]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
wifi: cfg80211: fix return value in cfg80211_get_radio_idx_by_chan()
authorAditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Tue, 12 Aug 2025 07:23:28 +0000 (12:53 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 4 Sep 2025 09:19:01 +0000 (11:19 +0200)
commit5f9d5fd8e08968e66d0212f782fc24d76e52800f
tree5029ab4d23d4865c0867cd790e6eefb5cbf99aaf
parent1860b1a8257c5d52fbed3093eb9a3e7476619403
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@oss.qualcomm.com>
Link: https://patch.msgid.link/20250812-fix_scan_ap_flag_requirement_during_mlo-v4-1-383ffb6da213@oss.qualcomm.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
net/wireless/util.c