clk/sophgo: Using BUG() instead of unreachable() in mmux_get_parent_id()
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/1 clk/sophgo: Using BUG() instead of unreachable() in mmux_get_parent_id()
In general it's a good idea to avoid using bare unreachable() because it introduces undefined behavior in compiled code. but it caused a compilation warning, Using BUG() instead of unreachable() to resolve compilation warnings.
Fixes the following warnings:
drivers/clk/sophgo/clk-cv18xx-ip.o: warning: objtool: mmux_round_rate() falls through to next function bypass_div_round_rate()
--- drivers/clk/sophgo/clk-cv18xx-ip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/sophgo/clk-cv18xx-ip.c +1 -1
@@ -613,7 +613,7 @@ static u8 mmux_get_parent_id(struct cv1800_clk_mmux *mmux)return i; } -unreachable (); +BUG (); }static int mmux_enable (struct clk_hw *hw)
Signature · 1 line
2.25.1
Quoted 6 lines · Li Qiang
In general it's a good idea to avoid using bare
unreachable()because it introduces undefined behavior in compiled code. but it caused a compilation warning, UsingBUG()instead ofunreachable()to resolve compilation warnings.Fixes the following warnings:
drivers/clk/sophgo/clk-cv18xx-ip.o: warning: objtool:mmux_round_rate()falls through to next functionbypass_div_round_rate()
I tried to build this drivers/clk/sophgo/clk-cv18xx-ip.c but don't see the warning. I'm using make W=1 with gcc 13.2.0
What's the meaning of this warning message and how to reproduce this?
Quoted 20 lines
Fixes 80fd61ec46124 ("clk: sophgo: Add clock support for CV1800 SoC")Signed-off-by Li Qiang <[email protected]>--- drivers/clk/sophgo/clk-cv18xx-ip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/sophgo/clk-cv18xx-ip.c +1
-1@@ -613,7 +613,7 @@ static u8 mmux_get_parent_id(struct cv1800_clk_mmux *mmux)return i; } -unreachable (); +BUG (); }static int mmux_enable (struct clk_hw *hw)
Quoting Li Qiang (2024-07-08 23:36:38)
Quoted 10 lines
In general it's a good idea to avoid using bare
unreachable()because it introduces undefined behavior in compiled code. but it caused a compilation warning, UsingBUG()instead ofunreachable()to resolve compilation warnings.Fixes the following warnings:
drivers/clk/sophgo/clk-cv18xx-ip.o: warning: objtool:mmux_round_rate()falls through to next functionbypass_div_round_rate()Fixes 80fd61ec46124 ("clk: sophgo: Add clock support for CV1800 SoC")Signed-off-by Li Qiang <[email protected]>---
Applied to clk-next