Skip to contentSkip to conversation

cfg80211: return -ENOENT when stopping sched_scan while not running

PATCH New Luciano Coelho 1 participant 1 message Jul 8, 2011 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cfg80211: return -ENOENT when stopping sched_scan while not running

If we try to stop a scheduled scan while it is not running, we should return -ENOENT instead of simply ignoring the command and returning success. This is more consistent with other parts of the code.

---
 include/linux/nl80211.h |    3 ++-
 net/wireless/scan.c     |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
include/linux/nl80211.h +2 -1
index 3ec2f94..8cb025a 100644
@@ -247,7 +247,8 @@
  *	passed, all channels allowed for the current regulatory domain
  *	are used.  Extra IEs can also be passed from the userspace by
  *	using the %NL80211_ATTR_IE attribute.
- * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan
+ * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan.  Returns -ENOENT
+ *	if scheduled scan is not running.
  * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan
  *	results available.
  * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has
net/wireless/scan.c +1 -1
index 2cc9d4a..1c4672e 100644
@@ -137,7 +137,7 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev,
 	lockdep_assert_held(&rdev->sched_scan_mtx);
 
 	if (!rdev->sched_scan_req)
-		return 0;
+		return -ENOENT;
 
 	dev = rdev->sched_scan_req->dev;
 
Signature · 1 line
1.7.1