Skip to contentSkip to conversation

wifi: nxpwifi: fix return value check in change_vif_to_sta/ap

PATCH New Jeff Chen 1 participant 1 message Aug 31

Subsystems (2)
lore
Share & tools
lore

Jeff Chen

author
#0 lore raw

PATCH v2 1/1 wifi: nxpwifi: fix return value check in change_vif_to_sta/ap

From: Jeff Chen <[email protected]>

nxpwifi_change_vif_to_sta() and nxpwifi_change_vif_to_ap() both call nxpwifi_set_bss_mode() without storing the return value, then check 'if (ret)' which tests the stale value from the previous call. The 'if (ret) goto done' is therefore dead code, and errors from nxpwifi_set_bss_mode() are silently ignored.

Fix this by assigning the return value to ret, so the existing error path works correctly.

Fixes 73b01e57ed3e ("wifi: nxp: add nxpwifi driver for IW61x")
Assisted-by Claude:claude-opus-4-8
---
 drivers/net/wireless/nxp/nxpwifi/cfg80211.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/nxp/nxpwifi/cfg80211.c +2 -4
index 5cc8cdf594d3..335221c4f17d 100644
@@ -844,8 +844,7 @@ nxpwifi_change_vif_to_sta(struct net_device *dev,
 	update_vif_type_counter(adapter, type, 1);
 	dev->ieee80211_ptr->iftype = type;
 
-	if (nxpwifi_set_bss_mode(priv))
-		return -1;
+	ret = nxpwifi_set_bss_mode(priv);
 
 	if (ret)
 		goto done;
@@ -888,8 +887,7 @@ nxpwifi_change_vif_to_ap(struct net_device *dev,
 	update_vif_type_counter(adapter, type, 1);
 	dev->ieee80211_ptr->iftype = type;
 
-	if (nxpwifi_set_bss_mode(priv))
-		return -1;
+	ret = nxpwifi_set_bss_mode(priv);
 
 	if (ret)
 		goto done;

base-commit: ca800a9302764c445de0da0e84d2252400a770ee

Signature · 1 line
2.34.1