[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250812-fix_scan_ap_flag_requirement_during_mlo-v4-1-383ffb6da213@oss.qualcomm.com>
Date: Tue, 12 Aug 2025 12:53:28 +0530
From: Aditya Kumar Singh <aditya.kumar.singh@....qualcomm.com>
To: Johannes Berg <johannes@...solutions.net>,
Aditya Kumar Singh <aditya.kumar.singh@....qualcomm.com>
Cc: Johannes Berg <johannes.berg@...el.com>, linux-wireless@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH wireless-next v4 1/3] wifi: cfg80211: fix return value in
cfg80211_get_radio_idx_by_chan()
If a valid radio index is not found, the function returns -ENOENT. If the
channel argument itself is invalid, it returns -EINVAL. However, since the
caller only checks for < 0, the distinction between these error codes is
not utilized much. Also, handling these two distinct error codes throughout
the codebase adds complexity, as both cases must be addressed separately. A
subsequent change aims to simplify this by using a single error code for
all invalid cases, making error handling more consistent and streamlined.
To support this change, update the return value to -EINVAL when a valid
radio index is not found. This is still appropriate because, even if the
channel argument is structurally valid, the absence of a corresponding
radio index implies that the argument is effectively invalid—otherwise, a
valid index would have been found.
Signed-off-by: Aditya Kumar Singh <aditya.kumar.singh@....qualcomm.com>
---
include/net/cfg80211.h | 2 +-
net/wireless/util.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 406626ff6cc89df4df30e6e623403b4d9ceb6cbd..cb1c36be27493bc0b356497cdbc68f1be7b4a94d 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -9548,7 +9548,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,
* @wiphy: the wiphy
* @chan: channel for which the supported radio index is required
*
- * Return: radio index on success or a negative error code
+ * Return: radio index on success or -EINVAL otherwise
*/
int cfg80211_get_radio_idx_by_chan(struct wiphy *wiphy,
const struct ieee80211_channel *chan);
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 240c68baa3d1f71a80a36af854acf4aa7ce75d05..d12d49134c88159f19c2226517d129f74f3ce764 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -2584,7 +2584,7 @@ int cfg80211_get_radio_idx_by_chan(struct wiphy *wiphy,
}
}
- return -ENOENT;
+ return -EINVAL;
}
EXPORT_SYMBOL(cfg80211_get_radio_idx_by_chan);
--
2.34.1
Powered by blists - more mailing lists