Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01e5943a authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by David S. Miller
Browse files

net: fec: drop check for clk==NULL before calling clk_*



clk_prepare, clk_enable and their counterparts (at least the common clk
ones, but also most others) do check for the clk being NULL anyhow (and
return 0 then), so there is no gain when the caller checks, too.

Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: default avatarFugang Duan <fugang.duan@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9652dc2e
Loading
Loading
Loading
Loading
+11 −14
Original line number Diff line number Diff line
@@ -1841,11 +1841,11 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
		ret = clk_prepare_enable(fep->clk_ahb);
		if (ret)
			return ret;
		if (fep->clk_enet_out) {

		ret = clk_prepare_enable(fep->clk_enet_out);
		if (ret)
			goto failed_clk_enet_out;
		}

		if (fep->clk_ptp) {
			mutex_lock(&fep->ptp_clk_mutex);
			ret = clk_prepare_enable(fep->clk_ptp);
@@ -1857,14 +1857,12 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
			}
			mutex_unlock(&fep->ptp_clk_mutex);
		}
		if (fep->clk_ref) {

		ret = clk_prepare_enable(fep->clk_ref);
		if (ret)
			goto failed_clk_ref;
		}
	} else {
		clk_disable_unprepare(fep->clk_ahb);
		if (fep->clk_enet_out)
		clk_disable_unprepare(fep->clk_enet_out);
		if (fep->clk_ptp) {
			mutex_lock(&fep->ptp_clk_mutex);
@@ -1872,7 +1870,6 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
			fep->ptp_clk_on = false;
			mutex_unlock(&fep->ptp_clk_mutex);
		}
		if (fep->clk_ref)
		clk_disable_unprepare(fep->clk_ref);
	}