Commit d8eb6ea4 authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Paolo Abeni
Browse files

net: ravb: Check return value of reset_control_deassert()



reset_control_deassert() could return an error. Some devices cannot work
if reset signal de-assert operation fails. To avoid this check the return
code of reset_control_deassert() in ravb_probe() and take proper action.

Along with it, the free_netdev() call from the error path was moved after
reset_control_assert() on its own label (out_free_netdev) to free
netdev in case reset_control_deassert() fails.

Fixes: 0d13a1a4 ("ravb: Add reset support")
Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 91fdb30d
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -2654,7 +2654,10 @@ static int ravb_probe(struct platform_device *pdev)
	ndev->features = info->net_features;
	ndev->hw_features = info->net_hw_features;

	reset_control_deassert(rstc);
	error = reset_control_deassert(rstc);
	if (error)
		goto out_free_netdev;

	pm_runtime_enable(&pdev->dev);
	pm_runtime_get_sync(&pdev->dev);

@@ -2881,11 +2884,11 @@ static int ravb_probe(struct platform_device *pdev)
out_disable_refclk:
	clk_disable_unprepare(priv->refclk);
out_release:
	free_netdev(ndev);

	pm_runtime_put(&pdev->dev);
	pm_runtime_disable(&pdev->dev);
	reset_control_assert(rstc);
out_free_netdev:
	free_netdev(ndev);
	return error;
}