summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2026-04-13 22:26:03 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2026-04-13 22:26:03 +0000
commitbc66030cad2bc6999493d7a61a33fc3d3c6e2d08 (patch)
tree07ff0921b158b95d351c8d6b1b931bbe338a151d
parent127e3efc850139279d539791cdab8c8175db2a6d (diff)
-rw-r--r--brcmfmac/bca/core.c3
-rw-r--r--brcmfmac/bcdc.c2
-rw-r--r--brcmfmac/bcmsdh.c13
-rw-r--r--brcmfmac/btcoex.c2
-rw-r--r--brcmfmac/cfg80211.c27
-rw-r--r--brcmfmac/cfg80211.h8
-rw-r--r--brcmfmac/chip.c4
-rw-r--r--brcmfmac/common.c5
-rw-r--r--brcmfmac/core.c6
-rw-r--r--brcmfmac/cyw/core.c3
-rw-r--r--brcmfmac/firmware.c4
-rw-r--r--brcmfmac/flowring.c9
-rw-r--r--brcmfmac/fweh.c7
-rw-r--r--brcmfmac/fwsignal.c5
-rw-r--r--brcmfmac/msgbuf.c12
-rw-r--r--brcmfmac/pcie.c15
-rw-r--r--brcmfmac/pno.c4
-rw-r--r--brcmfmac/proto.c2
-rw-r--r--brcmfmac/sdio.c9
-rw-r--r--brcmfmac/sdio.h2
-rw-r--r--brcmfmac/usb.c6
-rw-r--r--brcmfmac/wcc/core.c3
-rw-r--r--brcmsmac/aiutils.c2
-rw-r--r--brcmsmac/ampdu.c2
-rw-r--r--brcmsmac/antsel.c2
-rw-r--r--brcmsmac/channel.c2
-rw-r--r--brcmsmac/dma.c4
-rw-r--r--brcmsmac/mac80211_if.c2
-rw-r--r--brcmsmac/main.c29
-rw-r--r--brcmsmac/phy/phy_cmn.c4
-rw-r--r--brcmsmac/phy/phy_lcn.c15
-rw-r--r--brcmsmac/phy/phy_n.c3
-rw-r--r--brcmsmac/phy_shim.c2
33 files changed, 106 insertions, 112 deletions
diff --git a/brcmfmac/bca/core.c b/brcmfmac/bca/core.c
index f471c962104a..6cb8343da936 100644
--- a/brcmfmac/bca/core.c
+++ b/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);
if (!fweh)
return -ENOMEM;
diff --git a/brcmfmac/bcdc.c b/brcmfmac/bcdc.c
index 9ec0c60b6da1..1817adc29cd8 100644
--- a/brcmfmac/bcdc.c
+++ b/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/brcmfmac/bcmsdh.c b/brcmfmac/bcmsdh.c
index 6a3f187320fc..d24b80e492e0 100644
--- a/brcmfmac/bcmsdh.c
+++ b/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);
if (!sdiodev->freezer)
return -ENOMEM;
atomic_set(&sdiodev->freezer->thread_count, 0);
@@ -951,11 +951,10 @@ int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
goto out;
/* try to attach to the target device */
- sdiodev->bus = brcmf_sdio_probe(sdiodev);
- if (IS_ERR(sdiodev->bus)) {
- ret = PTR_ERR(sdiodev->bus);
+ ret = brcmf_sdio_probe(sdiodev);
+ if (ret)
goto out;
- }
+
brcmf_sdiod_host_fixup(sdiodev->func2->card->host);
out:
if (ret)
@@ -1067,10 +1066,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);
if (!bus_if)
return -ENOMEM;
- sdiodev = kzalloc(sizeof(*sdiodev), GFP_KERNEL);
+ sdiodev = kzalloc_obj(*sdiodev);
if (!sdiodev) {
kfree(bus_if);
return -ENOMEM;
diff --git a/brcmfmac/btcoex.c b/brcmfmac/btcoex.c
index 67c0c5a92f99..0ca7f8672803 100644
--- a/brcmfmac/btcoex.c
+++ b/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);
if (!btci)
return -ENOMEM;
diff --git a/brcmfmac/cfg80211.c b/brcmfmac/cfg80211.c
index bb96b87b2a6e..cea02b33b798 100644
--- a/brcmfmac/cfg80211.c
+++ b/brcmfmac/cfg80211.c
@@ -932,7 +932,7 @@ static struct wireless_dev *brcmf_mon_add_vif(struct wiphy *wiphy,
ndev->type = ARPHRD_IEEE80211_RADIOTAP;
ndev->ieee80211_ptr = &vif->wdev;
ndev->needs_free_netdev = true;
- ndev->priv_destructor = brcmf_cfg80211_free_netdev;
+ ndev->priv_destructor = brcmf_cfg80211_free_vif;
SET_NETDEV_DEV(ndev, wiphy_dev(cfg->wiphy));
ifp = netdev_priv(ndev);
@@ -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);
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);
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);
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);
if (!vif)
return ERR_PTR(-ENOMEM);
@@ -6082,7 +6082,7 @@ void brcmf_free_vif(struct brcmf_cfg80211_vif *vif)
kfree(vif);
}
-void brcmf_cfg80211_free_netdev(struct net_device *ndev)
+void brcmf_cfg80211_free_vif(struct net_device *ndev)
{
struct brcmf_cfg80211_vif *vif;
struct brcmf_if *ifp;
@@ -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);
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);
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);
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);
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);
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);
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);
if (!cfg) {
bphy_err(drvr, "Could not allocate wiphy device\n");
return NULL;
diff --git a/brcmfmac/cfg80211.h b/brcmfmac/cfg80211.h
index 273c80f2d483..6ceb30142905 100644
--- a/brcmfmac/cfg80211.h
+++ b/brcmfmac/cfg80211.h
@@ -182,7 +182,7 @@ struct brcmf_cfg80211_profile {
* @BRCMF_VIF_STATUS_CONNECTED: connected/joined successfully.
* @BRCMF_VIF_STATUS_DISCONNECTING: disconnect/disable in progress.
* @BRCMF_VIF_STATUS_AP_CREATED: AP operation started.
- * @BRCMF_VIF_STATUS_EAP_SUCCUSS: EAPOL handshake successful.
+ * @BRCMF_VIF_STATUS_EAP_SUCCESS: EAPOL handshake successful.
* @BRCMF_VIF_STATUS_ASSOC_SUCCESS: successful SET_SSID received.
*/
enum brcmf_vif_status {
@@ -201,10 +201,12 @@ enum brcmf_vif_status {
* @probe_req_ie: IE info for probe request.
* @probe_res_ie: IE info for probe response.
* @beacon_ie: IE info for beacon frame.
+ * @assoc_req_ie: IE info for association request frame.
* @assoc_res_ie: IE info for association response frame.
* @probe_req_ie_len: IE info length for probe request.
* @probe_res_ie_len: IE info length for probe response.
* @beacon_ie_len: IE info length for beacon frame.
+ * @assoc_req_ie_len: IE info length for association request frame.
* @assoc_res_ie_len: IE info length for association response frame.
*/
struct vif_saved_ie {
@@ -227,12 +229,14 @@ struct vif_saved_ie {
* @wdev: wireless device.
* @profile: profile information.
* @sme_state: SME state using enum brcmf_vif_status bits.
+ * @saved_ie: saved IE info for a vif.
* @list: linked list.
* @mgmt_tx: completion for management frame transmit.
* @mgmt_tx_status: status of last management frame sent to firmware.
* @mgmt_tx_id:
* @mgmt_rx_reg: registered rx mgmt frame types.
* @mbss: Multiple BSS type, set if not first AP (not relevant for P2P).
+ * @is_11d: beacon contains country IE, enable regulatory 802.11d support
* @cqm_rssi_low: Lower RSSI limit for CQM monitoring
* @cqm_rssi_high: Upper RSSI limit for CQM monitoring
* @cqm_rssi_last: Last RSSI reading for CQM monitoring
@@ -489,7 +493,7 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
void brcmf_set_mpc(struct brcmf_if *ndev, int mpc);
bool brcmf_is_apmode_operating(struct wiphy *wiphy);
void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg);
-void brcmf_cfg80211_free_netdev(struct net_device *ndev);
+void brcmf_cfg80211_free_vif(struct net_device *ndev);
int brcmf_set_wsec(struct brcmf_if *ifp, const u8 *key, u16 key_len, u16 flags);
int brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
diff --git a/brcmfmac/chip.c b/brcmfmac/chip.c
index 4239f2b21e54..a790f1693b82 100644
--- a/brcmfmac/chip.c
+++ b/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);
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);
if (!chip)
return ERR_PTR(-ENOMEM);
diff --git a/brcmfmac/common.c b/brcmfmac/common.c
index 688f16c51319..b6027d83e6ab 100644
--- a/brcmfmac/common.c
+++ b/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);
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/brcmfmac/core.c b/brcmfmac/core.c
index 862a0336a0b5..ec170647800d 100644
--- a/brcmfmac/core.c
+++ b/brcmfmac/core.c
@@ -674,7 +674,7 @@ int brcmf_net_attach(struct brcmf_if *ifp, bool locked)
netif_carrier_off(ndev);
- ndev->priv_destructor = brcmf_cfg80211_free_netdev;
+ ndev->priv_destructor = brcmf_cfg80211_free_vif;
brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name);
return 0;
@@ -692,7 +692,7 @@ void brcmf_net_detach(struct net_device *ndev, bool locked)
else
unregister_netdev(ndev);
} else {
- brcmf_cfg80211_free_netdev(ndev);
+ brcmf_cfg80211_free_vif(ndev);
free_netdev(ndev);
}
}
@@ -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);
if (!ifp)
return ERR_PTR(-ENOMEM);
} else {
diff --git a/brcmfmac/cyw/core.c b/brcmfmac/cyw/core.c
index 4f0ea4347840..ce09d44fa73c 100644
--- a/brcmfmac/cyw/core.c
+++ b/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);
if (!fweh)
return -ENOMEM;
diff --git a/brcmfmac/firmware.c b/brcmfmac/firmware.c
index ef79924fd8f4..4bacd83db052 100644
--- a/brcmfmac/firmware.c
+++ b/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);
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);
if (!fwreq)
return NULL;
diff --git a/brcmfmac/flowring.c b/brcmfmac/flowring.c
index e1127d7e086d..df7e3bee19f2 100644
--- a/brcmfmac/flowring.c
+++ b/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);
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);
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/brcmfmac/fweh.c b/brcmfmac/fweh.c
index c2d98ee6652f..1cff4ba76943 100644
--- a/brcmfmac/fweh.c
+++ b/brcmfmac/fweh.c
@@ -153,6 +153,11 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr,
bphy_err(drvr, "invalid interface index: %u\n", ifevent->ifidx);
return;
}
+ if (ifevent->bsscfgidx >= BRCMF_MAX_IFS) {
+ bphy_err(drvr, "invalid bsscfg index: %u\n",
+ ifevent->bsscfgidx);
+ return;
+ }
ifp = drvr->iflist[ifevent->bsscfgidx];
@@ -497,7 +502,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/brcmfmac/fwsignal.c b/brcmfmac/fwsignal.c
index b70d20128f98..a43f1a38b0e3 100644
--- a/brcmfmac/fwsignal.c
+++ b/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);
if (!fws) {
rc = -ENOMEM;
goto fail;
diff --git a/brcmfmac/msgbuf.c b/brcmfmac/msgbuf.c
index 45fbcbdc7d9e..ba1ce1552e0f 100644
--- a/brcmfmac/msgbuf.c
+++ b/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);
if (!array)
return NULL;
- pktids = kzalloc(sizeof(*pktids), GFP_KERNEL);
+ pktids = kzalloc_obj(*pktids);
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);
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);
if (!msgbuf->flowring_dma_handle)
goto fail;
diff --git a/brcmfmac/pcie.c b/brcmfmac/pcie.c
index 6327f4eca500..45b342ea0637 100644
--- a/brcmfmac/pcie.c
+++ b/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);
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);
if (!rings)
goto fail;
@@ -2199,8 +2199,7 @@ 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);
if (!flowrings)
goto fail;
@@ -2457,7 +2456,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);
if (devinfo == NULL)
return ret;
@@ -2477,7 +2476,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);
if (pcie_bus_dev == NULL) {
ret = -ENOMEM;
goto fail;
@@ -2495,12 +2494,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);
if (!bus) {
ret = -ENOMEM;
goto fail;
}
- bus->msgbuf = kzalloc(sizeof(*bus->msgbuf), GFP_KERNEL);
+ bus->msgbuf = kzalloc_obj(*bus->msgbuf);
if (!bus->msgbuf) {
ret = -ENOMEM;
kfree(bus);
diff --git a/brcmfmac/pno.c b/brcmfmac/pno.c
index 05f66ab13bed..d9fc94076791 100644
--- a/brcmfmac/pno.c
+++ b/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);
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);
if (!pi)
return -ENOMEM;
diff --git a/brcmfmac/proto.c b/brcmfmac/proto.c
index 2e911d4874af..7fc441859f52 100644
--- a/brcmfmac/proto.c
+++ b/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/brcmfmac/sdio.c b/brcmfmac/sdio.c
index 8cf9d7e7c3f7..30f6fcb68632 100644
--- a/brcmfmac/sdio.c
+++ b/brcmfmac/sdio.c
@@ -4445,7 +4445,7 @@ brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus)
return fwreq;
}
-struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
+int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
{
int ret;
struct brcmf_sdio *bus;
@@ -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;
@@ -4551,11 +4551,12 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
goto fail;
}
- return bus;
+ return 0;
fail:
brcmf_sdio_remove(bus);
- return ERR_PTR(ret);
+ sdiodev->bus = NULL;
+ return ret;
}
/* Detach and free everything */
diff --git a/brcmfmac/sdio.h b/brcmfmac/sdio.h
index 0d18ed15b403..80180d5c6c87 100644
--- a/brcmfmac/sdio.h
+++ b/brcmfmac/sdio.h
@@ -358,7 +358,7 @@ void brcmf_sdiod_freezer_uncount(struct brcmf_sdio_dev *sdiodev);
int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev);
int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev);
-struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev);
+int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev);
void brcmf_sdio_remove(struct brcmf_sdio *bus);
void brcmf_sdio_isr(struct brcmf_sdio *bus, bool in_isr);
diff --git a/brcmfmac/usb.c b/brcmfmac/usb.c
index f0129d10d2b9..0b52f968b907 100644
--- a/brcmfmac/usb.c
+++ b/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/brcmfmac/wcc/core.c b/brcmfmac/wcc/core.c
index 05d7c2a4fba5..e14b5530f720 100644
--- a/brcmfmac/wcc/core.c
+++ b/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);
if (!fweh)
return -ENOMEM;
diff --git a/brcmsmac/aiutils.c b/brcmsmac/aiutils.c
index 0cb64fc56783..6a67db07833e 100644
--- a/brcmsmac/aiutils.c
+++ b/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/brcmsmac/ampdu.c b/brcmsmac/ampdu.c
index e1d707a7c964..fc7a5dd2e5d8 100644
--- a/brcmsmac/ampdu.c
+++ b/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/brcmsmac/antsel.c b/brcmsmac/antsel.c
index f411bc6d795d..9a3e40528ff7 100644
--- a/brcmsmac/antsel.c
+++ b/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/brcmsmac/channel.c b/brcmsmac/channel.c
index 3878c4124e25..cdfe8635c012 100644
--- a/brcmsmac/channel.c
+++ b/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/brcmsmac/dma.c b/brcmsmac/dma.c
index c739bf7463b3..a329c20e92fb 100644
--- a/brcmsmac/dma.c
+++ b/brcmsmac/dma.c
@@ -483,7 +483,7 @@ static void *dma_ringalloc(struct dma_info *di, u32 boundary, uint size,
if (((desc_strtaddr + size - 1) & boundary) != (desc_strtaddr
& boundary)) {
*alignbits = dma_align_sizetobits(size);
- dma_free_coherent(di->dmadev, size, va, *descpa);
+ dma_free_coherent(di->dmadev, *alloced, va, *descpa);
va = dma_alloc_consistent(di, size, *alignbits,
alloced, descpa);
}
@@ -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/brcmsmac/mac80211_if.c b/brcmsmac/mac80211_if.c
index aadcff1e2b5d..6255d673d2d3 100644
--- a/brcmsmac/mac80211_if.c
+++ b/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/brcmsmac/main.c b/brcmsmac/main.c
index c1a9c1e442ee..c7eaf160e1fa 100644
--- a/brcmsmac/main.c
+++ b/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/brcmsmac/phy/phy_cmn.c b/brcmsmac/phy/phy_cmn.c
index ce6ce2dea39c..7eae73ef7e94 100644
--- a/brcmsmac/phy/phy_cmn.c
+++ b/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/brcmsmac/phy/phy_lcn.c b/brcmsmac/phy/phy_lcn.c
index b4bba67a45ec..8cec5ad79fda 100644
--- a/brcmsmac/phy/phy_lcn.c
+++ b/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;
@@ -4790,7 +4790,7 @@ void wlc_phy_init_lcnphy(struct brcms_phy *pi)
wlc_lcnphy_calib_modes(pi, PHY_PERICAL_PHYINIT);
}
-static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
+static void wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
{
s8 txpwr = 0;
int i;
@@ -4879,8 +4879,6 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
sprom->ant_available_bg);
}
pi_lcn->lcnphy_cck_dig_filt_type = -1;
-
- return true;
}
void wlc_2064_vco_cal(struct brcms_phy *pi)
@@ -4968,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;
@@ -4992,10 +4990,7 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi)
pi->pi_fptr.radioloftget = wlc_lcnphy_get_radio_loft;
pi->pi_fptr.detach = wlc_phy_detach_lcnphy;
- if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) {
- kfree(pi->u.pi_lcnphy);
- return false;
- }
+ wlc_phy_txpwr_srom_read_lcnphy(pi);
if (LCNREV_IS(pi->pubpi.phy_rev, 1)) {
if (pi_lcn->lcnphy_tempsense_option == 3) {
diff --git a/brcmsmac/phy/phy_n.c b/brcmsmac/phy/phy_n.c
index b03d5a1f1a93..86cfa3e87a04 100644
--- a/brcmsmac/phy/phy_n.c
+++ b/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/brcmsmac/phy_shim.c b/brcmsmac/phy_shim.c
index 8b852581c4e4..20cf6379e838 100644
--- a/brcmsmac/phy_shim.c
+++ b/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;