mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RESEND PATCH] misc: atmel-ssc: Fix IRQ check in ssc_probe
@ 2022-06-01 12:30 Miaoqian Lin
  2022-06-06  7:41 ` Claudiu.Beznea
  0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2022-06-01 12:30 UTC (permalink / raw)
  To: Codrin Ciubotariu, Arnd Bergmann, Greg Kroah-Hartman,
	Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	Hans-Christian Egtvedt, Haavard Skinnemoen, Andrew Morton,
	linux-arm-kernel, linux-kernel
  Cc: linmq006

platform_get_irq() returns negative error number instead 0 on failure.
And the doc of platform_get_irq() provides a usage example:

    int irq = platform_get_irq(pdev, 0);
    if (irq < 0)
        return irq;

Fix the check of return value to catch errors correctly.

Fixes: eb1f2930609b ("Driver for the Atmel on-chip SSC on AT32AP and AT91")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/misc/atmel-ssc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index d6cd5537126c..69f9b0336410 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -232,9 +232,9 @@ static int ssc_probe(struct platform_device *pdev)
 	clk_disable_unprepare(ssc->clk);
 
 	ssc->irq = platform_get_irq(pdev, 0);
-	if (!ssc->irq) {
+	if (ssc->irq < 0) {
 		dev_dbg(&pdev->dev, "could not get irq\n");
-		return -ENXIO;
+		return ssc->irq;
 	}
 
 	mutex_lock(&user_lock);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RESEND PATCH] misc: atmel-ssc: Fix IRQ check in ssc_probe
  2022-06-01 12:30 [RESEND PATCH] misc: atmel-ssc: Fix IRQ check in ssc_probe Miaoqian Lin
@ 2022-06-06  7:41 ` Claudiu.Beznea
  0 siblings, 0 replies; 2+ messages in thread
From: Claudiu.Beznea @ 2022-06-06  7:41 UTC (permalink / raw)
  To: linmq006, Codrin.Ciubotariu, arnd, gregkh, Nicolas.Ferre,
	alexandre.belloni, hcegtvedt, hskinnemoen, akpm,
	linux-arm-kernel, linux-kernel

On 01.06.2022 15:30, Miaoqian Lin wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> platform_get_irq() returns negative error number instead 0 on failure.
> And the doc of platform_get_irq() provides a usage example:
> 
>     int irq = platform_get_irq(pdev, 0);
>     if (irq < 0)
>         return irq;
> 
> Fix the check of return value to catch errors correctly.
> 
> Fixes: eb1f2930609b ("Driver for the Atmel on-chip SSC on AT32AP and AT91")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>


> ---
>  drivers/misc/atmel-ssc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
> index d6cd5537126c..69f9b0336410 100644
> --- a/drivers/misc/atmel-ssc.c
> +++ b/drivers/misc/atmel-ssc.c
> @@ -232,9 +232,9 @@ static int ssc_probe(struct platform_device *pdev)
>         clk_disable_unprepare(ssc->clk);
> 
>         ssc->irq = platform_get_irq(pdev, 0);
> -       if (!ssc->irq) {
> +       if (ssc->irq < 0) {
>                 dev_dbg(&pdev->dev, "could not get irq\n");
> -               return -ENXIO;
> +               return ssc->irq;
>         }
> 
>         mutex_lock(&user_lock);
> --
> 2.25.1
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-06  7:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 12:30 [RESEND PATCH] misc: atmel-ssc: Fix IRQ check in ssc_probe Miaoqian Lin
2022-06-06  7:41 ` Claudiu.Beznea

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®