mdio-sun4i: oops in error handling in probe
Subsystems (5)
PATCH 1/1 mdio-sun4i: oops in error handling in probe
We could end up dereferencing an error pointer when we call regulator_disable().
Fixes 4bdcb1dd9feb ('net: Add MDIO bus driver for the Allwinner EMAC')
Signed-off-by Dan Carpenter <[email protected]>
drivers/net/phy/mdio-sun4i.c +3 -1
@@ -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;
Quoted 5 lines · Dan Carpenter
We could end up dereferencing an error pointer when we call
regulator_disable().Fixes 4bdcb1dd9feb ('net: Add MDIO bus driver for the Allwinner EMAC')Signed-off-by Dan Carpenter <[email protected]>
Acked-by Chen-Yu Tsai <[email protected]>
From: Dan Carpenter <[email protected]>
Date: Mon, 21 Mar 2016 12:02:31 +0300
Quoted 5 lines
We could end up dereferencing an error pointer when we call
regulator_disable().Fixes 4bdcb1dd9feb ('net: Add MDIO bus driver for the Allwinner EMAC')Signed-off-by Dan Carpenter <[email protected]>
Applied, thanks Dan.