diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2021-05-19 14:16:37 +0000 |
---|---|---|
committer | Philipp Zabel <p.zabel@pengutronix.de> | 2021-06-07 11:26:31 +0200 |
commit | 91105ed604e4ea7075a35a1ef8bc1782d347290e (patch) | |
tree | c5f4ad4ddc664a3ad4aafa7295717486dd10a9b5 /drivers/reset | |
parent | 747aeec9ac0612fa107a6032d4e475112e8820fb (diff) |
reset: mchp: sparx5: fix return value check in mchp_sparx5_map_io()
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>
Link: https://lore.kernel.org/r/20210519141638.3052456-1-weiyongjun1@huawei.com
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'drivers/reset')
-rw-r--r-- | drivers/reset/reset-microchip-sparx5.c | 4 |
1 files 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); |