From: Andrew Goodbody Date: Wed, 23 Jul 2025 15:54:07 +0000 (+0100) Subject: clk: versaclock: return value calculated by ERR_PTR X-Git-Tag: v2026.01-rc2~79^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f48f6f2a2df05bd7663917b694a4d881998f6c5;p=thirdparty%2Fu-boot.git clk: versaclock: return value calculated by ERR_PTR In versaclock_get_name -ENOMEM 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 was found by Smatch. Signed-off-by: Andrew Goodbody --- diff --git a/drivers/clk/clk_versaclock.c b/drivers/clk/clk_versaclock.c index 9ccaf13d242..790ea4dbe82 100644 --- a/drivers/clk/clk_versaclock.c +++ b/drivers/clk/clk_versaclock.c @@ -850,7 +850,7 @@ static char *versaclock_get_name(const char *dev_name, const char *clk_name, int buf = malloc(length); if (!buf) - ERR_PTR(-ENOMEM); + return ERR_PTR(-ENOMEM); if (index < 0) snprintf(buf, length, "%s.%s", dev_name, clk_name);