2022-10-14 09:39:20

by Dan Carpenter

[permalink] [raw]
Subject: [bug report] wifi: iwlwifi: mvm: trigger resume flow before wait for notifications

Hello Haim, Dreyfuss,

The patch b75dac847c94: "wifi: iwlwifi: mvm: trigger resume flow
before wait for notifications" from Sep 6, 2022, leads to the
following Smatch static checker warning:

drivers/net/wireless/intel/iwlwifi/mvm/d3.c:2791 iwl_mvm_resume_firmware()
error: uninitialized symbol 'd3_status'.

drivers/net/wireless/intel/iwlwifi/mvm/d3.c
2776 static int iwl_mvm_resume_firmware(struct iwl_mvm *mvm, bool test)
2777 {
2778 int ret;
2779 enum iwl_d3_status d3_status;
2780 struct iwl_host_cmd cmd = {
2781 .id = D0I3_END_CMD,
2782 .flags = CMD_WANT_SKB | CMD_SEND_IN_D3,
2783 };
2784 bool reset = fw_has_capa(&mvm->fw->ucode_capa,
2785 IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG);
2786
2787 ret = iwl_trans_d3_resume(mvm->trans, &d3_status, test, !reset);

Drivers are not required to impliment a ->d3_resume op and if they don't
then d3_status is not initialized.

2788 if (ret)
2789 return ret;
2790
--> 2791 if (d3_status != IWL_D3_STATUS_ALIVE) {
^^^^^^^^^
Uninitialized

2792 IWL_INFO(mvm, "Device was reset during suspend\n");
2793 return -ENOENT;
2794 }
2795
2796 /*
2797 * We should trigger resume flow using command only for 22000 family
2798 * AX210 and above don't need the command since they have
2799 * the doorbell interrupt.
2800 */
2801 if (mvm->trans->trans_cfg->device_family <= IWL_DEVICE_FAMILY_22000 &&
2802 fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_D0I3_END_FIRST)) {
2803 ret = iwl_mvm_send_cmd(mvm, &cmd);
2804 if (ret < 0)
2805 IWL_ERR(mvm, "Failed to send D0I3_END_CMD first (%d)\n",
2806 ret);
2807 }
2808
2809 return ret;
2810 }

regards,
dan carpenter