| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Scan implementation for ST-Ericsson CW1200 mac80211 drivers |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2010, ST-Ericsson |
|---|
| 5 | 6 | * 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. |
|---|
| 10 | 7 | */ |
|---|
| 11 | 8 | |
|---|
| 12 | 9 | #include <linux/sched.h> |
|---|
| .. | .. |
|---|
| 78 | 75 | if (req->n_ssids > WSM_SCAN_MAX_NUM_OF_SSIDS) |
|---|
| 79 | 76 | return -EINVAL; |
|---|
| 80 | 77 | |
|---|
| 81 | | - /* will be unlocked in cw1200_scan_work() */ |
|---|
| 82 | | - down(&priv->scan.lock); |
|---|
| 83 | | - mutex_lock(&priv->conf_mutex); |
|---|
| 84 | | - |
|---|
| 85 | 78 | frame.skb = ieee80211_probereq_get(hw, priv->vif->addr, NULL, 0, |
|---|
| 86 | 79 | req->ie_len); |
|---|
| 87 | | - if (!frame.skb) { |
|---|
| 88 | | - mutex_unlock(&priv->conf_mutex); |
|---|
| 89 | | - up(&priv->scan.lock); |
|---|
| 80 | + if (!frame.skb) |
|---|
| 90 | 81 | return -ENOMEM; |
|---|
| 91 | | - } |
|---|
| 92 | 82 | |
|---|
| 93 | 83 | if (req->ie_len) |
|---|
| 94 | 84 | 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); |
|---|
| 95 | 89 | |
|---|
| 96 | 90 | ret = wsm_set_template_frame(priv, &frame); |
|---|
| 97 | 91 | if (!ret) { |
|---|
| .. | .. |
|---|
| 99 | 93 | ret = wsm_set_probe_responder(priv, true); |
|---|
| 100 | 94 | } |
|---|
| 101 | 95 | if (ret) { |
|---|
| 102 | | - dev_kfree_skb(frame.skb); |
|---|
| 103 | 96 | mutex_unlock(&priv->conf_mutex); |
|---|
| 104 | 97 | up(&priv->scan.lock); |
|---|
| 98 | + dev_kfree_skb(frame.skb); |
|---|
| 105 | 99 | return ret; |
|---|
| 106 | 100 | } |
|---|
| 107 | 101 | |
|---|
| .. | .. |
|---|
| 123 | 117 | ++priv->scan.n_ssids; |
|---|
| 124 | 118 | } |
|---|
| 125 | 119 | |
|---|
| 126 | | - if (frame.skb) |
|---|
| 127 | | - dev_kfree_skb(frame.skb); |
|---|
| 128 | 120 | mutex_unlock(&priv->conf_mutex); |
|---|
| 121 | + dev_kfree_skb(frame.skb); |
|---|
| 129 | 122 | queue_work(priv->workqueue, &priv->scan.work); |
|---|
| 130 | 123 | return 0; |
|---|
| 131 | 124 | } |
|---|