Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

wifi: brcmfmac: avoid assignment in if/else-if conditions in NVRAM load path

The NVRAM selection logic in brcmf_fw_request_nvram_done() used
patterns like:

if ((data = bcm47xx_nvram_get_contents(&data_len)))
free_bcm47xx_nvram = true;
else if ((data = brcmf_fw_nvram_from_efi(&data_len)))
kfree_nvram = true;

This style violates kernel coding style guidelines and triggers
checkpatch.pl errors. It also slightly reduces readability.

Refactor these cases by separating the assignment and the check,
ensuring behavior remains identical while complying with coding
standards.

Signed-off-by: Darshan Rathod <darshanrathod475@gmail.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Link: https://patch.msgid.link/20250812123636.2142292-1-darshanrathod475@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Darshan Rathod and committed by
Johannes Berg
b662bc50 1373f941

+9 -5
+9 -5
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
··· 554 554 data = (u8 *)fw->data; 555 555 data_len = fw->size; 556 556 } else { 557 - if ((data = bcm47xx_nvram_get_contents(&data_len))) 557 + data = bcm47xx_nvram_get_contents(&data_len); 558 + if (data) { 558 559 free_bcm47xx_nvram = true; 559 - else if ((data = brcmf_fw_nvram_from_efi(&data_len))) 560 - kfree_nvram = true; 561 - else if (!(cur->flags & BRCMF_FW_REQF_OPTIONAL)) 562 - goto fail; 560 + } else { 561 + data = brcmf_fw_nvram_from_efi(&data_len); 562 + if (data) 563 + kfree_nvram = true; 564 + else if (!(cur->flags & BRCMF_FW_REQF_OPTIONAL)) 565 + goto fail; 566 + } 563 567 } 564 568 565 569 if (data)