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

net: mdio-ipq4019: add missing error check

If an optional resource is found but fails to remap, return on failure.
Avoids any potential problems when using the iomapped resource as the
assumption is that it's available.

Fixes: 23a890d493e3 ("net: mdio: Add the reset function for IPQ MDIO driver")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20241121193152.8966-1-rosenp@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Rosen Penev and committed by
Paolo Abeni
9cc8d0ec 82159e6a

+4 -1
+4 -1
drivers/net/mdio/mdio-ipq4019.c
··· 352 352 /* The platform resource is provided on the chipset IPQ5018 */ 353 353 /* This resource is optional */ 354 354 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 355 - if (res) 355 + if (res) { 356 356 priv->eth_ldo_rdy = devm_ioremap_resource(&pdev->dev, res); 357 + if (IS_ERR(priv->eth_ldo_rdy)) 358 + return PTR_ERR(priv->eth_ldo_rdy); 359 + } 357 360 358 361 bus->name = "ipq4019_mdio"; 359 362 bus->read = ipq4019_mdio_read_c22;