summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2026-02-21 23:46:04 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-22 08:26:33 -0800
commit189f164e573e18d9f8876dbd3ad8fcbe11f93037 (patch)
tree733382723a15ea29b7c9f3dde3bcb281f0b3c287 /sound
parent32a92f8c89326985e05dce8b22d3f0aa07a3e1bd (diff)
Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL usesHEADtorvalds/mastertorvalds/HEADmaster
Conversion performed via this Coccinelle script: // SPDX-License-Identifier: GPL-2.0-only // Options: --include-headers-for-types --all-includes --include-headers --keep-comments virtual patch @gfp depends on patch && !(file in "tools") && !(file in "samples")@ identifier ALLOC = {kmalloc_obj,kmalloc_objs,kmalloc_flex, kzalloc_obj,kzalloc_objs,kzalloc_flex, kvmalloc_obj,kvmalloc_objs,kvmalloc_flex, kvzalloc_obj,kvzalloc_objs,kvzalloc_flex}; @@ ALLOC(... - , GFP_KERNEL ) $ make coccicheck MODE=patch COCCI=gfp.cocci Build and boot tested x86_64 with Fedora 42's GCC and Clang: Linux version 6.19.0+ (user@host) (gcc (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7), GNU ld version 2.44-12.fc42) #1 SMP PREEMPT_DYNAMIC 1970-01-01 Linux version 6.19.0+ (user@host) (clang version 20.1.8 (Fedora 20.1.8-4.fc42), LLD 20.1.8) #1 SMP PREEMPT_DYNAMIC 1970-01-01 Signed-off-by: Kees Cook <kees@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/seq/oss/seq_oss_synth.c2
-rw-r--r--sound/firewire/amdtp-stream.c5
-rw-r--r--sound/pci/emu10k1/emufx.c2
-rw-r--r--sound/soc/codecs/pcm6240.c2
-rw-r--r--sound/soc/codecs/tas2781-fmwlib.c11
-rw-r--r--sound/soc/qcom/qdsp6/topology.c3
-rw-r--r--sound/soc/soc-dapm.c3
-rw-r--r--sound/soc/sof/ipc4-pcm.c5
-rw-r--r--sound/soc/sof/ipc4-topology.c6
-rw-r--r--sound/synth/emux/emux_effect.c2
-rw-r--r--sound/usb/qcom/qc_audio_offload.c3
-rw-r--r--sound/xen/xen_snd_front_evtchnl.c2
12 files changed, 19 insertions, 27 deletions
diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c
index b19b8756638d..c4b82e29ab05 100644
--- a/sound/core/seq/oss/seq_oss_synth.c
+++ b/sound/core/seq/oss/seq_oss_synth.c
@@ -214,7 +214,7 @@ snd_seq_oss_synth_setup(struct seq_oss_devinfo *dp)
info->nr_voices = rec->nr_voices;
if (info->nr_voices > 0) {
info->ch = kzalloc_objs(struct seq_oss_chinfo,
- info->nr_voices, GFP_KERNEL);
+ info->nr_voices);
if (!info->ch) {
rec->oper.close(&info->arg);
module_put(rec->oper.owner);
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index f33c08e7c659..e97721f80f65 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -1736,8 +1736,7 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
queue_size * 3 / 2);
s->ctx_data.tx.cache.pos = 0;
s->ctx_data.tx.cache.descs = kzalloc_objs(*s->ctx_data.tx.cache.descs,
- s->ctx_data.tx.cache.size,
- GFP_KERNEL);
+ s->ctx_data.tx.cache.size);
if (!s->ctx_data.tx.cache.descs) {
err = -ENOMEM;
goto err_context;
@@ -1758,7 +1757,7 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
};
s->ctx_data.rx.seq.descs = kzalloc_objs(*s->ctx_data.rx.seq.descs,
- queue_size, GFP_KERNEL);
+ queue_size);
if (!s->ctx_data.rx.seq.descs) {
err = -ENOMEM;
goto err_context;
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 77845b709e12..08e0556bf161 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -1807,7 +1807,7 @@ static int _snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
goto __err_gpr;
controls = kzalloc_objs(struct snd_emu10k1_fx8010_control_gpr,
- SND_EMU10K1_GPR_CONTROLS, GFP_KERNEL);
+ SND_EMU10K1_GPR_CONTROLS);
if (!controls)
goto __err_ctrls;
diff --git a/sound/soc/codecs/pcm6240.c b/sound/soc/codecs/pcm6240.c
index 9d86793f1958..78b21fbfad50 100644
--- a/sound/soc/codecs/pcm6240.c
+++ b/sound/soc/codecs/pcm6240.c
@@ -1262,7 +1262,7 @@ static struct pcmdevice_config_info *pcmdevice_add_config(void *ctxt,
config_offset += 4;
bk_da = cfg_info->blk_data = kzalloc_objs(struct pcmdevice_block_data *,
- cfg_info->nblocks, GFP_KERNEL);
+ cfg_info->nblocks);
if (!bk_da) {
*status = -ENOMEM;
goto out;
diff --git a/sound/soc/codecs/tas2781-fmwlib.c b/sound/soc/codecs/tas2781-fmwlib.c
index 460fae51c2f5..c969eb38704e 100644
--- a/sound/soc/codecs/tas2781-fmwlib.c
+++ b/sound/soc/codecs/tas2781-fmwlib.c
@@ -218,7 +218,7 @@ static struct tasdevice_config_info *tasdevice_add_config(
* these firmwares.
*/
bk_da = cfg_info->blk_data = kzalloc_objs(struct tasdev_blk_data *,
- cfg_info->nblocks, GFP_KERNEL);
+ cfg_info->nblocks);
if (!bk_da) {
*status = -ENOMEM;
goto out;
@@ -805,7 +805,7 @@ static int fw_parse_variable_header_kernel(
}
tas_fmw->programs = kzalloc_objs(struct tasdevice_prog,
- tas_fmw->nr_programs, GFP_KERNEL);
+ tas_fmw->nr_programs);
if (!tas_fmw->programs) {
offset = -ENOMEM;
goto out;
@@ -844,7 +844,7 @@ static int fw_parse_variable_header_kernel(
}
tas_fmw->configs = kzalloc_objs(struct tasdevice_config,
- tas_fmw->nr_configurations, GFP_KERNEL);
+ tas_fmw->nr_configurations);
if (!tas_fmw->configs) {
offset = -ENOMEM;
goto out;
@@ -1346,7 +1346,7 @@ static int fw_parse_configuration_data(
goto out;
}
tas_fmw->configs = kzalloc_objs(struct tasdevice_config,
- tas_fmw->nr_configurations, GFP_KERNEL);
+ tas_fmw->nr_configurations);
if (!tas_fmw->configs) {
offset = -ENOMEM;
goto out;
@@ -2141,8 +2141,7 @@ static int fw_parse_calibration_data(struct tasdevice_priv *tas_priv,
}
tas_fmw->calibrations = kzalloc_objs(struct tasdevice_calibration,
- tas_fmw->nr_calibrations,
- GFP_KERNEL);
+ tas_fmw->nr_calibrations);
if (!tas_fmw->calibrations) {
offset = -ENOMEM;
goto out;
diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c
index e87ad2f65e5d..e732fac9b8ca 100644
--- a/sound/soc/qcom/qdsp6/topology.c
+++ b/sound/soc/qcom/qdsp6/topology.c
@@ -318,8 +318,7 @@ audioreach_get_module_priv_data(const struct snd_soc_tplg_private *private)
struct audioreach_module_priv_data *pdata;
pdata = kzalloc_flex(*pdata, data,
- le32_to_cpu(mod_array->size),
- GFP_KERNEL);
+ le32_to_cpu(mod_array->size));
if (!pdata)
return ERR_PTR(-ENOMEM);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 1630a10c7ea3..2768ba5bfc9f 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3333,8 +3333,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card)
if (w->num_kcontrols) {
w->kcontrols = kzalloc_objs(struct snd_kcontrol *,
- w->num_kcontrols,
- GFP_KERNEL);
+ w->num_kcontrols);
if (!w->kcontrols) {
snd_soc_dapm_mutex_unlock(card);
return -ENOMEM;
diff --git a/sound/soc/sof/ipc4-pcm.c b/sound/soc/sof/ipc4-pcm.c
index f82b080de4a9..fc3ead77e5ea 100644
--- a/sound/soc/sof/ipc4-pcm.c
+++ b/sound/soc/sof/ipc4-pcm.c
@@ -477,7 +477,7 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
/* allocate memory for the pipeline data */
trigger_list = kzalloc_flex(*trigger_list, pipeline_instance_ids,
- pipeline_list->count, GFP_KERNEL);
+ pipeline_list->count);
if (!trigger_list)
return -ENOMEM;
@@ -932,8 +932,7 @@ static int sof_ipc4_pcm_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm
/* allocate memory for max number of pipeline IDs */
pipeline_list->pipelines = kzalloc_objs(*pipeline_list->pipelines,
- ipc4_data->max_num_pipelines,
- GFP_KERNEL);
+ ipc4_data->max_num_pipelines);
if (!pipeline_list->pipelines) {
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 8371e54314b4..db077e9d5644 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -437,8 +437,7 @@ static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
if (available_fmt->num_input_formats) {
in_format = kzalloc_objs(*in_format,
- available_fmt->num_input_formats,
- GFP_KERNEL);
+ available_fmt->num_input_formats);
if (!in_format)
return -ENOMEM;
available_fmt->input_pin_fmts = in_format;
@@ -459,8 +458,7 @@ static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
if (available_fmt->num_output_formats) {
out_format = kzalloc_objs(*out_format,
- available_fmt->num_output_formats,
- GFP_KERNEL);
+ available_fmt->num_output_formats);
if (!out_format) {
ret = -ENOMEM;
goto err_in;
diff --git a/sound/synth/emux/emux_effect.c b/sound/synth/emux/emux_effect.c
index dacbdf8cd39a..258997240a0a 100644
--- a/sound/synth/emux/emux_effect.c
+++ b/sound/synth/emux/emux_effect.c
@@ -273,7 +273,7 @@ snd_emux_create_effect(struct snd_emux_port *p)
{
int i;
p->effect = kzalloc_objs(struct snd_emux_effect_table,
- p->chset.max_channels, GFP_KERNEL);
+ p->chset.max_channels);
if (p->effect) {
for (i = 0; i < p->chset.max_channels; i++)
p->chset.channels[i].private = p->effect + i;
diff --git a/sound/usb/qcom/qc_audio_offload.c b/sound/usb/qcom/qc_audio_offload.c
index 57b803e0c986..01e6063c2207 100644
--- a/sound/usb/qcom/qc_audio_offload.c
+++ b/sound/usb/qcom/qc_audio_offload.c
@@ -1433,8 +1433,7 @@ static int prepare_qmi_response(struct snd_usb_substream *subs,
uadev[card_num].num_intf =
subs->dev->config->desc.bNumInterfaces;
uadev[card_num].info = kzalloc_objs(struct intf_info,
- uadev[card_num].num_intf,
- GFP_KERNEL);
+ uadev[card_num].num_intf);
if (!uadev[card_num].info) {
ret = -ENOMEM;
goto unmap_er;
diff --git a/sound/xen/xen_snd_front_evtchnl.c b/sound/xen/xen_snd_front_evtchnl.c
index 8a8807cbc80c..bc03f71bf16e 100644
--- a/sound/xen/xen_snd_front_evtchnl.c
+++ b/sound/xen/xen_snd_front_evtchnl.c
@@ -268,7 +268,7 @@ int xen_snd_front_evtchnl_create_all(struct xen_snd_front_info *front_info,
front_info->evt_pairs =
kzalloc_objs(struct xen_snd_front_evtchnl_pair,
- num_streams, GFP_KERNEL);
+ num_streams);
if (!front_info->evt_pairs)
return -ENOMEM;