From: Dan Carpenter <dan.carpenter@oracle.com>
To: luciano.coelho@intel.com
Cc: linux-wireless@vger.kernel.org
Subject: [bug report] iwlwifi: support loading the reduced power table from UEFI
Date: Fri, 25 Jun 2021 16:00:05 +0300 [thread overview]
Message-ID: <YNXTVZVhDw3VGx2k@mwanda> (raw)
Hello Luca Coelho,
The patch 9dad325f9d57: "iwlwifi: support loading the reduced power
table from UEFI" from Jun 21, 2021, leads to the following static
checker warning:
drivers/net/wireless/intel/iwlwifi/fw/pnvm.c:332 iwl_pnvm_load()
error: uninitialized symbol 'len'.
drivers/net/wireless/intel/iwlwifi/fw/pnvm.c
256 int iwl_pnvm_load(struct iwl_trans *trans,
257 struct iwl_notif_wait_data *notif_wait)
258 {
259 u8 *data;
260 size_t len;
^^^^^^^^^^
261 struct pnvm_sku_package *package;
262 struct iwl_notification_wait pnvm_wait;
263 static const u16 ntf_cmds[] = { WIDE_ID(REGULATORY_AND_NVM_GROUP,
264 PNVM_INIT_COMPLETE_NTFY) };
265 int ret;
266
267 /* if the SKU_ID is empty, there's nothing to do */
268 if (!trans->sku_id[0] && !trans->sku_id[1] && !trans->sku_id[2])
269 return 0;
270
271 /*
272 * If we already loaded (or tried to load) it before, we just
273 * need to set it again.
274 */
275 if (trans->pnvm_loaded) {
276 ret = iwl_trans_set_pnvm(trans, NULL, 0);
277 if (ret)
278 return ret;
279 goto skip_parse;
^^^^^^^^^^^^^^^
280 }
281
282 /* First attempt to get the PNVM from BIOS */
283 package = iwl_uefi_get_pnvm(trans, &len);
284 if (!IS_ERR_OR_NULL(package)) {
285 data = kmemdup(package->data, len, GFP_KERNEL);
286
287 /* free package regardless of whether kmemdup succeeded */
288 kfree(package);
289
290 if (data) {
291 /* we need only the data size */
292 len -= sizeof(*package);
293 goto parse;
294 }
295 }
296
297 /* If it's not available, try from the filesystem */
298 ret = iwl_pnvm_get_from_fs(trans, &data, &len);
299 if (ret) {
300 /*
301 * Pretend we've loaded it - at least we've tried and
302 * couldn't load it at all, so there's no point in
303 * trying again over and over.
304 */
305 trans->pnvm_loaded = true;
306
307 goto skip_parse;
308 }
309
310 parse:
311 iwl_pnvm_parse(trans, data, len);
312
313 kfree(data);
314
315 skip_parse:
316 data = NULL;
317 /* now try to get the reduce power table, if not loaded yet */
318 if (!trans->reduce_power_loaded) {
319 data = iwl_uefi_get_reduced_power(trans, &len);
320 if (IS_ERR_OR_NULL(data)) {
321 /*
322 * Pretend we've loaded it - at least we've tried and
323 * couldn't load it at all, so there's no point in
324 * trying again over and over.
325 */
326 trans->reduce_power_loaded = true;
327
328 goto skip_reduce_power;
329 }
330 }
331
332 ret = iwl_trans_set_reduce_power(trans, data, len);
^^^
Uninitialized
333 if (ret)
334 IWL_DEBUG_FW(trans,
335 "Failed to set reduce power table %d\n",
336 ret);
337 kfree(data);
338
339 skip_reduce_power:
340 iwl_init_notification_wait(notif_wait, &pnvm_wait,
341 ntf_cmds, ARRAY_SIZE(ntf_cmds),
342 iwl_pnvm_complete_fn, trans);
343
regards,
dan carpenter
reply other threads:[~2021-06-25 13:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=YNXTVZVhDw3VGx2k@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-wireless@vger.kernel.org \
--cc=luciano.coelho@intel.com \
/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.