Skip to contentSkip to conversation

ASoC: renesas: fsi: Propagate platform_get_irq() errors

PATCH Superseded Narasimharao Vadlamudi 3 participants 3 messages Jun 29 – Jun 30

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: renesas: fsi: Propagate platform_get_irq() errors

platform_get_irq() returns a negative error code on failure. The driver currently stores the return value in an unsigned int and returns -ENODEV for all failures, which loses useful errors such as -EPROBE_DEFER.

Store the IRQ in an int and return the error from platform_get_irq() directly.

---
 sound/soc/renesas/fsi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
sound/soc/renesas/fsi.c +6 -3
index ae86014c3819..6be6587e1095 100644
@@ -1992,7 +1992,7 @@ static int fsi_probe(struct platform_device *pdev)
 	const struct fsi_core *core;
 	struct fsi_priv *fsi;
 	struct resource *res;
-	unsigned int irq;
+	int irq;
 	int ret;
 
 	memset(&info, 0, sizeof(info));
@@ -2007,12 +2007,15 @@ static int fsi_probe(struct platform_device *pdev)
 	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	irq = platform_get_irq(pdev, 0);
-	if (!res || (int)irq <= 0) {
+	if (!res) {
 		dev_err(&pdev->dev, "Not enough FSI platform resources.\n");
 		return -ENODEV;
 	}
 
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
+
 	master = devm_kzalloc(&pdev->dev, sizeof(*master), GFP_KERNEL);
 	if (!master)
 		return -ENOMEM;
Signature · 1 line
2.43.0
maintainer Acked-by on v1 1/1
#1 lore raw

Hi Narasimharao

Quoted 10 lines

platform_get_irq() returns a negative error code on failure. The driver currently stores the return value in an unsigned int and returns

(quoted diff) +0 -2
-ENODEV for all failures, which loses useful errors such as
-EPROBE_DEFER.

Store the IRQ in an int and return the error from platform_get_irq() directly.

---

Thank you for your help !!

Best regards
---
Kuninori Morimoto

Reviewed-by on v1 1/1
#2 lore raw
In reply to Narasimharao Vadlamudi

Hi Narasimharao,

Quoted 9 lines · Narasimharao Vadlamudi

platform_get_irq() returns a negative error code on failure. The driver currently stores the return value in an unsigned int and returns

(quoted diff) +0 -2
-ENODEV for all failures, which loses useful errors such as
-EPROBE_DEFER.

Store the IRQ in an int and return the error from platform_get_irq() directly.

Thanks for your patch!

Quoted 12 lines
sound/soc/renesas/fsi.c +1 -1
@@ -1992,7 +1992,7 @@ static int fsi_probe(struct platform_device *pdev)
        const struct fsi_core *core;
        struct fsi_priv *fsi;
        struct resource *res;
-       unsigned int irq;
+       int irq;
        int ret;
 
        memset(&info, 0, sizeof(info));

sound/soc/renesas/fsi.c static int fsi_probe(struct platform_device *pdev) · line 2011

Quoted 5 lines
sound/soc/renesas/fsi.c +0 -2
@@ -2007,12 +2007,15 @@ static int fsi_probe(struct platform_device *pdev)
        }
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       irq = platform_get_irq(pdev, 0);
-       if (!res || (int)irq <= 0) {

This check also covered irq == 0, but that can indeed no longer happen. Might be good to mention that in the commit message.

sound/soc/renesas/fsi.c static int fsi_probe(struct platform_device *pdev) · line 2021

Quoted 12 lines
sound/soc/renesas/fsi.c +5 -0
+       if (!res) {
                dev_err(&pdev->dev, "Not enough FSI platform resources.\n");
                return -ENODEV;
        }
 
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0)
+               return irq;
+
        master = devm_kzalloc(&pdev->dev, sizeof(*master), GFP_KERNEL);
        if (!master)
                return -ENOMEM;

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds