Skip to contentSkip to conversation

wifi: nxpwifi: fix missing error codes in _nxpwifi_fw_dpc()

PATCH New Jeff Chen 1 participant 1 message Aug 31

Subsystems (2)
lore
Share & tools
lore

Jeff Chen

author
#0 lore raw

PATCH 1/1 wifi: nxpwifi: fix missing error codes in _nxpwifi_fw_dpc()

From: Jeff Chen <[email protected]>

When nxpwifi_register_cfg80211(), nxpwifi_init_channel_scan_gap(), or nxpwifi_add_virtual_intf() fail, the function jumped to an error label but left ret == 0, causing _nxpwifi_fw_dpc() to return success despite the failure.

Fix by propagating the return value of nxpwifi_register_cfg80211() and nxpwifi_init_channel_scan_gap() directly into ret, and by extracting the encoded error from the ERR_PTR wdev with PTR_ERR() before each goto err_add_intf. The P2P client interface path had the same IS_ERR/goto pattern and is fixed in the same way.

Fixes 73b01e57ed3e ("wifi: nxp: add nxpwifi driver for IW61x")
Assisted-by Claude:claude-opus-4-8
---
 drivers/net/wireless/nxp/nxpwifi/main.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/wireless/nxp/nxpwifi/main.c +8 -2
index b4c63829024a..5df099b98719 100644
@@ -603,14 +603,18 @@ static int _nxpwifi_fw_dpc(const struct firmware *firmware, void *context)
 	maybe_quirk_fw_disable_ds(adapter);
 
 	if (!adapter->wiphy) {
-		if (nxpwifi_register_cfg80211(adapter)) {
+		ret = nxpwifi_register_cfg80211(adapter);
+
+		if (ret) {
 			nxpwifi_dbg(adapter, ERROR,
 				    "cannot register with cfg80211\n");
 			goto err_init_fw;
 		}
 	}
 
-	if (nxpwifi_init_channel_scan_gap(adapter)) {
+	ret = nxpwifi_init_channel_scan_gap(adapter);
+
+	if (ret) {
 		nxpwifi_dbg(adapter, ERROR,
 			    "could not init channel stats table\n");
 		goto err_init_chan_scan;
@@ -623,6 +627,7 @@ static int _nxpwifi_fw_dpc(const struct firmware *firmware, void *context)
 	if (IS_ERR(wdev)) {
 		nxpwifi_dbg(adapter, ERROR,
 			    "cannot create default STA interface\n");
+		ret = PTR_ERR(wdev);
 		rtnl_unlock();
 		goto err_add_intf;
 	}
@@ -632,6 +637,7 @@ static int _nxpwifi_fw_dpc(const struct firmware *firmware, void *context)
 	if (IS_ERR(wdev)) {
 		nxpwifi_dbg(adapter, ERROR,
 			    "cannot create AP interface\n");
+		ret = PTR_ERR(wdev);
 		rtnl_unlock();
 		goto err_add_intf;
 	}

base-commit: ca800a9302764c445de0da0e84d2252400a770ee
prerequisite-patch-id: f0aef766da5c18da0e8867bf47bcff1991a4f0d5

Signature · 1 line
2.34.1