Skip to contentSkip to conversation

clk: visconti: Remove pointless NULL check in visconti_pll_add_lookup()

PATCH Applied Nathan Chancellor 3 participants 3 messages Jan 7, 2022 – Jan 11, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: visconti: Remove pointless NULL check in visconti_pll_add_lookup()

Clang warns:

drivers/clk/visconti/pll.c:292:20: warning: address of array 'ctx->clk_data.hws' will always evaluate to 'true' [-Wpointer-bool-conversion]

        if (ctx->clk_data.hws && id)
            ~~~~~~~~~~~~~~^~~ ~~

1 warning generated.

This array cannot be NULL if ctx is not NULL, which is allocated in visconti_init_pll(), so just remove the check, which matches other clk drivers.

Fixes b4cbe606dc36 ("clk: visconti: Add support common clock driver and reset driver")
---
 drivers/clk/visconti/pll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/visconti/pll.c +1 -1
index 3b6e88bb73d5..a2398bc6c6e4 100644
@@ -289,7 +289,7 @@ static void visconti_pll_add_lookup(struct visconti_pll_provider *ctx,
 				    struct clk_hw *hw_clk,
 				    unsigned int id)
 {
-	if (ctx->clk_data.hws && id)
+	if (id)
 		ctx->clk_data.hws[id] = hw_clk;
 }
 

base-commit: 70faf946ad975c64efb2eb809f9139f304a494b0

Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw

Quoting Nathan Chancellor (2022-01-07 10:33:03)

Quoted 11 lines

Clang warns:

drivers/clk/visconti/pll.c:292:20: warning: address of array 'ctx->clk_data.hws' will always evaluate to 'true' [-Wpointer-bool-conversion]

        if (ctx->clk_data.hws && id)
            ~~~~~~~~~~~~~~^~~ ~~

1 warning generated.

This array cannot be NULL if ctx is not NULL, which is allocated in visconti_init_pll(), so just remove the check, which matches other clk drivers.

Quoted 5 lines
Fixes b4cbe606dc36 ("clk: visconti: Add support common clock driver and reset driver")

---

Applied to clk-next

Acked-by on v1 1/1
#2 lore raw
In reply to Nathan Chancellor

Hi Nathan,

Thanks for your patch.

Quoted 24 lines

-----Original Message-----
From: Nathan Chancellor <[email protected]>
Sent: Saturday, January 8, 2022 3:33 AM
To: Michael Turquette <[email protected]>; Stephen Boyd <[email protected]>; iwamatsu nobuhiro(岩松 信洋 □SWC◯ACT) <[email protected]>
Cc: Nick Desaulniers <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Nathan Chancellor <[email protected]>; kernel test robot <[email protected]>
Subject: [PATCH] clk: visconti: Remove pointless NULL check in visconti_pll_add_lookup()

Clang warns:

drivers/clk/visconti/pll.c:292:20: warning: address of array 'ctx->clk_data.hws' will always evaluate to 'true' [-Wpointer-bool-conversion]

        if (ctx->clk_data.hws && id)
            ~~~~~~~~~~~~~~^~~ ~~

1 warning generated.

This array cannot be NULL if ctx is not NULL, which is allocated in visconti_init_pll(), so just remove the check, which matches other clk drivers.

Quoted 8 lines
Fixes b4cbe606dc36 ("clk: visconti: Add support common clock driver and

reset driver")

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

Best regards,
Nobuhiro