lkml.org 
[lkml]   [2022]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mfd: ipaq-micro: Fix IRQ check in micro_probe
Date
platform_get_irq() returns non-zero IRQ number on success,
negative error number 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: dcc21cc09e3c2 ("mfd: Add driver for Atmel Microcontroller on iPaq h3xxx")
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
drivers/mfd/ipaq-micro.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/ipaq-micro.c b/drivers/mfd/ipaq-micro.c
index e92eeeb67a98..ac042bfd38a8 100644
--- a/drivers/mfd/ipaq-micro.c
+++ b/drivers/mfd/ipaq-micro.c
@@ -403,8 +403,8 @@ static int __init micro_probe(struct platform_device *pdev)
micro_reset_comm(micro);

irq = platform_get_irq(pdev, 0);
- if (!irq)
- return -EINVAL;
+ if (irq < 0)
+ return irq;
ret = devm_request_irq(&pdev->dev, irq, micro_serial_isr,
IRQF_SHARED, "ipaq-micro",
micro);
--
2.17.1
\
 
 \ /
  Last update: 2022-05-26 03:16    [W:0.043 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site