Skip to contentSkip to conversation

irqchip: imx-mu-msi: fix platform_get_irq() error checking

PATCH In review Dan Carpenter 2 participants 2 messages Aug 12, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irqchip: imx-mu-msi: fix platform_get_irq() error checking

The platform_get_irq() function returns negative error codes on error so "gic_irq" needs to be signed to handle this correctly. Also change the "<= 0" check to "< 0" and preserve the error code as the documentation for platform_get_irq() shows.

Fixes 893ae515ff8d ("irqchip: imx mu worked as msi controller")
---
 drivers/irqchip/irq-imx-mu-msi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/irqchip/irq-imx-mu-msi.c +3 -3
index f7193a6c1245..97f3cdab8f58 100644
@@ -80,7 +80,7 @@ struct imx_mu_msi {
 	struct imx_mu_msir	*msir;
 	u32			irqs_num;
 	unsigned long		used;
-	u32			gic_irq;
+	int			gic_irq;
 	struct clk              *clk;
 	struct device		*pd_a;
 	struct device		*pd_b;
@@ -355,8 +355,8 @@ static int imx_mu_msi_probe(struct platform_device *pdev)
 	msi_data->irqs_num = IMX_MU_CHANS;
 
 	msi_data->gic_irq = platform_get_irq(msi_data->pdev, 0);
-	if (msi_data->gic_irq <= 0)
-		return -ENODEV;
+	if (msi_data->gic_irq < 0)
+		return msi_data->gic_irq;
 
 	platform_set_drvdata(pdev, msi_data);
 
Signature · 1 line
2.35.1
maintainer
#1 lore raw
Quoted 16 lines

-----Original Message-----
From: Dan Carpenter <[email protected]>
Sent: Friday, August 12, 2022 1:23 AM
To: Thomas Gleixner <[email protected]>; Frank Li <[email protected]>
Cc: Marc Zyngier <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; dl-linux- imx <[email protected]>; Jon Mason <[email protected]>; linux- [email protected]; [email protected]
Subject: [EXT] [PATCH] irqchip: imx-mu-msi: fix platform_get_irq() error checking

Caution: EXT Email

Quoted 8 lines

The platform_get_irq() function returns negative error codes on error so "gic_irq" needs to be signed to handle this correctly. Also change the "<= 0" check to "< 0" and preserve the error code as the documentation for platform_get_irq() shows.

Fixes 893ae515ff8d ("irqchip: imx mu worked as msi controller")

---

[Frank Li] Thanks, 893ae515ff8d should be under review. There are still some issue, which need be fixed. I am working on these. I will squash your patch into my next version.

Quoted 31 lines
 drivers/irqchip/irq-imx-mu-msi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/irqchip/irq-imx-mu- renamed from drivers/irqchip/irq-imx-mu-msi.c +0 -0

msi.c
index f7193a6c1245..97f3cdab8f58 100644

drivers/irqchip/irq-imx-mu-msi.c +3 -4
@@ -80,7 +80,7 @@ struct imx_mu_msi {
        struct imx_mu_msir      *msir;
        u32                     irqs_num;
        unsigned long           used;
-       u32                     gic_irq;
+       int                     gic_irq;
        struct clk              *clk;
        struct device           *pd_a;
        struct device           *pd_b;
@@ -355,8 +355,8 @@ static int imx_mu_msi_probe(struct platform_device
 *pdev)
        msi_data->irqs_num = IMX_MU_CHANS;
 
        msi_data->gic_irq = platform_get_irq(msi_data->pdev, 0);
-       if (msi_data->gic_irq <= 0)
-               return -ENODEV;
+       if (msi_data->gic_irq < 0)
+               return msi_data->gic_irq;
 
        platform_set_drvdata(pdev, msi_data);
 
--

2.35.1