mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] clk: actions: owl-pll: cast delay to unsigned long for uelay()
@ 2026-09-04 21:50 Rosen Penev
  2026-09-12  0:02 ` Brian Masney
  0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-09-04 21:50 UTC (permalink / raw)
  To: linux-clk
  Cc: Stephen Boyd, Brian Masney, Jerome Brunet, Andreas Färber,
	Manivannan Sadhasivam,
	moderated list:ARM/ACTIONS SEMI ARCHITECTURE,
	moderated list:ARM/ACTIONS SEMI ARCHITECTURE, open list

The 'delay' field in struct owl_pll_hw is u8, but udelay() internally
compares its argument against MAX_UDELAY_MS * 1000 (2000). Since a u8
can never exceed 255, the compiler warns of a tautological comparison
that is always false:

  drivers/clk/actions/owl-pll.c:189:2: error: result of comparison of
  constant 2000 with expression of type 'u8' is always false

Cast the delay value to unsigned long to widen the type and silence the
warning without changing behavior.

Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/clk/actions/owl-pll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/actions/owl-pll.c b/drivers/clk/actions/owl-pll.c
index 869690b79cc1..5e30ce35f2f5 100644
--- a/drivers/clk/actions/owl-pll.c
+++ b/drivers/clk/actions/owl-pll.c
@@ -186,7 +186,7 @@ static int owl_pll_set_rate(struct clk_hw *hw, unsigned long rate,
 
 	regmap_write(common->regmap, pll_hw->reg, reg);
 
-	udelay(pll_hw->delay);
+	udelay((unsigned long)pll_hw->delay);
 
 	return 0;
 }
-- 
2.55.0


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

* Re: [PATCH] clk: actions: owl-pll: cast delay to unsigned long for uelay()
  2026-09-04 21:50 [PATCH] clk: actions: owl-pll: cast delay to unsigned long for uelay() Rosen Penev
@ 2026-09-12  0:02 ` Brian Masney
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Masney @ 2026-09-12  0:02 UTC (permalink / raw)
  To: Rosen Penev
  Cc: linux-clk, Stephen Boyd, Brian Masney, Jerome Brunet,
	Andreas Färber, Manivannan Sadhasivam,
	moderated list:ARM/ACTIONS SEMI ARCHITECTURE,
	moderated list:ARM/ACTIONS SEMI ARCHITECTURE, open list

Hi Rosen,

The subject has a typo: s/uelay/udelay/

On Fri, Sep 04, 2026 at 02:50:13PM -0700, Rosen Penev wrote:
> The 'delay' field in struct owl_pll_hw is u8, but udelay() internally
> compares its argument against MAX_UDELAY_MS * 1000 (2000). Since a u8
> can never exceed 255, the compiler warns of a tautological comparison
> that is always false:
> 
>   drivers/clk/actions/owl-pll.c:189:2: error: result of comparison of
>   constant 2000 with expression of type 'u8' is always false
> 
> Cast the delay value to unsigned long to widen the type and silence the
> warning without changing behavior.

Just to clarify: This only shows up with a W=1 build, right? If so, it
would be good to clarify that in the commit message.

> 
> Assisted-by: opencode:big-pickle

The new guidance is:

Assisted-by: LLM

Brian


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

end of thread, other threads:[~2026-09-12  0:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-04 21:50 [PATCH] clk: actions: owl-pll: cast delay to unsigned long for uelay() Rosen Penev
2026-09-12  0:02 ` Brian Masney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®