* [PATCH] clk: sunxi: Fix operator precedence in sunxi_divs_clk_setup
@ 2019-10-22 16:50 Nathan Chancellor
2019-10-29 7:43 ` Maxime Ripard
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2019-10-22 16:50 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: Emilio López, linux-kernel, Maxime Ripard,
clang-built-linux, Chen-Yu Tsai, Nathan Chancellor, linux-clk,
linux-arm-kernel
r375326 in Clang exposes an issue with operator precedence in
sunxi_div_clk_setup:
drivers/clk/sunxi/clk-sunxi.c:1083:30: warning: operator '?:' has lower
precedence than '|'; '|' will be evaluated first
[-Wbitwise-conditional-parentheses]
data->div[i].critical ?
~~~~~~~~~~~~~~~~~~~~~ ^
drivers/clk/sunxi/clk-sunxi.c:1083:30: note: place parentheses around
the '|' expression to silence this warning
data->div[i].critical ?
^
)
drivers/clk/sunxi/clk-sunxi.c:1083:30: note: place parentheses around
the '?:' expression to evaluate it first
data->div[i].critical ?
^
(
1 warning generated.
It appears that the intention was for ?: to be evaluated first so that
CLK_IS_CRITICAL could be added to clkflags if the critical boolean was
set; right now, | is being evaluated first. Add parentheses around the
?: block to have it be evaluated first.
Fixes: 9919d44ff297 ("clk: sunxi: Use CLK_IS_CRITICAL flag for critical clks")
Link: https://github.com/ClangBuiltLinux/linux/issues/745
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/clk/sunxi/clk-sunxi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index d3a43381a792..27201fd26e44 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -1080,8 +1080,8 @@ static struct clk ** __init sunxi_divs_clk_setup(struct device_node *node,
rate_hw, rate_ops,
gate_hw, &clk_gate_ops,
clkflags |
- data->div[i].critical ?
- CLK_IS_CRITICAL : 0);
+ (data->div[i].critical ?
+ CLK_IS_CRITICAL : 0));
WARN_ON(IS_ERR(clk_data->clks[i]));
}
--
2.23.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] clk: sunxi: Fix operator precedence in sunxi_divs_clk_setup
2019-10-22 16:50 [PATCH] clk: sunxi: Fix operator precedence in sunxi_divs_clk_setup Nathan Chancellor
@ 2019-10-29 7:43 ` Maxime Ripard
0 siblings, 0 replies; 2+ messages in thread
From: Maxime Ripard @ 2019-10-29 7:43 UTC (permalink / raw)
To: Nathan Chancellor
Cc: clang-built-linux, Stephen Boyd, Michael Turquette, linux-kernel,
Emilio López, Chen-Yu Tsai, linux-clk, linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 1644 bytes --]
On Tue, Oct 22, 2019 at 09:50:54AM -0700, Nathan Chancellor wrote:
> r375326 in Clang exposes an issue with operator precedence in
> sunxi_div_clk_setup:
>
> drivers/clk/sunxi/clk-sunxi.c:1083:30: warning: operator '?:' has lower
> precedence than '|'; '|' will be evaluated first
> [-Wbitwise-conditional-parentheses]
> data->div[i].critical ?
> ~~~~~~~~~~~~~~~~~~~~~ ^
> drivers/clk/sunxi/clk-sunxi.c:1083:30: note: place parentheses around
> the '|' expression to silence this warning
> data->div[i].critical ?
> ^
> )
> drivers/clk/sunxi/clk-sunxi.c:1083:30: note: place parentheses around
> the '?:' expression to evaluate it first
> data->div[i].critical ?
> ^
> (
> 1 warning generated.
>
> It appears that the intention was for ?: to be evaluated first so that
> CLK_IS_CRITICAL could be added to clkflags if the critical boolean was
> set; right now, | is being evaluated first. Add parentheses around the
> ?: block to have it be evaluated first.
>
> Fixes: 9919d44ff297 ("clk: sunxi: Use CLK_IS_CRITICAL flag for critical clks")
> Link: https://github.com/ClangBuiltLinux/linux/issues/745
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Applied, thanks!
Maxime
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-29 7:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-22 16:50 [PATCH] clk: sunxi: Fix operator precedence in sunxi_divs_clk_setup Nathan Chancellor
2019-10-29 7:43 ` Maxime Ripard
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).