summaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2026-02-20 23:49:23 -0800
committerKees Cook <kees@kernel.org>2026-02-21 01:02:28 -0800
commit69050f8d6d075dc01af7a5f2f550a8067510366f (patch)
treebb265f94d9dfa7876c06a5d9f88673d496a15341 /sound/soc
parentd39a1d7486d98668dd34aaa6732aad7977c45f5a (diff)
downloadlinux-next-69050f8d6d075dc01af7a5f2f550a8067510366f.tar.gz
linux-next-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 'sound/soc')
-rw-r--r--sound/soc/amd/acp-pcm-dma.c2
-rw-r--r--sound/soc/amd/acp/acp-platform.c2
-rw-r--r--sound/soc/amd/acp/acp-sdw-legacy-mach.c4
-rw-r--r--sound/soc/amd/acp/acp-sdw-sof-mach.c4
-rw-r--r--sound/soc/amd/ps/ps-pdm-dma.c2
-rw-r--r--sound/soc/amd/ps/ps-sdw-dma.c2
-rw-r--r--sound/soc/amd/raven/acp3x-pcm-dma.c2
-rw-r--r--sound/soc/amd/renoir/acp3x-pdm-dma.c2
-rw-r--r--sound/soc/amd/vangogh/acp5x-pcm-dma.c2
-rw-r--r--sound/soc/amd/yc/acp6x-pdm-dma.c2
-rw-r--r--sound/soc/atmel/atmel-pcm-pdc.c2
-rw-r--r--sound/soc/atmel/mchp-pdmc.c2
-rw-r--r--sound/soc/au1x/dma.c6
-rw-r--r--sound/soc/bcm/bcm63xx-pcm-whistler.c4
-rw-r--r--sound/soc/codecs/aw88395/aw88395_lib.c4
-rw-r--r--sound/soc/codecs/cx20442.c2
-rw-r--r--sound/soc/codecs/da7219.c4
-rw-r--r--sound/soc/codecs/lpass-rx-macro.c6
-rw-r--r--sound/soc/codecs/lpass-wsa-macro.c8
-rw-r--r--sound/soc/codecs/pcm6240.c11
-rw-r--r--sound/soc/codecs/sigmadsp.c5
-rw-r--r--sound/soc/codecs/tas2781-fmwlib.c45
-rw-r--r--sound/soc/codecs/tas2783-sdw.c4
-rw-r--r--sound/soc/codecs/wcd-clsh-v2.c2
-rw-r--r--sound/soc/codecs/wcd-mbhc-v2.c2
-rw-r--r--sound/soc/codecs/wm0010.c2
-rw-r--r--sound/soc/codecs/wm_adsp.c12
-rw-r--r--sound/soc/fsl/fsl_asrc_m2m.c4
-rw-r--r--sound/soc/fsl/fsl_dma.c2
-rw-r--r--sound/soc/fsl/fsl_qmc_audio.c2
-rw-r--r--sound/soc/fsl/imx-pcm-fiq.c2
-rw-r--r--sound/soc/fsl/mpc5200_dma.c2
-rw-r--r--sound/soc/fsl/p1022_ds.c2
-rw-r--r--sound/soc/fsl/p1022_rdk.c2
-rw-r--r--sound/soc/generic/audio-graph-card.c2
-rw-r--r--sound/soc/generic/audio-graph-card2.c2
-rw-r--r--sound/soc/generic/simple-card.c2
-rw-r--r--sound/soc/intel/atom/sst-mfld-platform-compress.c2
-rw-r--r--sound/soc/intel/atom/sst-mfld-platform-pcm.c2
-rw-r--r--sound/soc/intel/atom/sst/sst.c2
-rw-r--r--sound/soc/intel/atom/sst/sst_ipc.c2
-rw-r--r--sound/soc/intel/atom/sst/sst_loader.c2
-rw-r--r--sound/soc/intel/atom/sst/sst_pvt.c2
-rw-r--r--sound/soc/intel/avs/path.c8
-rw-r--r--sound/soc/intel/avs/pcm.c2
-rw-r--r--sound/soc/intel/avs/utils.c6
-rw-r--r--sound/soc/intel/boards/sof_sdw.c4
-rw-r--r--sound/soc/intel/catpt/pcm.c2
-rw-r--r--sound/soc/loongson/loongson_dma.c2
-rw-r--r--sound/soc/mediatek/mt8186/mt8186-audsys-clk.c2
-rw-r--r--sound/soc/mediatek/mt8188/mt8188-audsys-clk.c2
-rw-r--r--sound/soc/mediatek/mt8195/mt8195-audsys-clk.c2
-rw-r--r--sound/soc/meson/aiu-fifo.c2
-rw-r--r--sound/soc/meson/axg-tdm-formatter.c2
-rw-r--r--sound/soc/meson/meson-codec-glue.c2
-rw-r--r--sound/soc/pxa/pxa-ssp.c4
-rw-r--r--sound/soc/qcom/lpass-platform.c2
-rw-r--r--sound/soc/qcom/qdsp6/q6adm.c2
-rw-r--r--sound/soc/qcom/qdsp6/q6afe.c2
-rw-r--r--sound/soc/qcom/qdsp6/q6apm-dai.c4
-rw-r--r--sound/soc/qcom/qdsp6/q6apm.c6
-rw-r--r--sound/soc/qcom/qdsp6/q6asm-dai.c4
-rw-r--r--sound/soc/qcom/qdsp6/q6asm.c4
-rw-r--r--sound/soc/qcom/qdsp6/q6core.c2
-rw-r--r--sound/soc/qcom/qdsp6/q6routing.c2
-rw-r--r--sound/soc/qcom/qdsp6/topology.c17
-rw-r--r--sound/soc/renesas/siu_dai.c2
-rw-r--r--sound/soc/samsung/idma.c2
-rw-r--r--sound/soc/sdca/sdca_asoc.c2
-rw-r--r--sound/soc/sdca/sdca_function_device.c2
-rw-r--r--sound/soc/sdca/sdca_jack.c2
-rw-r--r--sound/soc/soc-ac97.c2
-rw-r--r--sound/soc/soc-core.c2
-rw-r--r--sound/soc/soc-dapm.c18
-rw-r--r--sound/soc/soc-generic-dmaengine-pcm.c2
-rw-r--r--sound/soc/soc-ops-test.c2
-rw-r--r--sound/soc/soc-ops.c2
-rw-r--r--sound/soc/soc-pcm.c2
-rw-r--r--sound/soc/soc-usb.c2
-rw-r--r--sound/soc/sof/compress.c2
-rw-r--r--sound/soc/sof/intel/apl.c2
-rw-r--r--sound/soc/sof/intel/cnl.c2
-rw-r--r--sound/soc/sof/intel/hda-mlink.c2
-rw-r--r--sound/soc/sof/intel/icl.c2
-rw-r--r--sound/soc/sof/intel/mtl.c2
-rw-r--r--sound/soc/sof/intel/skl.c2
-rw-r--r--sound/soc/sof/intel/telemetry.c6
-rw-r--r--sound/soc/sof/intel/tgl.c2
-rw-r--r--sound/soc/sof/ipc3-dtrace.c2
-rw-r--r--sound/soc/sof/ipc3-topology.c11
-rw-r--r--sound/soc/sof/ipc4-pcm.c14
-rw-r--r--sound/soc/sof/ipc4-topology.c33
-rw-r--r--sound/soc/sof/sof-client-probes-ipc4.c2
-rw-r--r--sound/soc/sof/sof-client.c4
-rw-r--r--sound/soc/sof/stream-ipc.c2
-rw-r--r--sound/soc/sof/topology.c22
-rw-r--r--sound/soc/sprd/sprd-pcm-compress.c2
-rw-r--r--sound/soc/xilinx/xlnx_formatter_pcm.c2
98 files changed, 214 insertions, 208 deletions
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c
index 897dde630022..19c09ba2b510 100644
--- a/sound/soc/amd/acp-pcm-dma.c
+++ b/sound/soc/amd/acp-pcm-dma.c
@@ -775,7 +775,7 @@ static int acp_dma_open(struct snd_soc_component *component,
struct snd_pcm_runtime *runtime = substream->runtime;
struct audio_drv_data *intr_data = dev_get_drvdata(component->dev);
struct audio_substream_data *adata =
- kzalloc(sizeof(struct audio_substream_data), GFP_KERNEL);
+ kzalloc_obj(struct audio_substream_data, GFP_KERNEL);
if (!adata)
return -ENOMEM;
diff --git a/sound/soc/amd/acp/acp-platform.c b/sound/soc/amd/acp/acp-platform.c
index b25ac5612808..66a30da4b801 100644
--- a/sound/soc/amd/acp/acp-platform.c
+++ b/sound/soc/amd/acp/acp-platform.c
@@ -196,7 +196,7 @@ static int acp_dma_open(struct snd_soc_component *component, struct snd_pcm_subs
struct acp_stream *stream;
int ret;
- stream = kzalloc(sizeof(*stream), GFP_KERNEL);
+ stream = kzalloc_obj(*stream, GFP_KERNEL);
if (!stream)
return -ENOMEM;
diff --git a/sound/soc/amd/acp/acp-sdw-legacy-mach.c b/sound/soc/amd/acp/acp-sdw-legacy-mach.c
index c93fc0920a3e..c1c28fee0496 100644
--- a/sound/soc/amd/acp/acp-sdw-legacy-mach.c
+++ b/sound/soc/amd/acp/acp-sdw-legacy-mach.c
@@ -395,13 +395,13 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)
/* One per DAI link, worst case is a DAI link for every endpoint */
struct asoc_sdw_dailink *soc_dais __free(kfree) =
- kcalloc(num_ends, sizeof(*soc_dais), GFP_KERNEL);
+ kzalloc_objs(*soc_dais, num_ends, GFP_KERNEL);
if (!soc_dais)
return -ENOMEM;
/* One per endpoint, ie. each DAI on each codec/amp */
struct asoc_sdw_endpoint *soc_ends __free(kfree) =
- kcalloc(num_ends, sizeof(*soc_ends), GFP_KERNEL);
+ kzalloc_objs(*soc_ends, num_ends, GFP_KERNEL);
if (!soc_ends)
return -ENOMEM;
diff --git a/sound/soc/amd/acp/acp-sdw-sof-mach.c b/sound/soc/amd/acp/acp-sdw-sof-mach.c
index da815b3f6389..3319f0996fe6 100644
--- a/sound/soc/amd/acp/acp-sdw-sof-mach.c
+++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c
@@ -288,13 +288,13 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
/* One per DAI link, worst case is a DAI link for every endpoint */
struct asoc_sdw_dailink *sof_dais __free(kfree) =
- kcalloc(num_ends, sizeof(*sof_dais), GFP_KERNEL);
+ kzalloc_objs(*sof_dais, num_ends, GFP_KERNEL);
if (!sof_dais)
return -ENOMEM;
/* One per endpoint, ie. each DAI on each codec/amp */
struct asoc_sdw_endpoint *sof_ends __free(kfree) =
- kcalloc(num_ends, sizeof(*sof_ends), GFP_KERNEL);
+ kzalloc_objs(*sof_ends, num_ends, GFP_KERNEL);
if (!sof_ends)
return -ENOMEM;
diff --git a/sound/soc/amd/ps/ps-pdm-dma.c b/sound/soc/amd/ps/ps-pdm-dma.c
index 9cfbe05ad996..5a4ba65847fd 100644
--- a/sound/soc/amd/ps/ps-pdm-dma.c
+++ b/sound/soc/amd/ps/ps-pdm-dma.c
@@ -189,7 +189,7 @@ static int acp63_pdm_dma_open(struct snd_soc_component *component,
runtime = substream->runtime;
adata = dev_get_drvdata(component->dev);
- pdm_data = kzalloc(sizeof(*pdm_data), GFP_KERNEL);
+ pdm_data = kzalloc_obj(*pdm_data, GFP_KERNEL);
if (!pdm_data)
return -EINVAL;
diff --git a/sound/soc/amd/ps/ps-sdw-dma.c b/sound/soc/amd/ps/ps-sdw-dma.c
index 5449323e2728..0c7af398de3a 100644
--- a/sound/soc/amd/ps/ps-sdw-dma.c
+++ b/sound/soc/amd/ps/ps-sdw-dma.c
@@ -318,7 +318,7 @@ static int acp63_sdw_dma_open(struct snd_soc_component *component,
runtime = substream->runtime;
cpu_dai = snd_soc_rtd_to_cpu(prtd, 0);
amd_manager = snd_soc_dai_get_drvdata(cpu_dai);
- stream = kzalloc(sizeof(*stream), GFP_KERNEL);
+ stream = kzalloc_obj(*stream, GFP_KERNEL);
if (!stream)
return -ENOMEM;
diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c
index bb9ed52d744d..2716c4e18c1f 100644
--- a/sound/soc/amd/raven/acp3x-pcm-dma.c
+++ b/sound/soc/amd/raven/acp3x-pcm-dma.c
@@ -218,7 +218,7 @@ static int acp3x_dma_open(struct snd_soc_component *component,
prtd = snd_soc_substream_to_rtd(substream);
component = snd_soc_rtdcom_lookup(prtd, DRV_NAME);
adata = dev_get_drvdata(component->dev);
- i2s_data = kzalloc(sizeof(*i2s_data), GFP_KERNEL);
+ i2s_data = kzalloc_obj(*i2s_data, GFP_KERNEL);
if (!i2s_data)
return -EINVAL;
diff --git a/sound/soc/amd/renoir/acp3x-pdm-dma.c b/sound/soc/amd/renoir/acp3x-pdm-dma.c
index a560d06097d5..c2dd512118ad 100644
--- a/sound/soc/amd/renoir/acp3x-pdm-dma.c
+++ b/sound/soc/amd/renoir/acp3x-pdm-dma.c
@@ -211,7 +211,7 @@ static int acp_pdm_dma_open(struct snd_soc_component *component,
runtime = substream->runtime;
adata = dev_get_drvdata(component->dev);
- pdm_data = kzalloc(sizeof(*pdm_data), GFP_KERNEL);
+ pdm_data = kzalloc_obj(*pdm_data, GFP_KERNEL);
if (!pdm_data)
return -EINVAL;
diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c
index aa4726899434..c52d2bed5c6c 100644
--- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c
+++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c
@@ -213,7 +213,7 @@ static int acp5x_dma_open(struct snd_soc_component *component,
component = snd_soc_rtdcom_lookup(prtd, DRV_NAME);
adata = dev_get_drvdata(component->dev);
- i2s_data = kzalloc(sizeof(*i2s_data), GFP_KERNEL);
+ i2s_data = kzalloc_obj(*i2s_data, GFP_KERNEL);
if (!i2s_data)
return -ENOMEM;
diff --git a/sound/soc/amd/yc/acp6x-pdm-dma.c b/sound/soc/amd/yc/acp6x-pdm-dma.c
index ac758b90f441..b4fece9d3fac 100644
--- a/sound/soc/amd/yc/acp6x-pdm-dma.c
+++ b/sound/soc/amd/yc/acp6x-pdm-dma.c
@@ -187,7 +187,7 @@ static int acp6x_pdm_dma_open(struct snd_soc_component *component,
runtime = substream->runtime;
adata = dev_get_drvdata(component->dev);
- pdm_data = kzalloc(sizeof(*pdm_data), GFP_KERNEL);
+ pdm_data = kzalloc_obj(*pdm_data, GFP_KERNEL);
if (!pdm_data)
return -EINVAL;
diff --git a/sound/soc/atmel/atmel-pcm-pdc.c b/sound/soc/atmel/atmel-pcm-pdc.c
index 7db8df85c54f..3b3e6b2b3a50 100644
--- a/sound/soc/atmel/atmel-pcm-pdc.c
+++ b/sound/soc/atmel/atmel-pcm-pdc.c
@@ -288,7 +288,7 @@ static int atmel_pcm_open(struct snd_soc_component *component,
if (ret < 0)
goto out;
- prtd = kzalloc(sizeof(struct atmel_runtime_data), GFP_KERNEL);
+ prtd = kzalloc_obj(struct atmel_runtime_data, GFP_KERNEL);
if (prtd == NULL) {
ret = -ENOMEM;
goto out;
diff --git a/sound/soc/atmel/mchp-pdmc.c b/sound/soc/atmel/mchp-pdmc.c
index 06dc3c48e7e8..d31508419fe3 100644
--- a/sound/soc/atmel/mchp-pdmc.c
+++ b/sound/soc/atmel/mchp-pdmc.c
@@ -706,7 +706,7 @@ static int mchp_pdmc_add_chmap_ctls(struct snd_pcm *pcm, struct mchp_pdmc *dd)
if (WARN_ON(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].chmap_kctl))
return -EBUSY;
- info = kzalloc(sizeof(*info), GFP_KERNEL);
+ info = kzalloc_obj(*info, GFP_KERNEL);
if (!info)
return -ENOMEM;
info->pcm = pcm;
diff --git a/sound/soc/au1x/dma.c b/sound/soc/au1x/dma.c
index c9c2b1e71d55..46bcdaa0532c 100644
--- a/sound/soc/au1x/dma.c
+++ b/sound/soc/au1x/dma.c
@@ -81,7 +81,7 @@ static int au1000_setup_dma_link(struct audio_stream *stream,
stream->period_size = period_bytes;
stream->periods = periods;
- stream->buffer = kmalloc(sizeof(struct pcm_period), GFP_KERNEL);
+ stream->buffer = kmalloc_obj(struct pcm_period, GFP_KERNEL);
if (!stream->buffer)
return -ENOMEM;
pointer = stream->buffer;
@@ -89,8 +89,8 @@ static int au1000_setup_dma_link(struct audio_stream *stream,
pointer->start = (u32)(dma_start + (i * period_bytes));
pointer->relative_end = (u32) (((i+1) * period_bytes) - 0x1);
if (i < periods - 1) {
- pointer->next = kmalloc(sizeof(struct pcm_period),
- GFP_KERNEL);
+ pointer->next = kmalloc_obj(struct pcm_period,
+ GFP_KERNEL);
if (!pointer->next) {
au1000_release_dma_link(stream);
return -ENOMEM;
diff --git a/sound/soc/bcm/bcm63xx-pcm-whistler.c b/sound/soc/bcm/bcm63xx-pcm-whistler.c
index efeb06ddabeb..a7bc7060f742 100644
--- a/sound/soc/bcm/bcm63xx-pcm-whistler.c
+++ b/sound/soc/bcm/bcm63xx-pcm-whistler.c
@@ -48,7 +48,7 @@ static int bcm63xx_pcm_hw_params(struct snd_soc_component *component,
struct i2s_dma_desc *dma_desc;
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
- dma_desc = kzalloc(sizeof(*dma_desc), GFP_NOWAIT);
+ dma_desc = kzalloc_obj(*dma_desc, GFP_NOWAIT);
if (!dma_desc)
return -ENOMEM;
@@ -210,7 +210,7 @@ static int bcm63xx_pcm_open(struct snd_soc_component *component,
goto out;
ret = -ENOMEM;
- prtd = kzalloc(sizeof(*prtd), GFP_KERNEL);
+ prtd = kzalloc_obj(*prtd, GFP_KERNEL);
if (!prtd)
goto out;
diff --git a/sound/soc/codecs/aw88395/aw88395_lib.c b/sound/soc/codecs/aw88395/aw88395_lib.c
index ceb7fc43d018..31799ca5bb0f 100644
--- a/sound/soc/codecs/aw88395/aw88395_lib.c
+++ b/sound/soc/codecs/aw88395/aw88395_lib.c
@@ -665,8 +665,8 @@ static int aw_dev_load_cfg_by_hdr(struct aw_device *aw_dev,
{
int ret;
- struct aw_all_prof_info *all_prof_info __free(kfree) = kzalloc(sizeof(*all_prof_info),
- GFP_KERNEL);
+ struct aw_all_prof_info *all_prof_info __free(kfree) = kzalloc_obj(*all_prof_info,
+ GFP_KERNEL);
if (!all_prof_info)
return -ENOMEM;
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c
index d6121c0a2616..b0383eb47407 100644
--- a/sound/soc/codecs/cx20442.c
+++ b/sound/soc/codecs/cx20442.c
@@ -346,7 +346,7 @@ static int cx20442_component_probe(struct snd_soc_component *component)
{
struct cx20442_priv *cx20442;
- cx20442 = kzalloc(sizeof(struct cx20442_priv), GFP_KERNEL);
+ cx20442 = kzalloc_obj(struct cx20442_priv, GFP_KERNEL);
if (cx20442 == NULL)
return -ENOMEM;
diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c
index 298a626df3ad..1f890294064c 100644
--- a/sound/soc/codecs/da7219.c
+++ b/sound/soc/codecs/da7219.c
@@ -2143,8 +2143,8 @@ static int da7219_register_dai_clks(struct snd_soc_component *component)
/* For DT platforms allocate onecell data for clock registration */
if (np) {
- clk_data = kzalloc(struct_size(clk_data, hws, DA7219_DAI_NUM_CLKS),
- GFP_KERNEL);
+ clk_data = kzalloc_flex(*clk_data, hws, DA7219_DAI_NUM_CLKS,
+ GFP_KERNEL);
if (!clk_data)
return -ENOMEM;
diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
index 0a8de5620e72..b6a2c39882ac 100644
--- a/sound/soc/codecs/lpass-rx-macro.c
+++ b/sound/soc/codecs/lpass-rx-macro.c
@@ -3820,7 +3820,8 @@ static int rx_macro_probe(struct platform_device *pdev)
rx->rxn_reg_stride = 0x80;
rx->rxn_reg_stride2 = 0xc;
def_count = ARRAY_SIZE(rx_defaults) + ARRAY_SIZE(rx_pre_2_5_defaults);
- reg_defaults = kmalloc_array(def_count, sizeof(struct reg_default), GFP_KERNEL);
+ reg_defaults = kmalloc_objs(struct reg_default, def_count,
+ GFP_KERNEL);
if (!reg_defaults)
return -ENOMEM;
memcpy(&reg_defaults[0], rx_defaults, sizeof(rx_defaults));
@@ -3834,7 +3835,8 @@ static int rx_macro_probe(struct platform_device *pdev)
rx->rxn_reg_stride = 0xc0;
rx->rxn_reg_stride2 = 0x0;
def_count = ARRAY_SIZE(rx_defaults) + ARRAY_SIZE(rx_2_5_defaults);
- reg_defaults = kmalloc_array(def_count, sizeof(struct reg_default), GFP_KERNEL);
+ reg_defaults = kmalloc_objs(struct reg_default, def_count,
+ GFP_KERNEL);
if (!reg_defaults)
return -ENOMEM;
memcpy(&reg_defaults[0], rx_defaults, sizeof(rx_defaults));
diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c
index b695c77c18ac..e26aaea450d6 100644
--- a/sound/soc/codecs/lpass-wsa-macro.c
+++ b/sound/soc/codecs/lpass-wsa-macro.c
@@ -2725,8 +2725,8 @@ static int wsa_macro_probe(struct platform_device *pdev)
case LPASS_CODEC_VERSION_2_1:
wsa->reg_layout = &wsa_codec_v2_1;
def_count = ARRAY_SIZE(wsa_defaults) + ARRAY_SIZE(wsa_defaults_v2_1);
- reg_defaults = kmalloc_array(def_count, sizeof(*reg_defaults),
- GFP_KERNEL);
+ reg_defaults = kmalloc_objs(*reg_defaults, def_count,
+ GFP_KERNEL);
if (!reg_defaults)
return -ENOMEM;
memcpy(&reg_defaults[0], wsa_defaults, sizeof(wsa_defaults));
@@ -2741,8 +2741,8 @@ static int wsa_macro_probe(struct platform_device *pdev)
case LPASS_CODEC_VERSION_2_9:
wsa->reg_layout = &wsa_codec_v2_5;
def_count = ARRAY_SIZE(wsa_defaults) + ARRAY_SIZE(wsa_defaults_v2_5);
- reg_defaults = kmalloc_array(def_count, sizeof(*reg_defaults),
- GFP_KERNEL);
+ reg_defaults = kmalloc_objs(*reg_defaults, def_count,
+ GFP_KERNEL);
if (!reg_defaults)
return -ENOMEM;
memcpy(&reg_defaults[0], wsa_defaults, sizeof(wsa_defaults));
diff --git a/sound/soc/codecs/pcm6240.c b/sound/soc/codecs/pcm6240.c
index bde190a659b1..6911de5a8c7e 100644
--- a/sound/soc/codecs/pcm6240.c
+++ b/sound/soc/codecs/pcm6240.c
@@ -1234,7 +1234,7 @@ static struct pcmdevice_config_info *pcmdevice_add_config(void *ctxt,
struct pcmdevice_block_data **bk_da;
unsigned int config_offset = 0, i;
- cfg_info = kzalloc(sizeof(struct pcmdevice_config_info), GFP_KERNEL);
+ cfg_info = kzalloc_obj(struct pcmdevice_config_info, GFP_KERNEL);
if (!cfg_info) {
*status = -ENOMEM;
goto out;
@@ -1261,8 +1261,8 @@ static struct pcmdevice_config_info *pcmdevice_add_config(void *ctxt,
get_unaligned_be32(&config_data[config_offset]);
config_offset += 4;
- bk_da = cfg_info->blk_data = kcalloc(cfg_info->nblocks,
- sizeof(struct pcmdevice_block_data *), GFP_KERNEL);
+ bk_da = cfg_info->blk_data = kzalloc_objs(struct pcmdevice_block_data *,
+ cfg_info->nblocks, GFP_KERNEL);
if (!bk_da) {
*status = -ENOMEM;
goto out;
@@ -1276,8 +1276,7 @@ static struct pcmdevice_config_info *pcmdevice_add_config(void *ctxt,
__func__, i, cfg_info->nblocks);
break;
}
- bk_da[i] = kzalloc(sizeof(struct pcmdevice_block_data),
- GFP_KERNEL);
+ bk_da[i] = kzalloc_obj(struct pcmdevice_block_data, GFP_KERNEL);
if (!bk_da[i]) {
*status = -ENOMEM;
break;
@@ -1549,7 +1548,7 @@ static int pcmdev_regbin_ready(const struct firmware *fmw, void *ctxt)
ret = -EINVAL;
goto out;
}
- cfg_info = kcalloc(fw_hdr->nconfig, sizeof(*cfg_info), GFP_KERNEL);
+ cfg_info = kzalloc_objs(*cfg_info, fw_hdr->nconfig, GFP_KERNEL);
if (!cfg_info) {
pcm_dev->fw_state = PCMDEVICE_FW_LOAD_FAILED;
ret = -ENOMEM;
diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c
index 201f74e3a7ae..c2a6a1f446d6 100644
--- a/sound/soc/codecs/sigmadsp.c
+++ b/sound/soc/codecs/sigmadsp.c
@@ -270,7 +270,7 @@ static int sigma_fw_load_data(struct sigmadsp *sigmadsp,
length -= sizeof(*data_chunk);
- data = kzalloc(struct_size(data, data, length), GFP_KERNEL);
+ data = kzalloc_flex(*data, data, length, GFP_KERNEL);
if (!data)
return -ENOMEM;
@@ -413,8 +413,7 @@ static int process_sigma_action(struct sigmadsp *sigmadsp,
if (len < 3)
return -EINVAL;
- data = kzalloc(struct_size(data, data, size_sub(len, 2)),
- GFP_KERNEL);
+ data = kzalloc_flex(*data, data, size_sub(len, 2), GFP_KERNEL);
if (!data)
return -ENOMEM;
diff --git a/sound/soc/codecs/tas2781-fmwlib.c b/sound/soc/codecs/tas2781-fmwlib.c
index 0e084c3a162d..d3ded7d5efa1 100644
--- a/sound/soc/codecs/tas2781-fmwlib.c
+++ b/sound/soc/codecs/tas2781-fmwlib.c
@@ -176,7 +176,7 @@ static struct tasdevice_config_info *tasdevice_add_config(
* of audio cases, flexible configs have been introduced in the
* dsp firmware.
*/
- cfg_info = kzalloc(sizeof(struct tasdevice_config_info), GFP_KERNEL);
+ cfg_info = kzalloc_obj(struct tasdevice_config_info, GFP_KERNEL);
if (!cfg_info) {
*status = -ENOMEM;
goto out;
@@ -217,8 +217,8 @@ static struct tasdevice_config_info *tasdevice_add_config(
* the number and size of blk are not fixed and different among
* these firmwares.
*/
- bk_da = cfg_info->blk_data = kcalloc(cfg_info->nblocks,
- sizeof(struct tasdev_blk_data *), GFP_KERNEL);
+ bk_da = cfg_info->blk_data = kzalloc_objs(struct tasdev_blk_data *,
+ cfg_info->nblocks, GFP_KERNEL);
if (!bk_da) {
*status = -ENOMEM;
goto out;
@@ -232,7 +232,7 @@ static struct tasdevice_config_info *tasdevice_add_config(
__func__, i, cfg_info->nblocks);
break;
}
- bk_da[i] = kzalloc(sizeof(struct tasdev_blk_data), GFP_KERNEL);
+ bk_da[i] = kzalloc_obj(struct tasdev_blk_data, GFP_KERNEL);
if (!bk_da[i]) {
*status = -ENOMEM;
break;
@@ -379,7 +379,7 @@ int tasdevice_rca_parser(void *context, const struct firmware *fmw)
goto out;
}
- cfg_info = kcalloc(fw_hdr->nconfig, sizeof(*cfg_info), GFP_KERNEL);
+ cfg_info = kzalloc_objs(*cfg_info, fw_hdr->nconfig, GFP_KERNEL);
if (!cfg_info) {
ret = -ENOMEM;
tas_priv->fw_state = TASDEVICE_DSP_FW_FAIL;
@@ -509,8 +509,8 @@ static int fw_parse_data_kernel(struct tasdevice_fw *tas_fmw,
img_data->nr_blk = get_unaligned_be32(&data[offset]);
offset += 4;
- img_data->dev_blks = kcalloc(img_data->nr_blk,
- sizeof(struct tasdev_blk), GFP_KERNEL);
+ img_data->dev_blks = kzalloc_objs(struct tasdev_blk, img_data->nr_blk,
+ GFP_KERNEL);
if (!img_data->dev_blks) {
offset = -ENOMEM;
goto out;
@@ -805,8 +805,8 @@ static int fw_parse_variable_header_kernel(
goto out;
}
- tas_fmw->programs = kcalloc(tas_fmw->nr_programs,
- sizeof(struct tasdevice_prog), GFP_KERNEL);
+ tas_fmw->programs = kzalloc_objs(struct tasdevice_prog,
+ tas_fmw->nr_programs, GFP_KERNEL);
if (!tas_fmw->programs) {
offset = -ENOMEM;
goto out;
@@ -844,8 +844,8 @@ static int fw_parse_variable_header_kernel(
goto out;
}
- tas_fmw->configs = kcalloc(tas_fmw->nr_configurations,
- sizeof(struct tasdevice_config), GFP_KERNEL);
+ tas_fmw->configs = kzalloc_objs(struct tasdevice_config,
+ tas_fmw->nr_configurations, GFP_KERNEL);
if (!tas_fmw->configs) {
offset = -ENOMEM;
goto out;
@@ -1239,8 +1239,8 @@ static int fw_parse_data(struct tasdevice_fw *tas_fmw,
img_data->nr_blk = get_unaligned_be16(&data[offset]);
offset += 2;
- img_data->dev_blks = kcalloc(img_data->nr_blk,
- sizeof(struct tasdev_blk), GFP_KERNEL);
+ img_data->dev_blks = kzalloc_objs(struct tasdev_blk, img_data->nr_blk,
+ GFP_KERNEL);
if (!img_data->dev_blks) {
offset = -ENOMEM;
goto out;
@@ -1284,8 +1284,8 @@ static int fw_parse_program_data(struct tasdevice_priv *tas_priv,
}
tas_fmw->programs =
- kcalloc(tas_fmw->nr_programs, sizeof(struct tasdevice_prog),
- GFP_KERNEL);
+ kzalloc_objs(struct tasdevice_prog, tas_fmw->nr_programs,
+ GFP_KERNEL);
if (!tas_fmw->programs) {
offset = -ENOMEM;
goto out;
@@ -1348,8 +1348,8 @@ static int fw_parse_configuration_data(
/*Not error for calibration Data file, return directly*/
goto out;
}
- tas_fmw->configs = kcalloc(tas_fmw->nr_configurations,
- sizeof(struct tasdevice_config), GFP_KERNEL);
+ tas_fmw->configs = kzalloc_objs(struct tasdevice_config,
+ tas_fmw->nr_configurations, GFP_KERNEL);
if (!tas_fmw->configs) {
offset = -ENOMEM;
goto out;
@@ -2143,8 +2143,9 @@ static int fw_parse_calibration_data(struct tasdevice_priv *tas_priv,
goto out;
}
- tas_fmw->calibrations = kcalloc(tas_fmw->nr_calibrations,
- sizeof(struct tasdevice_calibration), GFP_KERNEL);
+ tas_fmw->calibrations = kzalloc_objs(struct tasdevice_calibration,
+ tas_fmw->nr_calibrations,
+ GFP_KERNEL);
if (!tas_fmw->calibrations) {
offset = -ENOMEM;
goto out;
@@ -2206,8 +2207,8 @@ int tas2781_load_calibration(void *context, char *file_name,
fmw.size = fw_entry->size;
fmw.data = fw_entry->data;
- tas_fmw = tasdev->cali_data_fmw = kzalloc(sizeof(struct tasdevice_fw),
- GFP_KERNEL);
+ tas_fmw = tasdev->cali_data_fmw = kzalloc_obj(struct tasdevice_fw,
+ GFP_KERNEL);
if (!tasdev->cali_data_fmw) {
ret = -ENOMEM;
goto out;
@@ -2267,7 +2268,7 @@ static int tasdevice_dspfw_ready(const struct firmware *fmw,
return -EINVAL;
}
- tas_priv->fmw = kzalloc(sizeof(struct tasdevice_fw), GFP_KERNEL);
+ tas_priv->fmw = kzalloc_obj(struct tasdevice_fw, GFP_KERNEL);
if (!tas_priv->fmw)
return -ENOMEM;
diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c
index 84d45eab3523..ab3620761f5d 100644
--- a/sound/soc/codecs/tas2783-sdw.c
+++ b/sound/soc/codecs/tas2783-sdw.c
@@ -733,8 +733,8 @@ static void tas2783_fw_ready(const struct firmware *fmw, void *context)
s32 img_sz, ret = 0, cur_file = 0;
s32 offset = 0;
- struct tas_fw_hdr *hdr __free(kfree) = kzalloc(sizeof(*hdr), GFP_KERNEL);
- struct tas_fw_file *file __free(kfree) = kzalloc(sizeof(*file), GFP_KERNEL);
+ struct tas_fw_hdr *hdr __free(kfree) = kzalloc_obj(*hdr, GFP_KERNEL);
+ struct tas_fw_file *file __free(kfree) = kzalloc_obj(*file, GFP_KERNEL);
if (!file || !hdr) {
ret = -ENOMEM;
goto out;
diff --git a/sound/soc/codecs/wcd-clsh-v2.c b/sound/soc/codecs/wcd-clsh-v2.c
index d96e23ec43d4..1da1a85cbe6b 100644
--- a/sound/soc/codecs/wcd-clsh-v2.c
+++ b/sound/soc/codecs/wcd-clsh-v2.c
@@ -883,7 +883,7 @@ struct wcd_clsh_ctrl *wcd_clsh_ctrl_alloc(struct snd_soc_component *comp,
{
struct wcd_clsh_ctrl *ctrl;
- ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
+ ctrl = kzalloc_obj(*ctrl, GFP_KERNEL);
if (!ctrl)
return ERR_PTR(-ENOMEM);
diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c
index 0c842aaa7eec..56b112946b37 100644
--- a/sound/soc/codecs/wcd-mbhc-v2.c
+++ b/sound/soc/codecs/wcd-mbhc-v2.c
@@ -1515,7 +1515,7 @@ struct wcd_mbhc *wcd_mbhc_init(struct snd_soc_component *component,
return ERR_PTR(-EINVAL);
}
- mbhc = kzalloc(sizeof(*mbhc), GFP_KERNEL);
+ mbhc = kzalloc_obj(*mbhc, GFP_KERNEL);
if (!mbhc)
return ERR_PTR(-ENOMEM);
diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c
index 6e097d8ed288..f6166428a000 100644
--- a/sound/soc/codecs/wm0010.c
+++ b/sound/soc/codecs/wm0010.c
@@ -396,7 +396,7 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_component *comp
rec->command, rec->length);
len = rec->length + 8;
- xfer = kzalloc(sizeof(*xfer), GFP_KERNEL);
+ xfer = kzalloc_obj(*xfer, GFP_KERNEL);
if (!xfer) {
ret = -ENOMEM;
goto abort;
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 17cec79245d4..8a584fd8f5de 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -542,7 +542,7 @@ static void wm_adsp_ctl_work(struct work_struct *work)
cs_dsp);
struct snd_kcontrol_new *kcontrol;
- kcontrol = kzalloc(sizeof(*kcontrol), GFP_KERNEL);
+ kcontrol = kzalloc_obj(*kcontrol, GFP_KERNEL);
if (!kcontrol)
return;
@@ -627,7 +627,7 @@ int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
" %.*s", cs_ctl->subname_len - skip, cs_ctl->subname + skip);
}
- ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
+ ctl = kzalloc_obj(*ctl, GFP_KERNEL);
if (!ctl)
return -ENOMEM;
ctl->cs_ctl = cs_ctl;
@@ -1259,7 +1259,7 @@ int wm_adsp_compr_open(struct wm_adsp *dsp, struct snd_compr_stream *stream)
}
}
- compr = kzalloc(sizeof(*compr), GFP_KERNEL);
+ compr = kzalloc_obj(*compr, GFP_KERNEL);
if (!compr) {
ret = -ENOMEM;
goto out;
@@ -1430,8 +1430,8 @@ static int wm_adsp_buffer_populate(struct wm_adsp_compr_buf *buf)
u32 offset = 0;
int i, ret;
- buf->regions = kcalloc(caps->num_regions, sizeof(*buf->regions),
- GFP_KERNEL);
+ buf->regions = kzalloc_objs(*buf->regions, caps->num_regions,
+ GFP_KERNEL);
if (!buf->regions)
return -ENOMEM;
@@ -1477,7 +1477,7 @@ static struct wm_adsp_compr_buf *wm_adsp_buffer_alloc(struct wm_adsp *dsp)
{
struct wm_adsp_compr_buf *buf;
- buf = kzalloc(sizeof(*buf), GFP_KERNEL);
+ buf = kzalloc_obj(*buf, GFP_KERNEL);
if (!buf)
return NULL;
diff --git a/sound/soc/fsl/fsl_asrc_m2m.c b/sound/soc/fsl/fsl_asrc_m2m.c
index 77999526dd9e..7a16a895cb0e 100644
--- a/sound/soc/fsl/fsl_asrc_m2m.c
+++ b/sound/soc/fsl/fsl_asrc_m2m.c
@@ -155,7 +155,7 @@ static int asrc_dmaconfig(struct fsl_asrc_pair *pair,
if (buf_len % max_period_size)
sg_len += 1;
- sg = kmalloc_array(sg_len, sizeof(*sg), GFP_KERNEL);
+ sg = kmalloc_objs(*sg, sg_len, GFP_KERNEL);
if (!sg)
return -ENOMEM;
@@ -420,7 +420,7 @@ static struct sg_table *fsl_asrc_m2m_map_dma_buf(struct dma_buf_attachment *atta
struct snd_dma_buffer *dmab = attachment->dmabuf->priv;
struct sg_table *sgt;
- sgt = kmalloc(sizeof(*sgt), GFP_KERNEL);
+ sgt = kmalloc_obj(*sgt, GFP_KERNEL);
if (!sgt)
return NULL;
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index aca066b5a43c..44834dba4cb7 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -848,7 +848,7 @@ static int fsl_soc_dma_probe(struct platform_device *pdev)
return ret;
}
- dma = kzalloc(sizeof(*dma), GFP_KERNEL);
+ dma = kzalloc_obj(*dma, GFP_KERNEL);
if (!dma) {
of_node_put(ssi_np);
return -ENOMEM;
diff --git a/sound/soc/fsl/fsl_qmc_audio.c b/sound/soc/fsl/fsl_qmc_audio.c
index 3de448ef724c..747c8253b77b 100644
--- a/sound/soc/fsl/fsl_qmc_audio.c
+++ b/sound/soc/fsl/fsl_qmc_audio.c
@@ -316,7 +316,7 @@ static int qmc_audio_pcm_open(struct snd_soc_component *component,
if (ret < 0)
return ret;
- prtd = kzalloc(sizeof(*prtd), GFP_KERNEL);
+ prtd = kzalloc_obj(*prtd, GFP_KERNEL);
if (!prtd)
return -ENOMEM;
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 83de3ae33691..8a1a7c89781f 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -176,7 +176,7 @@ static int snd_imx_open(struct snd_soc_component *component,
struct imx_pcm_runtime_data *iprtd;
int ret;
- iprtd = kzalloc(sizeof(*iprtd), GFP_KERNEL);
+ iprtd = kzalloc_obj(*iprtd, GFP_KERNEL);
if (iprtd == NULL)
return -ENOMEM;
runtime->private_data = iprtd;
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index 345f338251ac..41255ff305b3 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -333,7 +333,7 @@ int mpc5200_audio_dma_create(struct platform_device *op)
}
/* Allocate and initialize the driver private data */
- psc_dma = kzalloc(sizeof *psc_dma, GFP_KERNEL);
+ psc_dma = kzalloc_obj(*psc_dma, GFP_KERNEL);
if (!psc_dma) {
ret = -ENOMEM;
goto out_unmap;
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c
index 66db05970d82..44b62f5615f2 100644
--- a/sound/soc/fsl/p1022_ds.c
+++ b/sound/soc/fsl/p1022_ds.c
@@ -211,7 +211,7 @@ static int p1022_ds_probe(struct platform_device *pdev)
return -EINVAL;
}
- mdata = kzalloc(sizeof(struct machine_data), GFP_KERNEL);
+ mdata = kzalloc_obj(struct machine_data, GFP_KERNEL);
if (!mdata) {
ret = -ENOMEM;
goto error_put;
diff --git a/sound/soc/fsl/p1022_rdk.c b/sound/soc/fsl/p1022_rdk.c
index d4568346714f..43a95cd590cf 100644
--- a/sound/soc/fsl/p1022_rdk.c
+++ b/sound/soc/fsl/p1022_rdk.c
@@ -226,7 +226,7 @@ static int p1022_rdk_probe(struct platform_device *pdev)
return -EINVAL;
}
- mdata = kzalloc(sizeof(struct machine_data), GFP_KERNEL);
+ mdata = kzalloc_obj(struct machine_data, GFP_KERNEL);
if (!mdata) {
ret = -ENOMEM;
goto error_put;
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index 7720cf1fd6e1..965d7bb55929 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -553,7 +553,7 @@ int audio_graph_parse_of(struct simple_util_priv *priv, struct device *dev)
struct snd_soc_card *card = simple_priv_to_card(priv);
int ret = -ENOMEM;
- struct link_info *li __free(kfree) = kzalloc(sizeof(*li), GFP_KERNEL);
+ struct link_info *li __free(kfree) = kzalloc_obj(*li, GFP_KERNEL);
if (!li)
goto end;
diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c
index 5dcc78c551a2..85043bc3c3d3 100644
--- a/sound/soc/generic/audio-graph-card2.c
+++ b/sound/soc/generic/audio-graph-card2.c
@@ -1305,7 +1305,7 @@ int audio_graph2_parse_of(struct simple_util_priv *priv, struct device *dev,
struct snd_soc_card *card = simple_priv_to_card(priv);
int ret;
- struct link_info *li __free(kfree) = kzalloc(sizeof(*li), GFP_KERNEL);
+ struct link_info *li __free(kfree) = kzalloc_obj(*li, GFP_KERNEL);
if (!li)
return -ENOMEM;
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 5af6d1b308f2..5bc6d7cd1921 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -726,7 +726,7 @@ static int simple_probe(struct platform_device *pdev)
card->driver_name = "simple-card";
ret = -ENOMEM;
- struct link_info *li __free(kfree) = kzalloc(sizeof(*li), GFP_KERNEL);
+ struct link_info *li __free(kfree) = kzalloc_obj(*li, GFP_KERNEL);
if (!li)
goto end;
diff --git a/sound/soc/intel/atom/sst-mfld-platform-compress.c b/sound/soc/intel/atom/sst-mfld-platform-compress.c
index 9dfb0a814b94..877df5ce156d 100644
--- a/sound/soc/intel/atom/sst-mfld-platform-compress.c
+++ b/sound/soc/intel/atom/sst-mfld-platform-compress.c
@@ -47,7 +47,7 @@ static int sst_platform_compr_open(struct snd_soc_component *component,
struct snd_compr_runtime *runtime = cstream->runtime;
struct sst_runtime_stream *stream;
- stream = kzalloc(sizeof(*stream), GFP_KERNEL);
+ stream = kzalloc_obj(*stream, GFP_KERNEL);
if (!stream)
return -ENOMEM;
diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
index 373d68b4cf88..e007db432b49 100644
--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
+++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
@@ -306,7 +306,7 @@ static int sst_media_open(struct snd_pcm_substream *substream,
struct snd_pcm_runtime *runtime = substream->runtime;
struct sst_runtime_stream *stream;
- stream = kzalloc(sizeof(*stream), GFP_KERNEL);
+ stream = kzalloc_obj(*stream, GFP_KERNEL);
if (!stream)
return -ENOMEM;
spin_lock_init(&stream->status_lock);
diff --git a/sound/soc/intel/atom/sst/sst.c b/sound/soc/intel/atom/sst/sst.c
index 3c47c8de04b7..5313c8ec605e 100644
--- a/sound/soc/intel/atom/sst/sst.c
+++ b/sound/soc/intel/atom/sst/sst.c
@@ -463,7 +463,7 @@ static int intel_sst_suspend(struct device *dev)
return -EBUSY;
/* save the memories */
- fw_save = kzalloc(sizeof(*fw_save), GFP_KERNEL);
+ fw_save = kzalloc_obj(*fw_save, GFP_KERNEL);
if (!fw_save)
return -ENOMEM;
fw_save->iram = kvzalloc(ctx->iram_end - ctx->iram_base, GFP_KERNEL);
diff --git a/sound/soc/intel/atom/sst/sst_ipc.c b/sound/soc/intel/atom/sst/sst_ipc.c
index 0630e58b9d6b..bdf68d69127f 100644
--- a/sound/soc/intel/atom/sst/sst_ipc.c
+++ b/sound/soc/intel/atom/sst/sst_ipc.c
@@ -31,7 +31,7 @@ struct sst_block *sst_create_block(struct intel_sst_drv *ctx,
struct sst_block *msg;
dev_dbg(ctx->dev, "Enter\n");
- msg = kzalloc(sizeof(*msg), GFP_KERNEL);
+ msg = kzalloc_obj(*msg, GFP_KERNEL);
if (!msg)
return NULL;
msg->condition = false;
diff --git a/sound/soc/intel/atom/sst/sst_loader.c b/sound/soc/intel/atom/sst/sst_loader.c
index bf4ba6bcc429..60b73c9c2306 100644
--- a/sound/soc/intel/atom/sst/sst_loader.c
+++ b/sound/soc/intel/atom/sst/sst_loader.c
@@ -148,7 +148,7 @@ static int sst_fill_memcpy_list(struct list_head *memcpy_list,
{
struct sst_memcpy_list *listnode;
- listnode = kzalloc(sizeof(*listnode), GFP_KERNEL);
+ listnode = kzalloc_obj(*listnode, GFP_KERNEL);
if (listnode == NULL)
return -ENOMEM;
listnode->dstn = destn;
diff --git a/sound/soc/intel/atom/sst/sst_pvt.c b/sound/soc/intel/atom/sst/sst_pvt.c
index c01b29616ebc..67b1ab14239f 100644
--- a/sound/soc/intel/atom/sst/sst_pvt.c
+++ b/sound/soc/intel/atom/sst/sst_pvt.c
@@ -124,7 +124,7 @@ int sst_create_ipc_msg(struct ipc_post **arg, bool large)
{
struct ipc_post *msg;
- msg = kzalloc(sizeof(*msg), GFP_ATOMIC);
+ msg = kzalloc_obj(*msg, GFP_ATOMIC);
if (!msg)
return -ENOMEM;
if (large) {
diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index 899906e0bcb4..a080d85d30a6 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -880,7 +880,7 @@ avs_path_module_create(struct avs_dev *adev,
if (module_id < 0)
return ERR_PTR(module_id);
- mod = kzalloc(sizeof(*mod), GFP_KERNEL);
+ mod = kzalloc_obj(*mod, GFP_KERNEL);
if (!mod)
return ERR_PTR(-ENOMEM);
@@ -968,7 +968,7 @@ static struct avs_path_binding *avs_path_binding_create(struct avs_dev *adev,
{
struct avs_path_binding *binding;
- binding = kzalloc(sizeof(*binding), GFP_KERNEL);
+ binding = kzalloc_obj(*binding, GFP_KERNEL);
if (!binding)
return ERR_PTR(-ENOMEM);
@@ -1043,7 +1043,7 @@ avs_path_pipeline_create(struct avs_dev *adev, struct avs_path *owner,
struct avs_tplg_module *tmod;
int ret, i;
- ppl = kzalloc(sizeof(*ppl), GFP_KERNEL);
+ ppl = kzalloc_obj(*ppl, GFP_KERNEL);
if (!ppl)
return ERR_PTR(-ENOMEM);
@@ -1173,7 +1173,7 @@ static struct avs_path *avs_path_create_unlocked(struct avs_dev *adev, u32 dma_i
struct avs_path *path;
int ret;
- path = kzalloc(sizeof(*path), GFP_KERNEL);
+ path = kzalloc_obj(*path, GFP_KERNEL);
if (!path)
return ERR_PTR(-ENOMEM);
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index 4a6deb599c88..b8f5e1185a1a 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -130,7 +130,7 @@ static int avs_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_d
return -EINVAL;
}
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = kzalloc_obj(*data, GFP_KERNEL);
if (!data)
return -ENOMEM;
diff --git a/sound/soc/intel/avs/utils.c b/sound/soc/intel/avs/utils.c
index 81f9b67d8e29..df4d4e2f6c4f 100644
--- a/sound/soc/intel/avs/utils.c
+++ b/sound/soc/intel/avs/utils.c
@@ -124,7 +124,7 @@ avs_module_ida_alloc(struct avs_dev *adev, struct avs_mods_info *newinfo, bool p
tocopy_count = oldinfo->count;
}
- ida_ptrs = kcalloc(newinfo->count, sizeof(*ida_ptrs), GFP_KERNEL);
+ ida_ptrs = kzalloc_objs(*ida_ptrs, newinfo->count, GFP_KERNEL);
if (!ida_ptrs)
return -ENOMEM;
@@ -132,7 +132,7 @@ avs_module_ida_alloc(struct avs_dev *adev, struct avs_mods_info *newinfo, bool p
memcpy(ida_ptrs, adev->mod_idas, tocopy_count * sizeof(*ida_ptrs));
for (i = tocopy_count; i < newinfo->count; i++) {
- ida_ptrs[i] = kzalloc(sizeof(**ida_ptrs), GFP_KERNEL);
+ ida_ptrs[i] = kzalloc_obj(**ida_ptrs, GFP_KERNEL);
if (!ida_ptrs[i]) {
while (i--)
kfree(ida_ptrs[i]);
@@ -246,7 +246,7 @@ int avs_request_firmware(struct avs_dev *adev, const struct firmware **fw_p, con
}
/* FW is not loaded, let's load it now and add to the list */
- entry = kzalloc(sizeof(*entry), GFP_KERNEL);
+ entry = kzalloc_obj(*entry, GFP_KERNEL);
if (!entry)
return -ENOMEM;
diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c
index ee34282828e4..65bc023ab01b 100644
--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -1251,12 +1251,12 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
* add one additional to act as a terminator such that code can iterate
* until it hits an uninitialised DAI.
*/
- sof_dais = kcalloc(num_ends + 1, sizeof(*sof_dais), GFP_KERNEL);
+ sof_dais = kzalloc_objs(*sof_dais, num_ends + 1, GFP_KERNEL);
if (!sof_dais)
return -ENOMEM;
/* One per endpoint, ie. each DAI on each codec/amp */
- sof_ends = kcalloc(num_ends, sizeof(*sof_ends), GFP_KERNEL);
+ sof_ends = kzalloc_objs(*sof_ends, num_ends, GFP_KERNEL);
if (!sof_ends) {
ret = -ENOMEM;
goto err_dai;
diff --git a/sound/soc/intel/catpt/pcm.c b/sound/soc/intel/catpt/pcm.c
index 2c3405686f79..b3e8ea4b92b4 100644
--- a/sound/soc/intel/catpt/pcm.c
+++ b/sound/soc/intel/catpt/pcm.c
@@ -263,7 +263,7 @@ static int catpt_dai_startup(struct snd_pcm_substream *substream,
template = catpt_get_stream_template(substream);
- stream = kzalloc(sizeof(*stream), GFP_KERNEL);
+ stream = kzalloc_obj(*stream, GFP_KERNEL);
if (!stream)
return -ENOMEM;
diff --git a/sound/soc/loongson/loongson_dma.c b/sound/soc/loongson/loongson_dma.c
index 20e4a0641340..8cf0feb64ff9 100644
--- a/sound/soc/loongson/loongson_dma.c
+++ b/sound/soc/loongson/loongson_dma.c
@@ -243,7 +243,7 @@ static int loongson_pcm_open(struct snd_soc_component *component,
SNDRV_PCM_HW_PARAM_PERIODS);
snd_soc_set_runtime_hwparams(substream, &ls_pcm_hardware);
- prtd = kzalloc(sizeof(*prtd), GFP_KERNEL);
+ prtd = kzalloc_obj(*prtd, GFP_KERNEL);
if (!prtd)
return -ENOMEM;
diff --git a/sound/soc/mediatek/mt8186/mt8186-audsys-clk.c b/sound/soc/mediatek/mt8186/mt8186-audsys-clk.c
index 5666be6b1bd2..53f30d12195b 100644
--- a/sound/soc/mediatek/mt8186/mt8186-audsys-clk.c
+++ b/sound/soc/mediatek/mt8186/mt8186-audsys-clk.c
@@ -135,7 +135,7 @@ int mt8186_audsys_clk_register(struct mtk_base_afe *afe)
}
/* add clk_lookup for devm_clk_get(SND_SOC_DAPM_CLOCK_SUPPLY) */
- cl = kzalloc(sizeof(*cl), GFP_KERNEL);
+ cl = kzalloc_obj(*cl, GFP_KERNEL);
if (!cl)
return -ENOMEM;
diff --git a/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c b/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c
index 40d2ab0a7677..2ef5ed3ee200 100644
--- a/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c
+++ b/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c
@@ -193,7 +193,7 @@ int mt8188_audsys_clk_register(struct mtk_base_afe *afe)
}
/* add clk_lookup for devm_clk_get(SND_SOC_DAPM_CLOCK_SUPPLY) */
- cl = kzalloc(sizeof(*cl), GFP_KERNEL);
+ cl = kzalloc_obj(*cl, GFP_KERNEL);
if (!cl)
return -ENOMEM;
diff --git a/sound/soc/mediatek/mt8195/mt8195-audsys-clk.c b/sound/soc/mediatek/mt8195/mt8195-audsys-clk.c
index 38594bc3f2f7..ec069729253e 100644
--- a/sound/soc/mediatek/mt8195/mt8195-audsys-clk.c
+++ b/sound/soc/mediatek/mt8195/mt8195-audsys-clk.c
@@ -199,7 +199,7 @@ int mt8195_audsys_clk_register(struct mtk_base_afe *afe)
}
/* add clk_lookup for devm_clk_get(SND_SOC_DAPM_CLOCK_SUPPLY) */
- cl = kzalloc(sizeof(*cl), GFP_KERNEL);
+ cl = kzalloc_obj(*cl, GFP_KERNEL);
if (!cl)
return -ENOMEM;
diff --git a/sound/soc/meson/aiu-fifo.c b/sound/soc/meson/aiu-fifo.c
index b222bde1f61b..b17a62727fc7 100644
--- a/sound/soc/meson/aiu-fifo.c
+++ b/sound/soc/meson/aiu-fifo.c
@@ -196,7 +196,7 @@ int aiu_fifo_dai_probe(struct snd_soc_dai *dai)
{
struct aiu_fifo *fifo;
- fifo = kzalloc(sizeof(*fifo), GFP_KERNEL);
+ fifo = kzalloc_obj(*fifo, GFP_KERNEL);
if (!fifo)
return -ENOMEM;
diff --git a/sound/soc/meson/axg-tdm-formatter.c b/sound/soc/meson/axg-tdm-formatter.c
index a6579efd3775..1fd78790c967 100644
--- a/sound/soc/meson/axg-tdm-formatter.c
+++ b/sound/soc/meson/axg-tdm-formatter.c
@@ -368,7 +368,7 @@ struct axg_tdm_stream *axg_tdm_stream_alloc(struct axg_tdm_iface *iface)
{
struct axg_tdm_stream *ts;
- ts = kzalloc(sizeof(*ts), GFP_KERNEL);
+ ts = kzalloc_obj(*ts, GFP_KERNEL);
if (ts) {
INIT_LIST_HEAD(&ts->formatter_list);
mutex_init(&ts->lock);
diff --git a/sound/soc/meson/meson-codec-glue.c b/sound/soc/meson/meson-codec-glue.c
index f8c5643f3cfe..bd9a91d8bc3a 100644
--- a/sound/soc/meson/meson-codec-glue.c
+++ b/sound/soc/meson/meson-codec-glue.c
@@ -122,7 +122,7 @@ int meson_codec_glue_input_dai_probe(struct snd_soc_dai *dai)
{
struct meson_codec_glue_input *data;
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = kzalloc_obj(*data, GFP_KERNEL);
if (!data)
return -ENOMEM;
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index b8a3cb8b7597..790e4db9d91b 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -85,7 +85,7 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream,
clk_prepare_enable(priv->extclk);
- dma = kzalloc(sizeof(struct snd_dmaengine_dai_dma_data), GFP_KERNEL);
+ dma = kzalloc_obj(struct snd_dmaengine_dai_dma_data, GFP_KERNEL);
if (!dma)
return -ENOMEM;
dma->chan_name = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
@@ -749,7 +749,7 @@ static int pxa_ssp_probe(struct snd_soc_dai *dai)
struct ssp_priv *priv;
int ret;
- priv = kzalloc(sizeof(struct ssp_priv), GFP_KERNEL);
+ priv = kzalloc_obj(struct ssp_priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index b456e096f138..84909af310b4 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -202,7 +202,7 @@ static int lpass_platform_pcmops_open(struct snd_soc_component *component,
struct regmap *map;
unsigned int dai_id = cpu_dai->driver->id;
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = kzalloc_obj(*data, GFP_KERNEL);
if (!data)
return -ENOMEM;
diff --git a/sound/soc/qcom/qdsp6/q6adm.c b/sound/soc/qcom/qdsp6/q6adm.c
index 40bc44003453..db0ae71f2983 100644
--- a/sound/soc/qcom/qdsp6/q6adm.c
+++ b/sound/soc/qcom/qdsp6/q6adm.c
@@ -284,7 +284,7 @@ static struct q6copp *q6adm_alloc_copp(struct q6adm *adm, int port_idx)
if (idx >= MAX_COPPS_PER_PORT)
return ERR_PTR(-EBUSY);
- c = kzalloc(sizeof(*c), GFP_ATOMIC);
+ c = kzalloc_obj(*c, GFP_ATOMIC);
if (!c)
return ERR_PTR(-ENOMEM);
diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
index 76e14fc1b2b5..b1851dac61fa 100644
--- a/sound/soc/qcom/qdsp6/q6afe.c
+++ b/sound/soc/qcom/qdsp6/q6afe.c
@@ -1359,7 +1359,7 @@ void q6afe_tdm_port_prepare(struct q6afe_port *port,
pcfg->tdm_cfg.slot_width = cfg->slot_width;
pcfg->tdm_cfg.slot_mask = cfg->slot_mask;
- port->scfg = kzalloc(sizeof(*port->scfg), GFP_KERNEL);
+ port->scfg = kzalloc_obj(*port->scfg, GFP_KERNEL);
if (!port->scfg)
return;
diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c
index aaeeadded7aa..dcd960aeab2f 100644
--- a/sound/soc/qcom/qdsp6/q6apm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6apm-dai.c
@@ -348,7 +348,7 @@ static int q6apm_dai_open(struct snd_soc_component *component,
return -EINVAL;
}
- prtd = kzalloc(sizeof(*prtd), GFP_KERNEL);
+ prtd = kzalloc_obj(*prtd, GFP_KERNEL);
if (prtd == NULL)
return -ENOMEM;
@@ -490,7 +490,7 @@ static int q6apm_dai_compr_open(struct snd_soc_component *component,
if (!pdata)
return -EINVAL;
- prtd = kzalloc(sizeof(*prtd), GFP_KERNEL);
+ prtd = kzalloc_obj(*prtd, GFP_KERNEL);
if (prtd == NULL)
return -ENOMEM;
diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c
index 1d5edf285793..99d2dcdfac25 100644
--- a/sound/soc/qcom/qdsp6/q6apm.c
+++ b/sound/soc/qcom/qdsp6/q6apm.c
@@ -57,7 +57,7 @@ static struct audioreach_graph *q6apm_get_audioreach_graph(struct q6apm *apm, ui
if (!info)
return ERR_PTR(-ENODEV);
- graph = kzalloc(sizeof(*graph), GFP_KERNEL);
+ graph = kzalloc_obj(*graph, GFP_KERNEL);
if (!graph)
return ERR_PTR(-ENOMEM);
@@ -220,7 +220,7 @@ int q6apm_map_memory_regions(struct q6apm_graph *graph, unsigned int dir, phys_a
return 0;
}
- buf = kcalloc(periods, sizeof(struct audio_buffer), GFP_KERNEL);
+ buf = kzalloc_objs(struct audio_buffer, periods, GFP_KERNEL);
if (!buf) {
mutex_unlock(&graph->lock);
return -ENOMEM;
@@ -615,7 +615,7 @@ struct q6apm_graph *q6apm_graph_open(struct device *dev, q6apm_cb cb,
return ERR_CAST(ar_graph);
}
- graph = kzalloc(sizeof(*graph), GFP_KERNEL);
+ graph = kzalloc_obj(*graph, GFP_KERNEL);
if (!graph) {
ret = -ENOMEM;
goto put_ar_graph;
diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c
index 709b4f3318ff..99c1969d5cdc 100644
--- a/sound/soc/qcom/qdsp6/q6asm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
@@ -378,7 +378,7 @@ static int q6asm_dai_open(struct snd_soc_component *component,
return -EINVAL;
}
- prtd = kzalloc(sizeof(struct q6asm_dai_rtd), GFP_KERNEL);
+ prtd = kzalloc_obj(struct q6asm_dai_rtd, GFP_KERNEL);
if (prtd == NULL)
return -ENOMEM;
@@ -621,7 +621,7 @@ static int q6asm_dai_compr_open(struct snd_soc_component *component,
return -EINVAL;
}
- prtd = kzalloc(sizeof(*prtd), GFP_KERNEL);
+ prtd = kzalloc_obj(*prtd, GFP_KERNEL);
if (!prtd)
return -ENOMEM;
diff --git a/sound/soc/qcom/qdsp6/q6asm.c b/sound/soc/qcom/qdsp6/q6asm.c
index 1bb295407c60..424306da4a25 100644
--- a/sound/soc/qcom/qdsp6/q6asm.c
+++ b/sound/soc/qcom/qdsp6/q6asm.c
@@ -506,7 +506,7 @@ int q6asm_map_memory_regions(unsigned int dir, struct audio_client *ac,
return 0;
}
- buf = kcalloc(periods, sizeof(*buf), GFP_ATOMIC);
+ buf = kzalloc_objs(*buf, periods, GFP_ATOMIC);
if (!buf) {
spin_unlock_irqrestore(&ac->lock, flags);
return -ENOMEM;
@@ -850,7 +850,7 @@ struct audio_client *q6asm_audio_client_alloc(struct device *dev, q6asm_cb cb,
return ac;
}
- ac = kzalloc(sizeof(*ac), GFP_KERNEL);
+ ac = kzalloc_obj(*ac, GFP_KERNEL);
if (!ac)
return ERR_PTR(-ENOMEM);
diff --git a/sound/soc/qcom/qdsp6/q6core.c b/sound/soc/qcom/qdsp6/q6core.c
index f4939302b88a..393488c571cd 100644
--- a/sound/soc/qcom/qdsp6/q6core.c
+++ b/sound/soc/qcom/qdsp6/q6core.c
@@ -327,7 +327,7 @@ EXPORT_SYMBOL_GPL(q6core_is_adsp_ready);
static int q6core_probe(struct apr_device *adev)
{
- g_core = kzalloc(sizeof(*g_core), GFP_KERNEL);
+ g_core = kzalloc_obj(*g_core, GFP_KERNEL);
if (!g_core)
return -ENOMEM;
diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c
index aaa3af9f1993..c3b26b318718 100644
--- a/sound/soc/qcom/qdsp6/q6routing.c
+++ b/sound/soc/qcom/qdsp6/q6routing.c
@@ -1133,7 +1133,7 @@ static int q6pcm_routing_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- routing_data = kzalloc(sizeof(*routing_data), GFP_KERNEL);
+ routing_data = kzalloc_obj(*routing_data, GFP_KERNEL);
if (!routing_data)
return -ENOMEM;
diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c
index 2e71eaa90441..076b55c1f729 100644
--- a/sound/soc/qcom/qdsp6/topology.c
+++ b/sound/soc/qcom/qdsp6/topology.c
@@ -42,7 +42,7 @@ static struct audioreach_graph_info *audioreach_tplg_alloc_graph_info(struct q6a
}
*found = false;
- info = kzalloc(sizeof(*info), GFP_KERNEL);
+ info = kzalloc_obj(*info, GFP_KERNEL);
if (!info)
return ERR_PTR(-ENOMEM);
@@ -92,7 +92,7 @@ static struct audioreach_sub_graph *audioreach_tplg_alloc_sub_graph(struct q6apm
}
*found = false;
- sg = kzalloc(sizeof(*sg), GFP_KERNEL);
+ sg = kzalloc_obj(*sg, GFP_KERNEL);
if (!sg)
return ERR_PTR(-ENOMEM);
@@ -134,7 +134,7 @@ static struct audioreach_container *audioreach_tplg_alloc_container(struct q6apm
}
*found = false;
- cont = kzalloc(sizeof(*cont), GFP_KERNEL);
+ cont = kzalloc_obj(*cont, GFP_KERNEL);
if (!cont)
return ERR_PTR(-ENOMEM);
@@ -176,7 +176,7 @@ static struct audioreach_module *audioreach_tplg_alloc_module(struct q6apm *apm,
return mod;
}
*found = false;
- mod = kzalloc(sizeof(*mod), GFP_KERNEL);
+ mod = kzalloc_obj(*mod, GFP_KERNEL);
if (!mod)
return ERR_PTR(-ENOMEM);
@@ -317,8 +317,9 @@ audioreach_get_module_priv_data(const struct snd_soc_tplg_private *private)
if (le32_to_cpu(mod_array->type) == SND_SOC_AR_TPLG_MODULE_CFG_TYPE) {
struct audioreach_module_priv_data *pdata;
- pdata = kzalloc(struct_size(pdata, data, le32_to_cpu(mod_array->size)),
- GFP_KERNEL);
+ pdata = kzalloc_flex(*pdata, data,
+ le32_to_cpu(mod_array->size),
+ GFP_KERNEL);
if (!pdata)
return ERR_PTR(-ENOMEM);
@@ -829,7 +830,7 @@ static int audioreach_widget_load_mixer(struct snd_soc_component *component,
w_array = &tplg_w->priv.array[0];
- scontrol = kzalloc(sizeof(*scontrol), GFP_KERNEL);
+ scontrol = kzalloc_obj(*scontrol, GFP_KERNEL);
if (!scontrol)
return -ENOMEM;
@@ -1246,7 +1247,7 @@ static int audioreach_control_load(struct snd_soc_component *scomp, int index,
struct snd_soc_dobj *dobj;
int ret = 0;
- scontrol = kzalloc(sizeof(*scontrol), GFP_KERNEL);
+ scontrol = kzalloc_obj(*scontrol, GFP_KERNEL);
if (!scontrol)
return -ENOMEM;
diff --git a/sound/soc/renesas/siu_dai.c b/sound/soc/renesas/siu_dai.c
index 7e771a164a80..5e7751c8b1e3 100644
--- a/sound/soc/renesas/siu_dai.c
+++ b/sound/soc/renesas/siu_dai.c
@@ -453,7 +453,7 @@ int siu_init_port(int port, struct siu_port **port_info, struct snd_card *card)
struct snd_kcontrol *kctrl;
int ret;
- *port_info = kzalloc(sizeof(**port_info), GFP_KERNEL);
+ *port_info = kzalloc_obj(**port_info, GFP_KERNEL);
if (!*port_info)
return -ENOMEM;
diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c
index 402ccadad46c..58fade080976 100644
--- a/sound/soc/samsung/idma.c
+++ b/sound/soc/samsung/idma.c
@@ -290,7 +290,7 @@ static int idma_open(struct snd_soc_component *component,
snd_soc_set_runtime_hwparams(substream, &idma_hardware);
- prtd = kzalloc(sizeof(struct idma_ctrl), GFP_KERNEL);
+ prtd = kzalloc_obj(struct idma_ctrl, GFP_KERNEL);
if (prtd == NULL)
return -ENOMEM;
diff --git a/sound/soc/sdca/sdca_asoc.c b/sound/soc/sdca/sdca_asoc.c
index bb6e74e80a3e..51ccaa14b443 100644
--- a/sound/soc/sdca/sdca_asoc.c
+++ b/sound/soc/sdca/sdca_asoc.c
@@ -1349,7 +1349,7 @@ int sdca_asoc_set_constraints(struct device *dev, struct regmap *regmap,
dev_dbg(dev, "%s: set channel constraint mask: %#x\n",
entity->label, channel_mask);
- constraint = kzalloc(sizeof(*constraint), GFP_KERNEL);
+ constraint = kzalloc_obj(*constraint, GFP_KERNEL);
if (!constraint)
return -ENOMEM;
diff --git a/sound/soc/sdca/sdca_function_device.c b/sound/soc/sdca/sdca_function_device.c
index c6cc880a150e..dd419f426ba6 100644
--- a/sound/soc/sdca/sdca_function_device.c
+++ b/sound/soc/sdca/sdca_function_device.c
@@ -39,7 +39,7 @@ static struct sdca_dev *sdca_dev_register(struct device *parent,
int ret;
int rc;
- sdev = kzalloc(sizeof(*sdev), GFP_KERNEL);
+ sdev = kzalloc_obj(*sdev, GFP_KERNEL);
if (!sdev)
return ERR_PTR(-ENOMEM);
diff --git a/sound/soc/sdca/sdca_jack.c b/sound/soc/sdca/sdca_jack.c
index 605514f02045..0ce9cf8f850c 100644
--- a/sound/soc/sdca/sdca_jack.c
+++ b/sound/soc/sdca/sdca_jack.c
@@ -99,7 +99,7 @@ int sdca_jack_process(struct sdca_interrupt *interrupt)
if (kctl) {
struct soc_enum *soc_enum = (struct soc_enum *)kctl->private_value;
- ucontrol = kzalloc(sizeof(*ucontrol), GFP_KERNEL);
+ ucontrol = kzalloc_obj(*ucontrol, GFP_KERNEL);
if (!ucontrol)
return -ENOMEM;
diff --git a/sound/soc/soc-ac97.c b/sound/soc/soc-ac97.c
index 37486d6a438e..f71413a186b8 100644
--- a/sound/soc/soc-ac97.c
+++ b/sound/soc/soc-ac97.c
@@ -181,7 +181,7 @@ struct snd_ac97 *snd_soc_alloc_ac97_component(struct snd_soc_component *componen
{
struct snd_ac97 *ac97;
- ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL);
+ ac97 = kzalloc_obj(struct snd_ac97, GFP_KERNEL);
if (ac97 == NULL)
return ERR_PTR(-ENOMEM);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 5811d053ce7a..7c1f2c93d5d3 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -507,7 +507,7 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
/*
* for rtd->dev
*/
- dev = kzalloc(sizeof(struct device), GFP_KERNEL);
+ dev = kzalloc_obj(struct device, GFP_KERNEL);
if (!dev)
return NULL;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index c23ccf4a602d..54ee54dcba87 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -638,7 +638,7 @@ static int dapm_add_path(
if (ret)
return ret;
- path = kzalloc(sizeof(struct snd_soc_dapm_path), GFP_KERNEL);
+ path = kzalloc_obj(struct snd_soc_dapm_path, GFP_KERNEL);
if (!path)
return -ENOMEM;
@@ -713,7 +713,7 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
const char *name;
int ret;
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = kzalloc_obj(*data, GFP_KERNEL);
if (!data)
return -ENOMEM;
@@ -1435,7 +1435,7 @@ static int dapm_widget_list_create(struct snd_soc_dapm_widget_list **list,
list_for_each(it, widgets)
size++;
- *list = kzalloc(struct_size(*list, widgets, size), GFP_KERNEL);
+ *list = kzalloc_flex(**list, widgets, size, GFP_KERNEL);
if (*list == NULL)
return -ENOMEM;
@@ -3332,9 +3332,9 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card)
continue;
if (w->num_kcontrols) {
- w->kcontrols = kcalloc(w->num_kcontrols,
- sizeof(struct snd_kcontrol *),
- GFP_KERNEL);
+ w->kcontrols = kzalloc_objs(struct snd_kcontrol *,
+ w->num_kcontrols,
+ GFP_KERNEL);
if (!w->kcontrols) {
snd_soc_dapm_mutex_unlock(card);
return -ENOMEM;
@@ -3972,12 +3972,12 @@ static int dapm_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
* stuff that increases stack usage.
* So, we use kzalloc()/kfree() for params in this function.
*/
- struct snd_pcm_hw_params *params __free(kfree) = kzalloc(sizeof(*params),
- GFP_KERNEL);
+ struct snd_pcm_hw_params *params __free(kfree) = kzalloc_obj(*params,
+ GFP_KERNEL);
if (!params)
return -ENOMEM;
- runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
+ runtime = kzalloc_obj(*runtime, GFP_KERNEL);
if (!runtime)
return -ENOMEM;
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index a63e942fdc0b..1a2b5a8fd198 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -437,7 +437,7 @@ int snd_dmaengine_pcm_register(struct device *dev,
struct dmaengine_pcm *pcm;
int ret;
- pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
+ pcm = kzalloc_obj(*pcm, GFP_KERNEL);
if (!pcm)
return -ENOMEM;
diff --git a/sound/soc/soc-ops-test.c b/sound/soc/soc-ops-test.c
index 1bafa5626d48..0f924a6b0d15 100644
--- a/sound/soc/soc-ops-test.c
+++ b/sound/soc/soc-ops-test.c
@@ -486,7 +486,7 @@ static void soc_ops_test_access(struct kunit *test)
/* it is too large struct. use kzalloc() */
struct snd_ctl_elem_value *result;
- result = kzalloc(sizeof(*result), GFP_KERNEL);
+ result = kzalloc_obj(*result, GFP_KERNEL);
if (!result)
return;
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index ba42939d5f01..1d2ebb4f63e4 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -454,7 +454,7 @@ static int snd_soc_clip_to_platform_max(struct snd_kcontrol *kctl)
if (!mc->platform_max)
return 0;
- uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
+ uctl = kzalloc_obj(*uctl, GFP_KERNEL);
if (!uctl)
return -ENOMEM;
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 6b134962c71c..b3e3ffdcce6f 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1323,7 +1323,7 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe,
be_substream->pcm->nonatomic = 1;
}
- dpcm = kzalloc(sizeof(struct snd_soc_dpcm), GFP_KERNEL);
+ dpcm = kzalloc_obj(struct snd_soc_dpcm, GFP_KERNEL);
if (!dpcm)
return -ENOMEM;
diff --git a/sound/soc/soc-usb.c b/sound/soc/soc-usb.c
index 26baa66d29a8..57e537edb637 100644
--- a/sound/soc/soc-usb.c
+++ b/sound/soc/soc-usb.c
@@ -189,7 +189,7 @@ struct snd_soc_usb *snd_soc_usb_allocate_port(struct snd_soc_component *componen
{
struct snd_soc_usb *usb;
- usb = kzalloc(sizeof(*usb), GFP_KERNEL);
+ usb = kzalloc_obj(*usb, GFP_KERNEL);
if (!usb)
return ERR_PTR(-ENOMEM);
diff --git a/sound/soc/sof/compress.c b/sound/soc/sof/compress.c
index 86d563c864e5..f68fa3551df8 100644
--- a/sound/soc/sof/compress.c
+++ b/sound/soc/sof/compress.c
@@ -101,7 +101,7 @@ static int sof_compr_open(struct snd_soc_component *component,
struct snd_sof_pcm *spcm;
int dir;
- sstream = kzalloc(sizeof(*sstream), GFP_KERNEL);
+ sstream = kzalloc_obj(*sstream, GFP_KERNEL);
if (!sstream)
return -ENOMEM;
diff --git a/sound/soc/sof/intel/apl.c b/sound/soc/sof/intel/apl.c
index 0c68ae41a8a8..31494c686c72 100644
--- a/sound/soc/sof/intel/apl.c
+++ b/sound/soc/sof/intel/apl.c
@@ -54,7 +54,7 @@ int sof_apl_ops_init(struct snd_sof_dev *sdev)
if (sdev->pdata->ipc_type == SOF_IPC_TYPE_4) {
struct sof_ipc4_fw_data *ipc4_data;
- sdev->private = kzalloc(sizeof(*ipc4_data), GFP_KERNEL);
+ sdev->private = kzalloc_obj(*ipc4_data, GFP_KERNEL);
if (!sdev->private)
return -ENOMEM;
diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c
index 69376fb5b20d..b55dd9ace41f 100644
--- a/sound/soc/sof/intel/cnl.c
+++ b/sound/soc/sof/intel/cnl.c
@@ -401,7 +401,7 @@ int sof_cnl_ops_init(struct snd_sof_dev *sdev)
if (sdev->pdata->ipc_type == SOF_IPC_TYPE_4) {
struct sof_ipc4_fw_data *ipc4_data;
- sdev->private = kzalloc(sizeof(*ipc4_data), GFP_KERNEL);
+ sdev->private = kzalloc_obj(*ipc4_data, GFP_KERNEL);
if (!sdev->private)
return -ENOMEM;
diff --git a/sound/soc/sof/intel/hda-mlink.c b/sound/soc/sof/intel/hda-mlink.c
index 6f15213937a3..c9790f37928f 100644
--- a/sound/soc/sof/intel/hda-mlink.c
+++ b/sound/soc/sof/intel/hda-mlink.c
@@ -392,7 +392,7 @@ static int hda_ml_alloc_h2link(struct hdac_bus *bus, int index)
struct hdac_ext_link *hlink;
int ret;
- h2link = kzalloc(sizeof(*h2link), GFP_KERNEL);
+ h2link = kzalloc_obj(*h2link, GFP_KERNEL);
if (!h2link)
return -ENOMEM;
diff --git a/sound/soc/sof/intel/icl.c b/sound/soc/sof/intel/icl.c
index dbc5ad62258b..8079a1363b45 100644
--- a/sound/soc/sof/intel/icl.c
+++ b/sound/soc/sof/intel/icl.c
@@ -122,7 +122,7 @@ int sof_icl_ops_init(struct snd_sof_dev *sdev)
if (sdev->pdata->ipc_type == SOF_IPC_TYPE_4) {
struct sof_ipc4_fw_data *ipc4_data;
- sdev->private = kzalloc(sizeof(*ipc4_data), GFP_KERNEL);
+ sdev->private = kzalloc_obj(*ipc4_data, GFP_KERNEL);
if (!sdev->private)
return -ENOMEM;
diff --git a/sound/soc/sof/intel/mtl.c b/sound/soc/sof/intel/mtl.c
index 4ac81537ca05..e46b0fd5746f 100644
--- a/sound/soc/sof/intel/mtl.c
+++ b/sound/soc/sof/intel/mtl.c
@@ -734,7 +734,7 @@ int sof_mtl_set_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *dsp_ops)
dsp_ops->core_get = mtl_dsp_core_get;
dsp_ops->core_put = mtl_dsp_core_put;
- sdev->private = kzalloc(sizeof(struct sof_ipc4_fw_data), GFP_KERNEL);
+ sdev->private = kzalloc_obj(struct sof_ipc4_fw_data, GFP_KERNEL);
if (!sdev->private)
return -ENOMEM;
diff --git a/sound/soc/sof/intel/skl.c b/sound/soc/sof/intel/skl.c
index 90a3c2e2334c..eb94027a5724 100644
--- a/sound/soc/sof/intel/skl.c
+++ b/sound/soc/sof/intel/skl.c
@@ -62,7 +62,7 @@ int sof_skl_ops_init(struct snd_sof_dev *sdev)
/* probe/remove/shutdown */
sof_skl_ops.shutdown = hda_dsp_shutdown;
- sdev->private = kzalloc(sizeof(*ipc4_data), GFP_KERNEL);
+ sdev->private = kzalloc_obj(*ipc4_data, GFP_KERNEL);
if (!sdev->private)
return -ENOMEM;
diff --git a/sound/soc/sof/intel/telemetry.c b/sound/soc/sof/intel/telemetry.c
index dcaaf03599db..2e2cc6e2ea3a 100644
--- a/sound/soc/sof/intel/telemetry.c
+++ b/sound/soc/sof/intel/telemetry.c
@@ -29,7 +29,7 @@ void sof_ipc4_intel_dump_telemetry_state(struct snd_sof_dev *sdev, u32 flags)
if (!slot_offset)
return;
- telemetry_data = kmalloc(sizeof(*telemetry_data), GFP_KERNEL);
+ telemetry_data = kmalloc_obj(*telemetry_data, GFP_KERNEL);
if (!telemetry_data)
return;
sof_mailbox_read(sdev, slot_offset, telemetry_data, sizeof(*telemetry_data));
@@ -39,7 +39,7 @@ void sof_ipc4_intel_dump_telemetry_state(struct snd_sof_dev *sdev, u32 flags)
goto free_telemetry_data;
}
- block = kmalloc(sizeof(*block), GFP_KERNEL);
+ block = kmalloc_obj(*block, GFP_KERNEL);
if (!block)
goto free_telemetry_data;
@@ -71,7 +71,7 @@ void sof_ipc4_intel_dump_telemetry_state(struct snd_sof_dev *sdev, u32 flags)
break;
}
- xoops = kzalloc(struct_size(xoops, ar, XTENSA_CORE_AR_REGS_COUNT), GFP_KERNEL);
+ xoops = kzalloc_flex(*xoops, ar, XTENSA_CORE_AR_REGS_COUNT, GFP_KERNEL);
if (!xoops)
goto free_block;
diff --git a/sound/soc/sof/intel/tgl.c b/sound/soc/sof/intel/tgl.c
index e68bbe685ba3..1c07f5882e1c 100644
--- a/sound/soc/sof/intel/tgl.c
+++ b/sound/soc/sof/intel/tgl.c
@@ -90,7 +90,7 @@ int sof_tgl_ops_init(struct snd_sof_dev *sdev)
if (sdev->pdata->ipc_type == SOF_IPC_TYPE_4) {
struct sof_ipc4_fw_data *ipc4_data;
- sdev->private = kzalloc(sizeof(*ipc4_data), GFP_KERNEL);
+ sdev->private = kzalloc_obj(*ipc4_data, GFP_KERNEL);
if (!sdev->private)
return -ENOMEM;
diff --git a/sound/soc/sof/ipc3-dtrace.c b/sound/soc/sof/ipc3-dtrace.c
index 50700f5cb0ef..d5cb86b2ad08 100644
--- a/sound/soc/sof/ipc3-dtrace.c
+++ b/sound/soc/sof/ipc3-dtrace.c
@@ -126,7 +126,7 @@ static int trace_filter_parse(struct snd_sof_dev *sdev, char *string,
capacity += TRACE_FILTER_ELEMENTS_PER_ENTRY;
entry = strchr(entry + 1, entry_delimiter[0]);
}
- *out = kmalloc_array(capacity, sizeof(**out), GFP_KERNEL);
+ *out = kmalloc_objs(**out, capacity, GFP_KERNEL);
if (!*out)
return -ENOMEM;
diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c
index 743f42fb26c0..b4fc27727106 100644
--- a/sound/soc/sof/ipc3-topology.c
+++ b/sound/soc/sof/ipc3-topology.c
@@ -524,7 +524,7 @@ static int sof_ipc3_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
struct snd_sof_widget *comp_swidget;
int ret;
- pipeline = kzalloc(sizeof(*pipeline), GFP_KERNEL);
+ pipeline = kzalloc_obj(*pipeline, GFP_KERNEL);
if (!pipeline)
return -ENOMEM;
@@ -589,7 +589,7 @@ static int sof_ipc3_widget_setup_comp_buffer(struct snd_sof_widget *swidget)
struct sof_ipc_buffer *buffer;
int ret;
- buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
+ buffer = kzalloc_obj(*buffer, GFP_KERNEL);
if (!buffer)
return -ENOMEM;
@@ -893,7 +893,7 @@ static int sof_process_load(struct snd_soc_component *scomp,
/* allocate struct for widget control data sizes and types */
if (widget->num_kcontrols) {
- wdata = kcalloc(widget->num_kcontrols, sizeof(*wdata), GFP_KERNEL);
+ wdata = kzalloc_objs(*wdata, widget->num_kcontrols, GFP_KERNEL);
if (!wdata)
return -ENOMEM;
@@ -1567,7 +1567,7 @@ static int sof_ipc3_widget_setup_comp_dai(struct snd_sof_widget *swidget)
struct snd_sof_dai_link *slink;
int ret;
- private = kzalloc(sizeof(*private), GFP_KERNEL);
+ private = kzalloc_obj(*private, GFP_KERNEL);
if (!private)
return -ENOMEM;
@@ -1622,7 +1622,8 @@ static int sof_ipc3_widget_setup_comp_dai(struct snd_sof_widget *swidget)
continue;
/* Reserve memory for all hw configs, eventually freed by widget */
- config = kcalloc(slink->num_hw_configs, sizeof(*config), GFP_KERNEL);
+ config = kzalloc_objs(*config, slink->num_hw_configs,
+ GFP_KERNEL);
if (!config) {
ret = -ENOMEM;
goto free_comp;
diff --git a/sound/soc/sof/ipc4-pcm.c b/sound/soc/sof/ipc4-pcm.c
index c3337c3f08c1..a21dc53e1026 100644
--- a/sound/soc/sof/ipc4-pcm.c
+++ b/sound/soc/sof/ipc4-pcm.c
@@ -476,8 +476,8 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
}
/* allocate memory for the pipeline data */
- trigger_list = kzalloc(struct_size(trigger_list, pipeline_instance_ids,
- pipeline_list->count), GFP_KERNEL);
+ trigger_list = kzalloc_flex(*trigger_list, pipeline_instance_ids,
+ pipeline_list->count, GFP_KERNEL);
if (!trigger_list)
return -ENOMEM;
@@ -931,15 +931,15 @@ static int sof_ipc4_pcm_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm
pipeline_list = &spcm->stream[stream].pipeline_list;
/* allocate memory for max number of pipeline IDs */
- pipeline_list->pipelines = kcalloc(ipc4_data->max_num_pipelines,
- sizeof(*pipeline_list->pipelines),
- GFP_KERNEL);
+ pipeline_list->pipelines = kzalloc_objs(*pipeline_list->pipelines,
+ ipc4_data->max_num_pipelines,
+ GFP_KERNEL);
if (!pipeline_list->pipelines) {
sof_ipc4_pcm_free(sdev, spcm);
return -ENOMEM;
}
- stream_priv = kzalloc(sizeof(*stream_priv), GFP_KERNEL);
+ stream_priv = kzalloc_obj(*stream_priv, GFP_KERNEL);
if (!stream_priv) {
sof_ipc4_pcm_free(sdev, spcm);
return -ENOMEM;
@@ -951,7 +951,7 @@ static int sof_ipc4_pcm_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm
if (!support_info || stream == SNDRV_PCM_STREAM_CAPTURE)
continue;
- time_info = kzalloc(sizeof(*time_info), GFP_KERNEL);
+ time_info = kzalloc_obj(*time_info, GFP_KERNEL);
if (!time_info) {
sof_ipc4_pcm_free(sdev, spcm);
return -ENOMEM;
diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index 622bffb50a1c..051b02b222f9 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -436,8 +436,9 @@ static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
module_base_cfg->is_pages);
if (available_fmt->num_input_formats) {
- in_format = kcalloc(available_fmt->num_input_formats,
- sizeof(*in_format), GFP_KERNEL);
+ in_format = kzalloc_objs(*in_format,
+ available_fmt->num_input_formats,
+ GFP_KERNEL);
if (!in_format)
return -ENOMEM;
available_fmt->input_pin_fmts = in_format;
@@ -457,8 +458,9 @@ static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
}
if (available_fmt->num_output_formats) {
- out_format = kcalloc(available_fmt->num_output_formats, sizeof(*out_format),
- GFP_KERNEL);
+ out_format = kzalloc_objs(*out_format,
+ available_fmt->num_output_formats,
+ GFP_KERNEL);
if (!out_format) {
ret = -ENOMEM;
goto err_in;
@@ -627,7 +629,7 @@ static int sof_ipc4_widget_setup_pcm(struct snd_sof_widget *swidget)
int node_type = 0;
int ret, dir;
- ipc4_copier = kzalloc(sizeof(*ipc4_copier), GFP_KERNEL);
+ ipc4_copier = kzalloc_obj(*ipc4_copier, GFP_KERNEL);
if (!ipc4_copier)
return -ENOMEM;
@@ -688,7 +690,7 @@ static int sof_ipc4_widget_setup_pcm(struct snd_sof_widget *swidget)
}
skip_gtw_cfg:
- ipc4_copier->gtw_attr = kzalloc(sizeof(*ipc4_copier->gtw_attr), GFP_KERNEL);
+ ipc4_copier->gtw_attr = kzalloc_obj(*ipc4_copier->gtw_attr, GFP_KERNEL);
if (!ipc4_copier->gtw_attr) {
ret = -ENOMEM;
goto free_available_fmt;
@@ -757,7 +759,7 @@ static int sof_ipc4_widget_setup_comp_dai(struct snd_sof_widget *swidget)
int node_type = 0;
int ret;
- ipc4_copier = kzalloc(sizeof(*ipc4_copier), GFP_KERNEL);
+ ipc4_copier = kzalloc_obj(*ipc4_copier, GFP_KERNEL);
if (!ipc4_copier)
return -ENOMEM;
@@ -824,7 +826,7 @@ static int sof_ipc4_widget_setup_comp_dai(struct snd_sof_widget *swidget)
break;
}
- blob = kzalloc(sizeof(*blob), GFP_KERNEL);
+ blob = kzalloc_obj(*blob, GFP_KERNEL);
if (!blob) {
ret = -ENOMEM;
goto free_available_fmt;
@@ -863,7 +865,8 @@ static int sof_ipc4_widget_setup_comp_dai(struct snd_sof_widget *swidget)
SOF_IPC4_NODE_INDEX_INTEL_DMIC(ipc4_copier->dai_index);
break;
default:
- ipc4_copier->gtw_attr = kzalloc(sizeof(*ipc4_copier->gtw_attr), GFP_KERNEL);
+ ipc4_copier->gtw_attr = kzalloc_obj(*ipc4_copier->gtw_attr,
+ GFP_KERNEL);
if (!ipc4_copier->gtw_attr) {
ret = -ENOMEM;
goto free_available_fmt;
@@ -930,7 +933,7 @@ static int sof_ipc4_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
struct snd_sof_pipeline *spipe = swidget->spipe;
int ret;
- pipeline = kzalloc(sizeof(*pipeline), GFP_KERNEL);
+ pipeline = kzalloc_obj(*pipeline, GFP_KERNEL);
if (!pipeline)
return -ENOMEM;
@@ -989,7 +992,7 @@ static int sof_ipc4_widget_setup_comp_pga(struct snd_sof_widget *swidget)
struct sof_ipc4_gain *gain;
int ret;
- gain = kzalloc(sizeof(*gain), GFP_KERNEL);
+ gain = kzalloc_obj(*gain, GFP_KERNEL);
if (!gain)
return -ENOMEM;
@@ -1048,7 +1051,7 @@ static int sof_ipc4_widget_setup_comp_mixer(struct snd_sof_widget *swidget)
dev_dbg(scomp->dev, "Updating IPC structure for %s\n", swidget->widget->name);
- mixer = kzalloc(sizeof(*mixer), GFP_KERNEL);
+ mixer = kzalloc_obj(*mixer, GFP_KERNEL);
if (!mixer)
return -ENOMEM;
@@ -1080,7 +1083,7 @@ static int sof_ipc4_widget_setup_comp_src(struct snd_sof_widget *swidget)
dev_dbg(scomp->dev, "Updating IPC structure for %s\n", swidget->widget->name);
- src = kzalloc(sizeof(*src), GFP_KERNEL);
+ src = kzalloc_obj(*src, GFP_KERNEL);
if (!src)
return -ENOMEM;
@@ -1123,7 +1126,7 @@ static int sof_ipc4_widget_setup_comp_asrc(struct snd_sof_widget *swidget)
dev_dbg(scomp->dev, "Updating IPC structure for %s\n", swidget->widget->name);
- asrc = kzalloc(sizeof(*asrc), GFP_KERNEL);
+ asrc = kzalloc_obj(*asrc, GFP_KERNEL);
if (!asrc)
return -ENOMEM;
@@ -1206,7 +1209,7 @@ static int sof_ipc4_widget_setup_comp_process(struct snd_sof_widget *swidget)
void *cfg;
int ret;
- process = kzalloc(sizeof(*process), GFP_KERNEL);
+ process = kzalloc_obj(*process, GFP_KERNEL);
if (!process)
return -ENOMEM;
diff --git a/sound/soc/sof/sof-client-probes-ipc4.c b/sound/soc/sof/sof-client-probes-ipc4.c
index d3fa37106b64..2ab282e98a61 100644
--- a/sound/soc/sof/sof-client-probes-ipc4.c
+++ b/sound/soc/sof/sof-client-probes-ipc4.c
@@ -327,7 +327,7 @@ static int ipc4_probes_points_add(struct sof_client_dev *cdev,
* performance issue I wrote the conversion explicitly open for
* future development.
*/
- points = kcalloc(num_desc, sizeof(*points), GFP_KERNEL);
+ points = kzalloc_objs(*points, num_desc, GFP_KERNEL);
if (!points)
return -ENOMEM;
diff --git a/sound/soc/sof/sof-client.c b/sound/soc/sof/sof-client.c
index 38f1d7cec470..6cc9b7616100 100644
--- a/sound/soc/sof/sof-client.c
+++ b/sound/soc/sof/sof-client.c
@@ -554,7 +554,7 @@ int sof_client_register_ipc_rx_handler(struct sof_client_dev *cdev,
return -EINVAL;
}
- event = kmalloc(sizeof(*event), GFP_KERNEL);
+ event = kmalloc_obj(*event, GFP_KERNEL);
if (!event)
return -ENOMEM;
@@ -608,7 +608,7 @@ int sof_client_register_fw_state_handler(struct sof_client_dev *cdev,
if (!callback)
return -EINVAL;
- event = kmalloc(sizeof(*event), GFP_KERNEL);
+ event = kmalloc_obj(*event, GFP_KERNEL);
if (!event)
return -ENOMEM;
diff --git a/sound/soc/sof/stream-ipc.c b/sound/soc/sof/stream-ipc.c
index 8262443ac89a..e7541e1976b8 100644
--- a/sound/soc/sof/stream-ipc.c
+++ b/sound/soc/sof/stream-ipc.c
@@ -99,7 +99,7 @@ EXPORT_SYMBOL(sof_set_stream_data_offset);
int sof_stream_pcm_open(struct snd_sof_dev *sdev,
struct snd_pcm_substream *substream)
{
- struct sof_stream *stream = kmalloc(sizeof(*stream), GFP_KERNEL);
+ struct sof_stream *stream = kmalloc_obj(*stream, GFP_KERNEL);
if (!stream)
return -ENOMEM;
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index 9bf8ab610a7e..46d78de5d9da 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -973,7 +973,7 @@ static int sof_control_load(struct snd_soc_component *scomp, int index,
dev_dbg(scomp->dev, "tplg: load control type %d name : %s\n",
hdr->type, hdr->name);
- scontrol = kzalloc(sizeof(*scontrol), GFP_KERNEL);
+ scontrol = kzalloc_obj(*scontrol, GFP_KERNEL);
if (!scontrol)
return -ENOMEM;
@@ -1233,7 +1233,7 @@ static int sof_widget_parse_tokens(struct snd_soc_component *scomp, struct snd_s
num_tuples += token_list[object_token_list[i]].count;
/* allocate memory for tuples array */
- swidget->tuples = kcalloc(num_tuples, sizeof(*swidget->tuples), GFP_KERNEL);
+ swidget->tuples = kzalloc_objs(*swidget->tuples, num_tuples, GFP_KERNEL);
if (!swidget->tuples)
return -ENOMEM;
@@ -1420,7 +1420,7 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
int token_list_size = 0;
int ret = 0;
- swidget = kzalloc(sizeof(*swidget), GFP_KERNEL);
+ swidget = kzalloc_obj(*swidget, GFP_KERNEL);
if (!swidget)
return -ENOMEM;
@@ -1496,7 +1496,7 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
switch (w->id) {
case snd_soc_dapm_dai_in:
case snd_soc_dapm_dai_out:
- dai = kzalloc(sizeof(*dai), GFP_KERNEL);
+ dai = kzalloc_obj(*dai, GFP_KERNEL);
if (!dai) {
ret = -ENOMEM;
goto widget_free;
@@ -1586,7 +1586,7 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
if (w->id == snd_soc_dapm_scheduler) {
struct snd_sof_pipeline *spipe;
- spipe = kzalloc(sizeof(*spipe), GFP_KERNEL);
+ spipe = kzalloc_obj(*spipe, GFP_KERNEL);
if (!spipe) {
ret = -ENOMEM;
goto free;
@@ -1739,7 +1739,7 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
if (!pcm)
return 0;
- spcm = kzalloc(sizeof(*spcm), GFP_KERNEL);
+ spcm = kzalloc_obj(*spcm, GFP_KERNEL);
if (!spcm)
return -ENOMEM;
@@ -1906,7 +1906,7 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, struct snd_
return -EINVAL;
}
- slink = kzalloc(sizeof(*slink), GFP_KERNEL);
+ slink = kzalloc_obj(*slink, GFP_KERNEL);
if (!slink)
return -ENOMEM;
@@ -1999,7 +1999,7 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, struct snd_
}
/* allocate memory for tuples array */
- slink->tuples = kcalloc(num_tuples, sizeof(*slink->tuples), GFP_KERNEL);
+ slink->tuples = kzalloc_objs(*slink->tuples, num_tuples, GFP_KERNEL);
if (!slink->tuples) {
kfree(slink->hw_configs);
kfree(slink);
@@ -2094,7 +2094,7 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
int ret = 0;
/* allocate memory for sroute and connect */
- sroute = kzalloc(sizeof(*sroute), GFP_KERNEL);
+ sroute = kzalloc_obj(*sroute, GFP_KERNEL);
if (!sroute)
return -ENOMEM;
@@ -2398,11 +2398,11 @@ static int sof_dspless_widget_ready(struct snd_soc_component *scomp, int index,
struct snd_sof_widget *swidget;
struct snd_sof_dai *sdai;
- swidget = kzalloc(sizeof(*swidget), GFP_KERNEL);
+ swidget = kzalloc_obj(*swidget, GFP_KERNEL);
if (!swidget)
return -ENOMEM;
- sdai = kzalloc(sizeof(*sdai), GFP_KERNEL);
+ sdai = kzalloc_obj(*sdai, GFP_KERNEL);
if (!sdai) {
kfree(swidget);
return -ENOMEM;
diff --git a/sound/soc/sprd/sprd-pcm-compress.c b/sound/soc/sprd/sprd-pcm-compress.c
index 4b6ebfa5b033..0d544ff5a24f 100644
--- a/sound/soc/sprd/sprd-pcm-compress.c
+++ b/sound/soc/sprd/sprd-pcm-compress.c
@@ -160,7 +160,7 @@ static int sprd_platform_compr_dma_config(struct snd_soc_component *component,
return -ENODEV;
}
- sgt = sg = kcalloc(sg_num, sizeof(*sg), GFP_KERNEL);
+ sgt = sg = kzalloc_objs(*sg, sg_num, GFP_KERNEL);
if (!sg) {
ret = -ENOMEM;
goto sg_err;
diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c
index 17ef05309469..7cfe09fdd2a0 100644
--- a/sound/soc/xilinx/xlnx_formatter_pcm.c
+++ b/sound/soc/xilinx/xlnx_formatter_pcm.c
@@ -341,7 +341,7 @@ static int xlnx_formatter_pcm_open(struct snd_soc_component *component,
!adata->s2mm_presence)
return -ENODEV;
- stream_data = kzalloc(sizeof(*stream_data), GFP_KERNEL);
+ stream_data = kzalloc_obj(*stream_data, GFP_KERNEL);
if (!stream_data)
return -ENOMEM;