[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250416-smatch-fix-v1-1-35491b462d8f@gmail.com>
Date: Wed, 16 Apr 2025 13:50:23 -0300
From: Kurt Borja <kuurtb@...il.com>
To: Hans de Goede <hdegoede@...hat.com>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Armin Wolf <W_Armin@....de>, Mario Limonciello <mario.limonciello@....com>
Cc: platform-driver-x86@...r.kernel.org, Dell.Client.Kernel@...l.com,
linux-kernel@...r.kernel.org, Dan Carpenter <dan.carpenter@...aro.org>,
Kurt Borja <kuurtb@...il.com>
Subject: [PATCH] platform/x86: alienware-wmi-wmax: Fix uninitialized
variable due to bad error handling
wmax_thermal_information() may also return -ENOMSG, which would leave
`id` uninitialized in thermal_profile_probe.
Reorder and modify logic to catch all errors.
Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Closes: https://lore.kernel.org/r/Z_-KVqNbD9ygvE2X@stanley.mountain
Fixes: 27e9e6339896 ("platform/x86: alienware-wmi: Refactor thermal control methods")
Signed-off-by: Kurt Borja <kuurtb@...il.com>
---
Hi all,
@Ilpo: This will definitely conflict with the for-next branch when
merging.
Also, the fixes tag references a commit from before the split (same
series though), but ofc this fix is meant to be applied on top of it
(fixes branch). Is this ok or would it be better to change the fixes
tag to the "split" commit?
---
drivers/platform/x86/dell/alienware-wmi-wmax.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platform/x86/dell/alienware-wmi-wmax.c
index 3d3014b5adf046c94c1ebf39a0e28a92622b40d6..b8e71f06fdde347573bff5c27a9ba53a0efcacae 100644
--- a/drivers/platform/x86/dell/alienware-wmi-wmax.c
+++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c
@@ -607,12 +607,10 @@ static int thermal_profile_probe(void *drvdata, unsigned long *choices)
for (u32 i = 0; i < sys_desc[3]; i++) {
ret = wmax_thermal_information(priv->wdev, WMAX_OPERATION_LIST_IDS,
i + first_mode, &out_data);
-
- if (ret == -EIO)
- return ret;
-
if (ret == -EBADRQC)
break;
+ if (ret)
+ return ret;
if (!is_wmax_thermal_code(out_data))
continue;
---
base-commit: fcf27a6a926fd9eeba39e9c3fde43c9298fe284e
change-id: 20250416-smatch-fix-d1191e2514f5
Best regards,
--
~ Kurt
Powered by blists - more mailing lists