lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240719115727.27857-1-limiao870622@163.com>
Date: Fri, 19 Jul 2024 19:57:27 +0800
From: limiao <limiao870622@....com>
To: mturquette@...libre.com,
	sboyd@...nel.org,
	unicorn_wang@...look.com,
	inochiama@...look.com,
	limiao870622@....com
Cc: linux-clk@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	limiao <limiao@...inos.cn>
Subject: [PATCH] clk: sophgo: fix warning emitted by objtool

From: limiao <limiao@...inos.cn>

for ARCH=x86, the combination of CONFIG_OBJTOOL=y enables
a host tool named 'objtool' which runs at compile time,
when CONFIG_CLK_SOPHGO_CV1800=y or m, objtool will produces
the following warning:

drivers/clk/sophgo/clk-cv18xx-ip.o: warning: objtool:
mmux_round_rate() falls through to next function aclk_set_rate()

we can find the reason from objtool help document(tools/objtool/
Documentation/objtool.txt):

Objtool warnings
----------------
...
8. file.o: warning: objtool: funcA() falls through to next function funcB()
...
   2) funcA() uses the unreachable() annotation in a section of code
     that is actually reachable.

so we replace unreachable() with returning an errno to avoid this warning.

Signed-off-by: limiao<limiao@...inos.cn>
---
 drivers/clk/sophgo/clk-cv18xx-ip.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/sophgo/clk-cv18xx-ip.c b/drivers/clk/sophgo/clk-cv18xx-ip.c
index 805f561725ae..0fe9a9bd3f49 100644
--- a/drivers/clk/sophgo/clk-cv18xx-ip.c
+++ b/drivers/clk/sophgo/clk-cv18xx-ip.c
@@ -602,7 +602,7 @@ static inline struct cv1800_clk_mmux *hw_to_cv1800_clk_mmux(struct clk_hw *hw)
 	return container_of(common, struct cv1800_clk_mmux, common);
 }
 
-static u8 mmux_get_parent_id(struct cv1800_clk_mmux *mmux)
+static int mmux_get_parent_id(struct cv1800_clk_mmux *mmux)
 {
 	struct clk_hw *hw = &mmux->common.hw;
 	struct clk_hw *parent = clk_hw_get_parent(hw);
@@ -613,7 +613,7 @@ static u8 mmux_get_parent_id(struct cv1800_clk_mmux *mmux)
 			return i;
 	}
 
-	unreachable();
+	return -EINVAL;
 }
 
 static int mmux_enable(struct clk_hw *hw)
@@ -648,6 +648,8 @@ static long mmux_round_rate(struct clk_hw *parent, unsigned long *parent_rate,
 			return *parent_rate;
 
 		id = mmux_get_parent_id(mmux);
+		if (id < 0)
+			return *parent_rate;
 	}
 
 	div_id = mmux->parent2sel[id];
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ