* [PATCH -next] reset: mchp: sparx5: fix return value check in mchp_sparx5_map_io()
@ 2021-05-19 14:16 Wei Yongjun
2021-06-07 9:23 ` Philipp Zabel
0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2021-05-19 14:16 UTC (permalink / raw)
To: weiyongjun1, Steen Hegelund, Philipp Zabel, Lars Povlsen,
Steen Hegelund, UNGLinuxDriver
Cc: linux-arm-kernel, linux-kernel, kernel-janitors, Hulk Robot
In case of error, the function devm_platform_get_and_ioremap_resource()
returns ERR_PTR() and never returns NULL. The NULL test in the return
value check should be replaced with IS_ERR().
Fixes: 453ed4283beb ("reset: mchp: sparx5: add switch reset driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
drivers/reset/reset-microchip-sparx5.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/reset/reset-microchip-sparx5.c b/drivers/reset/reset-microchip-sparx5.c
index cff39a643a14..f01e7db8e83b 100644
--- a/drivers/reset/reset-microchip-sparx5.c
+++ b/drivers/reset/reset-microchip-sparx5.c
@@ -82,9 +82,9 @@ static int mchp_sparx5_map_io(struct platform_device *pdev, int index,
void __iomem *mem;
mem = devm_platform_get_and_ioremap_resource(pdev, index, &res);
- if (!mem) {
+ if (IS_ERR(mem)) {
dev_err(&pdev->dev, "Could not map resource %d\n", index);
- return -ENXIO;
+ return PTR_ERR(mem);
}
sparx5_reset_regmap_config.name = res->name;
map = devm_regmap_init_mmio(&pdev->dev, mem, &sparx5_reset_regmap_config);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] reset: mchp: sparx5: fix return value check in mchp_sparx5_map_io()
2021-05-19 14:16 [PATCH -next] reset: mchp: sparx5: fix return value check in mchp_sparx5_map_io() Wei Yongjun
@ 2021-06-07 9:23 ` Philipp Zabel
2021-06-07 9:33 ` Philipp Zabel
0 siblings, 1 reply; 3+ messages in thread
From: Philipp Zabel @ 2021-06-07 9:23 UTC (permalink / raw)
To: Wei Yongjun, Steen Hegelund, Lars Povlsen, UNGLinuxDriver
Cc: linux-arm-kernel, linux-kernel, kernel-janitors, Hulk Robot
On Wed, 2021-05-19 at 14:16 +0000, Wei Yongjun wrote:
> In case of error, the function devm_platform_get_and_ioremap_resource()
> returns ERR_PTR() and never returns NULL. The NULL test in the return
> value check should be replaced with IS_ERR().
>
> Fixes: 453ed4283beb ("reset: mchp: sparx5: add switch reset driver")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Thank you, applied to reset/fixes.
regards
Philipp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] reset: mchp: sparx5: fix return value check in mchp_sparx5_map_io()
2021-06-07 9:23 ` Philipp Zabel
@ 2021-06-07 9:33 ` Philipp Zabel
0 siblings, 0 replies; 3+ messages in thread
From: Philipp Zabel @ 2021-06-07 9:33 UTC (permalink / raw)
To: Wei Yongjun, Steen Hegelund, Lars Povlsen, UNGLinuxDriver
Cc: linux-arm-kernel, linux-kernel, kernel-janitors, Hulk Robot
On Mon, 2021-06-07 at 11:23 +0200, Philipp Zabel wrote:
> On Wed, 2021-05-19 at 14:16 +0000, Wei Yongjun wrote:
> > In case of error, the function devm_platform_get_and_ioremap_resource()
> > returns ERR_PTR() and never returns NULL. The NULL test in the return
> > value check should be replaced with IS_ERR().
> >
> > Fixes: 453ed4283beb ("reset: mchp: sparx5: add switch reset driver")
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
>
> Thank you, applied to reset/fixes.
^^^^^^^^^^^
reset/next, not fixes.
regards
Philipp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-07 9:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 14:16 [PATCH -next] reset: mchp: sparx5: fix return value check in mchp_sparx5_map_io() Wei Yongjun
2021-06-07 9:23 ` Philipp Zabel
2021-06-07 9:33 ` Philipp Zabel
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).