Skip to content

Commit

Permalink
stmmac: dwmac-sunxi: Call exit cleanup function in probe error path
Browse files Browse the repository at this point in the history
dwmac-sunxi has 2 callbacks that were called from stmmac_platform as
part of the probe and remove sequences.

Ater the conversion of dwmac-sunxi into a standalone platform driver,
the .init function is called before calling into the stmmac driver
core, but .exit is not called to clean up if stmmac returns an error.

This patch fixes the probe error path. This properly cleans up and
releases resources when the driver core fails to probe.

Cc: Joachim Eastwood <manabian@gmail.com>
Fixes: 9a9e9a1 ("stmmac: dwmac-sunxi: turn setup callback into a
		      probe function")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Chen-Yu Tsai authored and David S. Miller committed Dec 14, 2015
1 parent 79462ad commit d856c16
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ static int sun7i_gmac_probe(struct platform_device *pdev)
if (ret)
return ret;

return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
if (ret)
sun7i_gmac_exit(pdev, plat_dat->bsp_priv);

return ret;
}

static const struct of_device_id sun7i_dwmac_match[] = {
Expand Down

0 comments on commit d856c16

Please sign in to comment.