diff options
author | Rosen Penev <rosenp@gmail.com> | 2024-11-21 22:31:52 +0300 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2024-11-26 13:01:39 +0300 |
commit | 9cc8d0ecdd2aad42e377e971e3bb114339df609e (patch) | |
tree | 8e8fc27ab016dfdd6183fdf1bfea1033544480f8 /drivers | |
parent | 82159e6ab409bd7c3de4fafdc27d64a58bcb154a (diff) | |
download | linux-9cc8d0ecdd2aad42e377e971e3bb114339df609e.tar.xz |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/mdio/mdio-ipq4019.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/mdio/mdio-ipq4019.c b/drivers/net/mdio/mdio-ipq4019.c index dd3ed2d6430b..d9a94df482d9 100644 --- a/drivers/net/mdio/mdio-ipq4019.c +++ b/drivers/net/mdio/mdio-ipq4019.c @@ -352,8 +352,11 @@ static int ipq4019_mdio_probe(struct platform_device *pdev) /* The platform resource is provided on the chipset IPQ5018 */ /* This resource is optional */ res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (res) + if (res) { priv->eth_ldo_rdy = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(priv->eth_ldo_rdy)) + return PTR_ERR(priv->eth_ldo_rdy); + } bus->name = "ipq4019_mdio"; bus->read = ipq4019_mdio_read_c22; |