Message ID | 1599482984-42783-1-git-send-email-zhangchangzhong@huawei.com |
---|---|
State | Accepted |
Delegated to: | David Miller |
Headers | show |
Series | [net-next] net: ethernet: fec: remove redundant null check before clk_disable_unprepare() | expand |
From: Zhang Changzhong <zhangchangzhong@huawei.com> Sent: Monday, September 7, 2020 8:50 PM > Because clk_prepare_enable() and clk_disable_unprepare() already checked > NULL clock parameter, so the additional checks are unnecessary, just remove > them. > > Reported-by: Hulk Robot <hulkci@huawei.com> > Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com> Acked-by: Fugang Duan <fugang.duan@nxp.com> > --- > drivers/net/ethernet/freescale/fec_main.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/freescale/fec_main.c > b/drivers/net/ethernet/freescale/fec_main.c > index fb37816..c043afb 100644 > --- a/drivers/net/ethernet/freescale/fec_main.c > +++ b/drivers/net/ethernet/freescale/fec_main.c > @@ -1960,8 +1960,7 @@ static int fec_enet_clk_enable(struct net_device > *ndev, bool enable) > mutex_unlock(&fep->ptp_clk_mutex); > } > failed_clk_ptp: > - if (fep->clk_enet_out) > - clk_disable_unprepare(fep->clk_enet_out); > + clk_disable_unprepare(fep->clk_enet_out); > > return ret; > } > -- > 2.9.5
On Mon, 7 Sep 2020 13:14:50 +0000 Andy Duan wrote: > From: Zhang Changzhong <zhangchangzhong@huawei.com> Sent: Monday, September 7, 2020 8:50 PM > > Because clk_prepare_enable() and clk_disable_unprepare() already checked > > NULL clock parameter, so the additional checks are unnecessary, just remove > > them. > > > > Reported-by: Hulk Robot <hulkci@huawei.com> > > Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com> > > Acked-by: Fugang Duan <fugang.duan@nxp.com> Applied, thanks!
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index fb37816..c043afb 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1960,8 +1960,7 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable) mutex_unlock(&fep->ptp_clk_mutex); } failed_clk_ptp: - if (fep->clk_enet_out) - clk_disable_unprepare(fep->clk_enet_out); + clk_disable_unprepare(fep->clk_enet_out); return ret; }
Because clk_prepare_enable() and clk_disable_unprepare() already checked NULL clock parameter, so the additional checks are unnecessary, just remove them. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com> --- drivers/net/ethernet/freescale/fec_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)