Skip to content

Commit

Permalink
wifi: ath12k: fix the stack frame size warning in ath12k_mac_op_hw_scan
Browse files Browse the repository at this point in the history
Fix the following W=1 kernel build warning:

drivers/net/wireless/ath/ath12k/mac.c: In function ‘ath12k_mac_op_hw_scan’:
drivers/net/wireless/ath/ath12k/mac.c:3806:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Miaoqing Pan <quic_miaoqing@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://patch.msgid.link/20240809015841.2671448-1-quic_miaoqing@quicinc.com
  • Loading branch information
Miaoqing Pan authored and Kalle Valo committed Aug 15, 2024
1 parent ae98f5c commit 6274df2
Showing 1 changed file with 30 additions and 24 deletions.
54 changes: 30 additions & 24 deletions drivers/net/wireless/ath/ath12k/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -3663,7 +3663,7 @@ static int ath12k_mac_op_hw_scan(struct ieee80211_hw *hw,
struct ath12k *ar, *prev_ar;
struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
struct cfg80211_scan_request *req = &hw_req->req;
struct ath12k_wmi_scan_req_arg arg = {};
struct ath12k_wmi_scan_req_arg *arg = NULL;
int ret;
int i;
bool create = true;
Expand Down Expand Up @@ -3745,42 +3745,47 @@ static int ath12k_mac_op_hw_scan(struct ieee80211_hw *hw,
if (ret)
goto exit;

ath12k_wmi_start_scan_init(ar, &arg);
arg.vdev_id = arvif->vdev_id;
arg.scan_id = ATH12K_SCAN_ID;
arg = kzalloc(sizeof(*arg), GFP_KERNEL);
if (!arg) {
ret = -ENOMEM;
goto exit;
}

ath12k_wmi_start_scan_init(ar, arg);
arg->vdev_id = arvif->vdev_id;
arg->scan_id = ATH12K_SCAN_ID;

if (req->ie_len) {
arg.extraie.ptr = kmemdup(req->ie, req->ie_len, GFP_KERNEL);
if (!arg.extraie.ptr) {
arg->extraie.ptr = kmemdup(req->ie, req->ie_len, GFP_KERNEL);
if (!arg->extraie.ptr) {
ret = -ENOMEM;
goto exit;
}
arg.extraie.len = req->ie_len;
arg->extraie.len = req->ie_len;
}

if (req->n_ssids) {
arg.num_ssids = req->n_ssids;
for (i = 0; i < arg.num_ssids; i++)
arg.ssid[i] = req->ssids[i];
arg->num_ssids = req->n_ssids;
for (i = 0; i < arg->num_ssids; i++)
arg->ssid[i] = req->ssids[i];
} else {
arg.scan_f_passive = 1;
arg->scan_f_passive = 1;
}

if (req->n_channels) {
arg.num_chan = req->n_channels;
arg.chan_list = kcalloc(arg.num_chan, sizeof(*arg.chan_list),
GFP_KERNEL);

if (!arg.chan_list) {
arg->num_chan = req->n_channels;
arg->chan_list = kcalloc(arg->num_chan, sizeof(*arg->chan_list),
GFP_KERNEL);
if (!arg->chan_list) {
ret = -ENOMEM;
goto exit;
}

for (i = 0; i < arg.num_chan; i++)
arg.chan_list[i] = req->channels[i]->center_freq;
for (i = 0; i < arg->num_chan; i++)
arg->chan_list[i] = req->channels[i]->center_freq;
}

ret = ath12k_start_scan(ar, &arg);
ret = ath12k_start_scan(ar, arg);
if (ret) {
ath12k_warn(ar->ab, "failed to start hw scan: %d\n", ret);
spin_lock_bh(&ar->data_lock);
Expand All @@ -3790,14 +3795,15 @@ static int ath12k_mac_op_hw_scan(struct ieee80211_hw *hw,

/* Add a margin to account for event/command processing */
ieee80211_queue_delayed_work(ath12k_ar_to_hw(ar), &ar->scan.timeout,
msecs_to_jiffies(arg.max_scan_time +
msecs_to_jiffies(arg->max_scan_time +
ATH12K_MAC_SCAN_TIMEOUT_MSECS));

exit:
kfree(arg.chan_list);

if (req->ie_len)
kfree(arg.extraie.ptr);
if (arg) {
kfree(arg->chan_list);
kfree(arg->extraie.ptr);
kfree(arg);
}

mutex_unlock(&ar->conf_mutex);

Expand Down

0 comments on commit 6274df2

Please sign in to comment.