RE: [PATCH net-next] net: ethernet: fec: remove redundant null check before clk_disable_unprepare()
From: Andy Duan
Date: Mon Sep 07 2020 - 13:46:16 EST
From: Zhang Changzhong <zhangchangzhong@xxxxxxxxxx> 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@xxxxxxxxxx>
> Signed-off-by: Zhang Changzhong <zhangchangzhong@xxxxxxxxxx>
Acked-by: Fugang Duan <fugang.duan@xxxxxxx>
> ---
> 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