All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Kurt Borja <kuurtb@gmail.com>
Cc: platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com
Subject: [bug report] platform/x86: alienware-wmi-wmax: Improve platform profile probe
Date: Wed, 16 Apr 2025 13:45:42 +0300	[thread overview]
Message-ID: <Z_-KVqNbD9ygvE2X@stanley.mountain> (raw)

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

             reply	other threads:[~2025-04-16 10:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-16 10:45 Dan Carpenter [this message]
2025-04-16 16:06 ` [bug report] platform/x86: alienware-wmi-wmax: Improve platform profile probe Kurt Borja

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z_-KVqNbD9ygvE2X@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=Dell.Client.Kernel@dell.com \
    --cc=kuurtb@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.