iwlwifi: acpi: fill in SAR tables with defaults
If the tables we get in the iwl_sar_set_profile() is smaller than the revision we support, we need to fill the values with 0. Make sure that's the case. Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20210819183728.7fb9716db7ba.I75541846e0720f80695186ba39398133c8758280@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
parent
c5b42c674a
commit
40063f6028
|
@ -420,8 +420,12 @@ static int iwl_sar_set_profile(union acpi_object *table,
|
|||
* The table from ACPI is flat, but we store it in a
|
||||
* structured array.
|
||||
*/
|
||||
for (i = 0; i < num_chains; i++) {
|
||||
for (j = 0; j < num_sub_bands; j++) {
|
||||
for (i = 0; i < ACPI_SAR_NUM_CHAINS_REV2; i++) {
|
||||
for (j = 0; j < ACPI_SAR_NUM_SUB_BANDS_REV2; j++) {
|
||||
/* if we don't have the values, use the default */
|
||||
if (i >= num_chains || j >= num_sub_bands) {
|
||||
profile->chains[i].subbands[j] = 0;
|
||||
} else {
|
||||
if (table[idx].type != ACPI_TYPE_INTEGER ||
|
||||
table[idx].integer.value > U8_MAX)
|
||||
return -EINVAL;
|
||||
|
@ -432,6 +436,7 @@ static int iwl_sar_set_profile(union acpi_object *table,
|
|||
idx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Only if all values were valid can the profile be enabled */
|
||||
profile->enabled = enabled;
|
||||
|
|
Loading…
Reference in New Issue