Skip to content

Commit 5577eec

Browse files
Wei Yongjungregkh
authored andcommitted
watchdog: jz4740: Fix return value check in jz4740_wdt_probe()
[ Upstream commit 29e85f5 ] 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: 6d53214 ("watchdog: jz4740: Use regmap provided by TCU driver") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Acked-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20210304045909.945799-1-weiyongjun1@huawei.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 3b93d52 commit 5577eec

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/watchdog/jz4740_wdt.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ static int jz4740_wdt_probe(struct platform_device *pdev)
176176
watchdog_set_drvdata(jz4740_wdt, drvdata);
177177

178178
drvdata->map = device_node_to_regmap(dev->parent->of_node);
179-
if (!drvdata->map) {
179+
if (IS_ERR(drvdata->map)) {
180180
dev_err(dev, "regmap not found\n");
181-
return -EINVAL;
181+
return PTR_ERR(drvdata->map);
182182
}
183183

184184
return devm_watchdog_register_device(dev, &drvdata->wdt);

0 commit comments

Comments
 (0)