diff mbox series

[wireless-next,v2] wifi: brcmfmac: Convert to use ERR_CAST()

Message ID 20240829124326.3257874-1-liyuesong@vivo.com (mailing list archive)
State Deferred
Delegated to: Kalle Valo
Headers show
Series [wireless-next,v2] wifi: brcmfmac: Convert to use ERR_CAST() | expand

Commit Message

Yuesong Li Aug. 29, 2024, 12:43 p.m. UTC
Use ERR_CAST() as it is designed for casting an error pointer to
another type.

This macro utilizes the __force and __must_check modifiers, which instruct
the compiler to verify for errors at the locations where it is employed.

Signed-off-by: Yuesong Li <liyuesong@vivo.com>
---
v2: - Fix the subject and the PATCH name
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +-
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 815f6b3c79fc..3ea2824f8a68 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -836,7 +836,7 @@  struct wireless_dev *brcmf_apsta_add_vif(struct wiphy *wiphy, const char *name,
 
 	vif = brcmf_alloc_vif(cfg, type);
 	if (IS_ERR(vif))
-		return (struct wireless_dev *)vif;
+		return ERR_CAST(vif);
 
 	brcmf_cfg80211_arm_vif_event(cfg, vif);
 
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
index 6e0c90f4718b..2e627f428f5f 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
@@ -2164,7 +2164,7 @@  static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p,
 	p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE);
 	if (IS_ERR(p2p_vif)) {
 		bphy_err(drvr, "could not create discovery vif\n");
-		return (struct wireless_dev *)p2p_vif;
+		return ERR_CAST(p2p_vif);
 	}
 
 	pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp;