mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] wifi: zd1211rw: unwind failed interface additions
@ 2026-10-19  1:32 Jiale Yao
  2026-10-21 10:14 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Jiale Yao @ 2026-10-19  1:32 UTC (permalink / raw)
  To: John W. Linville, Daniel Drake, linux-wireless, linux-kernel; +Cc: Jiale Yao

zd1211rw stores the vif and interface type before programming the MAC
and receive configuration. If that setup fails, mac80211 does not call
remove_interface and the stale type prevents another interface from
being added.

Clear the vif and type and restore the hardware MAC state before
returning the setup error.

Fixes: 459c51ad6e1f ("zd1211rw: port to mac80211")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
 drivers/net/wireless/zydas/zd1211rw/zd_mac.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c
index 03948f0b4628..abbe25623b44 100644
--- a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c
@@ -1102,6 +1102,7 @@ static int zd_op_add_interface(struct ieee80211_hw *hw,
 				struct ieee80211_vif *vif)
 {
 	struct zd_mac *mac = zd_hw_mac(hw);
+	int ret;
 
 	/* using NL80211_IFTYPE_UNSPECIFIED to indicate no mode selected */
 	if (mac->type != NL80211_IFTYPE_UNSPECIFIED)
@@ -1120,8 +1121,14 @@ static int zd_op_add_interface(struct ieee80211_hw *hw,
 	}
 
 	mac->vif = vif;
+	ret = set_mac_and_bssid(mac);
+	if (ret) {
+		mac->type = NL80211_IFTYPE_UNSPECIFIED;
+		mac->vif = NULL;
+		zd_write_mac_addr(&mac->chip, NULL);
+	}
 
-	return set_mac_and_bssid(mac);
+	return ret;
 }
 
 static void zd_op_remove_interface(struct ieee80211_hw *hw,
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] wifi: zd1211rw: unwind failed interface additions
  2026-10-19  1:32 [PATCH] wifi: zd1211rw: unwind failed interface additions Jiale Yao
@ 2026-10-21 10:14 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2026-10-21 10:14 UTC (permalink / raw)
  To: Jiale Yao, John W. Linville, Daniel Drake, linux-wireless, linux-kernel

On Mon, 2026-10-19 at 09:32 +0800, Jiale Yao wrote:
> zd1211rw stores the vif and interface type before programming the MAC
> and receive configuration. If that setup fails, mac80211 does not call
> remove_interface and the stale type prevents another interface from
> being added.
> 
> Clear the vif and type and restore the hardware MAC state before
> returning the setup error.

This is completely crazy. "I have an LLM and it found something that
doesn't make sense to it" is not a reason to send a patch.

Does this actually matter at all? This driver only supports a single
interface anyway - who cares about the hardware state when it's going to
be shut down right away?!

johannes

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-21 10:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-19  1:32 [PATCH] wifi: zd1211rw: unwind failed interface additions Jiale Yao
2026-10-21 10:14 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®