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

phy: Sparx5 Eth SerDes: Fix return value check in sparx5_serdes_probe()

In case of error, the function devm_ioremap() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value
check should be replaced with NULL test.

Fixes: 2ff8a1eeb5aa ("phy: Add Sparx5 ethernet serdes PHY driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210909072149.2934047-1-yangyingliang@huawei.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Yang Yingliang and committed by
Vinod Koul
b4dc97ab b475bf0e

+2 -2
+2 -2
drivers/phy/microchip/sparx5_serdes.c
··· 2475 2475 return -EINVAL; 2476 2476 } 2477 2477 iomem = devm_ioremap(priv->dev, iores->start, resource_size(iores)); 2478 - if (IS_ERR(iomem)) { 2478 + if (!iomem) { 2479 2479 dev_err(priv->dev, "Unable to get serdes registers: %s\n", 2480 2480 iores->name); 2481 - return PTR_ERR(iomem); 2481 + return -ENOMEM; 2482 2482 } 2483 2483 for (idx = 0; idx < ARRAY_SIZE(sparx5_serdes_iomap); idx++) { 2484 2484 struct sparx5_serdes_io_resource *iomap = &sparx5_serdes_iomap[idx];