diff options
| author | Kees Cook <kees@kernel.org> | 2026-02-20 23:49:23 -0800 |
|---|---|---|
| committer | Kees Cook <kees@kernel.org> | 2026-02-21 01:02:28 -0800 |
| commit | 69050f8d6d075dc01af7a5f2f550a8067510366f (patch) | |
| tree | bb265f94d9dfa7876c06a5d9f88673d496a15341 /drivers/net/wireless | |
| parent | d39a1d7486d98668dd34aaa6732aad7977c45f5a (diff) | |
| download | lwn-69050f8d6d075dc01af7a5f2f550a8067510366f.tar.gz lwn-69050f8d6d075dc01af7a5f2f550a8067510366f.zip | |
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:
Single allocations: kmalloc(sizeof(TYPE), ...)
are replaced with: kmalloc_obj(TYPE, ...)
Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with: kmalloc_objs(TYPE, COUNT, ...)
Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...)
(where TYPE may also be *VAR)
The resulting allocations no longer return "void *", instead returning
"TYPE *".
Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'drivers/net/wireless')
289 files changed, 910 insertions, 975 deletions
diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c index 1230e6278f23..f1567365ac04 100644 --- a/drivers/net/wireless/ath/ar5523/ar5523.c +++ b/drivers/net/wireless/ath/ar5523/ar5523.c @@ -1512,11 +1512,11 @@ static int ar5523_load_firmware(struct usb_device *dev) return -ENOENT; } - txblock = kzalloc(sizeof(*txblock), GFP_KERNEL); + txblock = kzalloc_obj(*txblock, GFP_KERNEL); if (!txblock) goto out; - rxblock = kmalloc(sizeof(*rxblock), GFP_KERNEL); + rxblock = kmalloc_obj(*rxblock, GFP_KERNEL); if (!rxblock) goto out_free_txblock; diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c index 82f120ee1c66..23e5163acc9a 100644 --- a/drivers/net/wireless/ath/ath10k/ce.c +++ b/drivers/net/wireless/ath/ath10k/ce.c @@ -1461,8 +1461,8 @@ ath10k_ce_alloc_src_ring(struct ath10k *ar, unsigned int ce_id, nentries = roundup_pow_of_two(nentries); - src_ring = kzalloc(struct_size(src_ring, per_transfer_context, - nentries), GFP_KERNEL); + src_ring = kzalloc_flex(*src_ring, per_transfer_context, nentries, + GFP_KERNEL); if (src_ring == NULL) return ERR_PTR(-ENOMEM); @@ -1519,8 +1519,8 @@ ath10k_ce_alloc_src_ring_64(struct ath10k *ar, unsigned int ce_id, nentries = roundup_pow_of_two(nentries); - src_ring = kzalloc(struct_size(src_ring, per_transfer_context, - nentries), GFP_KERNEL); + src_ring = kzalloc_flex(*src_ring, per_transfer_context, nentries, + GFP_KERNEL); if (!src_ring) return ERR_PTR(-ENOMEM); @@ -1575,8 +1575,8 @@ ath10k_ce_alloc_dest_ring(struct ath10k *ar, unsigned int ce_id, nentries = roundup_pow_of_two(attr->dest_nentries); - dest_ring = kzalloc(struct_size(dest_ring, per_transfer_context, - nentries), GFP_KERNEL); + dest_ring = kzalloc_flex(*dest_ring, per_transfer_context, nentries, + GFP_KERNEL); if (dest_ring == NULL) return ERR_PTR(-ENOMEM); @@ -1619,8 +1619,8 @@ ath10k_ce_alloc_dest_ring_64(struct ath10k *ar, unsigned int ce_id, nentries = roundup_pow_of_two(attr->dest_nentries); - dest_ring = kzalloc(struct_size(dest_ring, per_transfer_context, - nentries), GFP_KERNEL); + dest_ring = kzalloc_flex(*dest_ring, per_transfer_context, nentries, + GFP_KERNEL); if (!dest_ring) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index d7e429041065..bea2cd4e5ee4 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -807,8 +807,7 @@ int ath10k_htt_rx_alloc(struct ath10k_htt *htt) } htt->rx_ring.netbufs_ring = - kcalloc(htt->rx_ring.size, sizeof(struct sk_buff *), - GFP_KERNEL); + kzalloc_objs(struct sk_buff *, htt->rx_ring.size, GFP_KERNEL); if (!htt->rx_ring.netbufs_ring) goto err_netbuf; diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index da6f7957a0ae..ef595a939bde 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -6431,7 +6431,7 @@ static int ath10k_hw_scan(struct ieee80211_hw *hw, if (ret) goto exit; - arg = kzalloc(sizeof(*arg), GFP_KERNEL); + arg = kzalloc_obj(*arg, GFP_KERNEL); if (!arg) { ret = -ENOMEM; goto exit; @@ -7559,8 +7559,8 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, } if (ath10k_debug_is_extd_tx_stats_enabled(ar)) { - arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), - GFP_KERNEL); + arsta->tx_stats = kzalloc_obj(*arsta->tx_stats, + GFP_KERNEL); if (!arsta->tx_stats) { ath10k_mac_dec_num_stations(arvif, sta); ret = -ENOMEM; @@ -7972,7 +7972,7 @@ static int ath10k_remain_on_channel(struct ieee80211_hw *hw, scan_time_msec = ar->hw->wiphy->max_remain_on_channel_duration * 2; - arg = kzalloc(sizeof(*arg), GFP_KERNEL); + arg = kzalloc_obj(*arg, GFP_KERNEL); if (!arg) { ret = -ENOMEM; goto exit; @@ -8954,8 +8954,7 @@ ath10k_mac_op_change_chanctx(struct ieee80211_hw *hw, if (arg.n_vifs == 0) goto radar; - arg.vifs = kcalloc(arg.n_vifs, sizeof(arg.vifs[0]), - GFP_KERNEL); + arg.vifs = kzalloc_objs(arg.vifs[0], arg.n_vifs, GFP_KERNEL); if (!arg.vifs) goto radar; diff --git a/drivers/net/wireless/ath/ath10k/qmi.c b/drivers/net/wireless/ath/ath10k/qmi.c index 8275345631a0..62c9ef500ee7 100644 --- a/drivers/net/wireless/ath/ath10k/qmi.c +++ b/drivers/net/wireless/ath/ath10k/qmi.c @@ -245,7 +245,7 @@ static int ath10k_qmi_bdf_dnld_send_sync(struct ath10k_qmi *qmi) const u8 *temp; int ret; - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req, GFP_KERNEL); if (!req) return -ENOMEM; @@ -437,7 +437,7 @@ ath10k_qmi_cfg_send_sync_msg(struct ath10k *ar, int ret; u32 i; - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req, GFP_KERNEL); if (!req) return -ENOMEM; @@ -578,7 +578,7 @@ static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi) struct qmi_txn txn; int ret; - resp = kzalloc(sizeof(*resp), GFP_KERNEL); + resp = kzalloc_obj(*resp, GFP_KERNEL); if (!resp) return -ENOMEM; @@ -877,7 +877,7 @@ ath10k_qmi_driver_event_post(struct ath10k_qmi *qmi, { struct ath10k_qmi_driver_event *event; - event = kzalloc(sizeof(*event), GFP_ATOMIC); + event = kzalloc_obj(*event, GFP_ATOMIC); if (!event) return -ENOMEM; @@ -1075,7 +1075,7 @@ int ath10k_qmi_init(struct ath10k *ar, u32 msa_size) struct ath10k_qmi *qmi; int ret; - qmi = kzalloc(sizeof(*qmi), GFP_KERNEL); + qmi = kzalloc_obj(*qmi, GFP_KERNEL); if (!qmi) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index 00d0556dafef..ff046cff7399 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -246,7 +246,7 @@ static int ath10k_sdio_writesb32(struct ath10k *ar, u32 addr, u32 val) __le32 *buf; int ret; - buf = kzalloc(sizeof(*buf), GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (!buf) return -ENOMEM; @@ -1766,7 +1766,7 @@ static int ath10k_sdio_diag_read32(struct ath10k *ar, u32 address, __le32 *val; int ret; - val = kzalloc(sizeof(*val), GFP_KERNEL); + val = kzalloc_obj(*val, GFP_KERNEL); if (!val) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c index 493bfb410aff..50a3498a0bfd 100644 --- a/drivers/net/wireless/ath/ath10k/txrx.c +++ b/drivers/net/wireless/ath/ath10k/txrx.c @@ -230,7 +230,7 @@ void ath10k_peer_map_event(struct ath10k_htt *htt, spin_lock_bh(&ar->data_lock); peer = ath10k_peer_find(ar, ev->vdev_id, ev->addr); if (!peer) { - peer = kzalloc(sizeof(*peer), GFP_ATOMIC); + peer = kzalloc_obj(*peer, GFP_ATOMIC); if (!peer) goto exit; diff --git a/drivers/net/wireless/ath/ath10k/usb.c b/drivers/net/wireless/ath/ath10k/usb.c index 1732a4f98418..59969db56048 100644 --- a/drivers/net/wireless/ath/ath10k/usb.c +++ b/drivers/net/wireless/ath/ath10k/usb.c @@ -799,7 +799,7 @@ static int ath10k_usb_alloc_pipe_resources(struct ath10k *ar, init_usb_anchor(&pipe->urb_submitted); for (i = 0; i < urb_cnt; i++) { - urb_context = kzalloc(sizeof(*urb_context), GFP_KERNEL); + urb_context = kzalloc_obj(*urb_context, GFP_KERNEL); if (!urb_context) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c index 16d07d619b4d..ec8e91707f84 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c @@ -145,7 +145,7 @@ ath10k_wmi_tlv_parse_alloc(struct ath10k *ar, const void *ptr, const void **tb; int ret; - tb = kcalloc(WMI_TLV_TAG_MAX, sizeof(*tb), gfp); + tb = kzalloc_objs(*tb, WMI_TLV_TAG_MAX, gfp); if (!tb) return ERR_PTR(-ENOMEM); @@ -1546,7 +1546,7 @@ static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k *ar, data += sizeof(*src); data_len -= sizeof(*src); - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -1569,7 +1569,7 @@ static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k *ar, data += sizeof(*src); data_len -= sizeof(*src); - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -1590,7 +1590,7 @@ static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k *ar, data += sizeof(*src); data_len -= sizeof(*src); - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -3063,7 +3063,7 @@ ath10k_wmi_mgmt_tx_alloc_msdu_id(struct ath10k *ar, struct sk_buff *skb, struct ath10k_mgmt_tx_pkt_addr *pkt_addr; int ret; - pkt_addr = kmalloc(sizeof(*pkt_addr), GFP_ATOMIC); + pkt_addr = kmalloc_obj(*pkt_addr, GFP_ATOMIC); if (!pkt_addr) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index ce22141e5efd..0bdb38edd915 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -3046,7 +3046,7 @@ static int ath10k_wmi_main_op_pull_fw_stats(struct ath10k *ar, if (!skb_pull(skb, sizeof(*src))) return -EPROTO; - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -3067,7 +3067,7 @@ static int ath10k_wmi_main_op_pull_fw_stats(struct ath10k *ar, if (!skb_pull(skb, sizeof(*src))) return -EPROTO; - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -3100,7 +3100,7 @@ static int ath10k_wmi_10x_op_pull_fw_stats(struct ath10k *ar, if (!skb_pull(skb, sizeof(*src))) return -EPROTO; - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -3122,7 +3122,7 @@ static int ath10k_wmi_10x_op_pull_fw_stats(struct ath10k *ar, if (!skb_pull(skb, sizeof(*src))) return -EPROTO; - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -3161,7 +3161,7 @@ static int ath10k_wmi_10_2_op_pull_fw_stats(struct ath10k *ar, if (!skb_pull(skb, sizeof(*src))) return -EPROTO; - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -3198,7 +3198,7 @@ static int ath10k_wmi_10_2_op_pull_fw_stats(struct ath10k *ar, if (!skb_pull(skb, sizeof(*src))) return -EPROTO; - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -3238,7 +3238,7 @@ static int ath10k_wmi_10_2_4_op_pull_fw_stats(struct ath10k *ar, if (!skb_pull(skb, sizeof(*src))) return -EPROTO; - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -3281,7 +3281,7 @@ static int ath10k_wmi_10_2_4_op_pull_fw_stats(struct ath10k *ar, if (!skb_pull(skb, stats_len)) return -EPROTO; - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -3330,7 +3330,7 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar, if (!skb_pull(skb, sizeof(*src))) return -EPROTO; - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -3376,7 +3376,7 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar, if (!skb_pull(skb, sizeof(*src))) return -EPROTO; - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -3409,7 +3409,7 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar, if (!skb_pull(skb, sizeof(*src))) return -EPROTO; - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -3429,7 +3429,7 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar, if (!skb_pull(skb, sizeof(*src))) return -EPROTO; - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; ath10k_wmi_10_4_pull_vdev_stats(src, dst); @@ -4912,7 +4912,7 @@ void ath10k_wmi_event_pdev_tpc_config(struct ath10k *ar, struct sk_buff *skb) rate_max = WMI_TPC_RATE_MAX; } - tpc_stats = kzalloc(sizeof(*tpc_stats), GFP_ATOMIC); + tpc_stats = kzalloc_obj(*tpc_stats, GFP_ATOMIC); if (!tpc_stats) return; @@ -5168,7 +5168,7 @@ void ath10k_wmi_event_tpc_final_table(struct ath10k *ar, struct sk_buff *skb) rate_max = WMI_TPC_FINAL_RATE_MAX; } - tpc_stats = kzalloc(sizeof(*tpc_stats), GFP_ATOMIC); + tpc_stats = kzalloc_obj(*tpc_stats, GFP_ATOMIC); if (!tpc_stats) return; diff --git a/drivers/net/wireless/ath/ath10k/wow.c b/drivers/net/wireless/ath/ath10k/wow.c index aa7b2e703f3d..8b7f608b5265 100644 --- a/drivers/net/wireless/ath/ath10k/wow.c +++ b/drivers/net/wireless/ath/ath10k/wow.c @@ -301,7 +301,7 @@ static int ath10k_vif_wow_set_wakeups(struct ath10k_vif *arvif, struct wmi_pno_scan_req *pno; int ret; - pno = kzalloc(sizeof(*pno), GFP_KERNEL); + pno = kzalloc_obj(*pno, GFP_KERNEL); if (!pno) return -ENOMEM; @@ -413,7 +413,7 @@ static int ath10k_vif_wow_clean_nlo(struct ath10k_vif *arvif) if (ar->nlo_enabled) { struct wmi_pno_scan_req *pno; - pno = kzalloc(sizeof(*pno), GFP_KERNEL); + pno = kzalloc_obj(*pno, GFP_KERNEL); if (!pno) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath11k/ce.c b/drivers/net/wireless/ath/ath11k/ce.c index a7a163621b21..b91f8bb9a81c 100644 --- a/drivers/net/wireless/ath/ath11k/ce.c +++ b/drivers/net/wireless/ath/ath11k/ce.c @@ -615,7 +615,7 @@ ath11k_ce_alloc_ring(struct ath11k_base *ab, int nentries, int desc_sz) struct ath11k_ce_ring *ce_ring; dma_addr_t base_addr; - ce_ring = kzalloc(struct_size(ce_ring, skb, nentries), GFP_KERNEL); + ce_ring = kzalloc_flex(*ce_ring, skb, nentries, GFP_KERNEL); if (ce_ring == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/wireless/ath/ath11k/cfr.c b/drivers/net/wireless/ath/ath11k/cfr.c index 61bf1c0884f7..61ac656ece07 100644 --- a/drivers/net/wireless/ath/ath11k/cfr.c +++ b/drivers/net/wireless/ath/ath11k/cfr.c @@ -975,8 +975,7 @@ int ath11k_cfr_init(struct ath11k_base *ab) spin_lock_init(&cfr->lut_lock); num_lut_entries = min_t(u32, CFR_MAX_LUT_ENTRIES, db_cap.min_elem); - cfr->lut = kcalloc(num_lut_entries, sizeof(*cfr->lut), - GFP_KERNEL); + cfr->lut = kzalloc_objs(*cfr->lut, num_lut_entries, GFP_KERNEL); if (!cfr->lut) { ret = -ENOMEM; goto err; diff --git a/drivers/net/wireless/ath/ath11k/dbring.c b/drivers/net/wireless/ath/ath11k/dbring.c index d6994ce6ebff..6ac18f8a1e5f 100644 --- a/drivers/net/wireless/ath/ath11k/dbring.c +++ b/drivers/net/wireless/ath/ath11k/dbring.c @@ -127,7 +127,7 @@ static int ath11k_dbring_fill_bufs(struct ath11k *ar, size = ring->buf_sz + align - 1; while (num_remain > 0) { - buff = kzalloc(sizeof(*buff), GFP_ATOMIC); + buff = kzalloc_obj(*buff, GFP_ATOMIC); if (!buff) break; diff --git a/drivers/net/wireless/ath/ath11k/debugfs.c b/drivers/net/wireless/ath/ath11k/debugfs.c index 50f344803e8f..9b8660e56a1a 100644 --- a/drivers/net/wireless/ath/ath11k/debugfs.c +++ b/drivers/net/wireless/ath/ath11k/debugfs.c @@ -1193,8 +1193,7 @@ static int ath11k_debugfs_dbr_dbg_init(struct ath11k *ar, int dbr_id) if (ar->debug.dbr_debug[dbr_id]) return 0; - ar->debug.dbr_debug[dbr_id] = kzalloc(sizeof(*dbr_debug), - GFP_KERNEL); + ar->debug.dbr_debug[dbr_id] = kzalloc_obj(*dbr_debug, GFP_KERNEL); if (!ar->debug.dbr_debug[dbr_id]) return -ENOMEM; @@ -1216,9 +1215,9 @@ static int ath11k_debugfs_dbr_dbg_init(struct ath11k *ar, int dbr_id) dbr_debug->dbr_debug_enabled = true; dbr_dbg_data->num_ring_debug_entries = ATH11K_DEBUG_DBR_ENTRIES_MAX; dbr_dbg_data->dbr_debug_idx = 0; - dbr_dbg_data->entries = kcalloc(ATH11K_DEBUG_DBR_ENTRIES_MAX, - sizeof(struct ath11k_dbg_dbr_entry), - GFP_KERNEL); + dbr_dbg_data->entries = kzalloc_objs(struct ath11k_dbg_dbr_entry, + ATH11K_DEBUG_DBR_ENTRIES_MAX, + GFP_KERNEL); if (!dbr_dbg_data->entries) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index b9e976ddcbbf..49d959b2e148 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -772,7 +772,7 @@ static void ath11k_dp_rx_tid_del_func(struct ath11k_dp *dp, void *ctx, return; } - elem = kzalloc(sizeof(*elem), GFP_ATOMIC); + elem = kzalloc_obj(*elem, GFP_ATOMIC); if (!elem) goto free_desc; @@ -1542,7 +1542,7 @@ struct htt_ppdu_stats_info *ath11k_dp_htt_get_ppdu_desc(struct ath11k *ar, } } - ppdu_info = kzalloc(sizeof(*ppdu_info), GFP_ATOMIC); + ppdu_info = kzalloc_obj(*ppdu_info, GFP_ATOMIC); if (!ppdu_info) return NULL; @@ -5485,7 +5485,7 @@ static int ath11k_dp_rx_full_mon_prepare_mpdu(struct ath11k_dp *dp, struct sk_buff *head, struct sk_buff *tail) { - mon_mpdu = kzalloc(sizeof(*mon_mpdu), GFP_ATOMIC); + mon_mpdu = kzalloc_obj(*mon_mpdu, GFP_ATOMIC); if (!mon_mpdu) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless/ath/ath11k/dp_tx.c index 86e1e6c27b36..9c2310665713 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -796,7 +796,7 @@ int ath11k_dp_tx_send_reo_cmd(struct ath11k_base *ab, struct dp_rx_tid *rx_tid, * for tid delete command to free up the resource on the command status * indication? */ - dp_cmd = kzalloc(sizeof(*dp_cmd), GFP_ATOMIC); + dp_cmd = kzalloc_obj(*dp_cmd, GFP_ATOMIC); if (!dp_cmd) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 4dfd08b58416..7ec87ea7620f 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -4221,7 +4221,7 @@ static int ath11k_mac_op_hw_scan(struct ieee80211_hw *hw, if (ret) goto exit; - arg = kzalloc(sizeof(*arg), GFP_KERNEL); + arg = kzalloc_obj(*arg, GFP_KERNEL); if (!arg) { ret = -ENOMEM; @@ -7876,7 +7876,7 @@ ath11k_mac_update_active_vif_chan(struct ath11k *ar, if (arg.n_vifs == 0) return; - arg.vifs = kcalloc(arg.n_vifs, sizeof(arg.vifs[0]), GFP_KERNEL); + arg.vifs = kzalloc_objs(arg.vifs[0], arg.n_vifs, GFP_KERNEL); if (!arg.vifs) return; @@ -9729,7 +9729,7 @@ static int ath11k_mac_op_remain_on_channel(struct ieee80211_hw *hw, scan_time_msec = ar->hw->wiphy->max_remain_on_channel_duration * 2; - arg = kzalloc(sizeof(*arg), GFP_KERNEL); + arg = kzalloc_obj(*arg, GFP_KERNEL); if (!arg) { ret = -ENOMEM; goto exit; @@ -9823,7 +9823,7 @@ static int ath11k_mac_station_add(struct ath11k *ar, arvif->reinstall_group_keys = false; } - arsta->rx_stats = kzalloc(sizeof(*arsta->rx_stats), GFP_KERNEL); + arsta->rx_stats = kzalloc_obj(*arsta->rx_stats, GFP_KERNEL); if (!arsta->rx_stats) { ret = -ENOMEM; goto dec_num_station; @@ -9844,7 +9844,7 @@ static int ath11k_mac_station_add(struct ath11k *ar, sta->addr, arvif->vdev_id); if (ath11k_debugfs_is_extd_tx_stats_enabled(ar)) { - arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), GFP_KERNEL); + arsta->tx_stats = kzalloc_obj(*arsta->tx_stats, GFP_KERNEL); if (!arsta->tx_stats) { ret = -ENOMEM; goto free_peer; @@ -10278,7 +10278,7 @@ static void ath11k_mac_setup_mac_address_list(struct ath11k *ar) return; n_addresses = ar->ab->hw_params.num_vdevs; - addresses = kcalloc(n_addresses, sizeof(*addresses), GFP_KERNEL); + addresses = kzalloc_objs(*addresses, n_addresses, GFP_KERNEL); if (!addresses) return; @@ -10310,7 +10310,7 @@ static int ath11k_mac_setup_iface_combinations(struct ath11k *ar) else n_combos = 1; - combinations = kcalloc(n_combos, sizeof(*combinations), GFP_KERNEL); + combinations = kzalloc_objs(*combinations, n_combos, GFP_KERNEL); if (!combinations) return -ENOMEM; @@ -10319,7 +10319,7 @@ static int ath11k_mac_setup_iface_combinations(struct ath11k *ar) else n_limits = 2; - limits = kcalloc(n_limits, sizeof(*limits), GFP_KERNEL); + limits = kzalloc_objs(*limits, n_limits, GFP_KERNEL); if (!limits) { kfree(combinations); return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c index d2c44f7f9b62..7cb91d23362f 100644 --- a/drivers/net/wireless/ath/ath11k/mhi.c +++ b/drivers/net/wireless/ath/ath11k/mhi.c @@ -207,7 +207,7 @@ static int ath11k_mhi_get_msi(struct ath11k_pci *ab_pci) ath11k_dbg(ab, ATH11K_DBG_PCI, "num_vectors %d base_vector %d\n", num_vectors, base_vector); - irq = kcalloc(num_vectors, sizeof(int), GFP_KERNEL); + irq = kzalloc_objs(int, num_vectors, GFP_KERNEL); if (!irq) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath11k/peer.c b/drivers/net/wireless/ath/ath11k/peer.c index 6d0126c39301..027cc7aa58c8 100644 --- a/drivers/net/wireless/ath/ath11k/peer.c +++ b/drivers/net/wireless/ath/ath11k/peer.c @@ -125,7 +125,7 @@ void ath11k_peer_map_event(struct ath11k_base *ab, u8 vdev_id, u16 peer_id, spin_lock_bh(&ab->base_lock); peer = ath11k_peer_find(ab, vdev_id, mac_addr); if (!peer) { - peer = kzalloc(sizeof(*peer), GFP_ATOMIC); + peer = kzalloc_obj(*peer, GFP_ATOMIC); if (!peer) goto exit; diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c index ff6a97e328b8..ea6f560abd98 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c @@ -1799,11 +1799,11 @@ static int ath11k_qmi_fw_ind_register_send(struct ath11k_base *ab) struct qmi_txn txn; int ret; - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req, GFP_KERNEL); if (!req) return -ENOMEM; - resp = kzalloc(sizeof(*resp), GFP_KERNEL); + resp = kzalloc_obj(*resp, GFP_KERNEL); if (!resp) { ret = -ENOMEM; goto resp_out; @@ -1878,7 +1878,7 @@ static int ath11k_qmi_respond_fw_mem_request(struct ath11k_base *ab) int ret = 0, i; bool delayed; - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req, GFP_KERNEL); if (!req) return -ENOMEM; @@ -2306,7 +2306,7 @@ static int ath11k_qmi_load_file_target_mem(struct ath11k_base *ab, int ret = 0; u32 remaining = len; - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req, GFP_KERNEL); if (!req) return -ENOMEM; @@ -2705,7 +2705,7 @@ static int ath11k_qmi_wlanfw_wlan_cfg_send(struct ath11k_base *ab) ce_cfg = (struct ce_pipe_config *)ab->qmi.ce_cfg.tgt_ce; svc_cfg = (struct service_to_pipe *)ab->qmi.ce_cfg.svc_to_ce_map; - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req, GFP_KERNEL); if (!req) return -ENOMEM; @@ -2929,7 +2929,7 @@ ath11k_qmi_driver_event_post(struct ath11k_qmi *qmi, { struct ath11k_qmi_driver_event *event; - event = kzalloc(sizeof(*event), GFP_ATOMIC); + event = kzalloc_obj(*event, GFP_ATOMIC); if (!event) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c index 49b79648752c..0cf830d97dbd 100644 --- a/drivers/net/wireless/ath/ath11k/reg.c +++ b/drivers/net/wireless/ath/ath11k/reg.c @@ -146,8 +146,7 @@ int ath11k_reg_update_chan_list(struct ath11k *ar, bool wait) if (WARN_ON(!num_channels)) return -EINVAL; - params = kzalloc(struct_size(params, ch_param, num_channels), - GFP_KERNEL); + params = kzalloc_flex(*params, ch_param, num_channels, GFP_KERNEL); if (!params) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 451cc4c719ae..40747fba3b0c 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -249,7 +249,7 @@ const void **ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, const void **tb; int ret; - tb = kcalloc(WMI_TAG_MAX, sizeof(*tb), gfp); + tb = kzalloc_objs(*tb, WMI_TAG_MAX, gfp); if (!tb) return ERR_PTR(-ENOMEM); @@ -4918,9 +4918,8 @@ static int ath11k_wmi_tlv_ext_soc_hal_reg_caps_parse(struct ath11k_base *soc, } if (!soc->reg_info_store) { - soc->reg_info_store = kcalloc(soc->num_radios, - sizeof(*soc->reg_info_store), - GFP_ATOMIC); + soc->reg_info_store = kzalloc_objs(*soc->reg_info_store, + soc->num_radios, GFP_ATOMIC); if (!soc->reg_info_store) return -ENOMEM; } @@ -5238,8 +5237,7 @@ static struct cur_reg_rule struct cur_reg_rule *reg_rule_ptr; u32 count; - reg_rule_ptr = kcalloc(num_reg_rules, sizeof(*reg_rule_ptr), - GFP_ATOMIC); + reg_rule_ptr = kzalloc_objs(*reg_rule_ptr, num_reg_rules, GFP_ATOMIC); if (!reg_rule_ptr) return NULL; @@ -5388,7 +5386,7 @@ static struct cur_reg_rule struct cur_reg_rule *reg_rule_ptr; u32 count; - reg_rule_ptr = kcalloc(num_reg_rules, sizeof(*reg_rule_ptr), GFP_ATOMIC); + reg_rule_ptr = kzalloc_objs(*reg_rule_ptr, num_reg_rules, GFP_ATOMIC); if (!reg_rule_ptr) return NULL; @@ -6694,7 +6692,7 @@ static int ath11k_wmi_tlv_fw_stats_data_parse(struct ath11k_base *ab, data += sizeof(*src); len -= sizeof(*src); - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -6737,7 +6735,7 @@ static int ath11k_wmi_tlv_fw_stats_data_parse(struct ath11k_base *ab, data += sizeof(*src); len -= sizeof(*src); - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -6760,7 +6758,7 @@ static int ath11k_wmi_tlv_fw_stats_data_parse(struct ath11k_base *ab, data += sizeof(*src); len -= sizeof(*src); - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -7247,7 +7245,7 @@ static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *sk struct cur_regulatory_info *reg_info; int ret; - reg_info = kzalloc(sizeof(*reg_info), GFP_ATOMIC); + reg_info = kzalloc_obj(*reg_info, GFP_ATOMIC); if (!reg_info) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath11k/wow.c b/drivers/net/wireless/ath/ath11k/wow.c index b6f08755129f..7b696d1dd0e8 100644 --- a/drivers/net/wireless/ath/ath11k/wow.c +++ b/drivers/net/wireless/ath/ath11k/wow.c @@ -381,7 +381,7 @@ static int ath11k_vif_wow_set_wakeups(struct ath11k_vif *arvif, struct wmi_pno_scan_req *pno; int ret; - pno = kzalloc(sizeof(*pno), GFP_KERNEL); + pno = kzalloc_obj(*pno, GFP_KERNEL); if (!pno) return -ENOMEM; @@ -495,7 +495,7 @@ static int ath11k_vif_wow_clean_nlo(struct ath11k_vif *arvif) if (ar->nlo_enabled) { struct wmi_pno_scan_req *pno; - pno = kzalloc(sizeof(*pno), GFP_KERNEL); + pno = kzalloc_obj(*pno, GFP_KERNEL); if (!pno) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath12k/ce.c b/drivers/net/wireless/ath/ath12k/ce.c index f13b260c5c96..1106671dc844 100644 --- a/drivers/net/wireless/ath/ath12k/ce.c +++ b/drivers/net/wireless/ath/ath12k/ce.c @@ -332,7 +332,7 @@ ath12k_ce_alloc_ring(struct ath12k_base *ab, int nentries, int desc_sz) struct ath12k_ce_ring *ce_ring; dma_addr_t base_addr; - ce_ring = kzalloc(struct_size(ce_ring, skb, nentries), GFP_KERNEL); + ce_ring = kzalloc_flex(*ce_ring, skb, nentries, GFP_KERNEL); if (!ce_ring) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index 9d6c50a94e64..d9b41fc90dcd 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -1805,7 +1805,7 @@ static struct ath12k_hw_group *ath12k_core_hw_group_alloc(struct ath12k_base *ab list_for_each_entry(ag, &ath12k_hw_group_list, list) count++; - ag = kzalloc(sizeof(*ag), GFP_KERNEL); + ag = kzalloc_obj(*ag, GFP_KERNEL); if (!ag) return NULL; diff --git a/drivers/net/wireless/ath/ath12k/dp.c b/drivers/net/wireless/ath/ath12k/dp.c index ab54c8a84d3e..43f8ef03b1cf 100644 --- a/drivers/net/wireless/ath/ath12k/dp.c +++ b/drivers/net/wireless/ath/ath12k/dp.c @@ -407,9 +407,8 @@ static int ath12k_dp_init_bank_profiles(struct ath12k_base *ab) int i; dp->num_bank_profiles = num_tcl_banks; - dp->bank_profiles = kmalloc_array(num_tcl_banks, - sizeof(struct ath12k_dp_tx_bank_profile), - GFP_KERNEL); + dp->bank_profiles = kmalloc_objs(struct ath12k_dp_tx_bank_profile, + num_tcl_banks, GFP_KERNEL); if (!dp->bank_profiles) return -ENOMEM; @@ -1215,8 +1214,8 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab) spin_lock_bh(&dp->rx_desc_lock); - dp->rxbaddr = kcalloc(num_rx_spt_pages, - sizeof(struct ath12k_rx_desc_info *), GFP_ATOMIC); + dp->rxbaddr = kzalloc_objs(struct ath12k_rx_desc_info *, + num_rx_spt_pages, GFP_ATOMIC); if (!dp->rxbaddr) { spin_unlock_bh(&dp->rx_desc_lock); @@ -1227,8 +1226,8 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab) * RX */ for (i = 0; i < num_rx_spt_pages; i++) { - rx_descs = kcalloc(ATH12K_MAX_SPT_ENTRIES, sizeof(*rx_descs), - GFP_ATOMIC); + rx_descs = kzalloc_objs(*rx_descs, ATH12K_MAX_SPT_ENTRIES, + GFP_ATOMIC); if (!rx_descs) { spin_unlock_bh(&dp->rx_desc_lock); @@ -1253,8 +1252,8 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab) spin_unlock_bh(&dp->rx_desc_lock); - dp->txbaddr = kcalloc(ATH12K_NUM_TX_SPT_PAGES(ab), - sizeof(struct ath12k_tx_desc_info *), GFP_ATOMIC); + dp->txbaddr = kzalloc_objs(struct ath12k_tx_desc_info *, + ATH12K_NUM_TX_SPT_PAGES(ab), GFP_ATOMIC); if (!dp->txbaddr) return -ENOMEM; @@ -1262,8 +1261,9 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab) for (pool_id = 0; pool_id < ATH12K_HW_MAX_QUEUES; pool_id++) { spin_lock_bh(&dp->tx_desc_lock[pool_id]); for (i = 0; i < ATH12K_TX_SPT_PAGES_PER_POOL(ab); i++) { - tx_descs = kcalloc(ATH12K_MAX_SPT_ENTRIES, sizeof(*tx_descs), - GFP_ATOMIC); + tx_descs = kzalloc_objs(*tx_descs, + ATH12K_MAX_SPT_ENTRIES, + GFP_ATOMIC); if (!tx_descs) { spin_unlock_bh(&dp->tx_desc_lock[pool_id]); @@ -1362,8 +1362,8 @@ static int ath12k_dp_cc_init(struct ath12k_base *ab) if (dp->num_spt_pages > ATH12K_MAX_PPT_ENTRIES) dp->num_spt_pages = ATH12K_MAX_PPT_ENTRIES; - dp->spt_info = kcalloc(dp->num_spt_pages, sizeof(struct ath12k_spt_info), - GFP_KERNEL); + dp->spt_info = kzalloc_objs(struct ath12k_spt_info, dp->num_spt_pages, + GFP_KERNEL); if (!dp->spt_info) { ath12k_warn(ab, "SPT page allocation failure"); diff --git a/drivers/net/wireless/ath/ath12k/dp_htt.c b/drivers/net/wireless/ath/ath12k/dp_htt.c index cc71c5c5de5a..e71bb71a6020 100644 --- a/drivers/net/wireless/ath/ath12k/dp_htt.c +++ b/drivers/net/wireless/ath/ath12k/dp_htt.c @@ -386,7 +386,7 @@ struct htt_ppdu_stats_info *ath12k_dp_htt_get_ppdu_desc(struct ath12k_pdev_dp *d } } - ppdu_info = kzalloc(sizeof(*ppdu_info), GFP_ATOMIC); + ppdu_info = kzalloc_obj(*ppdu_info, GFP_ATOMIC); if (!ppdu_info) return NULL; diff --git a/drivers/net/wireless/ath/ath12k/dp_peer.c b/drivers/net/wireless/ath/ath12k/dp_peer.c index 2e66872b5572..95b5a4af4b2e 100644 --- a/drivers/net/wireless/ath/ath12k/dp_peer.c +++ b/drivers/net/wireless/ath/ath12k/dp_peer.c @@ -165,7 +165,7 @@ void ath12k_dp_link_peer_map_event(struct ath12k_base *ab, u8 vdev_id, u16 peer_ spin_lock_bh(&dp->dp_lock); peer = ath12k_dp_link_peer_find_by_vdev_and_addr(dp, vdev_id, mac_addr); if (!peer) { - peer = kzalloc(sizeof(*peer), GFP_ATOMIC); + peer = kzalloc_obj(*peer, GFP_ATOMIC); if (!peer) goto exit; @@ -179,8 +179,8 @@ void ath12k_dp_link_peer_map_event(struct ath12k_base *ab, u8 vdev_id, u16 peer_ ar = ath12k_mac_get_ar_by_vdev_id(ab, vdev_id); if (ar && ath12k_debugfs_is_extd_rx_stats_enabled(ar) && !peer->peer_stats.rx_stats) { - peer->peer_stats.rx_stats = - kzalloc(sizeof(*peer->peer_stats.rx_stats), GFP_ATOMIC); + peer->peer_stats.rx_stats = kzalloc_obj(*peer->peer_stats.rx_stats, + GFP_ATOMIC); } rcu_read_unlock(); @@ -233,7 +233,7 @@ static int ath12k_dp_link_peer_rhash_addr_tbl_init(struct ath12k_dp *dp) lockdep_assert_held(&dp->link_peer_rhash_tbl_lock); - rhash_addr_tbl = kzalloc(sizeof(*dp->rhead_peer_addr), GFP_KERNEL); + rhash_addr_tbl = kzalloc_obj(*dp->rhead_peer_addr, GFP_KERNEL); if (!rhash_addr_tbl) return -ENOMEM; @@ -463,7 +463,7 @@ int ath12k_dp_peer_create(struct ath12k_dp_hw *dp_hw, u8 *addr, } spin_unlock_bh(&dp_hw->peer_lock); - dp_peer = kzalloc(sizeof(*dp_peer), GFP_ATOMIC); + dp_peer = kzalloc_obj(*dp_peer, GFP_ATOMIC); if (!dp_peer) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath12k/dp_rx.c b/drivers/net/wireless/ath/ath12k/dp_rx.c index a32ee9f8061a..5a82ede65dd3 100644 --- a/drivers/net/wireless/ath/ath12k/dp_rx.c +++ b/drivers/net/wireless/ath/ath12k/dp_rx.c @@ -464,7 +464,7 @@ void ath12k_dp_rx_tid_del_func(struct ath12k_dp *dp, void *ctx, ath12k_dp_rx_process_reo_cmd_update_rx_queue_list(dp); spin_unlock_bh(&dp->dp_lock); - elem = kzalloc(sizeof(*elem), GFP_ATOMIC); + elem = kzalloc_obj(*elem, GFP_ATOMIC); if (!elem) goto free_desc; @@ -565,7 +565,7 @@ static int ath12k_dp_prepare_reo_update_elem(struct ath12k_dp *dp, lockdep_assert_held(&dp->dp_lock); - elem = kzalloc(sizeof(*elem), GFP_ATOMIC); + elem = kzalloc_obj(*elem, GFP_ATOMIC); if (!elem) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 68431a0e128e..007c91dbb269 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -3838,7 +3838,7 @@ static void ath12k_bss_assoc(struct ath12k *ar, lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); struct ath12k_wmi_peer_assoc_arg *peer_arg __free(kfree) = - kzalloc(sizeof(*peer_arg), GFP_KERNEL); + kzalloc_obj(*peer_arg, GFP_KERNEL); if (!peer_arg) return; @@ -4217,7 +4217,7 @@ static struct ath12k_link_vif *ath12k_mac_assign_link_vif(struct ath12k_hw *ah, if (vif->type == NL80211_IFTYPE_STATION) arvif->is_sta_assoc_link = true; } else { - arvif = kzalloc(sizeof(*arvif), GFP_KERNEL); + arvif = kzalloc_obj(*arvif, GFP_KERNEL); if (!arvif) return NULL; } @@ -5024,7 +5024,8 @@ static struct ath12k_vif_cache *ath12k_ahvif_get_link_cache(struct ath12k_vif *a u8 link_id) { if (!ahvif->cache[link_id]) { - ahvif->cache[link_id] = kzalloc(sizeof(*ahvif->cache[0]), GFP_KERNEL); + ahvif->cache[link_id] = kzalloc_obj(*ahvif->cache[0], + GFP_KERNEL); if (ahvif->cache[link_id]) INIT_LIST_HEAD(&ahvif->cache[link_id]->key_conf.list); } @@ -5602,7 +5603,7 @@ static int ath12k_mac_initiate_hw_scan(struct ieee80211_hw *hw, if (ret) goto exit; - arg = kzalloc(sizeof(*arg), GFP_KERNEL); + arg = kzalloc_obj(*arg, GFP_KERNEL); if (!arg) { ret = -ENOMEM; goto exit; @@ -5692,7 +5693,7 @@ int ath12k_mac_op_hw_scan(struct ieee80211_hw *hw, lockdep_assert_wiphy(hw->wiphy); - chan_list = kcalloc(hw_req->req.n_channels, sizeof(*chan_list), GFP_KERNEL); + chan_list = kzalloc_objs(*chan_list, hw_req->req.n_channels, GFP_KERNEL); if (!chan_list) return -ENOMEM; @@ -6122,7 +6123,7 @@ static int ath12k_mac_update_key_cache(struct ath12k_vif_cache *cache, } if (cmd == SET_KEY) { - key_conf = kzalloc(sizeof(*key_conf), GFP_KERNEL); + key_conf = kzalloc_obj(*key_conf, GFP_KERNEL); if (!key_conf) return -ENOMEM; @@ -6456,7 +6457,7 @@ static int ath12k_mac_station_assoc(struct ath12k *ar, mask = &arvif->bitrate_mask; struct ath12k_wmi_peer_assoc_arg *peer_arg __free(kfree) = - kzalloc(sizeof(*peer_arg), GFP_KERNEL); + kzalloc_obj(*peer_arg, GFP_KERNEL); if (!peer_arg) return -ENOMEM; @@ -6619,7 +6620,7 @@ static void ath12k_sta_rc_update_wk(struct wiphy *wiphy, struct wiphy_work *wk) nss = min(nss, mac_nss); struct ath12k_wmi_peer_assoc_arg *peer_arg __free(kfree) = - kzalloc(sizeof(*peer_arg), GFP_KERNEL); + kzalloc_obj(*peer_arg, GFP_KERNEL); if (!peer_arg) return; @@ -7974,7 +7975,7 @@ static struct ath12k_link_sta *ath12k_mac_alloc_assign_link_sta(struct ath12k_hw if (arsta) return NULL; - arsta = kmalloc(sizeof(*arsta), GFP_KERNEL); + arsta = kmalloc_obj(*arsta, GFP_KERNEL); if (!arsta) return NULL; @@ -11549,7 +11550,7 @@ ath12k_mac_update_active_vif_chan(struct ath12k *ar, if (arg.n_vifs == 0) return; - arg.vifs = kcalloc(arg.n_vifs, sizeof(arg.vifs[0]), GFP_KERNEL); + arg.vifs = kzalloc_objs(arg.vifs[0], arg.n_vifs, GFP_KERNEL); if (!arg.vifs) return; @@ -13714,7 +13715,7 @@ int ath12k_mac_op_remain_on_channel(struct ieee80211_hw *hw, scan_time_msec = hw->wiphy->max_remain_on_channel_duration * 2; struct ath12k_wmi_scan_req_arg *arg __free(kfree) = - kzalloc(sizeof(*arg), GFP_KERNEL); + kzalloc_obj(*arg, GFP_KERNEL); if (!arg) return -ENOMEM; @@ -14122,7 +14123,7 @@ ath12k_mac_setup_radio_iface_comb(struct ath12k *ar, max_interfaces = 1; } - limits = kcalloc(n_limits, sizeof(*limits), GFP_KERNEL); + limits = kzalloc_objs(*limits, n_limits, GFP_KERNEL); if (!limits) return -ENOMEM; @@ -14186,7 +14187,7 @@ ath12k_mac_setup_global_iface_comb(struct ath12k_hw *ah, else n_limits = 1; - limits = kcalloc(n_limits, sizeof(*limits), GFP_KERNEL); + limits = kzalloc_objs(*limits, n_limits, GFP_KERNEL); if (!limits) return -ENOMEM; @@ -14249,8 +14250,8 @@ static int ath12k_mac_setup_iface_combinations(struct ath12k_hw *ah) if (ar->ab->hw_params->single_pdev_only) n_combinations = 2; - combinations = kcalloc(n_combinations, sizeof(*combinations), - GFP_KERNEL); + combinations = kzalloc_objs(*combinations, n_combinations, + GFP_KERNEL); if (!combinations) return -ENOMEM; @@ -14271,20 +14272,20 @@ static int ath12k_mac_setup_iface_combinations(struct ath12k_hw *ah) goto out; } - combinations = kcalloc(n_combinations, sizeof(*combinations), GFP_KERNEL); + combinations = kzalloc_objs(*combinations, n_combinations, GFP_KERNEL); if (!combinations) return -ENOMEM; /* there are multiple radios */ - radio = kcalloc(ah->num_radio, sizeof(*radio), GFP_KERNEL); + radio = kzalloc_objs(*radio, ah->num_radio, GFP_KERNEL); if (!radio) { ret = -ENOMEM; goto err_free_combinations; } for_each_ar(ah, ar, i) { - comb = kzalloc(sizeof(*comb), GFP_KERNEL); + comb = kzalloc_obj(*comb, GFP_KERNEL); if (!comb) { ret = -ENOMEM; goto err_free_radios; diff --git a/drivers/net/wireless/ath/ath12k/mhi.c b/drivers/net/wireless/ath/ath12k/mhi.c index 45c0f66dcc5e..8f07c00c51a2 100644 --- a/drivers/net/wireless/ath/ath12k/mhi.c +++ b/drivers/net/wireless/ath/ath12k/mhi.c @@ -80,7 +80,7 @@ static int ath12k_mhi_get_msi(struct ath12k_pci *ab_pci) ath12k_dbg(ab, ATH12K_DBG_PCI, "Number of assigned MSI for MHI is %d, base vector is %d\n", num_vectors, base_vector); - irq = kcalloc(num_vectors, sizeof(*irq), GFP_KERNEL); + irq = kzalloc_objs(*irq, num_vectors, GFP_KERNEL); if (!irq) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath12k/peer.c b/drivers/net/wireless/ath/ath12k/peer.c index 5f3bd3b9a3e9..ad571a4cf974 100644 --- a/drivers/net/wireless/ath/ath12k/peer.c +++ b/drivers/net/wireless/ath/ath12k/peer.c @@ -413,7 +413,7 @@ int ath12k_link_sta_rhash_tbl_init(struct ath12k_base *ab) struct rhashtable *rhash_addr_tbl; int ret; - rhash_addr_tbl = kzalloc(sizeof(*ab->rhead_sta_addr), GFP_KERNEL); + rhash_addr_tbl = kzalloc_obj(*ab->rhead_sta_addr, GFP_KERNEL); if (!rhash_addr_tbl) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c index cfde4147c8fc..631041bf1dc1 100644 --- a/drivers/net/wireless/ath/ath12k/qmi.c +++ b/drivers/net/wireless/ath/ath12k/qmi.c @@ -2344,11 +2344,11 @@ static int ath12k_qmi_fw_ind_register_send(struct ath12k_base *ab) struct qmi_txn txn; int ret; - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req, GFP_KERNEL); if (!req) return -ENOMEM; - resp = kzalloc(sizeof(*resp), GFP_KERNEL); + resp = kzalloc_obj(*resp, GFP_KERNEL); if (!resp) { ret = -ENOMEM; goto resp_out; @@ -2416,7 +2416,7 @@ int ath12k_qmi_respond_fw_mem_request(struct ath12k_base *ab) int ret = 0, i; bool delayed; - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req, GFP_KERNEL); if (!req) return -ENOMEM; @@ -2968,7 +2968,7 @@ static int ath12k_qmi_load_file_target_mem(struct ath12k_base *ab, int ret = 0; u32 remaining = len; - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req, GFP_KERNEL); if (!req) return -ENOMEM; @@ -3465,7 +3465,7 @@ static int ath12k_qmi_wlanfw_wlan_cfg_send(struct ath12k_base *ab) ce_cfg = (struct ce_pipe_config *)ab->qmi.ce_cfg.tgt_ce; svc_cfg = (struct service_to_pipe *)ab->qmi.ce_cfg.svc_to_ce_map; - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req, GFP_KERNEL); if (!req) return -ENOMEM; @@ -3636,7 +3636,7 @@ ath12k_qmi_driver_event_post(struct ath12k_qmi *qmi, { struct ath12k_qmi_driver_event *event; - event = kzalloc(sizeof(*event), GFP_ATOMIC); + event = kzalloc_obj(*event, GFP_ATOMIC); if (!event) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath12k/reg.c b/drivers/net/wireless/ath/ath12k/reg.c index 7898f6981e5a..cd9ed489369e 100644 --- a/drivers/net/wireless/ath/ath12k/reg.c +++ b/drivers/net/wireless/ath/ath12k/reg.c @@ -170,7 +170,7 @@ int ath12k_reg_update_chan_list(struct ath12k *ar, bool wait) return -EINVAL; } - arg = kzalloc(struct_size(arg, channel, num_channels), GFP_KERNEL); + arg = kzalloc_flex(*arg, channel, num_channels, GFP_KERNEL); if (!arg) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath12k/wifi7/dp.c b/drivers/net/wireless/ath/ath12k/wifi7/dp.c index 2b194879ee80..8e0b83801346 100644 --- a/drivers/net/wireless/ath/ath12k/wifi7/dp.c +++ b/drivers/net/wireless/ath/ath12k/wifi7/dp.c @@ -161,7 +161,7 @@ struct ath12k_dp *ath12k_wifi7_dp_device_alloc(struct ath12k_base *ab) struct ath12k_dp *dp; /* TODO: align dp later if cache alignment becomes a bottleneck */ - dp = kzalloc(sizeof(*dp), GFP_KERNEL); + dp = kzalloc_obj(*dp, GFP_KERNEL); if (!dp) return NULL; diff --git a/drivers/net/wireless/ath/ath12k/wifi7/dp_mon.c b/drivers/net/wireless/ath/ath12k/wifi7/dp_mon.c index bd741532b7dc..c9cea597a92e 100644 --- a/drivers/net/wireless/ath/ath12k/wifi7/dp_mon.c +++ b/drivers/net/wireless/ath/ath12k/wifi7/dp_mon.c @@ -1800,7 +1800,7 @@ ath12k_wifi7_dp_mon_parse_rx_dest_tlv(struct ath12k_pdev_dp *dp_pdev, if (WARN_ON_ONCE(pmon->mon_mpdu)) break; - pmon->mon_mpdu = kzalloc(sizeof(*pmon->mon_mpdu), GFP_ATOMIC); + pmon->mon_mpdu = kzalloc_obj(*pmon->mon_mpdu, GFP_ATOMIC); if (!pmon->mon_mpdu) return -ENOMEM; break; @@ -1849,7 +1849,7 @@ ath12k_wifi7_dp_mon_tx_get_ppdu_info(struct ath12k_mon_data *pmon, } /* allocate new tx_ppdu_info */ - tx_ppdu_info = kzalloc(sizeof(*tx_ppdu_info), GFP_ATOMIC); + tx_ppdu_info = kzalloc_obj(*tx_ppdu_info, GFP_ATOMIC); if (!tx_ppdu_info) return NULL; @@ -2383,7 +2383,7 @@ ath12k_wifi7_dp_mon_tx_parse_status_tlv(struct ath12k_base *ab, case HAL_TX_MPDU_START: { struct dp_mon_mpdu *mon_mpdu = tx_ppdu_info->tx_mon_mpdu; - mon_mpdu = kzalloc(sizeof(*mon_mpdu), GFP_ATOMIC); + mon_mpdu = kzalloc_obj(*mon_mpdu, GFP_ATOMIC); if (!mon_mpdu) return DP_MON_TX_STATUS_PPDU_NOT_DONE; status = DP_MON_TX_MPDU_START; @@ -2853,7 +2853,7 @@ ath12k_wifi7_dp_rx_mon_dest_process(struct ath12k *ar, int mac_id, } if (head_msdu && tail_msdu) { - tmp_mpdu = kzalloc(sizeof(*tmp_mpdu), GFP_ATOMIC); + tmp_mpdu = kzalloc_obj(*tmp_mpdu, GFP_ATOMIC); if (!tmp_mpdu) break; diff --git a/drivers/net/wireless/ath/ath12k/wifi7/dp_rx.c b/drivers/net/wireless/ath/ath12k/wifi7/dp_rx.c index 7450938adf65..038e339e8fb1 100644 --- a/drivers/net/wireless/ath/ath12k/wifi7/dp_rx.c +++ b/drivers/net/wireless/ath/ath12k/wifi7/dp_rx.c @@ -165,7 +165,7 @@ int ath12k_wifi7_dp_reo_cmd_send(struct ath12k_base *ab, * for tid delete command to free up the resource on the command status * indication? */ - dp_cmd = kzalloc(sizeof(*dp_cmd), GFP_ATOMIC); + dp_cmd = kzalloc_obj(*dp_cmd, GFP_ATOMIC); if (!dp_cmd) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c index 7617fc3a2479..eb7615a289f7 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -303,7 +303,7 @@ ath12k_wmi_tlv_parse_alloc(struct ath12k_base *ab, const void **tb; int ret; - tb = kcalloc(WMI_TAG_MAX, sizeof(*tb), gfp); + tb = kzalloc_objs(*tb, WMI_TAG_MAX, gfp); if (!tb) return ERR_PTR(-ENOMEM); @@ -6867,7 +6867,7 @@ static int ath12k_reg_chan_list_event(struct ath12k_base *ab, struct sk_buff *sk u8 pdev_idx = 255; int ret; - reg_info = kzalloc(sizeof(*reg_info), GFP_ATOMIC); + reg_info = kzalloc_obj(*reg_info, GFP_ATOMIC); if (!reg_info) { ret = -ENOMEM; goto fallback; @@ -8297,7 +8297,7 @@ static int ath12k_wmi_tlv_fw_stats_data_parse(struct ath12k_base *ab, data += sizeof(*src); len -= sizeof(*src); - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; ath12k_wmi_pull_vdev_stats(src, dst); @@ -8316,7 +8316,7 @@ static int ath12k_wmi_tlv_fw_stats_data_parse(struct ath12k_base *ab, data += sizeof(*src); len -= sizeof(*src); - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; ath12k_wmi_pull_bcn_stats(src, dst); @@ -8338,7 +8338,7 @@ static int ath12k_wmi_tlv_fw_stats_data_parse(struct ath12k_base *ab, data += sizeof(*src); len -= sizeof(*src); - dst = kzalloc(sizeof(*dst), GFP_ATOMIC); + dst = kzalloc_obj(*dst, GFP_ATOMIC); if (!dst) continue; @@ -9559,8 +9559,7 @@ static void ath12k_wmi_process_tpc_stats(struct ath12k_base *ab, goto unlock; } ar->debug.tpc_stats = - kzalloc(sizeof(struct wmi_tpc_stats_arg), - GFP_ATOMIC); + kzalloc_obj(struct wmi_tpc_stats_arg, GFP_ATOMIC); if (!ar->debug.tpc_stats) { ath12k_warn(ab, "Failed to allocate memory for tpc stats\n"); diff --git a/drivers/net/wireless/ath/ath12k/wow.c b/drivers/net/wireless/ath/ath12k/wow.c index bb08e1740582..bdac483c58cf 100644 --- a/drivers/net/wireless/ath/ath12k/wow.c +++ b/drivers/net/wireless/ath/ath12k/wow.c @@ -395,7 +395,7 @@ static int ath12k_wow_vif_set_wakeups(struct ath12k_link_vif *arvif, struct wmi_pno_scan_req_arg *pno; int ret; - pno = kzalloc(sizeof(*pno), GFP_KERNEL); + pno = kzalloc_obj(*pno, GFP_KERNEL); if (!pno) return -ENOMEM; @@ -507,7 +507,7 @@ static int ath12k_wow_vdev_clean_nlo(struct ath12k *ar, u32 vdev_id) if (!ar->nlo_enabled) return 0; - pno = kzalloc(sizeof(*pno), GFP_KERNEL); + pno = kzalloc_obj(*pno, GFP_KERNEL); if (!pno) return -ENOMEM; @@ -748,7 +748,7 @@ static int ath12k_wow_arp_ns_offload(struct ath12k *ar, bool enable) lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); - offload = kmalloc(sizeof(*offload), GFP_KERNEL); + offload = kmalloc_obj(*offload, GFP_KERNEL); if (!offload) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 4d88b02ffa79..7b945a010ea1 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c @@ -919,8 +919,8 @@ ath5k_desc_alloc(struct ath5k_hw *ah) ATH5K_DBG(ah, ATH5K_DEBUG_ANY, "DMA map: %p (%zu) -> %llx\n", ds, ah->desc_len, (unsigned long long)ah->desc_daddr); - bf = kcalloc(1 + ATH_TXBUF + ATH_RXBUF + ATH_BCBUF, - sizeof(struct ath5k_buf), GFP_KERNEL); + bf = kzalloc_objs(struct ath5k_buf, + 1 + ATH_TXBUF + ATH_RXBUF + ATH_BCBUF, GFP_KERNEL); if (bf == NULL) { ATH5K_ERR(ah, "can't allocate bufptr\n"); ret = -ENOMEM; diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c index ec130510aeb2..5e30316f4543 100644 --- a/drivers/net/wireless/ath/ath5k/debug.c +++ b/drivers/net/wireless/ath/ath5k/debug.c @@ -928,7 +928,7 @@ static int open_file_eeprom(struct inode *inode, struct file *file) /* Create private struct and assign to file */ - ep = kmalloc(sizeof(*ep), GFP_KERNEL); + ep = kmalloc_obj(*ep, GFP_KERNEL); if (!ep) { ret = -ENOMEM; goto freebuf; diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c index 58d3e86f6256..a8b9c346c74b 100644 --- a/drivers/net/wireless/ath/ath5k/eeprom.c +++ b/drivers/net/wireless/ath/ath5k/eeprom.c @@ -727,9 +727,8 @@ ath5k_eeprom_convert_pcal_info_5111(struct ath5k_hw *ah, int mode, /* Allocate pd_curves for this cal pier */ chinfo[pier].pd_curves = - kcalloc(AR5K_EEPROM_N_PD_CURVES, - sizeof(struct ath5k_pdgain_info), - GFP_KERNEL); + kzalloc_objs(struct ath5k_pdgain_info, + AR5K_EEPROM_N_PD_CURVES, GFP_KERNEL); if (!chinfo[pier].pd_curves) goto err_out; @@ -761,8 +760,8 @@ ath5k_eeprom_convert_pcal_info_5111(struct ath5k_hw *ah, int mode, if (!pd->pd_step) goto err_out; - pd->pd_pwr = kcalloc(AR5K_EEPROM_N_PWR_POINTS_5111, - sizeof(s16), GFP_KERNEL); + pd->pd_pwr = kzalloc_objs(s16, AR5K_EEPROM_N_PWR_POINTS_5111, + GFP_KERNEL); if (!pd->pd_pwr) goto err_out; @@ -917,9 +916,9 @@ ath5k_eeprom_convert_pcal_info_5112(struct ath5k_hw *ah, int mode, /* Allocate pd_curves for this cal pier */ chinfo[pier].pd_curves = - kcalloc(AR5K_EEPROM_N_PD_CURVES, - sizeof(struct ath5k_pdgain_info), - GFP_KERNEL); + kzalloc_objs(struct ath5k_pdgain_info, + AR5K_EEPROM_N_PD_CURVES, + GFP_KERNEL); if (!chinfo[pier].pd_curves) goto err_out; @@ -943,8 +942,8 @@ ath5k_eeprom_convert_pcal_info_5112(struct ath5k_hw *ah, int mode, if (!pd->pd_step) goto err_out; - pd->pd_pwr = kcalloc(pd->pd_points, - sizeof(s16), GFP_KERNEL); + pd->pd_pwr = kzalloc_objs(s16, pd->pd_points, + GFP_KERNEL); if (!pd->pd_pwr) goto err_out; @@ -981,8 +980,8 @@ ath5k_eeprom_convert_pcal_info_5112(struct ath5k_hw *ah, int mode, if (!pd->pd_step) goto err_out; - pd->pd_pwr = kcalloc(pd->pd_points, - sizeof(s16), GFP_KERNEL); + pd->pd_pwr = kzalloc_objs(s16, pd->pd_points, + GFP_KERNEL); if (!pd->pd_pwr) goto err_out; @@ -1209,9 +1208,9 @@ ath5k_eeprom_convert_pcal_info_2413(struct ath5k_hw *ah, int mode, /* Allocate pd_curves for this cal pier */ chinfo[pier].pd_curves = - kcalloc(AR5K_EEPROM_N_PD_CURVES, - sizeof(struct ath5k_pdgain_info), - GFP_KERNEL); + kzalloc_objs(struct ath5k_pdgain_info, + AR5K_EEPROM_N_PD_CURVES, + GFP_KERNEL); if (!chinfo[pier].pd_curves) goto err_out; @@ -1237,8 +1236,8 @@ ath5k_eeprom_convert_pcal_info_2413(struct ath5k_hw *ah, int mode, if (!pd->pd_step) goto err_out; - pd->pd_pwr = kcalloc(pd->pd_points, - sizeof(s16), GFP_KERNEL); + pd->pd_pwr = kzalloc_objs(s16, pd->pd_points, + GFP_KERNEL); if (!pd->pd_pwr) goto err_out; diff --git a/drivers/net/wireless/ath/ath6kl/core.c b/drivers/net/wireless/ath/ath6kl/core.c index 830350bda531..8be852e832f3 100644 --- a/drivers/net/wireless/ath/ath6kl/core.c +++ b/drivers/net/wireless/ath/ath6kl/core.c @@ -311,7 +311,7 @@ struct ath6kl *ath6kl_core_create(struct device *dev) ar->sta_list[ctr].mgmt_psq_len = 0; INIT_LIST_HEAD(&ar->sta_list[ctr].mgmt_psq); ar->sta_list[ctr].aggr_conn = - kzalloc(sizeof(struct aggr_info_conn), GFP_KERNEL); + kzalloc_obj(struct aggr_info_conn, GFP_KERNEL); if (!ar->sta_list[ctr].aggr_conn) { ath6kl_err("Failed to allocate memory for sta aggregation information\n"); ath6kl_core_destroy(ar); diff --git a/drivers/net/wireless/ath/ath6kl/htc_mbox.c b/drivers/net/wireless/ath/ath6kl/htc_mbox.c index 122e07ef3965..19dfeb012c04 100644 --- a/drivers/net/wireless/ath/ath6kl/htc_mbox.c +++ b/drivers/net/wireless/ath/ath6kl/htc_mbox.c @@ -2792,7 +2792,7 @@ static int ath6kl_htc_reset(struct htc_target *target) (HTC_MAX_CTRL_MSG_LEN + HTC_HDR_LENGTH); for (i = 0; i < NUM_CONTROL_BUFFERS; i++) { - packet = kzalloc(sizeof(*packet), GFP_KERNEL); + packet = kzalloc_obj(*packet, GFP_KERNEL); if (!packet) return -ENOMEM; @@ -2842,13 +2842,13 @@ static void *ath6kl_htc_mbox_create(struct ath6kl *ar) struct htc_target *target = NULL; int status = 0; - target = kzalloc(sizeof(*target), GFP_KERNEL); + target = kzalloc_obj(*target, GFP_KERNEL); if (!target) { ath6kl_err("unable to allocate memory\n"); return NULL; } - target->dev = kzalloc(sizeof(*target->dev), GFP_KERNEL); + target->dev = kzalloc_obj(*target->dev, GFP_KERNEL); if (!target->dev) { ath6kl_err("unable to allocate memory\n"); kfree(target); diff --git a/drivers/net/wireless/ath/ath6kl/htc_pipe.c b/drivers/net/wireless/ath/ath6kl/htc_pipe.c index 7b823be9d846..ba8a701087c3 100644 --- a/drivers/net/wireless/ath/ath6kl/htc_pipe.c +++ b/drivers/net/wireless/ath/ath6kl/htc_pipe.c @@ -510,7 +510,7 @@ static struct htc_packet *build_htc_txctrl_packet(void) struct htc_packet *packet = NULL; struct sk_buff *skb; - packet = kzalloc(sizeof(struct htc_packet), GFP_KERNEL); + packet = kzalloc_obj(struct htc_packet, GFP_KERNEL); if (packet == NULL) return NULL; @@ -1409,7 +1409,7 @@ static void *ath6kl_htc_pipe_create(struct ath6kl *ar) struct htc_packet *packet; int i; - target = kzalloc(sizeof(struct htc_target), GFP_KERNEL); + target = kzalloc_obj(struct htc_target, GFP_KERNEL); if (target == NULL) { ath6kl_err("htc create unable to allocate memory\n"); status = -ENOMEM; @@ -1423,13 +1423,13 @@ static void *ath6kl_htc_pipe_create(struct ath6kl *ar) reset_endpoint_states(target); for (i = 0; i < HTC_PACKET_CONTAINER_ALLOCATION; i++) { - packet = kzalloc(sizeof(struct htc_packet), GFP_KERNEL); + packet = kzalloc_obj(struct htc_packet, GFP_KERNEL); if (packet != NULL) free_htc_packet_container(target, packet); } - target->dev = kzalloc(sizeof(*target->dev), GFP_KERNEL); + target->dev = kzalloc_obj(*target->dev, GFP_KERNEL); if (!target->dev) { ath6kl_err("unable to allocate memory\n"); status = -ENOMEM; diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c index 59068ea3879b..908cb87842f7 100644 --- a/drivers/net/wireless/ath/ath6kl/main.c +++ b/drivers/net/wireless/ath/ath6kl/main.c @@ -485,7 +485,7 @@ void ath6kl_connect_ap_mode_sta(struct ath6kl_vif *vif, u16 aid, u8 *mac_addr, keymgmt, ucipher, auth, apsd_info); /* send event to application */ - sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); + sinfo = kzalloc_obj(*sinfo, GFP_KERNEL); if (!sinfo) return; @@ -1249,8 +1249,8 @@ static void ath6kl_set_multicast_list(struct net_device *ndev) } if (!found) { - mc_filter = kzalloc(sizeof(struct ath6kl_mc_filter), - GFP_ATOMIC); + mc_filter = kzalloc_obj(struct ath6kl_mc_filter, + GFP_ATOMIC); if (!mc_filter) { WARN_ON(1); goto out; diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c index 83de40bc4445..c0a895ae882f 100644 --- a/drivers/net/wireless/ath/ath6kl/sdio.c +++ b/drivers/net/wireless/ath/ath6kl/sdio.c @@ -1316,7 +1316,7 @@ static int ath6kl_sdio_probe(struct sdio_func *func, func->num, func->vendor, func->device, func->max_blksize, func->cur_blksize); - ar_sdio = kzalloc(sizeof(struct ath6kl_sdio), GFP_KERNEL); + ar_sdio = kzalloc_obj(struct ath6kl_sdio, GFP_KERNEL); if (!ar_sdio) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c index c3b06b515c4f..623d134c4be7 100644 --- a/drivers/net/wireless/ath/ath6kl/txrx.c +++ b/drivers/net/wireless/ath/ath6kl/txrx.c @@ -1770,13 +1770,13 @@ struct aggr_info *aggr_init(struct ath6kl_vif *vif) { struct aggr_info *p_aggr = NULL; - p_aggr = kzalloc(sizeof(struct aggr_info), GFP_KERNEL); + p_aggr = kzalloc_obj(struct aggr_info, GFP_KERNEL); if (!p_aggr) { ath6kl_err("failed to alloc memory for aggr_node\n"); return NULL; } - p_aggr->aggr_conn = kzalloc(sizeof(struct aggr_info_conn), GFP_KERNEL); + p_aggr->aggr_conn = kzalloc_obj(struct aggr_info_conn, GFP_KERNEL); if (!p_aggr->aggr_conn) { ath6kl_err("failed to alloc memory for connection specific aggr info\n"); kfree(p_aggr); diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c index 38bb501fc553..9362ab82cc30 100644 --- a/drivers/net/wireless/ath/ath6kl/usb.c +++ b/drivers/net/wireless/ath/ath6kl/usb.c @@ -190,8 +190,7 @@ static int ath6kl_usb_alloc_pipe_resources(struct ath6kl_usb_pipe *pipe, init_usb_anchor(&pipe->urb_submitted); for (i = 0; i < urb_cnt; i++) { - urb_context = kzalloc(sizeof(struct ath6kl_urb_context), - GFP_KERNEL); + urb_context = kzalloc_obj(struct ath6kl_urb_context, GFP_KERNEL); if (urb_context == NULL) { status = -ENOMEM; goto fail_alloc_pipe_resources; @@ -634,7 +633,7 @@ static struct ath6kl_usb *ath6kl_usb_create(struct usb_interface *interface) int i; /* ath6kl_usb_destroy() needs ar_usb != NULL && ar_usb->wq != NULL. */ - ar_usb = kzalloc(sizeof(struct ath6kl_usb), GFP_KERNEL); + ar_usb = kzalloc_obj(struct ath6kl_usb, GFP_KERNEL); if (ar_usb == NULL) return NULL; ar_usb->wq = alloc_workqueue("ath6kl_wq", 0, 0); diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index 08a154bce139..c043ba9a2afa 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c @@ -4135,7 +4135,7 @@ void *ath6kl_wmi_init(struct ath6kl *dev) { struct wmi *wmi; - wmi = kzalloc(sizeof(struct wmi), GFP_KERNEL); + wmi = kzalloc_obj(struct wmi, GFP_KERNEL); if (!wmi) return NULL; diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index fe9abe8cd268..c7e063482f55 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c @@ -107,7 +107,7 @@ static int hif_usb_send_regout(struct hif_device_usb *hif_dev, if (urb == NULL) return -ENOMEM; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) { usb_free_urb(urb); return -ENOMEM; @@ -190,7 +190,7 @@ static int hif_usb_send_mgmt(struct hif_device_usb *hif_dev, if (urb == NULL) return -ENOMEM; - cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC); + cmd = kzalloc_obj(*cmd, GFP_ATOMIC); if (cmd == NULL) { usb_free_urb(urb); return -ENOMEM; @@ -849,7 +849,7 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev) init_usb_anchor(&hif_dev->mgmt_submitted); for (i = 0; i < MAX_TX_URB_NUM; i++) { - tx_buf = kzalloc(sizeof(*tx_buf), GFP_KERNEL); + tx_buf = kzalloc_obj(*tx_buf, GFP_KERNEL); if (!tx_buf) goto err; @@ -897,7 +897,7 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) for (i = 0; i < MAX_RX_URB_NUM; i++) { - rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL); + rx_buf = kzalloc_obj(*rx_buf, GFP_KERNEL); if (!rx_buf) { ret = -ENOMEM; goto err_rxb; @@ -972,7 +972,7 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) for (i = 0; i < MAX_REG_IN_URB_NUM; i++) { - rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL); + rx_buf = kzalloc_obj(*rx_buf, GFP_KERNEL); if (!rx_buf) { ret = -ENOMEM; goto err_rxb; @@ -1376,7 +1376,7 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, if (id->driver_info == STORAGE_DEVICE) return send_eject_command(interface); - hif_dev = kzalloc(sizeof(struct hif_device_usb), GFP_KERNEL); + hif_dev = kzalloc_obj(struct hif_device_usb, GFP_KERNEL); if (!hif_dev) { ret = -ENOMEM; goto err_alloc; diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 3633f9eb2c55..a57b1ca76891 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -611,7 +611,7 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv, struct ath_common *common; int i, ret = 0, csz = 0; - ah = kzalloc(sizeof(struct ath_hw), GFP_KERNEL); + ah = kzalloc_obj(struct ath_hw, GFP_KERNEL); if (!ah) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index ee5945cfc10e..20e1f9b72b16 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c @@ -664,8 +664,8 @@ void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event) * Store this event, so that the TX cleanup * routine can check later for the needed packet. */ - tx_pend = kzalloc(sizeof(struct ath9k_htc_tx_event), - GFP_ATOMIC); + tx_pend = kzalloc_obj(struct ath9k_htc_tx_event, + GFP_ATOMIC); if (!tx_pend) continue; @@ -1193,7 +1193,7 @@ int ath9k_rx_init(struct ath9k_htc_priv *priv) for (i = 0; i < ATH9K_HTC_RXBUF; i++) { struct ath9k_htc_rxbuf *rxbuf = - kzalloc(sizeof(struct ath9k_htc_rxbuf), GFP_KERNEL); + kzalloc_obj(struct ath9k_htc_rxbuf, GFP_KERNEL); if (rxbuf == NULL) goto err; diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c index b5257b2b4aa5..a2fe131d8c00 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.c +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c @@ -499,7 +499,7 @@ struct htc_target *ath9k_htc_hw_alloc(void *hif_handle, struct htc_endpoint *endpoint; struct htc_target *target; - target = kzalloc(sizeof(struct htc_target), GFP_KERNEL); + target = kzalloc_obj(struct htc_target, GFP_KERNEL); if (!target) return NULL; diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 14de62c1a32b..e7bf63d257b2 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -3128,7 +3128,7 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, !AR_SREV_9300_20_OR_LATER(ah)) return NULL; - timer = kzalloc(sizeof(struct ath_gen_timer), GFP_KERNEL); + timer = kzalloc_obj(struct ath_gen_timer, GFP_KERNEL); if (timer == NULL) return NULL; diff --git a/drivers/net/wireless/ath/ath9k/mci.c b/drivers/net/wireless/ath/ath9k/mci.c index a0845002d6fe..f82bb2349928 100644 --- a/drivers/net/wireless/ath/ath9k/mci.c +++ b/drivers/net/wireless/ath/ath9k/mci.c @@ -53,7 +53,7 @@ static bool ath_mci_add_profile(struct ath_common *common, (info->type != MCI_GPM_COEX_PROFILE_VOICE)) return false; - entry = kzalloc(sizeof(*entry), GFP_ATOMIC); + entry = kzalloc_obj(*entry, GFP_ATOMIC); if (!entry) return false; diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c index 805ad31edba2..2f56b9cc0ab8 100644 --- a/drivers/net/wireless/ath/ath9k/wmi.c +++ b/drivers/net/wireless/ath/ath9k/wmi.c @@ -92,7 +92,7 @@ struct wmi *ath9k_init_wmi(struct ath9k_htc_priv *priv) { struct wmi *wmi; - wmi = kzalloc(sizeof(struct wmi), GFP_KERNEL); + wmi = kzalloc_obj(struct wmi, GFP_KERNEL); if (!wmi) return NULL; diff --git a/drivers/net/wireless/ath/carl9170/cmd.c b/drivers/net/wireless/ath/carl9170/cmd.c index b8ed193c0195..402fd0633e09 100644 --- a/drivers/net/wireless/ath/carl9170/cmd.c +++ b/drivers/net/wireless/ath/carl9170/cmd.c @@ -120,7 +120,7 @@ struct carl9170_cmd *carl9170_cmd_buf(struct ar9170 *ar, { struct carl9170_cmd *tmp; - tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC); + tmp = kzalloc_obj(*tmp, GFP_ATOMIC); if (tmp) { tmp->hdr.cmd = cmd; tmp->hdr.len = len; diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index a7a9345f3483..3262a279746f 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c @@ -1412,8 +1412,7 @@ static int carl9170_op_ampdu_action(struct ieee80211_hw *hw, if (!sta_info->ht_sta) return -EOPNOTSUPP; - tid_info = kzalloc(sizeof(struct carl9170_sta_tid), - GFP_KERNEL); + tid_info = kzalloc_obj(struct carl9170_sta_tid, GFP_KERNEL); if (!tid_info) return -ENOMEM; diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c index b7717f9e1e9b..59caf1e4b158 100644 --- a/drivers/net/wireless/ath/carl9170/tx.c +++ b/drivers/net/wireless/ath/carl9170/tx.c @@ -1328,7 +1328,7 @@ static void carl9170_bar_check(struct ar9170 *ar, struct sk_buff *skb) struct carl9170_bar_list_entry *entry; unsigned int queue = skb_get_queue_mapping(skb); - entry = kmalloc(sizeof(*entry), GFP_ATOMIC); + entry = kmalloc_obj(*entry, GFP_ATOMIC); if (!WARN_ON_ONCE(!entry)) { entry->skb = skb; spin_lock_bh(&ar->bar_list_lock[queue]); diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c b/drivers/net/wireless/ath/dfs_pattern_detector.c index 700da9f4531e..a798ff11183d 100644 --- a/drivers/net/wireless/ath/dfs_pattern_detector.c +++ b/drivers/net/wireless/ath/dfs_pattern_detector.c @@ -199,7 +199,7 @@ channel_detector_create(struct dfs_pattern_detector *dpd, u16 freq) u32 i; struct channel_detector *cd; - cd = kzalloc(struct_size(cd, detectors, dpd->num_radar_types), GFP_ATOMIC); + cd = kzalloc_flex(*cd, detectors, dpd->num_radar_types, GFP_ATOMIC); if (cd == NULL) goto fail; @@ -354,7 +354,7 @@ dfs_pattern_detector_init(struct ath_common *common, if (!IS_ENABLED(CONFIG_CFG80211_CERTIFICATION_ONUS)) return NULL; - dpd = kmalloc(sizeof(*dpd), GFP_KERNEL); + dpd = kmalloc_obj(*dpd, GFP_KERNEL); if (dpd == NULL) return NULL; diff --git a/drivers/net/wireless/ath/dfs_pri_detector.c b/drivers/net/wireless/ath/dfs_pri_detector.c index d07c454c9c00..388f9d1913bd 100644 --- a/drivers/net/wireless/ath/dfs_pri_detector.c +++ b/drivers/net/wireless/ath/dfs_pri_detector.c @@ -202,7 +202,7 @@ static bool pulse_queue_enqueue(struct pri_detector *pde, u64 ts) { struct pulse_elem *p = pool_get_pulse_elem(); if (p == NULL) { - p = kmalloc(sizeof(*p), GFP_ATOMIC); + p = kmalloc_obj(*p, GFP_ATOMIC); if (p == NULL) { DFS_POOL_STAT_INC(pulse_alloc_error); return false; @@ -284,7 +284,7 @@ static bool pseq_handler_create_sequences(struct pri_detector *pde, ps.deadline_ts = ps.first_ts + ps.dur; new_ps = pool_get_pseq_elem(); if (new_ps == NULL) { - new_ps = kmalloc(sizeof(*new_ps), GFP_ATOMIC); + new_ps = kmalloc_obj(*new_ps, GFP_ATOMIC); if (new_ps == NULL) { DFS_POOL_STAT_INC(pseq_alloc_error); return false; @@ -418,7 +418,7 @@ struct pri_detector *pri_detector_init(const struct radar_detector_specs *rs) { struct pri_detector *de; - de = kzalloc(sizeof(*de), GFP_ATOMIC); + de = kzalloc_obj(*de, GFP_ATOMIC); if (de == NULL) return NULL; de->exit = pri_detector_exit; diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c index 0f4df5585fd9..c6ec7a296240 100644 --- a/drivers/net/wireless/ath/wcn36xx/dxe.c +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c @@ -74,7 +74,7 @@ static int wcn36xx_dxe_allocate_ctl_block(struct wcn36xx_dxe_ch *ch) spin_lock_init(&ch->lock); for (i = 0; i < ch->desc_num; i++) { - cur_ctl = kzalloc(sizeof(*cur_ctl), GFP_KERNEL); + cur_ctl = kzalloc_obj(*cur_ctl, GFP_KERNEL); if (!cur_ctl) goto out_fail; diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index 02a525645bfa..c3f0860873de 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -462,7 +462,7 @@ static u64 wcn36xx_prepare_multicast(struct ieee80211_hw *hw, struct netdev_hw_addr *ha; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac prepare multicast list\n"); - fp = kzalloc(sizeof(*fp), GFP_ATOMIC); + fp = kzalloc_obj(*fp, GFP_ATOMIC); if (!fp) { wcn36xx_err("Out of memory setting filters.\n"); return 0; diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 136acc414714..f9ebe13d0245 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -847,7 +847,7 @@ int wcn36xx_smd_start_hw_scan(struct wcn36xx *wcn, struct ieee80211_vif *vif, return -EINVAL; mutex_lock(&wcn->hal_mutex); - msg_body = kzalloc(sizeof(*msg_body), GFP_KERNEL); + msg_body = kzalloc_obj(*msg_body, GFP_KERNEL); if (!msg_body) { ret = -ENOMEM; goto out; @@ -942,7 +942,7 @@ int wcn36xx_smd_update_channel_list(struct wcn36xx *wcn, struct cfg80211_scan_re struct wcn36xx_hal_update_channel_list_req_msg *msg_body; int ret, i; - msg_body = kzalloc(sizeof(*msg_body), GFP_KERNEL); + msg_body = kzalloc_obj(*msg_body, GFP_KERNEL); if (!msg_body) return -ENOMEM; @@ -1624,7 +1624,7 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn, struct cfg80211_chan_def *chandef; int ret; - msg_body = kzalloc(sizeof(*msg_body), GFP_KERNEL); + msg_body = kzalloc_obj(*msg_body, GFP_KERNEL); if (!msg_body) return -ENOMEM; @@ -1744,7 +1744,7 @@ static int wcn36xx_smd_config_bss_v0(struct wcn36xx *wcn, struct wcn36xx_hal_config_sta_params *sta_params; int ret; - msg = kzalloc(sizeof(*msg), GFP_KERNEL); + msg = kzalloc_obj(*msg, GFP_KERNEL); if (!msg) return -ENOMEM; @@ -3306,7 +3306,7 @@ int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, case WCN36XX_HAL_DELETE_STA_CONTEXT_IND: case WCN36XX_HAL_PRINT_REG_INFO_IND: case WCN36XX_HAL_SCAN_OFFLOAD_IND: - msg_ind = kmalloc(struct_size(msg_ind, msg, len), GFP_ATOMIC); + msg_ind = kmalloc_flex(*msg_ind, msg, len, GFP_ATOMIC); if (!msg_ind) { wcn36xx_err("Run out of memory while handling SMD_EVENT (%d)\n", msg_header->msg_type); diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index 7218fe70f3bc..e0f39ef9ac78 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c @@ -691,7 +691,7 @@ wil_cfg80211_add_iface(struct wiphy *wiphy, const char *name, return ERR_PTR(-EINVAL); } - p2p_wdev = kzalloc(sizeof(*p2p_wdev), GFP_KERNEL); + p2p_wdev = kzalloc_obj(*p2p_wdev, GFP_KERNEL); if (!p2p_wdev) return ERR_PTR(-ENOMEM); @@ -2394,7 +2394,7 @@ static int wil_cfg80211_probe_client(struct wiphy *wiphy, if (cid < 0) return -ENOLINK; - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req, GFP_KERNEL); if (!req) return -ENOMEM; diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index c021ebcddee7..2e5c24245e6a 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -1392,7 +1392,7 @@ static int link_show(struct seq_file *s, void *data) struct station_info *sinfo; int i, rc = 0; - sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); + sinfo = kzalloc_obj(*sinfo, GFP_KERNEL); if (!sinfo) return -ENOMEM; @@ -2441,9 +2441,8 @@ int wil6210_debugfs_init(struct wil6210_priv *wil) if (IS_ERR_OR_NULL(dbg)) return -ENODEV; - wil->dbg_data.data_arr = kcalloc(dbg_off_count, - sizeof(struct wil_debugfs_iomem_data), - GFP_KERNEL); + wil->dbg_data.data_arr = kzalloc_objs(struct wil_debugfs_iomem_data, + dbg_off_count, GFP_KERNEL); if (!wil->dbg_data.data_arr) { debugfs_remove_recursive(dbg); wil->debug = NULL; diff --git a/drivers/net/wireless/ath/wil6210/fw_inc.c b/drivers/net/wireless/ath/wil6210/fw_inc.c index c3c0b289dcf3..bc172f5a70c9 100644 --- a/drivers/net/wireless/ath/wil6210/fw_inc.c +++ b/drivers/net/wireless/ath/wil6210/fw_inc.c @@ -160,8 +160,8 @@ fw_handle_brd_file(struct wil6210_priv *wil, const void *data, return -EINVAL; } - wil->brd_info = kcalloc(max_num_ent, sizeof(struct wil_brd_info), - GFP_KERNEL); + wil->brd_info = kzalloc_objs(struct wil_brd_info, max_num_ent, + GFP_KERNEL); if (!wil->brd_info) return -ENOMEM; diff --git a/drivers/net/wireless/ath/wil6210/pmc.c b/drivers/net/wireless/ath/wil6210/pmc.c index a2f7b4c1da48..8d368c901122 100644 --- a/drivers/net/wireless/ath/wil6210/pmc.c +++ b/drivers/net/wireless/ath/wil6210/pmc.c @@ -85,9 +85,8 @@ void wil_pmc_alloc(struct wil6210_priv *wil, num_descriptors, descriptor_size); /* allocate descriptors info list in pmc context*/ - pmc->descriptors = kcalloc(num_descriptors, - sizeof(struct desc_alloc_info), - GFP_KERNEL); + pmc->descriptors = kzalloc_objs(struct desc_alloc_info, num_descriptors, + GFP_KERNEL); if (!pmc->descriptors) { wil_err(wil, "ERROR allocating pmc skb list\n"); goto no_release_err; diff --git a/drivers/net/wireless/ath/wil6210/rx_reorder.c b/drivers/net/wireless/ath/wil6210/rx_reorder.c index d385bc03033a..75bf9dbbf23a 100644 --- a/drivers/net/wireless/ath/wil6210/rx_reorder.c +++ b/drivers/net/wireless/ath/wil6210/rx_reorder.c @@ -241,13 +241,13 @@ out: struct wil_tid_ampdu_rx *wil_tid_ampdu_rx_alloc(struct wil6210_priv *wil, int size, u16 ssn) { - struct wil_tid_ampdu_rx *r = kzalloc(sizeof(*r), GFP_KERNEL); + struct wil_tid_ampdu_rx *r = kzalloc_obj(*r, GFP_KERNEL); if (!r) return NULL; r->reorder_buf = - kcalloc(size, sizeof(struct sk_buff *), GFP_KERNEL); + kzalloc_objs(struct sk_buff *, size, GFP_KERNEL); if (!r->reorder_buf) { kfree(r); return NULL; diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c index 19702b6f09c3..e11f30a7bb48 100644 --- a/drivers/net/wireless/ath/wil6210/txrx.c +++ b/drivers/net/wireless/ath/wil6210/txrx.c @@ -119,7 +119,7 @@ static int wil_vring_alloc(struct wil6210_priv *wil, struct wil_ring *vring) vring->swhead = 0; vring->swtail = 0; - vring->ctx = kcalloc(vring->size, sizeof(vring->ctx[0]), GFP_KERNEL); + vring->ctx = kzalloc_objs(vring->ctx[0], vring->size, GFP_KERNEL); if (!vring->ctx) { vring->va = NULL; return -ENOMEM; diff --git a/drivers/net/wireless/ath/wil6210/txrx_edma.c b/drivers/net/wireless/ath/wil6210/txrx_edma.c index 1ba1f21ebea2..e391951346c2 100644 --- a/drivers/net/wireless/ath/wil6210/txrx_edma.c +++ b/drivers/net/wireless/ath/wil6210/txrx_edma.c @@ -314,9 +314,8 @@ static int wil_init_rx_buff_arr(struct wil6210_priv *wil, struct list_head *free = &wil->rx_buff_mgmt.free; int i; - wil->rx_buff_mgmt.buff_arr = kcalloc(size + 1, - sizeof(struct wil_rx_buff), - GFP_KERNEL); + wil->rx_buff_mgmt.buff_arr = kzalloc_objs(struct wil_rx_buff, size + 1, + GFP_KERNEL); if (!wil->rx_buff_mgmt.buff_arr) return -ENOMEM; @@ -382,7 +381,7 @@ static int wil_ring_alloc_desc_ring(struct wil6210_priv *wil, ring->swhead = 0; ring->swtail = 0; - ring->ctx = kcalloc(ring->size, sizeof(ring->ctx[0]), GFP_KERNEL); + ring->ctx = kzalloc_objs(ring->ctx[0], ring->size, GFP_KERNEL); if (!ring->ctx) goto err; diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c index 6d376f85fbde..69f9fb19f01b 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c @@ -1080,7 +1080,7 @@ static void wmi_evt_connect(struct wil6210_vif *vif, int id, void *d, int len) goto out; } - sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); + sinfo = kzalloc_obj(*sinfo, GFP_KERNEL); if (!sinfo) { rc = -ENOMEM; goto out; diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c index aa683eacaf38..11554306a5f3 100644 --- a/drivers/net/wireless/atmel/at76c50x-usb.c +++ b/drivers/net/wireless/atmel/at76c50x-usb.c @@ -378,7 +378,7 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size, return -EINVAL; } - dfu_stat_buf = kmalloc(sizeof(*dfu_stat_buf), GFP_KERNEL); + dfu_stat_buf = kmalloc_obj(*dfu_stat_buf, GFP_KERNEL); if (!dfu_stat_buf) { ret = -ENOMEM; goto exit; @@ -607,7 +607,7 @@ static inline int at76_get_hw_cfg_intersil(struct usb_device *udev, static int at76_get_hw_config(struct at76_priv *priv) { int ret; - union at76_hwcfg *hwcfg = kmalloc(sizeof(*hwcfg), GFP_KERNEL); + union at76_hwcfg *hwcfg = kmalloc_obj(*hwcfg, GFP_KERNEL); if (!hwcfg) return -ENOMEM; @@ -931,7 +931,7 @@ static void at76_dump_mib_mac_addr(struct at76_priv *priv) { int i; int ret; - struct mib_mac_addr *m = kmalloc(sizeof(*m), GFP_KERNEL); + struct mib_mac_addr *m = kmalloc_obj(*m, GFP_KERNEL); if (!m) return; @@ -959,7 +959,7 @@ static void at76_dump_mib_mac_wep(struct at76_priv *priv) int i; int ret; int key_len; - struct mib_mac_wep *m = kmalloc(sizeof(*m), GFP_KERNEL); + struct mib_mac_wep *m = kmalloc_obj(*m, GFP_KERNEL); if (!m) return; @@ -994,7 +994,7 @@ exit: static void at76_dump_mib_mac_mgmt(struct at76_priv *priv) { int ret; - struct mib_mac_mgmt *m = kmalloc(sizeof(*m), GFP_KERNEL); + struct mib_mac_mgmt *m = kmalloc_obj(*m, GFP_KERNEL); if (!m) return; @@ -1030,7 +1030,7 @@ exit: static void at76_dump_mib_mac(struct at76_priv *priv) { int ret; - struct mib_mac *m = kmalloc(sizeof(*m), GFP_KERNEL); + struct mib_mac *m = kmalloc_obj(*m, GFP_KERNEL); if (!m) return; @@ -1067,7 +1067,7 @@ exit: static void at76_dump_mib_phy(struct at76_priv *priv) { int ret; - struct mib_phy *m = kmalloc(sizeof(*m), GFP_KERNEL); + struct mib_phy *m = kmalloc_obj(*m, GFP_KERNEL); if (!m) return; @@ -1100,7 +1100,7 @@ exit: static void at76_dump_mib_local(struct at76_priv *priv) { int ret; - struct mib_local *m = kmalloc(sizeof(*m), GFP_KERNEL); + struct mib_local *m = kmalloc_obj(*m, GFP_KERNEL); if (!m) return; @@ -1125,7 +1125,7 @@ exit: static void at76_dump_mib_mdomain(struct at76_priv *priv) { int ret; - struct mib_mdomain *m = kmalloc(sizeof(*m), GFP_KERNEL); + struct mib_mdomain *m = kmalloc_obj(*m, GFP_KERNEL); if (!m) return; @@ -2442,7 +2442,7 @@ static int at76_probe(struct usb_interface *interface, udev = usb_get_dev(interface_to_usbdev(interface)); - fwv = kmalloc(sizeof(*fwv), GFP_KERNEL); + fwv = kmalloc_obj(*fwv, GFP_KERNEL); if (!fwv) { ret = -ENOMEM; goto exit; diff --git a/drivers/net/wireless/broadcom/b43/bus.c b/drivers/net/wireless/broadcom/b43/bus.c index fdb1c82892d6..b6c8697f782b 100644 --- a/drivers/net/wireless/broadcom/b43/bus.c +++ b/drivers/net/wireless/broadcom/b43/bus.c @@ -74,7 +74,7 @@ void b43_bus_bcma_block_write(struct b43_bus_dev *dev, const void *buffer, struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core) { - struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL); + struct b43_bus_dev *dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) return NULL; @@ -179,7 +179,7 @@ struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev) { struct b43_bus_dev *dev; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) return NULL; diff --git a/drivers/net/wireless/broadcom/b43/debugfs.c b/drivers/net/wireless/broadcom/b43/debugfs.c index 5a49970afc8c..aa6768a66b03 100644 --- a/drivers/net/wireless/broadcom/b43/debugfs.c +++ b/drivers/net/wireless/broadcom/b43/debugfs.c @@ -670,15 +670,15 @@ void b43_debugfs_add_device(struct b43_wldev *dev) char devdir[16]; B43_WARN_ON(!dev); - e = kzalloc(sizeof(*e), GFP_KERNEL); + e = kzalloc_obj(*e, GFP_KERNEL); if (!e) { b43err(dev->wl, "debugfs: add device OOM\n"); return; } e->dev = dev; log = &e->txstatlog; - log->log = kcalloc(B43_NR_LOGGED_TXSTATUS, - sizeof(struct b43_txstatus), GFP_KERNEL); + log->log = kzalloc_objs(struct b43_txstatus, B43_NR_LOGGED_TXSTATUS, + GFP_KERNEL); if (!log->log) { b43err(dev->wl, "debugfs: add device txstatus OOM\n"); kfree(e); diff --git a/drivers/net/wireless/broadcom/b43/dma.c b/drivers/net/wireless/broadcom/b43/dma.c index 6ac7dcebfff9..eca39555718f 100644 --- a/drivers/net/wireless/broadcom/b43/dma.c +++ b/drivers/net/wireless/broadcom/b43/dma.c @@ -838,7 +838,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, int i, err; dma_addr_t dma_test; - ring = kzalloc(sizeof(*ring), GFP_KERNEL); + ring = kzalloc_obj(*ring, GFP_KERNEL); if (!ring) goto out; @@ -846,8 +846,8 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, if (for_tx) ring->nr_slots = B43_TXRING_SLOTS; - ring->meta = kcalloc(ring->nr_slots, sizeof(struct b43_dmadesc_meta), - GFP_KERNEL); + ring->meta = kzalloc_objs(struct b43_dmadesc_meta, ring->nr_slots, + GFP_KERNEL); if (!ring->meta) goto err_kfree_ring; for (i = 0; i < ring->nr_slots; i++) diff --git a/drivers/net/wireless/broadcom/b43/lo.c b/drivers/net/wireless/broadcom/b43/lo.c index 338b6545a1e7..6fcd7205bda3 100644 --- a/drivers/net/wireless/broadcom/b43/lo.c +++ b/drivers/net/wireless/broadcom/b43/lo.c @@ -766,7 +766,7 @@ struct b43_lo_calib *b43_calibrate_lo_setting(struct b43_wldev *dev, loctl.i, loctl.q); } - cal = kmalloc(sizeof(*cal), GFP_KERNEL); + cal = kmalloc_obj(*cal, GFP_KERNEL); if (!cal) { b43warn(dev->wl, "LO calib: out of memory\n"); return NULL; diff --git a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireless/broadcom/b43/main.c index f1a77c4c445f..97e222e9e613 100644 --- a/drivers/net/wireless/broadcom/b43/main.c +++ b/drivers/net/wireless/broadcom/b43/main.c @@ -2555,7 +2555,7 @@ static void b43_request_firmware(struct work_struct *work) int err; const char *errmsg; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return; ctx->dev = dev; @@ -5494,7 +5494,7 @@ static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl) struct b43_wldev *wldev; int err = -ENOMEM; - wldev = kzalloc(sizeof(*wldev), GFP_KERNEL); + wldev = kzalloc_obj(*wldev, GFP_KERNEL); if (!wldev) goto out; diff --git a/drivers/net/wireless/broadcom/b43/phy_ac.c b/drivers/net/wireless/broadcom/b43/phy_ac.c index 756cd44a8104..85af2d791d91 100644 --- a/drivers/net/wireless/broadcom/b43/phy_ac.c +++ b/drivers/net/wireless/broadcom/b43/phy_ac.c @@ -17,7 +17,7 @@ static int b43_phy_ac_op_allocate(struct b43_wldev *dev) { struct b43_phy_ac *phy_ac; - phy_ac = kzalloc(sizeof(*phy_ac), GFP_KERNEL); + phy_ac = kzalloc_obj(*phy_ac, GFP_KERNEL); if (!phy_ac) return -ENOMEM; dev->phy.ac = phy_ac; diff --git a/drivers/net/wireless/broadcom/b43/phy_g.c b/drivers/net/wireless/broadcom/b43/phy_g.c index ac72ca39e409..94038d427b39 100644 --- a/drivers/net/wireless/broadcom/b43/phy_g.c +++ b/drivers/net/wireless/broadcom/b43/phy_g.c @@ -2422,14 +2422,14 @@ static int b43_gphy_op_allocate(struct b43_wldev *dev) struct b43_txpower_lo_control *lo; int err; - gphy = kzalloc(sizeof(*gphy), GFP_KERNEL); + gphy = kzalloc_obj(*gphy, GFP_KERNEL); if (!gphy) { err = -ENOMEM; goto error; } dev->phy.g = gphy; - lo = kzalloc(sizeof(*lo), GFP_KERNEL); + lo = kzalloc_obj(*lo, GFP_KERNEL); if (!lo) { err = -ENOMEM; goto err_free_gphy; diff --git a/drivers/net/wireless/broadcom/b43/phy_ht.c b/drivers/net/wireless/broadcom/b43/phy_ht.c index 26a226126bc4..a1a5e699caf1 100644 --- a/drivers/net/wireless/broadcom/b43/phy_ht.c +++ b/drivers/net/wireless/broadcom/b43/phy_ht.c @@ -842,7 +842,7 @@ static int b43_phy_ht_op_allocate(struct b43_wldev *dev) { struct b43_phy_ht *phy_ht; - phy_ht = kzalloc(sizeof(*phy_ht), GFP_KERNEL); + phy_ht = kzalloc_obj(*phy_ht, GFP_KERNEL); if (!phy_ht) return -ENOMEM; dev->phy.ht = phy_ht; diff --git a/drivers/net/wireless/broadcom/b43/phy_lcn.c b/drivers/net/wireless/broadcom/b43/phy_lcn.c index 63bd29f070f7..67b61a915aa2 100644 --- a/drivers/net/wireless/broadcom/b43/phy_lcn.c +++ b/drivers/net/wireless/broadcom/b43/phy_lcn.c @@ -669,7 +669,7 @@ static int b43_phy_lcn_op_allocate(struct b43_wldev *dev) { struct b43_phy_lcn *phy_lcn; - phy_lcn = kzalloc(sizeof(*phy_lcn), GFP_KERNEL); + phy_lcn = kzalloc_obj(*phy_lcn, GFP_KERNEL); if (!phy_lcn) return -ENOMEM; dev->phy.lcn = phy_lcn; diff --git a/drivers/net/wireless/broadcom/b43/phy_lp.c b/drivers/net/wireless/broadcom/b43/phy_lp.c index 0e5c076e7544..622d4fe3b613 100644 --- a/drivers/net/wireless/broadcom/b43/phy_lp.c +++ b/drivers/net/wireless/broadcom/b43/phy_lp.c @@ -43,7 +43,7 @@ static int b43_lpphy_op_allocate(struct b43_wldev *dev) { struct b43_phy_lp *lpphy; - lpphy = kzalloc(sizeof(*lpphy), GFP_KERNEL); + lpphy = kzalloc_obj(*lpphy, GFP_KERNEL); if (!lpphy) return -ENOMEM; dev->phy.lp = lpphy; diff --git a/drivers/net/wireless/broadcom/b43/phy_n.c b/drivers/net/wireless/broadcom/b43/phy_n.c index 4bb005b93f2c..768d9576be41 100644 --- a/drivers/net/wireless/broadcom/b43/phy_n.c +++ b/drivers/net/wireless/broadcom/b43/phy_n.c @@ -1549,7 +1549,7 @@ static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max, len = bw << 1; } - samples = kcalloc(len, sizeof(struct cordic_iq), GFP_KERNEL); + samples = kzalloc_objs(struct cordic_iq, len, GFP_KERNEL); if (!samples) { b43err(dev->wl, "allocation for samples generation failed\n"); return 0; @@ -6417,7 +6417,7 @@ static int b43_nphy_op_allocate(struct b43_wldev *dev) { struct b43_phy_n *nphy; - nphy = kzalloc(sizeof(*nphy), GFP_KERNEL); + nphy = kzalloc_obj(*nphy, GFP_KERNEL); if (!nphy) return -ENOMEM; diff --git a/drivers/net/wireless/broadcom/b43/pio.c b/drivers/net/wireless/broadcom/b43/pio.c index e41f2f5b4c26..135091bec6c4 100644 --- a/drivers/net/wireless/broadcom/b43/pio.c +++ b/drivers/net/wireless/broadcom/b43/pio.c @@ -127,7 +127,7 @@ static struct b43_pio_txqueue *b43_setup_pioqueue_tx(struct b43_wldev *dev, struct b43_pio_txpacket *p; unsigned int i; - q = kzalloc(sizeof(*q), GFP_KERNEL); + q = kzalloc_obj(*q, GFP_KERNEL); if (!q) return NULL; q->dev = dev; @@ -161,7 +161,7 @@ static struct b43_pio_rxqueue *b43_setup_pioqueue_rx(struct b43_wldev *dev, { struct b43_pio_rxqueue *q; - q = kzalloc(sizeof(*q), GFP_KERNEL); + q = kzalloc_obj(*q, GFP_KERNEL); if (!q) return NULL; q->dev = dev; diff --git a/drivers/net/wireless/broadcom/b43/sdio.c b/drivers/net/wireless/broadcom/b43/sdio.c index 02b0cfd535ab..8d19fe48831f 100644 --- a/drivers/net/wireless/broadcom/b43/sdio.c +++ b/drivers/net/wireless/broadcom/b43/sdio.c @@ -139,7 +139,7 @@ static int b43_sdio_probe(struct sdio_func *func, } sdio_release_host(func); - sdio = kzalloc(sizeof(*sdio), GFP_KERNEL); + sdio = kzalloc_obj(*sdio, GFP_KERNEL); if (!sdio) { error = -ENOMEM; dev_err(&func->dev, "failed to allocate ssb bus\n"); diff --git a/drivers/net/wireless/broadcom/b43legacy/debugfs.c b/drivers/net/wireless/broadcom/b43legacy/debugfs.c index 5d04bcc216e5..ec1f67f6d328 100644 --- a/drivers/net/wireless/broadcom/b43legacy/debugfs.c +++ b/drivers/net/wireless/broadcom/b43legacy/debugfs.c @@ -358,15 +358,15 @@ void b43legacy_debugfs_add_device(struct b43legacy_wldev *dev) char devdir[16]; B43legacy_WARN_ON(!dev); - e = kzalloc(sizeof(*e), GFP_KERNEL); + e = kzalloc_obj(*e, GFP_KERNEL); if (!e) { b43legacyerr(dev->wl, "debugfs: add device OOM\n"); return; } e->dev = dev; log = &e->txstatlog; - log->log = kcalloc(B43legacy_NR_LOGGED_TXSTATUS, - sizeof(struct b43legacy_txstatus), GFP_KERNEL); + log->log = kzalloc_objs(struct b43legacy_txstatus, + B43legacy_NR_LOGGED_TXSTATUS, GFP_KERNEL); if (!log->log) { b43legacyerr(dev->wl, "debugfs: add device txstatus OOM\n"); kfree(e); diff --git a/drivers/net/wireless/broadcom/b43legacy/dma.c b/drivers/net/wireless/broadcom/b43legacy/dma.c index 60e41de72f29..aff7e9161ffc 100644 --- a/drivers/net/wireless/broadcom/b43legacy/dma.c +++ b/drivers/net/wireless/broadcom/b43legacy/dma.c @@ -610,7 +610,7 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev, int nr_slots; dma_addr_t dma_test; - ring = kzalloc(sizeof(*ring), GFP_KERNEL); + ring = kzalloc_obj(*ring, GFP_KERNEL); if (!ring) goto out; ring->type = type; @@ -620,8 +620,8 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev, if (for_tx) nr_slots = B43legacy_TXRING_SLOTS; - ring->meta = kcalloc(nr_slots, sizeof(struct b43legacy_dmadesc_meta), - GFP_KERNEL); + ring->meta = kzalloc_objs(struct b43legacy_dmadesc_meta, nr_slots, + GFP_KERNEL); if (!ring->meta) goto err_kfree_ring; if (for_tx) { diff --git a/drivers/net/wireless/broadcom/b43legacy/main.c b/drivers/net/wireless/broadcom/b43legacy/main.c index aada342e0b80..0873014a9299 100644 --- a/drivers/net/wireless/broadcom/b43legacy/main.c +++ b/drivers/net/wireless/broadcom/b43legacy/main.c @@ -3269,9 +3269,8 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev) if ((phy->type == B43legacy_PHYTYPE_B) || (phy->type == B43legacy_PHYTYPE_G)) { - phy->_lo_pairs = kcalloc(B43legacy_LO_COUNT, - sizeof(struct b43legacy_lopair), - GFP_KERNEL); + phy->_lo_pairs = kzalloc_objs(struct b43legacy_lopair, + B43legacy_LO_COUNT, GFP_KERNEL); if (!phy->_lo_pairs) return -ENOMEM; } @@ -3739,7 +3738,7 @@ static int b43legacy_one_core_attach(struct ssb_device *dev, struct b43legacy_wldev *wldev; int err = -ENOMEM; - wldev = kzalloc(sizeof(*wldev), GFP_KERNEL); + wldev = kzalloc_obj(*wldev, GFP_KERNEL); if (!wldev) goto out; diff --git a/drivers/net/wireless/broadcom/b43legacy/pio.c b/drivers/net/wireless/broadcom/b43legacy/pio.c index aac413d0f629..fd9b79710350 100644 --- a/drivers/net/wireless/broadcom/b43legacy/pio.c +++ b/drivers/net/wireless/broadcom/b43legacy/pio.c @@ -320,7 +320,7 @@ struct b43legacy_pioqueue *b43legacy_setup_pioqueue(struct b43legacy_wldev *dev, u32 value; u16 qsize; - queue = kzalloc(sizeof(*queue), GFP_KERNEL); + queue = kzalloc_obj(*queue, GFP_KERNEL); if (!queue) goto out; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/core.c index f471c962104a..1a6cb3450d58 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/core.c @@ -23,8 +23,7 @@ static int brcmf_bca_alloc_fweh_info(struct brcmf_pub *drvr) { struct brcmf_fweh_info *fweh; - fweh = kzalloc(struct_size(fweh, evt_handler, BRCMF_BCA_E_LAST), - GFP_KERNEL); + fweh = kzalloc_flex(*fweh, evt_handler, BRCMF_BCA_E_LAST, GFP_KERNEL); if (!fweh) return -ENOMEM; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c index 9ec0c60b6da1..1817adc29cd8 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c @@ -444,7 +444,7 @@ int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { struct brcmf_bcdc *bcdc; - bcdc = kzalloc(sizeof(*bcdc), GFP_ATOMIC); + bcdc = kzalloc_obj(*bcdc, GFP_ATOMIC); if (!bcdc) goto fail; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c index 6a3f187320fc..cf5cf1dce28d 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c @@ -794,7 +794,7 @@ static int brcmf_sdiod_freezer_attach(struct brcmf_sdio_dev *sdiodev) if (!IS_ENABLED(CONFIG_PM_SLEEP)) return 0; - sdiodev->freezer = kzalloc(sizeof(*sdiodev->freezer), GFP_KERNEL); + sdiodev->freezer = kzalloc_obj(*sdiodev->freezer, GFP_KERNEL); if (!sdiodev->freezer) return -ENOMEM; atomic_set(&sdiodev->freezer->thread_count, 0); @@ -1067,10 +1067,10 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func, if (func->num != 2) return -ENODEV; - bus_if = kzalloc(sizeof(*bus_if), GFP_KERNEL); + bus_if = kzalloc_obj(*bus_if, GFP_KERNEL); if (!bus_if) return -ENOMEM; - sdiodev = kzalloc(sizeof(*sdiodev), GFP_KERNEL); + sdiodev = kzalloc_obj(*sdiodev, GFP_KERNEL); if (!sdiodev) { kfree(bus_if); return -ENOMEM; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c index 67c0c5a92f99..5aa1dd33bf85 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c @@ -362,7 +362,7 @@ int brcmf_btcoex_attach(struct brcmf_cfg80211_info *cfg) struct brcmf_btcoex_info *btci; brcmf_dbg(TRACE, "enter\n"); - btci = kmalloc(sizeof(*btci), GFP_KERNEL); + btci = kmalloc_obj(*btci, GFP_KERNEL); if (!btci) return -ENOMEM; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 61f7e620cab3..a442c74423a6 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -2527,7 +2527,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, offsetof(struct brcmf_assoc_params_le, chanspec_list); if (cfg->channel) join_params_size += sizeof(u16); - ext_join_params = kzalloc(sizeof(*ext_join_params), GFP_KERNEL); + ext_join_params = kzalloc_obj(*ext_join_params, GFP_KERNEL); if (ext_join_params == NULL) { err = -ENOMEM; goto done; @@ -4330,7 +4330,7 @@ brcmf_pmksa_v3_op(struct brcmf_if *ifp, struct cfg80211_pmksa *pmksa, int length = offsetof(struct brcmf_pmk_op_v3_le, pmk); int ret; - pmk_op = kzalloc(sizeof(*pmk_op), GFP_KERNEL); + pmk_op = kzalloc_obj(*pmk_op, GFP_KERNEL); if (!pmk_op) return -ENOMEM; @@ -5588,7 +5588,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, err = -EINVAL; goto exit; } - af_params = kzalloc(sizeof(*af_params), GFP_KERNEL); + af_params = kzalloc_obj(*af_params, GFP_KERNEL); if (af_params == NULL) { bphy_err(drvr, "unable to allocate frame\n"); err = -ENOMEM; @@ -6050,7 +6050,7 @@ struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, brcmf_dbg(TRACE, "allocating virtual interface (size=%zu)\n", sizeof(*vif)); - vif = kzalloc(sizeof(*vif), GFP_KERNEL); + vif = kzalloc_obj(*vif, GFP_KERNEL); if (!vif) return ERR_PTR(-ENOMEM); @@ -6540,7 +6540,7 @@ brcmf_notify_connect_status_ap(struct brcmf_cfg80211_info *cfg, return -EINVAL; } - sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); + sinfo = kzalloc_obj(*sinfo, GFP_KERNEL); if (!sinfo) return -ENOMEM; @@ -6828,7 +6828,7 @@ static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_info *cfg) static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_info *cfg) { - cfg->conf = kzalloc(sizeof(*cfg->conf), GFP_KERNEL); + cfg->conf = kzalloc_obj(*cfg->conf, GFP_KERNEL); if (!cfg->conf) goto init_priv_mem_out; cfg->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); @@ -7486,7 +7486,7 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp) mchan = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN); n_combos = 1 + !!(p2p && !rsdb) + !!mbss; - combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL); + combo = kzalloc_objs(*combo, n_combos, GFP_KERNEL); if (!combo) goto err; @@ -7503,7 +7503,7 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp) c = 0; i = 0; n_limits = 1 + mon_flag + (p2p ? 2 : 0) + (rsdb || !p2p); - c0_limits = kcalloc(n_limits, sizeof(*c0_limits), GFP_KERNEL); + c0_limits = kzalloc_objs(*c0_limits, n_limits, GFP_KERNEL); if (!c0_limits) goto err; @@ -7542,7 +7542,7 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp) if (p2p && !rsdb) { c++; i = 0; - p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL); + p2p_limits = kzalloc_objs(*p2p_limits, 4, GFP_KERNEL); if (!p2p_limits) goto err; p2p_limits[i].max = 1; @@ -7563,8 +7563,7 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp) c++; i = 0; n_limits = 1 + mon_flag; - mbss_limits = kcalloc(n_limits, sizeof(*mbss_limits), - GFP_KERNEL); + mbss_limits = kzalloc_objs(*mbss_limits, n_limits, GFP_KERNEL); if (!mbss_limits) goto err; mbss_limits[i].max = 4; @@ -8322,7 +8321,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, return NULL; } - cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); + cfg = kzalloc_obj(*cfg, GFP_KERNEL); if (!cfg) { bphy_err(drvr, "Could not allocate wiphy device\n"); return NULL; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c index 4239f2b21e54..a3bbbb76dd97 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c @@ -507,7 +507,7 @@ static struct brcmf_core *brcmf_chip_add_core(struct brcmf_chip_priv *ci, { struct brcmf_core_priv *core; - core = kzalloc(sizeof(*core), GFP_KERNEL); + core = kzalloc_obj(*core, GFP_KERNEL); if (!core) return ERR_PTR(-ENOMEM); @@ -1137,7 +1137,7 @@ struct brcmf_chip *brcmf_chip_attach(void *ctx, u16 devid, if (err < 0) return ERR_PTR(-EINVAL); - chip = kzalloc(sizeof(*chip), GFP_KERNEL); + chip = kzalloc_obj(*chip, GFP_KERNEL); if (!chip) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c index 688f16c51319..cdc9dc733f5b 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c @@ -132,8 +132,7 @@ static int brcmf_c_download_blob(struct brcmf_if *ifp, brcmf_dbg(TRACE, "Enter\n"); - chunk_buf = kzalloc(struct_size(chunk_buf, data, MAX_CHUNK_LEN), - GFP_KERNEL); + chunk_buf = kzalloc_flex(*chunk_buf, data, MAX_CHUNK_LEN, GFP_KERNEL); if (!chunk_buf) { err = -ENOMEM; return -ENOMEM; @@ -521,7 +520,7 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev, brcmf_dbg(INFO, "Enter, bus=%d, chip=%d, rev=%d\n", bus_type, chip, chiprev); - settings = kzalloc(sizeof(*settings), GFP_ATOMIC); + settings = kzalloc_obj(*settings, GFP_ATOMIC); if (!settings) return NULL; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index 616885d6db3f..99d5fd453cf1 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -879,7 +879,7 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, if (!drvr->settings->p2p_enable && is_p2pdev) { /* this is P2P_DEVICE interface */ brcmf_dbg(INFO, "allocate non-netdev interface\n"); - ifp = kzalloc(sizeof(*ifp), GFP_KERNEL); + ifp = kzalloc_obj(*ifp, GFP_KERNEL); if (!ifp) return ERR_PTR(-ENOMEM); } else { diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c index 4f0ea4347840..abd38ac8c51e 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c @@ -66,8 +66,7 @@ static int brcmf_cyw_alloc_fweh_info(struct brcmf_pub *drvr) { struct brcmf_fweh_info *fweh; - fweh = kzalloc(struct_size(fweh, evt_handler, BRCMF_CYW_E_LAST), - GFP_KERNEL); + fweh = kzalloc_flex(*fweh, evt_handler, BRCMF_CYW_E_LAST, GFP_KERNEL); if (!fweh) return -ENOMEM; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c index ef79924fd8f4..7b3b0bd1acaf 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c @@ -765,7 +765,7 @@ int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req, if (!brcmf_fw_request_is_valid(req)) return -EINVAL; - fwctx = kzalloc(sizeof(*fwctx), GFP_KERNEL); + fwctx = kzalloc_obj(*fwctx, GFP_KERNEL); if (!fwctx) return -ENOMEM; @@ -825,7 +825,7 @@ brcmf_fw_alloc_request(u32 chip, u32 chiprev, return NULL; } - fwreq = kzalloc(struct_size(fwreq, items, n_fwnames), GFP_KERNEL); + fwreq = kzalloc_flex(*fwreq, items, n_fwnames, GFP_KERNEL); if (!fwreq) return NULL; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c index e1127d7e086d..9184022600d6 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c @@ -145,7 +145,7 @@ u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN], if (i == flow->nrofrings) return -ENOMEM; - ring = kzalloc(sizeof(*ring), GFP_ATOMIC); + ring = kzalloc_obj(*ring, GFP_ATOMIC); if (!ring) return -ENOMEM; @@ -360,7 +360,7 @@ struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings) struct brcmf_flowring *flow; u32 i; - flow = kzalloc(sizeof(*flow), GFP_KERNEL); + flow = kzalloc_obj(*flow, GFP_KERNEL); if (flow) { flow->dev = dev; flow->nrofrings = nrofrings; @@ -369,8 +369,7 @@ struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings) flow->addr_mode[i] = ADDR_INDIRECT; for (i = 0; i < ARRAY_SIZE(flow->hash); i++) flow->hash[i].ifidx = BRCMF_FLOWRING_INVALID_IFIDX; - flow->rings = kcalloc(nrofrings, sizeof(*flow->rings), - GFP_KERNEL); + flow->rings = kzalloc_objs(*flow->rings, nrofrings, GFP_KERNEL); if (!flow->rings) { kfree(flow); flow = NULL; @@ -480,7 +479,7 @@ void brcmf_flowring_add_tdls_peer(struct brcmf_flowring *flow, int ifidx, struct brcmf_flowring_tdls_entry *tdls_entry; struct brcmf_flowring_tdls_entry *search; - tdls_entry = kzalloc(sizeof(*tdls_entry), GFP_ATOMIC); + tdls_entry = kzalloc_obj(*tdls_entry, GFP_ATOMIC); if (tdls_entry == NULL) return; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c index c2d98ee6652f..984886481f4e 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c @@ -497,7 +497,7 @@ void brcmf_fweh_process_event(struct brcmf_pub *drvr, datalen + sizeof(*event_packet) > packet_len) return; - event = kzalloc(struct_size(event, data, datalen), gfp); + event = kzalloc_flex(*event, data, datalen, gfp); if (!event) return; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c index b70d20128f98..b6fab5eb6002 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c @@ -1712,8 +1712,7 @@ void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *pkt) /* allocate space for flow reorder info */ brcmf_dbg(INFO, "flow-%d: start, maxidx %d\n", flow_id, max_idx); - rfi = kzalloc(struct_size(rfi, pktslots, max_idx + 1), - GFP_ATOMIC); + rfi = kzalloc_flex(*rfi, pktslots, max_idx + 1, GFP_ATOMIC); if (rfi == NULL) { bphy_err(drvr, "failed to alloc buffer\n"); brcmf_netif_rx(ifp, pkt); @@ -2343,7 +2342,7 @@ struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr) int rc; u32 mode; - fws = kzalloc(sizeof(*fws), GFP_KERNEL); + fws = kzalloc_obj(*fws, GFP_KERNEL); if (!fws) { rc = -ENOMEM; goto fail; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c index 45fbcbdc7d9e..7252cdb6d87a 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c @@ -299,11 +299,11 @@ brcmf_msgbuf_init_pktids(u32 nr_array_entries, struct brcmf_msgbuf_pktid *array; struct brcmf_msgbuf_pktids *pktids; - array = kcalloc(nr_array_entries, sizeof(*array), GFP_KERNEL); + array = kzalloc_objs(*array, nr_array_entries, GFP_KERNEL); if (!array) return NULL; - pktids = kzalloc(sizeof(*pktids), GFP_KERNEL); + pktids = kzalloc_obj(*pktids, GFP_KERNEL); if (!pktids) { kfree(array); return NULL; @@ -670,7 +670,7 @@ static u32 brcmf_msgbuf_flowring_create(struct brcmf_msgbuf *msgbuf, int ifidx, u32 flowid; ulong flags; - create = kzalloc(sizeof(*create), GFP_ATOMIC); + create = kzalloc_obj(*create, GFP_ATOMIC); if (create == NULL) return BRCMF_FLOWRING_INVALID_ID; @@ -1539,7 +1539,7 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr) if_msgbuf->max_flowrings = BRCMF_FLOWRING_HASHSIZE - 1; } - msgbuf = kzalloc(sizeof(*msgbuf), GFP_KERNEL); + msgbuf = kzalloc_obj(*msgbuf, GFP_KERNEL); if (!msgbuf) goto fail; @@ -1588,8 +1588,8 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr) msgbuf->flowrings = (struct brcmf_commonring **)if_msgbuf->flowrings; msgbuf->max_flowrings = if_msgbuf->max_flowrings; msgbuf->flowring_dma_handle = - kcalloc(msgbuf->max_flowrings, - sizeof(*msgbuf->flowring_dma_handle), GFP_KERNEL); + kzalloc_objs(*msgbuf->flowring_dma_handle, + msgbuf->max_flowrings, GFP_KERNEL); if (!msgbuf->flowring_dma_handle) goto fail; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c index 6327f4eca500..d15b98273cd3 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c @@ -1155,7 +1155,7 @@ brcmf_pcie_alloc_dma_and_ring(struct brcmf_pciedev_info *devinfo, u32 ring_id, addr = tcm_ring_phys_addr + BRCMF_RING_LEN_ITEMS_OFFSET; brcmf_pcie_write_tcm16(devinfo, addr, ring_itemsize_array[ring_id]); - ring = kzalloc(sizeof(*ring), GFP_KERNEL); + ring = kzalloc_obj(*ring, GFP_KERNEL); if (!ring) { dma_free_coherent(&devinfo->pdev->dev, size, dma_buf, dma_handle); @@ -1347,7 +1347,7 @@ static int brcmf_pcie_init_ringbuffers(struct brcmf_pciedev_info *devinfo) devinfo->shared.max_flowrings = max_flowrings; devinfo->shared.max_submissionrings = max_submissionrings; devinfo->shared.max_completionrings = max_completionrings; - rings = kcalloc(max_flowrings, sizeof(*ring), GFP_KERNEL); + rings = kzalloc_objs(*ring, max_flowrings, GFP_KERNEL); if (!rings) goto fail; @@ -2199,8 +2199,8 @@ static void brcmf_pcie_setup(struct device *dev, int ret, bus->msgbuf->commonrings[i] = &devinfo->shared.commonrings[i]->commonring; - flowrings = kcalloc(devinfo->shared.max_flowrings, sizeof(*flowrings), - GFP_KERNEL); + flowrings = kzalloc_objs(*flowrings, devinfo->shared.max_flowrings, + GFP_KERNEL); if (!flowrings) goto fail; @@ -2457,7 +2457,7 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) brcmf_dbg(PCIE, "Enter %x:%x\n", pdev->vendor, pdev->device); ret = -ENOMEM; - devinfo = kzalloc(sizeof(*devinfo), GFP_KERNEL); + devinfo = kzalloc_obj(*devinfo, GFP_KERNEL); if (devinfo == NULL) return ret; @@ -2477,7 +2477,7 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) else devinfo->reginfo = &brcmf_reginfo_default; - pcie_bus_dev = kzalloc(sizeof(*pcie_bus_dev), GFP_KERNEL); + pcie_bus_dev = kzalloc_obj(*pcie_bus_dev, GFP_KERNEL); if (pcie_bus_dev == NULL) { ret = -ENOMEM; goto fail; @@ -2495,12 +2495,12 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (ret < 0) goto fail; - bus = kzalloc(sizeof(*bus), GFP_KERNEL); + bus = kzalloc_obj(*bus, GFP_KERNEL); if (!bus) { ret = -ENOMEM; goto fail; } - bus->msgbuf = kzalloc(sizeof(*bus->msgbuf), GFP_KERNEL); + bus->msgbuf = kzalloc_obj(*bus->msgbuf, GFP_KERNEL); if (!bus->msgbuf) { ret = -ENOMEM; kfree(bus); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c index 05f66ab13bed..34179e69d77d 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c @@ -321,7 +321,7 @@ static int brcmf_pno_prep_fwconfig(struct brcmf_pno_info *pi, } *buckets = NULL; - fw_buckets = kcalloc(pi->n_reqs, sizeof(*fw_buckets), GFP_KERNEL); + fw_buckets = kzalloc_objs(*fw_buckets, pi->n_reqs, GFP_KERNEL); if (!fw_buckets) return -ENOMEM; @@ -517,7 +517,7 @@ int brcmf_pno_attach(struct brcmf_cfg80211_info *cfg) struct brcmf_pno_info *pi; brcmf_dbg(TRACE, "enter\n"); - pi = kzalloc(sizeof(*pi), GFP_KERNEL); + pi = kzalloc_obj(*pi, GFP_KERNEL); if (!pi) return -ENOMEM; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c index 2e911d4874af..7fc441859f52 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c @@ -23,7 +23,7 @@ int brcmf_proto_attach(struct brcmf_pub *drvr) brcmf_dbg(TRACE, "Enter\n"); - proto = kzalloc(sizeof(*proto), GFP_ATOMIC); + proto = kzalloc_obj(*proto, GFP_ATOMIC); if (!proto) goto fail; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 8cf9d7e7c3f7..30c19591c018 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -4455,7 +4455,7 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) brcmf_dbg(TRACE, "Enter\n"); /* Allocate private bus interface state */ - bus = kzalloc(sizeof(*bus), GFP_ATOMIC); + bus = kzalloc_obj(*bus, GFP_ATOMIC); if (!bus) { ret = -ENOMEM; goto fail; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c index f0129d10d2b9..0b52f968b907 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c @@ -428,7 +428,7 @@ brcmf_usbdev_qinit(struct list_head *q, int qsize) int i; struct brcmf_usbreq *req, *reqs; - reqs = kcalloc(qsize, sizeof(struct brcmf_usbreq), GFP_ATOMIC); + reqs = kzalloc_objs(struct brcmf_usbreq, qsize, GFP_ATOMIC); if (reqs == NULL) return NULL; @@ -1255,7 +1255,7 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo, if (!bus_pub) return -ENODEV; - bus = kzalloc(sizeof(*bus), GFP_ATOMIC); + bus = kzalloc_obj(*bus, GFP_ATOMIC); if (!bus) { ret = -ENOMEM; goto fail; @@ -1359,7 +1359,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) brcmf_dbg(USB, "Enter 0x%04x:0x%04x\n", id->idVendor, id->idProduct); - devinfo = kzalloc(sizeof(*devinfo), GFP_ATOMIC); + devinfo = kzalloc_obj(*devinfo, GFP_ATOMIC); if (devinfo == NULL) return -ENOMEM; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/core.c index 05d7c2a4fba5..9a8351537938 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/core.c @@ -24,8 +24,7 @@ static int brcmf_wcc_alloc_fweh_info(struct brcmf_pub *drvr) { struct brcmf_fweh_info *fweh; - fweh = kzalloc(struct_size(fweh, evt_handler, BRCMF_WCC_E_LAST), - GFP_KERNEL); + fweh = kzalloc_flex(*fweh, evt_handler, BRCMF_WCC_E_LAST, GFP_KERNEL); if (!fweh) return -ENOMEM; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/aiutils.c index 0cb64fc56783..6a67db07833e 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/aiutils.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/aiutils.c @@ -512,7 +512,7 @@ ai_attach(struct bcma_bus *pbus) struct si_info *sii; /* alloc struct si_info */ - sii = kzalloc(sizeof(*sii), GFP_ATOMIC); + sii = kzalloc_obj(*sii, GFP_ATOMIC); if (sii == NULL) return NULL; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/ampdu.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/ampdu.c index e1d707a7c964..fc7a5dd2e5d8 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/ampdu.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/ampdu.c @@ -219,7 +219,7 @@ struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc) struct ampdu_info *ampdu; int i; - ampdu = kzalloc(sizeof(*ampdu), GFP_ATOMIC); + ampdu = kzalloc_obj(*ampdu, GFP_ATOMIC); if (!ampdu) return NULL; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/antsel.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/antsel.c index f411bc6d795d..9a3e40528ff7 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/antsel.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/antsel.c @@ -111,7 +111,7 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc) struct antsel_info *asi; struct ssb_sprom *sprom = &wlc->hw->d11core->bus->sprom; - asi = kzalloc(sizeof(*asi), GFP_ATOMIC); + asi = kzalloc_obj(*asi, GFP_ATOMIC); if (!asi) return NULL; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/channel.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/channel.c index 3878c4124e25..cdfe8635c012 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/channel.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/channel.c @@ -331,7 +331,7 @@ struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc) const char *ccode = sprom->alpha2; int ccode_len = sizeof(sprom->alpha2); - wlc_cm = kzalloc(sizeof(*wlc_cm), GFP_ATOMIC); + wlc_cm = kzalloc_obj(*wlc_cm, GFP_ATOMIC); if (wlc_cm == NULL) return NULL; wlc_cm->pub = pub; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c index c739bf7463b3..9f6ef7ce1b58 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c @@ -558,7 +558,7 @@ struct dma_pub *dma_attach(char *name, struct brcms_c_info *wlc, struct si_info *sii = container_of(sih, struct si_info, pub); /* allocate private info structure */ - di = kzalloc(sizeof(*di), GFP_ATOMIC); + di = kzalloc_obj(*di, GFP_ATOMIC); if (di == NULL) return NULL; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c index aadcff1e2b5d..6255d673d2d3 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c @@ -1499,7 +1499,7 @@ struct brcms_timer *brcms_init_timer(struct brcms_info *wl, { struct brcms_timer *t; - t = kzalloc(sizeof(*t), GFP_ATOMIC); + t = kzalloc_obj(*t, GFP_ATOMIC); if (!t) return NULL; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c index c1a9c1e442ee..c7eaf160e1fa 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c @@ -457,11 +457,11 @@ static struct brcms_bss_cfg *brcms_c_bsscfg_malloc(uint unit) { struct brcms_bss_cfg *cfg; - cfg = kzalloc(sizeof(*cfg), GFP_ATOMIC); + cfg = kzalloc_obj(*cfg, GFP_ATOMIC); if (cfg == NULL) goto fail; - cfg->current_bss = kzalloc(sizeof(*cfg->current_bss), GFP_ATOMIC); + cfg->current_bss = kzalloc_obj(*cfg->current_bss, GFP_ATOMIC); if (cfg->current_bss == NULL) goto fail; @@ -477,14 +477,14 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid) { struct brcms_c_info *wlc; - wlc = kzalloc(sizeof(*wlc), GFP_ATOMIC); + wlc = kzalloc_obj(*wlc, GFP_ATOMIC); if (wlc == NULL) { *err = 1002; goto fail; } /* allocate struct brcms_c_pub state structure */ - wlc->pub = kzalloc(sizeof(*wlc->pub), GFP_ATOMIC); + wlc->pub = kzalloc_obj(*wlc->pub, GFP_ATOMIC); if (wlc->pub == NULL) { *err = 1003; goto fail; @@ -493,7 +493,7 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid) /* allocate struct brcms_hardware state structure */ - wlc->hw = kzalloc(sizeof(*wlc->hw), GFP_ATOMIC); + wlc->hw = kzalloc_obj(*wlc->hw, GFP_ATOMIC); if (wlc->hw == NULL) { *err = 1005; goto fail; @@ -501,7 +501,7 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid) wlc->hw->wlc = wlc; wlc->hw->bandstate[0] = - kcalloc(MAXBANDS, sizeof(struct brcms_hw_band), GFP_ATOMIC); + kzalloc_objs(struct brcms_hw_band, MAXBANDS, GFP_ATOMIC); if (wlc->hw->bandstate[0] == NULL) { *err = 1006; goto fail; @@ -515,14 +515,13 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid) } wlc->modulecb = - kcalloc(BRCMS_MAXMODULES, sizeof(struct modulecb), - GFP_ATOMIC); + kzalloc_objs(struct modulecb, BRCMS_MAXMODULES, GFP_ATOMIC); if (wlc->modulecb == NULL) { *err = 1009; goto fail; } - wlc->default_bss = kzalloc(sizeof(*wlc->default_bss), GFP_ATOMIC); + wlc->default_bss = kzalloc_obj(*wlc->default_bss, GFP_ATOMIC); if (wlc->default_bss == NULL) { *err = 1010; goto fail; @@ -534,20 +533,20 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid) goto fail; } - wlc->protection = kzalloc(sizeof(*wlc->protection), GFP_ATOMIC); + wlc->protection = kzalloc_obj(*wlc->protection, GFP_ATOMIC); if (wlc->protection == NULL) { *err = 1016; goto fail; } - wlc->stf = kzalloc(sizeof(*wlc->stf), GFP_ATOMIC); + wlc->stf = kzalloc_obj(*wlc->stf, GFP_ATOMIC); if (wlc->stf == NULL) { *err = 1017; goto fail; } wlc->bandstate[0] = - kcalloc(MAXBANDS, sizeof(*wlc->bandstate[0]), GFP_ATOMIC); + kzalloc_objs(*wlc->bandstate[0], MAXBANDS, GFP_ATOMIC); if (wlc->bandstate[0] == NULL) { *err = 1025; goto fail; @@ -560,14 +559,14 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid) + (sizeof(struct brcms_band)*i)); } - wlc->corestate = kzalloc(sizeof(*wlc->corestate), GFP_ATOMIC); + wlc->corestate = kzalloc_obj(*wlc->corestate, GFP_ATOMIC); if (wlc->corestate == NULL) { *err = 1026; goto fail; } - wlc->corestate->macstat_snapshot = - kzalloc(sizeof(*wlc->corestate->macstat_snapshot), GFP_ATOMIC); + wlc->corestate->macstat_snapshot = kzalloc_obj(*wlc->corestate->macstat_snapshot, + GFP_ATOMIC); if (wlc->corestate->macstat_snapshot == NULL) { *err = 1027; goto fail; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c index ce6ce2dea39c..7eae73ef7e94 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c @@ -333,7 +333,7 @@ struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp) { struct shared_phy *sh; - sh = kzalloc(sizeof(*sh), GFP_ATOMIC); + sh = kzalloc_obj(*sh, GFP_ATOMIC); if (sh == NULL) return NULL; @@ -420,7 +420,7 @@ wlc_phy_attach(struct shared_phy *sh, struct bcma_device *d11core, return &pi->pubpi_ro; } - pi = kzalloc(sizeof(*pi), GFP_ATOMIC); + pi = kzalloc_obj(*pi, GFP_ATOMIC); if (pi == NULL) return NULL; pi->wiphy = wiphy; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c index 5258681218ea..8cec5ad79fda 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c @@ -1319,7 +1319,7 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, s16 *ptr; struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - ptr = kmalloc_array(131, sizeof(s16), GFP_ATOMIC); + ptr = kmalloc_objs(s16, 131, GFP_ATOMIC); if (NULL == ptr) return false; if (module == 2) { @@ -3605,7 +3605,7 @@ wlc_lcnphy_a1(struct brcms_phy *pi, int cal_type, int num_levels, u16 *phy_c32; phy_c21 = 0; phy_c10 = phy_c13 = phy_c14 = phy_c8 = 0; - ptr = kmalloc_array(131, sizeof(s16), GFP_ATOMIC); + ptr = kmalloc_objs(s16, 131, GFP_ATOMIC); if (NULL == ptr) return; @@ -4966,7 +4966,7 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi) { struct brcms_phy_lcnphy *pi_lcn; - pi_lcn = kzalloc(sizeof(*pi_lcn), GFP_ATOMIC); + pi_lcn = kzalloc_obj(*pi_lcn, GFP_ATOMIC); if (!pi_lcn) return false; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c index b03d5a1f1a93..86cfa3e87a04 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c @@ -23049,8 +23049,7 @@ wlc_phy_gen_load_samples_nphy(struct brcms_phy *pi, u32 f_kHz, u16 max_val, tbl_len = (phy_bw << 1); } - tone_buf = kmalloc_array(tbl_len, sizeof(struct cordic_iq), - GFP_ATOMIC); + tone_buf = kmalloc_objs(struct cordic_iq, tbl_len, GFP_ATOMIC); if (tone_buf == NULL) return 0; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c index 8b852581c4e4..20cf6379e838 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c @@ -40,7 +40,7 @@ struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw, struct brcms_c_info *wlc) { struct phy_shim_info *physhim; - physhim = kzalloc(sizeof(*physhim), GFP_ATOMIC); + physhim = kzalloc_obj(*physhim, GFP_ATOMIC); if (!physhim) return NULL; diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2100.c b/drivers/net/wireless/intel/ipw2x00/ipw2100.c index c7c5bc0f1650..029459df3343 100644 --- a/drivers/net/wireless/intel/ipw2x00/ipw2100.c +++ b/drivers/net/wireless/intel/ipw2x00/ipw2100.c @@ -1885,9 +1885,8 @@ static int ipw2100_wdev_init(struct net_device *dev) bg_band->band = NL80211_BAND_2GHZ; bg_band->n_channels = geo->bg_channels; - bg_band->channels = kcalloc(geo->bg_channels, - sizeof(struct ieee80211_channel), - GFP_KERNEL); + bg_band->channels = kzalloc_objs(struct ieee80211_channel, + geo->bg_channels, GFP_KERNEL); if (!bg_band->channels) { ipw2100_down(priv); return -ENOMEM; @@ -3413,9 +3412,8 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv) dma_addr_t p; priv->msg_buffers = - kmalloc_array(IPW_COMMAND_POOL_SIZE, - sizeof(struct ipw2100_tx_packet), - GFP_KERNEL); + kmalloc_objs(struct ipw2100_tx_packet, IPW_COMMAND_POOL_SIZE, + GFP_KERNEL); if (!priv->msg_buffers) return -ENOMEM; @@ -4410,9 +4408,8 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv) return err; } - priv->tx_buffers = kmalloc_array(TX_PENDED_QUEUE_LENGTH, - sizeof(struct ipw2100_tx_packet), - GFP_KERNEL); + priv->tx_buffers = kmalloc_objs(struct ipw2100_tx_packet, + TX_PENDED_QUEUE_LENGTH, GFP_KERNEL); if (!priv->tx_buffers) { bd_queue_free(priv, &priv->tx_queue); return -ENOMEM; @@ -4555,9 +4552,8 @@ static int ipw2100_rx_allocate(struct ipw2100_priv *priv) /* * allocate packets */ - priv->rx_buffers = kmalloc_array(RX_QUEUE_LENGTH, - sizeof(struct ipw2100_rx_packet), - GFP_KERNEL); + priv->rx_buffers = kmalloc_objs(struct ipw2100_rx_packet, + RX_QUEUE_LENGTH, GFP_KERNEL); if (!priv->rx_buffers) { IPW_DEBUG_INFO("can't allocate rx packet buffer table\n"); diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c index b0e769da9415..a39985e4a977 100644 --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c @@ -3153,8 +3153,7 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len) if (!virts) return -ENOMEM; - phys = kmalloc_array(CB_NUMBER_OF_ELEMENTS_SMALL, sizeof(dma_addr_t), - GFP_KERNEL); + phys = kmalloc_objs(dma_addr_t, CB_NUMBER_OF_ELEMENTS_SMALL, GFP_KERNEL); if (!phys) { kfree(virts); return -ENOMEM; @@ -3723,7 +3722,7 @@ static int ipw_queue_tx_init(struct ipw_priv *priv, { struct pci_dev *dev = priv->pci_dev; - q->txb = kmalloc_array(count, sizeof(q->txb[0]), GFP_KERNEL); + q->txb = kmalloc_objs(q->txb[0], count, GFP_KERNEL); if (!q->txb) return -ENOMEM; @@ -5201,7 +5200,7 @@ static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *priv) struct ipw_rx_queue *rxq; int i; - rxq = kzalloc(sizeof(*rxq), GFP_KERNEL); + rxq = kzalloc_obj(*rxq, GFP_KERNEL); if (unlikely(!rxq)) { IPW_ERROR("memory allocation failed\n"); return NULL; @@ -8103,7 +8102,7 @@ static int is_duplicate_packet(struct ipw_priv *priv, break; } if (p == &priv->ibss_mac_hash[index]) { - entry = kmalloc(sizeof(*entry), GFP_ATOMIC); + entry = kmalloc_obj(*entry, GFP_ATOMIC); if (!entry) { IPW_ERROR ("Cannot malloc new mac entry\n"); @@ -11119,8 +11118,7 @@ static int ipw_up(struct ipw_priv *priv) return -EIO; if (cmdlog && !priv->cmdlog) { - priv->cmdlog = kcalloc(cmdlog, sizeof(*priv->cmdlog), - GFP_KERNEL); + priv->cmdlog = kzalloc_objs(*priv->cmdlog, cmdlog, GFP_KERNEL); if (priv->cmdlog == NULL) { IPW_ERROR("Error allocating %d command log entries.\n", cmdlog); @@ -11279,9 +11277,8 @@ static int ipw_wdev_init(struct net_device *dev) bg_band->band = NL80211_BAND_2GHZ; bg_band->n_channels = geo->bg_channels; - bg_band->channels = kcalloc(geo->bg_channels, - sizeof(struct ieee80211_channel), - GFP_KERNEL); + bg_band->channels = kzalloc_objs(struct ieee80211_channel, + geo->bg_channels, GFP_KERNEL); if (!bg_band->channels) { rc = -ENOMEM; goto out; @@ -11318,9 +11315,8 @@ static int ipw_wdev_init(struct net_device *dev) a_band->band = NL80211_BAND_5GHZ; a_band->n_channels = geo->a_channels; - a_band->channels = kcalloc(geo->a_channels, - sizeof(struct ieee80211_channel), - GFP_KERNEL); + a_band->channels = kzalloc_objs(struct ieee80211_channel, + geo->a_channels, GFP_KERNEL); if (!a_band->channels) { rc = -ENOMEM; goto out; diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_crypto.c b/drivers/net/wireless/intel/ipw2x00/libipw_crypto.c index 243d0c5928a2..e39b95f68dd4 100644 --- a/drivers/net/wireless/intel/ipw2x00/libipw_crypto.c +++ b/drivers/net/wireless/intel/ipw2x00/libipw_crypto.c @@ -159,7 +159,7 @@ int libipw_register_crypto_ops(const struct libipw_crypto_ops *ops) unsigned long flags; struct libipw_crypto_alg *alg; - alg = kzalloc(sizeof(*alg), GFP_KERNEL); + alg = kzalloc_obj(*alg, GFP_KERNEL); if (alg == NULL) return -ENOMEM; diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_crypto_ccmp.c b/drivers/net/wireless/intel/ipw2x00/libipw_crypto_ccmp.c index bf900d8c8ad3..631a4dd86cab 100644 --- a/drivers/net/wireless/intel/ipw2x00/libipw_crypto_ccmp.c +++ b/drivers/net/wireless/intel/ipw2x00/libipw_crypto_ccmp.c @@ -53,7 +53,7 @@ static void *libipw_ccmp_init(int key_idx) { struct libipw_ccmp_data *priv; - priv = kzalloc(sizeof(*priv), GFP_ATOMIC); + priv = kzalloc_obj(*priv, GFP_ATOMIC); if (priv == NULL) goto fail; priv->key_idx = key_idx; diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_crypto_tkip.c b/drivers/net/wireless/intel/ipw2x00/libipw_crypto_tkip.c index 32288697da4f..c6b0de8d91ae 100644 --- a/drivers/net/wireless/intel/ipw2x00/libipw_crypto_tkip.c +++ b/drivers/net/wireless/intel/ipw2x00/libipw_crypto_tkip.c @@ -87,7 +87,7 @@ static void *libipw_tkip_init(int key_idx) if (fips_enabled) return NULL; - priv = kzalloc(sizeof(*priv), GFP_ATOMIC); + priv = kzalloc_obj(*priv, GFP_ATOMIC); if (priv == NULL) goto fail; diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_crypto_wep.c b/drivers/net/wireless/intel/ipw2x00/libipw_crypto_wep.c index c3a4ccb9de17..96109e123a1a 100644 --- a/drivers/net/wireless/intel/ipw2x00/libipw_crypto_wep.c +++ b/drivers/net/wireless/intel/ipw2x00/libipw_crypto_wep.c @@ -37,7 +37,7 @@ static void *libipw_wep_init(int keyidx) if (fips_enabled) return NULL; - priv = kzalloc(sizeof(*priv), GFP_ATOMIC); + priv = kzalloc_obj(*priv, GFP_ATOMIC); if (priv == NULL) return NULL; priv->key_idx = keyidx; diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_module.c b/drivers/net/wireless/intel/ipw2x00/libipw_module.c index 2ad085b1f492..cc771ee9bac3 100644 --- a/drivers/net/wireless/intel/ipw2x00/libipw_module.c +++ b/drivers/net/wireless/intel/ipw2x00/libipw_module.c @@ -57,8 +57,8 @@ static int libipw_networks_allocate(struct libipw_device *ieee) int i, j; for (i = 0; i < MAX_NETWORK_COUNT; i++) { - ieee->networks[i] = kzalloc(sizeof(struct libipw_network), - GFP_KERNEL); + ieee->networks[i] = kzalloc_obj(struct libipw_network, + GFP_KERNEL); if (!ieee->networks[i]) { LIBIPW_ERROR("Out of memory allocating beacons\n"); for (j = 0; j < i; j++) diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_tx.c b/drivers/net/wireless/intel/ipw2x00/libipw_tx.c index 80edaa3dea9c..6e16060834b8 100644 --- a/drivers/net/wireless/intel/ipw2x00/libipw_tx.c +++ b/drivers/net/wireless/intel/ipw2x00/libipw_tx.c @@ -180,7 +180,7 @@ static struct libipw_txb *libipw_alloc_txb(int nr_frags, int txb_size, struct libipw_txb *txb; int i; - txb = kzalloc(struct_size(txb, fragments, nr_frags), gfp_mask); + txb = kzalloc_flex(*txb, fragments, nr_frags, gfp_mask); if (!txb) return NULL; diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_wx.c b/drivers/net/wireless/intel/ipw2x00/libipw_wx.c index db71d81b0d4f..3db31b740a0e 100644 --- a/drivers/net/wireless/intel/ipw2x00/libipw_wx.c +++ b/drivers/net/wireless/intel/ipw2x00/libipw_wx.c @@ -365,8 +365,7 @@ int libipw_wx_set_encode(struct libipw_device *ieee, struct libipw_crypt_data *new_crypt; /* take WEP into use */ - new_crypt = kzalloc(sizeof(struct libipw_crypt_data), - GFP_KERNEL); + new_crypt = kzalloc_obj(struct libipw_crypt_data, GFP_KERNEL); if (new_crypt == NULL) return -ENOMEM; new_crypt->ops = libipw_get_crypto_ops("WEP"); @@ -598,7 +597,7 @@ int libipw_wx_set_encodeext(struct libipw_device *ieee, libipw_crypt_delayed_deinit(&ieee->crypt_info, crypt); - new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); + new_crypt = kzalloc_obj(*new_crypt, GFP_KERNEL); if (new_crypt == NULL) { ret = -ENOMEM; goto done; diff --git a/drivers/net/wireless/intel/iwlegacy/3945-mac.c b/drivers/net/wireless/intel/iwlegacy/3945-mac.c index 54991f31c52c..c87579e4c7f9 100644 --- a/drivers/net/wireless/intel/iwlegacy/3945-mac.c +++ b/drivers/net/wireless/intel/iwlegacy/3945-mac.c @@ -269,7 +269,7 @@ il3945_get_free_frame(struct il_priv *il) struct il3945_frame *frame; struct list_head *element; if (list_empty(&il->free_frames)) { - frame = kzalloc(sizeof(*frame), GFP_KERNEL); + frame = kzalloc_obj(*frame, GFP_KERNEL); if (!frame) { IL_ERR("Could not allocate frame!\n"); return NULL; diff --git a/drivers/net/wireless/intel/iwlegacy/4965-mac.c b/drivers/net/wireless/intel/iwlegacy/4965-mac.c index 57fa866efd9f..8429b6f5768b 100644 --- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c @@ -3027,7 +3027,7 @@ il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id) u32 rate_flags = 0; __le32 rate_n_flags; - link_cmd = kzalloc(sizeof(struct il_link_quality_cmd), GFP_KERNEL); + link_cmd = kzalloc_obj(struct il_link_quality_cmd, GFP_KERNEL); if (!link_cmd) { IL_ERR("Unable to allocate memory for LQ cmd.\n"); return NULL; @@ -3709,7 +3709,7 @@ il4965_get_free_frame(struct il_priv *il) struct il_frame *frame; struct list_head *element; if (list_empty(&il->free_frames)) { - frame = kzalloc(sizeof(*frame), GFP_KERNEL); + frame = kzalloc_obj(*frame, GFP_KERNEL); if (!frame) { IL_ERR("Could not allocate frame!\n"); return NULL; diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c index b7bd3ec4cc50..4a12703e9b46 100644 --- a/drivers/net/wireless/intel/iwlegacy/common.c +++ b/drivers/net/wireless/intel/iwlegacy/common.c @@ -907,8 +907,7 @@ il_init_channel_map(struct il_priv *il) D_EEPROM("Parsing data for %d channels.\n", il->channel_count); il->channel_info = - kcalloc(il->channel_count, sizeof(struct il_channel_info), - GFP_KERNEL); + kzalloc_objs(struct il_channel_info, il->channel_count, GFP_KERNEL); if (!il->channel_info) { IL_ERR("Could not allocate channel_info\n"); il->channel_count = 0; @@ -2969,9 +2968,8 @@ il_tx_queue_alloc(struct il_priv *il, struct il_tx_queue *txq, u32 id) /* Driver ilate data, only for Tx (not command) queues, * not shared with device. */ if (id != il->cmd_queue) { - txq->skbs = kcalloc(TFD_QUEUE_SIZE_MAX, - sizeof(struct sk_buff *), - GFP_KERNEL); + txq->skbs = kzalloc_objs(struct sk_buff *, TFD_QUEUE_SIZE_MAX, + GFP_KERNEL); if (!txq->skbs) { IL_ERR("Fail to alloc skbs\n"); goto error; @@ -3024,9 +3022,9 @@ il_tx_queue_init(struct il_priv *il, u32 txq_id) } txq->meta = - kcalloc(actual_slots, sizeof(struct il_cmd_meta), GFP_KERNEL); + kzalloc_objs(struct il_cmd_meta, actual_slots, GFP_KERNEL); txq->cmd = - kcalloc(actual_slots, sizeof(struct il_device_cmd *), GFP_KERNEL); + kzalloc_objs(struct il_device_cmd *, actual_slots, GFP_KERNEL); if (!txq->meta || !txq->cmd) goto out_free_arrays; @@ -3444,12 +3442,12 @@ il_init_geos(struct il_priv *il) } channels = - kcalloc(il->channel_count, sizeof(struct ieee80211_channel), - GFP_KERNEL); + kzalloc_objs(struct ieee80211_channel, il->channel_count, + GFP_KERNEL); if (!channels) return -ENOMEM; - rates = kcalloc(RATE_COUNT_LEGACY, sizeof(*rates), GFP_KERNEL); + rates = kzalloc_objs(*rates, RATE_COUNT_LEGACY, GFP_KERNEL); if (!rates) { kfree(channels); return -ENOMEM; @@ -4611,9 +4609,8 @@ il_alloc_txq_mem(struct il_priv *il) { if (!il->txq) il->txq = - kcalloc(il->cfg->num_of_queues, - sizeof(struct il_tx_queue), - GFP_KERNEL); + kzalloc_objs(struct il_tx_queue, il->cfg->num_of_queues, + GFP_KERNEL); if (!il->txq) { IL_ERR("Not enough memory for txq\n"); return -ENOMEM; diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/calib.c b/drivers/net/wireless/intel/iwlwifi/dvm/calib.c index f488620d2844..94c5d40cdf41 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/calib.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/calib.c @@ -63,7 +63,7 @@ int iwl_calib_set(struct iwl_priv *priv, if (check_sub_overflow(len, sizeof(*cmd), &len)) return -ENOMEM; - res = kmalloc(struct_size(res, cmd.data, len), GFP_ATOMIC); + res = kmalloc_flex(*res, cmd.data, len, GFP_ATOMIC); if (!res) return -ENOMEM; res->cmd = *cmd; diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/devices.c b/drivers/net/wireless/intel/iwlwifi/dvm/devices.c index be7e61e2b291..5c8665b5a1b7 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/devices.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/devices.c @@ -567,7 +567,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, }; int err; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) return -ENOMEM; diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/eeprom.c b/drivers/net/wireless/intel/iwlwifi/dvm/eeprom.c index d337ab543eb0..f723884e2a62 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/eeprom.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/eeprom.c @@ -1067,8 +1067,7 @@ iwl_parse_eeprom_data(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg, if (WARN_ON(!cfg || !cfg->eeprom_params)) return NULL; - data = kzalloc(struct_size(data, channels, IWL_NUM_CHANNELS), - GFP_KERNEL); + data = kzalloc_flex(*data, channels, IWL_NUM_CHANNELS, GFP_KERNEL); if (!data) return NULL; diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/lib.c b/drivers/net/wireless/intel/iwlwifi/dvm/lib.c index 48711dbcfa5a..bc14ed3060dd 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/lib.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/lib.c @@ -1056,7 +1056,7 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan) int ret, i; u16 seq; - key_data.rsc_tsc = kzalloc(sizeof(*key_data.rsc_tsc), GFP_KERNEL); + key_data.rsc_tsc = kzalloc_obj(*key_data.rsc_tsc, GFP_KERNEL); if (!key_data.rsc_tsc) return -ENOMEM; diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/main.c b/drivers/net/wireless/intel/iwlwifi/dvm/main.c index 2b4dbebc71c2..ec30b5f3870b 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/main.c @@ -205,7 +205,7 @@ int iwlagn_send_beacon_cmd(struct iwl_priv *priv) /* Allocate beacon command */ if (!priv->beacon_cmd) - priv->beacon_cmd = kzalloc(sizeof(*tx_beacon_cmd), GFP_KERNEL); + priv->beacon_cmd = kzalloc_obj(*tx_beacon_cmd, GFP_KERNEL); tx_beacon_cmd = priv->beacon_cmd; if (!tx_beacon_cmd) return -ENOMEM; diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rx.c b/drivers/net/wireless/intel/iwlwifi/dvm/rx.c index b34ee68f3dce..088302a238de 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/rx.c @@ -915,7 +915,7 @@ static void iwlagn_rx_noa_notification(struct iwl_priv *priv, len += 1 + 2; copylen += 1 + 2; - new_data = kmalloc(struct_size(new_data, data, len), GFP_ATOMIC); + new_data = kmalloc_flex(*new_data, data, len, GFP_ATOMIC); if (new_data) { new_data->length = len; new_data->data[0] = WLAN_EID_VENDOR_SPECIFIC; diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/sta.c b/drivers/net/wireless/intel/iwlwifi/dvm/sta.c index 8b01ab986cb1..b29859f9d7c0 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/sta.c @@ -864,7 +864,7 @@ iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, { struct iwl_link_quality_cmd *link_cmd; - link_cmd = kzalloc(sizeof(struct iwl_link_quality_cmd), GFP_KERNEL); + link_cmd = kzalloc_obj(struct iwl_link_quality_cmd, GFP_KERNEL); if (!link_cmd) { IWL_ERR(priv, "Unable to allocate memory for LQ cmd.\n"); return NULL; diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/tt.c b/drivers/net/wireless/intel/iwlwifi/dvm/tt.c index 96831ce8da6f..9bfdf033463b 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/tt.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/tt.c @@ -595,13 +595,11 @@ void iwl_tt_initialize(struct iwl_priv *priv) if (priv->lib->adv_thermal_throttle) { IWL_DEBUG_TEMP(priv, "Advanced Thermal Throttling\n"); - tt->restriction = kcalloc(IWL_TI_STATE_MAX, - sizeof(struct iwl_tt_restriction), - GFP_KERNEL); - tt->transaction = kcalloc(IWL_TI_STATE_MAX * - (IWL_TI_STATE_MAX - 1), - sizeof(struct iwl_tt_trans), - GFP_KERNEL); + tt->restriction = kzalloc_objs(struct iwl_tt_restriction, + IWL_TI_STATE_MAX, GFP_KERNEL); + tt->transaction = kzalloc_objs(struct iwl_tt_trans, + IWL_TI_STATE_MAX * (IWL_TI_STATE_MAX - 1), + GFP_KERNEL); if (!tt->restriction || !tt->transaction) { IWL_ERR(priv, "Fallback to Legacy Throttling\n"); priv->thermal_throttle.advanced_tt = false; diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c index 2ce55859641c..a070593e085f 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c @@ -595,7 +595,7 @@ static struct scatterlist *alloc_sgtable(ssize_t size) nents -= n_fill; } - new = kcalloc(n_alloc, sizeof(*new), GFP_KERNEL); + new = kzalloc_objs(*new, n_alloc, GFP_KERNEL); if (!new) { if (result) _devcd_free_sgtable(result); @@ -2958,8 +2958,8 @@ int iwl_fw_dbg_error_collect(struct iwl_fw_runtime *fwrt, struct iwl_fw_dump_desc *iwl_dump_error_desc; int ret; - iwl_dump_error_desc = - kmalloc(sizeof(*iwl_dump_error_desc), GFP_KERNEL); + iwl_dump_error_desc = kmalloc_obj(*iwl_dump_error_desc, + GFP_KERNEL); if (!iwl_dump_error_desc) return -ENOMEM; @@ -3011,7 +3011,7 @@ int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt, delay = le32_to_cpu(trigger->stop_delay) * USEC_PER_MSEC; } - desc = kzalloc(struct_size(desc, trig_desc.data, len), GFP_ATOMIC); + desc = kzalloc_flex(*desc, trig_desc.data, len, GFP_ATOMIC); if (!desc) return -ENOMEM; diff --git a/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c b/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c index 3c4bee85b825..21d889344796 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c @@ -360,7 +360,7 @@ static void *iwl_dbgfs_fw_info_seq_start(struct seq_file *seq, loff_t *pos) if (*pos >= fw->ucode_capa.n_cmd_versions) return NULL; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) return NULL; state->pos = *pos; diff --git a/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c b/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c index f297e82d63d2..a45c3a9c223e 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c @@ -379,7 +379,7 @@ iwl_pnvm_load_pnvm_to_trans(struct iwl_trans *trans, return; } - pnvm_data = kzalloc(sizeof(*pnvm_data), GFP_KERNEL); + pnvm_data = kzalloc_obj(*pnvm_data, GFP_KERNEL); if (!pnvm_data) goto free; @@ -425,7 +425,7 @@ iwl_pnvm_load_reduce_power_to_trans(struct iwl_trans *trans, return; } - pnvm_data = kzalloc(sizeof(*pnvm_data), GFP_KERNEL); + pnvm_data = kzalloc_obj(*pnvm_data, GFP_KERNEL); if (!pnvm_data) goto free; diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c index 5240dacf1360..a6733224428a 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c @@ -71,7 +71,7 @@ static struct iwl_ucode_tlv *iwl_dbg_tlv_add(const struct iwl_ucode_tlv *tlv, u32 len = le32_to_cpu(tlv->length); struct iwl_dbg_tlv_node *node; - node = kzalloc(struct_size(node, tlv.data, len), GFP_KERNEL); + node = kzalloc_flex(*node, tlv.data, len, GFP_KERNEL); if (!node) return NULL; @@ -618,7 +618,7 @@ static int iwl_dbg_tlv_alloc_fragments(struct iwl_fw_runtime *fwrt, num_frags = min_t(u32, num_frags, remain_pages); frag_pages = DIV_ROUND_UP(remain_pages, num_frags); - fw_mon->frags = kcalloc(num_frags, sizeof(*fw_mon->frags), GFP_KERNEL); + fw_mon->frags = kzalloc_objs(*fw_mon->frags, num_frags, GFP_KERNEL); if (!fw_mon->frags) return -ENOMEM; @@ -1001,7 +1001,7 @@ static void iwl_dbg_tlv_set_periodic_trigs(struct iwl_fw_runtime *fwrt) collect_interval = le32_to_cpu(trig->data[0]); - timer_node = kzalloc(sizeof(*timer_node), GFP_KERNEL); + timer_node = kzalloc_obj(*timer_node, GFP_KERNEL); if (!timer_node) { IWL_ERR(fwrt, "WRT: Failed to allocate periodic trigger\n"); diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c index f8fc6f30fbe5..39e362df0233 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -1459,7 +1459,7 @@ static int iwl_alloc_ucode_mem(struct fw_img *out, struct fw_img_parsing *img) { struct fw_desc *sec; - sec = kcalloc(img->sec_counter, sizeof(*sec), GFP_KERNEL); + sec = kzalloc_objs(*sec, img->sec_counter, GFP_KERNEL); if (!sec) return -ENOMEM; @@ -1622,7 +1622,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) /* dump all fw memory areas by default */ fw->dbg.dump_mask = 0xffffffff; - pieces = kzalloc(sizeof(*pieces), GFP_KERNEL); + pieces = kzalloc_obj(*pieces, GFP_KERNEL); if (!pieces) goto out_free_fw; @@ -1915,7 +1915,7 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans) struct iwl_drv *drv; int ret; - drv = kzalloc(sizeof(*drv), GFP_KERNEL); + drv = kzalloc_obj(*drv, GFP_KERNEL); if (!drv) { ret = -ENOMEM; goto err; diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c index e021fc57d85d..75d1db91314b 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c @@ -1377,13 +1377,11 @@ iwl_parse_mei_nvm_data(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg, u8 tx_chains = fw->valid_rx_ant; if (cfg->uhb_supported) - data = kzalloc(struct_size(data, channels, - IWL_NVM_NUM_CHANNELS_UHB), - GFP_KERNEL); + data = kzalloc_flex(*data, channels, IWL_NVM_NUM_CHANNELS_UHB, + GFP_KERNEL); else - data = kzalloc(struct_size(data, channels, - IWL_NVM_NUM_CHANNELS_EXT), - GFP_KERNEL); + data = kzalloc_flex(*data, channels, IWL_NVM_NUM_CHANNELS_EXT, + GFP_KERNEL); if (!data) return NULL; @@ -1446,17 +1444,14 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg, const __le16 *ch_section; if (cfg->uhb_supported) - data = kzalloc(struct_size(data, channels, - IWL_NVM_NUM_CHANNELS_UHB), - GFP_KERNEL); + data = kzalloc_flex(*data, channels, IWL_NVM_NUM_CHANNELS_UHB, + GFP_KERNEL); else if (cfg->nvm_type != IWL_NVM_EXT) - data = kzalloc(struct_size(data, channels, - IWL_NVM_NUM_CHANNELS), - GFP_KERNEL); + data = kzalloc_flex(*data, channels, IWL_NVM_NUM_CHANNELS, + GFP_KERNEL); else - data = kzalloc(struct_size(data, channels, - IWL_NVM_NUM_CHANNELS_EXT), - GFP_KERNEL); + data = kzalloc_flex(*data, channels, IWL_NVM_NUM_CHANNELS_EXT, + GFP_KERNEL); if (!data) return NULL; @@ -1692,7 +1687,7 @@ iwl_parse_nvm_mcc_info(struct iwl_trans *trans, num_of_ch); /* build a regdomain rule for every valid channel */ - regd = kzalloc(struct_size(regd, reg_rules, num_of_ch), GFP_KERNEL); + regd = kzalloc_flex(*regd, reg_rules, num_of_ch, GFP_KERNEL); if (!regd) return ERR_PTR(-ENOMEM); @@ -2041,7 +2036,7 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans, if (empty_otp) IWL_INFO(trans, "OTP is empty\n"); - nvm = kzalloc(struct_size(nvm, channels, IWL_NUM_CHANNELS), GFP_KERNEL); + nvm = kzalloc_flex(*nvm, channels, IWL_NUM_CHANNELS, GFP_KERNEL); if (!nvm) { ret = -ENOMEM; goto out; diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c index 0a93ac769f66..a5e287daf440 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c @@ -59,8 +59,7 @@ struct iwl_phy_db_chg_txp { struct iwl_phy_db *iwl_phy_db_init(struct iwl_trans *trans) { - struct iwl_phy_db *phy_db = kzalloc(sizeof(struct iwl_phy_db), - GFP_KERNEL); + struct iwl_phy_db *phy_db = kzalloc_obj(struct iwl_phy_db, GFP_KERNEL); if (!phy_db) return phy_db; @@ -172,9 +171,9 @@ int iwl_phy_db_set_section(struct iwl_phy_db *phy_db, * Firmware sends the largest index first, so we can use * it to know how much we should allocate. */ - phy_db->calib_ch_group_papd = kcalloc(chg_id + 1, - sizeof(struct iwl_phy_db_entry), - GFP_ATOMIC); + phy_db->calib_ch_group_papd = kzalloc_objs(struct iwl_phy_db_entry, + chg_id + 1, + GFP_ATOMIC); if (!phy_db->calib_ch_group_papd) return -ENOMEM; phy_db->n_group_papd = chg_id + 1; @@ -186,9 +185,9 @@ int iwl_phy_db_set_section(struct iwl_phy_db *phy_db, * Firmware sends the largest index first, so we can use * it to know how much we should allocate. */ - phy_db->calib_ch_group_txp = kcalloc(chg_id + 1, - sizeof(struct iwl_phy_db_entry), - GFP_ATOMIC); + phy_db->calib_ch_group_txp = kzalloc_objs(struct iwl_phy_db_entry, + chg_id + 1, + GFP_ATOMIC); if (!phy_db->calib_ch_group_txp) return -ENOMEM; phy_db->n_group_txp = chg_id + 1; diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.c b/drivers/net/wireless/intel/iwlwifi/iwl-trans.c index fa1442246662..eebec9b8c169 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.c @@ -46,7 +46,7 @@ iwl_trans_get_restart_data(struct device *dev) if (data) return data; - data = kzalloc(struct_size(data, name, strlen(name) + 1), GFP_ATOMIC); + data = kzalloc_flex(*data, name, strlen(name) + 1, GFP_ATOMIC); if (!data) return NULL; @@ -113,7 +113,7 @@ static void iwl_trans_schedule_reprobe(struct iwl_trans *trans, return; } - reprobe = kzalloc(sizeof(*reprobe), GFP_KERNEL); + reprobe = kzalloc_obj(*reprobe, GFP_KERNEL); if (!reprobe) { module_put(THIS_MODULE); return; diff --git a/drivers/net/wireless/intel/iwlwifi/mei/main.c b/drivers/net/wireless/intel/iwlwifi/mei/main.c index dce0b7cf7b26..f9358cb01103 100644 --- a/drivers/net/wireless/intel/iwlwifi/mei/main.c +++ b/drivers/net/wireless/intel/iwlwifi/mei/main.c @@ -702,7 +702,7 @@ static void iwl_mei_handle_csme_filters(struct mei_cl_device *cldev, rcu_dereference_protected(mei->filters, lockdep_is_held(&iwl_mei_mutex)); - new_filters = kzalloc(sizeof(*new_filters), GFP_KERNEL); + new_filters = kzalloc_obj(*new_filters, GFP_KERNEL); if (!new_filters) return; @@ -886,7 +886,7 @@ static void iwl_mei_handle_nvm(struct mei_cl_device *cldev, int i; kfree(mei->nvm); - mei->nvm = kzalloc(sizeof(*mei_nvm), GFP_KERNEL); + mei->nvm = kzalloc_obj(*mei_nvm, GFP_KERNEL); if (!mei->nvm) return; diff --git a/drivers/net/wireless/intel/iwlwifi/mld/d3.c b/drivers/net/wireless/intel/iwlwifi/mld/d3.c index 6595542e95cf..e7849183dff1 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/d3.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/d3.c @@ -609,10 +609,9 @@ iwl_mld_handle_wowlan_info_notif(struct iwl_mld *mld, 5)) return true; - converted_notif = kzalloc(struct_size(converted_notif, - mlo_gtks, - notif_v5->num_mlo_link_keys), - GFP_ATOMIC); + converted_notif = kzalloc_flex(*converted_notif, mlo_gtks, + notif_v5->num_mlo_link_keys, + GFP_ATOMIC); if (!converted_notif) { IWL_ERR(mld, "Failed to allocate memory for converted wowlan_info_notif\n"); @@ -1173,8 +1172,7 @@ iwl_mld_set_netdetect_info(struct iwl_mld *mld, for (int k = 0; k < SCAN_OFFLOAD_MATCHING_CHANNELS_LEN; k++) n_channels += hweight8(matches[i].matching_channels[k]); - match = kzalloc(struct_size(match, channels, n_channels), - GFP_KERNEL); + match = kzalloc_flex(*match, channels, n_channels, GFP_KERNEL); if (!match) return; @@ -1251,8 +1249,8 @@ iwl_mld_process_netdetect_res(struct iwl_mld *mld, goto out; } n_matches = hweight_long(matched_profiles); - netdetect_info = kzalloc(struct_size(netdetect_info, matches, - n_matches), GFP_KERNEL); + netdetect_info = kzalloc_flex(*netdetect_info, matches, n_matches, + GFP_KERNEL); if (netdetect_info) iwl_mld_set_netdetect_info(mld, netdetect_cfg, netdetect_info, resume_data->netdetect_res, @@ -1656,7 +1654,7 @@ iwl_mld_suspend_send_security_cmds(struct iwl_mld *mld, struct iwl_mld_suspend_key_iter_data data = {}; int ret; - data.rsc = kzalloc(sizeof(*data.rsc), GFP_KERNEL); + data.rsc = kzalloc_obj(*data.rsc, GFP_KERNEL); if (!data.rsc) return -ENOMEM; @@ -2002,8 +2000,8 @@ int iwl_mld_wowlan_resume(struct iwl_mld *mld) iwl_fw_dbg_read_d3_debug_data(&mld->fwrt); - resume_data.wowlan_status = kzalloc(sizeof(*resume_data.wowlan_status), - GFP_KERNEL); + resume_data.wowlan_status = kzalloc_obj(*resume_data.wowlan_status, + GFP_KERNEL); if (!resume_data.wowlan_status) return -ENOMEM; diff --git a/drivers/net/wireless/intel/iwlwifi/mld/iface.c b/drivers/net/wireless/intel/iwlwifi/mld/iface.c index 743e44ff19cf..b418cbeb30aa 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/iface.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/iface.c @@ -542,7 +542,7 @@ void iwl_mld_handle_probe_resp_data_notif(struct iwl_mld *mld, notif->noa_attr.len_low)) return; - new_data = kzalloc(sizeof(*new_data), GFP_KERNEL); + new_data = kzalloc_obj(*new_data, GFP_KERNEL); if (!new_data) return; diff --git a/drivers/net/wireless/intel/iwlwifi/mld/link.c b/drivers/net/wireless/intel/iwlwifi/mld/link.c index d89840a1152b..5640de4662d7 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/link.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/link.c @@ -468,7 +468,7 @@ int iwl_mld_add_link(struct iwl_mld *mld, if (is_deflink) { link = &mld_vif->deflink; } else { - link = kzalloc(sizeof(*link), GFP_KERNEL); + link = kzalloc_obj(*link, GFP_KERNEL); if (!link) return -ENOMEM; } diff --git a/drivers/net/wireless/intel/iwlwifi/mld/low_latency.c b/drivers/net/wireless/intel/iwlwifi/mld/low_latency.c index 23362867b400..fb63c8ba800a 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/low_latency.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/low_latency.c @@ -131,8 +131,8 @@ int iwl_mld_low_latency_init(struct iwl_mld *mld) struct iwl_mld_low_latency *ll = &mld->low_latency; unsigned long ts = jiffies; - ll->pkts_counters = kcalloc(mld->trans->info.num_rxqs, - sizeof(*ll->pkts_counters), GFP_KERNEL); + ll->pkts_counters = kzalloc_objs(*ll->pkts_counters, + mld->trans->info.num_rxqs, GFP_KERNEL); if (!ll->pkts_counters) return -ENOMEM; diff --git a/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c index 3414b04a6953..54e128fd0141 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c @@ -2092,8 +2092,7 @@ static int iwl_mld_alloc_ptk_pn(struct iwl_mld *mld, return -EINVAL; WARN_ON(rcu_access_pointer(mld_sta->ptk_pn[keyidx])); - *ptk_pn = kzalloc(struct_size(*ptk_pn, q, num_rx_queues), - GFP_KERNEL); + *ptk_pn = kzalloc_flex(**ptk_pn, q, num_rx_queues, GFP_KERNEL); if (!*ptk_pn) return -ENOMEM; diff --git a/drivers/net/wireless/intel/iwlwifi/mld/notif.c b/drivers/net/wireless/intel/iwlwifi/mld/notif.c index 35356b244c0a..240526d8b632 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/notif.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/notif.c @@ -557,7 +557,7 @@ static void iwl_mld_rx_notif(struct iwl_mld *mld, break; } - entry = kzalloc(sizeof(*entry), GFP_ATOMIC); + entry = kzalloc_obj(*entry, GFP_ATOMIC); /* we can't do much... */ if (!entry) return; diff --git a/drivers/net/wireless/intel/iwlwifi/mld/scan.c b/drivers/net/wireless/intel/iwlwifi/mld/scan.c index 16f48087a888..6679be028a6b 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/scan.c @@ -2083,9 +2083,9 @@ void iwl_mld_handle_channel_survey_notif(struct iwl_mld *mld, n_channels += mld->wiphy->bands[band]->n_channels; } - mld->channel_survey = kzalloc(struct_size(mld->channel_survey, - channels, n_channels), - GFP_KERNEL); + mld->channel_survey = kzalloc_flex(*mld->channel_survey, + channels, n_channels, + GFP_KERNEL); if (!mld->channel_survey) return; diff --git a/drivers/net/wireless/intel/iwlwifi/mld/sta.c b/drivers/net/wireless/intel/iwlwifi/mld/sta.c index 6056a306f7cb..0869f2ee7cee 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/sta.c @@ -539,7 +539,7 @@ iwl_mld_add_link_sta(struct iwl_mld *mld, struct ieee80211_link_sta *link_sta) if (link_sta == &link_sta->sta->deflink) { mld_link_sta = &mld_sta->deflink; } else { - mld_link_sta = kzalloc(sizeof(*mld_link_sta), GFP_KERNEL); + mld_link_sta = kzalloc_obj(*mld_link_sta, GFP_KERNEL); if (!mld_link_sta) return -ENOMEM; } @@ -660,8 +660,8 @@ iwl_mld_alloc_dup_data(struct iwl_mld *mld, struct iwl_mld_sta *mld_sta) if (mld->fw_status.in_hw_restart) return 0; - dup_data = kcalloc(mld->trans->info.num_rxqs, sizeof(*dup_data), - GFP_KERNEL); + dup_data = kzalloc_objs(*dup_data, mld->trans->info.num_rxqs, + GFP_KERNEL); if (!dup_data) return -ENOMEM; @@ -695,9 +695,9 @@ static void iwl_mld_alloc_mpdu_counters(struct iwl_mld *mld, sta->tdls || !ieee80211_vif_is_mld(vif)) return; - mld_sta->mpdu_counters = kcalloc(mld->trans->info.num_rxqs, - sizeof(*mld_sta->mpdu_counters), - GFP_KERNEL); + mld_sta->mpdu_counters = kzalloc_objs(*mld_sta->mpdu_counters, + mld->trans->info.num_rxqs, + GFP_KERNEL); if (!mld_sta->mpdu_counters) return; diff --git a/drivers/net/wireless/intel/iwlwifi/mld/time_sync.c b/drivers/net/wireless/intel/iwlwifi/mld/time_sync.c index 50799f9bfccb..ad6f5c40f23d 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/time_sync.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/time_sync.c @@ -12,8 +12,8 @@ static int iwl_mld_init_time_sync(struct iwl_mld *mld, u32 protocols, const u8 *addr) { - struct iwl_mld_time_sync_data *time_sync = kzalloc(sizeof(*time_sync), - GFP_KERNEL); + struct iwl_mld_time_sync_data *time_sync = kzalloc_obj(*time_sync, + GFP_KERNEL); if (!time_sync) return -ENOMEM; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c index 6c225861db61..8df70323d426 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c @@ -460,7 +460,7 @@ static int iwl_mvm_wowlan_config_rsc_tsc(struct iwl_mvm *mvm, struct wowlan_key_rsc_v5_data data = {}; int i; - data.rsc = kzalloc(sizeof(*data.rsc), GFP_KERNEL); + data.rsc = kzalloc_obj(*data.rsc, GFP_KERNEL); if (!data.rsc) return -ENOMEM; @@ -483,7 +483,7 @@ static int iwl_mvm_wowlan_config_rsc_tsc(struct iwl_mvm *mvm, } else if (ver == 2 || ver == IWL_FW_CMD_VER_UNKNOWN) { struct wowlan_key_rsc_tsc_data data = {}; - data.rsc_tsc = kzalloc(sizeof(*data.rsc_tsc), GFP_KERNEL); + data.rsc_tsc = kzalloc_obj(*data.rsc_tsc, GFP_KERNEL); if (!data.rsc_tsc) return -ENOMEM; @@ -2605,8 +2605,7 @@ static void iwl_mvm_query_netdetect_reasons(struct iwl_mvm *mvm, n_matches = 0; } - net_detect = kzalloc(struct_size(net_detect, matches, n_matches), - GFP_KERNEL); + net_detect = kzalloc_flex(*net_detect, matches, n_matches, GFP_KERNEL); if (!net_detect || !n_matches) goto out_report_nd; net_detect->n_matches = n_matches; @@ -2620,8 +2619,7 @@ static void iwl_mvm_query_netdetect_reasons(struct iwl_mvm *mvm, d3_data->nd_results, i); - match = kzalloc(struct_size(match, channels, n_channels), - GFP_KERNEL); + match = kzalloc_flex(*match, channels, n_channels, GFP_KERNEL); if (!match) goto out_report_nd; match->n_channels = n_channels; @@ -3093,7 +3091,7 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm) } if (resume_notif_based) { - d3_data.status = kzalloc(sizeof(*d3_data.status), GFP_KERNEL); + d3_data.status = kzalloc_obj(*d3_data.status, GFP_KERNEL); if (!d3_data.status) { IWL_ERR(mvm, "Failed to allocate wowlan status\n"); ret = -ENOMEM; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c index a493ef6bedc3..0a21670a9207 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c @@ -1124,7 +1124,7 @@ static void iwl_mvm_ftm_rtt_smoothing(struct iwl_mvm *mvm, } if (!resp) { - resp = kzalloc(sizeof(*resp), GFP_KERNEL); + resp = kzalloc_obj(*resp, GFP_KERNEL); if (!resp) return; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c index 0e5820c13523..a633f0d9c821 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c @@ -1764,7 +1764,7 @@ void iwl_mvm_probe_resp_data_notif(struct iwl_mvm *mvm, notif->noa_attr.len_low)) return; - new_data = kzalloc(sizeof(*new_data), GFP_KERNEL); + new_data = kzalloc_obj(*new_data, GFP_KERNEL); if (!new_data) return; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 169c87588938..aeaa1d4b312d 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -4348,9 +4348,9 @@ static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw, int tid, q; WARN_ON(rcu_access_pointer(mvmsta->ptk_pn[keyidx])); - ptk_pn = kzalloc(struct_size(ptk_pn, q, - mvm->trans->info.num_rxqs), - GFP_KERNEL); + ptk_pn = kzalloc_flex(*ptk_pn, q, + mvm->trans->info.num_rxqs, + GFP_KERNEL); if (!ptk_pn) { ret = -ENOMEM; break; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c index 075ff09e93cc..00ba47d5f499 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c @@ -905,7 +905,7 @@ iwl_mvm_mld_change_vif_links(struct ieee80211_hw *hw, if (!(added & BIT(i))) continue; - new_link[i] = kzalloc(sizeof(*new_link[i]), GFP_KERNEL); + new_link[i] = kzalloc_obj(*new_link[i], GFP_KERNEL); if (!new_link[i]) { err = -ENOMEM; goto free; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c index 1100d763ceb6..8417b76e8fdb 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c @@ -547,7 +547,7 @@ static int iwl_mvm_mld_alloc_sta_link(struct iwl_mvm *mvm, if (rcu_access_pointer(sta->link[link_id]) == &sta->deflink) { link = &mvm_sta->deflink; } else { - link = kzalloc(sizeof(*link), GFP_KERNEL); + link = kzalloc_obj(*link, GFP_KERNEL); if (!link) return -ENOMEM; } diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index 5ebd046371f5..be328607e6f8 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -1097,7 +1097,7 @@ static void iwl_mvm_me_conn_status(void *priv, const struct iwl_mei_conn_info *c */ prev_conn_info = rcu_dereference_protected(mvm->csme_conn_info, true); - curr_conn_info = kzalloc(sizeof(*curr_conn_info), GFP_KERNEL); + curr_conn_info = kzalloc_obj(*curr_conn_info, GFP_KERNEL); if (!curr_conn_info) return; @@ -1747,7 +1747,7 @@ static void iwl_mvm_rx_common(struct iwl_mvm *mvm, return; } - entry = kzalloc(sizeof(*entry), GFP_ATOMIC); + entry = kzalloc_obj(*entry, GFP_ATOMIC); /* we can't do much... */ if (!entry) return; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c index 9c51953d255d..3e39c243ddca 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c @@ -547,7 +547,7 @@ iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm, else blocklist_len = IWL_SCAN_MAX_BLACKLIST_LEN; - blocklist = kcalloc(blocklist_len, sizeof(*blocklist), GFP_KERNEL); + blocklist = kzalloc_objs(*blocklist, blocklist_len, GFP_KERNEL); if (!blocklist) return -ENOMEM; @@ -3603,9 +3603,8 @@ void iwl_mvm_rx_channel_survey_notif(struct iwl_mvm *mvm, n_channels += mvm->hw->wiphy->bands[band]->n_channels; } - mvm->acs_survey = kzalloc(struct_size(mvm->acs_survey, - channels, n_channels), - GFP_KERNEL); + mvm->acs_survey = kzalloc_flex(*mvm->acs_survey, channels, + n_channels, GFP_KERNEL); if (!mvm->acs_survey) return; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c index 363232bb74fa..5f37ee7b9ab1 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c @@ -1798,8 +1798,8 @@ int iwl_mvm_sta_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif, if (iwl_mvm_has_new_rx_api(mvm)) { int q; - dup_data = kcalloc(mvm->trans->info.num_rxqs, - sizeof(*dup_data), GFP_KERNEL); + dup_data = kzalloc_objs(*dup_data, mvm->trans->info.num_rxqs, + GFP_KERNEL); if (!dup_data) return -ENOMEM; /* diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c index 0957223c776d..65b54f1e6347 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c @@ -99,10 +99,10 @@ int iwl_pcie_init_fw_sec(struct iwl_trans *trans, /* add 2 due to separators */ paging_cnt = iwl_pcie_get_num_sections(fw, lmac_cnt + umac_cnt + 2); - dram->fw = kcalloc(umac_cnt + lmac_cnt, sizeof(*dram->fw), GFP_KERNEL); + dram->fw = kzalloc_objs(*dram->fw, umac_cnt + lmac_cnt, GFP_KERNEL); if (!dram->fw) return -ENOMEM; - dram->paging = kcalloc(paging_cnt, sizeof(*dram->paging), GFP_KERNEL); + dram->paging = kzalloc_objs(*dram->paging, paging_cnt, GFP_KERNEL); if (!dram->paging) return -ENOMEM; diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/rx.c index 619a9505e6d9..4e23b292e4df 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/rx.c @@ -773,15 +773,14 @@ static int iwl_pcie_rx_alloc(struct iwl_trans *trans) if (WARN_ON(trans_pcie->rxq)) return -EINVAL; - trans_pcie->rxq = kcalloc(trans->info.num_rxqs, sizeof(struct iwl_rxq), - GFP_KERNEL); - trans_pcie->rx_pool = kcalloc(RX_POOL_SIZE(trans_pcie->num_rx_bufs), - sizeof(trans_pcie->rx_pool[0]), - GFP_KERNEL); + trans_pcie->rxq = kzalloc_objs(struct iwl_rxq, trans->info.num_rxqs, + GFP_KERNEL); + trans_pcie->rx_pool = kzalloc_objs(trans_pcie->rx_pool[0], + RX_POOL_SIZE(trans_pcie->num_rx_bufs), + GFP_KERNEL); trans_pcie->global_table = - kcalloc(RX_POOL_SIZE(trans_pcie->num_rx_bufs), - sizeof(trans_pcie->global_table[0]), - GFP_KERNEL); + kzalloc_objs(trans_pcie->global_table[0], + RX_POOL_SIZE(trans_pcie->num_rx_bufs), GFP_KERNEL); if (!trans_pcie->rxq || !trans_pcie->rx_pool || !trans_pcie->global_table) { ret = -ENOMEM; diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c index 415a19ea9f06..ec88aefb0913 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c @@ -2303,7 +2303,7 @@ void iwl_trans_pcie_reset(struct iwl_trans *trans, enum iwl_reset_mode mode) return; } - removal = kzalloc(sizeof(*removal), GFP_ATOMIC); + removal = kzalloc_obj(*removal, GFP_ATOMIC); if (!removal) { module_put(THIS_MODULE); return; @@ -2748,7 +2748,7 @@ static void *iwl_dbgfs_tx_queue_seq_start(struct seq_file *seq, loff_t *pos) if (*pos >= priv->trans->mac_cfg->base->num_of_queues) return NULL; - state = kmalloc(sizeof(*state), GFP_KERNEL); + state = kmalloc_obj(*state, GFP_KERNEL); if (!state) return NULL; state->pos = *pos; diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/tx-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/tx-gen2.c index df0545f09da9..f2752ab4c402 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/tx-gen2.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/tx-gen2.c @@ -928,7 +928,7 @@ iwl_txq_dyn_alloc_dma(struct iwl_trans *trans, int size, unsigned int timeout) if (WARN_ON(size > bc_tbl_entries)) return ERR_PTR(-EINVAL); - txq = kzalloc(sizeof(*txq), GFP_KERNEL); + txq = kzalloc_obj(*txq, GFP_KERNEL); if (!txq) return ERR_PTR(-ENOMEM); @@ -1152,7 +1152,7 @@ int iwl_txq_gen2_init(struct iwl_trans *trans, int txq_id, int queue_size) /* alloc and init the tx queue */ if (!trans_pcie->txqs.txq[txq_id]) { - queue = kzalloc(sizeof(*queue), GFP_KERNEL); + queue = kzalloc_obj(*queue, GFP_KERNEL); if (!queue) { IWL_ERR(trans, "Not enough memory for tx queue\n"); return -ENOMEM; diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/tx.c index 6e85aa519e1b..0b817e5c5679 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/tx.c @@ -741,9 +741,8 @@ int iwl_pcie_txq_alloc(struct iwl_trans *trans, struct iwl_txq *txq, txq->n_window = slots_num; - txq->entries = kcalloc(slots_num, - sizeof(struct iwl_pcie_txq_entry), - GFP_KERNEL); + txq->entries = kzalloc_objs(struct iwl_pcie_txq_entry, slots_num, + GFP_KERNEL); if (!txq->entries) goto error; @@ -751,8 +750,7 @@ int iwl_pcie_txq_alloc(struct iwl_trans *trans, struct iwl_txq *txq, if (cmd_queue) for (i = 0; i < slots_num; i++) { txq->entries[i].cmd = - kmalloc(sizeof(struct iwl_device_cmd), - GFP_KERNEL); + kmalloc_obj(struct iwl_device_cmd, GFP_KERNEL); if (!txq->entries[i].cmd) goto error; } @@ -838,8 +836,8 @@ static int iwl_pcie_tx_alloc(struct iwl_trans *trans) } trans_pcie->txq_memory = - kcalloc(trans->mac_cfg->base->num_of_queues, - sizeof(struct iwl_txq), GFP_KERNEL); + kzalloc_objs(struct iwl_txq, + trans->mac_cfg->base->num_of_queues, GFP_KERNEL); if (!trans_pcie->txq_memory) { IWL_ERR(trans, "Not enough memory for txq\n"); ret = -ENOMEM; diff --git a/drivers/net/wireless/intersil/p54/eeprom.c b/drivers/net/wireless/intersil/p54/eeprom.c index 5bd35c147e19..c338a7a7fc41 100644 --- a/drivers/net/wireless/intersil/p54/eeprom.c +++ b/drivers/net/wireless/intersil/p54/eeprom.c @@ -154,13 +154,12 @@ static int p54_generate_band(struct ieee80211_hw *dev, if ((!list->entries) || (!list->band_channel_num[band])) return -EINVAL; - tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); + tmp = kzalloc_obj(*tmp, GFP_KERNEL); if (!tmp) goto err_out; - tmp->channels = kcalloc(list->band_channel_num[band], - sizeof(struct ieee80211_channel), - GFP_KERNEL); + tmp->channels = kzalloc_objs(struct ieee80211_channel, + list->band_channel_num[band], GFP_KERNEL); if (!tmp->channels) goto err_out; @@ -336,23 +335,22 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) max_channel_num = max_t(unsigned int, max_channel_num, priv->curve_data->entries); - list = kzalloc(sizeof(*list), GFP_KERNEL); + list = kzalloc_obj(*list, GFP_KERNEL); if (!list) { ret = -ENOMEM; goto free; } priv->chan_num = max_channel_num; - priv->survey = kcalloc(max_channel_num, sizeof(struct survey_info), - GFP_KERNEL); + priv->survey = kzalloc_objs(struct survey_info, max_channel_num, + GFP_KERNEL); if (!priv->survey) { ret = -ENOMEM; goto free; } list->max_entries = max_channel_num; - list->channels = kcalloc(max_channel_num, - sizeof(struct p54_channel_entry), - GFP_KERNEL); + list->channels = kzalloc_objs(struct p54_channel_entry, max_channel_num, + GFP_KERNEL); if (!list->channels) { ret = -ENOMEM; goto free; diff --git a/drivers/net/wireless/intersil/p54/p54usb.c b/drivers/net/wireless/intersil/p54/p54usb.c index cae47663b17b..c0d3b5329f4e 100644 --- a/drivers/net/wireless/intersil/p54/p54usb.c +++ b/drivers/net/wireless/intersil/p54/p54usb.c @@ -328,7 +328,7 @@ static void p54u_tx_net2280(struct ieee80211_hw *dev, struct sk_buff *skb) struct net2280_reg_write *reg = NULL; int err = -ENOMEM; - reg = kmalloc(sizeof(*reg), GFP_ATOMIC); + reg = kmalloc_obj(*reg, GFP_ATOMIC); if (!reg) goto out; diff --git a/drivers/net/wireless/marvell/libertas/cfg.c b/drivers/net/wireless/marvell/libertas/cfg.c index caba7491cd5a..331b0b69ce62 100644 --- a/drivers/net/wireless/marvell/libertas/cfg.c +++ b/drivers/net/wireless/marvell/libertas/cfg.c @@ -2094,7 +2094,7 @@ struct wireless_dev *lbs_cfg_alloc(struct device *dev) int ret = 0; struct wireless_dev *wdev; - wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); + wdev = kzalloc_obj(struct wireless_dev, GFP_KERNEL); if (!wdev) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/wireless/marvell/libertas/debugfs.c b/drivers/net/wireless/marvell/libertas/debugfs.c index c604613ab506..d2dc9128dae2 100644 --- a/drivers/net/wireless/marvell/libertas/debugfs.c +++ b/drivers/net/wireless/marvell/libertas/debugfs.c @@ -232,7 +232,7 @@ static ssize_t lbs_threshold_read(uint16_t tlv_type, uint16_t event_mask, if (!buf) return -ENOMEM; - subscribed = kzalloc(sizeof(*subscribed), GFP_KERNEL); + subscribed = kzalloc_obj(*subscribed, GFP_KERNEL); if (!subscribed) { ret = -ENOMEM; goto out_page; @@ -288,7 +288,7 @@ static ssize_t lbs_threshold_write(uint16_t tlv_type, uint16_t event_mask, ret = -EINVAL; goto out_page; } - events = kzalloc(sizeof(*events), GFP_KERNEL); + events = kzalloc_obj(*events, GFP_KERNEL); if (!events) { ret = -ENOMEM; goto out_page; diff --git a/drivers/net/wireless/marvell/libertas/if_sdio.c b/drivers/net/wireless/marvell/libertas/if_sdio.c index fc5318035822..b814cf9032ad 100644 --- a/drivers/net/wireless/marvell/libertas/if_sdio.c +++ b/drivers/net/wireless/marvell/libertas/if_sdio.c @@ -1158,7 +1158,7 @@ static int if_sdio_probe(struct sdio_func *func, return -ENODEV; } - card = kzalloc(sizeof(struct if_sdio_card), GFP_KERNEL); + card = kzalloc_obj(struct if_sdio_card, GFP_KERNEL); if (!card) return -ENOMEM; diff --git a/drivers/net/wireless/marvell/libertas/if_spi.c b/drivers/net/wireless/marvell/libertas/if_spi.c index 8a2504a62840..a21f7bba13c5 100644 --- a/drivers/net/wireless/marvell/libertas/if_spi.c +++ b/drivers/net/wireless/marvell/libertas/if_spi.c @@ -1113,7 +1113,7 @@ static int if_spi_probe(struct spi_device *spi) } /* Allocate card structure to represent this specific device */ - card = kzalloc(sizeof(struct if_spi_card), GFP_KERNEL); + card = kzalloc_obj(struct if_spi_card, GFP_KERNEL); if (!card) { err = -ENOMEM; goto teardown; diff --git a/drivers/net/wireless/marvell/libertas/if_usb.c b/drivers/net/wireless/marvell/libertas/if_usb.c index 924ab93b7b67..e02756d7e87a 100644 --- a/drivers/net/wireless/marvell/libertas/if_usb.c +++ b/drivers/net/wireless/marvell/libertas/if_usb.c @@ -203,7 +203,7 @@ static int if_usb_probe(struct usb_interface *intf, udev = interface_to_usbdev(intf); - cardp = kzalloc(sizeof(struct if_usb_card), GFP_KERNEL); + cardp = kzalloc_obj(struct if_usb_card, GFP_KERNEL); if (!cardp) goto error; diff --git a/drivers/net/wireless/marvell/libertas/mesh.c b/drivers/net/wireless/marvell/libertas/mesh.c index 2dd635935448..aa94b777da13 100644 --- a/drivers/net/wireless/marvell/libertas/mesh.c +++ b/drivers/net/wireless/marvell/libertas/mesh.c @@ -983,7 +983,7 @@ static int lbs_add_mesh(struct lbs_private *priv) int ret = 0; /* Allocate a virtual mesh device */ - mesh_wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); + mesh_wdev = kzalloc_obj(struct wireless_dev, GFP_KERNEL); if (!mesh_wdev) { lbs_deb_mesh("init mshX wireless device failed\n"); ret = -ENOMEM; diff --git a/drivers/net/wireless/marvell/libertas_tf/if_usb.c b/drivers/net/wireless/marvell/libertas_tf/if_usb.c index 5662a244f82a..44c609205422 100644 --- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c +++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c @@ -154,7 +154,7 @@ static int if_usb_probe(struct usb_interface *intf, lbtf_deb_enter(LBTF_DEB_USB); udev = interface_to_usbdev(intf); - cardp = kzalloc(sizeof(struct if_usb_card), GFP_KERNEL); + cardp = kzalloc_obj(struct if_usb_card, GFP_KERNEL); if (!cardp) goto error; diff --git a/drivers/net/wireless/marvell/mwifiex/11n.c b/drivers/net/wireless/marvell/mwifiex/11n.c index 66f0f5377ac1..cef8a55427dd 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n.c +++ b/drivers/net/wireless/marvell/mwifiex/11n.c @@ -547,8 +547,8 @@ void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid, int tid_down; if (!mwifiex_get_ba_tbl(priv, tid, ra)) { - new_node = kzalloc(sizeof(struct mwifiex_tx_ba_stream_tbl), - GFP_ATOMIC); + new_node = kzalloc_obj(struct mwifiex_tx_ba_stream_tbl, + GFP_ATOMIC); if (!new_node) return; diff --git a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c index f3397dc6c422..c00b385c0f58 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c +++ b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c @@ -344,7 +344,7 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta, return; } /* if !tbl then create one */ - new_node = kzalloc(sizeof(struct mwifiex_rx_reorder_tbl), GFP_KERNEL); + new_node = kzalloc_obj(struct mwifiex_rx_reorder_tbl, GFP_KERNEL); if (!new_node) return; diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index a66d18e380fc..f387b26b086b 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -756,7 +756,7 @@ mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, int radio_idx, return -EINVAL; } - bss_cfg = kzalloc(sizeof(*bss_cfg), GFP_KERNEL); + bss_cfg = kzalloc_obj(*bss_cfg, GFP_KERNEL); if (!bss_cfg) return -ENOMEM; @@ -2073,7 +2073,7 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy, if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_UAP) return -1; - bss_cfg = kzalloc(sizeof(struct mwifiex_uap_bss_param), GFP_KERNEL); + bss_cfg = kzalloc_obj(struct mwifiex_uap_bss_param, GFP_KERNEL); if (!bss_cfg) return -ENOMEM; @@ -2683,7 +2683,7 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, if (!mwifiex_stop_bg_scan(priv)) cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0); - user_scan_cfg = kzalloc(sizeof(*user_scan_cfg), GFP_KERNEL); + user_scan_cfg = kzalloc_obj(*user_scan_cfg, GFP_KERNEL); if (!user_scan_cfg) return -ENOMEM; @@ -2787,7 +2787,7 @@ mwifiex_cfg80211_sched_scan_start(struct wiphy *wiphy, request->n_channels, request->scan_plans->interval, (int)request->ie_len); - bgscan_cfg = kzalloc(sizeof(*bgscan_cfg), GFP_KERNEL); + bgscan_cfg = kzalloc_obj(*bgscan_cfg, GFP_KERNEL); if (!bgscan_cfg) return -ENOMEM; @@ -3452,7 +3452,7 @@ static int mwifiex_set_mef_filter(struct mwifiex_private *priv, if (wowlan->n_patterns || wowlan->magic_pkt) num_entries++; - mef_entry = kcalloc(num_entries, sizeof(*mef_entry), GFP_KERNEL); + mef_entry = kzalloc_objs(*mef_entry, num_entries, GFP_KERNEL); if (!mef_entry) return -ENOMEM; @@ -3989,7 +3989,7 @@ mwifiex_cfg80211_uap_add_station(struct mwifiex_private *priv, const u8 *mac, if (!ret) { struct station_info *sinfo; - sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); + sinfo = kzalloc_obj(*sinfo, GFP_KERNEL); if (!sinfo) return -ENOMEM; @@ -4161,7 +4161,7 @@ static int mwifiex_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev, if (!tb[MWIFIEX_TM_ATTR_DATA]) return -EINVAL; - hostcmd = kzalloc(sizeof(*hostcmd), GFP_KERNEL); + hostcmd = kzalloc_obj(*hostcmd, GFP_KERNEL); if (!hostcmd) return -ENOMEM; @@ -4677,9 +4677,9 @@ int mwifiex_init_channel_scan_gap(struct mwifiex_adapter *adapter) * additional active scan request for hidden SSIDs on passive channels. */ adapter->num_in_chan_stats = 2 * (n_channels_bg + n_channels_a); - adapter->chan_stats = kcalloc(adapter->num_in_chan_stats, - sizeof(*adapter->chan_stats), - GFP_KERNEL); + adapter->chan_stats = kzalloc_objs(*adapter->chan_stats, + adapter->num_in_chan_stats, + GFP_KERNEL); if (!adapter->chan_stats) return -ENOMEM; diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index 0f466c31337f..1bb30fbab12b 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -389,8 +389,8 @@ int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter) u32 i; /* Allocate and initialize struct cmd_ctrl_node */ - cmd_array = kcalloc(MWIFIEX_NUM_OF_CMD_BUFFER, - sizeof(struct cmd_ctrl_node), GFP_KERNEL); + cmd_array = kzalloc_objs(struct cmd_ctrl_node, + MWIFIEX_NUM_OF_CMD_BUFFER, GFP_KERNEL); if (!cmd_array) return -ENOMEM; diff --git a/drivers/net/wireless/marvell/mwifiex/ie.c b/drivers/net/wireless/marvell/mwifiex/ie.c index 26694cee15d3..55af5e9b5bee 100644 --- a/drivers/net/wireless/marvell/mwifiex/ie.c +++ b/drivers/net/wireless/marvell/mwifiex/ie.c @@ -149,7 +149,7 @@ mwifiex_update_uap_custom_ie(struct mwifiex_private *priv, u16 len; int ret; - ap_custom_ie = kzalloc(sizeof(*ap_custom_ie), GFP_KERNEL); + ap_custom_ie = kzalloc_obj(*ap_custom_ie, GFP_KERNEL); if (!ap_custom_ie) return -ENOMEM; @@ -221,8 +221,7 @@ static int mwifiex_update_vs_ie(const u8 *ies, int ies_len, vendor_ie = cfg80211_find_vendor_ie(oui, oui_type, ies, ies_len); if (vendor_ie) { if (!*ie_ptr) { - *ie_ptr = kzalloc(sizeof(struct mwifiex_ie), - GFP_KERNEL); + *ie_ptr = kzalloc_obj(struct mwifiex_ie, GFP_KERNEL); if (!*ie_ptr) return -ENOMEM; ie = *ie_ptr; @@ -326,7 +325,7 @@ static int mwifiex_uap_parse_tail_ies(struct mwifiex_private *priv, if (!info->tail || !info->tail_len) return 0; - gen_ie = kzalloc(sizeof(*gen_ie), GFP_KERNEL); + gen_ie = kzalloc_obj(*gen_ie, GFP_KERNEL); if (!gen_ie) return -ENOMEM; @@ -439,7 +438,7 @@ int mwifiex_del_mgmt_ies(struct mwifiex_private *priv) int ret = 0; if (priv->gen_idx != MWIFIEX_AUTO_IDX_MASK) { - gen_ie = kmalloc(sizeof(*gen_ie), GFP_KERNEL); + gen_ie = kmalloc_obj(*gen_ie, GFP_KERNEL); if (!gen_ie) return -ENOMEM; @@ -457,7 +456,7 @@ int mwifiex_del_mgmt_ies(struct mwifiex_private *priv) } if (priv->beacon_idx != MWIFIEX_AUTO_IDX_MASK) { - beacon_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); + beacon_ie = kmalloc_obj(struct mwifiex_ie, GFP_KERNEL); if (!beacon_ie) { ret = -ENOMEM; goto done; @@ -467,7 +466,7 @@ int mwifiex_del_mgmt_ies(struct mwifiex_private *priv) beacon_ie->ie_length = 0; } if (priv->proberesp_idx != MWIFIEX_AUTO_IDX_MASK) { - pr_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); + pr_ie = kmalloc_obj(struct mwifiex_ie, GFP_KERNEL); if (!pr_ie) { ret = -ENOMEM; goto done; @@ -477,7 +476,7 @@ int mwifiex_del_mgmt_ies(struct mwifiex_private *priv) pr_ie->ie_length = 0; } if (priv->assocresp_idx != MWIFIEX_AUTO_IDX_MASK) { - ar_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); + ar_ie = kmalloc_obj(struct mwifiex_ie, GFP_KERNEL); if (!ar_ie) { ret = -ENOMEM; goto done; diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index 4820010a86f6..28ffcc780eab 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -25,7 +25,7 @@ static int mwifiex_add_bss_prio_tbl(struct mwifiex_private *priv) struct mwifiex_bss_prio_node *bss_prio; struct mwifiex_bss_prio_tbl *tbl = adapter->bss_prio_tbl; - bss_prio = kzalloc(sizeof(struct mwifiex_bss_prio_node), GFP_KERNEL); + bss_prio = kzalloc_obj(struct mwifiex_bss_prio_node, GFP_KERNEL); if (!bss_prio) return -ENOMEM; diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index ff177b06f42d..d4c62fad8099 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -60,7 +60,7 @@ static int mwifiex_register(void *card, struct device *dev, struct mwifiex_adapter *adapter; int i; - adapter = kzalloc(sizeof(struct mwifiex_adapter), GFP_KERNEL); + adapter = kzalloc_obj(struct mwifiex_adapter, GFP_KERNEL); if (!adapter) return -ENOMEM; @@ -82,7 +82,7 @@ static int mwifiex_register(void *card, struct device *dev, for (i = 0; i < MWIFIEX_MAX_BSS_NUM; i++) { /* Allocate memory for private structure */ adapter->priv[i] = - kzalloc(sizeof(struct mwifiex_private), GFP_KERNEL); + kzalloc_obj(struct mwifiex_private, GFP_KERNEL); if (!adapter->priv[i]) goto error; @@ -1180,7 +1180,7 @@ void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter) p += adapter->if_ops.reg_dump(adapter, p); } p += sprintf(p, "\n=== more debug information\n"); - debug_info = kzalloc(sizeof(*debug_info), GFP_KERNEL); + debug_info = kzalloc_obj(*debug_info, GFP_KERNEL); if (debug_info) { for (i = 0; i < adapter->priv_num; i++) { if (!adapter->priv[i]->netdev) @@ -1346,7 +1346,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv, if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA || GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) { - priv->hist_data = kmalloc(sizeof(*priv->hist_data), GFP_KERNEL); + priv->hist_data = kmalloc_obj(*priv->hist_data, GFP_KERNEL); if (priv->hist_data) mwifiex_hist_data_reset(priv); } diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c index cab889af4c4a..b4858c0002e0 100644 --- a/drivers/net/wireless/marvell/mwifiex/scan.c +++ b/drivers/net/wireless/marvell/mwifiex/scan.c @@ -1503,16 +1503,15 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, adapter->scan_processing = true; spin_unlock_bh(&adapter->mwifiex_cmd_lock); - scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv), - GFP_KERNEL); + scan_cfg_out = kzalloc_obj(union mwifiex_scan_cmd_config_tlv, + GFP_KERNEL); if (!scan_cfg_out) { ret = -ENOMEM; goto done; } - scan_chan_list = kcalloc(MWIFIEX_USER_SCAN_CHAN_MAX, - sizeof(struct mwifiex_chan_scan_param_set), - GFP_KERNEL); + scan_chan_list = kzalloc_objs(struct mwifiex_chan_scan_param_set, + MWIFIEX_USER_SCAN_CHAN_MAX, GFP_KERNEL); if (!scan_chan_list) { kfree(scan_cfg_out); ret = -ENOMEM; @@ -1650,7 +1649,7 @@ static int mwifiex_save_hidden_ssid_channels(struct mwifiex_private *priv, int chid; /* Allocate and fill new bss descriptor */ - bss_desc = kzalloc(sizeof(*bss_desc), GFP_KERNEL); + bss_desc = kzalloc_obj(*bss_desc, GFP_KERNEL); if (!bss_desc) return -ENOMEM; @@ -1693,7 +1692,7 @@ static int mwifiex_update_curr_bss_params(struct mwifiex_private *priv, int ret; /* Allocate and fill new bss descriptor */ - bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor), GFP_KERNEL); + bss_desc = kzalloc_obj(struct mwifiex_bssdescriptor, GFP_KERNEL); if (!bss_desc) return -ENOMEM; @@ -1932,7 +1931,7 @@ mwifiex_active_scan_req_for_passive_chan(struct mwifiex_private *priv) mwifiex_dbg(adapter, INFO, "No BSS with hidden SSID found on DFS channels\n"); return 0; } - user_scan_cfg = kzalloc(sizeof(*user_scan_cfg), GFP_KERNEL); + user_scan_cfg = kzalloc_obj(*user_scan_cfg, GFP_KERNEL); if (!user_scan_cfg) return -ENOMEM; @@ -2174,9 +2173,8 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, if (nd_config) { adapter->nd_info = - kzalloc(struct_size(adapter->nd_info, matches, - scan_rsp->number_of_sets), - GFP_ATOMIC); + kzalloc_flex(*adapter->nd_info, matches, + scan_rsp->number_of_sets, GFP_ATOMIC); if (adapter->nd_info) adapter->nd_info->n_matches = scan_rsp->number_of_sets; @@ -2452,7 +2450,7 @@ int mwifiex_stop_bg_scan(struct mwifiex_private *priv) return 0; } - bgscan_cfg = kzalloc(sizeof(*bgscan_cfg), GFP_KERNEL); + bgscan_cfg = kzalloc_obj(*bgscan_cfg, GFP_KERNEL); if (!bgscan_cfg) return -ENOMEM; @@ -2779,7 +2777,7 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv, return -EBUSY; } - scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL); + scan_cfg = kzalloc_obj(struct mwifiex_user_scan_cfg, GFP_KERNEL); if (!scan_cfg) return -ENOMEM; diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c index dcca71158fc6..b457ed6f18f5 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c @@ -1516,7 +1516,7 @@ int mwifiex_send_rgpower_table(struct mwifiex_private *priv, const u8 *data, struct mwifiex_adapter *adapter = priv->adapter; struct mwifiex_ds_misc_cmd *hostcmd __free(kfree) = NULL; - hostcmd = kzalloc(sizeof(*hostcmd), GFP_KERNEL); + hostcmd = kzalloc_obj(*hostcmd, GFP_KERNEL); if (!hostcmd) return -ENOMEM; diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c index 9c53825f222d..f8f84fc670f3 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c @@ -1052,7 +1052,7 @@ mwifiex_create_custom_regdomain(struct mwifiex_private *priv, if (WARN_ON_ONCE(num_chan > NL80211_MAX_SUPP_REG_RULES)) return ERR_PTR(-EINVAL); - regd = kzalloc(struct_size(regd, reg_rules, num_chan), GFP_KERNEL); + regd = kzalloc_flex(*regd, reg_rules, num_chan, GFP_KERNEL); if (!regd) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c index ef6722ffdc74..46476cb752dd 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c @@ -330,8 +330,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, return -EINVAL; /* Allocate and fill new bss descriptor */ - bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor), - GFP_KERNEL); + bss_desc = kzalloc_obj(struct mwifiex_bssdescriptor, GFP_KERNEL); if (!bss_desc) return -ENOMEM; diff --git a/drivers/net/wireless/marvell/mwifiex/tdls.c b/drivers/net/wireless/marvell/mwifiex/tdls.c index 77a9a6de636d..a4cf323e704b 100644 --- a/drivers/net/wireless/marvell/mwifiex/tdls.c +++ b/drivers/net/wireless/marvell/mwifiex/tdls.c @@ -1356,7 +1356,7 @@ void mwifiex_add_auto_tdls_peer(struct mwifiex_private *priv, const u8 *mac) } /* create new TDLS peer */ - tdls_peer = kzalloc(sizeof(*tdls_peer), GFP_ATOMIC); + tdls_peer = kzalloc_obj(*tdls_peer, GFP_ATOMIC); if (tdls_peer) { ether_addr_copy(tdls_peer->mac_addr, mac); tdls_peer->tdls_status = TDLS_SETUP_INPROGRESS; diff --git a/drivers/net/wireless/marvell/mwifiex/uap_event.c b/drivers/net/wireless/marvell/mwifiex/uap_event.c index 245cb99a3daa..9abd011aa295 100644 --- a/drivers/net/wireless/marvell/mwifiex/uap_event.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_event.c @@ -105,7 +105,7 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv) switch (eventcause) { case EVENT_UAP_STA_ASSOC: - sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); + sinfo = kzalloc_obj(*sinfo, GFP_KERNEL); if (!sinfo) return -ENOMEM; diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c index 6882e90e90b2..7d3631d21223 100644 --- a/drivers/net/wireless/marvell/mwifiex/util.c +++ b/drivers/net/wireless/marvell/mwifiex/util.c @@ -694,7 +694,7 @@ mwifiex_add_sta_entry(struct mwifiex_private *priv, const u8 *mac) if (node) goto done; - node = kzalloc(sizeof(*node), GFP_ATOMIC); + node = kzalloc_obj(*node, GFP_ATOMIC); if (!node) goto done; diff --git a/drivers/net/wireless/marvell/mwifiex/wmm.c b/drivers/net/wireless/marvell/mwifiex/wmm.c index 1b1222c73728..841505e83c7f 100644 --- a/drivers/net/wireless/marvell/mwifiex/wmm.c +++ b/drivers/net/wireless/marvell/mwifiex/wmm.c @@ -99,7 +99,7 @@ mwifiex_wmm_allocate_ralist_node(struct mwifiex_adapter *adapter, const u8 *ra) { struct mwifiex_ra_list_tbl *ra_list; - ra_list = kzalloc(sizeof(struct mwifiex_ra_list_tbl), GFP_ATOMIC); + ra_list = kzalloc_obj(struct mwifiex_ra_list_tbl, GFP_ATOMIC); if (!ra_list) return NULL; diff --git a/drivers/net/wireless/marvell/mwl8k.c b/drivers/net/wireless/marvell/mwl8k.c index 54d6d00ecdf1..c505c83f8abc 100644 --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c @@ -1182,7 +1182,7 @@ static int mwl8k_rxq_init(struct ieee80211_hw *hw, int index) return -ENOMEM; } - rxq->buf = kcalloc(MWL8K_RX_DESCS, sizeof(*rxq->buf), GFP_KERNEL); + rxq->buf = kzalloc_objs(*rxq->buf, MWL8K_RX_DESCS, GFP_KERNEL); if (rxq->buf == NULL) { dma_free_coherent(&priv->pdev->dev, size, rxq->rxd, rxq->rxd_dma); @@ -1478,7 +1478,7 @@ static int mwl8k_txq_init(struct ieee80211_hw *hw, int index) return -ENOMEM; } - txq->skb = kcalloc(MWL8K_TX_DESCS, sizeof(*txq->skb), GFP_KERNEL); + txq->skb = kzalloc_objs(*txq->skb, MWL8K_TX_DESCS, GFP_KERNEL); if (txq->skb == NULL) { dma_free_coherent(&priv->pdev->dev, size, txq->txd, txq->txd_dma); @@ -2472,7 +2472,7 @@ static int mwl8k_cmd_get_hw_spec_sta(struct ieee80211_hw *hw) int rc; int i; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -2537,7 +2537,7 @@ static int mwl8k_cmd_get_hw_spec_ap(struct ieee80211_hw *hw) int rc, i; u32 api_version; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -2639,7 +2639,7 @@ static int mwl8k_cmd_set_hw_spec(struct ieee80211_hw *hw) int rc; int i; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -2753,7 +2753,7 @@ static int mwl8k_cmd_get_stat(struct ieee80211_hw *hw, struct mwl8k_cmd_get_stat *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -2796,7 +2796,7 @@ mwl8k_cmd_radio_control(struct ieee80211_hw *hw, bool enable, bool force) if (enable == priv->radio_on && !force) return 0; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -2854,7 +2854,7 @@ static int mwl8k_cmd_rf_tx_power(struct ieee80211_hw *hw, int dBm) struct mwl8k_cmd_rf_tx_power *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -2895,7 +2895,7 @@ static int mwl8k_cmd_tx_power(struct ieee80211_hw *hw, int rc; int i; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -2948,7 +2948,7 @@ mwl8k_cmd_rf_antenna(struct ieee80211_hw *hw, int antenna, int mask) struct mwl8k_cmd_rf_antenna *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3066,7 +3066,7 @@ static int mwl8k_cmd_set_pre_scan(struct ieee80211_hw *hw) struct mwl8k_cmd_set_pre_scan *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3099,7 +3099,7 @@ mwl8k_cmd_bbp_reg_access(struct ieee80211_hw *hw, struct mwl8k_cmd_bbp_reg_access *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3135,7 +3135,7 @@ mwl8k_cmd_set_post_scan(struct ieee80211_hw *hw, const __u8 *mac) struct mwl8k_cmd_set_post_scan *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3228,7 +3228,7 @@ static int mwl8k_cmd_set_rf_channel(struct ieee80211_hw *hw, struct mwl8k_priv *priv = hw->priv; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3314,7 +3314,7 @@ mwl8k_cmd_set_aid(struct ieee80211_hw *hw, u16 prot_mode; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3368,7 +3368,7 @@ mwl8k_cmd_set_rate(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct mwl8k_cmd_set_rate *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3402,7 +3402,7 @@ static int mwl8k_cmd_finalize_join(struct ieee80211_hw *hw, void *frame, int payload_len; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3440,7 +3440,7 @@ mwl8k_cmd_set_rts_threshold(struct ieee80211_hw *hw, int radio_idx, struct mwl8k_cmd_set_rts_threshold *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3469,7 +3469,7 @@ static int mwl8k_cmd_set_slot(struct ieee80211_hw *hw, bool short_slot_time) struct mwl8k_cmd_set_slot *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3543,7 +3543,7 @@ mwl8k_cmd_set_edca_params(struct ieee80211_hw *hw, __u8 qnum, struct mwl8k_cmd_set_edca_params *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3583,7 +3583,7 @@ static int mwl8k_cmd_set_wmm_mode(struct ieee80211_hw *hw, bool enable) struct mwl8k_cmd_set_wmm_mode *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3615,7 +3615,7 @@ static int mwl8k_cmd_mimo_config(struct ieee80211_hw *hw, __u8 rx, __u8 tx) struct mwl8k_cmd_mimo_config *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3658,7 +3658,7 @@ static int mwl8k_cmd_use_fixed_rate_sta(struct ieee80211_hw *hw) struct mwl8k_cmd_use_fixed_rate_sta *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3698,7 +3698,7 @@ mwl8k_cmd_use_fixed_rate_ap(struct ieee80211_hw *hw, int mcast, int mgmt) struct mwl8k_cmd_use_fixed_rate_ap *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3727,7 +3727,7 @@ static int mwl8k_cmd_enable_sniffer(struct ieee80211_hw *hw, bool enable) struct mwl8k_cmd_enable_sniffer *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3782,7 +3782,7 @@ static int mwl8k_cmd_update_mac_addr(struct ieee80211_hw *hw, mac_type = MWL8K_MAC_TYPE_SECONDARY_AP; } - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3837,7 +3837,7 @@ static int mwl8k_cmd_set_rateadapt_mode(struct ieee80211_hw *hw, __u16 mode) struct mwl8k_cmd_set_rate_adapt_mode *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3865,7 +3865,7 @@ static int mwl8k_cmd_get_watchdog_bitmap(struct ieee80211_hw *hw, u8 *bitmap) struct mwl8k_cmd_get_watchdog_bitmap *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -3954,7 +3954,7 @@ static int mwl8k_cmd_bss_start(struct ieee80211_hw *hw, if (!enable && !(priv->running_bsses & (1 << mwl8k_vif->macid))) return 0; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -4046,7 +4046,7 @@ mwl8k_check_ba(struct ieee80211_hw *hw, struct mwl8k_ampdu_stream *stream, struct mwl8k_cmd_bastream *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -4078,7 +4078,7 @@ mwl8k_create_ba(struct ieee80211_hw *hw, struct mwl8k_ampdu_stream *stream, struct mwl8k_cmd_bastream *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -4121,7 +4121,7 @@ static void mwl8k_destroy_ba(struct ieee80211_hw *hw, { struct mwl8k_cmd_bastream *cmd; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return; @@ -4173,7 +4173,7 @@ static int mwl8k_cmd_set_new_stn_add(struct ieee80211_hw *hw, u32 rates; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -4211,7 +4211,7 @@ static int mwl8k_cmd_set_new_stn_add_self(struct ieee80211_hw *hw, struct mwl8k_cmd_set_new_stn *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -4254,7 +4254,7 @@ static int mwl8k_cmd_set_new_stn_del(struct ieee80211_hw *hw, spin_unlock(&priv->stream_lock); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -4341,7 +4341,7 @@ static int mwl8k_cmd_update_encryption_enable(struct ieee80211_hw *hw, struct mwl8k_cmd_update_encryption *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -4410,7 +4410,7 @@ static int mwl8k_cmd_encryption_set_key(struct ieee80211_hw *hw, u8 idx; struct mwl8k_vif *mwl8k_vif = MWL8K_VIF(vif); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -4467,7 +4467,7 @@ static int mwl8k_cmd_encryption_remove_key(struct ieee80211_hw *hw, int rc; struct mwl8k_vif *mwl8k_vif = MWL8K_VIF(vif); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -4604,7 +4604,7 @@ static int mwl8k_cmd_update_stadb_add(struct ieee80211_hw *hw, u32 rates; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; @@ -4643,7 +4643,7 @@ static int mwl8k_cmd_update_stadb_del(struct ieee80211_hw *hw, struct mwl8k_cmd_update_stadb *cmd; int rc; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt76/agg-rx.c b/drivers/net/wireless/mediatek/mt76/agg-rx.c index 3d34caf7e4f7..144c336e13a2 100644 --- a/drivers/net/wireless/mediatek/mt76/agg-rx.c +++ b/drivers/net/wireless/mediatek/mt76/agg-rx.c @@ -248,7 +248,7 @@ int mt76_rx_aggr_start(struct mt76_dev *dev, struct mt76_wcid *wcid, u8 tidno, mt76_rx_aggr_stop(dev, wcid, tidno); - tid = kzalloc(struct_size(tid, reorder_buf, size), GFP_KERNEL); + tid = kzalloc_flex(*tid, reorder_buf, size, GFP_KERNEL); if (!tid) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index bd56cdb022a2..45992fdcec60 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -1055,7 +1055,7 @@ mt7615_mac_queue_rate_update(struct mt7615_phy *phy, struct mt7615_sta *sta, if (work_pending(&dev->rate_work)) return -EBUSY; - wrd = kzalloc(sizeof(*wrd), GFP_ATOMIC); + wrd = kzalloc_obj(*wrd, GFP_ATOMIC); if (!wrd) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c index beed795edb24..fee1f5ae0496 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c @@ -966,7 +966,7 @@ mt7996_mac_sta_init_link(struct mt7996_dev *dev, mtxq->wcid = idx; } } else { - msta_link = kzalloc(sizeof(*msta_link), GFP_KERNEL); + msta_link = kzalloc_obj(*msta_link, GFP_KERNEL); if (!msta_link) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c index 14a88ef79b6c..c0c042de477b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c @@ -726,7 +726,7 @@ mt7996_mcu_wed_rro_event(struct mt7996_dev *dev, struct sk_buff *skb) struct mt7996_wed_rro_session_id *session; e = (void *)skb->data; - session = kzalloc(sizeof(*session), GFP_ATOMIC); + session = kzalloc_obj(*session, GFP_ATOMIC); if (!session) break; diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c index c39e7f313ea1..edd4e570fe9f 100644 --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c @@ -484,15 +484,15 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, static int wilc_wfi_cfg_allocate_wpa_entry(struct wilc_priv *priv, u8 idx) { if (!priv->wilc_gtk[idx]) { - priv->wilc_gtk[idx] = kzalloc(sizeof(*priv->wilc_gtk[idx]), - GFP_KERNEL); + priv->wilc_gtk[idx] = kzalloc_obj(*priv->wilc_gtk[idx], + GFP_KERNEL); if (!priv->wilc_gtk[idx]) return -ENOMEM; } if (!priv->wilc_ptk[idx]) { - priv->wilc_ptk[idx] = kzalloc(sizeof(*priv->wilc_ptk[idx]), - GFP_KERNEL); + priv->wilc_ptk[idx] = kzalloc_obj(*priv->wilc_ptk[idx], + GFP_KERNEL); if (!priv->wilc_ptk[idx]) return -ENOMEM; } @@ -504,8 +504,8 @@ static int wilc_wfi_cfg_allocate_wpa_igtk_entry(struct wilc_priv *priv, u8 idx) { idx -= 4; if (!priv->wilc_igtk[idx]) { - priv->wilc_igtk[idx] = kzalloc(sizeof(*priv->wilc_igtk[idx]), - GFP_KERNEL); + priv->wilc_igtk[idx] = kzalloc_obj(*priv->wilc_igtk[idx], + GFP_KERNEL); if (!priv->wilc_igtk[idx]) return -ENOMEM; } @@ -1178,7 +1178,7 @@ static int mgmt_tx(struct wiphy *wiphy, if (!ieee80211_is_mgmt(mgmt->frame_control)) goto out; - mgmt_tx = kmalloc(sizeof(*mgmt_tx), GFP_KERNEL); + mgmt_tx = kmalloc_obj(*mgmt_tx, GFP_KERNEL); if (!mgmt_tx) { ret = -ENOMEM; goto out; diff --git a/drivers/net/wireless/microchip/wilc1000/hif.c b/drivers/net/wireless/microchip/wilc1000/hif.c index a229c6cab332..bbd1794acb27 100644 --- a/drivers/net/wireless/microchip/wilc1000/hif.c +++ b/drivers/net/wireless/microchip/wilc1000/hif.c @@ -60,7 +60,7 @@ wilc_alloc_work(struct wilc_vif *vif, void (*work_fun)(struct work_struct *), if (!work_fun) return ERR_PTR(-EINVAL); - msg = kzalloc(sizeof(*msg), GFP_ATOMIC); + msg = kzalloc_obj(*msg, GFP_ATOMIC); if (!msg) return ERR_PTR(-ENOMEM); msg->fn = work_fun; @@ -387,7 +387,7 @@ wilc_parse_join_bss_param(struct cfg80211_bss *bss, u64 ies_tsf; int ret; - param = kzalloc(sizeof(*param), GFP_KERNEL); + param = kzalloc_obj(*param, GFP_KERNEL); if (!param) return NULL; @@ -1039,7 +1039,7 @@ int wilc_set_external_auth_param(struct wilc_vif *vif, wid.id = WID_EXTERNAL_AUTH_PARAM; wid.type = WID_BIN_DATA; wid.size = sizeof(*param); - param = kzalloc(sizeof(*param), GFP_KERNEL); + param = kzalloc_obj(*param, GFP_KERNEL); if (!param) return -EINVAL; @@ -1516,7 +1516,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) struct host_if_drv *hif_drv; struct wilc_vif *vif = netdev_priv(dev); - hif_drv = kzalloc(sizeof(*hif_drv), GFP_KERNEL); + hif_drv = kzalloc_obj(*hif_drv, GFP_KERNEL); if (!hif_drv) return -ENOMEM; diff --git a/drivers/net/wireless/microchip/wilc1000/mon.c b/drivers/net/wireless/microchip/wilc1000/mon.c index c3d27aaec297..b5cf6fa7a851 100644 --- a/drivers/net/wireless/microchip/wilc1000/mon.c +++ b/drivers/net/wireless/microchip/wilc1000/mon.c @@ -120,7 +120,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) return -EFAULT; netif_stop_queue(dev); - mgmt_tx = kmalloc(sizeof(*mgmt_tx), GFP_ATOMIC); + mgmt_tx = kmalloc_obj(*mgmt_tx, GFP_ATOMIC); if (!mgmt_tx) return -ENOMEM; diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c index af298021e050..956cb578bf37 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.c +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c @@ -752,7 +752,7 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) return NETDEV_TX_OK; } - tx_data = kmalloc(sizeof(*tx_data), GFP_ATOMIC); + tx_data = kmalloc_obj(*tx_data, GFP_ATOMIC); if (!tx_data) { dev_kfree_skb(skb); netif_wake_queue(ndev); diff --git a/drivers/net/wireless/microchip/wilc1000/sdio.c b/drivers/net/wireless/microchip/wilc1000/sdio.c index af970f999111..64b1490b793d 100644 --- a/drivers/net/wireless/microchip/wilc1000/sdio.c +++ b/drivers/net/wireless/microchip/wilc1000/sdio.c @@ -145,7 +145,7 @@ static int wilc_sdio_probe(struct sdio_func *func, int ret; - sdio_priv = kzalloc(sizeof(*sdio_priv), GFP_KERNEL); + sdio_priv = kzalloc_obj(*sdio_priv, GFP_KERNEL); if (!sdio_priv) return -ENOMEM; diff --git a/drivers/net/wireless/microchip/wilc1000/spi.c b/drivers/net/wireless/microchip/wilc1000/spi.c index 5bcabb7decea..cad1fcf2e14f 100644 --- a/drivers/net/wireless/microchip/wilc1000/spi.c +++ b/drivers/net/wireless/microchip/wilc1000/spi.c @@ -211,7 +211,7 @@ static int wilc_bus_probe(struct spi_device *spi) struct wilc *wilc; int ret; - spi_priv = kzalloc(sizeof(*spi_priv), GFP_KERNEL); + spi_priv = kzalloc_obj(*spi_priv, GFP_KERNEL); if (!spi_priv) return -ENOMEM; diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c index fedc7d59216a..15a2221892cd 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan.c +++ b/drivers/net/wireless/microchip/wilc1000/wlan.c @@ -244,7 +244,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, u8 *buffer, return 0; } - tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC); + tqe = kmalloc_obj(*tqe, GFP_ATOMIC); if (!tqe) { complete(&wilc->cfg_event); return 0; @@ -413,7 +413,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, return 0; } - tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC); + tqe = kmalloc_obj(*tqe, GFP_ATOMIC); if (!tqe) { tx_complete_fn(tx_data, 0); @@ -466,7 +466,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, tx_complete_fn(priv, 0); return 0; } - tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC); + tqe = kmalloc_obj(*tqe, GFP_ATOMIC); if (!tqe) { tx_complete_fn(priv, 0); @@ -1209,7 +1209,7 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) offset += size; wilc->rx_buffer_offset = offset; - rqe = kmalloc(sizeof(*rqe), GFP_KERNEL); + rqe = kmalloc_obj(*rqe, GFP_KERNEL); if (!rqe) return; diff --git a/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c b/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c index cfabd5aebb54..0163f0b17497 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c +++ b/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c @@ -390,7 +390,7 @@ int wilc_wlan_cfg_init(struct wilc *wl) if (!wl->cfg.s) goto out_w; - str_vals = kzalloc(sizeof(*str_vals), GFP_KERNEL); + str_vals = kzalloc_obj(*str_vals, GFP_KERNEL); if (!str_vals) goto out_s; diff --git a/drivers/net/wireless/purelifi/plfxlc/usb.c b/drivers/net/wireless/purelifi/plfxlc/usb.c index 711902a809db..09303aa6c1d7 100644 --- a/drivers/net/wireless/purelifi/plfxlc/usb.c +++ b/drivers/net/wireless/purelifi/plfxlc/usb.c @@ -204,7 +204,7 @@ static int __lf_x_usb_enable_rx(struct plfxlc_usb *usb) int i, r; r = -ENOMEM; - urbs = kcalloc(RX_URBS_COUNT, sizeof(struct urb *), GFP_KERNEL); + urbs = kzalloc_objs(struct urb *, RX_URBS_COUNT, GFP_KERNEL); if (!urbs) goto error; diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 956c5763662f..b1908fa90cfa 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -981,7 +981,7 @@ qtnf_parse_wowlan_info(struct qtnf_wmac *mac, const struct qlink_wowlan_support *data1; struct wiphy_wowlan_support *supp; - supp = kzalloc(sizeof(*supp), GFP_KERNEL); + supp = kzalloc_obj(*supp, GFP_KERNEL); if (!supp) return; @@ -1031,8 +1031,8 @@ qtnf_parse_variable_mac_info(struct qtnf_wmac *mac, if (WARN_ON(resp->n_reg_rules > NL80211_MAX_SUPP_REG_RULES)) return -E2BIG; - mac->rd = kzalloc(struct_size(mac->rd, reg_rules, resp->n_reg_rules), - GFP_KERNEL); + mac->rd = kzalloc_flex(*mac->rd, reg_rules, resp->n_reg_rules, + GFP_KERNEL); if (!mac->rd) return -ENOMEM; @@ -1084,8 +1084,8 @@ qtnf_parse_variable_mac_info(struct qtnf_wmac *mac, return -EINVAL; } - limits = kcalloc(rec->n_limits, sizeof(*limits), - GFP_KERNEL); + limits = kzalloc_objs(*limits, rec->n_limits, + GFP_KERNEL); if (!limits) return -ENOMEM; @@ -1254,9 +1254,8 @@ qtnf_cmd_resp_proc_mac_info(struct qtnf_wmac *mac, sizeof(mac_info->vht_cap_mod_mask)); mac_info->n_if_comb = resp_info->n_iface_combinations; - mac_info->if_comb = kcalloc(mac->macinfo.n_if_comb, - sizeof(*mac->macinfo.if_comb), - GFP_KERNEL); + mac_info->if_comb = kzalloc_objs(*mac->macinfo.if_comb, + mac->macinfo.n_if_comb, GFP_KERNEL); if (!mac->macinfo.if_comb) return -ENOMEM; @@ -1341,8 +1340,8 @@ static int qtnf_cmd_band_fill_iftype(const u8 *data, if (band->n_iftype_data == 0) return 0; - iftype_data = kcalloc(band->n_iftype_data, sizeof(*iftype_data), - GFP_KERNEL); + iftype_data = kzalloc_objs(*iftype_data, band->n_iftype_data, + GFP_KERNEL); if (!iftype_data) { band->n_iftype_data = 0; return -ENOMEM; @@ -1389,8 +1388,8 @@ qtnf_cmd_resp_fill_band_info(struct ieee80211_supported_band *band, return 0; if (!band->channels) - band->channels = kcalloc(band->n_channels, sizeof(*chan), - GFP_KERNEL); + band->channels = kzalloc_objs(*chan, band->n_channels, + GFP_KERNEL); if (!band->channels) { band->n_channels = 0; return -ENOMEM; diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c index 38af6cdc2843..4cab8dee332b 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.c +++ b/drivers/net/wireless/quantenna/qtnfmac/core.c @@ -212,7 +212,7 @@ static int qtnf_mac_init_single_band(struct wiphy *wiphy, { int ret; - wiphy->bands[band] = kzalloc(sizeof(*wiphy->bands[band]), GFP_KERNEL); + wiphy->bands[band] = kzalloc_obj(*wiphy->bands[band], GFP_KERNEL); if (!wiphy->bands[band]) return -ENOMEM; diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c index 71840f41b73c..c16cd1e5286a 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/event.c +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c @@ -41,7 +41,7 @@ qtnf_event_handle_sta_assoc(struct qtnf_wmac *mac, struct qtnf_vif *vif, return -EPROTO; } - sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); + sinfo = kzalloc_obj(*sinfo, GFP_KERNEL); if (!sinfo) return -ENOMEM; diff --git a/drivers/net/wireless/quantenna/qtnfmac/util.c b/drivers/net/wireless/quantenna/qtnfmac/util.c index cda6f5f3f38a..5c1a5a8f87a6 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/util.c +++ b/drivers/net/wireless/quantenna/qtnfmac/util.c @@ -59,7 +59,7 @@ struct qtnf_sta_node *qtnf_sta_list_add(struct qtnf_vif *vif, if (node) goto done; - node = kzalloc(sizeof(*node), GFP_KERNEL); + node = kzalloc_obj(*node, GFP_KERNEL); if (unlikely(!node)) goto done; diff --git a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c index 42e21e9f303b..f2b55db0b27b 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c @@ -1589,7 +1589,7 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) /* * Create channel information array */ - info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); + info = kzalloc_objs(*info, spec->num_channels, GFP_KERNEL); if (!info) return -ENOMEM; diff --git a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c index 36ddc5a69fa4..a6b26c5ef4cf 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c @@ -1907,7 +1907,7 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) /* * Create channel information array */ - info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); + info = kzalloc_objs(*info, spec->num_channels, GFP_KERNEL); if (!info) return -ENOMEM; diff --git a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c index 09923765e2db..50f1eeddf913 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c @@ -1720,7 +1720,7 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) /* * Create channel information array */ - info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); + info = kzalloc_objs(*info, spec->num_channels, GFP_KERNEL); if (!info) return -ENOMEM; diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index 65d0f805459c..6041f029857b 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -11907,13 +11907,13 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) /* * Create channel information and survey arrays */ - info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); + info = kzalloc_objs(*info, spec->num_channels, GFP_KERNEL); if (!info) return -ENOMEM; rt2x00dev->chan_survey = - kcalloc(spec->num_channels, sizeof(struct rt2x00_chan_survey), - GFP_KERNEL); + kzalloc_objs(struct rt2x00_chan_survey, spec->num_channels, + GFP_KERNEL); if (!rt2x00dev->chan_survey) { kfree(info); return -ENOMEM; diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c index b51a23300ba2..d1d94b0b0f31 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c @@ -179,7 +179,7 @@ static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev) u32 fw_mode; int ret; - reg = kmalloc(sizeof(*reg), GFP_KERNEL); + reg = kmalloc_obj(*reg, GFP_KERNEL); if (reg == NULL) return -ENOMEM; /* cannot use rt2x00usb_register_read here as it uses different diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c index f2395309ec00..edececd89572 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c @@ -639,7 +639,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) struct dentry *queue_folder; struct dentry *register_folder; - intf = kzalloc(sizeof(struct rt2x00debug_intf), GFP_KERNEL); + intf = kzalloc_obj(struct rt2x00debug_intf, GFP_KERNEL); if (!intf) { rt2x00_err(rt2x00dev, "Failed to allocate debug handler\n"); return; diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c index 778a478ab53a..dee01472747f 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c @@ -1020,11 +1020,11 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, if (spec->supported_rates & SUPPORT_RATE_OFDM) num_rates += 8; - channels = kcalloc(spec->num_channels, sizeof(*channels), GFP_KERNEL); + channels = kzalloc_objs(*channels, spec->num_channels, GFP_KERNEL); if (!channels) return -ENOMEM; - rates = kcalloc(num_rates, sizeof(*rates), GFP_KERNEL); + rates = kzalloc_objs(*rates, num_rates, GFP_KERNEL); if (!rates) goto exit_free_channels; diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c index 13e48b1e7356..8fb336834ced 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c @@ -564,7 +564,7 @@ static void rt2x00queue_bar_check(struct queue_entry *entry) if (likely(!ieee80211_is_back_req(bar->frame_control))) return; - bar_entry = kmalloc(sizeof(*bar_entry), GFP_ATOMIC); + bar_entry = kmalloc_obj(*bar_entry, GFP_ATOMIC); /* * If the alloc fails we still send the BAR out but just don't track @@ -1244,7 +1244,7 @@ int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev) */ rt2x00dev->data_queues = 2 + rt2x00dev->ops->tx_queues + req_atim; - queue = kcalloc(rt2x00dev->data_queues, sizeof(*queue), GFP_KERNEL); + queue = kzalloc_objs(*queue, rt2x00dev->data_queues, GFP_KERNEL); if (!queue) return -ENOMEM; diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c index a6d50149e0c3..54599cad78f9 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c @@ -196,7 +196,7 @@ void rt2x00usb_register_read_async(struct rt2x00_dev *rt2x00dev, struct urb *urb; struct rt2x00_async_read_data *rd; - rd = kmalloc(sizeof(*rd), GFP_ATOMIC); + rd = kmalloc_obj(*rd, GFP_ATOMIC); if (!rd) return; diff --git a/drivers/net/wireless/ralink/rt2x00/rt61pci.c b/drivers/net/wireless/ralink/rt2x00/rt61pci.c index d1cd5694e3c7..aea74b6b28e4 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c +++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c @@ -2712,7 +2712,7 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) /* * Create channel information array */ - info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); + info = kzalloc_objs(*info, spec->num_channels, GFP_KERNEL); if (!info) return -ENOMEM; diff --git a/drivers/net/wireless/ralink/rt2x00/rt73usb.c b/drivers/net/wireless/ralink/rt2x00/rt73usb.c index b79dda952a33..c47f4689ffdd 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c +++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c @@ -2136,7 +2136,7 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) /* * Create channel information array */ - info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); + info = kzalloc_objs(*info, spec->num_channels, GFP_KERNEL); if (!info) return -ENOMEM; diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c index 7aa2da0cd63c..7a2a31af9a79 100644 --- a/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c +++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c @@ -129,7 +129,7 @@ static void rtl8187_iowrite_async(struct rtl8187_priv *priv, __le16 addr, } *buf; int rc; - buf = kmalloc(sizeof(*buf), GFP_ATOMIC); + buf = kmalloc_obj(*buf, GFP_ATOMIC); if (!buf) return; @@ -1463,7 +1463,7 @@ static int rtl8187_probe(struct usb_interface *intf, priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B); /* allocate "DMA aware" buffer for register accesses */ - priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf), GFP_KERNEL); + priv->io_dmabuf = kmalloc_obj(*priv->io_dmabuf, GFP_KERNEL); if (!priv->io_dmabuf) { err = -ENOMEM; goto err_free_dev; diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c index f9a527f6a175..721c95f13ec9 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c @@ -7323,7 +7323,7 @@ static void rtl8xxxu_collect_sta_iter(void *data, struct ieee80211_sta *sta) struct rtl8xxxu_iter_stas_data *iter_stas = data; struct rtl8xxxu_stas_entry *stas_entry; - stas_entry = kmalloc(sizeof(*stas_entry), GFP_ATOMIC); + stas_entry = kmalloc_obj(*stas_entry, GFP_ATOMIC); if (!stas_entry) return; @@ -7381,7 +7381,7 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw) } for (i = 0; i < RTL8XXXU_TX_URBS; i++) { - tx_urb = kmalloc(sizeof(struct rtl8xxxu_tx_urb), GFP_KERNEL); + tx_urb = kmalloc_obj(struct rtl8xxxu_tx_urb, GFP_KERNEL); if (!tx_urb) { if (!i) ret = -ENOMEM; @@ -7402,7 +7402,7 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw) spin_unlock_irqrestore(&priv->rx_urb_lock, flags); for (i = 0; i < RTL8XXXU_RX_URBS; i++) { - rx_urb = kmalloc(sizeof(struct rtl8xxxu_rx_urb), GFP_KERNEL); + rx_urb = kmalloc_obj(struct rtl8xxxu_rx_urb, GFP_KERNEL); if (!rx_urb) { if (!i) ret = -ENOMEM; diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c index 09e5a16d7252..0ac9cf0937aa 100644 --- a/drivers/net/wireless/realtek/rtlwifi/base.c +++ b/drivers/net/wireless/realtek/rtlwifi/base.c @@ -2011,7 +2011,7 @@ void rtl_collect_scan_list(struct ieee80211_hw *hw, struct sk_buff *skb) } if (!entry) { - entry = kmalloc(sizeof(*entry), GFP_ATOMIC); + entry = kmalloc_obj(*entry, GFP_ATOMIC); if (!entry) goto label_err; diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c index e88d92d3ae7a..332f90e4d83f 100644 --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c @@ -132,10 +132,10 @@ static void rtl_btc_alloc_variable(struct rtl_priv *rtlpriv, bool wifi_only) { if (wifi_only) rtlpriv->btcoexist.wifi_only_context = - kzalloc(sizeof(struct wifi_only_cfg), GFP_KERNEL); + kzalloc_obj(struct wifi_only_cfg, GFP_KERNEL); else rtlpriv->btcoexist.btc_context = - kzalloc(sizeof(struct btc_coexist), GFP_KERNEL); + kzalloc_obj(struct btc_coexist, GFP_KERNEL); } static void rtl_btc_free_variable(struct rtl_priv *rtlpriv) diff --git a/drivers/net/wireless/realtek/rtlwifi/rc.c b/drivers/net/wireless/realtek/rtlwifi/rc.c index a164364109ba..dcfaa98198b6 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rc.c +++ b/drivers/net/wireless/realtek/rtlwifi/rc.c @@ -278,7 +278,7 @@ static void *rtl_rate_alloc_sta(void *ppriv, struct rtl_priv *rtlpriv = ppriv; struct rtl_rate_priv *rate_priv; - rate_priv = kzalloc(sizeof(*rate_priv), gfp); + rate_priv = kzalloc_obj(*rate_priv, gfp); if (!rate_priv) return NULL; diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c index cc699efa9c79..1f927dd9e152 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c @@ -70,10 +70,10 @@ static int rtl92du_init_shared_data(struct ieee80211_hw *hw) rtlpriv->curveindex_5g = kcalloc(TARGET_CHNL_NUM_5G, sizeof(*rtlpriv->curveindex_5g), GFP_KERNEL); - rtlpriv->mutex_for_power_on_off = - kzalloc(sizeof(*rtlpriv->mutex_for_power_on_off), GFP_KERNEL); - rtlpriv->mutex_for_hw_init = - kzalloc(sizeof(*rtlpriv->mutex_for_hw_init), GFP_KERNEL); + rtlpriv->mutex_for_power_on_off = kzalloc_obj(*rtlpriv->mutex_for_power_on_off, + GFP_KERNEL); + rtlpriv->mutex_for_hw_init = kzalloc_obj(*rtlpriv->mutex_for_hw_init, + GFP_KERNEL); if (!rtlpriv->curveindex_2g || !rtlpriv->curveindex_5g || !rtlpriv->mutex_for_power_on_off || !rtlpriv->mutex_for_hw_init) { diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c index c68a9fff6808..a3e5b0963cb7 100644 --- a/drivers/net/wireless/realtek/rtw88/fw.c +++ b/drivers/net/wireless/realtek/rtw88/fw.c @@ -1331,7 +1331,7 @@ static struct rtw_rsvd_page *rtw_alloc_rsvd_page(struct rtw_dev *rtwdev, { struct rtw_rsvd_page *rsvd_pkt = NULL; - rsvd_pkt = kzalloc(sizeof(*rsvd_pkt), GFP_KERNEL); + rsvd_pkt = kzalloc_obj(*rsvd_pkt, GFP_KERNEL); if (!rsvd_pkt) return NULL; diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c index 138e9e348c6c..b42840271051 100644 --- a/drivers/net/wireless/realtek/rtw88/sdio.c +++ b/drivers/net/wireless/realtek/rtw88/sdio.c @@ -1290,8 +1290,8 @@ static int rtw_sdio_init_tx(struct rtw_dev *rtwdev) for (i = 0; i < RTK_MAX_TX_QUEUE_NUM; i++) skb_queue_head_init(&rtwsdio->tx_queue[i]); - rtwsdio->tx_handler_data = kmalloc(sizeof(*rtwsdio->tx_handler_data), - GFP_KERNEL); + rtwsdio->tx_handler_data = kmalloc_obj(*rtwsdio->tx_handler_data, + GFP_KERNEL); if (!rtwsdio->tx_handler_data) goto err_destroy_wq; diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c index db60e142268d..433b06c8d8a6 100644 --- a/drivers/net/wireless/realtek/rtw88/usb.c +++ b/drivers/net/wireless/realtek/rtw88/usb.c @@ -403,7 +403,7 @@ static bool rtw_usb_tx_agg_skb(struct rtw_usb *rtwusb, struct sk_buff_head *list if (skb_queue_empty(list)) return false; - txcb = kmalloc(sizeof(*txcb), GFP_ATOMIC); + txcb = kmalloc_obj(*txcb, GFP_ATOMIC); if (!txcb) return false; diff --git a/drivers/net/wireless/realtek/rtw88/util.c b/drivers/net/wireless/realtek/rtw88/util.c index 66819f694405..fcd6eb1ab32a 100644 --- a/drivers/net/wireless/realtek/rtw88/util.c +++ b/drivers/net/wireless/realtek/rtw88/util.c @@ -122,7 +122,7 @@ static void rtw_collect_sta_iter(void *data, struct ieee80211_sta *sta) struct rtw_iter_stas_data *iter_stas = data; struct rtw_stas_entry *stas_entry; - stas_entry = kmalloc(sizeof(*stas_entry), GFP_ATOMIC); + stas_entry = kmalloc_obj(*stas_entry, GFP_ATOMIC); if (!stas_entry) return; @@ -172,7 +172,7 @@ static void rtw_collect_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) struct rtw_iter_vifs_data *iter_stas = data; struct rtw_vifs_entry *vifs_entry; - vifs_entry = kmalloc(sizeof(*vifs_entry), GFP_ATOMIC); + vifs_entry = kmalloc_obj(*vifs_entry, GFP_ATOMIC); if (!vifs_entry) return; diff --git a/drivers/net/wireless/realtek/rtw89/acpi.c b/drivers/net/wireless/realtek/rtw89/acpi.c index f1e758a5f32b..0853b2e49675 100644 --- a/drivers/net/wireless/realtek/rtw89/acpi.c +++ b/drivers/net/wireless/realtek/rtw89/acpi.c @@ -115,7 +115,7 @@ rtw89_acpi_evaluate_method(struct rtw89_dev *rtwdev, const char *method) goto out; } - data = kzalloc(struct_size(data, buf, len), GFP_KERNEL); + data = kzalloc_flex(*data, buf, len, GFP_KERNEL); if (!data) goto out; diff --git a/drivers/net/wireless/realtek/rtw89/cam.c b/drivers/net/wireless/realtek/rtw89/cam.c index 9f63d67777fa..949f304216e2 100644 --- a/drivers/net/wireless/realtek/rtw89/cam.c +++ b/drivers/net/wireless/realtek/rtw89/cam.c @@ -420,7 +420,7 @@ static int rtw89_cam_sec_key_install(struct rtw89_dev *rtwdev, return ret; } - sec_cam = kzalloc(sizeof(*sec_cam), GFP_KERNEL); + sec_cam = kzalloc_obj(*sec_cam, GFP_KERNEL); if (!sec_cam) { ret = -ENOMEM; goto err_release_cam; diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c index 6e77522bcd8f..3295f76a0f1c 100644 --- a/drivers/net/wireless/realtek/rtw89/core.c +++ b/drivers/net/wireless/realtek/rtw89/core.c @@ -4220,7 +4220,7 @@ int rtw89_core_send_nullfunc(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rt if (vif->type != NL80211_IFTYPE_STATION || !vif->cfg.assoc) return 0; - wait = kzalloc(sizeof(*wait), GFP_KERNEL); + wait = kzalloc_obj(*wait, GFP_KERNEL); if (!wait) return -ENOMEM; @@ -5657,7 +5657,7 @@ rtw89_wait_for_cond_prep(struct rtw89_wait_info *wait, unsigned int cond) if (cur != RTW89_WAIT_COND_IDLE) return ERR_PTR(-EPERM); - prep = kzalloc(sizeof(*prep), GFP_KERNEL); + prep = kzalloc_obj(*prep, GFP_KERNEL); if (!prep) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c index 06a9504d2bad..fb89660ba70c 100644 --- a/drivers/net/wireless/realtek/rtw89/debug.c +++ b/drivers/net/wireless/realtek/rtw89/debug.c @@ -3524,7 +3524,7 @@ rtw89_debug_priv_early_h2c_set(struct rtw89_dev *rtwdev, goto out; } - early_h2c = kmalloc(sizeof(*early_h2c), GFP_KERNEL); + early_h2c = kmalloc_obj(*early_h2c, GFP_KERNEL); if (!early_h2c) { kfree(h2c); return -EFAULT; diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c index f84726f04669..97c58a2fa399 100644 --- a/drivers/net/wireless/realtek/rtw89/fw.c +++ b/drivers/net/wireless/realtek/rtw89/fw.c @@ -1099,12 +1099,12 @@ int rtw89_build_phy_tbl_from_elm(struct rtw89_dev *rtwdev, else if (*pp) return 1; /* ignore if an element is existing */ - tbl = kzalloc(sizeof(*tbl), GFP_KERNEL); + tbl = kzalloc_obj(*tbl, GFP_KERNEL); if (!tbl) return -ENOMEM; n_regs = le32_to_cpu(elm->size) / sizeof(tbl->regs[0]); - regs = kcalloc(n_regs, sizeof(*regs), GFP_KERNEL); + regs = kzalloc_objs(*regs, n_regs, GFP_KERNEL); if (!regs) goto out; @@ -1141,7 +1141,7 @@ int rtw89_fw_recognize_txpwr_from_elm(struct rtw89_dev *rtwdev, struct rtw89_txpwr_conf *conf; if (!rtwdev->rfe_data) { - rtwdev->rfe_data = kzalloc(sizeof(*rtwdev->rfe_data), GFP_KERNEL); + rtwdev->rfe_data = kzalloc_obj(*rtwdev->rfe_data, GFP_KERNEL); if (!rtwdev->rfe_data) return -ENOMEM; } @@ -1201,7 +1201,7 @@ int rtw89_build_txpwr_trk_tbl_from_elm(struct rtw89_dev *rtwdev, return -ENOENT; } - elm_info->txpwr_trk = kzalloc(sizeof(*elm_info->txpwr_trk), GFP_KERNEL); + elm_info->txpwr_trk = kzalloc_obj(*elm_info->txpwr_trk, GFP_KERNEL); if (!elm_info->txpwr_trk) return -ENOMEM; @@ -1250,7 +1250,7 @@ int rtw89_build_rfk_log_fmt_from_elm(struct rtw89_dev *rtwdev, if (elm_info->rfk_log_fmt) goto allocated; - elm_info->rfk_log_fmt = kzalloc(sizeof(*elm_info->rfk_log_fmt), GFP_KERNEL); + elm_info->rfk_log_fmt = kzalloc_obj(*elm_info->rfk_log_fmt, GFP_KERNEL); if (!elm_info->rfk_log_fmt) return 1; /* this is an optional element, so just ignore this */ @@ -2944,7 +2944,7 @@ static int rtw89_fw_h2c_add_general_pkt(struct rtw89_dev *rtwdev, struct sk_buff *skb; int ret; - info = kzalloc(sizeof(*info), GFP_KERNEL); + info = kzalloc_obj(*info, GFP_KERNEL); if (!info) return -ENOMEM; @@ -8138,7 +8138,7 @@ static int rtw89_append_probe_req_ie(struct rtw89_dev *rtwdev, skb_put_data(new, ies->ies[band], ies->len[band]); skb_put_data(new, ies->common_ies, ies->common_ie_len); - info = kzalloc(sizeof(*info), GFP_KERNEL); + info = kzalloc_obj(*info, GFP_KERNEL); if (!info) { ret = -ENOMEM; kfree_skb(new); @@ -8234,7 +8234,7 @@ static int rtw89_update_6ghz_rnr_chan_ax(struct rtw89_dev *rtwdev, hdr = (struct ieee80211_hdr *)skb->data; ether_addr_copy(hdr->addr3, params->bssid); - info = kzalloc(sizeof(*info), GFP_KERNEL); + info = kzalloc_obj(*info, GFP_KERNEL); if (!info) { ret = -ENOMEM; kfree_skb(skb); @@ -8527,7 +8527,7 @@ int rtw89_pno_scan_add_chan_list_ax(struct rtw89_dev *rtwdev, idx < nd_config->n_channels && list_len < RTW89_SCAN_LIST_LIMIT_AX; idx++, list_len++) { channel = nd_config->channels[idx]; - ch_info = kzalloc(sizeof(*ch_info), GFP_KERNEL); + ch_info = kzalloc_obj(*ch_info, GFP_KERNEL); if (!ch_info) { ret = -ENOMEM; goto out; @@ -8567,7 +8567,7 @@ static int rtw89_hw_scan_add_op_types_ax(struct rtw89_dev *rtwdev, { struct rtw89_mac_chinfo_ax *tmp; - tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); + tmp = kzalloc_obj(*tmp, GFP_KERNEL); if (!tmp) return -ENOMEM; @@ -8613,7 +8613,7 @@ int rtw89_hw_scan_prep_chan_list_ax(struct rtw89_dev *rtwdev, for (idx = 0; idx < req->n_channels; idx++) { channel = req->channels[idx]; - ch_info = kzalloc(sizeof(*ch_info), GFP_KERNEL); + ch_info = kzalloc_obj(*ch_info, GFP_KERNEL); if (!ch_info) { ret = -ENOMEM; goto out; @@ -8745,7 +8745,7 @@ int rtw89_pno_scan_add_chan_list_be(struct rtw89_dev *rtwdev, idx < nd_config->n_channels && list_len < RTW89_SCAN_LIST_LIMIT_BE; idx++, list_len++) { channel = nd_config->channels[idx]; - ch_info = kzalloc(sizeof(*ch_info), GFP_KERNEL); + ch_info = kzalloc_obj(*ch_info, GFP_KERNEL); if (!ch_info) { ret = -ENOMEM; goto out; @@ -8807,7 +8807,7 @@ int rtw89_hw_scan_prep_chan_list_be(struct rtw89_dev *rtwdev, !cfg80211_channel_is_psc(channel) && chan_by_rnr) continue; - ch_info = kzalloc(sizeof(*ch_info), GFP_KERNEL); + ch_info = kzalloc_obj(*ch_info, GFP_KERNEL); if (!ch_info) { ret = -ENOMEM; goto out; diff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wireless/realtek/rtw89/mac80211.c index 315bb0d0759f..594af3b7201b 100644 --- a/drivers/net/wireless/realtek/rtw89/mac80211.c +++ b/drivers/net/wireless/realtek/rtw89/mac80211.c @@ -1666,7 +1666,7 @@ int rtw89_ops_change_vif_links(struct ieee80211_hw *hw, return -EOPNOTSUPP; if (removing_links) { - snap = kzalloc(sizeof(*snap), GFP_KERNEL); + snap = kzalloc_obj(*snap, GFP_KERNEL); if (!snap) return -ENOMEM; diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c index 6c6d5f1da867..eb2e2191408a 100644 --- a/drivers/net/wireless/realtek/rtw89/phy.c +++ b/drivers/net/wireless/realtek/rtw89/phy.c @@ -1975,7 +1975,7 @@ void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev, bool noio) struct rtw89_fw_h2c_rf_reg_info *rf_reg_info; u8 path; - rf_reg_info = kzalloc(sizeof(*rf_reg_info), GFP_KERNEL); + rf_reg_info = kzalloc_obj(*rf_reg_info, GFP_KERNEL); if (!rf_reg_info) return; diff --git a/drivers/net/wireless/realtek/rtw89/sar.c b/drivers/net/wireless/realtek/rtw89/sar.c index ef7feccccd5e..994ebbd8d267 100644 --- a/drivers/net/wireless/realtek/rtw89/sar.c +++ b/drivers/net/wireless/realtek/rtw89/sar.c @@ -501,7 +501,7 @@ static void rtw89_set_sar_from_acpi(struct rtw89_dev *rtwdev) struct rtw89_sar_cfg_acpi *cfg; int ret; - cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); + cfg = kzalloc_obj(*cfg, GFP_KERNEL); if (!cfg) return; diff --git a/drivers/net/wireless/realtek/rtw89/ser.c b/drivers/net/wireless/realtek/rtw89/ser.c index 7fdc69578da3..f91e66133b30 100644 --- a/drivers/net/wireless/realtek/rtw89/ser.c +++ b/drivers/net/wireless/realtek/rtw89/ser.c @@ -210,7 +210,7 @@ static int ser_send_msg(struct rtw89_ser *ser, u8 event) if (test_bit(RTW89_SER_DRV_STOP_RUN, ser->flags)) return -EIO; - msg = kmalloc(sizeof(*msg), GFP_ATOMIC); + msg = kmalloc_obj(*msg, GFP_ATOMIC); if (!msg) return -ENOMEM; diff --git a/drivers/net/wireless/realtek/rtw89/usb.c b/drivers/net/wireless/realtek/rtw89/usb.c index e77561a4d971..95b5c1cfdce4 100644 --- a/drivers/net/wireless/realtek/rtw89/usb.c +++ b/drivers/net/wireless/realtek/rtw89/usb.c @@ -294,7 +294,7 @@ static void rtw89_usb_ops_tx_kick_off(struct rtw89_dev *rtwdev, u8 txch) if (!skb) break; - txcb = kmalloc(sizeof(*txcb), GFP_ATOMIC); + txcb = kmalloc_obj(*txcb, GFP_ATOMIC); if (!txcb) { rtw89_usb_tx_free_skb(rtwdev, txch, skb); continue; @@ -931,8 +931,8 @@ static int rtw89_usb_intf_init(struct rtw89_dev *rtwdev, if (ret) return ret; - rtwusb->vendor_req_buf = kmalloc(sizeof(*rtwusb->vendor_req_buf), - GFP_KERNEL); + rtwusb->vendor_req_buf = kmalloc_obj(*rtwusb->vendor_req_buf, + GFP_KERNEL); if (!rtwusb->vendor_req_buf) return -ENOMEM; diff --git a/drivers/net/wireless/realtek/rtw89/wow.c b/drivers/net/wireless/realtek/rtw89/wow.c index b67ceda59e92..6954ca8f0b35 100644 --- a/drivers/net/wireless/realtek/rtw89/wow.c +++ b/drivers/net/wireless/realtek/rtw89/wow.c @@ -1490,7 +1490,7 @@ static int rtw89_pno_scan_update_probe_req(struct rtw89_dev *rtwdev, skb_put_data(skb, basic_rate_ie, sizeof(basic_rate_ie)); skb_put_data(skb, nd_config->ie, nd_config->ie_len); - info = kzalloc(sizeof(*info), GFP_KERNEL); + info = kzalloc_obj(*info, GFP_KERNEL); if (!info) { kfree_skb(skb); rtw89_fw_release_pno_pkt_list(rtwdev, rtwvif_link); diff --git a/drivers/net/wireless/rsi/rsi_91x_coex.c b/drivers/net/wireless/rsi/rsi_91x_coex.c index 372eaaa2b9ef..5bc8c30f2721 100644 --- a/drivers/net/wireless/rsi/rsi_91x_coex.c +++ b/drivers/net/wireless/rsi/rsi_91x_coex.c @@ -140,7 +140,7 @@ int rsi_coex_attach(struct rsi_common *common) struct rsi_coex_ctrl_block *coex_cb; int cnt; - coex_cb = kzalloc(sizeof(*coex_cb), GFP_KERNEL); + coex_cb = kzalloc_obj(*coex_cb, GFP_KERNEL); if (!coex_cb) return -ENOMEM; diff --git a/drivers/net/wireless/rsi/rsi_91x_debugfs.c b/drivers/net/wireless/rsi/rsi_91x_debugfs.c index c528e6ca2c8d..ea1766b967ee 100644 --- a/drivers/net/wireless/rsi/rsi_91x_debugfs.c +++ b/drivers/net/wireless/rsi/rsi_91x_debugfs.c @@ -285,7 +285,7 @@ int rsi_init_dbgfs(struct rsi_hw *adapter) int ii; const struct rsi_dbg_files *files; - dev_dbgfs = kzalloc(sizeof(*dev_dbgfs), GFP_KERNEL); + dev_dbgfs = kzalloc_obj(*dev_dbgfs, GFP_KERNEL); if (!dev_dbgfs) return -ENOMEM; diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c index 7d26314a3e76..9e65db2f6460 100644 --- a/drivers/net/wireless/rsi/rsi_91x_hal.c +++ b/drivers/net/wireless/rsi/rsi_91x_hal.c @@ -647,7 +647,7 @@ static int bl_write_header(struct rsi_hw *adapter, u8 *flash_content, u32 write_addr, write_len; int status; - bl_hdr = kzalloc(sizeof(*bl_hdr), GFP_KERNEL); + bl_hdr = kzalloc_obj(*bl_hdr, GFP_KERNEL); if (!bl_hdr) return -ENOMEM; diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless/rsi/rsi_91x_main.c index a9bb37d5d581..c936e40ac871 100644 --- a/drivers/net/wireless/rsi/rsi_91x_main.c +++ b/drivers/net/wireless/rsi/rsi_91x_main.c @@ -304,11 +304,11 @@ struct rsi_hw *rsi_91x_init(u16 oper_mode) struct rsi_common *common = NULL; u8 ii = 0; - adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); + adapter = kzalloc_obj(*adapter, GFP_KERNEL); if (!adapter) return NULL; - adapter->priv = kzalloc(sizeof(*common), GFP_KERNEL); + adapter->priv = kzalloc_obj(*common, GFP_KERNEL); if (adapter->priv == NULL) { rsi_dbg(ERR_ZONE, "%s: Failed in allocation of memory\n", __func__); diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c index ee7ad81c858d..51932a434d89 100644 --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c @@ -828,7 +828,7 @@ static int rsi_init_sdio_interface(struct rsi_hw *adapter, struct rsi_91x_sdiodev *rsi_91x_dev; int status; - rsi_91x_dev = kzalloc(sizeof(*rsi_91x_dev), GFP_KERNEL); + rsi_91x_dev = kzalloc_obj(*rsi_91x_dev, GFP_KERNEL); if (!rsi_91x_dev) return -ENOMEM; diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c index dccc139cabb2..b0238103c13b 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c @@ -620,7 +620,7 @@ static int rsi_init_usb_interface(struct rsi_hw *adapter, struct rsi_91x_usbdev *rsi_dev; int status; - rsi_dev = kzalloc(sizeof(*rsi_dev), GFP_KERNEL); + rsi_dev = kzalloc_obj(*rsi_dev, GFP_KERNEL); if (!rsi_dev) return -ENOMEM; diff --git a/drivers/net/wireless/silabs/wfx/debug.c b/drivers/net/wireless/silabs/wfx/debug.c index e8265208f9a5..6475a4a42afc 100644 --- a/drivers/net/wireless/silabs/wfx/debug.c +++ b/drivers/net/wireless/silabs/wfx/debug.c @@ -291,7 +291,7 @@ static ssize_t wfx_send_hif_msg_read(struct file *file, char __user *user_buf, static int wfx_send_hif_msg_open(struct inode *inode, struct file *file) { - struct dbgfs_hif_msg *context = kzalloc(sizeof(*context), GFP_KERNEL); + struct dbgfs_hif_msg *context = kzalloc_obj(*context, GFP_KERNEL); if (!context) return -ENOMEM; diff --git a/drivers/net/wireless/st/cw1200/cw1200_sdio.c b/drivers/net/wireless/st/cw1200/cw1200_sdio.c index 00c4731d8f8e..b503112d3a3e 100644 --- a/drivers/net/wireless/st/cw1200/cw1200_sdio.c +++ b/drivers/net/wireless/st/cw1200/cw1200_sdio.c @@ -287,7 +287,7 @@ static int cw1200_sdio_probe(struct sdio_func *func, if (func->num != 0x01) return -ENODEV; - self = kzalloc(sizeof(*self), GFP_KERNEL); + self = kzalloc_obj(*self, GFP_KERNEL); if (!self) { pr_err("Can't allocate SDIO hwbus_priv.\n"); return -ENOMEM; diff --git a/drivers/net/wireless/st/cw1200/debug.c b/drivers/net/wireless/st/cw1200/debug.c index 8686929c70df..6af080d0f21b 100644 --- a/drivers/net/wireless/st/cw1200/debug.c +++ b/drivers/net/wireless/st/cw1200/debug.c @@ -360,8 +360,8 @@ static const struct file_operations fops_wsm_dumps = { int cw1200_debug_init(struct cw1200_common *priv) { int ret = -ENOMEM; - struct cw1200_debug_priv *d = kzalloc(sizeof(struct cw1200_debug_priv), - GFP_KERNEL); + struct cw1200_debug_priv *d = kzalloc_obj(struct cw1200_debug_priv, + GFP_KERNEL); priv->debug = d; if (!d) return ret; diff --git a/drivers/net/wireless/st/cw1200/pm.c b/drivers/net/wireless/st/cw1200/pm.c index 2002e3f9fe45..ed2650b2a40b 100644 --- a/drivers/net/wireless/st/cw1200/pm.c +++ b/drivers/net/wireless/st/cw1200/pm.c @@ -207,7 +207,7 @@ int cw1200_wow_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) wsm_set_ether_type_filter(priv, &cw1200_ether_type_filter_on.hdr); /* Allocate state */ - state = kzalloc(sizeof(struct cw1200_suspend_state), GFP_KERNEL); + state = kzalloc_obj(struct cw1200_suspend_state, GFP_KERNEL); if (!state) goto revert3; diff --git a/drivers/net/wireless/st/cw1200/queue.c b/drivers/net/wireless/st/cw1200/queue.c index a933e2c7dc2c..717da9c2cad9 100644 --- a/drivers/net/wireless/st/cw1200/queue.c +++ b/drivers/net/wireless/st/cw1200/queue.c @@ -153,8 +153,7 @@ int cw1200_queue_stats_init(struct cw1200_queue_stats *stats, spin_lock_init(&stats->lock); init_waitqueue_head(&stats->wait_link_id_empty); - stats->link_map_cache = kcalloc(map_capacity, sizeof(int), - GFP_KERNEL); + stats->link_map_cache = kzalloc_objs(int, map_capacity, GFP_KERNEL); if (!stats->link_map_cache) return -ENOMEM; @@ -180,13 +179,13 @@ int cw1200_queue_init(struct cw1200_queue *queue, spin_lock_init(&queue->lock); timer_setup(&queue->gc, cw1200_queue_gc, 0); - queue->pool = kcalloc(capacity, sizeof(struct cw1200_queue_item), - GFP_KERNEL); + queue->pool = kzalloc_objs(struct cw1200_queue_item, capacity, + GFP_KERNEL); if (!queue->pool) return -ENOMEM; - queue->link_map_cache = kcalloc(stats->map_capacity, sizeof(int), - GFP_KERNEL); + queue->link_map_cache = kzalloc_objs(int, stats->map_capacity, + GFP_KERNEL); if (!queue->link_map_cache) { kfree(queue->pool); queue->pool = NULL; diff --git a/drivers/net/wireless/st/cw1200/scan.c b/drivers/net/wireless/st/cw1200/scan.c index 1f856fbbc0ea..f0b902d2ecc1 100644 --- a/drivers/net/wireless/st/cw1200/scan.c +++ b/drivers/net/wireless/st/cw1200/scan.c @@ -225,9 +225,8 @@ void cw1200_scan_work(struct work_struct *work) scan.type = WSM_SCAN_TYPE_BACKGROUND; scan.flags = WSM_SCAN_FLAG_FORCE_BACKGROUND; } - scan.ch = kcalloc(it - priv->scan.curr, - sizeof(struct wsm_scan_ch), - GFP_KERNEL); + scan.ch = kzalloc_objs(struct wsm_scan_ch, it - priv->scan.curr, + GFP_KERNEL); if (!scan.ch) { priv->scan.status = -ENOMEM; goto fail; diff --git a/drivers/net/wireless/st/cw1200/wsm.c b/drivers/net/wireless/st/cw1200/wsm.c index 4a9e4b5d3547..0b669b2f3ef4 100644 --- a/drivers/net/wireless/st/cw1200/wsm.c +++ b/drivers/net/wireless/st/cw1200/wsm.c @@ -922,7 +922,7 @@ static int wsm_event_indication(struct cw1200_common *priv, struct wsm_buf *buf) return 0; } - event = kzalloc(sizeof(struct cw1200_wsm_event), GFP_KERNEL); + event = kzalloc_obj(struct cw1200_wsm_event, GFP_KERNEL); if (!event) return -ENOMEM; diff --git a/drivers/net/wireless/ti/wl1251/acx.c b/drivers/net/wireless/ti/wl1251/acx.c index 166efac812fe..b53ac17172c4 100644 --- a/drivers/net/wireless/ti/wl1251/acx.c +++ b/drivers/net/wireless/ti/wl1251/acx.c @@ -18,7 +18,7 @@ int wl1251_acx_frame_rates(struct wl1251 *wl, u8 ctrl_rate, u8 ctrl_mod, wl1251_debug(DEBUG_ACX, "acx frame rates"); - rates = kzalloc(sizeof(*rates), GFP_KERNEL); + rates = kzalloc_obj(*rates, GFP_KERNEL); if (!rates) return -ENOMEM; @@ -47,7 +47,7 @@ int wl1251_acx_station_id(struct wl1251 *wl) wl1251_debug(DEBUG_ACX, "acx dot11_station_id"); - mac = kzalloc(sizeof(*mac), GFP_KERNEL); + mac = kzalloc_obj(*mac, GFP_KERNEL); if (!mac) return -ENOMEM; @@ -67,7 +67,7 @@ int wl1251_acx_default_key(struct wl1251 *wl, u8 key_id) wl1251_debug(DEBUG_ACX, "acx dot11_default_key (%d)", key_id); - default_key = kzalloc(sizeof(*default_key), GFP_KERNEL); + default_key = kzalloc_obj(*default_key, GFP_KERNEL); if (!default_key) return -ENOMEM; @@ -95,7 +95,7 @@ int wl1251_acx_wake_up_conditions(struct wl1251 *wl, u8 wake_up_event, wl1251_debug(DEBUG_ACX, "acx wake up conditions"); - wake_up = kzalloc(sizeof(*wake_up), GFP_KERNEL); + wake_up = kzalloc_obj(*wake_up, GFP_KERNEL); if (!wake_up) return -ENOMEM; @@ -121,7 +121,7 @@ int wl1251_acx_sleep_auth(struct wl1251 *wl, u8 sleep_auth) wl1251_debug(DEBUG_ACX, "acx sleep auth"); - auth = kzalloc(sizeof(*auth), GFP_KERNEL); + auth = kzalloc_obj(*auth, GFP_KERNEL); if (!auth) return -ENOMEM; @@ -140,7 +140,7 @@ int wl1251_acx_fw_version(struct wl1251 *wl, char *buf, size_t len) wl1251_debug(DEBUG_ACX, "acx fw rev"); - rev = kzalloc(sizeof(*rev), GFP_KERNEL); + rev = kzalloc_obj(*rev, GFP_KERNEL); if (!rev) return -ENOMEM; @@ -167,7 +167,7 @@ int wl1251_acx_tx_power(struct wl1251 *wl, int power) if (power < 0 || power > 25) return -EINVAL; - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; @@ -191,7 +191,7 @@ int wl1251_acx_feature_cfg(struct wl1251 *wl, u32 data_flow_options) wl1251_debug(DEBUG_ACX, "acx feature cfg"); - feature = kzalloc(sizeof(*feature), GFP_KERNEL); + feature = kzalloc_obj(*feature, GFP_KERNEL); if (!feature) return -ENOMEM; @@ -233,7 +233,7 @@ int wl1251_acx_data_path_params(struct wl1251 *wl, wl1251_debug(DEBUG_ACX, "acx data path params"); - params = kzalloc(sizeof(*params), GFP_KERNEL); + params = kzalloc_obj(*params, GFP_KERNEL); if (!params) return -ENOMEM; @@ -279,7 +279,7 @@ int wl1251_acx_rx_msdu_life_time(struct wl1251 *wl, u32 life_time) wl1251_debug(DEBUG_ACX, "acx rx msdu life time"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; @@ -303,7 +303,7 @@ int wl1251_acx_rx_config(struct wl1251 *wl, u32 config, u32 filter) wl1251_debug(DEBUG_ACX, "acx rx config"); - rx_config = kzalloc(sizeof(*rx_config), GFP_KERNEL); + rx_config = kzalloc_obj(*rx_config, GFP_KERNEL); if (!rx_config) return -ENOMEM; @@ -329,7 +329,7 @@ int wl1251_acx_pd_threshold(struct wl1251 *wl) wl1251_debug(DEBUG_ACX, "acx data pd threshold"); - pd = kzalloc(sizeof(*pd), GFP_KERNEL); + pd = kzalloc_obj(*pd, GFP_KERNEL); if (!pd) return -ENOMEM; @@ -353,7 +353,7 @@ int wl1251_acx_slot(struct wl1251 *wl, enum acx_slot_type slot_time) wl1251_debug(DEBUG_ACX, "acx slot"); - slot = kzalloc(sizeof(*slot), GFP_KERNEL); + slot = kzalloc_obj(*slot, GFP_KERNEL); if (!slot) return -ENOMEM; @@ -379,7 +379,7 @@ int wl1251_acx_group_address_tbl(struct wl1251 *wl, bool enable, wl1251_debug(DEBUG_ACX, "acx group address tbl"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; @@ -405,7 +405,7 @@ int wl1251_acx_service_period_timeout(struct wl1251 *wl) struct acx_rx_timeout *rx_timeout; int ret; - rx_timeout = kzalloc(sizeof(*rx_timeout), GFP_KERNEL); + rx_timeout = kzalloc_obj(*rx_timeout, GFP_KERNEL); if (!rx_timeout) return -ENOMEM; @@ -434,7 +434,7 @@ int wl1251_acx_rts_threshold(struct wl1251 *wl, u16 rts_threshold) wl1251_debug(DEBUG_ACX, "acx rts threshold"); - rts = kzalloc(sizeof(*rts), GFP_KERNEL); + rts = kzalloc_obj(*rts, GFP_KERNEL); if (!rts) return -ENOMEM; @@ -458,7 +458,7 @@ int wl1251_acx_beacon_filter_opt(struct wl1251 *wl, bool enable_filter) wl1251_debug(DEBUG_ACX, "acx beacon filter opt"); - beacon_filter = kzalloc(sizeof(*beacon_filter), GFP_KERNEL); + beacon_filter = kzalloc_obj(*beacon_filter, GFP_KERNEL); if (!beacon_filter) return -ENOMEM; @@ -485,7 +485,7 @@ int wl1251_acx_beacon_filter_table(struct wl1251 *wl) wl1251_debug(DEBUG_ACX, "acx beacon filter table"); - ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL); + ie_table = kzalloc_obj(*ie_table, GFP_KERNEL); if (!ie_table) return -ENOMEM; @@ -513,7 +513,7 @@ int wl1251_acx_conn_monit_params(struct wl1251 *wl) wl1251_debug(DEBUG_ACX, "acx connection monitor parameters"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; @@ -540,7 +540,7 @@ int wl1251_acx_sg_enable(struct wl1251 *wl) wl1251_debug(DEBUG_ACX, "acx sg enable"); - pta = kzalloc(sizeof(*pta), GFP_KERNEL); + pta = kzalloc_obj(*pta, GFP_KERNEL); if (!pta) return -ENOMEM; @@ -564,7 +564,7 @@ int wl1251_acx_sg_cfg(struct wl1251 *wl) wl1251_debug(DEBUG_ACX, "acx sg cfg"); - param = kzalloc(sizeof(*param), GFP_KERNEL); + param = kzalloc_obj(*param, GFP_KERNEL); if (!param) return -ENOMEM; @@ -616,7 +616,7 @@ int wl1251_acx_cca_threshold(struct wl1251 *wl) wl1251_debug(DEBUG_ACX, "acx cca threshold"); - detection = kzalloc(sizeof(*detection), GFP_KERNEL); + detection = kzalloc_obj(*detection, GFP_KERNEL); if (!detection) return -ENOMEM; @@ -639,7 +639,7 @@ int wl1251_acx_bcn_dtim_options(struct wl1251 *wl) wl1251_debug(DEBUG_ACX, "acx bcn dtim options"); - bb = kzalloc(sizeof(*bb), GFP_KERNEL); + bb = kzalloc_obj(*bb, GFP_KERNEL); if (!bb) return -ENOMEM; @@ -666,7 +666,7 @@ int wl1251_acx_aid(struct wl1251 *wl, u16 aid) wl1251_debug(DEBUG_ACX, "acx aid"); - acx_aid = kzalloc(sizeof(*acx_aid), GFP_KERNEL); + acx_aid = kzalloc_obj(*acx_aid, GFP_KERNEL); if (!acx_aid) return -ENOMEM; @@ -690,7 +690,7 @@ int wl1251_acx_event_mbox_mask(struct wl1251 *wl, u32 event_mask) wl1251_debug(DEBUG_ACX, "acx event mbox mask"); - mask = kzalloc(sizeof(*mask), GFP_KERNEL); + mask = kzalloc_obj(*mask, GFP_KERNEL); if (!mask) return -ENOMEM; @@ -719,7 +719,7 @@ int wl1251_acx_low_rssi(struct wl1251 *wl, s8 threshold, u8 weight, wl1251_debug(DEBUG_ACX, "acx low rssi"); - rssi = kzalloc(sizeof(*rssi), GFP_KERNEL); + rssi = kzalloc_obj(*rssi, GFP_KERNEL); if (!rssi) return -ENOMEM; @@ -743,7 +743,7 @@ int wl1251_acx_set_preamble(struct wl1251 *wl, enum acx_preamble_type preamble) wl1251_debug(DEBUG_ACX, "acx_set_preamble"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; @@ -768,7 +768,7 @@ int wl1251_acx_cts_protect(struct wl1251 *wl, wl1251_debug(DEBUG_ACX, "acx_set_ctsprotect"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; @@ -790,7 +790,7 @@ int wl1251_acx_tsf_info(struct wl1251 *wl, u64 *mactime) struct acx_tsf_info *tsf_info; int ret; - tsf_info = kzalloc(sizeof(*tsf_info), GFP_KERNEL); + tsf_info = kzalloc_obj(*tsf_info, GFP_KERNEL); if (!tsf_info) return -ENOMEM; @@ -832,7 +832,7 @@ int wl1251_acx_mem_cfg(struct wl1251 *wl) wl1251_debug(DEBUG_ACX, "acx mem cfg"); - mem_conf = kzalloc(sizeof(*mem_conf), GFP_KERNEL); + mem_conf = kzalloc_obj(*mem_conf, GFP_KERNEL); if (!mem_conf) return -ENOMEM; @@ -877,7 +877,7 @@ int wl1251_acx_wr_tbtt_and_dtim(struct wl1251 *wl, u16 tbtt, u8 dtim) wl1251_debug(DEBUG_ACX, "acx tbtt and dtim"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; @@ -904,7 +904,7 @@ int wl1251_acx_bet_enable(struct wl1251 *wl, enum wl1251_acx_bet_mode mode, wl1251_debug(DEBUG_ACX, "acx bet enable"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; @@ -929,7 +929,7 @@ int wl1251_acx_arp_ip_filter(struct wl1251 *wl, bool enable, __be32 address) wl1251_debug(DEBUG_ACX, "acx arp ip filter, enable: %d", enable); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; @@ -957,7 +957,7 @@ int wl1251_acx_ac_cfg(struct wl1251 *wl, u8 ac, u8 cw_min, u16 cw_max, wl1251_debug(DEBUG_ACX, "acx ac cfg %d cw_ming %d cw_max %d " "aifs %d txop %d", ac, cw_min, cw_max, aifs, txop); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; @@ -990,7 +990,7 @@ int wl1251_acx_tid_cfg(struct wl1251 *wl, u8 queue, "ps_scheme %d ack_policy %d", queue, type, tsid, ps_scheme, ack_policy); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; diff --git a/drivers/net/wireless/ti/wl1251/cmd.c b/drivers/net/wireless/ti/wl1251/cmd.c index c33ee0d4d323..19eb8806651f 100644 --- a/drivers/net/wireless/ti/wl1251/cmd.c +++ b/drivers/net/wireless/ti/wl1251/cmd.c @@ -133,7 +133,7 @@ int wl1251_cmd_vbm(struct wl1251 *wl, u8 identity, wl1251_debug(DEBUG_CMD, "cmd vbm"); - vbm = kzalloc(sizeof(*vbm), GFP_KERNEL); + vbm = kzalloc_obj(*vbm, GFP_KERNEL); if (!vbm) return -ENOMEM; @@ -169,7 +169,7 @@ int wl1251_cmd_data_path_rx(struct wl1251 *wl, u8 channel, bool enable) wl1251_debug(DEBUG_CMD, "cmd data path"); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) return -ENOMEM; @@ -203,7 +203,7 @@ int wl1251_cmd_data_path_tx(struct wl1251 *wl, u8 channel, bool enable) wl1251_debug(DEBUG_CMD, "cmd data path"); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) return -ENOMEM; @@ -233,7 +233,7 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel, int ret, i; u8 *bssid; - join = kzalloc(sizeof(*join), GFP_KERNEL); + join = kzalloc_obj(*join, GFP_KERNEL); if (!join) return -ENOMEM; @@ -276,7 +276,7 @@ int wl1251_cmd_ps_mode(struct wl1251 *wl, u8 ps_mode) wl1251_debug(DEBUG_CMD, "cmd set ps mode"); - ps_params = kzalloc(sizeof(*ps_params), GFP_KERNEL); + ps_params = kzalloc_obj(*ps_params, GFP_KERNEL); if (!ps_params) return -ENOMEM; @@ -342,7 +342,7 @@ int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len, WARN_ON(n_channels > SCAN_MAX_NUM_OF_CHANNELS); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) return -ENOMEM; @@ -409,7 +409,7 @@ int wl1251_cmd_trigger_scan_to(struct wl1251 *wl, u32 timeout) wl1251_debug(DEBUG_CMD, "cmd trigger scan to"); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) return -ENOMEM; diff --git a/drivers/net/wireless/ti/wl1251/debugfs.c b/drivers/net/wireless/ti/wl1251/debugfs.c index a1b778a0fda0..a68d57555318 100644 --- a/drivers/net/wireless/ti/wl1251/debugfs.c +++ b/drivers/net/wireless/ti/wl1251/debugfs.c @@ -444,7 +444,7 @@ void wl1251_debugfs_reset(struct wl1251 *wl) int wl1251_debugfs_init(struct wl1251 *wl) { - wl->stats.fw_stats = kzalloc(sizeof(*wl->stats.fw_stats), GFP_KERNEL); + wl->stats.fw_stats = kzalloc_obj(*wl->stats.fw_stats, GFP_KERNEL); if (!wl->stats.fw_stats) return -ENOMEM; diff --git a/drivers/net/wireless/ti/wl1251/event.c b/drivers/net/wireless/ti/wl1251/event.c index e945aafd88ee..6135d7c6d109 100644 --- a/drivers/net/wireless/ti/wl1251/event.c +++ b/drivers/net/wireless/ti/wl1251/event.c @@ -208,7 +208,7 @@ int wl1251_event_handle(struct wl1251 *wl, u8 mbox_num) if (mbox_num > 1) return -EINVAL; - mbox = kmalloc(sizeof(*mbox), GFP_KERNEL); + mbox = kmalloc_obj(*mbox, GFP_KERNEL); if (!mbox) { wl1251_error("can not allocate mbox buffer"); return -ENOMEM; diff --git a/drivers/net/wireless/ti/wl1251/init.c b/drivers/net/wireless/ti/wl1251/init.c index 5663f197ea69..0d7f08f0a41a 100644 --- a/drivers/net/wireless/ti/wl1251/init.c +++ b/drivers/net/wireless/ti/wl1251/init.c @@ -194,8 +194,7 @@ int wl1251_hw_init_mem_config(struct wl1251 *wl) if (ret < 0) return ret; - wl->target_mem_map = kzalloc(sizeof(struct wl1251_acx_mem_map), - GFP_KERNEL); + wl->target_mem_map = kzalloc_obj(struct wl1251_acx_mem_map, GFP_KERNEL); if (!wl->target_mem_map) { wl1251_error("couldn't allocate target memory map"); return -ENOMEM; @@ -261,7 +260,7 @@ static int wl1251_hw_init_tx_queue_config(struct wl1251 *wl) wl1251_debug(DEBUG_ACX, "acx tx queue config"); - config = kzalloc(sizeof(*config), GFP_KERNEL); + config = kzalloc_obj(*config, GFP_KERNEL); if (!config) { ret = -ENOMEM; goto out; @@ -294,8 +293,8 @@ static int wl1251_hw_init_data_path_config(struct wl1251 *wl) int ret; /* asking for the data path parameters */ - wl->data_path = kzalloc(sizeof(struct acx_data_path_params_resp), - GFP_KERNEL); + wl->data_path = kzalloc_obj(struct acx_data_path_params_resp, + GFP_KERNEL); if (!wl->data_path) return -ENOMEM; diff --git a/drivers/net/wireless/ti/wl1251/io.c b/drivers/net/wireless/ti/wl1251/io.c index e8d567af74b4..84d497ebc7f2 100644 --- a/drivers/net/wireless/ti/wl1251/io.c +++ b/drivers/net/wireless/ti/wl1251/io.c @@ -123,7 +123,7 @@ void wl1251_set_partition(struct wl1251 *wl, { struct wl1251_partition_set *partition; - partition = kmalloc(sizeof(*partition), GFP_KERNEL); + partition = kmalloc_obj(*partition, GFP_KERNEL); if (!partition) { wl1251_error("can not allocate partition buffer"); return; diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c index 69fc51f183ad..0a5ec19f8abc 100644 --- a/drivers/net/wireless/ti/wl1251/main.c +++ b/drivers/net/wireless/ti/wl1251/main.c @@ -725,7 +725,7 @@ static u64 wl1251_op_prepare_multicast(struct ieee80211_hw *hw, if (unlikely(wl->state == WL1251_STATE_OFF)) return 0; - fp = kzalloc(sizeof(*fp), GFP_ATOMIC); + fp = kzalloc_obj(*fp, GFP_ATOMIC); if (!fp) { wl1251_error("Out of memory setting filters."); return 0; @@ -878,7 +878,7 @@ static int wl1251_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, wl1251_debug(DEBUG_MAC80211, "mac80211 set key"); - wl_cmd = kzalloc(sizeof(*wl_cmd), GFP_KERNEL); + wl_cmd = kzalloc_obj(*wl_cmd, GFP_KERNEL); if (!wl_cmd) { ret = -ENOMEM; goto out; @@ -1640,7 +1640,7 @@ struct ieee80211_hw *wl1251_alloc_hw(void) wl->tx_mgmt_frm_rate = DEFAULT_HW_GEN_TX_RATE; wl->tx_mgmt_frm_mod = DEFAULT_HW_GEN_MODULATION_TYPE; - wl->rx_descriptor = kmalloc(sizeof(*wl->rx_descriptor), GFP_KERNEL); + wl->rx_descriptor = kmalloc_obj(*wl->rx_descriptor, GFP_KERNEL); if (!wl->rx_descriptor) { wl1251_error("could not allocate memory for rx descriptor"); ieee80211_free_hw(hw); diff --git a/drivers/net/wireless/ti/wl1251/sdio.c b/drivers/net/wireless/ti/wl1251/sdio.c index b45050243129..1ba35c9fb34b 100644 --- a/drivers/net/wireless/ti/wl1251/sdio.c +++ b/drivers/net/wireless/ti/wl1251/sdio.c @@ -204,7 +204,7 @@ static int wl1251_sdio_probe(struct sdio_func *func, wl = hw->priv; - wl_sdio = kzalloc(sizeof(*wl_sdio), GFP_KERNEL); + wl_sdio = kzalloc_obj(*wl_sdio, GFP_KERNEL); if (wl_sdio == NULL) { ret = -ENOMEM; goto out_free_hw; diff --git a/drivers/net/wireless/ti/wl1251/tx.c b/drivers/net/wireless/ti/wl1251/tx.c index adb4840b0489..acd4834d8a54 100644 --- a/drivers/net/wireless/ti/wl1251/tx.c +++ b/drivers/net/wireless/ti/wl1251/tx.c @@ -451,7 +451,7 @@ void wl1251_tx_complete(struct wl1251 *wl) if (unlikely(wl->state != WL1251_STATE_ON)) return; - result = kmalloc_array(FW_TX_CMPLT_BLOCK_SIZE, sizeof(*result), GFP_KERNEL); + result = kmalloc_objs(*result, FW_TX_CMPLT_BLOCK_SIZE, GFP_KERNEL); if (!result) { wl1251_error("can not allocate result buffer"); return; diff --git a/drivers/net/wireless/ti/wl12xx/acx.c b/drivers/net/wireless/ti/wl12xx/acx.c index fb830d01b8ff..74e16f8c8b22 100644 --- a/drivers/net/wireless/ti/wl12xx/acx.c +++ b/drivers/net/wireless/ti/wl12xx/acx.c @@ -17,7 +17,7 @@ int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap) struct wl1271_acx_host_config_bitmap *bitmap_conf; int ret; - bitmap_conf = kzalloc(sizeof(*bitmap_conf), GFP_KERNEL); + bitmap_conf = kzalloc_obj(*bitmap_conf, GFP_KERNEL); if (!bitmap_conf) { ret = -ENOMEM; goto out; diff --git a/drivers/net/wireless/ti/wl12xx/cmd.c b/drivers/net/wireless/ti/wl12xx/cmd.c index 17434b3bb10b..d57f420baa60 100644 --- a/drivers/net/wireless/ti/wl12xx/cmd.c +++ b/drivers/net/wireless/ti/wl12xx/cmd.c @@ -22,7 +22,7 @@ int wl1271_cmd_ext_radio_parms(struct wl1271 *wl) if (!wl->nvs) return -ENODEV; - ext_radio_parms = kzalloc(sizeof(*ext_radio_parms), GFP_KERNEL); + ext_radio_parms = kzalloc_obj(*ext_radio_parms, GFP_KERNEL); if (!ext_radio_parms) return -ENOMEM; @@ -63,7 +63,7 @@ int wl1271_cmd_general_parms(struct wl1271 *wl) return -EINVAL; } - gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); + gen_parms = kzalloc_obj(*gen_parms, GFP_KERNEL); if (!gen_parms) return -ENOMEM; @@ -130,7 +130,7 @@ int wl128x_cmd_general_parms(struct wl1271 *wl) return -EINVAL; } - gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); + gen_parms = kzalloc_obj(*gen_parms, GFP_KERNEL); if (!gen_parms) return -ENOMEM; @@ -191,7 +191,7 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl) if (!wl->nvs) return -ENODEV; - radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); + radio_parms = kzalloc_obj(*radio_parms, GFP_KERNEL); if (!radio_parms) return -ENOMEM; @@ -235,7 +235,7 @@ int wl128x_cmd_radio_parms(struct wl1271 *wl) if (!wl->nvs) return -ENODEV; - radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); + radio_parms = kzalloc_obj(*radio_parms, GFP_KERNEL); if (!radio_parms) return -ENOMEM; @@ -280,7 +280,7 @@ int wl12xx_cmd_channel_switch(struct wl1271 *wl, wl1271_debug(DEBUG_ACX, "cmd channel switch"); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c index ffbf54776330..f766845e2451 100644 --- a/drivers/net/wireless/ti/wl12xx/main.c +++ b/drivers/net/wireless/ti/wl12xx/main.c @@ -1882,7 +1882,7 @@ static int wl12xx_setup(struct wl1271 *wl) wl1271_error("Invalid tcxo parameter %s", tcxo_param); } - priv->rx_mem_addr = kmalloc(sizeof(*priv->rx_mem_addr), GFP_KERNEL); + priv->rx_mem_addr = kmalloc_obj(*priv->rx_mem_addr, GFP_KERNEL); if (!priv->rx_mem_addr) return -ENOMEM; diff --git a/drivers/net/wireless/ti/wl12xx/scan.c b/drivers/net/wireless/ti/wl12xx/scan.c index 6c18e8552e4a..021c547bbab8 100644 --- a/drivers/net/wireless/ti/wl12xx/scan.c +++ b/drivers/net/wireless/ti/wl12xx/scan.c @@ -91,8 +91,8 @@ static int wl1271_scan_send(struct wl1271 *wl, struct wl12xx_vif *wlvif, if (!passive && wl->scan.req->n_ssids == 0) return WL1271_NOTHING_TO_SCAN; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - trigger = kzalloc(sizeof(*trigger), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); + trigger = kzalloc_obj(*trigger, GFP_KERNEL); if (!cmd || !trigger) { ret = -ENOMEM; goto out; @@ -184,7 +184,7 @@ int wl12xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif) wl1271_debug(DEBUG_CMD, "cmd scan stop"); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -317,7 +317,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl, wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config"); - cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); + cfg = kzalloc_obj(*cfg, GFP_KERNEL); if (!cfg) return -ENOMEM; @@ -348,7 +348,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl, wl1271_debug(DEBUG_SCAN, "filter_type = %d", cfg->filter_type); - cfg_channels = kzalloc(sizeof(*cfg_channels), GFP_KERNEL); + cfg_channels = kzalloc_obj(*cfg_channels, GFP_KERNEL); if (!cfg_channels) { ret = -ENOMEM; goto out; @@ -425,7 +425,7 @@ int wl1271_scan_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif) test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags)) return -EBUSY; - start = kzalloc(sizeof(*start), GFP_KERNEL); + start = kzalloc_obj(*start, GFP_KERNEL); if (!start) return -ENOMEM; @@ -465,7 +465,7 @@ void wl12xx_scan_sched_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif) wl1271_debug(DEBUG_CMD, "cmd periodic scan stop"); /* FIXME: what to do if alloc'ing to stop fails? */ - stop = kzalloc(sizeof(*stop), GFP_KERNEL); + stop = kzalloc_obj(*stop, GFP_KERNEL); if (!stop) { wl1271_error("failed to alloc memory to send sched scan stop"); return; diff --git a/drivers/net/wireless/ti/wl18xx/acx.c b/drivers/net/wireless/ti/wl18xx/acx.c index d1deef02f43e..f29dd27814f5 100644 --- a/drivers/net/wireless/ti/wl18xx/acx.c +++ b/drivers/net/wireless/ti/wl18xx/acx.c @@ -23,7 +23,7 @@ int wl18xx_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap, host_cfg_bitmap, sdio_blk_size, extra_mem_blks, len_field_size); - bitmap_conf = kzalloc(sizeof(*bitmap_conf), GFP_KERNEL); + bitmap_conf = kzalloc_obj(*bitmap_conf, GFP_KERNEL); if (!bitmap_conf) { ret = -ENOMEM; goto out; @@ -54,7 +54,7 @@ int wl18xx_acx_set_checksum_state(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "acx checksum state"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -80,7 +80,7 @@ int wl18xx_acx_clear_statistics(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "acx clear statistics"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -105,7 +105,7 @@ int wl18xx_acx_peer_ht_operation_mode(struct wl1271 *wl, u8 hlid, bool wide) wl1271_debug(DEBUG_ACX, "acx peer ht operation mode hlid %d bw %d", hlid, wide); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -146,7 +146,7 @@ int wl18xx_acx_set_peer_cap(struct wl1271 *wl, "acx set cap ht_supp: %d ht_cap: %d rates: 0x%x", ht_cap->ht_supported, ht_cap->cap, rate_set); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -192,7 +192,7 @@ int wl18xx_acx_interrupt_notify_config(struct wl1271 *wl, struct wl18xx_acx_interrupt_notify *acx; int ret = 0; - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -219,7 +219,7 @@ int wl18xx_acx_rx_ba_filter(struct wl1271 *wl, bool action) struct wl18xx_acx_rx_ba_filter *acx; int ret = 0; - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -247,7 +247,7 @@ int wl18xx_acx_ap_sleep(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "acx config ap sleep"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -277,7 +277,7 @@ int wl18xx_acx_dynamic_fw_traces(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "acx dynamic fw traces config %d", wl->dynamic_fw_traces); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -305,7 +305,7 @@ int wl18xx_acx_time_sync_cfg(struct wl1271 *wl) wl->conf.sg.params[WL18XX_CONF_SG_TIME_SYNC], wl->zone_master_mac_addr); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; diff --git a/drivers/net/wireless/ti/wl18xx/cmd.c b/drivers/net/wireless/ti/wl18xx/cmd.c index 5f8620d90052..5a1dc648fd57 100644 --- a/drivers/net/wireless/ti/wl18xx/cmd.c +++ b/drivers/net/wireless/ti/wl18xx/cmd.c @@ -22,7 +22,7 @@ int wl18xx_cmd_channel_switch(struct wl1271 *wl, wl1271_debug(DEBUG_ACX, "cmd channel switch (count=%d)", ch_switch->count); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -78,7 +78,7 @@ int wl18xx_cmd_smart_config_start(struct wl1271 *wl, u32 group_bitmap) wl1271_debug(DEBUG_CMD, "cmd smart config start group_bitmap=0x%x", group_bitmap); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -105,7 +105,7 @@ int wl18xx_cmd_smart_config_stop(struct wl1271 *wl) wl1271_debug(DEBUG_CMD, "cmd smart config stop"); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -137,7 +137,7 @@ int wl18xx_cmd_smart_config_set_group_key(struct wl1271 *wl, u16 group_id, return -E2BIG; } - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -167,7 +167,7 @@ int wl18xx_cmd_set_cac(struct wl1271 *wl, struct wl12xx_vif *wlvif, bool start) wl1271_debug(DEBUG_CMD, "cmd cac (channel %d) %s", wlvif->channel, start ? "start" : "stop"); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) return -ENOMEM; @@ -198,7 +198,7 @@ int wl18xx_cmd_radar_detection_debug(struct wl1271 *wl, u8 channel) wl1271_debug(DEBUG_CMD, "cmd radar detection debug (chan %d)", channel); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) return -ENOMEM; @@ -224,7 +224,7 @@ int wl18xx_cmd_dfs_master_restart(struct wl1271 *wl, struct wl12xx_vif *wlvif) wl1271_debug(DEBUG_CMD, "cmd dfs master restart (role %d)", wlvif->role_id); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) return -ENOMEM; diff --git a/drivers/net/wireless/ti/wl18xx/scan.c b/drivers/net/wireless/ti/wl18xx/scan.c index d9f4b715abf6..7e61403aa374 100644 --- a/drivers/net/wireless/ti/wl18xx/scan.c +++ b/drivers/net/wireless/ti/wl18xx/scan.c @@ -31,7 +31,7 @@ static int wl18xx_scan_send(struct wl1271 *wl, struct wl12xx_vif *wlvif, struct wlcore_scan_channels *cmd_channels = NULL; int ret; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -67,7 +67,7 @@ static int wl18xx_scan_send(struct wl1271 *wl, struct wl12xx_vif *wlvif, /* configure channels */ WARN_ON(req->n_ssids > 1); - cmd_channels = kzalloc(sizeof(*cmd_channels), GFP_KERNEL); + cmd_channels = kzalloc_obj(*cmd_channels, GFP_KERNEL); if (!cmd_channels) { ret = -ENOMEM; goto out; @@ -169,7 +169,7 @@ int wl18xx_scan_sched_scan_config(struct wl1271 *wl, if (filter_type < 0) return filter_type; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -201,7 +201,7 @@ int wl18xx_scan_sched_scan_config(struct wl1271 *wl, /* don't stop scanning automatically when something is found */ cmd->terminate_after = 0; - cmd_channels = kzalloc(sizeof(*cmd_channels), GFP_KERNEL); + cmd_channels = kzalloc_obj(*cmd_channels, GFP_KERNEL); if (!cmd_channels) { ret = -ENOMEM; goto out; @@ -301,7 +301,7 @@ static int __wl18xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_CMD, "cmd periodic scan stop"); - stop = kzalloc(sizeof(*stop), GFP_KERNEL); + stop = kzalloc_obj(*stop, GFP_KERNEL); if (!stop) { wl1271_error("failed to alloc memory to send sched scan stop"); return -ENOMEM; diff --git a/drivers/net/wireless/ti/wlcore/acx.c b/drivers/net/wireless/ti/wlcore/acx.c index e820fe694121..65d1df37828d 100644 --- a/drivers/net/wireless/ti/wlcore/acx.c +++ b/drivers/net/wireless/ti/wlcore/acx.c @@ -28,7 +28,7 @@ int wl1271_acx_wake_up_conditions(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx wake up conditions (wake_up_event %d listen_interval %d)", wake_up_event, listen_interval); - wake_up = kzalloc(sizeof(*wake_up), GFP_KERNEL); + wake_up = kzalloc_obj(*wake_up, GFP_KERNEL); if (!wake_up) { ret = -ENOMEM; goto out; @@ -57,7 +57,7 @@ int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth) wl1271_debug(DEBUG_ACX, "acx sleep auth %d", sleep_auth); - auth = kzalloc(sizeof(*auth), GFP_KERNEL); + auth = kzalloc_obj(*auth, GFP_KERNEL); if (!auth) { ret = -ENOMEM; goto out; @@ -90,7 +90,7 @@ int wl1271_acx_tx_power(struct wl1271 *wl, struct wl12xx_vif *wlvif, if (power < 0 || power > 25) return -EINVAL; - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -117,7 +117,7 @@ int wl1271_acx_feature_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif) wl1271_debug(DEBUG_ACX, "acx feature cfg"); - feature = kzalloc(sizeof(*feature), GFP_KERNEL); + feature = kzalloc_obj(*feature, GFP_KERNEL); if (!feature) { ret = -ENOMEM; goto out; @@ -162,7 +162,7 @@ int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "acx rx msdu life time"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -189,7 +189,7 @@ int wl1271_acx_slot(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx slot"); - slot = kzalloc(sizeof(*slot), GFP_KERNEL); + slot = kzalloc_obj(*slot, GFP_KERNEL); if (!slot) { ret = -ENOMEM; goto out; @@ -218,7 +218,7 @@ int wl1271_acx_group_address_tbl(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx group address tbl"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -248,7 +248,7 @@ int wl1271_acx_service_period_timeout(struct wl1271 *wl, struct acx_rx_timeout *rx_timeout; int ret; - rx_timeout = kzalloc(sizeof(*rx_timeout), GFP_KERNEL); + rx_timeout = kzalloc_obj(*rx_timeout, GFP_KERNEL); if (!rx_timeout) { ret = -ENOMEM; goto out; @@ -288,7 +288,7 @@ int wl1271_acx_rts_threshold(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx rts threshold: %d", rts_threshold); - rts = kzalloc(sizeof(*rts), GFP_KERNEL); + rts = kzalloc_obj(*rts, GFP_KERNEL); if (!rts) { ret = -ENOMEM; goto out; @@ -316,7 +316,7 @@ int wl1271_acx_dco_itrim_params(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "acx dco itrim parameters"); - dco = kzalloc(sizeof(*dco), GFP_KERNEL); + dco = kzalloc_obj(*dco, GFP_KERNEL); if (!dco) { ret = -ENOMEM; goto out; @@ -350,7 +350,7 @@ int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl->conf.conn.bcn_filt_mode == CONF_BCN_FILT_MODE_DISABLED) goto out; - beacon_filter = kzalloc(sizeof(*beacon_filter), GFP_KERNEL); + beacon_filter = kzalloc_obj(*beacon_filter, GFP_KERNEL); if (!beacon_filter) { ret = -ENOMEM; goto out; @@ -387,7 +387,7 @@ int wl1271_acx_beacon_filter_table(struct wl1271 *wl, wl1271_debug(DEBUG_ACX, "acx beacon filter table"); - ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL); + ie_table = kzalloc_obj(*ie_table, GFP_KERNEL); if (!ie_table) { ret = -ENOMEM; goto out; @@ -446,7 +446,7 @@ int wl1271_acx_conn_monit_params(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx connection monitor parameters: %s", enable ? "enabled" : "disabled"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -482,7 +482,7 @@ int wl1271_acx_sg_enable(struct wl1271 *wl, bool enable) wl1271_debug(DEBUG_ACX, "acx sg enable"); - pta = kzalloc(sizeof(*pta), GFP_KERNEL); + pta = kzalloc_obj(*pta, GFP_KERNEL); if (!pta) { ret = -ENOMEM; goto out; @@ -512,7 +512,7 @@ int wl12xx_acx_sg_cfg(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "acx sg cfg"); - param = kzalloc(sizeof(*param), GFP_KERNEL); + param = kzalloc_obj(*param, GFP_KERNEL); if (!param) { ret = -ENOMEM; goto out; @@ -541,7 +541,7 @@ int wl1271_acx_cca_threshold(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "acx cca threshold"); - detection = kzalloc(sizeof(*detection), GFP_KERNEL); + detection = kzalloc_obj(*detection, GFP_KERNEL); if (!detection) { ret = -ENOMEM; goto out; @@ -567,7 +567,7 @@ int wl1271_acx_bcn_dtim_options(struct wl1271 *wl, struct wl12xx_vif *wlvif) wl1271_debug(DEBUG_ACX, "acx bcn dtim options"); - bb = kzalloc(sizeof(*bb), GFP_KERNEL); + bb = kzalloc_obj(*bb, GFP_KERNEL); if (!bb) { ret = -ENOMEM; goto out; @@ -597,7 +597,7 @@ int wl1271_acx_aid(struct wl1271 *wl, struct wl12xx_vif *wlvif, u16 aid) wl1271_debug(DEBUG_ACX, "acx aid"); - acx_aid = kzalloc(sizeof(*acx_aid), GFP_KERNEL); + acx_aid = kzalloc_obj(*acx_aid, GFP_KERNEL); if (!acx_aid) { ret = -ENOMEM; goto out; @@ -624,7 +624,7 @@ int wl1271_acx_event_mbox_mask(struct wl1271 *wl, u32 event_mask) wl1271_debug(DEBUG_ACX, "acx event mbox mask"); - mask = kzalloc(sizeof(*mask), GFP_KERNEL); + mask = kzalloc_obj(*mask, GFP_KERNEL); if (!mask) { ret = -ENOMEM; goto out; @@ -654,7 +654,7 @@ int wl1271_acx_set_preamble(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx_set_preamble"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -682,7 +682,7 @@ int wl1271_acx_cts_protect(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx_set_ctsprotect"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -727,7 +727,7 @@ int wl1271_acx_sta_rate_policies(struct wl1271 *wl, struct wl12xx_vif *wlvif) wl1271_debug(DEBUG_ACX, "acx rate policies"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; @@ -798,7 +798,7 @@ int wl1271_acx_ap_rate_policy(struct wl1271 *wl, struct conf_tx_rate_class *c, wl1271_debug(DEBUG_ACX, "acx ap rate policy %d rates 0x%x", idx, c->enabled_rates); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -831,7 +831,7 @@ int wl1271_acx_ac_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx ac cfg %d cw_ming %d cw_max %d " "aifs %d txop %d", ac, cw_min, cw_max, aifsn, txop); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; @@ -866,7 +866,7 @@ int wl1271_acx_tid_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx tid config"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; @@ -907,7 +907,7 @@ int wl1271_acx_frag_threshold(struct wl1271 *wl, u32 frag_threshold) wl1271_debug(DEBUG_ACX, "acx frag threshold: %d", frag_threshold); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; @@ -933,7 +933,7 @@ int wl1271_acx_tx_config_options(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "acx tx config options"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; @@ -961,7 +961,7 @@ int wl12xx_acx_mem_cfg(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "wl1271 mem cfg"); - mem_conf = kzalloc(sizeof(*mem_conf), GFP_KERNEL); + mem_conf = kzalloc_obj(*mem_conf, GFP_KERNEL); if (!mem_conf) { ret = -ENOMEM; goto out; @@ -998,8 +998,7 @@ int wl1271_acx_init_mem_config(struct wl1271 *wl) { int ret; - wl->target_mem_map = kzalloc(sizeof(struct wl1271_acx_mem_map), - GFP_KERNEL); + wl->target_mem_map = kzalloc_obj(struct wl1271_acx_mem_map, GFP_KERNEL); if (!wl->target_mem_map) { wl1271_error("couldn't allocate target memory map"); return -ENOMEM; @@ -1032,7 +1031,7 @@ int wl1271_acx_init_rx_interrupt(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "wl1271 rx interrupt config"); - rx_conf = kzalloc(sizeof(*rx_conf), GFP_KERNEL); + rx_conf = kzalloc_obj(*rx_conf, GFP_KERNEL); if (!rx_conf) { ret = -ENOMEM; goto out; @@ -1066,7 +1065,7 @@ int wl1271_acx_bet_enable(struct wl1271 *wl, struct wl12xx_vif *wlvif, if (enable && wl->conf.conn.bet_enable == CONF_BET_MODE_DISABLE) goto out; - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -1095,7 +1094,7 @@ int wl1271_acx_arp_ip_filter(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx arp ip filter, enable: %d", enable); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -1128,7 +1127,7 @@ int wl1271_acx_pm_config(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "acx pm config"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -1157,7 +1156,7 @@ int wl1271_acx_keep_alive_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx keep alive mode: %d", enable); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -1185,7 +1184,7 @@ int wl1271_acx_keep_alive_config(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx keep alive config"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -1217,7 +1216,7 @@ int wl1271_acx_rssi_snr_trigger(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx rssi snr trigger"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -1259,7 +1258,7 @@ int wl1271_acx_rssi_snr_avg_weights(struct wl1271 *wl, wl1271_debug(DEBUG_ACX, "acx rssi snr avg weights"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -1294,7 +1293,7 @@ int wl1271_acx_set_ht_capabilities(struct wl1271 *wl, "sta supp: %d sta cap: %d", ht_cap->ht_supported, ht_cap->cap); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -1340,7 +1339,7 @@ int wl1271_acx_set_ht_information(struct wl1271 *wl, wl1271_debug(DEBUG_ACX, "acx ht information setting"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -1376,7 +1375,7 @@ int wl12xx_acx_set_ba_initiator_policy(struct wl1271 *wl, wl1271_debug(DEBUG_ACX, "acx ba initiator policy"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -1412,7 +1411,7 @@ int wl12xx_acx_set_ba_receiver_session(struct wl1271 *wl, u8 tid_index, wl1271_debug(DEBUG_ACX, "acx ba receiver session setting"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -1451,7 +1450,7 @@ int wl12xx_acx_tsf_info(struct wl1271 *wl, struct wl12xx_vif *wlvif, struct wl12xx_acx_fw_tsf_information *tsf_info; int ret; - tsf_info = kzalloc(sizeof(*tsf_info), GFP_KERNEL); + tsf_info = kzalloc_obj(*tsf_info, GFP_KERNEL); if (!tsf_info) { ret = -ENOMEM; goto out; @@ -1483,7 +1482,7 @@ int wl1271_acx_ps_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx ps rx streaming"); - rx_streaming = kzalloc(sizeof(*rx_streaming), GFP_KERNEL); + rx_streaming = kzalloc_obj(*rx_streaming, GFP_KERNEL); if (!rx_streaming) { ret = -ENOMEM; goto out; @@ -1530,7 +1529,7 @@ int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl, struct wl12xx_vif *wlvif) wl1271_debug(DEBUG_ACX, "acx ap max tx retry"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; @@ -1555,7 +1554,7 @@ int wl12xx_acx_config_ps(struct wl1271 *wl, struct wl12xx_vif *wlvif) wl1271_debug(DEBUG_ACX, "acx config ps"); - config_ps = kzalloc(sizeof(*config_ps), GFP_KERNEL); + config_ps = kzalloc_obj(*config_ps, GFP_KERNEL); if (!config_ps) { ret = -ENOMEM; goto out; @@ -1586,7 +1585,7 @@ int wl1271_acx_set_inconnection_sta(struct wl1271 *wl, wl1271_debug(DEBUG_ACX, "acx set inconnaction sta %pM", addr); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; @@ -1612,7 +1611,7 @@ int wl1271_acx_fm_coex(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "acx fm coex setting"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -1653,7 +1652,7 @@ int wl12xx_acx_set_rate_mgmt_params(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "acx set rate mgmt params"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; @@ -1695,7 +1694,7 @@ int wl12xx_acx_config_hangover(struct wl1271 *wl) wl1271_debug(DEBUG_ACX, "acx config hangover"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -1735,7 +1734,7 @@ int wlcore_acx_average_rssi(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_ACX, "acx roaming statistics"); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) { ret = -ENOMEM; goto out; @@ -1767,7 +1766,7 @@ int wl1271_acx_default_rx_filter_enable(struct wl1271 *wl, bool enable, wl1271_debug(DEBUG_ACX, "acx default rx filter en: %d act: %d", enable, action); - acx = kzalloc(sizeof(*acx), GFP_KERNEL); + acx = kzalloc_obj(*acx, GFP_KERNEL); if (!acx) return -ENOMEM; diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c index 9d73ba933a16..ded64bf9c5a6 100644 --- a/drivers/net/wireless/ti/wlcore/cmd.c +++ b/drivers/net/wireless/ti/wlcore/cmd.c @@ -172,7 +172,7 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl, *timeout = false; - events_vector = kmalloc(sizeof(*events_vector), GFP_KERNEL | GFP_DMA); + events_vector = kmalloc_obj(*events_vector, GFP_KERNEL | GFP_DMA); if (!events_vector) return -ENOMEM; @@ -231,7 +231,7 @@ int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 *addr, u8 role_type, if (WARN_ON(*role_id != WL12XX_INVALID_ROLE_ID)) return -EBUSY; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -273,7 +273,7 @@ int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id) if (WARN_ON(*role_id == WL12XX_INVALID_ROLE_ID)) return -ENOENT; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -431,7 +431,7 @@ static int wl12xx_cmd_role_start_dev(struct wl1271 *wl, struct wl12xx_cmd_role_start *cmd; int ret; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -483,7 +483,7 @@ static int wl12xx_cmd_role_stop_dev(struct wl1271 *wl, if (WARN_ON(wlvif->dev_hlid == WL12XX_INVALID_LINK_ID)) return -EINVAL; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -517,7 +517,7 @@ int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif) u32 supported_rates; int ret; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -594,7 +594,7 @@ int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif) if (WARN_ON(wlvif->sta.hlid == WL12XX_INVALID_LINK_ID)) return -EINVAL; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -641,7 +641,7 @@ int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif) } } - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -736,7 +736,7 @@ int wl12xx_cmd_role_stop_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif) struct wl12xx_cmd_role_stop *cmd; int ret; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -769,7 +769,7 @@ int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif) struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; int ret; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -942,7 +942,7 @@ int wl1271_cmd_data_path(struct wl1271 *wl, bool enable) wl1271_debug(DEBUG_CMD, "cmd data path"); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -993,7 +993,7 @@ int wl1271_cmd_ps_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_CMD, "cmd set ps mode"); - ps_params = kzalloc(sizeof(*ps_params), GFP_KERNEL); + ps_params = kzalloc_obj(*ps_params, GFP_KERNEL); if (!ps_params) { ret = -ENOMEM; goto out; @@ -1028,7 +1028,7 @@ int wl1271_cmd_template_set(struct wl1271 *wl, u8 role_id, WARN_ON(buf_len > WL1271_CMD_TEMPL_MAX_SIZE); buf_len = min_t(size_t, buf_len, WL1271_CMD_TEMPL_MAX_SIZE); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -1340,7 +1340,7 @@ int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid) wl1271_debug(DEBUG_CMD, "cmd set_default_wep_key %d", id); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -1376,7 +1376,7 @@ int wl1271_cmd_set_sta_key(struct wl1271 *wl, struct wl12xx_vif *wlvif, if (wlvif->sta.hlid == WL12XX_INVALID_LINK_ID) return 0; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -1442,7 +1442,7 @@ int wl1271_cmd_set_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif, int ret = 0; u8 lid_type; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) return -ENOMEM; @@ -1505,7 +1505,7 @@ int wl12xx_cmd_set_peer_state(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_CMD, "cmd set peer state (hlid=%d)", hlid); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -1540,7 +1540,7 @@ int wl12xx_cmd_add_peer(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_CMD, "cmd add peer %d", (int)hlid); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -1599,7 +1599,7 @@ int wl12xx_cmd_remove_peer(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl1271_debug(DEBUG_CMD, "cmd remove peer %d", (int)hlid); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -1733,7 +1733,7 @@ int wlcore_cmd_regdomain_config_locked(struct wl1271 *wl) if (!memcmp(tmp_ch_bitmap, wl->reg_ch_conf_last, sizeof(tmp_ch_bitmap))) goto out; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -1778,7 +1778,7 @@ int wl12xx_cmd_config_fwlog(struct wl1271 *wl) wl1271_debug(DEBUG_CMD, "cmd config firmware logger"); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -1810,7 +1810,7 @@ int wl12xx_cmd_stop_fwlog(struct wl1271 *wl) wl1271_debug(DEBUG_CMD, "cmd stop firmware logger"); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -1840,7 +1840,7 @@ static int wl12xx_cmd_roc(struct wl1271 *wl, struct wl12xx_vif *wlvif, if (WARN_ON(role_id == WL12XX_INVALID_ROLE_ID)) return -EINVAL; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -1882,7 +1882,7 @@ static int wl12xx_cmd_croc(struct wl1271 *wl, u8 role_id) wl1271_debug(DEBUG_CMD, "cmd croc (%d)", role_id); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -1951,7 +1951,7 @@ int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl, struct wl12xx_vif *wlvif) wl1271_debug(DEBUG_ACX, "cmd stop channel switch"); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; @@ -2055,7 +2055,7 @@ int wlcore_cmd_generic_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif, "cmd generic cfg (role %d feature %d enable %d value %d)", wlvif->role_id, feature, enable, value); - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) return -ENOMEM; diff --git a/drivers/net/wireless/ti/wlcore/init.c b/drivers/net/wireless/ti/wlcore/init.c index 03b49baa9d89..3f544a900f67 100644 --- a/drivers/net/wireless/ti/wlcore/init.c +++ b/drivers/net/wireless/ti/wlcore/init.c @@ -148,7 +148,7 @@ static int wl1271_ap_init_deauth_template(struct wl1271 *wl, int ret; u32 rate; - tmpl = kzalloc(sizeof(*tmpl), GFP_KERNEL); + tmpl = kzalloc_obj(*tmpl, GFP_KERNEL); if (!tmpl) { ret = -ENOMEM; goto out; @@ -175,7 +175,7 @@ static int wl1271_ap_init_null_template(struct wl1271 *wl, int ret; u32 rate; - nullfunc = kzalloc(sizeof(*nullfunc), GFP_KERNEL); + nullfunc = kzalloc_obj(*nullfunc, GFP_KERNEL); if (!nullfunc) { ret = -ENOMEM; goto out; @@ -208,7 +208,7 @@ static int wl1271_ap_init_qos_null_template(struct wl1271 *wl, int ret; u32 rate; - qosnull = kzalloc(sizeof(*qosnull), GFP_KERNEL); + qosnull = kzalloc_obj(*qosnull, GFP_KERNEL); if (!qosnull) { ret = -ENOMEM; goto out; diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index dce79bce2e3f..82e035aea874 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -1070,11 +1070,11 @@ static int wl1271_setup(struct wl1271 *wl) if (!wl->raw_fw_status) goto err; - wl->fw_status = kzalloc(sizeof(*wl->fw_status), GFP_KERNEL); + wl->fw_status = kzalloc_obj(*wl->fw_status, GFP_KERNEL); if (!wl->fw_status) goto err; - wl->tx_res_if = kzalloc(sizeof(*wl->tx_res_if), GFP_KERNEL); + wl->tx_res_if = kzalloc_obj(*wl->tx_res_if, GFP_KERNEL); if (!wl->tx_res_if) goto err; @@ -1477,7 +1477,7 @@ wl1271_validate_wowlan_pattern(struct cfg80211_pkt_pattern *p) struct wl12xx_rx_filter *wl1271_rx_filter_alloc(void) { - return kzalloc(sizeof(struct wl12xx_rx_filter), GFP_KERNEL); + return kzalloc_obj(struct wl12xx_rx_filter, GFP_KERNEL); } void wl1271_rx_filter_free(struct wl12xx_rx_filter *filter) @@ -3215,7 +3215,7 @@ static u64 wl1271_op_prepare_multicast(struct ieee80211_hw *hw, struct wl1271_filter_params *fp; struct netdev_hw_addr *ha; - fp = kzalloc(sizeof(*fp), GFP_ATOMIC); + fp = kzalloc_obj(*fp, GFP_ATOMIC); if (!fp) { wl1271_error("Out of memory setting filters."); return 0; @@ -3346,7 +3346,7 @@ static int wl1271_record_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif, if (i == MAX_NUM_KEYS) return -EBUSY; - ap_key = kzalloc(sizeof(*ap_key), GFP_KERNEL); + ap_key = kzalloc_obj(*ap_key, GFP_KERNEL); if (!ap_key) return -ENOMEM; @@ -6459,7 +6459,7 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size, goto err_fwlog; } - wl->buffer_32 = kmalloc(sizeof(*wl->buffer_32), GFP_KERNEL); + wl->buffer_32 = kmalloc_obj(*wl->buffer_32, GFP_KERNEL); if (!wl->buffer_32) { ret = -ENOMEM; goto err_mbox; diff --git a/drivers/net/wireless/ti/wlcore/scan.c b/drivers/net/wireless/ti/wlcore/scan.c index f6dc54c1dbad..7cd58bb0efb6 100644 --- a/drivers/net/wireless/ti/wlcore/scan.c +++ b/drivers/net/wireless/ti/wlcore/scan.c @@ -389,7 +389,7 @@ wlcore_scan_sched_scan_ssid_list(struct wl1271 *wl, goto out; } - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out; diff --git a/drivers/net/wireless/ti/wlcore/testmode.c b/drivers/net/wireless/ti/wlcore/testmode.c index 7c0cb1b7fef0..caca2786d07c 100644 --- a/drivers/net/wireless/ti/wlcore/testmode.c +++ b/drivers/net/wireless/ti/wlcore/testmode.c @@ -159,7 +159,7 @@ static int wl1271_tm_cmd_interrogate(struct wl1271 *wl, struct nlattr *tb[]) if (ret < 0) goto out; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto out_sleep; diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c index 4d9f5f87e814..f4f37f71285e 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim.c +++ b/drivers/net/wireless/virtual/mac80211_hwsim.c @@ -6489,7 +6489,7 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info) if (info->attrs[HWSIM_ATTR_PMSR_SUPPORT]) { struct cfg80211_pmsr_capabilities *pmsr_capa; - pmsr_capa = kmalloc(sizeof(*pmsr_capa), GFP_KERNEL); + pmsr_capa = kmalloc_obj(*pmsr_capa, GFP_KERNEL); if (!pmsr_capa) { ret = -ENOMEM; goto out_free; diff --git a/drivers/net/wireless/virtual/virt_wifi.c b/drivers/net/wireless/virtual/virt_wifi.c index 4eae89376feb..eac81ebf9551 100644 --- a/drivers/net/wireless/virtual/virt_wifi.c +++ b/drivers/net/wireless/virtual/virt_wifi.c @@ -558,7 +558,7 @@ static int virt_wifi_newlink(struct net_device *dev, netif_stacked_transfer_operstate(priv->lowerdev, dev); SET_NETDEV_DEV(dev, &priv->lowerdev->dev); - dev->ieee80211_ptr = kzalloc(sizeof(*dev->ieee80211_ptr), GFP_KERNEL); + dev->ieee80211_ptr = kzalloc_obj(*dev->ieee80211_ptr, GFP_KERNEL); if (!dev->ieee80211_ptr) { err = -ENOMEM; diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c index 0f6271d7259b..f5063efc8e42 100644 --- a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c @@ -722,8 +722,7 @@ static int zd_mac_config_beacon(struct ieee80211_hw *hw, struct sk_buff *beacon, /* Alloc memory for full beacon write at once. */ num_cmds = 1 + zd_chip_is_zd1211b(&mac->chip) + full_len; - ioreqs = kmalloc_array(num_cmds, sizeof(struct zd_ioreq32), - GFP_KERNEL); + ioreqs = kmalloc_objs(struct zd_ioreq32, num_cmds, GFP_KERNEL); if (!ioreqs) { r = -ENOMEM; goto out_nofree; diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_rf_uw2453.c b/drivers/net/wireless/zydas/zd1211rw/zd_rf_uw2453.c index a4e7f187d82d..d15d95ff5aad 100644 --- a/drivers/net/wireless/zydas/zd1211rw/zd_rf_uw2453.c +++ b/drivers/net/wireless/zydas/zd1211rw/zd_rf_uw2453.c @@ -518,7 +518,7 @@ int zd_rf_init_uw2453(struct zd_rf *rf) /* we have our own TX integration code */ rf->update_channel_int = 0; - rf->priv = kmalloc(sizeof(struct uw2453_priv), GFP_KERNEL); + rf->priv = kmalloc_obj(struct uw2453_priv, GFP_KERNEL); if (rf->priv == NULL) return -ENOMEM; diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c index 8ee15a15f4ca..e5c3be14ae4e 100644 --- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c @@ -752,7 +752,7 @@ static int __zd_usb_enable_rx(struct zd_usb *usb) dev_dbg_f(zd_usb_dev(usb), "\n"); r = -ENOMEM; - urbs = kcalloc(RX_URBS_COUNT, sizeof(struct urb *), GFP_KERNEL); + urbs = kzalloc_objs(struct urb *, RX_URBS_COUNT, GFP_KERNEL); if (!urbs) goto error; for (i = 0; i < RX_URBS_COUNT; i++) { |
