* [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
* Re: [PATCH -next] watchdog: jz4740: Fix return value check in jz4740_wdt_probe()
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
1 sibling, 0 replies; 3+ messages in thread
From: Paul Cercueil @ 2021-03-07 15:55 UTC (permalink / raw)
To: 'Wei Yongjun
Cc: Wim Van Sebroeck, Guenter Roeck, linux-mips, linux-watchdog,
kernel-janitors, Hulk Robot
Le jeu. 4 mars 2021 à 4:59, 'Wei Yongjun <weiyongjun1@huawei.com> a
écrit :
> 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>
Acked-by: Paul Cercueil <paul@crapouillou.net>
Cheers,
-Paul
> ---
> 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 [flat|nested] 3+ messages in thread
* Re: [PATCH -next] watchdog: jz4740: Fix return value check in jz4740_wdt_probe()
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
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2021-05-17 22:36 UTC (permalink / raw)
To: 'Wei Yongjun
Cc: Paul Cercueil, Wim Van Sebroeck, linux-mips, linux-watchdog,
kernel-janitors, Hulk Robot
On Thu, Mar 04, 2021 at 04:59:09AM +0000, 'Wei Yongjun wrote:
> 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>
> Acked-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> 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 [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).