hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/net/wireless/st/cw1200/scan.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Scan implementation for ST-Ericsson CW1200 mac80211 drivers
34 *
45 * Copyright (c) 2010, ST-Ericsson
56 * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
107 */
118
129 #include <linux/sched.h>
....@@ -78,20 +75,17 @@
7875 if (req->n_ssids > WSM_SCAN_MAX_NUM_OF_SSIDS)
7976 return -EINVAL;
8077
81
- /* will be unlocked in cw1200_scan_work() */
82
- down(&priv->scan.lock);
83
- mutex_lock(&priv->conf_mutex);
84
-
8578 frame.skb = ieee80211_probereq_get(hw, priv->vif->addr, NULL, 0,
8679 req->ie_len);
87
- if (!frame.skb) {
88
- mutex_unlock(&priv->conf_mutex);
89
- up(&priv->scan.lock);
80
+ if (!frame.skb)
9081 return -ENOMEM;
91
- }
9282
9383 if (req->ie_len)
9484 skb_put_data(frame.skb, req->ie, req->ie_len);
85
+
86
+ /* will be unlocked in cw1200_scan_work() */
87
+ down(&priv->scan.lock);
88
+ mutex_lock(&priv->conf_mutex);
9589
9690 ret = wsm_set_template_frame(priv, &frame);
9791 if (!ret) {
....@@ -99,9 +93,9 @@
9993 ret = wsm_set_probe_responder(priv, true);
10094 }
10195 if (ret) {
102
- dev_kfree_skb(frame.skb);
10396 mutex_unlock(&priv->conf_mutex);
10497 up(&priv->scan.lock);
98
+ dev_kfree_skb(frame.skb);
10599 return ret;
106100 }
107101
....@@ -123,9 +117,8 @@
123117 ++priv->scan.n_ssids;
124118 }
125119
126
- if (frame.skb)
127
- dev_kfree_skb(frame.skb);
128120 mutex_unlock(&priv->conf_mutex);
121
+ dev_kfree_skb(frame.skb);
129122 queue_work(priv->workqueue, &priv->scan.work);
130123 return 0;
131124 }