Commit c8fd1825 authored by Dan Carpenter's avatar Dan Carpenter Committed by Kamal Mostafa

mdio-sun4i: oops in error handling in probe

commit 227f33be upstream.

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>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 181e4533
......@@ -132,6 +132,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)
......@@ -147,7 +148,8 @@ static int sun4i_mdio_probe(struct platform_device *pdev)
return 0;
err_out_disable_regulator:
regulator_disable(data->regulator);
if (data->regulator)
regulator_disable(data->regulator);
err_out_free_mdiobus:
mdiobus_free(bus);
return ret;
......
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