[PATCH v2 0/3] clk: Return value calculated by ERR_PTR

Andrew Goodbody andrew.goodbody at linaro.org
Fri Nov 21 18:34:30 CET 2025


Smatch reported an error where a value calculated by ERR_PTR was not
used. Fixing this to return the generated value led to a test failure
which meant updating the sandbox clock code so that it would still cause
the tests to pass with the above correction.
Debugging this problem led to a SIGSEGV which is addressed in 1/3.
Possible memory leaks noticed are addressed in 3/3.

Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
Changes in v2:
- Added 1/3 to prevent SIGSEGV on debug statement
- Added code to original patch now 2/3 to fixup sandbox code that is
  needed to keep tests passing with fixed code
- Added 3/3 to prevent memory leaks on error
- Link to v1: https://lore.kernel.org/r/20250703-clk_uclass_fix-v1-1-9b6cc81c9490@linaro.org

---
Andrew Goodbody (3):
      clk: Prevent SIGSEGV on debug
      clk: Return value calculated by ERR_PTR
      clk: Prevent memory leak on error

 arch/sandbox/include/asm/clk.h |  1 +
 drivers/clk/clk-uclass.c       | 10 +++++-----
 drivers/clk/clk_sandbox.c      | 17 +++++++++++++++++
 test/dm/clk.c                  |  5 +++--
 4 files changed, 26 insertions(+), 7 deletions(-)
---
base-commit: 2bc0715b558fa1ac5c88b11e250740b16a905837
change-id: 20250703-clk_uclass_fix-eaf648b2ebb5

Best regards,
-- 
Andrew Goodbody <andrew.goodbody at linaro.org>



More information about the U-Boot mailing list