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

net/fsl: xgmac_mdio: fix return value check in xgmac_mdio_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: 1d14eb15dc2c ("net/fsl: xgmac_mdio: Use managed device resources")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Wei Yongjun and committed by
David S. Miller
cc4598cf 47ed9442

+2 -2
+2 -2
drivers/net/ethernet/freescale/xgmac_mdio.c
··· 335 335 priv = bus->priv; 336 336 priv->mdio_base = devm_ioremap(&pdev->dev, res->start, 337 337 resource_size(res)); 338 - if (IS_ERR(priv->mdio_base)) 339 - return PTR_ERR(priv->mdio_base); 338 + if (!priv->mdio_base) 339 + return -ENOMEM; 340 340 341 341 /* For both ACPI and DT cases, endianness of MDIO controller 342 342 * needs to be specified using "little-endian" property.