linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next][V2] soc: xilinx: vcu: fix error check on clk_hw_get_parent call
@ 2021-02-11  9:57 Colin King
  2021-02-11 11:30 ` Michael Tretter
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2021-02-11  9:57 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Michal Simek, Michael Tretter,
	linux-clk, linux-arm-kernel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently the check for failur on the call to clk_hw_get_parent
is checking for a null return in the divider pointer instead of
checking the mux pointer. Fix this.

Thanks to Michael Tretter for suggesting the correct fix.

Addresses-Coverity: ("Logically Dead Code")
Fixes: 9c789deea206 ("soc: xilinx: vcu: implement clock provider for output clocks")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---

V2: Check on mux pointer rather than removing deadcode that wasn't
    actually really dead code.

---
 drivers/clk/xilinx/xlnx_vcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/xilinx/xlnx_vcu.c b/drivers/clk/xilinx/xlnx_vcu.c
index d66b1315114e..256b8c4b9ee4 100644
--- a/drivers/clk/xilinx/xlnx_vcu.c
+++ b/drivers/clk/xilinx/xlnx_vcu.c
@@ -512,7 +512,7 @@ static void xvcu_clk_hw_unregister_leaf(struct clk_hw *hw)
 
 	mux = clk_hw_get_parent(divider);
 	clk_hw_unregister_mux(mux);
-	if (!divider)
+	if (!mux)
 		return;
 
 	clk_hw_unregister_divider(divider);
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next][V2] soc: xilinx: vcu: fix error check on clk_hw_get_parent call
  2021-02-11  9:57 [PATCH][next][V2] soc: xilinx: vcu: fix error check on clk_hw_get_parent call Colin King
@ 2021-02-11 11:30 ` Michael Tretter
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Tretter @ 2021-02-11 11:30 UTC (permalink / raw)
  To: Colin King
  Cc: Michael Turquette, Stephen Boyd, Michal Simek, linux-clk,
	linux-arm-kernel, kernel-janitors, linux-kernel

On Thu, 11 Feb 2021 09:57:00 +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently the check for failur on the call to clk_hw_get_parent
> is checking for a null return in the divider pointer instead of
> checking the mux pointer. Fix this.
> 
> Thanks to Michael Tretter for suggesting the correct fix.

Thanks!

> 
> Addresses-Coverity: ("Logically Dead Code")
> Fixes: 9c789deea206 ("soc: xilinx: vcu: implement clock provider for output clocks")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> 
> V2: Check on mux pointer rather than removing deadcode that wasn't
>     actually really dead code.
> 
> ---
>  drivers/clk/xilinx/xlnx_vcu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/xilinx/xlnx_vcu.c b/drivers/clk/xilinx/xlnx_vcu.c
> index d66b1315114e..256b8c4b9ee4 100644
> --- a/drivers/clk/xilinx/xlnx_vcu.c
> +++ b/drivers/clk/xilinx/xlnx_vcu.c
> @@ -512,7 +512,7 @@ static void xvcu_clk_hw_unregister_leaf(struct clk_hw *hw)
>  
>  	mux = clk_hw_get_parent(divider);
>  	clk_hw_unregister_mux(mux);

The mux should be unregistered after the check

> -	if (!divider)
> +	if (!mux)
>  		return;
>  
>  	clk_hw_unregister_divider(divider);

and the divider before the check.

Michael

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-11 11:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11  9:57 [PATCH][next][V2] soc: xilinx: vcu: fix error check on clk_hw_get_parent call Colin King
2021-02-11 11:30 ` Michael Tretter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).