lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210618061516.662-47-jslaby@suse.cz>
Date:   Fri, 18 Jun 2021 08:14:52 +0200
From:   Jiri Slaby <jslaby@...e.cz>
To:     gregkh@...uxfoundation.org
Cc:     linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jiri Slaby <jslaby@...e.cz>
Subject: [PATCH 46/70] mxser: move request irq to probe and switch to managed

Move request_irq from mxser_initbrd to mxser_probe so that we can switch
it to managed request. It simplifies the cleanup code.

Signed-off-by: Jiri Slaby <jslaby@...e.cz>
---
 drivers/tty/mxser.c | 30 +++++++++---------------------
 1 file changed, 9 insertions(+), 21 deletions(-)

diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index be58ee025180..83c795acdb19 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -1883,11 +1883,10 @@ static const struct tty_port_operations mxser_port_ops = {
  * The MOXA Smartio/Industio serial driver boot-time initialization code!
  */
 
-static int mxser_initbrd(struct mxser_board *brd)
+static void mxser_initbrd(struct mxser_board *brd)
 {
 	struct mxser_port *info;
 	unsigned int i;
-	int retval;
 	bool is_mu860;
 
 	brd->must_hwid = mxser_must_get_hwid(brd->ports[0].ioaddr);
@@ -1939,18 +1938,6 @@ static int mxser_initbrd(struct mxser_board *brd)
 		outb(inb(info->ioaddr + UART_IER) & 0xf0,
 			info->ioaddr + UART_IER);
 	}
-
-	retval = request_irq(brd->irq, mxser_interrupt, IRQF_SHARED, "mxser",
-			brd);
-	if (retval) {
-		for (i = 0; i < brd->info->nports; i++)
-			tty_port_destroy(&brd->ports[i].port);
-		printk(KERN_ERR "Board %s: Request irq failed, IRQ (%d) may "
-			"conflict with another device.\n",
-			brd->info->name, brd->irq);
-	}
-
-	return retval;
 }
 
 static int mxser_probe(struct pci_dev *pdev,
@@ -2004,10 +1991,14 @@ static int mxser_probe(struct pci_dev *pdev,
 	/* irq */
 	brd->irq = pdev->irq;
 
-	/* mxser_initbrd will hook ISR. */
-	retval = mxser_initbrd(brd);
-	if (retval)
-		goto err_zero;
+	mxser_initbrd(brd);
+
+	retval = devm_request_irq(&pdev->dev, brd->irq, mxser_interrupt,
+			IRQF_SHARED, "mxser", brd);
+	if (retval) {
+		dev_err(&pdev->dev, "request irq failed");
+		goto err_relbrd;
+	}
 
 	for (i = 0; i < brd->info->nports; i++) {
 		tty_dev = tty_port_register_device(&brd->ports[i].port,
@@ -2027,7 +2018,6 @@ static int mxser_probe(struct pci_dev *pdev,
 err_relbrd:
 	for (i = 0; i < brd->info->nports; i++)
 		tty_port_destroy(&brd->ports[i].port);
-	free_irq(brd->irq, brd);
 err_zero:
 	brd->info = NULL;
 err:
@@ -2044,8 +2034,6 @@ static void mxser_remove(struct pci_dev *pdev)
 		tty_port_destroy(&brd->ports[i].port);
 	}
 
-	free_irq(brd->irq, brd);
-
 	brd->info = NULL;
 }
 
-- 
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ