[PATCH] wifi: zd1211rw: unwind failed interface additions
From: Jiale Yao
Date: Sun Oct 18 2026 - 21:34:48 EST
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@xxxxxxx>
---
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