2020-09-07 13:10:22

by Zhang Changzhong

[permalink] [raw]
Subject: [PATCH net-next] net: xilinx: remove redundant null check before clk_disable_unprepare()

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 <[email protected]>
Signed-off-by: Zhang Changzhong <[email protected]>
---
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index fa5dc299..9aafd3e 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -2038,8 +2038,7 @@ static int axienet_remove(struct platform_device *pdev)

axienet_mdio_teardown(lp);

- if (lp->clk)
- clk_disable_unprepare(lp->clk);
+ clk_disable_unprepare(lp->clk);

of_node_put(lp->phy_node);
lp->phy_node = NULL;
--
2.9.5


2020-09-07 13:23:14

by Radhey Shyam Pandey

[permalink] [raw]
Subject: RE: [PATCH net-next] net: xilinx: remove redundant null check before clk_disable_unprepare()

> -----Original Message-----
> From: Zhang Changzhong <[email protected]>
> Sent: Monday, September 7, 2020 6:32 PM
> To: Radhey Shyam Pandey <[email protected]>; [email protected];
> [email protected]; Michal Simek <[email protected]>
> Cc: [email protected]; [email protected]
> Subject: [PATCH net-next] net: xilinx: remove redundant null check before
> clk_disable_unprepare()
>
> 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 <[email protected]>
> Signed-off-by: Zhang Changzhong <[email protected]>

Reviewed-by: Radhey Shyam Pandey <[email protected]>

Thanks!
> ---
> drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index fa5dc299..9aafd3e 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -2038,8 +2038,7 @@ static int axienet_remove(struct platform_device
> *pdev)
>
> axienet_mdio_teardown(lp);
>
> - if (lp->clk)
> - clk_disable_unprepare(lp->clk);
> + clk_disable_unprepare(lp->clk);
>
> of_node_put(lp->phy_node);
> lp->phy_node = NULL;
> --
> 2.9.5

2020-09-07 20:41:02

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH net-next] net: xilinx: remove redundant null check before clk_disable_unprepare()

On Mon, 7 Sep 2020 13:14:05 +0000 Radhey Shyam Pandey wrote:
> > From: Zhang Changzhong <[email protected]>
> > Sent: Monday, September 7, 2020 6:32 PM
> > To: Radhey Shyam Pandey <[email protected]>; [email protected];
> > [email protected]; Michal Simek <[email protected]>
> > Cc: [email protected]; [email protected]
> > Subject: [PATCH net-next] net: xilinx: remove redundant null check before
> > clk_disable_unprepare()
> >
> > 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 <[email protected]>
> > Signed-off-by: Zhang Changzhong <[email protected]>
>
> Reviewed-by: Radhey Shyam Pandey <[email protected]>

Applied, thanks!