[PATCH] clk: Return value calculated by ERR_PTR
Andrew Goodbody
andrew.goodbody at linaro.org
Thu Oct 30 17:51:12 CET 2025
On 28/10/2025 19:26, Tom Rini wrote:
> On Tue, Oct 28, 2025 at 11:59:07AM -0600, Tom Rini wrote:
>> On Thu, 03 Jul 2025 15:40:46 +0100, Andrew Goodbody wrote:
>>
>>> 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.
>>>
>>> This issue found by Smatch.
>>>
>>> [...]
>>
>> Applied to u-boot/master, thanks!
>>
>> [1/1] clk: Return value calculated by ERR_PTR
>> commit: 644b4650ee57c429bede77f44752cc867dac0e00
>
> Unfortunately I missed that this caused CI failures until too late:
Oh dear, I am sorry about that. This is proving to be tricky to resolve
as the test was relying on the broken behaviour but I am working on it.
But in the meantime I will post a patch that fixes a couple of debug
statements which were shown to be a problem during my debugging.
Andrew
> __________________________ test_ut[ut_dm_dm_test_clk] __________________________
> test/py/tests/test_ut.py:591: in test_ut
> assert output.endswith('failures: 0')
> E assert False
> E + where False = <built-in method endswith of str object at 0xfffede8fec30>('failures: 0')
> E + where <built-in method endswith of str object at 0xfffede8fec30> = "Test: clk: clk.c\r\r\ntest/dm/clk.c:92, dm_test_clk(): 321 == sandbox_clk_test_get_rate(dev_test, SANDBOX_CLK_TEST_ID...clk' failed 2 times\r\r\nTests run: 1, 12 ms, average: 12 ms, failures: 2\r\r\nexit not allowed from main input shell.".endswith
> ----------------------------- Captured stdout call -----------------------------
> => ut dm dm_test_clk
> Test: clk: clk.c
> test/dm/clk.c:92, dm_test_clk(): 321 == sandbox_clk_test_get_rate(dev_test, SANDBOX_CLK_TEST_ID_DEVM1): Expected 0x141 (321), got 0x0 (0)
> Test: clk: clk.c (flat tree)
> test/dm/clk.c:92, dm_test_clk(): 321 == sandbox_clk_test_get_rate(dev_test, SANDBOX_CLK_TEST_ID_DEVM1): Expected 0x141 (321), got 0x0 (0)
> Test 'clk' failed 2 times
> Tests run: 1, 12 ms, average: 12 ms, failures: 2
> exit not allowed from main input shell.
> =>
> _______________________ test_ut[ut_dm_dm_test_clk_base] ________________________
> test/py/tests/test_ut.py:591: in test_ut
> assert output.endswith('failures: 0')
> E assert False
> E + where False = <built-in method endswith of str object at 0xaaab788cbea0>('failures: 0')
> E + where <built-in method endswith of str object at 0xaaab788cbea0> = 'Test: clk_base: clk.c\r\r\ntest/dm/clk.c:44, dm_test_clk_base(): 0 == uclass_get_device_by_name(UCLASS_MISC, "clk-tes...base\' failed 2 times\r\r\nTests run: 1, 3 ms, average: 3 ms, failures: 2\r\r\nexit not allowed from main input shell.'.endswith
> ---------------------------- Captured stdout setup -----------------------------
> /u-boot
> Bloblist at 100 not found (err=-2)
> U-Boot 2026.01-rc1-00013-gf12ca3e2b81b (Oct 28 2025 - 18:45:26 +0000)
> Reset Status: WARM Reset Status: COLD
> Model: sandbox
> DRAM: 256 MiB
> using memory 0x1988c000-0x1f88e000 for malloc()
> Core: 266 devices, 94 uclasses, devicetree: board
> WDT: Not starting wdt-gpio-toggle
> WDT: Not starting wdt-gpio-level
> WDT: Not starting wdt at 0
> NAND: 4100 MiB
> MMC: mmc2: 2 (SD), mmc1: 1 (SD), mmc0: 0 (SD)
> Loading Environment from nowhere... OK
> In: serial,cros-ec-keyb,usbkbd
> Out: serial,vidconsole
> Err: serial,vidconsole
> Model: sandbox
> Net: eth0: eth at 10002000, eth5: eth at 10003000, eth3: sbe5, eth6: eth at 10004000, eth8: phy-test-eth, eth4: dsa-test-eth, eth2: lan0, eth7: lan1
> Hit any key to stop autoboot: 0
> =>
> ----------------------------- Captured stdout call -----------------------------
> => ut dm dm_test_clk_base
> Test: clk_base: clk.c
> test/dm/clk.c:44, dm_test_clk_base(): 0 == uclass_get_device_by_name(UCLASS_MISC, "clk-test4", &dev): Expected 0x0 (0), got 0xfffffffe (-2)
> Test: clk_base: clk.c (flat tree)
> test/dm/clk.c:44, dm_test_clk_base(): 0 == uclass_get_device_by_name(UCLASS_MISC, "clk-test4", &dev): Expected 0x0 (0), got 0xfffffffe (-2)
> Test 'clk_base' failed 2 times
> Tests run: 1, 3 ms, average: 3 ms, failures: 2
> exit not allowed from main input shell.
> =>
>
> So I will be pushing a revert in a moment.
>
More information about the U-Boot
mailing list