Skip to content

Commit 3c97974

Browse files
committed
wifi: cfg80211: fix return value in cfg80211_get_radio_idx_by_chan()
JIRA: https://issues.redhat.com/browse/RHEL-114891 commit 5f9d5fd Author: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com> Date: Tue Aug 12 12:53:28 2025 +0530 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> Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
1 parent aac3a8f commit 3c97974

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/net/cfg80211.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9548,7 +9548,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,
95489548
* @wiphy: the wiphy
95499549
* @chan: channel for which the supported radio index is required
95509550
*
9551-
* Return: radio index on success or a negative error code
9551+
* Return: radio index on success or -EINVAL otherwise
95529552
*/
95539553
int cfg80211_get_radio_idx_by_chan(struct wiphy *wiphy,
95549554
const struct ieee80211_channel *chan);

net/wireless/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2584,7 +2584,7 @@ int cfg80211_get_radio_idx_by_chan(struct wiphy *wiphy,
25842584
}
25852585
}
25862586

2587-
return -ENOENT;
2587+
return -EINVAL;
25882588
}
25892589
EXPORT_SYMBOL(cfg80211_get_radio_idx_by_chan);
25902590

0 commit comments

Comments
 (0)