* [PATCH -next] watchdog: wdat_wdt: fix return value check in wdat_wdt_probe()
@ 2016-09-28 14:51 Wei Yongjun
2016-09-28 14:59 ` Mika Westerberg
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Wei Yongjun @ 2016-09-28 14:51 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Mika Westerberg, Rafael J. Wysocki
Cc: Wei Yongjun, linux-watchdog
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>
---
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;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH -next] watchdog: wdat_wdt: fix return value check in wdat_wdt_probe()
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
2 siblings, 1 reply; 5+ messages in thread
From: Mika Westerberg @ 2016-09-28 14:59 UTC (permalink / raw)
To: Wei Yongjun
Cc: Wim Van Sebroeck, Guenter Roeck, Rafael J. Wysocki, Wei Yongjun,
linux-watchdog
On Wed, Sep 28, 2016 at 02:51:26PM +0000, 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>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] watchdog: wdat_wdt: fix return value check in wdat_wdt_probe()
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 15:52 ` Guenter Roeck
2016-09-28 16:27 ` Rafael J. Wysocki
2 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2016-09-28 15:52 UTC (permalink / raw)
To: Wei Yongjun
Cc: Wim Van Sebroeck, Mika Westerberg, Rafael J. Wysocki,
Wei Yongjun, linux-watchdog
On Wed, Sep 28, 2016 at 02:51:26PM +0000, 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>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> 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;
> }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] watchdog: wdat_wdt: fix return value check in wdat_wdt_probe()
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 15:52 ` Guenter Roeck
@ 2016-09-28 16:27 ` Rafael J. Wysocki
2 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2016-09-28 16:27 UTC (permalink / raw)
To: Wei Yongjun, Mika Westerberg
Cc: Wim Van Sebroeck, Guenter Roeck, Wei Yongjun, linux-watchdog
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] watchdog: wdat_wdt: fix return value check in wdat_wdt_probe()
2016-09-28 14:59 ` Mika Westerberg
@ 2016-09-28 21:50 ` Rafael J. Wysocki
0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2016-09-28 21:50 UTC (permalink / raw)
To: Mika Westerberg, Wei Yongjun
Cc: Wim Van Sebroeck, Guenter Roeck, Wei Yongjun, linux-watchdog
On 9/28/2016 4:59 PM, Mika Westerberg wrote:
> On Wed, Sep 28, 2016 at 02:51:26PM +0000, 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>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Applied (with tags).
Thanks,
Rafael
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-09-28 21:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.