diff mbox series

wifi: brcmfmac: always check the value returned by brcmf_chip_add_core()

Message ID 20230821112337.160974-1-dmantipov@yandex.ru
State New
Headers show
Series wifi: brcmfmac: always check the value returned by brcmf_chip_add_core() | expand

Commit Message

Dmitry Antipov Aug. 21, 2023, 11:22 a.m. UTC
In 'brcmf_chip_recognition()', always check the value returned by
'brcmf_chip_add_core()' with 'IS_ERR()' and return convenient
'PTR_ERR()' in case of error.

Fixes: cb7cf7be9eba ("brcmfmac: make chip related functions host interface independent")
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 .../net/wireless/broadcom/brcm80211/brcmfmac/chip.c    | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Kalle Valo Jan. 18, 2024, 11:27 a.m. UTC | #1
Dmitry Antipov <dmantipov@yandex.ru> wrote:

> In 'brcmf_chip_recognition()', always check the value returned by
> 'brcmf_chip_add_core()' with 'IS_ERR()' and return convenient
> 'PTR_ERR()' in case of error.
> 
> Fixes: cb7cf7be9eba ("brcmfmac: make chip related functions host interface independent")
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

This should be tested on a real device.

Patch set to Changes Requested.
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
index 2ef92ef25517..6a1b593eeff6 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
@@ -1006,18 +1006,28 @@  static int brcmf_chip_recognition(struct brcmf_chip_priv *ci)
 
 		core = brcmf_chip_add_core(ci, BCMA_CORE_CHIPCOMMON,
 					   SI_ENUM_BASE_DEFAULT, 0);
+		if (IS_ERR(core))
+			return PTR_ERR(core);
 		brcmf_chip_sb_corerev(ci, core);
 		core = brcmf_chip_add_core(ci, BCMA_CORE_SDIO_DEV,
 					   BCM4329_CORE_BUS_BASE, 0);
+		if (IS_ERR(core))
+			return PTR_ERR(core);
 		brcmf_chip_sb_corerev(ci, core);
 		core = brcmf_chip_add_core(ci, BCMA_CORE_INTERNAL_MEM,
 					   BCM4329_CORE_SOCRAM_BASE, 0);
+		if (IS_ERR(core))
+			return PTR_ERR(core);
 		brcmf_chip_sb_corerev(ci, core);
 		core = brcmf_chip_add_core(ci, BCMA_CORE_ARM_CM3,
 					   BCM4329_CORE_ARM_BASE, 0);
+		if (IS_ERR(core))
+			return PTR_ERR(core);
 		brcmf_chip_sb_corerev(ci, core);
 
 		core = brcmf_chip_add_core(ci, BCMA_CORE_80211, 0x18001000, 0);
+		if (IS_ERR(core))
+			return PTR_ERR(core);
 		brcmf_chip_sb_corerev(ci, core);
 	} else if (socitype == SOCI_AI) {
 		ci->iscoreup = brcmf_chip_ai_iscoreup;