Commit 227f33be authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

mdio-sun4i: oops in error handling in probe

We could end up dereferencing an error pointer when we call
regulator_disable().

Fixes: 4bdcb1dd ('net: Add MDIO bus driver for the Allwinner EMAC')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarChen-Yu Tsai <wens@csie.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent abc34d75
......@@ -122,6 +122,7 @@ static int sun4i_mdio_probe(struct platform_device *pdev)
return -EPROBE_DEFER;
dev_info(&pdev->dev, "no regulator found\n");
data->regulator = NULL;
} else {
ret = regulator_enable(data->regulator);
if (ret)
......@@ -137,6 +138,7 @@ static int sun4i_mdio_probe(struct platform_device *pdev)
return 0;
err_out_disable_regulator:
if (data->regulator)
regulator_disable(data->regulator);
err_out_free_mdiobus:
mdiobus_free(bus);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment