From: Guenter Roeck <linux@roeck-us.net>
To: 'Wei Yongjun <weiyongjun1@huawei.com>
Cc: Paul Cercueil <paul@crapouillou.net>,
Wim Van Sebroeck <wim@linux-watchdog.org>,
linux-mips@vger.kernel.org, linux-watchdog@vger.kernel.org,
kernel-janitors@vger.kernel.org, Hulk Robot <hulkci@huawei.com>
Subject: Re: [PATCH -next] watchdog: jz4740: Fix return value check in jz4740_wdt_probe()
Date: Mon, 17 May 2021 15:36:08 -0700 [thread overview]
Message-ID: <20210517223608.GA3628982@roeck-us.net> (raw)
In-Reply-To: <20210304045909.945799-1-weiyongjun1@huawei.com>
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);
prev parent reply other threads:[~2021-05-17 22:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210517223608.GA3628982@roeck-us.net \
--to=linux@roeck-us.net \
--cc=hulkci@huawei.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=paul@crapouillou.net \
--cc=weiyongjun1@huawei.com \
--cc=wim@linux-watchdog.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).