summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/ac97/bus.c4
-rw-r--r--sound/ac97/snd_ac97_compat.c2
-rw-r--r--sound/aoa/codecs/onyx.c8
-rw-r--r--sound/aoa/codecs/tas.c2
-rw-r--r--sound/aoa/codecs/toonie.c2
-rw-r--r--sound/aoa/core/gpio-pmf.c3
-rw-r--r--sound/aoa/fabrics/layout.c2
-rw-r--r--sound/aoa/soundbus/i2sbus/control.c2
-rw-r--r--sound/aoa/soundbus/i2sbus/core.c2
-rw-r--r--sound/aoa/soundbus/i2sbus/pcm.c2
-rw-r--r--sound/core/compress_offload.c8
-rw-r--r--sound/core/control.c4
-rw-r--r--sound/core/control_compat.c10
-rw-r--r--sound/core/control_led.c2
-rw-r--r--sound/core/device.c2
-rw-r--r--sound/core/hrtimer.c2
-rw-r--r--sound/core/hwdep.c2
-rw-r--r--sound/core/info.c8
-rw-r--r--sound/core/init.c4
-rw-r--r--sound/core/jack.c4
-rw-r--r--sound/core/memalloc.c4
-rw-r--r--sound/core/oss/mixer_oss.c32
-rw-r--r--sound/core/oss/pcm_oss.c18
-rw-r--r--sound/core/oss/pcm_plugin.c3
-rw-r--r--sound/core/pcm.c8
-rw-r--r--sound/core/pcm_compat.c2
-rw-r--r--sound/core/pcm_dmaengine.c2
-rw-r--r--sound/core/pcm_lib.c2
-rw-r--r--sound/core/pcm_memory.c2
-rw-r--r--sound/core/pcm_native.c8
-rw-r--r--sound/core/rawmidi.c8
-rw-r--r--sound/core/seq/oss/seq_oss_init.c4
-rw-r--r--sound/core/seq/oss/seq_oss_midi.c6
-rw-r--r--sound/core/seq/oss/seq_oss_readq.c4
-rw-r--r--sound/core/seq/oss/seq_oss_synth.c3
-rw-r--r--sound/core/seq/oss/seq_oss_timer.c2
-rw-r--r--sound/core/seq/oss/seq_oss_writeq.c2
-rw-r--r--sound/core/seq/seq_compat.c2
-rw-r--r--sound/core/seq/seq_dummy.c2
-rw-r--r--sound/core/seq/seq_fifo.c2
-rw-r--r--sound/core/seq/seq_memory.c7
-rw-r--r--sound/core/seq/seq_midi.c8
-rw-r--r--sound/core/seq/seq_midi_emul.c4
-rw-r--r--sound/core/seq/seq_midi_event.c2
-rw-r--r--sound/core/seq/seq_ports.c4
-rw-r--r--sound/core/seq/seq_prioq.c2
-rw-r--r--sound/core/seq/seq_queue.c2
-rw-r--r--sound/core/seq/seq_system.c2
-rw-r--r--sound/core/seq/seq_timer.c2
-rw-r--r--sound/core/seq/seq_ump_client.c10
-rw-r--r--sound/core/seq/seq_virmidi.c6
-rw-r--r--sound/core/sound.c2
-rw-r--r--sound/core/sound_oss.c2
-rw-r--r--sound/core/timer.c14
-rw-r--r--sound/core/ump.c8
-rw-r--r--sound/core/vmaster.c11
-rw-r--r--sound/drivers/dummy.c4
-rw-r--r--sound/drivers/mpu401/mpu401_uart.c2
-rw-r--r--sound/drivers/mts64.c2
-rw-r--r--sound/drivers/opl3/opl3_lib.c2
-rw-r--r--sound/drivers/opl3/opl3_synth.c2
-rw-r--r--sound/drivers/opl4/opl4_lib.c2
-rw-r--r--sound/drivers/pcmtest.c4
-rw-r--r--sound/drivers/portman2x4.c2
-rw-r--r--sound/drivers/vx/vx_pcm.c8
-rw-r--r--sound/firewire/amdtp-stream.c10
-rw-r--r--sound/firewire/bebob/bebob_proc.c2
-rw-r--r--sound/firewire/fireworks/fireworks.c2
-rw-r--r--sound/firewire/fireworks/fireworks_proc.c2
-rw-r--r--sound/firewire/motu/motu-hwdep.c6
-rw-r--r--sound/firewire/packets-buffer.c2
-rw-r--r--sound/hda/codecs/analog.c2
-rw-r--r--sound/hda/codecs/ca0110.c2
-rw-r--r--sound/hda/codecs/ca0132.c11
-rw-r--r--sound/hda/codecs/cirrus/cs420x.c2
-rw-r--r--sound/hda/codecs/cirrus/cs421x.c2
-rw-r--r--sound/hda/codecs/cirrus/cs8409.c2
-rw-r--r--sound/hda/codecs/cm9825.c2
-rw-r--r--sound/hda/codecs/cmedia.c2
-rw-r--r--sound/hda/codecs/conexant.c2
-rw-r--r--sound/hda/codecs/generic.c4
-rw-r--r--sound/hda/codecs/hdmi/hdmi.c2
-rw-r--r--sound/hda/codecs/hdmi/simplehdmi.c2
-rw-r--r--sound/hda/codecs/realtek/realtek.c4
-rw-r--r--sound/hda/codecs/senarytech.c2
-rw-r--r--sound/hda/codecs/si3054.c2
-rw-r--r--sound/hda/codecs/sigmatel.c2
-rw-r--r--sound/hda/codecs/via.c2
-rw-r--r--sound/hda/common/beep.c2
-rw-r--r--sound/hda/common/codec.c10
-rw-r--r--sound/hda/common/controller.c4
-rw-r--r--sound/hda/common/jack.c2
-rw-r--r--sound/hda/common/proc.c7
-rw-r--r--sound/hda/core/ext/controller.c2
-rw-r--r--sound/hda/core/ext/stream.c4
-rw-r--r--sound/hda/core/sysfs.c10
-rw-r--r--sound/i2c/cs8427.c2
-rw-r--r--sound/i2c/i2c.c4
-rw-r--r--sound/i2c/other/ak4113.c2
-rw-r--r--sound/i2c/other/ak4114.c2
-rw-r--r--sound/i2c/other/ak4117.c2
-rw-r--r--sound/i2c/tea6330t.c2
-rw-r--r--sound/isa/gus/gus_main.c2
-rw-r--r--sound/isa/gus/gus_mem.c2
-rw-r--r--sound/isa/gus/gus_mem_proc.c4
-rw-r--r--sound/isa/gus/gus_pcm.c2
-rw-r--r--sound/isa/sb/emu8000_pcm.c2
-rw-r--r--sound/isa/sb/sb16_csp.c2
-rw-r--r--sound/isa/wavefront/wavefront_synth.c2
-rw-r--r--sound/mips/hal2.c2
-rw-r--r--sound/mips/sgio2audio.c2
-rw-r--r--sound/parisc/harmony.c2
-rw-r--r--sound/pci/ac97/ac97_codec.c4
-rw-r--r--sound/pci/ac97/ac97_pcm.c2
-rw-r--r--sound/pci/ak4531_codec.c2
-rw-r--r--sound/pci/als300.c6
-rw-r--r--sound/pci/asihpi/asihpi.c4
-rw-r--r--sound/pci/asihpi/hpi6000.c2
-rw-r--r--sound/pci/asihpi/hpi6205.c2
-rw-r--r--sound/pci/asihpi/hpicmn.c5
-rw-r--r--sound/pci/asihpi/hpidspcd.c2
-rw-r--r--sound/pci/asihpi/hpioctl.c4
-rw-r--r--sound/pci/ca0106/ca0106_main.c4
-rw-r--r--sound/pci/cmipci.c4
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c6
-rw-r--r--sound/pci/cs46xx/dsp_spos.c8
-rw-r--r--sound/pci/cs46xx/dsp_spos_scb_lib.c2
-rw-r--r--sound/pci/ctxfi/ctamixer.c4
-rw-r--r--sound/pci/ctxfi/ctatc.c2
-rw-r--r--sound/pci/ctxfi/ctdaio.c8
-rw-r--r--sound/pci/ctxfi/cthw20k1.c16
-rw-r--r--sound/pci/ctxfi/cthw20k2.c16
-rw-r--r--sound/pci/ctxfi/ctmixer.c2
-rw-r--r--sound/pci/ctxfi/ctpcm.c4
-rw-r--r--sound/pci/ctxfi/ctsrc.c9
-rw-r--r--sound/pci/ctxfi/cttimer.c2
-rw-r--r--sound/pci/ctxfi/ctvmem.c6
-rw-r--r--sound/pci/echoaudio/echoaudio.c2
-rw-r--r--sound/pci/emu10k1/emu10k1x.c4
-rw-r--r--sound/pci/emu10k1/emufx.c34
-rw-r--r--sound/pci/emu10k1/emupcm.c10
-rw-r--r--sound/pci/es1968.c8
-rw-r--r--sound/pci/ice1712/ak4xxx.c2
-rw-r--r--sound/pci/ice1712/aureon.c4
-rw-r--r--sound/pci/ice1712/delta.c2
-rw-r--r--sound/pci/ice1712/ews.c4
-rw-r--r--sound/pci/ice1712/hoontech.c4
-rw-r--r--sound/pci/ice1712/juli.c4
-rw-r--r--sound/pci/ice1712/maya44.c2
-rw-r--r--sound/pci/ice1712/phase.c6
-rw-r--r--sound/pci/ice1712/pontis.c2
-rw-r--r--sound/pci/ice1712/prodigy192.c2
-rw-r--r--sound/pci/ice1712/prodigy_hifi.c8
-rw-r--r--sound/pci/ice1712/psc724.c2
-rw-r--r--sound/pci/ice1712/quartet.c4
-rw-r--r--sound/pci/ice1712/revo.c6
-rw-r--r--sound/pci/ice1712/se.c2
-rw-r--r--sound/pci/ice1712/wtm.c2
-rw-r--r--sound/pci/mixart/mixart.c6
-rw-r--r--sound/pci/mixart/mixart_hwdep.c6
-rw-r--r--sound/pci/pcxhr/pcxhr.c4
-rw-r--r--sound/pci/riptide/riptide.c6
-rw-r--r--sound/pci/rme9652/hdspm.c4
-rw-r--r--sound/pci/trident/trident_main.c2
-rw-r--r--sound/pci/via82xx.c5
-rw-r--r--sound/pci/via82xx_modem.c5
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c4
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf_core.c2
-rw-r--r--sound/ppc/awacs.c2
-rw-r--r--sound/ppc/beep.c2
-rw-r--r--sound/ppc/daca.c2
-rw-r--r--sound/ppc/pmac.c2
-rw-r--r--sound/ppc/tumbler.c2
-rw-r--r--sound/sh/aica.c4
-rw-r--r--sound/sh/sh_dac_audio.c2
-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
-rw-r--r--sound/sound_core.c2
-rw-r--r--sound/synth/emux/emux.c6
-rw-r--r--sound/synth/emux/emux_effect.c4
-rw-r--r--sound/synth/emux/emux_seq.c8
-rw-r--r--sound/synth/emux/soundfont.c8
-rw-r--r--sound/synth/util_mem.c2
-rw-r--r--sound/usb/6fire/comm.c3
-rw-r--r--sound/usb/6fire/control.c4
-rw-r--r--sound/usb/6fire/firmware.c3
-rw-r--r--sound/usb/6fire/midi.c3
-rw-r--r--sound/usb/6fire/pcm.c2
-rw-r--r--sound/usb/caiaq/audio.c5
-rw-r--r--sound/usb/endpoint.c6
-rw-r--r--sound/usb/fcp.c6
-rw-r--r--sound/usb/hiface/pcm.c2
-rw-r--r--sound/usb/line6/capture.c4
-rw-r--r--sound/usb/line6/driver.c2
-rw-r--r--sound/usb/line6/midi.c2
-rw-r--r--sound/usb/line6/pcm.c2
-rw-r--r--sound/usb/line6/playback.c4
-rw-r--r--sound/usb/line6/toneport.c2
-rw-r--r--sound/usb/media.c4
-rw-r--r--sound/usb/midi.c6
-rw-r--r--sound/usb/midi2.c6
-rw-r--r--sound/usb/misc/ua101.c2
-rw-r--r--sound/usb/mixer.c18
-rw-r--r--sound/usb/mixer_quirks.c13
-rw-r--r--sound/usb/mixer_s1810c.c4
-rw-r--r--sound/usb/mixer_scarlett.c2
-rw-r--r--sound/usb/mixer_scarlett2.c4
-rw-r--r--sound/usb/mixer_us16x08.c8
-rw-r--r--sound/usb/power.c2
-rw-r--r--sound/usb/qcom/qc_audio_offload.c16
-rw-r--r--sound/usb/quirks.c6
-rw-r--r--sound/usb/stream.c12
-rw-r--r--sound/usb/usx2y/usbusx2yaudio.c9
-rw-r--r--sound/virtio/virtio_card.c3
-rw-r--r--sound/virtio/virtio_jack.c2
-rw-r--r--sound/virtio/virtio_pcm.c2
-rw-r--r--sound/virtio/virtio_pcm_msg.c4
-rw-r--r--sound/x86/intel_hdmi_audio.c2
-rw-r--r--sound/xen/xen_snd_front_alsa.c4
-rw-r--r--sound/xen/xen_snd_front_evtchnl.c5
316 files changed, 692 insertions, 697 deletions
diff --git a/sound/ac97/bus.c b/sound/ac97/bus.c
index bb9b795e0226..0dda1f4d5cbd 100644
--- a/sound/ac97/bus.c
+++ b/sound/ac97/bus.c
@@ -104,7 +104,7 @@ static int ac97_codec_add(struct ac97_controller *ac97_ctrl, int idx,
struct ac97_codec_device *codec;
int ret;
- codec = kzalloc(sizeof(*codec), GFP_KERNEL);
+ codec = kzalloc_obj(*codec, GFP_KERNEL);
if (!codec)
return -ENOMEM;
ac97_ctrl->codecs[idx] = codec;
@@ -351,7 +351,7 @@ struct ac97_controller *snd_ac97_controller_register(
struct ac97_controller *ac97_ctrl;
int ret, i;
- ac97_ctrl = kzalloc(sizeof(*ac97_ctrl), GFP_KERNEL);
+ ac97_ctrl = kzalloc_obj(*ac97_ctrl, GFP_KERNEL);
if (!ac97_ctrl)
return ERR_PTR(-ENOMEM);
diff --git a/sound/ac97/snd_ac97_compat.c b/sound/ac97/snd_ac97_compat.c
index d2479bba75bf..e6c43556c8f6 100644
--- a/sound/ac97/snd_ac97_compat.c
+++ b/sound/ac97/snd_ac97_compat.c
@@ -69,7 +69,7 @@ struct snd_ac97 *snd_ac97_compat_alloc(struct ac97_codec_device *adev)
struct snd_ac97 *ac97;
int ret;
- 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/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c
index 4cf959017c9d..bce8b35c5c27 100644
--- a/sound/aoa/codecs/onyx.c
+++ b/sound/aoa/codecs/onyx.c
@@ -855,7 +855,8 @@ static int onyx_init_codec(struct aoa_codec *codec)
/* if no inputs are present... */
if ((onyx->codec.connected & 0xC) == 0) {
if (!onyx->codec_info)
- onyx->codec_info = kmalloc(sizeof(struct codec_info), GFP_KERNEL);
+ onyx->codec_info = kmalloc_obj(struct codec_info,
+ GFP_KERNEL);
if (!onyx->codec_info)
return -ENOMEM;
ci = onyx->codec_info;
@@ -866,7 +867,8 @@ static int onyx_init_codec(struct aoa_codec *codec)
/* if no outputs are present... */
if ((onyx->codec.connected & 3) == 0) {
if (!onyx->codec_info)
- onyx->codec_info = kmalloc(sizeof(struct codec_info), GFP_KERNEL);
+ onyx->codec_info = kmalloc_obj(struct codec_info,
+ GFP_KERNEL);
if (!onyx->codec_info)
return -ENOMEM;
ci = onyx->codec_info;
@@ -957,7 +959,7 @@ static int onyx_i2c_probe(struct i2c_client *client)
struct onyx *onyx;
u8 dummy;
- onyx = kzalloc(sizeof(struct onyx), GFP_KERNEL);
+ onyx = kzalloc_obj(struct onyx, GFP_KERNEL);
if (!onyx)
return -ENOMEM;
diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c
index 7085e0b93e29..9c9b35cb5b6a 100644
--- a/sound/aoa/codecs/tas.c
+++ b/sound/aoa/codecs/tas.c
@@ -845,7 +845,7 @@ static int tas_i2c_probe(struct i2c_client *client)
struct device_node *node = client->dev.of_node;
struct tas *tas;
- tas = kzalloc(sizeof(struct tas), GFP_KERNEL);
+ tas = kzalloc_obj(struct tas, GFP_KERNEL);
if (!tas)
return -ENOMEM;
diff --git a/sound/aoa/codecs/toonie.c b/sound/aoa/codecs/toonie.c
index b59967c49e0a..19653cf19292 100644
--- a/sound/aoa/codecs/toonie.c
+++ b/sound/aoa/codecs/toonie.c
@@ -121,7 +121,7 @@ static struct toonie *toonie;
static int __init toonie_init(void)
{
- toonie = kzalloc(sizeof(struct toonie), GFP_KERNEL);
+ toonie = kzalloc_obj(struct toonie, GFP_KERNEL);
if (!toonie)
return -ENOMEM;
diff --git a/sound/aoa/core/gpio-pmf.c b/sound/aoa/core/gpio-pmf.c
index e76bde25e41a..155a503e1e9b 100644
--- a/sound/aoa/core/gpio-pmf.c
+++ b/sound/aoa/core/gpio-pmf.c
@@ -173,8 +173,7 @@ static int pmf_set_notify(struct gpio_runtime *rt,
notif->gpio_private = NULL;
}
if (!old && notify) {
- irq_client = kzalloc(sizeof(struct pmf_irq_client),
- GFP_KERNEL);
+ irq_client = kzalloc_obj(struct pmf_irq_client, GFP_KERNEL);
if (!irq_client)
return -ENOMEM;
irq_client->data = notif;
diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c
index bb2a0ef3004b..0b73ecda1b1d 100644
--- a/sound/aoa/fabrics/layout.c
+++ b/sound/aoa/fabrics/layout.c
@@ -1025,7 +1025,7 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev)
goto outnodev;
}
- ldev = kzalloc(sizeof(struct layout_dev), GFP_KERNEL);
+ ldev = kzalloc_obj(struct layout_dev, GFP_KERNEL);
if (!ldev)
goto outnodev;
diff --git a/sound/aoa/soundbus/i2sbus/control.c b/sound/aoa/soundbus/i2sbus/control.c
index a003ef06de63..09e5070e0ae2 100644
--- a/sound/aoa/soundbus/i2sbus/control.c
+++ b/sound/aoa/soundbus/i2sbus/control.c
@@ -19,7 +19,7 @@
int i2sbus_control_init(struct macio_dev* dev, struct i2sbus_control **c)
{
- *c = kzalloc(sizeof(struct i2sbus_control), GFP_KERNEL);
+ *c = kzalloc_obj(struct i2sbus_control, GFP_KERNEL);
if (!*c)
return -ENOMEM;
diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c
index f4d43c854bbd..8941f3266947 100644
--- a/sound/aoa/soundbus/i2sbus/core.c
+++ b/sound/aoa/soundbus/i2sbus/core.c
@@ -171,7 +171,7 @@ static int i2sbus_add_dev(struct macio_dev *macio,
if (strncmp(node_name, "i2s-", 4))
return 0;
- dev = kzalloc(sizeof(struct i2sbus_dev), GFP_KERNEL);
+ dev = kzalloc_obj(struct i2sbus_dev, GFP_KERNEL);
if (!dev)
return 0;
diff --git a/sound/aoa/soundbus/i2sbus/pcm.c b/sound/aoa/soundbus/i2sbus/pcm.c
index 4c480ad2c05d..ceee3320a932 100644
--- a/sound/aoa/soundbus/i2sbus/pcm.c
+++ b/sound/aoa/soundbus/i2sbus/pcm.c
@@ -879,7 +879,7 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card,
tmp++;
}
- cii = kzalloc(sizeof(struct codec_info_item), GFP_KERNEL);
+ cii = kzalloc_obj(struct codec_info_item, GFP_KERNEL);
if (!cii)
return -ENOMEM;
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index ed2eeb914c6d..27d916c8fb29 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -519,7 +519,7 @@ snd_compr_get_codec_caps(struct snd_compr_stream *stream, unsigned long arg)
return -ENXIO;
struct snd_compr_codec_caps *caps __free(kfree) =
- kzalloc(sizeof(*caps), GFP_KERNEL);
+ kzalloc_obj(*caps, GFP_KERNEL);
if (!caps)
return -ENOMEM;
@@ -539,7 +539,7 @@ int snd_compr_malloc_pages(struct snd_compr_stream *stream, size_t size)
if (snd_BUG_ON(!(stream) || !(stream)->runtime))
return -EINVAL;
- dmab = kzalloc(sizeof(*dmab), GFP_KERNEL);
+ dmab = kzalloc_obj(*dmab, GFP_KERNEL);
if (!dmab)
return -ENOMEM;
dmab->dev = stream->dma_buffer.dev;
@@ -694,7 +694,7 @@ snd_compr_get_params(struct snd_compr_stream *stream, unsigned long arg)
return -EBADFD;
struct snd_codec *params __free(kfree) =
- kzalloc(sizeof(*params), GFP_KERNEL);
+ kzalloc_obj(*params, GFP_KERNEL);
if (!params)
return -ENOMEM;
retval = stream->ops->get_params(stream, params);
@@ -1066,7 +1066,7 @@ static int snd_compr_task_new(struct snd_compr_stream *stream, struct snd_compr_
return -EBUSY;
if (utask->origin_seqno != 0 || utask->input_size != 0)
return -EINVAL;
- task = kzalloc(sizeof(*task), GFP_KERNEL);
+ task = kzalloc_obj(*task, GFP_KERNEL);
if (task == NULL)
return -ENOMEM;
task->seqno = utask->seqno = snd_compr_seqno_next(stream);
diff --git a/sound/core/control.c b/sound/core/control.c
index 486d1bc4dac2..eb4a3c1214fb 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -233,7 +233,7 @@ static int snd_ctl_new(struct snd_kcontrol **kctl, unsigned int count,
if (count == 0 || count > MAX_CONTROL_COUNT)
return -EINVAL;
- *kctl = kzalloc(struct_size(*kctl, vd, count), GFP_KERNEL);
+ *kctl = kzalloc_flex(**kctl, vd, count, GFP_KERNEL);
if (!*kctl)
return -ENOMEM;
@@ -2057,7 +2057,7 @@ static int _snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head *
{
struct snd_kctl_ioctl *pn;
- pn = kzalloc(sizeof(struct snd_kctl_ioctl), GFP_KERNEL);
+ pn = kzalloc_obj(struct snd_kctl_ioctl, GFP_KERNEL);
if (pn == NULL)
return -ENOMEM;
pn->fioctl = fcn;
diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c
index b8988a4bcd9b..174395322c51 100644
--- a/sound/core/control_compat.c
+++ b/sound/core/control_compat.c
@@ -82,7 +82,7 @@ static int snd_ctl_elem_info_compat(struct snd_ctl_file *ctl,
struct snd_card *card = ctl->card;
int err;
struct snd_ctl_elem_info *data __free(kfree) =
- kzalloc(sizeof(*data), GFP_KERNEL);
+ kzalloc_obj(*data, GFP_KERNEL);
if (! data)
return -ENOMEM;
@@ -177,7 +177,7 @@ static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id,
return -ENOENT;
struct snd_ctl_elem_info *info __free(kfree) =
- kzalloc(sizeof(*info), GFP_KERNEL);
+ kzalloc_obj(*info, GFP_KERNEL);
if (info == NULL)
return -ENOMEM;
info->id = *id;
@@ -283,7 +283,7 @@ static int __ctl_elem_read_user(struct snd_card *card,
{
int err, type, count;
struct snd_ctl_elem_value *data __free(kfree) =
- kzalloc(sizeof(*data), GFP_KERNEL);
+ kzalloc_obj(*data, GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
@@ -318,7 +318,7 @@ static int __ctl_elem_write_user(struct snd_ctl_file *file,
struct snd_card *card = file->card;
int err, type, count;
struct snd_ctl_elem_value *data __free(kfree) =
- kzalloc(sizeof(*data), GFP_KERNEL);
+ kzalloc_obj(*data, GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
@@ -380,7 +380,7 @@ static int snd_ctl_elem_add_compat(struct snd_ctl_file *file,
int replace)
{
struct snd_ctl_elem_info *data __free(kfree) =
- kzalloc(sizeof(*data), GFP_KERNEL);
+ kzalloc_obj(*data, GFP_KERNEL);
if (! data)
return -ENOMEM;
diff --git a/sound/core/control_led.c b/sound/core/control_led.c
index c7641d5084e7..07eebf849ae3 100644
--- a/sound/core/control_led.c
+++ b/sound/core/control_led.c
@@ -653,7 +653,7 @@ static void snd_ctl_led_sysfs_add(struct snd_card *card)
for (group = 0; group < MAX_LED; group++) {
led = &snd_ctl_leds[group];
- led_card = kzalloc(sizeof(*led_card), GFP_KERNEL);
+ led_card = kzalloc_obj(*led_card, GFP_KERNEL);
if (!led_card)
goto cerr2;
led_card->number = card->number;
diff --git a/sound/core/device.c b/sound/core/device.c
index cdc5af526739..80c02914877f 100644
--- a/sound/core/device.c
+++ b/sound/core/device.c
@@ -34,7 +34,7 @@ int snd_device_new(struct snd_card *card, enum snd_device_type type,
if (snd_BUG_ON(!card || !device_data || !ops))
return -ENXIO;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
return -ENOMEM;
INIT_LIST_HEAD(&dev->list);
diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c
index 2d5f4d47071f..a98de8d9ce16 100644
--- a/sound/core/hrtimer.c
+++ b/sound/core/hrtimer.c
@@ -64,7 +64,7 @@ static int snd_hrtimer_open(struct snd_timer *t)
{
struct snd_hrtimer *stime;
- stime = kzalloc(sizeof(*stime), GFP_KERNEL);
+ stime = kzalloc_obj(*stime, GFP_KERNEL);
if (!stime)
return -ENOMEM;
stime->timer = t;
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
index 09200df2932c..a493db2160ed 100644
--- a/sound/core/hwdep.c
+++ b/sound/core/hwdep.c
@@ -375,7 +375,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
return -ENXIO;
if (rhwdep)
*rhwdep = NULL;
- hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
+ hwdep = kzalloc_obj(*hwdep, GFP_KERNEL);
if (!hwdep)
return -ENOMEM;
diff --git a/sound/core/info.c b/sound/core/info.c
index 1f5b8a3d9e3b..de8ec34360ee 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -79,7 +79,7 @@ static int alloc_info_private(struct snd_info_entry *entry,
return -ENODEV;
if (!try_module_get(entry->module))
return -EFAULT;
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = kzalloc_obj(*data, GFP_KERNEL);
if (!data) {
module_put(entry->module);
return -ENOMEM;
@@ -311,7 +311,7 @@ static ssize_t snd_info_text_entry_write(struct file *file,
guard(mutex)(&entry->access);
buf = data->wbuffer;
if (!buf) {
- data->wbuffer = buf = kzalloc(sizeof(*buf), GFP_KERNEL);
+ data->wbuffer = buf = kzalloc_obj(*buf, GFP_KERNEL);
if (!buf)
return -ENOMEM;
}
@@ -355,7 +355,7 @@ static int snd_info_text_entry_open(struct inode *inode, struct file *file)
if (err < 0)
return err;
- data->rbuffer = kzalloc(sizeof(*data->rbuffer), GFP_KERNEL);
+ data->rbuffer = kzalloc_obj(*data->rbuffer, GFP_KERNEL);
if (!data->rbuffer) {
err = -ENOMEM;
goto error;
@@ -663,7 +663,7 @@ snd_info_create_entry(const char *name, struct snd_info_entry *parent,
struct module *module)
{
struct snd_info_entry *entry;
- entry = kzalloc(sizeof(*entry), GFP_KERNEL);
+ entry = kzalloc_obj(*entry, GFP_KERNEL);
if (entry == NULL)
return NULL;
entry->name = kstrdup(name, GFP_KERNEL);
diff --git a/sound/core/init.c b/sound/core/init.c
index c372b3228785..84c11bd49a95 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -129,7 +129,7 @@ int snd_device_alloc(struct device **dev_p, struct snd_card *card)
struct device *dev;
*dev_p = NULL;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
return -ENOMEM;
device_initialize(dev);
@@ -1060,7 +1060,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file)
{
struct snd_monitor_file *mfile;
- mfile = kmalloc(sizeof(*mfile), GFP_KERNEL);
+ mfile = kmalloc_obj(*mfile, GFP_KERNEL);
if (mfile == NULL)
return -ENOMEM;
mfile->file = file;
diff --git a/sound/core/jack.c b/sound/core/jack.c
index 93e357a23f17..7160c260d06c 100644
--- a/sound/core/jack.c
+++ b/sound/core/jack.c
@@ -440,7 +440,7 @@ static struct snd_jack_kctl * snd_jack_kctl_new(struct snd_card *card, const cha
if (err < 0)
return NULL;
- jack_kctl = kzalloc(sizeof(*jack_kctl), GFP_KERNEL);
+ jack_kctl = kzalloc_obj(*jack_kctl, GFP_KERNEL);
if (!jack_kctl)
goto error;
@@ -516,7 +516,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
return -ENOMEM;
}
- jack = kzalloc(sizeof(struct snd_jack), GFP_KERNEL);
+ jack = kzalloc_obj(struct snd_jack, GFP_KERNEL);
if (jack == NULL)
return -ENOMEM;
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index b3853583d2ae..bb483a2d7ff2 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -719,12 +719,12 @@ static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size)
unsigned int idx, npages;
void *p;
- sgbuf = kzalloc(sizeof(*sgbuf), GFP_KERNEL);
+ sgbuf = kzalloc_obj(*sgbuf, GFP_KERNEL);
if (!sgbuf)
return NULL;
size = PAGE_ALIGN(size);
sgbuf->count = size >> PAGE_SHIFT;
- sgbuf->pages = kvcalloc(sgbuf->count, sizeof(*sgbuf->pages), GFP_KERNEL);
+ sgbuf->pages = kvzalloc_objs(*sgbuf->pages, sgbuf->count, GFP_KERNEL);
sgbuf->npages = kvcalloc(sgbuf->count, sizeof(*sgbuf->npages), GFP_KERNEL);
if (!sgbuf->pages || !sgbuf->npages)
goto error;
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index f4ad0bfb4dac..05c8e44cd428 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -47,7 +47,7 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file)
snd_card_unref(card);
return err;
}
- fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL);
+ fmixer = kzalloc_obj(*fmixer, GFP_KERNEL);
if (fmixer == NULL) {
snd_card_file_remove(card, file);
snd_card_unref(card);
@@ -530,9 +530,9 @@ static void snd_mixer_oss_get_volume1_vol(struct snd_mixer_oss_file *fmixer,
return;
struct snd_ctl_elem_info *uinfo __free(kfree) =
- kzalloc(sizeof(*uinfo), GFP_KERNEL);
+ kzalloc_obj(*uinfo, GFP_KERNEL);
struct snd_ctl_elem_value *uctl __free(kfree) =
- kzalloc(sizeof(*uctl), GFP_KERNEL);
+ kzalloc_obj(*uctl, GFP_KERNEL);
if (uinfo == NULL || uctl == NULL)
return;
if (kctl->info(kctl, uinfo))
@@ -566,9 +566,9 @@ static void snd_mixer_oss_get_volume1_sw(struct snd_mixer_oss_file *fmixer,
return;
struct snd_ctl_elem_info *uinfo __free(kfree) =
- kzalloc(sizeof(*uinfo), GFP_KERNEL);
+ kzalloc_obj(*uinfo, GFP_KERNEL);
struct snd_ctl_elem_value *uctl __free(kfree) =
- kzalloc(sizeof(*uctl), GFP_KERNEL);
+ kzalloc_obj(*uctl, GFP_KERNEL);
if (uinfo == NULL || uctl == NULL)
return;
if (kctl->info(kctl, uinfo))
@@ -629,9 +629,9 @@ static void snd_mixer_oss_put_volume1_vol(struct snd_mixer_oss_file *fmixer,
return;
struct snd_ctl_elem_info *uinfo __free(kfree) =
- kzalloc(sizeof(*uinfo), GFP_KERNEL);
+ kzalloc_obj(*uinfo, GFP_KERNEL);
struct snd_ctl_elem_value *uctl __free(kfree) =
- kzalloc(sizeof(*uctl), GFP_KERNEL);
+ kzalloc_obj(*uctl, GFP_KERNEL);
if (uinfo == NULL || uctl == NULL)
return;
if (kctl->info(kctl, uinfo))
@@ -669,9 +669,9 @@ static void snd_mixer_oss_put_volume1_sw(struct snd_mixer_oss_file *fmixer,
return;
struct snd_ctl_elem_info *uinfo __free(kfree) =
- kzalloc(sizeof(*uinfo), GFP_KERNEL);
+ kzalloc_obj(*uinfo, GFP_KERNEL);
struct snd_ctl_elem_value *uctl __free(kfree) =
- kzalloc(sizeof(*uctl), GFP_KERNEL);
+ kzalloc_obj(*uctl, GFP_KERNEL);
if (uinfo == NULL || uctl == NULL)
return;
if (kctl->info(kctl, uinfo))
@@ -798,9 +798,9 @@ static int snd_mixer_oss_get_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned
int err, idx;
struct snd_ctl_elem_info *uinfo __free(kfree) =
- kzalloc(sizeof(*uinfo), GFP_KERNEL);
+ kzalloc_obj(*uinfo, GFP_KERNEL);
struct snd_ctl_elem_value *uctl __free(kfree) =
- kzalloc(sizeof(*uctl), GFP_KERNEL);
+ kzalloc_obj(*uctl, GFP_KERNEL);
if (uinfo == NULL || uctl == NULL)
return -ENOMEM;
guard(rwsem_read)(&card->controls_rwsem);
@@ -843,9 +843,9 @@ static int snd_mixer_oss_put_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned
unsigned int idx;
struct snd_ctl_elem_info *uinfo __free(kfree) =
- kzalloc(sizeof(*uinfo), GFP_KERNEL);
+ kzalloc_obj(*uinfo, GFP_KERNEL);
struct snd_ctl_elem_value *uctl __free(kfree) =
- kzalloc(sizeof(*uctl), GFP_KERNEL);
+ kzalloc_obj(*uctl, GFP_KERNEL);
if (uinfo == NULL || uctl == NULL)
return -ENOMEM;
guard(rwsem_read)(&card->controls_rwsem);
@@ -1027,7 +1027,7 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer,
kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0);
if (kctl) {
struct snd_ctl_elem_info *uinfo __free(kfree) =
- kzalloc(sizeof(*uinfo), GFP_KERNEL);
+ kzalloc_obj(*uinfo, GFP_KERNEL);
if (!uinfo)
return -ENOMEM;
@@ -1055,7 +1055,7 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer,
}
}
if (slot.present != 0) {
- pslot = kmalloc(sizeof(slot), GFP_KERNEL);
+ pslot = kmalloc_obj(slot, GFP_KERNEL);
if (! pslot)
return -ENOMEM;
*pslot = slot;
@@ -1315,7 +1315,7 @@ static int snd_mixer_oss_notify_handler(struct snd_card *card, int cmd)
if (cmd == SND_MIXER_OSS_NOTIFY_REGISTER) {
int idx, err;
- mixer = kcalloc(2, sizeof(*mixer), GFP_KERNEL);
+ mixer = kzalloc_objs(*mixer, 2, GFP_KERNEL);
if (mixer == NULL)
return -ENOMEM;
mutex_init(&mixer->reg_mutex);
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 3bc94d34b35e..cf3509c2be15 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -398,7 +398,7 @@ static int snd_pcm_hw_param_near(struct snd_pcm_substream *pcm,
}
struct snd_pcm_hw_params *save __free(kfree) =
- kmalloc(sizeof(*save), GFP_KERNEL);
+ kmalloc_obj(*save, GFP_KERNEL);
if (save == NULL)
return -ENOMEM;
*save = *params;
@@ -411,7 +411,7 @@ static int snd_pcm_hw_param_near(struct snd_pcm_substream *pcm,
goto _end;
struct snd_pcm_hw_params *params1 __free(kfree) =
- kmalloc(sizeof(*params1), GFP_KERNEL);
+ kmalloc_obj(*params1, GFP_KERNEL);
if (params1 == NULL)
return -ENOMEM;
*params1 = *save;
@@ -786,7 +786,7 @@ static int choose_rate(struct snd_pcm_substream *substream,
unsigned int rate, prev;
struct snd_pcm_hw_params *save __free(kfree) =
- kmalloc(sizeof(*save), GFP_KERNEL);
+ kmalloc_obj(*save, GFP_KERNEL);
if (save == NULL)
return -ENOMEM;
*save = *params;
@@ -861,9 +861,9 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
if (!runtime->oss.params)
return 0;
- sw_params = kzalloc(sizeof(*sw_params), GFP_KERNEL);
- params = kmalloc(sizeof(*params), GFP_KERNEL);
- sparams = kmalloc(sizeof(*sparams), GFP_KERNEL);
+ sw_params = kzalloc_obj(*sw_params, GFP_KERNEL);
+ params = kmalloc_obj(*params, GFP_KERNEL);
+ sparams = kmalloc_obj(*sparams, GFP_KERNEL);
if (!sw_params || !params || !sparams) {
err = -ENOMEM;
goto failure;
@@ -1859,7 +1859,7 @@ static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file)
AFMT_S24_PACKED;
struct snd_pcm_hw_params *params __free(kfree) =
- kmalloc(sizeof(*params), GFP_KERNEL);
+ kmalloc_obj(*params, GFP_KERNEL);
if (!params)
return -ENOMEM;
_snd_pcm_hw_params_any(params);
@@ -2418,7 +2418,7 @@ static int snd_pcm_oss_open_file(struct file *file,
if (rpcm_oss_file)
*rpcm_oss_file = NULL;
- pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
+ pcm_oss_file = kzalloc_obj(*pcm_oss_file, GFP_KERNEL);
if (pcm_oss_file == NULL)
return -ENOMEM;
@@ -3032,7 +3032,7 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry,
}
} while (*str);
if (setup == NULL) {
- setup = kmalloc(sizeof(*setup), GFP_KERNEL);
+ setup = kmalloc_obj(*setup, GFP_KERNEL);
if (! setup) {
buffer->error = -ENOMEM;
return;
diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c
index a4c8c9f538f1..e5a0e3c79f7e 100644
--- a/sound/core/oss/pcm_plugin.c
+++ b/sound/core/oss/pcm_plugin.c
@@ -163,7 +163,8 @@ int snd_pcm_plugin_build(struct snd_pcm_substream *plug,
channels = src_format->channels;
else
channels = dst_format->channels;
- plugin->buf_channels = kcalloc(channels, sizeof(*plugin->buf_channels), GFP_KERNEL);
+ plugin->buf_channels = kzalloc_objs(*plugin->buf_channels, channels,
+ GFP_KERNEL);
if (plugin->buf_channels == NULL) {
snd_pcm_plugin_free(plugin);
return -ENOMEM;
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 0b512085eb63..e3c43b365207 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -334,7 +334,7 @@ static void snd_pcm_proc_info_read(struct snd_pcm_substream *substream,
return;
struct snd_pcm_info *info __free(kfree) =
- kmalloc(sizeof(*info), GFP_KERNEL);
+ kmalloc_obj(*info, GFP_KERNEL);
if (!info)
return;
@@ -657,7 +657,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
}
prev = NULL;
for (idx = 0, prev = NULL; idx < substream_count; idx++) {
- substream = kzalloc(sizeof(*substream), GFP_KERNEL);
+ substream = kzalloc_obj(*substream, GFP_KERNEL);
if (!substream)
return -ENOMEM;
substream->pcm = pcm;
@@ -713,7 +713,7 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
return -ENXIO;
if (rpcm)
*rpcm = NULL;
- pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
+ pcm = kzalloc_obj(*pcm, GFP_KERNEL);
if (!pcm)
return -ENOMEM;
pcm->card = card;
@@ -935,7 +935,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
if (substream == NULL)
return -EAGAIN;
- runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
+ runtime = kzalloc_obj(*runtime, GFP_KERNEL);
if (runtime == NULL)
return -ENOMEM;
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index e86f68f1f23c..71c74830083e 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -243,7 +243,7 @@ static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream,
return -ENOTTY;
struct snd_pcm_hw_params *data __free(kfree) =
- kmalloc(sizeof(*data), GFP_KERNEL);
+ kmalloc_obj(*data, GFP_KERNEL);
if (!data)
return -ENOMEM;
diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c
index f0c17503df42..cc6ce33f4ff7 100644
--- a/sound/core/pcm_dmaengine.c
+++ b/sound/core/pcm_dmaengine.c
@@ -318,7 +318,7 @@ int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
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/core/pcm_lib.c b/sound/core/pcm_lib.c
index 6eaa950504cf..70f279865adc 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -2601,7 +2601,7 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream,
if (WARN_ON(pcm->streams[stream].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/core/pcm_memory.c b/sound/core/pcm_memory.c
index 56725d36825b..2ef02871f84f 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -448,7 +448,7 @@ int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size)
/* dma_max=0 means the fixed size preallocation */
if (substream->dma_buffer.area && !substream->dma_max)
return -ENOMEM;
- dmab = kzalloc(sizeof(*dmab), GFP_KERNEL);
+ dmab = kzalloc_obj(*dmab, GFP_KERNEL);
if (! dmab)
return -ENOMEM;
dmab->dev = substream->dma_buffer.dev;
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 0a358d94b17c..a7e24be8c7db 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -244,7 +244,7 @@ int snd_pcm_info_user(struct snd_pcm_substream *substream,
{
int err;
struct snd_pcm_info *info __free(kfree) =
- kmalloc(sizeof(*info), GFP_KERNEL);
+ kmalloc_obj(*info, GFP_KERNEL);
if (! info)
return -ENOMEM;
@@ -2812,7 +2812,7 @@ static int snd_pcm_open_file(struct file *file,
if (err < 0)
return err;
- pcm_file = kzalloc(sizeof(*pcm_file), GFP_KERNEL);
+ pcm_file = kzalloc_obj(*pcm_file, GFP_KERNEL);
if (pcm_file == NULL) {
snd_pcm_release_substream(substream);
return -ENOMEM;
@@ -4111,7 +4111,7 @@ static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream,
int err;
struct snd_pcm_hw_params *params __free(kfree) =
- kmalloc(sizeof(*params), GFP_KERNEL);
+ kmalloc_obj(*params, GFP_KERNEL);
if (!params)
return -ENOMEM;
@@ -4140,7 +4140,7 @@ static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream,
int err;
struct snd_pcm_hw_params *params __free(kfree) =
- kmalloc(sizeof(*params), GFP_KERNEL);
+ kmalloc_obj(*params, GFP_KERNEL);
if (!params)
return -ENOMEM;
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 8969ee2757f1..ae93d968e083 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -159,7 +159,7 @@ static int snd_rawmidi_runtime_create(struct snd_rawmidi_substream *substream)
{
struct snd_rawmidi_runtime *runtime;
- runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
+ runtime = kzalloc_obj(*runtime, GFP_KERNEL);
if (!runtime)
return -ENOMEM;
runtime->substream = substream;
@@ -472,7 +472,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
fflags = snd_rawmidi_file_flags(file);
if ((file->f_flags & O_APPEND) || maj == SOUND_MAJOR) /* OSS emul? */
fflags |= SNDRV_RAWMIDI_LFLG_APPEND;
- rawmidi_file = kmalloc(sizeof(*rawmidi_file), GFP_KERNEL);
+ rawmidi_file = kmalloc_obj(*rawmidi_file, GFP_KERNEL);
if (rawmidi_file == NULL) {
err = -ENOMEM;
goto __error;
@@ -1803,7 +1803,7 @@ static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi,
int idx;
for (idx = 0; idx < count; idx++) {
- substream = kzalloc(sizeof(*substream), GFP_KERNEL);
+ substream = kzalloc_obj(*substream, GFP_KERNEL);
if (!substream)
return -ENOMEM;
substream->stream = direction;
@@ -1891,7 +1891,7 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device,
if (rrawmidi)
*rrawmidi = NULL;
- rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
+ rmidi = kzalloc_obj(*rmidi, GFP_KERNEL);
if (!rmidi)
return -ENOMEM;
err = snd_rawmidi_init(rmidi, card, id, device,
diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
index e0c368bd09cb..af8e14325239 100644
--- a/sound/core/seq/oss/seq_oss_init.c
+++ b/sound/core/seq/oss/seq_oss_init.c
@@ -65,7 +65,7 @@ snd_seq_oss_create_client(void)
int rc;
struct snd_seq_port_callback port_callback;
struct snd_seq_port_info *port __free(kfree) =
- kzalloc(sizeof(*port), GFP_KERNEL);
+ kzalloc_obj(*port, GFP_KERNEL);
if (!port)
return -ENOMEM;
@@ -168,7 +168,7 @@ snd_seq_oss_open(struct file *file, int level)
int i, rc;
struct seq_oss_devinfo *dp;
- dp = kzalloc(sizeof(*dp), GFP_KERNEL);
+ dp = kzalloc_obj(*dp, GFP_KERNEL);
if (!dp)
return -ENOMEM;
diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c
index 2d48c25ff4df..989e9a7069e3 100644
--- a/sound/core/seq/oss/seq_oss_midi.c
+++ b/sound/core/seq/oss/seq_oss_midi.c
@@ -66,9 +66,9 @@ int
snd_seq_oss_midi_lookup_ports(int client)
{
struct snd_seq_client_info *clinfo __free(kfree) =
- kzalloc(sizeof(*clinfo), GFP_KERNEL);
+ kzalloc_obj(*clinfo, GFP_KERNEL);
struct snd_seq_port_info *pinfo __free(kfree) =
- kzalloc(sizeof(*pinfo), GFP_KERNEL);
+ kzalloc_obj(*pinfo, GFP_KERNEL);
if (!clinfo || !pinfo)
return -ENOMEM;
@@ -153,7 +153,7 @@ snd_seq_oss_midi_check_new_port(struct snd_seq_port_info *pinfo)
/*
* allocate midi info record
*/
- mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
+ mdev = kzalloc_obj(*mdev, GFP_KERNEL);
if (!mdev)
return -ENOMEM;
diff --git a/sound/core/seq/oss/seq_oss_readq.c b/sound/core/seq/oss/seq_oss_readq.c
index bbaf72e70b35..014efc191c71 100644
--- a/sound/core/seq/oss/seq_oss_readq.c
+++ b/sound/core/seq/oss/seq_oss_readq.c
@@ -34,11 +34,11 @@ snd_seq_oss_readq_new(struct seq_oss_devinfo *dp, int maxlen)
{
struct seq_oss_readq *q;
- q = kzalloc(sizeof(*q), GFP_KERNEL);
+ q = kzalloc_obj(*q, GFP_KERNEL);
if (!q)
return NULL;
- q->q = kcalloc(maxlen, sizeof(union evrec), GFP_KERNEL);
+ q->q = kzalloc_objs(union evrec, maxlen, GFP_KERNEL);
if (!q->q) {
kfree(q);
return NULL;
diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c
index c7f81f2053a7..b19b8756638d 100644
--- a/sound/core/seq/oss/seq_oss_synth.c
+++ b/sound/core/seq/oss/seq_oss_synth.c
@@ -213,7 +213,8 @@ snd_seq_oss_synth_setup(struct seq_oss_devinfo *dp)
}
info->nr_voices = rec->nr_voices;
if (info->nr_voices > 0) {
- info->ch = kcalloc(info->nr_voices, sizeof(struct seq_oss_chinfo), GFP_KERNEL);
+ info->ch = kzalloc_objs(struct seq_oss_chinfo,
+ info->nr_voices, GFP_KERNEL);
if (!info->ch) {
rec->oper.close(&info->arg);
module_put(rec->oper.owner);
diff --git a/sound/core/seq/oss/seq_oss_timer.c b/sound/core/seq/oss/seq_oss_timer.c
index f9f57232a83f..32f1ff225cf5 100644
--- a/sound/core/seq/oss/seq_oss_timer.c
+++ b/sound/core/seq/oss/seq_oss_timer.c
@@ -34,7 +34,7 @@ snd_seq_oss_timer_new(struct seq_oss_devinfo *dp)
{
struct seq_oss_timer *rec;
- rec = kzalloc(sizeof(*rec), GFP_KERNEL);
+ rec = kzalloc_obj(*rec, GFP_KERNEL);
if (rec == NULL)
return NULL;
diff --git a/sound/core/seq/oss/seq_oss_writeq.c b/sound/core/seq/oss/seq_oss_writeq.c
index a93ff8315b8e..dfc20d9bcc30 100644
--- a/sound/core/seq/oss/seq_oss_writeq.c
+++ b/sound/core/seq/oss/seq_oss_writeq.c
@@ -27,7 +27,7 @@ snd_seq_oss_writeq_new(struct seq_oss_devinfo *dp, int maxlen)
struct seq_oss_writeq *q;
struct snd_seq_client_pool pool;
- q = kzalloc(sizeof(*q), GFP_KERNEL);
+ q = kzalloc_obj(*q, GFP_KERNEL);
if (!q)
return NULL;
q->dp = dp;
diff --git a/sound/core/seq/seq_compat.c b/sound/core/seq/seq_compat.c
index 260428747e33..a771684eac34 100644
--- a/sound/core/seq/seq_compat.c
+++ b/sound/core/seq/seq_compat.c
@@ -33,7 +33,7 @@ static int snd_seq_call_port_info_ioctl(struct snd_seq_client *client, unsigned
{
int err;
struct snd_seq_port_info *data __free(kfree) =
- kmalloc(sizeof(*data), GFP_KERNEL);
+ kmalloc_obj(*data, GFP_KERNEL);
if (!data)
return -ENOMEM;
diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c
index 783fc72c2ef6..d8b77385aa3f 100644
--- a/sound/core/seq/seq_dummy.c
+++ b/sound/core/seq/seq_dummy.c
@@ -115,7 +115,7 @@ create_port(int idx, int type)
struct snd_seq_port_callback pcb;
struct snd_seq_dummy_port *rec;
- rec = kzalloc(sizeof(*rec), GFP_KERNEL);
+ rec = kzalloc_obj(*rec, GFP_KERNEL);
if (!rec)
return NULL;
diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c
index 91cce1890111..ad15d001cef7 100644
--- a/sound/core/seq/seq_fifo.c
+++ b/sound/core/seq/seq_fifo.c
@@ -19,7 +19,7 @@ struct snd_seq_fifo *snd_seq_fifo_new(int poolsize)
{
struct snd_seq_fifo *f;
- f = kzalloc(sizeof(*f), GFP_KERNEL);
+ f = kzalloc_obj(*f, GFP_KERNEL);
if (!f)
return NULL;
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
index ccde0ca3d208..8a14d6e59c82 100644
--- a/sound/core/seq/seq_memory.c
+++ b/sound/core/seq/seq_memory.c
@@ -441,9 +441,8 @@ int snd_seq_pool_init(struct snd_seq_pool *pool)
if (snd_BUG_ON(!pool))
return -EINVAL;
- cellptr = kvmalloc_array(pool->size,
- sizeof(struct snd_seq_event_cell),
- GFP_KERNEL);
+ cellptr = kvmalloc_objs(struct snd_seq_event_cell, pool->size,
+ GFP_KERNEL);
if (!cellptr)
return -ENOMEM;
@@ -518,7 +517,7 @@ struct snd_seq_pool *snd_seq_pool_new(int poolsize)
struct snd_seq_pool *pool;
/* create pool block */
- pool = kzalloc(sizeof(*pool), GFP_KERNEL);
+ pool = kzalloc_obj(*pool, GFP_KERNEL);
if (!pool)
return NULL;
spin_lock_init(&pool->lock);
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c
index 88e930980f16..72e798ddbe4e 100644
--- a/sound/core/seq/seq_midi.c
+++ b/sound/core/seq/seq_midi.c
@@ -281,7 +281,7 @@ snd_seq_midisynth_probe(struct snd_seq_device *dev)
return -EINVAL;
struct snd_rawmidi_info *info __free(kfree) =
- kmalloc(sizeof(*info), GFP_KERNEL);
+ kmalloc_obj(*info, GFP_KERNEL);
if (! info)
return -ENOMEM;
info->device = device;
@@ -305,7 +305,7 @@ snd_seq_midisynth_probe(struct snd_seq_device *dev)
client = synths[card->number];
if (client == NULL) {
newclient = 1;
- client = kzalloc(sizeof(*client), GFP_KERNEL);
+ client = kzalloc_obj(*client, GFP_KERNEL);
if (client == NULL)
return -ENOMEM;
client->seq_client =
@@ -318,10 +318,10 @@ snd_seq_midisynth_probe(struct snd_seq_device *dev)
}
}
- msynth = kcalloc(ports, sizeof(struct seq_midisynth), GFP_KERNEL);
+ msynth = kzalloc_objs(struct seq_midisynth, ports, GFP_KERNEL);
struct snd_seq_port_info *port __free(kfree) =
- kmalloc(sizeof(*port), GFP_KERNEL);
+ kmalloc_obj(*port, GFP_KERNEL);
if (msynth == NULL || port == NULL)
goto __nomem;
diff --git a/sound/core/seq/seq_midi_emul.c b/sound/core/seq/seq_midi_emul.c
index 81d2ef5e5811..0e9461d0f9f8 100644
--- a/sound/core/seq/seq_midi_emul.c
+++ b/sound/core/seq/seq_midi_emul.c
@@ -650,7 +650,7 @@ static struct snd_midi_channel *snd_midi_channel_init_set(int n)
struct snd_midi_channel *chan;
int i;
- chan = kmalloc_array(n, sizeof(struct snd_midi_channel), GFP_KERNEL);
+ chan = kmalloc_objs(struct snd_midi_channel, n, GFP_KERNEL);
if (chan) {
for (i = 0; i < n; i++)
snd_midi_channel_init(chan+i, i);
@@ -688,7 +688,7 @@ struct snd_midi_channel_set *snd_midi_channel_alloc_set(int n)
{
struct snd_midi_channel_set *chset;
- chset = kmalloc(sizeof(*chset), GFP_KERNEL);
+ chset = kmalloc_obj(*chset, GFP_KERNEL);
if (chset) {
chset->channels = snd_midi_channel_init_set(n);
chset->private_data = NULL;
diff --git a/sound/core/seq/seq_midi_event.c b/sound/core/seq/seq_midi_event.c
index fa9dfc53c3fc..c2a9b0540c09 100644
--- a/sound/core/seq/seq_midi_event.c
+++ b/sound/core/seq/seq_midi_event.c
@@ -104,7 +104,7 @@ int snd_midi_event_new(int bufsize, struct snd_midi_event **rdev)
struct snd_midi_event *dev;
*rdev = NULL;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (dev == NULL)
return -ENOMEM;
if (bufsize > 0) {
diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c
index bbec34bba4f9..1b395caaae49 100644
--- a/sound/core/seq/seq_ports.c
+++ b/sound/core/seq/seq_ports.c
@@ -129,7 +129,7 @@ int snd_seq_create_port(struct snd_seq_client *client, int port,
}
/* create a new port */
- new_port = kzalloc(sizeof(*new_port), GFP_KERNEL);
+ new_port = kzalloc_obj(*new_port, GFP_KERNEL);
if (!new_port)
return -ENOMEM; /* failure, out of memory */
/* init port data */
@@ -572,7 +572,7 @@ int snd_seq_port_connect(struct snd_seq_client *connector,
bool exclusive;
int err;
- subs = kzalloc(sizeof(*subs), GFP_KERNEL);
+ subs = kzalloc_obj(*subs, GFP_KERNEL);
if (!subs)
return -ENOMEM;
diff --git a/sound/core/seq/seq_prioq.c b/sound/core/seq/seq_prioq.c
index e649485a8772..805c4ebbfdac 100644
--- a/sound/core/seq/seq_prioq.c
+++ b/sound/core/seq/seq_prioq.c
@@ -43,7 +43,7 @@ struct snd_seq_prioq *snd_seq_prioq_new(void)
{
struct snd_seq_prioq *f;
- f = kzalloc(sizeof(*f), GFP_KERNEL);
+ f = kzalloc_obj(*f, GFP_KERNEL);
if (!f)
return NULL;
diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
index c0c5e1424c5a..8c7b24a9421a 100644
--- a/sound/core/seq/seq_queue.c
+++ b/sound/core/seq/seq_queue.c
@@ -89,7 +89,7 @@ static struct snd_seq_queue *queue_new(int owner, int locked)
{
struct snd_seq_queue *q;
- q = kzalloc(sizeof(*q), GFP_KERNEL);
+ q = kzalloc_obj(*q, GFP_KERNEL);
if (!q)
return NULL;
diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c
index 5b5603e5970b..d7d84576c3d6 100644
--- a/sound/core/seq/seq_system.c
+++ b/sound/core/seq/seq_system.c
@@ -130,7 +130,7 @@ int __init snd_seq_system_client_init(void)
struct snd_seq_port_info *port;
int err;
- port = kzalloc(sizeof(*port), GFP_KERNEL);
+ port = kzalloc_obj(*port, GFP_KERNEL);
if (!port)
return -ENOMEM;
diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c
index 29b018a212fc..c5728efa05af 100644
--- a/sound/core/seq/seq_timer.c
+++ b/sound/core/seq/seq_timer.c
@@ -43,7 +43,7 @@ struct snd_seq_timer *snd_seq_timer_new(void)
{
struct snd_seq_timer *tmr;
- tmr = kzalloc(sizeof(*tmr), GFP_KERNEL);
+ tmr = kzalloc_obj(*tmr, GFP_KERNEL);
if (!tmr)
return NULL;
spin_lock_init(&tmr->lock);
diff --git a/sound/core/seq/seq_ump_client.c b/sound/core/seq/seq_ump_client.c
index 7bc18415a540..3ca808c787e2 100644
--- a/sound/core/seq/seq_ump_client.c
+++ b/sound/core/seq/seq_ump_client.c
@@ -220,7 +220,7 @@ static int seq_ump_group_init(struct seq_ump_client *client, int group_index)
return 0;
struct snd_seq_port_info *port __free(kfree) =
- kzalloc(sizeof(*port), GFP_KERNEL);
+ kzalloc_obj(*port, GFP_KERNEL);
if (!port)
return -ENOMEM;
@@ -246,9 +246,9 @@ static void update_port_infos(struct seq_ump_client *client)
int i, err;
struct snd_seq_port_info *old __free(kfree) =
- kzalloc(sizeof(*old), GFP_KERNEL);
+ kzalloc_obj(*old, GFP_KERNEL);
struct snd_seq_port_info *new __free(kfree) =
- kzalloc(sizeof(*new), GFP_KERNEL);
+ kzalloc_obj(*new, GFP_KERNEL);
if (!old || !new)
return;
@@ -283,7 +283,7 @@ static int create_ump_endpoint_port(struct seq_ump_client *client)
int err;
struct snd_seq_port_info *port __free(kfree) =
- kzalloc(sizeof(*port), GFP_KERNEL);
+ kzalloc_obj(*port, GFP_KERNEL);
if (!port)
return -ENOMEM;
@@ -461,7 +461,7 @@ static int snd_seq_ump_probe(struct snd_seq_device *dev)
struct snd_seq_client *cptr;
int p, err;
- client = kzalloc(sizeof(*client), GFP_KERNEL);
+ client = kzalloc_obj(*client, GFP_KERNEL);
if (!client)
return -ENOMEM;
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
index 574493fbd50d..16d61847c7fe 100644
--- a/sound/core/seq/seq_virmidi.c
+++ b/sound/core/seq/seq_virmidi.c
@@ -216,7 +216,7 @@ static int snd_virmidi_output_open(struct snd_rawmidi_substream *substream)
struct snd_rawmidi_runtime *runtime = substream->runtime;
struct snd_virmidi *vmidi;
- vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
+ vmidi = kzalloc_obj(*vmidi, GFP_KERNEL);
if (vmidi == NULL)
return -ENOMEM;
vmidi->substream = substream;
@@ -367,7 +367,7 @@ static int snd_virmidi_dev_attach_seq(struct snd_virmidi_dev *rdev)
return 0;
struct snd_seq_port_info *pinfo __free(kfree) =
- kzalloc(sizeof(*pinfo), GFP_KERNEL);
+ kzalloc_obj(*pinfo, GFP_KERNEL);
if (!pinfo)
return -ENOMEM;
@@ -498,7 +498,7 @@ int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmi
if (err < 0)
return err;
strscpy(rmidi->name, rmidi->id);
- rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
+ rdev = kzalloc_obj(*rdev, GFP_KERNEL);
if (rdev == NULL) {
snd_device_free(card, rmidi);
return -ENOMEM;
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 6531a67f13b3..876fac770749 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -257,7 +257,7 @@ int snd_register_device(int type, struct snd_card *card, int dev,
if (snd_BUG_ON(!device))
return -EINVAL;
- preg = kmalloc(sizeof *preg, GFP_KERNEL);
+ preg = kmalloc_obj(*preg, GFP_KERNEL);
if (preg == NULL)
return -ENOMEM;
preg->type = type;
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
index d65cc6fee2e6..6d4e44656e19 100644
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -96,7 +96,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev,
return 0; /* ignore silently */
if (minor < 0)
return minor;
- preg = kmalloc(sizeof(struct snd_minor), GFP_KERNEL);
+ preg = kmalloc_obj(struct snd_minor, GFP_KERNEL);
if (preg == NULL)
return -ENOMEM;
preg->type = type;
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 9a4a1748ff80..7d10f079b5b3 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -151,7 +151,7 @@ struct snd_timer_instance *snd_timer_instance_new(const char *owner)
{
struct snd_timer_instance *timeri;
- timeri = kzalloc(sizeof(*timeri), GFP_KERNEL);
+ timeri = kzalloc_obj(*timeri, GFP_KERNEL);
if (timeri == NULL)
return NULL;
timeri->owner = kstrdup(owner, GFP_KERNEL);
@@ -930,7 +930,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
}
if (rtimer)
*rtimer = NULL;
- timer = kzalloc(sizeof(*timer), GFP_KERNEL);
+ timer = kzalloc_obj(*timer, GFP_KERNEL);
if (!timer)
return -ENOMEM;
timer->tmr_class = tid->dev_class;
@@ -1197,7 +1197,7 @@ static int snd_timer_register_system(void)
return err;
strscpy(timer->name, "system timer");
timer->hw = snd_timer_system;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (priv == NULL) {
snd_timer_free(timer);
return -ENOMEM;
@@ -1432,11 +1432,11 @@ static int realloc_user_queue(struct snd_timer_user *tu, int size)
struct snd_timer_tread64 *tqueue = NULL;
if (tu->tread) {
- tqueue = kcalloc(size, sizeof(*tqueue), GFP_KERNEL);
+ tqueue = kzalloc_objs(*tqueue, size, GFP_KERNEL);
if (!tqueue)
return -ENOMEM;
} else {
- queue = kcalloc(size, sizeof(*queue), GFP_KERNEL);
+ queue = kzalloc_objs(*queue, size, GFP_KERNEL);
if (!queue)
return -ENOMEM;
}
@@ -1461,7 +1461,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file)
if (err < 0)
return err;
- tu = kzalloc(sizeof(*tu), GFP_KERNEL);
+ tu = kzalloc_obj(*tu, GFP_KERNEL);
if (tu == NULL)
return -ENOMEM;
spin_lock_init(&tu->qlock);
@@ -2128,7 +2128,7 @@ static int snd_utimer_create(struct snd_timer_uinfo *utimer_info,
if (!utimer_info || utimer_info->resolution == 0)
return -EINVAL;
- utimer = kzalloc(sizeof(*utimer), GFP_KERNEL);
+ utimer = kzalloc_obj(*utimer, GFP_KERNEL);
if (!utimer)
return -ENOMEM;
diff --git a/sound/core/ump.c b/sound/core/ump.c
index 8d8681a42ca5..543330c67b69 100644
--- a/sound/core/ump.c
+++ b/sound/core/ump.c
@@ -166,7 +166,7 @@ int snd_ump_endpoint_new(struct snd_card *card, char *id, int device,
if (input && output)
info_flags |= SNDRV_RAWMIDI_INFO_DUPLEX;
- ump = kzalloc(sizeof(*ump), GFP_KERNEL);
+ ump = kzalloc_obj(*ump, GFP_KERNEL);
if (!ump)
return -ENOMEM;
INIT_LIST_HEAD(&ump->block_list);
@@ -408,7 +408,7 @@ int snd_ump_block_new(struct snd_ump_endpoint *ump, unsigned int blk,
if (snd_ump_get_block(ump, blk))
return -EBUSY;
- fb = kzalloc(sizeof(*fb), GFP_KERNEL);
+ fb = kzalloc_obj(*fb, GFP_KERNEL);
if (!fb)
return -ENOMEM;
@@ -1352,8 +1352,8 @@ int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
bool input, output;
int err, num;
- ump->out_cvts = kcalloc(SNDRV_UMP_MAX_GROUPS,
- sizeof(*ump->out_cvts), GFP_KERNEL);
+ ump->out_cvts = kzalloc_objs(*ump->out_cvts, SNDRV_UMP_MAX_GROUPS,
+ GFP_KERNEL);
if (!ump->out_cvts)
return -ENOMEM;
diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c
index 76cc64245f5d..e4185c3a2629 100644
--- a/sound/core/vmaster.c
+++ b/sound/core/vmaster.c
@@ -58,7 +58,7 @@ static int follower_update(struct link_follower *follower)
{
int err, ch;
struct snd_ctl_elem_value *uctl __free(kfree) =
- kzalloc(sizeof(*uctl), GFP_KERNEL);
+ kzalloc_obj(*uctl, GFP_KERNEL);
if (!uctl)
return -ENOMEM;
@@ -84,7 +84,7 @@ static int follower_init(struct link_follower *follower)
}
struct snd_ctl_elem_info *uinfo __free(kfree) =
- kmalloc(sizeof(*uinfo), GFP_KERNEL);
+ kmalloc_obj(*uinfo, GFP_KERNEL);
if (!uinfo)
return -ENOMEM;
uinfo->id = follower->follower.id;
@@ -256,8 +256,7 @@ int _snd_ctl_add_follower(struct snd_kcontrol *master,
struct link_master *master_link = snd_kcontrol_chip(master);
struct link_follower *srec;
- srec = kzalloc(struct_size(srec, follower.vd, follower->count),
- GFP_KERNEL);
+ srec = kzalloc_flex(*srec, follower.vd, follower->count, GFP_KERNEL);
if (!srec)
return -ENOMEM;
srec->kctl = follower;
@@ -342,7 +341,7 @@ static int sync_followers(struct link_master *master, int old_val, int new_val)
{
struct link_follower *follower;
struct snd_ctl_elem_value *uval __free(kfree) =
- kmalloc(sizeof(*uval), GFP_KERNEL);
+ kmalloc_obj(*uval, GFP_KERNEL);
if (!uval)
return -ENOMEM;
@@ -430,7 +429,7 @@ struct snd_kcontrol *snd_ctl_make_virtual_master(char *name,
knew.name = name;
knew.info = master_info;
- master = kzalloc(sizeof(*master), GFP_KERNEL);
+ master = kzalloc_obj(*master, GFP_KERNEL);
if (!master)
return NULL;
INIT_LIST_HEAD(&master->followers);
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index 1860ff75fe15..33323c1f8dfe 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -329,7 +329,7 @@ static int dummy_systimer_create(struct snd_pcm_substream *substream)
{
struct dummy_systimer_pcm *dpcm;
- dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
+ dpcm = kzalloc_obj(*dpcm, GFP_KERNEL);
if (!dpcm)
return -ENOMEM;
substream->runtime->private_data = dpcm;
@@ -450,7 +450,7 @@ static int dummy_hrtimer_create(struct snd_pcm_substream *substream)
{
struct dummy_hrtimer_pcm *dpcm;
- dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
+ dpcm = kzalloc_obj(*dpcm, GFP_KERNEL);
if (!dpcm)
return -ENOMEM;
substream->runtime->private_data = dpcm;
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c
index 4af89822bf32..1b573969918f 100644
--- a/sound/drivers/mpu401/mpu401_uart.c
+++ b/sound/drivers/mpu401/mpu401_uart.c
@@ -518,7 +518,7 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
out_enable, in_enable, &rmidi);
if (err < 0)
return err;
- mpu = kzalloc(sizeof(*mpu), GFP_KERNEL);
+ mpu = kzalloc_obj(*mpu, GFP_KERNEL);
if (!mpu) {
err = -ENOMEM;
goto free_device;
diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c
index fe50b48c10e7..eeaa05ad9e5b 100644
--- a/sound/drivers/mts64.c
+++ b/sound/drivers/mts64.c
@@ -75,7 +75,7 @@ static int snd_mts64_create(struct snd_card *card,
*rchip = NULL;
- mts = kzalloc(sizeof(struct mts64), GFP_KERNEL);
+ mts = kzalloc_obj(struct mts64, GFP_KERNEL);
if (mts == NULL)
return -ENOMEM;
diff --git a/sound/drivers/opl3/opl3_lib.c b/sound/drivers/opl3/opl3_lib.c
index fa8a2ccbbd51..ce96b0fd1f43 100644
--- a/sound/drivers/opl3/opl3_lib.c
+++ b/sound/drivers/opl3/opl3_lib.c
@@ -324,7 +324,7 @@ int snd_opl3_new(struct snd_card *card,
int err;
*ropl3 = NULL;
- opl3 = kzalloc(sizeof(*opl3), GFP_KERNEL);
+ opl3 = kzalloc_obj(*opl3, GFP_KERNEL);
if (!opl3)
return -ENOMEM;
diff --git a/sound/drivers/opl3/opl3_synth.c b/sound/drivers/opl3/opl3_synth.c
index 10f622b439a0..7cdd4abb0b7c 100644
--- a/sound/drivers/opl3/opl3_synth.c
+++ b/sound/drivers/opl3/opl3_synth.c
@@ -313,7 +313,7 @@ struct fm_patch *snd_opl3_find_patch(struct snd_opl3 *opl3, int prog, int bank,
if (!create_patch)
return NULL;
- patch = kzalloc(sizeof(*patch), GFP_KERNEL);
+ patch = kzalloc_obj(*patch, GFP_KERNEL);
if (!patch)
return NULL;
patch->prog = prog;
diff --git a/sound/drivers/opl4/opl4_lib.c b/sound/drivers/opl4/opl4_lib.c
index 44fbc6bf0654..d476fb7be15e 100644
--- a/sound/drivers/opl4/opl4_lib.c
+++ b/sound/drivers/opl4/opl4_lib.c
@@ -187,7 +187,7 @@ int snd_opl4_create(struct snd_card *card,
if (ropl4)
*ropl4 = NULL;
- opl4 = kzalloc(sizeof(*opl4), GFP_KERNEL);
+ opl4 = kzalloc_obj(*opl4, GFP_KERNEL);
if (!opl4)
return -ENOMEM;
diff --git a/sound/drivers/pcmtest.c b/sound/drivers/pcmtest.c
index b8474631f0b5..8d3a19b628a2 100644
--- a/sound/drivers/pcmtest.c
+++ b/sound/drivers/pcmtest.c
@@ -377,7 +377,7 @@ static int snd_pcmtst_pcm_open(struct snd_pcm_substream *substream)
if (inject_open_err)
return -EBUSY;
- v_iter = kzalloc(sizeof(*v_iter), GFP_KERNEL);
+ v_iter = kzalloc_obj(*v_iter, GFP_KERNEL);
if (!v_iter)
return -ENOMEM;
@@ -575,7 +575,7 @@ static int snd_pcmtst_create(struct snd_card *card, struct platform_device *pdev
.dev_free = snd_pcmtst_dev_free,
};
- pcmtst = kzalloc(sizeof(*pcmtst), GFP_KERNEL);
+ pcmtst = kzalloc_obj(*pcmtst, GFP_KERNEL);
if (!pcmtst)
return -ENOMEM;
pcmtst->card = card;
diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c
index b903a138fc2a..3dac519c4c45 100644
--- a/sound/drivers/portman2x4.c
+++ b/sound/drivers/portman2x4.c
@@ -88,7 +88,7 @@ static int portman_create(struct snd_card *card,
*rchip = NULL;
- pm = kzalloc(sizeof(struct portman), GFP_KERNEL);
+ pm = kzalloc_obj(struct portman, GFP_KERNEL);
if (pm == NULL)
return -ENOMEM;
diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c
index 7fd8f413d6cf..0e7a4cdc1390 100644
--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -414,7 +414,7 @@ static int vx_alloc_pipe(struct vx_core *chip, int capture,
return err;
/* initialize the pipe record */
- pipe = kzalloc(sizeof(*pipe), GFP_KERNEL);
+ pipe = kzalloc_obj(*pipe, GFP_KERNEL);
if (! pipe) {
/* release the pipe */
vx_init_rmh(&rmh, CMD_FREE_PIPE);
@@ -1154,10 +1154,12 @@ static int vx_init_audio_io(struct vx_core *chip)
chip->audio_info = rmh.Stat[1];
/* allocate pipes */
- chip->playback_pipes = kcalloc(chip->audio_outs, sizeof(struct vx_pipe *), GFP_KERNEL);
+ chip->playback_pipes = kzalloc_objs(struct vx_pipe *, chip->audio_outs,
+ GFP_KERNEL);
if (!chip->playback_pipes)
return -ENOMEM;
- chip->capture_pipes = kcalloc(chip->audio_ins, sizeof(struct vx_pipe *), GFP_KERNEL);
+ chip->capture_pipes = kzalloc_objs(struct vx_pipe *, chip->audio_ins,
+ GFP_KERNEL);
if (!chip->capture_pipes) {
kfree(chip->playback_pipes);
return -ENOMEM;
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index 223c880af802..3f9471694b04 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -1735,8 +1735,9 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
s->ctx_data.tx.cache.size = max_t(unsigned int, s->syt_interval * 2,
queue_size * 3 / 2);
s->ctx_data.tx.cache.pos = 0;
- s->ctx_data.tx.cache.descs = kcalloc(s->ctx_data.tx.cache.size,
- sizeof(*s->ctx_data.tx.cache.descs), GFP_KERNEL);
+ s->ctx_data.tx.cache.descs = kzalloc_objs(*s->ctx_data.tx.cache.descs,
+ s->ctx_data.tx.cache.size,
+ GFP_KERNEL);
if (!s->ctx_data.tx.cache.descs) {
err = -ENOMEM;
goto err_context;
@@ -1756,7 +1757,8 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
[CIP_SFC_176400] = { 0, 67 },
};
- s->ctx_data.rx.seq.descs = kcalloc(queue_size, sizeof(*s->ctx_data.rx.seq.descs), GFP_KERNEL);
+ s->ctx_data.rx.seq.descs = kzalloc_objs(*s->ctx_data.rx.seq.descs,
+ queue_size, GFP_KERNEL);
if (!s->ctx_data.rx.seq.descs) {
err = -ENOMEM;
goto err_context;
@@ -1781,7 +1783,7 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
// for runtime of PCM substream in the interval equivalent to the size of PCM buffer. It
// could take a round over queue of AMDTP packet descriptors and small loss of history. For
// safe, keep more 8 elements for the queue, equivalent to 1 ms.
- descs = kcalloc(s->queue_size + 8, sizeof(*descs), GFP_KERNEL);
+ descs = kzalloc_objs(*descs, s->queue_size + 8, GFP_KERNEL);
if (!descs) {
err = -ENOMEM;
goto err_context;
diff --git a/sound/firewire/bebob/bebob_proc.c b/sound/firewire/bebob/bebob_proc.c
index f659b888a6d1..c5e060728fdc 100644
--- a/sound/firewire/bebob/bebob_proc.c
+++ b/sound/firewire/bebob/bebob_proc.c
@@ -38,7 +38,7 @@ proc_read_hw_info(struct snd_info_entry *entry,
struct snd_bebob *bebob = entry->private_data;
struct hw_info *info;
- info = kzalloc(sizeof(struct hw_info), GFP_KERNEL);
+ info = kzalloc_obj(struct hw_info, GFP_KERNEL);
if (info == NULL)
return;
diff --git a/sound/firewire/fireworks/fireworks.c b/sound/firewire/fireworks/fireworks.c
index 3378c7dce88a..8b6b0e5ba497 100644
--- a/sound/firewire/fireworks/fireworks.c
+++ b/sound/firewire/fireworks/fireworks.c
@@ -76,7 +76,7 @@ get_hardware_info(struct snd_efw *efw)
char version[12] = {0};
int err;
- hwinfo = kzalloc(sizeof(struct snd_efw_hwinfo), GFP_KERNEL);
+ hwinfo = kzalloc_obj(struct snd_efw_hwinfo, GFP_KERNEL);
if (hwinfo == NULL)
return -ENOMEM;
diff --git a/sound/firewire/fireworks/fireworks_proc.c b/sound/firewire/fireworks/fireworks_proc.c
index 12288567b0cd..179b7110c8e2 100644
--- a/sound/firewire/fireworks/fireworks_proc.c
+++ b/sound/firewire/fireworks/fireworks_proc.c
@@ -31,7 +31,7 @@ proc_read_hwinfo(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
unsigned short i;
struct snd_efw_hwinfo *hwinfo;
- hwinfo = kmalloc(sizeof(struct snd_efw_hwinfo), GFP_KERNEL);
+ hwinfo = kmalloc_obj(struct snd_efw_hwinfo, GFP_KERNEL);
if (hwinfo == NULL)
return;
diff --git a/sound/firewire/motu/motu-hwdep.c b/sound/firewire/motu/motu-hwdep.c
index 89dc436a0652..ea7f5d215060 100644
--- a/sound/firewire/motu/motu-hwdep.c
+++ b/sound/firewire/motu/motu-hwdep.c
@@ -185,7 +185,7 @@ static int hwdep_ioctl(struct snd_hwdep *hwdep, struct file *file,
if (!(motu->spec->flags & SND_MOTU_SPEC_REGISTER_DSP))
return -ENXIO;
- meter = kzalloc(sizeof(*meter), GFP_KERNEL);
+ meter = kzalloc_obj(*meter, GFP_KERNEL);
if (!meter)
return -ENOMEM;
@@ -207,7 +207,7 @@ static int hwdep_ioctl(struct snd_hwdep *hwdep, struct file *file,
if (!(motu->spec->flags & SND_MOTU_SPEC_COMMAND_DSP))
return -ENXIO;
- meter = kzalloc(sizeof(*meter), GFP_KERNEL);
+ meter = kzalloc_obj(*meter, GFP_KERNEL);
if (!meter)
return -ENOMEM;
@@ -229,7 +229,7 @@ static int hwdep_ioctl(struct snd_hwdep *hwdep, struct file *file,
if (!(motu->spec->flags & SND_MOTU_SPEC_REGISTER_DSP))
return -ENXIO;
- param = kzalloc(sizeof(*param), GFP_KERNEL);
+ param = kzalloc_obj(*param, GFP_KERNEL);
if (!param)
return -ENOMEM;
diff --git a/sound/firewire/packets-buffer.c b/sound/firewire/packets-buffer.c
index 0ecafd0c6722..3d5c3baf7e48 100644
--- a/sound/firewire/packets-buffer.c
+++ b/sound/firewire/packets-buffer.c
@@ -27,7 +27,7 @@ int iso_packets_buffer_init(struct iso_packets_buffer *b, struct fw_unit *unit,
void *p;
int err;
- b->packets = kmalloc_array(count, sizeof(*b->packets), GFP_KERNEL);
+ b->packets = kmalloc_objs(*b->packets, count, GFP_KERNEL);
if (!b->packets) {
err = -ENOMEM;
goto error;
diff --git a/sound/hda/codecs/analog.c b/sound/hda/codecs/analog.c
index 357ad5a6c0db..122d14e57313 100644
--- a/sound/hda/codecs/analog.c
+++ b/sound/hda/codecs/analog.c
@@ -191,7 +191,7 @@ static int alloc_ad_spec(struct hda_codec *codec)
{
struct ad198x_spec *spec;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
codec->spec = spec;
diff --git a/sound/hda/codecs/ca0110.c b/sound/hda/codecs/ca0110.c
index c75a9ff9460d..8638cef4ef20 100644
--- a/sound/hda/codecs/ca0110.c
+++ b/sound/hda/codecs/ca0110.c
@@ -35,7 +35,7 @@ static int ca0110_probe(struct hda_codec *codec, const struct hda_device_id *id)
struct hda_gen_spec *spec;
int err;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
snd_hda_gen_spec_init(spec);
diff --git a/sound/hda/codecs/ca0132.c b/sound/hda/codecs/ca0132.c
index dd054aedd501..af9236c56db4 100644
--- a/sound/hda/codecs/ca0132.c
+++ b/sound/hda/codecs/ca0132.c
@@ -3392,11 +3392,11 @@ static int dspxfr_image(struct hda_codec *codec,
if (fls_data == NULL)
return -EINVAL;
- dma_engine = kzalloc(sizeof(*dma_engine), GFP_KERNEL);
+ dma_engine = kzalloc_obj(*dma_engine, GFP_KERNEL);
if (!dma_engine)
return -ENOMEM;
- dma_engine->dmab = kzalloc(sizeof(*dma_engine->dmab), GFP_KERNEL);
+ dma_engine->dmab = kzalloc_obj(*dma_engine->dmab, GFP_KERNEL);
if (!dma_engine->dmab) {
kfree(dma_engine);
return -ENOMEM;
@@ -9831,9 +9831,8 @@ static int ca0132_prepare_verbs(struct hda_codec *codec)
*/
if (ca0132_use_pci_mmio(spec))
spec->desktop_init_verbs = ca0132_init_verbs1;
- spec->spec_init_verbs = kcalloc(NUM_SPEC_VERBS,
- sizeof(struct hda_verb),
- GFP_KERNEL);
+ spec->spec_init_verbs = kzalloc_objs(struct hda_verb, NUM_SPEC_VERBS,
+ GFP_KERNEL);
if (!spec->spec_init_verbs)
return -ENOMEM;
@@ -9900,7 +9899,7 @@ static int ca0132_codec_probe(struct hda_codec *codec,
codec_dbg(codec, "%s\n", __func__);
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
codec->spec = spec;
diff --git a/sound/hda/codecs/cirrus/cs420x.c b/sound/hda/codecs/cirrus/cs420x.c
index 13f5f1711fa4..454b6946b4a3 100644
--- a/sound/hda/codecs/cirrus/cs420x.c
+++ b/sound/hda/codecs/cirrus/cs420x.c
@@ -524,7 +524,7 @@ static struct cs_spec *cs_alloc_spec(struct hda_codec *codec, int vendor_nid)
{
struct cs_spec *spec;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return NULL;
codec->spec = spec;
diff --git a/sound/hda/codecs/cirrus/cs421x.c b/sound/hda/codecs/cirrus/cs421x.c
index a93e2e0bb391..28f3317a9ffd 100644
--- a/sound/hda/codecs/cirrus/cs421x.c
+++ b/sound/hda/codecs/cirrus/cs421x.c
@@ -162,7 +162,7 @@ static struct cs_spec *cs_alloc_spec(struct hda_codec *codec, int vendor_nid)
{
struct cs_spec *spec;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return NULL;
codec->spec = spec;
diff --git a/sound/hda/codecs/cirrus/cs8409.c b/sound/hda/codecs/cirrus/cs8409.c
index 61b6a15d6291..24b224c70e9f 100644
--- a/sound/hda/codecs/cirrus/cs8409.c
+++ b/sound/hda/codecs/cirrus/cs8409.c
@@ -61,7 +61,7 @@ static struct cs8409_spec *cs8409_alloc_spec(struct hda_codec *codec)
{
struct cs8409_spec *spec;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return NULL;
codec->spec = spec;
diff --git a/sound/hda/codecs/cm9825.c b/sound/hda/codecs/cm9825.c
index 52ee431f2e2c..a5330cff42ec 100644
--- a/sound/hda/codecs/cm9825.c
+++ b/sound/hda/codecs/cm9825.c
@@ -488,7 +488,7 @@ static int cm9825_probe(struct hda_codec *codec, const struct hda_device_id *id)
struct auto_pin_cfg *cfg;
int err = 0;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (spec == NULL)
return -ENOMEM;
diff --git a/sound/hda/codecs/cmedia.c b/sound/hda/codecs/cmedia.c
index 15e5a1118a6e..0494bbe15431 100644
--- a/sound/hda/codecs/cmedia.c
+++ b/sound/hda/codecs/cmedia.c
@@ -24,7 +24,7 @@ static int cmedia_probe(struct hda_codec *codec, const struct hda_device_id *id)
bool is_cmi8888 = id->vendor_id == 0x13f68888;
int err;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (spec == NULL)
return -ENOMEM;
diff --git a/sound/hda/codecs/conexant.c b/sound/hda/codecs/conexant.c
index f71123a47546..8f032102e558 100644
--- a/sound/hda/codecs/conexant.c
+++ b/sound/hda/codecs/conexant.c
@@ -1187,7 +1187,7 @@ static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name);
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
snd_hda_gen_spec_init(&spec->gen);
diff --git a/sound/hda/codecs/generic.c b/sound/hda/codecs/generic.c
index b75a5e9470df..147582c5e51f 100644
--- a/sound/hda/codecs/generic.c
+++ b/sound/hda/codecs/generic.c
@@ -1991,7 +1991,7 @@ static int parse_output_paths(struct hda_codec *codec)
bool best_wired = true, best_mio = true;
bool hp_spk_swapped = false;
struct auto_pin_cfg *best_cfg __free(kfree) =
- kmalloc(sizeof(*best_cfg), GFP_KERNEL);
+ kmalloc_obj(*best_cfg, GFP_KERNEL);
if (!best_cfg)
return -ENOMEM;
@@ -6095,7 +6095,7 @@ static int snd_hda_gen_probe(struct hda_codec *codec,
struct hda_gen_spec *spec;
int err;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
snd_hda_gen_spec_init(spec);
diff --git a/sound/hda/codecs/hdmi/hdmi.c b/sound/hda/codecs/hdmi/hdmi.c
index c2e3adc7b3c0..bcc81018fff3 100644
--- a/sound/hda/codecs/hdmi/hdmi.c
+++ b/sound/hda/codecs/hdmi/hdmi.c
@@ -2105,7 +2105,7 @@ int snd_hda_hdmi_generic_alloc(struct hda_codec *codec)
{
struct hdmi_spec *spec;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
diff --git a/sound/hda/codecs/hdmi/simplehdmi.c b/sound/hda/codecs/hdmi/simplehdmi.c
index 193c8dc882af..fe4e73c3d6e6 100644
--- a/sound/hda/codecs/hdmi/simplehdmi.c
+++ b/sound/hda/codecs/hdmi/simplehdmi.c
@@ -175,7 +175,7 @@ int snd_hda_hdmi_simple_probe(struct hda_codec *codec,
struct hdmi_spec_per_cvt *per_cvt;
struct hdmi_spec_per_pin *per_pin;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
diff --git a/sound/hda/codecs/realtek/realtek.c b/sound/hda/codecs/realtek/realtek.c
index efe20b450529..3356fd95fb7f 100644
--- a/sound/hda/codecs/realtek/realtek.c
+++ b/sound/hda/codecs/realtek/realtek.c
@@ -221,7 +221,7 @@ void alc_update_knob_master(struct hda_codec *codec,
return;
struct snd_ctl_elem_value *uctl __free(kfree) =
- kzalloc(sizeof(*uctl), GFP_KERNEL);
+ kzalloc_obj(*uctl, GFP_KERNEL);
if (!uctl)
return;
val = snd_hda_codec_read(codec, jack->nid, 0,
@@ -1028,7 +1028,7 @@ EXPORT_SYMBOL_NS_GPL(alc_parse_auto_config, "SND_HDA_CODEC_REALTEK");
/* common preparation job for alc_spec */
int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
{
- struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ struct alc_spec *spec = kzalloc_obj(*spec, GFP_KERNEL);
int err;
if (!spec)
diff --git a/sound/hda/codecs/senarytech.c b/sound/hda/codecs/senarytech.c
index 63cda57cf786..ed3d9cbb3ea6 100644
--- a/sound/hda/codecs/senarytech.c
+++ b/sound/hda/codecs/senarytech.c
@@ -170,7 +170,7 @@ static int senary_probe(struct hda_codec *codec, const struct hda_device_id *id)
codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name);
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
snd_hda_gen_spec_init(&spec->gen);
diff --git a/sound/hda/codecs/si3054.c b/sound/hda/codecs/si3054.c
index 87cf9da9f3bf..9074c74a0ed0 100644
--- a/sound/hda/codecs/si3054.c
+++ b/sound/hda/codecs/si3054.c
@@ -256,7 +256,7 @@ static void si3054_remove(struct hda_codec *codec)
static int si3054_probe(struct hda_codec *codec, const struct hda_device_id *id)
{
- codec->spec = kzalloc(sizeof(struct si3054_spec), GFP_KERNEL);
+ codec->spec = kzalloc_obj(struct si3054_spec, GFP_KERNEL);
if (!codec->spec)
return -ENOMEM;
return 0;
diff --git a/sound/hda/codecs/sigmatel.c b/sound/hda/codecs/sigmatel.c
index ecbee408d771..69d75cc63bd6 100644
--- a/sound/hda/codecs/sigmatel.c
+++ b/sound/hda/codecs/sigmatel.c
@@ -4456,7 +4456,7 @@ static int alloc_stac_spec(struct hda_codec *codec)
{
struct sigmatel_spec *spec;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
snd_hda_gen_spec_init(&spec->gen);
diff --git a/sound/hda/codecs/via.c b/sound/hda/codecs/via.c
index 6becea9bb810..42cce9f51931 100644
--- a/sound/hda/codecs/via.c
+++ b/sound/hda/codecs/via.c
@@ -102,7 +102,7 @@ static struct via_spec *via_new_spec(struct hda_codec *codec)
{
struct via_spec *spec;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (spec == NULL)
return NULL;
diff --git a/sound/hda/common/beep.c b/sound/hda/common/beep.c
index 13a7d92e8d8d..006eef5ceea8 100644
--- a/sound/hda/common/beep.c
+++ b/sound/hda/common/beep.c
@@ -220,7 +220,7 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
return 0; /* disabled by module option */
}
- beep = kzalloc(sizeof(*beep), GFP_KERNEL);
+ beep = kzalloc_obj(*beep, GFP_KERNEL);
if (beep == NULL)
return -ENOMEM;
snprintf(beep->phys, sizeof(beep->phys),
diff --git a/sound/hda/common/codec.c b/sound/hda/common/codec.c
index ffe7c69d5a32..6c787b603179 100644
--- a/sound/hda/common/codec.c
+++ b/sound/hda/common/codec.c
@@ -117,7 +117,7 @@ static int add_conn_list(struct hda_codec *codec, hda_nid_t nid, int len,
{
struct hda_conn_list *p;
- p = kmalloc(struct_size(p, conns, len), GFP_KERNEL);
+ p = kmalloc_flex(*p, conns, len, GFP_KERNEL);
if (!p)
return -ENOMEM;
p->len = len;
@@ -147,7 +147,7 @@ static int read_and_add_raw_conns(struct hda_codec *codec, hda_nid_t nid)
len = snd_hda_get_raw_connections(codec, nid, list, ARRAY_SIZE(list));
if (len == -ENOSPC) {
len = snd_hda_get_num_raw_conns(codec, nid);
- result = kmalloc_array(len, sizeof(hda_nid_t), GFP_KERNEL);
+ result = kmalloc_objs(hda_nid_t, len, GFP_KERNEL);
if (!result)
return -ENOMEM;
len = snd_hda_get_raw_connections(codec, nid, result, len);
@@ -703,7 +703,7 @@ struct hda_pcm *snd_hda_codec_pcm_new(struct hda_codec *codec,
struct hda_pcm *pcm;
va_list args;
- pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
+ pcm = kzalloc_obj(*pcm, GFP_KERNEL);
if (!pcm)
return NULL;
@@ -895,7 +895,7 @@ snd_hda_codec_device_init(struct hda_bus *bus, unsigned int codec_addr,
if (snd_BUG_ON(codec_addr > HDA_MAX_CODEC_ADDRESS))
return ERR_PTR(-EINVAL);
- codec = kzalloc(sizeof(*codec), GFP_KERNEL);
+ codec = kzalloc_obj(*codec, GFP_KERNEL);
if (!codec)
return ERR_PTR(-ENOMEM);
@@ -1855,7 +1855,7 @@ static int check_follower_present(struct hda_codec *codec,
static int put_kctl_with_value(struct snd_kcontrol *kctl, int val)
{
struct snd_ctl_elem_value *ucontrol __free(kfree) =
- kzalloc(sizeof(*ucontrol), GFP_KERNEL);
+ kzalloc_obj(*ucontrol, GFP_KERNEL);
if (!ucontrol)
return -ENOMEM;
diff --git a/sound/hda/common/controller.c b/sound/hda/common/controller.c
index b1cfd9bd4dcb..cf8502834484 100644
--- a/sound/hda/common/controller.c
+++ b/sound/hda/common/controller.c
@@ -715,7 +715,7 @@ int snd_hda_attach_pcm_stream(struct hda_bus *_bus, struct hda_codec *codec,
if (err < 0)
return err;
strscpy(pcm->name, cpcm->name, sizeof(pcm->name));
- apcm = kzalloc(sizeof(*apcm), GFP_KERNEL);
+ apcm = kzalloc_obj(*apcm, GFP_KERNEL);
if (apcm == NULL) {
snd_device_free(chip->card, pcm);
return -ENOMEM;
@@ -1283,7 +1283,7 @@ int azx_init_streams(struct azx *chip)
* and initialize
*/
for (i = 0; i < chip->num_streams; i++) {
- struct azx_dev *azx_dev = kzalloc(sizeof(*azx_dev), GFP_KERNEL);
+ struct azx_dev *azx_dev = kzalloc_obj(*azx_dev, GFP_KERNEL);
int dir, tag;
if (!azx_dev)
diff --git a/sound/hda/common/jack.c b/sound/hda/common/jack.c
index 7d7786df60ea..87120868d123 100644
--- a/sound/hda/common/jack.c
+++ b/sound/hda/common/jack.c
@@ -329,7 +329,7 @@ snd_hda_jack_detect_enable_callback_mst(struct hda_codec *codec, hda_nid_t nid,
callback = find_callback_from_list(jack, func);
if (func && !callback) {
- callback = kzalloc(sizeof(*callback), GFP_KERNEL);
+ callback = kzalloc_obj(*callback, GFP_KERNEL);
if (!callback)
return ERR_PTR(-ENOMEM);
callback->func = func;
diff --git a/sound/hda/common/proc.c b/sound/hda/common/proc.c
index 5f3f61519ba6..98cad7ea8cf1 100644
--- a/sound/hda/common/proc.c
+++ b/sound/hda/common/proc.c
@@ -689,7 +689,7 @@ static void print_dpmst_connections(struct snd_info_buffer *buffer, struct hda_c
if (conn_len <= 0)
return;
- conn = kmalloc_array(conn_len, sizeof(hda_nid_t), GFP_KERNEL);
+ conn = kmalloc_objs(hda_nid_t, conn_len, GFP_KERNEL);
if (!conn)
return;
@@ -845,9 +845,8 @@ static void print_codec_info(struct snd_info_entry *entry,
if (wid_caps & AC_WCAP_CONN_LIST) {
conn_len = snd_hda_get_num_raw_conns(codec, nid);
if (conn_len > 0) {
- conn = kmalloc_array(conn_len,
- sizeof(hda_nid_t),
- GFP_KERNEL);
+ conn = kmalloc_objs(hda_nid_t, conn_len,
+ GFP_KERNEL);
if (!conn)
return;
if (snd_hda_get_raw_connections(codec, nid, conn,
diff --git a/sound/hda/core/ext/controller.c b/sound/hda/core/ext/controller.c
index 9eea3ea2dae0..0c12ff36d992 100644
--- a/sound/hda/core/ext/controller.c
+++ b/sound/hda/core/ext/controller.c
@@ -89,7 +89,7 @@ int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus)
dev_dbg(bus->dev, "In %s Link count: %d\n", __func__, link_count);
for (idx = 0; idx < link_count; idx++) {
- hlink = kzalloc(sizeof(*hlink), GFP_KERNEL);
+ hlink = kzalloc_obj(*hlink, GFP_KERNEL);
if (!hlink)
return -ENOMEM;
hlink->index = idx;
diff --git a/sound/hda/core/ext/stream.c b/sound/hda/core/ext/stream.c
index b4759198e51d..a213e5b06bdb 100644
--- a/sound/hda/core/ext/stream.c
+++ b/sound/hda/core/ext/stream.c
@@ -101,8 +101,8 @@ int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx,
setup_op = snd_hdac_stream_setup;
for (i = 0; i < num_stream; i++) {
- struct hdac_ext_stream *hext_stream =
- kzalloc(sizeof(*hext_stream), GFP_KERNEL);
+ struct hdac_ext_stream *hext_stream = kzalloc_obj(*hext_stream,
+ GFP_KERNEL);
if (!hext_stream)
return -ENOMEM;
tag = ++stream_tag;
diff --git a/sound/hda/core/sysfs.c b/sound/hda/core/sysfs.c
index bffe52859dba..443f00d037a3 100644
--- a/sound/hda/core/sysfs.c
+++ b/sound/hda/core/sysfs.c
@@ -339,7 +339,7 @@ static int add_widget_node(struct kobject *parent, hda_nid_t nid,
const struct attribute_group *group,
struct kobject **res)
{
- struct kobject *kobj = kzalloc(sizeof(*kobj), GFP_KERNEL);
+ struct kobject *kobj = kzalloc_obj(*kobj, GFP_KERNEL);
int err;
if (!kobj)
@@ -366,7 +366,7 @@ static int widget_tree_create(struct hdac_device *codec)
int i, err;
hda_nid_t nid;
- tree = codec->widgets = kzalloc(sizeof(*tree), GFP_KERNEL);
+ tree = codec->widgets = kzalloc_obj(*tree, GFP_KERNEL);
if (!tree)
return -ENOMEM;
@@ -374,8 +374,8 @@ static int widget_tree_create(struct hdac_device *codec)
if (!tree->root)
return -ENOMEM;
- tree->nodes = kcalloc(codec->num_nodes + 1, sizeof(*tree->nodes),
- GFP_KERNEL);
+ tree->nodes = kzalloc_objs(*tree->nodes, codec->num_nodes + 1,
+ GFP_KERNEL);
if (!tree->nodes)
return -ENOMEM;
@@ -436,7 +436,7 @@ int hda_widget_sysfs_reinit(struct hdac_device *codec,
if (!tree)
return -ENOMEM;
- tree->nodes = kcalloc(num_nodes + 1, sizeof(*tree->nodes), GFP_KERNEL);
+ tree->nodes = kzalloc_objs(*tree->nodes, num_nodes + 1, GFP_KERNEL);
if (!tree->nodes) {
kfree(tree);
return -ENOMEM;
diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c
index 46f081268348..a4717449cc2f 100644
--- a/sound/i2c/cs8427.c
+++ b/sound/i2c/cs8427.c
@@ -269,7 +269,7 @@ int snd_cs8427_create(struct snd_i2c_bus *bus,
&device);
if (err < 0)
return err;
- chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = device->private_data = kzalloc_obj(*chip, GFP_KERNEL);
if (chip == NULL) {
snd_i2c_device_free(device);
return -ENOMEM;
diff --git a/sound/i2c/i2c.c b/sound/i2c/i2c.c
index 847e3b6ca601..8bb49f0d97e6 100644
--- a/sound/i2c/i2c.c
+++ b/sound/i2c/i2c.c
@@ -72,7 +72,7 @@ int snd_i2c_bus_create(struct snd_card *card, const char *name,
};
*ri2c = NULL;
- bus = kzalloc(sizeof(*bus), GFP_KERNEL);
+ bus = kzalloc_obj(*bus, GFP_KERNEL);
if (bus == NULL)
return -ENOMEM;
mutex_init(&bus->lock_mutex);
@@ -104,7 +104,7 @@ int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name,
*rdevice = NULL;
if (snd_BUG_ON(!bus))
return -EINVAL;
- device = kzalloc(sizeof(*device), GFP_KERNEL);
+ device = kzalloc_obj(*device, GFP_KERNEL);
if (device == NULL)
return -ENOMEM;
device->addr = addr;
diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c
index 70b3f7e17f9e..b1bfc71aab22 100644
--- a/sound/i2c/other/ak4113.c
+++ b/sound/i2c/other/ak4113.c
@@ -64,7 +64,7 @@ int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
.dev_free = snd_ak4113_dev_free,
};
- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = kzalloc_obj(*chip, GFP_KERNEL);
if (chip == NULL)
return -ENOMEM;
spin_lock_init(&chip->lock);
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c
index 0e3a272c1490..6d51e2a8db2b 100644
--- a/sound/i2c/other/ak4114.c
+++ b/sound/i2c/other/ak4114.c
@@ -64,7 +64,7 @@ int snd_ak4114_create(struct snd_card *card,
.dev_free = snd_ak4114_dev_free,
};
- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = kzalloc_obj(*chip, GFP_KERNEL);
if (chip == NULL)
return -ENOMEM;
spin_lock_init(&chip->lock);
diff --git a/sound/i2c/other/ak4117.c b/sound/i2c/other/ak4117.c
index d2ec20f885f0..8f4657aa6525 100644
--- a/sound/i2c/other/ak4117.c
+++ b/sound/i2c/other/ak4117.c
@@ -57,7 +57,7 @@ int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t
.dev_free = snd_ak4117_dev_free,
};
- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = kzalloc_obj(*chip, GFP_KERNEL);
if (chip == NULL)
return -ENOMEM;
spin_lock_init(&chip->lock);
diff --git a/sound/i2c/tea6330t.c b/sound/i2c/tea6330t.c
index 676d58054944..b63dfc50c1c2 100644
--- a/sound/i2c/tea6330t.c
+++ b/sound/i2c/tea6330t.c
@@ -285,7 +285,7 @@ int snd_tea6330t_update_mixer(struct snd_card *card,
u8 default_treble, default_bass;
unsigned char bytes[7];
- tea = kzalloc(sizeof(*tea), GFP_KERNEL);
+ tea = kzalloc_obj(*tea, GFP_KERNEL);
if (tea == NULL)
return -ENOMEM;
err = snd_i2c_device_create(bus, "TEA6330T", TEA6330T_ADDR, &device);
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c
index 5f50a39c6f16..0b6e56c16e38 100644
--- a/sound/isa/gus/gus_main.c
+++ b/sound/isa/gus/gus_main.c
@@ -116,7 +116,7 @@ int snd_gus_create(struct snd_card *card,
};
*rgus = NULL;
- gus = kzalloc(sizeof(*gus), GFP_KERNEL);
+ gus = kzalloc_obj(*gus, GFP_KERNEL);
if (gus == NULL)
return -ENOMEM;
spin_lock_init(&gus->reg_lock);
diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c
index 8d95d8d5abdf..65e5426a43fd 100644
--- a/sound/isa/gus/gus_mem.c
+++ b/sound/isa/gus/gus_mem.c
@@ -21,7 +21,7 @@ snd_gf1_mem_xalloc(struct snd_gf1_mem *alloc, struct snd_gf1_mem_block *block,
{
struct snd_gf1_mem_block *pblock, *nblock;
- nblock = kmalloc(sizeof(struct snd_gf1_mem_block), GFP_KERNEL);
+ nblock = kmalloc_obj(struct snd_gf1_mem_block, GFP_KERNEL);
if (nblock == NULL)
return NULL;
*nblock = *block;
diff --git a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c
index b5e1d1649500..fdb14acaddcf 100644
--- a/sound/isa/gus/gus_mem_proc.c
+++ b/sound/isa/gus/gus_mem_proc.c
@@ -50,7 +50,7 @@ int snd_gf1_mem_proc_init(struct snd_gus_card * gus)
for (idx = 0; idx < 4; idx++) {
if (gus->gf1.mem_alloc.banks_8[idx].size > 0) {
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (priv == NULL)
return -ENOMEM;
priv->gus = gus;
@@ -67,7 +67,7 @@ int snd_gf1_mem_proc_init(struct snd_gus_card * gus)
}
for (idx = 0; idx < 4; idx++) {
if (gus->gf1.rom_present & (1 << idx)) {
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (priv == NULL)
return -ENOMEM;
priv->rom = 1;
diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c
index 9249cbff30f3..b5da8d970b3f 100644
--- a/sound/isa/gus/gus_pcm.c
+++ b/sound/isa/gus/gus_pcm.c
@@ -638,7 +638,7 @@ static int snd_gf1_pcm_playback_open(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
int err;
- pcmp = kzalloc(sizeof(*pcmp), GFP_KERNEL);
+ pcmp = kzalloc_obj(*pcmp, GFP_KERNEL);
if (pcmp == NULL)
return -ENOMEM;
pcmp->gus = gus;
diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c
index 656a655d618d..a3071cd2e9a8 100644
--- a/sound/isa/sb/emu8000_pcm.c
+++ b/sound/isa/sb/emu8000_pcm.c
@@ -221,7 +221,7 @@ static int emu8k_pcm_open(struct snd_pcm_substream *subs)
struct snd_emu8k_pcm *rec;
struct snd_pcm_runtime *runtime = subs->runtime;
- rec = kzalloc(sizeof(*rec), GFP_KERNEL);
+ rec = kzalloc_obj(*rec, GFP_KERNEL);
if (! rec)
return -ENOMEM;
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c
index 9ad71a9fc18d..834b38de9afd 100644
--- a/sound/isa/sb/sb16_csp.c
+++ b/sound/isa/sb/sb16_csp.c
@@ -117,7 +117,7 @@ int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep)
if (err < 0)
return err;
- p = kzalloc(sizeof(*p), GFP_KERNEL);
+ p = kzalloc_obj(*p, GFP_KERNEL);
if (!p) {
snd_device_free(chip->card, hw);
return -ENOMEM;
diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
index 0d78533e1cfd..0b91b3b28f7f 100644
--- a/sound/isa/wavefront/wavefront_synth.c
+++ b/sound/isa/wavefront/wavefront_synth.c
@@ -1381,7 +1381,7 @@ wavefront_load_patch (snd_wavefront_t *dev, const char __user *addr)
wavefront_patch_info *header;
int err;
- header = kmalloc(sizeof(*header), GFP_KERNEL);
+ header = kmalloc_obj(*header, GFP_KERNEL);
if (! header)
return -ENOMEM;
diff --git a/sound/mips/hal2.c b/sound/mips/hal2.c
index f88e6a6733a5..c865c7ba3636 100644
--- a/sound/mips/hal2.c
+++ b/sound/mips/hal2.c
@@ -773,7 +773,7 @@ static int hal2_create(struct snd_card *card, struct snd_hal2 **rchip)
struct hpc3_regs *hpc3 = hpc3c0;
int err;
- hal2 = kzalloc(sizeof(*hal2), GFP_KERNEL);
+ hal2 = kzalloc_obj(*hal2, GFP_KERNEL);
if (!hal2)
return -ENOMEM;
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c
index 077fdf2181c1..af2690d901b4 100644
--- a/sound/mips/sgio2audio.c
+++ b/sound/mips/sgio2audio.c
@@ -788,7 +788,7 @@ static int snd_sgio2audio_create(struct snd_card *card,
if (!(readq(&mace->perif.audio.control) & AUDIO_CONTROL_CODEC_PRESENT))
return -ENOENT;
- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = kzalloc_obj(*chip, GFP_KERNEL);
if (chip == NULL)
return -ENOMEM;
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c
index 4b5a54da25fb..e9f30201cf4b 100644
--- a/sound/parisc/harmony.c
+++ b/sound/parisc/harmony.c
@@ -852,7 +852,7 @@ snd_harmony_create(struct snd_card *card,
*rchip = NULL;
- h = kzalloc(sizeof(*h), GFP_KERNEL);
+ h = kzalloc_obj(*h, GFP_KERNEL);
if (h == NULL)
return -ENOMEM;
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index c54bdefa5afe..7392bc15affa 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1957,7 +1957,7 @@ int snd_ac97_bus(struct snd_card *card, int num,
if (snd_BUG_ON(!card))
return -EINVAL;
- bus = kzalloc(sizeof(*bus), GFP_KERNEL);
+ bus = kzalloc_obj(*bus, GFP_KERNEL);
if (bus == NULL)
return -ENOMEM;
bus->card = card;
@@ -2069,7 +2069,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
return -EBUSY;
card = bus->card;
- ac97 = kzalloc(sizeof(*ac97), GFP_KERNEL);
+ ac97 = kzalloc_obj(*ac97, GFP_KERNEL);
if (ac97 == NULL)
return -ENOMEM;
ac97->private_data = template->private_data;
diff --git a/sound/pci/ac97/ac97_pcm.c b/sound/pci/ac97/ac97_pcm.c
index 4715d88ff8f4..9df21c42d624 100644
--- a/sound/pci/ac97/ac97_pcm.c
+++ b/sound/pci/ac97/ac97_pcm.c
@@ -441,7 +441,7 @@ int snd_ac97_pcm_assign(struct snd_ac97_bus *bus,
unsigned int rates;
struct snd_ac97 *codec;
- rpcms = kcalloc(pcms_count, sizeof(struct ac97_pcm), GFP_KERNEL);
+ rpcms = kzalloc_objs(struct ac97_pcm, pcms_count, GFP_KERNEL);
if (rpcms == NULL)
return -ENOMEM;
memset(avail_slots, 0, sizeof(avail_slots));
diff --git a/sound/pci/ak4531_codec.c b/sound/pci/ak4531_codec.c
index cdad47e4098d..c7f32b1de462 100644
--- a/sound/pci/ak4531_codec.c
+++ b/sound/pci/ak4531_codec.c
@@ -373,7 +373,7 @@ int snd_ak4531_mixer(struct snd_card *card,
return -EINVAL;
if (rak4531)
*rak4531 = NULL;
- ak4531 = kzalloc(sizeof(*ak4531), GFP_KERNEL);
+ ak4531 = kzalloc_obj(*ak4531, GFP_KERNEL);
if (ak4531 == NULL)
return -ENOMEM;
*ak4531 = *_ak4531;
diff --git a/sound/pci/als300.c b/sound/pci/als300.c
index 733e84def5a7..5b82777522d8 100644
--- a/sound/pci/als300.c
+++ b/sound/pci/als300.c
@@ -342,8 +342,7 @@ static int snd_als300_playback_open(struct snd_pcm_substream *substream)
{
struct snd_als300 *chip = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
- struct snd_als300_substream_data *data = kzalloc(sizeof(*data),
- GFP_KERNEL);
+ struct snd_als300_substream_data *data = kzalloc_obj(*data, GFP_KERNEL);
if (!data)
return -ENOMEM;
@@ -370,8 +369,7 @@ static int snd_als300_capture_open(struct snd_pcm_substream *substream)
{
struct snd_als300 *chip = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
- struct snd_als300_substream_data *data = kzalloc(sizeof(*data),
- GFP_KERNEL);
+ struct snd_als300_substream_data *data = kzalloc_obj(*data, GFP_KERNEL);
if (!data)
return -ENOMEM;
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index fd0a67b772d1..c5f38fc88c86 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -975,7 +975,7 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream)
struct snd_pcm_hardware snd_card_asihpi_playback;
int err;
- dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
+ dpcm = kzalloc_obj(*dpcm, GFP_KERNEL);
if (dpcm == NULL)
return -ENOMEM;
@@ -1145,7 +1145,7 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream)
struct snd_pcm_hardware snd_card_asihpi_capture;
int err;
- dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
+ dpcm = kzalloc_obj(*dpcm, GFP_KERNEL);
if (dpcm == NULL)
return -ENOMEM;
diff --git a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c
index b08578c93c6a..41b2892a9312 100644
--- a/sound/pci/asihpi/hpi6000.c
+++ b/sound/pci/asihpi/hpi6000.c
@@ -406,7 +406,7 @@ static void subsys_create_adapter(struct hpi_message *phm,
memset(&ao, 0, sizeof(ao));
- ao.priv = kzalloc(sizeof(struct hpi_hw_obj), GFP_KERNEL);
+ ao.priv = kzalloc_obj(struct hpi_hw_obj, GFP_KERNEL);
if (!ao.priv) {
HPI_DEBUG_LOG(ERROR, "can't get mem for adapter object\n");
phr->error = HPI_ERROR_MEMORY_ALLOC;
diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c
index c7d7eff86727..c484d929d6da 100644
--- a/sound/pci/asihpi/hpi6205.c
+++ b/sound/pci/asihpi/hpi6205.c
@@ -461,7 +461,7 @@ static void subsys_create_adapter(struct hpi_message *phm,
memset(&ao, 0, sizeof(ao));
- ao.priv = kzalloc(sizeof(struct hpi_hw_obj), GFP_KERNEL);
+ ao.priv = kzalloc_obj(struct hpi_hw_obj, GFP_KERNEL);
if (!ao.priv) {
HPI_DEBUG_LOG(ERROR, "can't get mem for adapter object\n");
phr->error = HPI_ERROR_MEMORY_ALLOC;
diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c
index 7d1abaedb46a..2378bdeb1f23 100644
--- a/sound/pci/asihpi/hpicmn.c
+++ b/sound/pci/asihpi/hpicmn.c
@@ -641,13 +641,12 @@ void hpi_cmn_control_cache_sync_to_msg(struct hpi_control_cache *p_cache,
struct hpi_control_cache *hpi_alloc_control_cache(const u32 control_count,
const u32 size_in_bytes, u8 *p_dsp_control_buffer)
{
- struct hpi_control_cache *p_cache =
- kmalloc(sizeof(*p_cache), GFP_KERNEL);
+ struct hpi_control_cache *p_cache = kmalloc_obj(*p_cache, GFP_KERNEL);
if (!p_cache)
return NULL;
p_cache->p_info =
- kcalloc(control_count, sizeof(*p_cache->p_info), GFP_KERNEL);
+ kzalloc_objs(*p_cache->p_info, control_count, GFP_KERNEL);
if (!p_cache->p_info) {
kfree(p_cache);
return NULL;
diff --git a/sound/pci/asihpi/hpidspcd.c b/sound/pci/asihpi/hpidspcd.c
index 9acc0ac75eca..8eda87107b28 100644
--- a/sound/pci/asihpi/hpidspcd.c
+++ b/sound/pci/asihpi/hpidspcd.c
@@ -69,7 +69,7 @@ short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code,
}
HPI_DEBUG_LOG(DEBUG, "dsp code %s opened\n", fw_name);
- dsp_code->pvt = kmalloc(sizeof(*dsp_code->pvt), GFP_KERNEL);
+ dsp_code->pvt = kmalloc_obj(*dsp_code->pvt, GFP_KERNEL);
if (!dsp_code->pvt) {
err_ret = HPI_ERROR_MEMORY_ALLOC;
goto error2;
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c
index 9fb0c8e503df..24c116ab9cf5 100644
--- a/sound/pci/asihpi/hpioctl.c
+++ b/sound/pci/asihpi/hpioctl.c
@@ -105,8 +105,8 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (cmd != HPI_IOCTL_LINUX)
return -EINVAL;
- hm = kmalloc(sizeof(*hm), GFP_KERNEL);
- hr = kzalloc(sizeof(*hr), GFP_KERNEL);
+ hm = kmalloc_obj(*hm, GFP_KERNEL);
+ hr = kzalloc_obj(*hr, GFP_KERNEL);
if (!hm || !hr) {
err = -ENOMEM;
goto out;
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 41774e2ef53f..bdf9453939f3 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -543,7 +543,7 @@ static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substr
struct snd_pcm_runtime *runtime = substream->runtime;
int err;
- epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
+ epcm = kzalloc_obj(*epcm, GFP_KERNEL);
if (epcm == NULL)
return -ENOMEM;
@@ -638,7 +638,7 @@ static int snd_ca0106_pcm_open_capture_channel(struct snd_pcm_substream *substre
struct snd_pcm_runtime *runtime = substream->runtime;
int err;
- epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
+ epcm = kzalloc_obj(*epcm, GFP_KERNEL);
if (!epcm)
return -ENOMEM;
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 0666be543474..189948f70d84 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -1096,7 +1096,7 @@ static int save_mixer_state(struct cmipci *cm)
struct snd_ctl_elem_value *val;
unsigned int i;
- val = kmalloc(sizeof(*val), GFP_KERNEL);
+ val = kmalloc_obj(*val, GFP_KERNEL);
if (!val)
return -ENOMEM;
for (i = 0; i < CM_SAVED_MIXERS; i++) {
@@ -1130,7 +1130,7 @@ static void restore_mixer_state(struct cmipci *cm)
struct snd_ctl_elem_value *val;
unsigned int i;
- val = kmalloc(sizeof(*val), GFP_KERNEL);
+ val = kmalloc_obj(*val, GFP_KERNEL);
if (!val)
return;
cm->mixer_insensitive = 0; /* at first clear this;
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index b96ab7fd464c..d7bed722d939 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -401,7 +401,7 @@ static int load_firmware(struct snd_cs46xx *chip,
}
err = -ENOMEM;
- module = kzalloc(sizeof(*module), GFP_KERNEL);
+ module = kzalloc_obj(*module, GFP_KERNEL);
if (!module)
goto error;
module->module_name = kstrdup(fw_name, GFP_KERNEL);
@@ -414,7 +414,7 @@ static int load_firmware(struct snd_cs46xx *chip,
if (nums >= 40)
goto error_inval;
module->symbol_table.symbols =
- kcalloc(nums, sizeof(struct dsp_symbol_entry), GFP_KERNEL);
+ kzalloc_objs(struct dsp_symbol_entry, nums, GFP_KERNEL);
if (!module->symbol_table.symbols)
goto error;
for (i = 0; i < nums; i++) {
@@ -434,7 +434,7 @@ static int load_firmware(struct snd_cs46xx *chip,
if (nums > 10)
goto error_inval;
module->segments =
- kcalloc(nums, sizeof(struct dsp_segment_desc), GFP_KERNEL);
+ kzalloc_objs(struct dsp_segment_desc, nums, GFP_KERNEL);
if (!module->segments)
goto error;
for (i = 0; i < nums; i++) {
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index 3d34575a0e8f..f106f46aeb87 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -221,7 +221,8 @@ add_symbol (struct snd_cs46xx * chip, char * symbol_name, u32 address, int type)
struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip)
{
- struct dsp_spos_instance * ins = kzalloc(sizeof(struct dsp_spos_instance), GFP_KERNEL);
+ struct dsp_spos_instance * ins = kzalloc_obj(struct dsp_spos_instance,
+ GFP_KERNEL);
if (ins == NULL)
return NULL;
@@ -231,9 +232,8 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip)
vmalloc(array_size(DSP_MAX_SYMBOLS,
sizeof(struct dsp_symbol_entry)));
ins->code.data = kmalloc(DSP_CODE_BYTE_SIZE, GFP_KERNEL);
- ins->modules = kmalloc_array(DSP_MAX_MODULES,
- sizeof(struct dsp_module_desc),
- GFP_KERNEL);
+ ins->modules = kmalloc_objs(struct dsp_module_desc, DSP_MAX_MODULES,
+ GFP_KERNEL);
if (!ins->symbol_table.symbols || !ins->code.data || !ins->modules) {
cs46xx_dsp_spos_destroy(chip);
goto error;
diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c
index 32ed415bf427..c55ff043d1d7 100644
--- a/sound/pci/cs46xx/dsp_spos_scb_lib.c
+++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c
@@ -234,7 +234,7 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip,
entry = snd_info_create_card_entry(ins->snd_card, scb->scb_name,
ins->proc_dsp_dir);
if (entry) {
- scb_info = kmalloc(sizeof(struct proc_scb_info), GFP_KERNEL);
+ scb_info = kmalloc_obj(struct proc_scb_info, GFP_KERNEL);
if (!scb_info) {
snd_info_free_entry(entry);
entry = NULL;
diff --git a/sound/pci/ctxfi/ctamixer.c b/sound/pci/ctxfi/ctamixer.c
index c30162be27ee..c22e3173ec1b 100644
--- a/sound/pci/ctxfi/ctamixer.c
+++ b/sound/pci/ctxfi/ctamixer.c
@@ -296,7 +296,7 @@ int amixer_mgr_create(struct hw *hw, void **ramixer_mgr)
struct amixer_mgr *amixer_mgr;
*ramixer_mgr = NULL;
- amixer_mgr = kzalloc(sizeof(*amixer_mgr), GFP_KERNEL);
+ amixer_mgr = kzalloc_obj(*amixer_mgr, GFP_KERNEL);
if (!amixer_mgr)
return -ENOMEM;
@@ -448,7 +448,7 @@ int sum_mgr_create(struct hw *hw, void **rsum_mgr)
struct sum_mgr *sum_mgr;
*rsum_mgr = NULL;
- sum_mgr = kzalloc(sizeof(*sum_mgr), GFP_KERNEL);
+ sum_mgr = kzalloc_obj(*sum_mgr, GFP_KERNEL);
if (!sum_mgr)
return -ENOMEM;
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c
index a25a599fc5be..f130a2722a70 100644
--- a/sound/pci/ctxfi/ctatc.c
+++ b/sound/pci/ctxfi/ctatc.c
@@ -1723,7 +1723,7 @@ int ct_atc_create(struct snd_card *card, struct pci_dev *pci,
*ratc = NULL;
- atc = kzalloc(sizeof(*atc), GFP_KERNEL);
+ atc = kzalloc_obj(*atc, GFP_KERNEL);
if (!atc)
return -ENOMEM;
diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c
index 1c8f8efd836c..12653f7cd9e8 100644
--- a/sound/pci/ctxfi/ctdaio.c
+++ b/sound/pci/ctxfi/ctdaio.c
@@ -159,7 +159,7 @@ static int dao_set_left_input(struct dao *dao, struct rsc *input)
struct daio *daio = &dao->daio;
int i;
- entry = kcalloc(daio->rscl.msr, sizeof(*entry), GFP_KERNEL);
+ entry = kzalloc_objs(*entry, daio->rscl.msr, GFP_KERNEL);
if (!entry)
return -ENOMEM;
@@ -188,7 +188,7 @@ static int dao_set_right_input(struct dao *dao, struct rsc *input)
struct daio *daio = &dao->daio;
int i;
- entry = kcalloc(daio->rscr.msr, sizeof(*entry), GFP_KERNEL);
+ entry = kzalloc_objs(*entry, daio->rscr.msr, GFP_KERNEL);
if (!entry)
return -ENOMEM;
@@ -660,7 +660,7 @@ int daio_mgr_create(struct hw *hw, void **rdaio_mgr)
struct imapper *entry;
*rdaio_mgr = NULL;
- daio_mgr = kzalloc(sizeof(*daio_mgr), GFP_KERNEL);
+ daio_mgr = kzalloc_obj(*daio_mgr, GFP_KERNEL);
if (!daio_mgr)
return -ENOMEM;
@@ -671,7 +671,7 @@ int daio_mgr_create(struct hw *hw, void **rdaio_mgr)
spin_lock_init(&daio_mgr->mgr_lock);
spin_lock_init(&daio_mgr->imap_lock);
INIT_LIST_HEAD(&daio_mgr->imappers);
- entry = kzalloc(sizeof(*entry), GFP_KERNEL);
+ entry = kzalloc_obj(*entry, GFP_KERNEL);
if (!entry) {
err = -ENOMEM;
goto error2;
diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c
index ea0a928937b6..0851453b8565 100644
--- a/sound/pci/ctxfi/cthw20k1.c
+++ b/sound/pci/ctxfi/cthw20k1.c
@@ -157,7 +157,7 @@ static int src_get_rsc_ctrl_blk(void **rblk)
struct src_rsc_ctrl_blk *blk;
*rblk = NULL;
- blk = kzalloc(sizeof(*blk), GFP_KERNEL);
+ blk = kzalloc_obj(*blk, GFP_KERNEL);
if (!blk)
return -ENOMEM;
@@ -483,7 +483,7 @@ static int src_mgr_get_ctrl_blk(void **rblk)
struct src_mgr_ctrl_blk *blk;
*rblk = NULL;
- blk = kzalloc(sizeof(*blk), GFP_KERNEL);
+ blk = kzalloc_obj(*blk, GFP_KERNEL);
if (!blk)
return -ENOMEM;
@@ -504,7 +504,7 @@ static int srcimp_mgr_get_ctrl_blk(void **rblk)
struct srcimp_mgr_ctrl_blk *blk;
*rblk = NULL;
- blk = kzalloc(sizeof(*blk), GFP_KERNEL);
+ blk = kzalloc_obj(*blk, GFP_KERNEL);
if (!blk)
return -ENOMEM;
@@ -691,7 +691,7 @@ static int amixer_rsc_get_ctrl_blk(void **rblk)
struct amixer_rsc_ctrl_blk *blk;
*rblk = NULL;
- blk = kzalloc(sizeof(*blk), GFP_KERNEL);
+ blk = kzalloc_obj(*blk, GFP_KERNEL);
if (!blk)
return -ENOMEM;
@@ -898,7 +898,7 @@ static int dai_get_ctrl_blk(void **rblk)
struct dai_ctrl_blk *blk;
*rblk = NULL;
- blk = kzalloc(sizeof(*blk), GFP_KERNEL);
+ blk = kzalloc_obj(*blk, GFP_KERNEL);
if (!blk)
return -ENOMEM;
@@ -947,7 +947,7 @@ static int dao_get_ctrl_blk(void **rblk)
struct dao_ctrl_blk *blk;
*rblk = NULL;
- blk = kzalloc(sizeof(*blk), GFP_KERNEL);
+ blk = kzalloc_obj(*blk, GFP_KERNEL);
if (!blk)
return -ENOMEM;
@@ -1141,7 +1141,7 @@ static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk)
struct daio_mgr_ctrl_blk *blk;
*rblk = NULL;
- blk = kzalloc(sizeof(*blk), GFP_KERNEL);
+ blk = kzalloc_obj(*blk, GFP_KERNEL);
if (!blk)
return -ENOMEM;
@@ -2227,7 +2227,7 @@ int create_20k1_hw_obj(struct hw **rhw)
struct hw20k1 *hw20k1;
*rhw = NULL;
- hw20k1 = kzalloc(sizeof(*hw20k1), GFP_KERNEL);
+ hw20k1 = kzalloc_obj(*hw20k1, GFP_KERNEL);
if (!hw20k1)
return -ENOMEM;
diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c
index fac88f5590c9..1d558914a26a 100644
--- a/sound/pci/ctxfi/cthw20k2.c
+++ b/sound/pci/ctxfi/cthw20k2.c
@@ -157,7 +157,7 @@ static int src_get_rsc_ctrl_blk(void **rblk)
struct src_rsc_ctrl_blk *blk;
*rblk = NULL;
- blk = kzalloc(sizeof(*blk), GFP_KERNEL);
+ blk = kzalloc_obj(*blk, GFP_KERNEL);
if (!blk)
return -ENOMEM;
@@ -483,7 +483,7 @@ static int src_mgr_get_ctrl_blk(void **rblk)
struct src_mgr_ctrl_blk *blk;
*rblk = NULL;
- blk = kzalloc(sizeof(*blk), GFP_KERNEL);
+ blk = kzalloc_obj(*blk, GFP_KERNEL);
if (!blk)
return -ENOMEM;
@@ -504,7 +504,7 @@ static int srcimp_mgr_get_ctrl_blk(void **rblk)
struct srcimp_mgr_ctrl_blk *blk;
*rblk = NULL;
- blk = kzalloc(sizeof(*blk), GFP_KERNEL);
+ blk = kzalloc_obj(*blk, GFP_KERNEL);
if (!blk)
return -ENOMEM;
@@ -693,7 +693,7 @@ static int amixer_rsc_get_ctrl_blk(void **rblk)
struct amixer_rsc_ctrl_blk *blk;
*rblk = NULL;
- blk = kzalloc(sizeof(*blk), GFP_KERNEL);
+ blk = kzalloc_obj(*blk, GFP_KERNEL);
if (!blk)
return -ENOMEM;
@@ -882,7 +882,7 @@ static int dai_get_ctrl_blk(void **rblk)
struct dai_ctrl_blk *blk;
*rblk = NULL;
- blk = kzalloc(sizeof(*blk), GFP_KERNEL);
+ blk = kzalloc_obj(*blk, GFP_KERNEL);
if (!blk)
return -ENOMEM;
@@ -932,7 +932,7 @@ static int dao_get_ctrl_blk(void **rblk)
struct dao_ctrl_blk *blk;
*rblk = NULL;
- blk = kzalloc(sizeof(*blk), GFP_KERNEL);
+ blk = kzalloc_obj(*blk, GFP_KERNEL);
if (!blk)
return -ENOMEM;
@@ -1084,7 +1084,7 @@ static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk)
int i;
*rblk = NULL;
- blk = kzalloc(sizeof(*blk), GFP_KERNEL);
+ blk = kzalloc_obj(*blk, GFP_KERNEL);
if (!blk)
return -ENOMEM;
@@ -2369,7 +2369,7 @@ int create_20k2_hw_obj(struct hw **rhw)
struct hw20k2 *hw20k2;
*rhw = NULL;
- hw20k2 = kzalloc(sizeof(*hw20k2), GFP_KERNEL);
+ hw20k2 = kzalloc_obj(*hw20k2, GFP_KERNEL);
if (!hw20k2)
return -ENOMEM;
diff --git a/sound/pci/ctxfi/ctmixer.c b/sound/pci/ctxfi/ctmixer.c
index fc9fde284fb3..3c5b89f3eae3 100644
--- a/sound/pci/ctxfi/ctmixer.c
+++ b/sound/pci/ctxfi/ctmixer.c
@@ -969,7 +969,7 @@ static int ct_mixer_get_mem(struct ct_mixer **rmixer)
*rmixer = NULL;
/* Allocate mem for mixer obj */
- mixer = kzalloc(sizeof(*mixer), GFP_KERNEL);
+ mixer = kzalloc_obj(*mixer, GFP_KERNEL);
if (!mixer)
return -ENOMEM;
diff --git a/sound/pci/ctxfi/ctpcm.c b/sound/pci/ctxfi/ctpcm.c
index 81dfc6a76b18..2b0f4130642c 100644
--- a/sound/pci/ctxfi/ctpcm.c
+++ b/sound/pci/ctxfi/ctpcm.c
@@ -119,7 +119,7 @@ static int ct_pcm_playback_open(struct snd_pcm_substream *substream)
struct ct_atc_pcm *apcm;
int err;
- apcm = kzalloc(sizeof(*apcm), GFP_KERNEL);
+ apcm = kzalloc_obj(*apcm, GFP_KERNEL);
if (!apcm)
return -ENOMEM;
@@ -265,7 +265,7 @@ static int ct_pcm_capture_open(struct snd_pcm_substream *substream)
struct ct_atc_pcm *apcm;
int err;
- apcm = kzalloc(sizeof(*apcm), GFP_KERNEL);
+ apcm = kzalloc_obj(*apcm, GFP_KERNEL);
if (!apcm)
return -ENOMEM;
diff --git a/sound/pci/ctxfi/ctsrc.c b/sound/pci/ctxfi/ctsrc.c
index 46afc9604c08..b781201c7f0e 100644
--- a/sound/pci/ctxfi/ctsrc.c
+++ b/sound/pci/ctxfi/ctsrc.c
@@ -540,7 +540,7 @@ int src_mgr_create(struct hw *hw, void **rsrc_mgr)
struct src_mgr *src_mgr;
*rsrc_mgr = NULL;
- src_mgr = kzalloc(sizeof(*src_mgr), GFP_KERNEL);
+ src_mgr = kzalloc_obj(*src_mgr, GFP_KERNEL);
if (!src_mgr)
return -ENOMEM;
@@ -669,8 +669,7 @@ static int srcimp_rsc_init(struct srcimp *srcimp,
return err;
/* Reserve memory for imapper nodes */
- srcimp->imappers = kcalloc(desc->msr, sizeof(struct imapper),
- GFP_KERNEL);
+ srcimp->imappers = kzalloc_objs(struct imapper, desc->msr, GFP_KERNEL);
if (!srcimp->imappers) {
err = -ENOMEM;
goto error1;
@@ -811,7 +810,7 @@ int srcimp_mgr_create(struct hw *hw, void **rsrcimp_mgr)
struct imapper *entry;
*rsrcimp_mgr = NULL;
- srcimp_mgr = kzalloc(sizeof(*srcimp_mgr), GFP_KERNEL);
+ srcimp_mgr = kzalloc_obj(*srcimp_mgr, GFP_KERNEL);
if (!srcimp_mgr)
return -ENOMEM;
@@ -822,7 +821,7 @@ int srcimp_mgr_create(struct hw *hw, void **rsrcimp_mgr)
spin_lock_init(&srcimp_mgr->mgr_lock);
spin_lock_init(&srcimp_mgr->imap_lock);
INIT_LIST_HEAD(&srcimp_mgr->imappers);
- entry = kzalloc(sizeof(*entry), GFP_KERNEL);
+ entry = kzalloc_obj(*entry, GFP_KERNEL);
if (!entry) {
err = -ENOMEM;
goto error2;
diff --git a/sound/pci/ctxfi/cttimer.c b/sound/pci/ctxfi/cttimer.c
index 609b10320ff7..53d16f575c38 100644
--- a/sound/pci/ctxfi/cttimer.c
+++ b/sound/pci/ctxfi/cttimer.c
@@ -390,7 +390,7 @@ struct ct_timer *ct_timer_new(struct ct_atc *atc)
struct ct_timer *atimer;
struct hw *hw;
- atimer = kzalloc(sizeof(*atimer), GFP_KERNEL);
+ atimer = kzalloc_obj(*atimer, GFP_KERNEL);
if (!atimer)
return NULL;
spin_lock_init(&atimer->lock);
diff --git a/sound/pci/ctxfi/ctvmem.c b/sound/pci/ctxfi/ctvmem.c
index 823d6e240a07..316072863dbf 100644
--- a/sound/pci/ctxfi/ctvmem.c
+++ b/sound/pci/ctxfi/ctvmem.c
@@ -55,7 +55,7 @@ get_vm_block(struct ct_vm *vm, unsigned int size, struct ct_atc *atc)
return entry;
}
- block = kzalloc(sizeof(*block), GFP_KERNEL);
+ block = kzalloc_obj(*block, GFP_KERNEL);
if (!block)
return NULL;
@@ -170,7 +170,7 @@ int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci)
*rvm = NULL;
- vm = kzalloc(sizeof(*vm), GFP_KERNEL);
+ vm = kzalloc_obj(*vm, GFP_KERNEL);
if (!vm)
return -ENOMEM;
@@ -195,7 +195,7 @@ int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci)
vm->get_ptp_phys = ct_get_ptp_phys;
INIT_LIST_HEAD(&vm->unused);
INIT_LIST_HEAD(&vm->used);
- block = kzalloc(sizeof(*block), GFP_KERNEL);
+ block = kzalloc_obj(*block, GFP_KERNEL);
if (NULL != block) {
block->addr = 0;
block->size = vm->size;
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 8b7b6838106f..fdf309633c8a 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -265,7 +265,7 @@ static int pcm_open(struct snd_pcm_substream *substream,
chip = snd_pcm_substream_chip(substream);
runtime = substream->runtime;
- pipe = kzalloc(sizeof(struct audiopipe), GFP_KERNEL);
+ pipe = kzalloc_obj(struct audiopipe, GFP_KERNEL);
if (!pipe)
return -ENOMEM;
pipe->index = -1; /* Not configured yet */
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index 9607a0f7174b..e79f773941cd 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -367,7 +367,7 @@ static int snd_emu10k1x_playback_open(struct snd_pcm_substream *substream)
if (err < 0)
return err;
- epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
+ epcm = kzalloc_obj(*epcm, GFP_KERNEL);
if (epcm == NULL)
return -ENOMEM;
epcm->emu = chip;
@@ -547,7 +547,7 @@ static int snd_emu10k1x_pcm_open_capture(struct snd_pcm_substream *substream)
if (err < 0)
return err;
- epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
+ epcm = kzalloc_obj(*epcm, GFP_KERNEL);
if (epcm == NULL)
return -ENOMEM;
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 37af7bf76347..a9c786fe638a 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -776,7 +776,7 @@ static int snd_emu10k1_verify_controls(struct snd_emu10k1 *emu,
if (snd_emu10k1_look_for_ctl(emu, &id) == NULL)
return -ENOENT;
}
- gctl = kmalloc(sizeof(*gctl), GFP_KERNEL);
+ gctl = kmalloc_obj(*gctl, GFP_KERNEL);
if (! gctl)
return -ENOMEM;
err = 0;
@@ -864,9 +864,9 @@ static int snd_emu10k1_add_controls(struct snd_emu10k1 *emu,
struct snd_ctl_elem_value *val;
int err = 0;
- val = kmalloc(sizeof(*val), GFP_KERNEL);
- gctl = kmalloc(sizeof(*gctl), GFP_KERNEL);
- nctl = kmalloc(sizeof(*nctl), GFP_KERNEL);
+ val = kmalloc_obj(*val, GFP_KERNEL);
+ gctl = kmalloc_obj(*gctl, GFP_KERNEL);
+ nctl = kmalloc_obj(*nctl, GFP_KERNEL);
if (!val || !gctl || !nctl) {
err = -ENOMEM;
goto __error;
@@ -914,7 +914,7 @@ static int snd_emu10k1_add_controls(struct snd_emu10k1 *emu,
nctl->max = gctl->max;
nctl->translation = gctl->translation;
if (ctl == NULL) {
- ctl = kmalloc(sizeof(*ctl), GFP_KERNEL);
+ ctl = kmalloc_obj(*ctl, GFP_KERNEL);
if (ctl == NULL) {
err = -ENOMEM;
kfree(knew.tlv.p);
@@ -980,7 +980,7 @@ static int snd_emu10k1_list_controls(struct snd_emu10k1 *emu,
struct snd_emu10k1_fx8010_ctl *ctl;
struct snd_ctl_elem_id *id;
- gctl = kmalloc(sizeof(*gctl), GFP_KERNEL);
+ gctl = kmalloc_obj(*gctl, GFP_KERNEL);
if (! gctl)
return -ENOMEM;
@@ -1282,16 +1282,15 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
u32 *gpr_map;
err = -ENOMEM;
- icode = kzalloc(sizeof(*icode), GFP_KERNEL);
+ icode = kzalloc_obj(*icode, GFP_KERNEL);
if (!icode)
return err;
- icode->gpr_map = kcalloc(512 + 256 + 256 + 2 * 1024,
- sizeof(u_int32_t), GFP_KERNEL);
+ icode->gpr_map = kzalloc_objs(u_int32_t, 512 + 256 + 256 + 2 * 1024,
+ GFP_KERNEL);
if (!icode->gpr_map)
goto __err_gpr;
- controls = kcalloc(SND_EMU10K1_GPR_CONTROLS,
- sizeof(*controls), GFP_KERNEL);
+ controls = kzalloc_objs(*controls, SND_EMU10K1_GPR_CONTROLS, GFP_KERNEL);
if (!controls)
goto __err_ctrls;
@@ -1800,22 +1799,21 @@ static int _snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
u32 *gpr_map;
err = -ENOMEM;
- icode = kzalloc(sizeof(*icode), GFP_KERNEL);
+ icode = kzalloc_obj(*icode, GFP_KERNEL);
if (!icode)
return err;
- icode->gpr_map = kcalloc(256 + 160 + 160 + 2 * 512,
- sizeof(u_int32_t), GFP_KERNEL);
+ icode->gpr_map = kzalloc_objs(u_int32_t, 256 + 160 + 160 + 2 * 512,
+ GFP_KERNEL);
if (!icode->gpr_map)
goto __err_gpr;
- controls = kcalloc(SND_EMU10K1_GPR_CONTROLS,
- sizeof(struct snd_emu10k1_fx8010_control_gpr),
- GFP_KERNEL);
+ controls = kzalloc_objs(struct snd_emu10k1_fx8010_control_gpr,
+ SND_EMU10K1_GPR_CONTROLS, GFP_KERNEL);
if (!controls)
goto __err_ctrls;
- ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL);
+ ipcm = kzalloc_obj(*ipcm, GFP_KERNEL);
if (!ipcm)
goto __err_ipcm;
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 071c75ba81fd..1a0fd2014691 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -1132,7 +1132,7 @@ static int snd_emu10k1_efx_playback_open(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
int i, j, err;
- epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
+ epcm = kzalloc_obj(*epcm, GFP_KERNEL);
if (epcm == NULL)
return -ENOMEM;
epcm->emu = emu;
@@ -1171,7 +1171,7 @@ static int snd_emu10k1_playback_open(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
int i, err, sample_rate;
- epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
+ epcm = kzalloc_obj(*epcm, GFP_KERNEL);
if (epcm == NULL)
return -ENOMEM;
epcm->emu = emu;
@@ -1222,7 +1222,7 @@ static int snd_emu10k1_capture_open(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_emu10k1_pcm *epcm;
- epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
+ epcm = kzalloc_obj(*epcm, GFP_KERNEL);
if (epcm == NULL)
return -ENOMEM;
epcm->emu = emu;
@@ -1259,7 +1259,7 @@ static int snd_emu10k1_capture_mic_open(struct snd_pcm_substream *substream)
struct snd_emu10k1_pcm *epcm;
struct snd_pcm_runtime *runtime = substream->runtime;
- epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
+ epcm = kzalloc_obj(*epcm, GFP_KERNEL);
if (epcm == NULL)
return -ENOMEM;
epcm->emu = emu;
@@ -1299,7 +1299,7 @@ static int snd_emu10k1_capture_efx_open(struct snd_pcm_substream *substream)
int nefx = emu->audigy ? 64 : 32;
int idx, err;
- epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
+ epcm = kzalloc_obj(*epcm, GFP_KERNEL);
if (epcm == NULL)
return -ENOMEM;
epcm->emu = emu;
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 51aee2c4d461..6650f0192281 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -1307,7 +1307,7 @@ static struct esm_memory *snd_es1968_new_memory(struct es1968 *chip, int size)
__found:
if (buf->buf.bytes > size) {
- struct esm_memory *chunk = kmalloc(sizeof(*chunk), GFP_KERNEL);
+ struct esm_memory *chunk = kmalloc_obj(*chunk, GFP_KERNEL);
if (chunk == NULL)
return NULL;
chunk->buf = buf->buf;
@@ -1385,7 +1385,7 @@ snd_es1968_init_dmabuf(struct es1968 *chip)
INIT_LIST_HEAD(&chip->buf_list);
/* allocate an empty chunk */
- chunk = kmalloc(sizeof(*chunk), GFP_KERNEL);
+ chunk = kmalloc_obj(*chunk, GFP_KERNEL);
if (chunk == NULL) {
snd_es1968_free_dmabuf(chip);
return -ENOMEM;
@@ -1488,7 +1488,7 @@ static int snd_es1968_playback_open(struct snd_pcm_substream *substream)
if (apu1 < 0)
return apu1;
- es = kzalloc(sizeof(*es), GFP_KERNEL);
+ es = kzalloc_obj(*es, GFP_KERNEL);
if (!es) {
snd_es1968_free_apu_pair(chip, apu1);
return -ENOMEM;
@@ -1529,7 +1529,7 @@ static int snd_es1968_capture_open(struct snd_pcm_substream *substream)
return apu2;
}
- es = kzalloc(sizeof(*es), GFP_KERNEL);
+ es = kzalloc_obj(*es, GFP_KERNEL);
if (!es) {
snd_es1968_free_apu_pair(chip, apu1);
snd_es1968_free_apu_pair(chip, apu2);
diff --git a/sound/pci/ice1712/ak4xxx.c b/sound/pci/ice1712/ak4xxx.c
index cad33a2f26bc..e82bfc02599e 100644
--- a/sound/pci/ice1712/ak4xxx.c
+++ b/sound/pci/ice1712/ak4xxx.c
@@ -115,7 +115,7 @@ int snd_ice1712_akm4xxx_init(struct snd_akm4xxx *ak, const struct snd_akm4xxx *t
struct snd_ak4xxx_private *priv;
if (_priv != NULL) {
- priv = kmalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kmalloc_obj(*priv, GFP_KERNEL);
if (priv == NULL)
return -ENOMEM;
*priv = *_priv;
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c
index b4c9e7d11609..92c4950137b0 100644
--- a/sound/pci/ice1712/aureon.c
+++ b/sound/pci/ice1712/aureon.c
@@ -2076,7 +2076,7 @@ static int aureon_init(struct snd_ice1712 *ice)
struct aureon_spec *spec;
int i, err;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
ice->spec = spec;
@@ -2091,7 +2091,7 @@ static int aureon_init(struct snd_ice1712 *ice)
}
/* to remember the register values of CS8415 */
- ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
+ ice->akm = kzalloc_obj(struct snd_akm4xxx, GFP_KERNEL);
if (!ice->akm)
return -ENOMEM;
ice->akm_codecs = 1;
diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
index e5a9585cba4c..5ea80bd596e6 100644
--- a/sound/pci/ice1712/delta.c
+++ b/sound/pci/ice1712/delta.c
@@ -707,7 +707,7 @@ static int snd_ice1712_delta_init(struct snd_ice1712 *ice)
}
/* second stage of initialization, analog parts and others */
- ak = ice->akm = kmalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
+ ak = ice->akm = kmalloc_obj(struct snd_akm4xxx, GFP_KERNEL);
if (! ak)
return -ENOMEM;
ice->akm_codecs = 1;
diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c
index 1dffcb011deb..43a0a569de1b 100644
--- a/sound/pci/ice1712/ews.c
+++ b/sound/pci/ice1712/ews.c
@@ -431,7 +431,7 @@ static int snd_ice1712_ews_init(struct snd_ice1712 *ice)
break;
}
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
ice->spec = spec;
@@ -530,7 +530,7 @@ static int snd_ice1712_ews_init(struct snd_ice1712 *ice)
}
/* analog section */
- ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
+ ak = ice->akm = kzalloc_obj(struct snd_akm4xxx, GFP_KERNEL);
if (! ak)
return -ENOMEM;
ice->akm_codecs = 1;
diff --git a/sound/pci/ice1712/hoontech.c b/sound/pci/ice1712/hoontech.c
index 071f94dc7390..ab651526aba9 100644
--- a/sound/pci/ice1712/hoontech.c
+++ b/sound/pci/ice1712/hoontech.c
@@ -156,7 +156,7 @@ static int hoontech_init(struct snd_ice1712 *ice, bool staudio)
ice->num_total_dacs = 8;
ice->num_total_adcs = 8;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
ice->spec = spec;
@@ -301,7 +301,7 @@ static int snd_ice1712_value_init(struct snd_ice1712 *ice)
ice->num_total_adcs = 2;
/* analog section */
- ak = ice->akm = kmalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
+ ak = ice->akm = kmalloc_obj(struct snd_akm4xxx, GFP_KERNEL);
if (! ak)
return -ENOMEM;
ice->akm_codecs = 1;
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c
index d679842ae1bd..10f0eb7b347d 100644
--- a/sound/pci/ice1712/juli.c
+++ b/sound/pci/ice1712/juli.c
@@ -560,7 +560,7 @@ static int juli_init(struct snd_ice1712 *ice)
struct juli_spec *spec;
struct snd_akm4xxx *ak;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
ice->spec = spec;
@@ -594,7 +594,7 @@ static int juli_init(struct snd_ice1712 *ice)
ice->num_total_dacs = 2;
ice->num_total_adcs = 2;
- ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
+ ice->akm = kzalloc_obj(struct snd_akm4xxx, GFP_KERNEL);
ak = ice->akm;
if (!ak)
return -ENOMEM;
diff --git a/sound/pci/ice1712/maya44.c b/sound/pci/ice1712/maya44.c
index 551f478c59c4..b854fec347c4 100644
--- a/sound/pci/ice1712/maya44.c
+++ b/sound/pci/ice1712/maya44.c
@@ -668,7 +668,7 @@ static int maya44_init(struct snd_ice1712 *ice)
int i;
struct snd_maya44 *chip;
- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = kzalloc_obj(*chip, GFP_KERNEL);
if (!chip)
return -ENOMEM;
mutex_init(&chip->mutex);
diff --git a/sound/pci/ice1712/phase.c b/sound/pci/ice1712/phase.c
index 151b740ce66d..00f97b87b06c 100644
--- a/sound/pci/ice1712/phase.c
+++ b/sound/pci/ice1712/phase.c
@@ -125,7 +125,7 @@ static int phase22_init(struct snd_ice1712 *ice)
}
/* Initialize analog chips */
- ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
+ ice->akm = kzalloc_obj(struct snd_akm4xxx, GFP_KERNEL);
ak = ice->akm;
if (!ak)
return -ENOMEM;
@@ -411,13 +411,13 @@ static int phase28_init(struct snd_ice1712 *ice)
ice->num_total_dacs = 8;
ice->num_total_adcs = 2;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
ice->spec = spec;
/* Initialize analog chips */
- ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
+ ice->akm = kzalloc_obj(struct snd_akm4xxx, GFP_KERNEL);
ak = ice->akm;
if (!ak)
return -ENOMEM;
diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c
index 557473f0d59e..80f7bb3af420 100644
--- a/sound/pci/ice1712/pontis.c
+++ b/sound/pci/ice1712/pontis.c
@@ -728,7 +728,7 @@ static int pontis_init(struct snd_ice1712 *ice)
ice->num_total_adcs = 2;
/* to remember the register values */
- ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
+ ice->akm = kzalloc_obj(struct snd_akm4xxx, GFP_KERNEL);
if (! ice->akm)
return -ENOMEM;
ice->akm_codecs = 1;
diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c
index cd7db2b65b51..039ead80dd64 100644
--- a/sound/pci/ice1712/prodigy192.c
+++ b/sound/pci/ice1712/prodigy192.c
@@ -713,7 +713,7 @@ static int prodigy192_init(struct snd_ice1712 *ice)
ice->num_total_adcs = 2;
ice->vt1720 = 0; /* ice1724, e.g. 23 GPIOs */
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
ice->spec = spec;
diff --git a/sound/pci/ice1712/prodigy_hifi.c b/sound/pci/ice1712/prodigy_hifi.c
index eac233093865..105409daf071 100644
--- a/sound/pci/ice1712/prodigy_hifi.c
+++ b/sound/pci/ice1712/prodigy_hifi.c
@@ -1060,12 +1060,12 @@ static int prodigy_hifi_init(struct snd_ice1712 *ice)
ice->gpio.saved[0] = 0;
/* to remember the register values */
- ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
+ ice->akm = kzalloc_obj(struct snd_akm4xxx, GFP_KERNEL);
if (! ice->akm)
return -ENOMEM;
ice->akm_codecs = 1;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
ice->spec = spec;
@@ -1143,12 +1143,12 @@ static int prodigy_hd2_init(struct snd_ice1712 *ice)
ice->gpio.saved[0] = 0;
/* to remember the register values */
- ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
+ ice->akm = kzalloc_obj(struct snd_akm4xxx, GFP_KERNEL);
if (! ice->akm)
return -ENOMEM;
ice->akm_codecs = 1;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
ice->spec = spec;
diff --git a/sound/pci/ice1712/psc724.c b/sound/pci/ice1712/psc724.c
index 0818e42c94ca..bb69d5173983 100644
--- a/sound/pci/ice1712/psc724.c
+++ b/sound/pci/ice1712/psc724.c
@@ -383,7 +383,7 @@ static int psc724_init(struct snd_ice1712 *ice)
{
struct psc724_spec *spec;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
ice->spec = spec;
diff --git a/sound/pci/ice1712/quartet.c b/sound/pci/ice1712/quartet.c
index 099601edf1d0..a4f13a3ed6cf 100644
--- a/sound/pci/ice1712/quartet.c
+++ b/sound/pci/ice1712/quartet.c
@@ -969,7 +969,7 @@ static int qtet_init(struct snd_ice1712 *ice)
val = inb(ICEMT1724(ice, RATE));
outb(val | VT1724_SPDIF_MASTER, ICEMT1724(ice, RATE));
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
/* qtet is clocked by Xilinx array */
@@ -1005,7 +1005,7 @@ static int qtet_init(struct snd_ice1712 *ice)
ice->num_total_dacs = 2;
ice->num_total_adcs = 2;
- ice->akm = kcalloc(2, sizeof(struct snd_akm4xxx), GFP_KERNEL);
+ ice->akm = kzalloc_objs(struct snd_akm4xxx, 2, GFP_KERNEL);
ak = ice->akm;
if (!ak)
return -ENOMEM;
diff --git a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c
index bcf114152dfd..37556ff6fb36 100644
--- a/sound/pci/ice1712/revo.c
+++ b/sound/pci/ice1712/revo.c
@@ -147,7 +147,7 @@ static int revo51_i2c_init(struct snd_ice1712 *ice,
struct revo51_spec *spec;
int err;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
ice->spec = spec;
@@ -470,7 +470,7 @@ static int ap192_ak4114_init(struct snd_ice1712 *ice)
int err;
struct revo51_spec *spec;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
ice->spec = spec;
@@ -515,7 +515,7 @@ static int revo_init(struct snd_ice1712 *ice)
}
/* second stage of initialization, analog parts and others */
- ak = ice->akm = kcalloc(2, sizeof(struct snd_akm4xxx), GFP_KERNEL);
+ ak = ice->akm = kzalloc_objs(struct snd_akm4xxx, 2, GFP_KERNEL);
if (! ak)
return -ENOMEM;
switch (ice->eeprom.subvendor) {
diff --git a/sound/pci/ice1712/se.c b/sound/pci/ice1712/se.c
index ffa9d8860a5a..09f5085d2dde 100644
--- a/sound/pci/ice1712/se.c
+++ b/sound/pci/ice1712/se.c
@@ -660,7 +660,7 @@ static int se_init(struct snd_ice1712 *ice)
{
struct se_spec *spec;
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
ice->spec = spec;
diff --git a/sound/pci/ice1712/wtm.c b/sound/pci/ice1712/wtm.c
index 57a79536e7ba..0c961b588cd2 100644
--- a/sound/pci/ice1712/wtm.c
+++ b/sound/pci/ice1712/wtm.c
@@ -579,7 +579,7 @@ static int wtm_init(struct snd_ice1712 *ice)
ice->force_rdma1 = 1;
/*init mutex for dac mute conflict*/
- spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ spec = kzalloc_obj(*spec, GFP_KERNEL);
if (!spec)
return -ENOMEM;
ice->spec = spec;
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index c6319e75beab..bcf36b102f6f 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -255,7 +255,7 @@ snd_mixart_add_ref_pipe(struct snd_mixart *chip, int pcm_number, int capture,
"add_ref_pipe audio chip(%d) pcm(%d)\n",
chip->chip_idx, pcm_number);
- buf = kmalloc(sizeof(*buf), GFP_KERNEL);
+ buf = kmalloc_obj(*buf, GFP_KERNEL);
if (!buf)
return NULL;
@@ -1017,7 +1017,7 @@ static int snd_mixart_create(struct mixart_mgr *mgr, struct snd_card *card, int
.dev_free = snd_mixart_chip_dev_free,
};
- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = kzalloc_obj(*chip, GFP_KERNEL);
if (!chip)
return -ENOMEM;
@@ -1243,7 +1243,7 @@ static int snd_mixart_probe(struct pci_dev *pci,
/*
*/
- mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
+ mgr = kzalloc_obj(*mgr, GFP_KERNEL);
if (! mgr) {
pci_disable_device(pci);
return -ENOMEM;
diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c
index 689c0f995a9c..9b19c83a26c5 100644
--- a/sound/pci/mixart/mixart_hwdep.c
+++ b/sound/pci/mixart/mixart_hwdep.c
@@ -135,9 +135,9 @@ static int mixart_enum_connectors(struct mixart_mgr *mgr)
struct mixart_audio_info_req *audio_info_req;
struct mixart_audio_info_resp *audio_info;
- connector = kmalloc(sizeof(*connector), GFP_KERNEL);
- audio_info_req = kmalloc(sizeof(*audio_info_req), GFP_KERNEL);
- audio_info = kmalloc(sizeof(*audio_info), GFP_KERNEL);
+ connector = kmalloc_obj(*connector, GFP_KERNEL);
+ audio_info_req = kmalloc_obj(*audio_info_req, GFP_KERNEL);
+ audio_info = kmalloc_obj(*audio_info, GFP_KERNEL);
if (! connector || ! audio_info_req || ! audio_info) {
err = -ENOMEM;
goto __error;
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index 83066d08367e..66e71bdfbc77 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -1163,7 +1163,7 @@ static int pcxhr_create(struct pcxhr_mgr *mgr,
.dev_free = pcxhr_chip_dev_free,
};
- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = kzalloc_obj(*chip, GFP_KERNEL);
if (!chip)
return -ENOMEM;
@@ -1488,7 +1488,7 @@ static int pcxhr_probe(struct pci_dev *pci,
}
/* alloc card manager */
- mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
+ mgr = kzalloc_obj(*mgr, GFP_KERNEL);
if (! mgr) {
pci_disable_device(pci);
return -ENOMEM;
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index f91fe64bf4f9..8217a42c5bb7 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1595,7 +1595,7 @@ static int snd_riptide_playback_open(struct snd_pcm_substream *substream)
chip->playback_substream[sub_num] = substream;
runtime->hw = snd_riptide_playback;
- data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL);
+ data = kzalloc_obj(struct pcmhw, GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
data->paths = lbus_play_paths[sub_num];
@@ -1618,7 +1618,7 @@ static int snd_riptide_capture_open(struct snd_pcm_substream *substream)
chip->capture_substream = substream;
runtime->hw = snd_riptide_capture;
- data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL);
+ data = kzalloc_obj(struct pcmhw, GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
data->paths = lbus_rec_path;
@@ -1768,7 +1768,7 @@ static int snd_riptide_initialize(struct snd_riptide *chip)
cif = chip->cif;
if (!cif) {
- cif = kzalloc(sizeof(struct cmdif), GFP_KERNEL);
+ cif = kzalloc_obj(struct cmdif, GFP_KERNEL);
if (!cif)
return -ENOMEM;
cif->dev = chip->card->dev;
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 3ba5bdc96d9d..2978036aa8c5 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -6671,7 +6671,7 @@ static int snd_hdspm_create(struct snd_card *card,
if (hdspm_read(hdspm, HDSPM_statusRegister2) &
HDSPM_s2_tco_detect) {
hdspm->midiPorts++;
- hdspm->tco = kzalloc(sizeof(*hdspm->tco), GFP_KERNEL);
+ hdspm->tco = kzalloc_obj(*hdspm->tco, GFP_KERNEL);
if (hdspm->tco)
hdspm_tco_write(hdspm);
@@ -6685,7 +6685,7 @@ static int snd_hdspm_create(struct snd_card *card,
case AES32:
if (hdspm_read(hdspm, HDSPM_statusRegister) & HDSPM_tco_detect) {
hdspm->midiPorts++;
- hdspm->tco = kzalloc(sizeof(*hdspm->tco), GFP_KERNEL);
+ hdspm->tco = kzalloc_obj(*hdspm->tco, GFP_KERNEL);
if (hdspm->tco)
hdspm_tco_write(hdspm);
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 55515c58b8aa..b0f1433e530f 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -2888,7 +2888,7 @@ static int snd_trident_mixer(struct snd_trident *trident, int pcm_spdif_device)
.read = snd_trident_codec_read,
};
- uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
+ uctl = kzalloc_obj(*uctl, GFP_KERNEL);
if (!uctl)
return -ENOMEM;
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 2b0f9e38863e..0290bf6b089d 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -423,9 +423,8 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
return -ENOMEM;
}
if (! dev->idx_table) {
- dev->idx_table = kmalloc_array(VIA_TABLE_SIZE,
- sizeof(*dev->idx_table),
- GFP_KERNEL);
+ dev->idx_table = kmalloc_objs(*dev->idx_table, VIA_TABLE_SIZE,
+ GFP_KERNEL);
if (! dev->idx_table)
return -ENOMEM;
}
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 6ce2cd88cda6..94430e87791d 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -278,9 +278,8 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
return -ENOMEM;
}
if (! dev->idx_table) {
- dev->idx_table = kmalloc_array(VIA_TABLE_SIZE,
- sizeof(*dev->idx_table),
- GFP_KERNEL);
+ dev->idx_table = kmalloc_objs(*dev->idx_table, VIA_TABLE_SIZE,
+ GFP_KERNEL);
if (! dev->idx_table)
return -ENOMEM;
}
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index eb373d9395e3..dc6f603160ac 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -864,7 +864,7 @@ static int snd_ymfpci_playback_open_1(struct snd_pcm_substream *substream)
if (err < 0)
return err;
- ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
+ ypcm = kzalloc_obj(*ypcm, GFP_KERNEL);
if (ypcm == NULL)
return -ENOMEM;
ypcm->chip = chip;
@@ -990,7 +990,7 @@ static int snd_ymfpci_capture_open(struct snd_pcm_substream *substream,
if (err < 0)
return err;
- ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
+ ypcm = kzalloc_obj(*ypcm, GFP_KERNEL);
if (ypcm == NULL)
return -ENOMEM;
ypcm->chip = chip;
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
index a104baac3a94..c0ae099963c8 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
@@ -142,7 +142,7 @@ struct snd_pdacf *snd_pdacf_create(struct snd_card *card)
{
struct snd_pdacf *chip;
- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = kzalloc_obj(*chip, GFP_KERNEL);
if (chip == NULL)
return NULL;
chip->card = card;
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index c231a9d6d1de..5d5fccb71d70 100644
--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -896,7 +896,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
chip->revision = (in_le32(&chip->awacs->codec_stat) >> 12) & 0xf;
#ifdef PMAC_AMP_AVAIL
if (chip->revision == 3 && chip->has_iic && CHECK_CUDA_AMP()) {
- struct awacs_amp *amp = kzalloc(sizeof(*amp), GFP_KERNEL);
+ struct awacs_amp *amp = kzalloc_obj(*amp, GFP_KERNEL);
if (! amp)
return -ENOMEM;
chip->mixer_data = amp;
diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c
index ab2468790b0c..5e5370e83d56 100644
--- a/sound/ppc/beep.c
+++ b/sound/ppc/beep.c
@@ -208,7 +208,7 @@ int snd_pmac_attach_beep(struct snd_pmac *chip)
void *dmabuf;
int err = -ENOMEM;
- beep = kzalloc(sizeof(*beep), GFP_KERNEL);
+ beep = kzalloc_obj(*beep, GFP_KERNEL);
if (! beep)
return -ENOMEM;
dmabuf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4,
diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c
index a74114225b67..12829f724d86 100644
--- a/sound/ppc/daca.c
+++ b/sound/ppc/daca.c
@@ -244,7 +244,7 @@ int snd_pmac_daca_init(struct snd_pmac *chip)
request_module("i2c-powermac");
- mix = kzalloc(sizeof(*mix), GFP_KERNEL);
+ mix = kzalloc_obj(*mix, GFP_KERNEL);
if (! mix)
return -ENOMEM;
chip->mixer_data = mix;
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 6d7dab26ddf2..1384484fd996 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -1143,7 +1143,7 @@ int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
*chip_return = NULL;
- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = kzalloc_obj(*chip, GFP_KERNEL);
if (chip == NULL)
return -ENOMEM;
chip->card = card;
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index 3c09660e1522..6cc51dcecb7e 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -1348,7 +1348,7 @@ int snd_pmac_tumbler_init(struct snd_pmac *chip)
request_module("i2c-powermac");
- mix = kzalloc(sizeof(*mix), GFP_KERNEL);
+ mix = kzalloc_obj(*mix, GFP_KERNEL);
if (! mix)
return -ENOMEM;
mix->headphone_irq = -1;
diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index fa81bfba59c1..f6a80f04d043 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -330,7 +330,7 @@ static int snd_aicapcm_pcm_open(struct snd_pcm_substream
if (!enable)
return -ENOENT;
dreamcastcard = substream->pcm->private_data;
- channel = kmalloc(sizeof(struct aica_channel), GFP_KERNEL);
+ channel = kmalloc_obj(struct aica_channel, GFP_KERNEL);
if (!channel)
return -ENOMEM;
/* set defaults for channel */
@@ -559,7 +559,7 @@ static int snd_aica_probe(struct platform_device *devptr)
{
int err;
struct snd_card_aica *dreamcastcard;
- dreamcastcard = kzalloc(sizeof(struct snd_card_aica), GFP_KERNEL);
+ dreamcastcard = kzalloc_obj(struct snd_card_aica, GFP_KERNEL);
if (unlikely(!dreamcastcard))
return -ENOMEM;
err = snd_card_new(&devptr->dev, index, SND_AICA_DRIVER,
diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c
index 164f91240d02..e0ba12662da1 100644
--- a/sound/sh/sh_dac_audio.c
+++ b/sound/sh/sh_dac_audio.c
@@ -306,7 +306,7 @@ static int snd_sh_dac_create(struct snd_card *card,
*rchip = NULL;
- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = kzalloc_obj(*chip, GFP_KERNEL);
if (chip == NULL)
return -ENOMEM;
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;
diff --git a/sound/sound_core.c b/sound/sound_core.c
index d81fed1c1226..741e62cffe6e 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -238,7 +238,7 @@ static DEFINE_SPINLOCK(sound_loader_lock);
static int sound_insert_unit(struct sound_unit **list, const struct file_operations *fops, int index, int low, int top, const char *name, umode_t mode, struct device *dev)
{
- struct sound_unit *s = kmalloc(sizeof(*s), GFP_KERNEL);
+ struct sound_unit *s = kmalloc_obj(*s, GFP_KERNEL);
int r;
if (!s)
diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c
index 01444fc960d0..f690e8f812d9 100644
--- a/sound/synth/emux/emux.c
+++ b/sound/synth/emux/emux.c
@@ -26,7 +26,7 @@ int snd_emux_new(struct snd_emux **remu)
struct snd_emux *emu;
*remu = NULL;
- emu = kzalloc(sizeof(*emu), GFP_KERNEL);
+ emu = kzalloc_obj(*emu, GFP_KERNEL);
if (emu == NULL)
return -ENOMEM;
@@ -86,8 +86,8 @@ int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, ch
emu->card = card;
emu->name = kstrdup_const(name, GFP_KERNEL);
- emu->voices = kcalloc(emu->max_voices, sizeof(struct snd_emux_voice),
- GFP_KERNEL);
+ emu->voices = kzalloc_objs(struct snd_emux_voice, emu->max_voices,
+ GFP_KERNEL);
if (emu->name == NULL || emu->voices == NULL)
return -ENOMEM;
diff --git a/sound/synth/emux/emux_effect.c b/sound/synth/emux/emux_effect.c
index bfe383fa90ba..dacbdf8cd39a 100644
--- a/sound/synth/emux/emux_effect.c
+++ b/sound/synth/emux/emux_effect.c
@@ -272,8 +272,8 @@ void
snd_emux_create_effect(struct snd_emux_port *p)
{
int i;
- p->effect = kcalloc(p->chset.max_channels,
- sizeof(struct snd_emux_effect_table), GFP_KERNEL);
+ p->effect = kzalloc_objs(struct snd_emux_effect_table,
+ p->chset.max_channels, GFP_KERNEL);
if (p->effect) {
for (i = 0; i < p->chset.max_channels; i++)
p->chset.channels[i].private = p->effect + i;
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c
index 9d63ac006aa5..9a279d07364d 100644
--- a/sound/synth/emux/emux_seq.c
+++ b/sound/synth/emux/emux_seq.c
@@ -132,12 +132,12 @@ snd_emux_create_port(struct snd_emux *emu, char *name,
int i, type, cap;
/* Allocate structures for this channel */
- p = kzalloc(sizeof(*p), GFP_KERNEL);
+ p = kzalloc_obj(*p, GFP_KERNEL);
if (!p)
return NULL;
- p->chset.channels = kcalloc(max_channels, sizeof(*p->chset.channels),
- GFP_KERNEL);
+ p->chset.channels = kzalloc_objs(*p->chset.channels, max_channels,
+ GFP_KERNEL);
if (!p->chset.channels) {
kfree(p);
return NULL;
@@ -351,7 +351,7 @@ int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card)
if (emu->midi_ports <= 0)
return 0;
- emu->vmidi = kcalloc(emu->midi_ports, sizeof(*emu->vmidi), GFP_KERNEL);
+ emu->vmidi = kzalloc_objs(*emu->vmidi, emu->midi_ports, GFP_KERNEL);
if (!emu->vmidi)
return -ENOMEM;
diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c
index 59f3b1b6df4a..01996637d257 100644
--- a/sound/synth/emux/soundfont.c
+++ b/sound/synth/emux/soundfont.c
@@ -230,7 +230,7 @@ newsf(struct snd_sf_list *sflist, int type, char *name)
}
/* not found -- create a new one */
- sf = kzalloc(sizeof(*sf), GFP_KERNEL);
+ sf = kzalloc_obj(*sf, GFP_KERNEL);
if (sf == NULL)
return NULL;
sf->id = sflist->fonts_size;
@@ -309,7 +309,7 @@ sf_zone_new(struct snd_sf_list *sflist, struct snd_soundfont *sf)
{
struct snd_sf_zone *zp;
- zp = kzalloc(sizeof(*zp), GFP_KERNEL);
+ zp = kzalloc_obj(*zp, GFP_KERNEL);
if (!zp)
return NULL;
zp->next = sf->zones;
@@ -342,7 +342,7 @@ sf_sample_new(struct snd_sf_list *sflist, struct snd_soundfont *sf)
{
struct snd_sf_sample *sp;
- sp = kzalloc(sizeof(*sp), GFP_KERNEL);
+ sp = kzalloc_obj(*sp, GFP_KERNEL);
if (!sp)
return NULL;
@@ -1391,7 +1391,7 @@ snd_sf_new(struct snd_sf_callback *callback, struct snd_util_memhdr *hdr)
{
struct snd_sf_list *sflist;
- sflist = kzalloc(sizeof(*sflist), GFP_KERNEL);
+ sflist = kzalloc_obj(*sflist, GFP_KERNEL);
if (!sflist)
return NULL;
diff --git a/sound/synth/util_mem.c b/sound/synth/util_mem.c
index 2fd577c2a8eb..36fa4fc9632c 100644
--- a/sound/synth/util_mem.c
+++ b/sound/synth/util_mem.c
@@ -26,7 +26,7 @@ snd_util_memhdr_new(int memsize)
{
struct snd_util_memhdr *hdr;
- hdr = kzalloc(sizeof(*hdr), GFP_KERNEL);
+ hdr = kzalloc_obj(*hdr, GFP_KERNEL);
if (hdr == NULL)
return NULL;
hdr->size = memsize;
diff --git a/sound/usb/6fire/comm.c b/sound/usb/6fire/comm.c
index 49629d4bb327..b7378a514e21 100644
--- a/sound/usb/6fire/comm.c
+++ b/sound/usb/6fire/comm.c
@@ -141,8 +141,7 @@ static int usb6fire_comm_write16(struct comm_runtime *rt, u8 request,
int usb6fire_comm_init(struct sfire_chip *chip)
{
- struct comm_runtime *rt = kzalloc(sizeof(struct comm_runtime),
- GFP_KERNEL);
+ struct comm_runtime *rt = kzalloc_obj(struct comm_runtime, GFP_KERNEL);
struct urb *urb;
int ret;
diff --git a/sound/usb/6fire/control.c b/sound/usb/6fire/control.c
index 9bd8dcbb68e4..0e8be4efbf44 100644
--- a/sound/usb/6fire/control.c
+++ b/sound/usb/6fire/control.c
@@ -551,8 +551,8 @@ int usb6fire_control_init(struct sfire_chip *chip)
{
int i;
int ret;
- struct control_runtime *rt = kzalloc(sizeof(struct control_runtime),
- GFP_KERNEL);
+ struct control_runtime *rt = kzalloc_obj(struct control_runtime,
+ GFP_KERNEL);
struct comm_runtime *comm_rt = chip->comm;
if (!rt)
diff --git a/sound/usb/6fire/firmware.c b/sound/usb/6fire/firmware.c
index cc8caec946cc..6707fb8a2d1e 100644
--- a/sound/usb/6fire/firmware.c
+++ b/sound/usb/6fire/firmware.c
@@ -195,8 +195,7 @@ static int usb6fire_fw_ezusb_upload(
u8 data;
struct usb_device *device = interface_to_usbdev(intf);
const struct firmware *fw = NULL;
- struct ihex_record *rec = kmalloc(sizeof(struct ihex_record),
- GFP_KERNEL);
+ struct ihex_record *rec = kmalloc_obj(struct ihex_record, GFP_KERNEL);
if (!rec)
return -ENOMEM;
diff --git a/sound/usb/6fire/midi.c b/sound/usb/6fire/midi.c
index 4d1eeb32c5fe..40c935fb7592 100644
--- a/sound/usb/6fire/midi.c
+++ b/sound/usb/6fire/midi.c
@@ -140,8 +140,7 @@ static const struct snd_rawmidi_ops in_ops = {
int usb6fire_midi_init(struct sfire_chip *chip)
{
int ret;
- struct midi_runtime *rt = kzalloc(sizeof(struct midi_runtime),
- GFP_KERNEL);
+ struct midi_runtime *rt = kzalloc_obj(struct midi_runtime, GFP_KERNEL);
struct comm_runtime *comm_rt = chip->comm;
if (!rt)
diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index 08515da5dcc8..abd1338eb972 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -587,7 +587,7 @@ int usb6fire_pcm_init(struct sfire_chip *chip)
int ret;
struct snd_pcm *pcm;
struct pcm_runtime *rt =
- kzalloc(sizeof(struct pcm_runtime), GFP_KERNEL);
+ kzalloc_obj(struct pcm_runtime, GFP_KERNEL);
if (!rt)
return -ENOMEM;
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
index 95d425dd9d70..06837b9f8bf8 100644
--- a/sound/usb/caiaq/audio.c
+++ b/sound/usb/caiaq/audio.c
@@ -681,7 +681,7 @@ static struct urb **alloc_urbs(struct snd_usb_caiaqdev *cdev, int dir, int *ret)
usb_sndisocpipe(usb_dev, ENDPOINT_PLAYBACK) :
usb_rcvisocpipe(usb_dev, ENDPOINT_CAPTURE);
- urbs = kmalloc_array(N_URBS, sizeof(*urbs), GFP_KERNEL);
+ urbs = kmalloc_objs(*urbs, N_URBS, GFP_KERNEL);
if (!urbs) {
*ret = -ENOMEM;
return NULL;
@@ -813,8 +813,7 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev)
NULL, 0, 0);
cdev->data_cb_info =
- kmalloc_array(N_URBS, sizeof(struct snd_usb_caiaq_cb_info),
- GFP_KERNEL);
+ kmalloc_objs(struct snd_usb_caiaq_cb_info, N_URBS, GFP_KERNEL);
if (!cdev->data_cb_info)
return -ENOMEM;
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index a855b2cc60c7..8a2bb82c1a18 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -621,7 +621,7 @@ iface_ref_find(struct snd_usb_audio *chip, int iface)
if (ip->iface == iface)
return ip;
- ip = kzalloc(sizeof(*ip), GFP_KERNEL);
+ ip = kzalloc_obj(*ip, GFP_KERNEL);
if (!ip)
return NULL;
ip->iface = iface;
@@ -639,7 +639,7 @@ clock_ref_find(struct snd_usb_audio *chip, int clock)
if (ref->clock == clock)
return ref;
- ref = kzalloc(sizeof(*ref), GFP_KERNEL);
+ ref = kzalloc_obj(*ref, GFP_KERNEL);
if (!ref)
return NULL;
ref->clock = clock;
@@ -698,7 +698,7 @@ int snd_usb_add_endpoint(struct snd_usb_audio *chip, int ep_num, int type)
usb_audio_dbg(chip, "Creating new %s endpoint #%x\n",
ep_type_name(type),
ep_num);
- ep = kzalloc(sizeof(*ep), GFP_KERNEL);
+ ep = kzalloc_obj(*ep, GFP_KERNEL);
if (!ep)
return -ENOMEM;
diff --git a/sound/usb/fcp.c b/sound/usb/fcp.c
index 1f4595d1e217..2ca41460aa5b 100644
--- a/sound/usb/fcp.c
+++ b/sound/usb/fcp.c
@@ -329,7 +329,7 @@ static int fcp_add_new_ctl(struct usb_mixer_interface *mixer,
struct usb_mixer_elem_info *elem;
int err;
- elem = kzalloc(sizeof(*elem), GFP_KERNEL);
+ elem = kzalloc_obj(*elem, GFP_KERNEL);
if (!elem)
return -ENOMEM;
@@ -654,7 +654,7 @@ static int fcp_ioctl_set_meter_map(struct usb_mixer_interface *mixer,
if (!private->meter_ctl) {
/* Allocate buffer for the map */
s16 *new_map __free(kfree) =
- kmalloc_array(map.map_size, sizeof(s16), GFP_KERNEL);
+ kmalloc_objs(s16, map.map_size, GFP_KERNEL);
if (!new_map)
return -ENOMEM;
@@ -1045,7 +1045,7 @@ static int fcp_init(struct usb_mixer_interface *mixer,
static int fcp_init_private(struct usb_mixer_interface *mixer)
{
struct fcp_data *private =
- kzalloc(sizeof(struct fcp_data), GFP_KERNEL);
+ kzalloc_obj(struct fcp_data, GFP_KERNEL);
if (!private)
return -ENOMEM;
diff --git a/sound/usb/hiface/pcm.c b/sound/usb/hiface/pcm.c
index 27cd427fbaa5..2603a88a9d27 100644
--- a/sound/usb/hiface/pcm.c
+++ b/sound/usb/hiface/pcm.c
@@ -547,7 +547,7 @@ int hiface_pcm_init(struct hiface_chip *chip, u8 extra_freq)
struct snd_pcm *pcm;
struct pcm_runtime *rt;
- rt = kzalloc(sizeof(*rt), GFP_KERNEL);
+ rt = kzalloc_obj(*rt, GFP_KERNEL);
if (!rt)
return -ENOMEM;
diff --git a/sound/usb/line6/capture.c b/sound/usb/line6/capture.c
index 9ef4faa006a0..bad575fa4ed2 100644
--- a/sound/usb/line6/capture.c
+++ b/sound/usb/line6/capture.c
@@ -255,8 +255,8 @@ int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm)
struct usb_line6 *line6 = line6pcm->line6;
int i;
- line6pcm->in.urbs = kcalloc(line6->iso_buffers, sizeof(struct urb *),
- GFP_KERNEL);
+ line6pcm->in.urbs = kzalloc_objs(struct urb *, line6->iso_buffers,
+ GFP_KERNEL);
if (line6pcm->in.urbs == NULL)
return -ENOMEM;
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index e97368c31417..191682894f04 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -202,7 +202,7 @@ int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer,
struct urb *urb;
/* create message: */
- msg = kzalloc(sizeof(struct message), GFP_ATOMIC);
+ msg = kzalloc_obj(struct message, GFP_ATOMIC);
if (msg == NULL)
return -ENOMEM;
diff --git a/sound/usb/line6/midi.c b/sound/usb/line6/midi.c
index 4731293728e6..0e5cb8a86922 100644
--- a/sound/usb/line6/midi.c
+++ b/sound/usb/line6/midi.c
@@ -264,7 +264,7 @@ int line6_init_midi(struct usb_line6 *line6)
if (err < 0)
return err;
- line6midi = kzalloc(sizeof(struct snd_line6_midi), GFP_KERNEL);
+ line6midi = kzalloc_obj(struct snd_line6_midi, GFP_KERNEL);
if (!line6midi)
return -ENOMEM;
diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c
index f61d9f6cf754..ea1cea5d1105 100644
--- a/sound/usb/line6/pcm.c
+++ b/sound/usb/line6/pcm.c
@@ -528,7 +528,7 @@ int line6_init_pcm(struct usb_line6 *line6,
if (err < 0)
return err;
- line6pcm = kzalloc(sizeof(*line6pcm), GFP_KERNEL);
+ line6pcm = kzalloc_obj(*line6pcm, GFP_KERNEL);
if (!line6pcm)
return -ENOMEM;
diff --git a/sound/usb/line6/playback.c b/sound/usb/line6/playback.c
index 9f26f66e6792..5d3666ebaf83 100644
--- a/sound/usb/line6/playback.c
+++ b/sound/usb/line6/playback.c
@@ -404,8 +404,8 @@ int line6_create_audio_out_urbs(struct snd_line6_pcm *line6pcm)
struct usb_line6 *line6 = line6pcm->line6;
int i;
- line6pcm->out.urbs = kcalloc(line6->iso_buffers, sizeof(struct urb *),
- GFP_KERNEL);
+ line6pcm->out.urbs = kzalloc_objs(struct urb *, line6->iso_buffers,
+ GFP_KERNEL);
if (line6pcm->out.urbs == NULL)
return -ENOMEM;
diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c
index 68cda7bf330c..abc1a750a921 100644
--- a/sound/usb/line6/toneport.c
+++ b/sound/usb/line6/toneport.c
@@ -363,7 +363,7 @@ static int toneport_setup(struct usb_line6_toneport *toneport)
struct usb_line6 *line6 = &toneport->line6;
struct usb_device *usbdev = line6->usbdev;
- ticks = kmalloc(sizeof(*ticks), GFP_KERNEL);
+ ticks = kmalloc_obj(*ticks, GFP_KERNEL);
if (!ticks)
return -ENOMEM;
diff --git a/sound/usb/media.c b/sound/usb/media.c
index 0064f8d12422..0aab1eb5c4e9 100644
--- a/sound/usb/media.c
+++ b/sound/usb/media.c
@@ -49,7 +49,7 @@ int snd_media_stream_init(struct snd_usb_substream *subs, struct snd_pcm *pcm,
return 0;
/* allocate media_ctl */
- mctl = kzalloc(sizeof(*mctl), GFP_KERNEL);
+ mctl = kzalloc_obj(*mctl, GFP_KERNEL);
if (!mctl)
return -ENOMEM;
@@ -188,7 +188,7 @@ static int snd_media_mixer_init(struct snd_usb_audio *chip)
continue;
/* allocate media_mixer_ctl */
- mctl = kzalloc(sizeof(*mctl), GFP_KERNEL);
+ mctl = kzalloc_obj(*mctl, GFP_KERNEL);
if (!mctl)
return -ENOMEM;
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index dd8249e75970..c72434ac581d 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -1328,7 +1328,7 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi *umidi,
int err;
rep->in = NULL;
- ep = kzalloc(sizeof(*ep), GFP_KERNEL);
+ ep = kzalloc_obj(*ep, GFP_KERNEL);
if (!ep)
return -ENOMEM;
ep->umidi = umidi;
@@ -1414,7 +1414,7 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi *umidi,
int err;
rep->out = NULL;
- ep = kzalloc(sizeof(*ep), GFP_KERNEL);
+ ep = kzalloc_obj(*ep, GFP_KERNEL);
if (!ep)
return -ENOMEM;
ep->umidi = umidi;
@@ -2506,7 +2506,7 @@ int __snd_usbmidi_create(struct snd_card *card,
int out_ports, in_ports;
int i, err;
- umidi = kzalloc(sizeof(*umidi), GFP_KERNEL);
+ umidi = kzalloc_obj(*umidi, GFP_KERNEL);
if (!umidi)
return -ENOMEM;
umidi->dev = interface_to_usbdev(iface);
diff --git a/sound/usb/midi2.c b/sound/usb/midi2.c
index e6793f3bdfc3..cf05e4cb97b1 100644
--- a/sound/usb/midi2.c
+++ b/sound/usb/midi2.c
@@ -432,7 +432,7 @@ static int create_midi2_endpoint(struct snd_usb_midi2_interface *umidi,
hostep->desc.bEndpointAddress,
ms_ep->bNumGrpTrmBlock);
- ep = kzalloc(sizeof(*ep), GFP_KERNEL);
+ ep = kzalloc_obj(*ep, GFP_KERNEL);
if (!ep)
return -ENOMEM;
@@ -693,7 +693,7 @@ static int create_midi2_ump(struct snd_usb_midi2_interface *umidi,
char idstr[16];
int err;
- rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
+ rmidi = kzalloc_obj(*rmidi, GFP_KERNEL);
if (!rmidi)
return -ENOMEM;
INIT_LIST_HEAD(&rmidi->list);
@@ -1101,7 +1101,7 @@ int snd_usb_midi_v2_create(struct snd_usb_audio *chip,
hostif->desc.bInterfaceNumber,
hostif->desc.bAlternateSetting);
- umidi = kzalloc(sizeof(*umidi), GFP_KERNEL);
+ umidi = kzalloc_obj(*umidi, GFP_KERNEL);
if (!umidi)
return -ENOMEM;
umidi->chip = chip;
diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c
index 76b6eb55dcc2..62be8a00a826 100644
--- a/sound/usb/misc/ua101.c
+++ b/sound/usb/misc/ua101.c
@@ -1062,7 +1062,7 @@ static int alloc_stream_urbs(struct ua101 *ua, struct ua101_stream *stream,
while (size >= max_packet_size) {
if (u >= stream->queue_length)
goto bufsize_error;
- urb = kmalloc(sizeof(*urb), GFP_KERNEL);
+ urb = kmalloc_obj(*urb, GFP_KERNEL);
if (!urb)
return -ENOMEM;
usb_init_urb(&urb->urb);
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index bfe15b1cb66c..1b66f9581b4a 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1684,7 +1684,7 @@ static void __build_feature_ctl(struct usb_mixer_interface *mixer,
if (check_ignored_ctl(map))
return;
- cval = kzalloc(sizeof(*cval), GFP_KERNEL);
+ cval = kzalloc_obj(*cval, GFP_KERNEL);
if (!cval)
return;
snd_usb_mixer_elem_init_std(&cval->head, mixer, unitid);
@@ -1894,7 +1894,7 @@ static void build_connector_control(struct usb_mixer_interface *mixer,
if (check_ignored_ctl(map))
return;
- cval = kzalloc(sizeof(*cval), GFP_KERNEL);
+ cval = kzalloc_obj(*cval, GFP_KERNEL);
if (!cval)
return;
snd_usb_mixer_elem_init_std(&cval->head, mixer, term->id);
@@ -1956,7 +1956,7 @@ static int parse_clock_source_unit(struct mixer_build *state, int unitid,
UAC2_CS_CONTROL_CLOCK_VALID))
return 0;
- cval = kzalloc(sizeof(*cval), GFP_KERNEL);
+ cval = kzalloc_obj(*cval, GFP_KERNEL);
if (!cval)
return -ENOMEM;
@@ -2177,7 +2177,7 @@ static void build_mixer_unit_ctl(struct mixer_build *state,
if (check_ignored_ctl(map))
return;
- cval = kzalloc(sizeof(*cval), GFP_KERNEL);
+ cval = kzalloc_obj(*cval, GFP_KERNEL);
if (!cval)
return;
@@ -2525,7 +2525,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
map = find_map(state->map, unitid, valinfo->control);
if (check_ignored_ctl(map))
continue;
- cval = kzalloc(sizeof(*cval), GFP_KERNEL);
+ cval = kzalloc_obj(*cval, GFP_KERNEL);
if (!cval)
return -ENOMEM;
snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid);
@@ -2771,7 +2771,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
if (check_ignored_ctl(map))
return 0;
- cval = kzalloc(sizeof(*cval), GFP_KERNEL);
+ cval = kzalloc_obj(*cval, GFP_KERNEL);
if (!cval)
return -ENOMEM;
snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid);
@@ -3598,13 +3598,13 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif)
strscpy(chip->card->mixername, "USB Mixer");
- mixer = kzalloc(sizeof(*mixer), GFP_KERNEL);
+ mixer = kzalloc_obj(*mixer, GFP_KERNEL);
if (!mixer)
return -ENOMEM;
mixer->chip = chip;
mixer->ignore_ctl_error = !!(chip->quirk_flags & QUIRK_FLAG_IGNORE_CTL_ERROR);
- mixer->id_elems = kcalloc(MAX_ID_ELEMS, sizeof(*mixer->id_elems),
- GFP_KERNEL);
+ mixer->id_elems = kzalloc_objs(*mixer->id_elems, MAX_ID_ELEMS,
+ GFP_KERNEL);
if (!mixer->id_elems) {
kfree(mixer);
return -ENOMEM;
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index ec65e8a71919..dc538450f3b9 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -67,7 +67,7 @@ static int snd_create_std_mono_ctl_offset(struct usb_mixer_interface *mixer,
struct usb_mixer_elem_info *cval;
struct snd_kcontrol *kctl;
- cval = kzalloc(sizeof(*cval), GFP_KERNEL);
+ cval = kzalloc_obj(*cval, GFP_KERNEL);
if (!cval)
return -ENOMEM;
@@ -151,7 +151,7 @@ static int add_single_ctl_with_resume(struct usb_mixer_interface *mixer,
struct usb_mixer_elem_list *list;
struct snd_kcontrol *kctl;
- list = kzalloc(sizeof(*list), GFP_KERNEL);
+ list = kzalloc_obj(*list, GFP_KERNEL);
if (!list)
return -ENOMEM;
if (listp)
@@ -274,7 +274,8 @@ static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer)
mixer->rc_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!mixer->rc_urb)
return -ENOMEM;
- mixer->rc_setup_packet = kmalloc(sizeof(*mixer->rc_setup_packet), GFP_KERNEL);
+ mixer->rc_setup_packet = kmalloc_obj(*mixer->rc_setup_packet,
+ GFP_KERNEL);
if (!mixer->rc_setup_packet) {
usb_free_urb(mixer->rc_urb);
mixer->rc_urb = NULL;
@@ -616,7 +617,7 @@ static int snd_dualsense_ih_connect(struct input_handler *handler,
struct input_handle *handle;
int err;
- handle = kzalloc(sizeof(*handle), GFP_KERNEL);
+ handle = kzalloc_obj(*handle, GFP_KERNEL);
if (!handle)
return -ENOMEM;
@@ -713,7 +714,7 @@ static int snd_dualsense_jack_create(struct usb_mixer_interface *mixer,
struct snd_kcontrol *kctl;
int err;
- mei = kzalloc(sizeof(*mei), GFP_KERNEL);
+ mei = kzalloc_obj(*mei, GFP_KERNEL);
if (!mei)
return -ENOMEM;
@@ -2278,7 +2279,7 @@ static int realtek_add_jack(struct usb_mixer_interface *mixer,
struct usb_mixer_elem_info *cval;
struct snd_kcontrol *kctl;
- cval = kzalloc(sizeof(*cval), GFP_KERNEL);
+ cval = kzalloc_obj(*cval, GFP_KERNEL);
if (!cval)
return -ENOMEM;
snd_usb_mixer_elem_init_std(&cval->head, mixer, unitid);
diff --git a/sound/usb/mixer_s1810c.c b/sound/usb/mixer_s1810c.c
index b4ce89afb25b..f931643db1c5 100644
--- a/sound/usb/mixer_s1810c.c
+++ b/sound/usb/mixer_s1810c.c
@@ -534,7 +534,7 @@ snd_s1810c_switch_init(struct usb_mixer_interface *mixer,
struct snd_kcontrol *kctl;
struct usb_mixer_elem_info *elem;
- elem = kzalloc(sizeof(struct usb_mixer_elem_info), GFP_KERNEL);
+ elem = kzalloc_obj(struct usb_mixer_elem_info, GFP_KERNEL);
if (!elem)
return -ENOMEM;
@@ -645,7 +645,7 @@ int snd_sc1810_init_mixer(struct usb_mixer_interface *mixer)
if (ret < 0)
return ret;
- private = kzalloc(sizeof(struct s1810_mixer_state), GFP_KERNEL);
+ private = kzalloc_obj(struct s1810_mixer_state, GFP_KERNEL);
if (!private)
return -ENOMEM;
diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c
index fa11f25288b7..8582153cb4a7 100644
--- a/sound/usb/mixer_scarlett.c
+++ b/sound/usb/mixer_scarlett.c
@@ -819,7 +819,7 @@ static int add_new_ctl(struct usb_mixer_interface *mixer,
struct usb_mixer_elem_info *elem;
int err;
- elem = kzalloc(sizeof(*elem), GFP_KERNEL);
+ elem = kzalloc_obj(*elem, GFP_KERNEL);
if (!elem)
return -ENOMEM;
diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c
index 88b7e42d159e..41a496adcc09 100644
--- a/sound/usb/mixer_scarlett2.c
+++ b/sound/usb/mixer_scarlett2.c
@@ -3197,7 +3197,7 @@ static int scarlett2_add_new_ctl(struct usb_mixer_interface *mixer,
struct usb_mixer_elem_info *elem;
int err;
- elem = kzalloc(sizeof(*elem), GFP_KERNEL);
+ elem = kzalloc_obj(*elem, GFP_KERNEL);
if (!elem)
return -ENOMEM;
@@ -8272,7 +8272,7 @@ static int scarlett2_init_private(struct usb_mixer_interface *mixer,
const struct scarlett2_device_entry *entry)
{
struct scarlett2_data *private =
- kzalloc(sizeof(struct scarlett2_data), GFP_KERNEL);
+ kzalloc_obj(struct scarlett2_data, GFP_KERNEL);
if (!private)
return -ENOMEM;
diff --git a/sound/usb/mixer_us16x08.c b/sound/usb/mixer_us16x08.c
index f9df40730eff..c7b63c29cbf6 100644
--- a/sound/usb/mixer_us16x08.c
+++ b/sound/usb/mixer_us16x08.c
@@ -969,7 +969,7 @@ static struct snd_us16x08_comp_store *snd_us16x08_create_comp_store(void)
int i;
struct snd_us16x08_comp_store *tmp;
- tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
+ tmp = kmalloc_obj(*tmp, GFP_KERNEL);
if (!tmp)
return NULL;
@@ -991,7 +991,7 @@ static struct snd_us16x08_eq_store *snd_us16x08_create_eq_store(void)
int i, b_idx;
struct snd_us16x08_eq_store *tmp;
- tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
+ tmp = kmalloc_obj(*tmp, GFP_KERNEL);
if (!tmp)
return NULL;
@@ -1027,7 +1027,7 @@ static struct snd_us16x08_meter_store *snd_us16x08_create_meter_store(void)
{
struct snd_us16x08_meter_store *tmp;
- tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
+ tmp = kzalloc_obj(*tmp, GFP_KERNEL);
if (!tmp)
return NULL;
tmp->comp_index = 1;
@@ -1059,7 +1059,7 @@ static int add_new_ctl(struct usb_mixer_interface *mixer,
usb_audio_dbg(mixer->chip, "us16x08 add mixer %s\n", name);
- elem = kzalloc(sizeof(*elem), GFP_KERNEL);
+ elem = kzalloc_obj(*elem, GFP_KERNEL);
if (!elem)
return -ENOMEM;
diff --git a/sound/usb/power.c b/sound/usb/power.c
index 66bd4daa68fd..47863b688b4d 100644
--- a/sound/usb/power.c
+++ b/sound/usb/power.c
@@ -20,7 +20,7 @@ snd_usb_find_power_domain(struct usb_host_interface *ctrl_iface,
struct snd_usb_power_domain *pd;
void *p;
- pd = kzalloc(sizeof(*pd), GFP_KERNEL);
+ pd = kzalloc_obj(*pd, GFP_KERNEL);
if (!pd)
return NULL;
diff --git a/sound/usb/qcom/qc_audio_offload.c b/sound/usb/qcom/qc_audio_offload.c
index cfb30a195364..b709b6cb3051 100644
--- a/sound/usb/qcom/qc_audio_offload.c
+++ b/sound/usb/qcom/qc_audio_offload.c
@@ -438,7 +438,7 @@ static unsigned long uaudio_get_iova(unsigned long *curr_iova,
}
}
- info = kzalloc(sizeof(*info), GFP_KERNEL);
+ info = kzalloc_obj(*info, GFP_KERNEL);
if (!info) {
iova = 0;
goto done;
@@ -1432,9 +1432,9 @@ static int prepare_qmi_response(struct snd_usb_substream *subs,
init_waitqueue_head(&uadev[card_num].disconnect_wq);
uadev[card_num].num_intf =
subs->dev->config->desc.bNumInterfaces;
- uadev[card_num].info = kcalloc(uadev[card_num].num_intf,
- sizeof(struct intf_info),
- GFP_KERNEL);
+ uadev[card_num].info = kzalloc_objs(struct intf_info,
+ uadev[card_num].num_intf,
+ GFP_KERNEL);
if (!uadev[card_num].info) {
ret = -ENOMEM;
goto unmap_er;
@@ -1687,7 +1687,7 @@ static struct qmi_msg_handler uaudio_stream_req_handlers = {
*/
static int qc_usb_audio_offload_init_qmi_dev(void)
{
- uaudio_qdev = kzalloc(sizeof(*uaudio_qdev), GFP_KERNEL);
+ uaudio_qdev = kzalloc_obj(*uaudio_qdev, GFP_KERNEL);
if (!uaudio_qdev)
return -ENOMEM;
@@ -1759,7 +1759,7 @@ static void qc_usb_audio_offload_probe(struct snd_usb_audio *chip)
guard(mutex)(&qdev_mutex);
guard(mutex)(&chip->mutex);
if (!uadev[chip->card->number].chip) {
- sdev = kzalloc(sizeof(*sdev), GFP_KERNEL);
+ sdev = kzalloc_obj(*sdev, GFP_KERNEL);
if (!sdev)
return;
@@ -1914,11 +1914,11 @@ static int qc_usb_audio_probe(struct auxiliary_device *auxdev,
struct uaudio_qmi_svc *svc;
int ret;
- svc = kzalloc(sizeof(*svc), GFP_KERNEL);
+ svc = kzalloc_obj(*svc, GFP_KERNEL);
if (!svc)
return -ENOMEM;
- svc->uaudio_svc_hdl = kzalloc(sizeof(*svc->uaudio_svc_hdl), GFP_KERNEL);
+ svc->uaudio_svc_hdl = kzalloc_obj(*svc->uaudio_svc_hdl, GFP_KERNEL);
if (!svc->uaudio_svc_hdl) {
ret = -ENOMEM;
goto free_svc;
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 17e49617218b..975b57adf2f4 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -566,7 +566,7 @@ static int snd_usb_extigy_boot_quirk(struct usb_device *dev, struct usb_interfac
if (err < 0)
dev_dbg(&dev->dev, "error sending boot message: %d\n", err);
struct usb_device_descriptor *new_device_descriptor __free(kfree) =
- kmalloc(sizeof(*new_device_descriptor), GFP_KERNEL);
+ kmalloc_obj(*new_device_descriptor, GFP_KERNEL);
if (!new_device_descriptor)
return -ENOMEM;
err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
@@ -944,7 +944,7 @@ static int snd_usb_mbox2_boot_quirk(struct usb_device *dev)
dev_dbg(&dev->dev, "device initialised!\n");
struct usb_device_descriptor *new_device_descriptor __free(kfree) =
- kmalloc(sizeof(*new_device_descriptor), GFP_KERNEL);
+ kmalloc_obj(*new_device_descriptor, GFP_KERNEL);
if (!new_device_descriptor)
return -ENOMEM;
@@ -1279,7 +1279,7 @@ static int snd_usb_mbox3_boot_quirk(struct usb_device *dev)
dev_dbg(&dev->dev, "MBOX3: device initialised!\n");
struct usb_device_descriptor *new_device_descriptor __free(kfree) =
- kmalloc(sizeof(*new_device_descriptor), GFP_KERNEL);
+ kmalloc_obj(*new_device_descriptor, GFP_KERNEL);
if (!new_device_descriptor)
return -ENOMEM;
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index ec7d756d78d1..adf1827807d4 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -291,7 +291,7 @@ static struct snd_pcm_chmap_elem *convert_chmap(int channels, unsigned int bits,
if (channels > ARRAY_SIZE(chmap->map))
return NULL;
- chmap = kzalloc(sizeof(*chmap), GFP_KERNEL);
+ chmap = kzalloc_obj(*chmap, GFP_KERNEL);
if (!chmap)
return NULL;
@@ -335,7 +335,7 @@ snd_pcm_chmap_elem *convert_chmap_v3(struct uac3_cluster_header_descriptor
if (channels > ARRAY_SIZE(chmap->map))
return NULL;
- chmap = kzalloc(sizeof(*chmap), GFP_KERNEL);
+ chmap = kzalloc_obj(*chmap, GFP_KERNEL);
if (!chmap)
return NULL;
@@ -526,7 +526,7 @@ static int __snd_usb_add_audio_stream(struct snd_usb_audio *chip,
}
/* create a new pcm */
- as = kzalloc(sizeof(*as), GFP_KERNEL);
+ as = kzalloc_obj(*as, GFP_KERNEL);
if (!as)
return -ENOMEM;
as->pcm_index = chip->pcm_devs;
@@ -693,7 +693,7 @@ audio_format_alloc_init(struct snd_usb_audio *chip,
struct usb_host_endpoint *ep = &alts->endpoint[0];
struct audioformat *fp;
- fp = kzalloc(sizeof(*fp), GFP_KERNEL);
+ fp = kzalloc_obj(*fp, GFP_KERNEL);
if (!fp)
return NULL;
@@ -927,7 +927,7 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,
break;
}
- chmap = kzalloc(sizeof(*chmap), GFP_KERNEL);
+ chmap = kzalloc_obj(*chmap, GFP_KERNEL);
if (!chmap)
return ERR_PTR(-ENOMEM);
@@ -1078,7 +1078,7 @@ found_clock:
fp->rate_max = UAC3_BADD_SAMPLING_RATE;
fp->rates = SNDRV_PCM_RATE_CONTINUOUS;
- pd = kzalloc(sizeof(*pd), GFP_KERNEL);
+ pd = kzalloc_obj(*pd, GFP_KERNEL);
if (!pd) {
audioformat_free(fp);
return NULL;
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index c7c7ec9c228b..c8f2f07d7f8d 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -657,15 +657,13 @@ static int usx2y_rate_set(struct usx2ydev *usx2y, int rate)
struct urb *urb;
if (usx2y->rate != rate) {
- us = kzalloc(struct_size(us, urb, NOOF_SETRATE_URBS),
- GFP_KERNEL);
+ us = kzalloc_flex(*us, urb, NOOF_SETRATE_URBS, GFP_KERNEL);
if (!us) {
err = -ENOMEM;
goto cleanup;
}
us->len = NOOF_SETRATE_URBS;
- usbdata = kmalloc_array(NOOF_SETRATE_URBS, sizeof(int),
- GFP_KERNEL);
+ usbdata = kmalloc_objs(int, NOOF_SETRATE_URBS, GFP_KERNEL);
if (!usbdata) {
err = -ENOMEM;
goto cleanup;
@@ -944,7 +942,8 @@ static int usx2y_audio_stream_new(struct snd_card *card, int playback_endpoint,
for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
i <= SNDRV_PCM_STREAM_CAPTURE; ++i) {
- usx2y_substream[i] = kzalloc(sizeof(struct snd_usx2y_substream), GFP_KERNEL);
+ usx2y_substream[i] = kzalloc_obj(struct snd_usx2y_substream,
+ GFP_KERNEL);
if (!usx2y_substream[i])
return -ENOMEM;
diff --git a/sound/virtio/virtio_card.c b/sound/virtio/virtio_card.c
index 52c5757585c6..65abd8510ff4 100644
--- a/sound/virtio/virtio_card.c
+++ b/sound/virtio/virtio_card.c
@@ -137,8 +137,7 @@ static int virtsnd_find_vqs(struct virtio_snd *snd)
n = virtqueue_get_vring_size(vqs[VIRTIO_SND_VQ_EVENT]);
- snd->event_msgs = kmalloc_array(n, sizeof(*snd->event_msgs),
- GFP_KERNEL);
+ snd->event_msgs = kmalloc_objs(*snd->event_msgs, n, GFP_KERNEL);
if (!snd->event_msgs)
return -ENOMEM;
diff --git a/sound/virtio/virtio_jack.c b/sound/virtio/virtio_jack.c
index c69f1dcdcc84..2f1ec3ac02f0 100644
--- a/sound/virtio/virtio_jack.c
+++ b/sound/virtio/virtio_jack.c
@@ -144,7 +144,7 @@ int virtsnd_jack_parse_cfg(struct virtio_snd *snd)
if (!snd->jacks)
return -ENOMEM;
- info = kcalloc(snd->njacks, sizeof(*info), GFP_KERNEL);
+ info = kzalloc_objs(*info, snd->njacks, GFP_KERNEL);
if (!info)
return -ENOMEM;
diff --git a/sound/virtio/virtio_pcm.c b/sound/virtio/virtio_pcm.c
index 3602b6690fcd..ef5a8a507b24 100644
--- a/sound/virtio/virtio_pcm.c
+++ b/sound/virtio/virtio_pcm.c
@@ -354,7 +354,7 @@ int virtsnd_pcm_parse_cfg(struct virtio_snd *snd)
spin_lock_init(&vss->lock);
}
- info = kcalloc(snd->nsubstreams, sizeof(*info), GFP_KERNEL);
+ info = kzalloc_objs(*info, snd->nsubstreams, GFP_KERNEL);
if (!info)
return -ENOMEM;
diff --git a/sound/virtio/virtio_pcm_msg.c b/sound/virtio/virtio_pcm_msg.c
index 9778020a7ba8..79af520ef12e 100644
--- a/sound/virtio/virtio_pcm_msg.c
+++ b/sound/virtio/virtio_pcm_msg.c
@@ -135,7 +135,7 @@ int virtsnd_pcm_msg_alloc(struct virtio_pcm_substream *vss,
struct snd_pcm_runtime *runtime = vss->substream->runtime;
unsigned int i;
- vss->msgs = kcalloc(periods, sizeof(*vss->msgs), GFP_KERNEL);
+ vss->msgs = kzalloc_objs(*vss->msgs, periods, GFP_KERNEL);
if (!vss->msgs)
return -ENOMEM;
@@ -146,7 +146,7 @@ int virtsnd_pcm_msg_alloc(struct virtio_pcm_substream *vss,
int sg_num = virtsnd_pcm_sg_num(data, period_bytes);
struct virtio_pcm_msg *msg;
- msg = kzalloc(struct_size(msg, sgs, sg_num + 2), GFP_KERNEL);
+ msg = kzalloc_flex(*msg, sgs, sg_num + 2, GFP_KERNEL);
if (!msg)
return -ENOMEM;
diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c
index f5807fc73c54..dc7501c95b99 100644
--- a/sound/x86/intel_hdmi_audio.c
+++ b/sound/x86/intel_hdmi_audio.c
@@ -475,7 +475,7 @@ static void had_build_channel_allocation_map(struct snd_intelhad *intelhaddata)
kfree(intelhaddata->chmap->chmap);
intelhaddata->chmap->chmap = NULL;
- chmap = kzalloc(sizeof(*chmap), GFP_KERNEL);
+ chmap = kzalloc_obj(*chmap, GFP_KERNEL);
if (!chmap)
return;
diff --git a/sound/xen/xen_snd_front_alsa.c b/sound/xen/xen_snd_front_alsa.c
index b229eb6f7057..379a4a1cb911 100644
--- a/sound/xen/xen_snd_front_alsa.c
+++ b/sound/xen/xen_snd_front_alsa.c
@@ -442,8 +442,8 @@ static int shbuf_setup_backstore(struct xen_snd_front_pcm_stream_info *stream,
stream->buffer_sz = buffer_sz;
stream->num_pages = DIV_ROUND_UP(stream->buffer_sz, PAGE_SIZE);
- stream->pages = kcalloc(stream->num_pages, sizeof(struct page *),
- GFP_KERNEL);
+ stream->pages = kzalloc_objs(struct page *, stream->num_pages,
+ GFP_KERNEL);
if (!stream->pages)
return -ENOMEM;
diff --git a/sound/xen/xen_snd_front_evtchnl.c b/sound/xen/xen_snd_front_evtchnl.c
index 2fbed8e4a490..8a8807cbc80c 100644
--- a/sound/xen/xen_snd_front_evtchnl.c
+++ b/sound/xen/xen_snd_front_evtchnl.c
@@ -267,9 +267,8 @@ int xen_snd_front_evtchnl_create_all(struct xen_snd_front_info *front_info,
int d, ret = 0;
front_info->evt_pairs =
- kcalloc(num_streams,
- sizeof(struct xen_snd_front_evtchnl_pair),
- GFP_KERNEL);
+ kzalloc_objs(struct xen_snd_front_evtchnl_pair,
+ num_streams, GFP_KERNEL);
if (!front_info->evt_pairs)
return -ENOMEM;