Linux wireless drivers development
 help / color / mirror / Atom feed
From: Jeff Chen <chunfan.chen@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: error27@gmail.com, johannes@sipsolutions.net,
	Jeff Chen <jeff.chen_1@nxp.com>,
	Dan Carpenter <dan.carpenter@linaro.org>
Subject: [PATCH] wifi: nxpwifi: fix return value check in change_vif_to_sta/ap
Date: Tue, 25 Aug 2026 18:49:42 +0800	[thread overview]
Message-ID: <20260825104942.5730-1-jeff.chen_1@nxp.com> (raw)

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")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-wireless/anwqp-LuExbRshYu@stanley.mountain/
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jeff Chen <jeff.chen_1@nxp.com>
---
 drivers/net/wireless/nxp/nxpwifi/cfg80211.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/nxp/nxpwifi/cfg80211.c b/drivers/net/wireless/nxp/nxpwifi/cfg80211.c
index 5cc8cdf594d3..ee022fa40990 100644
--- a/drivers/net/wireless/nxp/nxpwifi/cfg80211.c
+++ b/drivers/net/wireless/nxp/nxpwifi/cfg80211.c
@@ -844,9 +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,9 +886,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
-- 
2.34.1


                 reply	other threads:[~2026-08-25 10:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260825104942.5730-1-jeff.chen_1@nxp.com \
    --to=chunfan.chen@gmail.com \
    --cc=dan.carpenter@linaro.org \
    --cc=error27@gmail.com \
    --cc=jeff.chen_1@nxp.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox