linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] watchdog: jz4740: Fix return value check in jz4740_wdt_probe()
@ 2021-03-04  4:59 'Wei Yongjun
  2021-03-07 15:55 ` Paul Cercueil
  2021-05-17 22:36 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: 'Wei Yongjun @ 2021-03-04  4:59 UTC (permalink / raw)
  To: weiyongjun1, Paul Cercueil, Wim Van Sebroeck, Guenter Roeck
  Cc: linux-mips, linux-watchdog, kernel-janitors, Hulk Robot

From: Wei Yongjun <weiyongjun1@huawei.com>

In case of error, the function device_node_to_regmap() returns
ERR_PTR() and never returns NULL. The NULL test in the return
value check should be replaced with IS_ERR().

Fixes: 6d532143c915 ("watchdog: jz4740: Use regmap provided by TCU driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/watchdog/jz4740_wdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c
index bdf9564efa29..395bde79e292 100644
--- a/drivers/watchdog/jz4740_wdt.c
+++ b/drivers/watchdog/jz4740_wdt.c
@@ -176,9 +176,9 @@ static int jz4740_wdt_probe(struct platform_device *pdev)
 	watchdog_set_drvdata(jz4740_wdt, drvdata);
 
 	drvdata->map = device_node_to_regmap(dev->parent->of_node);
-	if (!drvdata->map) {
+	if (IS_ERR(drvdata->map)) {
 		dev_err(dev, "regmap not found\n");
-		return -EINVAL;
+		return PTR_ERR(drvdata->map);
 	}
 
 	return devm_watchdog_register_device(dev, &drvdata->wdt);


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

end of thread, other threads:[~2021-05-17 22:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-04  4:59 [PATCH -next] watchdog: jz4740: Fix return value check in jz4740_wdt_probe() 'Wei Yongjun
2021-03-07 15:55 ` Paul Cercueil
2021-05-17 22:36 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).