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]
Date:	Wed,  4 Jun 2014 15:13:06 +0400
From:	nyushchenko@....rtsoft.ru
To:	Grant Likely <grant.likely@...aro.org>,
	Rob Herring <robh+dt@...nel.org>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	devicetree@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, lugovskoy@....rtsoft.ru,
	Nikita Yushchenko <nyushchenko@....rtsoft.ru>
Subject: [PATCH 06/21] mpc85xx_edac: use devm_irq_of_parse_and_map()

From: Nikita Yushchenko <nyushchenko@....rtsoft.ru>

This avoids calls to irq_dispose_mapping() while IRQ handler is still
installed.

Signed-off-by: Nikita Yushchenko <nyushchenko@....rtsoft.ru>
---
 drivers/edac/mpc85xx_edac.c |   41 +++++++++++++++++++++++++++++------------
 1 file changed, 29 insertions(+), 12 deletions(-)

diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index f4aec2e..a8b78d2 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -354,7 +354,15 @@ int mpc85xx_pci_err_probe(struct platform_device *op)
 	}
 
 	if (edac_op_state == EDAC_OPSTATE_INT) {
-		pdata->irq = irq_of_parse_and_map(op->dev.of_node, 0);
+		pdata->irq = devm_irq_of_parse_and_map(&op->dev,
+				op->dev.of_node, 0);
+		if (pdata->irq <= 0) {
+			printk(KERN_ERR
+			       "%s: Unable to locate irq for MPC85xx PCI err\n",
+			       __func__);
+			res = -ENODEV;
+			goto err2;
+		}
 		res = devm_request_irq(&op->dev, pdata->irq,
 				       mpc85xx_pci_isr,
 				       IRQF_SHARED,
@@ -363,7 +371,6 @@ int mpc85xx_pci_err_probe(struct platform_device *op)
 			printk(KERN_ERR
 			       "%s: Unable to request irq %d for "
 			       "MPC85xx PCI err\n", __func__, pdata->irq);
-			irq_dispose_mapping(pdata->irq);
 			res = -ENODEV;
 			goto err2;
 		}
@@ -631,7 +638,15 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)
 	}
 
 	if (edac_op_state == EDAC_OPSTATE_INT) {
-		pdata->irq = irq_of_parse_and_map(op->dev.of_node, 0);
+		pdata->irq = devm_irq_of_parse_and_map(&op->dev,
+				op->dev.of_node, 0);
+		if (pdata->irq <= 0) {
+			printk(KERN_ERR
+			       "%s: Unable to locate irq for MPC85xx L2 err\n",
+			       __func__);
+			res = -ENODEV;
+			goto err2;
+		}
 		res = devm_request_irq(&op->dev, pdata->irq,
 				       mpc85xx_l2_isr, 0,
 				       "[EDAC] L2 err", edac_dev);
@@ -639,7 +654,6 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)
 			printk(KERN_ERR
 			       "%s: Unable to request irq %d for "
 			       "MPC85xx L2 err\n", __func__, pdata->irq);
-			irq_dispose_mapping(pdata->irq);
 			res = -ENODEV;
 			goto err2;
 		}
@@ -674,10 +688,8 @@ static int mpc85xx_l2_err_remove(struct platform_device *op)
 
 	edac_dbg(0, "\n");
 
-	if (edac_op_state == EDAC_OPSTATE_INT) {
+	if (edac_op_state == EDAC_OPSTATE_INT)
 		out_be32(pdata->l2_vbase + MPC85XX_L2_ERRINTEN, 0);
-		irq_dispose_mapping(pdata->irq);
-	}
 
 	out_be32(pdata->l2_vbase + MPC85XX_L2_ERRDIS, orig_l2_err_disable);
 	edac_device_del_device(&op->dev);
@@ -1130,7 +1142,15 @@ static int mpc85xx_mc_err_probe(struct platform_device *op)
 		out_be32(pdata->mc_vbase + MPC85XX_MC_ERR_SBE, 0x10000);
 
 		/* register interrupts */
-		pdata->irq = irq_of_parse_and_map(op->dev.of_node, 0);
+		pdata->irq = devm_irq_of_parse_and_map(&op->dev,
+				op->dev.of_node, 0);
+		if (pdata->irq <= 0) {
+			printk(KERN_ERR
+			       "%s: Unable to locate irq for MPC85xx DRAM ERR\n",
+			       __func__);
+			res = -ENODEV;
+			goto err2;
+		}
 		res = devm_request_irq(&op->dev, pdata->irq,
 				       mpc85xx_mc_isr,
 				       IRQF_SHARED,
@@ -1138,7 +1158,6 @@ static int mpc85xx_mc_err_probe(struct platform_device *op)
 		if (res < 0) {
 			printk(KERN_ERR "%s: Unable to request irq %d for "
 			       "MPC85xx DRAM ERR\n", __func__, pdata->irq);
-			irq_dispose_mapping(pdata->irq);
 			res = -ENODEV;
 			goto err2;
 		}
@@ -1168,10 +1187,8 @@ static int mpc85xx_mc_err_remove(struct platform_device *op)
 
 	edac_dbg(0, "\n");
 
-	if (edac_op_state == EDAC_OPSTATE_INT) {
+	if (edac_op_state == EDAC_OPSTATE_INT)
 		out_be32(pdata->mc_vbase + MPC85XX_MC_ERR_INT_EN, 0);
-		irq_dispose_mapping(pdata->irq);
-	}
 
 	out_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DISABLE,
 		 orig_ddr_err_disable);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ