[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <29cc25fb-0196-d80d-e3c7-b6aa22d32b1b@linaro.org>
Date: Tue, 27 Sep 2022 11:36:16 +0200
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: Nathan Chancellor <nathan@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>
Cc: Amit Kucheria <amitk@...nel.org>, Zhang Rui <rui.zhang@...el.com>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
"kernelci.org bot" <bot@...nelci.org>,
"Sudip Mukherjee (Codethink)" <sudipm.mukherjee@...il.com>
Subject: Re: [PATCH -next] thermal/intel/int340x: Initialized ret in error
path in int340x_thermal_zone_add()
On 23/09/2022 17:20, Nathan Chancellor wrote:
> Clang warns:
>
> drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c:222:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
> if (!int34x_thermal_zone->ops)
> ^~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c:279:17: note: uninitialized use occurs here
> return ERR_PTR(ret);
> ^~~
> drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c:222:2: note: remove the 'if' if its condition is always false
> if (!int34x_thermal_zone->ops)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c:211:9: note: initialize the variable 'ret' to silence this warning
> int ret;
> ^
> = 0
> 1 error generated.
>
> If kmemdup() fails, -ENOMEM should be returned.
>
> Fixes: f6f6f9a01374 ("thermal/intel/int340x: Replace parameter to simplify")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1717
> Reported-by: "kernelci.org bot" <bot@...nelci.org>
> Reported-by: "Sudip Mukherjee (Codethink)" <sudipm.mukherjee@...il.com>
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>
> ---
I've folded this patch with the changes introducing the issue
Thanks for the fix
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Powered by blists - more mailing lists