* [bug report] platform/x86: alienware-wmi-wmax: Improve platform profile probe
@ 2025-04-16 10:45 Dan Carpenter
2025-04-16 16:06 ` Kurt Borja
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-04-16 10:45 UTC (permalink / raw)
To: Kurt Borja; +Cc: platform-driver-x86, Dell.Client.Kernel
Hello Kurt Borja,
Commit 32b6372ddd43 ("platform/x86: alienware-wmi-wmax: Improve
platform profile probe") from Mar 29, 2025 (linux-next), leads to the
following Smatch static checker warning:
drivers/platform/x86/dell/alienware-wmi-wmax.c:1217 awcc_platform_profile_probe()
error: uninitialized symbol 'id'.
drivers/platform/x86/dell/alienware-wmi-wmax.c
1191 static int awcc_platform_profile_probe(void *drvdata, unsigned long *choices)
1192 {
1193 enum platform_profile_option profile;
1194 struct awcc_priv *priv = drvdata;
1195 enum awcc_thermal_profile mode;
1196 u8 id, offset = 0;
1197 int ret;
1198
1199 /*
1200 * Thermal profile IDs are listed last at offset
1201 * fan_count + temp_count + unknown_count
1202 */
1203 for (unsigned int i = 0; i < ARRAY_SIZE(priv->res_count) - 1; i++)
1204 offset += priv->res_count[i];
1205
1206 for (unsigned int i = 0; i < priv->profile_count; i++) {
1207 ret = awcc_op_get_resource_id(priv->wdev, i + offset, &id);
1208 if (ret == -EIO)
-ENOMSG is not handled.
1209 return ret;
1210 /*
1211 * Some devices report an incorrect number of thermal profiles
1212 * so the resource ID list may end prematurely
1213 */
1214 if (ret == -EBADRQC)
1215 break;
1216
--> 1217 if (!is_awcc_thermal_profile_id(id)) {
1218 dev_dbg(&priv->wdev->dev, "Unmapped thermal profile ID 0x%02x\n", id);
1219 continue;
1220 }
1221
1222 mode = FIELD_GET(AWCC_THERMAL_MODE_MASK, id);
1223 profile = awcc_mode_to_platform_profile[mode];
1224 priv->supported_profiles[profile] = id;
1225
1226 __set_bit(profile, choices);
1227 }
1228
1229 if (bitmap_empty(choices, PLATFORM_PROFILE_LAST))
1230 return -ENODEV;
1231
1232 if (awcc->gmode) {
1233 priv->supported_profiles[PLATFORM_PROFILE_PERFORMANCE] =
1234 AWCC_SPECIAL_PROFILE_GMODE;
1235
1236 __set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
1237 }
1238
1239 /* Every model supports the "custom" profile */
1240 priv->supported_profiles[PLATFORM_PROFILE_CUSTOM] =
1241 AWCC_SPECIAL_PROFILE_CUSTOM;
1242
1243 __set_bit(PLATFORM_PROFILE_CUSTOM, choices);
1244
1245 return 0;
1246 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] platform/x86: alienware-wmi-wmax: Improve platform profile probe
2025-04-16 10:45 [bug report] platform/x86: alienware-wmi-wmax: Improve platform profile probe Dan Carpenter
@ 2025-04-16 16:06 ` Kurt Borja
0 siblings, 0 replies; 2+ messages in thread
From: Kurt Borja @ 2025-04-16 16:06 UTC (permalink / raw)
To: Dan Carpenter; +Cc: platform-driver-x86, Dell.Client.Kernel
Hi Dan,
On Wed Apr 16, 2025 at 7:45 AM -03, Dan Carpenter wrote:
> Hello Kurt Borja,
>
> Commit 32b6372ddd43 ("platform/x86: alienware-wmi-wmax: Improve
> platform profile probe") from Mar 29, 2025 (linux-next), leads to the
> following Smatch static checker warning:
>
> drivers/platform/x86/dell/alienware-wmi-wmax.c:1217 awcc_platform_profile_probe()
> error: uninitialized symbol 'id'.
>
> drivers/platform/x86/dell/alienware-wmi-wmax.c
> 1191 static int awcc_platform_profile_probe(void *drvdata, unsigned long *choices)
> 1192 {
> 1193 enum platform_profile_option profile;
> 1194 struct awcc_priv *priv = drvdata;
> 1195 enum awcc_thermal_profile mode;
> 1196 u8 id, offset = 0;
> 1197 int ret;
> 1198
> 1199 /*
> 1200 * Thermal profile IDs are listed last at offset
> 1201 * fan_count + temp_count + unknown_count
> 1202 */
> 1203 for (unsigned int i = 0; i < ARRAY_SIZE(priv->res_count) - 1; i++)
> 1204 offset += priv->res_count[i];
> 1205
> 1206 for (unsigned int i = 0; i < priv->profile_count; i++) {
> 1207 ret = awcc_op_get_resource_id(priv->wdev, i + offset, &id);
> 1208 if (ret == -EIO)
>
> -ENOMSG is not handled.
True.
I'll submit a fix for this. Thank you for reporting!
--
~ Kurt
>
> 1209 return ret;
> 1210 /*
> 1211 * Some devices report an incorrect number of thermal profiles
> 1212 * so the resource ID list may end prematurely
> 1213 */
> 1214 if (ret == -EBADRQC)
> 1215 break;
> 1216
> --> 1217 if (!is_awcc_thermal_profile_id(id)) {
> 1218 dev_dbg(&priv->wdev->dev, "Unmapped thermal profile ID 0x%02x\n", id);
> 1219 continue;
> 1220 }
> 1221
> 1222 mode = FIELD_GET(AWCC_THERMAL_MODE_MASK, id);
> 1223 profile = awcc_mode_to_platform_profile[mode];
> 1224 priv->supported_profiles[profile] = id;
> 1225
> 1226 __set_bit(profile, choices);
> 1227 }
> 1228
> 1229 if (bitmap_empty(choices, PLATFORM_PROFILE_LAST))
> 1230 return -ENODEV;
> 1231
> 1232 if (awcc->gmode) {
> 1233 priv->supported_profiles[PLATFORM_PROFILE_PERFORMANCE] =
> 1234 AWCC_SPECIAL_PROFILE_GMODE;
> 1235
> 1236 __set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
> 1237 }
> 1238
> 1239 /* Every model supports the "custom" profile */
> 1240 priv->supported_profiles[PLATFORM_PROFILE_CUSTOM] =
> 1241 AWCC_SPECIAL_PROFILE_CUSTOM;
> 1242
> 1243 __set_bit(PLATFORM_PROFILE_CUSTOM, choices);
> 1244
> 1245 return 0;
> 1246 }
>
> regards,
> dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-16 16:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-16 10:45 [bug report] platform/x86: alienware-wmi-wmax: Improve platform profile probe Dan Carpenter
2025-04-16 16:06 ` Kurt Borja
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.