Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wei Yongjun and committed by
Philipp Zabel
91105ed6 747aeec9

+2 -2
+2 -2
drivers/reset/reset-microchip-sparx5.c
··· 82 82 void __iomem *mem; 83 83 84 84 mem = devm_platform_get_and_ioremap_resource(pdev, index, &res); 85 - if (!mem) { 85 + if (IS_ERR(mem)) { 86 86 dev_err(&pdev->dev, "Could not map resource %d\n", index); 87 - return -ENXIO; 87 + return PTR_ERR(mem); 88 88 } 89 89 sparx5_reset_regmap_config.name = res->name; 90 90 map = devm_regmap_init_mmio(&pdev->dev, mem, &sparx5_reset_regmap_config);