提交 227f33be 编写于 作者: D Dan Carpenter 提交者: 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: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NChen-Yu Tsai <wens@csie.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 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,7 +138,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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册