From fe780310cfa8bf5a093894b5cd7fe85c6b02fd91 Mon Sep 17 00:00:00 2001 From: Andrew Goodbody Date: Fri, 21 Nov 2025 17:34:32 +0000 Subject: clk: Return value calculated by ERR_PTR In clk_set_default_get_by_id ret is passed to ERR_PTR but nothing is done with the value that this calculates which is obviously not the intention of the code. This is confirmed by the code around where this function is called. Instead return the value from ERR_PTR. Then fixup the sandbox code so that the test dm_test_clk does not fail as it relied on the broken behaviour. Finally disable part of the test that does not work correctly with CLK_AUTO_ID This issue found by Smatch. Signed-off-by: Andrew Goodbody --- test/dm/clk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/dm/clk.c b/test/dm/clk.c index 790968e6477..c3363796498 100644 --- a/test/dm/clk.c +++ b/test/dm/clk.c @@ -89,8 +89,9 @@ static int dm_test_clk(struct unit_test_state *uts) SANDBOX_CLK_TEST_ID_SPI)); ut_asserteq(0, sandbox_clk_test_get_rate(dev_test, SANDBOX_CLK_TEST_ID_I2C)); - ut_asserteq(321, sandbox_clk_test_get_rate(dev_test, - SANDBOX_CLK_TEST_ID_DEVM1)); + if (!CONFIG_IS_ENABLED(CLK_AUTO_ID)) + ut_asserteq(321, sandbox_clk_test_get_rate(dev_test, + SANDBOX_CLK_TEST_ID_DEVM1)); ut_asserteq(0, sandbox_clk_test_get_rate(dev_test, SANDBOX_CLK_TEST_ID_DEVM2)); -- cgit v1.2.3