[PATCH] mac80211: fix ieee80211_set_antenna() return value

From: Christoph Rudorff

Date: Fri Oct 16 2026 - 08:28:28 EST


To set up antenna the device must be disabled, "not started".
So return -EBUSY instead of -EOPNOTSUPP

$ iw phy0 set antenna 0x3
command failed: Operation not supported (-95)

expected output:
command failed: Device or resource busy (-16)

Signed-off-by: Christoph Rudorff <chris@xxxxxxxxxxx>
---
I was confused that none of my wifi devices can set_antenna.

Code review, turns out, the device must be disabled "not started".

So correct the return value and later drv_set_antenna()
handles the "not supported" case.

This is a good candidate for backport.
---
net/mac80211/cfg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index a1753335eb9d..87a9ead7c638 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -4920,7 +4920,7 @@ static int ieee80211_set_antenna(struct wiphy *wiphy, int radio_idx,
int ret;

if (local->started)
- return -EOPNOTSUPP;
+ return -EBUSY;

ret = drv_set_antenna(local, tx_ant, rx_ant);
if (ret)

---
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
change-id: 20261016-fix-set-antenna-50205dc86cb6

Best regards,
--
Christoph Rudorff <chris@xxxxxxxxxxx>