Re: [PATCH] watchdog: ftwdt010_wdt: fix test for platform_get_irq() failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le 11/08/2022 à 12:56, Dan Carpenter a écrit :
This code assumes that platform_get_irq() function returns zero on
failure.  In fact, platform_get_irq() never returns zero.  It returns
negative error codes or positive non-zero values on success.

Fixes: eca10ae6000d ("watchdog: add driver for Cortina Gemini watchdog")
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
  drivers/watchdog/ftwdt010_wdt.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/ftwdt010_wdt.c b/drivers/watchdog/ftwdt010_wdt.c
index 21dcc7765688..02112fc264bd 100644
--- a/drivers/watchdog/ftwdt010_wdt.c
+++ b/drivers/watchdog/ftwdt010_wdt.c
@@ -156,7 +156,7 @@ static int ftwdt010_wdt_probe(struct platform_device *pdev)
  	}
irq = platform_get_irq(pdev, 0);
-	if (irq) {
+	if (irq > 0) {
  		ret = devm_request_irq(dev, irq, ftwdt010_wdt_interrupt, 0,
  				       "watchdog bark", gwdt);
  		if (ret)

Hi,
can't platform_get_irq() return 0?
All the paths in platform_get_irq() look like 0 is a valid value.

The other patches you just sent are "< 0 ==> error", so ">= 0 ==> valid"

Any reason here for >0?

CJ



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux