From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
To: Wei Yongjun <weiyj.lk@gmail.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Wim Van Sebroeck <wim@iguana.be>,
Guenter Roeck <linux@roeck-us.net>,
Wei Yongjun <weiyongjun1@huawei.com>,
linux-watchdog@vger.kernel.org
Subject: Re: [PATCH -next] watchdog: wdat_wdt: fix return value check in wdat_wdt_probe()
Date: Wed, 28 Sep 2016 18:27:05 +0200 [thread overview]
Message-ID: <9a6eeb96-86db-b8b1-828c-694a50c6d389@intel.com> (raw)
In-Reply-To: <1475074286-13834-1-git-send-email-weiyj.lk@gmail.com>
On 9/28/2016 4:51 PM, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> In case of error, the function devm_ioremap_resource() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check should
> be replaced with IS_ERR().
>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Can you please CC your fixes to a mailing list,
linux-kernel@vger.kernel.org at least if you can't find a more specific one?
They are much easier to handle then, to me at least.
> ---
> drivers/watchdog/wdat_wdt.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c
> index 6b64645..4594723 100644
> --- a/drivers/watchdog/wdat_wdt.c
> +++ b/drivers/watchdog/wdat_wdt.c
> @@ -351,16 +351,17 @@ static int wdat_wdt_probe(struct platform_device *pdev)
> res = &pdev->resource[i];
> if (resource_type(res) == IORESOURCE_MEM) {
> reg = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(reg))
> + return PTR_ERR(reg);
> } else if (resource_type(res) == IORESOURCE_IO) {
> reg = devm_ioport_map(&pdev->dev, res->start, 1);
> + if (!reg)
> + return -ENOMEM;
> } else {
> dev_err(&pdev->dev, "Unsupported resource\n");
> return -EINVAL;
> }
>
> - if (!reg)
> - return -ENOMEM;
> -
> regs[i] = reg;
> }
Thanks,
Rafael
prev parent reply other threads:[~2016-09-28 16:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-28 14:51 [PATCH -next] watchdog: wdat_wdt: fix return value check in wdat_wdt_probe() Wei Yongjun
2016-09-28 14:59 ` Mika Westerberg
2016-09-28 21:50 ` Rafael J. Wysocki
2016-09-28 15:52 ` Guenter Roeck
2016-09-28 16:27 ` Rafael J. Wysocki [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=9a6eeb96-86db-b8b1-828c-694a50c6d389@intel.com \
--to=rafael.j.wysocki@intel.com \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mika.westerberg@linux.intel.com \
--cc=weiyj.lk@gmail.com \
--cc=weiyongjun1@huawei.com \
--cc=wim@iguana.be \
/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).