]> git.hungrycats.org Git - linux/commitdiff
treewide: refresh kmalloc_obj() conversions
authorKees Cook <kees+treewide@kernel.org>
Wed, 2 Sep 2026 22:31:14 +0000 (15:31 -0700)
committerKees Cook <kees@kernel.org>
Sat, 5 Sep 2026 04:37:00 +0000 (21:37 -0700)
This is another run of the Coccinelle script for converting kmalloc()
family of allocations to kmalloc_obj() via the existing rules in
scripts/coccinelle/api/kmalloc_objs.cocci

This catches both the set of kmalloc() uses added since the first
kmalloc_obj() conversions in v7.0 and adds a large group missed in the
first pass due to Coccinelle not interacting well with the cleanup.h
scoped_...() family of macros[1]. I worked around this with spatch's
"--macro-file" argument to a file with all the scoped_...() macros mapped
to Coccinelle's YACFE_ITERATOR[2] as that was the closest viable control
flow indicator I could find.

Build tested allmodconfig on x86, arm64, arm, loongarch, mips, powerpc,
riscv, and s390 with no new warnings.

Link: https://lore.kernel.org/lkml/202609021314.8A9C0B8@keescook/
Link: https://github.com/coccinelle/coccinelle/blob/master/standard.h
Signed-off-by: Kees Cook <kees+treewide@kernel.org>
304 files changed:
arch/arm64/crypto/aes-neonbs-glue.c
arch/arm64/kvm/nested.c
arch/loongarch/kvm/intc/dmsintc.c
arch/mips/bcm47xx/buttons.c
arch/powerpc/sysdev/xive/common.c
arch/riscv/kvm/vcpu_pmu.c
arch/s390/kvm/s390/s390.c
drivers/accel/rocket/rocket_job.c
drivers/acpi/irq.c
drivers/base/property.c
drivers/block/drbd/drbd_nl_gen.c
drivers/block/ublk_drv.c
drivers/block/zram/backend_lz4.c
drivers/clk/ti/composite.c
drivers/clk/ti/mux.c
drivers/cpufreq/amd-pstate.c
drivers/crypto/inside-secure/eip93/eip93-common.c
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c
drivers/crypto/ti/dthev2-aes.c
drivers/devfreq/hisi_uncore_freq.c
drivers/dma-buf/st-dma-fence.c
drivers/dma-buf/udmabuf.c
drivers/dma/switchtec_dma.c
drivers/edac/versalnet_edac.c
drivers/firmware/arm_scmi/driver.c
drivers/firmware/qcom/qcom_tzmem.c
drivers/firmware/ti_sci.c
drivers/fpga/dfl-afu-dma-region.c
drivers/gpio/gpio-aggregator.c
drivers/gpio/gpio-mpsse.c
drivers/gpio/gpio-sim.c
drivers/gpio/gpio-virtuser.c
drivers/gpio/gpiolib-cdev.c
drivers/gpio/gpiolib.c
drivers/gpu/buddy.c
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
drivers/gpu/drm/amd/amdgpu/amdgpu_lockdep.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/core/dc_surface.c
drivers/gpu/drm/amd/display/dc/dccg/dcn42/dcn42_dccg.c
drivers/gpu/drm/amd/display/dc/dccg/dcn60/dcn60_dccg.c
drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c
drivers/gpu/drm/amd/display/dc/irq/dcn42/irq_service_dcn42.c
drivers/gpu/drm/amd/display/dc/irq/dcn60/irq_service_dcn60.c
drivers/gpu/drm/amd/display/dc/pg/dcn42/dcn42_pg_cntl.c
drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn302/dcn302_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn316/dcn316_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn36/dcn36_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c
drivers/gpu/drm/amd/display/modules/power/power.c
drivers/gpu/drm/amd/display/modules/power/power_abm.c
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
drivers/gpu/drm/amd/ras/core/cmd.c
drivers/gpu/drm/drm_exec.c
drivers/gpu/drm/drm_syncobj.c
drivers/gpu/drm/qxl/qxl_display.c
drivers/gpu/drm/tilcdc/tilcdc_panel_legacy.c
drivers/gpu/drm/verisilicon/vs_plane.c
drivers/gpu/drm/virtio/virtgpu_prime.c
drivers/gpu/drm/vkms/vkms_configfs.c
drivers/gpu/drm/xe/xe_amc.c
drivers/gpu/drm/xe/xe_vm.c
drivers/hid/hid-asus.c
drivers/hid/hid-steam.c
drivers/hid/hid-steelseries-arctis.c
drivers/hv/channel.c
drivers/hv/hv_balloon.c
drivers/hwmon/applesmc.c
drivers/hwtracing/coresight/coresight-core.c
drivers/i2c/busses/i2c-gpio.c
drivers/i3c/master/amd-i3c-master.c
drivers/iio/adc/ad7280a.c
drivers/iio/buffer/industrialio-buffer-dmaengine.c
drivers/iio/inkern.c
drivers/infiniband/core/nldev.c
drivers/infiniband/hw/hns/hns_roce_debugfs.c
drivers/input/input.c
drivers/input/keyboard/adp5585-keys.c
drivers/input/keyboard/atkbd.c
drivers/input/misc/ims-pcu.c
drivers/input/mouse/psmouse-smbus.c
drivers/input/serio/serio_raw.c
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
drivers/iommu/iommufd/device.c
drivers/iommu/iommufd/driver.c
drivers/iommu/iommufd/hwpt_noiommu.c
drivers/iommu/vsi-iommu.c
drivers/irqchip/irq-gic-v5-irs.c
drivers/irqchip/irq-loongarch-ir.c
drivers/irqchip/irq-realtek-rtl.c
drivers/mailbox/riscv-sbi-mpxy-mbox.c
drivers/md/dm-inlinecrypt.c
drivers/md/md-llbitmap.c
drivers/media/platform/allegro-dvt/allegro-core.c
drivers/media/platform/amd/isp4/isp4_interface.c
drivers/media/platform/renesas/rcar-isp/core.c
drivers/media/rc/igorplugusb.c
drivers/mfd/mfd-core.c
drivers/mfd/ucb1x00-assabet.c
drivers/mtd/mtd_virt_concat.c
drivers/mtd/mtdconcat.c
drivers/net/dsa/mv88e6xxx/tcflower.c
drivers/net/ethernet/alibaba/eea/eea_adminq.c
drivers/net/ethernet/alibaba/eea/eea_net.c
drivers/net/ethernet/alibaba/eea/eea_pci.c
drivers/net/ethernet/alibaba/eea/eea_ring.c
drivers/net/ethernet/alibaba/eea/eea_rx.c
drivers/net/ethernet/alibaba/eea/eea_tx.c
drivers/net/ethernet/amd/pds_core/core.c
drivers/net/ethernet/amd/pds_core/fw.c
drivers/net/ethernet/cadence/macb_main.c
drivers/net/ethernet/cisco/enic/enic_admin.c
drivers/net/ethernet/cisco/enic/enic_main.c
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
drivers/net/ethernet/intel/libie/controlq.c
drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_icm_pool.c
drivers/net/ethernet/meta/fbnic/fbnic_irq.c
drivers/net/ethernet/microsoft/mana/gdma_main.c
drivers/net/ntb_netdev.c
drivers/net/wireless/ath/ath12k/ahb.c
drivers/net/wireless/intel/iwlwifi/mld/regulatory.c
drivers/net/wireless/mediatek/mt76/mt7921/regd.c
drivers/net/wireless/mediatek/mt76/mt7925/main.c
drivers/net/wireless/mediatek/mt76/mt7925/regd.c
drivers/net/wireless/morsemicro/mm81x/mac.c
drivers/net/wireless/morsemicro/mm81x/yaps.c
drivers/net/wireless/nxp/nxpwifi/cfg80211.c
drivers/net/wireless/nxp/nxpwifi/cmdevt.c
drivers/net/wireless/nxp/nxpwifi/ie.c
drivers/net/wireless/nxp/nxpwifi/init.c
drivers/net/wireless/nxp/nxpwifi/main.c
drivers/net/wireless/nxp/nxpwifi/scan.c
drivers/net/wireless/nxp/nxpwifi/sta_cfg.c
drivers/net/wireless/nxp/nxpwifi/sta_cmd.c
drivers/net/wireless/nxp/nxpwifi/uap_event.c
drivers/nvdimm/region_devs.c
drivers/nvme/host/core.c
drivers/nvme/host/pci.c
drivers/opp/core.c
drivers/pci/endpoint/pci-ep-msi.c
drivers/platform/x86/amd/hsmp/acpi.c
drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
drivers/platform/x86/intel/pmc/pwrm_telemetry.c
drivers/pmdomain/core.c
drivers/power/reset/reboot-mode.c
drivers/power/sequencing/core.c
drivers/power/sequencing/pwrseq-pcie-m2.c
drivers/power/supply/power_supply_core.c
drivers/ptp/ptp_chardev.c
drivers/s390/block/dasd.c
drivers/scsi/fnic/fnic_debugfs.c
drivers/scsi/leapraid/leapraid_func.c
drivers/scsi/scsi_scan.c
drivers/soc/bcm/brcmstb/common.c
drivers/spi/spi-offload.c
drivers/staging/greybus/raw.c
drivers/staging/media/atomisp/pci/sh_css.c
drivers/staging/media/atomisp/pci/sh_css_firmware.c
drivers/tee/qcomtee/user_obj.c
drivers/thunderbolt/stream.c
drivers/tty/moxa.c
drivers/tty/vt/consolemap.c
drivers/ufs/core/ufs-txeq.c
drivers/ufs/host/ufs-qcom.c
drivers/usb/gadget/function/f_ncm.c
drivers/usb/usbip/usbip_common.c
drivers/xen/grant-table.c
fs/9p/vfs_dentry.c
fs/afs/dir.c
fs/afs/symlink.c
fs/binfmt_misc.c
fs/ceph/addr.c
fs/ceph/mds_client.c
fs/ceph/subvolume_metrics.c
fs/coredump.c
fs/ext4/fast_commit.c
fs/fuse/file.c
fs/fuse/readdir.c
fs/hfs/bnode.c
fs/namespace.c
fs/nfsd/export.c
fs/nfsd/nfs4callback.c
fs/nfsd/nfs4state.c
fs/nfsd/nfsctl.c
fs/ntfs/bitmap.c
fs/ntfs/compress.c
fs/ntfs/dir.c
fs/ntfs/ea.c
fs/ntfs/index.c
fs/ntfs/logfile.c
fs/ntfs/mft.c
fs/ntfs/runlist.c
fs/ntfs/super.c
fs/overlayfs/readdir.c
fs/smb/client/cifs_swn.c
fs/smb/client/dfs_cache.c
fs/smb/client/smb2inode.c
fs/smb/server/ksmbd_work.c
fs/smb/server/smb2pdu.c
fs/xfs/libxfs/xfs_da_btree.c
init/initramfs_test.c
io_uring/napi.c
io_uring/zcrx.c
kernel/bpf/diagnostics.c
kernel/bpf/hashtab.c
kernel/bpf/liveness.c
kernel/bpf/log.c
kernel/bpf/verifier.c
kernel/dma/map_benchmark.c
kernel/events/core.c
kernel/futex/core.c
kernel/irq/manage.c
kernel/jump_label.c
kernel/kthread.c
kernel/sched/ext/cid.c
kernel/sched/ext/ext.c
kernel/sched/ext/sub.c
kernel/trace/fprobe.c
kernel/trace/ring_buffer.c
kernel/trace/trace_eprobe.c
kernel/trace/trace_remote.c
lib/test_rhashtable.c
lib/test_workqueue.c
lib/tests/kunit_iov_iter.c
mm/damon/tests/vaddr-kunit.h
net/batman-adv/hard-interface.c
net/bluetooth/hci_sync.c
net/devlink/netlink.c
net/devlink/param.c
net/ipv4/tcp_ipv4.c
net/mac80211/nan.c
net/mctp/test/route-test.c
net/mctp/test/utils.c
net/netfilter/nf_tables_api.c
net/netfilter/nfnetlink_cttimeout.c
net/rds/info.c
net/rxrpc/key.c
net/sched/act_gate.c
net/sched/act_tunnel_key.c
net/sunrpc/auth_gss/gss_krb5_crypto.c
net/sunrpc/svcauth_unix.c
net/sunrpc/xdr.c
net/unix/af_unix.c
net/wireless/core.c
net/wireless/nl80211.c
security/integrity/ima/ima_queue.c
sound/core/compress_offload.c
sound/core/control.c
sound/core/control_led.c
sound/core/init.c
sound/core/misc.c
sound/core/oss/mixer_oss.c
sound/core/pcm_native.c
sound/core/seq/oss/seq_oss_synth.c
sound/core/seq/seq_clientmgr.c
sound/core/seq/seq_virmidi.c
sound/core/timer.c
sound/drivers/aloop.c
sound/isa/gus/gus_dma.c
sound/pci/cs46xx/cs46xx_lib.c
sound/pci/ctxfi/ctamixer.c
sound/pci/ctxfi/ctdaio.c
sound/pci/ctxfi/ctsrc.c
sound/pci/ctxfi/cttimer.c
sound/pci/emu10k1/emufx.c
sound/soc/codecs/simple-amplifier.c
sound/soc/generic/simple-card-utils.c
sound/soc/meson/gx-formatter.c
sound/soc/qcom/qdsp6/q6afe.c
sound/soc/sdca/sdca_functions.c
sound/soc/sof/sof-client-probes-ipc4.c
sound/soc/sof/sof-client.c
sound/sparc/amd7930.c

index 5bcbac97989317af09992885a22ec35c170c6115..7cb1aede9a484e000de1606e766831899784d59c 100644 (file)
@@ -66,7 +66,7 @@ static int aesbs_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
        struct crypto_aes_ctx *rk;
        int err;
 
-       rk = kmalloc(sizeof(*rk), GFP_KERNEL);
+       rk = kmalloc_obj(*rk);
        if (!rk)
                return -ENOMEM;
 
@@ -128,7 +128,7 @@ static int aesbs_cbc_ctr_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
        struct crypto_aes_ctx *rk;
        int err;
 
-       rk = kmalloc(sizeof(*rk), GFP_KERNEL);
+       rk = kmalloc_obj(*rk);
        if (!rk)
                return -ENOMEM;
 
index 17123f0b6daba4b679f8ff638ed3a92125b27524..3c4fc566eafc636e441694ddb3857695a8204ad8 100644 (file)
@@ -93,7 +93,7 @@ int kvm_vcpu_init_nested(struct kvm_vcpu *vcpu)
        num_mmus = atomic_read(&kvm->online_vcpus) * S2_MMU_PER_VCPU;
 
        if (num_mmus > kvm->arch.nested_mmus_size) {
-               tmp = kvcalloc(num_mmus, sizeof(*tmp), GFP_KERNEL_ACCOUNT);
+               tmp = kvzalloc_objs(*tmp, num_mmus, GFP_KERNEL_ACCOUNT);
                if (!tmp)
                        return -ENOMEM;
 
index bb7285c49df3aed2f9c2a115bd24f85e7487f760..5518cafada55826b84c5b2fe7a1c66ce30dd75d6 100644 (file)
@@ -149,7 +149,7 @@ static int kvm_dmsintc_create(struct kvm_device *dev, u32 type)
                return -EINVAL;
        }
 
-       s = kzalloc(sizeof(struct loongarch_dmsintc), GFP_KERNEL);
+       s = kzalloc_obj(struct loongarch_dmsintc);
        if (!s)
                return -ENOMEM;
 
index 151a4ee2803f024ce6f60eb9e1a6cba912cc6d38..7bb338da8e424da0c50e3223184bdbb9201466db 100644 (file)
@@ -523,24 +523,24 @@ bcm47xx_buttons_add(const struct bcm47xx_gpio_key *buttons, int nbuttons)
 
        /* 1 node for gpio-keys device, 1 node for each button, 1 terminator */
        const struct software_node **node_group __free(kfree) =
-               kcalloc(1 + nbuttons + 1, sizeof(*node_group), GFP_KERNEL);
+               kzalloc_objs(*node_group, 1 + nbuttons + 1);
        if (!node_group)
                return -ENOMEM;
 
        /* 1 code property, 1 gpio property, 1 terminator */
        struct property_entry *props __free(kfree) =
-               kcalloc(nbuttons * 3, sizeof(*props), GFP_KERNEL);
+               kzalloc_objs(*props, nbuttons * 3);
        if (!props)
                return -ENOMEM;
 
        /* 1 node for gpio-keys device, 1 node for each button */
        struct software_node *nodes __free(kfree) =
-               kcalloc(1 + nbuttons, sizeof(*nodes), GFP_KERNEL);
+               kzalloc_objs(*nodes, 1 + nbuttons);
        if (!nodes)
                return -ENOMEM;
 
        struct software_node_ref_args *ref_args __free(kfree) =
-               kcalloc(nbuttons, sizeof(*ref_args), GFP_KERNEL);
+               kzalloc_objs(*ref_args, nbuttons);
        if (!ref_args)
                return -ENOMEM;
 
index 8ae0886323370d67a68a98393ea980705f754774..ed3d3e26c1366bf08cec665115e2438d6b4b6ed5 100644 (file)
@@ -1134,7 +1134,7 @@ static int __init xive_init_ipis(void)
        if (!ipi_domain)
                goto out_free_fwnode;
 
-       xive_ipis = kzalloc_objs(*xive_ipis, nr_node_ids, GFP_KERNEL);
+       xive_ipis = kzalloc_objs(*xive_ipis, nr_node_ids);
        if (!xive_ipis)
                goto out_free_domain;
 
index 752f1014d633e7d67f69c27b72088ed560c187ac..6ff741ee78036d01a6fe0f8e0421194ba87d623d 100644 (file)
@@ -503,8 +503,8 @@ int kvm_riscv_vcpu_pmu_event_info(struct kvm_vcpu *vcpu, unsigned long saddr_low
                }
        }
 
-       einfo = kvcalloc(num_events, sizeof(*einfo),
-                        GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
+       einfo = kvzalloc_objs(*einfo, num_events,
+                             GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
        if (!einfo) {
                ret = SBI_ERR_FAILURE;
                goto out;
index b0839e887221ecb1ea07aefd65f749b1e407eec2..5c73f43782a741504332392e26cc2e77d547cd0f 100644 (file)
@@ -2168,7 +2168,7 @@ static int kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
        if (args->count < 1 || args->count > KVM_S390_SKEYS_MAX)
                return -EINVAL;
 
-       keys = kvmalloc_array(args->count, sizeof(*keys), GFP_KERNEL_ACCOUNT);
+       keys = kvmalloc_objs(*keys, args->count, GFP_KERNEL_ACCOUNT);
        if (!keys)
                return -ENOMEM;
 
@@ -2205,7 +2205,7 @@ static int kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
        if (args->count < 1 || args->count > KVM_S390_SKEYS_MAX)
                return -EINVAL;
 
-       keys = kvmalloc_array(args->count, sizeof(*keys), GFP_KERNEL_ACCOUNT);
+       keys = kvmalloc_objs(*keys, args->count, GFP_KERNEL_ACCOUNT);
        if (!keys)
                return -ENOMEM;
 
index 3141f210fcd1b57404b95c93749bed82749c08c5..f40435505818563d2ffc05e2cacc11073f61097c 100644 (file)
@@ -196,7 +196,7 @@ static int rocket_job_push(struct rocket_job *job)
        if (check_add_overflow(job->in_bo_count, job->out_bo_count, &bo_count))
                return -EINVAL;
 
-       bos = kvmalloc_array(bo_count, sizeof(*bos), GFP_KERNEL);
+       bos = kvmalloc_objs(*bos, bo_count);
        if (!bos)
                return -ENOMEM;
        memcpy(bos, job->in_bos, job->in_bo_count * sizeof(void *));
index e4293458bf61986eec45eddfda08054ccce8dd17..a670722ddd5a07d212a730632a2f46af446e0e2f 100644 (file)
@@ -486,7 +486,8 @@ static u32 acpi_add_prt_dep(acpi_handle handle)
                        if (ACPI_FAILURE(status))
                                continue;
                        dep_devices.count = 1;
-                       dep_devices.handles = kcalloc(1, sizeof(*dep_devices.handles), GFP_KERNEL);
+                       dep_devices.handles = kzalloc_objs(*dep_devices.handles,
+                                                          1);
                        if (!dep_devices.handles) {
                                acpi_handle_err(handle, "failed to allocate memory\n");
                                continue;
@@ -499,7 +500,8 @@ static u32 acpi_add_prt_dep(acpi_handle handle)
                        if (!gsi_handle)
                                continue;
                        dep_devices.count = 1;
-                       dep_devices.handles = kcalloc(1, sizeof(*dep_devices.handles), GFP_KERNEL);
+                       dep_devices.handles = kzalloc_objs(*dep_devices.handles,
+                                                          1);
                        if (!dep_devices.handles) {
                                acpi_handle_err(handle, "failed to allocate memory\n");
                                continue;
@@ -526,7 +528,7 @@ static u32 acpi_add_irq_dep(acpi_handle handle)
                        continue;
 
                dep_devices.count = 1;
-               dep_devices.handles = kcalloc(1, sizeof(*dep_devices.handles), GFP_KERNEL);
+               dep_devices.handles = kzalloc_objs(*dep_devices.handles, 1);
                if (!dep_devices.handles) {
                        acpi_handle_err(handle, "failed to allocate memory\n");
                        continue;
index b136c339ddae74b693404303c05466dc0ff76191..cceaa3240ca489aad0fe71c9df16d366315441d7 100644 (file)
@@ -526,7 +526,7 @@ int fwnode_property_match_string(const struct fwnode_handle *fwnode,
        if (nval == 0)
                return -ENODATA;
 
-       const char **values __free(kfree) = kcalloc(nval, sizeof(*values), GFP_KERNEL);
+       const char **values __free(kfree) = kzalloc_objs(*values, nval);
        if (!values)
                return -ENOMEM;
 
index fb44b948cec87ba0d4159eb428d76065fcd28d91..9753dc789bdea9e3810ef43f2072b65b7afcda16 100644 (file)
@@ -656,7 +656,7 @@ static int __drbd_cfg_context_from_attrs(struct drbd_cfg_context *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_DRBD_CFG_CONTEXT_CTX_PEER_ADDR + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb, DRBD_A_DRBD_CFG_CONTEXT_CTX_PEER_ADDR + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_drbd_cfg_context_nl_policy, NULL);
@@ -714,7 +714,7 @@ static int __disk_conf_from_attrs(struct disk_conf *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_DISK_CONF_DISABLE_WRITE_SAME + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb, DRBD_A_DISK_CONF_DISABLE_WRITE_SAME + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_disk_conf_nl_policy, NULL);
@@ -871,7 +871,7 @@ static int __res_opts_from_attrs(struct res_opts *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_RES_OPTS_ON_NO_DATA + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb, DRBD_A_RES_OPTS_ON_NO_DATA + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_res_opts_nl_policy, NULL);
@@ -921,7 +921,7 @@ static int __net_conf_from_attrs(struct net_conf *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_NET_CONF_SOCK_CHECK_TIMEO + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb, DRBD_A_NET_CONF_SOCK_CHECK_TIMEO + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_net_conf_nl_policy, NULL);
@@ -1087,7 +1087,7 @@ static int __set_role_parms_from_attrs(struct set_role_parms *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_SET_ROLE_PARMS_ASSUME_UPTODATE + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb, DRBD_A_SET_ROLE_PARMS_ASSUME_UPTODATE + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_set_role_parms_nl_policy, NULL);
@@ -1133,7 +1133,7 @@ static int __resize_parms_from_attrs(struct resize_parms *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_RESIZE_PARMS_AL_STRIPE_SIZE + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb, DRBD_A_RESIZE_PARMS_AL_STRIPE_SIZE + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_resize_parms_nl_policy, NULL);
@@ -1195,7 +1195,7 @@ static int __start_ov_parms_from_attrs(struct start_ov_parms *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_START_OV_PARMS_OV_STOP_SECTOR + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb, DRBD_A_START_OV_PARMS_OV_STOP_SECTOR + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_start_ov_parms_nl_policy, NULL);
@@ -1245,7 +1245,7 @@ static int __new_c_uuid_parms_from_attrs(struct new_c_uuid_parms *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_NEW_C_UUID_PARMS_CLEAR_BM + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb, DRBD_A_NEW_C_UUID_PARMS_CLEAR_BM + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_new_c_uuid_parms_nl_policy, NULL);
@@ -1291,7 +1291,7 @@ static int __disconnect_parms_from_attrs(struct disconnect_parms *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_DISCONNECT_PARMS_FORCE_DISCONNECT + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb, DRBD_A_DISCONNECT_PARMS_FORCE_DISCONNECT + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_disconnect_parms_nl_policy, NULL);
@@ -1337,7 +1337,7 @@ static int __detach_parms_from_attrs(struct detach_parms *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_DETACH_PARMS_FORCE_DETACH + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb, DRBD_A_DETACH_PARMS_FORCE_DETACH + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_detach_parms_nl_policy, NULL);
@@ -1383,7 +1383,7 @@ static int __resource_info_from_attrs(struct resource_info *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_RESOURCE_INFO_RES_SUSP_FEN + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb, DRBD_A_RESOURCE_INFO_RES_SUSP_FEN + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_resource_info_nl_policy, NULL);
@@ -1441,7 +1441,7 @@ static int __device_info_from_attrs(struct device_info *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_DEVICE_INFO_DEV_DISK_STATE + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb, DRBD_A_DEVICE_INFO_DEV_DISK_STATE + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_device_info_nl_policy, NULL);
@@ -1487,7 +1487,7 @@ static int __connection_info_from_attrs(struct connection_info *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_CONNECTION_INFO_CONN_ROLE + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb, DRBD_A_CONNECTION_INFO_CONN_ROLE + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_connection_info_nl_policy, NULL);
@@ -1537,7 +1537,8 @@ static int __peer_device_info_from_attrs(struct peer_device_info *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_PEER_DEVICE_INFO_PEER_RESYNC_SUSP_DEPENDENCY + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb,
+                          DRBD_A_PEER_DEVICE_INFO_PEER_RESYNC_SUSP_DEPENDENCY + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_peer_device_info_nl_policy, NULL);
@@ -1599,7 +1600,8 @@ static int __resource_statistics_from_attrs(struct resource_statistics *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_RESOURCE_STATISTICS_RES_STAT_WRITE_ORDERING + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb,
+                          DRBD_A_RESOURCE_STATISTICS_RES_STAT_WRITE_ORDERING + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_resource_statistics_nl_policy, NULL);
@@ -1645,7 +1647,7 @@ static int __device_statistics_from_attrs(struct device_statistics *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_DEVICE_STATISTICS_HISTORY_UUIDS + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb, DRBD_A_DEVICE_STATISTICS_HISTORY_UUIDS + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_device_statistics_nl_policy, NULL);
@@ -1743,7 +1745,8 @@ static int __connection_statistics_from_attrs(struct connection_statistics *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_CONNECTION_STATISTICS_CONN_CONGESTED + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb,
+                          DRBD_A_CONNECTION_STATISTICS_CONN_CONGESTED + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_connection_statistics_nl_policy, NULL);
@@ -1789,7 +1792,8 @@ static int __peer_device_statistics_from_attrs(struct peer_device_statistics *s,
                *ret_nested_attribute_table = NULL;
        if (!tla)
                return -ENOMSG;
-       ntb = kcalloc(DRBD_A_PEER_DEVICE_STATISTICS_PEER_DEV_FLAGS + 1, sizeof(*ntb), GFP_KERNEL);
+       ntb = kzalloc_objs(*ntb,
+                          DRBD_A_PEER_DEVICE_STATISTICS_PEER_DEV_FLAGS + 1);
        if (!ntb)
                return -ENOMEM;
        err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_peer_device_statistics_nl_policy, NULL);
index 6c5bec7da97c707442eb8c68adc13b962727c453..47574a98fc86140df317292a272b1b3bdeb8b71e 100644 (file)
@@ -5390,7 +5390,7 @@ static int __ublk_ctrl_reg_buf(struct ublk_device *ub,
                       page_to_pfn(pages[i + 1]) == pfn + (i - start) + 1)
                        i++;
 
-               range = kzalloc(sizeof(*range), GFP_KERNEL);
+               range = kzalloc_obj(*range);
                if (!range) {
                        ret = -ENOMEM;
                        goto unwind;
@@ -5453,7 +5453,7 @@ static int ublk_ctrl_reg_buf(struct ublk_device *ub,
        nr_pages = buf_reg.len >> PAGE_SHIFT;
 
        /* Pin pages before any locks (may sleep) */
-       pages = kvmalloc_array(nr_pages, sizeof(*pages), GFP_KERNEL);
+       pages = kvmalloc_objs(*pages, nr_pages);
        if (!pages)
                return -ENOMEM;
 
index 1e28104ad9641ab08380d50b8635051031eefa55..1e4ad31d39a63f45b3bddd3d8a467d8d7d095beb 100644 (file)
@@ -42,7 +42,7 @@ static int lz4_setup_params(struct zcomp_params *params)
        if (!params->dict || !params->dict_sz)
                return 0;
 
-       dict_stream = kzalloc_obj(*dict_stream, GFP_KERNEL);
+       dict_stream = kzalloc_obj(*dict_stream);
        if (!dict_stream)
                return -ENOMEM;
 
index 01eae89952541f408c5a6b48c62272f2b1e1c37b..83c3592cd179e132ddefe4792d1907799181843e 100644 (file)
@@ -248,7 +248,7 @@ int __init ti_clk_add_component(struct device_node *node, struct clk_hw *hw,
                return -EINVAL;
        }
 
-       parent_data = kcalloc(num_parents, sizeof(*parent_data), GFP_KERNEL);
+       parent_data = kzalloc_objs(*parent_data, num_parents);
        if (!parent_data)
                return -ENOMEM;
 
index 0fef60e82107a5a53a01a6c5c0cd1020daf16c82..baf90a3fb49e108da65388646fc9f24608b051b4 100644 (file)
@@ -181,7 +181,7 @@ static void of_mux_clk_setup(struct device_node *node)
                pr_err("mux-clock %pOFn must have parents\n", node);
                return;
        }
-       parent_data = kcalloc(num_parents, sizeof(*parent_data), GFP_KERNEL);
+       parent_data = kzalloc_objs(*parent_data, num_parents);
        if (!parent_data)
                return;
 
index d4ff8b228f86f3d4749282cb9597ede99d036009..8bfd46d60843dda450b017ef7d9f25d7ff63ad44 100644 (file)
@@ -1624,7 +1624,7 @@ static struct freq_attr **get_freq_attrs(void)
        /* amd_pstate_{max_freq, lowest_nonlinear_freq, highest_perf} should always be visible */
        BUG_ON(!count);
 
-       attrs = kcalloc(count + 1, sizeof(struct freq_attr *), GFP_KERNEL);
+       attrs = kzalloc_objs(struct freq_attr *, count + 1);
        if (!attrs)
                return ERR_PTR(-ENOMEM);
 
index 4c163d7281b312f5372d89cdceba5016305fd29f..dacf586b26411da477b3b7263a72308a54ea7ed0 100644 (file)
@@ -533,7 +533,7 @@ int eip93_send_req(struct crypto_async_request *async,
 
        memcpy(iv, reqiv, rctx->ivsize);
 
-       rctx->sa_state = kzalloc(sizeof(*rctx->sa_state), GFP_KERNEL);
+       rctx->sa_state = kzalloc_obj(*rctx->sa_state);
        if (!rctx->sa_state)
                return -ENOMEM;
 
@@ -561,8 +561,7 @@ int eip93_send_req(struct crypto_async_request *async,
                        iv[3] = 0xffffffff;
                        crypto_inc((u8 *)iv, AES_BLOCK_SIZE);
 
-                       rctx->sa_state_ctr = kzalloc(sizeof(*rctx->sa_state_ctr),
-                                                    GFP_KERNEL);
+                       rctx->sa_state_ctr = kzalloc_obj(*rctx->sa_state_ctr);
                        if (!rctx->sa_state_ctr) {
                                err = -ENOMEM;
                                goto free_sa_state;
index e0d003b5035876feb7493dc28ae9799e5844368d..50e444da97e6eb373efd3abbe62a2a1f2f63026e 100644 (file)
@@ -59,8 +59,7 @@ static void *qat_zstd_alloc_scratch(void)
        if (!scratch->literals)
                goto error;
 
-       scratch->out_seqs = kvcalloc(QAT_MAX_SEQUENCES, sizeof(ZSTD_Sequence),
-                                    GFP_KERNEL);
+       scratch->out_seqs = kvzalloc_objs(ZSTD_Sequence, QAT_MAX_SEQUENCES);
        if (!scratch->out_seqs)
                goto error;
 
index eb5cd902dfb59b690a6c4c3fb7e508e7dff2329d..a3c069ca2baf296c72ee25f150797613fba8db94 100644 (file)
@@ -387,7 +387,7 @@ static int dthe_aes_run(struct crypto_engine *engine, void *areq)
                src_nents++;
                dst_nents++;
 
-               src = kmalloc_array(src_nents, sizeof(*src), GFP_ATOMIC);
+               src = kmalloc_objs(*src, src_nents, GFP_ATOMIC);
                if (!src) {
                        ret = -ENOMEM;
                        goto aes_ctr_src_alloc_err;
@@ -399,7 +399,7 @@ static int dthe_aes_run(struct crypto_engine *engine, void *areq)
                sg_set_buf(sg, pad_buf, pad_size);
 
                if (diff_dst) {
-                       dst = kmalloc_array(dst_nents, sizeof(*dst), GFP_ATOMIC);
+                       dst = kmalloc_objs(*dst, dst_nents, GFP_ATOMIC);
                        if (!dst) {
                                ret = -ENOMEM;
                                goto aes_ctr_dst_alloc_err;
@@ -624,7 +624,7 @@ static struct scatterlist *dthe_aead_prep_aad(struct scatterlist *sg,
        if (assoclen % AES_BLOCK_SIZE)
                aad_nents++;
 
-       aad_sg = kmalloc_array(aad_nents, sizeof(struct scatterlist), GFP_ATOMIC);
+       aad_sg = kmalloc_objs(struct scatterlist, aad_nents, GFP_ATOMIC);
        if (!aad_sg)
                return ERR_PTR(-ENOMEM);
 
@@ -680,7 +680,7 @@ static struct scatterlist *dthe_aead_prep_crypt(struct scatterlist *sg,
        if (cryptlen % AES_BLOCK_SIZE)
                crypt_nents++;
 
-       crypt_sg = kmalloc_array(crypt_nents, sizeof(struct scatterlist), GFP_ATOMIC);
+       crypt_sg = kmalloc_objs(struct scatterlist, crypt_nents, GFP_ATOMIC);
        if (!crypt_sg) {
                err = -ENOMEM;
                goto dthe_aead_prep_crypt_mem_err;
index e1f64b72308236629aeadc98c127d704464b880e..ac55641b0259ac07cde4a6f00a70136996f9975d 100644 (file)
@@ -474,7 +474,7 @@ static int hisi_uncore_mark_related_cpus(struct hisi_uncore_freq *uncore,
                return -EINVAL;
 
        len = rc;
-       u32 *num __free(kfree) = kcalloc(len, sizeof(*num), GFP_KERNEL);
+       u32 *num __free(kfree) = kzalloc_objs(*num, len);
        if (!num)
                return -ENOMEM;
 
index 856d0d302a5df40a4ae3c196e1cf828dc0316574..cb62e606d0a2b19e4484237854af2f83f670f4a7 100644 (file)
@@ -27,7 +27,7 @@ static struct dma_fence *mock_fence(void)
 {
        struct dma_fence *f;
 
-       f = kmalloc(sizeof(*f), GFP_KERNEL);
+       f = kmalloc_obj(*f);
        if (!f)
                return NULL;
 
index 4a9ab5822ffc3ae16bbd97059d41ea601b0f1a59..df6dd0046242355a9b8f8ef466f3a7e7a4717a21 100644 (file)
@@ -359,7 +359,7 @@ static long udmabuf_create(struct miscdevice *device,
        long ret = -EINVAL;
        u32 i, flags;
 
-       ubuf = kzalloc(sizeof(*ubuf), GFP_KERNEL);
+       ubuf = kzalloc_obj(*ubuf);
        if (!ubuf)
                return -ENOMEM;
 
@@ -387,7 +387,7 @@ static long udmabuf_create(struct miscdevice *device,
        if (ret)
                goto err;
 
-       folios = kvmalloc_array(max_nr_folios, sizeof(*folios), GFP_KERNEL);
+       folios = kvmalloc_objs(*folios, max_nr_folios);
        if (!folios) {
                ret = -ENOMEM;
                goto err;
index c133535d376566d3615f56bcdcc90092219797de..c8e2169877e92cd7b3dc11d619d3d3d54291ceaa 100644 (file)
@@ -1056,7 +1056,7 @@ static int switchtec_dma_chan_init(struct switchtec_dma_dev *swdma_dev,
        int se_buf_len, irq, rc;
        struct dma_chan *chan;
 
-       swdma_chan = kzalloc_obj(*swdma_chan, GFP_KERNEL);
+       swdma_chan = kzalloc_obj(*swdma_chan);
        if (!swdma_chan)
                return -ENOMEM;
 
@@ -1162,8 +1162,7 @@ static int switchtec_dma_chans_enumerate(struct switchtec_dma_dev *swdma_dev,
        struct dma_device *dma = &swdma_dev->dma_dev;
        int base, cnt, rc, i;
 
-       swdma_dev->swdma_chans = kcalloc(chan_cnt, sizeof(*swdma_dev->swdma_chans),
-                                        GFP_KERNEL);
+       swdma_dev->swdma_chans = kzalloc_objs(*swdma_dev->swdma_chans, chan_cnt);
 
        if (!swdma_dev->swdma_chans)
                return -ENOMEM;
@@ -1222,7 +1221,7 @@ static int switchtec_dma_create(struct pci_dev *pdev)
        /*
         * Create the switchtec dma device
         */
-       swdma_dev = kzalloc_obj(*swdma_dev, GFP_KERNEL);
+       swdma_dev = kzalloc_obj(*swdma_dev);
        if (!swdma_dev)
                return -ENOMEM;
 
index 97ec05d68bbbcea194e028a34bfb757665fa257e..9e65c4b1d99dd3d74b8fb76bbd40b00368488d2c 100644 (file)
@@ -813,7 +813,7 @@ static int init_one_mc(struct mc_priv *priv, struct platform_device *pdev, int i
        layers[1].is_virt_csrow = false;
 
        rc = -ENOMEM;
-       dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+       dev = kzalloc_obj(*dev);
        if (!dev)
                return rc;
 
index ef29fd223287dd5843d336cfbe0429d234e7aa3e..922777e86d588456edb477a5f32aea6aac282f8b 100644 (file)
@@ -1792,7 +1792,7 @@ static void *scmi_iterator_init(const struct scmi_protocol_handle *ph,
 {
        int ret;
 
-       struct scmi_iterator *i __free(kfree) = kzalloc(sizeof(*i), GFP_KERNEL);
+       struct scmi_iterator *i __free(kfree) = kzalloc_obj(*i);
        if (!i)
                return ERR_PTR(-ENOMEM);
 
index 0fd9581275f1736ceb4e3c5e209afa2607207771..f926c1f648221f6f7d26a9a01a4c018f1b8c848d 100644 (file)
@@ -169,7 +169,7 @@ static int qcom_tzmem_init_area(struct qcom_tzmem_area *area)
 {
        int ret;
 
-       u64 *handle __free(kfree) = kzalloc(sizeof(*handle), GFP_KERNEL);
+       u64 *handle __free(kfree) = kzalloc_obj(*handle);
        if (!handle)
                return -ENOMEM;
 
@@ -197,8 +197,7 @@ static int qcom_tzmem_pool_add_memory(struct qcom_tzmem_pool *pool,
 {
        int ret;
 
-       struct qcom_tzmem_area *area __free(kfree) = kzalloc(sizeof(*area),
-                                                            gfp);
+       struct qcom_tzmem_area *area __free(kfree) = kzalloc_obj(*area, gfp);
        if (!area)
                return -ENOMEM;
 
@@ -415,8 +414,7 @@ void *qcom_tzmem_alloc(struct qcom_tzmem_pool *pool, size_t size, gfp_t gfp)
 
        size = PAGE_ALIGN(size);
 
-       struct qcom_tzmem_chunk *chunk __free(kfree) = kzalloc(sizeof(*chunk),
-                                                              gfp);
+       struct qcom_tzmem_chunk *chunk __free(kfree) = kzalloc_obj(*chunk, gfp);
        if (!chunk)
                return NULL;
 
index cc747ab0237f2fd851b4bd3f42cba87065220df9..33d7c4a4181e6eda64459877d114279cddb4df1e 100644 (file)
@@ -2386,7 +2386,7 @@ static int ti_sci_set_irq(const struct ti_sci_handle *handle, u32 valid_params,
        if (ret || !(info->fw_caps & MSG_FLAG_CAPS_LPM_IRQ_CONTEXT_LOST))
                goto end;
 
-       irq = kzalloc_obj(*irq, GFP_KERNEL);
+       irq = kzalloc_obj(*irq);
        if (!irq) {
                ti_sci_manage_irq(handle, valid_params, src_id, src_index,
                                  dst_id, dst_host_irq, ia_id, vint,
index 87652d58d03fc2b6fbceca45149ab126fd98e228..1b3a1af8658d3849d06de3ca4355598cdf4fa98a 100644 (file)
@@ -316,7 +316,7 @@ int afu_dma_map_region(struct dfl_feature_dev_data *fdata,
        if (user_addr + length < user_addr)
                return -EINVAL;
 
-       region = kzalloc(sizeof(*region), GFP_KERNEL);
+       region = kzalloc_obj(*region);
        if (!region)
                return -ENOMEM;
 
index 5ce89f52b4b5c3d401b132ce4787a246f6f644f4..b0b65416d74dc13266ff3cb23e1b1f8fac1b892a 100644 (file)
@@ -886,8 +886,8 @@ gpio_aggregator_make_device_sw_node(struct gpio_aggregator *aggr)
        if (num_lines == 0)
                return NULL;
 
-       const char **line_names __free(kfree) = kcalloc(
-                               num_lines, sizeof(*line_names), GFP_KERNEL);
+       const char **line_names __free(kfree) = kzalloc_objs(*line_names,
+                                                            num_lines);
        if (!line_names)
                return ERR_PTR(-ENOMEM);
 
index a859deab2bca80a8e995fe4f140f0c79dc698a77..30e8009b5fcc7c8d234abc246d60f04c012242de 100644 (file)
@@ -518,7 +518,7 @@ static void gpio_mpsse_irq_enable(struct irq_data *irqd)
                 * Can't be devm because it uses a non-raw spinlock (illegal in
                 * this context, where a raw spinlock is held by our caller)
                 */
-               worker = kzalloc(sizeof(*worker), GFP_NOWAIT);
+               worker = kzalloc_obj(*worker, GFP_NOWAIT);
                if (!worker)
                        return;
 
index ef1b779e8ea64ef5dc8ef4b552852dff050a9824..0c73bec042670fc5706b4a93700e652cbaf3605e 100644 (file)
@@ -790,8 +790,7 @@ gpio_sim_make_bank_swnode(struct gpio_sim_bank *bank,
 
        line_names_size = gpio_sim_get_line_names_size(bank);
        if (line_names_size) {
-               line_names = kcalloc(line_names_size, sizeof(*line_names),
-                                    GFP_KERNEL);
+               line_names = kzalloc_objs(*line_names, line_names_size);
                if (!line_names)
                        return ERR_PTR(-ENOMEM);
 
index 7d0d366be37a48512898e0dfcdfbb20c44a4b78c..449fb1aed24b7a6d09fb684cabd2cc9c8ebbfcf2 100644 (file)
@@ -1429,8 +1429,7 @@ gpio_virtuser_make_device_swnode(struct gpio_virtuser_device *dev)
        memset(properties, 0, sizeof(properties));
 
        num_ids = list_count_nodes(&dev->lookup_list);
-       char **ids __free(kfree) = kcalloc(num_ids + 1, sizeof(*ids),
-                                          GFP_KERNEL);
+       char **ids __free(kfree) = kzalloc_objs(*ids, num_ids + 1);
        if (!ids)
                return ERR_PTR(-ENOMEM);
 
index 9f3b628d57934bc7df449120e2c929abf42d43e8..d1105b7ae43777f3cc8797aedb5099cdfd30c3ad 100644 (file)
@@ -2653,7 +2653,7 @@ static int gpio_chrdev_open(struct inode *inode, struct file *file)
        struct gpio_chardev_data *cdev;
        int ret = -ENOMEM;
 
-       cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
+       cdev = kzalloc_obj(*cdev);
        if (!cdev)
                return -ENOMEM;
 
index ef8ccaf17c9cee387bee377c0cb674242b79bd51..66d2325bfae8736f8c7f3cfccfc3d7c0f50e074e 100644 (file)
@@ -1178,7 +1178,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
        int base = 0;
        int ret;
 
-       gdev = kzalloc(sizeof(*gdev), GFP_KERNEL);
+       gdev = kzalloc_obj(*gdev);
        if (!gdev)
                return -ENOMEM;
        gc->gpiodev = gdev;
@@ -1218,7 +1218,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
                goto err_put_device;
        gdev->ngpio = gc->ngpio;
 
-       gdev->descs = kcalloc(gc->ngpio, sizeof(*gdev->descs), GFP_KERNEL);
+       gdev->descs = kzalloc_objs(*gdev->descs, gc->ngpio);
        if (!gdev->descs) {
                ret = -ENOMEM;
                goto err_put_device;
index a5553fcec28c2bc8ea41fea3cb23ae605b34075d..26e7a48b55f33205822a5d03f2f575f6ba0c1b7a 100644 (file)
@@ -411,16 +411,13 @@ int gpu_buddy_init(struct gpu_buddy *mm, u64 size, u64 chunk_size)
        if (!mm->used_scoreboard)
                goto out_free_free_scoreboard;
 
-       mm->free_trees = kmalloc_array(GPU_BUDDY_MAX_FREE_TREES,
-                                      sizeof(*mm->free_trees),
-                                      GFP_KERNEL);
+       mm->free_trees = kmalloc_objs(*mm->free_trees, GPU_BUDDY_MAX_FREE_TREES);
        if (!mm->free_trees)
                goto out_free_used_scoreboard;
 
        for_each_free_tree(i) {
-               mm->free_trees[i] = kmalloc_array(mm->max_order + 1,
-                                                 sizeof(struct rb_root),
-                                                 GFP_KERNEL);
+               mm->free_trees[i] = kmalloc_objs(struct rb_root,
+                                                mm->max_order + 1);
                if (!mm->free_trees[i])
                        goto out_free_tree;
 
@@ -430,9 +427,7 @@ int gpu_buddy_init(struct gpu_buddy *mm, u64 size, u64 chunk_size)
 
        mm->n_roots = hweight64(size);
 
-       mm->roots = kmalloc_array(mm->n_roots,
-                                 sizeof(struct gpu_buddy_block *),
-                                 GFP_KERNEL);
+       mm->roots = kmalloc_objs(struct gpu_buddy_block *, mm->n_roots);
        if (!mm->roots)
                goto out_free_tree;
 
index 87e15e39eb302d5a05e25e33a467cfd9641f3bbc..6ff9ffe47f356e9c28dcf21ab44cb39efe86f4c8 100644 (file)
@@ -603,9 +603,8 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool skip_vram_check,
                ring_count++;
        }
        if (ring_count)
-               coredump->rings = kvcalloc(ring_count,
-                                          sizeof(struct amdgpu_coredump_ring),
-                                          GFP_NOWAIT);
+               coredump->rings = kvzalloc_objs(struct amdgpu_coredump_ring,
+                                               ring_count, GFP_NOWAIT);
        if (coredump->rings) {
                for (i = 0, idx = 0; i < adev->num_rings && idx < ring_count; i++) {
                        struct amdgpu_coredump_ring *cdump_ring;
index 164e85b66e2d49908b410aca620a9ac14f816d15..62f5c5cbd7f94626519903a8466f942440a8bdbb 100644 (file)
@@ -1608,11 +1608,11 @@ int amdgpu_discovery_sysfs_early_init(struct amdgpu_device *adev, struct pci_dev
 
        discovery_bin = adev->discovery.bin;
 
-       early_entry = kzalloc(sizeof(*early_entry), GFP_KERNEL);
+       early_entry = kzalloc_obj(*early_entry);
        if (!early_entry)
                return -ENOMEM;
 
-       ip_top = kzalloc(sizeof(*ip_top), GFP_KERNEL);
+       ip_top = kzalloc_obj(*ip_top);
        if (!ip_top) {
                kfree(early_entry);
                return -ENOMEM;
index d5787d848d04407211e18ce583a4282ff0a2a31d..4a7f63fb2fadf5fc294ec30b50cfadfd3e834d63 100644 (file)
@@ -98,7 +98,7 @@ int amdgpu_lockdep_init(void)
        struct amdgpu_lockdep_dummy_locks *locks;
        unsigned long flags;
 
-       locks = kzalloc(sizeof(*locks), GFP_KERNEL);
+       locks = kzalloc_obj(*locks);
        if (!locks)
                return -ENOMEM;
 
index 95468b9463fb8470d1d66797999996b3a02b2031..78adfc839ef80ab3b53742ea99a1861a29a2b1fa 100644 (file)
@@ -1293,7 +1293,7 @@ amdgpu_ras_debugfs_table_read_uniras(struct amdgpu_device *adev,
                return -ENOMEM;
 
        if (num_recs) {
-               records = kvcalloc(num_recs, sizeof(*records), GFP_KERNEL);
+               records = kvzalloc_objs(*records, num_recs);
                if (!records) {
                        res = -ENOMEM;
                        goto out;
index d5a419776e932c93b43fbc8d2394d4da53a002d1..05abf4c31dce983cebb430a73c529d44e6389ef4 100644 (file)
@@ -2361,9 +2361,8 @@ void amdgpu_ttm_enable_buffer_funcs(struct amdgpu_device *adev)
        num_clear_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES);
        num_move_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES);
 
-       adev->mman.clear_entities = kcalloc(num_clear_entities,
-                                               sizeof(struct amdgpu_ttm_buffer_entity),
-                                               GFP_KERNEL);
+       adev->mman.clear_entities = kzalloc_objs(struct amdgpu_ttm_buffer_entity,
+                                                num_clear_entities);
        atomic_set(&adev->mman.next_clear_entity, 0);
        if (!adev->mman.clear_entities)
                goto error_free_default_entity;
index a98a6cfd4fba80a6943685511d4b42874bd0c458..71d34fd093858c58becabd81afe53085d63a22b3 100644 (file)
@@ -159,8 +159,8 @@ void amdgpu_umc_handle_bad_pages(struct amdgpu_device *adev,
                    adev->umc.ras->ecc_info_query_ras_error_address &&
                    adev->umc.max_ras_err_cnt_per_query) {
                        err_data->err_addr =
-                               kcalloc(adev->umc.max_ras_err_cnt_per_query,
-                                       sizeof(struct eeprom_table_record), GFP_KERNEL);
+                               kzalloc_objs(struct eeprom_table_record,
+                                            adev->umc.max_ras_err_cnt_per_query);
 
                        /* still call query_ras_error_address to clear error status
                         * even NOMEM error is encountered
index 4b023e024d9fb9b2f6321f88a4967e03bf204798..743b41db5b7cb51d58a8486b57629785285e934a 100644 (file)
@@ -227,7 +227,7 @@ static int amdgpu_userq_fence_alloc(struct amdgpu_usermode_queue *userq,
        struct amdgpu_userq_fence *userq_fence;
        void *entry;
 
-       userq_fence = kmalloc(sizeof(*userq_fence), GFP_KERNEL);
+       userq_fence = kmalloc_obj(*userq_fence);
        if (!userq_fence)
                return -ENOMEM;
 
@@ -244,9 +244,7 @@ static int amdgpu_userq_fence_alloc(struct amdgpu_usermode_queue *userq,
        } while (xas_retry(&xas, entry));
        rcu_read_unlock();
 
-       userq_fence->fence_drv_array = kvmalloc_array(xas.xa_index,
-                                                     sizeof(fence_drv),
-                                                     GFP_KERNEL);
+       userq_fence->fence_drv_array = kvmalloc_objs(fence_drv, xas.xa_index);
        if (!userq_fence->fence_drv_array) {
                mutex_unlock(&userq->fence_drv_lock);
                kfree(userq_fence);
index b43fc643668d21731adcb55500a2ea52b1d772af..7a007f4916bcc7d2511a533ef98613e0bcdcbf31 100644 (file)
@@ -316,8 +316,8 @@ static int amdgpu_virt_ras_realloc_eh_data_space(struct amdgpu_device *adev,
        if (align_space > AMDGPU_VIRT_RAS_BAD_PAGE_TABLE_MAX_CAPACITY)
                return -ENOMEM;
 
-       new_bps = kmalloc_array(align_space, sizeof(*data->bps), GFP_KERNEL);
-       new_bo = kcalloc(align_space, sizeof(*data->bps_bo), GFP_KERNEL);
+       new_bps = kmalloc_objs(*data->bps, align_space);
+       new_bo = kzalloc_objs(*data->bps_bo, align_space);
        if (!new_bps || !new_bo) {
                kfree(new_bps);
                kfree(new_bo);
@@ -355,7 +355,7 @@ static int amdgpu_virt_init_ras_err_handler_data(struct amdgpu_device *adev)
        if (!bps)
                goto bps_failure;
 
-       bps_bo = kcalloc(align_space, sizeof(*(*data)->bps_bo), GFP_KERNEL);
+       bps_bo = kzalloc_objs(*(*data)->bps_bo, align_space);
        if (!bps_bo)
                goto bps_bo_failure;
 
index 7fcfc150a7fc1b1cfcf6aa293154764e5ca1a7f6..504a286368ebd168d2e6ef63919db740ffcc2588 100644 (file)
@@ -1921,13 +1921,13 @@ static int criu_checkpoint_devices(struct kfd_process *p,
        struct kfd_criu_device_bucket *device_buckets = NULL;
        int ret = 0, i;
 
-       device_buckets = kvcalloc(num_devices, sizeof(*device_buckets), GFP_KERNEL);
+       device_buckets = kvzalloc_objs(*device_buckets, num_devices);
        if (!device_buckets) {
                ret = -ENOMEM;
                goto exit;
        }
 
-       device_priv = kvcalloc(num_devices, sizeof(*device_priv), GFP_KERNEL);
+       device_priv = kvzalloc_objs(*device_priv, num_devices);
        if (!device_priv) {
                ret = -ENOMEM;
                goto exit;
@@ -2047,17 +2047,17 @@ static int criu_checkpoint_bos(struct kfd_process *p,
        int ret = 0, pdd_index, bo_index = 0, id;
        void *mem;
 
-       bo_buckets = kvcalloc(num_bos, sizeof(*bo_buckets), GFP_KERNEL);
+       bo_buckets = kvzalloc_objs(*bo_buckets, num_bos);
        if (!bo_buckets)
                return -ENOMEM;
 
-       bo_privs = kvcalloc(num_bos, sizeof(*bo_privs), GFP_KERNEL);
+       bo_privs = kvzalloc_objs(*bo_privs, num_bos);
        if (!bo_privs) {
                ret = -ENOMEM;
                goto exit;
        }
 
-       files = kvcalloc(num_bos, sizeof(struct file *), GFP_KERNEL);
+       files = kvzalloc_objs(struct file *, num_bos);
        if (!files) {
                ret = -ENOMEM;
                goto exit;
@@ -2588,7 +2588,7 @@ static int criu_restore_bos(struct kfd_process *p,
        if (!bo_buckets)
                return -ENOMEM;
 
-       files = kvcalloc(args->num_bos, sizeof(struct file *), GFP_KERNEL);
+       files = kvzalloc_objs(struct file *, args->num_bos);
        if (!files) {
                ret = -ENOMEM;
                goto exit;
index a54fd9529dc9eb57c7f531508209e7879c43e8b5..0d2f9dbce0a9ffbc5b377dfdcdcb826f0ff0c505 100644 (file)
@@ -4180,7 +4180,7 @@ dm_test_destroy_connector(struct kunit *test, struct drm_device *drm)
 {
        struct amdgpu_dm_connector *aconnector;
 
-       aconnector = kzalloc(sizeof(*aconnector), GFP_KERNEL);
+       aconnector = kzalloc_obj(*aconnector);
        KUNIT_ASSERT_NOT_NULL(test, aconnector);
 
        KUNIT_ASSERT_EQ(test,
index 4dacddd23878951bbc5a4269e644544ea9984873..0d998f20425038035d08e42b1080c8591f50046c 100644 (file)
@@ -1445,7 +1445,7 @@ static void dm_test_crtc_destroy_state_no_stream(struct kunit *test)
        struct dm_crtc_state *dm_state;
 
        /* destroy_state kfree()s the state, so use a plain (unmanaged) alloc. */
-       dm_state = kzalloc_obj(*dm_state, GFP_KERNEL);
+       dm_state = kzalloc_obj(*dm_state);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dm_state);
 
        amdgpu_dm_crtc_destroy_state(NULL, &dm_state->base);
@@ -1475,7 +1475,7 @@ static void dm_test_crtc_destroy_state_releases_stream(struct kunit *test)
        kref_get(&stream->refcount);
 
        /* destroy_state kfree()s the state, so use a plain (unmanaged) alloc. */
-       dm_state = kzalloc_obj(*dm_state, GFP_KERNEL);
+       dm_state = kzalloc_obj(*dm_state);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dm_state);
        dm_state->stream = stream;
 
@@ -1569,7 +1569,7 @@ static void dm_test_crtc_handle_vblank_completes_cursor_only(struct kunit *test)
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, acrtc);
 
        /* drm_crtc_send_vblank_event() consumes (kfree()s) the event. */
-       event = kzalloc_obj(*event, GFP_KERNEL);
+       event = kzalloc_obj(*event);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, event);
 
        acrtc->base.dev = &adev->ddev;
@@ -1628,7 +1628,7 @@ dm_test_vblank_control_worker_setup(struct kunit *test, bool enable,
        kref_get(&stream->refcount);
 
        /* Worker kfree()s the work item, so it must be a plain allocation. */
-       work = kzalloc_obj(*work, GFP_KERNEL);
+       work = kzalloc_obj(*work);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, work);
        work->dm = &adev->dm;
        work->acrtc = acrtc;
index 28c36217f6a2176fedfcbcbb6d251cd07e81a127..861ee9eaa0321a3720e557edd240ac7d45abb9e1 100644 (file)
@@ -103,7 +103,7 @@ static enum dc_status dm_test_dp_read_hpd_rx_irq_data_ok(struct dc_link *link,
  */
 static struct dc_sink *dm_test_sink_create(struct dc_link *link)
 {
-       struct dc_sink *sink = kzalloc(sizeof(*sink), GFP_KERNEL);
+       struct dc_sink *sink = kzalloc_obj(*sink);
 
        if (!sink)
                return NULL;
@@ -2131,7 +2131,7 @@ static void dm_test_hpd_rx_offload_work_no_connector(struct kunit *test)
        offload_wq = kunit_kzalloc(test, sizeof(*offload_wq), GFP_KERNEL);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_wq);
 
-       offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL);
+       offload_work = kzalloc_obj(*offload_work);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);
        offload_work->offload_wq = offload_wq;
        offload_work->adev = adev;
@@ -2177,7 +2177,7 @@ static void dm_test_hpd_rx_offload_work_no_connection(struct kunit *test)
        link->dc = dc;
        aconn->dc_link = link;
 
-       offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL);
+       offload_work = kzalloc_obj(*offload_work);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);
        offload_work->offload_wq = offload_wq;
        offload_work->adev = adev;
@@ -2244,7 +2244,7 @@ static void dm_test_hpd_rx_offload_work_automated_test(struct kunit *test)
        link->connector_signal = SIGNAL_TYPE_DISPLAY_PORT;
        aconn->dc_link = link;
 
-       offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL);
+       offload_work = kzalloc_obj(*offload_work);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);
        offload_work->offload_wq = offload_wq;
        offload_work->adev = adev;
@@ -2315,7 +2315,7 @@ static void dm_test_hpd_rx_offload_work_link_loss(struct kunit *test)
        link->connector_signal = SIGNAL_TYPE_DISPLAY_PORT;
        aconn->dc_link = link;
 
-       offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL);
+       offload_work = kzalloc_obj(*offload_work);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);
        offload_work->offload_wq = offload_wq;
        offload_work->adev = adev;
@@ -3452,9 +3452,9 @@ static void dm_test_handle_hpd_work_out_of_range(struct kunit *test)
        struct amdgpu_device *adev;
 
        adev = dm_kunit_alloc_adev(test);
-       hpd_work = kzalloc(sizeof(*hpd_work), GFP_KERNEL);
+       hpd_work = kzalloc_obj(*hpd_work);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hpd_work);
-       hpd_work->dmub_notify = kzalloc(sizeof(*hpd_work->dmub_notify), GFP_KERNEL);
+       hpd_work->dmub_notify = kzalloc_obj(*hpd_work->dmub_notify);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hpd_work->dmub_notify);
        hpd_work->dmub_notify->type =
                (enum dmub_notification_type)ARRAY_SIZE(adev->dm.dmub_callback);
@@ -3899,9 +3899,9 @@ static void dm_test_handle_vmin_vmax_update(struct kunit *test)
        kref_get(&stream->refcount);
 
        /* The worker kfree()s both, so they must come from the slab. */
-       work = kzalloc(sizeof(*work), GFP_KERNEL);
+       work = kzalloc_obj(*work);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, work);
-       adjust = kzalloc(sizeof(*adjust), GFP_KERNEL);
+       adjust = kzalloc_obj(*adjust);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adjust);
 
        work->adev = adev;
index ba97092c7bb8559c90acdab76bc7589a1a0a0a1b..23ac8ae41c680bdb6185c8fae7e7259dc81970d8 100644 (file)
@@ -2945,7 +2945,7 @@ static void dm_test_plane_reset_initializes_state(struct kunit *test)
         * destroy-existing-state path. The destroy hook frees this state, so it
         * must be a plain (non-KUnit-managed) allocation.
         */
-       old_state = kzalloc(sizeof(*old_state), GFP_KERNEL);
+       old_state = kzalloc_obj(*old_state);
        KUNIT_ASSERT_NOT_NULL(test, old_state);
        plane->funcs = &dm_test_plane_reset_funcs;
        plane->state = &old_state->base;
@@ -3018,7 +3018,7 @@ static void dm_test_plane_destroy_state_minimal(struct kunit *test)
        KUNIT_ASSERT_NOT_NULL(test, plane);
 
        /* destroy_state frees the state itself, so use a plain allocation. */
-       dm_plane_state = kzalloc(sizeof(*dm_plane_state), GFP_KERNEL);
+       dm_plane_state = kzalloc_obj(*dm_plane_state);
        KUNIT_ASSERT_NOT_NULL(test, dm_plane_state);
 
        amdgpu_dm_plane_drm_plane_destroy_state(plane, &dm_plane_state->base);
index 3c10eec9b1e02e73bea7776eef0fab04f75921eb..5645866610fcc94a7da4c81dbea7e51bc82c24a0 100644 (file)
@@ -239,7 +239,7 @@ static void dm_test_atomic_destroy_state_no_context(struct kunit *test)
         * Use kzalloc(), not kunit_kzalloc(): dm_atomic_destroy_state() frees
         * the state itself, so KUnit-managed memory would be double-freed.
         */
-       dm_state = kzalloc(sizeof(*dm_state), GFP_KERNEL);
+       dm_state = kzalloc_obj(*dm_state);
        KUNIT_ASSERT_NOT_NULL(test, dm_state);
 
        /* context == NULL: dc_state_release() is skipped and the state is freed. */
index e2148cb3b8ab6547fbf7502871f57d8294ec3d87..bf80eaf23e9aeb5066a14982abf0aef031e753d4 100644 (file)
@@ -377,7 +377,7 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p
        }
        break;
        case AMDGPU_FAMILY_GC_11_5_4: {
-               struct clk_mgr_dcn42 *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL);
+               struct clk_mgr_dcn42 *clk_mgr = kzalloc_obj(*clk_mgr);
 
                if (clk_mgr == NULL) {
                        BREAK_TO_DEBUGGER();
index d71b0aed90c9a97776b27ee20ef46f320705e3df..7dd88d90eba2fbec74eacc37d37fe40e4e39cad6 100644 (file)
@@ -1595,7 +1595,7 @@ struct clk_mgr_internal *dcn60_clk_mgr_construct(
                struct dccg *dccg)
 {
        struct clk_log_info log_info = {0};
-       struct dcn60_clk_mgr *clk_mgr60 = kzalloc(sizeof(struct dcn60_clk_mgr), GFP_KERNEL);
+       struct dcn60_clk_mgr *clk_mgr60 = kzalloc_obj(struct dcn60_clk_mgr);
        struct clk_mgr_internal *clk_mgr;
 
        if (!clk_mgr60)
@@ -1644,7 +1644,7 @@ struct clk_mgr_internal *dcn60_clk_mgr_construct(
 
        clk_mgr->smu_present = false;
 
-       clk_mgr->base.bw_params = kzalloc(sizeof(*clk_mgr->base.bw_params), GFP_KERNEL);
+       clk_mgr->base.bw_params = kzalloc_obj(*clk_mgr->base.bw_params);
        if (!clk_mgr->base.bw_params)
                goto fail;
 
index 68f22801430575ebc9aafdc7887373434fc566bf..a98ed4617a0316d5e0a6c17f36c29cf7acb7df4a 100644 (file)
@@ -914,8 +914,7 @@ static bool dc_construct_update_scratch_pool(struct dc *dc)
        unsigned int i;
 
        for (i = 0; i < ARRAY_SIZE(dc->update_scratch_pool); i++) {
-               dc->update_scratch_pool[i] = kzalloc(
-                               sizeof(struct dc_update_scratch_space), GFP_KERNEL);
+               dc->update_scratch_pool[i] = kzalloc_obj(struct dc_update_scratch_space);
                if (!dc->update_scratch_pool[i])
                        return false;
                dc->update_scratch_in_use[i] = false;
index 88e825a6582cbf7193b93969b7a6f020c5e94acb..0b135a9e6c4f8347c134411c97dc892c17fbb0aa 100644 (file)
@@ -290,7 +290,7 @@ static void dc_plane_cm_free(struct kref *kref)
 
 struct dc_plane_cm *dc_plane_cm_create(void)
 {
-       struct dc_plane_cm *cm = kvzalloc(sizeof(*cm), GFP_KERNEL);
+       struct dc_plane_cm *cm = kvzalloc_obj(*cm);
 
        if (cm == NULL)
                goto alloc_fail;
index 3b03b152da22bb0a8bb8b0fa696b7fa0019a055b..c2fa7fd56acf7f146dbf4c1e21052ca3c450bad7 100644 (file)
@@ -358,7 +358,7 @@ struct dccg *dccg42_create(
        const struct dccg_shift *dccg_shift,
        const struct dccg_mask *dccg_mask)
 {
-       struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL);
+       struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn);
        struct dccg *base;
 
        if (dccg_dcn == NULL) {
index 8e2f88913e4cc7c745ed228408b2d154e6c65764..1d6d193b23c71b6fa4ed74fecc7a4649ca7b662a 100644 (file)
@@ -167,7 +167,7 @@ struct dccg *dccg60_create(
        const struct dccg_shift *dccg_shift,
        const struct dccg_mask *dccg_mask)
 {
-       struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL);
+       struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn);
        struct dccg *base;
 
        if (dccg_dcn == NULL) {
index b75bfea635fd40a19a93b57981ce851d8f1d4a98..cf9c7a2089a184fbc106c2305ed6534256e37ccb 100644 (file)
@@ -542,7 +542,7 @@ void dal_hw_ddc_init_i3cpad(
                *hw_ddc = NULL;
        }
 
-       *hw_ddc = kzalloc(sizeof(struct hw_ddc), GFP_KERNEL);
+       *hw_ddc = kzalloc_obj(struct hw_ddc);
        if (!*hw_ddc) {
                ASSERT_CRITICAL(false);
                return;
index f4d1ce9079ded27dca3a0d9a9f77c4dc1a425f09..3a87c1a26488f10383d54182e08aa3859bd02d25 100644 (file)
@@ -405,7 +405,7 @@ static void dcn42_irq_construct(struct irq_service *irq_service,
 
 struct irq_service *dal_irq_service_dcn42_create(struct irq_service_init_data *init_data)
 {
-       struct irq_service *irq_service = kzalloc(sizeof(*irq_service), GFP_KERNEL);
+       struct irq_service *irq_service = kzalloc_obj(*irq_service);
 
        if (!irq_service)
                return NULL;
index 99163346e7d9d08ddd998ce4cfd99d2725d02d92..651bae6b5ede1d0e4ab41f54cf62b8d5d1e83598 100644 (file)
@@ -406,8 +406,7 @@ static void dcn60_irq_construct(
 struct irq_service *dal_irq_service_dcn60_create(
        struct irq_service_init_data *init_data)
 {
-       struct irq_service *irq_service = kzalloc(sizeof(*irq_service),
-                                                 GFP_KERNEL);
+       struct irq_service *irq_service = kzalloc_obj(*irq_service);
 
        if (!irq_service)
                return NULL;
index 78b33b2dbae848e6c33c0babb60c5ad5490a0bad..2c87e33e909ee38a6e4228ad031b69b35c3bf4e5 100644 (file)
@@ -615,7 +615,7 @@ struct pg_cntl *pg_cntl42_create(
        const struct pg_cntl_shift *pg_cntl_shift,
        const struct pg_cntl_mask *pg_cntl_mask)
 {
-       struct dcn_pg_cntl *pg_cntl_dcn = kzalloc(sizeof(*pg_cntl_dcn), GFP_KERNEL);
+       struct dcn_pg_cntl *pg_cntl_dcn = kzalloc_obj(*pg_cntl_dcn);
        struct pg_cntl *base;
 
        if (pg_cntl_dcn == NULL) {
index dbb8bb7fc20d8fb46dd786d5b89d5fbe5f66626c..aecbcd28c2d94aa5cea2ecd907f98f477309e01a 100644 (file)
@@ -1135,7 +1135,7 @@ static struct hpo_frl_stream_encoder *dcn30_hpo_frl_stream_encoder_create(enum e
        }
 
        /* allocate HPO stream encoder and create VPG sub-block */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
        vpg = dcn30_vpg_create(ctx, vpg_inst);
        afmt = dcn30_afmt_create(ctx, afmt_inst);
 
@@ -1166,7 +1166,7 @@ static struct hpo_frl_link_encoder *dcn30_hpo_frl_link_encoder_create(enum engin
        ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
 
        /* allocate HPO link encoder */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_enc3)
                return NULL; /* out of memory */
 
index 88dcf8166378c2a0161402b953de35bde9fd6db3..f67b3e00bd86a2082633a1f7589dcd348f439973 100644 (file)
@@ -492,7 +492,7 @@ static struct hpo_frl_stream_encoder *dcn302_hpo_frl_stream_encoder_create(enum
                return NULL;
 
        /* allocate HPO stream encoder and create VPG sub-block */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
        vpg = dcn302_vpg_create(ctx, vpg_inst);
        afmt = dcn302_afmt_create(ctx, afmt_inst);
 
@@ -531,7 +531,7 @@ static struct hpo_frl_link_encoder *dcn302_hpo_frl_link_encoder_create(enum engi
        ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
 
        /* allocate HPO link encoder */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_enc3)
                return NULL; /* out of memory */
 
index 50b7c7b85facdd004f1c2f457824866143338603..9e1bf34cca2afa64edc82f2749a072e4075b0ec9 100644 (file)
@@ -479,7 +479,7 @@ static struct hpo_frl_stream_encoder *dcn303_hpo_frl_stream_encoder_create(enum
                return NULL;
 
        /* allocate HPO stream encoder and create VPG sub-block */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
        vpg = dcn303_vpg_create(ctx, vpg_inst);
        afmt = dcn303_afmt_create(ctx, afmt_inst);
 
@@ -518,7 +518,7 @@ static struct hpo_frl_link_encoder *dcn303_hpo_frl_link_encoder_create(enum engi
        ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
 
        /* allocate HPO link encoder */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_enc3)
                return NULL; /* out of memory */
 
index db56e30cf2592ff79d7eb0cfa4dbcf16068da68c..6359fbb574df0851255576f699b539bcf591a6fd 100644 (file)
@@ -1346,7 +1346,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(enum e
        }
 
        /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
        vpg = dcn31_vpg_create(ctx, vpg_inst);
        afmt = dcn31_afmt_create(ctx, afmt_inst);
 
@@ -1377,7 +1377,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin
        ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
 
        /* allocate HPO link encoder */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_enc3)
                return NULL; /* out of memory */
 
index 63f92e9da6d8b9b68eda1a195d5a055e653a23f0..0ddfceca69dd534fbd302dae0d72547be6f99f36 100644 (file)
@@ -1404,7 +1404,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(enum e
        }
 
        /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
        vpg = dcn31_vpg_create(ctx, vpg_inst);
        afmt = dcn31_afmt_create(ctx, afmt_inst);
 
@@ -1436,7 +1436,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin
        ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
 
        /* allocate HPO link encoder */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_enc3)
                return NULL; /* out of memory */
 
index 15c1615c5f45583a28fd8274a36caab2b5414593..a1894be8cbb2cc9ce948bc1bfec29ae95581fb5e 100644 (file)
@@ -1347,7 +1347,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(enum e
        }
 
        /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
        vpg = dcn31_vpg_create(ctx, vpg_inst);
        afmt = dcn31_afmt_create(ctx, afmt_inst);
 
@@ -1379,7 +1379,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin
        ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
 
        /* allocate HPO link encoder */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_enc3)
                return NULL; /* out of memory */
 
index a5ea35e45791f3c851c4ae5ba2dd8f27870961ce..4a2d56a196b42197697b9ad56c588a151edc4229 100644 (file)
@@ -1340,7 +1340,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(enum e
        }
 
        /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
        vpg = dcn31_vpg_create(ctx, vpg_inst);
        afmt = dcn31_afmt_create(ctx, afmt_inst);
 
@@ -1372,7 +1372,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin
        ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
 
        /* allocate HPO link encoder */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_enc3)
                return NULL; /* out of memory */
 
index 7c2a79015f4e30b4d256acb2f0834ac8148a7f3f..a2e66761b8ec03b79ea7fbb30395734dca442d9b 100644 (file)
@@ -1339,7 +1339,7 @@ static struct hpo_frl_stream_encoder *dcn32_hpo_frl_stream_encoder_create(enum e
        }
 
        /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
        vpg = dcn32_vpg_create(ctx, vpg_inst);
        afmt = dcn32_afmt_create(ctx, afmt_inst);
 
@@ -1375,7 +1375,7 @@ static struct hpo_frl_link_encoder *dcn32_hpo_frl_link_encoder_create(enum engin
        hpo_frl_link_encoder_reg_list(0);
 
        /* allocate HPO link encoder */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_enc3)
                return NULL; /* out of memory */
 
index 5ee9a5a8ec3cdb8d0e5d4f02764ee90df2eca6b3..4097093d9012e78e97f0ff52c2f9d3331aaffa91 100644 (file)
@@ -1314,7 +1314,7 @@ static struct hpo_frl_stream_encoder *dcn321_hpo_frl_stream_encoder_create(enum
        }
 
        /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
        vpg = dcn321_vpg_create(ctx, vpg_inst);
        afmt = dcn321_afmt_create(ctx, afmt_inst);
 
@@ -1350,7 +1350,7 @@ static struct hpo_frl_link_encoder *dcn321_hpo_frl_link_encoder_create(enum engi
        hpo_frl_link_encoder_reg_list(0);
 
        /* allocate HPO link encoder */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_enc3)
                return NULL; /* out of memory */
 
index 52826e96c1842384ade48861d68fe73901e40966..fd7a22fcca590602e4a32bb56c9d48ecf4e0c1bb 100644 (file)
@@ -1398,7 +1398,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(
                return NULL;
 
        /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
        vpg = dcn31_vpg_create(ctx, vpg_inst);
        afmt = dcn31_afmt_create(ctx, afmt_inst);
 
@@ -1430,7 +1430,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(
        hpo_frl_link_encoder_reg_list(0);
 
        /* allocate HPO link encoder */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_enc3)
                return NULL; /* out of memory */
 
index e3fc71307c914815e2271ef383d18d2c13a712ff..83248ee01d1123de9d4903367cd134256b2891ac 100644 (file)
@@ -1378,7 +1378,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(
                return NULL;
 
        /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
        vpg = dcn31_vpg_create(ctx, vpg_inst);
        afmt = dcn31_afmt_create(ctx, afmt_inst);
 
@@ -1410,7 +1410,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(
        hpo_frl_link_encoder_reg_list(0);
 
        /* allocate HPO link encoder */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_enc3)
                return NULL; /* out of memory */
 
index c019a657005d6d3a457447872934658f756859bf..8d1baa76c347f1dae56ff7c7721cbdb92646d8db 100644 (file)
@@ -1385,7 +1385,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(
                return NULL;
 
        /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
        vpg = dcn31_vpg_create(ctx, vpg_inst);
        afmt = dcn31_afmt_create(ctx, afmt_inst);
 
@@ -1417,7 +1417,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(
        hpo_frl_link_encoder_reg_list(0);
 
        /* allocate HPO link encoder */
-       hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_enc3)
                return NULL; /* out of memory */
 
index aced8ff657bf4b54ce9181c3c3e05e35b715f22d..0cfdca82bef0fd02656db4bd54a298195053132e 100644 (file)
@@ -1322,7 +1322,7 @@ static struct hpo_frl_stream_encoder *dcn401_hpo_frl_stream_encoder_create(
                return NULL;
 
        /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
-       hpo_enc401 = kzalloc(sizeof(struct dcn401_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc401 = kzalloc_obj(struct dcn401_hpo_frl_stream_encoder);
        vpg = dcn401_vpg_create(ctx, vpg_inst);
        afmt = dcn401_afmt_create(ctx, afmt_inst);
 
@@ -1353,7 +1353,7 @@ static struct hpo_frl_link_encoder *dcn401_hpo_frl_link_encoder_create(
        hpo_frl_link_encoder_reg_list(0);
 
        /* allocate HPO link encoder */
-       hpo_link_enc = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_link_enc = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_link_enc)
                return NULL; /* out of memory */
 
index b93d608b64a930cfc5a94ff4cb9030759dd15303..28192d6dda7a1b963fcbd506483d1abb5982b18d 100644 (file)
@@ -818,7 +818,7 @@ static struct dce_aux *dcn42_aux_engine_create(
        uint32_t inst)
 {
        struct aux_engine_dce110 *aux_engine =
-               kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL);
+               kzalloc_obj(struct aux_engine_dce110);
 
        if (!aux_engine)
                return NULL;
@@ -884,7 +884,7 @@ static struct dce_i2c_hw *dcn42_i2c_hw_create(
        uint32_t inst)
 {
        struct dce_i2c_hw *dce_i2c_hw =
-               kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL);
+               kzalloc_obj(struct dce_i2c_hw);
 
        if (!dce_i2c_hw)
                return NULL;
@@ -910,7 +910,7 @@ static struct clock_source *dcn42_clock_source_create(
        bool dp_clk_src)
 {
        struct dce110_clk_src *clk_src =
-               kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
+               kzalloc_obj(struct dce110_clk_src);
 
        if (!clk_src)
                return NULL;
@@ -929,8 +929,7 @@ static struct hubbub *dcn42_hubbub_create(struct dc_context *ctx)
 {
        int i;
 
-       struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub),
-                                         GFP_KERNEL);
+       struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub);
 
        if (!hubbub3)
                return NULL;
@@ -983,7 +982,7 @@ static struct hubp *dcn42_hubp_create(
        uint32_t inst)
 {
        struct dcn20_hubp *hubp2 =
-               kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL);
+               kzalloc_obj(struct dcn20_hubp);
 
        if (!hubp2)
                return NULL;
@@ -1025,7 +1024,7 @@ static struct dpp *dcn42_dpp_create(
        uint32_t inst)
 {
        struct dcn42_dpp *dpp42 =
-               kzalloc(sizeof(struct dcn42_dpp), GFP_KERNEL);
+               kzalloc_obj(struct dcn42_dpp);
 
        if (!dpp42)
                return NULL;
@@ -1051,8 +1050,7 @@ static struct mpc *dcn42_mpc_create(
        int num_mpcc,
        int num_rmu)
 {
-       struct dcn42_mpc *mpc401 = kzalloc(sizeof(struct dcn42_mpc),
-                                                                               GFP_KERNEL);
+       struct dcn42_mpc *mpc401 = kzalloc_obj(struct dcn42_mpc);
 
        if (!mpc401)
                return NULL;
@@ -1075,7 +1073,7 @@ static struct output_pixel_processor *dcn42_opp_create(
        struct dc_context *ctx, uint32_t inst)
 {
        struct dcn20_opp *opp4 =
-               kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL);
+               kzalloc_obj(struct dcn20_opp);
 
        if (!opp4) {
                BREAK_TO_DEBUGGER();
@@ -1098,7 +1096,7 @@ static struct timing_generator *dcn42_timing_generator_create(
        uint32_t instance)
 {
        struct optc *tgn10 =
-               kzalloc(sizeof(struct optc), GFP_KERNEL);
+               kzalloc_obj(struct optc);
 
        if (!tgn10)
                return NULL;
@@ -1136,7 +1134,7 @@ static struct link_encoder *dcn42_link_encoder_create(
        const struct encoder_init_data *enc_init_data)
 {
        struct dcn20_link_encoder *enc20 =
-               kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);
+               kzalloc_obj(struct dcn20_link_encoder);
 
        if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs))
                return NULL;
@@ -1202,7 +1200,7 @@ static struct vpg *dcn42_vpg_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
-       struct dcn31_vpg *vpg4 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL);
+       struct dcn31_vpg *vpg4 = kzalloc_obj(struct dcn31_vpg);
 
        if (!vpg4)
                return NULL;
@@ -1231,7 +1229,7 @@ static struct apg *dcn42_apg_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
-       struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL);
+       struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg);
 
        if (!apg31)
                return NULL;
@@ -1275,7 +1273,7 @@ static struct stream_encoder *dcn42_stream_encoder_create(
        } else
                return NULL;
 
-       enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL);
+       enc1 = kzalloc_obj(struct dcn10_stream_encoder);
        vpg = dcn42_vpg_create(ctx, vpg_inst);
        apg = dcn42_apg_create(ctx, apg_inst);
 
@@ -1325,7 +1323,7 @@ static struct hpo_frl_stream_encoder *dcn42_hpo_frl_stream_encoder_create(
                return NULL;
 
        /* allocate HPO stream encoder and create VPG sub-block */
-       hpo_enc42 = kzalloc(sizeof(struct dcn42_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc42 = kzalloc_obj(struct dcn42_hpo_frl_stream_encoder);
        vpg = dcn42_vpg_create(ctx, vpg_inst);
        apg = dcn42_apg_create(ctx, apg_inst);
 
@@ -1357,7 +1355,7 @@ static struct hpo_frl_link_encoder *dcn42_hpo_frl_link_encoder_create(
        hpo_frl_link_encoder_reg_list(0);
 
        /* allocate HPO link encoder */
-       hpo_link_enc = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_link_enc = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_link_enc)
                return NULL; /* out of memory */
 
@@ -1399,7 +1397,7 @@ static struct hpo_dp_stream_encoder *dcn42_hpo_dp_stream_encoder_create(
        apg_inst = hpo_dp_inst + 5;
 
        /* allocate HPO stream encoder and create VPG sub-block */
-       hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL);
+       hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder);
        vpg = dcn42_vpg_create(ctx, vpg_inst);
        apg = dcn42_apg_create(ctx, apg_inst);
 
@@ -1432,7 +1430,7 @@ static struct hpo_dp_link_encoder *dcn42_hpo_dp_link_encoder_create(
        struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31;
 
        /* allocate HPO link encoder */
-       hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL);
+       hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder);
        if (!hpo_dp_enc31)
                return NULL; /* out of memory */
 
@@ -1453,7 +1451,7 @@ static struct hpo_dp_link_encoder *dcn42_hpo_dp_link_encoder_create(
 static struct dce_hwseq *dcn42_hwseq_create(
        struct dc_context *ctx)
 {
-       struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
+       struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq);
 
 #undef REG_STRUCT
 #define REG_STRUCT hwseq_reg
@@ -1727,8 +1725,7 @@ static bool dcn42_dwbc_create(struct dc_context *ctx, struct resource_pool *pool
        uint32_t dwb_count = pool->res_cap->num_dwb;
 
        for (i = 0; i < dwb_count; i++) {
-               struct dcn30_dwbc *dwbc42 = kzalloc(sizeof(struct dcn30_dwbc),
-                                                                                       GFP_KERNEL);
+               struct dcn30_dwbc *dwbc42 = kzalloc_obj(struct dcn30_dwbc);
 
                if (!dwbc42) {
                        dm_error("DC: failed to create dwbc42!\n");
@@ -1764,8 +1761,7 @@ static bool dcn42_mmhubbub_create(struct dc_context *ctx, struct resource_pool *
        uint32_t pipe_count = pool->res_cap->num_dwb;
 
        for (i = 0; i < pipe_count; i++) {
-               struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub),
-                                                                                                  GFP_KERNEL);
+               struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub);
 
                if (!mcif_wb30) {
                        dm_error("DC: failed to create mcif_wb30!\n");
@@ -1793,7 +1789,7 @@ static struct display_stream_compressor *dcn42_dsc_create(
        struct dc_context *ctx, uint32_t inst)
 {
        struct dcn401_dsc *dsc =
-               kzalloc(sizeof(struct dcn401_dsc), GFP_KERNEL);
+               kzalloc_obj(struct dcn401_dsc);
 
        if (!dsc) {
                BREAK_TO_DEBUGGER();
@@ -1890,7 +1886,7 @@ static struct link_encoder *dcn42_link_enc_create_minimal(
        if ((unsigned int)(eng_id - ENGINE_ID_DIGA) >= ctx->dc->res_pool->res_cap->num_dig_link_enc)
                return NULL;
 
-       enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);
+       enc20 = kzalloc_obj(struct dcn20_link_encoder);
        if (!enc20)
                return NULL;
 
@@ -2441,7 +2437,7 @@ struct resource_pool *dcn42_create_resource_pool(
        struct dc *dc)
 {
        struct dcn42_resource_pool *pool =
-               kzalloc(sizeof(struct dcn42_resource_pool), GFP_KERNEL);
+               kzalloc_obj(struct dcn42_resource_pool);
 
        if (!pool)
                return NULL;
index 41f0c67f57fffa00d73fabadb446f55c30af1ee5..f36d0f828166f8ba5829fa2bffd8a7932cc711db 100644 (file)
@@ -870,7 +870,7 @@ static struct dce_aux *dcn42b_aux_engine_create(
        uint32_t inst)
 {
        struct aux_engine_dce110 *aux_engine =
-               kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL);
+               kzalloc_obj(struct aux_engine_dce110);
 
        if (!aux_engine)
                return NULL;
@@ -940,7 +940,7 @@ static struct dce_i2c_hw *dcn42b_i2c_hw_create(
        uint32_t inst)
 {
        struct dce_i2c_hw *dce_i2c_hw =
-               kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL);
+               kzalloc_obj(struct dce_i2c_hw);
 
        if (!dce_i2c_hw)
                return NULL;
@@ -968,7 +968,7 @@ static struct clock_source *dcn42b_clock_source_create(
        bool dp_clk_src)
 {
        struct dce110_clk_src *clk_src =
-               kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
+               kzalloc_obj(struct dce110_clk_src);
 
        if (!clk_src)
                return NULL;
@@ -988,8 +988,7 @@ static struct hubbub *dcn42b_hubbub_create(struct dc_context *ctx)
 {
        int i;
 
-       struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub),
-                                         GFP_KERNEL);
+       struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub);
 
        if (!hubbub3)
                return NULL;
@@ -1042,7 +1041,7 @@ static struct hubp *dcn42b_hubp_create(
        uint32_t inst)
 {
        struct dcn20_hubp *hubp2 =
-               kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL);
+               kzalloc_obj(struct dcn20_hubp);
 
        if (!hubp2)
                return NULL;
@@ -1084,7 +1083,7 @@ static struct dpp *dcn42b_dpp_create(
        uint32_t inst)
 {
        struct dcn42_dpp *dpp42b =
-               kzalloc(sizeof(struct dcn42_dpp), GFP_KERNEL);
+               kzalloc_obj(struct dcn42_dpp);
 
        if (!dpp42b)
                return NULL;
@@ -1110,8 +1109,7 @@ static struct mpc *dcn42b_mpc_create(
        int num_mpcc,
        int num_rmu)
 {
-       struct dcn42_mpc *mpc42b = kzalloc(sizeof(struct dcn42_mpc),
-                                                                               GFP_KERNEL);
+       struct dcn42_mpc *mpc42b = kzalloc_obj(struct dcn42_mpc);
 
        if (!mpc42b)
                return NULL;
@@ -1134,7 +1132,7 @@ static struct output_pixel_processor *dcn42b_opp_create(
        struct dc_context *ctx, uint32_t inst)
 {
        struct dcn20_opp *opp4 =
-               kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL);
+               kzalloc_obj(struct dcn20_opp);
 
        if (!opp4) {
                BREAK_TO_DEBUGGER();
@@ -1158,7 +1156,7 @@ static struct timing_generator *dcn42b_timing_generator_create(
        uint32_t instance)
 {
        struct optc *tgn10 =
-               kzalloc(sizeof(struct optc), GFP_KERNEL);
+               kzalloc_obj(struct optc);
 
        if (!tgn10)
                return NULL;
@@ -1196,7 +1194,7 @@ static struct link_encoder *dcn42b_link_encoder_create(
        const struct encoder_init_data *enc_init_data)
 {
        struct dcn20_link_encoder *enc20 =
-               kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);
+               kzalloc_obj(struct dcn20_link_encoder);
 
        if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs))
                return NULL;
@@ -1271,7 +1269,7 @@ static struct vpg *dcn42b_vpg_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
-       struct dcn31_vpg *vpg4 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL);
+       struct dcn31_vpg *vpg4 = kzalloc_obj(struct dcn31_vpg);
 
        if (!vpg4)
                return NULL;
@@ -1300,7 +1298,7 @@ static struct apg *dcn42b_apg_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
-       struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL);
+       struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg);
 
        if (!apg31)
                return NULL;
@@ -1344,7 +1342,7 @@ static struct stream_encoder *dcn42b_stream_encoder_create(
        } else
                return NULL;
 
-       enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL);
+       enc1 = kzalloc_obj(struct dcn10_stream_encoder);
        vpg = dcn42b_vpg_create(ctx, vpg_inst);
        apg = dcn42b_apg_create(ctx, apg_inst);
 
@@ -1404,7 +1402,7 @@ static struct hpo_dp_stream_encoder *dcn42b_hpo_dp_stream_encoder_create(
        apg_inst = hpo_dp_inst + 6;
 
        /* allocate HPO stream encoder and create VPG sub-block */
-       hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL);
+       hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder);
        vpg = dcn42b_vpg_create(ctx, vpg_inst);
        apg = dcn42b_apg_create(ctx, apg_inst);
 
@@ -1437,7 +1435,7 @@ static struct hpo_dp_link_encoder *dcn42b_hpo_dp_link_encoder_create(
        struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31;
 
        /* allocate HPO link encoder */
-       hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL);
+       hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder);
        if (!hpo_dp_enc31)
                return NULL; /* out of memory */
 
@@ -1457,7 +1455,7 @@ static struct hpo_dp_link_encoder *dcn42b_hpo_dp_link_encoder_create(
 static struct dce_hwseq *dcn42b_hwseq_create(
        struct dc_context *ctx)
 {
-       struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
+       struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq);
 
 #undef REG_STRUCT
 #define REG_STRUCT hwseq_reg
@@ -1716,8 +1714,7 @@ static bool dcn42b_dwbc_create(struct dc_context *ctx, struct resource_pool *poo
        uint32_t dwb_count = pool->res_cap->num_dwb;
 
        for (i = 0; i < dwb_count; i++) {
-               struct dcn30_dwbc *dwbc42 = kzalloc(sizeof(struct dcn30_dwbc),
-                                                                                       GFP_KERNEL);
+               struct dcn30_dwbc *dwbc42 = kzalloc_obj(struct dcn30_dwbc);
 
                if (!dwbc42) {
                        dm_error("DC: failed to create dwbc42!\n");
@@ -1753,8 +1750,7 @@ static bool dcn42b_mmhubbub_create(struct dc_context *ctx, struct resource_pool
        uint32_t pipe_count = pool->res_cap->num_dwb;
 
        for (i = 0; i < pipe_count; i++) {
-               struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub),
-                                                                                                  GFP_KERNEL);
+               struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub);
 
                if (!mcif_wb30) {
                        dm_error("DC: failed to create mcif_wb30!\n");
@@ -1782,7 +1778,7 @@ static struct display_stream_compressor *dcn42b_dsc_create(
        struct dc_context *ctx, uint32_t inst)
 {
        struct dcn401_dsc *dsc =
-               kzalloc(sizeof(struct dcn401_dsc), GFP_KERNEL);
+               kzalloc_obj(struct dcn401_dsc);
 
        if (!dsc) {
                BREAK_TO_DEBUGGER();
@@ -1875,7 +1871,7 @@ static struct link_encoder *dcn42b_link_enc_create_minimal(
        if ((unsigned int)(eng_id - ENGINE_ID_DIGA) >= ctx->dc->res_pool->res_cap->num_dig_link_enc)
                return NULL;
 
-       enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);
+       enc20 = kzalloc_obj(struct dcn20_link_encoder);
        if (!enc20)
                return NULL;
 
@@ -2439,7 +2435,7 @@ struct resource_pool *dcn42b_create_resource_pool(
        struct dc *dc)
 {
        struct dcn42b_resource_pool *pool =
-               kzalloc(sizeof(struct dcn42b_resource_pool), GFP_KERNEL);
+               kzalloc_obj(struct dcn42b_resource_pool);
 
        if (!pool)
                return NULL;
index 4b7668abf4dcd3ce8edafb1155af7ecb063507f6..d091ea55cb5d36145aea7c739b3eaaeaa0f6a9c3 100644 (file)
@@ -998,7 +998,7 @@ static struct dce_aux *dcn60_aux_engine_create(
        uint32_t inst)
 {
        struct aux_engine_dce110 *aux_engine =
-               kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL);
+               kzalloc_obj(struct aux_engine_dce110);
 
        if (!aux_engine)
                return NULL;
@@ -1037,7 +1037,7 @@ static struct dce_i2c_hw *dcn60_i2c_hw_create(
        uint32_t inst)
 {
        struct dce_i2c_hw *dce_i2c_hw =
-               kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL);
+               kzalloc_obj(struct dce_i2c_hw);
 
        if (!dce_i2c_hw)
                return NULL;
@@ -1061,7 +1061,7 @@ static struct clock_source *dcn60_clock_source_create(
                bool dp_clk_src)
 {
        struct dce110_clk_src *clk_src =
-               kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
+               kzalloc_obj(struct dce110_clk_src);
 
        if (!clk_src)
                return NULL;
@@ -1081,8 +1081,7 @@ static struct hubbub *dcn60_hubbub_create(struct dc_context *ctx)
 {
        int i;
 
-       struct dcn20_hubbub *hubbub2 = kzalloc(sizeof(struct dcn20_hubbub),
-                                         GFP_KERNEL);
+       struct dcn20_hubbub *hubbub2 = kzalloc_obj(struct dcn20_hubbub);
 
        if (!hubbub2)
                return NULL;
@@ -1136,7 +1135,7 @@ static struct hubp *dcn60_hubp_create(
        uint32_t inst)
 {
        struct dcn20_hubp *hubp2 =
-               kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL);
+               kzalloc_obj(struct dcn20_hubp);
 
        if (!hubp2)
                return NULL;
@@ -1168,7 +1167,7 @@ static struct dpp *dcn60_dpp_create(
        uint32_t inst)
 {
        struct dcn60_dpp *dpp60 =
-               kzalloc(sizeof(struct dcn60_dpp), GFP_KERNEL);
+               kzalloc_obj(struct dcn60_dpp);
 
        if (!dpp60)
                return NULL;
@@ -1194,8 +1193,7 @@ static struct mpc *dcn60_mpc_create(
                int num_mpcc,
                int num_rmu)
 {
-       struct dcn60_mpc *mpc60 = kzalloc(sizeof(struct dcn60_mpc),
-                                         GFP_KERNEL);
+       struct dcn60_mpc *mpc60 = kzalloc_obj(struct dcn60_mpc);
 
        if (!mpc60)
                return NULL;
@@ -1218,7 +1216,7 @@ static struct output_pixel_processor *dcn60_opp_create(
        struct dc_context *ctx, uint32_t inst)
 {
        struct dcn20_opp *opp2 =
-               kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL);
+               kzalloc_obj(struct dcn20_opp);
 
        if (!opp2) {
                BREAK_TO_DEBUGGER();
@@ -1242,7 +1240,7 @@ static struct timing_generator *dcn60_timing_generator_create(
                uint32_t instance)
 {
        struct optc *tgn10 =
-               kzalloc(sizeof(struct optc), GFP_KERNEL);
+               kzalloc_obj(struct optc);
 
        if (!tgn10)
                return NULL;
@@ -1282,7 +1280,7 @@ static struct link_encoder *dcn60_link_encoder_create(
        const struct encoder_init_data *enc_init_data)
 {
        struct dcn20_link_encoder *enc20 =
-               kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);
+               kzalloc_obj(struct dcn20_link_encoder);
 
        if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) {
                kfree(enc20);
@@ -1349,7 +1347,7 @@ static struct vpg *dcn60_vpg_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
-       struct dcn31_vpg *vpg6 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL);
+       struct dcn31_vpg *vpg6 = kzalloc_obj(struct dcn31_vpg);
 
        if (!vpg6)
                return NULL;
@@ -1378,7 +1376,7 @@ static struct apg *dcn60_apg_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
-       struct dcn31_apg *apg60 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL);
+       struct dcn31_apg *apg60 = kzalloc_obj(struct dcn31_apg);
 
        if (!apg60)
                return NULL;
@@ -1415,7 +1413,7 @@ static struct stream_encoder *dcn60_stream_encoder_create(
        } else
                return NULL;
 
-       enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL);
+       enc1 = kzalloc_obj(struct dcn10_stream_encoder);
        vpg = dcn60_vpg_create(ctx, vpg_inst);
        apg = dcn60_apg_create(ctx, apg_inst);
 
@@ -1462,7 +1460,7 @@ static struct hpo_frl_stream_encoder *dcn60_hpo_frl_stream_encoder_create(
                return NULL;
 
        /* allocate HPO stream encoder and create VPG, APG sub-blocks */
-       hpo_enc60 = kzalloc(sizeof(struct dcn401_hpo_frl_stream_encoder), GFP_KERNEL);
+       hpo_enc60 = kzalloc_obj(struct dcn401_hpo_frl_stream_encoder);
        vpg = dcn60_vpg_create(ctx, vpg_inst);
        apg = dcn60_apg_create(ctx, apg_inst);
 
@@ -1493,7 +1491,7 @@ static struct hpo_frl_link_encoder *dcn60_hpo_frl_link_encoder_create(
        hpo_frl_link_encoder_reg_list(0);
 
        /* allocate HPO link encoder */
-       hpo_link_enc = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
+       hpo_link_enc = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
        if (!hpo_link_enc)
                return NULL; /* out of memory */
 
@@ -1535,7 +1533,7 @@ static struct hpo_dp_stream_encoder *dcn60_hpo_dp_stream_encoder_create(
        apg_inst = hpo_dp_inst;
 
        /* allocate HPO stream encoder and create VPG sub-block */
-       hpo_dp_enc60 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL);
+       hpo_dp_enc60 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder);
        vpg = dcn60_vpg_create(ctx, vpg_inst);
        apg = dcn60_apg_create(ctx, apg_inst);
 
@@ -1568,7 +1566,7 @@ static struct hpo_dp_link_encoder *dcn60_hpo_dp_link_encoder_create(
        struct dcn31_hpo_dp_link_encoder *hpo_dp_enc60;
 
        /* allocate HPO link encoder */
-       hpo_dp_enc60 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL);
+       hpo_dp_enc60 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder);
        if (!hpo_dp_enc60)
                return NULL; /* out of memory */
 
@@ -1589,7 +1587,7 @@ static struct hpo_dp_link_encoder *dcn60_hpo_dp_link_encoder_create(
 static struct dce_hwseq *dcn60_hwseq_create(
        struct dc_context *ctx)
 {
-       struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
+       struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq);
 
 #undef REG_STRUCT
 #define REG_STRUCT hwseq_reg
@@ -1784,7 +1782,7 @@ static struct display_stream_compressor *dcn60_dsc_create(
        struct dc_context *ctx, uint32_t inst)
 {
        struct dcn60_dsc *dsc =
-               kzalloc(sizeof(struct dcn60_dsc), GFP_KERNEL);
+               kzalloc_obj(struct dcn60_dsc);
 
        if (!dsc) {
                BREAK_TO_DEBUGGER();
@@ -2363,7 +2361,7 @@ struct resource_pool *dcn60_create_resource_pool(
                struct dc *dc)
 {
        struct dcn60_resource_pool *pool =
-               kzalloc(sizeof(struct dcn60_resource_pool), GFP_KERNEL);
+               kzalloc_obj(struct dcn60_resource_pool);
 
        if (!pool)
                return NULL;
index ee15c14a899ee44d6c0cb30f3700b82834ffa059..2f9690e65ca95dba2cb2f610486c1114d790fb7d 100644 (file)
@@ -111,7 +111,7 @@ struct mod_power *mod_power_create(struct dc *dc,
        if (dc == NULL)
                goto fail_dc_null;
 
-       core_power = kzalloc(sizeof(struct core_power), GFP_KERNEL);
+       core_power = kzalloc_obj(struct core_power);
 
        if (core_power == NULL)
                goto fail_alloc_context;
@@ -129,8 +129,7 @@ struct mod_power *mod_power_create(struct dc *dc,
 
        for (i = 0; i < MOD_POWER_MAX_CONCURRENT_STREAMS; i++) {
                core_power->map[i].psr_context =
-                               kzalloc(sizeof(struct mod_power_psr_context),
-                                       GFP_KERNEL);
+                               kzalloc_obj(struct mod_power_psr_context);
                if (core_power->map[i].psr_context == NULL)
                        goto fail_construct;
        }
index 5e86889eaa8414fac228ca8111a3d9fdeff2ccc9..5f27dea4aa0a02a235ccc00f02bb8ccd6ce872fd 100644 (file)
@@ -705,8 +705,7 @@ void initialize_backlight_caps(struct core_power *core_power, unsigned int inst)
         * (do not want to use 256 bytes on the stack)
         */
        ext_backlight_caps = (struct dm_acpi_atif_backlight_caps *)
-               (kzalloc(sizeof(struct dm_acpi_atif_backlight_caps),
-                               GFP_KERNEL));
+               (kzalloc_obj(struct dm_acpi_atif_backlight_caps));
 
        if (ext_backlight_caps == NULL)
                return;
index 2393fa8d4e4b0ff3a5e29449027cf24b38ecae1d..bdf1e489369e6ef67ccf9dfa2ef45516c6062129 100644 (file)
@@ -2988,7 +2988,7 @@ static int smu7_init_voltage_dependency_on_display_clock_table(struct pp_hwmgr *
        if (!amdgpu_device_ip_get_ip_block(hwmgr->adev, AMD_IP_BLOCK_TYPE_DCE))
                return 0;
 
-       table = kzalloc(struct_size(table, entries, 4), GFP_KERNEL);
+       table = kzalloc_flex(*table, entries, 4);
        if (!table)
                return -ENOMEM;
 
index aa4daf8f7d6f2d67478d6f50b8fd816ab0ab221e..4f820db5f8dd2ef9b8e125cdba0c23add2513989 100644 (file)
@@ -222,7 +222,7 @@ static int smu_v15_0_8_tables_init(struct smu_context *smu)
 
        smu_table->metrics_time = 0;
 
-       driver_pptable = kzalloc(sizeof(PPTable_t), GFP_KERNEL);
+       driver_pptable = kzalloc_obj(PPTable_t);
        if (!driver_pptable)
                return -ENOMEM;
 
@@ -1026,7 +1026,7 @@ static int smu_v15_0_8_fru_get_product_info(struct smu_context *smu,
        struct amdgpu_device *adev = smu->adev;
 
        if (!adev->fru_info) {
-               adev->fru_info = kzalloc(sizeof(*adev->fru_info), GFP_KERNEL);
+               adev->fru_info = kzalloc_obj(*adev->fru_info);
                if (!adev->fru_info)
                        return -ENOMEM;
        }
index 6c37dc519eed5155fae59c328e87c620e4199d0f..446b935c1fc915d1197d76941d3f0b1c7a4fdf3f 100644 (file)
@@ -222,7 +222,7 @@ static int ras_cmd_get_cper_records(struct ras_core_context *ras_core,
        if (!buffer)
                return RAS_CMD__ERROR_GENERIC;
 
-       trace = kcalloc(trace_count, sizeof(*trace), GFP_KERNEL);
+       trace = kzalloc_objs(*trace, trace_count);
        if (!trace) {
                ret = RAS_CMD__ERROR_GENERIC;
                goto out;
@@ -316,7 +316,7 @@ static int ras_cmd_get_batch_trace_records(struct ras_core_context *ras_core,
            (input_data->start_batch_id >= overview.last_batch_id))
                return RAS_CMD__ERROR_INVALID_INPUT_SIZE;
 
-       trace_arry = kcalloc(trace_count, sizeof(*trace_arry), GFP_KERNEL);
+       trace_arry = kzalloc_objs(*trace_arry, trace_count);
        if (!trace_arry)
                return RAS_CMD__ERROR_GENERIC;
 
index fa923852fae4509b946a2ce393b9219145727f25..41034a5996ff45b504d68e26e9f82785ca19091f 100644 (file)
@@ -79,7 +79,7 @@ void drm_exec_init(struct drm_exec *exec, u32 flags, unsigned nr)
                nr = PAGE_SIZE / sizeof(void *);
 
        exec->flags = flags;
-       exec->objects = kvmalloc_objs(*exec->objects, nr, GFP_KERNEL);
+       exec->objects = kvmalloc_objs(*exec->objects, nr);
 
        /* If allocation here fails, just delay that till the first use */
        exec->max_objects = exec->objects ? nr : 0;
index 2fa170a29a6263637608cfeb2494091553ac8cc7..c23a5de27effa41445f008de9efe8e002836c020 100644 (file)
@@ -1619,7 +1619,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
                goto err_points;
        }
 
-       chains = kmalloc_objs(*chains, args->count_handles, GFP_KERNEL);
+       chains = kmalloc_objs(*chains, args->count_handles);
        if (!chains) {
                ret = -ENOMEM;
                goto err_points;
index 7f4178800afd7de378308df9749e9c217b7b8698..2fc41fb90aaa9a81343216c0fec7b228bae87534 100644 (file)
@@ -981,7 +981,7 @@ static struct drm_plane *qxl_create_plane(struct qxl_device *qdev,
                return ERR_PTR(-EINVAL);
        }
 
-       plane = kzalloc(sizeof(*plane), GFP_KERNEL);
+       plane = kzalloc_obj(*plane);
        if (!plane)
                return ERR_PTR(-ENOMEM);
 
index 2e7b3e87fea18839c9fd898fcbbd3da89e52a196..7583b6ebba2aaae659d44798d949787315714f0f 100644 (file)
@@ -22,7 +22,7 @@ tilcdc_panel_update_prop(struct of_changeset *ocs, struct device_node *node,
 {
        struct property *prop;
 
-       prop = kzalloc(sizeof(*prop), GFP_KERNEL);
+       prop = kzalloc_obj(*prop);
        if (!prop)
                return -ENOMEM;
 
index d81f7b8f4c650a7fa472e2fae2495eb1ee0b6eff..7ddb9d2dcb83dd7d53521d07436a03b974efac16 100644 (file)
@@ -136,7 +136,7 @@ struct drm_plane_state *vs_plane_duplicate_state(struct drm_plane *plane)
 
        vs_state_old = to_vs_plane_state(plane->state);
 
-       vs_state = kzalloc_obj(*vs_state, GFP_KERNEL);
+       vs_state = kzalloc_obj(*vs_state);
        if (!vs_state)
                return NULL;
 
@@ -166,7 +166,7 @@ void vs_plane_reset(struct drm_plane *plane)
                plane->state = NULL;
        }
 
-       vs_state = kzalloc_obj(*vs_state, GFP_KERNEL);
+       vs_state = kzalloc_obj(*vs_state);
        if (!vs_state)
                return;
 
index 216c77cd0d21b3c0f444de9cb8807bea96c0af82..149e6bcb5878c38d1ca7d65d8283131e4f4c3202 100644 (file)
@@ -293,9 +293,7 @@ int virtgpu_dma_buf_obj_resubmit(struct virtio_gpu_device *vgdev,
                return -ENOMEM;
        }
 
-       ents = kvmalloc_array(bo->sgt->nents,
-                             sizeof(struct virtio_gpu_mem_entry),
-                             GFP_KERNEL);
+       ents = kvmalloc_objs(struct virtio_gpu_mem_entry, bo->sgt->nents);
        if (!ents) {
                DRM_ERROR("failed to allocate ent list\n");
                return -ENOMEM;
index 7551b8c7766de056bdd9768513b36b73cd206ade..601e3f128c9f85f5f7b7b98de1ddb27774b7f305 100644 (file)
@@ -212,7 +212,7 @@ static struct config_group *make_crtc_group(struct config_group *group,
                if (dev->enabled)
                        return ERR_PTR(-EBUSY);
 
-               crtc = kzalloc(sizeof(*crtc), GFP_KERNEL);
+               crtc = kzalloc_obj(*crtc);
                if (!crtc)
                        return ERR_PTR(-ENOMEM);
 
@@ -368,7 +368,7 @@ static struct config_group *make_plane_group(struct config_group *group,
                if (dev->enabled)
                        return ERR_PTR(-EBUSY);
 
-               plane = kzalloc(sizeof(*plane), GFP_KERNEL);
+               plane = kzalloc_obj(*plane);
                if (!plane)
                        return ERR_PTR(-ENOMEM);
 
@@ -484,7 +484,7 @@ static struct config_group *make_encoder_group(struct config_group *group,
                if (dev->enabled)
                        return ERR_PTR(-EBUSY);
 
-               encoder = kzalloc(sizeof(*encoder), GFP_KERNEL);
+               encoder = kzalloc_obj(*encoder);
                if (!encoder)
                        return ERR_PTR(-ENOMEM);
 
@@ -651,7 +651,7 @@ static struct config_group *make_connector_group(struct config_group *group,
                if (dev->enabled)
                        return ERR_PTR(-EBUSY);
 
-               connector = kzalloc(sizeof(*connector), GFP_KERNEL);
+               connector = kzalloc_obj(*connector);
                if (!connector)
                        return ERR_PTR(-ENOMEM);
 
index 8ecadee6eea39e83d98070438a6a6999ee11c936..edd50bf8261eca0aea8df79d3324461272e0252a 100644 (file)
@@ -177,7 +177,7 @@ int xe_amc_init(struct xe_i2c *i2c)
 {
        struct xe_amc *amc;
 
-       amc = kzalloc(sizeof(*amc), GFP_KERNEL);
+       amc = kzalloc_obj(*amc);
        if (!amc)
                return -ENOMEM;
 
index 9e0176861cb642a56d7196ef8b582614274d0bd5..23952ad8951e280b3e83e8fff59a0d13e2449c6f 100644 (file)
@@ -4148,7 +4148,7 @@ static int fill_faults(struct xe_vm *vm,
        entry_size = sizeof(struct xe_vm_fault);
        count = args->size / entry_size;
 
-       fault_list = kcalloc(count, sizeof(struct xe_vm_fault), GFP_KERNEL);
+       fault_list = kzalloc_objs(struct xe_vm_fault, count);
        if (!fault_list)
                return -ENOMEM;
 
index ec966fc0a411c59f34e25f995d122daee136def8..c38a2b3b33d9e8c30605e427ed84e3dfa523aeab 100644 (file)
@@ -406,7 +406,7 @@ static int asus_kbd_fn_lock_set(struct asus_drvdata *drvdata, bool enabled)
        struct asus_work_action *action;
        unsigned long flags;
 
-       action = kzalloc(sizeof(struct asus_work_action), GFP_ATOMIC);
+       action = kzalloc_obj(struct asus_work_action, GFP_ATOMIC);
        if (!action)
                return -ENOMEM;
 
@@ -433,7 +433,7 @@ static int asus_kbd_wmi_fan_send(struct asus_drvdata *drvdata, u8 *report_data,
                return -EINVAL;
        }
 
-       action = kzalloc(sizeof(struct asus_work_action), GFP_NOWAIT);
+       action = kzalloc_obj(struct asus_work_action, GFP_NOWAIT);
        if (!action)
                return -ENOMEM;
 
@@ -746,7 +746,7 @@ static void asus_kbd_backlight_set(struct asus_hid_listener *listener, int brigh
 
        drvdata->kbd_backlight_brightness = brightness;
 
-       action = kzalloc(sizeof(struct asus_work_action), GFP_NOWAIT);
+       action = kzalloc_obj(struct asus_work_action, GFP_NOWAIT);
        if (!action)
                return;
 
index ac08cb2d0368fcd2869c2351ffecf2c5e15fe29e..0f364d43aa4b3d8597a345fc2bb9486d95d8557c 100644 (file)
@@ -759,7 +759,7 @@ static inline int steam_haptic_pulse(struct steam_device *steam, u8 pad,
 
        if (steam->quirks & STEAM_QUIRK_IBEX) {
                struct steam_ibex_output_report *report =
-                       kzalloc(sizeof(struct steam_ibex_output_report), GFP_KERNEL);
+                       kzalloc_obj(struct steam_ibex_output_report);
 
                if (!report)
                        return -ENOMEM;
@@ -798,7 +798,7 @@ static inline int steam_haptic_rumble(struct steam_device *steam,
 
        if (steam->quirks & STEAM_QUIRK_IBEX) {
                struct steam_ibex_output_report *report =
-                       kzalloc(sizeof(struct steam_ibex_output_report), GFP_KERNEL);
+                       kzalloc_obj(struct steam_ibex_output_report);
 
                if (!report)
                        return -ENOMEM;
index 23fb0cebd72ad1829832f6c859a2c8f2ab7dacf1..7a855b66730a6cd5f37392ac39bed2f86e4f5523 100644 (file)
@@ -469,7 +469,7 @@ static int steelseries_arctis_probe(struct hid_device *hdev,
                return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
 
        if (interface_num == info->sync_interface) {
-               sd = kzalloc_obj(*sd, GFP_KERNEL);
+               sd = kzalloc_obj(*sd);
                if (!sd)
                        return -ENOMEM;
 
index f4370617deacbe011d5c44a9ba0fc0b1255b3a0f..7e4cc6f55237a8945d51696a6520b2ecc31b805e 100644 (file)
@@ -694,12 +694,11 @@ void *vmbus_alloc_buffer(struct vmbus_channel *channel,
                return vzalloc(nr_pages << PAGE_SHIFT);
 
        /* Worst case: every chunk is a single page. */
-       chunks = kvmalloc_array(nr_pages, sizeof(*chunks),
-                               GFP_KERNEL | __GFP_ZERO);
+       chunks = kvmalloc_objs(*chunks, nr_pages, GFP_KERNEL | __GFP_ZERO);
        if (!chunks)
                goto err;
 
-       pages = kvmalloc_array(nr_pages, sizeof(*pages), GFP_KERNEL);
+       pages = kvmalloc_objs(*pages, nr_pages);
        if (!pages)
                goto err;
 
index 9cba97e811114ab119826d267dbcee39e0898647..39c1b793a8934f44941cf5374718af3e00247201 100644 (file)
@@ -939,7 +939,7 @@ static unsigned long process_hot_add(unsigned long pg_start,
         */
 
        if (rg_size != 0) {
-               ha_region = kzalloc(sizeof(struct hv_hotadd_state), GFP_KERNEL);
+               ha_region = kzalloc_obj(struct hv_hotadd_state);
                if (!ha_region)
                        return 0;
 
index ca56bd8b170e6e00f53636a4f059954aa12bfbb1..00e603b5e401d7ae5cc2551c53d6a2d6cf1b0460 100644 (file)
@@ -1476,9 +1476,9 @@ static int __init applesmc_init(void)
        applesmc_fan_config[smcreg.fan_count] = 0;
        applesmc_pwm_config[smcreg.fan_count] = 0;
 
-       applesmc_info_temp = kzalloc_obj(*applesmc_info_temp, GFP_KERNEL);
-       applesmc_info_fan = kzalloc_obj(*applesmc_info_fan, GFP_KERNEL);
-       applesmc_info_pwm = kzalloc_obj(*applesmc_info_pwm, GFP_KERNEL);
+       applesmc_info_temp = kzalloc_obj(*applesmc_info_temp);
+       applesmc_info_fan = kzalloc_obj(*applesmc_info_fan);
+       applesmc_info_pwm = kzalloc_obj(*applesmc_info_pwm);
        if (!applesmc_info_temp || !applesmc_info_fan || !applesmc_info_pwm) {
                ret = -ENOMEM;
                goto out_info;
@@ -1493,7 +1493,7 @@ static int __init applesmc_init(void)
        applesmc_info_pwm->type = hwmon_pwm;
        applesmc_info_pwm->config = applesmc_pwm_config;
 
-       applesmc_info_arr = kcalloc(4, sizeof(*applesmc_info_arr), GFP_KERNEL);
+       applesmc_info_arr = kzalloc_objs(*applesmc_info_arr, 4);
        if (!applesmc_info_arr) {
                ret = -ENOMEM;
                goto out_info;
@@ -1504,7 +1504,7 @@ static int __init applesmc_init(void)
        applesmc_info_arr[2] = applesmc_info_pwm;
        applesmc_info_arr[3] = NULL;
 
-       applesmc_chip = kzalloc_obj(*applesmc_chip, GFP_KERNEL);
+       applesmc_chip = kzalloc_obj(*applesmc_chip);
        if (!applesmc_chip) {
                ret = -ENOMEM;
                goto out_info;
@@ -1514,10 +1514,9 @@ static int __init applesmc_init(void)
        applesmc_chip->info = applesmc_info_arr;
 
        /* Create non-standard fanX_safe attributes group */
-       fan_safe_attrs = kcalloc(smcreg.fan_count,
-                                     sizeof(*fan_safe_attrs), GFP_KERNEL);
-       fan_safe_attr_list = kcalloc(smcreg.fan_count + 1,
-                                         sizeof(*fan_safe_attr_list), GFP_KERNEL);
+       fan_safe_attrs = kzalloc_objs(*fan_safe_attrs, smcreg.fan_count);
+       fan_safe_attr_list = kzalloc_objs(*fan_safe_attr_list,
+                                         smcreg.fan_count + 1);
        if (!fan_safe_attrs || !fan_safe_attr_list) {
                ret = -ENOMEM;
                goto out_info;
index 6d65c43d574fd63eaf08dc255c750606fc9365e2..928488a216d4eafa3cdb5f882ae5f44ddaff0448 100644 (file)
@@ -1679,7 +1679,7 @@ coresight_allocate_device_list(const char *prefix)
                        return list;
        }
 
-       list = kzalloc(sizeof(*list), GFP_KERNEL);
+       list = kzalloc_obj(*list);
        if (!list)
                return NULL;
 
index b7521b7ece3773efaf030b3e8c268a2eaa310ff7..6294b0b0cc8f710013493d78b8fd6300697528b0 100644 (file)
@@ -418,7 +418,7 @@ static struct i2c_gpio_scl_data *i2c_gpio_create_scl(struct device *dev)
                }
        }
 
-       scl = kzalloc(sizeof(*scl), GFP_KERNEL);
+       scl = kzalloc_obj(*scl);
        if (!scl) {
                if (sharable)
                        fwnode_handle_put(args.fwnode);
index ef5ad5abb788c94e5db4cc9baaf0dd67d77b34fc..e4da9c38eccb47765565cee09965b191b6493f30 100644 (file)
@@ -376,7 +376,7 @@ static struct xi3c_xfer *xi3c_master_alloc_xfer(unsigned int ncmds)
 {
        struct xi3c_xfer *xfer;
 
-       xfer = kzalloc_flex(*xfer, cmds, ncmds, GFP_KERNEL);
+       xfer = kzalloc_flex(*xfer, cmds, ncmds);
        if (!xfer)
                return NULL;
 
@@ -735,7 +735,7 @@ static int xi3c_master_send_bdcast_ccc_cmd(struct xi3c_master *master,
        if (!xfer)
                return -ENOMEM;
 
-       buf = kmalloc_objs(*buf, xfer_len, GFP_KERNEL);
+       buf = kmalloc_objs(*buf, xfer_len);
        if (!buf)
                return -ENOMEM;
 
index 505fa68ee539cffa5954861dd9770773d32e4823..5ae0d694d20cc7e005c1cb66e189144b68bc52cd 100644 (file)
@@ -796,8 +796,8 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
        struct ad7280_state *st = iio_priv(indio_dev);
        int i, ret;
 
-       unsigned int *channels __free(kfree) = kcalloc(st->scan_cnt, sizeof(*channels),
-                                                      GFP_KERNEL);
+       unsigned int *channels __free(kfree) = kzalloc_objs(*channels,
+                                                           st->scan_cnt);
        if (!channels)
                return IRQ_HANDLED;
 
index ecc02a427b92d3dd8966ed8d101e39186bd22f20..1bd82d3db5ea5c389fff3400b10af82309a315b3 100644 (file)
@@ -109,7 +109,7 @@ static int iio_dmaengine_buffer_submit_block(struct iio_dma_buffer_queue *queue,
                if (nents < 0)
                        return nents;
 
-               vecs = kmalloc_array(nents, sizeof(*vecs), GFP_ATOMIC);
+               vecs = kmalloc_objs(*vecs, nents, GFP_ATOMIC);
                if (!vecs)
                        return -ENOMEM;
 
index fb08e4f02520ddd8657789ccc05ffe49eb5895af..1f22275de55cae45ec4bc3fb6c7ae5e2e56a2ac8 100644 (file)
@@ -345,7 +345,7 @@ static struct iio_channel *iio_channel_get_sys(const char *name,
                return ERR_PTR(-ENODEV);
 
        struct iio_channel *channel __free(kfree) =
-               kzalloc(sizeof(*channel), GFP_KERNEL);
+               kzalloc_obj(*channel);
        if (!channel) {
                err = -ENOMEM;
                goto error_no_mem;
index a4014a230639471ddbca723babf762b2be0c1c02..4e8fbee3474547778d4624a1a1a9e397ee8b9572 100644 (file)
@@ -2943,7 +2943,7 @@ static int nldev_frmr_pools_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
        u32 aging_period;
        int err;
 
-       tb = kzalloc_objs(*tb, RDMA_NLDEV_ATTR_MAX, GFP_KERNEL);
+       tb = kzalloc_objs(*tb, RDMA_NLDEV_ATTR_MAX);
        if (!tb)
                return -ENOMEM;
 
index 05630f7c9155101f682f96852da582804ca7f687..103b8c9ca9695f40ea2f055fab4ab69bf151e5b9 100644 (file)
@@ -267,8 +267,7 @@ static int hns_roce_alloc_scc_param(struct hns_roce_dev *hr_dev)
        struct hns_roce_scc_param *scc_param;
        int i;
 
-       scc_param = kvcalloc(HNS_ROCE_SCC_ALGO_TOTAL, sizeof(*scc_param),
-                            GFP_KERNEL);
+       scc_param = kvzalloc_objs(*scc_param, HNS_ROCE_SCC_ALGO_TOTAL);
        if (!scc_param)
                return -ENOMEM;
 
index 78c10eea7328d0cb800abc0ab94a814d3cb6b037..01c91fec9b7eba92835855b4531ddfafe78990c4 100644 (file)
@@ -2344,7 +2344,7 @@ static int input_device_tune_vals(struct input_dev *dev)
        if (dev->max_vals >= max_vals)
                return 0;
 
-       vals = kcalloc(max_vals, sizeof(*vals), GFP_KERNEL);
+       vals = kzalloc_objs(*vals, max_vals);
        if (!vals)
                return -ENOMEM;
 
index 017c9502918045df746015cf150867cd03d50cfe..f2c1ba017d20a0c6ebc3bce9d4140be6c63b01dc 100644 (file)
@@ -115,8 +115,8 @@ static int adp5585_keys_parse_fw(const struct adp5585_dev *adp5585,
                                     "Too many keypad pins (%d) defined (max=%d)\n",
                                     n_pins, adp5585->n_pins);
 
-       unsigned int *keypad_pins __free(kfree) = kcalloc(n_pins, sizeof(*keypad_pins),
-                                                         GFP_KERNEL);
+       unsigned int *keypad_pins __free(kfree) = kzalloc_objs(*keypad_pins,
+                                                              n_pins);
        if (!keypad_pins)
                return -ENOMEM;
 
index 5736f4bc5a50afd141e1438289e3a3134f36d993..b9ad2381f885deefd526e76876b28a138480ee80 100644 (file)
@@ -1070,7 +1070,7 @@ static int atkbd_get_keymap_from_fwnode(struct atkbd *atkbd)
        if (n <= 0 || n > ATKBD_KEYMAP_SIZE)
                return -ENXIO;
 
-       u32 *ptr __free(kfree) = kcalloc(n, sizeof(*ptr), GFP_KERNEL);
+       u32 *ptr __free(kfree) = kzalloc_objs(*ptr, n);
        if (!ptr)
                return -ENOMEM;
 
index b1a0edcc49b4e5d4e22cb66a2b69511c37991399..c3244c1a375116b3f08511e329f8d3831f7c9b3c 100644 (file)
@@ -1844,7 +1844,7 @@ static int ims_pcu_line_setup(struct ims_pcu *pcu)
 {
        struct usb_host_interface *interface = pcu->ctrl_intf->cur_altsetting;
        struct usb_cdc_line_coding *line __free(kfree) =
-                               kmalloc(sizeof(*line), GFP_KERNEL);
+                               kmalloc_obj(*line);
        int error;
 
        if (!line)
index 7fb4cbb2aca2fa6f15108955ab1ecced99c75a1e..98d9c860d2db0e4e1fbdc7e48a9657f2ef2705cb 100644 (file)
@@ -232,7 +232,7 @@ int psmouse_smbus_init(struct psmouse *psmouse,
        struct psmouse_smbus_dev *smbdev;
        int error;
 
-       smbdev = kzalloc(sizeof(*smbdev), GFP_KERNEL);
+       smbdev = kzalloc_obj(*smbdev);
        if (!smbdev)
                return -ENOMEM;
 
index a7ccedfa459c4231717387e1c7d0cefdd22d3001..868dee9a2ed85814af40af782cc04446a9e6f45c 100644 (file)
@@ -84,7 +84,7 @@ static int serio_raw_open(struct inode *inode, struct file *file)
                if (serio_raw->dead)
                        return -ENODEV;
 
-               client = kzalloc(sizeof(*client), GFP_KERNEL);
+               client = kzalloc_obj(*client);
                if (!client)
                        return -ENOMEM;
 
index 50f8321e979cefe39e6e095ce56feee120fe3727..dd2fee2f560e68d82071f1c26d79a89b3de1c9f2 100644 (file)
@@ -796,7 +796,7 @@ static inline struct arm_smmu_invs *arm_smmu_invs_alloc(size_t num_invs)
 {
        struct arm_smmu_invs *new_invs;
 
-       new_invs = kzalloc(struct_size(new_invs, inv, num_invs), GFP_KERNEL);
+       new_invs = kzalloc_flex(*new_invs, inv, num_invs);
        if (!new_invs)
                return NULL;
        new_invs->max_invs = num_invs;
index 5c4b06eda5460da66cc9d7d570a4944ccb42dcf6..a664c70a6fe7378497a8115eeca8c29cf2c2f845 100644 (file)
@@ -76,7 +76,7 @@ static struct iommufd_group *iommufd_alloc_group(struct iommufd_ctx *ictx,
 {
        struct iommufd_group *new_igroup;
 
-       new_igroup = kzalloc_obj(*new_igroup, GFP_KERNEL);
+       new_igroup = kzalloc_obj(*new_igroup);
        if (!new_igroup)
                return ERR_PTR(-ENOMEM);
 
index 3b8067976eac00c15a8a75882f65a22425553210..e4d17a74817822fcf460904c3391eef187cf83dd 100644 (file)
@@ -49,7 +49,7 @@ int _iommufd_alloc_mmap(struct iommufd_ctx *ictx, struct iommufd_object *owner,
        if (!length || !PAGE_ALIGNED(length))
                return -EINVAL;
 
-       immap = kzalloc(sizeof(*immap), GFP_KERNEL);
+       immap = kzalloc_obj(*immap);
        if (!immap)
                return -ENOMEM;
        immap->owner = owner;
index 9b8b5eb714913708ccd9be6dd7364b88ef98f160..a80209a7429a31f6392615908e29814d0de05ae3 100644 (file)
@@ -54,7 +54,7 @@ noiommu_alloc_paging_flags(struct device *dev, u32 flags,
                (BIT(PT_FEAT_DYNAMIC_TOP) | BIT(PT_FEAT_AMDV1_ENCRYPT_TABLES) |
                 BIT(PT_FEAT_AMDV1_FORCE_COHERENCE));
 
-       dom = kzalloc(sizeof(*dom), GFP_KERNEL);
+       dom = kzalloc_obj(*dom);
        if (!dom)
                return ERR_PTR(-ENOMEM);
 
index 42c424496d0739cd461d8407c4401beedb6ee06f..5dac20b143a550e2b07b78f2604cbfc7562a98a2 100644 (file)
@@ -231,7 +231,7 @@ static struct iommu_domain *vsi_iommu_domain_alloc_paging(struct device *dev)
        struct vsi_iommu *iommu = dev_iommu_priv_get(dev);
        struct vsi_iommu_domain *vsi_domain;
 
-       vsi_domain = kzalloc(sizeof(*vsi_domain), GFP_KERNEL);
+       vsi_domain = kzalloc_obj(*vsi_domain);
        if (!vsi_domain)
                return NULL;
 
index b3feb6340b59e7f770c42189a17c4dfcb26f7cdc..4486645a4b6f2895f044c8e846fc4a80e4efeba4 100644 (file)
@@ -618,7 +618,7 @@ static int __init gicv5_irs_of_init_affinity(struct device_node *node,
        if (niaffids != ncpus)
                return -EINVAL;
 
-       u16 *iaffids __free(kfree) = kcalloc(niaffids, sizeof(*iaffids), GFP_KERNEL);
+       u16 *iaffids __free(kfree) = kzalloc_objs(*iaffids, niaffids);
        if (!iaffids)
                return -ENOMEM;
 
index 21c649a89a70636b45bd10fbbecda1210c9d2869..cb4ad34da058b06474cc3f4f51e64e6607b8ec3c 100644 (file)
@@ -331,7 +331,7 @@ static int redirect_domain_alloc(struct irq_domain *domain, unsigned int virq,
                struct irq_data *irq_data = irq_domain_get_irq_data(domain, virq + i);
                struct redirect_item *item;
 
-               item = kzalloc(sizeof(*item), GFP_KERNEL);
+               item = kzalloc_obj(*item);
                if (!item) {
                        pr_err("Alloc redirect descriptor failed\n");
                        goto out_free_resources;
index 26e52c3f8c68cfb4cd9c5dd07cb0556d168b8e01..f1ab5a77dcefc632a198a721f26ab882a5ae09b7 100644 (file)
@@ -188,7 +188,7 @@ static int __init realtek_setup_parents(struct device_node *node)
        struct irq_domain *domain;
 
        cnt = max(1, num_parents);
-       output = kcalloc(cnt, sizeof(*output), GFP_KERNEL);
+       output = kzalloc_objs(*output, cnt);
        if (!output)
                return -ENOMEM;
 
index 714f7fb97a2fd681d1398c952cb51d454ac9ad23..ea69c6b6b4f99b7a243c2f54e80b372399af2e0d 100644 (file)
@@ -783,7 +783,7 @@ static int mpxy_mbox_populate_channels(struct mpxy_mbox *mbox)
                return dev_err_probe(mbox->dev, -ENODEV, "no MPXY channels available\n");
 
        /* Allocate and fetch all channel IDs */
-       channel_ids = kcalloc(mbox->channel_count, sizeof(*channel_ids), GFP_KERNEL);
+       channel_ids = kzalloc_objs(*channel_ids, mbox->channel_count);
        if (!channel_ids)
                return -ENOMEM;
        rc = mpxy_get_channel_ids(mbox->channel_count, channel_ids);
index 66fa2f9d1fdc4e9631f38ebd8d9309aa8e500eb8..3479dfe5f70806685dbf48ff5a1b64388a55aa17 100644 (file)
@@ -322,7 +322,7 @@ static int inlinecrypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
                return -EINVAL;
        }
 
-       ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
+       ctx = kzalloc_obj(*ctx);
        if (!ctx) {
                ti->error = "Out of memory";
                return -ENOMEM;
index e1a783ee2032599ee9b38316b42a186ed7fd732e..1c9fcc746ec69a3ee958a93c685ad1d646d8ca1a 100644 (file)
@@ -810,7 +810,7 @@ static int llbitmap_expand_pages(struct llbitmap *llbitmap,
        if (nr_pages <= old_nr_pages)
                return 0;
 
-       pctl = kcalloc(nr_pages, sizeof(*pctl), GFP_NOIO);
+       pctl = kzalloc_objs(*pctl, nr_pages, GFP_NOIO);
        if (!pctl)
                return -ENOMEM;
 
@@ -846,7 +846,7 @@ static int llbitmap_alloc_pages(struct llbitmap *llbitmap)
        unsigned int nr_pages = max(used_pages, llbitmap_reserved_pages(llbitmap));
        int i;
 
-       llbitmap->pctl = kcalloc(nr_pages, sizeof(*llbitmap->pctl), GFP_NOIO);
+       llbitmap->pctl = kzalloc_objs(*llbitmap->pctl, nr_pages, GFP_NOIO);
        if (!llbitmap->pctl)
                return -ENOMEM;
 
index eac3bc9af99051b3268966d8a364bc4d5a2e15b6..4f3299a66b37d5c1d20c035f624d73f7a7c1cebd 100644 (file)
@@ -3105,7 +3105,7 @@ static int allegro_open(struct file *file)
        unsigned int cpb_size_max;
        unsigned int cpb_size_def;
 
-       channel = kzalloc(sizeof(*channel), GFP_KERNEL);
+       channel = kzalloc_obj(*channel);
        if (!channel)
                return -ENOMEM;
 
index 4801617f95599d64e0118f7f5d945e60c706a07d..218aad5d7dfb1336ae0cbf68cdc18c9744f4df27 100644 (file)
@@ -127,7 +127,7 @@ isp4if_gpu_mem_alloc(struct isp4_interface *ispif, u32 mem_size)
        struct device *dev = ispif->dev;
        int ret;
 
-       mem_info = kmalloc_obj(*mem_info, GFP_KERNEL);
+       mem_info = kmalloc_obj(*mem_info);
        if (!mem_info)
                return NULL;
 
@@ -368,7 +368,7 @@ static int isp4if_send_fw_cmd(struct isp4_interface *ispif, u32 cmd_id,
 
        /* Allocate the sync command object early and outside of the lock */
        if (sync) {
-               ele = kmalloc_obj(*ele, GFP_KERNEL);
+               ele = kmalloc_obj(*ele);
                if (!ele)
                        return -ENOMEM;
 
@@ -738,7 +738,7 @@ isp4if_alloc_buffer_node(struct isp4if_img_buf_info *buf_info)
 {
        struct isp4if_img_buf_node *node;
 
-       node = kmalloc_obj(*node, GFP_KERNEL);
+       node = kmalloc_obj(*node);
        if (node)
                node->buf_info = *buf_info;
 
index b5861d0cd0e8bb4da575772f97eb93afacd0c857..586a5adbedfa87025d4258fd75a312a9a7b05ae2 100644 (file)
@@ -232,7 +232,7 @@ int risp_core_job_prepare(struct rcar_isp_core *core)
        }
 
        /* Memory is released when the job is consumed. */
-       job = kzalloc(sizeof(*job), GFP_KERNEL);
+       job = kzalloc_obj(*job);
        if (!job)
                return -ENOMEM;
 
index b5117ee9f5fa056c3673c9bab9effb6b9353e5d9..7758487da3d3bddd202209214a95432f08c8a415 100644 (file)
@@ -164,7 +164,7 @@ static int igorplugusb_probe(struct usb_interface *intf,
        if (!ir)
                return -ENOMEM;
 
-       ir->request = kzalloc_obj(*ir->request, GFP_KERNEL);
+       ir->request = kzalloc_obj(*ir->request);
        if (!ir->request)
                goto fail;
 
index 7aa32b90cf1eb7fa0a05bf3dc506e60a262c9850..16ad4fd26357991db58744c6aa54f57bdc15dbe4 100644 (file)
@@ -135,7 +135,7 @@ static int mfd_match_of_node_to_dev(struct platform_device *pdev,
                return -EAGAIN;
 
 allocate_of_node:
-       of_entry = kzalloc(sizeof(*of_entry), GFP_KERNEL);
+       of_entry = kzalloc_obj(*of_entry);
        if (!of_entry)
                return -ENOMEM;
 
@@ -174,7 +174,7 @@ static int mfd_add_device(struct device *parent, int id,
        if (!pdev->mfd_cell)
                goto fail_device;
 
-       res = kcalloc(cell->num_resources, sizeof(*res), GFP_KERNEL);
+       res = kzalloc_objs(*res, cell->num_resources);
        if (!res)
                goto fail_device;
 
index ee49ac779d1afa8a3b2aaa9085ecc365e56c16f8..698f60aa9756533c957b3dccb0af3a68c87810fe 100644 (file)
@@ -96,7 +96,7 @@ static int ucb1x00_assabet_add(struct ucb1x00_dev *dev)
 
        struct ucb1x00_assabet_priv *priv;
 
-       priv = kzalloc_obj(*priv, GFP_KERNEL);
+       priv = kzalloc_obj(*priv);
        if (!priv)
                return -ENOMEM;
 
index da4277ced4d63b0a2e387dfa5e826eb946c18da3..25cf33fe1ec18f1479d1a0c3d452eeae837b50ac 100644 (file)
@@ -166,7 +166,7 @@ static int mtd_virt_concat_create_item(struct device_node *parts,
                        return 0;
        }
 
-       item = kzalloc_flex(*item, nodes, count, GFP_KERNEL);
+       item = kzalloc_flex(*item, nodes, count);
        if (!item)
                return -ENOMEM;
 
@@ -182,7 +182,7 @@ static int mtd_virt_concat_create_item(struct device_node *parts,
        for (i = 1; i < count; i++)
                item->nodes[i] = of_parse_phandle(parts, CONCAT_PROP, (i - 1));
 
-       concat = kzalloc_flex(*concat, subdev, count, GFP_KERNEL);
+       concat = kzalloc_flex(*concat, subdev, count);
        if (!concat) {
                kfree(item);
                return -ENOMEM;
index c97167d51fe2d8a5d101603ecb2307d2a504bbd1..d54d309c30a0cd9c589ea562adec71df833c7458 100644 (file)
@@ -639,7 +639,7 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[],       /* subdevices to c
        printk(KERN_NOTICE "into device \"%s\"\n", name);
 
        /* allocate the device structure */
-       concat = kzalloc_flex(*concat, subdev, num_devs, GFP_KERNEL);
+       concat = kzalloc_flex(*concat, subdev, num_devs);
        if (!concat) {
                printk
                    ("memory allocation error while creating concatenated device \"%s\"\n",
index d67604a55b9f9dafe6410baaab4c04fbedc85a6a..2ddfeaaa06906962568dd362d42c08af457588cc 100644 (file)
@@ -97,7 +97,7 @@ int mv88e6xxx_cls_flower_add(struct dsa_switch *ds, int port,
                goto err_unlock;
        }
 
-       entry = kzalloc(sizeof(*entry), GFP_KERNEL);
+       entry = kzalloc_obj(*entry);
        if (!entry) {
                err = -ENOMEM;
                goto err_unlock;
index dfad1bdbc44d8f8fb1135b01338134787c0251fb..73d0caf257006f2e45829590333bd3c424b1321c 100644 (file)
@@ -439,8 +439,7 @@ int eea_adminq_dev_status(struct eea_net *enet,
        q_num = enet->cfg.rx_ring_num + enet->cfg.tx_ring_num + 1;
        io_num = enet->cfg.rx_ring_num + enet->cfg.tx_ring_num;
 
-       req = kcalloc(q_num, sizeof(struct eea_aq_queue_drv_status),
-                     GFP_KERNEL);
+       req = kzalloc_objs(struct eea_aq_queue_drv_status, q_num);
        if (!req)
                return -ENOMEM;
 
@@ -486,11 +485,11 @@ void eea_adminq_config_host_info(struct eea_net *enet)
        struct eea_aq_host_info_rep *rep;
        int rc = -ENOMEM;
 
-       cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
+       cfg = kzalloc_obj(*cfg);
        if (!cfg)
                return;
 
-       rep = kzalloc(sizeof(*rep), GFP_KERNEL);
+       rep = kzalloc_obj(*rep);
        if (!rep)
                goto err_free_cfg;
 
index 63e68580de940d9c2a3b43b0f59089742848d33c..0af6c95b5e63ebd01e876cb387e39da03e6bcb8d 100644 (file)
@@ -62,7 +62,7 @@ static int eea_alloc_irq_blks(struct eea_net *enet)
 
        num = enet->edev->rx_num;
 
-       irq_blks = kvcalloc(num, sizeof(*blk), GFP_KERNEL);
+       irq_blks = kvzalloc_objs(*blk, num);
        if (!irq_blks)
                return -ENOMEM;
 
@@ -194,11 +194,11 @@ static int eea_alloc_rxtx_q_mem(struct eea_net_init_ctx *ctx)
        struct eea_net_tx *tx;
        int err, i;
 
-       ctx->tx = kvcalloc(ctx->cfg.tx_ring_num, sizeof(*ctx->tx), GFP_KERNEL);
+       ctx->tx = kvzalloc_objs(*ctx->tx, ctx->cfg.tx_ring_num);
        if (!ctx->tx)
                return -ENOMEM;
 
-       ctx->rx = kvcalloc(ctx->cfg.rx_ring_num, sizeof(*ctx->rx), GFP_KERNEL);
+       ctx->rx = kvzalloc_objs(*ctx->rx, ctx->cfg.rx_ring_num);
        if (!ctx->rx)
                goto err_free_tx;
 
@@ -601,7 +601,7 @@ static int eea_netdev_init_features(struct net_device *netdev,
        int err;
        u32 mtu;
 
-       cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
+       cfg = kzalloc_obj(*cfg);
        if (!cfg)
                return -ENOMEM;
 
index 9872e360dd5d097bdcb45c88dc290543119a2b4a..c625b58b26f05ac673b99e2292726d4cdf4481e4 100644 (file)
@@ -651,7 +651,7 @@ static int eea_pci_probe(struct pci_dev *pci_dev,
        struct eea_device *edev;
        int err;
 
-       ep_dev = kzalloc(sizeof(*ep_dev), GFP_KERNEL);
+       ep_dev = kzalloc_obj(*ep_dev);
        if (!ep_dev)
                return -ENOMEM;
 
index 99dcabd094b894499f1d52ec9c49f0e7af8c0364..fac7d4647ecb3dc00cf0fb71e98528ebed135f08 100644 (file)
@@ -217,7 +217,7 @@ struct eea_ring *eea_ering_alloc(u32 index, u32 num, struct eea_device *edev,
        if (!cq_desc_size || !is_power_of_2(cq_desc_size))
                return NULL;
 
-       ering = kzalloc(sizeof(*ering), GFP_KERNEL);
+       ering = kzalloc_obj(*ering);
        if (!ering)
                return NULL;
 
index a3f0d2a79ad8be335d8324d8210342c229e7b443..5dfb7cb2ba6d22c8a7899b99d9a81b10adde0c04 100644 (file)
@@ -764,7 +764,7 @@ struct eea_net_rx *eea_alloc_rx(struct eea_net_init_ctx *ctx, u32 idx)
        struct eea_net_rx *rx;
        int err;
 
-       rx = kzalloc(sizeof(*rx), GFP_KERNEL);
+       rx = kzalloc_obj(*rx);
        if (!rx)
                return rx;
 
@@ -786,8 +786,7 @@ struct eea_net_rx *eea_alloc_rx(struct eea_net_init_ctx *ctx, u32 idx)
        rx->dma_dev = ctx->edev->dma_dev;
 
        /* meta */
-       rx->meta = kvcalloc(ctx->cfg.rx_ring_depth,
-                           sizeof(*rx->meta), GFP_KERNEL);
+       rx->meta = kvzalloc_objs(*rx->meta, ctx->cfg.rx_ring_depth);
        if (!rx->meta)
                goto err_free_rx;
 
index 85fb0e9ca5ba6e01f879359c0e590906590a6dd5..c9292bca1a8bda70e6ff1a7572436c577e34a4cc 100644 (file)
@@ -480,8 +480,7 @@ int eea_alloc_tx(struct eea_net_init_ctx *ctx, struct eea_net_tx *tx, u32 idx)
        tx->dma_dev = ctx->edev->dma_dev;
 
        /* meta */
-       tx->meta = kvcalloc(ctx->cfg.tx_ring_depth,
-                           sizeof(*tx->meta), GFP_KERNEL);
+       tx->meta = kvzalloc_objs(*tx->meta, ctx->cfg.tx_ring_depth);
        if (!tx->meta)
                goto err_free_tx;
 
index 922e3ec8af1b9d014a3cef854c0187c43bcc6c03..419e4b6ac98316498e1be57d2b2efc02647ec3f3 100644 (file)
@@ -810,8 +810,7 @@ void pdsc_host_mem_add(struct pdsc *pdsc)
        if (count == 0)
                return;
 
-       pdsc->host_mem_reqs = kzalloc_objs(*pdsc->host_mem_reqs, count,
-                                          GFP_KERNEL);
+       pdsc->host_mem_reqs = kzalloc_objs(*pdsc->host_mem_reqs, count);
        if (!pdsc->host_mem_reqs) {
                dev_err(pdsc->dev, "failed to alloc host_mem_reqs array\n");
                return;
index 5ccf017f6af474dfbc124bf5dc686b75b409c6b3..8551ce3cd86a0bedb628903141c677d69499a2a7 100644 (file)
@@ -382,7 +382,7 @@ static int pdsc_send_package_data(struct pldmfw *context, const u8 *data,
        if (!length)
                return 0;
 
-       deferred = kmalloc_obj(*deferred, GFP_KERNEL);
+       deferred = kmalloc_obj(*deferred);
        if (!deferred)
                return -ENOMEM;
 
@@ -505,7 +505,7 @@ static int pdsc_send_component_table(struct pldmfw *context,
                component->version_string, component->index,
                component->component_size, transfer_flag);
 
-       component_priv = kzalloc_obj(*component_priv, GFP_KERNEL);
+       component_priv = kzalloc_obj(*component_priv);
        if (!component_priv)
                return -ENOMEM;
 
@@ -710,7 +710,7 @@ static int pdsc_flash_component_chunk(struct pdsc *pdsc, struct device *dev,
        u8 *component_data;
        int err;
 
-       deferred = kmalloc_obj(*deferred, GFP_KERNEL);
+       deferred = kmalloc_obj(*deferred);
        if (!deferred)
                return -ENOMEM;
 
index b1939da4c95adaa933806b32f676544c212f5b19..daa8a4a149e958ee1659d02cafd6d97623fbc3e6 100644 (file)
@@ -4334,7 +4334,7 @@ static int macb_taprio_setup_replace(struct net_device *netdev,
                return -EINVAL;
        }
 
-       enst_queue = kcalloc(conf->num_entries, sizeof(*enst_queue), GFP_KERNEL);
+       enst_queue = kzalloc_objs(*enst_queue, conf->num_entries);
        if (unlikely(!enst_queue))
                return -ENOMEM;
 
index 7188f1b81c046b9a0caffbeb0195925e4dc79c00..61c82b48044d0a7f0fa960149199b9060ae40771 100644 (file)
@@ -137,7 +137,7 @@ static void enic_admin_msg_enqueue(struct enic *enic, void *buf,
 {
        struct enic_admin_msg *msg;
 
-       msg = kmalloc(struct_size(msg, data, len), GFP_KERNEL);
+       msg = kmalloc_flex(*msg, data, len);
        if (!msg)
                return;
 
index 0baef7a120ec638d9835c26d057b9d568946a11e..65830c1d3ff689de54e3414788e89785aed32874 100644 (file)
@@ -2858,7 +2858,7 @@ enic_sriov_v2_enable(struct enic *enic, int num_vfs)
                return -EOPNOTSUPP;
        }
 
-       enic->vf_state = kcalloc(num_vfs, sizeof(*enic->vf_state), GFP_KERNEL);
+       enic->vf_state = kzalloc_objs(*enic->vf_state, num_vfs);
        if (!enic->vf_state)
                return -ENOMEM;
 
@@ -2946,7 +2946,7 @@ enic_sriov_configure(struct pci_dev *pdev, int num_vfs)
                if (enic->vf_type == ENIC_VF_TYPE_V2)
                        return enic_sriov_v2_enable(enic, num_vfs);
 
-               pp = kcalloc(num_vfs, sizeof(*pp), GFP_KERNEL);
+               pp = kzalloc_objs(*pp, num_vfs);
                if (!pp)
                        return -ENOMEM;
 
@@ -2971,7 +2971,7 @@ enic_sriov_configure(struct pci_dev *pdev, int num_vfs)
                return 0;
        }
 
-       pp = kzalloc_obj(*enic->pp, GFP_KERNEL);
+       pp = kzalloc_obj(*enic->pp);
        if (!pp)
                return -ENOMEM;
 
index 79d4a77f72bd49fc24e449deba7f1ca5c9bc9493..8cabce0eb2ab5fafde42aece504594215786de2e 100644 (file)
@@ -616,7 +616,7 @@ static int dpaa2_switch_lag_fdb_add(struct dpaa2_switch_lag *lag,
                goto out;
        }
 
-       a = kzalloc(sizeof(*a), GFP_KERNEL);
+       a = kzalloc_obj(*a);
        if (!a) {
                err = -ENOMEM;
                goto out;
@@ -4131,8 +4131,7 @@ static int dpaa2_switch_probe(struct fsl_mc_device *sw_dev)
                goto err_free_fdbs;
        }
 
-       ethsw->lags = kcalloc(ethsw->sw_attr.num_ifs, sizeof(*ethsw->lags),
-                             GFP_KERNEL);
+       ethsw->lags = kzalloc_objs(*ethsw->lags, ethsw->sw_attr.num_ifs);
        if (!ethsw->lags) {
                err = -ENOMEM;
                goto err_free_filter;
index 45a49eba6a820dcb626b450e8f78f194046e2079..6214fc036ce5fe59725e43af28293e0b43433c4e 100644 (file)
@@ -157,8 +157,7 @@ static void libie_ctlq_free_tx_msgs(struct libie_ctlq_info *ctlq,
  */
 static int libie_ctlq_alloc_tx_msgs(struct libie_ctlq_info *ctlq)
 {
-       ctlq->tx_msg = kvzalloc_objs(*ctlq->tx_msg, ctlq->ring_len,
-                                    GFP_KERNEL);
+       ctlq->tx_msg = kvzalloc_objs(*ctlq->tx_msg, ctlq->ring_len);
        if (!ctlq->tx_msg)
                return -ENOMEM;
 
index 3070700b952bfa8bfe9a1ca67e183ff82c7e80a4..2b67671a2bd8e5ecf8a4e1b9a103f5bf8456d848 100644 (file)
@@ -3647,7 +3647,7 @@ static int npc_defrag_add_2_show_list(struct rvu *rvu, u16 old_midx,
 {
        struct npc_defrag_show_node *node;
 
-       node = kcalloc(1, sizeof(*node), GFP_KERNEL);
+       node = kzalloc_objs(*node, 1);
        if (!node)
                return -ENOMEM;
 
@@ -4082,7 +4082,7 @@ int npc_cn20k_defrag(struct rvu *rvu)
        INIT_LIST_HEAD(&x4lh);
        INIT_LIST_HEAD(&x2lh);
 
-       node = kcalloc(npc_priv->num_subbanks, sizeof(*node), GFP_KERNEL);
+       node = kzalloc_objs(*node, npc_priv->num_subbanks);
        if (!node)
                return -ENOMEM;
 
@@ -4711,7 +4711,7 @@ static int npc_priv_init(struct rvu *rvu)
                return -EINVAL;
        }
 
-       npc_priv = kcalloc(1, sizeof(*npc_priv), GFP_KERNEL);
+       npc_priv = kzalloc_objs(*npc_priv, 1);
        if (!npc_priv)
                return -ENOMEM;
 
@@ -4729,8 +4729,7 @@ static int npc_priv_init(struct rvu *rvu)
                 num_banks, bank_depth, num_subbanks, subbank_depth,
                 npc_kw_name[npc_priv->kw]);
 
-       npc_priv->sb = kcalloc(num_subbanks, sizeof(struct npc_subbank),
-                              GFP_KERNEL);
+       npc_priv->sb = kzalloc_objs(struct npc_subbank, num_subbanks);
        if (!npc_priv->sb)
                goto fail1;
 
@@ -4757,9 +4756,7 @@ static int npc_priv_init(struct rvu *rvu)
 
        /* Get number of pcifuncs in the system */
        npc_priv->pf_cnt = npc_pcifunc_map_create(rvu);
-       npc_priv->xa_pf2idx_map = kcalloc(npc_priv->pf_cnt,
-                                         sizeof(struct xarray),
-                                         GFP_KERNEL);
+       npc_priv->xa_pf2idx_map = kzalloc_objs(struct xarray, npc_priv->pf_cnt);
        if (!npc_priv->xa_pf2idx_map) {
                ret = -ENOMEM;
                goto fail3;
index b6e2c153b4f7de83d1cfbb22f5c6d2ee18e64f1c..60d477c4eb25bc2f158d18b70d23d6c6b720239d 100644 (file)
@@ -2288,8 +2288,7 @@ static int mlx5_esw_spfs_init(struct mlx5_eswitch *esw)
        if (!num_entries)
                goto out_free;
 
-       esw_funcs->spfs = kcalloc(num_entries, sizeof(*esw_funcs->spfs),
-                                 GFP_KERNEL);
+       esw_funcs->spfs = kzalloc_objs(*esw_funcs->spfs, num_entries);
        if (!esw_funcs->spfs) {
                err = -ENOMEM;
                goto out_free;
index d603e294ee0e886874a3cfe8a6881dd3befd7006..eb74b626016821927d9fe49194b2e76c82adcd7c 100644 (file)
@@ -1524,7 +1524,7 @@ struct mlx5_flow_handle *
 mlx5_esw_lag_demux_rule_create(struct mlx5_eswitch *esw, u16 vport_num,
                               struct mlx5_flow_table *lag_ft)
 {
-       struct mlx5_flow_spec *spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
+       struct mlx5_flow_spec *spec = kvzalloc_obj(*spec);
        struct mlx5_flow_destination dest = {};
        struct mlx5_flow_act flow_act = {};
        struct mlx5_flow_handle *ret;
index 95a8b1e64ba46b11c08c5c2029508c9a414efa8f..1724bf7e0e7afaa1409c8595b17b07b6280a30fa 100644 (file)
@@ -317,7 +317,7 @@ int mlx5_sf_hw_table_init(struct mlx5_core_dev *dev)
 
        num_spfs = mlx5_esw_get_num_spfs(dev);
        num_hwc = MLX5_SF_HWC_FIRST_SPF + num_spfs;
-       table->hwc = kcalloc(num_hwc, sizeof(*table->hwc), GFP_KERNEL);
+       table->hwc = kzalloc_objs(*table->hwc, num_hwc);
        if (!table->hwc) {
                err = -ENOMEM;
                goto hwc_alloc_err;
index fa4d24b3dfaabc84948c21396ad96f57a8302bcd..1b928b40686e5bc83bd6a48c47a4284b27eedd1c 100644 (file)
@@ -239,7 +239,7 @@ static int dr_icm_buddy_init_ste_cache(struct mlx5dr_icm_buddy_mem *buddy)
        if (!buddy->hw_ste_arr)
                goto free_ste_arr;
 
-       buddy->miss_list = kvmalloc_array(num_of_entries, sizeof(struct list_head), GFP_KERNEL);
+       buddy->miss_list = kvmalloc_objs(struct list_head, num_of_entries);
        if (!buddy->miss_list)
                goto free_hw_ste_arr;
 
index 5e383d40abc7e222824125d3c2ec9d4349f7eecc..ec3b628ecb2d0f8344911c4c4d1c5edb44259177 100644 (file)
@@ -282,7 +282,7 @@ enum fbnic_msix_self_test_codes fbnic_msix_test(struct fbnic_dev *fbd)
        int i;
 
        /* Allocate bitmap and IRQ vector table */
-       test_data = kzalloc_obj(*test_data, GFP_KERNEL);
+       test_data = kzalloc_obj(*test_data);
 
        /* memory allocation failure */
        if (!test_data)
index f92b2d0bf926e1b715ff665d37f8173a2103e6fe..8e9bfc1d6a2ae14dd5b3c468c95dfb235038044a 100644 (file)
@@ -429,11 +429,11 @@ int mana_gd_alloc_memory(struct gdma_context *gc, unsigned int length,
        /* length is a power of 2 above PAGE_SIZE, so this divides exactly. */
        npages = length / PAGE_SIZE;
 
-       gmi->pages_va = kvcalloc(npages, sizeof(*gmi->pages_va), GFP_KERNEL);
+       gmi->pages_va = kvzalloc_objs(*gmi->pages_va, npages);
        if (!gmi->pages_va)
                return -ENOMEM;
 
-       gmi->pages_dma = kvcalloc(npages, sizeof(*gmi->pages_dma), GFP_KERNEL);
+       gmi->pages_dma = kvzalloc_objs(*gmi->pages_dma, npages);
        if (!gmi->pages_dma)
                goto free_va;
 
@@ -825,7 +825,7 @@ int mana_schedule_serv_work(struct gdma_context *gc, enum gdma_eqe_type type)
                return -ENODEV;
        }
 
-       mns_wk = kzalloc(sizeof(*mns_wk), GFP_ATOMIC);
+       mns_wk = kzalloc_obj(*mns_wk, GFP_ATOMIC);
        if (!mns_wk) {
                module_put(THIS_MODULE);
                clear_bit(GC_IN_SERVICE, &gc->flags);
@@ -1991,7 +1991,7 @@ struct gdma_irq_context *mana_gd_get_gic(struct gdma_context *gc,
                *msi_requested = msi;
        }
 
-       gic = kzalloc(sizeof(*gic), GFP_KERNEL);
+       gic = kzalloc_obj(*gic);
        if (!gic) {
                gic = ERR_PTR(-ENOMEM);
                if (irq_map.virq)
index 2c04be6d61a856d4d2b9903bb9064404424126e5..7a0d5e892a1a5565cbdd552c2e2073e717d89436 100644 (file)
@@ -659,8 +659,7 @@ static int ntb_netdev_probe(struct device *client_dev)
        dev->client_dev = client_dev;
        dev->num_queues = 0;
 
-       dev->queues = kzalloc_objs(*dev->queues, NTB_NETDEV_MAX_QUEUES,
-                                  GFP_KERNEL);
+       dev->queues = kzalloc_objs(*dev->queues, NTB_NETDEV_MAX_QUEUES);
        if (!dev->queues) {
                rc = -ENOMEM;
                goto err_free_netdev;
index 0fc55c9169e1a7bff179d01265eac4c9e1d0710e..d89a49c6ebb742823b440342fd1699db0c8d14b7 100644 (file)
@@ -870,7 +870,7 @@ static struct ath12k_ahb_rproc_info *ath12k_ahb_rproc_info_alloc(struct ath12k_b
 
        lockdep_assert_held(&ath12k_rproc_info_lock);
 
-       rproc_info = kzalloc_obj(*rproc_info, GFP_KERNEL);
+       rproc_info = kzalloc_obj(*rproc_info);
        if (!rproc_info)
                return NULL;
 
index 533870cf443fa80236a5fa71cb9b6cc76e351053..6db84c2117f25b9cb9ddf214ba1bb12c5c4332d4 100644 (file)
@@ -514,8 +514,7 @@ void iwl_mld_init_ap_type_tables(struct iwl_mld *mld)
                return;
 
        if (iwl_fw_lookup_cmd_ver(mld->fw, cmd.id, 1) == 1) {
-               struct iwl_mcc_allowed_ap_type_cmd_v1 *cmd_v1 =
-                       kzalloc(sizeof(*cmd_v1), GFP_KERNEL);
+               struct iwl_mcc_allowed_ap_type_cmd_v1 *cmd_v1 = kzalloc_obj(*cmd_v1);
 
                if (!cmd_v1)
                        return;
index 4a8ea4624fee57c981d6c1ac7ab9ff44e30ab9fa..fcdeb65cd8ef27807bd7422436513355a0cf905f 100644 (file)
@@ -289,7 +289,7 @@ int mt7921_regd_update(struct mt792x_phy *phy, char *alpha2)
                goto err;
        }
 
-       regd = kzalloc(struct_size(regd, reg_rules, num_of_rules), GFP_KERNEL);
+       regd = kzalloc_flex(*regd, reg_rules, num_of_rules);
        if (!regd) {
                ret = -ENOMEM;
                goto err;
index 84b55f008b3d396fd9f61619e0183238a6b542be..5993b31e1aae4df0685b1c795c373e6f29d3f090 100644 (file)
@@ -1105,7 +1105,7 @@ mt7925_mac_sta_add_links(struct mt792x_dev *dev, struct ieee80211_vif *vif,
                        mlink = &msta->deflink;
                        is_deflink = true;
                } else {
-                       mlink = kzalloc(sizeof(*mlink), GFP_KERNEL);
+                       mlink = kzalloc_obj(*mlink);
                        if (!mlink) {
                                err = -ENOMEM;
                                break;
index f4beb7f52043c34e1c02a98f7257ca4399145f93..57f1736b54a3ba5737ac25d01fca0238432df1bb 100644 (file)
@@ -336,7 +336,7 @@ int mt7925_regd_update(struct mt792x_phy *phy, char *alpha2)
                goto err;
        }
 
-       regd = kzalloc(struct_size(regd, reg_rules, num_of_rules), GFP_KERNEL);
+       regd = kzalloc_flex(*regd, reg_rules, num_of_rules);
        if (!regd) {
                ret = -ENOMEM;
                goto err;
index 08ca116a68b47f6c76675fe8025e25022c940c30..0fa80b1488aacc3e1d4b87f6016ad7e34733892f 100644 (file)
@@ -706,8 +706,7 @@ static int mm81x_hw_scan_h_init_chan_list(struct mm81x_hw_scan_params *params,
 
        params->num_chans = 0;
        params->allocated_chans = 0;
-       params->channels = kcalloc(chans_to_allocate, sizeof(*params->channels),
-                                  GFP_KERNEL);
+       params->channels = kzalloc_objs(*params->channels, chans_to_allocate);
        if (!params->channels)
                return -ENOMEM;
 
@@ -728,8 +727,8 @@ static int mm81x_hw_scan_h_init_chan_list(struct mm81x_hw_scan_params *params,
                }
        }
 
-       params->powers_qdbm = kmalloc_array(
-               num_pwrs_coarse, sizeof(*params->powers_qdbm), GFP_KERNEL);
+       params->powers_qdbm = kmalloc_objs(*params->powers_qdbm,
+                                          num_pwrs_coarse);
        if (!params->powers_qdbm)
                return -ENOMEM;
 
@@ -822,7 +821,7 @@ __mm81x_hw_scan_h_init_params(struct mm81x *mors)
        struct mm81x_hw_scan_params *params = mors->hw_scan.params;
 
        if (!params) {
-               params = kzalloc_obj(*params, GFP_KERNEL);
+               params = kzalloc_obj(*params);
                if (params)
                        mors->hw_scan.params = params;
        } else {
index e98a2a58726f5165897d693bd21502b3a821333e..2d1728c1a6dece800786c62e6543e7b9e89a8206 100644 (file)
 
 static int mm81x_yaps_alloc_pkt_buffers(struct mm81x_yaps *yaps)
 {
-       yaps->hw.to_chip_pkts = kcalloc(MAX_PKTS_PER_TX_TXN,
-                                       sizeof(*yaps->hw.to_chip_pkts),
-                                       GFP_KERNEL);
+       yaps->hw.to_chip_pkts = kzalloc_objs(*yaps->hw.to_chip_pkts,
+                                            MAX_PKTS_PER_TX_TXN);
        if (!yaps->hw.to_chip_pkts)
                return -ENOMEM;
 
-       yaps->hw.from_chip_pkts = kcalloc(MAX_PKTS_PER_RX_TXN,
-                                         sizeof(*yaps->hw.from_chip_pkts),
-                                         GFP_KERNEL);
+       yaps->hw.from_chip_pkts = kzalloc_objs(*yaps->hw.from_chip_pkts,
+                                              MAX_PKTS_PER_RX_TXN);
        if (!yaps->hw.from_chip_pkts) {
                kfree(yaps->hw.to_chip_pkts);
                yaps->hw.to_chip_pkts = NULL;
index 5cc8cdf594d3e27928c5da50c84feda2651ce9d8..86304ea3331c745fbe45d7810506cbcd27f63f01 100644 (file)
@@ -641,7 +641,7 @@ nxpwifi_cfg80211_set_wiphy_params(struct wiphy *wiphy, int radio_idx, u32 change
 
        switch (priv->bss_role) {
        case NXPWIFI_BSS_ROLE_UAP:
-               bss_cfg = kzalloc_obj(*bss_cfg, GFP_KERNEL);
+               bss_cfg = kzalloc_obj(*bss_cfg);
                if (!bss_cfg) {
                        ret = -ENOMEM;
                        break;
@@ -1713,7 +1713,7 @@ static int nxpwifi_cfg80211_start_ap(struct wiphy *wiphy,
        if (!nxpwifi_is_channel_setting_allowable(priv, params->chandef.chan))
                return -EOPNOTSUPP;
 
-       bss_cfg = kzalloc_obj(*bss_cfg, GFP_KERNEL);
+       bss_cfg = kzalloc_obj(*bss_cfg);
        if (!bss_cfg)
                return -ENOMEM;
 
@@ -1866,7 +1866,7 @@ nxpwifi_cfg80211_scan(struct wiphy *wiphy,
        if (!nxpwifi_stop_bg_scan(priv))
                cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0);
 
-       user_scan_cfg = kzalloc_obj(*user_scan_cfg, GFP_KERNEL);
+       user_scan_cfg = kzalloc_obj(*user_scan_cfg);
        if (!user_scan_cfg)
                return -ENOMEM;
 
@@ -1973,7 +1973,7 @@ nxpwifi_cfg80211_sched_scan_start(struct wiphy *wiphy,
                   request->n_channels, request->scan_plans->interval,
                   (int)request->ie_len);
 
-       bgscan_cfg = kzalloc_obj(*bgscan_cfg, GFP_KERNEL);
+       bgscan_cfg = kzalloc_obj(*bgscan_cfg);
        if (!bgscan_cfg)
                return -ENOMEM;
 
@@ -2304,7 +2304,7 @@ nxpwifi_setup_he_caps(struct nxpwifi_private *priv,
        if (!hw_he_cap_len)
                return;
 
-       iftype_data = kmalloc_obj(*iftype_data, GFP_KERNEL);
+       iftype_data = kmalloc_obj(*iftype_data);
        if (!iftype_data)
                return;
        memset(iftype_data, 0, sizeof(*iftype_data));
@@ -2759,7 +2759,7 @@ static int nxpwifi_set_mef_filter(struct nxpwifi_private *priv,
        if (wowlan->n_patterns || wowlan->magic_pkt)
                num_entries++;
 
-       mef_entry = kzalloc_objs(*mef_entry, num_entries, GFP_KERNEL);
+       mef_entry = kzalloc_objs(*mef_entry, num_entries);
        if (!mef_entry)
                return -ENOMEM;
 
@@ -3227,7 +3227,7 @@ static int nxpwifi_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev,
                if (!tb[NXPWIFI_TM_ATTR_DATA])
                        return -EINVAL;
 
-               hostcmd = kzalloc_obj(*hostcmd, GFP_KERNEL);
+               hostcmd = kzalloc_obj(*hostcmd);
                if (!hostcmd)
                        return -ENOMEM;
 
index 4eb17ada5db81c68a91320bdd0ad4ba055e0ef55..fc1950a125b650b5dd5626b9d436a1d1745ce86b 100644 (file)
@@ -302,7 +302,7 @@ int nxpwifi_alloc_cmd_buffer(struct nxpwifi_adapter *adapter)
 
        /* Allocate and initialize struct cmd_ctrl_node */
        cmd_array = kzalloc_objs(struct cmd_ctrl_node,
-                                NXPWIFI_NUM_OF_CMD_BUFFER, GFP_KERNEL);
+                                NXPWIFI_NUM_OF_CMD_BUFFER);
        if (!cmd_array)
                return -ENOMEM;
 
index 158755c0c905cb7787134ce86428fd2a550e416b..86b18d50feafa374ccc5ceeb6f91fe7eccbdea64 100644 (file)
@@ -143,7 +143,7 @@ nxpwifi_update_uap_custom_ie(struct nxpwifi_private *priv,
        u16 len;
        int ret;
 
-       ap_custom_ie = kzalloc_obj(*ap_custom_ie, GFP_KERNEL);
+       ap_custom_ie = kzalloc_obj(*ap_custom_ie);
        if (!ap_custom_ie)
                return -ENOMEM;
 
@@ -209,7 +209,7 @@ static int nxpwifi_update_vs_ie(const u8 *ies, int ies_len,
        vendor_ie = cfg80211_find_vendor_ie(oui, oui_type, ies, ies_len);
        if (vendor_ie) {
                if (!*ie_ptr) {
-                       *ie_ptr = kzalloc_obj(struct nxpwifi_ie, GFP_KERNEL);
+                       *ie_ptr = kzalloc_obj(struct nxpwifi_ie);
                        if (!*ie_ptr)
                                return -ENOMEM;
                        ie = *ie_ptr;
@@ -309,7 +309,7 @@ static int nxpwifi_uap_parse_tail_ies(struct nxpwifi_private *priv,
        if (!info->tail || !info->tail_len)
                return 0;
 
-       gen_ie = kzalloc_obj(*gen_ie, GFP_KERNEL);
+       gen_ie = kzalloc_obj(*gen_ie);
        if (!gen_ie)
                return -ENOMEM;
 
@@ -417,7 +417,7 @@ int nxpwifi_del_mgmt_ies(struct nxpwifi_private *priv)
        int ret = 0;
 
        if (priv->gen_idx != NXPWIFI_AUTO_IDX_MASK) {
-               gen_ie = kmalloc_obj(*gen_ie, GFP_KERNEL);
+               gen_ie = kmalloc_obj(*gen_ie);
                if (!gen_ie)
                        return -ENOMEM;
 
@@ -434,7 +434,7 @@ int nxpwifi_del_mgmt_ies(struct nxpwifi_private *priv)
        }
 
        if (priv->beacon_idx != NXPWIFI_AUTO_IDX_MASK) {
-               beacon_ie = kmalloc_obj(*beacon_ie, GFP_KERNEL);
+               beacon_ie = kmalloc_obj(*beacon_ie);
                if (!beacon_ie) {
                        ret = -ENOMEM;
                        goto done;
@@ -444,7 +444,7 @@ int nxpwifi_del_mgmt_ies(struct nxpwifi_private *priv)
                beacon_ie->ie_length = 0;
        }
        if (priv->proberesp_idx != NXPWIFI_AUTO_IDX_MASK) {
-               pr_ie = kmalloc_obj(*pr_ie, GFP_KERNEL);
+               pr_ie = kmalloc_obj(*pr_ie);
                if (!pr_ie) {
                        ret = -ENOMEM;
                        goto done;
@@ -454,7 +454,7 @@ int nxpwifi_del_mgmt_ies(struct nxpwifi_private *priv)
                pr_ie->ie_length = 0;
        }
        if (priv->assocresp_idx != NXPWIFI_AUTO_IDX_MASK) {
-               ar_ie = kmalloc_obj(*ar_ie, GFP_KERNEL);
+               ar_ie = kmalloc_obj(*ar_ie);
                if (!ar_ie) {
                        ret = -ENOMEM;
                        goto done;
index b128fc9fe31a2d0785b03cb7868c3bec7a239f05..7c75dca5d0a831df04721d062ebbb5847b83cb81 100644 (file)
@@ -20,7 +20,7 @@ static int nxpwifi_add_bss_prio_tbl(struct nxpwifi_private *priv)
        struct nxpwifi_bss_prio_node *bss_prio;
        struct nxpwifi_bss_prio_tbl *tbl = adapter->bss_prio_tbl;
 
-       bss_prio = kzalloc_obj(*bss_prio, GFP_KERNEL);
+       bss_prio = kzalloc_obj(*bss_prio);
        if (!bss_prio)
                return -ENOMEM;
 
index b4c63829024a008c8cac6ab801528a56e409dda2..55b962430f37e72cbd401993c6164a8128c10f98 100644 (file)
@@ -32,7 +32,7 @@ static struct nxpwifi_adapter *nxpwifi_register(void *card, struct device *dev,
        int ret = 0;
        int i;
 
-       adapter = kzalloc_obj(*adapter, GFP_KERNEL);
+       adapter = kzalloc_obj(*adapter);
        if (!adapter)
                return ERR_PTR(-ENOMEM);
 
@@ -55,7 +55,7 @@ static struct nxpwifi_adapter *nxpwifi_register(void *card, struct device *dev,
        for (i = 0; i < NXPWIFI_MAX_BSS_NUM; i++) {
                /* Allocate memory for private structure */
                adapter->priv[i] =
-                       kzalloc_obj(struct nxpwifi_private, GFP_KERNEL);
+                       kzalloc_obj(struct nxpwifi_private);
                if (!adapter->priv[i]) {
                        ret = -ENOMEM;
                        goto error;
@@ -1106,7 +1106,7 @@ void nxpwifi_drv_info_dump(struct nxpwifi_adapter *adapter)
                        p += adapter->if_ops.reg_dump(adapter, p);
        }
        p += sprintf(p, "\n=== more debug information\n");
-       debug_info = kzalloc_obj(*debug_info, GFP_KERNEL);
+       debug_info = kzalloc_obj(*debug_info);
        if (debug_info) {
                for (i = 0; i < adapter->priv_num; i++) {
                        if (!adapter->priv[i]->netdev)
@@ -1242,7 +1242,7 @@ void nxpwifi_init_priv_params(struct nxpwifi_private *priv,
 
        if (GET_BSS_ROLE(priv) == NXPWIFI_BSS_ROLE_STA ||
            GET_BSS_ROLE(priv) == NXPWIFI_BSS_ROLE_UAP) {
-               priv->hist_data = kmalloc_obj(*priv->hist_data, GFP_KERNEL);
+               priv->hist_data = kmalloc_obj(*priv->hist_data);
                if (priv->hist_data)
                        nxpwifi_hist_data_reset(priv);
        }
index b77056983e83f191fe5e75a6b8a54cf157d41abb..67d7ff2f10c593082f10fe789add398263828b91 100644 (file)
@@ -1341,15 +1341,14 @@ int nxpwifi_scan_networks(struct nxpwifi_private *priv,
        adapter->scan_processing = true;
        spin_unlock_bh(&adapter->nxpwifi_cmd_lock);
 
-       scan_cfg_out = kzalloc_obj(union nxpwifi_scan_cmd_config_tlv,
-                                  GFP_KERNEL);
+       scan_cfg_out = kzalloc_obj(union nxpwifi_scan_cmd_config_tlv);
        if (!scan_cfg_out) {
                ret = -ENOMEM;
                goto done;
        }
 
        scan_chan_list = kzalloc_objs(struct nxpwifi_chan_scan_param_set,
-                                     NXPWIFI_USER_SCAN_CHAN_MAX, GFP_KERNEL);
+                                     NXPWIFI_USER_SCAN_CHAN_MAX);
        if (!scan_chan_list) {
                kfree(scan_cfg_out);
                ret = -ENOMEM;
@@ -1471,7 +1470,7 @@ static int nxpwifi_save_hidden_ssid_channels(struct nxpwifi_private *priv,
        int chid;
 
        /* Allocate and fill new bss descriptor */
-       bss_desc = kzalloc_obj(*bss_desc, GFP_KERNEL);
+       bss_desc = kzalloc_obj(*bss_desc);
        if (!bss_desc)
                return -ENOMEM;
 
@@ -1512,7 +1511,7 @@ static int nxpwifi_update_curr_bss_params(struct nxpwifi_private *priv,
        int ret;
 
        /* Allocate and fill new bss descriptor */
-       bss_desc = kzalloc_obj(*bss_desc, GFP_KERNEL);
+       bss_desc = kzalloc_obj(*bss_desc);
        if (!bss_desc)
                return -ENOMEM;
 
@@ -1751,7 +1750,7 @@ nxpwifi_active_scan_req_for_passive_chan(struct nxpwifi_private *priv)
                nxpwifi_dbg(adapter, INFO, "No BSS with hidden SSID found on DFS channels\n");
                return 0;
        }
-       user_scan_cfg = kzalloc_obj(*user_scan_cfg, GFP_KERNEL);
+       user_scan_cfg = kzalloc_obj(*user_scan_cfg);
 
        if (!user_scan_cfg)
                return -ENOMEM;
@@ -2258,7 +2257,7 @@ int nxpwifi_stop_bg_scan(struct nxpwifi_private *priv)
                return 0;
        }
 
-       bgscan_cfg = kzalloc_obj(*bgscan_cfg, GFP_KERNEL);
+       bgscan_cfg = kzalloc_obj(*bgscan_cfg);
        if (!bgscan_cfg)
                return -ENOMEM;
 
index 702fa1531da1e36fb822ddc6c7d24f2162b05d0d..56cf63fbf7fe60221667d75d1e8948aafb388687 100644 (file)
@@ -245,7 +245,7 @@ int nxpwifi_bss_start(struct nxpwifi_private *priv, struct cfg80211_bss *bss,
                return -EINVAL;
 
        /* Allocate and fill new bss descriptor */
-       bss_desc = kzalloc_obj(*bss_desc, GFP_KERNEL);
+       bss_desc = kzalloc_obj(*bss_desc);
        if (!bss_desc)
                return -ENOMEM;
 
index 5e8ffd306b31fcb4850b332767b8d4f3f71e3236..9bfa4aebc3e554bfda5bcab11e75fc4236b27194 100644 (file)
@@ -2822,7 +2822,7 @@ nxpwifi_create_custom_regdomain(struct nxpwifi_private *priv,
        if (WARN_ON_ONCE(num_chan > NL80211_MAX_SUPP_REG_RULES))
                return ERR_PTR(-EINVAL);
 
-       regd = kzalloc_flex(*regd, reg_rules, num_chan, GFP_KERNEL);
+       regd = kzalloc_flex(*regd, reg_rules, num_chan);
        if (!regd)
                return ERR_PTR(-ENOMEM);
 
index 9f717a3d7ec5d60985e1bf0939aca02d9704a994..ab5c15686f549db8571406c71acc5340f19af8a4 100644 (file)
@@ -88,7 +88,7 @@ nxpwifi_uap_event_sta_assoc(struct nxpwifi_private *priv)
        struct nxpwifi_sta_node *node;
        int len, i;
 
-       sinfo = kzalloc_obj(*sinfo, GFP_KERNEL);
+       sinfo = kzalloc_obj(*sinfo);
        if (!sinfo)
                return -ENOMEM;
 
index 24f42b4650ba665bf4165ce30cad834c51bdd698..09842ca68110705e68cf74e74af39dfde9049d93 100644 (file)
@@ -1002,8 +1002,7 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus,
        nd_region->num_lanes = ndr_desc->num_lanes;
        if (!nd_region->num_lanes)
                goto err_percpu;
-       nd_region->lane = kcalloc(nd_region->num_lanes,
-                                 sizeof(*nd_region->lane), GFP_KERNEL);
+       nd_region->lane = kzalloc_objs(*nd_region->lane, nd_region->num_lanes);
        if (!nd_region->lane)
                goto err_percpu;
 
index 1322c678f4eb80cd437b79ee192cc050ad9bee6b..b16cec1ff51fe03b691027318583e6f717672fec 100644 (file)
@@ -2382,8 +2382,7 @@ static int nvme_query_fdp_info(struct nvme_ns *ns, struct nvme_ns_info *info)
        if (!head->nr_plids)
                goto free;
 
-       head->plids = kcalloc(head->nr_plids, sizeof(*head->plids),
-                             GFP_KERNEL);
+       head->plids = kzalloc_objs(*head->plids, head->nr_plids);
        if (!head->plids) {
                dev_warn(ctrl->device,
                         "failed to allocate %u FDP placement IDs\n",
index da93b505d2394a5e1add5af042ed5d900a2d9efe..5440cf18b55b281cf1ce8841a32c477198f8dec5 100644 (file)
@@ -201,7 +201,7 @@ static int quirks_param_set(const char *value, const struct kernel_param *kp)
                        count++;
        }
 
-       qlist = kcalloc(count, sizeof(*qlist), GFP_KERNEL);
+       qlist = kzalloc_objs(*qlist, count);
        if (!qlist) {
                err = -ENOMEM;
                goto out_free_val;
index cd0e82dae776daa38cdea52cdea2da7d11fd4b64..2fafd983de8f5e14037849e17fcd4fab3bf76e9b 100644 (file)
@@ -348,7 +348,7 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev)
 
        count = opp_table->regulator_count;
 
-       uV = kmalloc_array(count, sizeof(*uV), GFP_KERNEL);
+       uV = kmalloc_objs(*uV, count);
        if (!uV)
                return 0;
 
@@ -1505,7 +1505,7 @@ struct opp_device *_add_opp_dev(const struct device *dev,
 {
        struct opp_device *opp_dev;
 
-       opp_dev = kzalloc(sizeof(*opp_dev), GFP_KERNEL);
+       opp_dev = kzalloc_obj(*opp_dev);
        if (!opp_dev)
                return NULL;
 
index 0855c7930abb4f7dfb1784a68e4a2b1a63334432..9c13f193537df6e58514eb0b8767a9c3d94b5255 100644 (file)
@@ -57,7 +57,7 @@ static int pci_epf_alloc_doorbell_embedded(struct pci_epf *epf, u16 num_db)
                return -ENODEV;
 
        struct pci_epc_aux_resource *res __free(kfree) =
-                               kcalloc(count, sizeof(*res), GFP_KERNEL);
+                               kzalloc_objs(*res, count);
        if (!res)
                return -ENOMEM;
 
@@ -98,7 +98,7 @@ static int pci_epf_alloc_doorbell_embedded(struct pci_epf *epf, u16 num_db)
                addr = iova_base + off;
        }
 
-       msg = kcalloc(num_db, sizeof(*msg), GFP_KERNEL);
+       msg = kzalloc_objs(*msg, num_db);
        if (!msg) {
                ret = -ENOMEM;
                goto err_unmap;
index 8257cd1da48eae8b82632e789b22d5a06c14e6fc..ddd7a04ee7535dbac590df970e07f57d3d1b2725 100644 (file)
@@ -720,9 +720,8 @@ static int hsmp_acpi_probe(struct platform_device *pdev)
                        return -ENODEV;
                }
 
-               hsmp_pdev->sock = kcalloc(hsmp_pdev->num_sockets,
-                                         sizeof(*hsmp_pdev->sock),
-                                         GFP_KERNEL);
+               hsmp_pdev->sock = kzalloc_objs(*hsmp_pdev->sock,
+                                              hsmp_pdev->num_sockets);
                if (!hsmp_pdev->sock)
                        return -ENOMEM;
 
index 446dd18d2cee4f8b4d12d7495bdbb5bcf86b5ba0..72a4c2107d7e59ad6d028c1a9c2571007effc483 100644 (file)
@@ -96,8 +96,8 @@ int hp_alloc_enumeration_data(void)
 
        if (!bioscfg_drv.enumeration_instances_count)
                return -EINVAL;
-       bioscfg_drv.enumeration_data = kvcalloc(bioscfg_drv.enumeration_instances_count,
-                                               sizeof(*bioscfg_drv.enumeration_data), GFP_KERNEL);
+       bioscfg_drv.enumeration_data = kvzalloc_objs(*bioscfg_drv.enumeration_data,
+                                                    bioscfg_drv.enumeration_instances_count);
 
        if (!bioscfg_drv.enumeration_data) {
                bioscfg_drv.enumeration_instances_count = 0;
index 4cde241e01d6d02832a40eb97f8ef32ad5d53969..013f779f20a46917d48dbddab271552e35b04b46 100644 (file)
@@ -93,8 +93,7 @@ acpi_disc_t pmc_parse_telem_dsd(union acpi_object *obj,
        if (header->num_entries != num_regions)
                return ERR_PTR(-EINVAL);
 
-       acpi_disc_t disc __free(kfree) = kmalloc_array(num_regions, sizeof(*disc),
-                                                     GFP_KERNEL);
+       acpi_disc_t disc __free(kfree) = kmalloc_objs(*disc, num_regions);
        if (!disc)
                return ERR_PTR(-ENOMEM);
 
index 842c4169e290677c1c19f53cbc43759e65811f86..052ec478dfcc4ced0b2850a6775ea29d464e972a 100644 (file)
@@ -2962,7 +2962,7 @@ int of_genpd_add_child_ids(struct device_node *np,
                return -EINVAL;
 
        /* Allocate tracking array for error unwind (parent/child pairs) */
-       pairs = kmalloc_array(count * 2, sizeof(*pairs), GFP_KERNEL);
+       pairs = kmalloc_objs(*pairs, count * 2);
        if (!pairs)
                return -ENOMEM;
 
index af00c00eceee7f1cfae715b424ffde907cf7cedd..3611bed341e14cc87fb2578d7678696c588bba79 100644 (file)
@@ -122,14 +122,14 @@ static int reboot_mode_create_device(struct reboot_mode_driver *reboot)
        struct mode_info *info;
        int ret;
 
-       priv = kzalloc_obj(*priv, GFP_KERNEL);
+       priv = kzalloc_obj(*priv);
        if (!priv)
                return -ENOMEM;
 
        INIT_LIST_HEAD(&priv->head);
 
        list_for_each_entry(info, &reboot->head, list) {
-               sysfs_info = kzalloc_obj(*sysfs_info, GFP_KERNEL);
+               sysfs_info = kzalloc_obj(*sysfs_info);
                if (!sysfs_info) {
                        ret = -ENOMEM;
                        goto error;
@@ -188,7 +188,7 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
                        continue;
                }
 
-               info = kzalloc_obj(*info, GFP_KERNEL);
+               info = kzalloc_obj(*info);
                if (!info) {
                        ret = -ENOMEM;
                        goto error;
index 721e888b658d1f254513e126bb72f2d0487a8383..0cb71efbb268b351607ccf610cbf0315f35eb3b7 100644 (file)
@@ -480,7 +480,7 @@ pwrseq_device_register(const struct pwrseq_config *config)
            !config->targets[0])
                return ERR_PTR(-EINVAL);
 
-       pwrseq = kzalloc(sizeof(*pwrseq), GFP_KERNEL);
+       pwrseq = kzalloc_obj(*pwrseq);
        if (!pwrseq)
                return ERR_PTR(-ENOMEM);
 
index de9848a9a9f19dba6d2e9d756c3d30f6648738ed..471ffe914a4e217ce5d669fed2388417e2dca824 100644 (file)
@@ -291,7 +291,7 @@ static int pwrseq_pcie_m2_create_serdev_one(struct pwrseq_pcie_m2_ctx *ctx,
                }
        }
 
-       pci_dev = kzalloc(sizeof(*pci_dev), GFP_KERNEL);
+       pci_dev = kzalloc_obj(*pci_dev);
        if (!pci_dev) {
                ret = -ENOMEM;
                goto err_put_ctrl;
index 00d8bc98d5887e0a6f7f7178c129cc638ffa71e2..47e307709e5e64f13893d30e8928773e5a116b84 100644 (file)
@@ -904,7 +904,7 @@ int power_supply_get_battery_info(struct power_supply *psy,
                        goto out_put_node;
                }
 
-               u32 *propdata __free(kfree) = kcalloc(proplen, sizeof(*propdata), GFP_KERNEL);
+               u32 *propdata __free(kfree) = kzalloc_objs(*propdata, proplen);
                if (!propdata) {
                        power_supply_put_battery_info(psy, info);
                        err = -EINVAL;
@@ -944,7 +944,7 @@ int power_supply_get_battery_info(struct power_supply *psy,
                goto out_put_node;
        }
 
-       propdata = kcalloc(proplen, sizeof(*propdata), GFP_KERNEL);
+       propdata = kzalloc_objs(*propdata, proplen);
        if (!propdata) {
                power_supply_put_battery_info(psy, info);
                err = -ENOMEM;
@@ -1726,7 +1726,7 @@ __power_supply_register(struct device *parent,
                pr_warn("%s: Expected proper parent device for '%s'\n",
                        __func__, desc->name);
 
-       psy = kzalloc(sizeof(*psy), GFP_KERNEL);
+       psy = kzalloc_obj(*psy);
        if (!psy)
                return ERR_PTR(-ENOMEM);
 
index dc23cd708cfec2bfa96e89e4fe82e073e2285445..f63b45f5ee6aef05273880c9a6c78deb4ffbff40 100644 (file)
@@ -136,7 +136,7 @@ int ptp_open(struct posix_clock_context *pccontext, fmode_t fmode)
        struct timestamp_event_queue *queue;
        char debugfsname[32];
 
-       queue = kzalloc(sizeof(*queue), GFP_KERNEL);
+       queue = kzalloc_obj(*queue);
        if (!queue)
                return -EINVAL;
        queue->mask = bitmap_alloc(PTP_MAX_CHANNELS, GFP_KERNEL);
index 5979758311c80332f429e1431781f51413c3ceb0..2ffe404b890fd70087e634c3f4ec2ffd40290b4f 100644 (file)
@@ -87,7 +87,7 @@ struct dasd_device *dasd_alloc_device(void)
 {
        struct dasd_device *device;
 
-       device = kzalloc_obj(struct dasd_device, GFP_KERNEL);
+       device = kzalloc_obj(struct dasd_device);
        if (!device)
                return ERR_PTR(-ENOMEM);
 
index 61f167e20574d99f7cc76108afb3aa426678d4ad..21b7e9666b746cf9633c246acc3b7daa9e26a4f5 100644 (file)
@@ -767,7 +767,7 @@ static int fnic_nvmef_debugfs_open(struct inode *inode, struct file *file)
        struct fnic_nvmef_info *info;
        int buf_size = 2 * PAGE_SIZE;
 
-       info = kzalloc_obj(struct fnic_nvmef_info, GFP_KERNEL);
+       info = kzalloc_obj(struct fnic_nvmef_info);
        if (!info)
                return -ENOMEM;
 
index 089d0810bd13a747ae2c92bb7305b964264784d6..66b43c1c72e1b091293f6639f21b937eac71f9af 100644 (file)
@@ -2984,8 +2984,7 @@ static void leapraid_fw_evt_put(struct leapraid_fw_evt_work *fw_work)
 
 static struct leapraid_fw_evt_work *leapraid_alloc_fw_evt_work(void)
 {
-       struct leapraid_fw_evt_work *fw_evt =
-               kzalloc(sizeof(*fw_evt), GFP_ATOMIC);
+       struct leapraid_fw_evt_work *fw_evt = kzalloc_obj(*fw_evt, GFP_ATOMIC);
 
        if (fw_evt)
                kref_init(&fw_evt->refcnt);
@@ -3644,8 +3643,7 @@ static void leapraid_sas_host_add(struct leapraid_adapter *adapter,
                        return;
 
                adapter->dev_topo.card.card_phy =
-                       kcalloc(phys_num,
-                               sizeof(struct leapraid_card_phy), GFP_KERNEL);
+                       kzalloc_objs(struct leapraid_card_phy, phys_num);
                if (!adapter->dev_topo.card.card_phy)
                        return;
 
@@ -3763,8 +3761,7 @@ static int leapraid_internal_exp_add(struct leapraid_adapter *adapter,
        }
 
        topo_node_exp->card_phy =
-               kcalloc(topo_node_exp->phys_num,
-                       sizeof(struct leapraid_card_phy), GFP_KERNEL);
+               kzalloc_objs(struct leapraid_card_phy, topo_node_exp->phys_num);
        if (!topo_node_exp->card_phy) {
                dev_err(&adapter->pdev->dev,
                        "%s: Failed to alloc expander phy array, count=%u\n",
@@ -4352,7 +4349,7 @@ static void leapraid_sas_volume_add(
                return;
        }
 
-       raid_volume = kzalloc(sizeof(*raid_volume), GFP_KERNEL);
+       raid_volume = kzalloc_obj(*raid_volume);
        if (!raid_volume)
                return;
 
@@ -6090,17 +6087,15 @@ static void leapraid_update_card_port_after_reset(
 
        if (!adapter->dev_topo.card.card_phy) {
                adapter->dev_topo.card.card_phy =
-                       kcalloc(nr_phys, sizeof(struct leapraid_card_phy),
-                               GFP_KERNEL);
+                       kzalloc_objs(struct leapraid_card_phy, nr_phys);
                if (!adapter->dev_topo.card.card_phy)
                        return;
        }
 
        adapter->dev_topo.card.phys_num = nr_phys;
 
-       new_card_port_table = kcalloc(adapter->dev_topo.card.phys_num,
-                                     sizeof(struct leapraid_card_port),
-                                     GFP_KERNEL);
+       new_card_port_table = kzalloc_objs(struct leapraid_card_port,
+                                          adapter->dev_topo.card.phys_num);
        if (!new_card_port_table)
                return;
 
@@ -7224,8 +7219,8 @@ static int leapraid_set_legacy_int(struct leapraid_adapter *adapter)
                 adapter->notification_desc.iopoll_qdex,
                 adapter->notification_desc.iopoll_qcnt);
        adapter->notification_desc.int_rqs =
-               kcalloc(adapter->notification_desc.iopoll_qdex,
-                       sizeof(struct leapraid_int_rq), GFP_KERNEL);
+               kzalloc_objs(struct leapraid_int_rq,
+                            adapter->notification_desc.iopoll_qdex);
        if (!adapter->notification_desc.int_rqs)
                return -ENOMEM;
 
@@ -7268,9 +7263,8 @@ static int leapraid_set_msix(struct leapraid_adapter *adapter)
        }
        if (iopoll_qcnt) {
                adapter->notification_desc.blk_mq_poll_rqs =
-                       kcalloc(iopoll_qcnt,
-                               sizeof(struct leapraid_blk_mq_poll_rq),
-                               GFP_KERNEL);
+                       kzalloc_objs(struct leapraid_blk_mq_poll_rq,
+                                    iopoll_qcnt);
                if (!adapter->notification_desc.blk_mq_poll_rqs)
                        return -ENOMEM;
                adapter->adapter_attr.rq_cnt =
@@ -7289,8 +7283,8 @@ static int leapraid_set_msix(struct leapraid_adapter *adapter)
                 adapter->notification_desc.iopoll_qcnt);
 
        adapter->notification_desc.int_rqs =
-               kcalloc(adapter->notification_desc.iopoll_qdex,
-                       sizeof(struct leapraid_int_rq), GFP_KERNEL);
+               kzalloc_objs(struct leapraid_int_rq,
+                            adapter->notification_desc.iopoll_qdex);
        if (!adapter->notification_desc.int_rqs)
                return -ENOMEM;
 
@@ -7365,9 +7359,8 @@ static int leapraid_set_msi(struct leapraid_adapter *adapter)
 
        if (iopoll_qcnt) {
                adapter->notification_desc.blk_mq_poll_rqs =
-                       kcalloc(iopoll_qcnt,
-                               sizeof(struct leapraid_blk_mq_poll_rq),
-                               GFP_KERNEL);
+                       kzalloc_objs(struct leapraid_blk_mq_poll_rq,
+                                    iopoll_qcnt);
                if (!adapter->notification_desc.blk_mq_poll_rqs)
                        return -ENOMEM;
 
@@ -7404,9 +7397,8 @@ static int leapraid_set_msi(struct leapraid_adapter *adapter)
                 adapter->notification_desc.iopoll_qcnt);
 
        adapter->notification_desc.int_rqs =
-               kcalloc(adapter->notification_desc.iopoll_qdex,
-                       sizeof(struct leapraid_int_rq),
-                       GFP_KERNEL);
+               kzalloc_objs(struct leapraid_int_rq,
+                            adapter->notification_desc.iopoll_qdex);
        if (!adapter->notification_desc.int_rqs)
                return -ENOMEM;
 
@@ -7958,18 +7950,16 @@ try_again:
                DIV_ROUND_UP(adapter->adapter_attr.rq_cnt,
                             LEAPRAID_REP_DESC_CHUNK_SIZE);
        adapter->mem_desc.rep_desc_seg_maint =
-               kcalloc(adapter->adapter_attr.rep_desc_q_seg_cnt,
-                       sizeof(struct leapraid_rep_desc_seg_maint),
-                       GFP_KERNEL);
+               kzalloc_objs(struct leapraid_rep_desc_seg_maint,
+                            adapter->adapter_attr.rep_desc_q_seg_cnt);
        if (!adapter->mem_desc.rep_desc_seg_maint)
                return -ENOMEM;
 
        rep_desc_q_cnt_allocated = 0;
        for (i = 0; i < adapter->adapter_attr.rep_desc_q_seg_cnt; i++) {
                adapter->mem_desc.rep_desc_seg_maint[i].rep_desc_maint =
-                       kcalloc(LEAPRAID_REP_DESC_CHUNK_SIZE,
-                               sizeof(struct leapraid_rep_desc_maint),
-                               GFP_KERNEL);
+                       kzalloc_objs(struct leapraid_rep_desc_maint,
+                                    LEAPRAID_REP_DESC_CHUNK_SIZE);
                if (!adapter->mem_desc.rep_desc_seg_maint[i].rep_desc_maint)
                        return -ENOMEM;
 
index 3b82e80e807a79a64b76661b372664ed427cff30..0f0f243c25615b4425e1a69f777ca099bd97eaaa 100644 (file)
@@ -158,7 +158,7 @@ int scsi_complete_async_scans(void)
                 * sleep a little.  Even if we never get memory, the async
                 * scans will finish eventually.
                 */
-               data = kmalloc(sizeof(*data), GFP_KERNEL);
+               data = kmalloc_obj(*data);
                if (!data)
                        msleep(1);
        } while (!data);
index 7be0374f59430d78b69ef35f6ccac343bb576f16..a903fa44e4e505a5699e37a6594fdb97e4e9b4b4 100644 (file)
@@ -65,7 +65,7 @@ static int __init brcmstb_soc_device_init(void)
                goto out_put_node;
        }
 
-       soc_info = kzalloc(sizeof(*soc_info), GFP_KERNEL);
+       soc_info = kzalloc_obj(*soc_info);
        if (!soc_info) {
                ret = -ENOMEM;
                goto out_unmap;
index a579ef33b2d2dec28e1a025a53d35c08dbef479c..a446927a51d36eb8156bc6bdc5f34e82f1e57d2d 100644 (file)
@@ -434,7 +434,7 @@ int devm_spi_offload_trigger_register(struct device *dev,
        if (!info->fwnode || !info->ops || !info->ops->match)
                return -EINVAL;
 
-       trigger = kzalloc(sizeof(*trigger), GFP_KERNEL);
+       trigger = kzalloc_obj(*trigger);
        if (!trigger)
                return -ENOMEM;
 
index 459aed0f12401dbbe65c9c97810b84a54222052b..4f1b3f4db404f7f6b85de3fd397ae5edc0051af9 100644 (file)
@@ -178,7 +178,7 @@ static int gb_raw_probe(struct gb_bundle *bundle,
        if (minor < 0)
                return minor;
 
-       raw = kzalloc_obj(*raw, GFP_KERNEL);
+       raw = kzalloc_obj(*raw);
        if (!raw) {
                ida_free(&minors, minor);
                return -ENOMEM;
index 00082276f1db4c38441d191697b622857eafa4fd..4a182dc384caf3e17ffc370bdc84fceb42267d1a 100644 (file)
@@ -5820,36 +5820,31 @@ static int ia_css_pipe_create_cas_scaler_desc_single_output(
        }
 
        descr->in_info = kmalloc_objs(*descr->in_info,
-                                     descr->num_stage,
-                                     GFP_KERNEL);
+                                     descr->num_stage);
        if (!descr->in_info) {
                err = -ENOMEM;
                goto ERR;
        }
        descr->internal_out_info = kmalloc_objs(*descr->internal_out_info,
-                                               descr->num_stage,
-                                               GFP_KERNEL);
+                                               descr->num_stage);
        if (!descr->internal_out_info) {
                err = -ENOMEM;
                goto ERR;
        }
        descr->out_info = kmalloc_objs(*descr->out_info,
-                                      descr->num_stage,
-                                      GFP_KERNEL);
+                                      descr->num_stage);
        if (!descr->out_info) {
                err = -ENOMEM;
                goto ERR;
        }
        descr->vf_info = kmalloc_objs(*descr->vf_info,
-                                     descr->num_stage,
-                                     GFP_KERNEL);
+                                     descr->num_stage);
        if (!descr->vf_info) {
                err = -ENOMEM;
                goto ERR;
        }
        descr->is_output_stage = kmalloc_objs(*descr->is_output_stage,
-                                             descr->num_stage,
-                                             GFP_KERNEL);
+                                             descr->num_stage);
        if (!descr->is_output_stage) {
                err = -ENOMEM;
                goto ERR;
@@ -5970,36 +5965,31 @@ ia_css_pipe_create_cas_scaler_desc(struct ia_css_pipe *pipe,
        descr->num_stage = num_stages;
 
        descr->in_info = kmalloc_objs(*descr->in_info,
-                                     descr->num_stage,
-                                     GFP_KERNEL);
+                                     descr->num_stage);
        if (!descr->in_info) {
                err = -ENOMEM;
                goto ERR;
        }
        descr->internal_out_info = kmalloc_objs(*descr->internal_out_info,
-                                               descr->num_stage,
-                                               GFP_KERNEL);
+                                               descr->num_stage);
        if (!descr->internal_out_info) {
                err = -ENOMEM;
                goto ERR;
        }
        descr->out_info = kmalloc_objs(*descr->out_info,
-                                      descr->num_stage,
-                                      GFP_KERNEL);
+                                      descr->num_stage);
        if (!descr->out_info) {
                err = -ENOMEM;
                goto ERR;
        }
        descr->vf_info = kmalloc_objs(*descr->vf_info,
-                                     descr->num_stage,
-                                     GFP_KERNEL);
+                                     descr->num_stage);
        if (!descr->vf_info) {
                err = -ENOMEM;
                goto ERR;
        }
        descr->is_output_stage = kmalloc_objs(*descr->is_output_stage,
-                                             descr->num_stage,
-                                             GFP_KERNEL);
+                                             descr->num_stage);
        if (!descr->is_output_stage) {
                err = -ENOMEM;
                goto ERR;
index af12df2f9b090a3e8ccb44ff735cbed5b43754d4..b895dee7756867a436fb426546f27ee5f8ec2286 100644 (file)
@@ -254,8 +254,8 @@ sh_css_load_firmware(struct device *dev, const char *fw_data,
        /* Only allocate memory for ISP blob info */
        if (sh_css_num_binaries > NUM_OF_SPS) {
                sh_css_blob_info =
-                       kmalloc_array(sh_css_num_binaries - NUM_OF_SPS,
-                                     sizeof(*sh_css_blob_info), GFP_KERNEL);
+                       kmalloc_objs(*sh_css_blob_info,
+                                    sh_css_num_binaries - NUM_OF_SPS);
                if (!sh_css_blob_info)
                        return -ENOMEM;
        } else {
index 10452fcc7ccb288f89752b42e73649b718d34daf..a06eb94e0bae4b9630c45271979171bc22116a54 100644 (file)
@@ -230,8 +230,7 @@ static int qcomtee_user_object_dispatch(struct qcomtee_object_invoke_ctx *oic,
        struct qcomtee_context_data *ctxdata = uo->ctx->data;
        int errno;
 
-       struct qcomtee_ureq *ureq __free(kfree) = kzalloc(sizeof(*ureq),
-                                                         GFP_KERNEL);
+       struct qcomtee_ureq *ureq __free(kfree) = kzalloc_obj(*ureq);
        if (!ureq)
                return -ENOMEM;
 
index c737dd0ca6e72ed1af27cdfb63fb32c5bb078dc8..25c259dd07602dfadab4a0f1449411d08a65ee3d 100644 (file)
@@ -408,8 +408,7 @@ static int tbstream_dev_alloc_rx_buffers(struct tbstream_dev *sdev)
        size_t ring_size = tb_ring_size(sdev->rx_ring.ring);
        int i;
 
-       sdev->rx_ring.frames = kcalloc(ring_size, sizeof(struct tbstream_frame),
-                                      GFP_KERNEL);
+       sdev->rx_ring.frames = kzalloc_objs(struct tbstream_frame, ring_size);
        if (!sdev->rx_ring.frames)
                return -ENOMEM;
 
@@ -463,8 +462,7 @@ static int tbstream_dev_alloc_tx_buffers(struct tbstream_dev *sdev)
        size_t ring_size = tb_ring_size(sdev->tx_ring.ring);
        int i;
 
-       sdev->tx_ring.frames = kcalloc(ring_size, sizeof(struct tbstream_frame),
-                                      GFP_KERNEL);
+       sdev->tx_ring.frames = kzalloc_objs(struct tbstream_frame, ring_size);
        if (!sdev->tx_ring.frames)
                return -ENOMEM;
 
@@ -1498,7 +1496,7 @@ tbstream_dev_make_group(struct config_group *group, const char *name)
        if (strlen(name) > TB_PROPERTY_KEY_SIZE)
                return ERR_PTR(-ENAMETOOLONG);
 
-       sdev = kzalloc_obj(*sdev, GFP_KERNEL);
+       sdev = kzalloc_obj(*sdev);
        if (!sdev)
                return ERR_PTR(-ENOMEM);
 
@@ -1592,7 +1590,7 @@ tbstream_make_group(struct config_group *group, const char *name)
        if (sscanf(name, "%u-%llx.%u", &domain, &route, &index) != 3)
                return ERR_PTR(-EINVAL);
 
-       sg = kzalloc_obj(*sg, GFP_KERNEL);
+       sg = kzalloc_obj(*sg);
        if (!sg)
                return ERR_PTR(-ENOMEM);
 
@@ -1698,7 +1696,7 @@ static int tbstream_probe(struct tb_service *svc)
 {
        struct tbstream *stream;
 
-       stream = kzalloc_obj(*stream, GFP_KERNEL);
+       stream = kzalloc_obj(*stream);
        if (!stream)
                return -ENOMEM;
 
index 1bb2376af85c22c4967563dd136c05451ed0f404..40a1c614e23b1ed8d84188490f174e2da22e5637 100644 (file)
@@ -954,8 +954,7 @@ static int moxa_init_board(struct moxa_board_conf *brd, struct device *dev)
        unsigned int i, first_idx;
        int ret;
 
-       brd->ports = kcalloc(MAX_PORTS_PER_BOARD, sizeof(*brd->ports),
-                       GFP_KERNEL);
+       brd->ports = kzalloc_objs(*brd->ports, MAX_PORTS_PER_BOARD);
        if (brd->ports == NULL) {
                printk(KERN_ERR "cannot allocate memory for ports\n");
                ret = -ENOMEM;
index 3fa89a2dbebab330972375ac60ab57729e262aa1..7d564341a7eb7cc75b8ce4a2f022104ab411130f 100644 (file)
@@ -776,7 +776,8 @@ int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct,
        struct uni_pagedict *dict;
        unsigned int d, r, g;
 
-       struct unipair *unilist __free(kvfree) = kvmalloc_array(ct, sizeof(*unilist), GFP_KERNEL);
+       struct unipair *unilist __free(kvfree) = kvmalloc_objs(*unilist, ct,
+                                                              GFP_KERNEL);
        if (!unilist)
                return -ENOMEM;
 
index fa5f539632eb068017bbc504ead5863858eae0bb..6192512e29ded475f4a37584c127f4b09fcde6af 100644 (file)
@@ -1073,7 +1073,7 @@ static int __ufshcd_tx_eqtr(struct ufs_hba *hba,
                            struct ufs_pa_layer_attr *pwr_mode)
 {
        struct ufshcd_tx_eqtr_data *eqtr_data  __free(kfree) =
-               kzalloc(sizeof(*eqtr_data), GFP_KERNEL);
+               kzalloc_obj(*eqtr_data);
        struct tx_eqtr_iter h_iter = {};
        struct tx_eqtr_iter d_iter = {};
        u32 gear = pwr_mode->gear_tx;
index 62396212a0a7309f3628c85a24095f82749fbaaf..65c0816bc6750d081489820641146613bcd613e9 100644 (file)
@@ -2761,7 +2761,7 @@ static int ufs_qcom_get_rx_fom(struct ufs_hba *hba,
                               struct tx_eqtr_iter *d_iter)
 {
        struct ufshcd_tx_eq_params *params __free(kfree) =
-               kzalloc(sizeof(*params), GFP_KERNEL);
+               kzalloc_obj(*params);
        struct ufs_qcom_host *host = ufshcd_get_variant(hba);
        struct ufs_pa_layer_attr old_pwr_info;
        u32 fom[PA_MAXDATALANES] = { 0 };
index bf02545b37a22b0008783199f2cd046d509acbea..500c9c19c78b4fd99de65054a20f9add5337798e 100644 (file)
@@ -1766,7 +1766,7 @@ static struct usb_function *ncm_alloc(struct usb_function_instance *fi)
        int status;
 
        /* allocate and initialize one new instance */
-       ncm = kzalloc(sizeof(*ncm), GFP_KERNEL);
+       ncm = kzalloc_obj(*ncm);
        if (!ncm)
                return ERR_PTR(-ENOMEM);
 
index a5837c0feb0580cdb4a61ec549c1294c7c1e1a66..100f8920624bb652eb4e0a9df5eb3528578a9b7b 100644 (file)
@@ -696,7 +696,7 @@ int usbip_recv_iso(struct usbip_device *ud, struct urb *urb)
 
        size = np * sizeof(*iso);
 
-       buff = kcalloc(np, sizeof(*iso), GFP_KERNEL);
+       buff = kzalloc_objs(*iso, np);
        if (!buff)
                return -ENOMEM;
 
index 69922be28b54cf859cb715bd3f311c0c7aea3b77..076c1b0ab87fd195b8fa3a76502f27c0e0431f09 100644 (file)
@@ -1478,7 +1478,7 @@ static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
        /* No need for kzalloc as it is initialized in following hypercall
         * GNTTABOP_setup_table.
         */
-       frames = kmalloc_array(nr_gframes, sizeof(*frames), GFP_ATOMIC);
+       frames = kmalloc_objs(*frames, nr_gframes, GFP_ATOMIC);
        if (!frames)
                return -ENOMEM;
 
index e549e222602ee3ee90e8a7f02c8743ae2f9dc195..fa6b7143db98ff68519cad6333bb4cd5b7f594df 100644 (file)
@@ -113,8 +113,7 @@ void v9fs_dentry_fid_remove(struct dentry *dentry)
  */
 static int v9fs_dentry_init(struct dentry *dentry)
 {
-       struct v9fs_dentry *v9fs_dentry = kzalloc(sizeof(*v9fs_dentry),
-                                                 GFP_KERNEL);
+       struct v9fs_dentry *v9fs_dentry = kzalloc_obj(*v9fs_dentry);
 
        if (!v9fs_dentry)
                return -ENOMEM;
index 81565366d937b940a35f725163885a45a34eae36..2db534a2c7cc49d005ad3aca036691cf20f49306 100644 (file)
@@ -1801,7 +1801,7 @@ static int afs_symlink(struct mnt_idmap *idmap, struct inode *dir,
                goto error;
 
        ret = -ENOMEM;
-       symlink = kmalloc_flex(struct afs_symlink, content, clen + 1, GFP_KERNEL);
+       symlink = kmalloc_flex(struct afs_symlink, content, clen + 1);
        if (!symlink)
                goto error;
        refcount_set(&symlink->ref, 1);
index 16b4823cb7b7e7a432f00aea42f37a9fad39ee76..6b8c122877ca2d9523173508a41881adfe6b9f05 100644 (file)
@@ -119,8 +119,7 @@ static ssize_t afs_do_read_symlink(struct afs_vnode *vnode)
                vnode->directory_size = i_size;
 
                /* Copy the symlink. */
-               symlink = kmalloc_flex(struct afs_symlink, content, i_size + 1,
-                                      GFP_KERNEL);
+               symlink = kmalloc_flex(struct afs_symlink, content, i_size + 1);
                if (!symlink)
                        return -ENOMEM;
 
index ddfd3aa57ac87345255e51e7b329277216983b75..620da85948b4d5ab0be01a363ec56d47e4e88be9 100644 (file)
@@ -331,8 +331,8 @@ static int entry_attach_interpreter(struct binfmt_misc_entry *e,
                return -ENOSPC;
 
        /* One allocation, both strings in it, like the entry's own buffer. */
-       interp = kmalloc(struct_size(interp, name, nlen + plen + 2),
-                        GFP_KERNEL_ACCOUNT);
+       interp = kmalloc_flex(*interp, name, nlen + plen + 2,
+                             GFP_KERNEL_ACCOUNT);
        if (!interp) {
                dec_ucount(ucounts, UCOUNT_BINFMT_MISC_INTERPRETERS);
                return -ENOMEM;
@@ -858,8 +858,7 @@ static struct binfmt_misc_entry *create_entry(const char __user *buffer,
        if ((count < 11) || (count > MAX_REGISTER_LENGTH))
                return ERR_PTR(-EINVAL);
 
-       e = kmalloc(struct_size(e, buf, count + MISC_DELIM_PAD),
-                   GFP_KERNEL_ACCOUNT);
+       e = kmalloc_flex(*e, buf, count + MISC_DELIM_PAD, GFP_KERNEL_ACCOUNT);
        if (!e)
                return ERR_PTR(-ENOMEM);
 
index 657c2cb0f8811b4a4cb3c2d79fee467f05cf7761..e598b2d424ec168804166f0183b1e1ed92022c86 100644 (file)
@@ -2546,7 +2546,7 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci,
        }
 
        pool_ns_len = pool_ns ? pool_ns->len : 0;
-       perm = kmalloc_flex(*perm, pool_ns, pool_ns_len + 1, GFP_KERNEL);
+       perm = kmalloc_flex(*perm, pool_ns, pool_ns_len + 1);
        if (!perm) {
                err = -ENOMEM;
                goto out_unlock;
index a091f77cedaf3e2cc6057f93891e065c6dbb61c3..cc5fea0a90123464fe66068970bebd14518840ad 100644 (file)
@@ -5492,7 +5492,7 @@ static void ceph_mdsc_reset_workfn(struct work_struct *work)
                goto out_complete;
        }
 
-       sessions = kcalloc(max_sessions, sizeof(*sessions), GFP_KERNEL);
+       sessions = kzalloc_objs(*sessions, max_sessions);
        if (!sessions) {
                mutex_unlock(&mdsc->mutex);
                ret = -ENOMEM;
index 03fda1f9257b6de0181dc5f8a2555fc294d212f4..01419c9482f1841d143c952631501eec32e0aa13 100644 (file)
@@ -245,7 +245,7 @@ int ceph_subvolume_metrics_snapshot(struct ceph_subvolume_metrics_tracker *track
                return 0;
        }
 
-       snap = kcalloc(count, sizeof(*snap), GFP_NOFS);
+       snap = kzalloc_objs(*snap, count, GFP_NOFS);
        if (!snap) {
                atomic64_inc(&tracker->snapshot_failures);
                return -ENOMEM;
index ac3cd74808c640c5a0fb6adb206da26e7f86b58c..6114839f5178b047e2d9866b51508d28618e2a36 100644 (file)
@@ -1000,7 +1000,7 @@ static bool coredump_pipe(struct core_name *cn, struct coredump_params *cprm,
                return false;
        }
 
-       helper_argv = kmalloc_array(argc + 1, sizeof(*helper_argv), GFP_KERNEL);
+       helper_argv = kmalloc_objs(*helper_argv, argc + 1);
        if (!helper_argv) {
                coredump_report_failure("%s failed to allocate memory", __func__);
                return false;
index 062103e42cd8638b7d0e0da577e1e3f135a0a84e..0cac890cf37029a1931cc0fa3de2fde82a9a5126 100644 (file)
@@ -1116,7 +1116,7 @@ static int ext4_fc_snapshot_inode(struct inode *inode,
        else if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE)
                inode_len += ei->i_extra_isize;
 
-       snap = kmalloc(struct_size(snap, inode_buf, inode_len), GFP_NOFS);
+       snap = kmalloc_flex(*snap, inode_buf, inode_len, GFP_NOFS);
        if (!snap) {
                atomic64_inc(&stats->snap_fail_nomem);
                ext4_fc_set_snap_err(snap_err, EXT4_FC_SNAP_ERR_NOMEM);
@@ -1522,7 +1522,7 @@ static int ext4_fc_alloc_snapshot_inodes(struct super_block *sb,
        if (nr_inodes > EXT4_FC_SNAPSHOT_MAX_INODES)
                return -E2BIG;
 
-       inodes = kvcalloc(nr_inodes, sizeof(*inodes), GFP_NOFS);
+       inodes = kvzalloc_objs(*inodes, nr_inodes, GFP_NOFS);
        if (!inodes)
                return -ENOMEM;
 
index 8d6135a6108a4a45b6a5a8047404577c80055958..9a36d0329e221a5ff7dbdb19ba5382b8f66521ff 100644 (file)
@@ -1597,8 +1597,7 @@ static int fuse_get_user_pages(struct fuse_args_pages *ap, struct iov_iter *ii,
         * manually extract pages using iov_iter_extract_pages() and then
         * copy that to a folios array.
         */
-       struct page **pages = kcalloc(max_pages, sizeof(struct page *),
-                                     GFP_KERNEL);
+       struct page **pages = kzalloc_objs(struct page *, max_pages);
        if (!pages) {
                ret = -ENOMEM;
                goto out;
index 5ca87151d70d987df36a763510eae2805aec1459..d2599043f7ecbf9fc34acdb70c886afe10b56543 100644 (file)
@@ -336,7 +336,7 @@ static int parse_dirplusfile(char *buf, size_t nbytes, struct file *file,
 static struct page **fuse_readdir_alloc_buf(struct fuse_args_pages *ap, size_t *bufsize)
 {
        unsigned int i, nr_alloc, nr_pages = DIV_ROUND_UP(*bufsize, PAGE_SIZE);
-       struct page **pages = kcalloc(nr_pages, sizeof(*pages), GFP_KERNEL);
+       struct page **pages = kzalloc_objs(*pages, nr_pages);
 
        if (!pages)
                return NULL;
index 1b331108d9c01b6a53da97cfe4b8439bce5b9ba7..fcb5b9cd17f64483a68704cb86d8cf2925614b57 100644 (file)
@@ -312,7 +312,7 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid)
                return NULL;
        }
 
-       node = kzalloc_flex(*node, page, tree->pages_per_bnode, GFP_KERNEL);
+       node = kzalloc_flex(*node, page, tree->pages_per_bnode);
        if (!node)
                return NULL;
        node->tree = tree;
index 1ecd96c918b33581e0bdae88dc1e4978ebce2965..ae5dc64f8b457e773049d4d8ea858d11770e9ede 100644 (file)
@@ -5999,7 +5999,7 @@ SYSCALL_DEFINE4(statmount, const struct mnt_id_req __user *, req,
                        return -EPERM;
        }
 
-       ks = kmalloc(sizeof(*ks), GFP_KERNEL_ACCOUNT);
+       ks = kmalloc_obj(*ks, GFP_KERNEL_ACCOUNT);
        if (!ks)
                return -ENOMEM;
 
index a47c90f40422b7a6a3d5c0e849de6c32d135389c..a7ebce53faec35f906e4acc1e6096ccc880a72b0 100644 (file)
@@ -358,7 +358,7 @@ int nfsd_nl_expkey_get_reqs_dumpit(struct sk_buff *skb,
                goto out_unlock;
        }
 
-       items = kcalloc(cnt, sizeof(*items), GFP_KERNEL);
+       items = kzalloc_objs(*items, cnt);
        seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);
        if (!items || !seqnos) {
                ret = -ENOMEM;
@@ -685,7 +685,7 @@ int nfsd_nl_svc_export_get_reqs_dumpit(struct sk_buff *skb,
                goto out_unlock;
        }
 
-       items = kcalloc(cnt, sizeof(*items), GFP_KERNEL);
+       items = kzalloc_objs(*items, cnt);
        seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);
        pathbuf = kmalloc(PATH_MAX, GFP_KERNEL);
        if (!items || !seqnos || !pathbuf) {
@@ -786,8 +786,7 @@ static int nfsd_nl_parse_fslocations(struct nlattr *attr,
        if (!count)
                return 0;
 
-       fsloc->locations = kcalloc(count, sizeof(struct nfsd4_fs_location),
-                                  GFP_KERNEL);
+       fsloc->locations = kzalloc_objs(struct nfsd4_fs_location, count);
        if (!fsloc->locations)
                return -ENOMEM;
 
index a901bbe67e0345cf1339cc74586214d0736bdc18..19dc337502ca869154a06f3f24954bc6e9f005e9 100644 (file)
@@ -1981,12 +1981,12 @@ int nfsd_net_cb_init(struct nfsd_net *nn)
 {
        struct nfsd_net_cb *cb;
 
-       cb = kzalloc(sizeof(*cb), GFP_KERNEL);
+       cb = kzalloc_obj(*cb);
        if (!cb)
                return -ENOMEM;
 
        cb->version4.counts = kzalloc_objs(unsigned int,
-                       ARRAY_SIZE(nfs4_cb_procedures), GFP_KERNEL);
+                       ARRAY_SIZE(nfs4_cb_procedures));
        if (!cb->version4.counts) {
                kfree(cb);
                return -ENOMEM;
index 18e17232cf945f80d33a66be37c0c65324a1cdec..9c4adf3110aea4ee4cb0b4b2c4e458bd1ee8320e 100644 (file)
@@ -1341,7 +1341,7 @@ alloc_init_dir_deleg(struct nfs4_client *clp, struct nfs4_file *fp)
                return NULL;
        }
 
-       ncn->ncn_nf = kcalloc(NOTIFY4_EVENT_QUEUE_SIZE, sizeof(*ncn->ncn_nf), GFP_KERNEL);
+       ncn->ncn_nf = kzalloc_objs(*ncn->ncn_nf, NOTIFY4_EVENT_QUEUE_SIZE);
        if (!ncn->ncn_nf) {
                nfs4_put_stid(&dp->dl_stid);
                return NULL;
@@ -10419,8 +10419,9 @@ alloc_nfsd_notify_event(u32 mask, const struct qstr *q, struct dentry *dentry,
                newnamelen = newname.name.len;
        }
 
-       ne = kmalloc(struct_size(ne, ne_name, q->len + 1 +
-                                (newnamelen ? newnamelen + 1 : 0)), GFP_NOFS);
+       ne = kmalloc_flex(*ne, ne_name,
+                         q->len + 1 + (newnamelen ? newnamelen + 1 : 0),
+                         GFP_NOFS);
        if (!ne)
                goto out;
 
index adb032b7311a313f4abd9a7725d677abdd11fc3b..5abb2d4274c98ee00a461806ddad40325331d305 100644 (file)
@@ -1647,7 +1647,7 @@ static int nfsd_nl_fh_key_set(const struct nlattr *attr, struct nfsd_net *nn)
        k1 = get_unaligned_le64(nla_data(attr) + 8);
 
        if (!fh_key) {
-               fh_key = kmalloc(sizeof(siphash_key_t), GFP_KERNEL);
+               fh_key = kmalloc_obj(siphash_key_t);
                if (!fh_key) {
                        trace_nfsd_ctl_fh_key_set(false, -ENOMEM);
                        return -ENOMEM;
index 1840b7d84c62848fd104aa290d0c8e33a8240dcb..5a4457551306d00e3a94cf144e6195fba9b8863c 100644 (file)
@@ -40,7 +40,7 @@ int ntfs_trim_fs(struct ntfs_volume *vol, struct fstrim_range *range)
                        end_cluster = vol->nr_clusters;
        }
 
-       ra = kzalloc(sizeof(*ra), GFP_NOFS);
+       ra = kzalloc_obj(*ra, GFP_NOFS);
        if (!ra)
                return -ENOMEM;
 
index 197d8607fc6338dbfb8738134c3d75d9968396f2..99a3ea2b5c5539a622f91967b03746330d58968e 100644 (file)
@@ -514,8 +514,8 @@ int ntfs_read_compressed_block(struct folio *folio)
                return -EIO;
        }
 
-       pages = kmalloc_array(nr_pages, sizeof(struct page *), GFP_NOFS);
-       completed_pages = kmalloc_array(nr_pages + 1, sizeof(int), GFP_NOFS);
+       pages = kmalloc_objs(struct page *, nr_pages, GFP_NOFS);
+       completed_pages = kmalloc_objs(int, nr_pages + 1, GFP_NOFS);
 
        if (unlikely(!pages || !completed_pages)) {
                kfree(pages);
@@ -1262,7 +1262,7 @@ static int ntfs_compress_workspace_init(struct ntfs_inode *ni,
        size = ni->itype.compressed.block_size + 2 *
                (ni->itype.compressed.block_size / NTFS_SB_SIZE) + 2;
        ws->nr_pages = DIV_ROUND_UP(size, PAGE_SIZE);
-       ws->pages = kcalloc(ws->nr_pages, sizeof(*ws->pages), GFP_NOFS);
+       ws->pages = kzalloc_objs(*ws->pages, ws->nr_pages, GFP_NOFS);
        if (!ws->pages)
                return -ENOMEM;
 
@@ -1483,7 +1483,7 @@ int ntfs_compress_write(struct ntfs_inode *ni, loff_t pos, size_t count,
        pages_per_cb = DIV_ROUND_UP(offset_in_page(pos & ~(cb_size - 1)) +
                        cb_size, PAGE_SIZE);
 
-       pages = kmalloc_array(pages_per_cb, sizeof(struct page *), GFP_NOFS);
+       pages = kmalloc_objs(struct page *, pages_per_cb, GFP_NOFS);
        if (!pages)
                return -ENOMEM;
        ctx = kvzalloc_obj(*ctx, GFP_NOFS);
index 2d594cbb4ebe3ff56ca0bf71a1b80fd2591b15e0..df60138f9b2d3858dfea25f6db865df62707a948 100644 (file)
@@ -166,8 +166,8 @@ found_it:
                         */
                        if (ie->key.file_name.file_name_type == FILE_NAME_DOS) {
                                if (!name) {
-                                       name = kmalloc(sizeof(struct ntfs_name),
-                                                       GFP_NOFS);
+                                       name = kmalloc_obj(struct ntfs_name,
+                                                          GFP_NOFS);
                                        if (!name) {
                                                err = -ENOMEM;
                                                goto err_out;
@@ -401,8 +401,8 @@ found_it2:
                         */
                        if (ie->key.file_name.file_name_type == FILE_NAME_DOS) {
                                if (!name) {
-                                       name = kmalloc(sizeof(struct ntfs_name),
-                                                       GFP_NOFS);
+                                       name = kmalloc_obj(struct ntfs_name,
+                                                          GFP_NOFS);
                                        if (!name) {
                                                err = -ENOMEM;
                                                goto unm_err_out;
@@ -700,7 +700,7 @@ static int ntfs_ia_blocks_readahead(struct ntfs_inode *ia_ni, loff_t pos)
        if (dir_start_index >= dir_end_index)
                return 0;
 
-       dir_ra = kzalloc(sizeof(*dir_ra), GFP_NOFS);
+       dir_ra = kzalloc_obj(*dir_ra, GFP_NOFS);
        if (!dir_ra)
                return -ENOMEM;
 
@@ -777,7 +777,7 @@ static int ntfs_readdir(struct file *file, struct dir_context *actor)
                return -ENOMEM;
        }
 
-       ra = kzalloc(sizeof(struct file_ra_state), GFP_NOFS);
+       ra = kzalloc_obj(struct file_ra_state, GFP_NOFS);
        if (!ra) {
                kfree(name);
                ntfs_index_ctx_put(ictx);
@@ -813,7 +813,7 @@ static int ntfs_readdir(struct file *file, struct dir_context *actor)
                        goto out;
                }
        } else if (!private) {
-               private = kzalloc(sizeof(struct ntfs_file_private), GFP_KERNEL);
+               private = kzalloc_obj(struct ntfs_file_private);
                if (!private) {
                        err = -ENOMEM;
                        goto out;
@@ -949,7 +949,7 @@ nextdir:
                }
 
                if (!nir) {
-                       nir = kzalloc(sizeof(struct ntfs_index_ra), GFP_KERNEL);
+                       nir = kzalloc_obj(struct ntfs_index_ra);
                        if (nir) {
                                nir->start_index = index;
                                nir->count = 1;
index 3f4ba766752293857b067046be9c49adc47a3df1..b4fcfbe2da4c9b2185c6f8f5a9d20733d98da742 100644 (file)
@@ -235,7 +235,7 @@ static int ntfs_set_ea(struct inode *inode, const char *name, size_t name_len,
                ea_info_qsize = le32_to_cpu(p_ea_info->ea_query_length);
        } else {
 create_ea_info:
-               p_ea_info = kzalloc(sizeof(struct ea_information), GFP_NOFS);
+               p_ea_info = kzalloc_obj(struct ea_information, GFP_NOFS);
                if (!p_ea_info)
                        return -ENOMEM;
 
index 46a8b19c0723e255e1db371dd8960c0b8c916d99..580998990bc95610a631a7f969dae781d9f1c9c4 100644 (file)
@@ -1660,7 +1660,7 @@ resplit:
                        goto out;
                }
        } else {
-               si = kzalloc(sizeof(struct split_info), GFP_NOFS);
+               si = kzalloc_obj(struct split_info, GFP_NOFS);
                if (!si) {
                        ntfs_ibm_clear(icx, new_vcn);
                        ret = -ENOMEM;
index 024ddee42dc8f6ea5f9881049cde38aac0265b61..1404664dacc01e97558cae4bc15883b7fc13cdc2 100644 (file)
@@ -691,7 +691,7 @@ map_vcn:
 
        memset(empty_buf, 0xff, vol->cluster_size);
 
-       ra = kzalloc(sizeof(*ra), GFP_NOFS);
+       ra = kzalloc_obj(*ra, GFP_NOFS);
        if (!ra)
                goto err;
 
index 7e58c99f1728d41edebdc72f735bb6f856aed67e..98ab686a5ea2fab42ca03c96f2dac414c88a00af 100644 (file)
@@ -2635,11 +2635,13 @@ static int ntfs_write_mft_block(struct folio *folio, struct writeback_control *w
        struct ntfs_inode *ni = NTFS_I(vi);
        struct ntfs_volume *vol = ni->vol;
        u8 *kaddr;
-       struct ntfs_inode **locked_nis __free(kfree) = kmalloc_array(PAGE_SIZE / NTFS_BLOCK_SIZE,
-                                                       sizeof(struct ntfs_inode *), GFP_NOFS);
+       struct ntfs_inode **locked_nis __free(kfree) = kmalloc_objs(struct ntfs_inode *,
+                                                                   PAGE_SIZE / NTFS_BLOCK_SIZE,
+                                                                   GFP_NOFS);
        int nr_locked_nis = 0, err = 0, mft_ofs, prev_mft_ofs;
-       struct inode **ref_inos __free(kfree) = kmalloc_array(PAGE_SIZE / NTFS_BLOCK_SIZE,
-                                                             sizeof(struct inode *), GFP_NOFS);
+       struct inode **ref_inos __free(kfree) = kmalloc_objs(struct inode *,
+                                                            PAGE_SIZE / NTFS_BLOCK_SIZE,
+                                                            GFP_NOFS);
        int nr_ref_inos = 0;
        struct bio *bio = NULL;
        u64 mft_no;
index 00373e450ea7ac54875a957c830fc3c964cbeb55..3a61f19bcbeef63ebb6888606ad03be34ac2208e 100644 (file)
@@ -1804,7 +1804,7 @@ merge_src_rle:
        new_2nd_cnt = src_cnt;
        new_cnt = new_1st_cnt + new_2nd_cnt + new_3rd_cnt;
        new_cnt += dst_rl_split.lcn >= LCN_HOLE ? 1 : 0;
-       new_rl = kvcalloc(new_cnt, sizeof(*new_rl), GFP_NOFS);
+       new_rl = kvzalloc_objs(*new_rl, new_cnt, GFP_NOFS);
        if (!new_rl)
                return ERR_PTR(-ENOMEM);
 
@@ -1888,13 +1888,13 @@ struct runlist_element *ntfs_rl_punch_hole(struct runlist_element *dst_rl, int d
 
        punch_cnt = (int)(e_rl - s_rl) + 1;
 
-       *punch_rl = kvcalloc(punch_cnt + 1, sizeof(struct runlist_element),
-                       GFP_NOFS);
+       *punch_rl = kvzalloc_objs(struct runlist_element, punch_cnt + 1,
+                                 GFP_NOFS);
        if (!*punch_rl)
                return ERR_PTR(-ENOMEM);
 
        new_cnt = dst_cnt - (int)(e_rl - s_rl + 1) + 3;
-       new_rl = kvcalloc(new_cnt, sizeof(struct runlist_element), GFP_NOFS);
+       new_rl = kvzalloc_objs(struct runlist_element, new_cnt, GFP_NOFS);
        if (!new_rl) {
                kvfree(*punch_rl);
                *punch_rl = NULL;
@@ -2038,13 +2038,13 @@ struct runlist_element *ntfs_rl_collapse_range(struct runlist_element *dst_rl, i
        one_split_3 = e_rl == s_rl && begin_split && end_split;
 
        punch_cnt = (int)(e_rl - s_rl) + 1;
-       *punch_rl = kvcalloc(punch_cnt + 1, sizeof(struct runlist_element),
-                       GFP_NOFS);
+       *punch_rl = kvzalloc_objs(struct runlist_element, punch_cnt + 1,
+                                 GFP_NOFS);
        if (!*punch_rl)
                return ERR_PTR(-ENOMEM);
 
        new_cnt = dst_cnt - (int)(e_rl - s_rl + 1) + 3;
-       new_rl = kvcalloc(new_cnt, sizeof(struct runlist_element), GFP_NOFS);
+       new_rl = kvzalloc_objs(struct runlist_element, new_cnt, GFP_NOFS);
        if (!new_rl) {
                kvfree(*punch_rl);
                *punch_rl = NULL;
index 60d43339c590a097947dc73b865092b375832db6..5aad2d2a36bb4038f2221173e81b64e3ac47f655 100644 (file)
@@ -2539,7 +2539,7 @@ static int ntfs_init_fs_context(struct fs_context *fc)
        struct ntfs_volume *vol;
 
        /* Allocate a new struct ntfs_volume and place it in sb->s_fs_info. */
-       vol = kmalloc(sizeof(struct ntfs_volume), GFP_NOFS);
+       vol = kmalloc_obj(struct ntfs_volume, GFP_NOFS);
        if (!vol)
                return -ENOMEM;
 
index e7fe29cb6028b154ffaf5b355f21554d7d57b856..7d6f7f6022ebe0e9346bb822e075746b33247279 100644 (file)
@@ -1044,7 +1044,7 @@ static int ovl_dir_open(struct inode *inode, struct file *file)
        struct ovl_dir_file *od;
        enum ovl_path_type type;
 
-       od = kzalloc(sizeof(struct ovl_dir_file), GFP_KERNEL);
+       od = kzalloc_obj(struct ovl_dir_file);
        if (!od)
                return -ENOMEM;
 
index fe10719e627e54260c341fd9f90ce67105190a74..c49ecddf4a3390a206ec672b88c8264e12430a78 100644 (file)
@@ -443,7 +443,7 @@ static struct cifs_swn_reg *cifs_get_swn_reg(struct cifs_tcon *tcon)
                goto unlock;
        }
 
-       reg = kmalloc_obj(struct cifs_swn_reg, GFP_KERNEL);
+       reg = kmalloc_obj(struct cifs_swn_reg);
        if (reg == NULL) {
                ret = -ENOMEM;
                goto fail_unlock;
index 86dba25b7a5a80ebb97f8b352a852b27b3ca1a78..f6c4259479c567e59ad88a60c8aa85e335cae5e4 100644 (file)
@@ -365,7 +365,7 @@ static struct cache_dfs_tgt *alloc_target(const char *name, int path_consumed)
 {
        struct cache_dfs_tgt *t;
 
-       t = kmalloc_obj(*t, GFP_KERNEL);
+       t = kmalloc_obj(*t);
        if (!t)
                return ERR_PTR(-ENOMEM);
        t->name = kstrdup(name, GFP_KERNEL);
index 98ea5c6c34afeaa247ec5ce804d770ba72773fa0..96063e355186509697e6061db8793b0301644fec 100644 (file)
@@ -237,7 +237,7 @@ replay_again:
        num_rqst = 0;
        server = cifs_pick_channel(ses);
 
-       vars = kzalloc_obj(*vars, GFP_KERNEL);
+       vars = kzalloc_obj(*vars);
        if (vars == NULL) {
                rc = -ENOMEM;
                goto out;
index f35335307670fe146e775cdfbe97070f8a776a6a..d307aefe0aec1e4d5a5f32305d54847951cb6352 100644 (file)
@@ -30,7 +30,7 @@ static int ksmbd_reserve_iov(struct ksmbd_work *work, int need_iov_cnt)
        } while (new_alloc_cnt < work->iov_cnt + need_iov_cnt);
 
        if (work->iov == work->iov_inline) {
-               new = kcalloc(new_alloc_cnt, sizeof(*new), KSMBD_DEFAULT_GFP);
+               new = kzalloc_objs(*new, new_alloc_cnt, KSMBD_DEFAULT_GFP);
                if (!new)
                        return -ENOMEM;
 
index 0ecc52fde69ca094202989ae74f61332aba444ca..b7ce67094626005391c974366db47bb74aa79a3a 100644 (file)
@@ -11820,7 +11820,7 @@ static void smb2_notify_cancel_fn(void **argv)
                return;
        conn = in_work->conn;
 
-       ctx = kmalloc(sizeof(*ctx), GFP_ATOMIC);
+       ctx = kmalloc_obj(*ctx, GFP_ATOMIC);
        if (!ctx) {
                /* Can't defer the response -- free without sending one. */
                list_del_init(&in_work->async_request_entry);
index f190c088591bcede08dde19262e3a491c1c0ba45..7938d2324e87699b66a7bf31a4c083960dd4bcfe 100644 (file)
@@ -2746,8 +2746,8 @@ xfs_dabuf_map(
         * larger one that needs to be free by the caller.
         */
        if (nirecs > 1) {
-               map = kcalloc(nirecs, sizeof(struct xfs_buf_map),
-                             GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
+               map = kzalloc_objs(struct xfs_buf_map, nirecs,
+                                  GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
                *mapp = map;
        }
 
index 9cf316c13ffa5c8850f9cceba4516c8e490bbeda..1154547721eaf1583e6625cbc8220a86bd3bf34e 100644 (file)
@@ -514,7 +514,7 @@ static void __init initramfs_test_hdr_hex(struct kunit *test)
        char fdata[] = "this file data will not be unpacked";
        struct initramfs_test_bufs {
                char cpio_src[(CPIO_HDRLEN + PATH_MAX + 3 + sizeof(fdata)) * 2];
-       } *tbufs = kzalloc(sizeof(struct initramfs_test_bufs), GFP_KERNEL);
+       } *tbufs = kzalloc_obj(struct initramfs_test_bufs);
        struct initramfs_test_cpio c[] = { {
                .magic = "070701",
                .ino = 1,
index bfc771445912037f9e2fb687f1f0887703f73d98..ca1c814fa73a28c4354cd7ee32a7e25e7302a385 100644 (file)
@@ -58,7 +58,7 @@ int __io_napi_add_id(struct io_ring_ctx *ctx, unsigned int napi_id,
                }
        }
 
-       e = kmalloc(sizeof(*e), GFP_NOWAIT);
+       e = kmalloc_obj(*e, GFP_NOWAIT);
        if (!e)
                return -ENOMEM;
 
index 1b3b11405daca50d8a2dc7200e6293bb986cf172..86d580d4410d9c1ae0f9877fc1031572062a4d3f 100644 (file)
@@ -483,8 +483,8 @@ static int io_zcrx_append_area(struct io_zcrx_ifq *ifq,
        old_areas = ifq->areas;
        old_nr = ifq->nr_areas;
 
-       areas = kmalloc_array(old_nr + 1, sizeof(areas[0]),
-                             GFP_KERNEL_ACCOUNT | __GFP_ZERO);
+       areas = kmalloc_objs(areas[0], old_nr + 1,
+                            GFP_KERNEL_ACCOUNT | __GFP_ZERO);
        if (!areas)
                return -ENOMEM;
        if (old_areas)
index b682fd2be443ec52ac3e4ccda4b8ab3e5e2515d6..0abbbe177e317d306c3826d8e5ae9d4203c3ca08 100644 (file)
@@ -266,7 +266,7 @@ static char *diag_fmt_alloc(struct bpf_verifier_env *env, size_t size)
        }
 
        capacity = max_t(size_t, BPF_DIAG_FMT_CHUNK_SIZE, size);
-       chunk = kmalloc(struct_size(chunk, data, capacity), GFP_KERNEL_ACCOUNT);
+       chunk = kmalloc_flex(*chunk, data, capacity, GFP_KERNEL_ACCOUNT);
        if (!chunk)
                return NULL;
 
index d40cb5dd446ca14876b306f6b73246eddb67c76d..c2796e8d29eaed612006956f9d96944683398800 100644 (file)
@@ -511,7 +511,7 @@ static int bpf_ma_set_dtor(struct bpf_map *map, struct bpf_mem_alloc *ma,
        if (IS_ERR_OR_NULL(map->record))
                return 0;
 
-       hrec = kzalloc(sizeof(*hrec), GFP_KERNEL);
+       hrec = kzalloc_obj(*hrec);
        if (!hrec)
                return -ENOMEM;
        hrec->key_size = map->key_size;
index 74fc4b3f80d6ece59e3c9f9ca7ed9a996862304e..301fc60bddc430b6c873ef56129f2fb1ede598d3 100644 (file)
@@ -85,7 +85,7 @@ static struct func_instance *call_instance(struct bpf_verifier_env *env,
        if (f)
                return f;
 
-       f = kvzalloc(sizeof(*f), GFP_KERNEL_ACCOUNT);
+       f = kvzalloc_obj(*f, GFP_KERNEL_ACCOUNT);
        if (!f)
                return ERR_PTR(-ENOMEM);
        f->callsite = lookup_key;
index 589770ca3d3a03e42e64f9d7a4d738a69a4113e5..fb032dfdc0dee4405f6133a66324058b09a16b82 100644 (file)
@@ -862,7 +862,7 @@ struct bpf_verifier_log *bpf_log_attr_create_vlog(struct bpf_log_attr *attr_log,
        if (!size)
                return NULL;
 
-       log = kzalloc_obj(*log, GFP_KERNEL);
+       log = kzalloc_obj(*log);
        if (!log)
                return ERR_PTR(-ENOMEM);
 
index e421ea2b80c3a12afb8ee9c70c10bb569cf428b2..a68e5435ca5f4783592a430e19a831342045e7f3 100644 (file)
@@ -5483,7 +5483,7 @@ static int check_max_stack_depth(struct bpf_verifier_env *env)
        bool priv_stack_supported;
        int ret;
 
-       dinfo = kvcalloc(env->subprog_cnt, sizeof(*dinfo), GFP_KERNEL_ACCOUNT);
+       dinfo = kvzalloc_objs(*dinfo, env->subprog_cnt, GFP_KERNEL_ACCOUNT);
        if (!dinfo)
                return -ENOMEM;
 
@@ -20536,8 +20536,7 @@ static int process_fd_array_continuous(struct bpf_verifier_env *env,
                return -E2BIG;
        }
 
-       env->fd_array = kvcalloc(cnt, sizeof(*env->fd_array),
-                                GFP_KERNEL_ACCOUNT);
+       env->fd_array = kvzalloc_objs(*env->fd_array, cnt, GFP_KERNEL_ACCOUNT);
        if (!env->fd_array)
                return -ENOMEM;
        env->fd_array_cnt = cnt;
index fdc070f419f66fa56e5aa774d0eea37925dfc89b..957707158ff610af63443ef37250183cdd3d1a4c 100644 (file)
@@ -51,8 +51,7 @@ struct dma_single_map_param {
 
 static void *dma_single_map_benchmark_prepare(struct map_benchmark_data *map)
 {
-       struct dma_single_map_param *params __free(kfree) = kzalloc(sizeof(*params),
-                                                                   GFP_KERNEL);
+       struct dma_single_map_param *params __free(kfree) = kzalloc_obj(*params);
        if (!params)
                return NULL;
 
index a6c8e38a311042afab6b65814a84c67b87ba929b..a7adc8e340899df7edebaeb57cfb3025e60175bd 100644 (file)
@@ -13558,9 +13558,8 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
                return ERR_PTR(err);
 
        if (has_addr_filter(event)) {
-               event->addr_filter_ranges = kcalloc(pmu->nr_addr_filters,
-                                                   sizeof(struct perf_addr_filter_range),
-                                                   GFP_KERNEL);
+               event->addr_filter_ranges = kzalloc_objs(struct perf_addr_filter_range,
+                                                        pmu->nr_addr_filters);
                if (!event->addr_filter_ranges)
                        return ERR_PTR(-ENOMEM);
 
index 51ba5e1257c04841ad915e69607b9f5a605cb6a4..a061f54b606dd0ea27b533bb688189c8f21dd4fb 100644 (file)
@@ -1874,8 +1874,8 @@ static int futex_hash_allocate(unsigned int hash_slots, unsigned int flags)
                        free_percpu(ref);
        }
 
-       fph = kvzalloc(struct_size(fph, queues, hash_slots),
-                      GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
+       fph = kvzalloc_flex(*fph, queues, hash_slots,
+                           GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
        if (!fph)
                return -ENOMEM;
 
@@ -2103,7 +2103,7 @@ static int __init futex_init(void)
        size = sizeof(struct futex_hash_bucket) * hashsize;
        order = get_order(size);
 
-       __futex_queues = kcalloc(nr_node_ids, sizeof(*__futex_queues), GFP_KERNEL);
+       __futex_queues = kzalloc_objs(*__futex_queues, nr_node_ids);
        kmemleak_not_leak(__futex_queues);
 
        runtime_const_init(shift, __futex_shift);
index 2fbff2618a1e2d8336aaf23d2aaa0ae40efe5cbe..57eff26fa646a4c818a60ed85fe12950eaee0d77 100644 (file)
@@ -2306,7 +2306,7 @@ int request_nmi(unsigned int irq, irq_handler_t handler,
            !irq_supports_nmi(desc))
                return -EINVAL;
 
-       action = kzalloc(sizeof(struct irqaction), GFP_KERNEL);
+       action = kzalloc_obj(struct irqaction);
        if (!action)
                return -ENOMEM;
 
index e851e4b37d0efcfc97eac5a81d1987ed32922b91..ab6b774bcfd7da4738aca0d94f8306a849f6fd9a 100644 (file)
@@ -726,12 +726,11 @@ static int jump_label_add_module(struct module *mod)
                if (static_key_sealed(key))
                        goto do_poke;
 
-               jlm = kzalloc(sizeof(struct static_key_mod), GFP_KERNEL);
+               jlm = kzalloc_obj(struct static_key_mod);
                if (!jlm)
                        return -ENOMEM;
                if (!static_key_linked(key)) {
-                       jlm2 = kzalloc(sizeof(struct static_key_mod),
-                                      GFP_KERNEL);
+                       jlm2 = kzalloc_obj(struct static_key_mod);
                        if (!jlm2) {
                                kfree(jlm);
                                return -ENOMEM;
index 63beb59b7a3d1801cd2256a789853638dc8c3577..a3f95c90456bd4c475bbf4cd9390f18435fd5980 100644 (file)
@@ -852,7 +852,7 @@ int kthread_affine_preferred(struct task_struct *p, const struct cpumask *mask)
        if (!zalloc_cpumask_var(&affinity, GFP_KERNEL))
                return -ENOMEM;
 
-       kthread->preferred_affinity = kzalloc(sizeof(struct cpumask), GFP_KERNEL);
+       kthread->preferred_affinity = kzalloc_obj(struct cpumask);
        if (!kthread->preferred_affinity) {
                ret = -ENOMEM;
                goto out;
index 39f88deb94bc4d868afcb6fc1068ec9435b8805d..bc4eee5bb4cbf691695d37b004914fad5a79b82d 100644 (file)
@@ -98,16 +98,16 @@ static struct scx_cid_tables *scx_cid_alloc_tables(void)
        u32 npossible = num_possible_cpus();
        struct scx_cid_tables *tbls;
 
-       tbls = kzalloc_obj(*tbls, GFP_KERNEL);
+       tbls = kzalloc_obj(*tbls);
        if (!tbls)
                return NULL;
 
-       tbls->cid_to_cpu = kvcalloc(npossible, sizeof(*tbls->cid_to_cpu), GFP_KERNEL);
-       tbls->cpu_to_cid = kvcalloc(nr_cpu_ids, sizeof(*tbls->cpu_to_cid), GFP_KERNEL);
-       tbls->cid_to_shard = kvcalloc(npossible, sizeof(*tbls->cid_to_shard), GFP_KERNEL);
-       tbls->shard_node = kvcalloc(npossible, sizeof(*tbls->shard_node), GFP_KERNEL);
-       tbls->shard_ranges = kvcalloc(npossible, sizeof(*tbls->shard_ranges), GFP_KERNEL);
-       tbls->topo = kvcalloc(npossible, sizeof(*tbls->topo), GFP_KERNEL);
+       tbls->cid_to_cpu = kvzalloc_objs(*tbls->cid_to_cpu, npossible);
+       tbls->cpu_to_cid = kvzalloc_objs(*tbls->cpu_to_cid, nr_cpu_ids);
+       tbls->cid_to_shard = kvzalloc_objs(*tbls->cid_to_shard, npossible);
+       tbls->shard_node = kvzalloc_objs(*tbls->shard_node, npossible);
+       tbls->shard_ranges = kvzalloc_objs(*tbls->shard_ranges, npossible);
+       tbls->topo = kvzalloc_objs(*tbls->topo, npossible);
 
        if (!tbls->cid_to_cpu || !tbls->cpu_to_cid || !tbls->cid_to_shard ||
            !tbls->shard_node || !tbls->shard_ranges || !tbls->topo) {
@@ -490,7 +490,7 @@ __bpf_kfunc void scx_bpf_cid_override(const s32 *cpu_to_cid__arena, u32 cpu_to_c
         * region that arena fault recovery covers.
         */
        alloced = zalloc_cpumask_var(&seen, GFP_KERNEL);
-       node_counts = kcalloc(nr_node_ids, sizeof(*node_counts), GFP_KERNEL);
+       node_counts = kzalloc_objs(*node_counts, nr_node_ids);
        if (cpu_to_cid_cnt == nr_cpu_ids)
                cpu_to_cid = kmemdup(cpu_to_cid__arena, cpu_to_cid_cnt * sizeof(s32),
                                     GFP_KERNEL);
index 713aa26b28286bc80ac6897c69c4a87cc640417b..51de1d8b72a1ede6d16c07b58defb1284285b8a6 100644 (file)
@@ -5449,7 +5449,7 @@ static ssize_t scx_attr_caps_show(struct kobject *kobj,
        struct scx_sched *sch = container_of(kobj, struct scx_sched, kobj);
        u32 npossible = num_possible_cpus();
        struct scx_cmask *agg __free(kfree) =
-               kzalloc(struct_size(agg, bits, SCX_CMASK_NR_WORDS(npossible)), GFP_KERNEL);
+               kzalloc_flex(*agg, bits, SCX_CMASK_NR_WORDS(npossible));
        unsigned long *agg_bm __free(bitmap) = bitmap_zalloc(npossible, GFP_KERNEL);
        ssize_t count = 0;
        s32 cap, si;
index 0554448835bd08015c9cfe033eeb514895848680..9e7040482bde389f4bf91260db06598445f5b0d4 100644 (file)
@@ -194,7 +194,7 @@ s32 scx_alloc_pshards(struct scx_sched *sch)
        shard_node = rcu_dereference_protected(scx_shard_node,
                                               lockdep_is_held(&scx_enable_mutex));
 
-       pshard = kzalloc_objs(pshard[0], scx_nr_cid_shards, GFP_KERNEL);
+       pshard = kzalloc_objs(pshard[0], scx_nr_cid_shards);
        if (!pshard)
                return -ENOMEM;
 
index ddb0b12a5c4a301da1eb052d610d9639cd7aae2e..1e9b00997ff2741d7a5cc376122a380402bfb32c 100644 (file)
@@ -945,7 +945,7 @@ int register_fprobe(struct fprobe *fp, const char *filter, const char *notfilter
        if (num < 0)
                return num;
 
-       addrs = kcalloc(num, sizeof(*addrs), GFP_KERNEL);
+       addrs = kzalloc_objs(*addrs, num);
        if (!addrs)
                return -ENOMEM;
 
index b0963ac6fd167d5a870d58e1f12a766e3636dc13..9726413a6385aac45f4e8fa352dc7f43d2c7fddf 100644 (file)
@@ -2600,8 +2600,8 @@ rb_allocate_cpu_buffer(struct trace_buffer *buffer, long nr_pages, int cpu)
                cpu_buffer->remote = buffer->remote;
                cpu_buffer->meta_page = (struct trace_buffer_meta *)(void *)desc->meta_va;
                cpu_buffer->nr_pages = nr_pages;
-               cpu_buffer->subbuf_ids = kcalloc(cpu_buffer->nr_pages + 1,
-                                                sizeof(*cpu_buffer->subbuf_ids), GFP_KERNEL);
+               cpu_buffer->subbuf_ids = kzalloc_objs(*cpu_buffer->subbuf_ids,
+                                                     cpu_buffer->nr_pages + 1);
                if (!cpu_buffer->subbuf_ids)
                        goto fail_free_reader;
 
index 78fa1cbda9ac80197915b3543debdc2b4b72e031..998e6390937af69a20b603fb9ad122345f0f7428 100644 (file)
@@ -930,7 +930,7 @@ static int __trace_eprobe_create(int argc, const char *argv[])
        } else
                ep->filter_str = NULL;
 
-       ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
+       ctx = kzalloc_obj(*ctx);
        if (!ctx)
                return -ENOMEM;
        ctx->event = ep->event;
index e6724f947170d9ffb75c189b9ce1a8cd696e0a52..75fa1ffc4c96d5c6ff976cf04c3551ebff5e9ab5 100644 (file)
@@ -251,8 +251,8 @@ static int trace_remote_get(struct trace_remote *remote, int cpu)
        if (cpu != RING_BUFFER_ALL_CPUS && !remote->pcpu_reader_locks) {
                int lock_cpu;
 
-               remote->pcpu_reader_locks = kcalloc(nr_cpu_ids, sizeof(*remote->pcpu_reader_locks),
-                                                   GFP_KERNEL);
+               remote->pcpu_reader_locks = kzalloc_objs(*remote->pcpu_reader_locks,
+                                                        nr_cpu_ids);
                if (!remote->pcpu_reader_locks) {
                        trace_remote_try_unload(remote);
                        return -ENOMEM;
@@ -324,7 +324,7 @@ static int __alloc_ring_buffer_iter(struct trace_remote_iterator *iter, int cpu)
                return iter->rb_iter ? 0 : -ENOMEM;
        }
 
-       iter->rb_iters = kcalloc(nr_cpu_ids, sizeof(*iter->rb_iters), GFP_KERNEL);
+       iter->rb_iters = kzalloc_objs(*iter->rb_iters, nr_cpu_ids);
        if (!iter->rb_iters)
                return -ENOMEM;
 
@@ -1204,7 +1204,7 @@ remote_events_dir_header_page_read(struct file *filp, char __user *ubuf, size_t
        struct trace_seq *s;
        int ret;
 
-       s = kmalloc(sizeof(*s), GFP_KERNEL);
+       s = kmalloc_obj(*s);
        if (!s)
                return -ENOMEM;
 
@@ -1227,7 +1227,7 @@ remote_events_dir_header_event_read(struct file *filp, char __user *ubuf, size_t
        struct trace_seq *s;
        int ret;
 
-       s = kmalloc(sizeof(*s), GFP_KERNEL);
+       s = kmalloc_obj(*s);
        if (!s)
                return -ENOMEM;
 
index b767a38a74f97d3f23cf993218cbf8307c21bc91..2f922b63d545cb6ccfd88d2ccb041b402088cb19 100644 (file)
@@ -696,7 +696,7 @@ static int __init test_rhashtable_next_key(void)
        if (err)
                return err;
 
-       objs = kcalloc(n, sizeof(*objs), GFP_KERNEL);
+       objs = kzalloc_objs(*objs, n);
        if (!objs) {
                rhashtable_destroy(&ht);
                return -ENOMEM;
index 99e160bd5ad174a578edcd2421e069e84c212095..2bdfcbbcabb4ea274936b86e53a2c908f394a7b4 100644 (file)
@@ -149,11 +149,11 @@ static int __init run_bench(int n_threads, const char *scope, const char *label)
        if (ret)
                return ret;
 
-       ctxs = kcalloc(n_threads, sizeof(*ctxs), GFP_KERNEL);
+       ctxs = kzalloc_objs(*ctxs, n_threads);
        if (!ctxs)
                return -ENOMEM;
 
-       tasks = kcalloc(n_threads, sizeof(*tasks), GFP_KERNEL);
+       tasks = kzalloc_objs(*tasks, n_threads);
        if (!tasks) {
                kfree(ctxs);
                return -ENOMEM;
index d9690ba1db887cb0b9adb289dc9933409b85b6a2..32e42d8c7ca13ebc30a03489b3c3073cd517546c 100644 (file)
@@ -57,7 +57,7 @@ static void *__init iov_kunit_create_buffer(struct kunit *test,
        void *buffer;
        unsigned int i;
 
-       pages = kzalloc_objs(struct page *, npages, GFP_KERNEL);
+       pages = kzalloc_objs(struct page *, npages);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pages);
        *ppages = pages;
 
index 6a95441d193aeb7e67c16a659f82a7c38838e8f2..d61b503e319a07c5727da738bffb82f6ef3a8ce9 100644 (file)
@@ -136,7 +136,7 @@ static void damon_do_test_apply_three_regions(struct kunit *test,
        if (!t)
                kunit_skip(test, "target alloc fail");
 
-       ranges = kmalloc_array(nr_regions / 2, sizeof(*ranges), GFP_KERNEL);
+       ranges = kmalloc_objs(*ranges, nr_regions / 2);
        if (!ranges) {
                damon_destroy_target(t, NULL);
                kunit_skip(test, "ranges alloc fail");
index e7ad295504e4fae47038c99826dd1c37abdb3930..c5bc60d16e40ffd76504495ecd2720d930bee413 100644 (file)
@@ -981,7 +981,7 @@ batadv_wifi_net_device_insert(struct net_device *net_dev, u32 wifi_flags)
 
        ASSERT_RTNL();
 
-       device_state = kzalloc_obj(*device_state, GFP_KERNEL);
+       device_state = kzalloc_obj(*device_state);
        if (!device_state)
                return -ENOMEM;
 
index ffd7b37e740184feb9cc327933feb3d4540708a1..3f121099eb22b373ca901f44cc52ed3874c5a152 100644 (file)
@@ -6423,8 +6423,7 @@ static int hci_update_event_filter_sync(struct hci_dev *hdev)
                goto update_scan;
        }
 
-       accept_list = kmalloc_array(num_entries, sizeof(*accept_list),
-                                   GFP_KERNEL);
+       accept_list = kmalloc_objs(*accept_list, num_entries);
        if (!accept_list) {
                hci_dev_unlock(hdev);
                return -ENOMEM;
index 300580c1a2174e58152031d25c961c2885c7273e..a8eda727bff15b49693f12524cd610a798f74942 100644 (file)
@@ -251,7 +251,7 @@ devlink_get_parent_from_attrs_lock(struct net *net, struct nlattr **attrs)
        if (!attrs[DEVLINK_ATTR_PARENT_DEV])
                return ERR_PTR(-EINVAL);
 
-       tb = kcalloc(maxtype + 1, sizeof(*tb), GFP_KERNEL);
+       tb = kzalloc_objs(*tb, maxtype + 1);
        if (!tb)
                return ERR_PTR(-ENOMEM);
 
index 8ca0f3ed646c4348ae7fad0452d2d5613661c340..95ac9db8c993d321336dee767f0d7a7d20d53daf 100644 (file)
@@ -330,13 +330,12 @@ static int devlink_nl_param_fill(struct sk_buff *msg, struct devlink *devlink,
        int err;
        int i;
 
-       default_value = kcalloc(DEVLINK_PARAM_CMODE_MAX + 1,
-                               sizeof(*default_value), GFP_KERNEL);
+       default_value = kzalloc_objs(*default_value,
+                                    DEVLINK_PARAM_CMODE_MAX + 1);
        if (!default_value)
                return -ENOMEM;
 
-       param_value = kcalloc(DEVLINK_PARAM_CMODE_MAX + 1,
-                             sizeof(*param_value), GFP_KERNEL);
+       param_value = kzalloc_objs(*param_value, DEVLINK_PARAM_CMODE_MAX + 1);
        if (!param_value) {
                kfree(default_value);
                return -ENOMEM;
index 9f053eb8b46e254cf53ec3783dedf5f3e6acd4ac..04dbb2babbcdc11f84d0d394daa439b1797750c1 100644 (file)
@@ -2931,8 +2931,8 @@ static int bpf_iter_tcp_realloc_batch(struct bpf_tcp_iter_state *iter,
 {
        union bpf_tcp_iter_batch_item *new_batch;
 
-       new_batch = kvmalloc_array(new_batch_sz, sizeof(*new_batch),
-                                  flags | __GFP_NOWARN);
+       new_batch = kvmalloc_objs(*new_batch, new_batch_sz,
+                                 flags | __GFP_NOWARN);
        if (!new_batch)
                return -ENOMEM;
 
index 19e08661be43ab06d8ba157d768c4e02fd879331..c7769da9617b55a669785c21dedf005312af9881 100644 (file)
@@ -659,8 +659,7 @@ int ieee80211_nan_set_peer_sched(struct ieee80211_sub_if_data *sdata,
        if (!sta)
                return -ENOENT;
 
-       new_sched = kzalloc(struct_size(new_sched, channels, sched->n_channels),
-                           GFP_KERNEL);
+       new_sched = kzalloc_flex(*new_sched, channels, sched->n_channels);
        if (!new_sched)
                return -ENOMEM;
 
index c92e3abb40d77527bb0e86b2b17a79baf8c4a844..f05f75bf93e009fd5191d5bc02891daf8a80cf65 100644 (file)
@@ -193,7 +193,7 @@ static void __mctp_route_test_init(struct kunit *test,
        if (netid != MCTP_NET_ANY)
                WRITE_ONCE(dev->mdev->net, netid);
 
-       dev->mdev->addrs = kmalloc_objs(u8, 1, GFP_KERNEL);
+       dev->mdev->addrs = kmalloc_objs(u8, 1);
        dev->mdev->num_addrs = 1;
        dev->mdev->addrs[0] = 8;
 
index 6eef8d485c25e2bd97ab28514de1a2c6852267a6..6b131084a2492dd324e5747d41234f7a2402a9ec 100644 (file)
@@ -88,7 +88,7 @@ struct mctp_test_dev *mctp_test_create_dev_with_addr(mctp_eid_t addr)
        if (!dev)
                return NULL;
 
-       dev->mdev->addrs = kmalloc_objs(u8, 1, GFP_KERNEL);
+       dev->mdev->addrs = kmalloc_objs(u8, 1);
        if (!dev->mdev->addrs) {
                mctp_test_destroy_dev(dev);
                return NULL;
index 765a92fa90d62bc793e10e73d2e1bdce59a9b358..31fbd5a28937f18ab6c53d89eec699ec3bdf683a 100644 (file)
@@ -3215,7 +3215,7 @@ static int nft_trans_delhook(struct nft_hook *hook,
 {
        struct nft_trans_hook *trans_hook;
 
-       trans_hook = kmalloc_obj(*trans_hook, GFP_KERNEL);
+       trans_hook = kmalloc_obj(*trans_hook);
        if (!trans_hook)
                return -ENOMEM;
 
index 66c2016f6049d7f63b58ae43cc6ac91e6ffd3e11..f43bf768b31cbacdbc7232cb98723abec00aebb5 100644 (file)
@@ -150,7 +150,7 @@ static int cttimeout_new_timeout(struct sk_buff *skb,
                goto err_proto_put;
        }
 
-       timeout = kzalloc(sizeof(*timeout), GFP_KERNEL);
+       timeout = kzalloc_obj(*timeout);
        if (timeout == NULL) {
                ret = -ENOMEM;
                goto err_proto_put;
index 31e7ad1084594944e7cf55a9e15c17a5a2c80d17..a57f81a05c87852f42edfc0c3ee79a944724697c 100644 (file)
@@ -205,7 +205,7 @@ int rds_info_getsockopt(struct socket *sock, int optname, sockopt_t *opt)
         * iterator code to allocate and hand it back.
         */
        npages = iov_iter_npages(&opt->iter_out, INT_MAX);
-       pages = kvmalloc_array(npages, sizeof(*pages), GFP_KERNEL);
+       pages = kvmalloc_objs(*pages, npages);
        if (!pages) {
                ret = -ENOMEM;
                goto out;
index a0aa78d892897f5c552df3a34c582d5a49172909..cbd26da44951078bd2427b70fd03d2bede92627f 100644 (file)
@@ -210,7 +210,7 @@ static int rxrpc_preparse_xdr_yfs_rxgk(struct key_preparsed_payload *prep,
        if (!token)
                goto nomem;
 
-       token->rxgk = kzalloc(struct_size_t(struct rxgk_key, _key, raw_keylen), GFP_KERNEL);
+       token->rxgk = kzalloc_flex(struct rxgk_key, _key, raw_keylen);
        if (!token->rxgk)
                goto nomem_token;
 
index fdbfcaa3e2ab946204ba4ee350630c0c4ea88352..5d228a4022040a2257cde85b18923b81b2224b27 100644 (file)
@@ -240,7 +240,7 @@ static int tcf_gate_copy_entries(struct tcf_gate_params *dst,
        list_for_each_entry(entry, &src->entries, list) {
                struct tcfg_gate_entry *new;
 
-               new = kzalloc(sizeof(*new), GFP_ATOMIC);
+               new = kzalloc_obj(*new, GFP_ATOMIC);
                if (!new) {
                        NL_SET_ERR_MSG(extack, "Not enough memory for entry");
                        return -ENOMEM;
@@ -415,7 +415,7 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla,
        if (err < 0)
                goto release_idr;
 
-       p = kzalloc(sizeof(*p), GFP_KERNEL);
+       p = kzalloc_obj(*p);
        if (!p) {
                err = -ENOMEM;
                goto chain_put;
index ff401ace4f3daeee6748cb19983fcc329d1b99b5..5038348533060ae943cdf6adc40eeee937a20b2b 100644 (file)
@@ -526,7 +526,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
        }
        t = to_tunnel_key(*a);
 
-       params_new = kzalloc(sizeof(*params_new), GFP_KERNEL);
+       params_new = kzalloc_obj(*params_new);
        if (unlikely(!params_new)) {
                NL_SET_ERR_MSG(extack, "Cannot allocate tunnel key parameters");
                ret = -ENOMEM;
index cf461ebcdde5dcb1b99effc448abaa878877adcc..09a7c97e87da7f7a47e49f894ce25ee39dabce33 100644 (file)
@@ -282,9 +282,8 @@ int gss_krb5_mic_build_sg(const struct xdr_buf *body,
                unsigned int overflow_nents =
                        nsg - XDR_BUF_TO_SG_NENTS + 1;
 
-               *sg_overflow = kmalloc_array(overflow_nents,
-                                            sizeof(**sg_overflow),
-                                            GFP_NOFS);
+               *sg_overflow = kmalloc_objs(**sg_overflow, overflow_nents,
+                                           GFP_NOFS);
                if (!*sg_overflow)
                        return -ENOMEM;
 
index aebd97e7f66c7eee4caefefe7be43411e1819e1e..31a1bc60a5f6d359a8226c393ee37bbbbe46e859 100644 (file)
@@ -625,7 +625,7 @@ int sunrpc_nl_unix_gid_get_reqs_dumpit(struct sk_buff *skb,
        if (!cnt)
                return 0;
 
-       items = kcalloc(cnt, sizeof(*items), GFP_KERNEL);
+       items = kzalloc_objs(*items, cnt);
        seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);
        if (!items || !seqnos) {
                ret = -ENOMEM;
@@ -1326,7 +1326,7 @@ int sunrpc_nl_ip_map_get_reqs_dumpit(struct sk_buff *skb,
        if (!cnt)
                return 0;
 
-       items = kcalloc(cnt, sizeof(*items), GFP_KERNEL);
+       items = kzalloc_objs(*items, cnt);
        seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);
        if (!items || !seqnos) {
                ret = -ENOMEM;
index cb2ef428651f6ecf258adc3b1f30ced64f79f39f..c42fd338c6076cc191fc0cf7085f46a6c64d0ce2 100644 (file)
@@ -371,8 +371,7 @@ int xdr_buf_to_sg_alloc(const struct xdr_buf *buf, unsigned int offset,
                unsigned int overflow_nents = nsg - sg_head_nents + 1;
                struct scatterlist *overflow;
 
-               overflow = kmalloc_array(overflow_nents, sizeof(*overflow),
-                                        gfp);
+               overflow = kmalloc_objs(*overflow, overflow_nents, gfp);
                if (!overflow)
                        return -ENOMEM;
 
index 13f9926bf2057753256fcf44ddb359c1bdafb2ff..79c3921c583cc3f923ba1550e27940d1ca0bbb87 100644 (file)
@@ -3667,8 +3667,8 @@ static int bpf_iter_unix_realloc_batch(struct bpf_unix_iter_state *iter,
 {
        struct sock **new_batch;
 
-       new_batch = kvmalloc_array(new_batch_sz, sizeof(*new_batch),
-                                  GFP_USER | __GFP_NOWARN);
+       new_batch = kvmalloc_objs(*new_batch, new_batch_sz,
+                                 GFP_USER | __GFP_NOWARN);
        if (!new_batch)
                return -ENOMEM;
 
index d13310fef691aed449a58e6f14396bc867708ab5..3032993ba5dc4f62d45e57173a1e1354b754cf0d 100644 (file)
@@ -311,9 +311,8 @@ int cfg80211_nan_set_local_schedule(struct cfg80211_registered_device *rdev,
        if (!sched->n_channels)
                return 0;
 
-       wdev->u.nan.chandefs = kcalloc(sched->n_channels,
-                                      sizeof(*wdev->u.nan.chandefs),
-                                      GFP_KERNEL);
+       wdev->u.nan.chandefs = kzalloc_objs(*wdev->u.nan.chandefs,
+                                           sched->n_channels);
        if (!wdev->u.nan.chandefs)
                return -ENOMEM;
 
index 44f2bad08670597674a6b5b59b400cf1d76acc55..899b6374c550654c4ccce0f5583e19fcb99addf7 100644 (file)
@@ -17330,8 +17330,7 @@ static int nl80211_parse_nan_channel(struct cfg80211_registered_device *rdev,
        u8 n_rx_nss;
        int ret;
 
-       channel_parsed = kcalloc(NL80211_ATTR_MAX + 1, sizeof(*channel_parsed),
-                                GFP_KERNEL);
+       channel_parsed = kzalloc_objs(*channel_parsed, NL80211_ATTR_MAX + 1);
        if (!channel_parsed)
                return -ENOMEM;
 
@@ -17554,8 +17553,7 @@ static int nl80211_nan_set_peer_sched(struct sk_buff *skb,
        }
 
        if (n_channels) {
-               nan_channels = kcalloc(n_channels, sizeof(*nan_channels),
-                                      GFP_KERNEL);
+               nan_channels = kzalloc_objs(*nan_channels, n_channels);
                if (!nan_channels)
                        return -ENOMEM;
        }
@@ -17693,8 +17691,7 @@ static int nl80211_nan_set_local_sched(struct sk_buff *skb,
                                 info->nlhdr, GENL_HDRLEN, rem)
                n_channels++;
 
-       sched = kzalloc(struct_size(sched, nan_channels, n_channels),
-                       GFP_KERNEL);
+       sched = kzalloc_flex(*sched, nan_channels, n_channels);
        if (!sched)
                return -ENOMEM;
 
index f89f0ca3d4edf16a7147b3c23d25fc2cf18044c6..0f1b7e4113c4f0973e1783168ce0aefed70be247 100644 (file)
@@ -75,8 +75,7 @@ static struct hlist_head *ima_alloc_replace_htable(void)
        struct hlist_head *old_htable, *new_htable;
 
        /* Initializing to zeros is equivalent to call HLIST_HEAD_INIT. */
-       new_htable = kcalloc(IMA_MEASURE_HTABLE_SIZE, sizeof(struct hlist_head),
-                            GFP_KERNEL);
+       new_htable = kzalloc_objs(struct hlist_head, IMA_MEASURE_HTABLE_SIZE);
        if (!new_htable)
                return ERR_PTR(-ENOMEM);
 
index 23d62fede06e893b21308473b5d93f3b1da57d32..7c397b1c9231fb6cd3d8b2822d6a586557e0c9ea 100644 (file)
@@ -107,7 +107,7 @@ static int snd_compr_open(struct inode *inode, struct file *f)
                return -EINVAL;
        }
 
-       data = kzalloc(sizeof(*data), GFP_KERNEL);
+       data = kzalloc_obj(*data);
        if (!data) {
                snd_card_unref(compr->card);
                return -ENOMEM;
@@ -119,7 +119,7 @@ static int snd_compr_open(struct inode *inode, struct file *f)
        data->stream.direction = dirn;
        data->stream.private_data = compr->private_data;
        data->stream.device = compr;
-       runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
+       runtime = kzalloc_obj(*runtime);
        if (!runtime) {
                kfree(data);
                snd_card_unref(compr->card);
index 78ce7bc936d29b22da4379a6be8dee47c3b29645..4199342d4ffe095a9b405c11ecce8c013fb2fa92 100644 (file)
@@ -69,7 +69,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
                err = -ENODEV;
                goto __error2;
        }
-       ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
+       ctl = kzalloc_obj(*ctl);
        if (ctl == NULL) {
                err = -ENOMEM;
                goto __error;
@@ -174,7 +174,7 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask,
                                        goto _found;
                                }
                        }
-                       ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
+                       ev = kzalloc_obj(*ev, GFP_ATOMIC);
                        if (ev) {
                                ev->id = *id;
                                ev->mask = mask;
@@ -871,7 +871,7 @@ static int snd_ctl_card_info(struct snd_card *card, struct snd_ctl_file * ctl,
                             unsigned int cmd, void __user *arg)
 {
        struct snd_ctl_card_info *info __free(kfree) =
-               kzalloc(sizeof(*info), GFP_KERNEL);
+               kzalloc_obj(*info);
        ssize_t n;
 
        if (! info)
index 3d13bbec1c5448d86c5395b5c82bcfa88d57b08e..ec0e6c7ad6577008d45e2e96472f484af54c5160 100644 (file)
@@ -158,7 +158,7 @@ static void snd_ctl_led_set_state(struct snd_card *card, unsigned int access,
                        UPDATE_ROUTE(route, snd_ctl_led_get(lctl));
                }
                if (!found && kctl && card) {
-                       lctl = kzalloc(sizeof(*lctl), GFP_KERNEL);
+                       lctl = kzalloc_obj(*lctl);
                        if (lctl) {
                                lctl->card = card;
                                lctl->access = access;
index 2f7f83a7611b2739523de15d716d72216a7dacf0..9693e646b3bb346a7a0ee0d93e5b871668a5b703 100644 (file)
@@ -364,7 +364,7 @@ static int snd_card_init(struct snd_card *card, struct device *parent,
                                                sound_debugfs_root);
 #endif
 #ifdef CONFIG_SND_CTL_DEBUG
-       card->value_buf = kmalloc(sizeof(*card->value_buf), GFP_KERNEL);
+       card->value_buf = kmalloc_obj(*card->value_buf);
        if (!card->value_buf)
                return -ENOMEM;
 #endif
index 4772b2a3b808d7882120b16faf3f24a968df8cc1..066fb9ecdcdc316106ec556a1b727e66f632e6ac 100644 (file)
@@ -125,7 +125,7 @@ int snd_fasync_helper(int fd, struct file *file, int on,
        struct snd_fasync *fasync = NULL;
 
        if (on) {
-               fasync = kzalloc(sizeof(*fasync), GFP_KERNEL);
+               fasync = kzalloc_obj(*fasync);
                if (!fasync)
                        return -ENOMEM;
                INIT_LIST_HEAD(&fasync->list);
index ff9d7fd60a7ea722c07e5be8d9acd21a8889ac3a..c533d767c29ac0d2099936f0d4af71a12f082769 100644 (file)
@@ -890,7 +890,7 @@ static int snd_mixer_oss_build_test(struct snd_mixer_oss *mixer, struct slot *sl
        int err;
 
        struct snd_ctl_elem_info *info __free(kfree) =
-               kmalloc(sizeof(*info), GFP_KERNEL);
+               kmalloc_obj(*info);
        if (!info)
                return -ENOMEM;
        scoped_guard(rwsem_read, &card->controls_rwsem) {
index 62324282fcae9cdc5bd648a9047492e2116ad9b8..6d32c12fb79bdf2294cdd8998510c77b2f54a41f 100644 (file)
@@ -2330,7 +2330,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
                return -EINVAL;
 
        struct snd_pcm_group *group __free(kfree) =
-               kzalloc(sizeof(*group), GFP_KERNEL);
+               kzalloc_obj(*group);
        if (!group)
                return -ENOMEM;
        snd_pcm_group_init(group);
index c4b82e29ab0566712018aca19fef9677f2e1a4cf..21a0a98c8e92366b7830e05387da2344e7aa0c71 100644 (file)
@@ -86,7 +86,7 @@ snd_seq_oss_synth_probe(struct snd_seq_device *dev)
        struct seq_oss_synth *rec;
        struct snd_seq_oss_reg *reg = SNDRV_SEQ_DEVICE_ARGPTR(dev);
 
-       rec = kzalloc(sizeof(*rec), GFP_KERNEL);
+       rec = kzalloc_obj(*rec);
        if (!rec)
                return -ENOMEM;
        rec->seq_device = -1;
index 5b86e75c2658a8a16a2995e624424d15fc3f8025..239809ce48d725f5fe0e3e37532032dc519e6701 100644 (file)
@@ -210,7 +210,7 @@ static struct snd_seq_client *seq_create_client1(int client_index, int poolsize)
        struct snd_seq_client *client;
 
        /* init client data */
-       client = kzalloc(sizeof(*client), GFP_KERNEL);
+       client = kzalloc_obj(*client);
        if (client == NULL)
                return NULL;
        client->pool = snd_seq_pool_new(poolsize);
index 6208bf7f57bf1886b9de825a07c2d691d418fd23..a01785a6de9b6c4c250d02a18621b12034799dca 100644 (file)
@@ -188,7 +188,7 @@ static int snd_virmidi_input_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);
        if (vmidi == NULL)
                return -ENOMEM;
        vmidi->substream = substream;
index f666f05e9d45ad89382513c3bcd00e21c8758204..679b2643567090a29913662cdde89fa066fcc4aa 100644 (file)
@@ -1855,7 +1855,7 @@ static int snd_timer_user_info(struct file *file,
                return -EBADFD;
 
        struct snd_timer_info *info __free(kfree) =
-               kzalloc(sizeof(*info), GFP_KERNEL);
+               kzalloc_obj(*info);
        if (! info)
                return -ENOMEM;
        info->card = t->card ? t->card->number : -1;
index 4e3ea23ca9135bbb83342fc07810cbf01991137d..81cb1f59f703bb982a55f786b0a17c5cae6b3e77 100644 (file)
@@ -1365,7 +1365,7 @@ static int loopback_open(struct snd_pcm_substream *substream)
        int dev = get_cable_index(substream);
 
        guard(mutex)(&loopback->cable_lock);
-       dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
+       dpcm = kzalloc_obj(*dpcm);
        if (!dpcm)
                return -ENOMEM;
        dpcm->loopback = loopback;
@@ -1373,7 +1373,7 @@ static int loopback_open(struct snd_pcm_substream *substream)
 
        cable = loopback->cables[substream->number][dev];
        if (!cable) {
-               cable = kzalloc(sizeof(*cable), GFP_KERNEL);
+               cable = kzalloc_obj(*cable);
                if (!cable) {
                        err = -ENOMEM;
                        goto unlock;
index 30bd76eee96e68b296de981e638b4c84e88058fc..7be6ff201ecbc8efc18168e224858f1b2b6931d0 100644 (file)
@@ -214,7 +214,7 @@ int snd_gf1_dma_transfer_block(struct snd_gus_card * gus,
        struct snd_gf1_dma_block *block;
        struct snd_gf1_dma_block *free_block = NULL;
 
-       block = kmalloc(sizeof(*block), atomic ? GFP_ATOMIC : GFP_KERNEL);
+       block = kmalloc_obj(*block, atomic ? GFP_ATOMIC : GFP_KERNEL);
        if (!block)
                return -ENOMEM;
 
index 19a6927c079dd4826a0c3d650260a5db86e03cb2..f6db08b75649c7a6397a8a8b2e6d9c42acf2e11d 100644 (file)
@@ -1444,7 +1444,7 @@ static int _cs46xx_playback_open_channel (struct snd_pcm_substream *substream,in
        struct snd_cs46xx_pcm * cpcm;
        struct snd_pcm_runtime *runtime = substream->runtime;
 
-       cpcm = kzalloc(sizeof(*cpcm), GFP_KERNEL);
+       cpcm = kzalloc_obj(*cpcm);
        if (cpcm == NULL)
                return -ENOMEM;
        if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
index 5fc1c922620a95a36c0d340eced66de8b9642639..f356917cb6ac74f4773552cc94438a87c9e125fd 100644 (file)
@@ -236,7 +236,7 @@ static int get_amixer_rsc(struct amixer_mgr *mgr,
        *ramixer = NULL;
 
        /* Allocate mem for amixer resource */
-       amixer = kzalloc(sizeof(*amixer), GFP_KERNEL);
+       amixer = kzalloc_obj(*amixer);
        if (!amixer)
                return -ENOMEM;
 
@@ -390,7 +390,7 @@ static int get_sum_rsc(struct sum_mgr *mgr,
        *rsum = NULL;
 
        /* Allocate mem for sum resource */
-       sum = kzalloc(sizeof(*sum), GFP_KERNEL);
+       sum = kzalloc_obj(*sum);
        if (!sum)
                return -ENOMEM;
 
index 69aacd06716cef7b41b993ccb0fcda9eab583954..9be70c6862ab5839c348dcfd0bce0cc90f574340 100644 (file)
@@ -540,7 +540,7 @@ static int get_daio_rsc(struct daio_mgr *mgr,
        err = -ENOMEM;
        /* Allocate mem for daio resource */
        if (desc->output) {
-               struct dao *dao = kzalloc(sizeof(*dao), GFP_KERNEL);
+               struct dao *dao = kzalloc_obj(*dao);
                if (!dao)
                        goto error;
 
@@ -552,7 +552,7 @@ static int get_daio_rsc(struct daio_mgr *mgr,
 
                *rdaio = &dao->daio;
        } else {
-               struct dai *dai = kzalloc(sizeof(*dai), GFP_KERNEL);
+               struct dai *dai = kzalloc_obj(*dai);
                if (!dai)
                        goto error;
 
index 46dc1f509234f0ece410ee7e3e6a54605768dd86..1fadaf22309fc5b81d2e517450cbcba35f3f622e 100644 (file)
@@ -432,9 +432,9 @@ get_src_rsc(struct src_mgr *mgr, const struct src_desc *desc, struct src **rsrc)
 
        /* Allocate mem for master src resource */
        if (MEMRD == desc->mode)
-               src = kcalloc(desc->multi, sizeof(*src), GFP_KERNEL);
+               src = kzalloc_objs(*src, desc->multi);
        else
-               src = kzalloc(sizeof(*src), GFP_KERNEL);
+               src = kzalloc_obj(*src);
 
        if (!src) {
                err = -ENOMEM;
index cc379d880cad3c151df614622bb247dfcc995f23..9d6f5df2bc7efc1feaea396aaf81f90cdbcff75b 100644 (file)
@@ -318,7 +318,7 @@ ct_timer_instance_new(struct ct_timer *atimer, struct ct_atc_pcm *apcm)
 {
        struct ct_timer_instance *ti;
 
-       ti = kzalloc(sizeof(*ti), GFP_KERNEL);
+       ti = kzalloc_obj(*ti);
        if (!ti)
                return NULL;
        spin_lock_init(&ti->lock);
index 49cabb2eb2b799fef024c9375ca5244f426bab53..a33817aba17f1e47568f1fa1f389de2c62c15b0b 100644 (file)
@@ -2470,7 +2470,7 @@ static int snd_emu10k1_fx8010_ioctl(struct snd_hwdep * hw, struct file *file, un
                emu->support_tlv = 1;
                return put_user(SNDRV_EMU10K1_VERSION, (int __user *)argp);
        case SNDRV_EMU10K1_IOCTL_INFO:
-               info = kzalloc(sizeof(*info), GFP_KERNEL);
+               info = kzalloc_obj(*info, GFP_KERNEL);
                if (!info)
                        return -ENOMEM;
                snd_emu10k1_fx8010_info(emu, info);
index ca53b08c0b331ce8967398f321b3d07048677145..07c040355c377bb91d5b9aa7c322dec46e4c677b 100644 (file)
@@ -371,7 +371,7 @@ static unsigned int *simple_amp_alloc_tlv_ranges(const struct simple_amp_ranges
        unsigned int *t;
        unsigned int i;
 
-       tlv = kzalloc_objs(*tlv, 2 + ranges->nb_ranges * 6, GFP_KERNEL);
+       tlv = kzalloc_objs(*tlv, 2 + ranges->nb_ranges * 6);
        if (!tlv)
                return NULL;
 
index 42019daa5e04fb9be156e2edc7f6d272e9e7626e..5f3423129b1328ff55f4a65bfc36474696498bf2 100644 (file)
@@ -168,7 +168,7 @@ int simple_util_parse_tdm_width_map(struct simple_util_priv *priv, struct device
        if (!dai->tdm_width_map)
                return simple_ret(priv, ret); /* see NOTE */
 
-       u32 *array_values __free(kfree) = kcalloc(n, sizeof(*array_values), GFP_KERNEL);
+       u32 *array_values __free(kfree) = kzalloc_objs(*array_values, n);
        if (!array_values)
                goto end;
 
index 311e63affb239ee575d59b7c6ea5c1c5f3ab2300..2d3218cce4264271388c0f9d296d6c493dee416b 100644 (file)
@@ -253,7 +253,7 @@ struct gx_stream *gx_stream_alloc(struct gx_iface *iface)
 {
        struct gx_stream *ts;
 
-       ts = kzalloc(sizeof(*ts), GFP_KERNEL);
+       ts = kzalloc_obj(*ts);
        if (ts) {
                INIT_LIST_HEAD(&ts->formatter_list);
                mutex_init(&ts->lock);
index 1d68a80e8e0c01ced565f3d4377a6c640c0352f4..f0ff1350e9ddea7ac4abb4090d1f25add5183e10 100644 (file)
@@ -1857,7 +1857,7 @@ struct q6afe_port *q6afe_port_get_from_id(struct device *dev, int id)
                return ERR_PTR(-EINVAL);
        }
 
-       port = kzalloc(sizeof(*port), GFP_KERNEL);
+       port = kzalloc_obj(*port, GFP_KERNEL);
        if (!port)
                return ERR_PTR(-ENOMEM);
 
index e01d91eb3cc8129584ff56ca63cd0b797cbddc8c..32d9b7f30a4f867f8839cfbbf64ff95b44120eac 100644 (file)
@@ -1249,8 +1249,7 @@ static int find_sdca_entity_pde(struct device *dev,
                return -EINVAL;
        }
 
-       u32 *delay_list __free(kfree) = kcalloc(num_delays, sizeof(*delay_list),
-                                               GFP_KERNEL);
+       u32 *delay_list __free(kfree) = kzalloc_objs(*delay_list, num_delays);
        if (!delay_list)
                return -ENOMEM;
 
@@ -1313,8 +1312,8 @@ static int find_sdca_entity_ge(struct device *dev,
                return -EINVAL;
        }
 
-       u8 *affected_list __free(kfree) = kcalloc(num_affected, sizeof(*affected_list),
-                                                 GFP_KERNEL);
+       u8 *affected_list __free(kfree) = kzalloc_objs(*affected_list,
+                                                      num_affected);
        if (!affected_list)
                return -ENOMEM;
 
@@ -1552,8 +1551,8 @@ static int find_sdca_entities(struct device *dev, struct fwnode_handle *function
        if (!entities)
                return -ENOMEM;
 
-       u32 *entity_list __free(kfree) = kcalloc(num_entities, sizeof(*entity_list),
-                                                GFP_KERNEL);
+       u32 *entity_list __free(kfree) = kzalloc_objs(*entity_list,
+                                                     num_entities);
        if (!entity_list)
                return -ENOMEM;
 
@@ -1715,8 +1714,8 @@ static int find_sdca_entity_connection_pde(struct device *dev,
        if (!managed)
                return -ENOMEM;
 
-       u32 *managed_list __free(kfree) = kcalloc(num_managed, sizeof(*managed_list),
-                                                 GFP_KERNEL);
+       u32 *managed_list __free(kfree) = kzalloc_objs(*managed_list,
+                                                      num_managed);
        if (!managed_list)
                return -ENOMEM;
 
@@ -2033,8 +2032,8 @@ static int find_sdca_clusters(struct device *dev,
        if (!clusters)
                return -ENOMEM;
 
-       u32 *cluster_list __free(kfree) = kcalloc(num_clusters, sizeof(*cluster_list),
-                                                 GFP_KERNEL);
+       u32 *cluster_list __free(kfree) = kzalloc_objs(*cluster_list,
+                                                      num_clusters);
        if (!cluster_list)
                return -ENOMEM;
 
index 2eef32b55395403ddcf905a5bfcc38672da9a290..c547ea61fb3d1204ee296bff4858ddd76d11785d 100644 (file)
@@ -260,7 +260,7 @@ static int ipc4_probes_points_info(struct sof_client_dev *cdev,
        *num_desc = info->num_elems;
        dev_dbg(dev, "%s: got %zu probe points", __func__, *num_desc);
 
-       *desc = kcalloc(*num_desc, sizeof(**desc), GFP_KERNEL);
+       *desc = kzalloc_objs(**desc, *num_desc);
        if (!*desc) {
                kfree(msg.data_ptr);
                return -ENOMEM;
index c7bbf09e547f6748e17e710314cc86d34cf16868..64da8df15bf2e0085a74d236a02650065f9a4cb7 100644 (file)
@@ -230,7 +230,7 @@ int sof_client_dev_register(struct snd_sof_dev *sdev, const char *name, u32 id,
        struct sof_client_dev *cdev;
        int ret;
 
-       centry = kzalloc(sizeof(*centry), GFP_KERNEL);
+       centry = kzalloc_obj(*centry);
        if (!centry)
                return -ENOMEM;
 
index da04ed5cbac496021f6ae843763c08dab53a039e..d746b2586d88b7935265a1b6e36bbcc58856c812 100644 (file)
@@ -903,7 +903,7 @@ static int snd_amd7930_create(struct snd_card *card,
        int err;
 
        *ramd = NULL;
-       amd = kzalloc(sizeof(*amd), GFP_KERNEL);
+       amd = kzalloc_obj(*amd);
        if (amd == NULL)
                return -ENOMEM;