From 0af298e62e5cff4ebf9bec47b8711177a7e2f115 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Wed, 28 Oct 2026 23:08:12 -0700 Subject: [PATCH 1/3] treewide: refresh kmalloc_obj() conversions Refresh the tree with run of the existing Coccinelle rules in scripts/coccinelle/api/kmalloc_objs.cocci, now that they also convert arrays of multi-byte integers. The conversions break down as: 435 kzalloc_objs() 169 kmalloc_objs() 52 kvzalloc_objs() 47 kzalloc_obj() 42 kvmalloc_objs() 8 kmalloc_obj() 2 kzalloc_flex() 2 kvmalloc_flex() and 37 existing kmalloc_obj() family calls drop a redundant GFP_KERNEL. Build tested with allmodconfig on x86_64 with GCC 16.2.0, and, together with the devm_kmalloc_obj() conversion that follows, on x86_64, arm64, i386, arm, riscv, s390, m68k, mips, parisc, sparc, loongarch, arc, xtensa, and openrisc with GCC 16.2.0 with no new warnings. Signed-off-by: Kees Cook --- arch/arc/net/bpf_jit_core.c | 3 +- arch/arm/kernel/topology.c | 3 +- arch/arm/mach-pxa/pm.c | 4 +- arch/arm/net/bpf_jit_32.c | 2 +- arch/arm64/kernel/suspend.c | 3 +- arch/arm64/kvm/sys_regs.c | 2 +- arch/arm64/kvm/vgic/vgic-irs-v5.c | 4 +- arch/arm64/kvm/vgic/vgic-v5-tables.c | 7 +- arch/loongarch/net/bpf_jit.c | 2 +- arch/mips/kernel/pm-cps.c | 2 +- arch/mips/net/bpf_jit_comp.c | 3 +- arch/powerpc/kernel/smp.c | 2 +- arch/powerpc/kvm/e500_mmu.c | 9 +-- arch/powerpc/kvm/e500_mmu_host.c | 5 +- arch/powerpc/net/bpf_jit_comp.c | 4 +- arch/powerpc/platforms/powernv/idle.c | 4 +- arch/powerpc/platforms/powernv/opal-imc.c | 4 +- .../powerpc/platforms/powernv/opal-sysparam.c | 4 +- arch/s390/kernel/uv.c | 2 +- arch/s390/net/bpf_jit_comp.c | 2 +- arch/s390/pci/pci.c | 4 +- arch/sparc/kernel/nmi.c | 3 +- arch/sparc/net/bpf_jit_comp_32.c | 2 +- arch/sparc/net/bpf_jit_comp_64.c | 2 +- arch/x86/events/intel/uncore_discovery.c | 3 +- arch/x86/kernel/amd_nb.c | 2 +- arch/x86/kernel/apic/x2apic_cluster.c | 2 +- arch/x86/kernel/cpu/mtrr/if.c | 2 +- arch/x86/kernel/cpu/resctrl/core.c | 3 +- arch/x86/kvm/debugfs.c | 2 +- arch/x86/kvm/vmx/tdx.c | 5 +- crypto/asymmetric_keys/verify_pefile.c | 2 +- drivers/accel/amdxdna/aie2_ctx.c | 2 +- drivers/accel/amdxdna/amdxdna_ctx.c | 2 +- .../habanalabs/common/command_submission.c | 25 ++++--- drivers/accel/habanalabs/common/hwmon.c | 2 +- drivers/accel/habanalabs/common/memory.c | 5 +- drivers/accel/habanalabs/gaudi/gaudi.c | 8 +-- .../accel/habanalabs/gaudi2/gaudi2_security.c | 2 +- drivers/accel/ivpu/ivpu_job.c | 2 +- drivers/acpi/apei/erst.c | 3 +- drivers/acpi/cppc_acpi.c | 9 +-- drivers/base/arch_topology.c | 8 +-- drivers/base/regmap/regcache-maple.c | 4 +- drivers/base/regmap/regcache-rbtree.c | 6 +- drivers/base/regmap/regmap-irq.c | 35 ++++------ drivers/bcma/sprom.c | 2 +- drivers/block/drbd/drbd_main.c | 3 +- drivers/block/drbd/drbd_receiver.c | 2 +- drivers/block/rbd.c | 4 +- drivers/block/xen-blkfront.c | 3 +- drivers/bluetooth/btintel_pcie.c | 2 +- drivers/bus/mhi/ep/clients/loopback.c | 2 +- drivers/char/ipmi/ipmi_ssif.c | 3 +- drivers/clk/at91/dt-compat.c | 2 +- drivers/clk/at91/sam9x7.c | 3 +- drivers/clk/at91/sama7d65.c | 6 +- drivers/clk/at91/sama7g5.c | 6 +- drivers/clk/bcm/clk-kona-setup.c | 6 +- drivers/clk/clk-conf.c | 4 +- drivers/clk/renesas/clk-div6.c | 3 +- drivers/clk/sprd/pll.c | 2 +- drivers/clk/sunxi/clk-sun8i-mbus.c | 2 +- drivers/clk/tegra/clk-bpmp.c | 2 +- drivers/clk/tegra/clk.c | 3 +- drivers/clk/x86/clk-pmc-atom.c | 3 +- drivers/comedi/comedi_fops.c | 5 +- drivers/comedi/drivers.c | 2 +- drivers/comedi/drivers/amplc_pci224.c | 5 +- drivers/comedi/drivers/das1800.c | 4 +- drivers/cpufreq/powernv-cpufreq.c | 2 +- drivers/cpuidle/dt_idle_genpd.c | 2 +- drivers/crypto/hisilicon/debugfs.c | 2 +- drivers/crypto/hisilicon/qm.c | 3 +- .../intel/qat/qat_common/adf_tl_debugfs.c | 10 ++- drivers/crypto/intel/qat/qat_common/qat_hal.c | 3 +- .../crypto/intel/qat/qat_common/qat_uclo.c | 6 +- drivers/dma/ste_dma40.c | 4 +- drivers/dma/ti/edma.c | 2 +- drivers/dpll/zl3073x/prop.c | 2 +- drivers/edac/skx_common.c | 3 +- drivers/firmware/arm_scmi/pinctrl.c | 7 +- drivers/firmware/arm_scmi/transports/pcc.c | 4 +- drivers/firmware/coreboot/coreboot-cfr.c | 10 +-- drivers/firmware/stratix10-svc.c | 2 +- drivers/firmware/ti_sci.c | 2 +- drivers/gpio/gpio-it87.c | 3 +- drivers/gpio/gpio-sim.c | 2 +- drivers/gpio/gpiolib.c | 4 +- drivers/gpu/buddy.c | 14 ++-- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 18 ++--- .../gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 9 +-- drivers/gpu/drm/amd/amdgpu/soc_v1_0.c | 2 +- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 4 +- .../drm/amd/amdkfd/kfd_mqd_manager_v12_1.c | 2 +- .../tests/amdgpu_dm_connector_test.c | 4 +- .../amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 4 +- .../amdgpu_dm/tests/amdgpu_dm_irq_test.c | 14 ++-- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 8 +-- .../gpu/drm/amd/display/dc/dc_memory_pool.c | 2 +- .../dc/resource/dcn42/dcn42_resource.c | 2 +- .../dc/resource/dcn42b/dcn42b_resource.c | 2 +- .../amd/display/dc/rmcm/dcn60/dcn60_rmcm.c | 2 +- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 3 +- .../drm/amd/pm/powerplay/hwmgr/smu_helper.c | 4 +- .../drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c | 4 +- drivers/gpu/drm/amd/ras/core/aca.c | 2 +- drivers/gpu/drm/amd/ras/core/cmd.c | 2 +- drivers/gpu/drm/amd/ras/core/eeprom.c | 2 +- drivers/gpu/drm/amd/ras/core/eeprom_fw.c | 2 +- drivers/gpu/drm/amd/ras/core/ras_cper.c | 2 +- drivers/gpu/drm/amd/ras/core/ras_psp.c | 2 +- drivers/gpu/drm/amd/ras/core/ras_umc.c | 4 +- .../drm/amd/ras/ras_mgr/amdgpu_virt_ras_cmd.c | 2 +- .../arm/display/komeda/komeda_format_caps.c | 2 +- drivers/gpu/drm/arm/malidp_mw.c | 3 +- drivers/gpu/drm/arm/malidp_planes.c | 2 +- drivers/gpu/drm/bridge/chipone-icn6211.c | 3 +- drivers/gpu/drm/bridge/fsl-ldb.c | 3 +- drivers/gpu/drm/bridge/ite-it66121.c | 6 +- drivers/gpu/drm/bridge/lontium-lt9211.c | 3 +- drivers/gpu/drm/bridge/lontium-lt9611.c | 3 +- drivers/gpu/drm/bridge/lvds-codec.c | 3 +- drivers/gpu/drm/bridge/nwl-dsi.c | 2 +- drivers/gpu/drm/bridge/sii902x.c | 2 +- drivers/gpu/drm/bridge/synopsys/dw-dp.c | 3 +- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 6 +- drivers/gpu/drm/bridge/tc358767.c | 6 +- drivers/gpu/drm/bridge/tc358768.c | 3 +- drivers/gpu/drm/bridge/ti-dlpc3433.c | 3 +- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 3 +- drivers/gpu/drm/drm_atomic_helper.c | 3 +- drivers/gpu/drm/drm_gpusvm.c | 8 +-- drivers/gpu/drm/drm_plane.c | 8 +-- drivers/gpu/drm/drm_property.c | 3 +- drivers/gpu/drm/drm_syncobj.c | 7 +- drivers/gpu/drm/gud/gud_connector.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 2 +- drivers/gpu/drm/i915/gt/intel_sseu_debugfs.c | 2 +- drivers/gpu/drm/i915/gt/selftest_reset.c | 2 +- drivers/gpu/drm/i915/i915_gpu_error.c | 2 +- drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 2 +- drivers/gpu/drm/i915/selftests/i915_random.c | 4 +- drivers/gpu/drm/imagination/pvr_fw_trace.c | 4 +- drivers/gpu/drm/mediatek/mtk_dp.c | 7 +- drivers/gpu/drm/mediatek/mtk_dpi.c | 6 +- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 4 +- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 4 +- drivers/gpu/drm/msm/msm_gpu.c | 6 +- drivers/gpu/drm/msm/msm_perfcntr.c | 6 +- drivers/gpu/drm/nouveau/nouveau_dmem.c | 12 ++-- .../gpu/drm/nouveau/nvkm/engine/gr/gv100.c | 8 +-- .../gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c | 2 +- drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 2 +- drivers/gpu/drm/panfrost/panfrost_drv.c | 2 +- drivers/gpu/drm/radeon/radeon_cs.c | 4 +- drivers/gpu/drm/radeon/radeon_object.c | 2 +- drivers/gpu/drm/radeon/radeon_ring.c | 2 +- .../gpu/drm/renesas/rcar-du/rcar_du_crtc.c | 2 +- drivers/gpu/drm/tidss/tidss_oldi.c | 3 +- drivers/gpu/drm/vc4/vc4_validate_shaders.c | 4 +- drivers/gpu/drm/verisilicon/vs_bridge.c | 6 +- drivers/gpu/drm/virtio/virtgpu_submit.c | 3 +- drivers/gpu/drm/xe/display/xe_fb_pin.c | 2 +- drivers/gpu/drm/xe/xe_pci.c | 2 +- drivers/gpu/drm/xe/xe_pt.c | 3 +- drivers/gpu/drm/xe/xe_vm.c | 8 +-- drivers/gpu/drm/xlnx/zynqmp_disp.c | 6 +- drivers/gpu/host1x/context.c | 4 +- drivers/gpu/tests/gpu_random.c | 2 +- drivers/hid/hid-haptic.c | 6 +- drivers/hv/channel.c | 2 +- drivers/hv/hv_common.c | 5 +- drivers/hv/mshv_regions.c | 2 +- drivers/hwmon/applesmc.c | 14 ++-- .../coresight/coresight-cti-platform.c | 4 +- drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +- drivers/i2c/i2c-atr.c | 4 +- drivers/i2c/i2c-stub.c | 4 +- drivers/infiniband/core/frmr_pools.c | 4 +- drivers/infiniband/core/umem_odp.c | 4 +- drivers/infiniband/core/uverbs_cmd.c | 3 +- drivers/infiniband/core/verbs.c | 4 +- drivers/infiniband/hw/bnxt_re/qplib_res.c | 2 +- drivers/infiniband/hw/erdma/erdma_verbs.c | 2 +- drivers/infiniband/hw/hfi1/affinity.c | 4 +- drivers/infiniband/hw/hfi1/chip.c | 9 ++- drivers/infiniband/hw/hns/hns_roce_srq.c | 2 +- .../infiniband/hw/ionic/ionic_controlpath.c | 5 +- drivers/infiniband/hw/mlx4/qp.c | 6 +- drivers/infiniband/hw/mlx4/srq.c | 3 +- drivers/infiniband/hw/mlx5/counters.c | 3 +- drivers/infiniband/hw/mlx5/qp.c | 12 ++-- drivers/infiniband/hw/mlx5/srq.c | 4 +- drivers/infiniband/hw/mthca/mthca_allocator.c | 6 +- drivers/infiniband/hw/mthca/mthca_eq.c | 2 +- drivers/infiniband/hw/mthca/mthca_mr.c | 3 +- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 3 +- drivers/input/misc/iqs7222.c | 2 +- drivers/iommu/arm/arm-smmu/arm-smmu.c | 2 +- drivers/iommu/hyperv/hv-iommu-guest.c | 4 +- drivers/iommu/intel/perfmon.c | 4 +- drivers/iommu/tegra-smmu.c | 2 +- drivers/irqchip/irq-atmel-aic5.c | 4 +- drivers/irqchip/irq-csky-mpintc.c | 2 +- drivers/irqchip/irq-gic-v3-its.c | 5 +- drivers/irqchip/irq-gic-v5-its.c | 16 ++--- drivers/irqchip/irq-mtk-sysirq.c | 9 +-- drivers/irqchip/irq-sifive-plic.c | 4 +- drivers/irqchip/irq-xilinx-smmu-csr.c | 2 +- drivers/leds/led-core.c | 2 +- drivers/mailbox/mtk-cmdq-mailbox.c | 2 +- drivers/md/dm-cache-target.c | 2 +- drivers/md/dm-clone-target.c | 2 +- drivers/md/dm-pcache/cache.c | 3 +- drivers/md/dm-pcache/cache_dev.c | 3 +- drivers/md/dm-table.c | 2 +- drivers/md/dm-verity-target.c | 5 +- .../platform/raspberrypi/pisp_be/pisp_be.c | 2 +- drivers/media/rc/imon_raw.c | 2 +- drivers/media/rc/ir-spi.c | 2 +- drivers/media/rc/lirc_dev.c | 2 +- drivers/media/rc/meson-ir-tx.c | 2 +- drivers/media/rc/rc-main.c | 2 +- drivers/media/rc/winbond-cir.c | 2 +- drivers/media/usb/em28xx/em28xx-audio.c | 5 +- drivers/media/usb/em28xx/em28xx-cards.c | 5 +- drivers/media/usb/stk1160/stk1160-core.c | 5 +- drivers/media/v4l2-core/v4l2-common.c | 2 +- drivers/media/v4l2-core/v4l2-fwnode.c | 3 +- drivers/media/v4l2-core/v4l2-subdev.c | 3 +- drivers/memstick/core/ms_block.c | 3 +- drivers/misc/cardreader/rtsx_usb.c | 2 +- drivers/misc/vmw_vmci/vmci_queue_pair.c | 6 +- drivers/mmc/core/host.c | 2 +- drivers/mtd/ftl.c | 3 +- drivers/mtd/nand/ecc-sw-bch.c | 3 +- drivers/mtd/nand/raw/nandsim.c | 2 +- drivers/mtd/parsers/sharpslpart.c | 3 +- drivers/mtd/ssfdc.c | 3 +- drivers/net/dsa/mv88e6xxx/devlink.c | 6 +- drivers/net/ethernet/amazon/ena/ena_ethtool.c | 2 +- .../ethernet/atheros/atl1c/atl1c_ethtool.c | 3 +- .../ethernet/atheros/atl1e/atl1e_ethtool.c | 3 +- drivers/net/ethernet/atheros/atlx/atl2.c | 3 +- .../net/ethernet/broadcom/bnge/bnge_resc.c | 2 +- drivers/net/ethernet/broadcom/bnx2.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 7 +- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 3 +- .../ethernet/cavium/thunder/nicvf_queues.c | 4 +- .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 6 +- .../net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c | 3 +- drivers/net/ethernet/emulex/benet/be_main.c | 3 +- .../net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +- .../net/ethernet/freescale/gianfar_ethtool.c | 6 +- drivers/net/ethernet/google/gve/gve_main.c | 12 ++-- drivers/net/ethernet/google/gve/gve_tx_dqo.c | 5 +- .../ethernet/hisilicon/hibmcge/hbg_diagnose.c | 4 +- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 2 +- .../hisilicon/hns3/hns3pf/hclge_debugfs.c | 2 +- .../hisilicon/hns3/hns3pf/hclge_main.c | 3 +- .../hisilicon/hns3/hns3vf/hclgevf_main.c | 3 +- .../net/ethernet/huawei/hinic/hinic_main.c | 2 +- .../net/ethernet/huawei/hinic3/hinic3_rss.c | 3 +- drivers/net/ethernet/ibm/ibmveth.c | 2 +- .../net/ethernet/intel/e1000/e1000_ethtool.c | 3 +- drivers/net/ethernet/intel/e1000e/ethtool.c | 3 +- drivers/net/ethernet/intel/ice/ice_nvm.c | 2 +- drivers/net/ethernet/intel/idpf/idpf_lib.c | 6 +- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 2 +- .../net/ethernet/intel/idpf/idpf_virtchnl.c | 4 +- drivers/net/ethernet/intel/igb/igb_ethtool.c | 6 +- drivers/net/ethernet/intel/igb/igb_main.c | 3 +- drivers/net/ethernet/intel/igc/igc_ethtool.c | 3 +- drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c | 2 +- .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +- .../ethernet/marvell/octeontx2/af/cn20k/npc.c | 12 ++-- .../ethernet/marvell/octeontx2/af/rvu_nix.c | 4 +- .../ethernet/marvell/octeontx2/af/rvu_npc.c | 15 ++--- .../marvell/octeontx2/af/rvu_switch.c | 3 +- .../net/ethernet/marvell/octeontx2/nic/qos.c | 4 +- .../ethernet/marvell/octeontx2/nic/qos_sq.c | 2 +- .../net/ethernet/marvell/octeontx2/nic/rep.c | 2 +- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 3 +- drivers/net/ethernet/mellanox/mlx4/eq.c | 2 +- drivers/net/ethernet/mellanox/mlx4/mr.c | 8 +-- .../net/ethernet/mellanox/mlx5/core/en/qos.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en/rqt.c | 12 ++-- .../ethernet/mellanox/mlx5/core/en/rx_res.c | 5 +- .../net/ethernet/mellanox/mlx5/core/en_fs.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en_rep.c | 2 +- .../net/ethernet/mellanox/mlx5/core/fs_pool.c | 4 +- .../net/ethernet/mellanox/mlx5/core/hwmon.c | 4 +- .../net/ethernet/mellanox/mlx5/core/lag/lag.c | 4 +- .../net/ethernet/mellanox/mlx5/core/pci_irq.c | 2 +- .../mellanox/mlx5/core/steering/hws/buddy.c | 8 +-- .../mlx5/core/steering/hws/bwc_complex.c | 4 +- .../mellanox/mlx5/core/steering/sws/dr_send.c | 5 +- .../ethernet/mellanox/mlxsw/spectrum_fid.c | 3 +- .../net/ethernet/mellanox/mlxsw/spectrum_mr.c | 3 +- .../net/ethernet/microsoft/mana/gdma_pci.c | 2 +- drivers/net/ethernet/microsoft/mana/mana_en.c | 2 +- .../ethernet/microsoft/mana/mana_ethtool.c | 2 +- drivers/net/ethernet/netronome/nfp/abm/main.c | 3 +- .../net/ethernet/qlogic/qed/qed_init_ops.c | 3 +- .../ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 8 +-- .../net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 8 +-- .../qlogic/qlcnic/qlcnic_sriov_common.c | 14 ++-- drivers/net/ethernet/realtek/r8169_main.c | 6 +- drivers/net/ethernet/rocker/rocker_ofdpa.c | 2 +- drivers/net/ethernet/sfc/falcon/efx.c | 5 +- drivers/net/ethernet/sfc/mae.c | 6 +- drivers/net/ethernet/sfc/rx_common.c | 5 +- drivers/net/ethernet/sfc/siena/rx_common.c | 5 +- drivers/net/ethernet/sfc/siena/siena_sriov.c | 3 +- drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c | 3 +- drivers/net/hyperv/rndis_filter.c | 2 +- drivers/net/mctp/mctp-usblib-test.c | 2 +- drivers/net/netdevsim/dev.c | 5 +- drivers/net/usb/asix_common.c | 6 +- drivers/net/usb/ax88179_178a.c | 6 +- drivers/net/usb/lan78xx.c | 4 +- drivers/net/wireless/ath/ath5k/phy.c | 4 +- drivers/net/wireless/ath/ath6kl/cfg80211.c | 2 +- drivers/net/wireless/ath/ath9k/ar9003_paprd.c | 2 +- drivers/net/wireless/ath/ath9k/hw.c | 4 +- drivers/net/wireless/broadcom/b43/phy_lp.c | 2 +- drivers/net/wireless/broadcom/b43/phy_n.c | 2 +- .../broadcom/brcm80211/brcmfmac/p2p.c | 6 +- .../broadcom/brcm80211/brcmfmac/pcie.c | 2 +- .../broadcom/brcm80211/brcmsmac/phy/phy_lcn.c | 4 +- .../broadcom/brcm80211/brcmsmac/phy/phy_n.c | 2 +- drivers/net/wireless/marvell/mwifiex/sdio.c | 5 +- .../mediatek/mt76/mt7925/cached_cal.c | 6 +- drivers/net/wireless/nxp/nxpwifi/cfg80211.c | 5 +- drivers/net/wireless/realtek/rtlwifi/efuse.c | 3 +- .../wireless/realtek/rtlwifi/rtl8192du/sw.c | 10 ++- drivers/nvdimm/btt.c | 2 +- drivers/nvme/target/core.c | 4 +- drivers/opp/of.c | 6 +- drivers/pci/of_property.c | 2 +- drivers/phy/phy-common-props.c | 2 +- drivers/pinctrl/pinconf-generic.c | 2 +- drivers/pinctrl/pinctrl-apple-gpio.c | 4 +- drivers/pinctrl/pinctrl-scmi.c | 2 +- drivers/pinctrl/qcom/pinctrl-msm.c | 2 +- drivers/pinctrl/qcom/tlmm-test.c | 2 +- drivers/pinctrl/renesas/core.c | 5 +- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 2 +- .../raspberrypi/vchiq-interface/vchiq_core.c | 3 +- drivers/platform/x86/intel/pmc/core.c | 2 +- .../platform/x86/intel/tpmi_power_domains.c | 4 +- drivers/platform/x86/intel_ips.c | 12 ++-- drivers/power/supply/max17042_battery.c | 4 +- drivers/power/supply/max8903_charger.c | 2 +- drivers/ras/amd/fmpm.c | 2 +- drivers/remoteproc/pru_rproc.c | 3 +- drivers/s390/char/keyboard.c | 7 +- drivers/s390/crypto/zcrypt_api.c | 2 +- drivers/scsi/be2iscsi/be_main.c | 5 +- drivers/scsi/hpsa.c | 4 +- drivers/scsi/leapraid/leapraid_func.c | 2 +- drivers/scsi/lpfc/lpfc_init.c | 5 +- drivers/scsi/lpfc/lpfc_sli.c | 66 ++++++------------- drivers/scsi/megaraid/megaraid_sas_base.c | 3 +- drivers/scsi/mpt3sas/mpt3sas_base.c | 3 +- drivers/sh/intc/core.c | 4 +- drivers/soc/qcom/qmi_tmd.c | 2 +- drivers/soc/tegra/pmc.c | 4 +- drivers/ssb/pci.c | 5 +- drivers/ssb/sprom.c | 4 +- drivers/staging/fbtft/fbtft-core.c | 2 +- .../target/iscsi/iscsi_target_seq_pdu_list.c | 6 +- drivers/target/sbp/sbp_target.c | 2 +- drivers/target/target_core_user.c | 3 +- drivers/tee/optee/protmem.c | 3 +- drivers/thermal/devfreq_cooling.c | 3 +- drivers/thermal/intel/therm_throt.c | 5 +- drivers/thunderbolt/debugfs.c | 3 +- drivers/thunderbolt/xdomain.c | 4 +- drivers/tty/vt/consolemap.c | 13 ++-- drivers/tty/vt/keyboard.c | 7 +- drivers/usb/dwc2/debugfs.c | 2 +- drivers/usb/dwc2/hcd.c | 8 +-- drivers/usb/dwc2/hcd_ddma.c | 2 +- drivers/usb/dwc3/core.c | 2 +- drivers/usb/gadget/function/f_ncm.c | 2 +- drivers/usb/gadget/function/uvc_configfs.c | 2 +- drivers/usb/storage/ene_ub6250.c | 10 ++- drivers/vhost/vhost.c | 3 +- drivers/video/backlight/hx8357.c | 2 +- drivers/video/fbdev/via/viafbdev.c | 3 +- drivers/virt/acrn/hsm.c | 2 +- drivers/w1/masters/ds2490.c | 2 +- drivers/xen/gntalloc.c | 2 +- drivers/xen/gntdev-dmabuf.c | 4 +- drivers/xen/grant-table.c | 2 +- fs/9p/fid.c | 2 +- fs/ceph/file.c | 2 +- fs/ceph/mds_client.c | 4 +- fs/ceph/mdsmap.c | 7 +- fs/ceph/snap.c | 2 +- fs/exfat/nls.c | 4 +- fs/ext2/super.c | 2 +- fs/ext4/resize.c | 3 +- fs/fuse/ext_map.c | 2 +- fs/gfs2/dir.c | 2 +- fs/gfs2/lock_dlm.c | 4 +- fs/namespace.c | 4 +- fs/nfs/pnfs.c | 2 +- fs/nfsd/export.c | 4 +- fs/nfsd/nfs4state.c | 2 +- fs/ntfs/mft.c | 2 +- fs/ntfs/super.c | 4 +- fs/ntfs/upcase.c | 2 +- fs/ntfs3/bitmap.c | 4 +- fs/ocfs2/super.c | 8 +-- fs/ocfs2/xattr.c | 2 +- fs/proc/base.c | 3 +- fs/resctrl/monitor.c | 2 +- fs/smb/client/dfs_cache.c | 2 +- fs/smb/common/compress/lz77.c | 2 +- fs/smb/server/smb2pdu.c | 7 +- fs/smb/server/transport_tcp.c | 2 +- fs/verity/open.c | 5 +- io_uring/dma-buf.c | 2 +- io_uring/zcrx.c | 4 +- ipc/sem.c | 6 +- kernel/bpf/btf.c | 8 +-- kernel/bpf/cfg.c | 4 +- kernel/bpf/core.c | 2 +- kernel/bpf/loops.c | 13 ++-- kernel/bpf/scev.c | 17 +++-- kernel/kcsan/debugfs.c | 2 +- kernel/module/kmod.c | 2 +- kernel/rcu/rcuscale.c | 5 +- kernel/rcu/rcutorture.c | 6 +- kernel/rcu/refscale.c | 2 +- kernel/trace/bpf_trace.c | 6 +- kernel/trace/fgraph.c | 4 +- kernel/trace/fprobe.c | 6 +- kernel/trace/ring_buffer.c | 2 +- kernel/trace/trace.c | 2 +- kernel/trace/trace_probe.c | 2 +- kernel/workqueue.c | 2 +- lib/argv_split.c | 2 +- lib/reed_solomon/reed_solomon.c | 6 +- lib/reed_solomon/test_rslib.c | 3 +- lib/region_alloc_benchmark.c | 4 +- lib/test_bitops.c | 2 +- lib/test_hmm.c | 22 ++++--- lib/test_workqueue.c | 5 +- mm/damon/core.c | 11 ++-- mm/hmm.c | 4 +- mm/mempolicy.c | 2 +- mm/shrinker_debug.c | 2 +- mm/slab_common.c | 2 +- mm/slub.c | 2 +- mm/vmalloc.c | 2 +- mm/vmstat.c | 2 +- net/bluetooth/mgmt.c | 2 +- net/bridge/br_vlan.c | 2 +- net/ceph/osdmap.c | 2 +- net/core/devmem.c | 5 +- net/core/filter.c | 2 +- net/ethtool/bitset.c | 8 +-- net/ethtool/ioctl.c | 10 +-- net/ncsi/ncsi-rsp.c | 5 +- net/netfilter/xt_hashlimit.c | 2 +- net/netlabel/netlabel_cipso_v4.c | 26 ++++---- net/packet/af_packet.c | 2 +- net/sched/sch_fq_codel.c | 2 +- net/sched/sch_hhf.c | 4 +- net/sctp/stream.c | 2 +- net/sunrpc/svc.c | 4 +- net/sunrpc/svcauth_unix.c | 4 +- net/wireless/core.c | 3 +- net/wireless/mlme.c | 2 +- net/wireless/nl80211.c | 11 ++-- security/apparmor/policy_unpack.c | 2 +- security/keys/encrypted-keys/encrypted.c | 3 +- security/security.c | 5 +- security/selinux/hooks.c | 3 +- security/selinux/ss/services.c | 4 +- sound/core/memalloc.c | 2 +- sound/core/oss/mixer_oss.c | 2 +- sound/firewire/bebob/bebob_maudio.c | 2 +- sound/firewire/dice/dice-transaction.c | 3 +- sound/firewire/fireface/ff-protocol-former.c | 2 +- sound/firewire/motu/motu-stream.c | 4 +- sound/pci/emu10k1/emufx.c | 2 +- sound/soc/codecs/arizona-jack.c | 2 +- sound/soc/codecs/audio-iio-aux.c | 5 +- sound/soc/codecs/cs35l41-lib.c | 2 +- sound/soc/codecs/rt1011.c | 10 ++- sound/soc/codecs/rt5645.c | 4 +- sound/soc/codecs/sigmadsp.c | 2 +- sound/soc/codecs/wcd9335.c | 2 +- sound/soc/codecs/wcd934x.c | 2 +- sound/soc/codecs/wm8904.c | 5 +- sound/soc/codecs/wm8958-dsp2.c | 20 +++--- sound/soc/intel/avs/loader.c | 2 +- sound/soc/intel/avs/path.c | 6 +- sound/soc/qcom/qaif-platform.c | 2 +- sound/soc/qcom/qdsp6/q6afe.c | 2 +- sound/soc/sof/ipc3-control.c | 2 +- sound/soc/sof/ipc4-compress.c | 2 +- sound/soc/sof/ipc4-control.c | 2 +- sound/soc/sof/sof-client-probes-ipc4.c | 3 +- sound/soc/sof/topology.c | 3 +- sound/usb/format.c | 2 +- sound/usb/qcom/qc_audio_offload.c | 3 +- 519 files changed, 931 insertions(+), 1213 deletions(-) diff --git a/arch/arc/net/bpf_jit_core.c b/arch/arc/net/bpf_jit_core.c index 639a2736f029..13450e5d2b7a 100644 --- a/arch/arc/net/bpf_jit_core.c +++ b/arch/arc/net/bpf_jit_core.c @@ -1101,8 +1101,7 @@ static void fill_ill_insn(void *area, unsigned int size) /* Piece of memory that can be allocated at the beginning of jit_prepare(). */ static int jit_prepare_early_mem_alloc(struct jit_context *ctx) { - ctx->bpf2insn = kcalloc(ctx->prog->len, sizeof(ctx->jit.len), - GFP_KERNEL); + ctx->bpf2insn = kzalloc_objs(ctx->jit.len, ctx->prog->len); if (!ctx->bpf2insn) { pr_err("bpf-jit: could not allocate memory for " diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index e6b50cd43ce5..b59012da9247 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -92,8 +92,7 @@ static void __init parse_dt_topology(void) unsigned long capacity = 0; int cpu = 0; - __cpu_capacity = kcalloc(nr_cpu_ids, sizeof(*__cpu_capacity), - GFP_NOWAIT); + __cpu_capacity = kzalloc_objs(*__cpu_capacity, nr_cpu_ids, GFP_NOWAIT); for_each_possible_cpu(cpu) { const __be32 *rate; diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c index c63e854921ea..02b55f1461f6 100644 --- a/arch/arm/mach-pxa/pm.c +++ b/arch/arm/mach-pxa/pm.c @@ -102,9 +102,7 @@ static int __init pxa_pm_init(void) return -EINVAL; } - sleep_save = kmalloc_array(pxa_cpu_pm_fns->save_count, - sizeof(*sleep_save), - GFP_KERNEL); + sleep_save = kmalloc_objs(*sleep_save, pxa_cpu_pm_fns->save_count); if (!sleep_save) return -ENOMEM; diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c index 9ede81afbc50..aa240e3de6e7 100644 --- a/arch/arm/net/bpf_jit_32.c +++ b/arch/arm/net/bpf_jit_32.c @@ -2199,7 +2199,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr ctx.idx += ctx.imm_count; if (ctx.imm_count) { - ctx.imms = kcalloc(ctx.imm_count, sizeof(u32), GFP_KERNEL); + ctx.imms = kzalloc_objs(u32, ctx.imm_count); if (ctx.imms == NULL) goto out_off; } diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c index c41724a40b75..3691c4c32904 100644 --- a/arch/arm64/kernel/suspend.c +++ b/arch/arm64/kernel/suspend.c @@ -170,8 +170,7 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) static int __init cpu_suspend_init(void) { /* ctx_ptr is an array of physical addresses */ - sleep_save_stash = kcalloc(mpidr_hash_size(), sizeof(*sleep_save_stash), - GFP_KERNEL); + sleep_save_stash = kzalloc_objs(*sleep_save_stash, mpidr_hash_size()); if (WARN_ON(!sleep_save_stash)) return -ENOMEM; diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 850eba167aad..c7d91138a6d4 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -506,7 +506,7 @@ static int set_ccsidr(struct kvm_vcpu *vcpu, u32 csselr, u32 val) if (val == get_ccsidr(vcpu, csselr)) return 0; - ccsidr = kmalloc_array(CSSELR_MAX, sizeof(u32), GFP_KERNEL_ACCOUNT); + ccsidr = kmalloc_objs(u32, CSSELR_MAX, GFP_KERNEL_ACCOUNT); if (!ccsidr) return -ENOMEM; diff --git a/arch/arm64/kvm/vgic/vgic-irs-v5.c b/arch/arm64/kvm/vgic/vgic-irs-v5.c index 8d0ad74ebc64..f73349c02656 100644 --- a/arch/arm64/kvm/vgic/vgic-irs-v5.c +++ b/arch/arm64/kvm/vgic/vgic-irs-v5.c @@ -1000,8 +1000,8 @@ int kvm_vgic_v5_irs_init(struct kvm *kvm, unsigned int nr_spis) * provide at least 32 SPIs, so we always meet alignment requirements. */ if (nr_spis) { - dist->spis = kcalloc(nr_spis, sizeof(struct vgic_irq), - GFP_KERNEL_ACCOUNT); + dist->spis = kzalloc_objs(struct vgic_irq, nr_spis, + GFP_KERNEL_ACCOUNT); if (!dist->spis) return -ENOMEM; diff --git a/arch/arm64/kvm/vgic/vgic-v5-tables.c b/arch/arm64/kvm/vgic/vgic-v5-tables.c index d577e485ebe9..8f72704209b0 100644 --- a/arch/arm64/kvm/vgic/vgic-v5-tables.c +++ b/arch/arm64/kvm/vgic/vgic-v5-tables.c @@ -198,8 +198,7 @@ static int vgic_v5_alloc_vmt_two_level(unsigned int num_entries) return -ENOMEM; vmt_info->l2.l2ptrs = kzalloc_objs(*vmt_info->l2.l2ptrs, - vmt_info->l2.num_l1_ents, - GFP_KERNEL); + vmt_info->l2.num_l1_ents); if (!vmt_info->l2.l2ptrs) { kfree(vmt_info->l2.vmt_base); return -ENOMEM; @@ -296,7 +295,7 @@ int vgic_v5_vmt_allocate(unsigned int max_vpes) int ret; /* Allocate the tracking structure */ - vmt_info = kzalloc_obj(*vmt_info, GFP_KERNEL); + vmt_info = kzalloc_obj(*vmt_info); if (!vmt_info) return -ENOMEM; @@ -1598,7 +1597,7 @@ static int vgic_v5_track_pending_irq(struct list_head *pending_irqs, u32 intid, { struct vgic_v5_pending_irq *pirq; - pirq = kzalloc_obj(*pirq, GFP_KERNEL); + pirq = kzalloc_obj(*pirq); if (!pirq) return -ENOMEM; diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c index 3ab039d0afb6..042930c7ddb2 100644 --- a/arch/loongarch/net/bpf_jit.c +++ b/arch/loongarch/net/bpf_jit.c @@ -2301,7 +2301,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr ctx.user_vm_start = bpf_arena_get_user_vm_start(prog->aux->arena); } - ctx.offset = kvcalloc(prog->len + 1, sizeof(u32), GFP_KERNEL); + ctx.offset = kvzalloc_objs(u32, prog->len + 1); if (ctx.offset == NULL) goto out_offset; diff --git a/arch/mips/kernel/pm-cps.c b/arch/mips/kernel/pm-cps.c index 3de0e05e0511..e421590e339e 100644 --- a/arch/mips/kernel/pm-cps.c +++ b/arch/mips/kernel/pm-cps.c @@ -361,7 +361,7 @@ static void *cps_gen_entry_code(unsigned cpu, enum cps_pm_state state) }; /* Allocate a buffer to hold the generated code */ - p = buf = kcalloc(max_instrs, sizeof(u32), GFP_KERNEL); + p = buf = kzalloc_objs(u32, max_instrs); if (!buf) return NULL; diff --git a/arch/mips/net/bpf_jit_comp.c b/arch/mips/net/bpf_jit_comp.c index 4682dbb3a059..1b213f9ba06b 100644 --- a/arch/mips/net/bpf_jit_comp.c +++ b/arch/mips/net/bpf_jit_comp.c @@ -959,8 +959,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr * Not able to allocate memory for descriptors[], then * we must fall back to the interpreter */ - ctx.descriptors = kcalloc(prog->len + 1, sizeof(*ctx.descriptors), - GFP_KERNEL); + ctx.descriptors = kzalloc_objs(*ctx.descriptors, prog->len + 1); if (ctx.descriptors == NULL) goto out_err; diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 6a5a5469aaae..7a25eaa59e62 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -824,7 +824,7 @@ static int parse_thread_groups(struct device_node *dn, int i = 0; count = of_property_count_u32_elems(dn, "ibm,thread-groups"); - thread_group_array = kcalloc(count, sizeof(u32), GFP_KERNEL); + thread_group_array = kzalloc_objs(u32, count); if (!thread_group_array) return -ENOMEM; ret = of_property_read_u32_array(dn, "ibm,thread-groups", diff --git a/arch/powerpc/kvm/e500_mmu.c b/arch/powerpc/kvm/e500_mmu.c index 75ed1496ead5..80b136507e40 100644 --- a/arch/powerpc/kvm/e500_mmu.c +++ b/arch/powerpc/kvm/e500_mmu.c @@ -804,9 +804,7 @@ int kvm_vcpu_ioctl_config_tlb(struct kvm_vcpu *vcpu, goto free_privs_first; } - g2h_bitmap = kcalloc(params.tlb_sizes[1], - sizeof(*g2h_bitmap), - GFP_KERNEL); + g2h_bitmap = kzalloc_objs(*g2h_bitmap, params.tlb_sizes[1]); if (!g2h_bitmap) { ret = -ENOMEM; goto free_privs_second; @@ -930,9 +928,8 @@ int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 *vcpu_e500) if (!vcpu_e500->gtlb_priv[1]) goto free_vcpu; - vcpu_e500->g2h_tlb1_map = kcalloc(vcpu_e500->gtlb_params[1].entries, - sizeof(*vcpu_e500->g2h_tlb1_map), - GFP_KERNEL); + vcpu_e500->g2h_tlb1_map = kzalloc_objs(*vcpu_e500->g2h_tlb1_map, + vcpu_e500->gtlb_params[1].entries); if (!vcpu_e500->g2h_tlb1_map) goto free_vcpu; diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c index 37e0d3d9e244..fa6128119874 100644 --- a/arch/powerpc/kvm/e500_mmu_host.c +++ b/arch/powerpc/kvm/e500_mmu_host.c @@ -741,9 +741,8 @@ int e500_mmu_host_init(struct kvmppc_vcpu_e500 *vcpu_e500) host_tlb_params[0].sets = host_tlb_params[0].entries / host_tlb_params[0].ways; host_tlb_params[1].sets = 1; - vcpu_e500->h2g_tlb1_rmap = kcalloc(host_tlb_params[1].entries, - sizeof(*vcpu_e500->h2g_tlb1_rmap), - GFP_KERNEL); + vcpu_e500->h2g_tlb1_rmap = kzalloc_objs(*vcpu_e500->h2g_tlb1_rmap, + host_tlb_params[1].entries); if (!vcpu_e500->h2g_tlb1_rmap) return -EINVAL; diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c index e0b812d0c77e..ce2966c52ac5 100644 --- a/arch/powerpc/net/bpf_jit_comp.c +++ b/arch/powerpc/net/bpf_jit_comp.c @@ -258,7 +258,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr goto skip_init_ctx; } - addrs = kcalloc(flen + 1, sizeof(*addrs), GFP_KERNEL); + addrs = kzalloc_objs(*addrs, flen + 1); if (addrs == NULL) goto out_err; @@ -1104,7 +1104,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im } if (fmod_ret->nr_nodes) { - branches = kcalloc(fmod_ret->nr_nodes, sizeof(u32), GFP_KERNEL); + branches = kzalloc_objs(u32, fmod_ret->nr_nodes); if (!branches) return -ENOMEM; diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c index 33103a98cfd5..52e4652ce278 100644 --- a/arch/powerpc/platforms/powernv/idle.c +++ b/arch/powerpc/platforms/powernv/idle.c @@ -1338,8 +1338,8 @@ static int __init pnv_parse_cpuidle_dt(void) "ibm,cpu-idle-state-flags"); pnv_idle_states = kzalloc_objs(*pnv_idle_states, nr_idle_states); - temp_u32 = kcalloc(nr_idle_states, sizeof(u32), GFP_KERNEL); - temp_u64 = kcalloc(nr_idle_states, sizeof(u64), GFP_KERNEL); + temp_u32 = kzalloc_objs(u32, nr_idle_states); + temp_u64 = kzalloc_objs(u64, nr_idle_states); temp_string = kcalloc(nr_idle_states, sizeof(char *), GFP_KERNEL); if (!(pnv_idle_states && temp_u32 && temp_u64 && temp_string)) { diff --git a/arch/powerpc/platforms/powernv/opal-imc.c b/arch/powerpc/platforms/powernv/opal-imc.c index b3fd5c648dea..15a35bab97dc 100644 --- a/arch/powerpc/platforms/powernv/opal-imc.c +++ b/arch/powerpc/platforms/powernv/opal-imc.c @@ -91,11 +91,11 @@ static int imc_get_mem_addr_nest(struct device_node *node, if (nr_chips <= 0) return -ENODEV; - base_addr_arr = kcalloc(nr_chips, sizeof(*base_addr_arr), GFP_KERNEL); + base_addr_arr = kzalloc_objs(*base_addr_arr, nr_chips); if (!base_addr_arr) return -ENOMEM; - chipid_arr = kcalloc(nr_chips, sizeof(*chipid_arr), GFP_KERNEL); + chipid_arr = kzalloc_objs(*chipid_arr, nr_chips); if (!chipid_arr) { kfree(base_addr_arr); return -ENOMEM; diff --git a/arch/powerpc/platforms/powernv/opal-sysparam.c b/arch/powerpc/platforms/powernv/opal-sysparam.c index 7fe6433517ca..c124d90c7811 100644 --- a/arch/powerpc/platforms/powernv/opal-sysparam.c +++ b/arch/powerpc/platforms/powernv/opal-sysparam.c @@ -185,14 +185,14 @@ void __init opal_sys_param_init(void) goto out_param_buf; } - id = kcalloc(count, sizeof(*id), GFP_KERNEL); + id = kzalloc_objs(*id, count); if (!id) { pr_err("SYSPARAM: Failed to allocate memory to read parameter " "id\n"); goto out_param_buf; } - size = kcalloc(count, sizeof(*size), GFP_KERNEL); + size = kzalloc_objs(*size, count); if (!size) { pr_err("SYSPARAM: Failed to allocate memory to read parameter " "size\n"); diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c index abb94720c79b..912fb168be54 100644 --- a/arch/s390/kernel/uv.c +++ b/arch/s390/kernel/uv.c @@ -254,7 +254,7 @@ void *uv_alloc_stor_var(unsigned long size) area = get_vm_area(size, VM_SPARSE); if (!area) return NULL; - pages = kvcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL_ACCOUNT); + pages = kvzalloc_objs(struct page *, nr_pages, GFP_KERNEL_ACCOUNT); if (!pages) goto free_area; for (i = 0; i < nr_pages; i++) { diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 3ab880fc17a6..ae89037db87c 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c @@ -2397,7 +2397,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr } memset(&jit, 0, sizeof(jit)); - jit.addrs = kvcalloc(fp->len + 1, sizeof(*jit.addrs), GFP_KERNEL); + jit.addrs = kvzalloc_objs(*jit.addrs, fp->len + 1); if (jit.addrs == NULL) goto out_err; /* diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index d64c544b32b0..1192fb167d3f 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -1079,8 +1079,8 @@ static int zpci_mem_init(void) if (!zpci_iomap_start) goto error_iomap; - zpci_iomap_bitmap = kcalloc(BITS_TO_LONGS(ZPCI_IOMAP_ENTRIES), - sizeof(*zpci_iomap_bitmap), GFP_KERNEL); + zpci_iomap_bitmap = kzalloc_objs(*zpci_iomap_bitmap, + BITS_TO_LONGS(ZPCI_IOMAP_ENTRIES)); if (!zpci_iomap_bitmap) goto error_iomap_bitmap; diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c index 149adc094753..255dd7dc7474 100644 --- a/arch/sparc/kernel/nmi.c +++ b/arch/sparc/kernel/nmi.c @@ -172,8 +172,7 @@ static int __init check_nmi_watchdog(void) if (!atomic_read(&nmi_active)) return 0; - prev_nmi_count = kmalloc_array(nr_cpu_ids, sizeof(unsigned int), - GFP_KERNEL); + prev_nmi_count = kmalloc_objs(unsigned int, nr_cpu_ids); if (!prev_nmi_count) { err = -ENOMEM; goto error; diff --git a/arch/sparc/net/bpf_jit_comp_32.c b/arch/sparc/net/bpf_jit_comp_32.c index bda2dbd3f4c5..5d98c222b420 100644 --- a/arch/sparc/net/bpf_jit_comp_32.c +++ b/arch/sparc/net/bpf_jit_comp_32.c @@ -335,7 +335,7 @@ void bpf_jit_compile(struct bpf_prog *fp) if (!bpf_jit_enable) return; - addrs = kmalloc_array(flen, sizeof(*addrs), GFP_KERNEL); + addrs = kmalloc_objs(*addrs, flen); if (addrs == NULL) return; diff --git a/arch/sparc/net/bpf_jit_comp_64.c b/arch/sparc/net/bpf_jit_comp_64.c index 2fa0e9375127..52f145e3843c 100644 --- a/arch/sparc/net/bpf_jit_comp_64.c +++ b/arch/sparc/net/bpf_jit_comp_64.c @@ -1511,7 +1511,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr memset(&ctx, 0, sizeof(ctx)); ctx.prog = prog; - ctx.offset = kmalloc_array(prog->len, sizeof(unsigned int), GFP_KERNEL); + ctx.offset = kmalloc_objs(unsigned int, prog->len); if (ctx.offset == NULL) goto out_err; diff --git a/arch/x86/events/intel/uncore_discovery.c b/arch/x86/events/intel/uncore_discovery.c index 0a22edf4d509..99a1b974b14f 100644 --- a/arch/x86/events/intel/uncore_discovery.c +++ b/arch/x86/events/intel/uncore_discovery.c @@ -394,8 +394,7 @@ static bool uncore_discovery_msr(struct uncore_discovery_domain *domain) int cpu, die; u64 base; - die_mask = kcalloc(BITS_TO_LONGS(uncore_max_dies()), - sizeof(unsigned long), GFP_KERNEL); + die_mask = kzalloc_objs(unsigned long, BITS_TO_LONGS(uncore_max_dies())); if (!die_mask) return false; diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index 5d364540673d..11fc164cba21 100644 --- a/arch/x86/kernel/amd_nb.c +++ b/arch/x86/kernel/amd_nb.c @@ -228,7 +228,7 @@ static void amd_cache_gart(void) if (!amd_nb_has_feature(AMD_NB_GART)) return; - flush_words = kmalloc_array(amd_northbridges.num, sizeof(u32), GFP_KERNEL); + flush_words = kmalloc_objs(u32, amd_northbridges.num); if (!flush_words) { amd_northbridges.flags &= ~AMD_NB_GART; pr_notice("Cannot initialize GART flush words, GART support disabled\n"); diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c index 7db83212effb..e444b09bf881 100644 --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c @@ -209,7 +209,7 @@ static int x2apic_cluster_probe(void) return 0; slots = max_t(u32, L1_CACHE_BYTES/sizeof(u32), nr_cpu_ids); - x86_cpu_to_logical_apicid = kcalloc(slots, sizeof(u32), GFP_KERNEL); + x86_cpu_to_logical_apicid = kzalloc_objs(u32, slots); if (!x86_cpu_to_logical_apicid) return 0; diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c index 4049235b1bfe..5df85c30b507 100644 --- a/arch/x86/kernel/cpu/mtrr/if.c +++ b/arch/x86/kernel/cpu/mtrr/if.c @@ -43,7 +43,7 @@ mtrr_file_add(unsigned long base, unsigned long size, max = num_var_ranges; if (fcount == NULL) { - fcount = kcalloc(max, sizeof(*fcount), GFP_KERNEL); + fcount = kzalloc_objs(*fcount, max); if (!fcount) return -ENOMEM; FILE_FCOUNT(file) = fcount; diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index 55214d6fdc49..bd9e4cf9f7cb 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -408,8 +408,7 @@ static int domain_setup_ctrlval(struct rdt_resource *r, struct rdt_ctrl_domain * struct msr_param m; u32 *dc; - dc = kmalloc_array(hw_res->num_closid, sizeof(*hw_dom->ctrl_val), - GFP_KERNEL); + dc = kmalloc_objs(*hw_dom->ctrl_val, hw_res->num_closid); if (!dc) return -ENOMEM; diff --git a/arch/x86/kvm/debugfs.c b/arch/x86/kvm/debugfs.c index 0074a56e45b4..9dde80022fb9 100644 --- a/arch/x86/kvm/debugfs.c +++ b/arch/x86/kvm/debugfs.c @@ -103,7 +103,7 @@ static int kvm_mmu_rmaps_stat_show(struct seq_file *m, void *v) ret = -ENOMEM; memset(log, 0, sizeof(log)); for (i = 0; i < KVM_NR_PAGE_SIZES; i++) { - log[i] = kcalloc(RMAP_LOG_SIZE, sizeof(unsigned int), GFP_KERNEL); + log[i] = kzalloc_objs(unsigned int, RMAP_LOG_SIZE); if (!log[i]) goto out; } diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c index 8a593159c9b7..c213c0eba919 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -3024,8 +3024,9 @@ static int tdx_td_vcpu_init(struct kvm_vcpu *vcpu, u64 vcpu_rcx) */ tdx->vp.tdvpr_pa = page_to_phys(tdx->vp.tdvpr_page); - tdx->vp.tdcx_pages = kcalloc(kvm_tdx->td.tdcx_nr_pages, sizeof(*tdx->vp.tdcx_pages), - GFP_KERNEL_ACCOUNT); + tdx->vp.tdcx_pages = kzalloc_objs(*tdx->vp.tdcx_pages, + kvm_tdx->td.tdcx_nr_pages, + GFP_KERNEL_ACCOUNT); if (!tdx->vp.tdcx_pages) { ret = -ENOMEM; goto free_tdvpr; diff --git a/crypto/asymmetric_keys/verify_pefile.c b/crypto/asymmetric_keys/verify_pefile.c index 1efd5c0d0e9c..b83d1f1e19a3 100644 --- a/crypto/asymmetric_keys/verify_pefile.c +++ b/crypto/asymmetric_keys/verify_pefile.c @@ -272,7 +272,7 @@ static int pefile_digest_pe_contents(const void *pebuf, unsigned int pelen, if (ret < 0) return ret; - canon = kcalloc(ctx->n_sections, sizeof(unsigned), GFP_KERNEL); + canon = kzalloc_objs(unsigned, ctx->n_sections); if (!canon) return -ENOMEM; diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c index 9c6b7353cbe9..d3e46a0c4b3d 100644 --- a/drivers/accel/amdxdna/aie2_ctx.c +++ b/drivers/accel/amdxdna/aie2_ctx.c @@ -566,7 +566,7 @@ static int aie2_hwctx_col_list(struct amdxdna_hwctx *hwctx) return -EINVAL; } - hwctx->col_list = kmalloc_array(entries, sizeof(*hwctx->col_list), GFP_KERNEL); + hwctx->col_list = kmalloc_objs(*hwctx->col_list, entries); if (!hwctx->col_list) return -ENOMEM; diff --git a/drivers/accel/amdxdna/amdxdna_ctx.c b/drivers/accel/amdxdna/amdxdna_ctx.c index 888e857ec558..a089a7990675 100644 --- a/drivers/accel/amdxdna/amdxdna_ctx.c +++ b/drivers/accel/amdxdna/amdxdna_ctx.c @@ -712,7 +712,7 @@ static int amdxdna_drm_submit_execbuf(struct amdxdna_client *client, cmd_bo_hdl = (u32)args->cmd_handles; if (args->arg_count) { - arg_bo_hdls = kcalloc(args->arg_count, sizeof(u32), GFP_KERNEL); + arg_bo_hdls = kzalloc_objs(u32, args->arg_count); if (!arg_bo_hdls) return -ENOMEM; ret = copy_from_user(arg_bo_hdls, u64_to_user_ptr(args->args), diff --git a/drivers/accel/habanalabs/common/command_submission.c b/drivers/accel/habanalabs/common/command_submission.c index ba4257bda77b..8a3febc2089e 100644 --- a/drivers/accel/habanalabs/common/command_submission.c +++ b/drivers/accel/habanalabs/common/command_submission.c @@ -947,11 +947,12 @@ static int allocate_cs(struct hl_device *hdev, struct hl_ctx *ctx, goto free_cs; } - cs->jobs_in_queue_cnt = kcalloc(hdev->asic_prop.max_queues, - sizeof(*cs->jobs_in_queue_cnt), GFP_ATOMIC); + cs->jobs_in_queue_cnt = kzalloc_objs(*cs->jobs_in_queue_cnt, + hdev->asic_prop.max_queues, + GFP_ATOMIC); if (!cs->jobs_in_queue_cnt) - cs->jobs_in_queue_cnt = kcalloc(hdev->asic_prop.max_queues, - sizeof(*cs->jobs_in_queue_cnt), GFP_KERNEL); + cs->jobs_in_queue_cnt = kzalloc_objs(*cs->jobs_in_queue_cnt, + hdev->asic_prop.max_queues); if (!cs->jobs_in_queue_cnt) { atomic64_inc(&ctx->cs_counters.out_of_mem_drop_cnt); @@ -1899,13 +1900,11 @@ static int cs_ioctl_extract_signal_seq(struct hl_device *hdev, return -EINVAL; } - signal_seq_arr = kmalloc_array(signal_seq_arr_len, - sizeof(*signal_seq_arr), - GFP_ATOMIC); + signal_seq_arr = kmalloc_objs(*signal_seq_arr, signal_seq_arr_len, + GFP_ATOMIC); if (!signal_seq_arr) - signal_seq_arr = kmalloc_array(signal_seq_arr_len, - sizeof(*signal_seq_arr), - GFP_KERNEL); + signal_seq_arr = kmalloc_objs(*signal_seq_arr, + signal_seq_arr_len); if (!signal_seq_arr) { atomic64_inc(&ctx->cs_counters.out_of_mem_drop_cnt); atomic64_inc(&hdev->aggregated_cs_counters.out_of_mem_drop_cnt); @@ -2479,7 +2478,7 @@ static int cs_ioctl_engine_cores(struct hl_fpriv *hpriv, u64 engine_cores, } engine_cores_arr = (void __user *) (uintptr_t) engine_cores; - cores = kmalloc_array(num_engine_cores, sizeof(u32), GFP_KERNEL); + cores = kmalloc_objs(u32, num_engine_cores); if (!cores) return -ENOMEM; @@ -2521,7 +2520,7 @@ static int cs_ioctl_engines(struct hl_fpriv *hpriv, u64 engines_arr_user_addr, } engines_arr = (void __user *) (uintptr_t) engines_arr_user_addr; - engines = kmalloc_array(num_engines, sizeof(u32), GFP_KERNEL); + engines = kmalloc_objs(u32, num_engines); if (!engines) return -ENOMEM; @@ -3037,7 +3036,7 @@ static int hl_multi_cs_wait_ioctl(struct hl_fpriv *hpriv, void *data) /* allocate memory for sequence array */ cs_seq_arr = - kmalloc_array(seq_arr_len, sizeof(*cs_seq_arr), GFP_KERNEL); + kmalloc_objs(*cs_seq_arr, seq_arr_len); if (!cs_seq_arr) return -ENOMEM; diff --git a/drivers/accel/habanalabs/common/hwmon.c b/drivers/accel/habanalabs/common/hwmon.c index 768604d2392d..cf3b0d9c3dea 100644 --- a/drivers/accel/habanalabs/common/hwmon.c +++ b/drivers/accel/habanalabs/common/hwmon.c @@ -178,7 +178,7 @@ int hl_build_hwmon_channel_info(struct hl_device *hdev, struct cpucp_sensor *sen num_sensors_for_type = counts[i] + 1; dev_dbg(hdev->dev, "num_sensors_for_type %d = %d\n", i, num_sensors_for_type); - curr_arr = kcalloc(num_sensors_for_type, sizeof(*curr_arr), GFP_KERNEL); + curr_arr = kzalloc_objs(*curr_arr, num_sensors_for_type); if (!curr_arr) { rc = -ENOMEM; goto sensors_type_err; diff --git a/drivers/accel/habanalabs/common/memory.c b/drivers/accel/habanalabs/common/memory.c index 361cff577381..2f76776b4039 100644 --- a/drivers/accel/habanalabs/common/memory.c +++ b/drivers/accel/habanalabs/common/memory.c @@ -139,7 +139,7 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args, phys_pg_pack->flags = args->flags; phys_pg_pack->contiguous = contiguous; - phys_pg_pack->pages = kvmalloc_array(num_pgs, sizeof(u64), GFP_KERNEL); + phys_pg_pack->pages = kvmalloc_objs(u64, num_pgs); if (ZERO_OR_NULL_PTR(phys_pg_pack->pages)) { rc = -ENOMEM; goto pages_arr_err; @@ -885,8 +885,7 @@ static int init_phys_pg_pack_from_userptr(struct hl_ctx *ctx, page_mask = ~(((u64) page_size) - 1); - phys_pg_pack->pages = kvmalloc_array(total_npages, sizeof(u64), - GFP_KERNEL); + phys_pg_pack->pages = kvmalloc_objs(u64, total_npages); if (ZERO_OR_NULL_PTR(phys_pg_pack->pages)) { rc = -ENOMEM; goto page_pack_arr_mem_err; diff --git a/drivers/accel/habanalabs/gaudi/gaudi.c b/drivers/accel/habanalabs/gaudi/gaudi.c index 5ddb38aaff7a..21387d1f01c9 100644 --- a/drivers/accel/habanalabs/gaudi/gaudi.c +++ b/drivers/accel/habanalabs/gaudi/gaudi.c @@ -8989,14 +8989,12 @@ static int gaudi_print_fences_single_engine( int rc = -ENOMEM, i; u32 *statuses, *fences; - statuses = kcalloc(sds->props[SP_ENGINE_NUM_OF_QUEUES], - sizeof(*statuses), GFP_KERNEL); + statuses = kzalloc_objs(*statuses, sds->props[SP_ENGINE_NUM_OF_QUEUES]); if (!statuses) goto out; - fences = kcalloc(sds->props[SP_ENGINE_NUM_OF_FENCES] * - sds->props[SP_ENGINE_NUM_OF_QUEUES], - sizeof(*fences), GFP_KERNEL); + fences = kzalloc_objs(*fences, + sds->props[SP_ENGINE_NUM_OF_FENCES] * sds->props[SP_ENGINE_NUM_OF_QUEUES]); if (!fences) goto free_status; diff --git a/drivers/accel/habanalabs/gaudi2/gaudi2_security.c b/drivers/accel/habanalabs/gaudi2/gaudi2_security.c index ea3a0e57c836..744555165461 100644 --- a/drivers/accel/habanalabs/gaudi2/gaudi2_security.c +++ b/drivers/accel/habanalabs/gaudi2/gaudi2_security.c @@ -2717,7 +2717,7 @@ static int gaudi2_init_pb_sm_objs(struct hl_device *hdev) array_base = gaudi2_pb_dcr0_sm_objs.mm_block_base_addr + gaudi2_pb_dcr0_sm_objs.glbl_sec_offset; - sec_array = kcalloc(glbl_sec_array_len, sizeof(u32), GFP_KERNEL); + sec_array = kzalloc_objs(u32, glbl_sec_array_len); if (!sec_array) return -ENOMEM; diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c index b9b6efea43e8..3d1ba1aa7eea 100644 --- a/drivers/accel/ivpu/ivpu_job.c +++ b/drivers/accel/ivpu/ivpu_job.c @@ -914,7 +914,7 @@ static int ivpu_submit(struct drm_file *file, struct ivpu_file_priv *file_priv, u32 *buf_handles; int idx, ret; - buf_handles = kcalloc(buffer_count, sizeof(u32), GFP_KERNEL); + buf_handles = kzalloc_objs(u32, buffer_count); if (!buf_handles) return -ENOMEM; diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 15ab797641cf..50c98db57e4a 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -543,8 +543,7 @@ retry: pr_warn(FW_WARN "too many record IDs!\n"); return 0; } - new_entries = kvmalloc_array(new_size, sizeof(entries[0]), - GFP_KERNEL); + new_entries = kvmalloc_objs(entries[0], new_size); if (!new_entries) return -ENOMEM; memcpy(new_entries, entries, diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index 80e2e6b32ce3..05a547bbe936 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -913,9 +913,8 @@ static int cpc_register_non_mmio_desc(struct cpc_desc *cpc_desc) if (!found) return 0; - cpc_desc->non_mmio_nodes = kcalloc(nr_regs, - sizeof(*cpc_desc->non_mmio_nodes), - GFP_KERNEL); + cpc_desc->non_mmio_nodes = kzalloc_objs(*cpc_desc->non_mmio_nodes, + nr_regs); if (!cpc_desc->non_mmio_nodes) return -ENOMEM; @@ -1254,9 +1253,7 @@ static int cpc_register_sysmem_desc(struct cpc_desc *cpc_desc) if (!found) return 0; - cpc_desc->sysmem_nodes = kcalloc(nr_regs, - sizeof(*cpc_desc->sysmem_nodes), - GFP_KERNEL); + cpc_desc->sysmem_nodes = kzalloc_objs(*cpc_desc->sysmem_nodes, nr_regs); if (!cpc_desc->sysmem_nodes) return -ENOMEM; diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 8c5e47c28d9a..e51fc9f5e976 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -280,9 +280,8 @@ bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) &cpu_capacity); if (!ret) { if (!raw_capacity) { - raw_capacity = kcalloc(num_possible_cpus(), - sizeof(*raw_capacity), - GFP_KERNEL); + raw_capacity = kzalloc_objs(*raw_capacity, + num_possible_cpus()); if (!raw_capacity) { cap_parsing_failed = true; return false; @@ -333,8 +332,7 @@ static inline void topology_init_cpu_capacity_cppc(void) if (likely(!acpi_cpc_valid())) return; - raw_capacity = kcalloc(num_possible_cpus(), sizeof(*raw_capacity), - GFP_KERNEL); + raw_capacity = kzalloc_objs(*raw_capacity, num_possible_cpus()); if (!raw_capacity) return; diff --git a/drivers/base/regmap/regcache-maple.c b/drivers/base/regmap/regcache-maple.c index 16e488da5f23..b35ccc45e7fd 100644 --- a/drivers/base/regmap/regcache-maple.c +++ b/drivers/base/regmap/regcache-maple.c @@ -73,7 +73,7 @@ static int regcache_maple_write(struct regmap *map, unsigned int reg, rcu_read_unlock(); - entry = kmalloc_array(last - index + 1, sizeof(*entry), map->alloc_flags); + entry = kmalloc_objs(*entry, last - index + 1, map->alloc_flags); if (!entry) return -ENOMEM; @@ -340,7 +340,7 @@ static int regcache_maple_insert_block(struct regmap *map, int first, unsigned long *entry; int i, ret; - entry = kmalloc_array(last - first + 1, sizeof(*entry), map->alloc_flags); + entry = kmalloc_objs(*entry, last - first + 1, map->alloc_flags); if (!entry) return -ENOMEM; diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index e2feed6dbecf..80ceb97dfdb6 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c @@ -346,9 +346,9 @@ regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg) if (!rbnode->block) goto err_free; - rbnode->cache_present = kcalloc(BITS_TO_LONGS(rbnode->blklen), - sizeof(*rbnode->cache_present), - map->alloc_flags); + rbnode->cache_present = kzalloc_objs(*rbnode->cache_present, + BITS_TO_LONGS(rbnode->blklen), + map->alloc_flags); if (!rbnode->cache_present) goto err_free_block; diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 8e6d508c4fbd..c8fbcdf8f168 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -733,50 +733,44 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, return -ENOMEM; if (chip->num_main_regs) { - d->main_status_buf = kcalloc(chip->num_main_regs, - sizeof(*d->main_status_buf), - GFP_KERNEL); + d->main_status_buf = kzalloc_objs(*d->main_status_buf, + chip->num_main_regs); if (!d->main_status_buf) goto err_alloc; } - d->status_buf = kcalloc(chip->num_regs, sizeof(*d->status_buf), - GFP_KERNEL); + d->status_buf = kzalloc_objs(*d->status_buf, chip->num_regs); if (!d->status_buf) goto err_alloc; if (chip->status_is_level) { - d->prev_status_buf = kcalloc(chip->num_regs, sizeof(*d->prev_status_buf), - GFP_KERNEL); + d->prev_status_buf = kzalloc_objs(*d->prev_status_buf, + chip->num_regs); if (!d->prev_status_buf) goto err_alloc; } - d->mask_buf = kcalloc(chip->num_regs, sizeof(*d->mask_buf), - GFP_KERNEL); + d->mask_buf = kzalloc_objs(*d->mask_buf, chip->num_regs); if (!d->mask_buf) goto err_alloc; - d->mask_buf_def = kcalloc(chip->num_regs, sizeof(*d->mask_buf_def), - GFP_KERNEL); + d->mask_buf_def = kzalloc_objs(*d->mask_buf_def, chip->num_regs); if (!d->mask_buf_def) goto err_alloc; if (chip->wake_base) { - d->wake_buf = kcalloc(chip->num_regs, sizeof(*d->wake_buf), - GFP_KERNEL); + d->wake_buf = kzalloc_objs(*d->wake_buf, chip->num_regs); if (!d->wake_buf) goto err_alloc; } if (chip->type_in_mask) { - d->type_buf_def = kcalloc(chip->num_regs, - sizeof(*d->type_buf_def), GFP_KERNEL); + d->type_buf_def = kzalloc_objs(*d->type_buf_def, chip->num_regs); if (!d->type_buf_def) goto err_alloc; - d->type_buf = kcalloc(chip->num_regs, sizeof(*d->type_buf), GFP_KERNEL); + d->type_buf = kzalloc_objs(*d->type_buf, chip->num_regs); if (!d->type_buf) goto err_alloc; } @@ -785,15 +779,14 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, /* * Create config_buf[num_config_bases][num_config_regs] */ - d->config_buf = kcalloc(chip->num_config_bases, - sizeof(*d->config_buf), GFP_KERNEL); + d->config_buf = kzalloc_objs(*d->config_buf, + chip->num_config_bases); if (!d->config_buf) goto err_alloc; for (i = 0; i < chip->num_config_bases; i++) { - d->config_buf[i] = kcalloc(chip->num_config_regs, - sizeof(**d->config_buf), - GFP_KERNEL); + d->config_buf[i] = kzalloc_objs(**d->config_buf, + chip->num_config_regs); if (!d->config_buf[i]) goto err_alloc; } diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c index e668ad7963fc..7c8ba01c036c 100644 --- a/drivers/bcma/sprom.c +++ b/drivers/bcma/sprom.c @@ -620,7 +620,7 @@ int bcma_sprom_get(struct bcma_bus *bus) for (i = 0; i < ARRAY_SIZE(sprom_sizes); i++) { size_t words = sprom_sizes[i]; - sprom = kcalloc(words, sizeof(u16), GFP_KERNEL); + sprom = kzalloc_objs(u16, words); if (!sprom) return -ENOMEM; diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 099dff1ea256..890d1c898f23 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c @@ -473,8 +473,7 @@ static void drbd_calc_cpu_mask(cpumask_var_t *cpu_mask) { unsigned int *resources_per_cpu, min_index = ~0; - resources_per_cpu = kcalloc(nr_cpu_ids, sizeof(*resources_per_cpu), - GFP_KERNEL); + resources_per_cpu = kzalloc_objs(*resources_per_cpu, nr_cpu_ids); if (resources_per_cpu) { struct drbd_resource *resource; unsigned int cpu, min = ~0; diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index a405ccdf919e..3799b8dece37 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -4063,7 +4063,7 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info return config_unknown_volume(connection, pi); device = peer_device->device; - p_uuid = kmalloc_array(UI_EXTENDED_SIZE, sizeof(*p_uuid), GFP_NOIO); + p_uuid = kmalloc_objs(*p_uuid, UI_EXTENDED_SIZE, GFP_NOIO); if (!p_uuid) return false; diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 1f1c2810f6ee..54892ea50548 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1043,9 +1043,7 @@ static int rbd_header_from_disk(struct rbd_image_header *header, goto out_err; /* ...as well as the array of their sizes. */ - snap_sizes = kmalloc_array(snap_count, - sizeof(*header->snap_sizes), - GFP_KERNEL); + snap_sizes = kmalloc_objs(*header->snap_sizes, snap_count); if (!snap_sizes) goto out_err; diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index ad0cb42c1019..17d08c66d108 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -448,8 +448,7 @@ static int xlbd_reserve_minors(unsigned int minor, unsigned int nr) if (end > nr_minors) { unsigned long *bitmap, *old; - bitmap = kcalloc(BITS_TO_LONGS(end), sizeof(*bitmap), - GFP_KERNEL); + bitmap = kzalloc_objs(*bitmap, BITS_TO_LONGS(end)); if (bitmap == NULL) return -ENOMEM; diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c index 91b1ee9d6010..4178fd000fe7 100644 --- a/drivers/bluetooth/btintel_pcie.c +++ b/drivers/bluetooth/btintel_pcie.c @@ -793,7 +793,7 @@ static struct scatterlist *btintel_pcie_alloc_sgtable(ssize_t size) return NULL; nents = DIV_ROUND_UP(size, PAGE_SIZE); - result = kcalloc(nents, sizeof(*result), GFP_KERNEL); + result = kzalloc_objs(*result, nents); if (!result) return NULL; diff --git a/drivers/bus/mhi/ep/clients/loopback.c b/drivers/bus/mhi/ep/clients/loopback.c index c7452428d0b7..8da0c184aa3e 100644 --- a/drivers/bus/mhi/ep/clients/loopback.c +++ b/drivers/bus/mhi/ep/clients/loopback.c @@ -53,7 +53,7 @@ static void mhi_ep_loopback_ul_callback(struct mhi_ep_device *mhi_dev, if (!buf) return; - mhi_ep_lb_work = kmalloc_obj(*mhi_ep_lb_work, GFP_KERNEL); + mhi_ep_lb_work = kmalloc_obj(*mhi_ep_lb_work); if (!mhi_ep_lb_work) { kfree(buf); return; diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index 2361103c5edc..3a11fc4f3524 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c @@ -2033,8 +2033,7 @@ static unsigned short *ssif_address_list(void) list_for_each_entry(info, &ssif_infos, link) count++; - address_list = kcalloc(count + 1, sizeof(*address_list), - GFP_KERNEL); + address_list = kzalloc_objs(*address_list, count + 1); if (!address_list) return NULL; diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index dad26dd5e71d..b6e066de5f12 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -584,7 +584,7 @@ of_at91_clk_pll_get_characteristics(struct device_node *np) } if (num_cells > 3) { - icpll = kcalloc(num_output, sizeof(*icpll), GFP_KERNEL); + icpll = kzalloc_objs(*icpll, num_output); if (!icpll) goto out_free_output; } diff --git a/drivers/clk/at91/sam9x7.c b/drivers/clk/at91/sam9x7.c index 8b52da194849..946aa54dd2e8 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -907,8 +907,7 @@ static void __init sam9x7_pmc_setup(struct device_node *np) u8 num_parents = 4 + sam9x7_gck[i].pp_count; u32 *mux_table; - mux_table = kmalloc_array(num_parents, sizeof(*mux_table), - GFP_KERNEL); + mux_table = kmalloc_objs(*mux_table, num_parents); if (!mux_table) goto err_free; diff --git a/drivers/clk/at91/sama7d65.c b/drivers/clk/at91/sama7d65.c index ba8ff413fa2c..306667877e75 100644 --- a/drivers/clk/at91/sama7d65.c +++ b/drivers/clk/at91/sama7d65.c @@ -1227,8 +1227,7 @@ static void __init sama7d65_pmc_setup(struct device_node *np) struct clk_hw *tmp_parent_hws[8]; u32 *mux_table; - mux_table = kmalloc_array(num_parents, sizeof(*mux_table), - GFP_KERNEL); + mux_table = kmalloc_objs(*mux_table, num_parents); if (!mux_table) goto err_free; @@ -1328,8 +1327,7 @@ static void __init sama7d65_pmc_setup(struct device_node *np) struct clk_hw *tmp_parent_hws[8]; u32 *mux_table; - mux_table = kmalloc_array(num_parents, sizeof(*mux_table), - GFP_KERNEL); + mux_table = kmalloc_objs(*mux_table, num_parents); if (!mux_table) goto err_free; diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c index 1340c2b00619..b0b2b11ca1fd 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -1102,8 +1102,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np) struct clk_hw *tmp_parent_hws[8]; u32 *mux_table; - mux_table = kmalloc_array(num_parents, sizeof(*mux_table), - GFP_KERNEL); + mux_table = kmalloc_objs(*mux_table, num_parents); if (!mux_table) goto err_free; @@ -1198,8 +1197,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np) struct clk_hw *tmp_parent_hws[8]; u32 *mux_table; - mux_table = kmalloc_array(num_parents, sizeof(*mux_table), - GFP_KERNEL); + mux_table = kmalloc_objs(*mux_table, num_parents); if (!mux_table) goto err_free; diff --git a/drivers/clk/bcm/clk-kona-setup.c b/drivers/clk/bcm/clk-kona-setup.c index 338558f6fbae..a2bc7f07cc32 100644 --- a/drivers/clk/bcm/clk-kona-setup.c +++ b/drivers/clk/bcm/clk-kona-setup.c @@ -569,14 +569,12 @@ static u32 *parent_process(const char *clocks[], * selector is not required, but we allocate space for the * array anyway to keep things simple. */ - parent_names = kmalloc_array(parent_count, sizeof(*parent_names), - GFP_KERNEL); + parent_names = kmalloc_objs(*parent_names, parent_count); if (!parent_names) return ERR_PTR(-ENOMEM); /* There is at least one parent, so allocate a selector array */ - parent_sel = kmalloc_array(parent_count, sizeof(*parent_sel), - GFP_KERNEL); + parent_sel = kmalloc_objs(*parent_sel, parent_count); if (!parent_sel) { kfree(parent_names); diff --git a/drivers/clk/clk-conf.c b/drivers/clk/clk-conf.c index da66b9ae3de5..cf3a3f7f1223 100644 --- a/drivers/clk/clk-conf.c +++ b/drivers/clk/clk-conf.c @@ -91,7 +91,7 @@ static int __set_clk_rates(struct device_node *node, bool clk_supplier) count_64 = of_property_count_u64_elems(node, "assigned-clock-rates-u64"); if (count_64 > 0) { count = count_64; - rates_64 = kcalloc(count, sizeof(*rates_64), GFP_KERNEL); + rates_64 = kzalloc_objs(*rates_64, count); if (!rates_64) return -ENOMEM; @@ -99,7 +99,7 @@ static int __set_clk_rates(struct device_node *node, bool clk_supplier) "assigned-clock-rates-u64", rates_64, count); } else if (count > 0) { - rates = kcalloc(count, sizeof(*rates), GFP_KERNEL); + rates = kzalloc_objs(*rates, count); if (!rates) return -ENOMEM; diff --git a/drivers/clk/renesas/clk-div6.c b/drivers/clk/renesas/clk-div6.c index c23489900e96..dbc5714c148c 100644 --- a/drivers/clk/renesas/clk-div6.c +++ b/drivers/clk/renesas/clk-div6.c @@ -332,8 +332,7 @@ static void __init cpg_div6_clock_init(struct device_node *np) return; } - parent_names = kmalloc_array(num_parents, sizeof(*parent_names), - GFP_KERNEL); + parent_names = kmalloc_objs(*parent_names, num_parents); if (!parent_names) return; diff --git a/drivers/clk/sprd/pll.c b/drivers/clk/sprd/pll.c index 4aec30777d8a..e13d5e610ad0 100644 --- a/drivers/clk/sprd/pll.c +++ b/drivers/clk/sprd/pll.c @@ -104,7 +104,7 @@ static unsigned long _sprd_pll_recalc_rate(const struct sprd_pll *pll, u64 refin; u16 k1, k2; - cfg = kcalloc(regs_num, sizeof(*cfg), GFP_KERNEL); + cfg = kzalloc_objs(*cfg, regs_num); if (!cfg) return parent_rate; diff --git a/drivers/clk/sunxi/clk-sun8i-mbus.c b/drivers/clk/sunxi/clk-sun8i-mbus.c index fe7a0693b15d..8374de154c71 100644 --- a/drivers/clk/sunxi/clk-sun8i-mbus.c +++ b/drivers/clk/sunxi/clk-sun8i-mbus.c @@ -34,7 +34,7 @@ static void __init sun8i_a23_mbus_setup(struct device_node *node) void __iomem *reg; int err; - parents = kcalloc(num_parents, sizeof(*parents), GFP_KERNEL); + parents = kzalloc_objs(*parents, num_parents); if (!parents) return; diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c index 15b976162b59..b0d03229c3be 100644 --- a/drivers/clk/tegra/clk-bpmp.c +++ b/drivers/clk/tegra/clk-bpmp.c @@ -559,7 +559,7 @@ tegra_bpmp_clk_register(struct tegra_bpmp *bpmp, init.num_parents = info->num_parents; - parents = kcalloc(info->num_parents, sizeof(*parents), GFP_KERNEL); + parents = kzalloc_objs(*parents, info->num_parents); if (!parents) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c index 78655422253d..fcd77082d8b5 100644 --- a/drivers/clk/tegra/clk.c +++ b/drivers/clk/tegra/clk.c @@ -212,8 +212,7 @@ void tegra_clk_periph_resume(void) static int tegra_clk_periph_ctx_init(int banks) { - periph_state_ctx = kcalloc(2 * banks, sizeof(*periph_state_ctx), - GFP_KERNEL); + periph_state_ctx = kzalloc_objs(*periph_state_ctx, 2 * banks); if (!periph_state_ctx) return -ENOMEM; diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-atom.c index 43dda274e329..3a59f370cdea 100644 --- a/drivers/clk/x86/clk-pmc-atom.c +++ b/drivers/clk/x86/clk-pmc-atom.c @@ -273,8 +273,7 @@ static const char **plt_clk_register_parents(struct platform_device *pdev, if (!data->parents) return ERR_PTR(-ENOMEM); - parent_names = kcalloc(nparents, sizeof(*parent_names), - GFP_KERNEL); + parent_names = kzalloc_objs(*parent_names, nparents); if (!parent_names) return ERR_PTR(-ENOMEM); diff --git a/drivers/comedi/comedi_fops.c b/drivers/comedi/comedi_fops.c index 05d14839c5a6..9a65dc5d62a4 100644 --- a/drivers/comedi/comedi_fops.c +++ b/drivers/comedi/comedi_fops.c @@ -1677,8 +1677,7 @@ static int do_insnlist_ioctl(struct comedi_device *dev, } /* Allocate scratch space for all instruction data. */ - data = kmalloc_array(max_n_data_required, sizeof(unsigned int), - GFP_KERNEL); + data = kmalloc_objs(unsigned int, max_n_data_required); if (!data) { ret = -ENOMEM; goto error; @@ -1768,7 +1767,7 @@ static int do_insn_ioctl(struct comedi_device *dev, n_data = MAX_SAMPLES; } - data = kmalloc_array(n_data, sizeof(unsigned int), GFP_KERNEL); + data = kmalloc_objs(unsigned int, n_data); if (!data) { ret = -ENOMEM; goto error; diff --git a/drivers/comedi/drivers.c b/drivers/comedi/drivers.c index e78ad565f8f3..3f75485338a1 100644 --- a/drivers/comedi/drivers.c +++ b/drivers/comedi/drivers.c @@ -142,7 +142,7 @@ int comedi_alloc_subdev_readback(struct comedi_subdevice *s) if (!s->n_chan) return -EINVAL; - s->readback = kcalloc(s->n_chan, sizeof(*s->readback), GFP_KERNEL); + s->readback = kzalloc_objs(*s->readback, s->n_chan); if (!s->readback) return -ENOMEM; diff --git a/drivers/comedi/drivers/amplc_pci224.c b/drivers/comedi/drivers/amplc_pci224.c index 55292a28f28c..6c3356531e95 100644 --- a/drivers/comedi/drivers/amplc_pci224.c +++ b/drivers/comedi/drivers/amplc_pci224.c @@ -1024,9 +1024,8 @@ pci224_auto_attach(struct comedi_device *dev, unsigned long context_model) irq = pci_dev->irq; /* Allocate buffer to hold values for AO channel scan. */ - devpriv->ao_scan_vals = kmalloc_array(board->ao_chans, - sizeof(devpriv->ao_scan_vals[0]), - GFP_KERNEL); + devpriv->ao_scan_vals = kmalloc_objs(devpriv->ao_scan_vals[0], + board->ao_chans); if (!devpriv->ao_scan_vals) return -ENOMEM; diff --git a/drivers/comedi/drivers/das1800.c b/drivers/comedi/drivers/das1800.c index 7d7ea99a81aa..c68dd98f4850 100644 --- a/drivers/comedi/drivers/das1800.c +++ b/drivers/comedi/drivers/das1800.c @@ -1228,9 +1228,7 @@ static int das1800_attach(struct comedi_device *dev, if (dev->irq & it->options[2]) das1800_init_dma(dev, it); - devpriv->fifo_buf = kmalloc_array(FIFO_SIZE, - sizeof(*devpriv->fifo_buf), - GFP_KERNEL); + devpriv->fifo_buf = kmalloc_objs(*devpriv->fifo_buf, FIFO_SIZE); if (!devpriv->fifo_buf) return -ENOMEM; diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c index 4a6f4d9043e9..9dee341b407e 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c @@ -1048,7 +1048,7 @@ static int init_chip_info(void) cpumask_t *chip_cpu_mask; int ret = 0; - chip = kcalloc(num_possible_cpus(), sizeof(*chip), GFP_KERNEL); + chip = kzalloc_objs(*chip, num_possible_cpus()); if (!chip) return -ENOMEM; diff --git a/drivers/cpuidle/dt_idle_genpd.c b/drivers/cpuidle/dt_idle_genpd.c index ed41a90eeeb7..7e5533fe38f2 100644 --- a/drivers/cpuidle/dt_idle_genpd.c +++ b/drivers/cpuidle/dt_idle_genpd.c @@ -33,7 +33,7 @@ static int pd_parse_state_nodes( if (ret) goto free_state; - state_buf = kmalloc(sizeof(u32), GFP_KERNEL); + state_buf = kmalloc_obj(u32); if (!state_buf) { ret = -ENOMEM; goto free_state; diff --git a/drivers/crypto/hisilicon/debugfs.c b/drivers/crypto/hisilicon/debugfs.c index 3ee6de16e3f1..1f18309f856e 100644 --- a/drivers/crypto/hisilicon/debugfs.c +++ b/drivers/crypto/hisilicon/debugfs.c @@ -915,7 +915,7 @@ static int qm_last_regs_init(struct hisi_qm *qm) if (qm->fun_type == QM_HW_VF) return 0; - debug->qm_last_words = kcalloc(dfx_regs_num, sizeof(unsigned int), GFP_KERNEL); + debug->qm_last_words = kzalloc_objs(unsigned int, dfx_regs_num); if (!debug->qm_last_words) return -ENOMEM; diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 7d13476451e3..ce6266fcd74d 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -3117,8 +3117,7 @@ static int hisi_qp_memory_init(struct hisi_qm *qm, size_t dma_size, int id, struct hisi_qp *qp; int ret = -ENOMEM; - qm->poll_data[id].qp_finish_id = kcalloc(qm->qp_num, sizeof(u16), - GFP_KERNEL); + qm->poll_data[id].qp_finish_id = kzalloc_objs(u16, qm->qp_num); if (!qm->poll_data[id].qp_finish_id) return -ENOMEM; diff --git a/drivers/crypto/intel/qat/qat_common/adf_tl_debugfs.c b/drivers/crypto/intel/qat/qat_common/adf_tl_debugfs.c index b81f70576683..044939c9f3ed 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_tl_debugfs.c +++ b/drivers/crypto/intel/qat/qat_common/adf_tl_debugfs.c @@ -114,8 +114,7 @@ static int tl_calc_count(struct adf_telemetry *telemetry, int sample_cnt; int ret = 0; - hist_vals = kmalloc_array(tl_data->num_hbuff, sizeof(*hist_vals), - GFP_KERNEL); + hist_vals = kmalloc_objs(*hist_vals, tl_data->num_hbuff); if (!hist_vals) return -ENOMEM; @@ -171,11 +170,11 @@ static int tl_lat_acc_avg(struct adf_telemetry *telemetry, u64 *hist_cnt; int ret = 0; - hist_vals = kmalloc_array(num_hbuff, sizeof(*hist_vals), GFP_KERNEL); + hist_vals = kmalloc_objs(*hist_vals, num_hbuff); if (!hist_vals) return -ENOMEM; - hist_cnt = kmalloc_array(num_hbuff, sizeof(*hist_cnt), GFP_KERNEL); + hist_cnt = kmalloc_objs(*hist_cnt, num_hbuff); if (!hist_cnt) { ret = -ENOMEM; goto out_free_hist_vals; @@ -220,8 +219,7 @@ static int tl_bw_hw_units_to_mbps(struct adf_telemetry *telemetry, int sample_cnt; int ret = 0; - hist_vals = kmalloc_array(tl_data->num_hbuff, sizeof(*hist_vals), - GFP_KERNEL); + hist_vals = kmalloc_objs(*hist_vals, tl_data->num_hbuff); if (!hist_vals) return -ENOMEM; diff --git a/drivers/crypto/intel/qat/qat_common/qat_hal.c b/drivers/crypto/intel/qat/qat_common/qat_hal.c index 1c3d1311f1c7..2251418cce97 100644 --- a/drivers/crypto/intel/qat/qat_common/qat_hal.c +++ b/drivers/crypto/intel/qat/qat_common/qat_hal.c @@ -1304,8 +1304,7 @@ int qat_hal_batch_wr_lm(struct icp_qat_fw_loader_handle *handle, alloc_inst_size = lm_init_header->size; if ((unsigned int)alloc_inst_size > handle->hal_handle->max_ustore) alloc_inst_size = handle->hal_handle->max_ustore; - micro_inst_arry = kmalloc_array(alloc_inst_size, sizeof(u64), - GFP_KERNEL); + micro_inst_arry = kmalloc_objs(u64, alloc_inst_size); if (!micro_inst_arry) return -ENOMEM; micro_inst_num = 0; diff --git a/drivers/crypto/intel/qat/qat_common/qat_uclo.c b/drivers/crypto/intel/qat/qat_common/qat_uclo.c index a00ca2a0900f..196f71fc1095 100644 --- a/drivers/crypto/intel/qat/qat_common/qat_uclo.c +++ b/drivers/crypto/intel/qat/qat_common/qat_uclo.c @@ -373,8 +373,7 @@ static int qat_uclo_init_ustore(struct icp_qat_fw_loader_handle *handle, u64 *fill_data; uof_image = image->img_ptr; - fill_data = kcalloc(ICP_QAT_UCLO_MAX_USTORE, sizeof(u64), - GFP_KERNEL); + fill_data = kzalloc_objs(u64, ICP_QAT_UCLO_MAX_USTORE); if (!fill_data) return -ENOMEM; for (i = 0; i < ICP_QAT_UCLO_MAX_USTORE; i++) @@ -994,8 +993,7 @@ static int qat_uclo_parse_uof_obj(struct icp_qat_fw_loader_handle *handle) pr_err("UOF incompatible\n"); return -EINVAL; } - obj_handle->uword_buf = kcalloc(UWORD_CPYBUF_SIZE, sizeof(u64), - GFP_KERNEL); + obj_handle->uword_buf = kzalloc_objs(u64, UWORD_CPYBUF_SIZE); if (!obj_handle->uword_buf) return -ENOMEM; obj_handle->ustore_phy_size = ICP_QAT_UCLO_MAX_USTORE; diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 74dd4cbdc3c0..35fc4d3ea500 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -3663,9 +3663,7 @@ static int __init d40_lcla_allocate(struct d40_base *base) * To full fill this hardware requirement without wasting 256 kb * we allocate pages until we get an aligned one. */ - page_list = kmalloc_array(MAX_LCLA_ALLOC_ATTEMPTS, - sizeof(*page_list), - GFP_KERNEL); + page_list = kmalloc_objs(*page_list, MAX_LCLA_ALLOC_ATTEMPTS); if (!page_list) return -ENOMEM; diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c index d97db5af3555..51935eb6f827 100644 --- a/drivers/dma/ti/edma.c +++ b/drivers/dma/ti/edma.c @@ -2186,7 +2186,7 @@ static struct edma_soc_info *edma_setup_info_from_dt(struct device *dev, if (!nelm) return info; - tmp = kcalloc(nelm, sizeof(*tmp), GFP_KERNEL); + tmp = kzalloc_objs(*tmp, nelm); if (!tmp) return ERR_PTR(-ENOMEM); diff --git a/drivers/dpll/zl3073x/prop.c b/drivers/dpll/zl3073x/prop.c index 4e006ed5950a..37e633fa5a72 100644 --- a/drivers/dpll/zl3073x/prop.c +++ b/drivers/dpll/zl3073x/prop.c @@ -297,7 +297,7 @@ struct zl3073x_pin_props *zl3073x_pin_props_get(struct zl3073x_dev *zldev, * DPLL core pin properties requires list of frequency ranges. * So read the frequency list into temporary array. */ - freqs = kcalloc(num_freqs, sizeof(*freqs), GFP_KERNEL); + freqs = kzalloc_objs(*freqs, num_freqs); if (!freqs) { rc = -ENOMEM; goto err_alloc_freqs; diff --git a/drivers/edac/skx_common.c b/drivers/edac/skx_common.c index bfd0cd1689ed..f1f9a7902e34 100644 --- a/drivers/edac/skx_common.c +++ b/drivers/edac/skx_common.c @@ -363,8 +363,7 @@ int skx_adxl_get(void) while (*names++) adxl_component_count++; - adxl_values = kcalloc(adxl_component_count, sizeof(*adxl_values), - GFP_KERNEL); + adxl_values = kzalloc_objs(*adxl_values, adxl_component_count); if (!adxl_values) { adxl_component_count = 0; return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/pinctrl.c b/drivers/firmware/arm_scmi/pinctrl.c index 42cb1aef1fe1..cc45eaa0018a 100644 --- a/drivers/firmware/arm_scmi/pinctrl.c +++ b/drivers/firmware/arm_scmi/pinctrl.c @@ -620,9 +620,7 @@ static int scmi_pinctrl_get_group_info(const struct scmi_protocol_handle *ph, return -ENODATA; } - group->group_pins = kmalloc_array(group->nr_pins, - sizeof(*group->group_pins), - GFP_KERNEL); + group->group_pins = kmalloc_objs(*group->group_pins, group->nr_pins); if (!group->group_pins) return -ENOMEM; @@ -699,8 +697,7 @@ static int scmi_pinctrl_get_function_info(const struct scmi_protocol_handle *ph, return -ENODATA; } - func->groups = kmalloc_array(func->nr_groups, sizeof(*func->groups), - GFP_KERNEL); + func->groups = kmalloc_objs(*func->groups, func->nr_groups); if (!func->groups) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/transports/pcc.c b/drivers/firmware/arm_scmi/transports/pcc.c index 86d4a097d8ec..26942e0402e3 100644 --- a/drivers/firmware/arm_scmi/transports/pcc.c +++ b/drivers/firmware/arm_scmi/transports/pcc.c @@ -266,7 +266,7 @@ acpi_scmi_dsd_parse_transport_package(struct pcc_transport_map *map, } } - p = kzalloc(sizeof(*p), GFP_KERNEL); + p = kzalloc_obj(*p); if (!p) return -ENOMEM; @@ -580,7 +580,7 @@ struct pcc_transport_map *pcc_transport_map_get(struct fwnode_handle *fwnode) if (map) return map; - map = kzalloc_obj(*map, GFP_KERNEL); + map = kzalloc_obj(*map); if (!map) return ERR_PTR(-ENOMEM); diff --git a/drivers/firmware/coreboot/coreboot-cfr.c b/drivers/firmware/coreboot/coreboot-cfr.c index 2d9ea5d213d8..c30e6075f396 100644 --- a/drivers/firmware/coreboot/coreboot-cfr.c +++ b/drivers/firmware/coreboot/coreboot-cfr.c @@ -293,7 +293,7 @@ static efi_char16_t *coreboot_cfr_efi_name(const char *name) return ERR_PTR(-ENAMETOOLONG); efi_char16_t *efi_name __free(kfree) = - kcalloc(len + 1, sizeof(*efi_name), GFP_KERNEL); + kzalloc_objs(*efi_name, len + 1); if (!efi_name) return ERR_PTR(-ENOMEM); @@ -724,8 +724,8 @@ static int coreboot_cfr_copy_bool_values(struct coreboot_cfr_setting *setting) }; unsigned int i; - setting->values = kcalloc(ARRAY_SIZE(bool_values), sizeof(*setting->values), - GFP_KERNEL); + setting->values = kzalloc_objs(*setting->values, + ARRAY_SIZE(bool_values)); if (!setting->values) return -ENOMEM; @@ -779,7 +779,7 @@ static int coreboot_cfr_copy_enum_values(struct coreboot_cfr_setting *setting, if (count <= 0) return count ?: -EINVAL; - setting->values = kcalloc(count, sizeof(*setting->values), GFP_KERNEL); + setting->values = kzalloc_objs(*setting->values, count); if (!setting->values) return -ENOMEM; @@ -902,7 +902,7 @@ static int coreboot_cfr_add_numeric_option(struct coreboot_cfr_drvdata *data, if (option->dependency_id) return 0; - setting = kzalloc_obj(*setting, GFP_KERNEL); + setting = kzalloc_obj(*setting); if (!setting) return -ENOMEM; diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c index 88391ea161ed..993b857f3b75 100644 --- a/drivers/firmware/stratix10-svc.c +++ b/drivers/firmware/stratix10-svc.c @@ -1516,7 +1516,7 @@ int stratix10_svc_async_send(struct stratix10_svc_chan *chan, void *msg, return -EINVAL; } - handle = kzalloc(sizeof(*handle), GFP_KERNEL); + handle = kzalloc_obj(*handle); if (!handle) return -ENOMEM; diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index 5fa63ff7c74a..fc513157f18f 100644 --- a/drivers/firmware/ti_sci.c +++ b/drivers/firmware/ti_sci.c @@ -3759,7 +3759,7 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle, return ERR_PTR(sets); } - sub_types = kcalloc(sets, sizeof(*sub_types), GFP_KERNEL); + sub_types = kzalloc_objs(*sub_types, sets); if (!sub_types) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpio/gpio-it87.c b/drivers/gpio/gpio-it87.c index 699325129a7d..2585253d36ea 100644 --- a/drivers/gpio/gpio-it87.c +++ b/drivers/gpio/gpio-it87.c @@ -362,8 +362,7 @@ static int __init it87_gpio_init(void) */ labels = kcalloc(it87_gpio->chip.ngpio, sizeof("it87_gpXY"), GFP_KERNEL); - labels_table = kcalloc(it87_gpio->chip.ngpio, sizeof(*labels_table), - GFP_KERNEL); + labels_table = kzalloc_objs(*labels_table, it87_gpio->chip.ngpio); if (!labels || !labels_table) { rc = -ENOMEM; diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c index 0c73bec04267..1de940bec11a 100644 --- a/drivers/gpio/gpio-sim.c +++ b/drivers/gpio/gpio-sim.c @@ -803,7 +803,7 @@ gpio_sim_make_bank_swnode(struct gpio_sim_bank *bank, ranges_size = gpio_sim_get_reserved_ranges_size(bank); if (ranges_size) { - ranges = kcalloc(ranges_size, sizeof(u32), GFP_KERNEL); + ranges = kzalloc_objs(u32, ranges_size); if (!ranges) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index fbdeda2f2787..848348f8f1ef 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -664,7 +664,7 @@ static int gpiochip_set_names(struct gpio_chip *chip) return 0; } - names = kcalloc(count, sizeof(*names), GFP_KERNEL); + names = kzalloc_objs(*names, count); if (!names) return -ENOMEM; @@ -750,7 +750,7 @@ static int gpiochip_apply_reserved_ranges(struct gpio_chip *gc) if (size == 0) return 0; - ranges = kmalloc_array(size, sizeof(*ranges), GFP_KERNEL); + ranges = kmalloc_objs(*ranges, size); if (!ranges) return -ENOMEM; diff --git a/drivers/gpu/buddy.c b/drivers/gpu/buddy.c index 503f7d5934e4..6d5b92cae875 100644 --- a/drivers/gpu/buddy.c +++ b/drivers/gpu/buddy.c @@ -876,21 +876,17 @@ int gpu_buddy_init(struct gpu_buddy *mm, u64 size, u64 chunk_size) BUG_ON(mm->max_order > GPU_BUDDY_MAX_ORDER); - mm->free_scoreboard = kcalloc(mm->max_order + 1, - sizeof(*mm->free_scoreboard), - GFP_KERNEL); + mm->free_scoreboard = kzalloc_objs(*mm->free_scoreboard, + mm->max_order + 1); if (!mm->free_scoreboard) return -ENOMEM; - mm->used_scoreboard = kcalloc(mm->max_order + 1, - sizeof(*mm->used_scoreboard), - GFP_KERNEL); + mm->used_scoreboard = kzalloc_objs(*mm->used_scoreboard, + mm->max_order + 1); if (!mm->used_scoreboard) goto out_free_free_scoreboard; - mm->free_tree = kcalloc(mm->max_order + 1, - sizeof(struct rb_root), - GFP_KERNEL); + mm->free_tree = kzalloc_objs(struct rb_root, mm->max_order + 1); if (!mm->free_tree) goto out_free_used_scoreboard; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index 3a4b3424b5b2..5561d6a8b1a3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -916,7 +916,7 @@ static int kfd_mem_attach(struct amdgpu_device *adev, struct kgd_mem *mem, } for (i = 0; i <= is_aql; i++) { - attachment[i] = kzalloc(sizeof(*attachment[i]), GFP_KERNEL); + attachment[i] = kzalloc_obj(*attachment[i]); if (unlikely(!attachment[i])) { ret = -ENOMEM; goto unwind; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c index 3dc95d9accf2..80a90dc70ffa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c @@ -1002,7 +1002,7 @@ static ssize_t amdgpu_debugfs_gca_config_read(struct file *f, char __user *buf, if (size & 0x3 || *pos & 0x3) return -EINVAL; - config = kmalloc_array(256, sizeof(*config), GFP_KERNEL); + config = kmalloc_objs(*config, 256); if (!config) return -ENOMEM; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index 3962b9f08dd6..d6af393eb5e9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -1162,7 +1162,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data, goto out_exec; } - vm_entries = kvcalloc(args->num_entries, sizeof(*vm_entries), GFP_KERNEL); + vm_entries = kvzalloc_objs(*vm_entries, args->num_entries); if (!vm_entries) { r = -ENOMEM; goto out_exec; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c index a7d13e337d84..7badbdf2252c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c @@ -177,7 +177,7 @@ int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier, unsigned long end; int r; - pfns = kvmalloc_array(npages, sizeof(*pfns), GFP_KERNEL); + pfns = kvmalloc_objs(*pfns, npages); if (unlikely(!pfns)) { r = -ENOMEM; goto out_free_range; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 59ea7af5b0e4..335c523592bf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -919,8 +919,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) if (ret) return ret; - regs = kmalloc_array(info->read_mmr_reg.count, sizeof(*regs), - GFP_KERNEL); + regs = kmalloc_objs(*regs, info->read_mmr_reg.count); if (!regs) return -ENOMEM; @@ -1518,7 +1517,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) if (r < 0) goto pm_put; - fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); + fpriv = kzalloc_obj(*fpriv); if (unlikely(!fpriv)) { r = -ENOMEM; goto out_suspend; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index 47e852c15c36..068b2cc723aa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -244,7 +244,7 @@ static int amdgpu_check_address_validity(struct amdgpu_device *adev, (address >= RAS_UMC_INJECT_ADDR_LIMIT)) return -EFAULT; - page_pfns = kcalloc(nr_page_pfns, sizeof(*page_pfns), GFP_KERNEL); + page_pfns = kzalloc_objs(*page_pfns, nr_page_pfns); if (!page_pfns) return -ENOMEM; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c index 6cd3927a7e82..d427c8318dc0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c @@ -1534,10 +1534,10 @@ int ualink_ip_sw_init(struct amdgpu_ip_block *ip_block) struct amdgpu_device *adev = ip_block->adev; struct amdgpu_ualink_info *info; - info = kzalloc(sizeof(*info), GFP_KERNEL); - ppod_setup = kzalloc(sizeof(*ppod_setup), GFP_KERNEL); - vpod_config = kzalloc(sizeof(*vpod_config), GFP_KERNEL); - stations = kzalloc(sizeof(*stations), GFP_KERNEL); + info = kzalloc_obj(*info); + ppod_setup = kzalloc_obj(*ppod_setup); + vpod_config = kzalloc_obj(*vpod_config); + stations = kzalloc_obj(*stations); if (!info || !ppod_setup || !vpod_config || !stations) { kfree(info); kfree(ppod_setup); @@ -3555,7 +3555,7 @@ static void amdgpu_ualink_process_npa_req_msg(struct amdgpu_device *adev, range_end = 0; } - mm_node = kzalloc(sizeof(*mm_node), GFP_KERNEL); + mm_node = kzalloc_obj(*mm_node); if (!mm_node) { dev_warn(adev->dev, "NPA-REQ: mm_node alloc failed handle:%llx:%llx\n", @@ -3926,7 +3926,7 @@ int amdgpu_ualink_import_handle(struct drm_device *dev, * to the NPA address. * First store the entry in the Xarray. */ - imp_xa_node = kzalloc(sizeof(*imp_xa_node), GFP_KERNEL); + imp_xa_node = kzalloc_obj(*imp_xa_node); if (!imp_xa_node) { r = -ENOMEM; goto out; @@ -4030,7 +4030,7 @@ int amdgpu_ualink_export_handle(struct drm_device *dev, struct drm_file *filp, /* If no ualink handle generated for BO, then generate one and * add it to the exporter Xarray. */ - exp_xa_node = kzalloc(sizeof(*exp_xa_node), GFP_KERNEL); + exp_xa_node = kzalloc_obj(*exp_xa_node); if (!exp_xa_node) { dev_err(adev->dev, "Failed to allocate exp_xa_node\n"); r = -ENOMEM; @@ -5181,7 +5181,7 @@ static int amdgpu_ualink_gart_map(struct amdgpu_device *adev, u64 npages, dev_dbg(adev->dev, "npa 0x%llx npages 0x%llx\n", npa, npages); if (npages > 1) { - dma_addr = kmalloc_array(npages, sizeof(*dma_addr), GFP_KERNEL); + dma_addr = kmalloc_objs(*dma_addr, npages); if (!dma_addr) return -ENOMEM; @@ -6328,7 +6328,7 @@ int amdgpu_ualink_sw_init(struct amdgpu_device *adev) struct amdgpu_ualink_remote *remote; int r; - remote = kzalloc(sizeof(*remote), GFP_KERNEL); + remote = kzalloc_obj(*remote); if (!remote) return -ENOMEM; adev->ualink.remote = remote; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c index c1257f530e9a..b7cebe392108 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c @@ -505,8 +505,7 @@ int amdgpu_userq_signal_ioctl(struct drm_device *dev, void *data, syncobj_points = NULL; } - syncobj = kmalloc_array(num_syncobj_handles, sizeof(*syncobj), - GFP_KERNEL); + syncobj = kmalloc_objs(*syncobj, num_syncobj_handles); if (!syncobj) { r = -ENOMEM; goto free_syncobj_points; @@ -765,13 +764,11 @@ amdgpu_userq_wait_return_fence_info(struct drm_device *dev, struct drm_file *fil struct drm_exec exec; int i, cnt, r; - fence_info = kmalloc_array(wait_info->num_fences, sizeof(*fence_info), - GFP_KERNEL); + fence_info = kmalloc_objs(*fence_info, wait_info->num_fences); if (!fence_info) return -ENOMEM; - fences = kmalloc_array(wait_info->num_fences, sizeof(*fences), - GFP_KERNEL); + fences = kmalloc_objs(*fences, wait_info->num_fences); if (!fences) { r = -ENOMEM; goto free_fence_info; diff --git a/drivers/gpu/drm/amd/amdgpu/soc_v1_0.c b/drivers/gpu/drm/amd/amdgpu/soc_v1_0.c index 506060fc5368..b83e4e0c4309 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/soc_v1_0.c @@ -751,7 +751,7 @@ int soc_v1_0_reset_init(struct amdgpu_device *adev) { struct amdgpu_reset_control *reset_ctl; - reset_ctl = kzalloc_obj(*reset_ctl, GFP_KERNEL); + reset_ctl = kzalloc_obj(*reset_ctl); if (!reset_ctl) return -ENOMEM; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index ce67e56efa8c..61480e9119b8 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -1848,8 +1848,8 @@ static int initialize_nocpsch(struct device_queue_manager *dqm) pr_debug("num of pipes: %d\n", get_pipes_per_mec(dqm)); - dqm->allocated_queues = kcalloc(get_pipes_per_mec(dqm), - sizeof(unsigned int), GFP_KERNEL); + dqm->allocated_queues = kzalloc_objs(unsigned int, + get_pipes_per_mec(dqm)); if (!dqm->allocated_queues) return -ENOMEM; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c index 33f0ecbe6b0a..748c23ec7183 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c @@ -150,7 +150,7 @@ static struct kfd_mem_obj *allocate_mqd(struct mqd_manager *mm, mqd_size *= NUM_XCC(node->xcc_mask); if (node->kfd->cwsr_enabled && (q->type == KFD_QUEUE_TYPE_COMPUTE)) { - mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL); + mqd_mem_obj = kzalloc_obj(struct kfd_mem_obj); if (!mqd_mem_obj) return NULL; retval = amdgpu_amdkfd_alloc_kernel_mem(node->adev, diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c index 5fdf8ce023b9..f09e2a72c534 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c @@ -7646,7 +7646,7 @@ dm_test_uad_ctx_alloc(struct kunit *test, int connector_type) /* A real (non-kunit) sink the function is expected to free via dc_sink_release. */ static struct dc_sink *dm_test_uad_owned_sink(void) { - struct dc_sink *sink = kzalloc_obj(*sink, GFP_KERNEL); + struct dc_sink *sink = kzalloc_obj(*sink); if (sink) kref_init(&sink->refcount); @@ -7758,7 +7758,7 @@ static void dm_test_update_after_detect_disconnect(struct kunit *test) struct dm_test_uad_ctx *ctx = dm_test_uad_ctx_alloc(test, DRM_MODE_CONNECTOR_HDMIA); struct dc_sink *old_sink = dm_test_uad_owned_sink(); - struct dc_crtc_timing *timing = kzalloc_obj(*timing, GFP_KERNEL); + struct dc_crtc_timing *timing = kzalloc_obj(*timing); KUNIT_ASSERT_NOT_NULL(test, old_sink); KUNIT_ASSERT_NOT_NULL(test, timing); diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c index 489dd56474b9..abdcf8fd808b 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c @@ -1628,7 +1628,7 @@ static void dm_test_crtc_destroy_cleans_up_and_frees(struct kunit *test) KUNIT_ASSERT_NOT_ERR_OR_NULL(test, plane); /* amdgpu_dm_crtc_destroy() kfree()s the CRTC, so use a plain alloc. */ - acrtc = kzalloc_obj(*acrtc, GFP_KERNEL); + acrtc = kzalloc_obj(*acrtc); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, acrtc); ret = drm_crtc_init_with_planes(&adev->ddev, &acrtc->base, plane, @@ -1695,7 +1695,7 @@ static void dm_test_crtc_reset_state_replaces_existing(struct kunit *test) kref_get(&stream->refcount); /* reset_state kfree()s the old state, so use a plain (unmanaged) alloc. */ - old = kzalloc_obj(*old, GFP_KERNEL); + old = kzalloc_obj(*old); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, old); old->stream = stream; crtc->state = &old->base; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c index 6e599657dac1..8a0d68fc74d0 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c @@ -2293,7 +2293,7 @@ dm_test_setup_hpd_rx_offload_work(struct kunit *test, link->connector_signal = SIGNAL_TYPE_DISPLAY_PORT; aconn->dc_link = link; - offload_work = kzalloc_obj(*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; @@ -3766,7 +3766,7 @@ static void dm_test_pflip_high_irq_completes_flip(struct kunit *test) acrtc->pflip_status = AMDGPU_FLIP_SUBMITTED; /* 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->event = event; @@ -3842,7 +3842,7 @@ static void dm_test_pflip_high_irq_vrr_no_scanoutpos(struct kunit *test) adev = drm_to_adev(acrtc->base.dev); /* 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->event = event; @@ -3882,7 +3882,7 @@ static void dm_test_pflip_high_irq_vrr_front_porch(struct kunit *test) acrtc = dm_test_setup_vrr_pflip_crtc(test, tg); adev = drm_to_adev(acrtc->base.dev); - event = kzalloc_obj(*event, GFP_KERNEL); + event = kzalloc_obj(*event); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, event); acrtc->event = event; @@ -3943,7 +3943,7 @@ static void dm_test_vupdate_high_irq_dcn_completes_flip(struct kunit *test) acrtc = dm_test_add_crtc(test, adev); acrtc->pflip_status = AMDGPU_FLIP_SUBMITTED; - event = kzalloc_obj(*event, GFP_KERNEL); + event = kzalloc_obj(*event); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, event); acrtc->event = event; @@ -4217,7 +4217,7 @@ static void dm_test_crtc_high_irq_writeback_completes(struct kunit *test) * The job carries no framebuffer or fence, so the deferred DRM cleanup * work only kfree()s it; it needs nothing from this test. */ - job = kzalloc_obj(*job, GFP_KERNEL); + job = kzalloc_obj(*job); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, job); list_add_tail(&job->list_entry, &wb_conn->job_queue); @@ -4309,7 +4309,7 @@ static void dm_test_handle_hpd_work_null_notify(struct kunit *test) struct amdgpu_device *adev; adev = dm_kunit_alloc_adev(test); - hpd_work = kzalloc_obj(*hpd_work, GFP_KERNEL); + hpd_work = kzalloc_obj(*hpd_work); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hpd_work); hpd_work->adev = adev; INIT_WORK(&hpd_work->handle_hpd_work, dm_handle_hpd_work); diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c index 7422e8ba9564..1f5ee7a0d741 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c @@ -765,7 +765,7 @@ static void dm_test_add_modifier_appends_and_grows(struct kunit *test) size = 1; cap = 1; - mods = kmalloc_array(cap, sizeof(*mods), GFP_KERNEL); + mods = kmalloc_objs(*mods, cap); KUNIT_ASSERT_NOT_NULL(test, mods); mods[0] = 0xAAULL; @@ -803,7 +803,7 @@ static void dm_test_add_modifier_failure_paths(struct kunit *test) /* Doubling this capacity overflows the kmalloc_array() size product. */ cap = 1ULL << 62; size = cap; - mods = kmalloc_array(1, sizeof(*mods), GFP_KERNEL); + mods = kmalloc_objs(*mods, 1); KUNIT_ASSERT_NOT_NULL(test, mods); amdgpu_dm_plane_add_modifier(&mods, &size, &cap, 0x1234ULL); @@ -2448,7 +2448,7 @@ static void dm_test_plane_destroy_state_releases_resources(struct kunit *test) KUNIT_ASSERT_NOT_NULL(test, dc_plane_state); /* destroy_state frees the state itself, so use a plain allocation. */ - dm_plane_state = kzalloc_obj(*dm_plane_state, GFP_KERNEL); + dm_plane_state = kzalloc_obj(*dm_plane_state); KUNIT_ASSERT_NOT_NULL(test, dm_plane_state); /* Hold an extra reference so the release does not free KUnit memory. */ @@ -3187,7 +3187,7 @@ static struct drm_plane *dm_test_alloc_init_plane(struct kunit *test, adev->dm.adev = adev; adev->dm.dc = dm_kunit_alloc_dc_with_ctx(test); - plane = kzalloc_obj(*plane, GFP_KERNEL); + plane = kzalloc_obj(*plane); KUNIT_ASSERT_NOT_NULL(test, plane); plane->type = DRM_PLANE_TYPE_OVERLAY; diff --git a/drivers/gpu/drm/amd/display/dc/dc_memory_pool.c b/drivers/gpu/drm/amd/display/dc/dc_memory_pool.c index 8a5a72f4cc88..4e716a543de1 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_memory_pool.c +++ b/drivers/gpu/drm/amd/display/dc/dc_memory_pool.c @@ -119,7 +119,7 @@ __must_check struct dc_memory_pool *dc_memory_pool_create(size_t size, pool->unaligned_pool = unaligned_pool; pool->unaligned_memory = kcalloc(lines + 1, PAGE_SIZE, GFP_KERNEL); pool->memory = page_align_up(pool->unaligned_memory); - pool->free_list = kcalloc((uint32_t)capacity, sizeof(atomic_t), GFP_KERNEL); + pool->free_list = kzalloc_objs(atomic_t, (uint32_t)capacity); pool->free_head = (atomic64_t)ATOMIC_INIT(0); if (!pool->unaligned_memory || !pool->free_list) { diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c index e5e94e955157..955d60d5eb3e 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c @@ -1084,7 +1084,7 @@ static struct rmcm *dcn42_rmcm_create( struct dc_context *ctx, int inst) { - struct dcn42_rmcm *rmcm42 = kzalloc(sizeof(struct dcn42_rmcm), GFP_KERNEL); + struct dcn42_rmcm *rmcm42 = kzalloc_obj(struct dcn42_rmcm); if (!rmcm42) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c index e111e7532383..a498a4d25506 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c @@ -1148,7 +1148,7 @@ static struct rmcm *dcn42b_rmcm_create( struct dc_context *ctx, int inst) { - struct dcn42_rmcm *rmcm42 = kzalloc(sizeof(struct dcn42_rmcm), GFP_KERNEL); + struct dcn42_rmcm *rmcm42 = kzalloc_obj(struct dcn42_rmcm); if (!rmcm42) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.c b/drivers/gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.c index df4d6476d70a..1b8e7020fcb2 100644 --- a/drivers/gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.c +++ b/drivers/gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.c @@ -220,7 +220,7 @@ static const struct rmcm_funcs dcn60_rmcm_funcs = { struct rmcm *dcn60_rmcm_create(struct dc_context *ctx, int inst) { - struct dcn42_rmcm *rmcm42 = kzalloc(sizeof(struct dcn42_rmcm), GFP_KERNEL); + struct dcn42_rmcm *rmcm42 = kzalloc_obj(struct dcn42_rmcm); if (!rmcm42) return NULL; diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c index 48c52ac0fc77..9780afbf1d9e 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -4900,8 +4900,7 @@ static void amdgpu_debugfs_prints_cpu_info(struct seq_file *m, uint32_t num_cpu_cores = amdgpu_dpm_get_num_cpu_cores(adev); if (amdgpu_dpm_is_cclk_dpm_supported(adev)) { - p_val = kcalloc(num_cpu_cores, sizeof(uint16_t), - GFP_KERNEL); + p_val = kzalloc_objs(uint16_t, num_cpu_cores); if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_CPU_CLK, (void *)p_val, &size)) { diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c index 085b100821b9..67391d589e5a 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c @@ -52,7 +52,7 @@ int phm_copy_clock_limits_array( uint32_t i; uint32_t *table; - table = kcalloc(power_saving_clock_count, sizeof(uint32_t), GFP_KERNEL); + table = kzalloc_objs(uint32_t, power_saving_clock_count); if (NULL == table) return -ENOMEM; @@ -73,7 +73,7 @@ int phm_copy_overdrive_settings_limits_array( uint32_t i; uint32_t *table; - table = kcalloc(od_setting_count, sizeof(uint32_t), GFP_KERNEL); + table = kzalloc_objs(uint32_t, od_setting_count); if (NULL == table) return -ENOMEM; diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c index ce56d540e85e..520317453053 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c @@ -286,13 +286,13 @@ static int smu_v15_0_8_allocate_dpm_context(struct smu_context *smu) struct smu_dpm_context *smu_dpm = &smu->smu_dpm; smu_dpm->dpm_context = - kzalloc(sizeof(struct smu_15_0_dpm_context), GFP_KERNEL); + kzalloc_obj(struct smu_15_0_dpm_context); if (!smu_dpm->dpm_context) return -ENOMEM; smu_dpm->dpm_context_size = sizeof(struct smu_15_0_dpm_context); smu_dpm->dpm_policies = - kzalloc(sizeof(struct smu_dpm_policy_ctxt), GFP_KERNEL); + kzalloc_obj(struct smu_dpm_policy_ctxt); if (!smu_dpm->dpm_policies) { kfree(smu_dpm->dpm_context); return -ENOMEM; diff --git a/drivers/gpu/drm/amd/ras/core/aca.c b/drivers/gpu/drm/amd/ras/core/aca.c index 4289e968d331..5e6c597afa5e 100644 --- a/drivers/gpu/drm/amd/ras/core/aca.c +++ b/drivers/gpu/drm/amd/ras/core/aca.c @@ -614,7 +614,7 @@ int ras_aca_sw_init(struct ras_core_context *ras_core) memset(ras_aca, 0, sizeof(*ras_aca)); - ras_aca->aca_blk = kcalloc(RAS_BLOCK_ID__LAST, sizeof(struct aca_block), GFP_KERNEL); + ras_aca->aca_blk = kzalloc_objs(struct aca_block, RAS_BLOCK_ID__LAST); if (!ras_aca->aca_blk) return -ENOMEM; diff --git a/drivers/gpu/drm/amd/ras/core/cmd.c b/drivers/gpu/drm/amd/ras/core/cmd.c index 56fcd180b565..f4febbf61177 100644 --- a/drivers/gpu/drm/amd/ras/core/cmd.c +++ b/drivers/gpu/drm/amd/ras/core/cmd.c @@ -216,7 +216,7 @@ static int ras_cmd_get_cper_records(struct ras_core_context *ras_core, req->buf_size > RAS_CMD_MAX_CPER_BUF_SZ) return RAS_CMD__ERROR_INVALID_INPUT_DATA; - batch_logs = kcalloc(nr_batch_logs, sizeof(*batch_logs), GFP_KERNEL); + batch_logs = kzalloc_objs(*batch_logs, nr_batch_logs); if (!batch_logs) { ret = RAS_CMD__ERROR_GENERIC; goto out; diff --git a/drivers/gpu/drm/amd/ras/core/eeprom.c b/drivers/gpu/drm/amd/ras/core/eeprom.c index efa04cd8fbe0..9e9295b972b5 100644 --- a/drivers/gpu/drm/amd/ras/core/eeprom.c +++ b/drivers/gpu/drm/amd/ras/core/eeprom.c @@ -1086,7 +1086,7 @@ static int ras_eeprom_sw_init(struct ras_core_context *ras_core, if (!param) return -EINVAL; - control = kzalloc(sizeof(*control), GFP_KERNEL); + control = kzalloc_obj(*control); if (!control) return -ENOMEM; diff --git a/drivers/gpu/drm/amd/ras/core/eeprom_fw.c b/drivers/gpu/drm/amd/ras/core/eeprom_fw.c index 02369d54bdff..721b45277de4 100644 --- a/drivers/gpu/drm/amd/ras/core/eeprom_fw.c +++ b/drivers/gpu/drm/amd/ras/core/eeprom_fw.c @@ -145,7 +145,7 @@ static int fw_eeprom_sw_init(struct ras_core_context *ras_core, if (!param) return -EINVAL; - ctl = kzalloc(sizeof(*ctl), GFP_KERNEL); + ctl = kzalloc_obj(*ctl); if (!ctl) return -ENOMEM; diff --git a/drivers/gpu/drm/amd/ras/core/ras_cper.c b/drivers/gpu/drm/amd/ras/core/ras_cper.c index c8506f695d60..9d7847104a90 100644 --- a/drivers/gpu/drm/amd/ras/core/ras_cper.c +++ b/drivers/gpu/drm/amd/ras/core/ras_cper.c @@ -748,7 +748,7 @@ int ras_cper_sw_init(struct ras_core_context *ras_core) uint32_t nr_profiles = RAS_LOG_EVENT_COUNT_MAX; int i, ret = 0; - profiles = kcalloc(nr_profiles, sizeof(*profiles), GFP_KERNEL); + profiles = kzalloc_objs(*profiles, nr_profiles); if (!profiles) return -ENOMEM; diff --git a/drivers/gpu/drm/amd/ras/core/ras_psp.c b/drivers/gpu/drm/amd/ras/core/ras_psp.c index c16acf4b57f7..1cd7627db7fa 100644 --- a/drivers/gpu/drm/amd/ras/core/ras_psp.c +++ b/drivers/gpu/drm/amd/ras/core/ras_psp.c @@ -108,7 +108,7 @@ static struct gpu_mem_block *ras_psp_alloc_mem(struct ras_core_context *ras_core if ((mem_type >= GPU_MEM_TYPE_MAX) || (mem_size < PAGE_SIZE)) return NULL; - gpu_mem = kzalloc(sizeof(*gpu_mem), GFP_KERNEL); + gpu_mem = kzalloc_obj(*gpu_mem); if (!gpu_mem) return NULL; diff --git a/drivers/gpu/drm/amd/ras/core/ras_umc.c b/drivers/gpu/drm/amd/ras/core/ras_umc.c index aaf98cbee619..78560467ee84 100644 --- a/drivers/gpu/drm/amd/ras/core/ras_umc.c +++ b/drivers/gpu/drm/amd/ras/core/ras_umc.c @@ -202,7 +202,7 @@ int ras_umc_alloc_row_pages(struct ras_core_context *ras_core, page_num = ras_umc->max_pages_per_row; - address = kcalloc(page_num, sizeof(*address), GFP_KERNEL); + address = kzalloc_objs(*address, page_num); if (!address) return -ENOMEM; @@ -599,7 +599,7 @@ static int ras_umc_log_record(struct ras_core_context *ras_core, struct eeprom_umc_record *rec; int ret; - rec = kzalloc(sizeof(*rec), GFP_KERNEL); + rec = kzalloc_obj(*rec); if (!rec) return -ENOMEM; diff --git a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_virt_ras_cmd.c b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_virt_ras_cmd.c index 1e83cb5064ff..5cd0243050dc 100644 --- a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_virt_ras_cmd.c +++ b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_virt_ras_cmd.c @@ -448,7 +448,7 @@ int amdgpu_virt_ras_convert_retired_address(struct amdgpu_device *adev, if (!pfn || !max_pfn_sz) return -EINVAL; - rsp = kzalloc(sizeof(*rsp), GFP_KERNEL); + rsp = kzalloc_obj(*rsp); if (!rsp) return -ENOMEM; diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c index c9a1edb9a000..a2e9421ef88b 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c @@ -119,7 +119,7 @@ u32 *komeda_get_layer_fourcc_list(struct komeda_format_caps_table *table, u32 *fmts; int i, j, n = 0; - fmts = kcalloc(table->n_formats, sizeof(u32), GFP_KERNEL); + fmts = kzalloc_objs(u32, table->n_formats); if (!fmts) return NULL; diff --git a/drivers/gpu/drm/arm/malidp_mw.c b/drivers/gpu/drm/arm/malidp_mw.c index edd924ba722d..8d1e1e3a6deb 100644 --- a/drivers/gpu/drm/arm/malidp_mw.c +++ b/drivers/gpu/drm/arm/malidp_mw.c @@ -193,8 +193,7 @@ static u32 *get_writeback_formats(struct malidp_drm *malidp, int *n_formats) u32 *formats; int n, i; - formats = kcalloc(map->n_pixel_formats, sizeof(*formats), - GFP_KERNEL); + formats = kzalloc_objs(*formats, map->n_pixel_formats); if (!formats) return NULL; diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index d971ed6eb6eb..38db3d192773 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -954,7 +954,7 @@ int malidp_de_planes_init(struct drm_device *drm) modifiers = supported_modifiers; } - formats = kcalloc(map->n_pixel_formats, sizeof(*formats), GFP_KERNEL); + formats = kzalloc_objs(*formats, map->n_pixel_formats); if (!formats) { ret = -ENOMEM; goto cleanup; diff --git a/drivers/gpu/drm/bridge/chipone-icn6211.c b/drivers/gpu/drm/bridge/chipone-icn6211.c index 4ec50fb63aba..14eaae07455c 100644 --- a/drivers/gpu/drm/bridge/chipone-icn6211.c +++ b/drivers/gpu/drm/bridge/chipone-icn6211.c @@ -603,8 +603,7 @@ chipone_atomic_get_input_bus_fmts(struct drm_bridge *bridge, *num_input_fmts = 0; - input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, MAX_INPUT_SEL_FORMATS); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/bridge/fsl-ldb.c b/drivers/gpu/drm/bridge/fsl-ldb.c index 7ec84c81cd78..ef2d0c428c1f 100644 --- a/drivers/gpu/drm/bridge/fsl-ldb.c +++ b/drivers/gpu/drm/bridge/fsl-ldb.c @@ -256,8 +256,7 @@ fsl_ldb_atomic_get_input_bus_fmts(struct drm_bridge *bridge, *num_input_fmts = 0; - input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, MAX_INPUT_SEL_FORMATS); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c index c8d0a26e8e90..41613b530ed3 100644 --- a/drivers/gpu/drm/bridge/ite-it66121.c +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -749,8 +749,7 @@ static u32 *it66121_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, { u32 *output_fmts; - output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts), - GFP_KERNEL); + output_fmts = kzalloc_objs(*output_fmts, MAX_OUTPUT_SEL_FORMATS); if (!output_fmts) return NULL; @@ -775,8 +774,7 @@ static u32 *it66121_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, *num_input_fmts = 0; - input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, MAX_INPUT_SEL_FORMATS); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/bridge/lontium-lt9211.c b/drivers/gpu/drm/bridge/lontium-lt9211.c index 285cda58f661..b165fba0a1c0 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9211.c +++ b/drivers/gpu/drm/bridge/lontium-lt9211.c @@ -599,8 +599,7 @@ lt9211_atomic_get_input_bus_fmts(struct drm_bridge *bridge, *num_input_fmts = 0; - input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, MAX_INPUT_SEL_FORMATS); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 2d1a28261037..619ee6e95c51 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -839,8 +839,7 @@ lt9611_atomic_get_input_bus_fmts(struct drm_bridge *bridge, *num_input_fmts = 0; - input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, MAX_INPUT_SEL_FORMATS); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/bridge/lvds-codec.c b/drivers/gpu/drm/bridge/lvds-codec.c index f97c8586273d..7ce633a74860 100644 --- a/drivers/gpu/drm/bridge/lvds-codec.c +++ b/drivers/gpu/drm/bridge/lvds-codec.c @@ -89,8 +89,7 @@ lvds_codec_atomic_get_input_bus_fmts(struct drm_bridge *bridge, *num_input_fmts = 0; - input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, MAX_INPUT_SEL_FORMATS); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c index 09992529f3d8..7e1a076ce03f 100644 --- a/drivers/gpu/drm/bridge/nwl-dsi.c +++ b/drivers/gpu/drm/bridge/nwl-dsi.c @@ -948,7 +948,7 @@ static u32 *nwl_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, return NULL; } - input_fmts = kcalloc(1, sizeof(*input_fmts), GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, 1); if (!input_fmts) return NULL; input_fmts[0] = input_fmt; diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index 9aac44ed5b67..a1e34d2bb3da 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -482,7 +482,7 @@ static u32 *sii902x_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, *num_input_fmts = 0; - input_fmts = kcalloc(1, sizeof(*input_fmts), GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, 1); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c b/drivers/gpu/drm/bridge/synopsys/dw-dp.c index 86a20a0b9c01..b367258005af 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c @@ -1768,7 +1768,8 @@ static u32 *dw_dp_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, *num_output_fmts = 0; - output_fmts = kcalloc(ARRAY_SIZE(dw_dp_output_formats), sizeof(*output_fmts), GFP_KERNEL); + output_fmts = kzalloc_objs(*output_fmts, + ARRAY_SIZE(dw_dp_output_formats)); if (!output_fmts) return NULL; diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 937d61c42b58..75057eabe5b5 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2670,8 +2670,7 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, *num_output_fmts = 0; - output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts), - GFP_KERNEL); + output_fmts = kzalloc_objs(*output_fmts, MAX_OUTPUT_SEL_FORMATS); if (!output_fmts) return NULL; @@ -2794,8 +2793,7 @@ static u32 *dw_hdmi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, *num_input_fmts = 0; - input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, MAX_INPUT_SEL_FORMATS); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 51f4baa62a53..dd05a52f1948 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1888,8 +1888,7 @@ tc_dpi_atomic_get_input_bus_fmts(struct drm_bridge *bridge, *num_input_fmts = 0; - input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, MAX_INPUT_SEL_FORMATS); if (!input_fmts) return NULL; @@ -1911,8 +1910,7 @@ tc_edp_atomic_get_output_bus_fmts(struct drm_bridge *bridge, *num_output_fmts = 0; - output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts), - GFP_KERNEL); + output_fmts = kzalloc_objs(*output_fmts, MAX_OUTPUT_SEL_FORMATS); if (!output_fmts) return NULL; diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/tc358768.c index 18f73ad2589e..9dbc66a3531c 100644 --- a/drivers/gpu/drm/bridge/tc358768.c +++ b/drivers/gpu/drm/bridge/tc358768.c @@ -1227,8 +1227,7 @@ tc358768_atomic_get_input_bus_fmts(struct drm_bridge *bridge, *num_input_fmts = 0; - input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, MAX_INPUT_SEL_FORMATS); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/bridge/ti-dlpc3433.c b/drivers/gpu/drm/bridge/ti-dlpc3433.c index c9f789e30687..a0d376b0d646 100644 --- a/drivers/gpu/drm/bridge/ti-dlpc3433.c +++ b/drivers/gpu/drm/bridge/ti-dlpc3433.c @@ -221,8 +221,7 @@ dlpc_atomic_get_input_bus_fmts(struct drm_bridge *bridge, *num_input_fmts = 0; - input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, MAX_INPUT_SEL_FORMATS); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c index eb5b249cc43c..77ef1613c5f5 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c @@ -783,8 +783,7 @@ sn65dsi83_atomic_get_input_bus_fmts(struct drm_bridge *bridge, *num_input_fmts = 0; - input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, MAX_INPUT_SEL_FORMATS); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 9d006f98413a..ccfe3840d505 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -4142,8 +4142,7 @@ drm_atomic_helper_bridge_get_hdmi_output_bus_fmts(struct drm_bridge *bridge, * %DRM_OUTPUT_COLOR_FORMAT_COUNT will do for counting set bits here. */ BUILD_BUG_ON(const_true(DRM_OUTPUT_COLOR_FORMAT_COUNT > 8)); - out_fmts = kmalloc_array(hweight8(bridge->supported_formats), - sizeof(u32), GFP_KERNEL); + out_fmts = kmalloc_objs(u32, hweight8(bridge->supported_formats)); if (!out_fmts) { *num_output_fmts = 0; return NULL; diff --git a/drivers/gpu/drm/drm_gpusvm.c b/drivers/gpu/drm/drm_gpusvm.c index 03dbe304e4b8..45169eb6de61 100644 --- a/drivers/gpu/drm/drm_gpusvm.c +++ b/drivers/gpu/drm/drm_gpusvm.c @@ -816,7 +816,7 @@ static bool drm_gpusvm_check_pages(struct drm_gpusvm *gpusvm, mmap_assert_locked(gpusvm->mm); - pfns = kvmalloc_array(npages, sizeof(*pfns), GFP_KERNEL); + pfns = kvmalloc_objs(*pfns, npages); if (!pfns) return false; @@ -888,7 +888,7 @@ enum drm_gpusvm_scan_result drm_gpusvm_scan_mm(struct drm_gpusvm_range *range, const struct dev_pagemap *other = NULL; int err, i; - pfns = kvcalloc(npages, sizeof(*pfns), GFP_KERNEL); + pfns = kvzalloc_objs(*pfns, npages); if (!pfns) return DRM_GPUSVM_SCAN_UNPOPULATED; @@ -1830,7 +1830,7 @@ retry: goto set_seqno; } - pfns = kvmalloc_array(npages, sizeof(*pfns), GFP_KERNEL); + pfns = kvmalloc_objs(*pfns, npages); if (!pfns) return -ENOMEM; @@ -1981,7 +1981,7 @@ int drm_gpusvm_range_evict(struct drm_gpusvm *gpusvm, if (!mmget_not_zero(mm)) return -EFAULT; - pfns = kvmalloc_array(npages, sizeof(*pfns), GFP_KERNEL); + pfns = kvmalloc_objs(*pfns, npages); if (!pfns) { mmput(mm); return -ENOMEM; diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 46adef2a30c0..bd4a1d678420 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -399,8 +399,7 @@ static int __drm_universal_plane_init(struct drm_device *dev, plane->base.properties = &plane->properties; plane->dev = dev; plane->funcs = funcs; - plane->format_types = kmalloc_array(format_count, sizeof(uint32_t), - GFP_KERNEL); + plane->format_types = kmalloc_objs(uint32_t, format_count); if (!plane->format_types) { DRM_DEBUG_KMS("out of memory when allocating plane\n"); drm_mode_object_unregister(dev, &plane->base); @@ -424,9 +423,8 @@ static int __drm_universal_plane_init(struct drm_device *dev, format_modifier_count); plane->modifier_count = format_modifier_count; - plane->modifiers = kmalloc_array(format_modifier_count, - sizeof(*plane->modifiers), - GFP_KERNEL); + plane->modifiers = kmalloc_objs(*plane->modifiers, + format_modifier_count); if (format_modifier_count && !plane->modifiers) { DRM_DEBUG_KMS("out of memory when allocating plane\n"); diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c index f38f2c5437e6..91f114cf9f60 100644 --- a/drivers/gpu/drm/drm_property.c +++ b/drivers/gpu/drm/drm_property.c @@ -114,8 +114,7 @@ struct drm_property *drm_property_create(struct drm_device *dev, property->dev = dev; if (num_values) { - property->values = kcalloc(num_values, sizeof(uint64_t), - GFP_KERNEL); + property->values = kzalloc_objs(uint64_t, num_values); if (!property->values) goto fail; } diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index f1d4da168545..137397972a98 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -1051,7 +1051,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, lockdep_assert_none_held_once(); } - points = kmalloc_array(count, sizeof(*points), GFP_KERNEL); + points = kmalloc_objs(*points, count); if (points == NULL) return -ENOMEM; @@ -1238,7 +1238,7 @@ static int drm_syncobj_array_find(struct drm_file *file_private, struct drm_syncobj **syncobjs; int ret; - handles = kmalloc_array(count_handles, sizeof(*handles), GFP_KERNEL); + handles = kmalloc_objs(*handles, count_handles); if (handles == NULL) return -ENOMEM; @@ -1572,8 +1572,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data, if (ret < 0) return ret; - points = kmalloc_array(args->count_handles, sizeof(*points), - GFP_KERNEL); + points = kmalloc_objs(*points, args->count_handles); if (!points) { ret = -ENOMEM; goto out; diff --git a/drivers/gpu/drm/gud/gud_connector.c b/drivers/gpu/drm/gud/gud_connector.c index 8141c3a1e30a..9d689c6ee324 100644 --- a/drivers/gpu/drm/gud/gud_connector.c +++ b/drivers/gpu/drm/gud/gud_connector.c @@ -503,7 +503,7 @@ static int gud_connector_add_properties(struct gud_device *gdrm, struct gud_conn num_properties = ret / sizeof(*properties); ret = 0; - gconn->properties = kcalloc(num_properties, sizeof(*gconn->properties), GFP_KERNEL); + gconn->properties = kzalloc_objs(*gconn->properties, num_properties); if (!gconn->properties) { ret = -ENOMEM; goto out; diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/i915/gem/i915_gem_pages.c index 59e3d4de7d3c..6734c49572d7 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c @@ -341,7 +341,7 @@ static void *i915_gem_object_map_pfn(struct drm_i915_gem_object *obj, if (n_pfn > ARRAY_SIZE(stack)) { /* Too big for stack -- allocate temporary array instead */ - pfns = kvmalloc_array(n_pfn, sizeof(*pfns), GFP_KERNEL); + pfns = kvmalloc_objs(*pfns, n_pfn); if (!pfns) return ERR_PTR(-ENOMEM); } diff --git a/drivers/gpu/drm/i915/gt/intel_sseu_debugfs.c b/drivers/gpu/drm/i915/gt/intel_sseu_debugfs.c index 54f38bc4b1b5..5e1adb95d923 100644 --- a/drivers/gpu/drm/i915/gt/intel_sseu_debugfs.c +++ b/drivers/gpu/drm/i915/gt/intel_sseu_debugfs.c @@ -245,7 +245,7 @@ int intel_sseu_status(struct seq_file *m, struct intel_gt *gt) seq_puts(m, "SSEU Device Status\n"); - sseu = kzalloc(sizeof(*sseu), GFP_KERNEL); + sseu = kzalloc_obj(*sseu); if (!sseu) return -ENOMEM; diff --git a/drivers/gpu/drm/i915/gt/selftest_reset.c b/drivers/gpu/drm/i915/gt/selftest_reset.c index 2cfc23c58e90..3599c9f101e1 100644 --- a/drivers/gpu/drm/i915/gt/selftest_reset.c +++ b/drivers/gpu/drm/i915/gt/selftest_reset.c @@ -38,7 +38,7 @@ __igt_reset_stolen(struct intel_gt *gt, if (!num_pages) return 0; - crc = kmalloc_array(num_pages, sizeof(u32), GFP_KERNEL); + crc = kmalloc_objs(u32, num_pages); if (!crc) return -ENOMEM; diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index 5353a9c66694..0d0597167912 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -1807,7 +1807,7 @@ static void gt_record_guc_hw_state(struct intel_uncore *uncore, for (i = 0; i < ARRAY_SIZE(guc_hw_reg_state); i++) count += guc_hw_reg_state[i].count; - hw_state = kcalloc(count, sizeof(u32), ALLOW_FAIL); + hw_state = kzalloc_objs(u32, count, ALLOW_FAIL); if (!hw_state) return; diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c index e6bd06774816..ce7b76943c06 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c @@ -251,7 +251,7 @@ static int lowlevel_hole(struct i915_address_space *vm, struct i915_vma_resource *mock_vma_res; unsigned int size; - mock_vma_res = kzalloc(sizeof(*mock_vma_res), GFP_KERNEL); + mock_vma_res = kzalloc_obj(*mock_vma_res); if (!mock_vma_res) return -ENOMEM; diff --git a/drivers/gpu/drm/i915/selftests/i915_random.c b/drivers/gpu/drm/i915/selftests/i915_random.c index abdfadcf626b..59d779897a41 100644 --- a/drivers/gpu/drm/i915/selftests/i915_random.c +++ b/drivers/gpu/drm/i915/selftests/i915_random.c @@ -77,8 +77,8 @@ unsigned int *i915_random_order(unsigned int count, struct rnd_state *state) { unsigned int *order, i; - order = kmalloc_array(count, sizeof(*order), - GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_NOWARN); + order = kmalloc_objs(*order, count, + GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_NOWARN); if (!order) return order; diff --git a/drivers/gpu/drm/imagination/pvr_fw_trace.c b/drivers/gpu/drm/imagination/pvr_fw_trace.c index 6fe478f64f02..ebd8c4e2f902 100644 --- a/drivers/gpu/drm/imagination/pvr_fw_trace.c +++ b/drivers/gpu/drm/imagination/pvr_fw_trace.c @@ -458,8 +458,8 @@ static int fw_trace_open(struct inode *inode, struct file *file) if (!trace_seq_data) return -ENOMEM; - trace_seq_data->buffer = kcalloc(ROGUE_FW_TRACE_BUF_DEFAULT_SIZE_IN_DWORDS, - sizeof(*trace_seq_data->buffer), GFP_KERNEL); + trace_seq_data->buffer = kzalloc_objs(*trace_seq_data->buffer, + ROGUE_FW_TRACE_BUF_DEFAULT_SIZE_IN_DWORDS); if (!trace_seq_data->buffer) { err = -ENOMEM; goto err_free_data; diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c index f656b85b8421..974c4fff6fd3 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -2522,15 +2522,14 @@ static u32 *mtk_dp_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, if (((rate * 97 / 100) < (mode->clock * 24 / 8)) && ((rate * 97 / 100) > (mode->clock * 16 / 8)) && (display_info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422))) { - input_fmts = kcalloc(1, sizeof(*input_fmts), GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, 1); if (!input_fmts) return NULL; *num_input_fmts = 1; input_fmts[0] = MEDIA_BUS_FMT_YUYV8_1X16; } else { - input_fmts = kcalloc(ARRAY_SIZE(mt8195_input_fmts), - sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, + ARRAY_SIZE(mt8195_input_fmts)); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c index 0e4f430de983..1bc569dc01a3 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c @@ -710,8 +710,7 @@ static u32 *mtk_dpi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, return NULL; } - output_fmts = kcalloc(dpi->conf->num_output_fmts, sizeof(*output_fmts), - GFP_KERNEL); + output_fmts = kzalloc_objs(*output_fmts, dpi->conf->num_output_fmts); if (!output_fmts) return NULL; @@ -734,8 +733,7 @@ static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, *num_input_fmts = 0; - input_fmts = kcalloc(1, sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, 1); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c index c4355c5cc340..0f9cfc7235db 100644 --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c @@ -286,9 +286,7 @@ meson_encoder_hdmi_get_inp_bus_fmts(struct drm_bridge *bridge, for (i = 0 ; i < ARRAY_SIZE(meson_encoder_hdmi_out_bus_fmts) ; ++i) { if (output_fmt == meson_encoder_hdmi_out_bus_fmts[i]) { *num_input_fmts = 1; - input_fmts = kcalloc(*num_input_fmts, - sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, *num_input_fmts); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c index 16c7335c4b1f..4af6501ef463 100644 --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c @@ -1536,7 +1536,7 @@ static void a5xx_gpu_state_get_hlsq_regs(struct msm_gpu *gpu, for (i = 0; i < ARRAY_SIZE(a5xx_hlsq_aperture_regs); i++) count += a5xx_hlsq_aperture_regs[i].count; - a5xx_state->hlsqregs = kcalloc(count, sizeof(u32), GFP_KERNEL); + a5xx_state->hlsqregs = kzalloc_objs(u32, count); if (!a5xx_state->hlsqregs) return; @@ -1583,7 +1583,7 @@ static void a5xx_gpu_state_get_gpmu_regs(struct msm_gpu *gpu, for (i = 0; a5xx_gpmu_registers[i] != ~0; i += 2) count += a5xx_gpmu_registers[i + 1] - a5xx_gpmu_registers[i] + 1; - a5xx_state->gpmuregs = kcalloc(count, sizeof(u32), GFP_KERNEL); + a5xx_state->gpmuregs = kzalloc_objs(u32, count); if (!a5xx_state->gpmuregs) return; diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index 0c2c35636251..8319119041eb 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -285,7 +285,7 @@ static void crashstate_get_bos(struct msm_gpu_state *state, struct msm_gem_submi drm_gpuvm_for_each_va (vma, submit->vm) cnt++; - state->bos = kcalloc(cnt, sizeof(struct msm_gpu_state_bo), GFP_KERNEL); + state->bos = kzalloc_objs(struct msm_gpu_state_bo, cnt); if (state->bos) drm_gpuvm_for_each_va(vma, submit->vm) { @@ -301,8 +301,8 @@ static void crashstate_get_bos(struct msm_gpu_state *state, struct msm_gem_submi drm_exec_fini(&exec); } else { - state->bos = kcalloc(submit->nr_bos, - sizeof(struct msm_gpu_state_bo), GFP_KERNEL); + state->bos = kzalloc_objs(struct msm_gpu_state_bo, + submit->nr_bos); for (int i = 0; state->bos && i < submit->nr_bos; i++) { struct drm_gem_object *obj = submit->bos[i].obj; diff --git a/drivers/gpu/drm/msm/msm_perfcntr.c b/drivers/gpu/drm/msm/msm_perfcntr.c index 7fa2e858bd08..d50a57063bc6 100644 --- a/drivers/gpu/drm/msm/msm_perfcntr.c +++ b/drivers/gpu/drm/msm/msm_perfcntr.c @@ -418,9 +418,9 @@ msm_ioctl_perfcntr_config(struct drm_device *dev, void *data, struct drm_file *f * kept in the end. */ - struct msm_perfcntr_context_state *perfctx __free(kfree) = kzalloc( - struct_size(perfctx, reserved_counters, gpu->num_perfcntr_groups), - GFP_KERNEL); + struct msm_perfcntr_context_state *perfctx __free(kfree) = kzalloc_flex(*perfctx, + reserved_counters, + gpu->num_perfcntr_groups); if (!perfctx) return -ENOMEM; diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c index e74d7bb975a8..eacac8055834 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c @@ -221,8 +221,8 @@ static vm_fault_t nouveau_dmem_migrate_to_ram(struct vm_fault *vmf) args.start = ALIGN_DOWN(vmf->address, (PAGE_SIZE << order)); args.vma = vmf->vma; args.end = args.start + (PAGE_SIZE << order); - args.src = kcalloc(nr, sizeof(*args.src), GFP_KERNEL); - args.dst = kcalloc(nr, sizeof(*args.dst), GFP_KERNEL); + args.src = kzalloc_objs(*args.src, nr); + args.dst = kzalloc_objs(*args.dst, nr); if (!args.src || !args.dst) { ret = VM_FAULT_OOM; @@ -493,8 +493,8 @@ nouveau_dmem_evict_chunk(struct nouveau_dmem_chunk *chunk) struct nouveau_dmem_dma_info *dma_info; struct nouveau_fence *fence; - src_pfns = kvcalloc(npages, sizeof(*src_pfns), GFP_KERNEL | __GFP_NOFAIL); - dst_pfns = kvcalloc(npages, sizeof(*dst_pfns), GFP_KERNEL | __GFP_NOFAIL); + src_pfns = kvzalloc_objs(*src_pfns, npages, GFP_KERNEL | __GFP_NOFAIL); + dst_pfns = kvzalloc_objs(*dst_pfns, npages, GFP_KERNEL | __GFP_NOFAIL); dma_info = kvzalloc_objs(*dma_info, npages, GFP_KERNEL | __GFP_NOFAIL); migrate_device_range(src_pfns, chunk->pagemap.range.start >> PAGE_SHIFT, @@ -862,10 +862,10 @@ nouveau_dmem_migrate_vma(struct nouveau_drm *drm, if (max > (unsigned long)HPAGE_PMD_NR) max = (unsigned long)HPAGE_PMD_NR; - args.src = kcalloc(max, sizeof(*args.src), GFP_KERNEL); + args.src = kzalloc_objs(*args.src, max); if (!args.src) goto out; - args.dst = kcalloc(max, sizeof(*args.dst), GFP_KERNEL); + args.dst = kzalloc_objs(*args.dst, max); if (!args.dst) goto out_free_src; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gv100.c index 7f7404a76140..883adc7f0b45 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gv100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gv100.c @@ -128,7 +128,7 @@ gv100_gr_scg_estimate_perf(struct gf100_gr *gr, unsigned long *gpc_tpc_mask, u32 *num_tpc_gpc; int ret = -EINVAL; - if (!(num_tpc_gpc = kcalloc(gr->gpc_nr, sizeof(*num_tpc_gpc), GFP_KERNEL))) + if (!(num_tpc_gpc = kzalloc_objs(*num_tpc_gpc, gr->gpc_nr))) return -ENOMEM; /* Calculate pix-perf-reduction-rate per GPC and find bottleneck TPC */ @@ -231,9 +231,9 @@ gv100_gr_oneinit_sm_id(struct gf100_gr *gr) u32 gpc, tpc, pes, gtpc; int perf, maxperf, ret = 0; - gpc_tpc_mask = kcalloc(gr->gpc_nr, sizeof(*gpc_tpc_mask), GFP_KERNEL); - gpc_table = kcalloc(gr->tpc_total, sizeof(*gpc_table), GFP_KERNEL); - tpc_table = kcalloc(gr->tpc_total, sizeof(*tpc_table), GFP_KERNEL); + gpc_tpc_mask = kzalloc_objs(*gpc_tpc_mask, gr->gpc_nr); + gpc_table = kzalloc_objs(*gpc_table, gr->tpc_total); + tpc_table = kzalloc_objs(*tpc_table, gr->tpc_total); if (!gpc_table || !tpc_table || !gpc_tpc_mask) { ret = -ENOMEM; goto done; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c index 3135b46cbfcd..bff0802b7256 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c @@ -171,7 +171,7 @@ gt215_link_train(struct gt215_ram *ram) return -ENOSYS; /* XXX: Multiple partitions? */ - result = kmalloc_array(64, sizeof(u32), GFP_KERNEL); + result = kmalloc_objs(u32, 64); if (!result) return -ENOMEM; diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c index a2c702b831a7..ee940a6833ff 100644 --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c @@ -1085,7 +1085,7 @@ int tiler_map_show(struct seq_file *s, void *arg) h_adj = omap_dmm->container_height / ydiv; w_adj = omap_dmm->container_width / xdiv; - map = kmalloc_array(h_adj, sizeof(*map), GFP_KERNEL); + map = kmalloc_objs(*map, h_adj); global_map = kmalloc_array(w_adj + 1, h_adj, GFP_KERNEL); if (!map || !global_map) diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index 7c348a0bf1ee..eeda113037fe 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -260,7 +260,7 @@ panfrost_copy_in_sync(struct drm_device *dev, if (!in_fence_count) return 0; - handles = kvmalloc_array(in_fence_count, sizeof(u32), GFP_KERNEL); + handles = kvmalloc_objs(u32, in_fence_count); if (!handles) { ret = -ENOMEM; DRM_DEBUG("Failed to allocate incoming syncobj handles\n"); diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 2db819ab85d2..6bd4a389f89d 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c @@ -285,7 +285,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) p->chunk_relocs = NULL; p->chunk_flags = NULL; p->chunk_const_ib = NULL; - p->chunks_array = kvmalloc_array(cs->num_chunks, sizeof(uint64_t), GFP_KERNEL); + p->chunks_array = kvmalloc_objs(uint64_t, cs->num_chunks); if (p->chunks_array == NULL) { return -ENOMEM; } @@ -344,7 +344,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) continue; } - p->chunks[i].kdata = kvmalloc_array(size, sizeof(uint32_t), GFP_KERNEL); + p->chunks[i].kdata = kvmalloc_objs(uint32_t, size); size *= sizeof(uint32_t); if (p->chunks[i].kdata == NULL) { return -ENOMEM; diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index a0fc0801abb0..bf94fa86f29c 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -147,7 +147,7 @@ int radeon_bo_create(struct radeon_device *rdev, } *bo_ptr = NULL; - bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); + bo = kzalloc_obj(struct radeon_bo); if (bo == NULL) return -ENOMEM; drm_gem_private_object_init(rdev_to_drm(rdev), &bo->tbo.base, size); diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index a5dff072c1ac..b6e9fe0bc959 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -322,7 +322,7 @@ unsigned radeon_ring_backup(struct radeon_device *rdev, struct radeon_ring *ring } /* and then save the content of the ring */ - *data = kvmalloc_array(size, sizeof(uint32_t), GFP_KERNEL); + *data = kvmalloc_objs(uint32_t, size); if (!*data) { mutex_unlock(&rdev->ring_lock); return 0; diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.c index 59c2a4b76137..1cd66c4b990f 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.c @@ -917,7 +917,7 @@ static void rcar_du_crtc_crc_init(struct rcar_du_crtc *rcrtc) /* Reserve 1 for "auto" source. */ count = rcrtc->vsp->num_planes + 1; - sources = kmalloc_array(count, sizeof(*sources), GFP_KERNEL); + sources = kmalloc_objs(*sources, count); if (!sources) return; diff --git a/drivers/gpu/drm/tidss/tidss_oldi.c b/drivers/gpu/drm/tidss/tidss_oldi.c index 5eb749f495d5..62c9780f7855 100644 --- a/drivers/gpu/drm/tidss/tidss_oldi.c +++ b/drivers/gpu/drm/tidss/tidss_oldi.c @@ -297,8 +297,7 @@ static u32 *tidss_oldi_atomic_get_input_bus_fmts(struct drm_bridge *bridge, if (i == ARRAY_SIZE(oldi_bus_formats)) return NULL; - input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), - GFP_KERNEL); + input_fmts = kzalloc_objs(*input_fmts, MAX_INPUT_SEL_FORMATS); if (!input_fmts) return NULL; diff --git a/drivers/gpu/drm/vc4/vc4_validate_shaders.c b/drivers/gpu/drm/vc4/vc4_validate_shaders.c index 66502a6a4a8e..db7c0dbdf60e 100644 --- a/drivers/gpu/drm/vc4/vc4_validate_shaders.c +++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c @@ -799,8 +799,8 @@ vc4_validate_shader(struct drm_gem_dma_object *shader_obj) reset_validation_state(&validation_state); validation_state.branch_targets = - kcalloc(BITS_TO_LONGS(validation_state.max_ip), - sizeof(unsigned long), GFP_KERNEL); + kzalloc_objs(unsigned long, + BITS_TO_LONGS(validation_state.max_ip)); if (!validation_state.branch_targets) goto fail; diff --git a/drivers/gpu/drm/verisilicon/vs_bridge.c b/drivers/gpu/drm/verisilicon/vs_bridge.c index 3a5091c0ac2c..e27e0dd4f02a 100644 --- a/drivers/gpu/drm/verisilicon/vs_bridge.c +++ b/drivers/gpu/drm/verisilicon/vs_bridge.c @@ -67,8 +67,7 @@ static u32 *vs_bridge_atomic_get_output_bus_fmts_dpi(struct drm_bridge *bridge, *num_output_fmts = 2; - output_fmts = kcalloc(*num_output_fmts, sizeof(*output_fmts), - GFP_KERNEL); + output_fmts = kzalloc_objs(*output_fmts, *num_output_fmts); if (!output_fmts) return NULL; @@ -90,8 +89,7 @@ static u32 *vs_bridge_atomic_get_output_bus_fmts_dp(struct drm_bridge *bridge, *num_output_fmts = ARRAY_SIZE(vsdc_dp_supported_fmts); - output_fmts = kcalloc(*num_output_fmts, sizeof(*output_fmts), - GFP_KERNEL); + output_fmts = kzalloc_objs(*output_fmts, *num_output_fmts); if (!output_fmts) return NULL; diff --git a/drivers/gpu/drm/virtio/virtgpu_submit.c b/drivers/gpu/drm/virtio/virtgpu_submit.c index 3d35326dd904..6580ece65870 100644 --- a/drivers/gpu/drm/virtio/virtgpu_submit.c +++ b/drivers/gpu/drm/virtio/virtgpu_submit.c @@ -305,8 +305,7 @@ static int virtio_gpu_init_submit_buflist(struct virtio_gpu_submit *submit) if (!exbuf->num_bo_handles) return 0; - bo_handles = kvmalloc_array(exbuf->num_bo_handles, sizeof(*bo_handles), - GFP_KERNEL); + bo_handles = kvmalloc_objs(*bo_handles, exbuf->num_bo_handles); if (!bo_handles) return -ENOMEM; diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c index e09116265ae9..1bb484254d6e 100644 --- a/drivers/gpu/drm/xe/display/xe_fb_pin.c +++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c @@ -305,7 +305,7 @@ static struct i915_vma *__xe_pin_fb_vma(struct drm_gem_object *obj, bool is_dpt, const struct intel_fb_pin_params *pin_params) { struct xe_device *xe = to_xe_device(obj->dev); - struct i915_vma *vma = kzalloc(sizeof(*vma), GFP_KERNEL); + struct i915_vma *vma = kzalloc_obj(*vma); struct xe_bo *bo = gem_to_xe_bo(obj); struct xe_validation_ctx ctx; struct drm_exec exec; diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c index 50e4920e8e08..8d8f00d5dcc4 100644 --- a/drivers/gpu/drm/xe/xe_pci.c +++ b/drivers/gpu/drm/xe/xe_pci.c @@ -637,7 +637,7 @@ static int read_gmdid(struct xe_device *xe, enum xe_gmdid_type type, u32 *ver, u return 0; } - gt = kzalloc(sizeof(*gt), GFP_KERNEL); + gt = kzalloc_obj(*gt); if (!gt) return -ENOMEM; diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c index 8a95d58d9c6f..aeeac0f1ab83 100644 --- a/drivers/gpu/drm/xe/xe_pt.c +++ b/drivers/gpu/drm/xe/xe_pt.c @@ -3016,8 +3016,7 @@ struct xe_pt_job_ops *xe_pt_job_ops_alloc(u32 num_ops) if (!pt_job_ops) return NULL; - pt_job_ops->ops = kvmalloc_array(num_ops, sizeof(*pt_job_ops->ops), - GFP_KERNEL); + pt_job_ops->ops = kvmalloc_objs(*pt_job_ops->ops, num_ops); if (!pt_job_ops->ops) { kfree(pt_job_ops); return NULL; diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c index 1b704fa48cf0..d25de5652767 100644 --- a/drivers/gpu/drm/xe/xe_vm.c +++ b/drivers/gpu/drm/xe/xe_vm.c @@ -1682,7 +1682,7 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags, struct xe_file *xef) */ xe_assert(xe, !((flags & XE_VM_FLAG_GSC) && (flags & XE_VM_FLAG_FAULT_MODE))); - vm = kzalloc(sizeof(*vm), GFP_KERNEL); + vm = kzalloc_obj(*vm); if (!vm) return ERR_PTR(-ENOMEM); @@ -3287,8 +3287,8 @@ static int prefetch_ranges(struct xe_vm *vm, struct xe_vma_ops *vops, thread = skip_threads ? &stack_thread : NULL; if (!skip_threads) { - prefetches = kvmalloc_array(op->prefetch_range.ranges_count, - sizeof(*prefetches), GFP_KERNEL); + prefetches = kvmalloc_objs(*prefetches, + op->prefetch_range.ranges_count); if (!prefetches) return -ENOMEM; } @@ -3566,7 +3566,7 @@ static struct dma_fence *ops_execute(struct xe_vm *vm, ++n_fence; } - fences = kcalloc(n_fence, sizeof(*fences), GFP_KERNEL); + fences = kzalloc_objs(*fences, n_fence); if (!fences) { fence = ERR_PTR(-ENOMEM); goto err_trace; diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c index 52a0712e39c4..e998f2268674 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c @@ -987,8 +987,7 @@ u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, return NULL; } - formats = kcalloc(layer->info->num_formats, sizeof(*formats), - GFP_KERNEL); + formats = kzalloc_objs(*formats, layer->info->num_formats); if (!formats) { *num_formats = 0; return NULL; @@ -1024,8 +1023,7 @@ u32 *zynqmp_disp_live_layer_formats(struct zynqmp_disp_layer *layer, return NULL; } - formats = kcalloc(layer->info->num_formats, sizeof(*formats), - GFP_KERNEL); + formats = kzalloc_objs(*formats, layer->info->num_formats); if (!formats) { *num_formats = 0; return NULL; diff --git a/drivers/gpu/host1x/context.c b/drivers/gpu/host1x/context.c index c2c8a9bb5896..ed09afb87d86 100644 --- a/drivers/gpu/host1x/context.c +++ b/drivers/gpu/host1x/context.c @@ -232,7 +232,7 @@ struct host1x_memory_context *host1x_memory_context_alloc(struct host1x *host1x, if (!cdl->len) return ERR_PTR(-EOPNOTSUPP); - ctx = kzalloc_obj(*ctx, GFP_KERNEL); + ctx = kzalloc_obj(*ctx); if (!ctx) return ERR_PTR(-ENOMEM); @@ -388,7 +388,7 @@ struct host1x_context_mapping *host1x_memory_context_map(struct host1x_memory_co struct host1x_context_mapping *m; struct host1x_bo_mapping *bo_m; - m = kzalloc_obj(*m, GFP_KERNEL); + m = kzalloc_obj(*m); if (!m) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/tests/gpu_random.c b/drivers/gpu/tests/gpu_random.c index 6356372f7e52..295d7f0bf0c6 100644 --- a/drivers/gpu/tests/gpu_random.c +++ b/drivers/gpu/tests/gpu_random.c @@ -31,7 +31,7 @@ unsigned int *gpu_random_order(unsigned int count, struct rnd_state *state) { unsigned int *order, i; - order = kmalloc_array(count, sizeof(*order), GFP_KERNEL); + order = kmalloc_objs(*order, count); if (!order) return order; diff --git a/drivers/hid/hid-haptic.c b/drivers/hid/hid-haptic.c index 8760eeb08b2c..b7fadfbddc4c 100644 --- a/drivers/hid/hid-haptic.c +++ b/drivers/hid/hid-haptic.c @@ -426,14 +426,12 @@ int hid_haptic_init(struct hid_device *hdev, haptic->max_waveform_id = max(2u, haptic->max_waveform_id); haptic->max_duration_id = max(2u, haptic->max_duration_id); - haptic->hid_usage_map = kcalloc(haptic->max_waveform_id + 1, - sizeof(u16), GFP_KERNEL); + haptic->hid_usage_map = kzalloc_objs(u16, haptic->max_waveform_id + 1); if (!haptic->hid_usage_map) { ret = -ENOMEM; goto exit; } - haptic->duration_map = kcalloc(haptic->max_duration_id + 1, - sizeof(u32), GFP_KERNEL); + haptic->duration_map = kzalloc_objs(u32, haptic->max_duration_id + 1); if (!haptic->duration_map) { ret = -ENOMEM; goto usage_map; diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index a0883ddf32e2..997e78182f8d 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -774,7 +774,7 @@ static u64 *request_arr_init(u32 size) int i; u64 *req_arr; - req_arr = kcalloc(size, sizeof(u64), GFP_KERNEL); + req_arr = kzalloc_objs(u64, size); if (!req_arr) return NULL; diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c index 27b9b79d4f4c..df2577896271 100644 --- a/drivers/hv/hv_common.c +++ b/drivers/hv/hv_common.c @@ -407,8 +407,7 @@ int __init hv_common_init(void) BUG_ON(!hv_synic_eventring_tail); } - hv_vp_index = kmalloc_array(nr_cpu_ids, sizeof(*hv_vp_index), - GFP_KERNEL); + hv_vp_index = kmalloc_objs(*hv_vp_index, nr_cpu_ids); if (!hv_vp_index) { hv_common_free(); return -ENOMEM; @@ -894,7 +893,7 @@ int hv_pci_register_dev_id(int pci_domain_nr, u32 logical_dev_id_prefix) struct hv_pci_busdata *bus, *new; int ret; - new = kzalloc_obj(*new, GFP_KERNEL); + new = kzalloc_obj(*new); if (!new) return -ENOMEM; diff --git a/drivers/hv/mshv_regions.c b/drivers/hv/mshv_regions.c index dddaade31b5d..d915fb67768d 100644 --- a/drivers/hv/mshv_regions.c +++ b/drivers/hv/mshv_regions.c @@ -404,7 +404,7 @@ static int mshv_region_range_fault(struct mshv_mem_region *region, int ret; u64 i; - pfns = kmalloc_array(page_count, sizeof(*pfns), GFP_KERNEL); + pfns = kmalloc_objs(*pfns, page_count); if (!pfns) return -ENOMEM; diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index d0baa10502f7..e01960019aaf 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c @@ -547,7 +547,7 @@ static int applesmc_init_index(struct applesmc_registers *s) if (s->index) return 0; - s->index = kcalloc(s->temp_count, sizeof(s->index[0]), GFP_KERNEL); + s->index = kzalloc_objs(s->index[0], s->temp_count); if (!s->index) return -ENOMEM; @@ -1458,12 +1458,12 @@ static int __init applesmc_init(void) goto out_smcreg; /* allocate hwmon channel configs */ - applesmc_temp_config = kcalloc(smcreg.index_count + 1, - sizeof(*applesmc_temp_config), GFP_KERNEL); - applesmc_fan_config = kcalloc(smcreg.fan_count + 1, - sizeof(*applesmc_fan_config), GFP_KERNEL); - applesmc_pwm_config = kcalloc(smcreg.fan_count + 1, - sizeof(*applesmc_pwm_config), GFP_KERNEL); + applesmc_temp_config = kzalloc_objs(*applesmc_temp_config, + smcreg.index_count + 1); + applesmc_fan_config = kzalloc_objs(*applesmc_fan_config, + smcreg.fan_count + 1); + applesmc_pwm_config = kzalloc_objs(*applesmc_pwm_config, + smcreg.fan_count + 1); if (!applesmc_temp_config || !applesmc_fan_config || !applesmc_pwm_config) { ret = -ENOMEM; goto out_info; diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c index d6d5388705c3..5d5a195c4359 100644 --- a/drivers/hwtracing/coresight/coresight-cti-platform.c +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c @@ -247,7 +247,7 @@ static int cti_plat_read_trig_group(struct cti_trig_grp *tgrp, if (!tgrp->nr_sigs) return 0; - values = kcalloc(tgrp->nr_sigs, sizeof(u32), GFP_KERNEL); + values = kzalloc_objs(u32, tgrp->nr_sigs); if (!values) return -ENOMEM; @@ -283,7 +283,7 @@ static int cti_plat_read_trig_types(struct cti_trig_grp *tgrp, /* need an array to store the values iff there are any */ if (items) { - values = kcalloc(items, sizeof(u32), GFP_KERNEL); + values = kzalloc_objs(u32, items); if (!values) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 7302464c371a..1d8e99893fa0 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -743,7 +743,7 @@ static int lpi2c_imx_alloc_rx_cmd_buf(struct lpi2c_imx_struct *lpi2c_imx) * the rx command words buffer. */ cmd_num = DIV_ROUND_UP(rx_remain, CHUNK_DATA); - dma->rx_cmd_buf = kcalloc(cmd_num, sizeof(u16), GFP_KERNEL); + dma->rx_cmd_buf = kzalloc_objs(u16, cmd_num); dma->rx_cmd_buf_len = cmd_num * sizeof(u16); if (!dma->rx_cmd_buf) { diff --git a/drivers/i2c/i2c-atr.c b/drivers/i2c/i2c-atr.c index b98442ffff94..3eb2b2fcf00c 100644 --- a/drivers/i2c/i2c-atr.c +++ b/drivers/i2c/i2c-atr.c @@ -368,7 +368,7 @@ static int i2c_atr_map_msgs(struct i2c_atr_chan *chan, struct i2c_msg *msgs, u16 *new_buf; /* We don't care about old data, hence no realloc() */ - new_buf = kmalloc_array(num, sizeof(*new_buf), GFP_KERNEL); + new_buf = kmalloc_objs(*new_buf, num); if (!new_buf) return -ENOMEM; @@ -676,7 +676,7 @@ static int i2c_atr_parse_alias_pool(struct i2c_atr *atr) if (!alias_pool->size) return 0; - aliases32 = kcalloc(num_aliases, sizeof(*aliases32), GFP_KERNEL); + aliases32 = kzalloc_objs(*aliases32, num_aliases); if (!aliases32) { ret = -ENOMEM; goto err_free_alias_pool; diff --git a/drivers/i2c/i2c-stub.c b/drivers/i2c/i2c-stub.c index 04314e3ed24c..8590b3433777 100644 --- a/drivers/i2c/i2c-stub.c +++ b/drivers/i2c/i2c-stub.c @@ -334,9 +334,7 @@ static int __init i2c_stub_allocate_banks(int i) chip->bank_mask >>= 1; } - chip->bank_words = kcalloc(chip->bank_mask * chip->bank_size, - sizeof(u16), - GFP_KERNEL); + chip->bank_words = kzalloc_objs(u16, chip->bank_mask * chip->bank_size); if (!chip->bank_words) return -ENOMEM; diff --git a/drivers/infiniband/core/frmr_pools.c b/drivers/infiniband/core/frmr_pools.c index ce8ae4305b9c..4af36dc8cf38 100644 --- a/drivers/infiniband/core/frmr_pools.c +++ b/drivers/infiniband/core/frmr_pools.c @@ -145,7 +145,7 @@ static bool age_pinned_pool(struct ib_device *device, struct ib_frmr_pool *pool) to_destroy = min(total - pool->pinned_handles, pool->inactive_queue.ci); - handles = kcalloc(to_destroy, sizeof(*handles), GFP_ATOMIC); + handles = kzalloc_objs(*handles, to_destroy, GFP_ATOMIC); if (!handles) { spin_unlock(&pool->lock); return true; @@ -445,7 +445,7 @@ int ib_frmr_pools_set_pinned(struct ib_device *device, struct ib_frmr_key *key, if (!needed_handles) goto schedule_aging; - handles = kcalloc(needed_handles, sizeof(*handles), GFP_KERNEL); + handles = kzalloc_objs(*handles, needed_handles); if (!handles) return -ENOMEM; diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c index 9cc21cd762d9..327ee0958c90 100644 --- a/drivers/infiniband/core/umem_odp.c +++ b/drivers/infiniband/core/umem_odp.c @@ -94,8 +94,8 @@ static int ib_init_umem_odp(struct ib_umem_odp *umem_odp, map = &umem_odp->map; if (ib_uses_virt_dma(dev)) { - map->pfn_list = kvcalloc(nr_entries, sizeof(*map->pfn_list), - GFP_KERNEL | __GFP_NOWARN); + map->pfn_list = kvzalloc_objs(*map->pfn_list, nr_entries, + GFP_KERNEL | __GFP_NOWARN); if (!map->pfn_list) ret = -ENOMEM; } else diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index aca7c6ab55cd..cb8532225322 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -3022,8 +3022,7 @@ static int ib_uverbs_ex_create_rwq_ind_table(struct uverbs_attr_bundle *attrs) return -EINVAL; num_wq_handles = 1 << cmd.log_ind_tbl_size; - wqs_handles = kcalloc(num_wq_handles, sizeof(*wqs_handles), - GFP_KERNEL); + wqs_handles = kzalloc_objs(*wqs_handles, num_wq_handles); if (!wqs_handles) return -ENOMEM; diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 7d52d3036208..c4eb1de44155 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -3186,8 +3186,8 @@ struct rdma_hw_stats *rdma_alloc_hw_stats_struct( if (!stats) return NULL; - stats->is_disabled = kcalloc(BITS_TO_LONGS(num_counters), - sizeof(*stats->is_disabled), GFP_KERNEL); + stats->is_disabled = kzalloc_objs(*stats->is_disabled, + BITS_TO_LONGS(num_counters)); if (!stats->is_disabled) goto err; diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c index cde56ff2313b..1babfb46f82d 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_res.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c @@ -561,7 +561,7 @@ static int bnxt_qplib_alloc_sgid_tbl(struct bnxt_qplib_res *res, if (!sgid_tbl->tbl) return -ENOMEM; - sgid_tbl->hw_id = kcalloc(max, sizeof(u16), GFP_KERNEL); + sgid_tbl->hw_id = kzalloc_objs(u16, max); if (!sgid_tbl->hw_id) goto out_free1; diff --git a/drivers/infiniband/hw/erdma/erdma_verbs.c b/drivers/infiniband/hw/erdma/erdma_verbs.c index dd29d55d4122..ed33e83051e0 100644 --- a/drivers/infiniband/hw/erdma/erdma_verbs.c +++ b/drivers/infiniband/hw/erdma/erdma_verbs.c @@ -740,7 +740,7 @@ static int erdma_kmem_alloc(struct erdma_dev *dev, struct erdma_mem *mem, struct erdma_buf_list *buf_list; u32 i; - buf_list = kcalloc(page_cnt, sizeof(*buf_list), GFP_KERNEL); + buf_list = kzalloc_objs(*buf_list, page_cnt); if (!buf_list) return -ENOMEM; diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c index d4bf75dcd102..bf0a34b31474 100644 --- a/drivers/infiniband/hw/hfi1/affinity.c +++ b/drivers/infiniband/hw/hfi1/affinity.c @@ -139,8 +139,8 @@ int node_affinity_init(void) */ init_real_cpu_mask(); - hfi1_per_node_cntr = kcalloc(node_affinity.num_possible_nodes, - sizeof(*hfi1_per_node_cntr), GFP_KERNEL); + hfi1_per_node_cntr = kzalloc_objs(*hfi1_per_node_cntr, + node_affinity.num_possible_nodes); if (!hfi1_per_node_cntr) return -ENOMEM; diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c index faa724ca33bd..2d5c5ed6d569 100644 --- a/drivers/infiniband/hw/hfi1/chip.c +++ b/drivers/infiniband/hw/hfi1/chip.c @@ -12650,12 +12650,11 @@ static int init_cntrs(struct hfi1_devdata *dd) } /* allocate space for the counter values */ - dd->cntrs = kcalloc(dd->ndevcntrs + num_driver_cntrs, sizeof(u64), - GFP_KERNEL); + dd->cntrs = kzalloc_objs(u64, dd->ndevcntrs + num_driver_cntrs); if (!dd->cntrs) goto bail; - dd->scntrs = kcalloc(dd->ndevcntrs, sizeof(u64), GFP_KERNEL); + dd->scntrs = kzalloc_objs(u64, dd->ndevcntrs); if (!dd->scntrs) goto bail; @@ -12805,11 +12804,11 @@ static int init_cntrs(struct hfi1_devdata *dd) /* allocate per port storage for counter values */ ppd = (struct hfi1_pportdata *)(dd + 1); for (i = 0; i < dd->num_pports; i++, ppd++) { - ppd->cntrs = kcalloc(dd->nportcntrs, sizeof(u64), GFP_KERNEL); + ppd->cntrs = kzalloc_objs(u64, dd->nportcntrs); if (!ppd->cntrs) goto bail; - ppd->scntrs = kcalloc(dd->nportcntrs, sizeof(u64), GFP_KERNEL); + ppd->scntrs = kzalloc_objs(u64, dd->nportcntrs); if (!ppd->scntrs) goto bail; } diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c index b5e9ac9cfd59..4bd715c65583 100644 --- a/drivers/infiniband/hw/hns/hns_roce_srq.c +++ b/drivers/infiniband/hw/hns/hns_roce_srq.c @@ -251,7 +251,7 @@ static void free_srq_wqe_buf(struct hns_roce_dev *hr_dev, static int alloc_srq_wrid(struct hns_roce_srq *srq) { - srq->wrid = kvmalloc_array(srq->wqe_cnt, sizeof(u64), GFP_KERNEL); + srq->wrid = kvmalloc_objs(u64, srq->wqe_cnt); if (!srq->wrid) return -ENOMEM; diff --git a/drivers/infiniband/hw/ionic/ionic_controlpath.c b/drivers/infiniband/hw/ionic/ionic_controlpath.c index 18ad967812f5..e85c382f9140 100644 --- a/drivers/infiniband/hw/ionic/ionic_controlpath.c +++ b/drivers/infiniband/hw/ionic/ionic_controlpath.c @@ -2021,9 +2021,8 @@ static int ionic_qp_sq_init(struct ionic_ibdev *dev, struct ionic_ctx *ctx, goto err_sq_meta; } - qp->sq_msn_idx = kmalloc_array((u32)qp->sq.mask + 1, - sizeof(*qp->sq_msn_idx), - GFP_KERNEL); + qp->sq_msn_idx = kmalloc_objs(*qp->sq_msn_idx, + (u32)qp->sq.mask + 1); if (!qp->sq_msn_idx) { rc = -ENOMEM; goto err_sq_msn; diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index effc6bcceb76..ebc0985c9362 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c @@ -1154,10 +1154,8 @@ static int create_qp_common(struct ib_pd *pd, struct ib_qp_init_attr *init_attr, if (err) goto err_mtt; - qp->sq.wrid = kvmalloc_array(qp->sq.wqe_cnt, - sizeof(u64), GFP_KERNEL); - qp->rq.wrid = kvmalloc_array(qp->rq.wqe_cnt, - sizeof(u64), GFP_KERNEL); + qp->sq.wrid = kvmalloc_objs(u64, qp->sq.wqe_cnt); + qp->rq.wrid = kvmalloc_objs(u64, qp->rq.wqe_cnt); if (!qp->sq.wrid || !qp->rq.wrid) { err = -ENOMEM; goto err_wrid; diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c index 7bcb7e225662..f2869ea121f1 100644 --- a/drivers/infiniband/hw/mlx4/srq.c +++ b/drivers/infiniband/hw/mlx4/srq.c @@ -170,8 +170,7 @@ int mlx4_ib_create_srq(struct ib_srq *ib_srq, if (err) goto err_mtt; - srq->wrid = kvmalloc_array(srq->msrq.max, - sizeof(u64), GFP_KERNEL); + srq->wrid = kvmalloc_objs(u64, srq->msrq.max); if (!srq->wrid) { err = -ENOMEM; goto err_mtt; diff --git a/drivers/infiniband/hw/mlx5/counters.c b/drivers/infiniband/hw/mlx5/counters.c index 2250b195571c..1c25b825d0bd 100644 --- a/drivers/infiniband/hw/mlx5/counters.c +++ b/drivers/infiniband/hw/mlx5/counters.c @@ -174,8 +174,7 @@ static int mlx5_ib_read_counters(struct ib_counters *counters, goto err_bound; } - mread_attr.out = kcalloc(mcounters->counters_num, sizeof(u64), - GFP_KERNEL); + mread_attr.out = kzalloc_objs(u64, mcounters->counters_num); if (!mread_attr.out) { ret = -ENOMEM; goto err_bound; diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 627dd17804c9..5891b0b2a843 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -1213,15 +1213,11 @@ static int _create_kernel_qp(struct mlx5_ib_dev *dev, goto err_free; } - qp->sq.wrid = kvmalloc_array(qp->sq.wqe_cnt, - sizeof(*qp->sq.wrid), GFP_KERNEL); - qp->sq.wr_data = kvmalloc_array(qp->sq.wqe_cnt, - sizeof(*qp->sq.wr_data), GFP_KERNEL); - qp->rq.wrid = kvmalloc_array(qp->rq.wqe_cnt, - sizeof(*qp->rq.wrid), GFP_KERNEL); + qp->sq.wrid = kvmalloc_objs(*qp->sq.wrid, qp->sq.wqe_cnt); + qp->sq.wr_data = kvmalloc_objs(*qp->sq.wr_data, qp->sq.wqe_cnt); + qp->rq.wrid = kvmalloc_objs(*qp->rq.wrid, qp->rq.wqe_cnt); qp->sq.w_list = kvmalloc_objs(*qp->sq.w_list, qp->sq.wqe_cnt); - qp->sq.wqe_head = kvmalloc_array(qp->sq.wqe_cnt, - sizeof(*qp->sq.wqe_head), GFP_KERNEL); + qp->sq.wqe_head = kvmalloc_objs(*qp->sq.wqe_head, qp->sq.wqe_cnt); if (!qp->sq.wrid || !qp->sq.wr_data || !qp->rq.wrid || !qp->sq.w_list || !qp->sq.wqe_head) { diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c index 6a4a937d97ce..95f18e97cf69 100644 --- a/drivers/infiniband/hw/mlx5/srq.c +++ b/drivers/infiniband/hw/mlx5/srq.c @@ -136,14 +136,14 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_srq *srq, } mlx5_ib_dbg(dev, "srq->buf.page_shift = %d\n", srq->buf.page_shift); - in->pas = kvcalloc(srq->buf.npages, sizeof(*in->pas), GFP_KERNEL); + in->pas = kvzalloc_objs(*in->pas, srq->buf.npages); if (!in->pas) { err = -ENOMEM; goto err_buf; } mlx5_fill_page_frag_array(&srq->buf, in->pas); - srq->wrid = kvmalloc_array(srq->msrq.max, sizeof(u64), GFP_KERNEL); + srq->wrid = kvmalloc_objs(u64, srq->msrq.max); if (!srq->wrid) { err = -ENOMEM; goto err_in; diff --git a/drivers/infiniband/hw/mthca/mthca_allocator.c b/drivers/infiniband/hw/mthca/mthca_allocator.c index 117a070e784e..2de7173a2fa4 100644 --- a/drivers/infiniband/hw/mthca/mthca_allocator.c +++ b/drivers/infiniband/hw/mthca/mthca_allocator.c @@ -213,8 +213,7 @@ int mthca_buf_alloc(struct mthca_dev *dev, int size, int max_direct, npages *= 2; } - dma_list = kmalloc_array(npages, sizeof(*dma_list), - GFP_KERNEL); + dma_list = kmalloc_objs(*dma_list, npages); if (!dma_list) goto err_free; @@ -225,8 +224,7 @@ int mthca_buf_alloc(struct mthca_dev *dev, int size, int max_direct, npages = (size + PAGE_SIZE - 1) / PAGE_SIZE; shift = PAGE_SHIFT; - dma_list = kmalloc_array(npages, sizeof(*dma_list), - GFP_KERNEL); + dma_list = kmalloc_objs(*dma_list, npages); if (!dma_list) return -ENOMEM; diff --git a/drivers/infiniband/hw/mthca/mthca_eq.c b/drivers/infiniband/hw/mthca/mthca_eq.c index 70adcd54e20e..2b53c2019cf1 100644 --- a/drivers/infiniband/hw/mthca/mthca_eq.c +++ b/drivers/infiniband/hw/mthca/mthca_eq.c @@ -486,7 +486,7 @@ static int mthca_create_eq(struct mthca_dev *dev, for (i = 0; i < npages; ++i) eq->page_list[i].buf = NULL; - dma_list = kmalloc_array(npages, sizeof(*dma_list), GFP_KERNEL); + dma_list = kmalloc_objs(*dma_list, npages); if (!dma_list) goto err_out_free; diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c index bca908054e1b..6d5e1e5e0862 100644 --- a/drivers/infiniband/hw/mthca/mthca_mr.c +++ b/drivers/infiniband/hw/mthca/mthca_mr.c @@ -144,8 +144,7 @@ static int mthca_buddy_init(struct mthca_buddy *buddy, int max_order) buddy->max_order = max_order; spin_lock_init(&buddy->lock); - buddy->bits = kcalloc(buddy->max_order + 1, sizeof(*buddy->bits), - GFP_KERNEL); + buddy->bits = kzalloc_objs(*buddy->bits, buddy->max_order + 1); buddy->num_free = kzalloc_objs(*buddy->num_free, (buddy->max_order + 1)); if (!buddy->bits || !buddy->num_free) goto err_out; diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index 97c2e18e67ad..651fe6a83c69 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -1790,8 +1790,7 @@ int ocrdma_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init_attr, srq->bit_fields_len = (srq->rq.max_cnt / 32) + (srq->rq.max_cnt % 32 ? 1 : 0); srq->idx_bit_fields = - kmalloc_array(srq->bit_fields_len, sizeof(u32), - GFP_KERNEL); + kmalloc_objs(u32, srq->bit_fields_len); if (!srq->idx_bit_fields) { status = -ENOMEM; goto arm_err; diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c index ace489482734..5fc11986462a 100644 --- a/drivers/input/misc/iqs7222.c +++ b/drivers/input/misc/iqs7222.c @@ -1888,7 +1888,7 @@ static int iqs7222_dev_init(struct iqs7222_private *iqs7222, int dir) if (!val) continue; - val_buf = kcalloc(num_col, sizeof(__le16), GFP_KERNEL); + val_buf = kzalloc_objs(__le16, num_col); if (!val_buf) return -ENOMEM; diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index 889a0966d36c..182b5f13e1bb 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -186,7 +186,7 @@ static int arm_smmu_register_legacy_master(struct device *dev, if (err) return err; - sids = kcalloc(it.cur_count, sizeof(*sids), GFP_KERNEL); + sids = kzalloc_objs(*sids, it.cur_count); if (!sids) return -ENOMEM; diff --git a/drivers/iommu/hyperv/hv-iommu-guest.c b/drivers/iommu/hyperv/hv-iommu-guest.c index 876a22f21f1e..9f4fa4315091 100644 --- a/drivers/iommu/hyperv/hv-iommu-guest.c +++ b/drivers/iommu/hyperv/hv-iommu-guest.c @@ -502,7 +502,7 @@ static struct iommu_domain *hv_iommu_domain_alloc_paging(struct device *dev) }, }; - hv_domain = kzalloc_obj(*hv_domain, GFP_KERNEL); + hv_domain = kzalloc_obj(*hv_domain); if (!hv_domain) return ERR_PTR(-ENOMEM); @@ -645,7 +645,7 @@ int __init hv_iommu_init(void) iommu_detected = 1; pci_request_acs(); - hv_iommu = kzalloc_obj(*hv_iommu, GFP_KERNEL); + hv_iommu = kzalloc_obj(*hv_iommu); if (!hv_iommu) return -ENOMEM; diff --git a/drivers/iommu/intel/perfmon.c b/drivers/iommu/intel/perfmon.c index eb1df7a9b3c7..e40ed253eaa9 100644 --- a/drivers/iommu/intel/perfmon.c +++ b/drivers/iommu/intel/perfmon.c @@ -607,7 +607,7 @@ int alloc_iommu_pmu(struct intel_iommu *iommu) iommu_pmu->cntr_stride = pcap_cntr_stride(perfcap); iommu_pmu->num_eg = pcap_num_event_group(perfcap); - iommu_pmu->evcap = kcalloc(iommu_pmu->num_eg, sizeof(u64), GFP_KERNEL); + iommu_pmu->evcap = kzalloc_objs(u64, iommu_pmu->num_eg); if (!iommu_pmu->evcap) { ret = -ENOMEM; goto free_pmu; @@ -628,7 +628,7 @@ int alloc_iommu_pmu(struct intel_iommu *iommu) goto free_pmu_evcap; } for (i = 0; i < iommu_pmu->num_cntr; i++) { - iommu_pmu->cntr_evcap[i] = kcalloc(iommu_pmu->num_eg, sizeof(u32), GFP_KERNEL); + iommu_pmu->cntr_evcap[i] = kzalloc_objs(u32, iommu_pmu->num_eg); if (!iommu_pmu->cntr_evcap[i]) { ret = -ENOMEM; goto free_pmu_cntr_evcap; diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 67e7a7b925f0..d1d7442caeb3 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -301,7 +301,7 @@ static struct iommu_domain *tegra_smmu_domain_alloc_paging(struct device *dev) return NULL; } - as->count = kcalloc(SMMU_NUM_PDE, sizeof(u32), GFP_KERNEL); + as->count = kzalloc_objs(u32, SMMU_NUM_PDE); if (!as->count) { iommu_free_pages(as->pd); kfree(as); diff --git a/drivers/irqchip/irq-atmel-aic5.c b/drivers/irqchip/irq-atmel-aic5.c index 07a317ed06ef..efc791da5832 100644 --- a/drivers/irqchip/irq-atmel-aic5.c +++ b/drivers/irqchip/irq-atmel-aic5.c @@ -358,8 +358,8 @@ static int __init sama5d2_aic5_of_init(struct device_node *node, struct device_node *parent) { #ifdef CONFIG_PM - smr_cache = kcalloc(DIV_ROUND_UP(NR_SAMA5D2_IRQS, 32) * 32, - sizeof(*smr_cache), GFP_KERNEL); + smr_cache = kzalloc_objs(*smr_cache, + DIV_ROUND_UP(NR_SAMA5D2_IRQS, 32) * 32); if (!smr_cache) return -ENOMEM; #endif diff --git a/drivers/irqchip/irq-csky-mpintc.c b/drivers/irqchip/irq-csky-mpintc.c index 1d1f5091f26f..59fba46c0b3b 100644 --- a/drivers/irqchip/irq-csky-mpintc.c +++ b/drivers/irqchip/irq-csky-mpintc.c @@ -240,7 +240,7 @@ csky_mpintc_init(struct device_node *node, struct device_node *parent) if (ret < 0) nr_irq = INTC_IRQS; - __trigger = kcalloc(nr_irq, sizeof(unsigned long), GFP_KERNEL); + __trigger = kzalloc_objs(unsigned long, nr_irq); if (__trigger == NULL) return -ENXIO; diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 282e4bafb084..c952c069f937 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -3501,10 +3501,9 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, if (alloc_lpis) { lpi_map = its_lpi_alloc(nvecs, &lpi_base, &nr_lpis); if (lpi_map) - col_map = kcalloc(nr_lpis, sizeof(*col_map), - GFP_KERNEL); + col_map = kzalloc_objs(*col_map, nr_lpis); } else { - col_map = kcalloc(nr_ites, sizeof(*col_map), GFP_KERNEL); + col_map = kzalloc_objs(*col_map, nr_ites); nr_lpis = 0; lpi_base = 0; } diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c index 28e39b065de0..f876dc0de1b9 100644 --- a/drivers/irqchip/irq-gic-v5-its.c +++ b/drivers/irqchip/irq-gic-v5-its.c @@ -167,7 +167,7 @@ static int gicv5_its_create_itt_linear(struct gicv5_its_chip_data *its, unsigned int num_ents = BIT(event_id_bits); __le64 *itt; - itt = kcalloc(num_ents, sizeof(*itt), GFP_KERNEL); + itt = kzalloc_objs(*itt, num_ents); if (!itt) return -ENOMEM; @@ -211,11 +211,11 @@ static int gicv5_its_create_itt_two_level(struct gicv5_its_chip_data *its, num_ents = BIT(l1_bits); - itt_l1 = kcalloc(num_ents, sizeof(*itt_l1), GFP_KERNEL); + itt_l1 = kzalloc_objs(*itt_l1, num_ents); if (!itt_l1) return -ENOMEM; - l2ptrs = kcalloc(num_ents, sizeof(*l2ptrs), GFP_KERNEL); + l2ptrs = kzalloc_objs(*l2ptrs, num_ents); if (!l2ptrs) { kfree(itt_l1); return -ENOMEM; @@ -242,7 +242,7 @@ static int gicv5_its_create_itt_two_level(struct gicv5_its_chip_data *its, span = i == complete_tables ? final_span : l2_bits; - itt_l2 = kcalloc(BIT(span), sizeof(*itt_l2), GFP_KERNEL); + itt_l2 = kzalloc_objs(*itt_l2, BIT(span)); if (!itt_l2) { ret = -ENOMEM; goto out_free; @@ -403,7 +403,7 @@ static int gicv5_its_alloc_l2_devtab(struct gicv5_its_chip_data *its, if (span > l2_bits) span = l2_bits; - l2devtab = kcalloc(BIT(span), sizeof(*l2devtab), GFP_KERNEL); + l2devtab = kzalloc_objs(*l2devtab, BIT(span)); if (!l2devtab) return -ENOMEM; @@ -593,7 +593,7 @@ static int gicv5_its_alloc_devtab_linear(struct gicv5_its_chip_data *its, device_id_bits = device_id_cap; } - devtab = kcalloc(BIT(device_id_bits), sizeof(*devtab), GFP_KERNEL); + devtab = kzalloc_objs(*devtab, BIT(device_id_bits)); if (!devtab) return -ENOMEM; @@ -649,11 +649,11 @@ static int gicv5_its_alloc_devtab_two_level(struct gicv5_its_chip_data *its, l1_sz = KMALLOC_MAX_SIZE; } - l1devtab = kcalloc(BIT(l1_bits), sizeof(*l1devtab), GFP_KERNEL); + l1devtab = kzalloc_objs(*l1devtab, BIT(l1_bits)); if (!l1devtab) return -ENOMEM; - l2ptrs = kcalloc(BIT(l1_bits), sizeof(*l2ptrs), GFP_KERNEL); + l2ptrs = kzalloc_objs(*l2ptrs, BIT(l1_bits)); if (!l2ptrs) { kfree(l1devtab); return -ENOMEM; diff --git a/drivers/irqchip/irq-mtk-sysirq.c b/drivers/irqchip/irq-mtk-sysirq.c index 50f88293b4cc..552d01918b06 100644 --- a/drivers/irqchip/irq-mtk-sysirq.c +++ b/drivers/irqchip/irq-mtk-sysirq.c @@ -146,9 +146,8 @@ static int __init mtk_sysirq_of_init(struct device_node *node, goto out_free_chip; } - chip_data->intpol_words = kcalloc(nr_intpol_bases, - sizeof(*chip_data->intpol_words), - GFP_KERNEL); + chip_data->intpol_words = kzalloc_objs(*chip_data->intpol_words, + nr_intpol_bases); if (!chip_data->intpol_words) { ret = -ENOMEM; goto out_free_chip; @@ -184,9 +183,7 @@ static int __init mtk_sysirq_of_init(struct device_node *node, goto out_free_intpol; } - chip_data->which_word = kcalloc(intpol_num, - sizeof(*chip_data->which_word), - GFP_KERNEL); + chip_data->which_word = kzalloc_objs(*chip_data->which_word, intpol_num); if (!chip_data->which_word) { ret = -ENOMEM; goto out_free_intpol_idx; diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index 55d94c49f083..fdfbf1a9add9 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -729,8 +729,8 @@ static int plic_probe(struct fwnode_handle *fwnode) context_id * CONTEXT_ENABLE_SIZE; handler->priv = priv; - handler->enable_save = kcalloc(priv->irq_groups, sizeof(*handler->enable_save), - GFP_KERNEL); + handler->enable_save = kzalloc_objs(*handler->enable_save, + priv->irq_groups); if (!handler->enable_save) return -ENOMEM; done: diff --git a/drivers/irqchip/irq-xilinx-smmu-csr.c b/drivers/irqchip/irq-xilinx-smmu-csr.c index 9bb625598107..58a1555699f5 100644 --- a/drivers/irqchip/irq-xilinx-smmu-csr.c +++ b/drivers/irqchip/irq-xilinx-smmu-csr.c @@ -187,7 +187,7 @@ static int __init xilinx_smmu_csr_init(struct device_node *node, struct device_n if (irq_find_matching_fwnode(of_fwnode_handle(node), DOMAIN_BUS_ANY)) return -ENODEV; - csr = kzalloc(sizeof(*csr), GFP_KERNEL); + csr = kzalloc_obj(*csr); if (!csr) return -ENOMEM; diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c index 80e281dce195..177a9038cd29 100644 --- a/drivers/leds/led-core.c +++ b/drivers/leds/led-core.c @@ -443,7 +443,7 @@ u32 *led_get_default_pattern(struct led_classdev *led_cdev, unsigned int *size) if (count < 0) return NULL; - pattern = kcalloc(count, sizeof(*pattern), GFP_KERNEL); + pattern = kzalloc_objs(*pattern, count); if (!pattern) return NULL; diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c index 96462ca84471..e8244519da8b 100644 --- a/drivers/mailbox/mtk-cmdq-mailbox.c +++ b/drivers/mailbox/mtk-cmdq-mailbox.c @@ -140,7 +140,7 @@ static void cmdq_vm_init(struct cmdq *cmdq) if (!cmdq->pdata->gce_vm) return; - vm_map = kcalloc(cmdq->pdata->thread_nr, sizeof(*vm_map), GFP_KERNEL); + vm_map = kzalloc_objs(*vm_map, cmdq->pdata->thread_nr); if (!vm_map) return; diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 1a5072425c4a..d292a44c921e 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c @@ -2610,7 +2610,7 @@ static int copy_ctr_args(struct cache *cache, int argc, const char **argv) unsigned int i; const char **copy; - copy = kcalloc(argc, sizeof(*copy), GFP_KERNEL); + copy = kzalloc_objs(*copy, argc); if (!copy) return -ENOMEM; for (i = 0; i < argc; i++) { diff --git a/drivers/md/dm-clone-target.c b/drivers/md/dm-clone-target.c index c0f9b93983d4..bc4a5ce4c81a 100644 --- a/drivers/md/dm-clone-target.c +++ b/drivers/md/dm-clone-target.c @@ -1727,7 +1727,7 @@ static int copy_ctr_args(struct clone *clone, int argc, const char **argv, char unsigned int i; const char **copy; - copy = kcalloc(argc, sizeof(*copy), GFP_KERNEL); + copy = kzalloc_objs(*copy, argc); if (!copy) goto error; diff --git a/drivers/md/dm-pcache/cache.c b/drivers/md/dm-pcache/cache.c index b0b3e21677de..f83f4e528dcb 100644 --- a/drivers/md/dm-pcache/cache.c +++ b/drivers/md/dm-pcache/cache.c @@ -152,7 +152,8 @@ static int cache_init(struct dm_pcache *pcache) goto err; } - cache->seg_map = kvcalloc(BITS_TO_LONGS(cache_dev->seg_num), sizeof(unsigned long), GFP_KERNEL); + cache->seg_map = kvzalloc_objs(unsigned long, + BITS_TO_LONGS(cache_dev->seg_num)); if (!cache->seg_map) { ret = -ENOMEM; goto free_segments; diff --git a/drivers/md/dm-pcache/cache_dev.c b/drivers/md/dm-pcache/cache_dev.c index f0259353ee39..4c65a809286a 100644 --- a/drivers/md/dm-pcache/cache_dev.c +++ b/drivers/md/dm-pcache/cache_dev.c @@ -217,7 +217,8 @@ static int sb_validate(struct pcache_cache_dev *cache_dev, struct pcache_sb *sb) static int cache_dev_init(struct pcache_cache_dev *cache_dev, u32 seg_num) { cache_dev->seg_num = seg_num; - cache_dev->seg_bitmap = kvcalloc(BITS_TO_LONGS(cache_dev->seg_num), sizeof(unsigned long), GFP_KERNEL); + cache_dev->seg_bitmap = kvzalloc_objs(unsigned long, + BITS_TO_LONGS(cache_dev->seg_num)); if (!cache_dev->seg_bitmap) return -ENOMEM; diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index a483f49dd4ce..2e8d0436386f 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -513,7 +513,7 @@ static char **realloc_argv(unsigned int *size, char **old_argv) new_size = 8; gfp = GFP_NOIO; } - argv = kmalloc_array(new_size, sizeof(*argv), gfp); + argv = kmalloc_objs(*argv, new_size, gfp); if (argv) { if (old_argv) memcpy(argv, old_argv, *size * sizeof(*argv)); diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c index 6d589867623c..60cf906c0361 100644 --- a/drivers/md/dm-verity-target.c +++ b/drivers/md/dm-verity-target.c @@ -1106,9 +1106,8 @@ static int verity_alloc_most_once(struct dm_verity *v) return -E2BIG; } - v->validated_blocks = kvcalloc(BITS_TO_LONGS(v->data_blocks), - sizeof(unsigned long), - GFP_KERNEL); + v->validated_blocks = kvzalloc_objs(unsigned long, + BITS_TO_LONGS(v->data_blocks)); if (!v->validated_blocks) { ti->error = "failed to allocate bitset for check_at_most_once"; return -ENOMEM; diff --git a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c index d60d92d2ffa1..c4a187a928d3 100644 --- a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c +++ b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c @@ -472,7 +472,7 @@ static int pispbe_prepare_job(struct pispbe_dev *pispbe) streaming_map = pispbe->streaming_map; } - job = kzalloc(sizeof(*job), GFP_KERNEL); + job = kzalloc_obj(*job); if (!job) return -ENOMEM; diff --git a/drivers/media/rc/imon_raw.c b/drivers/media/rc/imon_raw.c index 295acd6ba9e1..a7cabdf055c7 100644 --- a/drivers/media/rc/imon_raw.c +++ b/drivers/media/rc/imon_raw.c @@ -127,7 +127,7 @@ static int imon_probe(struct usb_interface *intf, if (!imon->ir_urb) return -ENOMEM; - imon->ir_buf = kmalloc(sizeof(__be64), GFP_KERNEL); + imon->ir_buf = kmalloc_obj(__be64); if (!imon->ir_buf) { ret = -ENOMEM; goto free_urb; diff --git a/drivers/media/rc/ir-spi.c b/drivers/media/rc/ir-spi.c index 31eb58b06c70..8e11487510af 100644 --- a/drivers/media/rc/ir-spi.c +++ b/drivers/media/rc/ir-spi.c @@ -50,7 +50,7 @@ static int ir_spi_tx(struct rc_dev *dev, unsigned int *buffer, unsigned int coun len += buffer[i]; } - tx_buf = kmalloc_array(len, sizeof(*tx_buf), GFP_KERNEL); + tx_buf = kmalloc_objs(*tx_buf, len); if (!tx_buf) return -ENOMEM; diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index f7b8f1f66d9b..cb6419f27dc1 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -284,7 +284,7 @@ static ssize_t lirc_transmit(struct file *file, const char __user *buf, else count = ret; - txbuf = kmalloc_array(count, sizeof(unsigned int), GFP_KERNEL); + txbuf = kmalloc_objs(unsigned int, count); if (!txbuf) { ret = -ENOMEM; goto out_kfree_raw; diff --git a/drivers/media/rc/meson-ir-tx.c b/drivers/media/rc/meson-ir-tx.c index a0d07da09f67..e07d2a8dcbbe 100644 --- a/drivers/media/rc/meson-ir-tx.c +++ b/drivers/media/rc/meson-ir-tx.c @@ -257,7 +257,7 @@ static int meson_irtx_transmit(struct rc_dev *rc, unsigned int *buf, if (!meson_irtx_check_buf(ir, buf, len)) return -EINVAL; - tx_buf = kmalloc_array(len, sizeof(u32), GFP_KERNEL); + tx_buf = kmalloc_objs(u32, len); if (!tx_buf) return -ENOMEM; diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index a867bf9e8416..4bf645ac8d7b 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -221,7 +221,7 @@ static int ir_create_table(struct rc_dev *dev, struct rc_map *rc_map, return -ENOMEM; alloc = roundup_pow_of_two(size); - scan = kmalloc_objs(struct rc_map_table, alloc, GFP_KERNEL); + scan = kmalloc_objs(struct rc_map_table, alloc); if (!scan) { kfree(name); return -ENOMEM; diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index 1ae036f8a296..04ed7a551d28 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c @@ -629,7 +629,7 @@ wbcir_tx(struct rc_dev *dev, unsigned *b, unsigned count) unsigned i; unsigned long flags; - buf = kmalloc_array(count, sizeof(*b), GFP_KERNEL); + buf = kmalloc_objs(*b, count); if (!buf) return -ENOMEM; diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c index 7f0c5826ce5e..b25477ec20b4 100644 --- a/drivers/media/usb/em28xx/em28xx-audio.c +++ b/drivers/media/usb/em28xx/em28xx-audio.c @@ -751,9 +751,8 @@ static int em28xx_audio_urb_init(struct em28xx *dev) /* Allocate space to store the number of URBs to be used */ - dev->adev.transfer_buffer = kcalloc(num_urb, - sizeof(*dev->adev.transfer_buffer), - GFP_KERNEL); + dev->adev.transfer_buffer = kzalloc_objs(*dev->adev.transfer_buffer, + num_urb); if (!dev->adev.transfer_buffer) return -ENOMEM; diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 8440eafad44e..1d4f30cba8de 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -4202,9 +4202,8 @@ static int em28xx_usb_probe(struct usb_interface *intf, } /* compute alternate max packet sizes */ - dev->alt_max_pkt_size_isoc = kcalloc(intf->num_altsetting, - sizeof(dev->alt_max_pkt_size_isoc[0]), - GFP_KERNEL); + dev->alt_max_pkt_size_isoc = kzalloc_objs(dev->alt_max_pkt_size_isoc[0], + intf->num_altsetting); if (!dev->alt_max_pkt_size_isoc) { kfree(dev); retval = -ENOMEM; diff --git a/drivers/media/usb/stk1160/stk1160-core.c b/drivers/media/usb/stk1160/stk1160-core.c index 5058cada0d0a..e1e9cfc6c290 100644 --- a/drivers/media/usb/stk1160/stk1160-core.c +++ b/drivers/media/usb/stk1160/stk1160-core.c @@ -279,9 +279,8 @@ static int stk1160_probe(struct usb_interface *interface, return -ENODEV; /* Alloc an array for all possible max_pkt_size */ - alt_max_pkt_size = kmalloc_array(interface->num_altsetting, - sizeof(alt_max_pkt_size[0]), - GFP_KERNEL); + alt_max_pkt_size = kmalloc_objs(alt_max_pkt_size[0], + interface->num_altsetting); if (alt_max_pkt_size == NULL) return -ENOMEM; diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 11ab684024c5..ae72911f560c 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -674,7 +674,7 @@ void v4l2_simplify_fraction(u32 *numerator, u32 *denominator, u32 x, y, r; unsigned int i, n; - an = kmalloc_array(n_terms, sizeof(*an), GFP_KERNEL); + an = kmalloc_objs(*an, n_terms); if (an == NULL) return; diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index 570df3c415b0..9958d3c64f98 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -581,8 +581,7 @@ int v4l2_fwnode_endpoint_alloc_parse(struct fwnode_handle *fwnode, unsigned int i; vep->link_frequencies = - kmalloc_array(rval, sizeof(*vep->link_frequencies), - GFP_KERNEL); + kmalloc_objs(*vep->link_frequencies, rval); if (!vep->link_frequencies) return -ENOMEM; diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index a07d77e584c3..ca77aebcd8fe 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -2174,8 +2174,7 @@ int v4l2_subdev_routing_validate(struct v4l2_subdev *sd, if (disallow & (V4L2_SUBDEV_ROUTING_NO_STREAM_MIX | V4L2_SUBDEV_ROUTING_NO_MULTIPLEXING)) { - remote_pads = kcalloc(sd->entity.num_pads, sizeof(*remote_pads), - GFP_KERNEL); + remote_pads = kzalloc_objs(*remote_pads, sd->entity.num_pads); if (!remote_pads) return -ENOMEM; diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c index cd4ff1b79a6d..d4143a871d69 100644 --- a/drivers/memstick/core/ms_block.c +++ b/drivers/memstick/core/ms_block.c @@ -1347,8 +1347,7 @@ static int msb_ftl_initialize(struct msb_data *msb) msb->used_blocks_bitmap = bitmap_zalloc(msb->block_count, GFP_KERNEL); msb->erased_blocks_bitmap = bitmap_zalloc(msb->block_count, GFP_KERNEL); msb->lba_to_pba_table = - kmalloc_array(msb->logical_block_count, sizeof(u16), - GFP_KERNEL); + kmalloc_objs(u16, msb->logical_block_count); if (!msb->used_blocks_bitmap || !msb->lba_to_pba_table || !msb->erased_blocks_bitmap) { diff --git a/drivers/misc/cardreader/rtsx_usb.c b/drivers/misc/cardreader/rtsx_usb.c index a127744918f4..42b4b0b7ea69 100644 --- a/drivers/misc/cardreader/rtsx_usb.c +++ b/drivers/misc/cardreader/rtsx_usb.c @@ -292,7 +292,7 @@ int rtsx_usb_get_card_status(struct rtsx_ucr *ucr, u16 *status) return -EINVAL; if (polling_pipe == 0) { - buf = kzalloc(sizeof(u16), GFP_KERNEL); + buf = kzalloc_obj(u16); if (!buf) return -ENOMEM; diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c index e1a11820be01..ceafda4bf32f 100644 --- a/drivers/misc/vmw_vmci/vmci_queue_pair.c +++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c @@ -443,14 +443,12 @@ static int qp_alloc_ppn_set(void *prod_q, return VMCI_ERROR_ALREADY_EXISTS; produce_ppns = - kmalloc_array(num_produce_pages, sizeof(*produce_ppns), - GFP_KERNEL); + kmalloc_objs(*produce_ppns, num_produce_pages); if (!produce_ppns) return VMCI_ERROR_NO_MEM; consume_ppns = - kmalloc_array(num_consume_pages, sizeof(*consume_ppns), - GFP_KERNEL); + kmalloc_objs(*consume_ppns, num_consume_pages); if (!consume_ppns) { kfree(produce_ppns); return VMCI_ERROR_NO_MEM; diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 8e9e61839198..177eed813af3 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -461,7 +461,7 @@ int mmc_of_parse_voltage(struct mmc_host *host, u32 *mask) return -EINVAL; } - voltage_ranges = kcalloc(2 * num_ranges, sizeof(*voltage_ranges), GFP_KERNEL); + voltage_ranges = kzalloc_objs(*voltage_ranges, 2 * num_ranges); if (!voltage_ranges) return -ENOMEM; diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index fc9185d44d92..bb0b6ffb4c43 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c @@ -267,8 +267,7 @@ static int build_maps(partition_t *part) memset(part->VirtualBlockMap, 0xff, blocks * sizeof(uint32_t)); part->BlocksPerUnit = (1 << header.EraseUnitSize) >> header.BlockSize; - part->bam_cache = kmalloc_array(part->BlocksPerUnit, sizeof(uint32_t), - GFP_KERNEL); + part->bam_cache = kmalloc_objs(uint32_t, part->BlocksPerUnit); if (!part->bam_cache) goto out_VirtualBlockMap; diff --git a/drivers/mtd/nand/ecc-sw-bch.c b/drivers/mtd/nand/ecc-sw-bch.c index 26d5f3f10964..9d382d11e971 100644 --- a/drivers/mtd/nand/ecc-sw-bch.c +++ b/drivers/mtd/nand/ecc-sw-bch.c @@ -122,8 +122,7 @@ static int nand_ecc_sw_bch_init(struct nand_device *nand) return -EINVAL; engine_conf->eccmask = kzalloc(eccbytes, GFP_KERNEL); - engine_conf->errloc = kmalloc_array(t, sizeof(*engine_conf->errloc), - GFP_KERNEL); + engine_conf->errloc = kmalloc_objs(*engine_conf->errloc, t); if (!engine_conf->eccmask || !engine_conf->errloc) { ret = -ENOMEM; goto cleanup; diff --git a/drivers/mtd/nand/raw/nandsim.c b/drivers/mtd/nand/raw/nandsim.c index fe968037f75a..ff2d4cef11b3 100644 --- a/drivers/mtd/nand/raw/nandsim.c +++ b/drivers/mtd/nand/raw/nandsim.c @@ -982,7 +982,7 @@ static int ns_read_error(unsigned int page_no) static int ns_setup_wear_reporting(struct mtd_info *mtd) { wear_eb_count = div_u64(mtd->size, mtd->erasesize); - erase_block_wear = kcalloc(wear_eb_count, sizeof(unsigned long), GFP_KERNEL); + erase_block_wear = kzalloc_objs(unsigned long, wear_eb_count); if (!erase_block_wear) { NS_ERR("Too many erase blocks for wear reporting\n"); return -ENOMEM; diff --git a/drivers/mtd/parsers/sharpslpart.c b/drivers/mtd/parsers/sharpslpart.c index 3833b887c667..029d56e951db 100644 --- a/drivers/mtd/parsers/sharpslpart.c +++ b/drivers/mtd/parsers/sharpslpart.c @@ -179,8 +179,7 @@ static int sharpsl_nand_init_ftl(struct mtd_info *mtd, struct sharpsl_ftl *ftl) /* FTL reserves 5% of the blocks + 1 spare */ ftl->logmax = ((phymax * 95) / 100) - 1; - ftl->log2phy = kmalloc_array(ftl->logmax, sizeof(*ftl->log2phy), - GFP_KERNEL); + ftl->log2phy = kmalloc_objs(*ftl->log2phy, ftl->logmax); if (!ftl->log2phy) { ret = -ENOMEM; goto exit; diff --git a/drivers/mtd/ssfdc.c b/drivers/mtd/ssfdc.c index 4a5225699a54..94a80f34e4a6 100644 --- a/drivers/mtd/ssfdc.c +++ b/drivers/mtd/ssfdc.c @@ -329,8 +329,7 @@ static void ssfdcr_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) /* Allocate logical block map */ ssfdc->logic_block_map = - kmalloc_array(ssfdc->map_len, - sizeof(ssfdc->logic_block_map[0]), GFP_KERNEL); + kmalloc_objs(ssfdc->logic_block_map[0], ssfdc->map_len); if (!ssfdc->logic_block_map) goto out_free_ssfdc; memset(ssfdc->logic_block_map, 0xff, sizeof(ssfdc->logic_block_map[0]) * diff --git a/drivers/net/dsa/mv88e6xxx/devlink.c b/drivers/net/dsa/mv88e6xxx/devlink.c index 6f034841883c..124f9865a99f 100644 --- a/drivers/net/dsa/mv88e6xxx/devlink.c +++ b/drivers/net/dsa/mv88e6xxx/devlink.c @@ -273,7 +273,7 @@ static int mv88e6xxx_region_global_snapshot(struct devlink *dl, u16 *registers; int i, err; - registers = kmalloc_array(32, sizeof(u16), GFP_KERNEL); + registers = kmalloc_objs(u16, 32); if (!registers) return -ENOMEM; @@ -578,7 +578,7 @@ static int mv88e6xxx_region_pvt_snapshot(struct devlink *dl, int dev, port, err; u16 *pvt, *cur; - pvt = kcalloc(MV88E6XXX_MAX_PVT_ENTRIES, sizeof(*pvt), GFP_KERNEL); + pvt = kzalloc_objs(*pvt, MV88E6XXX_MAX_PVT_ENTRIES); if (!pvt) return -ENOMEM; @@ -617,7 +617,7 @@ static int mv88e6xxx_region_port_snapshot(struct devlink_port *devlink_port, u16 *registers; int i, err; - registers = kmalloc_array(32, sizeof(u16), GFP_KERNEL); + registers = kmalloc_objs(u16, 32); if (!registers) return -ENOMEM; diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c index 2455d6dddc26..e441ed6a8d35 100644 --- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c +++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c @@ -1120,7 +1120,7 @@ static void ena_dump_stats_ex(struct ena_adapter *adapter, u8 *buf) return; } - data_buf = kcalloc(strings_num, sizeof(u64), GFP_ATOMIC); + data_buf = kzalloc_objs(u64, strings_num, GFP_ATOMIC); if (!data_buf) { netif_err(adapter, drv, netdev, "Failed to allocate data buf\n"); diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_ethtool.c b/drivers/net/ethernet/atheros/atl1c/atl1c_ethtool.c index 0bce122c68f1..91fedc8a5252 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_ethtool.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_ethtool.c @@ -195,8 +195,7 @@ static int atl1c_get_eeprom(struct net_device *netdev, first_dword = eeprom->offset >> 2; last_dword = (eeprom->offset + eeprom->len - 1) >> 2; - eeprom_buff = kmalloc_array(last_dword - first_dword + 1, sizeof(u32), - GFP_KERNEL); + eeprom_buff = kmalloc_objs(u32, last_dword - first_dword + 1); if (eeprom_buff == NULL) return -ENOMEM; diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c b/drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c index 68f1832a198d..28728e92642c 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c @@ -222,8 +222,7 @@ static int atl1e_get_eeprom(struct net_device *netdev, first_dword = eeprom->offset >> 2; last_dword = (eeprom->offset + eeprom->len - 1) >> 2; - eeprom_buff = kmalloc_array(last_dword - first_dword + 1, sizeof(u32), - GFP_KERNEL); + eeprom_buff = kmalloc_objs(u32, last_dword - first_dword + 1); if (eeprom_buff == NULL) return -ENOMEM; diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c index 5d3b3357d53d..bb6b0f3363d4 100644 --- a/drivers/net/ethernet/atheros/atlx/atl2.c +++ b/drivers/net/ethernet/atheros/atlx/atl2.c @@ -1896,8 +1896,7 @@ static int atl2_get_eeprom(struct net_device *netdev, first_dword = eeprom->offset >> 2; last_dword = (eeprom->offset + eeprom->len - 1) >> 2; - eeprom_buff = kmalloc_array(last_dword - first_dword + 1, sizeof(u32), - GFP_KERNEL); + eeprom_buff = kmalloc_objs(u32, last_dword - first_dword + 1); if (!eeprom_buff) return -ENOMEM; diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c index 65ef34536e36..fdef2a52124c 100644 --- a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c +++ b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c @@ -575,7 +575,7 @@ static int bnge_alloc_rss_indir_tbl(struct bnge_dev *bd) bd->rss_indir_tbl_entries = entries; bd->rss_indir_tbl = - kmalloc_array(entries, sizeof(*bd->rss_indir_tbl), GFP_KERNEL); + kmalloc_objs(*bd->rss_indir_tbl, entries); if (!bd->rss_indir_tbl) return -ENOMEM; diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 3e2fd2939e87..39a62d5c1661 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c @@ -2677,7 +2677,7 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp) u32 good_mbuf_cnt; u32 val; - good_mbuf = kmalloc_array(512, sizeof(u16), GFP_KERNEL); + good_mbuf = kmalloc_objs(u16, 512); if (!good_mbuf) return -ENOMEM; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 757c7266ce15..ec2c20a90837 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -5140,7 +5140,7 @@ static int bnxt_alloc_vnic_attributes(struct bnxt *bp) else max_rings = 1; - vnic->fw_grp_ids = kcalloc(max_rings, sizeof(u16), GFP_KERNEL); + vnic->fw_grp_ids = kzalloc_objs(u16, max_rings); if (!vnic->fw_grp_ids) { rc = -ENOMEM; goto out; @@ -5690,8 +5690,7 @@ static int bnxt_alloc_mem(struct bnxt *bp, bool irq_re_init) if (!bp->tx_ring) return -ENOMEM; - bp->tx_ring_map = kcalloc(bp->tx_nr_rings, sizeof(u16), - GFP_KERNEL); + bp->tx_ring_map = kzalloc_objs(u16, bp->tx_nr_rings); if (!bp->tx_ring_map) return -ENOMEM; @@ -6692,7 +6691,7 @@ static int bnxt_alloc_rss_indir_tbl(struct bnxt *bp) bp->rss_indir_tbl_entries = entries; bp->rss_indir_tbl = - kmalloc_array(entries, sizeof(*bp->rss_indir_tbl), GFP_KERNEL); + kmalloc_objs(*bp->rss_indir_tbl, entries); if (!bp->rss_indir_tbl) return -ENOMEM; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c index 18e33144f345..6ba2a0329a2e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c @@ -501,8 +501,7 @@ int bnxt_vf_reps_create(struct bnxt *bp) return -ENOMEM; /* storage for cfa_code to vf-idx mapping */ - cfa_code_map = kmalloc_array(MAX_CFA_CODE, sizeof(*bp->cfa_code_map), - GFP_KERNEL); + cfa_code_map = kmalloc_objs(*bp->cfa_code_map, MAX_CFA_CODE); if (!cfa_code_map) { rc = -ENOMEM; goto err; diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c index 062ac4a5fa12..6d4e93de2021 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c @@ -511,7 +511,7 @@ static int nicvf_init_snd_queue(struct nicvf *nic, return err; sq->desc = sq->dmem.base; - sq->skbuff = kcalloc(q_len, sizeof(u64), GFP_KERNEL); + sq->skbuff = kzalloc_objs(u64, q_len); if (!sq->skbuff) return -ENOMEM; @@ -524,7 +524,7 @@ static int nicvf_init_snd_queue(struct nicvf *nic, qidx += ((nic->sqs_id + 1) * MAX_SND_QUEUES_PER_QS); if (qidx < nic->pnicvf->xdp_tx_queues) { /* Alloc memory to save page pointers for XDP_TX */ - sq->xdp_page = kcalloc(q_len, sizeof(u64), GFP_KERNEL); + sq->xdp_page = kzalloc_objs(u64, q_len); if (!sq->xdp_page) return -ENOMEM; sq->xdp_desc_cnt = 0; diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 1ced6df6eac8..e21162a86f38 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -864,7 +864,7 @@ int cxgb4_write_rss(const struct port_info *pi, const u16 *queues) u16 *rss; rxq = &adapter->sge.ethrxq[pi->first_qset]; - rss = kmalloc_array(pi->rss_size, sizeof(u16), GFP_KERNEL); + rss = kmalloc_objs(u16, pi->rss_size); if (!rss) return -ENOMEM; @@ -1388,7 +1388,7 @@ static int cxgb4_port_mirror_alloc_queues(struct net_device *dev) } /* Setup RSS for Mirror Rxqs */ - rss = kcalloc(pi->rss_size, sizeof(u16), GFP_KERNEL); + rss = kzalloc_objs(u16, pi->rss_size); if (!rss) { ret = -ENOMEM; goto out_free_queues; @@ -6096,7 +6096,7 @@ static int init_rss(struct adapter *adap) for_each_port(adap, i) { struct port_info *pi = adap2pinfo(adap, i); - pi->rss = kcalloc(pi->rss_size, sizeof(u16), GFP_KERNEL); + pi->rss = kzalloc_objs(u16, pi->rss_size); if (!pi->rss) return -ENOMEM; } diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c index 1c1a7bc5a896..2708de7f4d85 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c @@ -512,8 +512,7 @@ struct cxgb4_tc_u32_table *cxgb4_init_tc_u32(struct adapter *adap) unsigned int bmap_size; bmap_size = BITS_TO_LONGS(max_tids); - link->tid_map = kvcalloc(bmap_size, sizeof(unsigned long), - GFP_KERNEL); + link->tid_map = kvzalloc_objs(unsigned long, bmap_size); if (!link->tid_map) goto out_no_mem; bitmap_zero(link->tid_map, max_tids); diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index ed302f5ec476..ac09fd3a4260 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -4680,8 +4680,7 @@ static int be_if_create(struct be_adapter *adapter) u32 cap_flags = be_if_cap_flags(adapter); /* alloc required memory for other filtering fields */ - adapter->pmac_id = kcalloc(be_max_uc(adapter), - sizeof(*adapter->pmac_id), GFP_KERNEL); + adapter->pmac_id = kzalloc_objs(*adapter->pmac_id, be_max_uc(adapter)); if (!adapter->pmac_id) return -ENOMEM; diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index ad2d8256eb8d..b928c89077da 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -957,7 +957,7 @@ static int dpaa_fq_setup(struct dpaa_priv *priv, struct dpaa_fq *fq; u16 *channels; - channels = kcalloc(num_possible_cpus(), sizeof(u16), GFP_KERNEL); + channels = kzalloc_objs(u16, num_possible_cpus()); if (!channels) return -ENOMEM; diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c index e8edef6505bf..94905ea9cf72 100644 --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c @@ -689,10 +689,8 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, int j = MAX_FILER_IDX, l = 0x0; int ret = 1; - local_rqfpr = kmalloc_array(MAX_FILER_IDX + 1, sizeof(unsigned int), - GFP_KERNEL); - local_rqfcr = kmalloc_array(MAX_FILER_IDX + 1, sizeof(unsigned int), - GFP_KERNEL); + local_rqfpr = kmalloc_objs(unsigned int, MAX_FILER_IDX + 1); + local_rqfcr = kmalloc_objs(unsigned int, MAX_FILER_IDX + 1); if (!local_rqfpr || !local_rqfcr) { ret = 0; goto err; diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c index 2437cd8ba633..a943c042893b 100644 --- a/drivers/net/ethernet/google/gve/gve_main.c +++ b/drivers/net/ethernet/google/gve/gve_main.c @@ -115,8 +115,8 @@ static int gve_alloc_flow_rule_caches(struct gve_priv *priv) } flow_rules_cache->rule_ids_cache = - kvcalloc(GVE_FLOW_RULE_IDS_CACHE_SIZE, sizeof(*flow_rules_cache->rule_ids_cache), - GFP_KERNEL); + kvzalloc_objs(*flow_rules_cache->rule_ids_cache, + GVE_FLOW_RULE_IDS_CACHE_SIZE); if (!flow_rules_cache->rule_ids_cache) { dev_err(&priv->pdev->dev, "Cannot alloc flow rule ids cache\n"); err = -ENOMEM; @@ -154,9 +154,8 @@ static int gve_alloc_rss_config_cache(struct gve_priv *priv) if (!rss_config->hash_key) return -ENOMEM; - rss_config->hash_lut = kcalloc(priv->rss_lut_size, - sizeof(rss_config->hash_lut[0]), - GFP_KERNEL); + rss_config->hash_lut = kzalloc_objs(rss_config->hash_lut[0], + priv->rss_lut_size); if (!rss_config->hash_lut) goto free_rss_key_cache; @@ -688,8 +687,7 @@ static int gve_alloc_control_plane_resources(struct gve_priv *priv) goto abort; if (!gve_is_gqi(priv)) { - priv->ptype_lut_dqo = kvzalloc_obj(*priv->ptype_lut_dqo, - GFP_KERNEL); + priv->ptype_lut_dqo = kvzalloc_obj(*priv->ptype_lut_dqo); if (!priv->ptype_lut_dqo) { err = -ENOMEM; goto abort; diff --git a/drivers/net/ethernet/google/gve/gve_tx_dqo.c b/drivers/net/ethernet/google/gve/gve_tx_dqo.c index ad99cbb77e29..f36d2e0bacea 100644 --- a/drivers/net/ethernet/google/gve/gve_tx_dqo.c +++ b/drivers/net/ethernet/google/gve/gve_tx_dqo.c @@ -360,9 +360,8 @@ static int gve_tx_alloc_ring_dqo(struct gve_priv *priv, /* Only alloc xsk pool for XDP queues */ if (idx >= cfg->qcfg->num_queues && cfg->num_xdp_rings) { tx->dqo.xsk_reorder_queue = - kvcalloc(tx->dqo.complq_mask + 1, - sizeof(tx->dqo.xsk_reorder_queue[0]), - GFP_KERNEL); + kvzalloc_objs(tx->dqo.xsk_reorder_queue[0], + tx->dqo.complq_mask + 1); if (!tx->dqo.xsk_reorder_queue) goto err; } diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_diagnose.c b/drivers/net/ethernet/hisilicon/hibmcge/hbg_diagnose.c index c0ce74cf7382..1e6288dd5a36 100644 --- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_diagnose.c +++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_diagnose.c @@ -252,7 +252,7 @@ static int hbg_push_irq_cnt(struct hbg_priv *priv) u64 *data; int ret; - data = kcalloc(data_num, sizeof(u64), GFP_KERNEL); + data = kzalloc_objs(u64, data_num); if (!data) return -ENOMEM; @@ -296,7 +296,7 @@ static int hbg_push_stats(struct hbg_priv *priv) u64 *data; int ret; - data = kcalloc(data_num, sizeof(u64), GFP_KERNEL); + data = kzalloc_objs(u64, data_num); if (!data) return -ENOMEM; diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index d819d2bb3450..fa0e3736092f 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c @@ -1992,7 +1992,7 @@ static void hns_nic_dump(struct hns_nic_priv *priv) if (ops->get_regs_len && ops->get_regs) { reg_num = ops->get_regs_len(priv->ae_handle); reg_num = (reg_num + 3ul) & ~3ul; - data = kcalloc(reg_num, sizeof(u32), GFP_KERNEL); + data = kzalloc_objs(u32, reg_num); if (data) { ops->get_regs(priv->ae_handle, data); for (i = 0; i < reg_num; i += 4) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c index 9a4e29bfa166..33e11bbf766b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c @@ -2049,7 +2049,7 @@ static int hclge_dbg_dump_fd_tcam(struct seq_file *s, void *data) if (!hdev->hclge_fd_rule_num || !rule_num) return 0; - rule_locs = kcalloc(rule_num, sizeof(u16), GFP_KERNEL); + rule_locs = kzalloc_objs(u16, rule_num); if (!rule_locs) return -ENOMEM; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index d117a0b442d0..26aeeba3fcf2 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -10232,8 +10232,7 @@ static int hclge_set_channels(struct hnae3_handle *handle, u32 new_tqps_num, goto out; /* Reinitializes the rss indirect table according to the new RSS size */ - rss_indir = kcalloc(ae_dev->dev_specs.rss_ind_tbl_size, sizeof(u32), - GFP_KERNEL); + rss_indir = kzalloc_objs(u32, ae_dev->dev_specs.rss_ind_tbl_size); if (!rss_indir) return -ENOMEM; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 5d14d29b0296..4750e439a6b4 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -3184,8 +3184,7 @@ static int hclgevf_set_channels(struct hnae3_handle *handle, u32 new_tqps_num, goto out; /* Reinitializes the rss indirect table according to the new RSS size */ - rss_indir = kcalloc(hdev->ae_dev->dev_specs.rss_ind_tbl_size, - sizeof(u32), GFP_KERNEL); + rss_indir = kzalloc_objs(u32, hdev->ae_dev->dev_specs.rss_ind_tbl_size); if (!rss_indir) return -ENOMEM; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c index 42f4792d255b..319279c3309c 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -308,7 +308,7 @@ static int hinic_rss_init(struct hinic_dev *nic_dev) u32 *indir_tbl; int err, i; - indir_tbl = kcalloc(HINIC_RSS_INDIR_SIZE, sizeof(u32), GFP_KERNEL); + indir_tbl = kzalloc_objs(u32, HINIC_RSS_INDIR_SIZE); if (!indir_tbl) return -ENOMEM; diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_rss.c b/drivers/net/ethernet/huawei/hinic3/hinic3_rss.c index 25db74d8c7dd..767e925fdb90 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_rss.c +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_rss.c @@ -81,8 +81,7 @@ static int alloc_rss_resource(struct net_device *netdev) netdev_rss_key_fill(nic_dev->rss_hkey, L2NIC_RSS_KEY_SIZE); - nic_dev->rss_indir = kcalloc(L2NIC_RSS_INDIR_SIZE, sizeof(u16), - GFP_KERNEL); + nic_dev->rss_indir = kzalloc_objs(u16, L2NIC_RSS_INDIR_SIZE); if (!nic_dev->rss_indir) { kfree(nic_dev->rss_hkey); nic_dev->rss_hkey = NULL; diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index e9874dfedf37..05d6b60cd187 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c @@ -171,7 +171,7 @@ static int ibmveth_alloc_buffer_pool(struct ibmveth_buff_pool *pool) { int i; - pool->free_map = kmalloc_array(pool->size, sizeof(u16), GFP_KERNEL); + pool->free_map = kmalloc_objs(u16, pool->size); if (!pool->free_map) return -1; diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c index c15ad95c63c1..925f10206cdd 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c +++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c @@ -435,8 +435,7 @@ static int e1000_get_eeprom(struct net_device *netdev, first_word = eeprom->offset >> 1; last_word = (eeprom->offset + eeprom->len - 1) >> 1; - eeprom_buff = kmalloc_array(last_word - first_word + 1, sizeof(u16), - GFP_KERNEL); + eeprom_buff = kmalloc_objs(u16, last_word - first_word + 1); if (!eeprom_buff) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c index a8b35ae41141..6f45a37b17d4 100644 --- a/drivers/net/ethernet/intel/e1000e/ethtool.c +++ b/drivers/net/ethernet/intel/e1000e/ethtool.c @@ -512,8 +512,7 @@ static int e1000_get_eeprom(struct net_device *netdev, first_word = eeprom->offset >> 1; last_word = (eeprom->offset + eeprom->len - 1) >> 1; - eeprom_buff = kmalloc_array(last_word - first_word + 1, sizeof(u16), - GFP_KERNEL); + eeprom_buff = kmalloc_objs(u16, last_word - first_word + 1); if (!eeprom_buff) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/ice/ice_nvm.c b/drivers/net/ethernet/intel/ice/ice_nvm.c index 21f3b615dbbf..6d472d4f43b5 100644 --- a/drivers/net/ethernet/intel/ice/ice_nvm.c +++ b/drivers/net/ethernet/intel/ice/ice_nvm.c @@ -805,7 +805,7 @@ ice_get_netlist_info(struct ice_hw *hw, enum ice_bank_select bank, return status; node_count &= ICE_LINK_TOPO_NODE_COUNT_M; - id_blk = kcalloc(ICE_NETLIST_ID_BLK_SIZE, sizeof(*id_blk), GFP_KERNEL); + id_blk = kzalloc_objs(*id_blk, ICE_NETLIST_ID_BLK_SIZE); if (!id_blk) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c index cd1b173e3b27..523c0e0be884 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_lib.c +++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c @@ -31,7 +31,7 @@ static int idpf_init_vector_stack(struct idpf_adapter *adapter) stack->base = min_vec; stack->top = min_vec; - stack->vec_idx = kcalloc(stack->size, sizeof(u16), GFP_KERNEL); + stack->vec_idx = kzalloc_objs(u16, stack->size); if (!stack->vec_idx) { mutex_unlock(&adapter->vector_lock); @@ -378,7 +378,7 @@ int idpf_intr_req(struct idpf_adapter *adapter) adapter->mb_vector.v_idx = le16_to_cpu(adapter->caps.mailbox_vector_id); - vecids = kcalloc(actual_vecs, sizeof(u16), GFP_KERNEL); + vecids = kzalloc_objs(u16, actual_vecs); if (!vecids) { err = -ENOMEM; goto free_msix; @@ -1298,7 +1298,7 @@ static struct idpf_vport *idpf_vport_alloc(struct idpf_adapter *adapter, rsrc = &vport->dflt_qv_rsrc; rsrc->dev = &adapter->pdev->dev; - rsrc->q_vector_idxs = kcalloc(num_max_q, sizeof(u16), GFP_KERNEL); + rsrc->q_vector_idxs = kzalloc_objs(u16, num_max_q); if (!rsrc->q_vector_idxs) goto free_vport; diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c index 885df6294ad9..b346187bbf30 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c @@ -4581,7 +4581,7 @@ static int idpf_vport_intr_init_vec_idx(struct idpf_vport *vport, } total_vecs = idpf_get_reserved_vecs(adapter); - vecids = kcalloc(total_vecs, sizeof(u16), GFP_KERNEL); + vecids = kzalloc_objs(u16, total_vecs); if (!vecids) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c index 928de868fa62..c89783966bae 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c @@ -3042,7 +3042,7 @@ static int idpf_vport_params_buf_alloc(struct idpf_adapter *adapter) if (!adapter->vport_params_recvd) return -ENOMEM; - adapter->vport_ids = kcalloc(num_max_vports, sizeof(u32), GFP_KERNEL); + adapter->vport_ids = kzalloc_objs(u32, num_max_vports); if (!adapter->vport_ids) goto err_mem; @@ -3586,7 +3586,7 @@ int idpf_vport_queue_ids_init(struct idpf_vport *vport, u16 q_type; u32 *qids; - qids = kcalloc(IDPF_MAX_QIDS, sizeof(u32), GFP_KERNEL); + qids = kzalloc_objs(u32, IDPF_MAX_QIDS); if (!qids) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index 65014a54a6d1..ccc7302dc7bd 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -748,8 +748,7 @@ static int igb_get_eeprom(struct net_device *netdev, first_word = eeprom->offset >> 1; last_word = (eeprom->offset + eeprom->len - 1) >> 1; - eeprom_buff = kmalloc_array(last_word - first_word + 1, sizeof(u16), - GFP_KERNEL); + eeprom_buff = kmalloc_objs(u16, last_word - first_word + 1); if (!eeprom_buff) return -ENOMEM; @@ -3261,8 +3260,7 @@ static int igb_get_module_eeprom(struct net_device *netdev, first_word = ee->offset >> 1; last_word = (ee->offset + ee->len - 1) >> 1; - dataword = kmalloc_array(last_word - first_word + 1, sizeof(u16), - GFP_KERNEL); + dataword = kmalloc_objs(u16, last_word - first_word + 1); if (!dataword) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index d4a897a8c82c..131df3e09ba1 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -4102,8 +4102,7 @@ static int igb_sw_init(struct igb_adapter *adapter) igb_init_queue_configuration(adapter); /* Setup and initialize a copy of the hw vlan table array */ - adapter->shadow_vfta = kcalloc(E1000_VLAN_FILTER_TBL_SIZE, sizeof(u32), - GFP_KERNEL); + adapter->shadow_vfta = kzalloc_objs(u32, E1000_VLAN_FILTER_TBL_SIZE); if (!adapter->shadow_vfta) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index 89fe2788a565..4ebc0c7f5fc4 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -475,8 +475,7 @@ static int igc_ethtool_get_eeprom(struct net_device *netdev, first_word = eeprom->offset >> 1; last_word = (eeprom->offset + eeprom->len - 1) >> 1; - eeprom_buff = kmalloc_array(last_word - first_word + 1, sizeof(u16), - GFP_KERNEL); + eeprom_buff = kmalloc_objs(u16, last_word - first_word + 1); if (!eeprom_buff) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c index 4d8ae5b56145..da8519065d81 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c @@ -3340,7 +3340,7 @@ static int ixgbe_get_netlist_info(struct ixgbe_hw *hw, node_count &= IXGBE_LINK_TOPO_NODE_COUNT_M; - id_blk = kcalloc(IXGBE_NETLIST_ID_BLK_SIZE, sizeof(*id_blk), GFP_KERNEL); + id_blk = kzalloc_objs(*id_blk, IXGBE_NETLIST_ID_BLK_SIZE); if (!id_blk) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 36e43b5e88d1..c98c440ccb20 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c @@ -1069,7 +1069,7 @@ static int ixgbe_get_eeprom(struct net_device *netdev, last_word = (eeprom->offset + eeprom->len - 1) >> 1; eeprom_len = last_word - first_word + 1; - eeprom_buff = kmalloc_array(eeprom_len, sizeof(u16), GFP_KERNEL); + eeprom_buff = kmalloc_objs(u16, eeprom_len); if (!eeprom_buff) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index 38b4d65f58a5..f95c4eda86b0 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -1868,7 +1868,7 @@ static void mv643xx_eth_program_multicast_filter(struct net_device *dev) goto promiscuous; /* Allocate both mc_spec and mc_other tables */ - mc_spec = kcalloc(128, sizeof(u32), GFP_ATOMIC); + mc_spec = kzalloc_objs(u32, 128, GFP_ATOMIC); if (!mc_spec) goto promiscuous; mc_other = &mc_spec[64]; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c index 7c829b1da3e5..7a2a2e7335e0 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c @@ -2295,7 +2295,7 @@ process: /* 'save' array stores available indexes temporarily before * marking it as allocated */ - save = kcalloc(count, sizeof(u16), GFP_KERNEL); + save = kzalloc_objs(u16, count); if (!save) { rc = -ENOMEM; goto err1; @@ -3402,8 +3402,7 @@ static int npc_create_srch_order(int cnt) { int val = 0; - subbank_srch_order = kcalloc(cnt, sizeof(u32), - GFP_KERNEL); + subbank_srch_order = kzalloc_objs(u32, cnt); if (!subbank_srch_order) return -ENOMEM; @@ -3869,7 +3868,7 @@ static int npc_defrag_process(struct rvu *rvu, struct list_head *lh) /* Allocate an array to store newly allocated * free slots (mcam indexes) */ - save = kcalloc(cnt, sizeof(*save), GFP_KERNEL); + save = kzalloc_objs(*save, cnt); if (!save) { rc = -ENOMEM; goto err; @@ -4094,9 +4093,8 @@ int npc_cn20k_defrag(struct rvu *rvu) node[i].idx = i; node[i].key_type = sb->key_type; node[i].free_cnt = sb->free_cnt; - node[i].vidx = kcalloc(npc_priv->subbank_depth * 2, - sizeof(*node[i].vidx), - GFP_KERNEL); + node[i].vidx = kzalloc_objs(*node[i].vidx, + npc_priv->subbank_depth * 2); if (!node[i].vidx) { rc = -ENOMEM; goto free_vidx; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c index 29559db68929..97a3db66a50c 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c @@ -5163,8 +5163,8 @@ static int rvu_nix_block_init(struct rvu *rvu, struct nix_hw *nix_hw) if (err) return err; - nix_hw->tx_credits = kcalloc(hw->cgx_links + hw->lbk_links, - sizeof(u64), GFP_KERNEL); + nix_hw->tx_credits = kzalloc_objs(u64, + hw->cgx_links + hw->lbk_links); if (!nix_hw->tx_credits) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c index 42a601976db3..f8de72fb5a41 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c @@ -2443,8 +2443,7 @@ int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr) mcam->bmap_fcnt = mcam->bmap_entries; /* Alloc memory for saving entry to RVU PFFUNC allocation mapping */ - mcam->entry2pfvf_map = kcalloc(mcam->bmap_entries, sizeof(u16), - GFP_KERNEL); + mcam->entry2pfvf_map = kzalloc_objs(u16, mcam->bmap_entries); if (!mcam->entry2pfvf_map) goto free_bmap_reverse; @@ -2470,27 +2469,23 @@ int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr) if (err) goto free_entry_map; - mcam->cntr2pfvf_map = kcalloc(mcam->counters.max, sizeof(u16), - GFP_KERNEL); + mcam->cntr2pfvf_map = kzalloc_objs(u16, mcam->counters.max); if (!mcam->cntr2pfvf_map) goto free_cntr_bmap; /* Alloc memory for MCAM entry to counter mapping and for tracking * counter's reference count. */ - mcam->entry2cntr_map = kcalloc(mcam->total_entries, sizeof(u16), - GFP_KERNEL); + mcam->entry2cntr_map = kzalloc_objs(u16, mcam->total_entries); if (!mcam->entry2cntr_map) goto free_cntr_map; - mcam->cntr_refcnt = kcalloc(mcam->counters.max, sizeof(u16), - GFP_KERNEL); + mcam->cntr_refcnt = kzalloc_objs(u16, mcam->counters.max); if (!mcam->cntr_refcnt) goto free_entry_cntr_map; /* Alloc memory for saving target device of mcam rule */ - mcam->entry2target_pffunc = kcalloc(mcam->total_entries, - sizeof(u16), GFP_KERNEL); + mcam->entry2target_pffunc = kzalloc_objs(u16, mcam->total_entries); if (!mcam->entry2target_pffunc) goto free_cntr_refcnt; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_switch.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_switch.c index 49ce38685a7e..f8304391c708 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_switch.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_switch.c @@ -183,8 +183,7 @@ void rvu_switch_enable(struct rvu *rvu) goto free_entries; } - rswitch->entry2pcifunc = kcalloc(alloc_req.count, sizeof(u16), - GFP_KERNEL); + rswitch->entry2pcifunc = kzalloc_objs(u16, alloc_req.count); if (!rswitch->entry2pcifunc) goto free_entries; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/qos.c b/drivers/net/ethernet/marvell/octeontx2/nic/qos.c index 2ede0b84e5f5..8683d98d1eda 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/qos.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/qos.c @@ -841,9 +841,7 @@ static int otx2_qos_assign_base_idx_tl(struct otx2_nic *pfvf, /* allocate child index array */ child_cnt = node->child_dwrr_cnt + node->max_static_prio + 1; - child_idx_bmap = kcalloc(BITS_TO_LONGS(child_cnt), - sizeof(unsigned long), - GFP_KERNEL); + child_idx_bmap = kzalloc_objs(unsigned long, BITS_TO_LONGS(child_cnt)); if (!child_idx_bmap) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c b/drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c index 2872adabc830..683efce519af 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c @@ -75,7 +75,7 @@ static int otx2_qos_sq_aura_pool_init(struct otx2_nic *pfvf, int qidx) /* Allocate pointers and free them to aura/pool */ sq = &qset->sq[qidx]; sq->sqb_count = 0; - sq->sqb_ptrs = kcalloc(num_sqbs, sizeof(*sq->sqb_ptrs), GFP_KERNEL); + sq->sqb_ptrs = kzalloc_objs(*sq->sqb_ptrs, num_sqbs); if (!sq->sqb_ptrs) { err = -ENOMEM; goto pool_free; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c index 0f5d5642d3f7..12272a5baf0a 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c @@ -47,7 +47,7 @@ static int rvu_rep_mcam_flow_init(struct rep_dev *rep) count = OTX2_DEFAULT_FLOWCOUNT; - rep->flow_cfg->flow_ent = kcalloc(count, sizeof(u16), GFP_KERNEL); + rep->flow_cfg->flow_ent = kzalloc_objs(u16, count); if (!rep->flow_cfg->flow_ent) return -ENOMEM; diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index ad0fdc4133fb..38b08425b3a0 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -2814,8 +2814,7 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag) ring->frag_size = mtk_max_frag_size(rx_data_len); ring->buf_size = mtk_max_buf_size(ring->frag_size); - ring->data = kcalloc(rx_dma_size, sizeof(*ring->data), - GFP_KERNEL); + ring->data = kzalloc_objs(*ring->data, rx_dma_size); if (!ring->data) return -ENOMEM; diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index f1c3da04de7f..2ffdadca65cb 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c @@ -994,7 +994,7 @@ static int mlx4_create_eq(struct mlx4_dev *dev, int nent, for (i = 0; i < npages; ++i) eq->page_list[i].buf = NULL; - dma_list = kmalloc_array(npages, sizeof(*dma_list), GFP_KERNEL); + dma_list = kmalloc_objs(*dma_list, npages); if (!dma_list) goto err_out_free; diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c index 698a5d1f0d7e..bbf9551b28c9 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mr.c +++ b/drivers/net/ethernet/mellanox/mlx4/mr.c @@ -106,10 +106,8 @@ static int mlx4_buddy_init(struct mlx4_buddy *buddy, int max_order) buddy->max_order = max_order; spin_lock_init(&buddy->lock); - buddy->bits = kcalloc(buddy->max_order + 1, sizeof(*buddy->bits), - GFP_KERNEL); - buddy->num_free = kcalloc(buddy->max_order + 1, sizeof(*buddy->num_free), - GFP_KERNEL); + buddy->bits = kzalloc_objs(*buddy->bits, buddy->max_order + 1); + buddy->num_free = kzalloc_objs(*buddy->num_free, buddy->max_order + 1); if (!buddy->bits || !buddy->num_free) goto err_out; @@ -794,7 +792,7 @@ int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, int err; int i; - page_list = kcalloc(buf->npages, sizeof(*page_list), GFP_KERNEL); + page_list = kzalloc_objs(*page_list, buf->npages); if (!page_list) return -ENOMEM; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c index ac4979087e0d..3176549eff3e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c @@ -483,7 +483,7 @@ int mlx5e_mqprio_rl_init(struct mlx5e_mqprio_rl *rl, struct mlx5_core_dev *mdev, rl->mdev = mdev; rl->num_tc = num_tc; - rl->leaves_id = kvcalloc(num_tc, sizeof(*rl->leaves_id), GFP_KERNEL); + rl->leaves_id = kvzalloc_objs(*rl->leaves_id, num_tc); if (!rl->leaves_id) return -ENOMEM; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rqt.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rqt.c index 8511363f7bec..e11a86abb25c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rqt.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rqt.c @@ -157,13 +157,13 @@ int mlx5e_rqt_init_indir(struct mlx5e_rqt *rqt, struct mlx5_core_dev *mdev, u32 *rss_rqns, *rss_vhca_ids = NULL; int err; - rss_rqns = kvmalloc_array(indir->actual_table_size, sizeof(*rss_rqns), GFP_KERNEL); + rss_rqns = kvmalloc_objs(*rss_rqns, indir->actual_table_size); if (!rss_rqns) return -ENOMEM; if (vhca_ids) { - rss_vhca_ids = kvmalloc_array(indir->actual_table_size, sizeof(*rss_vhca_ids), - GFP_KERNEL); + rss_vhca_ids = kvmalloc_objs(*rss_vhca_ids, + indir->actual_table_size); if (!rss_vhca_ids) { kvfree(rss_rqns); return -ENOMEM; @@ -246,13 +246,13 @@ int mlx5e_rqt_redirect_indir(struct mlx5e_rqt *rqt, u32 *rqns, u32 *vhca_ids, if (WARN_ON(rqt->size != indir->max_table_size)) return -EINVAL; - rss_rqns = kvmalloc_array(indir->actual_table_size, sizeof(*rss_rqns), GFP_KERNEL); + rss_rqns = kvmalloc_objs(*rss_rqns, indir->actual_table_size); if (!rss_rqns) return -ENOMEM; if (vhca_ids) { - rss_vhca_ids = kvmalloc_array(indir->actual_table_size, sizeof(*rss_vhca_ids), - GFP_KERNEL); + rss_vhca_ids = kvmalloc_objs(*rss_vhca_ids, + indir->actual_table_size); if (!rss_vhca_ids) { kvfree(rss_rqns); return -ENOMEM; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c index e940635f5dcb..852039470544 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c @@ -347,14 +347,15 @@ static struct mlx5e_rx_res *mlx5e_rx_res_alloc(struct mlx5_core_dev *mdev, unsig if (!rx_res) return NULL; - rx_res->rss_rqns = kvcalloc(max_nch, sizeof(*rx_res->rss_rqns), GFP_KERNEL); + rx_res->rss_rqns = kvzalloc_objs(*rx_res->rss_rqns, max_nch); if (!rx_res->rss_rqns) { kvfree(rx_res); return NULL; } if (multi_vhca) { - rx_res->rss_vhca_ids = kvcalloc(max_nch, sizeof(*rx_res->rss_vhca_ids), GFP_KERNEL); + rx_res->rss_vhca_ids = kvzalloc_objs(*rx_res->rss_vhca_ids, + max_nch); if (!rx_res->rss_vhca_ids) { kvfree(rx_res->rss_rqns); kvfree(rx_res); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c index c19238bc821f..0f263cd06dfa 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c @@ -187,7 +187,7 @@ static int mlx5e_vport_context_update_vlans(struct mlx5e_flow_steering *fs) list_size = max_list_size; } - vlans = kvcalloc(list_size, sizeof(*vlans), GFP_KERNEL); + vlans = kvzalloc_objs(*vlans, list_size); if (!vlans) return -ENOMEM; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 88a170e40bd9..36277710a8a1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -590,7 +590,7 @@ mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv) if (is_uplink_rep) sqs_per_channel += 2; - sqs = kvcalloc(nch * sqs_per_channel, sizeof(*sqs), GFP_KERNEL); + sqs = kvzalloc_objs(*sqs, nch * sqs_per_channel); if (!sqs) goto out; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_pool.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_pool.c index faa519254316..842b039bac34 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_pool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_pool.c @@ -9,8 +9,8 @@ int mlx5_fs_bulk_bitmap_alloc(struct mlx5_core_dev *dev, { int i; - fs_bulk->bitmask = kvcalloc(BITS_TO_LONGS(fs_bulk->bulk_len), - sizeof(unsigned long), GFP_KERNEL); + fs_bulk->bitmask = kvzalloc_objs(unsigned long, + BITS_TO_LONGS(fs_bulk->bulk_len)); if (!fs_bulk->bitmask) return -ENOMEM; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/hwmon.c b/drivers/net/ethernet/mellanox/mlx5/core/hwmon.c index afcdebac9c4f..8cfee9c923f7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/hwmon.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/hwmon.c @@ -321,8 +321,8 @@ static struct mlx5_hwmon *mlx5_hwmon_alloc(struct mlx5_core_dev *mdev) } /* sensors configuration values array, must be 0-terminated hence, + 1 */ - hwmon->temp_channel_config = kcalloc(sensors_count + 1, sizeof(*hwmon->temp_channel_config), - GFP_KERNEL); + hwmon->temp_channel_config = kzalloc_objs(*hwmon->temp_channel_config, + sensors_count + 1); if (!hwmon->temp_channel_config) { err = -ENOMEM; goto err_free_temp_channel_desc; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c index 24086267b4a7..4907e0de0b8f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c @@ -711,8 +711,8 @@ static int mlx5_infer_tx_affinity_mapping(struct lag_tracker *tracker, int i; int j; - enabled = kcalloc(ldev->ports, sizeof(*enabled), GFP_KERNEL); - disabled = kcalloc(ldev->ports, sizeof(*disabled), GFP_KERNEL); + enabled = kzalloc_objs(*enabled, ldev->ports); + disabled = kzalloc_objs(*disabled, ldev->ports); if (!enabled || !disabled) { err = -ENOMEM; goto out; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c index 0f5b8bc7861e..2bcafc572a42 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c @@ -653,7 +653,7 @@ static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec, goto err_sf_ctrl; } - table->sf_comp_pool->irqs_per_cpu = kcalloc(nr_cpu_ids, sizeof(u16), GFP_KERNEL); + table->sf_comp_pool->irqs_per_cpu = kzalloc_objs(u16, nr_cpu_ids); if (!table->sf_comp_pool->irqs_per_cpu) { err = -ENOMEM; goto err_irqs_per_cpu; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/buddy.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/buddy.c index 02736ecf817d..36a207d6d30a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/buddy.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/buddy.c @@ -10,15 +10,11 @@ static int hws_buddy_init(struct mlx5hws_buddy_mem *buddy, u32 max_order) buddy->max_order = max_order; - buddy->bitmap = kcalloc(buddy->max_order + 1, - sizeof(*buddy->bitmap), - GFP_KERNEL); + buddy->bitmap = kzalloc_objs(*buddy->bitmap, buddy->max_order + 1); if (!buddy->bitmap) return -ENOMEM; - buddy->num_free = kcalloc(buddy->max_order + 1, - sizeof(*buddy->num_free), - GFP_KERNEL); + buddy->num_free = kzalloc_objs(*buddy->num_free, buddy->max_order + 1); if (!buddy->num_free) { ret = -ENOMEM; goto err_out_free_bits; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc_complex.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc_complex.c index 660630f18ce9..fa3e0405ad8a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc_complex.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc_complex.c @@ -459,7 +459,7 @@ static int hws_submatcher_init(struct mlx5hws_bwc_matcher *cmatcher, int idx, goto destroy_tbl; } - subm->bwc_matcher = kzalloc(sizeof(*subm->bwc_matcher), GFP_KERNEL); + subm->bwc_matcher = kzalloc_obj(*subm->bwc_matcher); if (!subm->bwc_matcher) { ret = -ENOMEM; goto destroy_action; @@ -612,7 +612,7 @@ int mlx5hws_bwc_matcher_create_complex(struct mlx5hws_bwc_matcher *bwc_matcher, if (ret) goto free_submasks; - cdata = kzalloc(sizeof(*cdata), GFP_KERNEL); + cdata = kzalloc_obj(*cdata); if (!cdata) { ret = -ENOMEM; goto free_submasks; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_send.c index 79e3c29d1044..2070cc42be00 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_send.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_send.c @@ -283,9 +283,8 @@ static struct mlx5dr_qp *dr_create_rc_qp(struct mlx5_core_dev *mdev, goto err_wq; } - dr_qp->sq.wqe_head = kcalloc(dr_qp->sq.wqe_cnt, - sizeof(dr_qp->sq.wqe_head[0]), - GFP_KERNEL); + dr_qp->sq.wqe_head = kzalloc_objs(dr_qp->sq.wqe_head[0], + dr_qp->sq.wqe_cnt); if (!dr_qp->sq.wqe_head) { mlx5_core_warn(mdev, "Can't allocate wqe head\n"); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c index 8d6cea43be61..e8fc608a2f8a 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c @@ -2311,8 +2311,7 @@ mlxsw_sp_fids_init(struct mlxsw_sp *mlxsw_sp, if (err) goto err_rhashtable_vni_init; - fid_core->port_fid_mappings = kcalloc(max_ports, sizeof(unsigned int), - GFP_KERNEL); + fid_core->port_fid_mappings = kzalloc_objs(unsigned int, max_ports); if (!fid_core->port_fid_mappings) { err = -ENOMEM; goto err_alloc_port_fid_mappings; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c index e700e9ac33b7..cc1d9677709e 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c @@ -213,8 +213,7 @@ mlxsw_sp_mr_route_info_create(struct mlxsw_sp_mr_table *mr_table, u16 irif_index; u16 erif = 0; - erif_indices = kmalloc_array(MAXVIFS, sizeof(*erif_indices), - GFP_KERNEL); + erif_indices = kmalloc_objs(*erif_indices, MAXVIFS); if (!erif_indices) return -ENOMEM; diff --git a/drivers/net/ethernet/microsoft/mana/gdma_pci.c b/drivers/net/ethernet/microsoft/mana/gdma_pci.c index ed8925296c8a..edfadfd89829 100644 --- a/drivers/net/ethernet/microsoft/mana/gdma_pci.c +++ b/drivers/net/ethernet/microsoft/mana/gdma_pci.c @@ -202,7 +202,7 @@ static int mana_pci_schedule_serv_work(struct gdma_context *gc, 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); diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index 6b7c027e497e..7d60ada02a02 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_en.c +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c @@ -3355,7 +3355,7 @@ static int mana_rss_table_alloc(struct mana_port_context *apc) return -EINVAL; } - apc->indir_table = kcalloc(apc->indir_table_sz, sizeof(u32), GFP_KERNEL); + apc->indir_table = kzalloc_objs(u32, apc->indir_table_sz); if (!apc->indir_table) return -ENOMEM; diff --git a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c index 33db79569d3b..35436503c0ed 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c +++ b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c @@ -382,7 +382,7 @@ static int mana_set_rxfh(struct net_device *ndev, rxfh->hfunc != ETH_RSS_HASH_TOP) return -EOPNOTSUPP; - save_table = kcalloc(apc->indir_table_sz, sizeof(u32), GFP_KERNEL); + save_table = kzalloc_objs(u32, apc->indir_table_sz); if (!save_table) return -ENOMEM; diff --git a/drivers/net/ethernet/netronome/nfp/abm/main.c b/drivers/net/ethernet/netronome/nfp/abm/main.c index 9b6bda523191..c4b6db44f4e3 100644 --- a/drivers/net/ethernet/netronome/nfp/abm/main.c +++ b/drivers/net/ethernet/netronome/nfp/abm/main.c @@ -477,8 +477,7 @@ static int nfp_abm_init(struct nfp_app *app) if (!abm->threshold_undef) goto err_free_abm; - abm->thresholds = kvcalloc(abm->num_thresholds, - sizeof(*abm->thresholds), GFP_KERNEL); + abm->thresholds = kvzalloc_objs(*abm->thresholds, abm->num_thresholds); if (!abm->thresholds) goto err_free_thresh_umap; diff --git a/drivers/net/ethernet/qlogic/qed/qed_init_ops.c b/drivers/net/ethernet/qlogic/qed/qed_init_ops.c index edcaecf5b679..0c18151d4e72 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_init_ops.c +++ b/drivers/net/ethernet/qlogic/qed/qed_init_ops.c @@ -214,8 +214,7 @@ int qed_init_alloc(struct qed_hwfn *p_hwfn) if (!rt_data->b_valid) return -ENOMEM; - rt_data->init_val = kcalloc(RUNTIME_ARRAY_SIZE, sizeof(u32), - GFP_KERNEL); + rt_data->init_val = kzalloc_objs(u32, RUNTIME_ARRAY_SIZE); if (!rt_data->init_val) { kfree(rt_data->b_valid); rt_data->b_valid = NULL; diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index bc82cecd0fe2..520798e7961a 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c @@ -907,12 +907,12 @@ int qlcnic_83xx_alloc_mbx_args(struct qlcnic_cmd_args *mbx, mbx->op_type = QLC_83XX_FW_MBX_CMD; mbx->req.num = mbx_tbl[i].in_args; mbx->rsp.num = mbx_tbl[i].out_args; - mbx->req.arg = kcalloc(mbx->req.num, sizeof(u32), - GFP_ATOMIC); + mbx->req.arg = kzalloc_objs(u32, mbx->req.num, + GFP_ATOMIC); if (!mbx->req.arg) return -ENOMEM; - mbx->rsp.arg = kcalloc(mbx->rsp.num, sizeof(u32), - GFP_ATOMIC); + mbx->rsp.arg = kzalloc_objs(u32, mbx->rsp.num, + GFP_ATOMIC); if (!mbx->rsp.arg) { kfree(mbx->req.arg); mbx->req.arg = NULL; diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index 1b94c42d669b..2f4f06d3411c 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c @@ -61,12 +61,12 @@ int qlcnic_82xx_alloc_mbx_args(struct qlcnic_cmd_args *mbx, if (type == mbx_tbl[i].cmd) { mbx->req.num = mbx_tbl[i].in_args; mbx->rsp.num = mbx_tbl[i].out_args; - mbx->req.arg = kcalloc(mbx->req.num, - sizeof(u32), GFP_ATOMIC); + mbx->req.arg = kzalloc_objs(u32, mbx->req.num, + GFP_ATOMIC); if (!mbx->req.arg) return -ENOMEM; - mbx->rsp.arg = kcalloc(mbx->rsp.num, - sizeof(u32), GFP_ATOMIC); + mbx->rsp.arg = kzalloc_objs(u32, mbx->rsp.num, + GFP_ATOMIC); if (!mbx->rsp.arg) { kfree(mbx->req.arg); mbx->req.arg = NULL; diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index a106f961e177..72d0258cff00 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c @@ -452,7 +452,7 @@ static int qlcnic_sriov_set_guest_vlan_mode(struct qlcnic_adapter *adapter, return 0; num_vlans = sriov->num_allowed_vlans; - sriov->allowed_vlans = kcalloc(num_vlans, sizeof(u16), GFP_KERNEL); + sriov->allowed_vlans = kzalloc_objs(u16, num_vlans); if (!sriov->allowed_vlans) { qlcnic_sriov_free_vlans(adapter); return -ENOMEM; @@ -729,12 +729,12 @@ static int qlcnic_sriov_alloc_bc_mbx_args(struct qlcnic_cmd_args *mbx, u32 type) mbx->op_type = QLC_BC_CMD; mbx->req.num = mbx_tbl[i].in_args; mbx->rsp.num = mbx_tbl[i].out_args; - mbx->req.arg = kcalloc(mbx->req.num, sizeof(u32), - GFP_ATOMIC); + mbx->req.arg = kzalloc_objs(u32, mbx->req.num, + GFP_ATOMIC); if (!mbx->req.arg) return -ENOMEM; - mbx->rsp.arg = kcalloc(mbx->rsp.num, sizeof(u32), - GFP_ATOMIC); + mbx->rsp.arg = kzalloc_objs(u32, mbx->rsp.num, + GFP_ATOMIC); if (!mbx->rsp.arg) { kfree(mbx->req.arg); mbx->req.arg = NULL; @@ -2167,8 +2167,8 @@ int qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *adapter) for (i = 0; i < sriov->num_vfs; i++) { vf = &sriov->vf_info[i]; - vf->sriov_vlans = kcalloc(sriov->num_allowed_vlans, - sizeof(*vf->sriov_vlans), GFP_KERNEL); + vf->sriov_vlans = kzalloc_objs(*vf->sriov_vlans, + sriov->num_allowed_vlans); if (!vf->sriov_vlans) { qlcnic_sriov_free_vlans(adapter); return -ENOMEM; diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index cd4ebc654dd0..32aad159fddf 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -7009,8 +7009,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) } } - tp->rx_ring = kcalloc(tp->num_rx_rings, sizeof(struct rtl8169_rx_ring), - GFP_KERNEL); + tp->rx_ring = kzalloc_objs(struct rtl8169_rx_ring, tp->num_rx_rings); if (!tp->rx_ring) { rc = -ENOMEM; goto err_destroy_phylink; @@ -7019,8 +7018,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) for (int i = 0; i < tp->num_rx_rings; i++) u64_stats_init(&tp->rx_ring[i].stats.syncp); - tp->rtl8169_napi = kcalloc(tp->irq_nvecs, sizeof(struct napi_struct), - GFP_KERNEL); + tp->rtl8169_napi = kzalloc_objs(struct napi_struct, tp->irq_nvecs); if (!tp->rtl8169_napi) { rc = -ENOMEM; goto err_free_rx_ring; diff --git a/drivers/net/ethernet/rocker/rocker_ofdpa.c b/drivers/net/ethernet/rocker/rocker_ofdpa.c index ace69a1d5275..1e0558bd78c3 100644 --- a/drivers/net/ethernet/rocker/rocker_ofdpa.c +++ b/drivers/net/ethernet/rocker/rocker_ofdpa.c @@ -1435,7 +1435,7 @@ static int ofdpa_port_vlan_flood_group(struct ofdpa_port *ofdpa_port, int err = 0; int i; - group_ids = kcalloc(port_count, sizeof(u32), GFP_KERNEL); + group_ids = kzalloc_objs(u32, port_count); if (!group_ids) return -ENOMEM; diff --git a/drivers/net/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c index 0c197b448645..323db6ada50c 100644 --- a/drivers/net/ethernet/sfc/falcon/efx.c +++ b/drivers/net/ethernet/sfc/falcon/efx.c @@ -1693,9 +1693,8 @@ static int ef4_probe_filters(struct ef4_nic *efx) ef4_for_each_channel(channel, efx) { channel->rps_flow_id = - kcalloc(efx->type->max_rx_ip_filters, - sizeof(*channel->rps_flow_id), - GFP_KERNEL); + kzalloc_objs(*channel->rps_flow_id, + efx->type->max_rx_ip_filters); if (!channel->rps_flow_id) success = 0; else diff --git a/drivers/net/ethernet/sfc/mae.c b/drivers/net/ethernet/sfc/mae.c index b6de61062a86..d561b9337885 100644 --- a/drivers/net/ethernet/sfc/mae.c +++ b/drivers/net/ethernet/sfc/mae.c @@ -1982,10 +1982,10 @@ int efx_mae_insert_ct(struct efx_nic *efx, struct efx_tc_ct_entry *conn) if (!inbuf) return -ENOMEM; - key = kcalloc(kw, sizeof(__le32), GFP_KERNEL); + key = kzalloc_objs(__le32, kw); if (!key) goto out_free; - resp = kcalloc(rw, sizeof(__le32), GFP_KERNEL); + resp = kzalloc_objs(__le32, rw); if (!resp) goto out_free; @@ -2053,7 +2053,7 @@ int efx_mae_remove_ct(struct efx_nic *efx, struct efx_tc_ct_entry *conn) if (!inbuf) return -ENOMEM; - key = kcalloc(kw, sizeof(__le32), GFP_KERNEL); + key = kzalloc_objs(__le32, kw); if (!key) goto out_free; diff --git a/drivers/net/ethernet/sfc/rx_common.c b/drivers/net/ethernet/sfc/rx_common.c index fd0a1a8ac2a1..020a7091c06b 100644 --- a/drivers/net/ethernet/sfc/rx_common.c +++ b/drivers/net/ethernet/sfc/rx_common.c @@ -762,9 +762,8 @@ int efx_probe_filters(struct efx_nic *efx) efx_for_each_channel(channel, efx) { channel->rps_flow_id = - kcalloc(efx->type->max_rx_ip_filters, - sizeof(*channel->rps_flow_id), - GFP_KERNEL); + kzalloc_objs(*channel->rps_flow_id, + efx->type->max_rx_ip_filters); if (!channel->rps_flow_id) success = 0; else diff --git a/drivers/net/ethernet/sfc/siena/rx_common.c b/drivers/net/ethernet/sfc/siena/rx_common.c index 4ceb108fad48..6c778b791a90 100644 --- a/drivers/net/ethernet/sfc/siena/rx_common.c +++ b/drivers/net/ethernet/sfc/siena/rx_common.c @@ -751,9 +751,8 @@ int efx_siena_probe_filters(struct efx_nic *efx) efx_for_each_channel(channel, efx) { channel->rps_flow_id = - kcalloc(efx->type->max_rx_ip_filters, - sizeof(*channel->rps_flow_id), - GFP_KERNEL); + kzalloc_objs(*channel->rps_flow_id, + efx->type->max_rx_ip_filters); if (!channel->rps_flow_id) success = 0; else diff --git a/drivers/net/ethernet/sfc/siena/siena_sriov.c b/drivers/net/ethernet/sfc/siena/siena_sriov.c index d9789330f8dc..df715727567e 100644 --- a/drivers/net/ethernet/sfc/siena/siena_sriov.c +++ b/drivers/net/ethernet/sfc/siena/siena_sriov.c @@ -830,8 +830,7 @@ static int efx_vfdi_set_status_page(struct siena_vf *vf) vf->peer_page_count = 0; if (page_count) { - vf->peer_page_addrs = kcalloc(page_count, sizeof(u64), - GFP_KERNEL); + vf->peer_page_addrs = kzalloc_objs(u64, page_count); if (vf->peer_page_addrs) { memcpy(vf->peer_page_addrs, req->u.set_status_page.peer_page_addr, diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c index e551ae0e2069..22f1bad92a29 100644 --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c @@ -86,8 +86,7 @@ static int txgbe_calc_eeprom_checksum(struct wx *wx, u16 *checksum) wx_init_eeprom_params(wx); - eeprom_ptrs = kvmalloc_array(TXGBE_EEPROM_LAST_WORD, sizeof(u16), - GFP_KERNEL); + eeprom_ptrs = kvmalloc_objs(u16, TXGBE_EEPROM_LAST_WORD); if (!eeprom_ptrs) return -ENOMEM; /* Read pointer area */ diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 9b6c44979b4e..9b6e974c4102 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -1555,7 +1555,7 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev, else ndc->rx_table_sz = ITAB_NUM; - ndc->rx_table = kcalloc(ndc->rx_table_sz, sizeof(u16), GFP_KERNEL); + ndc->rx_table = kzalloc_objs(u16, ndc->rx_table_sz); if (!ndc->rx_table) { ret = -ENOMEM; goto err_dev_remv; diff --git a/drivers/net/mctp/mctp-usblib-test.c b/drivers/net/mctp/mctp-usblib-test.c index 3a48b10164b0..f4e1258756d4 100644 --- a/drivers/net/mctp/mctp-usblib-test.c +++ b/drivers/net/mctp/mctp-usblib-test.c @@ -46,7 +46,7 @@ static int mctp_usblib_test_tx_send(struct mctp_usblib_tx_ctx *tx_ctx, ctx = mctp_usblib_tx_ctx_priv(tx_ctx); ndev = ctx->dev->ndev; - new_node = kzalloc_flex(*new_node, data, len, GFP_KERNEL); + new_node = kzalloc_flex(*new_node, data, len); if (!new_node) return -ENOMEM; diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c index feb88ccbbced..c6b17b387327 100644 --- a/drivers/net/netdevsim/dev.c +++ b/drivers/net/netdevsim/dev.c @@ -871,9 +871,8 @@ static int nsim_dev_traps_init(struct devlink *devlink) goto err_trap_data_free; } - nsim_trap_data->trap_policers_cnt_arr = kcalloc(policers_count, - sizeof(u64), - GFP_KERNEL); + nsim_trap_data->trap_policers_cnt_arr = kzalloc_objs(u64, + policers_count); if (!nsim_trap_data->trap_policers_cnt_arr) { err = -ENOMEM; goto err_trap_items_free; diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c index 51bf887e3520..ad9f0f5e4438 100644 --- a/drivers/net/usb/asix_common.c +++ b/drivers/net/usb/asix_common.c @@ -626,8 +626,7 @@ int asix_get_eeprom(struct net_device *net, struct ethtool_eeprom *eeprom, first_word = eeprom->offset >> 1; last_word = (eeprom->offset + eeprom->len - 1) >> 1; - eeprom_buff = kmalloc_array(last_word - first_word + 1, sizeof(u16), - GFP_KERNEL); + eeprom_buff = kmalloc_objs(u16, last_word - first_word + 1); if (!eeprom_buff) return -ENOMEM; @@ -666,8 +665,7 @@ int asix_set_eeprom(struct net_device *net, struct ethtool_eeprom *eeprom, first_word = eeprom->offset >> 1; last_word = (eeprom->offset + eeprom->len - 1) >> 1; - eeprom_buff = kmalloc_array(last_word - first_word + 1, sizeof(u16), - GFP_KERNEL); + eeprom_buff = kmalloc_objs(u16, last_word - first_word + 1); if (!eeprom_buff) return -ENOMEM; diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index c179e2319081..2279dbbcdb4d 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -555,8 +555,7 @@ ax88179_get_eeprom(struct net_device *net, struct ethtool_eeprom *eeprom, first_word = eeprom->offset >> 1; last_word = (eeprom->offset + eeprom->len - 1) >> 1; - eeprom_buff = kmalloc_array(last_word - first_word + 1, sizeof(u16), - GFP_KERNEL); + eeprom_buff = kmalloc_objs(u16, last_word - first_word + 1); if (!eeprom_buff) return -ENOMEM; @@ -598,8 +597,7 @@ ax88179_set_eeprom(struct net_device *net, struct ethtool_eeprom *eeprom, first_word = eeprom->offset >> 1; last_word = (eeprom->offset + eeprom->len - 1) >> 1; - eeprom_buff = kmalloc_array(last_word - first_word + 1, sizeof(u16), - GFP_KERNEL); + eeprom_buff = kmalloc_objs(u16, last_word - first_word + 1); if (!eeprom_buff) return -ENOMEM; diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 181e8c087655..aa0613f4bd68 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -604,7 +604,7 @@ static int lan78xx_read_reg(struct lan78xx_net *dev, u32 index, u32 *data) if (test_bit(EVENT_DEV_DISCONNECT, &dev->flags)) return -ENODEV; - buf = kmalloc(sizeof(u32), GFP_KERNEL); + buf = kmalloc_obj(u32); if (!buf) return -ENOMEM; @@ -634,7 +634,7 @@ static int lan78xx_write_reg(struct lan78xx_net *dev, u32 index, u32 data) if (test_bit(EVENT_DEV_DISCONNECT, &dev->flags)) return -ENODEV; - buf = kmalloc(sizeof(u32), GFP_KERNEL); + buf = kmalloc_obj(u32); if (!buf) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index 66b2dee39155..33297e96f01a 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c @@ -886,9 +886,7 @@ ath5k_hw_rfregs_init(struct ath5k_hw *ah, * ah->ah_rf_banks based on ah->ah_rf_banks_size * we set above */ if (ah->ah_rf_banks == NULL) { - ah->ah_rf_banks = kmalloc_array(ah->ah_rf_banks_size, - sizeof(u32), - GFP_KERNEL); + ah->ah_rf_banks = kmalloc_objs(u32, ah->ah_rf_banks_size); if (ah->ah_rf_banks == NULL) { ATH5K_ERR(ah, "out of memory\n"); return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index 65b7c68a9297..c91560d559c5 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -1047,7 +1047,7 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, n_channels = request->n_channels; - channels = kcalloc(n_channels, sizeof(u16), GFP_KERNEL); + channels = kzalloc_objs(u16, n_channels); if (channels == NULL) { ath6kl_warn("failed to set scan channels, scan all channels"); n_channels = 0; diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c index 83d993fff695..6170e37d0205 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c @@ -925,7 +925,7 @@ int ar9003_paprd_create_curve(struct ath_hw *ah, memset(caldata->pa_table[chain], 0, sizeof(caldata->pa_table[chain])); - buf = kmalloc_array(2 * 48, sizeof(u32), GFP_KERNEL); + buf = kmalloc_objs(u32, 2 * 48); if (!buf) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index e08ab73fcacb..10e819d1bff6 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -127,13 +127,13 @@ void ath9k_hw_read_array(struct ath_hw *ah, u32 array[][2], int size) u32 *tmp_reg_list, *tmp_data; int i; - tmp_reg_list = kmalloc_array(size, sizeof(u32), GFP_KERNEL); + tmp_reg_list = kmalloc_objs(u32, size); if (!tmp_reg_list) { dev_err(ah->dev, "%s: tmp_reg_list: alloc filed\n", __func__); return; } - tmp_data = kmalloc_array(size, sizeof(u32), GFP_KERNEL); + tmp_data = kmalloc_objs(u32, size); if (!tmp_data) { dev_err(ah->dev, "%s tmp_data: alloc filed\n", __func__); goto error_tmp_data; diff --git a/drivers/net/wireless/broadcom/b43/phy_lp.c b/drivers/net/wireless/broadcom/b43/phy_lp.c index 8e0058072242..3bbee377a14e 100644 --- a/drivers/net/wireless/broadcom/b43/phy_lp.c +++ b/drivers/net/wireless/broadcom/b43/phy_lp.c @@ -1570,7 +1570,7 @@ static void lpphy_pr41573_workaround(struct b43_wldev *dev) s8 tx_pwr_idx_over; u16 tssi_npt, tssi_idx; - saved_tab = kcalloc(saved_tab_size, sizeof(saved_tab[0]), GFP_KERNEL); + saved_tab = kzalloc_objs(saved_tab[0], saved_tab_size); if (!saved_tab) { b43err(dev->wl, "PR41573 failed. Out of memory!\n"); return; diff --git a/drivers/net/wireless/broadcom/b43/phy_n.c b/drivers/net/wireless/broadcom/b43/phy_n.c index 22359bd9db47..0972070846bb 100644 --- a/drivers/net/wireless/broadcom/b43/phy_n.c +++ b/drivers/net/wireless/broadcom/b43/phy_n.c @@ -1506,7 +1506,7 @@ static int b43_nphy_load_samples(struct b43_wldev *dev, u16 i; u32 *data; - data = kcalloc(len, sizeof(u32), GFP_KERNEL); + data = kzalloc_objs(u32, len); if (!data) { b43err(dev->wl, "allocation for samples loading failed\n"); return -ENOMEM; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c index 813cc15d8b87..e6f73188d42d 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c @@ -816,8 +816,7 @@ static s32 brcmf_p2p_run_escan(struct brcmf_cfg80211_info *cfg, } if (request->n_channels) { - chanspecs = kcalloc(request->n_channels, sizeof(*chanspecs), - GFP_KERNEL); + chanspecs = kzalloc_objs(*chanspecs, request->n_channels); if (!chanspecs) { err = -ENOMEM; goto exit; @@ -1100,8 +1099,7 @@ static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel) channel_cnt = AF_PEER_SEARCH_CNT; else channel_cnt = SOCIAL_CHAN_CNT; - default_chan_list = kcalloc(channel_cnt, sizeof(*default_chan_list), - GFP_KERNEL); + default_chan_list = kzalloc_objs(*default_chan_list, channel_cnt); if (default_chan_list == NULL) { bphy_err(drvr, "channel list allocation failed\n"); err = -ENOMEM; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c index 17bae04c14b0..e0ff122e1701 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c @@ -2107,7 +2107,7 @@ static int brcmf_pcie_read_otp(struct brcmf_pciedev_info *devinfo) sromctl | BCMA_CC_SROM_CONTROL_OTPSEL); } - otp = kcalloc(words, sizeof(u16), GFP_KERNEL); + otp = kzalloc_objs(u16, words); if (!otp) return -ENOMEM; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c index d65a68045ca8..70ef76b5546a 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c @@ -2594,7 +2594,7 @@ wlc_lcnphy_tx_iqlo_cal(struct brcms_phy *pi, if (WARN_ON(CHSPEC_IS5G(pi->radio_chanspec))) return; - values_to_save = kmalloc_array(20, sizeof(u16), GFP_ATOMIC); + values_to_save = kmalloc_objs(u16, 20, GFP_ATOMIC); if (NULL == values_to_save) return; @@ -3602,7 +3602,7 @@ wlc_lcnphy_a1(struct brcms_phy *pi, int cal_type, int num_levels, if (NULL == ptr) return; - phy_c32 = kmalloc_array(20, sizeof(u16), GFP_ATOMIC); + phy_c32 = kmalloc_objs(u16, 20, GFP_ATOMIC); if (NULL == phy_c32) { kfree(ptr); return; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c index 9ddd5d519893..0b99106672cc 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c @@ -23007,7 +23007,7 @@ wlc_phy_loadsampletable_nphy(struct brcms_phy *pi, struct cordic_iq *tone_buf, u16 t; u32 *data_buf = NULL; - data_buf = kmalloc_array(num_samps, sizeof(u32), GFP_ATOMIC); + data_buf = kmalloc_objs(u32, num_samps, GFP_ATOMIC); if (data_buf == NULL) return; diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index c15d6e1dd8f6..8f2e932c5484 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -2586,9 +2586,8 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter) if (!card->mp_regs) return -ENOMEM; - card->mpa_rx.len_arr = kcalloc(card->mp_agg_pkt_limit, - sizeof(*card->mpa_rx.len_arr), - GFP_KERNEL); + card->mpa_rx.len_arr = kzalloc_objs(*card->mpa_rx.len_arr, + card->mp_agg_pkt_limit); if (!card->mpa_rx.len_arr) { kfree(card->mp_regs); return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/cached_cal.c b/drivers/net/wireless/mediatek/mt76/mt7925/cached_cal.c index 0209606e1a47..eb1e1b4c1090 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/cached_cal.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/cached_cal.c @@ -76,7 +76,7 @@ int mt7925_mcu_send_axidma_info(struct mt792x_dev *dev) if (!dev->cached_cal.va) return -EINVAL; - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req); if (!req) return -ENOMEM; @@ -195,7 +195,7 @@ static int mt7925_mcu_fact_cal_rapid_set(struct mt792x_dev *dev, u8 cal_type, if (data_len > MT7925_FACT_CAL_DATA_BUF_LEN) return -EINVAL; - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req); if (!req) return -ENOMEM; @@ -225,7 +225,7 @@ int mt7925_mcu_send_fact_cal_mapping_tbl(struct mt792x_dev *dev) if (!dev->cached_cal.va) return -EINVAL; - tbl = kzalloc(sizeof(*tbl), GFP_KERNEL); + tbl = kzalloc_obj(*tbl); if (!tbl) return -ENOMEM; diff --git a/drivers/net/wireless/nxp/nxpwifi/cfg80211.c b/drivers/net/wireless/nxp/nxpwifi/cfg80211.c index ade57f128d10..ba54078b082c 100644 --- a/drivers/net/wireless/nxp/nxpwifi/cfg80211.c +++ b/drivers/net/wireless/nxp/nxpwifi/cfg80211.c @@ -3746,9 +3746,8 @@ int nxpwifi_init_channel_scan_gap(struct nxpwifi_adapter *adapter) * additional active scan request for hidden SSIDs on passive channels. */ adapter->num_in_chan_stats = 2 * (n_channels_bg + n_channels_a); - adapter->chan_stats = kcalloc(adapter->num_in_chan_stats, - sizeof(*adapter->chan_stats), - GFP_KERNEL); + adapter->chan_stats = kzalloc_objs(*adapter->chan_stats, + adapter->num_in_chan_stats); if (!adapter->chan_stats) return -ENOMEM; diff --git a/drivers/net/wireless/realtek/rtlwifi/efuse.c b/drivers/net/wireless/realtek/rtlwifi/efuse.c index 6518e77b89f5..b3936d9e0510 100644 --- a/drivers/net/wireless/realtek/rtlwifi/efuse.c +++ b/drivers/net/wireless/realtek/rtlwifi/efuse.c @@ -235,8 +235,7 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf) if (!efuse_word) goto out; for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) { - efuse_word[i] = kcalloc(efuse_max_section, sizeof(u16), - GFP_ATOMIC); + efuse_word[i] = kzalloc_objs(u16, efuse_max_section, GFP_ATOMIC); if (!efuse_word[i]) goto done; } diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c index 88e8cc590c54..d0b233361ba5 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c @@ -64,12 +64,10 @@ static int rtl92du_init_shared_data(struct ieee80211_hw *hw) } /* The other interface doesn't exist or was not probed yet. */ - rtlpriv->curveindex_2g = kcalloc(TARGET_CHNL_NUM_2G, - sizeof(*rtlpriv->curveindex_2g), - GFP_KERNEL); - rtlpriv->curveindex_5g = kcalloc(TARGET_CHNL_NUM_5G, - sizeof(*rtlpriv->curveindex_5g), - GFP_KERNEL); + rtlpriv->curveindex_2g = kzalloc_objs(*rtlpriv->curveindex_2g, + TARGET_CHNL_NUM_2G); + rtlpriv->curveindex_5g = kzalloc_objs(*rtlpriv->curveindex_5g, + TARGET_CHNL_NUM_5G); rtlpriv->mutex_for_power_on_off = kzalloc_obj(*rtlpriv->mutex_for_power_on_off); rtlpriv->mutex_for_hw_init = kzalloc_obj(*rtlpriv->mutex_for_hw_init); diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c index 48b6223e259e..727cce176a0c 100644 --- a/drivers/nvdimm/btt.c +++ b/drivers/nvdimm/btt.c @@ -721,7 +721,7 @@ static int log_set_indices(struct arena_info *arena) static int btt_rtt_init(struct arena_info *arena) { - arena->rtt = kcalloc(arena->nfree, sizeof(u32), GFP_KERNEL); + arena->rtt = kzalloc_objs(u32, arena->nfree); if (arena->rtt == NULL) return -ENOMEM; diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index a8171b88035c..a0720cf898bd 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c @@ -1681,8 +1681,8 @@ struct nvmet_ctrl *nvmet_alloc_ctrl(struct nvmet_alloc_ctrl_args *args) nvmet_init_cap(ctrl); WRITE_ONCE(ctrl->aen_enabled, NVMET_AEN_CFG_OPTIONAL); - ctrl->changed_ns_list = kmalloc_array(NVME_MAX_CHANGED_NAMESPACES, - sizeof(__le32), GFP_KERNEL); + ctrl->changed_ns_list = kmalloc_objs(__le32, + NVME_MAX_CHANGED_NAMESPACES); if (!ctrl->changed_ns_list) goto out_free_ctrl; diff --git a/drivers/opp/of.c b/drivers/opp/of.c index ea9380079578..c773766e7021 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -599,7 +599,7 @@ static u32 *_parse_named_prop(struct dev_pm_opp *opp, struct device *dev, return ERR_PTR(-EINVAL); } - out = kmalloc_array(count, sizeof(*out), GFP_KERNEL); + out = kmalloc_objs(*out, count); if (!out) return ERR_PTR(-EINVAL); @@ -737,7 +737,7 @@ static int _read_rate(struct dev_pm_opp *new_opp, struct opp_table *opp_table, return -EINVAL; } - rates = kmalloc_array(count, sizeof(*rates), GFP_KERNEL); + rates = kmalloc_objs(*rates, count); if (!rates) return -ENOMEM; @@ -782,7 +782,7 @@ static int _read_bw(struct dev_pm_opp *new_opp, struct opp_table *opp_table, return -EINVAL; } - bw = kmalloc_array(count, sizeof(*bw), GFP_KERNEL); + bw = kmalloc_objs(*bw, count); if (!bw) return -ENOMEM; diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c index 1500740cc55d..5dc36bdcdac3 100644 --- a/drivers/pci/of_property.c +++ b/drivers/pci/of_property.c @@ -268,7 +268,7 @@ static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs, if (!map_sz) return 0; - int_map = kcalloc(map_sz, sizeof(u32), GFP_KERNEL); + int_map = kzalloc_objs(u32, map_sz); if (!int_map) return -ENOMEM; mapp = int_map; diff --git a/drivers/phy/phy-common-props.c b/drivers/phy/phy-common-props.c index 3e814bcbea86..c97f0eb5c7b2 100644 --- a/drivers/phy/phy-common-props.c +++ b/drivers/phy/phy-common-props.c @@ -88,7 +88,7 @@ static int fwnode_get_u32_prop_for_name(struct fwnode_handle *fwnode, } /* We implicitly know idx >= 0 here */ - props = kcalloc(n_props, sizeof(*props), GFP_KERNEL); + props = kzalloc_objs(*props, n_props); if (!props) return -ENOMEM; diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c index 36845517984e..02a70a6bbbdd 100644 --- a/drivers/pinctrl/pinconf-generic.c +++ b/drivers/pinctrl/pinconf-generic.c @@ -392,7 +392,7 @@ int pinconf_generic_parse_dt_config(struct device_node *np, max_cfg = ARRAY_SIZE(dt_params); if (pctldev) max_cfg += pctldev->desc->num_custom_params; - cfg = kcalloc(max_cfg, sizeof(*cfg), GFP_KERNEL); + cfg = kzalloc_objs(*cfg, max_cfg); if (!cfg) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-apple-gpio.c b/drivers/pinctrl/pinctrl-apple-gpio.c index 6b26a23d283c..a190e264a6d5 100644 --- a/drivers/pinctrl/pinctrl-apple-gpio.c +++ b/drivers/pinctrl/pinctrl-apple-gpio.c @@ -412,9 +412,7 @@ static int apple_gpio_register(struct apple_gpio_pinctrl *pctl) gpio_irq_chip_set_chip(girq, &apple_gpio_irqchip); girq->parent_handler = apple_gpio_irq_handler; - girq->parents = kmalloc_array(girq->num_parents, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = kmalloc_objs(*girq->parents, girq->num_parents); irq_data = kmalloc_objs(*irq_data, girq->num_parents); if (!girq->parents || !irq_data) { ret = -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-scmi.c b/drivers/pinctrl/pinctrl-scmi.c index c93d61dfa282..fdede6f6078c 100644 --- a/drivers/pinctrl/pinctrl-scmi.c +++ b/drivers/pinctrl/pinctrl-scmi.c @@ -216,7 +216,7 @@ pinctrl_scmi_alloc_configs(struct pinctrl_dev *pctldev, u32 num_configs, if (num_configs <= SCMI_NUM_CONFIGS) return 0; - *p_config_value = kcalloc(num_configs, sizeof(**p_config_value), GFP_KERNEL); + *p_config_value = kzalloc_objs(**p_config_value, num_configs); if (!*p_config_value) return -ENOMEM; diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index 27f06bbc113c..07a7961f8d3e 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -759,7 +759,7 @@ static int msm_gpio_init_valid_mask(struct gpio_chip *gc, if (ret > ngpios) return -EINVAL; - tmp = kmalloc_array(len, sizeof(*tmp), GFP_KERNEL); + tmp = kmalloc_objs(*tmp, len); if (!tmp) return -ENOMEM; diff --git a/drivers/pinctrl/qcom/tlmm-test.c b/drivers/pinctrl/qcom/tlmm-test.c index 8bff92dc0d0b..77970b1be381 100644 --- a/drivers/pinctrl/qcom/tlmm-test.c +++ b/drivers/pinctrl/qcom/tlmm-test.c @@ -587,7 +587,7 @@ static int tlmm_reg_base(struct device_node *tlmm, struct resource *res) return count; } - reg_names = kcalloc(count, sizeof(*reg_names), GFP_KERNEL); + reg_names = kzalloc_objs(*reg_names, count); if (!reg_names) return -ENOMEM; diff --git a/drivers/pinctrl/renesas/core.c b/drivers/pinctrl/renesas/core.c index a466ebf99593..4b59fa1ecdeb 100644 --- a/drivers/pinctrl/renesas/core.c +++ b/drivers/pinctrl/renesas/core.c @@ -1135,7 +1135,7 @@ static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info) } /* Check groups and functions */ - refcnts = kcalloc(info->nr_groups, sizeof(*refcnts), GFP_KERNEL); + refcnts = kzalloc_objs(*refcnts, info->nr_groups); if (!refcnts) return; @@ -1277,8 +1277,7 @@ static void __init sh_pfc_check_driver(const struct platform_driver *pdrv) if (!sh_pfc_regs) return; - sh_pfc_enums = kcalloc(SH_PFC_MAX_ENUMS, sizeof(*sh_pfc_enums), - GFP_KERNEL); + sh_pfc_enums = kzalloc_objs(*sh_pfc_enums, SH_PFC_MAX_ENUMS); if (!sh_pfc_enums) goto free_regs; diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index 3ee5012463da..4ce775348ff6 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -388,7 +388,7 @@ static unsigned long *sunxi_pctrl_build_pin_config(struct device_node *node, if (!configlen) return NULL; - pinconfig = kcalloc(configlen, sizeof(*pinconfig), GFP_KERNEL); + pinconfig = kzalloc_objs(*pinconfig, configlen); if (!pinconfig) return ERR_PTR(-ENOMEM); diff --git a/drivers/platform/raspberrypi/vchiq-interface/vchiq_core.c b/drivers/platform/raspberrypi/vchiq-interface/vchiq_core.c index 48d6b1d74329..e809a19f5535 100644 --- a/drivers/platform/raspberrypi/vchiq-interface/vchiq_core.c +++ b/drivers/platform/raspberrypi/vchiq-interface/vchiq_core.c @@ -2350,8 +2350,7 @@ recycle_func(void *v) length = sizeof(*found) * BITSET_SIZE(VCHIQ_MAX_SERVICES); - found = kmalloc_array(BITSET_SIZE(VCHIQ_MAX_SERVICES), sizeof(*found), - GFP_KERNEL); + found = kmalloc_objs(*found, BITSET_SIZE(VCHIQ_MAX_SERVICES)); if (!found) return -ENOMEM; diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index 71be313bdf0e..ab5f6ad74ab0 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -272,7 +272,7 @@ static void pmc_core_lpm_display(struct pmc *pmc, struct device *dev, u32 bit_mask, *lpm_regs; arr_size = pmc_core_lpm_get_arr_size(maps); - lpm_regs = kmalloc_array(arr_size, sizeof(*lpm_regs), GFP_KERNEL); + lpm_regs = kmalloc_objs(*lpm_regs, arr_size); if (!lpm_regs) return; diff --git a/drivers/platform/x86/intel/tpmi_power_domains.c b/drivers/platform/x86/intel/tpmi_power_domains.c index d89b9894c42a..ebe052c3bbe4 100644 --- a/drivers/platform/x86/intel/tpmi_power_domains.c +++ b/drivers/platform/x86/intel/tpmi_power_domains.c @@ -240,8 +240,8 @@ static int __init tpmi_init(void) if (!tpmi_power_domain_mask) return -ENOMEM; - domain_die_map = kcalloc(size_mul(topology_max_packages(), MAX_POWER_DOMAINS), - sizeof(*domain_die_map), GFP_KERNEL); + domain_die_map = kzalloc_objs(*domain_die_map, + size_mul(topology_max_packages(), MAX_POWER_DOMAINS)); if (!domain_die_map) { ret = -ENOMEM; goto free_domain_mask; diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index b1b2d9caba7b..b935be2a2fd9 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c @@ -960,12 +960,12 @@ static int ips_monitor(void *data) u16 *mcp_samples, *ctv1_samples, *ctv2_samples, *mch_samples; u8 cur_seqno, last_seqno; - mcp_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL); - ctv1_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL); - ctv2_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL); - mch_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL); - cpu_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u32), GFP_KERNEL); - mchp_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u32), GFP_KERNEL); + mcp_samples = kzalloc_objs(u16, IPS_SAMPLE_COUNT); + ctv1_samples = kzalloc_objs(u16, IPS_SAMPLE_COUNT); + ctv2_samples = kzalloc_objs(u16, IPS_SAMPLE_COUNT); + mch_samples = kzalloc_objs(u16, IPS_SAMPLE_COUNT); + cpu_samples = kzalloc_objs(u32, IPS_SAMPLE_COUNT); + mchp_samples = kzalloc_objs(u32, IPS_SAMPLE_COUNT); if (!mcp_samples || !ctv1_samples || !ctv2_samples || !mch_samples || !cpu_samples || !mchp_samples) { dev_err(ips->dev, diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c index 8138b52e05e1..f67ec2f0d3b6 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -669,7 +669,7 @@ static int max17042_init_model(struct max17042_chip *chip) int table_size = ARRAY_SIZE(chip->config_data->cell_char_tbl); u16 *temp_data; - temp_data = kcalloc(table_size, sizeof(*temp_data), GFP_KERNEL); + temp_data = kzalloc_objs(*temp_data, table_size); if (!temp_data) return -ENOMEM; @@ -698,7 +698,7 @@ static int max17042_verify_model_lock(struct max17042_chip *chip) u16 *temp_data; int ret = 0; - temp_data = kcalloc(table_size, sizeof(*temp_data), GFP_KERNEL); + temp_data = kzalloc_objs(*temp_data, table_size); if (!temp_data) return -ENOMEM; diff --git a/drivers/power/supply/max8903_charger.c b/drivers/power/supply/max8903_charger.c index d5267ba19969..35c785b940f5 100644 --- a/drivers/power/supply/max8903_charger.c +++ b/drivers/power/supply/max8903_charger.c @@ -498,7 +498,7 @@ static int max8903_parse_dc_current_limit(struct platform_device *pdev, * reason to keep the raw mirror around for the lifetime of the * device. */ - map = kmalloc_array(map_size, sizeof(*map), GFP_KERNEL); + map = kmalloc_objs(*map, map_size); if (!map) return -ENOMEM; diff --git a/drivers/ras/amd/fmpm.c b/drivers/ras/amd/fmpm.c index 4ccaaf7b70bf..2b28a5504f5e 100644 --- a/drivers/ras/amd/fmpm.c +++ b/drivers/ras/amd/fmpm.c @@ -834,7 +834,7 @@ static int allocate_records(void) } } - spa_entries = kcalloc(spa_nr_entries, sizeof(u64), GFP_KERNEL); + spa_entries = kzalloc_objs(u64, spa_nr_entries); if (!spa_entries) { ret = -ENOMEM; goto out_free; diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c index a4636c7bc6b7..bcdb62b9acfb 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -534,8 +534,7 @@ static int pru_handle_intrmap(struct rproc *rproc) return -EINVAL; pru->evt_count = rsc->num_evts; - pru->mapped_irq = kcalloc(pru->evt_count, sizeof(unsigned int), - GFP_KERNEL); + pru->mapped_irq = kzalloc_objs(unsigned int, pru->evt_count); if (!pru->mapped_irq) { pru->evt_count = 0; return -ENOMEM; diff --git a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c index 63bcb52d6e87..28083467e1b3 100644 --- a/drivers/s390/char/keyboard.c +++ b/drivers/s390/char/keyboard.c @@ -81,8 +81,7 @@ kbd_alloc(void) { kbd = kzalloc_obj(struct kbd_data); if (!kbd) goto out; - kbd->key_maps = kcalloc(ARRAY_SIZE(ebc_key_maps), - sizeof(*kbd->key_maps), GFP_KERNEL); + kbd->key_maps = kzalloc_objs(*kbd->key_maps, ARRAY_SIZE(ebc_key_maps)); if (!kbd->key_maps) goto out_kbd; for (i = 0; i < ARRAY_SIZE(ebc_key_maps); i++) { @@ -94,8 +93,8 @@ kbd_alloc(void) { goto out_maps; } } - kbd->func_table = kcalloc(ARRAY_SIZE(ebc_func_table), - sizeof(*kbd->func_table), GFP_KERNEL); + kbd->func_table = kzalloc_objs(*kbd->func_table, + ARRAY_SIZE(ebc_func_table)); if (!kbd->func_table) goto out_maps; for (i = 0; i < ARRAY_SIZE(ebc_func_table); i++) { diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 80435fd8e6ad..15927d4ed419 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c @@ -1668,7 +1668,7 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd, case ZCRYPT_PERDEV_REQCNT: { u32 *reqcnt; - reqcnt = kcalloc(AP_DEVICES, sizeof(u32), GFP_KERNEL); + reqcnt = kzalloc_objs(u32, AP_DEVICES); if (!reqcnt) return -ENOMEM; zcrypt_perdev_reqcnt(reqcnt, AP_DEVICES); diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 356ab9c0fb7c..cadcaefaa8a5 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -4007,9 +4007,8 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba) /* Allocate memory for CID array */ ptr_cid_info->cid_array = - kcalloc(BEISCSI_GET_CID_COUNT(phba, ulp_num), - sizeof(*ptr_cid_info->cid_array), - GFP_KERNEL); + kzalloc_objs(*ptr_cid_info->cid_array, + BEISCSI_GET_CID_COUNT(phba, ulp_num)); if (!ptr_cid_info->cid_array) { kfree(ptr_cid_info); ptr_cid_info = NULL; diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 187505950b63..14e9ba693169 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -6500,7 +6500,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, return -EINVAL; if (ioc->buf_size > ioc->malloc_size * SG_ENTRIES_IN_CMD) return -EINVAL; - buff = kcalloc(SG_ENTRIES_IN_CMD, sizeof(*buff), GFP_KERNEL); + buff = kzalloc_objs(*buff, SG_ENTRIES_IN_CMD); if (!buff) { status = -ENOMEM; goto cleanup1; @@ -8640,7 +8640,7 @@ static struct ctlr_info *hpda_alloc_ctlr_info(void) if (!h) return NULL; - h->reply_map = kcalloc(nr_cpu_ids, sizeof(*h->reply_map), GFP_KERNEL); + h->reply_map = kzalloc_objs(*h->reply_map, nr_cpu_ids); if (!h->reply_map) { kfree(h); return NULL; diff --git a/drivers/scsi/leapraid/leapraid_func.c b/drivers/scsi/leapraid/leapraid_func.c index 66b43c1c72e1..573bccf1a4ce 100644 --- a/drivers/scsi/leapraid/leapraid_func.c +++ b/drivers/scsi/leapraid/leapraid_func.c @@ -7839,7 +7839,7 @@ try_again: /* Allocate I/O tracker to SCSI I/O. */ adapter->mem_desc.taskid_to_uniq_tag = - kcalloc(adapter->shost->can_queue, sizeof(u16), GFP_KERNEL); + kzalloc_objs(u16, adapter->shost->can_queue); if (!adapter->mem_desc.taskid_to_uniq_tag) return -ENOMEM; diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 7352cb6e584b..6df5f4e7c5d6 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -3026,7 +3026,7 @@ lpfc_hba_init(struct lpfc_hba *phba, uint32_t *hbainit) uint32_t *HashWorking; uint32_t *pwwnn = (uint32_t *) phba->wwnn; - HashWorking = kcalloc(80, sizeof(uint32_t), GFP_KERNEL); + HashWorking = kzalloc_objs(uint32_t, 80); if (!HashWorking) return; @@ -8347,8 +8347,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) /* Allocate eligible FCF bmask memory for FCF roundrobin failover */ longs = (LPFC_SLI4_FCF_TBL_INDX_MAX + BITS_PER_LONG - 1)/BITS_PER_LONG; - phba->fcf.fcf_rr_bmask = kcalloc(longs, sizeof(unsigned long), - GFP_KERNEL); + phba->fcf.fcf_rr_bmask = kzalloc_objs(unsigned long, longs); if (!phba->fcf.fcf_rr_bmask) { lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, "2759 Failed allocate memory for FCF round " diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 715b328d3d18..9173263c87f9 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -5727,17 +5727,14 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) */ if ((phba->vpi_bmask == NULL) && (phba->vpi_ids == NULL)) { longs = (phba->max_vpi + BITS_PER_LONG) / BITS_PER_LONG; - phba->vpi_bmask = kcalloc(longs, - sizeof(unsigned long), - GFP_KERNEL); + phba->vpi_bmask = kzalloc_objs(unsigned long, longs); if (!phba->vpi_bmask) { rc = -ENOMEM; goto lpfc_sli_hba_setup_error; } - phba->vpi_ids = kcalloc(phba->max_vpi + 1, - sizeof(uint16_t), - GFP_KERNEL); + phba->vpi_ids = kzalloc_objs(uint16_t, + phba->max_vpi + 1); if (!phba->vpi_ids) { kfree(phba->vpi_bmask); rc = -ENOMEM; @@ -6467,16 +6464,12 @@ lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type) length = sizeof(struct lpfc_rsrc_blks); switch (type) { case LPFC_RSC_TYPE_FCOE_RPI: - phba->sli4_hba.rpi_bmask = kcalloc(longs, - sizeof(unsigned long), - GFP_KERNEL); + phba->sli4_hba.rpi_bmask = kzalloc_objs(unsigned long, longs); if (unlikely(!phba->sli4_hba.rpi_bmask)) { rc = -ENOMEM; goto err_exit; } - phba->sli4_hba.rpi_ids = kcalloc(rsrc_id_cnt, - sizeof(uint16_t), - GFP_KERNEL); + phba->sli4_hba.rpi_ids = kzalloc_objs(uint16_t, rsrc_id_cnt); if (unlikely(!phba->sli4_hba.rpi_ids)) { kfree(phba->sli4_hba.rpi_bmask); rc = -ENOMEM; @@ -6496,14 +6489,12 @@ lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type) ext_blk_list = &phba->sli4_hba.lpfc_rpi_blk_list; break; case LPFC_RSC_TYPE_FCOE_VPI: - phba->vpi_bmask = kcalloc(longs, sizeof(unsigned long), - GFP_KERNEL); + phba->vpi_bmask = kzalloc_objs(unsigned long, longs); if (unlikely(!phba->vpi_bmask)) { rc = -ENOMEM; goto err_exit; } - phba->vpi_ids = kcalloc(rsrc_id_cnt, sizeof(uint16_t), - GFP_KERNEL); + phba->vpi_ids = kzalloc_objs(uint16_t, rsrc_id_cnt); if (unlikely(!phba->vpi_ids)) { kfree(phba->vpi_bmask); rc = -ENOMEM; @@ -6516,17 +6507,13 @@ lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type) ext_blk_list = &phba->lpfc_vpi_blk_list; break; case LPFC_RSC_TYPE_FCOE_XRI: - phba->sli4_hba.xri_bmask = kcalloc(longs, - sizeof(unsigned long), - GFP_KERNEL); + phba->sli4_hba.xri_bmask = kzalloc_objs(unsigned long, longs); if (unlikely(!phba->sli4_hba.xri_bmask)) { rc = -ENOMEM; goto err_exit; } phba->sli4_hba.max_cfg_param.xri_used = 0; - phba->sli4_hba.xri_ids = kcalloc(rsrc_id_cnt, - sizeof(uint16_t), - GFP_KERNEL); + phba->sli4_hba.xri_ids = kzalloc_objs(uint16_t, rsrc_id_cnt); if (unlikely(!phba->sli4_hba.xri_ids)) { kfree(phba->sli4_hba.xri_bmask); rc = -ENOMEM; @@ -6539,16 +6526,12 @@ lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type) ext_blk_list = &phba->sli4_hba.lpfc_xri_blk_list; break; case LPFC_RSC_TYPE_FCOE_VFI: - phba->sli4_hba.vfi_bmask = kcalloc(longs, - sizeof(unsigned long), - GFP_KERNEL); + phba->sli4_hba.vfi_bmask = kzalloc_objs(unsigned long, longs); if (unlikely(!phba->sli4_hba.vfi_bmask)) { rc = -ENOMEM; goto err_exit; } - phba->sli4_hba.vfi_ids = kcalloc(rsrc_id_cnt, - sizeof(uint16_t), - GFP_KERNEL); + phba->sli4_hba.vfi_ids = kzalloc_objs(uint16_t, rsrc_id_cnt); if (unlikely(!phba->sli4_hba.vfi_ids)) { kfree(phba->sli4_hba.vfi_bmask); rc = -ENOMEM; @@ -7232,15 +7215,12 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) } base = phba->sli4_hba.max_cfg_param.rpi_base; longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; - phba->sli4_hba.rpi_bmask = kcalloc(longs, - sizeof(unsigned long), - GFP_KERNEL); + phba->sli4_hba.rpi_bmask = kzalloc_objs(unsigned long, longs); if (unlikely(!phba->sli4_hba.rpi_bmask)) { rc = -ENOMEM; goto err_exit; } - phba->sli4_hba.rpi_ids = kcalloc(count, sizeof(uint16_t), - GFP_KERNEL); + phba->sli4_hba.rpi_ids = kzalloc_objs(uint16_t, count); if (unlikely(!phba->sli4_hba.rpi_ids)) { rc = -ENOMEM; goto free_rpi_bmask; @@ -7260,14 +7240,12 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) } base = phba->sli4_hba.max_cfg_param.vpi_base; longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; - phba->vpi_bmask = kcalloc(longs, sizeof(unsigned long), - GFP_KERNEL); + phba->vpi_bmask = kzalloc_objs(unsigned long, longs); if (unlikely(!phba->vpi_bmask)) { rc = -ENOMEM; goto free_rpi_ids; } - phba->vpi_ids = kcalloc(count, sizeof(uint16_t), - GFP_KERNEL); + phba->vpi_ids = kzalloc_objs(uint16_t, count); if (unlikely(!phba->vpi_ids)) { rc = -ENOMEM; goto free_vpi_bmask; @@ -7287,16 +7265,13 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) } base = phba->sli4_hba.max_cfg_param.xri_base; longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; - phba->sli4_hba.xri_bmask = kcalloc(longs, - sizeof(unsigned long), - GFP_KERNEL); + phba->sli4_hba.xri_bmask = kzalloc_objs(unsigned long, longs); if (unlikely(!phba->sli4_hba.xri_bmask)) { rc = -ENOMEM; goto free_vpi_ids; } phba->sli4_hba.max_cfg_param.xri_used = 0; - phba->sli4_hba.xri_ids = kcalloc(count, sizeof(uint16_t), - GFP_KERNEL); + phba->sli4_hba.xri_ids = kzalloc_objs(uint16_t, count); if (unlikely(!phba->sli4_hba.xri_ids)) { rc = -ENOMEM; goto free_xri_bmask; @@ -7316,15 +7291,12 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) } base = phba->sli4_hba.max_cfg_param.vfi_base; longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; - phba->sli4_hba.vfi_bmask = kcalloc(longs, - sizeof(unsigned long), - GFP_KERNEL); + phba->sli4_hba.vfi_bmask = kzalloc_objs(unsigned long, longs); if (unlikely(!phba->sli4_hba.vfi_bmask)) { rc = -ENOMEM; goto free_xri_ids; } - phba->sli4_hba.vfi_ids = kcalloc(count, sizeof(uint16_t), - GFP_KERNEL); + phba->sli4_hba.vfi_ids = kzalloc_objs(uint16_t, count); if (unlikely(!phba->sli4_hba.vfi_ids)) { rc = -ENOMEM; goto free_vfi_bmask; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 1064c5baae8e..602173fd313a 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -7157,8 +7157,7 @@ static inline int megasas_alloc_mfi_ctrl_mem(struct megasas_instance *instance) */ static int megasas_alloc_ctrl_mem(struct megasas_instance *instance) { - instance->reply_map = kcalloc(nr_cpu_ids, sizeof(unsigned int), - GFP_KERNEL); + instance->reply_map = kzalloc_objs(unsigned int, nr_cpu_ids); if (!instance->reply_map) return -ENOMEM; diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 1af25a22611a..5c957044eded 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -6589,8 +6589,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ioc->internal, ioc->internal_depth, ioc->internal_smid)); - ioc->io_queue_num = kcalloc(ioc->scsiio_depth, - sizeof(u16), GFP_KERNEL); + ioc->io_queue_num = kzalloc_objs(u16, ioc->scsiio_depth); if (!ioc->io_queue_num) goto out; /* diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c index ffbe60234eef..913ce0dc07e0 100644 --- a/drivers/sh/intc/core.c +++ b/drivers/sh/intc/core.c @@ -243,12 +243,12 @@ int __init register_intc_controller(struct intc_desc *desc) d->nr_reg += hw->ack_regs ? hw->nr_ack_regs : 0; d->nr_reg += hw->subgroups ? hw->nr_subgroups : 0; - d->reg = kcalloc(d->nr_reg, sizeof(*d->reg), GFP_NOWAIT); + d->reg = kzalloc_objs(*d->reg, d->nr_reg, GFP_NOWAIT); if (!d->reg) goto err2; #ifdef CONFIG_SMP - d->smp = kcalloc(d->nr_reg, sizeof(*d->smp), GFP_NOWAIT); + d->smp = kzalloc_objs(*d->smp, d->nr_reg, GFP_NOWAIT); if (!d->smp) goto err3; #endif diff --git a/drivers/soc/qcom/qmi_tmd.c b/drivers/soc/qcom/qmi_tmd.c index 54e5ce8dc462..d72fa75c3217 100644 --- a/drivers/soc/qcom/qmi_tmd.c +++ b/drivers/soc/qcom/qmi_tmd.c @@ -419,7 +419,7 @@ static void qmi_tmd_svc_arrive(struct work_struct *work) int ret, i; struct qmi_txn txn; - resp = kzalloc_obj(*resp, GFP_KERNEL); + resp = kzalloc_obj(*resp); if (!resp) { ret = -ENOMEM; goto out; diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index 2c70eedf514e..a24ac7d71d23 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -1264,7 +1264,7 @@ static int tegra_powergate_of_get_clks(struct tegra_powergate *pg, if (!pg->clks) return -ENOMEM; - pg->clk_rates = kcalloc(count, sizeof(*pg->clk_rates), GFP_KERNEL); + pg->clk_rates = kzalloc_objs(*pg->clk_rates, count); if (!pg->clk_rates) { kfree(pg->clks); return -ENOMEM; @@ -1979,7 +1979,7 @@ static int tegra_pmc_init(struct tegra_pmc *pmc) if (!pmc->wake_cntrl_level_map) return -ENOMEM; - pmc->wake_status = kcalloc(pmc->soc->max_wake_vectors, sizeof(u32), GFP_KERNEL); + pmc->wake_status = kzalloc_objs(u32, pmc->soc->max_wake_vectors); if (!pmc->wake_status) return -ENOMEM; diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c index 493bebbba521..7be74a97de2b 100644 --- a/drivers/ssb/pci.c +++ b/drivers/ssb/pci.c @@ -882,7 +882,7 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus, } pr_debug("SPROM offset is 0x%x\n", bus->sprom_offset); - buf = kcalloc(SSB_SPROMSIZE_WORDS_R123, sizeof(u16), GFP_KERNEL); + buf = kzalloc_objs(u16, SSB_SPROMSIZE_WORDS_R123); if (!buf) return -ENOMEM; bus->sprom_size = SSB_SPROMSIZE_WORDS_R123; @@ -891,8 +891,7 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus, if (err) { /* try for a 440 byte SPROM - revision 4 and higher */ kfree(buf); - buf = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16), - GFP_KERNEL); + buf = kzalloc_objs(u16, SSB_SPROMSIZE_WORDS_R4); if (!buf) return -ENOMEM; bus->sprom_size = SSB_SPROMSIZE_WORDS_R4; diff --git a/drivers/ssb/sprom.c b/drivers/ssb/sprom.c index 7cd553127861..8a61a0438c85 100644 --- a/drivers/ssb/sprom.c +++ b/drivers/ssb/sprom.c @@ -72,7 +72,7 @@ ssize_t ssb_attr_sprom_show(struct ssb_bus *bus, char *buf, ssize_t count = 0; size_t sprom_size_words = bus->sprom_size; - sprom = kcalloc(sprom_size_words, sizeof(u16), GFP_KERNEL); + sprom = kzalloc_objs(u16, sprom_size_words); if (!sprom) goto out; @@ -106,7 +106,7 @@ ssize_t ssb_attr_sprom_store(struct ssb_bus *bus, size_t sprom_size_words = bus->sprom_size; struct ssb_freeze_context freeze; - sprom = kcalloc(bus->sprom_size, sizeof(u16), GFP_KERNEL); + sprom = kzalloc_objs(u16, bus->sprom_size); if (!sprom) goto out; err = hex2sprom(sprom, buf, count, sprom_size_words); diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 7925d974de80..3d78b527cab5 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -852,7 +852,7 @@ static int fbtft_init_display_from_property(struct fbtft_par *par) if (count == 0) return -EINVAL; - values = kmalloc_array(count + 1, sizeof(*values), GFP_KERNEL); + values = kmalloc_objs(*values, count + 1); if (!values) return -ENOMEM; diff --git a/drivers/target/iscsi/iscsi_target_seq_pdu_list.c b/drivers/target/iscsi/iscsi_target_seq_pdu_list.c index 75c37c8866c8..dcae93e5c5ac 100644 --- a/drivers/target/iscsi/iscsi_target_seq_pdu_list.c +++ b/drivers/target/iscsi/iscsi_target_seq_pdu_list.c @@ -129,7 +129,7 @@ redo: seq_count++; continue; } - array = kcalloc(seq_count, sizeof(u32), GFP_KERNEL); + array = kzalloc_objs(u32, seq_count); if (!array) { pr_err("Unable to allocate memory" " for random array.\n"); @@ -149,7 +149,7 @@ redo: } if (seq_count) { - array = kcalloc(seq_count, sizeof(u32), GFP_KERNEL); + array = kzalloc_objs(u32, seq_count); if (!array) { pr_err("Unable to allocate memory for" " random array.\n"); @@ -181,7 +181,7 @@ static int iscsit_randomize_seq_lists( if (!seq_count) return 0; - array = kcalloc(seq_count, sizeof(u32), GFP_KERNEL); + array = kzalloc_objs(u32, seq_count); if (!array) { pr_err("Unable to allocate memory for random array.\n"); return -ENOMEM; diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index 896fc0f0379f..44fd25a75059 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c @@ -1813,7 +1813,7 @@ static int sbp_update_unit_directory(struct sbp_tport *tport) num_entries++; /* allocate num_entries + 4 for the header and unique ID leaf */ - data = kcalloc((num_entries + 4), sizeof(u32), GFP_KERNEL); + data = kzalloc_objs(u32, (num_entries + 4)); if (!data) return -ENOMEM; diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 425ad1246a75..456865080d71 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -645,8 +645,7 @@ static struct tcmu_cmd *tcmu_alloc_cmd(struct se_cmd *se_cmd) tcmu_cmd->tcmu_dev = udev; tcmu_cmd_set_block_cnts(tcmu_cmd); - tcmu_cmd->dbi = kcalloc(tcmu_cmd->dbi_cnt, sizeof(uint32_t), - GFP_NOIO); + tcmu_cmd->dbi = kzalloc_objs(uint32_t, tcmu_cmd->dbi_cnt, GFP_NOIO); if (!tcmu_cmd->dbi) { kmem_cache_free(tcmu_cmd_cache, tcmu_cmd); return NULL; diff --git a/drivers/tee/optee/protmem.c b/drivers/tee/optee/protmem.c index be3abf6e8aa6..bf2c678108df 100644 --- a/drivers/tee/optee/protmem.c +++ b/drivers/tee/optee/protmem.c @@ -304,8 +304,7 @@ struct tee_protmem_pool *optee_protmem_alloc_dyn_pool(struct optee *optee, if (rc) { if (rc != -ENOSPC) goto err; - rp->mem_attrs = kcalloc(rp->mem_attr_count, - sizeof(*rp->mem_attrs), GFP_KERNEL); + rp->mem_attrs = kzalloc_objs(*rp->mem_attrs, rp->mem_attr_count); if (!rp->mem_attrs) { rc = -ENOMEM; goto err; diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c index 9ada52cbf7dd..283c2c966f2a 100644 --- a/drivers/thermal/devfreq_cooling.c +++ b/drivers/thermal/devfreq_cooling.c @@ -353,8 +353,7 @@ static int devfreq_cooling_gen_tables(struct devfreq_cooling_device *dfc, unsigned long freq; int i; - dfc->freq_table = kcalloc(num_opps, sizeof(*dfc->freq_table), - GFP_KERNEL); + dfc->freq_table = kzalloc_objs(*dfc->freq_table, num_opps); if (!dfc->freq_table) return -ENOMEM; diff --git a/drivers/thermal/intel/therm_throt.c b/drivers/thermal/intel/therm_throt.c index 4d4e81601d17..59520cac6cc8 100644 --- a/drivers/thermal/intel/therm_throt.c +++ b/drivers/thermal/intel/therm_throt.c @@ -758,9 +758,8 @@ static __init void init_directed_pkg_intr(void) if (!boot_cpu_has(X86_FEATURE_DPTI)) return; - directed_intr_handler_cpus = kmalloc_array(topology_max_packages(), - sizeof(*directed_intr_handler_cpus), - GFP_KERNEL); + directed_intr_handler_cpus = kmalloc_objs(*directed_intr_handler_cpus, + topology_max_packages()); if (!directed_intr_handler_cpus) return; diff --git a/drivers/thunderbolt/debugfs.c b/drivers/thunderbolt/debugfs.c index ccefc5dd1ded..6a6875eb07ba 100644 --- a/drivers/thunderbolt/debugfs.c +++ b/drivers/thunderbolt/debugfs.c @@ -1960,8 +1960,7 @@ static int port_clear_all_counters(struct tb_port *port) u32 *buf; int ret; - buf = kcalloc(COUNTER_SET_LEN * port->config.max_counters, sizeof(u32), - GFP_KERNEL); + buf = kzalloc_objs(u32, COUNTER_SET_LEN * port->config.max_counters); if (!buf) return -ENOMEM; diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c index b187a60663f5..45e26833c953 100644 --- a/drivers/thunderbolt/xdomain.c +++ b/drivers/thunderbolt/xdomain.c @@ -398,7 +398,7 @@ static int tb_xdp_properties_request(struct tb_ctl *ctl, u64 route, goto err; } - data = kcalloc(data_len, sizeof(u32), GFP_KERNEL); + data = kzalloc_objs(u32, data_len); if (!data) { ret = -ENOMEM; goto err; @@ -710,7 +710,7 @@ static void update_property_block(struct tb_xdomain *xd) } block_len = ret; - block = kcalloc(block_len, sizeof(*block), GFP_KERNEL); + block = kzalloc_objs(*block, block_len); if (!block) { tb_property_free_dir(dir); goto out_unlock; diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c index 7d564341a7eb..111a5631ab8c 100644 --- a/drivers/tty/vt/consolemap.c +++ b/drivers/tty/vt/consolemap.c @@ -260,8 +260,8 @@ static void set_inverse_trans_unicode(struct uni_pagedict *dict) inv = dict->inverse_trans_unicode; if (!inv) { - inv = dict->inverse_trans_unicode = kmalloc_array(MAX_GLYPH, - sizeof(*inv), GFP_KERNEL); + inv = dict->inverse_trans_unicode = kmalloc_objs(*inv, + MAX_GLYPH); if (!inv) return; } @@ -511,8 +511,7 @@ con_insert_unipair(struct uni_pagedict *p, u_short unicode, u_short fontpos) n = UNI_DIR(unicode); dir = p->uni_pgdir[n]; if (!dir) { - dir = p->uni_pgdir[n] = kcalloc(UNI_DIR_ROWS, sizeof(*dir), - GFP_KERNEL); + dir = p->uni_pgdir[n] = kzalloc_objs(*dir, UNI_DIR_ROWS); if (!dir) return -ENOMEM; } @@ -520,8 +519,7 @@ con_insert_unipair(struct uni_pagedict *p, u_short unicode, u_short fontpos) n = UNI_ROW(unicode); row = dir[n]; if (!row) { - row = dir[n] = kmalloc_array(UNI_ROW_GLYPHS, sizeof(*row), - GFP_KERNEL); + row = dir[n] = kmalloc_objs(*row, UNI_ROW_GLYPHS); if (!row) return -ENOMEM; /* No glyphs for the characters (yet) */ @@ -776,8 +774,7 @@ 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_objs(*unilist, ct, - GFP_KERNEL); + struct unipair *unilist __free(kvfree) = kvmalloc_objs(*unilist, ct); if (!unilist) return -ENOMEM; diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c index ef4a19aeb3ce..d59d51dafa55 100644 --- a/drivers/tty/vt/keyboard.c +++ b/drivers/tty/vt/keyboard.c @@ -1731,8 +1731,8 @@ static int vt_do_kdgkbdiacr(void __user *udp) struct kbdiacrs __user *a = udp; int i, asize; - struct kbdiacr __free(kfree) *dia = kmalloc_array(MAX_DIACR, sizeof(struct kbdiacr), - GFP_KERNEL); + struct kbdiacr __free(kfree) *dia = kmalloc_objs(struct kbdiacr, + MAX_DIACR); if (!dia) return -ENOMEM; @@ -1759,8 +1759,7 @@ static int vt_do_kdgkbdiacruc(void __user *udp) struct kbdiacrsuc __user *a = udp; int asize; - void __free(kfree) *buf = kmalloc_array(MAX_DIACR, sizeof(struct kbdiacruc), - GFP_KERNEL); + void __free(kfree) *buf = kmalloc_objs(struct kbdiacruc, MAX_DIACR); if (buf == NULL) return -ENOMEM; diff --git a/drivers/usb/dwc2/debugfs.c b/drivers/usb/dwc2/debugfs.c index 2ecbf6523aaa..198d92d50f65 100644 --- a/drivers/usb/dwc2/debugfs.c +++ b/drivers/usb/dwc2/debugfs.c @@ -788,7 +788,7 @@ int dwc2_debugfs_init(struct dwc2_hsotg *hsotg) /* Add gadget debugfs nodes */ dwc2_hsotg_create_debug(hsotg); - hsotg->regset = kzalloc_obj(*hsotg->regset, GFP_KERNEL); + hsotg->regset = kzalloc_obj(*hsotg->regset); if (!hsotg->regset) { ret = -ENOMEM; goto err; diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index d5275cd658d4..2e1927dfa34f 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -5120,14 +5120,12 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg) dev_dbg(hsotg->dev, "hcfg=%08x\n", hcfg); #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS - hsotg->frame_num_array = kcalloc(FRAME_NUM_ARRAY_SIZE, - sizeof(*hsotg->frame_num_array), - GFP_KERNEL); + hsotg->frame_num_array = kzalloc_objs(*hsotg->frame_num_array, + FRAME_NUM_ARRAY_SIZE); if (!hsotg->frame_num_array) goto error1; hsotg->last_frame_num_array = - kcalloc(FRAME_NUM_ARRAY_SIZE, - sizeof(*hsotg->last_frame_num_array), GFP_KERNEL); + kzalloc_objs(*hsotg->last_frame_num_array, FRAME_NUM_ARRAY_SIZE); if (!hsotg->last_frame_num_array) goto error1; #endif diff --git a/drivers/usb/dwc2/hcd_ddma.c b/drivers/usb/dwc2/hcd_ddma.c index 703cda5a5895..9fbe7f61d069 100644 --- a/drivers/usb/dwc2/hcd_ddma.c +++ b/drivers/usb/dwc2/hcd_ddma.c @@ -77,7 +77,7 @@ static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, qh->desc_list_sz, DMA_TO_DEVICE); - qh->n_bytes = kcalloc(dwc2_max_desc_num(qh), sizeof(u32), flags); + qh->n_bytes = kzalloc_objs(u32, dwc2_max_desc_num(qh), flags); if (!qh->n_bytes) { dma_unmap_single(hsotg->dev, qh->desc_list_dma, qh->desc_list_sz, diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index fd5c2cd36c59..6859d62b21a4 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1140,7 +1140,7 @@ static void dwc3_set_incr_burst_type(struct dwc3 *dwc) if (ntype <= 0) return; - vals = kcalloc(ntype, sizeof(u32), GFP_KERNEL); + vals = kzalloc_objs(u32, ntype); if (!vals) return; diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c index 500c9c19c78b..7f4324981eb3 100644 --- a/drivers/usb/gadget/function/f_ncm.c +++ b/drivers/usb/gadget/function/f_ncm.c @@ -1457,7 +1457,7 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f) ncm_opts = container_of(f->fi, struct f_ncm_opts, func_inst); if (cdev->use_os_string) { - os_desc_table = kzalloc(sizeof(*os_desc_table), GFP_KERNEL); + os_desc_table = kzalloc_obj(*os_desc_table); if (!os_desc_table) return -ENOMEM; } diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c index 70a1415ea401..b9af49940d5f 100644 --- a/drivers/usb/gadget/function/uvc_configfs.c +++ b/drivers/usb/gadget/function/uvc_configfs.c @@ -2089,7 +2089,7 @@ static ssize_t uvcg_frame_dw_frame_interval_store(struct config_item *item, if (ret) goto end; - tmp = frm_intrv = kcalloc(n, sizeof(u32), GFP_KERNEL); + tmp = frm_intrv = kzalloc_objs(u32, n); if (!frm_intrv) { ret = -ENOMEM; goto end; diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c index a9358e04ab4b..fea2614e767c 100644 --- a/drivers/usb/storage/ene_ub6250.c +++ b/drivers/usb/storage/ene_ub6250.c @@ -805,12 +805,10 @@ static int ms_lib_alloc_logicalmap(struct us_data *us) u32 i; struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; - info->MS_Lib.Phy2LogMap = kmalloc_array(info->MS_Lib.NumberOfPhyBlock, - sizeof(u16), - GFP_KERNEL); - info->MS_Lib.Log2PhyMap = kmalloc_array(info->MS_Lib.NumberOfLogBlock, - sizeof(u16), - GFP_KERNEL); + info->MS_Lib.Phy2LogMap = kmalloc_objs(u16, + info->MS_Lib.NumberOfPhyBlock); + info->MS_Lib.Log2PhyMap = kmalloc_objs(u16, + info->MS_Lib.NumberOfLogBlock); if ((info->MS_Lib.Phy2LogMap == NULL) || (info->MS_Lib.Log2PhyMap == NULL)) { ms_lib_free_logicalmap(us); diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 4d5d32e68d35..57b68773025a 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -529,8 +529,7 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev) vq->indirect = kmalloc_objs(*vq->indirect, UIO_MAXIOV); vq->log = kmalloc_objs(*vq->log, dev->iov_limit); vq->heads = kmalloc_objs(*vq->heads, dev->iov_limit); - vq->nheads = kmalloc_array(dev->iov_limit, sizeof(*vq->nheads), - GFP_KERNEL); + vq->nheads = kmalloc_objs(*vq->nheads, dev->iov_limit); if (!vq->indirect || !vq->log || !vq->heads || !vq->nheads) goto err_nomem; } diff --git a/drivers/video/backlight/hx8357.c b/drivers/video/backlight/hx8357.c index 590365c6a51b..d69a7ebbf5f7 100644 --- a/drivers/video/backlight/hx8357.c +++ b/drivers/video/backlight/hx8357.c @@ -224,7 +224,7 @@ static int hx8357_spi_write_then_read(struct lcd_device *lcdev, if (txlen) { int i; - local_txbuf = kcalloc(txlen, sizeof(*local_txbuf), GFP_KERNEL); + local_txbuf = kzalloc_objs(*local_txbuf, txlen); if (!local_txbuf) return -ENOMEM; diff --git a/drivers/video/fbdev/via/viafbdev.c b/drivers/video/fbdev/via/viafbdev.c index 2c67a18d16ad..74f35dddbb27 100644 --- a/drivers/video/fbdev/via/viafbdev.c +++ b/drivers/video/fbdev/via/viafbdev.c @@ -581,8 +581,7 @@ static int viafb_ioctl(struct fb_info *info, u_int cmd, u_long arg) break; case VIAFB_GET_GAMMA_LUT: - viafb_gamma_table = kmalloc_array(256, sizeof(u32), - GFP_KERNEL); + viafb_gamma_table = kmalloc_objs(u32, 256); if (!viafb_gamma_table) return -ENOMEM; viafb_get_gamma_table(viafb_gamma_table); diff --git a/drivers/virt/acrn/hsm.c b/drivers/virt/acrn/hsm.c index f170ff4617fd..0c0a5504fc4e 100644 --- a/drivers/virt/acrn/hsm.c +++ b/drivers/virt/acrn/hsm.c @@ -50,7 +50,7 @@ static int pmcmd_ioctl(u64 cmd, void __user *uptr) switch (cmd & PMCMD_TYPE_MASK) { case ACRN_PMCMD_GET_PX_CNT: case ACRN_PMCMD_GET_CX_CNT: - pm_info = kzalloc(sizeof(u64), GFP_KERNEL); + pm_info = kzalloc_obj(u64); if (!pm_info) return -ENOMEM; diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c index 3cbff88c339e..b4e1415573c1 100644 --- a/drivers/w1/masters/ds2490.c +++ b/drivers/w1/masters/ds2490.c @@ -718,7 +718,7 @@ static void ds9490r_search(void *data, struct w1_master *master, * We are holding the bus mutex during the scan, but adding devices via the * callback needs the bus to be unlocked. So we queue up found ids here. */ - found_ids = kmalloc_array(master->max_slave_count, sizeof(u64), GFP_KERNEL); + found_ids = kmalloc_objs(u64, master->max_slave_count); if (!found_ids) { kfree(buf); return; diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c index 3218686be45b..c0dffabbf1b3 100644 --- a/drivers/xen/gntalloc.c +++ b/drivers/xen/gntalloc.c @@ -287,7 +287,7 @@ static long gntalloc_ioctl_alloc(struct gntalloc_file_private_data *priv, goto out; } - gref_ids = kcalloc(op.count, sizeof(gref_ids[0]), GFP_KERNEL); + gref_ids = kzalloc_objs(gref_ids[0], op.count); if (!gref_ids) { rc = -ENOMEM; goto out; diff --git a/drivers/xen/gntdev-dmabuf.c b/drivers/xen/gntdev-dmabuf.c index df1883aca850..80fc91dc88e8 100644 --- a/drivers/xen/gntdev-dmabuf.c +++ b/drivers/xen/gntdev-dmabuf.c @@ -611,7 +611,7 @@ dmabuf_imp_to_refs(struct gntdev_dmabuf_priv *priv, struct device *dev, gntdev_dmabuf->u.imp.sgt = sgt; - gfns = kcalloc(count, sizeof(*gfns), GFP_KERNEL); + gfns = kzalloc_objs(*gfns, count); if (!gfns) { ret = ERR_PTR(-ENOMEM); goto fail_unmap; @@ -738,7 +738,7 @@ long gntdev_ioctl_dmabuf_exp_from_refs(struct gntdev_priv *priv, if (unlikely(gntdev_test_page_count(op.count))) return -EINVAL; - refs = kcalloc(op.count, sizeof(*refs), GFP_KERNEL); + refs = kzalloc_objs(*refs, op.count); if (!refs) return -ENOMEM; diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index f75b5cc71cfc..604c4eea5930 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -1405,7 +1405,7 @@ static int gnttab_map_frames_v2(xen_pfn_t *frames, unsigned int nr_gframes) /* No need for kzalloc as it is initialized in following hypercall * GNTTABOP_get_status_frames. */ - sframes = kmalloc_array(nr_sframes, sizeof(*sframes), GFP_ATOMIC); + sframes = kmalloc_objs(*sframes, nr_sframes, GFP_ATOMIC); if (!sframes) return -ENOMEM; diff --git a/fs/9p/fid.c b/fs/9p/fid.c index 65dc7972b396..b6a1ca93bd0e 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c @@ -154,7 +154,7 @@ static int build_path_from_dentry(struct v9fs_session_info *v9ses, for (ds = dentry; !IS_ROOT(ds); ds = ds->d_parent) n++; - wnames = kmalloc_array(n, sizeof(*wnames), GFP_KERNEL); + wnames = kmalloc_objs(*wnames, n); if (!wnames) goto err_out; diff --git a/fs/ceph/file.c b/fs/ceph/file.c index bbb986781891..4a19a00be96f 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -137,7 +137,7 @@ static ssize_t iter_get_bvecs_alloc(struct iov_iter *iter, size_t maxsize, iov_iter_reexpand(iter, orig_count); /* Worst case is one bio_vec per page */ - bv = kvmalloc_objs(*bv, npages, GFP_KERNEL); + bv = kvmalloc_objs(*bv, npages); if (!bv) return -ENOMEM; diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index de36c83e94c0..3791fc627714 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -4538,8 +4538,8 @@ static void handle_session(struct ceph_mds_session *session, ceph_decode_64_safe(&p, end, cap_auths[i].match.uid, bad); ceph_decode_32_safe(&p, end, _len, bad); if (_len) { - cap_auths[i].match.gids = kcalloc(_len, sizeof(u32), - GFP_KERNEL); + cap_auths[i].match.gids = kzalloc_objs(u32, + _len); if (!cap_auths[i].match.gids) { pr_err_client(cl, "No memory for gids\n"); goto fail; diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c index 8e2937e4e562..d317c91547f1 100644 --- a/fs/ceph/mdsmap.c +++ b/fs/ceph/mdsmap.c @@ -267,8 +267,9 @@ struct ceph_mdsmap *ceph_mdsmap_decode(struct ceph_mds_client *mdsc, void **p, info->laggy = laggy; info->num_export_targets = num_export_targets; if (num_export_targets) { - info->export_targets = kcalloc(num_export_targets, - sizeof(u32), GFP_NOFS); + info->export_targets = kzalloc_objs(u32, + num_export_targets, + GFP_NOFS); if (!info->export_targets) goto nomem; for (j = 0; j < num_export_targets; j++) { @@ -287,7 +288,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(struct ceph_mds_client *mdsc, void **p, /* pg_pools */ ceph_decode_32_safe(p, end, n, bad); m->m_num_data_pg_pools = n; - m->m_data_pg_pools = kcalloc(n, sizeof(u64), GFP_NOFS); + m->m_data_pg_pools = kzalloc_objs(u64, n, GFP_NOFS); if (!m->m_data_pg_pools) goto nomem; ceph_decode_need(p, end, sizeof(u64)*(n+1), bad); diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c index 5c1540d95b8c..895968ab6a1f 100644 --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c @@ -493,7 +493,7 @@ static int dup_array(u64 **dst, __le64 *src, u32 num) kfree(*dst); if (num) { - *dst = kcalloc(num, sizeof(u64), GFP_NOFS); + *dst = kzalloc_objs(u64, num, GFP_NOFS); if (!*dst) return -ENOMEM; for (i = 0; i < num; i++) diff --git a/fs/exfat/nls.c b/fs/exfat/nls.c index 055447edcf9a..47aa187c54cc 100644 --- a/fs/exfat/nls.c +++ b/fs/exfat/nls.c @@ -655,7 +655,7 @@ static int exfat_load_upcase_table(struct super_block *sb, unsigned char skip = false; unsigned short *upcase_table; - upcase_table = kvcalloc(UTBL_COUNT, sizeof(unsigned short), GFP_KERNEL); + upcase_table = kvzalloc_objs(unsigned short, UTBL_COUNT); if (!upcase_table) return -ENOMEM; @@ -707,7 +707,7 @@ static int exfat_load_default_upcase_table(struct super_block *sb) unsigned short uni = 0, *upcase_table; unsigned int index = 0; - upcase_table = kvcalloc(UTBL_COUNT, sizeof(unsigned short), GFP_KERNEL); + upcase_table = kvzalloc_objs(unsigned short, UTBL_COUNT); if (!upcase_table) return -ENOMEM; diff --git a/fs/ext2/super.c b/fs/ext2/super.c index fb217ef2d69f..816d5829bd9f 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -1106,7 +1106,7 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc) goto failed_mount; } bgl_lock_init(sbi->s_blockgroup_lock); - sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL); + sbi->s_debts = kzalloc_objs(*sbi->s_debts, sbi->s_groups_count); if (!sbi->s_debts) { ret = -ENOMEM; ext2_msg(sb, KERN_ERR, "error: not enough memory"); diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 5e3ad8393cf8..041ab212c3a6 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -265,8 +265,7 @@ static struct ext4_new_flex_group_data *alloc_flex_gd(unsigned int flexbg_size, if (flex_gd->groups == NULL) goto out2; - flex_gd->bg_flags = kmalloc_array(flex_gd->resize_bg, sizeof(__u16), - GFP_NOFS); + flex_gd->bg_flags = kmalloc_objs(__u16, flex_gd->resize_bg, GFP_NOFS); if (flex_gd->bg_flags == NULL) goto out1; diff --git a/fs/fuse/ext_map.c b/fs/fuse/ext_map.c index 7f04edc33fe3..746cb679c1b8 100644 --- a/fs/fuse/ext_map.c +++ b/fs/fuse/ext_map.c @@ -351,7 +351,7 @@ int fuse_ext_map_populate(struct fuse_conn *fc, struct fuse_notify_backing_map_o fb->backing_id = arg->backing_id; err = -ENOMEM; - fb->extents = kvcalloc(arg->num_extents, sizeof(*fb->extents), GFP_KERNEL); + fb->extents = kvzalloc_objs(*fb->extents, arg->num_extents); if (!fb->extents) goto err_put; diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index 6cfe335fd590..52248d7eb075 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c @@ -1062,7 +1062,7 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name) /* Change the pointers. Don't bother distinguishing stuffed from non-stuffed. This code is complicated enough already. */ - lp = kmalloc_array(half_len, sizeof(__be64), GFP_NOFS); + lp = kmalloc_objs(__be64, half_len, GFP_NOFS); if (!lp) { error = -ENOMEM; goto fail_brelse; diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index 47eec0c13025..c1aeef0fa8c0 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c @@ -1120,8 +1120,8 @@ static int set_recover_size(struct gfs2_sbd *sdp, struct dlm_slot *slots, if (new_size == old_size) return 0; - submit = kcalloc(new_size, sizeof(uint32_t), GFP_NOFS); - result = kcalloc(new_size, sizeof(uint32_t), GFP_NOFS); + submit = kzalloc_objs(uint32_t, new_size, GFP_NOFS); + result = kzalloc_objs(uint32_t, new_size, GFP_NOFS); if (!submit || !result) { kfree(submit); kfree(result); diff --git a/fs/namespace.c b/fs/namespace.c index 25e196c05126..010ed5d68d22 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -6301,8 +6301,8 @@ static inline int prepare_klistmount(struct klistmount *kls, struct mnt_id_req * kls->last_mnt_id = last_mnt_id; kls->nr_mnt_ids = nr_mnt_ids; - kls->kmnt_ids = kvmalloc_array(nr_mnt_ids, sizeof(*kls->kmnt_ids), - GFP_KERNEL_ACCOUNT); + kls->kmnt_ids = kvmalloc_objs(*kls->kmnt_ids, nr_mnt_ids, + GFP_KERNEL_ACCOUNT); if (!kls->kmnt_ids) return -ENOMEM; diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index a057a06318c7..6dc00233e837 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -3169,7 +3169,7 @@ void pnfs_deviceid_delete_mark(struct nfs_client *clp, { struct nfs4_deviceid_delete *dd, *new; - new = kzalloc_obj(*new, GFP_KERNEL); + new = kzalloc_obj(*new); if (!new) return; /* lost notification; recovery waits for the next */ new->ld = pnfs_find_layoutdriver(ld->id); diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index e5a0f1ababe6..80824d7f45e4 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c @@ -361,7 +361,7 @@ int nfsd_nl_expkey_get_reqs_dumpit(struct sk_buff *skb, } items = kzalloc_objs(*items, cnt); - seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL); + seqnos = kzalloc_objs(*seqnos, cnt); if (!items || !seqnos) { ret = -ENOMEM; goto out_alloc; @@ -688,7 +688,7 @@ int nfsd_nl_svc_export_get_reqs_dumpit(struct sk_buff *skb, } items = kzalloc_objs(*items, cnt); - seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL); + seqnos = kzalloc_objs(*seqnos, cnt); pathbuf = kmalloc(PATH_MAX, GFP_KERNEL); if (!items || !seqnos || !pathbuf) { ret = -ENOMEM; diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 1de6c6d757c3..567a856af482 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1361,7 +1361,7 @@ alloc_init_dir_deleg(struct nfs4_client *clp, struct nfs4_file *fp) nfs4_put_stid(&dp->dl_stid); return NULL; } - ncn->ncn_masks = kcalloc(NOTIFY4_EVENT_QUEUE_SIZE, sizeof(*ncn->ncn_masks), GFP_KERNEL); + ncn->ncn_masks = kzalloc_objs(*ncn->ncn_masks, NOTIFY4_EVENT_QUEUE_SIZE); if (!ncn->ncn_masks) { nfs4_put_stid(&dp->dl_stid); return NULL; diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c index 89288b794348..60734500a406 100644 --- a/fs/ntfs/mft.c +++ b/fs/ntfs/mft.c @@ -3259,7 +3259,7 @@ static int ntfs_write_mft_block(struct folio *folio, struct writeback_control *w file_limit = min_t(u64, i_size, allocated_size); nr_records = PAGE_SIZE / vol->mft_record_size; max_units = PAGE_SIZE / min(vol->cluster_size, vol->mft_record_size); - units = kmalloc_array(max_units, sizeof(*units), GFP_NOFS); + units = kmalloc_objs(*units, max_units, GFP_NOFS); if (!locked_nis || !ref_inos || !units) { err = -ENOMEM; goto out_noio; diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 71f0aea46bf8..891b5e0c384b 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -2790,8 +2790,8 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) mutex_unlock(&ntfs_lock); lcn_bit_pages = (((vol->nr_clusters + 7) >> 3) + PAGE_SIZE - 1) >> PAGE_SHIFT; - vol->lcn_empty_bits_per_page = kvmalloc_array(lcn_bit_pages, sizeof(unsigned int), - GFP_KERNEL); + vol->lcn_empty_bits_per_page = kvmalloc_objs(unsigned int, + lcn_bit_pages); if (!vol->lcn_empty_bits_per_page) { ntfs_error(sb, "Unable to allocate pages for storing LCN empty bit counts\n"); diff --git a/fs/ntfs/upcase.c b/fs/ntfs/upcase.c index 4b954470883f..f024fd8381fd 100644 --- a/fs/ntfs/upcase.c +++ b/fs/ntfs/upcase.c @@ -52,7 +52,7 @@ __le16 *generate_default_upcase(void) int i, r; __le16 *uc; - uc = kvcalloc(default_upcase_len, sizeof(__le16), GFP_NOFS); + uc = kvzalloc_objs(__le16, default_upcase_len, GFP_NOFS); if (!uc) return uc; /* Generate the little endian Unicode upcase table used by ntfs. */ diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c index 60b362f388d9..52feb3504d5b 100644 --- a/fs/ntfs3/bitmap.c +++ b/fs/ntfs3/bitmap.c @@ -677,7 +677,7 @@ int wnd_init(struct wnd_bitmap *wnd, struct super_block *sb, size_t nbits) wnd->bits_last = wbits; wnd->free_bits = - kvmalloc_array(wnd->nwnd, sizeof(u16), GFP_KERNEL | __GFP_ZERO); + kvmalloc_objs(u16, wnd->nwnd, GFP_KERNEL | __GFP_ZERO); if (!wnd->free_bits) return -ENOMEM; @@ -1342,7 +1342,7 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits) new_last = wbits; if (new_wnd != wnd->nwnd) { - new_free = kmalloc_array(new_wnd, sizeof(u16), GFP_NOFS); + new_free = kmalloc_objs(u16, new_wnd, GFP_NOFS); if (!new_free) return -ENOMEM; diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 3072b0386db8..0781c5cbdb11 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -2072,8 +2072,7 @@ static int ocfs2_initialize_super(struct super_block *sb, } osb->slot_recovery_generations = - kcalloc(osb->max_slots, sizeof(*osb->slot_recovery_generations), - GFP_KERNEL); + kzalloc_objs(*osb->slot_recovery_generations, osb->max_slots); if (!osb->slot_recovery_generations) { status = -ENOMEM; mlog_errno(status); @@ -2081,9 +2080,8 @@ static int ocfs2_initialize_super(struct super_block *sb, } init_waitqueue_head(&osb->osb_wipe_event); - osb->osb_orphan_wipes = kcalloc(osb->max_slots, - sizeof(*osb->osb_orphan_wipes), - GFP_KERNEL); + osb->osb_orphan_wipes = kzalloc_objs(*osb->osb_orphan_wipes, + osb->max_slots); if (!osb->osb_orphan_wipes) { status = -ENOMEM; mlog_errno(status); diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index ac41653e59f5..71e5986bafaa 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c @@ -7898,7 +7898,7 @@ static int ocfs2_initxattrs(struct inode *inode, const struct xattr *xattr_array for (xattr = xattr_array; xattr->name != NULL; xattr++) count++; - xattrs = kcalloc(count, sizeof(*xattrs), GFP_NOFS); + xattrs = kzalloc_objs(*xattrs, count, GFP_NOFS); if (!xattrs) return -ENOMEM; diff --git a/fs/proc/base.c b/fs/proc/base.c index c9aebee0a338..7685660c3624 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -478,8 +478,7 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns, if (!file_ns_capable(m->file, &init_user_ns, CAP_SYS_ADMIN)) return -EACCES; - entries = kmalloc_array(MAX_STACK_TRACE_DEPTH, sizeof(*entries), - GFP_KERNEL); + entries = kmalloc_objs(*entries, MAX_STACK_TRACE_DEPTH); if (!entries) return -ENOMEM; diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 04e4ea612b7c..b9336464cc53 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -1887,7 +1887,7 @@ static int closid_num_dirty_rmid_alloc(struct rdt_resource *r) * use a smaller system wide value based on the resources in * use. */ - tmp = kcalloc(num_closid, sizeof(*tmp), GFP_KERNEL); + tmp = kzalloc_objs(*tmp, num_closid); if (!tmp) { mutex_unlock(&rdtgroup_mutex); return -ENOMEM; diff --git a/fs/smb/client/dfs_cache.c b/fs/smb/client/dfs_cache.c index 26956e33037e..02864f7acefc 100644 --- a/fs/smb/client/dfs_cache.c +++ b/fs/smb/client/dfs_cache.c @@ -798,7 +798,7 @@ static int get_targets(struct cache_entry *ce, struct dfs_cache_tgt_list *tl) INIT_LIST_HEAD(head); list_for_each_entry(t, &ce->tlist, list) { - it = kzalloc_obj(*it, GFP_KERNEL); + it = kzalloc_obj(*it); if (!it) { rc = -ENOMEM; goto err_free_it; diff --git a/fs/smb/common/compress/lz77.c b/fs/smb/common/compress/lz77.c index 9216d973d876..c915b114a05a 100644 --- a/fs/smb/common/compress/lz77.c +++ b/fs/smb/common/compress/lz77.c @@ -240,7 +240,7 @@ noinline int smb_lz77_compress(const void *src, const u32 slen, dstp += sizeof(u32); nib = NULL; - htable = kvcalloc(LZ77_HASH_SIZE, sizeof(*htable), GFP_KERNEL); + htable = kvzalloc_objs(*htable, LZ77_HASH_SIZE); if (!htable) return -ENOMEM; diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index be226664b8af..e67815b3e33d 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -7394,8 +7394,7 @@ static int smb2_add_stream_info(struct smb2_stream_info_buffer *buf, buf->capacity - offset < sizeof(*file_info)) return -ENOSPC; - utf16_name = kmalloc_array(name_len + 1, sizeof(*utf16_name), - KSMBD_DEFAULT_GFP); + utf16_name = kmalloc_objs(*utf16_name, name_len + 1, KSMBD_DEFAULT_GFP); if (!utf16_name) return -ENOMEM; @@ -7718,8 +7717,8 @@ static int find_file_posix_info(struct ksmbd_work *work, if (filename[0] == '\\') memmove(filename, filename + 1, strlen(filename)); name_bytes = strlen(filename); - utf16_name = kmalloc_array(name_bytes + 1, sizeof(*utf16_name), - KSMBD_DEFAULT_GFP); + utf16_name = kmalloc_objs(*utf16_name, name_bytes + 1, + KSMBD_DEFAULT_GFP); if (!utf16_name) { kfree(filename); return -ENOMEM; diff --git a/fs/smb/server/transport_tcp.c b/fs/smb/server/transport_tcp.c index a98a0f164239..870f3cf0c227 100644 --- a/fs/smb/server/transport_tcp.c +++ b/fs/smb/server/transport_tcp.c @@ -489,7 +489,7 @@ static struct tcp_tx *ksmbd_tcp_alloc_tx(const struct ksmbd_transport_write *tx, struct iov_iter iter; size_t remaining = tx->size - offset; - msg = kvmalloc(struct_size(msg, data, remaining), KSMBD_DEFAULT_GFP); + msg = kvmalloc_flex(*msg, data, remaining, KSMBD_DEFAULT_GFP); if (!msg) return NULL; diff --git a/fs/verity/open.c b/fs/verity/open.c index d1ac9556e947..398c36114451 100644 --- a/fs/verity/open.c +++ b/fs/verity/open.c @@ -236,9 +236,8 @@ struct fsverity_info *fsverity_create_info(struct inode *inode, vi->tree_params.tree_pages << vi->tree_params.log_blocks_per_page; - vi->hash_block_verified = kvcalloc(BITS_TO_LONGS(num_bits), - sizeof(unsigned long), - GFP_KERNEL); + vi->hash_block_verified = kvzalloc_objs(unsigned long, + BITS_TO_LONGS(num_bits)); if (!vi->hash_block_verified) { err = -ENOMEM; goto fail; diff --git a/io_uring/dma-buf.c b/io_uring/dma-buf.c index 132e3d0d7023..61825d59e384 100644 --- a/io_uring/dma-buf.c +++ b/io_uring/dma-buf.c @@ -28,7 +28,7 @@ int __io_register_dmabuf(struct io_ring_ctx *ctx, if (desc->uaddr || desc->size) return -EINVAL; - bd = kzalloc(sizeof(*bd), GFP_KERNEL); + bd = kzalloc_obj(*bd); if (!bd) return -ENOMEM; diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c index 6d7abb1636e7..21e042b3ccb9 100644 --- a/io_uring/zcrx.c +++ b/io_uring/zcrx.c @@ -549,8 +549,8 @@ static int __zcrx_create_area(struct io_zcrx_ifq *ifq, if (!area->nia.niovs) goto err; - area->freelist = kvmalloc_array(nr_iovs, sizeof(area->freelist[0]), - GFP_KERNEL_ACCOUNT | __GFP_ZERO); + area->freelist = kvmalloc_objs(area->freelist[0], nr_iovs, + GFP_KERNEL_ACCOUNT | __GFP_ZERO); if (!area->freelist) goto err; diff --git a/ipc/sem.c b/ipc/sem.c index 5ec41de7e85b..b16a877911e9 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -1447,8 +1447,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, } sem_unlock(sma, -1); rcu_read_unlock(); - sem_io = kvmalloc_array(nsems, sizeof(ushort), - GFP_KERNEL); + sem_io = kvmalloc_objs(ushort, nsems); if (sem_io == NULL) { ipc_rcu_putref(&sma->sem_perm, sem_rcu_free); return -ENOMEM; @@ -1482,8 +1481,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, rcu_read_unlock(); if (nsems > SEMMSL_FAST) { - sem_io = kvmalloc_array(nsems, sizeof(ushort), - GFP_KERNEL); + sem_io = kvmalloc_objs(ushort, nsems); if (sem_io == NULL) { ipc_rcu_putref(&sma->sem_perm, sem_rcu_free); return -ENOMEM; diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 8bf39098ba97..7e866bf017b5 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -1960,13 +1960,13 @@ static int env_resolve_init(struct btf_verifier_env *env) u32 *resolved_ids = NULL; u8 *visit_states = NULL; - resolved_sizes = kvcalloc(nr_types, sizeof(*resolved_sizes), - GFP_KERNEL | __GFP_NOWARN); + resolved_sizes = kvzalloc_objs(*resolved_sizes, nr_types, + GFP_KERNEL | __GFP_NOWARN); if (!resolved_sizes) goto nomem; - resolved_ids = kvcalloc(nr_types, sizeof(*resolved_ids), - GFP_KERNEL | __GFP_NOWARN); + resolved_ids = kvzalloc_objs(*resolved_ids, nr_types, + GFP_KERNEL | __GFP_NOWARN); if (!resolved_ids) goto nomem; diff --git a/kernel/bpf/cfg.c b/kernel/bpf/cfg.c index 2ee950e9ac82..1b04538351a1 100644 --- a/kernel/bpf/cfg.c +++ b/kernel/bpf/cfg.c @@ -868,8 +868,8 @@ int bpf_compute_scc(struct bpf_verifier_env *env) stack = kvcalloc(insn_cnt, sizeof(int), GFP_KERNEL_ACCOUNT); pre = kvcalloc(insn_cnt, sizeof(int), GFP_KERNEL_ACCOUNT); low = kvcalloc(insn_cnt, sizeof(int), GFP_KERNEL_ACCOUNT); - dfs = kvcalloc(insn_cnt, sizeof(*dfs), GFP_KERNEL_ACCOUNT); - dfs_pos = kvcalloc(insn_cnt, sizeof(*dfs_pos), GFP_KERNEL_ACCOUNT); + dfs = kvzalloc_objs(*dfs, insn_cnt, GFP_KERNEL_ACCOUNT); + dfs_pos = kvzalloc_objs(*dfs_pos, insn_cnt, GFP_KERNEL_ACCOUNT); if (!stack || !pre || !low || !dfs || !dfs_pos) { err = -ENOMEM; goto exit; diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 831f73f82599..0b8456f2dce9 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -2922,7 +2922,7 @@ int bpf_prog_array_copy_to_user(struct bpf_prog_array *array, * bpf_prog_array_copy_to_user(..., cnt); * so below kcalloc doesn't need extra cnt > 0 check. */ - ids = kcalloc(cnt, sizeof(u32), GFP_USER | __GFP_NOWARN); + ids = kzalloc_objs(u32, cnt, GFP_USER | __GFP_NOWARN); if (!ids) return -ENOMEM; nospc = bpf_prog_array_copy_core(array, ids, cnt); diff --git a/kernel/bpf/loops.c b/kernel/bpf/loops.c index 2568079c2945..fee2c6081135 100644 --- a/kernel/bpf/loops.c +++ b/kernel/bpf/loops.c @@ -29,7 +29,7 @@ static struct bpf_iarray **compute_predecessors(struct bpf_verifier_env *env) size_t sz; void *tmp; - num_preds = kvcalloc(prog->len, sizeof(u32), GFP_KERNEL_ACCOUNT); + num_preds = kvzalloc_objs(u32, prog->len, GFP_KERNEL_ACCOUNT); if (!num_preds) return NULL; @@ -156,7 +156,7 @@ int bpf_compute_idoms(struct bpf_verifier_env *env) if (!preds) return -ENOMEM; - idoms = kvcalloc(len, sizeof(*idoms), GFP_KERNEL_ACCOUNT); + idoms = kvzalloc_objs(*idoms, len, GFP_KERNEL_ACCOUNT); if (!idoms) { kvfree(preds); return -ENOMEM; @@ -216,7 +216,8 @@ static int add_exit(struct bpf_loop *loop, int from, int to) return 0; } if (!loop->exits) { - loop->exits = kvcalloc(MAX_LOOP_EXITS, sizeof(*loop->exits), GFP_KERNEL_ACCOUNT); + loop->exits = kvzalloc_objs(*loop->exits, MAX_LOOP_EXITS, + GFP_KERNEL_ACCOUNT); if (!loop->exits) return -ENOMEM; } @@ -467,9 +468,9 @@ int bpf_compute_loops(struct bpf_verifier_env *env) struct bpf_iarray *succ; struct bpf_loop *loop; - dfs.dfs_pos = kvcalloc(len, sizeof(int), GFP_KERNEL_ACCOUNT); - dfs.state = kvcalloc(len, sizeof(struct dfs_state), GFP_KERNEL_ACCOUNT); - dfs.stack = kvcalloc(len, sizeof(int), GFP_KERNEL_ACCOUNT); + dfs.dfs_pos = kvzalloc_objs(int, len, GFP_KERNEL_ACCOUNT); + dfs.state = kvzalloc_objs(struct dfs_state, len, GFP_KERNEL_ACCOUNT); + dfs.stack = kvzalloc_objs(int, len, GFP_KERNEL_ACCOUNT); if (!dfs.dfs_pos || !dfs.state || !dfs.stack) { err = -ENOMEM; goto out; diff --git a/kernel/bpf/scev.c b/kernel/bpf/scev.c index 06dee7e421ea..db123ef1f071 100644 --- a/kernel/bpf/scev.c +++ b/kernel/bpf/scev.c @@ -518,7 +518,7 @@ static struct env *get_loop_env(struct scev *scev, int loop_header, int insn_idx if (e) return e; - e = kzalloc(sizeof(*e), GFP_KERNEL_ACCOUNT); + e = kzalloc_obj(*e, GFP_KERNEL_ACCOUNT); if (!e) return NULL; @@ -1276,11 +1276,11 @@ static int compute_scev_for_loop(struct bpf_verifier_env *env, int cur_header) return 0; } - cur_env = kzalloc(sizeof(*cur_env), GFP_KERNEL_ACCOUNT); + cur_env = kzalloc_obj(*cur_env, GFP_KERNEL_ACCOUNT); if (!cur_env) goto nomem; if (log_level2) { - old_env = kzalloc(sizeof(*old_env), GFP_KERNEL_ACCOUNT); + old_env = kzalloc_obj(*old_env, GFP_KERNEL_ACCOUNT); if (!old_env) goto nomem; } @@ -1725,7 +1725,7 @@ int bpf_init_scev(struct bpf_verifier_env *env) { struct scev *scev; - scev = kzalloc(sizeof(struct scev), GFP_KERNEL_ACCOUNT); + scev = kzalloc_obj(struct scev, GFP_KERNEL_ACCOUNT); if (!scev) return -ENOMEM; env->scev = scev; @@ -1733,13 +1733,16 @@ int bpf_init_scev(struct bpf_verifier_env *env) bpf_mark_reg_unknown_imprecise(&scev->unknown_reg); /* A power of two for hash & (exprs_ht_cnt - 1)` indexing. */ scev->exprs_ht_cnt = roundup_pow_of_two(max(256U, DIV_ROUND_UP(env->prog->len, 4))); - scev->exprs_ht = kvcalloc(scev->exprs_ht_cnt, sizeof(*scev->exprs_ht), GFP_KERNEL_ACCOUNT); + scev->exprs_ht = kvzalloc_objs(*scev->exprs_ht, scev->exprs_ht_cnt, + GFP_KERNEL_ACCOUNT); if (!scev->exprs_ht) goto nomem; if (expr0(scev, UNKNOWN) < 0 || expr0(scev, OPAQUE) < 0) goto nomem; - scev->envs = kvcalloc(env->prog->len, sizeof(*scev->envs), GFP_KERNEL_ACCOUNT); - scev->discovered = kvcalloc(env->prog->len, sizeof(*scev->discovered), GFP_KERNEL_ACCOUNT); + scev->envs = kvzalloc_objs(*scev->envs, env->prog->len, + GFP_KERNEL_ACCOUNT); + scev->discovered = kvzalloc_objs(*scev->discovered, env->prog->len, + GFP_KERNEL_ACCOUNT); if (!scev->envs || !scev->discovered) goto nomem; /* diff --git a/kernel/kcsan/debugfs.c b/kernel/kcsan/debugfs.c index 2af39ba5b70b..2005ca79d066 100644 --- a/kernel/kcsan/debugfs.c +++ b/kernel/kcsan/debugfs.c @@ -156,7 +156,7 @@ retry_alloc: */ if (data_race(report_filterlist.used == report_filterlist.size)) { new_size = (report_filterlist.size ?: 4) * 2; - delay_free = new_addrs = kmalloc_array(new_size, sizeof(unsigned long), GFP_KERNEL); + delay_free = new_addrs = kmalloc_objs(unsigned long, new_size); if (!new_addrs) return -ENOMEM; } diff --git a/kernel/module/kmod.c b/kernel/module/kmod.c index 24091210741e..6db525d9779d 100644 --- a/kernel/module/kmod.c +++ b/kernel/module/kmod.c @@ -82,7 +82,7 @@ static int call_modprobe(char *orig_module_name, int wait) char *module_name; int ret; - char **argv = kmalloc_array(5, sizeof(*argv), GFP_KERNEL); + char **argv = kmalloc_objs(*argv, 5); if (!argv) goto out; diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index 1097ec15879c..38c75c37a07c 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -1188,7 +1188,7 @@ rcu_scale_init(void) } } writer_tasks = kzalloc_objs(writer_tasks[0], nrealwriters); - writer_durations = kcalloc(nrealwriters, sizeof(*writer_durations), GFP_KERNEL); + writer_durations = kzalloc_objs(*writer_durations, nrealwriters); writer_n_durations = kzalloc_objs(*writer_n_durations, nrealwriters); writer_done = kzalloc_objs(writer_done[0], nrealwriters); if (gp_async) { @@ -1210,8 +1210,7 @@ rcu_scale_init(void) } for (i = 0; i < nrealwriters; i++) { writer_durations[i] = - kcalloc(MAX_MEAS, sizeof(*writer_durations[i]), - GFP_KERNEL); + kzalloc_objs(*writer_durations[i], MAX_MEAS); if (!writer_durations[i]) { firsterr = -ENOMEM; goto unwind; diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 968343be4e0d..93ca7f06371e 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1763,7 +1763,7 @@ rcu_torture_writer(void *arg) return 0; } if (cur_ops->poll_active > 0) { - ulo = kcalloc(cur_ops->poll_active, sizeof(*ulo), GFP_KERNEL); + ulo = kzalloc_objs(*ulo, cur_ops->poll_active); if (!WARN_ON(!ulo)) ulo_size = cur_ops->poll_active; } @@ -2791,8 +2791,8 @@ static void rcu_torture_nmi_init(void) if (!nmi_calls || !cur_ops->nmi_capable || !cur_ops->call) return; - rcu_torture_nmi_events = kcalloc(nr_cpu_ids, sizeof(*rcu_torture_nmi_events), - GFP_KERNEL); + rcu_torture_nmi_events = kzalloc_objs(*rcu_torture_nmi_events, + nr_cpu_ids); if (!rcu_torture_nmi_events) return; ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "rcutorture/nmi:online", diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c index a2d9d75d88a1..4f3460700e34 100644 --- a/kernel/rcu/refscale.c +++ b/kernel/rcu/refscale.c @@ -1366,7 +1366,7 @@ static int main_func(void *arg) set_user_nice(current, MAX_NICE); VERBOSE_SCALEOUT("main_func task started"); - result_avg = kcalloc(nruns, sizeof(*result_avg), GFP_KERNEL); + result_avg = kzalloc_objs(*result_avg, nruns); buf = kzalloc(800 + 64, GFP_KERNEL); if (!result_avg || !buf) { SCALEOUT_ERRSTRING("out of memory"); diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 2aec56d7f3d3..d22e78e7f28d 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -2064,7 +2064,7 @@ int perf_event_query_prog_array(struct perf_event *event, void __user *info) ids_len = query.ids_len; if (ids_len > BPF_TRACE_MAX_PROGS) return -E2BIG; - ids = kcalloc(ids_len, sizeof(u32), GFP_USER | __GFP_NOWARN); + ids = kzalloc_objs(u32, ids_len, GFP_USER | __GFP_NOWARN); if (!ids) return -ENOMEM; /* @@ -2403,7 +2403,7 @@ static int copy_user_syms(struct user_syms *us, unsigned long __user *usyms, u32 if (!access_ok(usyms, cnt * sizeof(*usyms))) return -EFAULT; - syms = kvmalloc_array(cnt, sizeof(*syms), GFP_KERNEL); + syms = kvmalloc_objs(*syms, cnt); if (!syms) return -ENOMEM; @@ -2847,7 +2847,7 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr return -E2BIG; size = cnt * sizeof(*addrs); - addrs = kvmalloc_array(cnt, sizeof(*addrs), GFP_KERNEL); + addrs = kvmalloc_objs(*addrs, cnt); if (!addrs) return -ENOMEM; diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c index ed455b53513b..6d87143b3ddb 100644 --- a/kernel/trace/fgraph.c +++ b/kernel/trace/fgraph.c @@ -1235,8 +1235,8 @@ static int start_graph_tracing(void) unsigned long **ret_stack_list; int ret, cpu; - ret_stack_list = kcalloc(FTRACE_RETSTACK_ALLOC_SIZE, - sizeof(*ret_stack_list), GFP_KERNEL); + ret_stack_list = kzalloc_objs(*ret_stack_list, + FTRACE_RETSTACK_ALLOC_SIZE); if (!ret_stack_list) return -ENOMEM; diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c index da286619c5d8..47d565a1e2c5 100644 --- a/kernel/trace/fprobe.c +++ b/kernel/trace/fprobe.c @@ -745,7 +745,7 @@ static int fprobe_module_callback(struct notifier_block *nb, if (val != MODULE_STATE_GOING) return NOTIFY_DONE; - alist.addrs = kcalloc(alist.size, sizeof(*alist.addrs), GFP_KERNEL); + alist.addrs = kzalloc_objs(*alist.addrs, alist.size); /* * If failed to alloc memory, ftrace_ops will not be able to remove ips from * hash, but we can still remove nodes from fprobe_ip_table, so we can avoid @@ -815,7 +815,7 @@ static unsigned long *get_ftrace_locations(const char **syms, int num) unsigned long *addrs; /* Convert symbols to symbol address */ - addrs = kcalloc(num, sizeof(*addrs), GFP_KERNEL); + addrs = kzalloc_objs(*addrs, num); if (!addrs) return ERR_PTR(-ENOMEM); @@ -1082,7 +1082,7 @@ static int unregister_fprobe_nolock(struct fprobe *fp) unsigned long *addrs = NULL; int i, count; - addrs = kcalloc(hlist_array->size, sizeof(unsigned long), GFP_KERNEL); + addrs = kzalloc_objs(unsigned long, hlist_array->size); /* * This will remove fprobe_hash_node from the hash table even if * memory allocation fails. However, ftrace_ops will not be updated. diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 1fd28a72e6ee..75cd8df23c1b 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -7866,7 +7866,7 @@ int ring_buffer_map(struct trace_buffer *buffer, int cpu, return err; /* subbuf_ids includes the reader while nr_pages does not */ - subbuf_ids = kcalloc(cpu_buffer->nr_pages + 1, sizeof(*subbuf_ids), GFP_KERNEL); + subbuf_ids = kzalloc_objs(*subbuf_ids, cpu_buffer->nr_pages + 1); if (!subbuf_ids) { rb_free_meta_page(cpu_buffer); return -ENOMEM; diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index e8c4efa8107b..4ccdefb5c3ef 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -1281,7 +1281,7 @@ static int save_selftest(struct tracer *type) { struct trace_selftests *selftest; - selftest = kmalloc(sizeof(*selftest), GFP_KERNEL); + selftest = kmalloc_obj(*selftest); if (!selftest) return -ENOMEM; diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c index a880a90642d7..ba580d0d0f6a 100644 --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c @@ -2315,7 +2315,7 @@ const char **traceprobe_expand_meta_args(int argc, const char *argv[], else *new_argc = argc; - new_argv = kcalloc(*new_argc, sizeof(*new_argv), GFP_KERNEL); + new_argv = kzalloc_objs(*new_argv, *new_argc); if (!new_argv) return ERR_PTR(-ENOMEM); diff --git a/kernel/workqueue.c b/kernel/workqueue.c index f2e8071a6f4e..af845214e78b 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5267,7 +5267,7 @@ static int alloc_flush_pnodes(struct workqueue_struct *wq) struct wq_flush_pnode *fpn; int node; - wq->flush_pnodes = kcalloc(nr_node_ids + 1, sizeof(*wq->flush_pnodes), GFP_KERNEL); + wq->flush_pnodes = kzalloc_objs(*wq->flush_pnodes, nr_node_ids + 1); if (!wq->flush_pnodes) return -ENOMEM; diff --git a/lib/argv_split.c b/lib/argv_split.c index e28db8e3b58c..cf15892139e6 100644 --- a/lib/argv_split.c +++ b/lib/argv_split.c @@ -69,7 +69,7 @@ char **argv_split(gfp_t gfp, const char *str, int *argcp) return NULL; argc = count_argc(argv_str); - argv = kmalloc_array(argc + 2, sizeof(*argv), gfp); + argv = kmalloc_objs(*argv, argc + 2, gfp); if (!argv) { kfree(argv_str); return NULL; diff --git a/lib/reed_solomon/reed_solomon.c b/lib/reed_solomon/reed_solomon.c index 864484c01827..fe84c6a2a5a8 100644 --- a/lib/reed_solomon/reed_solomon.c +++ b/lib/reed_solomon/reed_solomon.c @@ -88,15 +88,15 @@ static struct rs_codec *codec_init(int symsize, int gfpoly, int (*gffunc)(int), rs->gffunc = gffunc; /* Allocate the arrays */ - rs->alpha_to = kmalloc_array(rs->nn + 1, sizeof(uint16_t), gfp); + rs->alpha_to = kmalloc_objs(uint16_t, rs->nn + 1, gfp); if (rs->alpha_to == NULL) goto err; - rs->index_of = kmalloc_array(rs->nn + 1, sizeof(uint16_t), gfp); + rs->index_of = kmalloc_objs(uint16_t, rs->nn + 1, gfp); if (rs->index_of == NULL) goto err; - rs->genpoly = kmalloc_array(rs->nroots + 1, sizeof(uint16_t), gfp); + rs->genpoly = kmalloc_objs(uint16_t, rs->nroots + 1, gfp); if(rs->genpoly == NULL) goto err; diff --git a/lib/reed_solomon/test_rslib.c b/lib/reed_solomon/test_rslib.c index 42b856e6c8a8..acfc172c8025 100644 --- a/lib/reed_solomon/test_rslib.c +++ b/lib/reed_solomon/test_rslib.c @@ -115,8 +115,7 @@ static struct wspace *alloc_ws(struct rs_codec *rs) if (!ws) return NULL; - ws->c = kmalloc_array(2 * (nn + nroots), - sizeof(uint16_t), GFP_KERNEL); + ws->c = kmalloc_objs(uint16_t, 2 * (nn + nroots)); if (!ws->c) goto err; diff --git a/lib/region_alloc_benchmark.c b/lib/region_alloc_benchmark.c index a644f3d5431a..4ca797dfa4ee 100644 --- a/lib/region_alloc_benchmark.c +++ b/lib/region_alloc_benchmark.c @@ -180,9 +180,9 @@ static int __init region_alloc_benchmark(void) max_cap = max(max_cap, capacities[i]); } - bitmap = kvmalloc_array(BITS_TO_LONGS(max_cap), sizeof(*bitmap), GFP_KERNEL); + bitmap = kvmalloc_objs(*bitmap, BITS_TO_LONGS(max_cap)); reg_sz = kvmalloc_array(max_cap + 1, sizeof(*reg_sz), GFP_KERNEL); - reg_idx = kvmalloc_array(max_cap, sizeof(*reg_idx), GFP_KERNEL); + reg_idx = kvmalloc_objs(*reg_idx, max_cap); if (!bitmap || !reg_sz || !reg_idx) goto out; diff --git a/lib/test_bitops.c b/lib/test_bitops.c index 55669624bb28..e6f3987ca270 100644 --- a/lib/test_bitops.c +++ b/lib/test_bitops.c @@ -59,7 +59,7 @@ static int __init test_fns(void) unsigned int i, n; ktime_t time; - buf = kmalloc_array(10000, sizeof(unsigned long), GFP_KERNEL); + buf = kmalloc_objs(unsigned long, 10000); if (!buf) return -ENOMEM; diff --git a/lib/test_hmm.c b/lib/test_hmm.c index b409c42bfe6f..a09a766b15b0 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -195,8 +195,8 @@ static void dmirror_device_evict_chunk(struct dmirror_chunk *chunk) unsigned long *dst_pfns; unsigned int order = 0; - src_pfns = kvcalloc(npages, sizeof(*src_pfns), GFP_KERNEL | __GFP_NOFAIL); - dst_pfns = kvcalloc(npages, sizeof(*dst_pfns), GFP_KERNEL | __GFP_NOFAIL); + src_pfns = kvzalloc_objs(*src_pfns, npages, GFP_KERNEL | __GFP_NOFAIL); + dst_pfns = kvzalloc_objs(*dst_pfns, npages, GFP_KERNEL | __GFP_NOFAIL); migrate_device_range(src_pfns, start_pfn, npages); for (i = 0; i < npages; i++) { @@ -1241,8 +1241,10 @@ static int dmirror_migrate_to_system(struct dmirror *dmirror, if (!mmget_not_zero(mm)) return -EINVAL; - src_pfns = kvcalloc(PTRS_PER_PTE, sizeof(*src_pfns), GFP_KERNEL | __GFP_NOFAIL); - dst_pfns = kvcalloc(PTRS_PER_PTE, sizeof(*dst_pfns), GFP_KERNEL | __GFP_NOFAIL); + src_pfns = kvzalloc_objs(*src_pfns, PTRS_PER_PTE, + GFP_KERNEL | __GFP_NOFAIL); + dst_pfns = kvzalloc_objs(*dst_pfns, PTRS_PER_PTE, + GFP_KERNEL | __GFP_NOFAIL); cmd->cpages = 0; mmap_read_lock(mm); @@ -1311,10 +1313,10 @@ static int dmirror_migrate_to_device(struct dmirror *dmirror, if (!mmget_not_zero(mm)) return -EINVAL; - src_pfns = kvcalloc(PTRS_PER_PTE, sizeof(*src_pfns), - GFP_KERNEL | __GFP_NOFAIL); - dst_pfns = kvcalloc(PTRS_PER_PTE, sizeof(*dst_pfns), - GFP_KERNEL | __GFP_NOFAIL); + src_pfns = kvzalloc_objs(*src_pfns, PTRS_PER_PTE, + GFP_KERNEL | __GFP_NOFAIL); + dst_pfns = kvzalloc_objs(*dst_pfns, PTRS_PER_PTE, + GFP_KERNEL | __GFP_NOFAIL); ret = 0; mmap_read_lock(mm); @@ -1788,8 +1790,8 @@ static vm_fault_t dmirror_devmem_fault(struct vm_fault *vmf) args.end = args.start + (PAGE_SIZE << order); nr = (args.end - args.start) >> PAGE_SHIFT; - args.src = kcalloc(nr, sizeof(unsigned long), GFP_KERNEL); - args.dst = kcalloc(nr, sizeof(unsigned long), GFP_KERNEL); + args.src = kzalloc_objs(unsigned long, nr); + args.dst = kzalloc_objs(unsigned long, nr); args.pgmap_owner = dmirror->mdevice; args.flags = dmirror_select_device(dmirror); args.fault_page = vmf->page; diff --git a/lib/test_workqueue.c b/lib/test_workqueue.c index 2bdfcbbcabb4..bdced8750197 100644 --- a/lib/test_workqueue.c +++ b/lib/test_workqueue.c @@ -160,7 +160,7 @@ static int __init run_bench(int n_threads, const char *scope, const char *label) } total_items = (unsigned long)n_threads * wq_items; - all_latencies = kvmalloc_array(total_items, sizeof(u64), GFP_KERNEL); + all_latencies = kvmalloc_objs(u64, total_items); if (!all_latencies) { kfree(tasks); kfree(ctxs); @@ -169,8 +169,7 @@ static int __init run_bench(int n_threads, const char *scope, const char *label) /* Allocate per-thread latency arrays */ for (i = 0; i < n_threads; i++) { - ctxs[i].latencies = kvmalloc_array(wq_items, sizeof(u64), - GFP_KERNEL); + ctxs[i].latencies = kvmalloc_objs(u64, wq_items); if (!ctxs[i].latencies) { while (--i >= 0) kvfree(ctxs[i].latencies); diff --git a/mm/damon/core.c b/mm/damon/core.c index 73b571b429cb..946b28440dff 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1516,15 +1516,14 @@ static int damos_commit_dests(struct damos_migrate_dests *dst, kfree(dst->node_id_arr); kfree(dst->weight_arr); - dst->node_id_arr = kmalloc_array(src->nr_dests, - sizeof(*dst->node_id_arr), GFP_KERNEL); + dst->node_id_arr = kmalloc_objs(*dst->node_id_arr, + src->nr_dests); if (!dst->node_id_arr) { dst->weight_arr = NULL; return -ENOMEM; } - dst->weight_arr = kmalloc_array(src->nr_dests, - sizeof(*dst->weight_arr), GFP_KERNEL); + dst->weight_arr = kmalloc_objs(*dst->weight_arr, src->nr_dests); if (!dst->weight_arr) { /* ->node_id_arr will be freed by scheme destruction */ return -ENOMEM; @@ -4038,8 +4037,8 @@ static int kdamond_fn(void *data) if (ctx->ops.init) ctx->ops.init(ctx); - ctx->regions_score_histogram = kmalloc_array(DAMOS_MAX_SCORE + 1, - sizeof(*ctx->regions_score_histogram), GFP_KERNEL); + ctx->regions_score_histogram = kmalloc_objs(*ctx->regions_score_histogram, + DAMOS_MAX_SCORE + 1); if (!ctx->regions_score_histogram) goto done; diff --git a/mm/hmm.c b/mm/hmm.c index 2f1e98c6b644..9871d3c3cd07 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -860,8 +860,8 @@ int hmm_dma_map_alloc(struct device *dev, struct hmm_dma_map *map, return -EOPNOTSUPP; map->dma_entry_size = dma_entry_size; - map->pfn_list = kvcalloc(nr_entries, sizeof(*map->pfn_list), - GFP_KERNEL | __GFP_NOWARN); + map->pfn_list = kvzalloc_objs(*map->pfn_list, nr_entries, + GFP_KERNEL | __GFP_NOWARN); if (!map->pfn_list) return -ENOMEM; diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 4da1cb8777f6..0cb6da1c47a4 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -246,7 +246,7 @@ int mempolicy_set_node_perf(unsigned int node, struct access_coordinate *coords) int i; bw_val = min(coords->read_bandwidth, coords->write_bandwidth); - new_bw = kcalloc(nr_node_ids, sizeof(unsigned int), GFP_KERNEL); + new_bw = kzalloc_objs(unsigned int, nr_node_ids); if (!new_bw) return -ENOMEM; diff --git a/mm/shrinker_debug.c b/mm/shrinker_debug.c index cafb56630132..3cf7bb076c6a 100644 --- a/mm/shrinker_debug.c +++ b/mm/shrinker_debug.c @@ -53,7 +53,7 @@ static int shrinker_debugfs_count_show(struct seq_file *m, void *v) bool memcg_aware; int ret = 0, nid; - count_per_node = kcalloc(nr_node_ids, sizeof(unsigned long), GFP_KERNEL); + count_per_node = kzalloc_objs(unsigned long, nr_node_ids); if (!count_per_node) return -ENOMEM; diff --git a/mm/slab_common.c b/mm/slab_common.c index 01c64ef661e7..2befd24b4d09 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1103,7 +1103,7 @@ int cache_random_seq_create(struct kmem_cache *cachep, unsigned int count, if (count < 2 || cachep->random_seq) return 0; - cachep->random_seq = kcalloc(count, sizeof(unsigned int), gfp); + cachep->random_seq = kzalloc_objs(unsigned int, count, gfp); if (!cachep->random_seq) return -ENOMEM; diff --git a/mm/slub.c b/mm/slub.c index 45e077c7526c..cd671b934719 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -9221,7 +9221,7 @@ static ssize_t show_slab_objects(struct kmem_cache *s, unsigned long *nodes; int len = 0; - nodes = kcalloc(nr_node_ids, sizeof(unsigned long), GFP_KERNEL); + nodes = kzalloc_objs(unsigned long, nr_node_ids); if (!nodes) return -ENOMEM; diff --git a/mm/vmalloc.c b/mm/vmalloc.c index f7aa4686fe5b..a4c22c569b1d 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -5374,7 +5374,7 @@ static void show_busy_info(struct seq_file *m) unsigned int *counters; if (IS_ENABLED(CONFIG_NUMA)) - counters = kmalloc_array(nr_node_ids, sizeof(unsigned int), GFP_KERNEL); + counters = kmalloc_objs(unsigned int, nr_node_ids); for_each_vmap_node(vn) { spin_lock(&vn->busy.lock); diff --git a/mm/vmstat.c b/mm/vmstat.c index a3e809c57f29..c6beac6be2bc 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1911,7 +1911,7 @@ static void *vmstat_start(struct seq_file *m, loff_t *pos) BUILD_BUG_ON(ARRAY_SIZE(vmstat_text) != NR_VMSTAT_ITEMS); fold_vm_numa_events(); - v = kmalloc_array(NR_VMSTAT_ITEMS, sizeof(unsigned long), GFP_KERNEL); + v = kmalloc_objs(unsigned long, NR_VMSTAT_ITEMS); m->private = v; if (!v) return ERR_PTR(-ENOMEM); diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 3b9c82bd2f02..202be1632e21 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -10943,7 +10943,7 @@ void mgmt_security_level_changed(struct hci_conn *conn) return; tlv_len = 2 * (sizeof(*tlv) + sizeof(__u8)); - ev = kzalloc_flex(*ev, tlv_data, tlv_len, GFP_KERNEL); + ev = kzalloc_flex(*ev, tlv_data, tlv_len); if (!ev) return; diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index c4e7e03e0969..6f6b574a359d 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -256,7 +256,7 @@ static void br_vlan_rebuild_port_array(struct net_bridge_vlan *masterv, WARN_ON(!br_vlan_is_master(masterv)); if (count > BR_VLAN_PORT_ARRAY_THRESHOLD) - array = kvmalloc(struct_size(array, vlans, count), GFP_KERNEL); + array = kvmalloc_flex(*array, vlans, count); if (array) { struct net_bridge_vlan *pv; diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index e69a2249ddfb..619e61aeb2b4 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c @@ -287,7 +287,7 @@ static u32 *decode_array_32_alloc(void **p, void *end, u32 *plen) if (len) { u32 i; - a = kmalloc_array(len, sizeof(u32), GFP_NOIO); + a = kmalloc_objs(u32, len, GFP_NOIO); if (!a) { ret = -ENOMEM; goto fail; diff --git a/net/core/devmem.c b/net/core/devmem.c index 32fafbfa1359..b2bd4373a2ea 100644 --- a/net/core/devmem.c +++ b/net/core/devmem.c @@ -289,9 +289,8 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev, } } else { spin_lock_init(&binding->freelist_lock); - binding->freelist = kvmalloc_array(binding->area.num_niovs, - sizeof(binding->freelist[0]), - GFP_KERNEL); + binding->freelist = kvmalloc_objs(binding->freelist[0], + binding->area.num_niovs); if (!binding->freelist) { err = -ENOMEM; goto err_unmap; diff --git a/net/core/filter.c b/net/core/filter.c index 9245009d9f1e..2d20b1271ab3 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -939,7 +939,7 @@ static int check_load_and_stores(const struct sock_filter *filter, int flen) BUILD_BUG_ON(BPF_MEMWORDS > 16); - masks = kmalloc_array(flen, sizeof(*masks), GFP_KERNEL); + masks = kmalloc_objs(*masks, flen); if (!masks) return -ENOMEM; diff --git a/net/ethtool/bitset.c b/net/ethtool/bitset.c index a3a2cc6480a0..945312b260e3 100644 --- a/net/ethtool/bitset.c +++ b/net/ethtool/bitset.c @@ -477,7 +477,7 @@ ethnl_update_bitset32_verbose(u32 *bitmap, unsigned int nbits, /* The bitmap size is only the size of the map part without * its mask part. */ - saved_bitmap = kcalloc(nwords, sizeof(u32), GFP_KERNEL); + saved_bitmap = kzalloc_objs(u32, nwords); if (!saved_bitmap) return -ENOMEM; memcpy(saved_bitmap, bitmap, nbytes); @@ -750,7 +750,7 @@ int ethnl_bitset_size(const unsigned long *val, const unsigned long *mask, if (nbits > ETHNL_SMALL_BITMAP_BITS) { unsigned int nwords = DIV_ROUND_UP(nbits, 32); - val32 = kmalloc_array(2 * nwords, sizeof(u32), GFP_KERNEL); + val32 = kmalloc_objs(u32, 2 * nwords); if (!val32) return -ENOMEM; mask32 = val32 + nwords; @@ -786,7 +786,7 @@ int ethnl_put_bitset(struct sk_buff *skb, int attrtype, if (nbits > ETHNL_SMALL_BITMAP_BITS) { unsigned int nwords = DIV_ROUND_UP(nbits, 32); - val32 = kmalloc_array(2 * nwords, sizeof(u32), GFP_KERNEL); + val32 = kmalloc_objs(u32, 2 * nwords); if (!val32) return -ENOMEM; mask32 = val32 + nwords; @@ -821,7 +821,7 @@ int ethnl_update_bitset(unsigned long *bitmap, unsigned int nbits, if (nbits > ETHNL_SMALL_BITMAP_BITS) { unsigned int dst_words = DIV_ROUND_UP(nbits, 32); - bitmap32 = kmalloc_array(dst_words, sizeof(u32), GFP_KERNEL); + bitmap32 = kmalloc_objs(u32, dst_words); if (!bitmap32) return -ENOMEM; } diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 27b0e2e275dc..80b7930b3fe0 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -815,7 +815,7 @@ static noinline_for_stack int ethtool_get_sset_info(struct net_device *dev, memset(&info, 0, sizeof(info)); info.cmd = ETHTOOL_GSSET_INFO; - info_buf = kcalloc(n_bits, sizeof(u32), GFP_USER); + info_buf = kzalloc_objs(u32, n_bits, GFP_USER); if (!info_buf) return -ENOMEM; @@ -1333,7 +1333,7 @@ static noinline_for_stack int ethtool_get_rxfh_indir(struct net_device *dev, if (user_size < rxfh.indir_size) return user_size == 0 ? 0 : -EINVAL; - rxfh.indir = kcalloc(rxfh.indir_size, sizeof(rxfh.indir[0]), GFP_USER); + rxfh.indir = kzalloc_objs(rxfh.indir[0], rxfh.indir_size, GFP_USER); if (!rxfh.indir) return -ENOMEM; @@ -1378,8 +1378,8 @@ static noinline_for_stack int ethtool_set_rxfh_indir(struct net_device *dev, if (user_size != 0 && user_size != rxfh_dev.indir_size) return -EINVAL; - rxfh_dev.indir = kcalloc(rxfh_dev.indir_size, - sizeof(rxfh_dev.indir[0]), GFP_USER); + rxfh_dev.indir = kzalloc_objs(rxfh_dev.indir[0], rxfh_dev.indir_size, + GFP_USER); if (!rxfh_dev.indir) return -ENOMEM; @@ -2377,7 +2377,7 @@ static int ethtool_self_test(struct net_device *dev, char __user *useraddr) return -EFAULT; test.len = test_len; - data = kcalloc(test_len, sizeof(u64), GFP_USER); + data = kzalloc_objs(u64, test_len, GFP_USER); if (!data) return -ENOMEM; diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c index 9c91872a2921..33921dc169e3 100644 --- a/net/ncsi/ncsi-rsp.c +++ b/net/ncsi/ncsi-rsp.c @@ -820,9 +820,8 @@ static int ncsi_rsp_handler_gc(struct ncsi_request *nr) nc->mac_filter.n_mc = rsp->mc_cnt; nc->mac_filter.n_mixed = rsp->mixed_cnt; - nc->vlan_filter.vids = kcalloc(rsp->vlan_cnt, - sizeof(*nc->vlan_filter.vids), - GFP_ATOMIC); + nc->vlan_filter.vids = kzalloc_objs(*nc->vlan_filter.vids, + rsp->vlan_cnt, GFP_ATOMIC); if (!nc->vlan_filter.vids) return -ENOMEM; /* Set VLAN filters active so they are cleared in the first diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c index 57ac455bc331..f4b443ed42ba 100644 --- a/net/netfilter/xt_hashlimit.c +++ b/net/netfilter/xt_hashlimit.c @@ -1077,7 +1077,7 @@ static void *dl_seq_start(struct seq_file *s, loff_t *pos) if (*pos >= htable->cfg.size) return NULL; - bucket = kmalloc(sizeof(unsigned int), GFP_ATOMIC); + bucket = kmalloc_obj(unsigned int, GFP_ATOMIC); if (!bucket) return ERR_PTR(-ENOMEM); diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c index b080e666523f..a8e66c2ddf49 100644 --- a/net/netlabel/netlabel_cipso_v4.c +++ b/net/netlabel/netlabel_cipso_v4.c @@ -185,16 +185,16 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, break; } } - doi_def->map.std->lvl.local = kcalloc(doi_def->map.std->lvl.local_size, - sizeof(u32), - GFP_KERNEL | __GFP_NOWARN); + doi_def->map.std->lvl.local = kzalloc_objs(u32, + doi_def->map.std->lvl.local_size, + GFP_KERNEL | __GFP_NOWARN); if (doi_def->map.std->lvl.local == NULL) { ret_val = -ENOMEM; goto add_std_failure; } - doi_def->map.std->lvl.cipso = kcalloc(doi_def->map.std->lvl.cipso_size, - sizeof(u32), - GFP_KERNEL | __GFP_NOWARN); + doi_def->map.std->lvl.cipso = kzalloc_objs(u32, + doi_def->map.std->lvl.cipso_size, + GFP_KERNEL | __GFP_NOWARN); if (doi_def->map.std->lvl.cipso == NULL) { ret_val = -ENOMEM; goto add_std_failure; @@ -260,18 +260,16 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, break; } } - doi_def->map.std->cat.local = kcalloc( - doi_def->map.std->cat.local_size, - sizeof(u32), - GFP_KERNEL | __GFP_NOWARN); + doi_def->map.std->cat.local = kzalloc_objs(u32, + doi_def->map.std->cat.local_size, + GFP_KERNEL | __GFP_NOWARN); if (doi_def->map.std->cat.local == NULL) { ret_val = -ENOMEM; goto add_std_failure; } - doi_def->map.std->cat.cipso = kcalloc( - doi_def->map.std->cat.cipso_size, - sizeof(u32), - GFP_KERNEL | __GFP_NOWARN); + doi_def->map.std->cat.cipso = kzalloc_objs(u32, + doi_def->map.std->cat.cipso_size, + GFP_KERNEL | __GFP_NOWARN); if (doi_def->map.std->cat.cipso == NULL) { ret_val = -ENOMEM; goto add_std_failure; diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index cf6429f09477..73222563fb70 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -2932,7 +2932,7 @@ tpacket_error: if (has_vnet_hdr) virtio_net_hdr_set_proto(skb, &vnet_hdr); - uarg = kmalloc(sizeof(*uarg), GFP_KERNEL); + uarg = kmalloc_obj(*uarg); if (unlikely(!uarg)) { if (likely(len_sum > 0)) err = len_sum; diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c index e6c87a32950f..e0fcda26ff62 100644 --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c @@ -542,7 +542,7 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt, err = -ENOMEM; goto init_failure; } - q->backlogs = kvcalloc(q->flows_cnt, sizeof(u32), GFP_KERNEL); + q->backlogs = kvzalloc_objs(u32, q->flows_cnt); if (!q->backlogs) { err = -ENOMEM; goto alloc_failure; diff --git a/net/sched/sch_hhf.c b/net/sched/sch_hhf.c index 5dec1ed969ad..fca20c50c97c 100644 --- a/net/sched/sch_hhf.c +++ b/net/sched/sch_hhf.c @@ -648,9 +648,7 @@ static int hhf_init(struct Qdisc *sch, struct nlattr *opt, /* Initialize heavy-hitter filter arrays. */ for (i = 0; i < HHF_ARRAYS_CNT; i++) { - q->hhf_arrays[i] = kvcalloc(HHF_ARRAYS_LEN, - sizeof(u32), - GFP_KERNEL); + q->hhf_arrays[i] = kvzalloc_objs(u32, HHF_ARRAYS_LEN); if (!q->hhf_arrays[i]) { /* Note: hhf_destroy() will be called * by our caller. diff --git a/net/sctp/stream.c b/net/sctp/stream.c index e4354d58f20b..8fa9f431782b 100644 --- a/net/sctp/stream.c +++ b/net/sctp/stream.c @@ -326,7 +326,7 @@ int sctp_send_reset_streams(struct sctp_association *asoc, goto out; } - nstr_list = kcalloc(str_nums, sizeof(__be16), GFP_KERNEL); + nstr_list = kzalloc_objs(__be16, str_nums); if (!nstr_list) { retval = -ENOMEM; goto out; diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 7e23af94a719..fda91c6e3fd2 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -109,10 +109,10 @@ module_param_call(pool_mode, param_set_pool_mode, param_get_pool_mode, static int svc_pool_map_alloc_arrays(struct svc_pool_map *m, unsigned int maxpools) { - m->to_pool = kcalloc(maxpools, sizeof(unsigned int), GFP_KERNEL); + m->to_pool = kzalloc_objs(unsigned int, maxpools); if (!m->to_pool) goto fail; - m->pool_to = kcalloc(maxpools, sizeof(unsigned int), GFP_KERNEL); + m->pool_to = kzalloc_objs(unsigned int, maxpools); if (!m->pool_to) goto fail_free; diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index a68fe44d1f62..1380d0946401 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c @@ -633,7 +633,7 @@ int sunrpc_nl_unix_gid_get_reqs_dumpit(struct sk_buff *skb, return 0; items = kzalloc_objs(*items, cnt); - seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL); + seqnos = kzalloc_objs(*seqnos, cnt); if (!items || !seqnos) { ret = -ENOMEM; goto out_alloc; @@ -1336,7 +1336,7 @@ int sunrpc_nl_ip_map_get_reqs_dumpit(struct sk_buff *skb, return 0; items = kzalloc_objs(*items, cnt); - seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL); + seqnos = kzalloc_objs(*seqnos, cnt); if (!items || !seqnos) { ret = -ENOMEM; goto out_alloc; diff --git a/net/wireless/core.c b/net/wireless/core.c index f4153c249599..cbf570c5c554 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -328,8 +328,7 @@ int cfg80211_nan_set_local_schedule(struct cfg80211_registered_device *rdev, * schedule on allocation failure. */ if (sched->n_channels) { - chandefs = kcalloc(sched->n_channels, sizeof(*chandefs), - GFP_KERNEL); + chandefs = kzalloc_objs(*chandefs, sched->n_channels); if (!chandefs) return -ENOMEM; diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index 80ca9031d29c..b7c67ea7c540 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c @@ -1170,7 +1170,7 @@ void cfg80211_dfs_channels_update_work(struct work_struct *work) n_chans += wiphy->bands[bandid]->n_channels; } - expired = kvcalloc(n_chans, sizeof(*expired), GFP_KERNEL); + expired = kvzalloc_objs(*expired, n_chans); if (!expired) { /* hmm - retry later */ queue_delayed_work(cfg80211_wq, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index d790e204aee3..f29acf851376 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -4679,9 +4679,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) return -EOPNOTSUPP; if (rdev->wiphy.n_radio) { - old_radio_rts_threshold = kcalloc(rdev->wiphy.n_radio, - sizeof(u32), - GFP_KERNEL); + old_radio_rts_threshold = kzalloc_objs(u32, + rdev->wiphy.n_radio); if (!old_radio_rts_threshold) return -ENOMEM; } @@ -18297,8 +18296,7 @@ nl80211_parse_non_evac_channel(struct cfg80211_registered_device *rdev, struct cfg80211_chan_def *chandef) { struct nlattr **channel_parsed __free(kfree) = - kcalloc(NL80211_ATTR_MAX + 1, sizeof(*channel_parsed), - GFP_KERNEL); + kzalloc_objs(*channel_parsed, NL80211_ATTR_MAX + 1); int ret; if (!channel_parsed) @@ -18333,8 +18331,7 @@ static int nl80211_nan_set_non_evac_channels(struct sk_buff *skb, n_channels++; struct cfg80211_nan_non_evac_channels *channels __free(kfree) = - kzalloc(struct_size(channels, chandefs, n_channels), - GFP_KERNEL); + kzalloc_flex(*channels, chandefs, n_channels); if (!channels) return -ENOMEM; diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index 35dfa3b451f3..24fbce2e4322 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -785,7 +785,7 @@ static int unpack_tagsets(struct aa_ext *e, struct aa_tags_struct *tags) if (!aa_unpack_array(e, "sets", &size)) goto fail_reset; - sets = kcalloc(size, sizeof(u32), GFP_KERNEL); + sets = kzalloc_objs(u32, size); if (!sets) { error = -ENOMEM; goto fail_reset; diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c index e07092ea301a..63f0245e6f74 100644 --- a/security/keys/encrypted-keys/encrypted.c +++ b/security/keys/encrypted-keys/encrypted.c @@ -648,8 +648,7 @@ static struct encrypted_key_payload *encrypted_key_alloc(struct key *key, if (ret < 0) return ERR_PTR(ret); - epayload = kzalloc_flex(*epayload, payload_data, payload_totallen, - GFP_KERNEL); + epayload = kzalloc_flex(*epayload, payload_data, payload_totallen); if (!epayload) return ERR_PTR(-ENOMEM); diff --git a/security/security.c b/security/security.c index f6583d507395..4727b8347fc4 100644 --- a/security/security.c +++ b/security/security.c @@ -1358,8 +1358,9 @@ int security_inode_init_security(struct inode *inode, struct inode *dir, if (initxattrs) { /* Allocate +1 as terminator. */ - new_xattrs = kcalloc(blob_sizes.lbs_xattr_count + 1, - sizeof(*new_xattrs), GFP_NOFS); + new_xattrs = kzalloc_objs(*new_xattrs, + blob_sizes.lbs_xattr_count + 1, + GFP_NOFS); if (!new_xattrs) return -ENOMEM; } diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 6168dd5f91c2..9950f89dfaa2 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -3894,8 +3894,7 @@ static int selinux_backing_file_alloc(struct file *backing_file, * mappings would have to be serialized. Size it dynamically: erofs * inode sharing adds a backing file without bumping s_stack_depth. */ - bfsec->layers = kmalloc_array(ubfsec->layer_count + 1, - sizeof(*bfsec->layers), GFP_KERNEL); + bfsec->layers = kmalloc_objs(*bfsec->layers, ubfsec->layer_count + 1); if (!bfsec->layers) return -ENOMEM; diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index da77ad769c83..0a08e57288e2 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -3311,7 +3311,7 @@ int security_get_classes(struct selinux_policy *policy, rc = -ENOMEM; *nclasses = policydb->p_classes.nprim; - *classes = kcalloc(*nclasses, sizeof(**classes), GFP_ATOMIC); + *classes = kzalloc_objs(**classes, *nclasses, GFP_ATOMIC); if (!*classes) goto out; @@ -3375,7 +3375,7 @@ int security_get_permissions(struct selinux_policy *policy, rc = -ENOMEM; *nperms = match->permissions.nprim; - *perms = kcalloc(*nperms, sizeof(**perms), GFP_ATOMIC); + *perms = kzalloc_objs(**perms, *nperms, GFP_ATOMIC); if (!*perms) goto out; diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 5bc7e586b430..a801aa8226c2 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c @@ -725,7 +725,7 @@ static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size) size = PAGE_ALIGN(size); sgbuf->count = size >> PAGE_SHIFT; sgbuf->pages = kvzalloc_objs(*sgbuf->pages, sgbuf->count); - sgbuf->npages = kvcalloc(sgbuf->count, sizeof(*sgbuf->npages), GFP_KERNEL); + sgbuf->npages = kvzalloc_objs(*sgbuf->npages, sgbuf->count); if (!sgbuf->pages || !sgbuf->npages) goto error; diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index a51bc68473e6..fc7fce617a3f 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -1180,7 +1180,7 @@ static void snd_mixer_oss_proc_write(struct snd_info_entry *entry, slot->assigned->index == idx && !strcmp(slot->assigned->name, str)) /* not changed */ break; - tbl = kmalloc(sizeof(*tbl), GFP_KERNEL); + tbl = kmalloc_obj(*tbl); if (!tbl) break; tbl->oss_id = ch; diff --git a/sound/firewire/bebob/bebob_maudio.c b/sound/firewire/bebob/bebob_maudio.c index 376a9a175479..8079a938a69b 100644 --- a/sound/firewire/bebob/bebob_maudio.c +++ b/sound/firewire/bebob/bebob_maudio.c @@ -112,7 +112,7 @@ int snd_bebob_maudio_load_firmware(struct fw_unit *unit) return -ENXIO; } - cues = kmalloc_array(3, sizeof(*cues), GFP_KERNEL); + cues = kmalloc_objs(*cues, 3); if (!cues) return -ENOMEM; diff --git a/sound/firewire/dice/dice-transaction.c b/sound/firewire/dice/dice-transaction.c index a3f7dfa990a4..a8099108776d 100644 --- a/sound/firewire/dice/dice-transaction.c +++ b/sound/firewire/dice/dice-transaction.c @@ -275,8 +275,7 @@ static int get_subaddrs(struct snd_dice *dice) unsigned int i; int err; - pointers = kmalloc_array(ARRAY_SIZE(min_values), sizeof(__be32), - GFP_KERNEL); + pointers = kmalloc_objs(__be32, ARRAY_SIZE(min_values)); if (pointers == NULL) return -ENOMEM; diff --git a/sound/firewire/fireface/ff-protocol-former.c b/sound/firewire/fireface/ff-protocol-former.c index 0907d0a2296f..d3c354a20730 100644 --- a/sound/firewire/fireface/ff-protocol-former.c +++ b/sound/firewire/fireface/ff-protocol-former.c @@ -95,7 +95,7 @@ static int former_switch_fetching_mode(struct snd_ff *ff, bool enable) for (i = 0; i < SND_FF_STREAM_MODE_COUNT; ++i) count = max(count, ff->spec->pcm_playback_channels[i]); - reg = kcalloc(count, sizeof(__le32), GFP_KERNEL); + reg = kzalloc_objs(__le32, count); if (!reg) return -ENOMEM; diff --git a/sound/firewire/motu/motu-stream.c b/sound/firewire/motu/motu-stream.c index e5f21360cfb7..a8e67d12ff2c 100644 --- a/sound/firewire/motu/motu-stream.c +++ b/sound/firewire/motu/motu-stream.c @@ -186,8 +186,8 @@ int snd_motu_stream_reserve_duplex(struct snd_motu *motu, unsigned int rate, } motu->cache.size = motu->tx_stream.syt_interval * frames_per_buffer; - motu->cache.event_offsets = kcalloc(motu->cache.size, sizeof(*motu->cache.event_offsets), - GFP_KERNEL); + motu->cache.event_offsets = kzalloc_objs(*motu->cache.event_offsets, + motu->cache.size); if (!motu->cache.event_offsets) { fw_iso_resources_free(&motu->tx_resources); fw_iso_resources_free(&motu->rx_resources); diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index d49866d9961e..ddac6cecc8eb 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -2474,7 +2474,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_obj(*info, GFP_KERNEL); + info = kzalloc_obj(*info); if (!info) return -ENOMEM; snd_emu10k1_fx8010_info(emu, info); diff --git a/sound/soc/codecs/arizona-jack.c b/sound/soc/codecs/arizona-jack.c index 6587d46a1867..9706c77d5a81 100644 --- a/sound/soc/codecs/arizona-jack.c +++ b/sound/soc/codecs/arizona-jack.c @@ -1150,7 +1150,7 @@ static int arizona_extcon_get_micd_configs(struct device *dev, if (nconfs <= 0) return 0; - vals = kcalloc(nconfs, sizeof(u32), GFP_KERNEL); + vals = kzalloc_objs(u32, nconfs); if (!vals) return -ENOMEM; diff --git a/sound/soc/codecs/audio-iio-aux.c b/sound/soc/codecs/audio-iio-aux.c index eef0af63e3d6..4ad45511a2a7 100644 --- a/sound/soc/codecs/audio-iio-aux.c +++ b/sound/soc/codecs/audio-iio-aux.c @@ -245,9 +245,8 @@ static int audio_iio_aux_probe(struct platform_device *pdev) iio_aux->num_chans = count; - const char **names __free(kfree) = kcalloc(iio_aux->num_chans, - sizeof(*names), - GFP_KERNEL); + const char **names __free(kfree) = kzalloc_objs(*names, + iio_aux->num_chans); if (!names) return -ENOMEM; diff --git a/sound/soc/codecs/cs35l41-lib.c b/sound/soc/codecs/cs35l41-lib.c index b0fa80705be7..1402eeb55d12 100644 --- a/sound/soc/codecs/cs35l41-lib.c +++ b/sound/soc/codecs/cs35l41-lib.c @@ -821,7 +821,7 @@ int cs35l41_otp_unpack(struct device *dev, struct regmap *regmap) u32 otp_val, otp_id_reg; u32 *otp_mem; - otp_mem = kmalloc_array(CS35L41_OTP_SIZE_WORDS, sizeof(*otp_mem), GFP_KERNEL); + otp_mem = kmalloc_objs(*otp_mem, CS35L41_OTP_SIZE_WORDS); if (!otp_mem) return -ENOMEM; diff --git a/sound/soc/codecs/rt1011.c b/sound/soc/codecs/rt1011.c index dda38e6e56b6..9bd4a56d34bf 100644 --- a/sound/soc/codecs/rt1011.c +++ b/sound/soc/codecs/rt1011.c @@ -2053,16 +2053,14 @@ static int rt1011_probe(struct snd_soc_component *component) schedule_work(&rt1011->cali_work); rt1011->i2s_ref = 0; - rt1011->bq_drc_params = kcalloc(RT1011_ADVMODE_NUM, - sizeof(struct rt1011_bq_drc_params *), - GFP_KERNEL); + rt1011->bq_drc_params = kzalloc_objs(struct rt1011_bq_drc_params *, + RT1011_ADVMODE_NUM); if (!rt1011->bq_drc_params) return -ENOMEM; for (i = 0; i < RT1011_ADVMODE_NUM; i++) { - rt1011->bq_drc_params[i] = kcalloc(RT1011_BQ_DRC_NUM, - sizeof(struct rt1011_bq_drc_params), - GFP_KERNEL); + rt1011->bq_drc_params[i] = kzalloc_objs(struct rt1011_bq_drc_params, + RT1011_BQ_DRC_NUM); if (!rt1011->bq_drc_params[i]) goto err; } diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 5e0fc69576c0..90ec1102e1cc 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3488,8 +3488,8 @@ static int rt5645_probe(struct snd_soc_component *component) if (rt5645->pdata.long_name) component->card->long_name = rt5645->pdata.long_name; - rt5645->eq_param = kcalloc(RT5645_HWEQ_NUM, - sizeof(struct rt5645_eq_param_s), GFP_KERNEL); + rt5645->eq_param = kzalloc_objs(struct rt5645_eq_param_s, + RT5645_HWEQ_NUM); if (!rt5645->eq_param) return -ENOMEM; diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c index 4ecbbac93258..24a463ed053a 100644 --- a/sound/soc/codecs/sigmadsp.c +++ b/sound/soc/codecs/sigmadsp.c @@ -299,7 +299,7 @@ static int sigma_fw_load_samplerates(struct sigmadsp *sigmadsp, if (sigmadsp->rate_constraints.count) return -EINVAL; - rates = kcalloc(num_rates, sizeof(*rates), GFP_KERNEL); + rates = kzalloc_objs(*rates, num_rates); if (!rates) return -ENOMEM; diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index a98d1fd78925..fcce0afdce49 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -1733,7 +1733,7 @@ static int wcd9335_slim_set_hw_params(struct wcd9335_codec *wcd, cfg->port_mask |= BIT(ch->port); } - cfg->chs = kcalloc(cfg->ch_count, sizeof(unsigned int), GFP_KERNEL); + cfg->chs = kzalloc_objs(unsigned int, cfg->ch_count); if (!cfg->chs) return -ENOMEM; diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index 0ed24cca088f..274f2e579ad8 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -1706,7 +1706,7 @@ static int wcd934x_slim_set_hw_params(struct wcd934x_codec *wcd, cfg->port_mask |= BIT(ch->port); } - cfg->chs = kcalloc(cfg->ch_count, sizeof(unsigned int), GFP_KERNEL); + cfg->chs = kzalloc_objs(unsigned int, cfg->ch_count); if (!cfg->chs) return -ENOMEM; diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 96d2e54a2c6a..ea7eee742a33 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c @@ -2203,9 +2203,8 @@ static void wm8904_handle_pdata(struct snd_soc_component *component) wm8904_get_drc_enum, wm8904_put_drc_enum); /* We need an array of texts for the enum API */ - wm8904->drc_texts = kmalloc_array(pdata->num_drc_cfgs, - sizeof(*wm8904->drc_texts), - GFP_KERNEL); + wm8904->drc_texts = kmalloc_objs(*wm8904->drc_texts, + pdata->num_drc_cfgs); if (!wm8904->drc_texts) return; diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c index b26c36ca8249..f6fb67e9ea0a 100644 --- a/sound/soc/codecs/wm8958-dsp2.c +++ b/sound/soc/codecs/wm8958-dsp2.c @@ -927,9 +927,8 @@ void wm8958_dsp2_init(struct snd_soc_component *component) }; /* We need an array of texts for the enum API */ - wm8994->mbc_texts = kmalloc_array(pdata->num_mbc_cfgs, - sizeof(*wm8994->mbc_texts), - GFP_KERNEL); + wm8994->mbc_texts = kmalloc_objs(*wm8994->mbc_texts, + pdata->num_mbc_cfgs); if (!wm8994->mbc_texts) return; @@ -953,9 +952,8 @@ void wm8958_dsp2_init(struct snd_soc_component *component) }; /* We need an array of texts for the enum API */ - wm8994->vss_texts = kmalloc_array(pdata->num_vss_cfgs, - sizeof(*wm8994->vss_texts), - GFP_KERNEL); + wm8994->vss_texts = kmalloc_objs(*wm8994->vss_texts, + pdata->num_vss_cfgs); if (!wm8994->vss_texts) return; @@ -980,9 +978,8 @@ void wm8958_dsp2_init(struct snd_soc_component *component) }; /* We need an array of texts for the enum API */ - wm8994->vss_hpf_texts = kmalloc_array(pdata->num_vss_hpf_cfgs, - sizeof(*wm8994->vss_hpf_texts), - GFP_KERNEL); + wm8994->vss_hpf_texts = kmalloc_objs(*wm8994->vss_hpf_texts, + pdata->num_vss_hpf_cfgs); if (!wm8994->vss_hpf_texts) return; @@ -1008,9 +1005,8 @@ void wm8958_dsp2_init(struct snd_soc_component *component) }; /* We need an array of texts for the enum API */ - wm8994->enh_eq_texts = kmalloc_array(pdata->num_enh_eq_cfgs, - sizeof(*wm8994->enh_eq_texts), - GFP_KERNEL); + wm8994->enh_eq_texts = kmalloc_objs(*wm8994->enh_eq_texts, + pdata->num_enh_eq_cfgs); if (!wm8994->enh_eq_texts) return; diff --git a/sound/soc/intel/avs/loader.c b/sound/soc/intel/avs/loader.c index bebdc79ec88e..12144eccd8ec 100644 --- a/sound/soc/intel/avs/loader.c +++ b/sound/soc/intel/avs/loader.c @@ -269,7 +269,7 @@ int avs_cldma_transfer_modules(struct avs_dev *adev, bool load, return 0; } - mod_ids = kcalloc(num_mods, sizeof(u16), GFP_KERNEL); + mod_ids = kzalloc_objs(u16, num_mods); if (!mod_ids) return -ENOMEM; diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c index a8a2b3484338..936be206eece 100644 --- a/sound/soc/intel/avs/path.c +++ b/sound/soc/intel/avs/path.c @@ -178,9 +178,9 @@ int avs_path_set_constraint(struct avs_dev *adev, struct avs_tplg_path_template list_for_each_entry(path_template, &template->path_list, node) i++; - rlist = kcalloc(i, sizeof(*rlist), GFP_KERNEL); - clist = kcalloc(i, sizeof(*clist), GFP_KERNEL); - slist = kcalloc(i, sizeof(*slist), GFP_KERNEL); + rlist = kzalloc_objs(*rlist, i); + clist = kzalloc_objs(*clist, i); + slist = kzalloc_objs(*slist, i); if (!rlist || !clist || !slist) return -ENOMEM; diff --git a/sound/soc/qcom/qaif-platform.c b/sound/soc/qcom/qaif-platform.c index facba3be2d8e..b13083911ab0 100644 --- a/sound/soc/qcom/qaif-platform.c +++ b/sound/soc/qcom/qaif-platform.c @@ -228,7 +228,7 @@ static int qaif_platform_pcmops_open(struct snd_soc_component *component, return dma_reg_idx; } - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = kzalloc_obj(*data); if (!data) return -ENOMEM; runtime->private_data = data; diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c index 9ac51c304ead..80c2cca89f23 100644 --- a/sound/soc/qcom/qdsp6/q6afe.c +++ b/sound/soc/qcom/qdsp6/q6afe.c @@ -1861,7 +1861,7 @@ struct q6afe_port *q6afe_port_get_from_id(struct device *dev, int id) return ERR_PTR(-EINVAL); } - port = kzalloc_obj(*port, GFP_KERNEL); + port = kzalloc_obj(*port); if (!port) return ERR_PTR(-ENOMEM); diff --git a/sound/soc/sof/ipc3-control.c b/sound/soc/sof/ipc3-control.c index d1697401b1da..b1d00a2a860a 100644 --- a/sound/soc/sof/ipc3-control.c +++ b/sound/soc/sof/ipc3-control.c @@ -743,7 +743,7 @@ sof_ipc3_set_up_volume_table(struct snd_sof_control *scontrol, int tlv[SOF_TLV_I int i; /* init the volume table */ - scontrol->volume_table = kcalloc(size, sizeof(u32), GFP_KERNEL); + scontrol->volume_table = kzalloc_objs(u32, size); if (!scontrol->volume_table) return -ENOMEM; diff --git a/sound/soc/sof/ipc4-compress.c b/sound/soc/sof/ipc4-compress.c index 97a4ec751905..780f99fb73d4 100644 --- a/sound/soc/sof/ipc4-compress.c +++ b/sound/soc/sof/ipc4-compress.c @@ -474,7 +474,7 @@ static int sof_ipc4_compr_set_params(struct snd_soc_component *component, goto free_list; } - compr_data = kzalloc(sizeof(*compr_data), GFP_KERNEL); + compr_data = kzalloc_obj(*compr_data); if (!compr_data) { ret = -ENOMEM; goto free_list; diff --git a/sound/soc/sof/ipc4-control.c b/sound/soc/sof/ipc4-control.c index 8d86d32a16ca..e29c8d89284a 100644 --- a/sound/soc/sof/ipc4-control.c +++ b/sound/soc/sof/ipc4-control.c @@ -1003,7 +1003,7 @@ sof_ipc4_set_up_volume_table(struct snd_sof_control *scontrol, int tlv[SOF_TLV_I int i; /* init the volume table */ - scontrol->volume_table = kcalloc(size, sizeof(u32), GFP_KERNEL); + scontrol->volume_table = kzalloc_objs(u32, size); if (!scontrol->volume_table) return -ENOMEM; diff --git a/sound/soc/sof/sof-client-probes-ipc4.c b/sound/soc/sof/sof-client-probes-ipc4.c index c547ea61fb3d..6a7dcfdf7b8e 100644 --- a/sound/soc/sof/sof-client-probes-ipc4.c +++ b/sound/soc/sof/sof-client-probes-ipc4.c @@ -383,8 +383,7 @@ static int ipc4_probes_points_remove(struct sof_client_dev *cdev, if (!mentry) return -ENODEV; - probe_point_ids = kcalloc(num_buffer_id, sizeof(*probe_point_ids), - GFP_KERNEL); + probe_point_ids = kzalloc_objs(*probe_point_ids, num_buffer_id); if (!probe_point_ids) return -ENOMEM; diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 750916b57def..4dcacafb9cdb 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -2519,8 +2519,7 @@ int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file) int i; const char **tplg_files __free(kfree) = - kcalloc(scomp->card->num_links, sizeof(*tplg_files), - GFP_KERNEL); + kzalloc_objs(*tplg_files, scomp->card->num_links); if (!tplg_files) return -ENOMEM; diff --git a/sound/usb/format.c b/sound/usb/format.c index 4830f9f93ad7..bb3a0b755a7f 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -578,7 +578,7 @@ static int validate_sample_rate_table_v2v3(struct snd_usb_audio *chip, UAC2_AS_VAL_ALT_SETTINGS)) return 0; - table = kcalloc(fp->nr_rates, sizeof(*table), GFP_KERNEL); + table = kzalloc_objs(*table, fp->nr_rates); if (!table) return -ENOMEM; diff --git a/sound/usb/qcom/qc_audio_offload.c b/sound/usb/qcom/qc_audio_offload.c index e4bfd43a2488..e9dc6ad8c3a2 100644 --- a/sound/usb/qcom/qc_audio_offload.c +++ b/sound/usb/qcom/qc_audio_offload.c @@ -1828,8 +1828,7 @@ static void qc_usb_audio_offload_probe(struct snd_usb_audio *chip) * Allocate playback pcm index array based on number of possible * playback paths within the UAC descriptors. */ - sdev->ppcm_idx = kcalloc(sdev->num_playback, sizeof(unsigned int), - GFP_KERNEL); + sdev->ppcm_idx = kzalloc_objs(unsigned int, sdev->num_playback); if (!sdev->ppcm_idx) goto unreg_xhci; From bcd347f31e84ecfb1e45be488b1c7c835b8feb4c Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Sun, 9 Aug 2026 12:41:08 -0700 Subject: [PATCH 2/3] coccinelle: kmalloc_obj: Include devm_kmalloc_obj conversion rules Mirroring the kmalloc -> kmalloc_obj conversion rules, do the same for devm_kmalloc. The device-managed allocators differ only by taking the managing "struct device *" as a leading argument, so capture the leading arguments in an "expression list" metavariable rather than repeating every pattern. Signed-off-by: Kees Cook Cc: Julia Lawall Cc: Nicolas Palix Cc: --- scripts/coccinelle/api/kmalloc_objs.cocci | 114 +++++++++++++--------- 1 file changed, 66 insertions(+), 48 deletions(-) diff --git a/scripts/coccinelle/api/kmalloc_objs.cocci b/scripts/coccinelle/api/kmalloc_objs.cocci index 0a98ddf03eca..e47604f7a1a6 100644 --- a/scripts/coccinelle/api/kmalloc_objs.cocci +++ b/scripts/coccinelle/api/kmalloc_objs.cocci @@ -20,6 +20,10 @@ def alloc_array(name): func = "kzalloc_objs" elif name == "kvcalloc": func = "kvzalloc_objs" + elif name == "devm_kmalloc_array": + func = "devm_kmalloc_objs" + elif name == "devm_kcalloc": + func = "devm_kzalloc_objs" else: print(f"Unknown transform for {name}", file=sys.stderr) return func @@ -42,6 +46,15 @@ def alloc_array(name): // Everything else gets the sizeof() extracted for the kmalloc_obj() // type/var argument. // +// The device-managed allocators differ from the plain ones only by taking +// the managing "struct device *" as a leading argument, so rather than +// repeating every pattern for them, the leading arguments are captured in +// an "expression list" metavariable and replayed on the replacement side. +// ARGS is empty for the plain allocators, in which case Coccinelle drops +// the separating comma as well. Note that there is no devm_kvmalloc +// family, and that the devm array helpers only exist as +// (dev, count, size, gfp). +// // The first matching alternative below wins, so the exclusions must come // before the more general conversions. @direct depends on patch && !(file in "tools") && !(file in "samples")@ @@ -81,150 +94,155 @@ expression GFP; expression COUNT; expression FLEX; expression E; -identifier ALLOC =~ "^kv?[mz]alloc$"; +expression list ARGS; +identifier ALLOC = {kmalloc,kzalloc,kvmalloc,kvzalloc, + devm_kmalloc,devm_kzalloc}; fresh identifier ALLOC_OBJ = ALLOC ## "_obj"; fresh identifier ALLOC_FLEX = ALLOC ## "_flex"; -identifier ALLOC_ARRAY = {kmalloc_array,kvmalloc_array,kcalloc,kvcalloc}; +identifier ALLOC_ARRAY = {kmalloc_array,kvmalloc_array,kcalloc,kvcalloc, + devm_kmalloc_array,devm_kcalloc}; fresh identifier ALLOC_OBJS = script:python(ALLOC_ARRAY) { alloc_array(ALLOC_ARRAY) }; @@ ( // Convert a single object sized by its target: p = kmalloc(sizeof(*p), gfp) -- VAR = ALLOC((sizeof(*VAR)), GFP) -+ VAR = ALLOC_OBJ(*VAR, GFP) +- VAR = ALLOC(ARGS, (sizeof(*VAR)), GFP) ++ VAR = ALLOC_OBJ(ARGS, *VAR, GFP) | // Exclude byte buffers and integral pointers: kmalloc(sizeof(u8), gfp), // kmalloc(sizeof("str"), gfp), kmalloc(sizeof(char *), gfp) - ALLOC((\(sizeof(STRING)\|sizeof(BYTE_TYPES)\| + ALLOC(ARGS, (\(sizeof(STRING)\|sizeof(BYTE_TYPES)\| sizeof(BYTE_TYPES *)\|sizeof(MULTIBYTE_TYPES *)\)), GFP) | // Exclude anything assigned to a byte pointer: // u8 *buf = kmalloc(sizeof(*hdr), gfp) - BYTES = ALLOC((\(sizeof(E)\|sizeof(TYPE)\)), GFP) + BYTES = ALLOC(ARGS, (\(sizeof(E)\|sizeof(TYPE)\)), GFP) | // Convert a multi-byte type to a pointer to it: // u32 *p = kmalloc(sizeof(u32), gfp) \(MULTIBYTES\|CONST_MULTIBYTES\) = -- ALLOC((sizeof(MULTIBYTE_TYPES)), GFP) -+ ALLOC_OBJ(MULTIBYTE_TYPES, GFP) +- ALLOC(ARGS, (sizeof(MULTIBYTE_TYPES)), GFP) ++ ALLOC_OBJ(ARGS, MULTIBYTE_TYPES, GFP) | // Same by expression: u32 *p = kmalloc(sizeof(p[0]), gfp) \(MULTIBYTES\|CONST_MULTIBYTES\) = -- ALLOC((sizeof(MULTIBYTE)), GFP) -+ ALLOC_OBJ(MULTIBYTE, GFP) +- ALLOC(ARGS, (sizeof(MULTIBYTE)), GFP) ++ ALLOC_OBJ(ARGS, MULTIBYTE, GFP) | // Exclude other multi-byte sizes, e.g. to pointers to arrays: s16 (*p)[2] = ... - ALLOC((\(sizeof(MULTIBYTE_TYPES)\|sizeof(MULTIBYTE)\)), GFP) + ALLOC(ARGS, (\(sizeof(MULTIBYTE_TYPES)\|sizeof(MULTIBYTE)\)), GFP) | // Exclude anything else assigned to a multi-byte pointer: // u32 *p = kmalloc(sizeof(*hdr), gfp) - \(MULTIBYTES\|CONST_MULTIBYTES\) = ALLOC((\(sizeof(E)\|sizeof(TYPE)\)), GFP) + \(MULTIBYTES\|CONST_MULTIBYTES\) = ALLOC(ARGS, (\(sizeof(E)\|sizeof(TYPE)\)), GFP) | // Exclude void pointers, to be checked by hand: kmalloc(sizeof(void *), gfp) - ALLOC((sizeof(void *)), GFP) + ALLOC(ARGS, (sizeof(void *)), GFP) | // Convert any other expression: p = kmalloc(sizeof(s->item), gfp) -- ALLOC((sizeof(E)), GFP) -+ ALLOC_OBJ(E, GFP) +- ALLOC(ARGS, (sizeof(E)), GFP) ++ ALLOC_OBJ(ARGS, E, GFP) | // Convert any other type: p = kmalloc(sizeof(struct item), gfp) -- ALLOC((sizeof(TYPE)), GFP) -+ ALLOC_OBJ(TYPE, GFP) +- ALLOC(ARGS, (sizeof(TYPE)), GFP) ++ ALLOC_OBJ(ARGS, TYPE, GFP) | // The same, for arrays allocated as (count, size): // Exclude byte buffers and integral pointers: kcalloc(n, sizeof(u8), gfp), // kcalloc(n, sizeof(char *), gfp) - ALLOC_ARRAY(COUNT, (\(sizeof(STRING)\|sizeof(BYTE_TYPES)\| + ALLOC_ARRAY(ARGS, COUNT, (\(sizeof(STRING)\|sizeof(BYTE_TYPES)\| sizeof(BYTE_TYPES *)\|sizeof(MULTIBYTE_TYPES *)\)), GFP) | // Exclude arrays assigned to a byte pointer: // u8 *buf = kcalloc(n, sizeof(*hdr), gfp) - BYTES = ALLOC_ARRAY(COUNT, (\(sizeof(E)\|sizeof(TYPE)\)), GFP) + BYTES = ALLOC_ARRAY(ARGS, COUNT, (\(sizeof(E)\|sizeof(TYPE)\)), GFP) | // Convert a multi-byte array to a pointer to it: // u32 *p = kcalloc(n, sizeof(u32), gfp) \(MULTIBYTES\|CONST_MULTIBYTES\) = -- ALLOC_ARRAY(COUNT, (sizeof(MULTIBYTE_TYPES)), GFP) -+ ALLOC_OBJS(MULTIBYTE_TYPES, COUNT, GFP) +- ALLOC_ARRAY(ARGS, COUNT, (sizeof(MULTIBYTE_TYPES)), GFP) ++ ALLOC_OBJS(ARGS, MULTIBYTE_TYPES, COUNT, GFP) | // Same by expression: u32 *p = kcalloc(n, sizeof(*p), gfp) \(MULTIBYTES\|CONST_MULTIBYTES\) = -- ALLOC_ARRAY(COUNT, (sizeof(MULTIBYTE)), GFP) -+ ALLOC_OBJS(MULTIBYTE, COUNT, GFP) +- ALLOC_ARRAY(ARGS, COUNT, (sizeof(MULTIBYTE)), GFP) ++ ALLOC_OBJS(ARGS, MULTIBYTE, COUNT, GFP) | // Exclude other multi-byte arrays: // s16 (*pairs)[2] = kcalloc(n, sizeof(s16), gfp) - ALLOC_ARRAY(COUNT, (\(sizeof(MULTIBYTE_TYPES)\|sizeof(MULTIBYTE)\)), GFP) + ALLOC_ARRAY(ARGS, COUNT, (\(sizeof(MULTIBYTE_TYPES)\|sizeof(MULTIBYTE)\)), GFP) | // Exclude other arrays assigned to a multi-byte pointer: // u32 *p = kcalloc(n, sizeof(*hdr), gfp) - \(MULTIBYTES\|CONST_MULTIBYTES\) = ALLOC_ARRAY(COUNT, (\(sizeof(E)\|sizeof(TYPE)\)), GFP) + \(MULTIBYTES\|CONST_MULTIBYTES\) = ALLOC_ARRAY(ARGS, COUNT, (\(sizeof(E)\|sizeof(TYPE)\)), GFP) | // Exclude arrays of void pointers: kcalloc(n, sizeof(void *), gfp) - ALLOC_ARRAY(COUNT, (sizeof(void *)), GFP) + ALLOC_ARRAY(ARGS, COUNT, (sizeof(void *)), GFP) | // Convert any other expression: p = kcalloc(n, sizeof(*p), gfp) -- ALLOC_ARRAY(COUNT, (sizeof(E)), GFP) -+ ALLOC_OBJS(E, COUNT, GFP) +- ALLOC_ARRAY(ARGS, COUNT, (sizeof(E)), GFP) ++ ALLOC_OBJS(ARGS, E, COUNT, GFP) | // Convert any other type: p = kcalloc(n, sizeof(struct item), gfp) -- ALLOC_ARRAY(COUNT, (sizeof(TYPE)), GFP) -+ ALLOC_OBJS(TYPE, COUNT, GFP) +- ALLOC_ARRAY(ARGS, COUNT, (sizeof(TYPE)), GFP) ++ ALLOC_OBJS(ARGS, TYPE, COUNT, GFP) | // The same, for arrays allocated as (size, count): // Exclude byte buffers and integral pointers: kcalloc(sizeof(u8), n, gfp), // kcalloc(sizeof(char *), n, gfp) - ALLOC_ARRAY((\(sizeof(STRING)\|sizeof(BYTE_TYPES)\| + ALLOC_ARRAY(ARGS, (\(sizeof(STRING)\|sizeof(BYTE_TYPES)\| sizeof(BYTE_TYPES *)\|sizeof(MULTIBYTE_TYPES *)\)), COUNT, GFP) | // Exclude arrays assigned to a byte pointer: // u8 *buf = kcalloc(sizeof(*hdr), n, gfp) - BYTES = ALLOC_ARRAY((\(sizeof(E)\|sizeof(TYPE)\)), COUNT, GFP) + BYTES = ALLOC_ARRAY(ARGS, (\(sizeof(E)\|sizeof(TYPE)\)), COUNT, GFP) | // Convert a multi-byte array to a pointer to it: // u32 *p = kcalloc(sizeof(u32), n, gfp) \(MULTIBYTES\|CONST_MULTIBYTES\) = -- ALLOC_ARRAY((sizeof(MULTIBYTE_TYPES)), COUNT, GFP) -+ ALLOC_OBJS(MULTIBYTE_TYPES, COUNT, GFP) +- ALLOC_ARRAY(ARGS, (sizeof(MULTIBYTE_TYPES)), COUNT, GFP) ++ ALLOC_OBJS(ARGS, MULTIBYTE_TYPES, COUNT, GFP) | // Same by expression: u32 *p = kcalloc(sizeof(*p), n, gfp) \(MULTIBYTES\|CONST_MULTIBYTES\) = -- ALLOC_ARRAY((sizeof(MULTIBYTE)), COUNT, GFP) -+ ALLOC_OBJS(MULTIBYTE, COUNT, GFP) +- ALLOC_ARRAY(ARGS, (sizeof(MULTIBYTE)), COUNT, GFP) ++ ALLOC_OBJS(ARGS, MULTIBYTE, COUNT, GFP) | // Exclude other multi-byte arrays: // s16 (*pairs)[2] = kcalloc(sizeof(s16), n, gfp) - ALLOC_ARRAY((\(sizeof(MULTIBYTE_TYPES)\|sizeof(MULTIBYTE)\)), COUNT, GFP) + ALLOC_ARRAY(ARGS, (\(sizeof(MULTIBYTE_TYPES)\|sizeof(MULTIBYTE)\)), COUNT, GFP) | // Exclude other arrays assigned to a multi-byte pointer: // u32 *p = kcalloc(sizeof(*hdr), n, gfp) - \(MULTIBYTES\|CONST_MULTIBYTES\) = ALLOC_ARRAY((\(sizeof(E)\|sizeof(TYPE)\)), COUNT, GFP) + \(MULTIBYTES\|CONST_MULTIBYTES\) = ALLOC_ARRAY(ARGS, (\(sizeof(E)\|sizeof(TYPE)\)), COUNT, GFP) | // Exclude arrays of void pointers: kcalloc(sizeof(void *), n, gfp) - ALLOC_ARRAY((sizeof(void *)), COUNT, GFP) + ALLOC_ARRAY(ARGS, (sizeof(void *)), COUNT, GFP) | // Convert any other expression: p = kcalloc(sizeof(*p), n, gfp) -- ALLOC_ARRAY((sizeof(E)), COUNT, GFP) -+ ALLOC_OBJS(E, COUNT, GFP) +- ALLOC_ARRAY(ARGS, (sizeof(E)), COUNT, GFP) ++ ALLOC_OBJS(ARGS, E, COUNT, GFP) | // Convert any other type: p = kcalloc(sizeof(struct item), n, gfp) -- ALLOC_ARRAY((sizeof(TYPE)), COUNT, GFP) -+ ALLOC_OBJS(TYPE, COUNT, GFP) +- ALLOC_ARRAY(ARGS, (sizeof(TYPE)), COUNT, GFP) ++ ALLOC_OBJS(ARGS, TYPE, COUNT, GFP) | // Convert flexible array structures: p = kmalloc(struct_size(p, data, n), gfp) -- ALLOC(struct_size(VAR, FLEX, COUNT), GFP) -+ ALLOC_FLEX(*VAR, FLEX, COUNT, GFP) +- ALLOC(ARGS, struct_size(VAR, FLEX, COUNT), GFP) ++ ALLOC_FLEX(ARGS, *VAR, FLEX, COUNT, GFP) | // Same by type: kmalloc(struct_size_t(struct item, data, n), gfp) -- ALLOC(struct_size_t(TYPE, FLEX, COUNT), GFP) -+ ALLOC_FLEX(TYPE, FLEX, COUNT, GFP) +- ALLOC(ARGS, struct_size_t(TYPE, FLEX, COUNT), GFP) ++ ALLOC_FLEX(ARGS, TYPE, FLEX, COUNT, GFP) ) @drop_gfp_kernel depends on patch && !(file in "tools") && !(file in "samples")@ identifier ALLOC = {kmalloc_obj,kmalloc_objs,kmalloc_flex, kzalloc_obj,kzalloc_objs,kzalloc_flex, kvmalloc_obj,kvmalloc_objs,kvmalloc_flex, - kvzalloc_obj,kvzalloc_objs,kvzalloc_flex}; + kvzalloc_obj,kvzalloc_objs,kvzalloc_flex, + devm_kmalloc_obj,devm_kmalloc_objs,devm_kmalloc_flex, + devm_kzalloc_obj,devm_kzalloc_objs,devm_kzalloc_flex}; @@ ALLOC(... From 4dd10fbbeb9c33709edc89916e19c03c780a0751 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Wed, 28 Oct 2026 23:16:33 -0700 Subject: [PATCH 3/3] treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() family Mirroring the earlier kmalloc_obj() conversion, convert the device-managed allocators over to the type-based API using the now updated scripts/coccinelle/api/kmalloc_objs.cocci. The size is derived from the type rather than written out as a sizeof(), and the result is a pointer to that type rather than void *, so a mismatch between the size requested and the variable assigned becomes a build error instead of being silently accepted. The conversions break down as: 6713 devm_kzalloc_obj() 1749 devm_kzalloc_objs() 307 devm_kzalloc_flex() 91 devm_kmalloc_objs() 82 devm_kmalloc_obj() 2 devm_kmalloc_flex() The rules deliberately leave alone allocations sized by a string or a byte-sized type, or assigned to a pointer to a byte-sized type, since those are byte buffers rather than objects. Allocations sized by a multi-byte integer type are only converted when they are assigned to a pointer to that same type, and allocations of pointers to integers or of void pointers are left alone too. After this change, 528 files still call devm_kmalloc(), devm_kzalloc(), devm_kcalloc(), or devm_kmalloc_array(). Build tested with allmodconfig on x86_64, arm64, i386, arm, riscv, s390, m68k, mips, parisc, sparc, loongarch, arc, xtensa, and openrisc with GCC 16.2.0 with no new warnings. Signed-off-by: Kees Cook --- arch/arc/kernel/perf_event.c | 17 ++-- arch/arm/common/sa1111.c | 2 +- arch/arm/mach-imx/src.c | 2 +- arch/arm/mach-omap1/omap-dma.c | 3 +- arch/mips/pci/pci-ar2315.c | 2 +- arch/mips/pci/pci-ar71xx.c | 3 +- arch/mips/pci/pci-ar724x.c | 3 +- arch/mips/pci/pci-rt3883.c | 2 +- arch/mips/ralink/timer.c | 2 +- arch/powerpc/platforms/512x/mpc512x_lpbfifo.c | 4 +- arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 2 +- arch/powerpc/platforms/8xx/cpm1-ic.c | 2 +- arch/powerpc/platforms/8xx/cpm1.c | 4 +- arch/powerpc/sysdev/cpm_common.c | 2 +- arch/sparc/kernel/leon_pci_grpci1.c | 2 +- arch/um/drivers/virtio_uml.c | 2 +- arch/x86/platform/intel-mid/pwr.c | 2 +- crypto/crypto_engine.c | 2 +- drivers/accel/qaic/mhi_controller.c | 4 +- drivers/accel/qaic/qaic_debugfs.c | 2 +- drivers/accel/qaic/qaic_drv.c | 2 +- drivers/accel/qaic/sahara.c | 2 +- drivers/accel/rocket/rocket_device.c | 2 +- drivers/acpi/ac.c | 2 +- drivers/acpi/acpi_apd.c | 2 +- drivers/acpi/acpi_tad.c | 2 +- drivers/acpi/apei/ghes-nvidia.c | 2 +- drivers/acpi/battery.c | 2 +- drivers/acpi/button.c | 2 +- drivers/acpi/evged.c | 4 +- drivers/acpi/fan_core.c | 4 +- drivers/acpi/nfit/core.c | 18 ++-- drivers/acpi/pfr_telemetry.c | 2 +- drivers/acpi/pfr_update.c | 2 +- drivers/acpi/pmic/intel_pmic.c | 2 +- drivers/acpi/pmic/tps68470_pmic.c | 2 +- drivers/ata/acard-ahci.c | 4 +- drivers/ata/ahci.c | 2 +- drivers/ata/ahci_brcm.c | 2 +- drivers/ata/ahci_ceva.c | 2 +- drivers/ata/ahci_da850.c | 2 +- drivers/ata/ahci_dwc.c | 2 +- drivers/ata/ahci_imx.c | 2 +- drivers/ata/ahci_mtk.c | 2 +- drivers/ata/ahci_qoriq.c | 2 +- drivers/ata/ahci_seattle.c | 2 +- drivers/ata/ahci_st.c | 2 +- drivers/ata/ahci_tegra.c | 7 +- drivers/ata/ahci_xgene.c | 2 +- drivers/ata/ata_piix.c | 2 +- drivers/ata/libahci.c | 2 +- drivers/ata/libahci_platform.c | 2 +- drivers/ata/pata_acpi.c | 2 +- drivers/ata/pata_arasan_cf.c | 2 +- drivers/ata/pata_atp867x.c | 2 +- drivers/ata/pata_cmd640.c | 2 +- drivers/ata/pata_ep93xx.c | 2 +- drivers/ata/pata_ftide010.c | 2 +- drivers/ata/pata_icside.c | 2 +- drivers/ata/pata_imx.c | 3 +- drivers/ata/pata_it821x.c | 2 +- drivers/ata/pata_ixp4xx_cf.c | 2 +- drivers/ata/pata_macio.c | 6 +- drivers/ata/pata_mpc52xx.c | 2 +- drivers/ata/pata_octeon_cf.c | 2 +- drivers/ata/pata_platform.c | 2 +- drivers/ata/pata_pxa.c | 3 +- drivers/ata/pata_rb532_cf.c | 2 +- drivers/ata/pata_rdc.c | 2 +- drivers/ata/pata_via.c | 2 +- drivers/ata/pdc_adma.c | 2 +- drivers/ata/sata_dwc_460ex.c | 4 +- drivers/ata/sata_gemini.c | 2 +- drivers/ata/sata_highbank.c | 4 +- drivers/ata/sata_mv.c | 14 +-- drivers/ata/sata_nv.c | 6 +- drivers/ata/sata_promise.c | 4 +- drivers/ata/sata_qstor.c | 2 +- drivers/ata/sata_rcar.c | 2 +- drivers/ata/sata_sil24.c | 2 +- drivers/ata/sata_sx4.c | 4 +- drivers/ata/sata_uli.c | 2 +- drivers/ata/sata_via.c | 2 +- drivers/auxdisplay/arm-charlcd.c | 2 +- drivers/auxdisplay/ht16k33.c | 2 +- drivers/auxdisplay/img-ascii-lcd.c | 2 +- drivers/auxdisplay/max6959.c | 2 +- drivers/auxdisplay/seg-led-gpio.c | 2 +- drivers/base/pinctrl.c | 2 +- drivers/base/regmap/regmap-sdw-mbq.c | 2 +- drivers/base/regmap/regmap.c | 5 +- drivers/bcma/host_soc.c | 2 +- drivers/bluetooth/bcm203x.c | 2 +- drivers/bluetooth/bfusb.c | 2 +- drivers/bluetooth/bpa10x.c | 2 +- drivers/bluetooth/btintel_pcie.c | 5 +- drivers/bluetooth/btmrvl_sdio.c | 5 +- drivers/bluetooth/btmtksdio.c | 2 +- drivers/bluetooth/btmtkuart.c | 2 +- drivers/bluetooth/btnxpuart.c | 2 +- drivers/bluetooth/btqcomsmd.c | 2 +- drivers/bluetooth/btsdio.c | 2 +- drivers/bluetooth/hci_aml.c | 2 +- drivers/bluetooth/hci_bcm.c | 4 +- drivers/bluetooth/hci_bcm4377.c | 7 +- drivers/bluetooth/hci_h5.c | 2 +- drivers/bluetooth/hci_intel.c | 2 +- drivers/bluetooth/hci_ll.c | 2 +- drivers/bluetooth/hci_mrvl.c | 2 +- drivers/bluetooth/hci_nokia.c | 2 +- drivers/bluetooth/hci_qca.c | 9 +- drivers/bus/brcmstb_gisb.c | 2 +- drivers/bus/fsl-mc/dprc-driver.c | 5 +- drivers/bus/fsl-mc/fsl-mc-allocator.c | 11 +-- drivers/bus/fsl-mc/fsl-mc-bus.c | 7 +- drivers/bus/fsl-mc/mc-io.c | 2 +- drivers/bus/hisi_lpc.c | 7 +- drivers/bus/imx-aipstz.c | 2 +- drivers/bus/imx-weim.c | 2 +- drivers/bus/intel-ixp4xx-eb.c | 2 +- drivers/bus/mhi/ep/clients/loopback.c | 2 +- drivers/bus/mhi/host/clients/loopback.c | 2 +- drivers/bus/mhi/host/pci_generic.c | 4 +- drivers/bus/moxtet.c | 3 +- drivers/bus/omap_l3_noc.c | 2 +- drivers/bus/qcom-ssc-block-bus.c | 2 +- drivers/bus/simple-pm-bus.c | 2 +- drivers/bus/stm32_dbg_bus.c | 4 +- drivers/bus/stm32_etzpc.c | 2 +- drivers/bus/stm32_firewall.c | 2 +- drivers/bus/stm32_rifsc.c | 4 +- drivers/bus/sunxi-rsb.c | 2 +- drivers/bus/tegra-aconnect.c | 3 +- drivers/bus/tegra-gmi.c | 2 +- drivers/bus/ti-sysc.c | 15 ++- drivers/bus/ts-nbus.c | 2 +- drivers/bus/uniphier-system-bus.c | 2 +- drivers/bus/vexpress-config.c | 4 +- drivers/char/hw_random/airoha-trng.c | 2 +- drivers/char/hw_random/arm_smccc_trng.c | 2 +- drivers/char/hw_random/atmel-rng.c | 2 +- drivers/char/hw_random/ba431-rng.c | 2 +- drivers/char/hw_random/bcm2835-rng.c | 2 +- drivers/char/hw_random/bcm74110-rng.c | 2 +- drivers/char/hw_random/cavium-rng-vf.c | 2 +- drivers/char/hw_random/cavium-rng.c | 2 +- drivers/char/hw_random/cctrng.c | 2 +- drivers/char/hw_random/cn10k-rng.c | 2 +- drivers/char/hw_random/exynos-trng.c | 2 +- drivers/char/hw_random/hisi-rng.c | 2 +- drivers/char/hw_random/hisi-trng-v2.c | 2 +- drivers/char/hw_random/histb-rng.c | 2 +- drivers/char/hw_random/imx-rngc.c | 2 +- drivers/char/hw_random/ingenic-rng.c | 2 +- drivers/char/hw_random/ingenic-trng.c | 2 +- drivers/char/hw_random/iproc-rng200.c | 2 +- drivers/char/hw_random/jh7110-trng.c | 2 +- drivers/char/hw_random/ks-sa-rng.c | 2 +- drivers/char/hw_random/meson-rng.c | 2 +- drivers/char/hw_random/mpfs-rng.c | 2 +- drivers/char/hw_random/mtk-rng.c | 2 +- drivers/char/hw_random/mxc-rnga.c | 2 +- drivers/char/hw_random/n2-drv.c | 5 +- drivers/char/hw_random/npcm-rng.c | 2 +- drivers/char/hw_random/octeon-rng.c | 2 +- drivers/char/hw_random/omap-rng.c | 2 +- drivers/char/hw_random/omap3-rom-rng.c | 2 +- drivers/char/hw_random/pic32-rng.c | 2 +- drivers/char/hw_random/qcom-rng.c | 2 +- drivers/char/hw_random/rockchip-rng.c | 2 +- drivers/char/hw_random/st-rng.c | 2 +- drivers/char/hw_random/stm32-rng.c | 2 +- drivers/char/hw_random/timeriomem-rng.c | 3 +- drivers/char/hw_random/xgene-rng.c | 2 +- drivers/char/hw_random/xilinx-trng.c | 2 +- drivers/char/hw_random/xiphera-trng.c | 2 +- drivers/char/ipmi/bt-bmc.c | 2 +- drivers/char/ipmi/ipmb_dev_int.c | 3 +- drivers/char/ipmi/ipmi_ipmb.c | 2 +- drivers/char/ipmi/ipmi_powernv.c | 2 +- drivers/char/ipmi/kcs_bmc_aspeed.c | 2 +- drivers/char/ipmi/kcs_bmc_cdev_ipmi.c | 2 +- drivers/char/ipmi/kcs_bmc_npcm7xx.c | 2 +- drivers/char/ipmi/kcs_bmc_serio.c | 2 +- drivers/char/ipmi/ssif_bmc.c | 2 +- drivers/char/tpm/st33zp24/i2c.c | 3 +- drivers/char/tpm/st33zp24/spi.c | 3 +- drivers/char/tpm/st33zp24/st33zp24.c | 3 +- drivers/char/tpm/tpm_atmel.c | 2 +- drivers/char/tpm/tpm_crb.c | 2 +- drivers/char/tpm/tpm_ftpm_tee.c | 3 +- drivers/char/tpm/tpm_i2c_atmel.c | 2 +- drivers/char/tpm/tpm_i2c_nuvoton.c | 2 +- drivers/char/tpm/tpm_nsc.c | 2 +- drivers/char/tpm/tpm_svsm.c | 2 +- drivers/char/tpm/tpm_tis.c | 2 +- drivers/char/tpm/tpm_tis_i2c.c | 3 +- drivers/char/tpm/tpm_tis_i2c_cr50.c | 2 +- drivers/char/tpm/tpm_tis_spi_cr50.c | 2 +- drivers/char/tpm/tpm_tis_spi_main.c | 3 +- drivers/char/tpm/tpm_tis_synquacer.c | 2 +- drivers/char/xilinx_hwicap/xilinx_hwicap.c | 2 +- drivers/char/xillybus/xillybus_core.c | 20 ++-- drivers/clk/actions/owl-s500.c | 2 +- drivers/clk/actions/owl-s700.c | 2 +- drivers/clk/actions/owl-s900.c | 2 +- drivers/clk/anlogic/cru_dr1.c | 2 +- drivers/clk/aspeed/clk-aspeed.c | 2 +- drivers/clk/aspeed/clk-ast2600.c | 2 +- drivers/clk/aspeed/clk-ast2700.c | 6 +- drivers/clk/axs10x/i2s_pll_clock.c | 2 +- drivers/clk/axs10x/pll_clock.c | 2 +- drivers/clk/bcm/clk-bcm2711-dvp.c | 6 +- drivers/clk/bcm/clk-bcm2835-aux.c | 5 +- drivers/clk/bcm/clk-bcm2835.c | 14 ++- drivers/clk/bcm/clk-bcm63268-timer.c | 3 +- drivers/clk/bcm/clk-bcm63xx-gate.c | 3 +- drivers/clk/bcm/clk-raspberrypi.c | 13 +-- drivers/clk/cix/clk-sky1-audss.c | 15 ++- drivers/clk/clk-apple-nco.c | 8 +- drivers/clk/clk-axi-clkgen.c | 2 +- drivers/clk/clk-bd718x7.c | 2 +- drivers/clk/clk-bm1880.c | 3 +- drivers/clk/clk-cdce706.c | 2 +- drivers/clk/clk-cdce925.c | 2 +- drivers/clk/clk-cs2000-cp.c | 2 +- drivers/clk/clk-en7523.c | 14 ++- drivers/clk/clk-ep93xx.c | 2 +- drivers/clk/clk-fsl-sai.c | 2 +- drivers/clk/clk-gemini.c | 2 +- drivers/clk/clk-gpio.c | 4 +- drivers/clk/clk-hi655x.c | 2 +- drivers/clk/clk-hsdk-pll.c | 2 +- drivers/clk/clk-k230.c | 7 +- drivers/clk/clk-lan966x.c | 5 +- drivers/clk/clk-lmk04832.c | 15 ++- drivers/clk/clk-lochnagar.c | 2 +- drivers/clk/clk-loongson2.c | 5 +- drivers/clk/clk-max77686.c | 2 +- drivers/clk/clk-max9485.c | 2 +- drivers/clk/clk-npcm8xx.c | 7 +- drivers/clk/clk-palmas.c | 2 +- drivers/clk/clk-plldig.c | 2 +- drivers/clk/clk-pwm.c | 2 +- drivers/clk/clk-renesas-pcie.c | 4 +- drivers/clk/clk-rk808.c | 3 +- drivers/clk/clk-rp1.c | 3 +- drivers/clk/clk-rpmi.c | 9 +- drivers/clk/clk-s2mps11.c | 9 +- drivers/clk/clk-scmi.c | 12 +-- drivers/clk/clk-scpi.c | 7 +- drivers/clk/clk-si514.c | 2 +- drivers/clk/clk-si521xx.c | 2 +- drivers/clk/clk-si5341.c | 2 +- drivers/clk/clk-si5351.c | 12 +-- drivers/clk/clk-si544.c | 2 +- drivers/clk/clk-si570.c | 2 +- drivers/clk/clk-sp7021.c | 5 +- drivers/clk/clk-sparx5.c | 2 +- drivers/clk/clk-tps68470.c | 3 +- drivers/clk/clk-twl.c | 6 +- drivers/clk/clk-twl6040.c | 2 +- drivers/clk/clk-versaclock5.c | 2 +- drivers/clk/clk-versaclock7.c | 2 +- drivers/clk/clk-wm831x.c | 2 +- drivers/clk/davinci/da8xx-cfgchip.c | 11 +-- drivers/clk/eswin/clk-eic7700-hsp.c | 2 +- drivers/clk/eswin/clk.c | 7 +- drivers/clk/hisilicon/clk-hi3519.c | 2 +- drivers/clk/hisilicon/clk-hi3559a.c | 4 +- drivers/clk/hisilicon/clk-hi6220-stub.c | 2 +- drivers/clk/hisilicon/clk-hisi-phase.c | 2 +- drivers/clk/hisilicon/clk.c | 6 +- drivers/clk/hisilicon/crg-hi3516cv300.c | 2 +- drivers/clk/hisilicon/crg-hi3798cv200.c | 2 +- drivers/clk/hisilicon/reset.c | 2 +- drivers/clk/imx/clk-imx8-acm.c | 17 ++-- drivers/clk/imx/clk-imx8mn.c | 3 +- drivers/clk/imx/clk-imx8mp-audiomix.c | 5 +- drivers/clk/imx/clk-imx8mp.c | 2 +- drivers/clk/imx/clk-imx8mq.c | 2 +- drivers/clk/imx/clk-imx8qxp-lpcg.c | 8 +- drivers/clk/imx/clk-imx8ulp-sim-lpav.c | 5 +- drivers/clk/imx/clk-imx8ulp.c | 17 ++-- drivers/clk/imx/clk-imx93.c | 3 +- drivers/clk/imx/clk-imx95-blk-ctl.c | 6 +- drivers/clk/imx/clk-imxrt1050.c | 4 +- drivers/clk/keystone/sci-clk.c | 20 ++-- drivers/clk/keystone/syscon-clk.c | 5 +- drivers/clk/mediatek/clk-mt8173-mfgtop.c | 2 +- drivers/clk/mediatek/clk-mt8183.c | 2 +- drivers/clk/mediatek/clk-mt8186-topckgen.c | 2 +- drivers/clk/mediatek/clk-mt8188-topckgen.c | 2 +- drivers/clk/mediatek/clk-mt8192.c | 2 +- drivers/clk/mediatek/clk-mt8195-topckgen.c | 2 +- drivers/clk/mediatek/clk-mtk.c | 3 +- drivers/clk/mediatek/reset.c | 2 +- drivers/clk/meson/meson-aoclk.c | 2 +- drivers/clk/microchip/clk-mpfs-ccc.c | 4 +- drivers/clk/microchip/clk-mpfs.c | 2 +- drivers/clk/microchip/clk-pic32.c | 10 +- drivers/clk/microchip/clk-pic32mzda.c | 2 +- drivers/clk/mmp/clk-audio.c | 6 +- drivers/clk/mmp/clk-pxa1908-apbc.c | 2 +- drivers/clk/mmp/clk-pxa1908-apbcp.c | 2 +- drivers/clk/mmp/clk-pxa1908-apmu.c | 2 +- drivers/clk/mmp/clk-pxa1908-mpmu.c | 2 +- drivers/clk/mstar/clk-msc313-cpupll.c | 2 +- drivers/clk/mstar/clk-msc313-mpll.c | 6 +- drivers/clk/mvebu/ap-cpu-clk.c | 7 +- drivers/clk/mvebu/armada-37xx-periph.c | 8 +- drivers/clk/mvebu/armada-37xx-tbg.c | 4 +- drivers/clk/mvebu/armada-37xx-xtal.c | 2 +- drivers/clk/mvebu/cp110-system-controller.c | 5 +- drivers/clk/nuvoton/clk-ma35d1-divider.c | 4 +- drivers/clk/nuvoton/clk-ma35d1-pll.c | 2 +- drivers/clk/nuvoton/clk-ma35d1.c | 5 +- drivers/clk/qcom/a53-pll.c | 4 +- drivers/clk/qcom/apcs-msm8916.c | 2 +- drivers/clk/qcom/apcs-sdx55.c | 2 +- drivers/clk/qcom/apss-ipq6018.c | 5 +- drivers/clk/qcom/clk-cpu-8996.c | 2 +- drivers/clk/qcom/clk-ref.c | 9 +- drivers/clk/qcom/clk-rpm.c | 2 +- drivers/clk/qcom/clk-spmi-pmic-div.c | 2 +- drivers/clk/qcom/common.c | 10 +- drivers/clk/qcom/gdsc.c | 5 +- drivers/clk/qcom/hfpll.c | 2 +- drivers/clk/qcom/ipq-cmn-pll.c | 13 ++- drivers/clk/qcom/krait-cc.c | 8 +- drivers/clk/qcom/lpass-gfm-sm8250.c | 2 +- drivers/clk/ralink/clk-mt7621.c | 7 +- drivers/clk/ralink/clk-mtmips.c | 4 +- drivers/clk/renesas/clk-vbattb.c | 4 +- drivers/clk/renesas/r8a78000-cpg.c | 2 +- drivers/clk/renesas/r9a06g032-clocks.c | 7 +- drivers/clk/renesas/r9a09g077-cpg.c | 10 +- drivers/clk/renesas/rcar-usb2-clock-sel.c | 2 +- drivers/clk/renesas/renesas-cpg-mssr.c | 2 +- drivers/clk/renesas/rzg2l-cpg.c | 28 +++--- drivers/clk/renesas/rzv2h-cpg.c | 26 +++--- drivers/clk/rockchip/clk-rk3528.c | 4 +- drivers/clk/samsung/clk-acpm.c | 5 +- drivers/clk/samsung/clk-exynos-arm64.c | 5 +- drivers/clk/samsung/clk-exynos-audss.c | 5 +- drivers/clk/samsung/clk-exynos-clkout.c | 5 +- drivers/clk/samsung/clk-s5pv210-audss.c | 4 +- drivers/clk/sifive/sifive-prci.c | 2 +- drivers/clk/socfpga/clk-agilex.c | 6 +- drivers/clk/socfpga/clk-agilex5.c | 3 +- drivers/clk/socfpga/clk-s10.c | 3 +- drivers/clk/sophgo/clk-cv1800.c | 2 +- drivers/clk/sophgo/clk-sg2042-clkgen.c | 5 +- drivers/clk/sophgo/clk-sg2042-pll.c | 5 +- drivers/clk/sophgo/clk-sg2042-rpgate.c | 5 +- drivers/clk/sophgo/clk-sg2044-pll.c | 2 +- drivers/clk/sophgo/clk-sg2044.c | 2 +- drivers/clk/spacemit/ccu_common.c | 3 +- .../clk/starfive/clk-starfive-jh7100-audio.c | 2 +- drivers/clk/starfive/clk-starfive-jh7100.c | 2 +- .../clk/starfive/clk-starfive-jh7110-aon.c | 4 +- .../clk/starfive/clk-starfive-jh7110-isp.c | 6 +- .../clk/starfive/clk-starfive-jh7110-pll.c | 2 +- .../clk/starfive/clk-starfive-jh7110-stg.c | 3 +- .../clk/starfive/clk-starfive-jh7110-sys.c | 4 +- .../clk/starfive/clk-starfive-jh7110-vout.c | 6 +- drivers/clk/starfive/clk-starfive-jh71x0.c | 2 +- drivers/clk/stm32/clk-stm32-core.c | 2 +- drivers/clk/stm32/clk-stm32mp1.c | 17 ++-- drivers/clk/sunxi/clk-sun6i-apb0-gates.c | 7 +- drivers/clk/sunxi/clk-sun9i-mmc.c | 5 +- drivers/clk/tegra/clk-bpmp.c | 4 +- drivers/clk/tegra/clk-device.c | 2 +- drivers/clk/tegra/clk-dfll.c | 2 +- drivers/clk/tegra/clk-tegra124-dfll-fcpu.c | 2 +- drivers/clk/tenstorrent/atlantis-prcm.c | 3 +- drivers/clk/thead/clk-th1520-ap.c | 2 +- drivers/clk/ti/adpll.c | 18 ++-- drivers/clk/ti/clk-dra7-atl.c | 2 +- drivers/clk/ultrarisc/clk-ultrarisc.c | 10 +- drivers/clk/uniphier/clk-uniphier-core.c | 3 +- drivers/clk/uniphier/clk-uniphier-cpugear.c | 2 +- .../clk/uniphier/clk-uniphier-fixed-factor.c | 2 +- .../clk/uniphier/clk-uniphier-fixed-rate.c | 2 +- drivers/clk/uniphier/clk-uniphier-gate.c | 2 +- drivers/clk/uniphier/clk-uniphier-mux.c | 2 +- drivers/clk/ux500/clk-sysctrl.c | 2 +- drivers/clk/versatile/clk-vexpress-osc.c | 2 +- drivers/clk/visconti/clkc.c | 8 +- drivers/clk/visconti/reset.c | 2 +- drivers/clk/x86/clk-cgu-pll.c | 2 +- drivers/clk/x86/clk-cgu.c | 8 +- drivers/clk/x86/clk-lgm.c | 3 +- drivers/clk/x86/clk-lpss-atom.c | 2 +- drivers/clk/x86/clk-pmc-atom.c | 9 +- drivers/clk/xilinx/clk-xlnx-clock-wizard.c | 10 +- drivers/clk/xilinx/xlnx_vcu.c | 8 +- drivers/clk/zte/clk-regmap.c | 6 +- drivers/clk/zte/clk-zx.c | 4 +- drivers/clk/zte/pll-zx.c | 2 +- drivers/clocksource/arm_arch_timer_mmio.c | 6 +- drivers/clocksource/em_sti.c | 2 +- drivers/clocksource/ingenic-ost.c | 2 +- drivers/clocksource/timer-nxp-stm.c | 2 +- drivers/clocksource/timer-rzn1.c | 3 +- drivers/clocksource/timer-stm32-lp.c | 2 +- drivers/clocksource/timer-sun5i.c | 2 +- drivers/clocksource/timer-tegra186.c | 8 +- drivers/clocksource/timer-ti-dm.c | 6 +- drivers/counter/counter-sysfs.c | 24 ++--- drivers/cpufreq/airoha-cpufreq.c | 2 +- drivers/cpufreq/brcmstb-avs-cpufreq.c | 5 +- drivers/cpufreq/cpufreq-dt.c | 2 +- drivers/cpufreq/imx6q-cpufreq.c | 3 +- drivers/cpufreq/loongson3_cpufreq.c | 2 +- drivers/cpufreq/mediatek-cpufreq-hw.c | 7 +- drivers/cpufreq/mediatek-cpufreq.c | 2 +- drivers/cpufreq/qcom-cpufreq-hw.c | 2 +- drivers/cpufreq/qcom-cpufreq-nvmem.c | 3 +- drivers/cpufreq/tegra124-cpufreq.c | 2 +- drivers/cpufreq/tegra186-cpufreq.c | 8 +- drivers/cpufreq/tegra194-cpufreq.c | 14 ++- drivers/cpufreq/ti-cpufreq.c | 2 +- drivers/cpuidle/cpuidle-psci.c | 5 +- drivers/cpuidle/cpuidle-qcom-spm.c | 2 +- drivers/cpuidle/cpuidle-riscv-sbi.c | 4 +- .../crypto/allwinner/sun4i-ss/sun4i-ss-core.c | 2 +- .../crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 5 +- .../crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 5 +- drivers/crypto/amcc/crypto4xx_core.c | 6 +- drivers/crypto/amlogic/amlogic-gxl-core.c | 5 +- drivers/crypto/aspeed/aspeed-acry.c | 3 +- drivers/crypto/aspeed/aspeed-hace.c | 3 +- drivers/crypto/atmel-aes.c | 2 +- drivers/crypto/atmel-i2c.c | 2 +- drivers/crypto/atmel-sha.c | 2 +- drivers/crypto/atmel-tdes.c | 2 +- drivers/crypto/axis/artpec6_crypto.c | 3 +- drivers/crypto/bcm/cipher.c | 4 +- drivers/crypto/caam/caamalg_qi2.c | 2 +- drivers/crypto/caam/caamrng.c | 2 +- drivers/crypto/caam/ctrl.c | 2 +- drivers/crypto/caam/jr.c | 5 +- drivers/crypto/cavium/cpt/cptpf_main.c | 2 +- drivers/crypto/cavium/cpt/cptvf_main.c | 2 +- drivers/crypto/ccp/ccp-dev.c | 2 +- drivers/crypto/ccp/ccp-dmaengine.c | 5 +- drivers/crypto/ccp/dbc.c | 2 +- drivers/crypto/ccp/platform-access.c | 2 +- drivers/crypto/ccp/psp-dev.c | 2 +- drivers/crypto/ccp/sev-dev.c | 2 +- drivers/crypto/ccp/sfs.c | 2 +- drivers/crypto/ccp/sp-dev.c | 2 +- drivers/crypto/ccp/sp-pci.c | 2 +- drivers/crypto/ccp/sp-platform.c | 2 +- drivers/crypto/ccp/tee-dev.c | 2 +- drivers/crypto/ccree/cc_aead.c | 4 +- drivers/crypto/ccree/cc_cipher.c | 2 +- drivers/crypto/ccree/cc_debugfs.c | 4 +- drivers/crypto/ccree/cc_driver.c | 2 +- drivers/crypto/ccree/cc_fips.c | 2 +- drivers/crypto/ccree/cc_hash.c | 4 +- drivers/crypto/gemini/sl3516-ce-core.c | 2 +- drivers/crypto/hisilicon/hpre/hpre_main.c | 8 +- drivers/crypto/hisilicon/qm.c | 2 +- drivers/crypto/hisilicon/sec2/sec_main.c | 6 +- drivers/crypto/hisilicon/zip/zip_main.c | 8 +- drivers/crypto/img-hash.c | 2 +- .../crypto/inside-secure/eip93/eip93-main.c | 2 +- drivers/crypto/inside-secure/safexcel.c | 17 ++-- .../intel/keembay/keembay-ocs-aes-core.c | 2 +- .../crypto/intel/keembay/keembay-ocs-ecc.c | 2 +- .../intel/keembay/keembay-ocs-hcu-core.c | 2 +- drivers/crypto/intel/qat/qat_420xx/adf_drv.c | 4 +- drivers/crypto/intel/qat/qat_4xxx/adf_drv.c | 4 +- drivers/crypto/intel/qat/qat_6xxx/adf_drv.c | 4 +- drivers/crypto/marvell/cesa/cesa.c | 5 +- .../crypto/marvell/octeontx/otx_cptpf_main.c | 2 +- .../crypto/marvell/octeontx/otx_cptvf_main.c | 2 +- .../marvell/octeontx2/otx2_cptpf_main.c | 2 +- .../marvell/octeontx2/otx2_cptvf_main.c | 2 +- drivers/crypto/mxs-dcp.c | 2 +- drivers/crypto/omap-aes.c | 2 +- drivers/crypto/omap-des.c | 2 +- drivers/crypto/omap-sham.c | 2 +- drivers/crypto/qce/core.c | 2 +- drivers/crypto/rockchip/rk3288_crypto.c | 3 +- drivers/crypto/s5p-sss.c | 2 +- drivers/crypto/sa2ul.c | 2 +- drivers/crypto/sahara.c | 2 +- drivers/crypto/starfive/jh7110-cryp.c | 2 +- drivers/crypto/stm32/stm32-cryp.c | 2 +- drivers/crypto/stm32/stm32-hash.c | 2 +- drivers/crypto/talitos.c | 12 +-- drivers/crypto/tegra/tegra-se-main.c | 2 +- drivers/crypto/ti/dthev2-common.c | 2 +- drivers/crypto/xilinx/zynqmp-aes-gcm.c | 2 +- drivers/cxl/acpi.c | 5 +- drivers/cxl/core/edac.c | 13 +-- drivers/cxl/core/hdm.c | 2 +- drivers/cxl/mem.c | 3 +- drivers/cxl/pci.c | 2 +- drivers/cxl/pmem.c | 4 +- drivers/dax/device.c | 5 +- drivers/devfreq/devfreq.c | 14 ++- drivers/devfreq/event/exynos-nocp.c | 2 +- drivers/devfreq/event/exynos-ppmu.c | 4 +- drivers/devfreq/event/rockchip-dfi.c | 2 +- drivers/devfreq/exynos-bus.c | 8 +- drivers/devfreq/hisi_uncore_freq.c | 4 +- drivers/devfreq/imx-bus.c | 2 +- drivers/devfreq/imx8m-ddrc.c | 2 +- drivers/devfreq/mtk-cci-devfreq.c | 4 +- drivers/devfreq/rk3399_dmc.c | 2 +- drivers/devfreq/sun8i-a33-mbus.c | 2 +- drivers/devfreq/tegra30-devfreq.c | 2 +- drivers/dma/altera-msgdma.c | 2 +- drivers/dma/amba-pl08x.c | 8 +- drivers/dma/amd/ae4dma/ae4dma-pci.c | 4 +- drivers/dma/amd/ptdma/ptdma-dmaengine.c | 7 +- drivers/dma/amd/ptdma/ptdma-pci.c | 4 +- drivers/dma/amd/qdma/qdma.c | 10 +- drivers/dma/apple-admac.c | 2 +- drivers/dma/arm-dma350.c | 2 +- drivers/dma/at_hdmac.c | 5 +- drivers/dma/at_xdmac.c | 4 +- drivers/dma/bcm-sba-raid.c | 7 +- drivers/dma/bcm2835-dma.c | 4 +- drivers/dma/cv1800b-dmamux.c | 4 +- drivers/dma/dma-axi-dmac.c | 2 +- drivers/dma/dma-jz4780.c | 3 +- .../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 9 +- drivers/dma/dw-edma/dw-edma-core.c | 8 +- drivers/dma/dw-edma/dw-edma-pcie.c | 2 +- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 3 +- drivers/dma/dw-edma/dw-hdma-v0-debugfs.c | 3 +- drivers/dma/dw/acpi.c | 2 +- drivers/dma/dw/core.c | 5 +- drivers/dma/dw/dw.c | 2 +- drivers/dma/dw/idma32.c | 2 +- drivers/dma/dw/of.c | 2 +- drivers/dma/dw/pci.c | 2 +- drivers/dma/dw/platform.c | 2 +- drivers/dma/dw/rzn1-dmamux.c | 2 +- drivers/dma/ep93xx_dma.c | 3 +- drivers/dma/fsl-edma-main.c | 3 +- drivers/dma/fsl-qdma.c | 3 +- drivers/dma/fsl_raid.c | 4 +- drivers/dma/hisi_dma.c | 11 +-- drivers/dma/hsu/hsu.c | 5 +- drivers/dma/hsu/pci.c | 2 +- drivers/dma/idma64.c | 7 +- drivers/dma/img-mdc-dma.c | 2 +- drivers/dma/imx-dma.c | 2 +- drivers/dma/imx-sdma.c | 2 +- drivers/dma/k3dma.c | 9 +- drivers/dma/lgm/lgm-dma.c | 6 +- drivers/dma/loongson/loongson1-apb-dma.c | 2 +- drivers/dma/loongson/loongson2-apb-cmc-dma.c | 4 +- drivers/dma/loongson/loongson2-apb-dma.c | 2 +- drivers/dma/lpc18xx-dmamux.c | 7 +- drivers/dma/lpc32xx-dmamux.c | 2 +- drivers/dma/mcf-edma-main.c | 3 +- drivers/dma/mediatek/mtk-cqdma.c | 13 ++- drivers/dma/mediatek/mtk-hsdma.c | 10 +- drivers/dma/mediatek/mtk-uart-apdma.c | 4 +- drivers/dma/milbeaut-hdmac.c | 3 +- drivers/dma/milbeaut-xdmac.c | 3 +- drivers/dma/mmp_pdma.c | 7 +- drivers/dma/mmp_tdma.c | 4 +- drivers/dma/moxart-dma.c | 2 +- drivers/dma/mpc512x_dma.c | 2 +- drivers/dma/mv_xor.c | 4 +- drivers/dma/mv_xor_v2.c | 7 +- drivers/dma/mxs-dma.c | 2 +- drivers/dma/nbpfaxi.c | 3 +- drivers/dma/owl-dma.c | 10 +- drivers/dma/pl330.c | 2 +- drivers/dma/pxa_dma.c | 7 +- drivers/dma/qcom/bam_dma.c | 6 +- drivers/dma/qcom/gpi.c | 2 +- drivers/dma/qcom/hidma.c | 7 +- drivers/dma/qcom/hidma_ll.c | 2 +- drivers/dma/qcom/hidma_mgmt.c | 13 +-- drivers/dma/qcom/hidma_mgmt_sys.c | 5 +- drivers/dma/qcom/qcom_adm.c | 6 +- drivers/dma/sf-pdma/sf-pdma.c | 3 +- drivers/dma/sh/rcar-dmac.c | 6 +- drivers/dma/sh/rz-dmac.c | 6 +- drivers/dma/sh/shdmac.c | 6 +- drivers/dma/sh/usb-dmac.c | 6 +- drivers/dma/sprd-dma.c | 4 +- drivers/dma/st_fdma.c | 6 +- drivers/dma/ste_dma40.c | 28 +++--- drivers/dma/stm32/stm32-dma.c | 2 +- drivers/dma/stm32/stm32-dma3.c | 6 +- drivers/dma/stm32/stm32-mdma.c | 4 +- drivers/dma/sun4i-dma.c | 15 ++- drivers/dma/sun6i-dma.c | 10 +- drivers/dma/tegra186-gpc-dma.c | 5 +- drivers/dma/tegra210-adma.c | 5 +- drivers/dma/ti/cppi41.c | 4 +- drivers/dma/ti/dma-crossbar.c | 9 +- drivers/dma/ti/edma.c | 35 ++++--- drivers/dma/ti/k3-udma-glue.c | 16 ++-- drivers/dma/ti/k3-udma.c | 93 ++++++++----------- drivers/dma/ti/omap-dma.c | 6 +- drivers/dma/txx9dmac.c | 4 +- drivers/dma/uniphier-mdmac.c | 3 +- drivers/dma/uniphier-xdmac.c | 3 +- drivers/dma/xgene-dma.c | 2 +- drivers/dma/xilinx/xdma.c | 5 +- drivers/dma/xilinx/xilinx_dma.c | 4 +- drivers/dma/xilinx/xilinx_dpdma.c | 4 +- drivers/dma/xilinx/zynqmp_dma.c | 4 +- drivers/edac/altera_edac.c | 2 +- drivers/edac/ecs.c | 7 +- drivers/edac/mem_repair.c | 2 +- drivers/edac/octeon_edac-pc.c | 3 +- drivers/edac/scrub.c | 2 +- drivers/edac/sifive_edac.c | 2 +- drivers/edac/versalnet_edac.c | 2 +- drivers/edac/xgene_edac.c | 2 +- drivers/extcon/extcon-adc-jack.c | 2 +- drivers/extcon/extcon-axp288.c | 2 +- drivers/extcon/extcon-fsa9480.c | 2 +- drivers/extcon/extcon-gpio.c | 2 +- drivers/extcon/extcon-intel-cht-wc.c | 2 +- drivers/extcon/extcon-intel-int3496.c | 2 +- drivers/extcon/extcon-intel-mrfld.c | 2 +- drivers/extcon/extcon-lc824206xa.c | 2 +- drivers/extcon/extcon-max14526.c | 2 +- drivers/extcon/extcon-max14577.c | 2 +- drivers/extcon/extcon-max3355.c | 3 +- drivers/extcon/extcon-max77693.c | 3 +- drivers/extcon/extcon-max77843.c | 2 +- drivers/extcon/extcon-max8997.c | 3 +- drivers/extcon/extcon-palmas.c | 2 +- drivers/extcon/extcon-ptn5150.c | 2 +- drivers/extcon/extcon-qcom-spmi-misc.c | 2 +- drivers/extcon/extcon-rt8973a.c | 2 +- drivers/extcon/extcon-rtk-type-c.c | 5 +- drivers/extcon/extcon-sm5502.c | 2 +- drivers/extcon/extcon-usb-gpio.c | 2 +- drivers/extcon/extcon-usbc-cros-ec.c | 2 +- drivers/extcon/extcon-usbc-tusb320.c | 2 +- drivers/firewire/ohci.c | 6 +- drivers/firmware/arm_scmi/clock.c | 16 ++-- drivers/firmware/arm_scmi/driver.c | 12 +-- drivers/firmware/arm_scmi/notify.c | 12 +-- drivers/firmware/arm_scmi/perf.c | 8 +- drivers/firmware/arm_scmi/pinctrl.c | 13 ++- drivers/firmware/arm_scmi/power.c | 6 +- drivers/firmware/arm_scmi/powercap.c | 13 ++- drivers/firmware/arm_scmi/raw_mode.c | 8 +- drivers/firmware/arm_scmi/reset.c | 6 +- .../firmware/arm_scmi/scmi_power_control.c | 2 +- drivers/firmware/arm_scmi/sensors.c | 15 ++- drivers/firmware/arm_scmi/system.c | 2 +- .../firmware/arm_scmi/transports/mailbox.c | 2 +- drivers/firmware/arm_scmi/transports/optee.c | 4 +- drivers/firmware/arm_scmi/transports/pcc.c | 2 +- drivers/firmware/arm_scmi/transports/smc.c | 2 +- drivers/firmware/arm_scmi/transports/virtio.c | 4 +- .../arm_scmi/vendors/imx/imx-sm-bbm.c | 2 +- .../arm_scmi/vendors/imx/imx-sm-cpu.c | 2 +- .../arm_scmi/vendors/imx/imx-sm-lmm.c | 2 +- .../arm_scmi/vendors/imx/imx-sm-misc.c | 2 +- drivers/firmware/arm_scmi/voltage.c | 7 +- drivers/firmware/arm_scpi.c | 6 +- drivers/firmware/cirrus/cs_dsp.c | 4 +- drivers/firmware/coreboot/cbmem.c | 2 +- drivers/firmware/coreboot/coreboot-cfr.c | 2 +- drivers/firmware/imx/imx-dsp.c | 2 +- drivers/firmware/imx/imx-scu-irq.c | 2 +- drivers/firmware/imx/imx-scu-soc.c | 3 +- drivers/firmware/imx/imx-scu.c | 2 +- drivers/firmware/meson/meson_sm.c | 2 +- drivers/firmware/microchip/mpfs-auto-update.c | 2 +- drivers/firmware/mtk-adsp-ipc.c | 2 +- drivers/firmware/qcom/qcom_pas.c | 2 +- drivers/firmware/qcom/qcom_pas_tee.c | 2 +- .../firmware/qcom/qcom_qseecom_uefisecapp.c | 2 +- drivers/firmware/qcom/qcom_scm.c | 6 +- drivers/firmware/samsung/exynos-acpm.c | 5 +- drivers/firmware/stratix10-rsu.c | 2 +- drivers/firmware/stratix10-svc.c | 7 +- drivers/firmware/tegra/bpmp-tegra186.c | 5 +- drivers/firmware/tegra/bpmp-tegra210.c | 2 +- drivers/firmware/tegra/bpmp.c | 16 ++-- drivers/firmware/ti_sci.c | 13 +-- drivers/firmware/turris-mox-rwtm.c | 2 +- drivers/firmware/xilinx/zynqmp.c | 2 +- drivers/fpga/altera-cvp.c | 2 +- drivers/fpga/altera-fpga2sdram.c | 2 +- drivers/fpga/altera-freeze-bridge.c | 2 +- drivers/fpga/altera-pr-ip-core.c | 2 +- drivers/fpga/altera-ps-spi.c | 2 +- drivers/fpga/dfl-afu-main.c | 2 +- drivers/fpga/dfl-afu-region.c | 2 +- drivers/fpga/dfl-fme-br.c | 2 +- drivers/fpga/dfl-fme-main.c | 2 +- drivers/fpga/dfl-fme-mgr.c | 4 +- drivers/fpga/dfl-fme-perf.c | 2 +- drivers/fpga/dfl-fme-pr.c | 4 +- drivers/fpga/dfl-n3000-nios.c | 2 +- drivers/fpga/dfl-pci.c | 2 +- drivers/fpga/dfl.c | 22 ++--- drivers/fpga/efinix-spi.c | 2 +- drivers/fpga/fpga-mgr.c | 2 +- drivers/fpga/ice40-spi.c | 2 +- drivers/fpga/intel-m10-bmc-sec-update.c | 2 +- drivers/fpga/lattice-sysconfig-spi.c | 2 +- drivers/fpga/microchip-spi.c | 2 +- drivers/fpga/socfpga-a10.c | 2 +- drivers/fpga/socfpga.c | 2 +- drivers/fpga/stratix10-soc.c | 2 +- drivers/fpga/ts73xx-fpga.c | 2 +- drivers/fpga/xilinx-pr-decoupler.c | 2 +- drivers/fpga/xilinx-selectmap.c | 2 +- drivers/fpga/xilinx-spi.c | 2 +- drivers/fpga/zynq-fpga.c | 2 +- drivers/fpga/zynqmp-fpga.c | 2 +- drivers/fsi/fsi-occ.c | 2 +- drivers/fsi/i2cr-scom.c | 2 +- drivers/gnss/sirf.c | 2 +- drivers/gpio/gpio-104-dio-48e.c | 4 +- drivers/gpio/gpio-104-idi-48.c | 2 +- drivers/gpio/gpio-74x164.c | 2 +- drivers/gpio/gpio-74xx-mmio.c | 2 +- drivers/gpio/gpio-adnp.c | 2 +- drivers/gpio/gpio-adp5520.c | 2 +- drivers/gpio/gpio-adp5585.c | 2 +- drivers/gpio/gpio-aggregator.c | 11 +-- drivers/gpio/gpio-altera-a10sr.c | 2 +- drivers/gpio/gpio-altera.c | 5 +- drivers/gpio/gpio-amd-fch.c | 2 +- drivers/gpio/gpio-amdpt.c | 2 +- drivers/gpio/gpio-arizona.c | 3 +- drivers/gpio/gpio-aspeed-sgpio.c | 2 +- drivers/gpio/gpio-aspeed.c | 6 +- drivers/gpio/gpio-ath79.c | 9 +- drivers/gpio/gpio-axiado-sgpio.c | 8 +- drivers/gpio/gpio-bcm-kona.c | 2 +- drivers/gpio/gpio-bd71815.c | 2 +- drivers/gpio/gpio-bd71828.c | 2 +- drivers/gpio/gpio-bd72720.c | 2 +- drivers/gpio/gpio-bd73800.c | 2 +- drivers/gpio/gpio-bd9571mwv.c | 2 +- drivers/gpio/gpio-blzp1600.c | 4 +- drivers/gpio/gpio-brcmstb.c | 4 +- drivers/gpio/gpio-bt8xx.c | 2 +- drivers/gpio/gpio-by-pinctrl.c | 2 +- drivers/gpio/gpio-cadence.c | 6 +- drivers/gpio/gpio-cgbc.c | 2 +- drivers/gpio/gpio-clps711x.c | 2 +- drivers/gpio/gpio-creg-snps.c | 2 +- drivers/gpio/gpio-cros-ec.c | 4 +- drivers/gpio/gpio-crystalcove.c | 2 +- drivers/gpio/gpio-cs5535.c | 2 +- drivers/gpio/gpio-da9052.c | 2 +- drivers/gpio/gpio-da9055.c | 2 +- drivers/gpio/gpio-davinci.c | 8 +- drivers/gpio/gpio-dln2.c | 2 +- drivers/gpio/gpio-dwapb.c | 8 +- drivers/gpio/gpio-eic-sprd.c | 2 +- drivers/gpio/gpio-elkhartlake.c | 2 +- drivers/gpio/gpio-em.c | 2 +- drivers/gpio/gpio-en7523.c | 2 +- drivers/gpio/gpio-ep93xx.c | 8 +- drivers/gpio/gpio-exar.c | 2 +- drivers/gpio/gpio-f7188x.c | 2 +- drivers/gpio/gpio-ftgpio010.c | 5 +- drivers/gpio/gpio-ge.c | 2 +- drivers/gpio/gpio-graniterapids.c | 2 +- drivers/gpio/gpio-grgpio.c | 2 +- drivers/gpio/gpio-gw-pld.c | 2 +- drivers/gpio/gpio-hisi.c | 2 +- drivers/gpio/gpio-hlwd.c | 6 +- drivers/gpio/gpio-htc-egpio.c | 2 +- drivers/gpio/gpio-idio-16.c | 4 +- drivers/gpio/gpio-idt3243x.c | 7 +- drivers/gpio/gpio-imx-scu.c | 2 +- drivers/gpio/gpio-ixp4xx.c | 2 +- drivers/gpio/gpio-janz-ttl.c | 2 +- drivers/gpio/gpio-kempld.c | 2 +- drivers/gpio/gpio-latch.c | 2 +- drivers/gpio/gpio-ljca.c | 2 +- drivers/gpio/gpio-logicvc.c | 2 +- drivers/gpio/gpio-loongson-64bit.c | 6 +- drivers/gpio/gpio-loongson.c | 2 +- drivers/gpio/gpio-loongson1.c | 2 +- drivers/gpio/gpio-lp3943.c | 3 +- drivers/gpio/gpio-lp873x.c | 2 +- drivers/gpio/gpio-lp87565.c | 2 +- drivers/gpio/gpio-lpc18xx.c | 4 +- drivers/gpio/gpio-ltc4283.c | 2 +- drivers/gpio/gpio-macsmc.c | 2 +- drivers/gpio/gpio-madera.c | 3 +- drivers/gpio/gpio-max3191x.c | 2 +- drivers/gpio/gpio-max7300.c | 2 +- drivers/gpio/gpio-max7301.c | 2 +- drivers/gpio/gpio-max732x.c | 4 +- drivers/gpio/gpio-max7360.c | 2 +- drivers/gpio/gpio-max77620.c | 2 +- drivers/gpio/gpio-max77650.c | 2 +- drivers/gpio/gpio-max77759.c | 2 +- drivers/gpio/gpio-mb86s7x.c | 2 +- drivers/gpio/gpio-mc33880.c | 2 +- drivers/gpio/gpio-menz127.c | 3 +- drivers/gpio/gpio-merrifield.c | 2 +- drivers/gpio/gpio-ml-ioh.c | 2 +- drivers/gpio/gpio-mlxbf.c | 2 +- drivers/gpio/gpio-mlxbf2.c | 2 +- drivers/gpio/gpio-mlxbf3.c | 2 +- drivers/gpio/gpio-mm-lantiq.c | 2 +- drivers/gpio/gpio-mmio.c | 2 +- drivers/gpio/gpio-mockup.c | 7 +- drivers/gpio/gpio-moxtet.c | 2 +- drivers/gpio/gpio-mpc5200.c | 4 +- drivers/gpio/gpio-mpc8xxx.c | 2 +- drivers/gpio/gpio-mpfs.c | 6 +- drivers/gpio/gpio-mpsse.c | 2 +- drivers/gpio/gpio-msc313.c | 4 +- drivers/gpio/gpio-mt7621.c | 2 +- drivers/gpio/gpio-mvebu.c | 3 +- drivers/gpio/gpio-mxc.c | 2 +- drivers/gpio/gpio-mxs.c | 2 +- drivers/gpio/gpio-nct6694.c | 2 +- drivers/gpio/gpio-nomadik.c | 2 +- drivers/gpio/gpio-novalake-events.c | 2 +- drivers/gpio/gpio-npcm-sgpio.c | 2 +- drivers/gpio/gpio-octeon.c | 2 +- drivers/gpio/gpio-omap.c | 2 +- drivers/gpio/gpio-palmas.c | 3 +- drivers/gpio/gpio-pca953x.c | 2 +- drivers/gpio/gpio-pca9570.c | 2 +- drivers/gpio/gpio-pcf857x.c | 2 +- drivers/gpio/gpio-pch.c | 2 +- drivers/gpio/gpio-pcie-idio-24.c | 4 +- drivers/gpio/gpio-pisosr.c | 2 +- drivers/gpio/gpio-pl061.c | 5 +- drivers/gpio/gpio-pmic-eic-sprd.c | 2 +- drivers/gpio/gpio-ppc44x.c | 2 +- drivers/gpio/gpio-pxa.c | 5 +- drivers/gpio/gpio-raspberrypi-exp.c | 2 +- drivers/gpio/gpio-rc5t583.c | 3 +- drivers/gpio/gpio-rcar.c | 2 +- drivers/gpio/gpio-rda.c | 6 +- drivers/gpio/gpio-rdc321x.c | 3 +- drivers/gpio/gpio-realtek-otto.c | 6 +- drivers/gpio/gpio-reg.c | 2 +- drivers/gpio/gpio-rtd.c | 2 +- drivers/gpio/gpio-rtd1625.c | 6 +- drivers/gpio/gpio-sama5d2-piobu.c | 2 +- drivers/gpio/gpio-sch.c | 2 +- drivers/gpio/gpio-sch311x.c | 2 +- drivers/gpio/gpio-shared-proxy.c | 2 +- drivers/gpio/gpio-sifive.c | 2 +- drivers/gpio/gpio-sim.c | 15 ++- drivers/gpio/gpio-siox.c | 2 +- drivers/gpio/gpio-sl28cpld.c | 2 +- drivers/gpio/gpio-sloppy-logic-analyzer.c | 2 +- drivers/gpio/gpio-sodaville.c | 2 +- drivers/gpio/gpio-spacemit-k1.c | 2 +- drivers/gpio/gpio-spear-spics.c | 2 +- drivers/gpio/gpio-sprd.c | 2 +- drivers/gpio/gpio-stmpe.c | 2 +- drivers/gpio/gpio-stp-xway.c | 2 +- drivers/gpio/gpio-syscon.c | 2 +- drivers/gpio/gpio-tangier.c | 6 +- drivers/gpio/gpio-tb10x.c | 2 +- drivers/gpio/gpio-tc3589x.c | 3 +- drivers/gpio/gpio-tegra.c | 9 +- drivers/gpio/gpio-tegra186.c | 12 +-- drivers/gpio/gpio-thunderx.c | 12 +-- drivers/gpio/gpio-timberdale.c | 2 +- drivers/gpio/gpio-tpic2810.c | 2 +- drivers/gpio/gpio-tps65086.c | 2 +- drivers/gpio/gpio-tps65218.c | 3 +- drivers/gpio/gpio-tps65219.c | 2 +- drivers/gpio/gpio-tps6586x.c | 3 +- drivers/gpio/gpio-tps65910.c | 3 +- drivers/gpio/gpio-tps65912.c | 2 +- drivers/gpio/gpio-tps68470.c | 3 +- drivers/gpio/gpio-tqmx86.c | 6 +- drivers/gpio/gpio-ts4800.c | 2 +- drivers/gpio/gpio-ts4900.c | 2 +- drivers/gpio/gpio-twl4030.c | 5 +- drivers/gpio/gpio-uniphier.c | 3 +- drivers/gpio/gpio-usbio.c | 2 +- drivers/gpio/gpio-vf610.c | 6 +- drivers/gpio/gpio-viperboard.c | 2 +- drivers/gpio/gpio-virtio.c | 11 ++- drivers/gpio/gpio-virtuser.c | 6 +- drivers/gpio/gpio-visconti.c | 2 +- drivers/gpio/gpio-vx855.c | 2 +- drivers/gpio/gpio-waveshare-dsi.c | 2 +- drivers/gpio/gpio-wcd934x.c | 2 +- drivers/gpio/gpio-wcove.c | 2 +- drivers/gpio/gpio-wm831x.c | 3 +- drivers/gpio/gpio-wm8350.c | 3 +- drivers/gpio/gpio-wm8994.c | 3 +- drivers/gpio/gpio-ws16c48.c | 4 +- drivers/gpio/gpio-xgene-sb.c | 2 +- drivers/gpio/gpio-xgene.c | 2 +- drivers/gpio/gpio-xgs-iproc.c | 2 +- drivers/gpio/gpio-xilinx.c | 5 +- drivers/gpio/gpio-xlp.c | 6 +- drivers/gpio/gpio-xra1403.c | 2 +- drivers/gpio/gpio-zevio.c | 2 +- drivers/gpio/gpio-zynq.c | 6 +- drivers/gpio/gpio-zynqmp-modepin.c | 2 +- drivers/gpio/gpiolib-kunit.c | 6 +- .../gpu/drm/arm/display/komeda/d71/d71_dev.c | 2 +- .../gpu/drm/arm/display/komeda/komeda_dev.c | 2 +- .../gpu/drm/arm/display/komeda/komeda_drv.c | 2 +- drivers/gpu/drm/armada/armada_510.c | 2 +- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 +- drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c | 2 +- drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c | 2 +- drivers/gpu/drm/bridge/imx/imx8qm-ldb.c | 2 +- drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c | 2 +- .../drm/bridge/imx/imx8qxp-pixel-combiner.c | 2 +- drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c | 2 +- drivers/gpu/drm/bridge/inno-hdmi.c | 2 +- drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 2 +- .../drm/bridge/synopsys/dw-hdmi-gp-audio.c | 2 +- drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 4 +- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +- drivers/gpu/drm/bridge/th1520-dw-hdmi.c | 2 +- drivers/gpu/drm/display/drm_dp_helper.c | 2 +- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 +- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 2 +- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 2 +- drivers/gpu/drm/exynos/exynos_dp.c | 3 +- drivers/gpu/drm/exynos/exynos_drm_dpi.c | 4 +- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 5 +- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_gsc.c | 4 +- drivers/gpu/drm/exynos/exynos_drm_rotator.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_scaler.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 4 +- drivers/gpu/drm/exynos/exynos_mixer.c | 2 +- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 2 +- drivers/gpu/drm/fsl-dcu/fsl_tcon.c | 2 +- drivers/gpu/drm/gud/gud_drv.c | 2 +- drivers/gpu/drm/hisilicon/hibmc/dp/dp_hw.c | 2 +- drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 2 +- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 2 +- .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 2 +- drivers/gpu/drm/imx/dc/dc-cf.c | 2 +- drivers/gpu/drm/imx/dc/dc-de.c | 2 +- drivers/gpu/drm/imx/dc/dc-drv.c | 2 +- drivers/gpu/drm/imx/dc/dc-ed.c | 2 +- drivers/gpu/drm/imx/dc/dc-fg.c | 2 +- drivers/gpu/drm/imx/dc/dc-fl.c | 2 +- drivers/gpu/drm/imx/dc/dc-fw.c | 2 +- drivers/gpu/drm/imx/dc/dc-ic.c | 4 +- drivers/gpu/drm/imx/dc/dc-lb.c | 2 +- drivers/gpu/drm/imx/dc/dc-pe.c | 2 +- drivers/gpu/drm/imx/dc/dc-tc.c | 2 +- drivers/gpu/drm/imx/dcss/dcss-blkctl.c | 2 +- drivers/gpu/drm/imx/dcss/dcss-ctxld.c | 2 +- drivers/gpu/drm/imx/dcss/dcss-dev.c | 2 +- drivers/gpu/drm/imx/dcss/dcss-dpr.c | 2 +- drivers/gpu/drm/imx/dcss/dcss-drv.c | 2 +- drivers/gpu/drm/imx/dcss/dcss-dtg.c | 2 +- drivers/gpu/drm/imx/dcss/dcss-scaler.c | 2 +- drivers/gpu/drm/imx/dcss/dcss-ss.c | 2 +- drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c | 2 +- drivers/gpu/drm/imx/ipuv3/imx-ldb.c | 2 +- drivers/gpu/drm/imx/ipuv3/imx-tve.c | 2 +- drivers/gpu/drm/ingenic/ingenic-ipu.c | 2 +- drivers/gpu/drm/kmb/kmb_dsi.c | 2 +- drivers/gpu/drm/lima/lima_drv.c | 2 +- drivers/gpu/drm/logicvc/logicvc_crtc.c | 2 +- drivers/gpu/drm/logicvc/logicvc_interface.c | 2 +- drivers/gpu/drm/logicvc/logicvc_layer.c | 2 +- drivers/gpu/drm/mcde/mcde_clk_div.c | 4 +- drivers/gpu/drm/mediatek/mtk_cec.c | 2 +- drivers/gpu/drm/mediatek/mtk_crtc.c | 9 +- drivers/gpu/drm/mediatek/mtk_ddp_comp.c | 2 +- drivers/gpu/drm/mediatek/mtk_disp_aal.c | 2 +- drivers/gpu/drm/mediatek/mtk_disp_ccorr.c | 2 +- drivers/gpu/drm/mediatek/mtk_disp_color.c | 2 +- drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 2 +- drivers/gpu/drm/mediatek/mtk_disp_merge.c | 2 +- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 2 +- .../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 2 +- drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 2 +- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 8 +- drivers/gpu/drm/mediatek/mtk_ethdr.c | 2 +- drivers/gpu/drm/mediatek/mtk_hdmi_common.c | 2 +- drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c | 2 +- drivers/gpu/drm/mediatek/mtk_hdmi_ddc_v2.c | 2 +- drivers/gpu/drm/mediatek/mtk_mdp_rdma.c | 2 +- drivers/gpu/drm/mediatek/mtk_padding.c | 2 +- drivers/gpu/drm/meson/meson_crtc.c | 3 +- drivers/gpu/drm/meson/meson_drv.c | 2 +- drivers/gpu/drm/meson/meson_dw_hdmi.c | 3 +- drivers/gpu/drm/meson/meson_dw_mipi_dsi.c | 2 +- drivers/gpu/drm/meson/meson_overlay.c | 3 +- drivers/gpu/drm/meson/meson_plane.c | 3 +- drivers/gpu/drm/msm/adreno/a6xx_hfi.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 2 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_pll.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 4 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_mixer.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c | 2 +- drivers/gpu/drm/msm/dp/dp_audio.c | 2 +- drivers/gpu/drm/msm/dp/dp_aux.c | 2 +- drivers/gpu/drm/msm/dp/dp_ctrl.c | 8 +- drivers/gpu/drm/msm/dp/dp_debug.c | 2 +- drivers/gpu/drm/msm/dp/dp_display.c | 2 +- drivers/gpu/drm/msm/dp/dp_link.c | 2 +- drivers/gpu/drm/msm/dp/dp_panel.c | 2 +- drivers/gpu/drm/msm/dsi/dsi.c | 2 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 7 +- drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c | 4 +- drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c | 4 +- drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c | 2 +- .../gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c | 4 +- drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 2 +- drivers/gpu/drm/msm/hdmi/hdmi.c | 12 +-- drivers/gpu/drm/msm/hdmi/hdmi_phy.c | 8 +- drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c | 2 +- drivers/gpu/drm/msm/hdmi/hdmi_phy_8998.c | 2 +- drivers/gpu/drm/msm/hdmi/hdmi_pll_8960.c | 2 +- drivers/gpu/drm/msm/msm_drv.c | 4 +- drivers/gpu/drm/msm/msm_mdss.c | 5 +- drivers/gpu/drm/mxsfb/lcdif_drv.c | 4 +- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 2 +- drivers/gpu/drm/omapdrm/dss/base.c | 2 +- drivers/gpu/drm/omapdrm/dss/dispc.c | 3 +- drivers/gpu/drm/omapdrm/dss/video-pll.c | 2 +- drivers/gpu/drm/panel/panel-edp.c | 2 +- drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 3 +- .../gpu/drm/panel/panel-ilitek-ili9806e-dsi.c | 2 +- .../gpu/drm/panel/panel-ilitek-ili9806e-spi.c | 2 +- drivers/gpu/drm/panel/panel-innolux-p079zca.c | 5 +- drivers/gpu/drm/panel/panel-raydium-rm67191.c | 4 +- .../gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 2 +- drivers/gpu/drm/panel/panel-simple.c | 4 +- drivers/gpu/drm/panel/panel-visionox-r66451.c | 2 +- drivers/gpu/drm/panfrost/panfrost_device.c | 6 +- drivers/gpu/drm/panfrost/panfrost_job.c | 2 +- drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 2 +- drivers/gpu/drm/pl111/pl111_drv.c | 2 +- drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c | 2 +- .../gpu/drm/rockchip/analogix_dp-rockchip.c | 2 +- drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 +- .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 2 +- .../gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c | 2 +- drivers/gpu/drm/rockchip/rk3066_hdmi.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 3 +- drivers/gpu/drm/rockchip/rockchip_lvds.c | 5 +- drivers/gpu/drm/rockchip/rockchip_rgb.c | 2 +- drivers/gpu/drm/sitronix/st7571-i2c.c | 2 +- drivers/gpu/drm/solomon/ssd130x-spi.c | 2 +- drivers/gpu/drm/sprd/sprd_dsi.c | 2 +- drivers/gpu/drm/sti/sti_compositor.c | 2 +- drivers/gpu/drm/sti/sti_cursor.c | 2 +- drivers/gpu/drm/sti/sti_dvo.c | 2 +- drivers/gpu/drm/sti/sti_gdp.c | 2 +- drivers/gpu/drm/sti/sti_hda.c | 2 +- drivers/gpu/drm/sti/sti_hdmi.c | 2 +- drivers/gpu/drm/sti/sti_hqvdp.c | 2 +- drivers/gpu/drm/sti/sti_mixer.c | 2 +- drivers/gpu/drm/sti/sti_tvout.c | 8 +- drivers/gpu/drm/sti/sti_vid.c | 2 +- drivers/gpu/drm/sti/sti_vtg.c | 2 +- drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 2 +- drivers/gpu/drm/sun4i/sun4i_backend.c | 2 +- drivers/gpu/drm/sun4i/sun4i_crtc.c | 2 +- drivers/gpu/drm/sun4i/sun4i_drv.c | 2 +- drivers/gpu/drm/sun4i/sun4i_frontend.c | 2 +- drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c | 2 +- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 2 +- drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c | 2 +- drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 2 +- drivers/gpu/drm/sun4i/sun4i_layer.c | 6 +- drivers/gpu/drm/sun4i/sun4i_lvds.c | 2 +- drivers/gpu/drm/sun4i/sun4i_rgb.c | 2 +- drivers/gpu/drm/sun4i/sun4i_tcon.c | 2 +- drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c | 2 +- drivers/gpu/drm/sun4i/sun4i_tv.c | 2 +- drivers/gpu/drm/sun4i/sun6i_drc.c | 2 +- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 2 +- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 2 +- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 2 +- drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c | 2 +- drivers/gpu/drm/sun4i/sun8i_mixer.c | 4 +- drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 5 +- drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 2 +- drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 2 +- drivers/gpu/drm/sysfb/simpledrm.c | 10 +- drivers/gpu/drm/tegra/dc.c | 2 +- drivers/gpu/drm/tegra/dpaux.c | 2 +- drivers/gpu/drm/tegra/dsi.c | 2 +- drivers/gpu/drm/tegra/gr2d.c | 4 +- drivers/gpu/drm/tegra/gr3d.c | 4 +- drivers/gpu/drm/tegra/hdmi.c | 2 +- drivers/gpu/drm/tegra/hub.c | 9 +- drivers/gpu/drm/tegra/nvdec.c | 4 +- drivers/gpu/drm/tegra/nvjpg.c | 2 +- drivers/gpu/drm/tegra/rgb.c | 2 +- drivers/gpu/drm/tegra/sor.c | 4 +- drivers/gpu/drm/tegra/vic.c | 4 +- drivers/gpu/drm/tidss/tidss_dispc.c | 10 +- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 2 +- drivers/gpu/drm/tve200/tve200_drv.c | 2 +- drivers/gpu/drm/vboxvideo/vbox_main.c | 10 +- drivers/gpu/drm/vc4/vc4_v3d.c | 2 +- drivers/gpu/drm/verisilicon/vs_dc.c | 2 +- drivers/gpu/drm/xe/xe_hwmon.c | 2 +- drivers/gpu/drm/xe/xe_i2c.c | 2 +- drivers/gpu/drm/xe/xe_sysctrl.c | 2 +- drivers/gpu/drm/xen/xen_drm_front.c | 3 +- drivers/gpu/drm/xlnx/zynqmp_dp_audio.c | 2 +- drivers/gpu/host1x/dev.c | 2 +- drivers/gpu/host1x/intr.c | 3 +- drivers/gpu/host1x/syncpt.c | 6 +- drivers/gpu/host1x/tegra114-mipi.c | 2 +- drivers/gpu/ipu-v3/ipu-common.c | 2 +- drivers/gpu/ipu-v3/ipu-cpmem.c | 2 +- drivers/gpu/ipu-v3/ipu-csi.c | 2 +- drivers/gpu/ipu-v3/ipu-dc.c | 2 +- drivers/gpu/ipu-v3/ipu-di.c | 2 +- drivers/gpu/ipu-v3/ipu-dmfc.c | 2 +- drivers/gpu/ipu-v3/ipu-dp.c | 2 +- drivers/gpu/ipu-v3/ipu-ic.c | 2 +- drivers/gpu/ipu-v3/ipu-image-convert.c | 2 +- drivers/gpu/ipu-v3/ipu-pre.c | 2 +- drivers/gpu/ipu-v3/ipu-prg.c | 2 +- drivers/gpu/ipu-v3/ipu-smfc.c | 2 +- drivers/gpu/ipu-v3/ipu-vdi.c | 2 +- drivers/greybus/gb-beagleplay.c | 2 +- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 4 +- drivers/hid/hid-a4tech.c | 2 +- drivers/hid/hid-alps.c | 2 +- drivers/hid/hid-apple.c | 6 +- drivers/hid/hid-appleir.c | 2 +- drivers/hid/hid-appletb-bl.c | 2 +- drivers/hid/hid-appletb-kbd.c | 2 +- drivers/hid/hid-asus.c | 6 +- drivers/hid/hid-bigbenff.c | 2 +- drivers/hid/hid-corsair-void.c | 3 +- drivers/hid/hid-corsair.c | 3 +- drivers/hid/hid-cougar.c | 2 +- drivers/hid/hid-cp2112.c | 2 +- drivers/hid/hid-creative-sb0540.c | 3 +- drivers/hid/hid-cypress.c | 2 +- drivers/hid/hid-elan.c | 2 +- drivers/hid/hid-ft260.c | 2 +- drivers/hid/hid-goodix-spi.c | 2 +- drivers/hid/hid-google-hammer.c | 5 +- drivers/hid/hid-google-stadiaff.c | 3 +- drivers/hid/hid-gt683r.c | 2 +- drivers/hid/hid-hyperx.c | 2 +- drivers/hid/hid-input.c | 4 +- drivers/hid/hid-led.c | 6 +- drivers/hid/hid-lenovo-go-s.c | 2 +- drivers/hid/hid-lenovo.c | 10 +- drivers/hid/hid-letsketch.c | 2 +- drivers/hid/hid-lg-g15.c | 4 +- drivers/hid/hid-logitech-hidpp.c | 8 +- drivers/hid/hid-magicmouse.c | 2 +- drivers/hid/hid-mcp2200.c | 2 +- drivers/hid/hid-mcp2221.c | 4 +- drivers/hid/hid-microsoft.c | 7 +- drivers/hid/hid-msi.c | 2 +- drivers/hid/hid-multitouch.c | 11 +-- drivers/hid/hid-nintendo-switch2-usb.c | 2 +- drivers/hid/hid-nintendo.c | 4 +- drivers/hid/hid-nvidia-shield.c | 2 +- drivers/hid/hid-oxp.c | 4 +- drivers/hid/hid-plantronics.c | 2 +- drivers/hid/hid-playstation.c | 8 +- drivers/hid/hid-pulsar.c | 2 +- drivers/hid/hid-pxrc.c | 2 +- drivers/hid/hid-rmi.c | 2 +- drivers/hid/hid-saitek.c | 2 +- drivers/hid/hid-sensor-custom.c | 3 +- drivers/hid/hid-sensor-hub.c | 17 ++-- drivers/hid/hid-sony.c | 4 +- drivers/hid/hid-steam.c | 2 +- drivers/hid/hid-steelseries.c | 4 +- drivers/hid/hid-u2fzero.c | 2 +- drivers/hid/hid-uclogic-core.c | 2 +- drivers/hid/hid-udraw-ps3.c | 2 +- drivers/hid/hid-vivaldi.c | 2 +- drivers/hid/hid-zydacron.c | 2 +- drivers/hid/i2c-hid/i2c-hid-acpi.c | 2 +- drivers/hid/i2c-hid/i2c-hid-core.c | 2 +- drivers/hid/i2c-hid/i2c-hid-of-elan.c | 2 +- drivers/hid/i2c-hid/i2c-hid-of-goodix.c | 3 +- drivers/hid/i2c-hid/i2c-hid-of.c | 2 +- drivers/hid/intel-ish-hid/ipc/ipc.c | 4 +- drivers/hid/intel-ish-hid/ishtp-fw-loader.c | 4 +- drivers/hid/intel-ish-hid/ishtp-hid-client.c | 12 +-- .../intel-quicki2c/pci-quicki2c.c | 2 +- .../intel-quickspi/pci-quickspi.c | 2 +- .../intel-thc-hid/intel-thc/intel-thc-dev.c | 2 +- .../intel-thc-hid/intel-thc/intel-thc-dma.c | 2 +- drivers/hid/surface-hid/surface_hid.c | 2 +- drivers/hid/surface-hid/surface_kbd.c | 2 +- drivers/hid/wacom_sys.c | 10 +- drivers/hsi/clients/nokia-modem.c | 5 +- drivers/hsi/controllers/omap_ssi_core.c | 6 +- drivers/hsi/controllers/omap_ssi_port.c | 2 +- drivers/hte/hte-tegra194.c | 12 +-- drivers/hwmon/abituguru.c | 3 +- drivers/hwmon/abituguru3.c | 3 +- drivers/hwmon/ad7314.c | 2 +- drivers/hwmon/ad7414.c | 2 +- drivers/hwmon/ad7418.c | 2 +- drivers/hwmon/adc128d818.c | 2 +- drivers/hwmon/adcxx.c | 2 +- drivers/hwmon/adm1025.c | 2 +- drivers/hwmon/adm1026.c | 2 +- drivers/hwmon/adm1029.c | 2 +- drivers/hwmon/adm1031.c | 2 +- drivers/hwmon/adm1177.c | 2 +- drivers/hwmon/adm9240.c | 2 +- drivers/hwmon/ads7828.c | 2 +- drivers/hwmon/ads7871.c | 2 +- drivers/hwmon/adt7411.c | 2 +- drivers/hwmon/adt7462.c | 2 +- drivers/hwmon/adt7470.c | 2 +- drivers/hwmon/adt7475.c | 2 +- drivers/hwmon/adt7x10.c | 2 +- drivers/hwmon/aht10.c | 2 +- drivers/hwmon/amc6821.c | 2 +- drivers/hwmon/aquacomputer_d5next.c | 2 +- drivers/hwmon/arctic_fan_controller.c | 2 +- drivers/hwmon/as370-hwmon.c | 2 +- drivers/hwmon/asb100.c | 3 +- drivers/hwmon/asc7621.c | 3 +- drivers/hwmon/aspeed-g6-pwm-tach.c | 2 +- drivers/hwmon/aspeed-pwm-tacho.c | 4 +- drivers/hwmon/asus-ec-sensors.c | 17 ++-- drivers/hwmon/asus_atk0110.c | 6 +- drivers/hwmon/asus_rog_ryujin.c | 2 +- drivers/hwmon/asus_wmi_sensors.c | 27 +++--- drivers/hwmon/atxp1.c | 2 +- drivers/hwmon/axi-fan-control.c | 2 +- drivers/hwmon/axiado-pwm-fan.c | 2 +- drivers/hwmon/axiado-tsadc.c | 2 +- drivers/hwmon/cgbc-hwmon.c | 2 +- drivers/hwmon/chipcap2.c | 2 +- drivers/hwmon/corsair-cpro.c | 2 +- drivers/hwmon/corsair-psu.c | 2 +- drivers/hwmon/cros_ec_hwmon.c | 4 +- drivers/hwmon/da9052-hwmon.c | 2 +- drivers/hwmon/da9055-hwmon.c | 2 +- drivers/hwmon/dell-smm-hwmon.c | 12 +-- drivers/hwmon/dme1737.c | 4 +- drivers/hwmon/ds1621.c | 3 +- drivers/hwmon/ds620.c | 2 +- drivers/hwmon/eic7700-pvt.c | 2 +- drivers/hwmon/emc1403.c | 3 +- drivers/hwmon/emc1812.c | 2 +- drivers/hwmon/emc2103.c | 3 +- drivers/hwmon/emc2305.c | 2 +- drivers/hwmon/emc6w201.c | 2 +- drivers/hwmon/f71805f.c | 3 +- drivers/hwmon/f71882fg.c | 3 +- drivers/hwmon/f75375s.c | 3 +- drivers/hwmon/fam15h_power.c | 7 +- drivers/hwmon/ftsteutates.c | 3 +- drivers/hwmon/g760a.c | 2 +- drivers/hwmon/g762.c | 2 +- drivers/hwmon/gigabyte_waterforce.c | 2 +- drivers/hwmon/gl518sm.c | 2 +- drivers/hwmon/gl520sm.c | 2 +- drivers/hwmon/gpd-fan.c | 2 +- drivers/hwmon/gpio-fan.c | 12 +-- drivers/hwmon/gsc-hwmon.c | 5 +- drivers/hwmon/gxp-fan-ctrl.c | 3 +- drivers/hwmon/hih6130.c | 2 +- drivers/hwmon/honor-fmi.c | 2 +- drivers/hwmon/hp-wmi-sensors.c | 24 ++--- drivers/hwmon/hs3001.c | 2 +- drivers/hwmon/htu31.c | 2 +- drivers/hwmon/hwmon.c | 2 +- drivers/hwmon/ibmpowernv.c | 17 ++-- drivers/hwmon/iio_hwmon.c | 10 +- drivers/hwmon/ina209.c | 2 +- drivers/hwmon/ina238.c | 2 +- drivers/hwmon/ina2xx.c | 2 +- drivers/hwmon/ina3221.c | 2 +- drivers/hwmon/intel-m10-bmc-hwmon.c | 2 +- drivers/hwmon/isl28022.c | 2 +- drivers/hwmon/it87.c | 2 +- drivers/hwmon/jc42.c | 2 +- drivers/hwmon/k10temp.c | 2 +- drivers/hwmon/k8temp.c | 2 +- drivers/hwmon/kb9002.c | 2 +- drivers/hwmon/kbatt.c | 2 +- drivers/hwmon/kfan.c | 2 +- drivers/hwmon/lan966x-hwmon.c | 2 +- drivers/hwmon/lenovo-ec-sensors.c | 2 +- drivers/hwmon/lineage-pem.c | 2 +- drivers/hwmon/lm63.c | 2 +- drivers/hwmon/lm70.c | 2 +- drivers/hwmon/lm73.c | 2 +- drivers/hwmon/lm75.c | 2 +- drivers/hwmon/lm77.c | 2 +- drivers/hwmon/lm78.c | 4 +- drivers/hwmon/lm80.c | 2 +- drivers/hwmon/lm83.c | 2 +- drivers/hwmon/lm85.c | 2 +- drivers/hwmon/lm87.c | 2 +- drivers/hwmon/lm90.c | 2 +- drivers/hwmon/lm92.c | 2 +- drivers/hwmon/lm93.c | 2 +- drivers/hwmon/lm95234.c | 2 +- drivers/hwmon/lm95241.c | 2 +- drivers/hwmon/lm95245.c | 2 +- drivers/hwmon/lochnagar-hwmon.c | 2 +- drivers/hwmon/ltc2945.c | 2 +- drivers/hwmon/ltc2947-core.c | 2 +- drivers/hwmon/ltc2990.c | 2 +- drivers/hwmon/ltc2991.c | 2 +- drivers/hwmon/ltc2992.c | 2 +- drivers/hwmon/ltc4151.c | 2 +- drivers/hwmon/ltc4215.c | 2 +- drivers/hwmon/ltc4245.c | 2 +- drivers/hwmon/ltc4261.c | 2 +- drivers/hwmon/ltc4282.c | 2 +- drivers/hwmon/ltc4283.c | 2 +- drivers/hwmon/macsmc-hwmon.c | 48 +++++----- drivers/hwmon/max1111.c | 2 +- drivers/hwmon/max127.c | 2 +- drivers/hwmon/max16065.c | 2 +- drivers/hwmon/max1668.c | 2 +- drivers/hwmon/max197.c | 2 +- drivers/hwmon/max31722.c | 2 +- drivers/hwmon/max31730.c | 2 +- drivers/hwmon/max31760.c | 2 +- drivers/hwmon/max31790.c | 2 +- drivers/hwmon/max31827.c | 2 +- drivers/hwmon/max6620.c | 2 +- drivers/hwmon/max6621.c | 2 +- drivers/hwmon/max6639.c | 2 +- drivers/hwmon/max6650.c | 2 +- drivers/hwmon/max6697.c | 2 +- drivers/hwmon/mc13783-adc.c | 2 +- drivers/hwmon/mc34vr500.c | 2 +- drivers/hwmon/mcp3021.c | 3 +- drivers/hwmon/mcp9982.c | 2 +- drivers/hwmon/menf21bmc_hwmon.c | 3 +- drivers/hwmon/minisforum-um780xtx.c | 2 +- drivers/hwmon/mlxreg-fan.c | 2 +- drivers/hwmon/mr75203.c | 14 ++- drivers/hwmon/nct6683.c | 7 +- drivers/hwmon/nct6694-hwmon.c | 8 +- drivers/hwmon/nct6775-core.c | 5 +- drivers/hwmon/nct6775-i2c.c | 2 +- drivers/hwmon/nct6775-platform.c | 2 +- drivers/hwmon/nct7363.c | 2 +- drivers/hwmon/nct7802.c | 2 +- drivers/hwmon/nct7904.c | 2 +- drivers/hwmon/npcm750-pwm-fan.c | 4 +- drivers/hwmon/nsa320-hwmon.c | 2 +- drivers/hwmon/ntc_thermistor.c | 2 +- drivers/hwmon/nzxt-kraken2.c | 2 +- drivers/hwmon/nzxt-kraken3.c | 2 +- drivers/hwmon/nzxt-smart2.c | 2 +- drivers/hwmon/occ/common.c | 8 +- drivers/hwmon/occ/p8_i2c.c | 3 +- drivers/hwmon/occ/p9_sbe.c | 3 +- drivers/hwmon/pc87360.c | 2 +- drivers/hwmon/pc87427.c | 3 +- drivers/hwmon/pcf8591.c | 3 +- drivers/hwmon/peci/cputemp.c | 2 +- drivers/hwmon/peci/dimmtemp.c | 2 +- drivers/hwmon/pmbus/adm1266.c | 2 +- drivers/hwmon/pmbus/adm1275.c | 3 +- drivers/hwmon/pmbus/dps920ab.c | 2 +- drivers/hwmon/pmbus/fsp-3y.c | 2 +- drivers/hwmon/pmbus/hac300s.c | 2 +- drivers/hwmon/pmbus/ibm-cffps.c | 2 +- drivers/hwmon/pmbus/ina233.c | 3 +- drivers/hwmon/pmbus/ir35221.c | 3 +- drivers/hwmon/pmbus/isl68137.c | 2 +- drivers/hwmon/pmbus/lm25066.c | 3 +- drivers/hwmon/pmbus/ltc2978.c | 3 +- drivers/hwmon/pmbus/ltc4286.c | 2 +- drivers/hwmon/pmbus/max16601.c | 2 +- drivers/hwmon/pmbus/max20730.c | 4 +- drivers/hwmon/pmbus/max20826.c | 4 +- drivers/hwmon/pmbus/max20830.c | 2 +- drivers/hwmon/pmbus/max31785.c | 2 +- drivers/hwmon/pmbus/max34440.c | 3 +- drivers/hwmon/pmbus/mp2856.c | 3 +- drivers/hwmon/pmbus/mp2869.c | 3 +- drivers/hwmon/pmbus/mp2888.c | 2 +- drivers/hwmon/pmbus/mp2891.c | 2 +- drivers/hwmon/pmbus/mp2925.c | 2 +- drivers/hwmon/pmbus/mp29502.c | 3 +- drivers/hwmon/pmbus/mp2975.c | 3 +- drivers/hwmon/pmbus/mp2985.c | 2 +- drivers/hwmon/pmbus/mp5926.c | 3 +- drivers/hwmon/pmbus/mp5990.c | 3 +- drivers/hwmon/pmbus/mp9941.c | 2 +- drivers/hwmon/pmbus/mp9945.c | 2 +- drivers/hwmon/pmbus/mpq7932.c | 2 +- drivers/hwmon/pmbus/mpq82d00.c | 2 +- drivers/hwmon/pmbus/mpq8646.c | 14 ++- drivers/hwmon/pmbus/pim4328.c | 6 +- drivers/hwmon/pmbus/pmbus.c | 5 +- drivers/hwmon/pmbus/pmbus_core.c | 18 ++-- drivers/hwmon/pmbus/q54sj108a2.c | 2 +- drivers/hwmon/pmbus/tda38640.c | 2 +- drivers/hwmon/pmbus/tps25990.c | 2 +- drivers/hwmon/pmbus/ucd9000.c | 7 +- drivers/hwmon/pmbus/ucd9200.c | 3 +- drivers/hwmon/pmbus/vt7505.c | 2 +- drivers/hwmon/pmbus/xdp720.c | 2 +- drivers/hwmon/pmbus/zl6100.c | 3 +- drivers/hwmon/powerz.c | 2 +- drivers/hwmon/powr1220.c | 2 +- drivers/hwmon/prom21-xhci.c | 2 +- drivers/hwmon/pt5161l.c | 2 +- drivers/hwmon/pwm-fan.c | 21 ++--- drivers/hwmon/qnap-mcu-hwmon.c | 2 +- drivers/hwmon/raspberrypi-hwmon.c | 2 +- drivers/hwmon/sch5627.c | 3 +- drivers/hwmon/sch5636.c | 3 +- drivers/hwmon/sch56xx-common.c | 2 +- drivers/hwmon/scmi-hwmon.c | 15 ++- drivers/hwmon/scpi-hwmon.c | 12 +-- drivers/hwmon/sfctemp.c | 2 +- drivers/hwmon/sg2042-mcu.c | 2 +- drivers/hwmon/sht15.c | 2 +- drivers/hwmon/sht21.c | 2 +- drivers/hwmon/sht3x.c | 2 +- drivers/hwmon/sht4x.c | 2 +- drivers/hwmon/shtc1.c | 2 +- drivers/hwmon/sis5595.c | 3 +- drivers/hwmon/sl28cpld-hwmon.c | 2 +- drivers/hwmon/smpro-hwmon.c | 2 +- drivers/hwmon/smsc47b397.c | 2 +- drivers/hwmon/smsc47m1.c | 2 +- drivers/hwmon/smsc47m192.c | 2 +- drivers/hwmon/socfpga-hwmon.c | 2 +- drivers/hwmon/sparx5-temp.c | 2 +- drivers/hwmon/spd5118.c | 2 +- drivers/hwmon/stts751.c | 2 +- drivers/hwmon/surface_temp.c | 2 +- drivers/hwmon/tc654.c | 2 +- drivers/hwmon/tc74.c | 2 +- drivers/hwmon/thmc50.c | 2 +- drivers/hwmon/tmp102.c | 2 +- drivers/hwmon/tmp108.c | 2 +- drivers/hwmon/tmp401.c | 2 +- drivers/hwmon/tmp421.c | 2 +- drivers/hwmon/tmp464.c | 2 +- drivers/hwmon/tmp513.c | 2 +- drivers/hwmon/tps23861.c | 2 +- drivers/hwmon/tsc1641.c | 2 +- drivers/hwmon/tvs-mpfs.c | 2 +- drivers/hwmon/ultra45_env.c | 2 +- drivers/hwmon/vexpress-hwmon.c | 2 +- drivers/hwmon/via-cputemp.c | 3 +- drivers/hwmon/via686a.c | 3 +- drivers/hwmon/vt1211.c | 2 +- drivers/hwmon/vt8231.c | 2 +- drivers/hwmon/w83627ehf.c | 2 +- drivers/hwmon/w83627hf.c | 2 +- drivers/hwmon/w83781d.c | 5 +- drivers/hwmon/w83791d.c | 3 +- drivers/hwmon/w83792d.c | 2 +- drivers/hwmon/w83795.c | 2 +- drivers/hwmon/w83l785ts.c | 2 +- drivers/hwmon/w83l786ng.c | 2 +- drivers/hwmon/xgene-hwmon.c | 2 +- drivers/hwmon/yogafan.c | 2 +- drivers/hwspinlock/omap_hwspinlock.c | 3 +- drivers/hwspinlock/sprd_hwspinlock.c | 5 +- drivers/hwspinlock/stm32_hwspinlock.c | 2 +- drivers/hwspinlock/sun6i_hwspinlock.c | 6 +- drivers/hwtracing/coresight/coresight-catu.c | 2 +- .../hwtracing/coresight/coresight-cpu-debug.c | 2 +- .../hwtracing/coresight/coresight-ctcu-core.c | 2 +- .../hwtracing/coresight/coresight-cti-core.c | 4 +- .../coresight/coresight-cti-platform.c | 2 +- .../hwtracing/coresight/coresight-cti-sysfs.c | 14 ++- drivers/hwtracing/coresight/coresight-dummy.c | 2 +- drivers/hwtracing/coresight/coresight-etb10.c | 2 +- .../hwtracing/coresight/coresight-etm-perf.c | 2 +- .../coresight/coresight-etm3x-core.c | 2 +- .../coresight/coresight-etm4x-core.c | 11 +-- .../hwtracing/coresight/coresight-funnel.c | 2 +- .../coresight/coresight-kunit-tests.c | 10 +- .../hwtracing/coresight/coresight-platform.c | 5 +- .../coresight/coresight-replicator.c | 2 +- drivers/hwtracing/coresight/coresight-stm.c | 2 +- .../coresight/coresight-syscfg-configfs.c | 14 +-- .../hwtracing/coresight/coresight-syscfg.c | 14 +-- .../hwtracing/coresight/coresight-tmc-core.c | 2 +- drivers/hwtracing/coresight/coresight-tnoc.c | 2 +- drivers/hwtracing/coresight/coresight-tpda.c | 2 +- drivers/hwtracing/coresight/coresight-tpdm.c | 14 +-- drivers/hwtracing/coresight/coresight-tpiu.c | 2 +- drivers/hwtracing/coresight/coresight-trbe.c | 4 +- drivers/hwtracing/coresight/ultrasoc-smb.c | 2 +- drivers/hwtracing/intel_th/gth.c | 11 +-- drivers/hwtracing/intel_th/msu.c | 2 +- drivers/hwtracing/intel_th/pti.c | 2 +- drivers/hwtracing/intel_th/sth.c | 2 +- drivers/hwtracing/ptt/hisi_ptt.c | 6 +- drivers/i2c/busses/i2c-altera.c | 2 +- drivers/i2c/busses/i2c-amd-asf-plat.c | 2 +- drivers/i2c/busses/i2c-amd-mp2-pci.c | 2 +- drivers/i2c/busses/i2c-amd-mp2-plat.c | 2 +- drivers/i2c/busses/i2c-amd8111.c | 2 +- drivers/i2c/busses/i2c-aspeed.c | 2 +- drivers/i2c/busses/i2c-at91-core.c | 2 +- drivers/i2c/busses/i2c-au1550.c | 3 +- drivers/i2c/busses/i2c-axxia.c | 2 +- drivers/i2c/busses/i2c-bcm-iproc.c | 3 +- drivers/i2c/busses/i2c-bcm-kona.c | 2 +- drivers/i2c/busses/i2c-bcm2835.c | 4 +- drivers/i2c/busses/i2c-brcmstb.c | 4 +- drivers/i2c/busses/i2c-cadence.c | 2 +- drivers/i2c/busses/i2c-cbus-gpio.c | 5 +- drivers/i2c/busses/i2c-cgbc.c | 2 +- drivers/i2c/busses/i2c-cht-wc.c | 2 +- drivers/i2c/busses/i2c-cp2615.c | 2 +- drivers/i2c/busses/i2c-cros-ec-tunnel.c | 2 +- drivers/i2c/busses/i2c-davinci.c | 2 +- drivers/i2c/busses/i2c-designware-amdisp.c | 2 +- drivers/i2c/busses/i2c-designware-pcidrv.c | 2 +- drivers/i2c/busses/i2c-designware-platdrv.c | 2 +- drivers/i2c/busses/i2c-digicolor.c | 2 +- drivers/i2c/busses/i2c-dln2.c | 2 +- drivers/i2c/busses/i2c-emev2.c | 2 +- drivers/i2c/busses/i2c-exynos5.c | 2 +- drivers/i2c/busses/i2c-fsi.c | 2 +- drivers/i2c/busses/i2c-gpio.c | 2 +- drivers/i2c/busses/i2c-gxp.c | 3 +- drivers/i2c/busses/i2c-hisi.c | 2 +- drivers/i2c/busses/i2c-hix5hd2.c | 2 +- drivers/i2c/busses/i2c-i801.c | 6 +- drivers/i2c/busses/i2c-icy.c | 4 +- drivers/i2c/busses/i2c-img-scb.c | 2 +- drivers/i2c/busses/i2c-imx-lpi2c.c | 4 +- drivers/i2c/busses/i2c-imx.c | 4 +- drivers/i2c/busses/i2c-isch.c | 2 +- drivers/i2c/busses/i2c-ismt.c | 2 +- drivers/i2c/busses/i2c-jz4780.c | 2 +- drivers/i2c/busses/i2c-k1.c | 2 +- drivers/i2c/busses/i2c-keba.c | 6 +- drivers/i2c/busses/i2c-kempld.c | 2 +- drivers/i2c/busses/i2c-ljca.c | 2 +- drivers/i2c/busses/i2c-lpc2k.c | 2 +- drivers/i2c/busses/i2c-ls2x-v2.c | 2 +- drivers/i2c/busses/i2c-ls2x.c | 2 +- drivers/i2c/busses/i2c-mchp-pci1xxxx.c | 2 +- drivers/i2c/busses/i2c-meson.c | 2 +- drivers/i2c/busses/i2c-microchip-corei2c.c | 2 +- drivers/i2c/busses/i2c-mlxbf.c | 11 +-- drivers/i2c/busses/i2c-mlxcpld.c | 2 +- drivers/i2c/busses/i2c-mpc.c | 2 +- drivers/i2c/busses/i2c-mt65xx.c | 2 +- drivers/i2c/busses/i2c-mt7621.c | 2 +- drivers/i2c/busses/i2c-mv64xxx.c | 3 +- drivers/i2c/busses/i2c-mxs.c | 2 +- drivers/i2c/busses/i2c-nct6694.c | 2 +- drivers/i2c/busses/i2c-nomadik.c | 2 +- drivers/i2c/busses/i2c-npcm7xx.c | 2 +- drivers/i2c/busses/i2c-nt72676.c | 2 +- drivers/i2c/busses/i2c-nvidia-gpu.c | 2 +- drivers/i2c/busses/i2c-ocores.c | 2 +- drivers/i2c/busses/i2c-octeon-platdrv.c | 2 +- drivers/i2c/busses/i2c-omap.c | 2 +- drivers/i2c/busses/i2c-opal.c | 2 +- drivers/i2c/busses/i2c-owl.c | 2 +- drivers/i2c/busses/i2c-pasemi-pci.c | 2 +- drivers/i2c/busses/i2c-pasemi-platform.c | 3 +- drivers/i2c/busses/i2c-pca-platform.c | 2 +- drivers/i2c/busses/i2c-pnx.c | 2 +- drivers/i2c/busses/i2c-pxa.c | 2 +- drivers/i2c/busses/i2c-qcom-cci.c | 2 +- drivers/i2c/busses/i2c-qcom-geni.c | 2 +- drivers/i2c/busses/i2c-qup.c | 12 +-- drivers/i2c/busses/i2c-rcar.c | 2 +- drivers/i2c/busses/i2c-riic.c | 2 +- drivers/i2c/busses/i2c-rk3x.c | 2 +- drivers/i2c/busses/i2c-robotfuzz-osif.c | 2 +- drivers/i2c/busses/i2c-rtl9300.c | 2 +- drivers/i2c/busses/i2c-rzv2m.c | 2 +- drivers/i2c/busses/i2c-s3c2410.c | 4 +- drivers/i2c/busses/i2c-sh_mobile.c | 2 +- drivers/i2c/busses/i2c-sprd.c | 2 +- drivers/i2c/busses/i2c-st.c | 2 +- drivers/i2c/busses/i2c-stm32.c | 2 +- drivers/i2c/busses/i2c-stm32f4.c | 2 +- drivers/i2c/busses/i2c-stm32f7.c | 4 +- drivers/i2c/busses/i2c-sun6i-p2wi.c | 2 +- drivers/i2c/busses/i2c-synquacer.c | 2 +- drivers/i2c/busses/i2c-tegra-bpmp.c | 2 +- drivers/i2c/busses/i2c-tegra.c | 2 +- drivers/i2c/busses/i2c-thunderx-pcidrv.c | 2 +- drivers/i2c/busses/i2c-uniphier-f.c | 2 +- drivers/i2c/busses/i2c-uniphier.c | 2 +- drivers/i2c/busses/i2c-usbio.c | 2 +- drivers/i2c/busses/i2c-versatile.c | 2 +- drivers/i2c/busses/i2c-viai2c-common.c | 2 +- drivers/i2c/busses/i2c-viai2c-zhaoxin.c | 2 +- drivers/i2c/busses/i2c-viperboard.c | 2 +- drivers/i2c/busses/i2c-virtio.c | 2 +- drivers/i2c/busses/i2c-xgene-slimpro.c | 2 +- drivers/i2c/busses/i2c-xiic.c | 2 +- drivers/i2c/busses/i2c-xlp9xx.c | 2 +- drivers/i2c/i2c-slave-testunit.c | 2 +- drivers/i2c/i2c-smbus.c | 3 +- drivers/i2c/i2c-stub.c | 2 +- drivers/i2c/muxes/i2c-demux-pinctrl.c | 5 +- drivers/i2c/muxes/i2c-mux-gpio.c | 2 +- drivers/i2c/muxes/i2c-mux-gpmux.c | 2 +- drivers/i2c/muxes/i2c-mux-reg.c | 2 +- drivers/i3c/master.c | 4 +- drivers/i3c/master/adi-i3c-master.c | 7 +- drivers/i3c/master/amd-i3c-master.c | 2 +- drivers/i3c/master/ast2600-i3c-master.c | 2 +- drivers/i3c/master/dw-i3c-master.c | 2 +- drivers/i3c/master/i3c-master-cdns.c | 7 +- drivers/i3c/master/mipi-i3c-hci/core.c | 4 +- .../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 4 +- drivers/i3c/master/mipi-i3c-hci/pio.c | 2 +- drivers/i3c/master/renesas-i3c.c | 2 +- drivers/i3c/master/svc-i3c-master.c | 7 +- drivers/iio/accel/adxl367_i2c.c | 2 +- drivers/iio/accel/adxl367_spi.c | 2 +- drivers/iio/adc/ab8500-gpadc.c | 6 +- drivers/iio/adc/ad4062.c | 2 +- drivers/iio/adc/ad4851.c | 2 +- drivers/iio/adc/ad7124.c | 6 +- drivers/iio/adc/ad7173.c | 9 +- drivers/iio/adc/ad7192.c | 3 +- drivers/iio/adc/ad7280a.c | 4 +- drivers/iio/adc/ad7606.c | 3 +- drivers/iio/adc/ad7606_spi.c | 2 +- drivers/iio/adc/ad7768.c | 2 +- drivers/iio/adc/ad7944.c | 4 +- drivers/iio/adc/ad9467.c | 8 +- drivers/iio/adc/ad_sigma_delta.c | 4 +- drivers/iio/adc/adi-axi-adc.c | 2 +- drivers/iio/adc/at91_adc.c | 5 +- drivers/iio/adc/cc10001_adc.c | 5 +- drivers/iio/adc/industrialio-adc.c | 3 +- drivers/iio/adc/max11410.c | 11 +-- drivers/iio/adc/mcp3564.c | 2 +- drivers/iio/adc/pac1934.c | 2 +- drivers/iio/adc/palmas_gpadc.c | 2 +- drivers/iio/adc/qcom-pm8xxx-xoadc.c | 7 +- drivers/iio/adc/qcom-spmi-adc5-gen3.c | 23 ++--- drivers/iio/adc/qcom-spmi-adc5.c | 8 +- drivers/iio/adc/qcom-spmi-vadc.c | 8 +- drivers/iio/adc/rzg2l_adc.c | 2 +- drivers/iio/adc/sd_adc_modulator.c | 2 +- drivers/iio/adc/stm32-adc-core.c | 2 +- drivers/iio/adc/stm32-adc.c | 4 +- drivers/iio/adc/stm32-dfsdm-adc.c | 8 +- drivers/iio/adc/stm32-dfsdm-core.c | 10 +- drivers/iio/adc/ti-ads1119.c | 7 +- drivers/iio/adc/ti-ads112c04.c | 2 +- drivers/iio/adc/ti-ads112c14.c | 12 +-- drivers/iio/adc/ti-ads131e08.c | 7 +- drivers/iio/adc/ti_am335x_adc.c | 3 +- drivers/iio/adc/twl6030-gpadc.c | 6 +- drivers/iio/adc/versal-sysmon-core.c | 2 +- drivers/iio/adc/versal-sysmon.c | 2 +- drivers/iio/adc/xilinx-ams.c | 2 +- drivers/iio/addac/ad74115.c | 3 +- drivers/iio/addac/ad74413r.c | 4 +- drivers/iio/amplifiers/adl8113.c | 3 +- drivers/iio/chemical/bme680_spi.c | 2 +- drivers/iio/chemical/scd30_serial.c | 2 +- drivers/iio/chemical/sps30_serial.c | 2 +- .../common/cros_ec_sensors/cros_ec_activity.c | 3 +- drivers/iio/common/scmi_sensors/scmi_iio.c | 10 +- drivers/iio/common/ssp_sensors/ssp_dev.c | 2 +- .../iio/common/st_sensors/st_sensors_core.c | 2 +- drivers/iio/dac/ad3530r.c | 2 +- drivers/iio/dac/ad5380.c | 4 +- drivers/iio/dac/ad5592r-base.c | 4 +- drivers/iio/dac/ad5686-spi.c | 3 +- drivers/iio/dac/ad5755.c | 2 +- drivers/iio/dac/adi-axi-dac.c | 2 +- drivers/iio/dac/ltc2664.c | 7 +- drivers/iio/dac/max22007.c | 2 +- drivers/iio/dac/mcp47feb02-core.c | 2 +- drivers/iio/dac/stm32-dac-core.c | 2 +- drivers/iio/frequency/adf4350.c | 2 +- drivers/iio/imu/bmi323/bmi323_i2c.c | 2 +- drivers/iio/imu/bno055/bno055_ser_core.c | 2 +- .../iio/imu/inv_icm42600/inv_icm42600_core.c | 2 +- .../iio/imu/inv_icm42607/inv_icm42607_core.c | 2 +- .../iio/imu/inv_icm45600/inv_icm45600_core.c | 2 +- drivers/iio/imu/kmx61.c | 2 +- drivers/iio/imu/smi330/smi330_i2c.c | 2 +- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 +- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c | 4 +- drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c | 2 +- drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c | 2 +- drivers/iio/industrialio-backend.c | 4 +- drivers/iio/magnetometer/hid-sensor-magn-3d.c | 10 +- drivers/iio/multiplexer/iio-mux.c | 8 +- drivers/iio/pressure/mpl115_spi.c | 2 +- drivers/iio/temperature/ltc2983.c | 23 +++-- drivers/iio/trigger/stm32-lptimer-trigger.c | 2 +- drivers/iio/trigger/stm32-timer-trigger.c | 2 +- drivers/infiniband/hw/erdma/erdma_cmdq.c | 4 +- drivers/input/joystick/adafruit-seesaw.c | 2 +- drivers/input/joystick/adc-joystick.c | 2 +- drivers/input/joystick/psxpad-spi.c | 2 +- drivers/input/joystick/pxrc.c | 2 +- drivers/input/joystick/qwiic-joystick.c | 2 +- drivers/input/joystick/sensehat-joystick.c | 3 +- drivers/input/keyboard/adc-keys.c | 4 +- drivers/input/keyboard/adp5520-keys.c | 2 +- drivers/input/keyboard/adp5585-keys.c | 2 +- drivers/input/keyboard/adp5588-keys.c | 2 +- drivers/input/keyboard/applespi.c | 2 +- drivers/input/keyboard/bcm-keypad.c | 2 +- drivers/input/keyboard/cap11xx.c | 6 +- drivers/input/keyboard/charlieplex_keypad.c | 2 +- drivers/input/keyboard/clps711x-keypad.c | 7 +- drivers/input/keyboard/cros_ec_keyb.c | 2 +- drivers/input/keyboard/cypress-sf.c | 9 +- .../input/keyboard/dlink-dir685-touchkeys.c | 2 +- drivers/input/keyboard/ep93xx_keypad.c | 2 +- drivers/input/keyboard/gpio_keys.c | 8 +- drivers/input/keyboard/gpio_keys_polled.c | 3 +- drivers/input/keyboard/imx-sm-bbm-key.c | 2 +- drivers/input/keyboard/imx_keypad.c | 2 +- drivers/input/keyboard/imx_sc_key.c | 2 +- drivers/input/keyboard/ipaq-micro-keys.c | 2 +- drivers/input/keyboard/iqs62x-keys.c | 3 +- drivers/input/keyboard/jornada680_kbd.c | 3 +- drivers/input/keyboard/jornada720_kbd.c | 2 +- drivers/input/keyboard/lm8323.c | 2 +- drivers/input/keyboard/lm8333.c | 2 +- drivers/input/keyboard/lpc32xx-keys.c | 3 +- drivers/input/keyboard/matrix_keypad.c | 2 +- drivers/input/keyboard/max7359_keypad.c | 3 +- drivers/input/keyboard/max7360-keypad.c | 2 +- drivers/input/keyboard/mpr121_touchkey.c | 2 +- drivers/input/keyboard/mt6779-keypad.c | 2 +- drivers/input/keyboard/mtk-pmic-keys.c | 2 +- drivers/input/keyboard/nspire-keypad.c | 3 +- drivers/input/keyboard/omap4-keypad.c | 8 +- drivers/input/keyboard/opencores-kbd.c | 3 +- drivers/input/keyboard/pinephone-keyboard.c | 2 +- drivers/input/keyboard/pmic8xxx-keypad.c | 2 +- drivers/input/keyboard/pxa27x_keypad.c | 3 +- drivers/input/keyboard/qt1050.c | 2 +- drivers/input/keyboard/qt1070.c | 3 +- drivers/input/keyboard/qt2160.c | 2 +- drivers/input/keyboard/samsung-keypad.c | 6 +- drivers/input/keyboard/snvs_pwrkey.c | 2 +- drivers/input/keyboard/spear-keyboard.c | 2 +- drivers/input/keyboard/st-keyscan.c | 3 +- drivers/input/keyboard/stmpe-keypad.c | 3 +- drivers/input/keyboard/sun4i-lradc-keys.c | 7 +- drivers/input/keyboard/tc3589x-keypad.c | 5 +- drivers/input/keyboard/tca8418_keypad.c | 2 +- drivers/input/keyboard/tegra-kbc.c | 2 +- drivers/input/keyboard/tm2-touchkey.c | 2 +- drivers/input/keyboard/twl4030_keypad.c | 2 +- drivers/input/matrix-keymap.c | 5 +- drivers/input/misc/88pm860x_onkey.c | 3 +- drivers/input/misc/88pm886-onkey.c | 2 +- drivers/input/misc/ab8500-ponkey.c | 3 +- drivers/input/misc/adxl34x.c | 2 +- drivers/input/misc/apanel.c | 2 +- drivers/input/misc/ariel-pwrbutton.c | 2 +- drivers/input/misc/arizona-haptics.c | 2 +- drivers/input/misc/atc260x-onkey.c | 2 +- drivers/input/misc/atlas_btns.c | 2 +- drivers/input/misc/atmel_captouch.c | 2 +- drivers/input/misc/aw86927.c | 2 +- drivers/input/misc/axp20x-pek.c | 3 +- drivers/input/misc/bma150.c | 2 +- drivers/input/misc/cobalt_btns.c | 2 +- drivers/input/misc/cpcap-pwrbutton.c | 2 +- drivers/input/misc/cs40l50-vibra.c | 2 +- drivers/input/misc/da7280.c | 2 +- drivers/input/misc/da9055_onkey.c | 2 +- drivers/input/misc/da9063_onkey.c | 3 +- drivers/input/misc/drv260x.c | 2 +- drivers/input/misc/drv2665.c | 2 +- drivers/input/misc/drv2667.c | 2 +- drivers/input/misc/gpio-beeper.c | 2 +- drivers/input/misc/gpio-vibra.c | 2 +- drivers/input/misc/gpio_decoder.c | 2 +- drivers/input/misc/ibm-panel.c | 2 +- drivers/input/misc/iqs269a.c | 2 +- drivers/input/misc/iqs626a.c | 2 +- drivers/input/misc/iqs7222.c | 2 +- drivers/input/misc/isa1200.c | 2 +- drivers/input/misc/kxtj9.c | 2 +- drivers/input/misc/max7360-rotary.c | 2 +- drivers/input/misc/max77650-onkey.c | 2 +- drivers/input/misc/max77693-haptic.c | 2 +- drivers/input/misc/max8925_onkey.c | 3 +- drivers/input/misc/nxp-bbnsm-pwrkey.c | 2 +- drivers/input/misc/pf1550-onkey.c | 2 +- drivers/input/misc/pm8941-pwrkey.c | 2 +- drivers/input/misc/pm8xxx-vibrator.c | 2 +- drivers/input/misc/pmic8xxx-pwrkey.c | 2 +- drivers/input/misc/pwm-beeper.c | 2 +- drivers/input/misc/pwm-vibra.c | 2 +- drivers/input/misc/qnap-mcu-input.c | 2 +- drivers/input/misc/rave-sp-pwrbutton.c | 2 +- drivers/input/misc/rb532_button.c | 2 +- drivers/input/misc/regulator-haptic.c | 2 +- drivers/input/misc/rotary_encoder.c | 6 +- drivers/input/misc/rt5120-pwrkey.c | 2 +- drivers/input/misc/sc27xx-vibra.c | 2 +- drivers/input/misc/sgi_btns.c | 2 +- drivers/input/misc/soc_button_array.c | 6 +- drivers/input/misc/sparcspkr.c | 4 +- drivers/input/misc/stpmic1_onkey.c | 2 +- drivers/input/misc/tps65218-pwrbutton.c | 2 +- drivers/input/misc/tps65219-pwrbutton.c | 2 +- drivers/input/misc/tps6594-pwrbutton.c | 2 +- drivers/input/misc/twl4030-vibra.c | 2 +- drivers/input/misc/twl6040-vibra.c | 2 +- drivers/input/misc/wm831x-on.c | 3 +- drivers/input/mouse/cyapa.c | 2 +- drivers/input/mouse/elan_i2c_core.c | 2 +- drivers/input/mouse/gpio_mouse.c | 2 +- drivers/input/mouse/synaptics_i2c.c | 2 +- drivers/input/rmi4/rmi_driver.c | 9 +- drivers/input/rmi4/rmi_f01.c | 2 +- drivers/input/rmi4/rmi_f03.c | 2 +- drivers/input/rmi4/rmi_f11.c | 16 ++-- drivers/input/rmi4/rmi_f12.c | 19 ++-- drivers/input/rmi4/rmi_f1a.c | 5 +- drivers/input/rmi4/rmi_f21.c | 2 +- drivers/input/rmi4/rmi_f30.c | 9 +- drivers/input/rmi4/rmi_f34.c | 2 +- drivers/input/rmi4/rmi_f3a.c | 8 +- drivers/input/rmi4/rmi_f54.c | 2 +- drivers/input/rmi4/rmi_f55.c | 2 +- drivers/input/rmi4/rmi_i2c.c | 3 +- drivers/input/rmi4/rmi_smbus.c | 3 +- drivers/input/rmi4/rmi_spi.c | 9 +- drivers/input/serio/altera_ps2.c | 2 +- drivers/input/serio/ams_delta_serio.c | 2 +- drivers/input/serio/apbps2.c | 2 +- drivers/input/serio/arc_ps2.c | 2 +- drivers/input/serio/ioc3kbd.c | 2 +- drivers/input/serio/olpc_apsp.c | 2 +- drivers/input/serio/ps2-gpio.c | 2 +- drivers/input/touch-overlay.c | 2 +- drivers/input/touchscreen/88pm860x-ts.c | 3 +- drivers/input/touchscreen/ad7877.c | 2 +- drivers/input/touchscreen/ad7879.c | 2 +- drivers/input/touchscreen/ads7846.c | 6 +- drivers/input/touchscreen/apple_z2.c | 2 +- drivers/input/touchscreen/ar1021_i2c.c | 2 +- drivers/input/touchscreen/atmel_mxt_ts.c | 12 +-- drivers/input/touchscreen/auo-pixcir-ts.c | 2 +- drivers/input/touchscreen/bcm_iproc_tsc.c | 2 +- drivers/input/touchscreen/bu21013_ts.c | 2 +- drivers/input/touchscreen/bu21029_ts.c | 2 +- drivers/input/touchscreen/chipone_icn8318.c | 2 +- drivers/input/touchscreen/chipone_icn8505.c | 2 +- drivers/input/touchscreen/colibri-vf50-ts.c | 2 +- drivers/input/touchscreen/cy8ctma140.c | 2 +- drivers/input/touchscreen/cy8ctmg110_ts.c | 2 +- drivers/input/touchscreen/cyttsp5.c | 2 +- drivers/input/touchscreen/da9034-ts.c | 3 +- drivers/input/touchscreen/edt-ft5x06.c | 2 +- drivers/input/touchscreen/eeti_ts.c | 2 +- drivers/input/touchscreen/egalax_ts.c | 2 +- drivers/input/touchscreen/ektf2127.c | 2 +- drivers/input/touchscreen/elants_i2c.c | 2 +- drivers/input/touchscreen/exc3000.c | 2 +- drivers/input/touchscreen/fsl-imx25-tcq.c | 2 +- drivers/input/touchscreen/goodix.c | 2 +- .../input/touchscreen/goodix_berlin_core.c | 2 +- drivers/input/touchscreen/hideep.c | 2 +- drivers/input/touchscreen/himax_hx83112b.c | 2 +- drivers/input/touchscreen/himax_hx852x.c | 2 +- drivers/input/touchscreen/hycon-hy46xx.c | 2 +- drivers/input/touchscreen/hynitron-cst816x.c | 2 +- drivers/input/touchscreen/hynitron_cstxxx.c | 2 +- drivers/input/touchscreen/ili210x.c | 2 +- drivers/input/touchscreen/ilitek_ts_i2c.c | 2 +- drivers/input/touchscreen/imagis.c | 2 +- drivers/input/touchscreen/imx6ul_tsc.c | 2 +- drivers/input/touchscreen/ipaq-micro-ts.c | 2 +- drivers/input/touchscreen/iqs5xx.c | 2 +- drivers/input/touchscreen/iqs7211.c | 4 +- drivers/input/touchscreen/jornada720_ts.c | 2 +- drivers/input/touchscreen/lpc32xx_ts.c | 2 +- drivers/input/touchscreen/max11801_ts.c | 2 +- drivers/input/touchscreen/melfas_mip4.c | 2 +- drivers/input/touchscreen/mms114.c | 3 +- drivers/input/touchscreen/msg2638.c | 2 +- drivers/input/touchscreen/mxs-lradc-ts.c | 2 +- drivers/input/touchscreen/novatek-nvt-ts.c | 2 +- drivers/input/touchscreen/pixcir_i2c_ts.c | 2 +- drivers/input/touchscreen/raspberrypi-ts.c | 2 +- drivers/input/touchscreen/raydium_i2c_ts.c | 2 +- .../input/touchscreen/resistive-adc-touch.c | 2 +- drivers/input/touchscreen/rohm_bu21023.c | 2 +- drivers/input/touchscreen/s6sy761.c | 2 +- drivers/input/touchscreen/silead.c | 2 +- drivers/input/touchscreen/sis_i2c.c | 2 +- drivers/input/touchscreen/st1232.c | 2 +- drivers/input/touchscreen/stmfts.c | 2 +- drivers/input/touchscreen/stmpe-ts.c | 2 +- drivers/input/touchscreen/sun4i-ts.c | 2 +- drivers/input/touchscreen/surface3_spi.c | 2 +- drivers/input/touchscreen/sx8654.c | 2 +- drivers/input/touchscreen/tps6507x-ts.c | 2 +- drivers/input/touchscreen/ts4800-ts.c | 2 +- drivers/input/touchscreen/tsc2007_core.c | 2 +- drivers/input/touchscreen/tsc200x-core.c | 2 +- drivers/input/touchscreen/wacom_i2c.c | 2 +- drivers/input/touchscreen/wacom_w9000.c | 2 +- drivers/input/touchscreen/wdt87xx_i2c.c | 2 +- drivers/input/touchscreen/wm831x-ts.c | 3 +- drivers/input/touchscreen/wm97xx-core.c | 4 +- drivers/input/touchscreen/zet6223.c | 2 +- drivers/input/touchscreen/zforce_ts.c | 2 +- drivers/input/touchscreen/zinitix.c | 2 +- drivers/interconnect/icc-clk.c | 4 +- drivers/interconnect/imx/imx.c | 7 +- drivers/interconnect/mediatek/icc-emi.c | 4 +- drivers/interconnect/qcom/bcm-voter.c | 2 +- drivers/interconnect/qcom/icc-rpm.c | 8 +- drivers/interconnect/qcom/icc-rpmh.c | 4 +- drivers/interconnect/qcom/osm-l3.c | 4 +- drivers/interconnect/samsung/exynos.c | 2 +- drivers/iommu/apple-dart.c | 2 +- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 6 +- .../iommu/arm/arm-smmu/arm-smmu-qcom-debug.c | 2 +- drivers/iommu/arm/arm-smmu/arm-smmu.c | 15 ++- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 5 +- drivers/iommu/bcm2712-iommu-cache.c | 2 +- drivers/iommu/bcm2712-iommu.c | 2 +- drivers/iommu/exynos-iommu.c | 2 +- drivers/iommu/ipmmu-vmsa.c | 2 +- drivers/iommu/msm_iommu.c | 2 +- drivers/iommu/mtk_iommu.c | 2 +- drivers/iommu/mtk_iommu_v1.c | 2 +- drivers/iommu/riscv/iommu-pci.c | 2 +- drivers/iommu/riscv/iommu-platform.c | 2 +- drivers/iommu/rockchip-iommu.c | 7 +- drivers/iommu/sprd-iommu.c | 2 +- drivers/iommu/sun50i-iommu.c | 2 +- drivers/iommu/tegra-smmu.c | 4 +- drivers/iommu/virtio-iommu.c | 5 +- drivers/iommu/vsi-iommu.c | 2 +- drivers/irqchip/irq-ast2700-intc0.c | 2 +- drivers/irqchip/irq-ast2700-intc1.c | 2 +- drivers/irqchip/irq-ast2700.c | 6 +- drivers/irqchip/irq-gic-pm.c | 5 +- drivers/irqchip/irq-gic.c | 2 +- drivers/irqchip/irq-imx-intmux.c | 2 +- drivers/irqchip/irq-imx-irqsteer.c | 2 +- drivers/irqchip/irq-imx-mu-msi.c | 2 +- drivers/irqchip/irq-keystone.c | 2 +- drivers/irqchip/irq-lan966x-oic.c | 2 +- drivers/irqchip/irq-ls-extirq.c | 2 +- drivers/irqchip/irq-ls-scfg-msi.c | 7 +- drivers/irqchip/irq-mbigen.c | 2 +- drivers/irqchip/irq-mvebu-gicp.c | 8 +- drivers/irqchip/irq-mvebu-icu.c | 5 +- drivers/irqchip/irq-mvebu-pic.c | 2 +- drivers/irqchip/irq-mvebu-sei.c | 2 +- drivers/irqchip/irq-pruss-intc.c | 4 +- drivers/irqchip/irq-qcom-mpm.c | 5 +- drivers/irqchip/irq-renesas-intc-irqpin.c | 2 +- drivers/irqchip/irq-renesas-irqc.c | 2 +- drivers/irqchip/irq-renesas-rza1.c | 2 +- drivers/irqchip/irq-renesas-rzg2l.c | 7 +- drivers/irqchip/irq-renesas-rzt2h.c | 2 +- drivers/irqchip/irq-renesas-rzv2h.c | 2 +- drivers/irqchip/irq-riscv-aplic-direct.c | 2 +- drivers/irqchip/irq-riscv-aplic-msi.c | 2 +- drivers/irqchip/irq-riscv-rpmi-sysmsi.c | 2 +- drivers/irqchip/irq-sg2042-msi.c | 2 +- drivers/irqchip/irq-sl28cpld.c | 2 +- drivers/irqchip/irq-st.c | 2 +- drivers/irqchip/irq-stm32mp-exti.c | 7 +- drivers/irqchip/irq-ti-sci-inta.c | 7 +- drivers/irqchip/irq-ti-sci-intr.c | 2 +- drivers/irqchip/irq-ts4800.c | 2 +- drivers/irqchip/irq-uniphier-aidet.c | 2 +- drivers/irqchip/qcom-irq-combiner.c | 3 +- drivers/irqchip/qcom-pdc.c | 4 +- drivers/leds/blink/leds-bcm63138.c | 4 +- drivers/leds/blink/leds-lgm-sso.c | 4 +- drivers/leds/flash/leds-aat1290.c | 9 +- drivers/leds/flash/leds-as3645a.c | 2 +- drivers/leds/flash/leds-ktd2692.c | 2 +- drivers/leds/flash/leds-lm3601x.c | 2 +- drivers/leds/flash/leds-max77693.c | 2 +- drivers/leds/flash/leds-mt6360.c | 3 +- drivers/leds/flash/leds-mt6370-flash.c | 2 +- drivers/leds/flash/leds-qcom-flash.c | 8 +- drivers/leds/flash/leds-rt4505.c | 2 +- drivers/leds/flash/leds-rt8515.c | 2 +- drivers/leds/flash/leds-sgm3140.c | 2 +- drivers/leds/flash/leds-sy7802.c | 2 +- drivers/leds/flash/leds-tps6131x.c | 2 +- drivers/leds/leds-88pm860x.c | 2 +- drivers/leds/leds-acer-a500.c | 4 +- drivers/leds/leds-adp5520.c | 3 +- drivers/leds/leds-an30259a.c | 2 +- drivers/leds/leds-apu.c | 7 +- drivers/leds/leds-ariel.c | 2 +- drivers/leds/leds-as3668.c | 2 +- drivers/leds/leds-aw200xx.c | 3 +- drivers/leds/leds-aw2013.c | 2 +- drivers/leds/leds-bcm6328.c | 12 +-- drivers/leds/leds-bcm6358.c | 4 +- drivers/leds/leds-bd2606mvv.c | 2 +- drivers/leds/leds-bd2802.c | 2 +- drivers/leds/leds-blinkm.c | 6 +- drivers/leds/leds-cht-wcove.c | 2 +- drivers/leds/leds-cpcap.c | 2 +- drivers/leds/leds-cr0014114.c | 3 +- drivers/leds/leds-cros_ec.c | 4 +- drivers/leds/leds-da903x.c | 2 +- drivers/leds/leds-da9052.c | 4 +- drivers/leds/leds-dac124s085.c | 2 +- drivers/leds/leds-el15203000.c | 3 +- drivers/leds/leds-gpio.c | 4 +- drivers/leds/leds-ip30.c | 2 +- drivers/leds/leds-is31fl319x.c | 2 +- drivers/leds/leds-is31fl32xx.c | 3 +- drivers/leds/leds-lm3530.c | 3 +- drivers/leds/leds-lm3532.c | 5 +- drivers/leds/leds-lm3533.c | 2 +- drivers/leds/leds-lm355x.c | 3 +- drivers/leds/leds-lm36274.c | 2 +- drivers/leds/leds-lm3642.c | 3 +- drivers/leds/leds-lm3692x.c | 2 +- drivers/leds/leds-lm3697.c | 2 +- drivers/leds/leds-lp3944.c | 3 +- drivers/leds/leds-lp3952.c | 2 +- drivers/leds/leds-lp50xx.c | 7 +- drivers/leds/leds-lp55xx-common.c | 14 ++- drivers/leds/leds-lp8788.c | 2 +- drivers/leds/leds-lp8860.c | 2 +- drivers/leds/leds-lp8864.c | 2 +- drivers/leds/leds-lt3593.c | 2 +- drivers/leds/leds-ltc3208.c | 2 +- drivers/leds/leds-ltc3220.c | 2 +- drivers/leds/leds-max5970.c | 2 +- drivers/leds/leds-max77650.c | 3 +- drivers/leds/leds-max77705.c | 6 +- drivers/leds/leds-max8997.c | 2 +- drivers/leds/leds-mc13783.c | 10 +- drivers/leds/leds-mlxcpld.c | 9 +- drivers/leds/leds-mlxreg.c | 5 +- drivers/leds/leds-mt6323.c | 4 +- drivers/leds/leds-netxbig.c | 21 ++--- drivers/leds/leds-nic78bx.c | 2 +- drivers/leds/leds-ns2.c | 4 +- drivers/leds/leds-pca9532.c | 4 +- drivers/leds/leds-pca955x.c | 3 +- drivers/leds/leds-pca963x.c | 2 +- drivers/leds/leds-pca995x.c | 2 +- drivers/leds/leds-pm8058.c | 2 +- drivers/leds/leds-powernv.c | 6 +- drivers/leds/leds-pwm.c | 3 +- drivers/leds/leds-qnap-mcu.c | 6 +- drivers/leds/leds-regulator.c | 2 +- drivers/leds/leds-sc27xx-bltc.c | 2 +- drivers/leds/leds-spi-byte.c | 2 +- drivers/leds/leds-st1202.c | 2 +- drivers/leds/leds-sun50i-a100.c | 2 +- drivers/leds/leds-sunfire.c | 2 +- drivers/leds/leds-syscon.c | 2 +- drivers/leds/leds-tca6507.c | 8 +- drivers/leds/leds-tlc591xx.c | 2 +- drivers/leds/leds-tps6105x.c | 2 +- drivers/leds/leds-turris-omnia.c | 2 +- drivers/leds/leds-upboard.c | 2 +- drivers/leds/leds-wm831x-status.c | 3 +- drivers/leds/leds-wm8350.c | 2 +- drivers/leds/rgb/leds-group-multicolor.c | 4 +- drivers/leds/rgb/leds-ktd202x.c | 4 +- drivers/leds/rgb/leds-lp5812.c | 10 +- drivers/leds/rgb/leds-lp5860-core.c | 2 +- drivers/leds/rgb/leds-lp5860-spi.c | 3 +- drivers/leds/rgb/leds-mt6370-rgb.c | 4 +- drivers/leds/rgb/leds-ncp5623.c | 4 +- drivers/leds/rgb/leds-pwm-multicolor.c | 5 +- drivers/leds/rgb/leds-qcom-lpg.c | 6 +- drivers/leds/rgb/leds-s2m-rgb.c | 2 +- .../simatic/simatic-ipc-leds-gpio-f7188x.c | 2 +- drivers/mailbox/arm_mhu.c | 2 +- drivers/mailbox/arm_mhu_db.c | 6 +- drivers/mailbox/arm_mhuv2.c | 10 +- drivers/mailbox/arm_mhuv3.c | 9 +- drivers/mailbox/armada-37xx-rwtm-mailbox.c | 4 +- drivers/mailbox/ast2700-mailbox.c | 6 +- drivers/mailbox/axiado-mailbox.c | 13 +-- drivers/mailbox/bcm-flexrm-mailbox.c | 8 +- drivers/mailbox/bcm-pdc-mailbox.c | 5 +- drivers/mailbox/bcm2835-mailbox.c | 5 +- drivers/mailbox/bcm74110-mailbox.c | 12 +-- drivers/mailbox/cix-mailbox.c | 2 +- drivers/mailbox/cv1800-mailbox.c | 2 +- drivers/mailbox/exynos-mailbox.c | 6 +- drivers/mailbox/hi3660-mailbox.c | 2 +- drivers/mailbox/hi6220-mailbox.c | 5 +- drivers/mailbox/imx-mailbox.c | 2 +- drivers/mailbox/mailbox-altera.c | 5 +- drivers/mailbox/mailbox-mchp-ipc-sbi.c | 20 ++-- drivers/mailbox/mailbox-mpfs.c | 2 +- drivers/mailbox/mailbox-sti.c | 9 +- drivers/mailbox/mailbox-test.c | 4 +- drivers/mailbox/mailbox-th1520.c | 4 +- drivers/mailbox/mailbox-xgene-slimpro.c | 2 +- drivers/mailbox/mtk-adsp-mailbox.c | 4 +- drivers/mailbox/mtk-cmdq-mailbox.c | 14 +-- drivers/mailbox/mtk-gpueb-mailbox.c | 9 +- drivers/mailbox/mtk-vcp-mailbox.c | 2 +- drivers/mailbox/omap-mailbox.c | 12 +-- drivers/mailbox/pcc.c | 7 +- drivers/mailbox/platform_mhu.c | 2 +- drivers/mailbox/qcom-apcs-ipc-mailbox.c | 2 +- drivers/mailbox/qcom-cpucp-mbox.c | 4 +- drivers/mailbox/qcom-ipcc.c | 7 +- drivers/mailbox/riscv-sbi-mpxy-mbox.c | 17 ++-- drivers/mailbox/rockchip-mailbox.c | 9 +- drivers/mailbox/sprd-mailbox.c | 2 +- drivers/mailbox/stm32-ipcc.c | 7 +- drivers/mailbox/sun6i-msgbox.c | 4 +- drivers/mailbox/tegra-hsp.c | 23 ++--- drivers/mailbox/ti-msgmgr.c | 6 +- drivers/mailbox/zynqmp-ipi-mailbox.c | 3 +- drivers/mcb/mcb-lpc.c | 2 +- drivers/mcb/mcb-pci.c | 2 +- drivers/media/cec/i2c/ch7322.c | 2 +- drivers/media/cec/i2c/tda9950.c | 2 +- .../media/cec/platform/cec-gpio/cec-gpio.c | 2 +- .../media/cec/platform/cros-ec/cros-ec-cec.c | 5 +- .../media/cec/platform/meson/ao-cec-g12a.c | 4 +- drivers/media/cec/platform/meson/ao-cec.c | 2 +- drivers/media/cec/platform/s5p/s5p_cec.c | 2 +- drivers/media/cec/platform/seco/seco-cec.c | 2 +- drivers/media/cec/platform/sti/stih-cec.c | 2 +- drivers/media/cec/platform/stm32/stm32-cec.c | 2 +- drivers/media/cec/platform/tegra/tegra_cec.c | 2 +- drivers/media/dvb-frontends/helene.c | 2 +- drivers/media/dvb-frontends/mn88443x.c | 2 +- drivers/media/i2c/ad5820.c | 2 +- drivers/media/i2c/adp1653.c | 4 +- drivers/media/i2c/adv7170.c | 2 +- drivers/media/i2c/adv7175.c | 2 +- drivers/media/i2c/adv7180.c | 2 +- drivers/media/i2c/adv7183.c | 2 +- drivers/media/i2c/adv7343.c | 5 +- drivers/media/i2c/adv7393.c | 2 +- drivers/media/i2c/adv748x/adv748x-core.c | 2 +- drivers/media/i2c/adv7511-v4l2.c | 2 +- drivers/media/i2c/adv7604.c | 2 +- drivers/media/i2c/adv7842.c | 2 +- drivers/media/i2c/ak7375.c | 3 +- drivers/media/i2c/ak881x.c | 2 +- drivers/media/i2c/alvium-csi2.c | 2 +- drivers/media/i2c/ar0521.c | 2 +- drivers/media/i2c/bt819.c | 2 +- drivers/media/i2c/bt856.c | 2 +- drivers/media/i2c/bt866.c | 2 +- drivers/media/i2c/ccs/ccs-core.c | 21 ++--- drivers/media/i2c/cs5345.c | 2 +- drivers/media/i2c/cs53l32a.c | 2 +- drivers/media/i2c/cvs/core.c | 2 +- drivers/media/i2c/cx25840/cx25840-core.c | 2 +- drivers/media/i2c/cx25840/cx25840-ir.c | 2 +- drivers/media/i2c/ds90ub913.c | 2 +- drivers/media/i2c/ds90ub953.c | 2 +- drivers/media/i2c/ds90ub960.c | 2 +- drivers/media/i2c/dw9714.c | 3 +- drivers/media/i2c/dw9719.c | 2 +- drivers/media/i2c/dw9768.c | 2 +- drivers/media/i2c/dw9807-vcm.c | 3 +- drivers/media/i2c/et8ek8/et8ek8_driver.c | 2 +- drivers/media/i2c/gc0308.c | 2 +- drivers/media/i2c/gc0310.c | 2 +- drivers/media/i2c/gc05a2.c | 2 +- drivers/media/i2c/gc08a3.c | 2 +- drivers/media/i2c/gc2145.c | 2 +- drivers/media/i2c/hi556.c | 2 +- drivers/media/i2c/hi846.c | 2 +- drivers/media/i2c/hi847.c | 2 +- drivers/media/i2c/hm1246.c | 2 +- drivers/media/i2c/imx111.c | 2 +- drivers/media/i2c/imx208.c | 2 +- drivers/media/i2c/imx214.c | 2 +- drivers/media/i2c/imx219.c | 2 +- drivers/media/i2c/imx258.c | 2 +- drivers/media/i2c/imx274.c | 2 +- drivers/media/i2c/imx283.c | 2 +- drivers/media/i2c/imx290.c | 2 +- drivers/media/i2c/imx296.c | 2 +- drivers/media/i2c/imx319.c | 4 +- drivers/media/i2c/imx334.c | 2 +- drivers/media/i2c/imx335.c | 2 +- drivers/media/i2c/imx355.c | 4 +- drivers/media/i2c/imx412.c | 2 +- drivers/media/i2c/imx415.c | 2 +- drivers/media/i2c/imx471.c | 2 +- drivers/media/i2c/imx576.c | 2 +- drivers/media/i2c/imx678.c | 2 +- drivers/media/i2c/ir-kbd-i2c.c | 2 +- drivers/media/i2c/isl7998x.c | 2 +- drivers/media/i2c/it6625.c | 2 +- drivers/media/i2c/ks0127.c | 2 +- drivers/media/i2c/lm3560.c | 2 +- drivers/media/i2c/lm3646.c | 7 +- drivers/media/i2c/lt6911uxe.c | 2 +- drivers/media/i2c/m52790.c | 2 +- drivers/media/i2c/max2175.c | 2 +- drivers/media/i2c/max9286.c | 2 +- drivers/media/i2c/maxim-serdes/max9296a.c | 2 +- drivers/media/i2c/maxim-serdes/max96717.c | 4 +- drivers/media/i2c/maxim-serdes/max96724.c | 6 +- drivers/media/i2c/maxim-serdes/max_des.c | 38 ++++---- drivers/media/i2c/maxim-serdes/max_ser.c | 31 +++---- drivers/media/i2c/maxim-serdes/max_serdes.c | 2 +- drivers/media/i2c/ml86v7667.c | 2 +- drivers/media/i2c/msp3400-driver.c | 2 +- drivers/media/i2c/mt9m001.c | 2 +- drivers/media/i2c/mt9m111.c | 2 +- drivers/media/i2c/mt9m114.c | 2 +- drivers/media/i2c/mt9p031.c | 2 +- drivers/media/i2c/mt9t112.c | 2 +- drivers/media/i2c/mt9v011.c | 2 +- drivers/media/i2c/mt9v032.c | 5 +- drivers/media/i2c/mt9v111.c | 2 +- drivers/media/i2c/og01a1b.c | 2 +- drivers/media/i2c/og0ve1b.c | 2 +- drivers/media/i2c/os02g10.c | 2 +- drivers/media/i2c/os05b10.c | 2 +- drivers/media/i2c/ov01a10.c | 2 +- drivers/media/i2c/ov02a10.c | 2 +- drivers/media/i2c/ov02c10.c | 2 +- drivers/media/i2c/ov02e10.c | 2 +- drivers/media/i2c/ov05c10.c | 2 +- drivers/media/i2c/ov08d10.c | 2 +- drivers/media/i2c/ov08x40.c | 2 +- drivers/media/i2c/ov13858.c | 2 +- drivers/media/i2c/ov13b10.c | 2 +- drivers/media/i2c/ov2640.c | 2 +- drivers/media/i2c/ov2659.c | 4 +- drivers/media/i2c/ov2680.c | 2 +- drivers/media/i2c/ov2685.c | 2 +- drivers/media/i2c/ov2732.c | 2 +- drivers/media/i2c/ov2735.c | 2 +- drivers/media/i2c/ov2740.c | 4 +- drivers/media/i2c/ov4689.c | 2 +- drivers/media/i2c/ov5640.c | 2 +- drivers/media/i2c/ov5645.c | 2 +- drivers/media/i2c/ov5647.c | 2 +- drivers/media/i2c/ov5648.c | 2 +- drivers/media/i2c/ov5670.c | 2 +- drivers/media/i2c/ov5675.c | 2 +- drivers/media/i2c/ov5693.c | 2 +- drivers/media/i2c/ov5695.c | 2 +- drivers/media/i2c/ov6211.c | 2 +- drivers/media/i2c/ov64a40.c | 2 +- drivers/media/i2c/ov7251.c | 2 +- drivers/media/i2c/ov7640.c | 2 +- drivers/media/i2c/ov7670.c | 2 +- drivers/media/i2c/ov772x.c | 2 +- drivers/media/i2c/ov7740.c | 2 +- drivers/media/i2c/ov8856.c | 2 +- drivers/media/i2c/ov8858.c | 2 +- drivers/media/i2c/ov8865.c | 2 +- drivers/media/i2c/ov9282.c | 2 +- drivers/media/i2c/ov9640.c | 2 +- drivers/media/i2c/ov9650.c | 2 +- drivers/media/i2c/ov9734.c | 2 +- drivers/media/i2c/rdacm20.c | 2 +- drivers/media/i2c/rdacm21.c | 2 +- drivers/media/i2c/rj54n1cb0c.c | 2 +- drivers/media/i2c/s5c73m3/s5c73m3-core.c | 2 +- drivers/media/i2c/s5k3m5.c | 2 +- drivers/media/i2c/s5k5baf.c | 4 +- drivers/media/i2c/s5k6a3.c | 2 +- drivers/media/i2c/s5kjn1.c | 2 +- drivers/media/i2c/s5kjn5.c | 2 +- drivers/media/i2c/saa6588.c | 2 +- drivers/media/i2c/saa6752hs.c | 2 +- drivers/media/i2c/saa7110.c | 2 +- drivers/media/i2c/saa7115.c | 2 +- drivers/media/i2c/saa7127.c | 2 +- drivers/media/i2c/saa717x.c | 2 +- drivers/media/i2c/saa7185.c | 2 +- drivers/media/i2c/sony-btf-mpx.c | 2 +- drivers/media/i2c/st-mipid02.c | 2 +- drivers/media/i2c/t4ka3.c | 2 +- drivers/media/i2c/tc358743.c | 3 +- drivers/media/i2c/tc358746.c | 2 +- drivers/media/i2c/tda7432.c | 2 +- drivers/media/i2c/tda9840.c | 2 +- drivers/media/i2c/tea6415c.c | 2 +- drivers/media/i2c/tea6420.c | 2 +- drivers/media/i2c/thp7312.c | 2 +- drivers/media/i2c/ths7303.c | 3 +- drivers/media/i2c/ths8200.c | 2 +- drivers/media/i2c/tlv320aic23b.c | 2 +- drivers/media/i2c/tvaudio.c | 2 +- drivers/media/i2c/tvp514x.c | 4 +- drivers/media/i2c/tvp5150.c | 2 +- drivers/media/i2c/tvp7002.c | 4 +- drivers/media/i2c/tw2804.c | 2 +- drivers/media/i2c/tw9900.c | 2 +- drivers/media/i2c/tw9903.c | 2 +- drivers/media/i2c/tw9906.c | 2 +- drivers/media/i2c/tw9910.c | 2 +- drivers/media/i2c/uda1342.c | 2 +- drivers/media/i2c/upd64031a.c | 2 +- drivers/media/i2c/upd64083.c | 2 +- drivers/media/i2c/vd55g1.c | 2 +- drivers/media/i2c/vd56g3.c | 2 +- drivers/media/i2c/vgxy61.c | 2 +- drivers/media/i2c/vp27smpx.c | 2 +- drivers/media/i2c/vpx3220.c | 2 +- drivers/media/i2c/wm8739.c | 2 +- drivers/media/i2c/wm8775.c | 2 +- drivers/media/pci/dt3155/dt3155.c | 2 +- drivers/media/pci/hws/hws_pci.c | 2 +- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 2 +- .../media/pci/intel/ipu6/ipu6-isys-subdev.c | 4 +- drivers/media/pci/intel/ipu6/ipu6-isys.c | 6 +- drivers/media/pci/intel/ipu6/ipu6-mmu-hw.c | 2 +- drivers/media/pci/intel/ipu6/ipu6-mmu.c | 2 +- drivers/media/pci/intel/ipu6/ipu6.c | 2 +- drivers/media/pci/intel/ipu6/ipu7-mmu-hw.c | 2 +- drivers/media/pci/intel/ivsc/mei_ace.c | 2 +- drivers/media/pci/intel/ivsc/mei_csi.c | 2 +- drivers/media/pci/pt3/pt3.c | 4 +- drivers/media/pci/tw5864/tw5864-core.c | 2 +- drivers/media/pci/tw68/tw68-core.c | 2 +- drivers/media/pci/zoran/zoran_card.c | 4 +- .../media/platform/allegro-dvt/allegro-core.c | 4 +- drivers/media/platform/amd/isp4/isp4.c | 2 +- .../platform/amlogic/c3/isp/c3-isp-dev.c | 2 +- .../amlogic/c3/mipi-adapter/c3-mipi-adap.c | 2 +- .../amlogic/c3/mipi-csi2/c3-mipi-csi2.c | 2 +- .../media/platform/amlogic/meson-ge2d/ge2d.c | 2 +- drivers/media/platform/amphion/vpu_core.c | 4 +- drivers/media/platform/amphion/vpu_drv.c | 2 +- .../platform/arm/mali-c55/mali-c55-core.c | 2 +- drivers/media/platform/aspeed/aspeed-video.c | 2 +- drivers/media/platform/atmel/atmel-isi.c | 2 +- .../platform/chips-media/coda/coda-common.c | 2 +- .../platform/chips-media/coda/imx-vdoa.c | 2 +- .../chips-media/wave5/wave5-vpu-dec.c | 2 +- .../chips-media/wave5/wave5-vpu-enc.c | 2 +- .../platform/chips-media/wave5/wave5-vpu.c | 2 +- .../platform/imagination/e5010-jpeg-enc.c | 2 +- drivers/media/platform/intel/pxa_camera.c | 2 +- drivers/media/platform/m2m-deinterlace.c | 2 +- drivers/media/platform/marvell/mmp-driver.c | 2 +- .../platform/mediatek/jpeg/mtk_jpeg_core.c | 2 +- .../platform/mediatek/jpeg/mtk_jpeg_dec_hw.c | 2 +- .../platform/mediatek/jpeg/mtk_jpeg_enc_hw.c | 2 +- .../platform/mediatek/mdp/mtk_mdp_core.c | 4 +- .../platform/mediatek/mdp3/mtk-mdp3-comp.c | 2 +- .../vcodec/common/mtk_vcodec_fw_scp.c | 2 +- .../vcodec/common/mtk_vcodec_fw_vpu.c | 2 +- .../vcodec/decoder/mtk_vcodec_dec_drv.c | 2 +- .../vcodec/decoder/mtk_vcodec_dec_hw.c | 2 +- .../vcodec/decoder/mtk_vcodec_dec_pm.c | 5 +- .../vcodec/encoder/mtk_vcodec_enc_drv.c | 2 +- .../vcodec/encoder/mtk_vcodec_enc_pm.c | 5 +- drivers/media/platform/mediatek/vpu/mtk_vpu.c | 2 +- .../platform/microchip/microchip-csi2dc.c | 2 +- .../microchip/microchip-sama5d2-isc.c | 5 +- .../microchip/microchip-sama7g5-isc.c | 5 +- drivers/media/platform/nvidia/tegra-vde/vde.c | 2 +- drivers/media/platform/nxp/dw100/dw100.c | 2 +- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 9 +- drivers/media/platform/nxp/imx-mipi-csis.c | 6 +- drivers/media/platform/nxp/imx-pxp.c | 2 +- drivers/media/platform/nxp/imx7-media-csi.c | 2 +- .../platform/nxp/imx8-isi/imx8-isi-core.c | 2 +- drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 2 +- .../media/platform/nxp/imx95-csi-formatter.c | 2 +- drivers/media/platform/nxp/mx2_emmaprp.c | 2 +- .../media/platform/qcom/camss/camss-csid.c | 9 +- .../qcom/camss/camss-csiphy-3ph-1-0.c | 2 +- .../media/platform/qcom/camss/camss-csiphy.c | 16 +--- .../media/platform/qcom/camss/camss-ispif.c | 13 +-- drivers/media/platform/qcom/camss/camss-tpg.c | 7 +- drivers/media/platform/qcom/camss/camss-vfe.c | 9 +- drivers/media/platform/qcom/camss/camss.c | 22 ++--- drivers/media/platform/qcom/iris/iris_probe.c | 4 +- drivers/media/platform/qcom/venus/core.c | 4 +- .../platform/raspberrypi/pisp_be/pisp_be.c | 2 +- drivers/media/platform/renesas/rcar-csi2.c | 2 +- drivers/media/platform/renesas/rcar-fcp.c | 2 +- .../media/platform/renesas/rcar-isp/csisp.c | 2 +- .../platform/renesas/rcar-vin/rcar-core.c | 2 +- drivers/media/platform/renesas/rcar_drif.c | 4 +- drivers/media/platform/renesas/rcar_fdp1.c | 2 +- drivers/media/platform/renesas/rcar_jpu.c | 2 +- drivers/media/platform/renesas/renesas-ceu.c | 3 +- .../platform/renesas/rzg2l-cru/rzg2l-core.c | 2 +- .../platform/renesas/rzg2l-cru/rzg2l-csi2.c | 2 +- .../renesas/rzv2h-ivc/rzv2h-ivc-dev.c | 2 +- drivers/media/platform/renesas/sh_vou.c | 2 +- .../media/platform/renesas/vsp1/vsp1_brx.c | 2 +- .../media/platform/renesas/vsp1/vsp1_clu.c | 2 +- drivers/media/platform/renesas/vsp1/vsp1_dl.c | 2 +- .../media/platform/renesas/vsp1/vsp1_drm.c | 2 +- .../media/platform/renesas/vsp1/vsp1_drv.c | 2 +- .../media/platform/renesas/vsp1/vsp1_entity.c | 8 +- .../media/platform/renesas/vsp1/vsp1_hgo.c | 2 +- .../media/platform/renesas/vsp1/vsp1_hgt.c | 2 +- .../media/platform/renesas/vsp1/vsp1_hsit.c | 2 +- .../media/platform/renesas/vsp1/vsp1_iif.c | 2 +- .../media/platform/renesas/vsp1/vsp1_lif.c | 2 +- .../media/platform/renesas/vsp1/vsp1_lut.c | 2 +- .../media/platform/renesas/vsp1/vsp1_rpf.c | 2 +- .../media/platform/renesas/vsp1/vsp1_sru.c | 2 +- .../media/platform/renesas/vsp1/vsp1_uds.c | 2 +- .../media/platform/renesas/vsp1/vsp1_uif.c | 2 +- .../media/platform/renesas/vsp1/vsp1_video.c | 2 +- .../media/platform/renesas/vsp1/vsp1_vspx.c | 2 +- .../media/platform/renesas/vsp1/vsp1_wpf.c | 2 +- drivers/media/platform/rockchip/rga/rga.c | 2 +- .../media/platform/rockchip/rkcif/rkcif-dev.c | 2 +- .../platform/rockchip/rkisp1/rkisp1-dev.c | 2 +- .../platform/rockchip/rkvdec/rkvdec-rcb.c | 2 +- .../media/platform/rockchip/rkvdec/rkvdec.c | 2 +- .../platform/samsung/exynos-gsc/gsc-core.c | 2 +- .../platform/samsung/exynos4-is/fimc-core.c | 2 +- .../platform/samsung/exynos4-is/fimc-is-i2c.c | 2 +- .../platform/samsung/exynos4-is/fimc-is.c | 2 +- .../platform/samsung/exynos4-is/fimc-lite.c | 2 +- .../platform/samsung/exynos4-is/media-dev.c | 2 +- .../platform/samsung/exynos4-is/mipi-csis.c | 2 +- .../platform/samsung/s3c-camif/camif-core.c | 2 +- drivers/media/platform/samsung/s5p-g2d/g2d.c | 2 +- .../platform/samsung/s5p-jpeg/jpeg-core.c | 2 +- .../media/platform/samsung/s5p-mfc/s5p_mfc.c | 7 +- .../media/platform/st/sti/bdisp/bdisp-hw.c | 6 +- .../media/platform/st/sti/bdisp/bdisp-v4l2.c | 2 +- .../media/platform/st/sti/delta/delta-v4l2.c | 2 +- drivers/media/platform/st/sti/hva/hva-h264.c | 2 +- drivers/media/platform/st/sti/hva/hva-mem.c | 2 +- drivers/media/platform/st/sti/hva/hva-v4l2.c | 2 +- drivers/media/platform/st/stm32/dma2d/dma2d.c | 2 +- drivers/media/platform/st/stm32/stm32-csi.c | 2 +- drivers/media/platform/st/stm32/stm32-dcmi.c | 8 +- .../st/stm32/stm32-dcmipp/dcmipp-core.c | 6 +- .../platform/sunxi/sun4i-csi/sun4i_csi.c | 2 +- .../platform/sunxi/sun6i-csi/sun6i_csi.c | 2 +- .../sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c | 2 +- .../sun8i_a83t_mipi_csi2.c | 2 +- .../media/platform/sunxi/sun8i-di/sun8i-di.c | 2 +- .../sunxi/sun8i-rotate/sun8i_rotate.c | 2 +- .../media/platform/synopsys/dw-mipi-csi2rx.c | 2 +- .../platform/synopsys/hdmirx/snps_hdmirx.c | 2 +- .../synopsys/hdmirx/snps_hdmirx_cec.c | 2 +- .../media/platform/ti/am437x/am437x-vpfe.c | 10 +- drivers/media/platform/ti/cal/cal-camerarx.c | 2 +- drivers/media/platform/ti/cal/cal-video.c | 4 +- drivers/media/platform/ti/cal/cal.c | 2 +- .../media/platform/ti/davinci/vpif_capture.c | 14 +-- .../platform/ti/j721e-csi2rx/j721e-csi2rx.c | 2 +- drivers/media/platform/ti/vpe/csc.c | 2 +- drivers/media/platform/ti/vpe/sc.c | 2 +- drivers/media/platform/ti/vpe/vip.c | 14 +-- drivers/media/platform/ti/vpe/vpe.c | 2 +- .../media/platform/verisilicon/hantro_drv.c | 12 +-- drivers/media/platform/video-mux.c | 5 +- .../media/platform/xilinx/xilinx-csi2rxss.c | 2 +- drivers/media/platform/xilinx/xilinx-tpg.c | 2 +- drivers/media/platform/xilinx/xilinx-vipp.c | 4 +- drivers/media/platform/xilinx/xilinx-vtc.c | 2 +- drivers/media/radio/radio-si476x.c | 2 +- drivers/media/radio/radio-timb.c | 2 +- drivers/media/radio/si470x/radio-si470x-i2c.c | 2 +- .../radio/si4713/radio-platform-si4713.c | 2 +- drivers/media/radio/si4713/si4713.c | 2 +- drivers/media/rc/gpio-ir-recv.c | 2 +- drivers/media/rc/gpio-ir-tx.c | 2 +- drivers/media/rc/igorplugusb.c | 2 +- drivers/media/rc/img-ir/img-ir-core.c | 2 +- drivers/media/rc/imon_raw.c | 2 +- drivers/media/rc/ir-hix5hd2.c | 2 +- drivers/media/rc/ir-spi.c | 2 +- drivers/media/rc/meson-ir-tx.c | 2 +- drivers/media/rc/meson-ir.c | 2 +- drivers/media/rc/mtk-cir.c | 2 +- drivers/media/rc/nuvoton-cir.c | 2 +- drivers/media/rc/pwm-ir-tx.c | 2 +- drivers/media/rc/st_rc.c | 2 +- drivers/media/rc/sunxi-cir.c | 2 +- drivers/media/spi/gs1662.c | 2 +- drivers/media/tuners/mt2060.c | 2 +- drivers/media/usb/cx231xx/cx231xx-cards.c | 2 +- .../media/v4l2-core/v4l2-flash-led-class.c | 9 +- drivers/memory/atmel-ebi.c | 7 +- drivers/memory/brcmstb_dpfe.c | 2 +- drivers/memory/brcmstb_memc.c | 2 +- drivers/memory/dfl-emif.c | 2 +- drivers/memory/emif.c | 20 ++-- drivers/memory/fsl-corenet-cf.c | 2 +- drivers/memory/fsl_ifc.c | 3 +- drivers/memory/jz4780-nemc.c | 2 +- drivers/memory/mtk-smi.c | 4 +- drivers/memory/mvebu-devbus.c | 2 +- drivers/memory/of_memory.c | 12 +-- drivers/memory/omap-gpmc.c | 2 +- drivers/memory/pl172.c | 2 +- drivers/memory/pl353-smc.c | 2 +- drivers/memory/renesas-rpc-if.c | 2 +- drivers/memory/samsung/exynos-srom.c | 3 +- drivers/memory/samsung/exynos5422-dmc.c | 17 ++-- drivers/memory/stm32-fmc2-ebi.c | 2 +- drivers/memory/stm32_omm.c | 2 +- drivers/memory/tegra/mc.c | 5 +- drivers/memory/tegra/tegra114-emc.c | 5 +- drivers/memory/tegra/tegra124-emc.c | 5 +- drivers/memory/tegra/tegra186-emc.c | 4 +- drivers/memory/tegra/tegra186.c | 4 +- drivers/memory/tegra/tegra20-emc.c | 5 +- drivers/memory/tegra/tegra210-emc-core.c | 8 +- drivers/memory/tegra/tegra30-emc.c | 5 +- drivers/memory/ti-aemif.c | 2 +- drivers/memory/ti-emif-pm.c | 2 +- drivers/mfd/88pm800.c | 3 +- drivers/mfd/88pm80x.c | 2 +- drivers/mfd/88pm860x-core.c | 8 +- drivers/mfd/88pm886.c | 2 +- drivers/mfd/aat2870-core.c | 3 +- drivers/mfd/ab8500-core.c | 2 +- drivers/mfd/abx500-core.c | 2 +- drivers/mfd/ac100.c | 2 +- drivers/mfd/adp5520.c | 2 +- drivers/mfd/adp5585.c | 2 +- drivers/mfd/altera-a10sr.c | 3 +- drivers/mfd/altera-sysmgr.c | 2 +- drivers/mfd/arizona-i2c.c | 2 +- drivers/mfd/arizona-spi.c | 7 +- drivers/mfd/as3711.c | 5 +- drivers/mfd/as3722.c | 2 +- drivers/mfd/atc260x-core.c | 3 +- drivers/mfd/atc260x-i2c.c | 2 +- drivers/mfd/atmel-flexcom.c | 2 +- drivers/mfd/atmel-hlcdc.c | 4 +- drivers/mfd/axp20x-i2c.c | 2 +- drivers/mfd/axp20x-rsb.c | 2 +- drivers/mfd/bcm2835-pm.c | 2 +- drivers/mfd/bcm590xx.c | 2 +- drivers/mfd/bq257xx.c | 2 +- drivers/mfd/cgbc-core.c | 2 +- drivers/mfd/cs40l50-i2c.c | 2 +- drivers/mfd/cs40l50-spi.c | 2 +- drivers/mfd/cs42l43-i2c.c | 2 +- drivers/mfd/cs42l43-sdw.c | 2 +- drivers/mfd/da903x.c | 3 +- drivers/mfd/da9052-i2c.c | 2 +- drivers/mfd/da9052-spi.c | 2 +- drivers/mfd/da9055-i2c.c | 2 +- drivers/mfd/da9062-core.c | 2 +- drivers/mfd/da9063-i2c.c | 2 +- drivers/mfd/da9150-core.c | 2 +- drivers/mfd/dln2.c | 2 +- drivers/mfd/ene-kb3930.c | 2 +- drivers/mfd/exynos-lpass.c | 2 +- drivers/mfd/fsl-imx25-tsadc.c | 2 +- drivers/mfd/gateworks-gsc.c | 2 +- drivers/mfd/hi6421-pmic-core.c | 2 +- drivers/mfd/hi655x-pmic.c | 2 +- drivers/mfd/intel-lpss.c | 2 +- drivers/mfd/intel-m10-bmc-pmci.c | 4 +- drivers/mfd/intel-m10-bmc-spi.c | 2 +- drivers/mfd/intel_pmc_bxt.c | 2 +- drivers/mfd/intel_soc_pmic_bxtwc.c | 2 +- drivers/mfd/intel_soc_pmic_chtdc_ti.c | 2 +- drivers/mfd/intel_soc_pmic_chtwc.c | 2 +- drivers/mfd/intel_soc_pmic_crc.c | 2 +- drivers/mfd/intel_soc_pmic_mrfld.c | 2 +- drivers/mfd/ioc3.c | 3 +- drivers/mfd/ipaq-micro.c | 2 +- drivers/mfd/iqs62x.c | 6 +- drivers/mfd/janz-cmodio.c | 2 +- drivers/mfd/kempld-core.c | 2 +- drivers/mfd/khadas-mcu.c | 2 +- drivers/mfd/lm3533-core.c | 5 +- drivers/mfd/lochnagar-i2c.c | 2 +- drivers/mfd/loongson-se.c | 2 +- drivers/mfd/lp3943.c | 2 +- drivers/mfd/lp873x.c | 2 +- drivers/mfd/lp87565.c | 2 +- drivers/mfd/lp8788-irq.c | 2 +- drivers/mfd/lp8788.c | 2 +- drivers/mfd/lpc_ich.c | 7 +- drivers/mfd/lpc_sch.c | 2 +- drivers/mfd/ls2k-bmc-core.c | 2 +- drivers/mfd/macsmc.c | 2 +- drivers/mfd/madera-i2c.c | 2 +- drivers/mfd/madera-spi.c | 2 +- drivers/mfd/max14577.c | 4 +- drivers/mfd/max77541.c | 2 +- drivers/mfd/max77620.c | 2 +- drivers/mfd/max77686.c | 3 +- drivers/mfd/max77693.c | 3 +- drivers/mfd/max77705.c | 2 +- drivers/mfd/max77759.c | 2 +- drivers/mfd/max77843.c | 2 +- drivers/mfd/max8907.c | 2 +- drivers/mfd/max8925-i2c.c | 8 +- drivers/mfd/max8997.c | 5 +- drivers/mfd/max8998.c | 5 +- drivers/mfd/mc13xxx-i2c.c | 2 +- drivers/mfd/mc13xxx-spi.c | 2 +- drivers/mfd/menelaus.c | 2 +- drivers/mfd/motorola-cpcap.c | 2 +- drivers/mfd/mp2629.c | 2 +- drivers/mfd/mt6358-irq.c | 12 +-- drivers/mfd/mt6360-core.c | 2 +- drivers/mfd/mt6370.c | 2 +- drivers/mfd/mt6397-core.c | 2 +- drivers/mfd/mxs-lradc.c | 2 +- drivers/mfd/nct6694.c | 6 +- drivers/mfd/ntxec.c | 2 +- drivers/mfd/ocelot-spi.c | 2 +- drivers/mfd/omap-usb-host.c | 4 +- drivers/mfd/omap-usb-tll.c | 2 +- drivers/mfd/palmas.c | 4 +- drivers/mfd/pf1550.c | 2 +- drivers/mfd/qcom-pm8xxx.c | 4 +- drivers/mfd/qcom-spmi-pmic.c | 2 +- drivers/mfd/qcom_rpm.c | 2 +- drivers/mfd/qnap-mcu.c | 2 +- drivers/mfd/rave-sp.c | 2 +- drivers/mfd/rc5t583.c | 2 +- drivers/mfd/retu-mfd.c | 2 +- drivers/mfd/rk8xx-core.c | 2 +- drivers/mfd/rn5t618.c | 2 +- drivers/mfd/rohm-bd71828.c | 2 +- drivers/mfd/rohm-bd96801.c | 4 +- drivers/mfd/rohm-pwrbutton.c | 6 +- drivers/mfd/rsmu_i2c.c | 2 +- drivers/mfd/rsmu_spi.c | 2 +- drivers/mfd/rt5033.c | 2 +- drivers/mfd/rz-mtu3.c | 4 +- drivers/mfd/sec-acpm.c | 4 +- drivers/mfd/sec-common.c | 4 +- drivers/mfd/si476x-i2c.c | 2 +- drivers/mfd/sky81452.c | 2 +- drivers/mfd/sm501.c | 3 +- drivers/mfd/sprd-sc27xx-spi.c | 7 +- drivers/mfd/ssbi.c | 2 +- drivers/mfd/stm32-lptimer.c | 2 +- drivers/mfd/stm32-timers.c | 2 +- drivers/mfd/stmfx.c | 2 +- drivers/mfd/stmpe.c | 4 +- drivers/mfd/stpmic1.c | 2 +- drivers/mfd/stw481x.c | 2 +- drivers/mfd/sun4i-gpadc.c | 2 +- drivers/mfd/tc3589x.c | 5 +- drivers/mfd/ti-lmu.c | 2 +- drivers/mfd/ti_am335x_tscadc.c | 2 +- drivers/mfd/tps6105x.c | 4 +- drivers/mfd/tps65010.c | 2 +- drivers/mfd/tps6507x.c | 3 +- drivers/mfd/tps65086.c | 2 +- drivers/mfd/tps65090.c | 2 +- drivers/mfd/tps65217.c | 2 +- drivers/mfd/tps65218.c | 2 +- drivers/mfd/tps65219.c | 2 +- drivers/mfd/tps6586x.c | 4 +- drivers/mfd/tps65910.c | 7 +- drivers/mfd/tps65912-i2c.c | 2 +- drivers/mfd/tps65912-spi.c | 2 +- drivers/mfd/tps6594-i2c.c | 2 +- drivers/mfd/tps6594-spi.c | 2 +- drivers/mfd/twl-core.c | 9 +- drivers/mfd/twl4030-audio.c | 3 +- drivers/mfd/twl6030-irq.c | 2 +- drivers/mfd/twl6040.c | 3 +- drivers/mfd/upboard-fpga.c | 2 +- drivers/mfd/vexpress-sysreg.c | 3 +- drivers/mfd/wcd934x.c | 2 +- drivers/mfd/wm831x-i2c.c | 2 +- drivers/mfd/wm831x-spi.c | 2 +- drivers/mfd/wm8350-i2c.c | 2 +- drivers/mfd/wm8400-core.c | 2 +- drivers/mfd/wm8994-core.c | 9 +- drivers/mfd/wm97xx-core.c | 3 +- drivers/misc/amd-sbi/rmi-i2c.c | 2 +- drivers/misc/atmel-ssc.c | 2 +- drivers/misc/bh1770glc.c | 2 +- drivers/misc/cardreader/alcor_pci.c | 2 +- drivers/misc/cardreader/rtsx_usb.c | 2 +- drivers/misc/cb710/core.c | 3 +- drivers/misc/dw-xdata-pcie.c | 2 +- drivers/misc/eeprom/idt_89hpesx.c | 3 +- drivers/misc/fastrpc.c | 2 +- drivers/misc/gehc-achc.c | 2 +- drivers/misc/hi6421v600-irq.c | 2 +- drivers/misc/keba/cp500.c | 2 +- drivers/misc/lan966x_pci.c | 2 +- drivers/misc/lattice-ecp3-config.c | 2 +- drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c | 2 +- .../misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c | 2 +- .../misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c | 2 +- drivers/misc/mei/vsc-tp.c | 6 +- drivers/misc/mrvl_cn10k_dpi.c | 5 +- drivers/misc/nsm.c | 2 +- drivers/misc/open-dice.c | 2 +- drivers/misc/pci_endpoint_test.c | 2 +- drivers/misc/pvpanic/pvpanic.c | 2 +- drivers/misc/rp1/rp1_pci.c | 2 +- drivers/misc/smpro-errmon.c | 2 +- drivers/misc/smpro-misc.c | 2 +- drivers/misc/sram.c | 7 +- drivers/misc/ti_fpc202.c | 2 +- drivers/misc/tps6594-pfsm.c | 2 +- drivers/misc/vmw_vmci/vmci_guest.c | 2 +- drivers/misc/xilinx_sdfec.c | 2 +- drivers/misc/xilinx_tmr_inject.c | 3 +- drivers/misc/xilinx_tmr_manager.c | 3 +- drivers/mmc/core/pwrseq_emmc.c | 2 +- drivers/mmc/core/pwrseq_sd8787.c | 2 +- drivers/mmc/core/pwrseq_simple.c | 2 +- drivers/mmc/core/slot-gpio.c | 2 +- drivers/mmc/host/atmel-mci.c | 2 +- drivers/mmc/host/cavium-octeon.c | 2 +- drivers/mmc/host/cavium-thunderx.c | 2 +- drivers/mmc/host/cqhci-core.c | 6 +- drivers/mmc/host/cqhci-crypto.c | 4 +- drivers/mmc/host/dw_mmc-exynos.c | 2 +- drivers/mmc/host/dw_mmc-hi3798cv200.c | 2 +- drivers/mmc/host/dw_mmc-hi3798mv200.c | 2 +- drivers/mmc/host/dw_mmc-k3.c | 2 +- drivers/mmc/host/dw_mmc-rockchip.c | 2 +- drivers/mmc/host/meson-gx-mmc.c | 4 +- drivers/mmc/host/meson-mx-sdhc-clkc.c | 2 +- drivers/mmc/host/meson-mx-sdio.c | 2 +- drivers/mmc/host/mmc_hsq.c | 4 +- drivers/mmc/host/mmci.c | 4 +- drivers/mmc/host/mmci_stm32_sdmmc.c | 4 +- drivers/mmc/host/mtk-sd.c | 6 +- drivers/mmc/host/omap.c | 3 +- drivers/mmc/host/omap_hsmmc.c | 2 +- drivers/mmc/host/renesas_sdhi_core.c | 3 +- drivers/mmc/host/sdhci-brcmstb.c | 3 +- drivers/mmc/host/sdhci-cadence-core.c | 2 +- drivers/mmc/host/sdhci-cadence-phy-v6.c | 2 +- drivers/mmc/host/sdhci-esdhc-imx.c | 2 +- drivers/mmc/host/sdhci-of-arasan.c | 3 +- drivers/mmc/host/sdhci-of-aspeed.c | 2 +- drivers/mmc/host/sdhci-of-dwcmshc.c | 8 +- drivers/mmc/host/sdhci-omap.c | 6 +- drivers/mmc/host/sdhci-pci-core.c | 4 +- drivers/mmc/host/sdhci-pci-gli.c | 2 +- drivers/mmc/host/sdhci-pxav2.c | 2 +- drivers/mmc/host/sdhci-pxav3.c | 2 +- drivers/mmc/host/sdhci-s3c.c | 2 +- drivers/mmc/host/sdhci-sprd.c | 2 +- drivers/mmc/host/sdhci-tegra.c | 3 +- drivers/mmc/host/sdhci-xenon-phy.c | 2 +- drivers/mmc/host/sdhci_am654.c | 3 +- drivers/mmc/host/uniphier-sd.c | 2 +- drivers/mtd/devices/bcm47xxsflash.c | 2 +- drivers/mtd/devices/docg3.c | 3 +- drivers/mtd/devices/mchp23k256.c | 2 +- drivers/mtd/devices/mchp48l640.c | 2 +- drivers/mtd/devices/powernv_flash.c | 2 +- drivers/mtd/devices/spear_smi.c | 11 +-- drivers/mtd/devices/sst25l.c | 2 +- drivers/mtd/devices/st_spi_fsm.c | 2 +- drivers/mtd/hyperbus/hbmc-am654.c | 4 +- drivers/mtd/hyperbus/rpc-if.c | 2 +- drivers/mtd/lpddr/lpddr2_nvm.c | 6 +- drivers/mtd/maps/int0800.c | 2 +- drivers/mtd/maps/lantiq-flash.c | 5 +- drivers/mtd/maps/physmap-core.c | 4 +- drivers/mtd/maps/physmap-gemini.c | 2 +- drivers/mtd/nand/ecc-mtk.c | 2 +- drivers/mtd/nand/ecc-mxic.c | 4 +- drivers/mtd/nand/ecc-realtek.c | 4 +- drivers/mtd/nand/onenand/onenand_omap2.c | 2 +- drivers/mtd/nand/onenand/onenand_samsung.c | 3 +- drivers/mtd/nand/qpic_common.c | 8 +- drivers/mtd/nand/raw/ams-delta.c | 3 +- drivers/mtd/nand/raw/arasan-nand-controller.c | 12 +-- drivers/mtd/nand/raw/atmel/nand-controller.c | 8 +- drivers/mtd/nand/raw/atmel/pmecc.c | 2 +- drivers/mtd/nand/raw/bcm47xxnflash/main.c | 2 +- drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c | 2 +- drivers/mtd/nand/raw/brcmnand/bcma_nand.c | 2 +- drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c | 2 +- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 6 +- drivers/mtd/nand/raw/brcmnand/iproc_nand.c | 2 +- .../mtd/nand/raw/cadence-nand-controller.c | 2 +- drivers/mtd/nand/raw/davinci_nand.c | 6 +- drivers/mtd/nand/raw/denali_dt.c | 5 +- drivers/mtd/nand/raw/denali_pci.c | 5 +- drivers/mtd/nand/raw/fsl_ifc_nand.c | 6 +- drivers/mtd/nand/raw/fsl_upm.c | 2 +- drivers/mtd/nand/raw/fsmc_nand.c | 6 +- drivers/mtd/nand/raw/gpio.c | 4 +- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 2 +- drivers/mtd/nand/raw/hisi504_nand.c | 2 +- drivers/mtd/nand/raw/ingenic/ingenic_ecc.c | 2 +- .../mtd/nand/raw/ingenic/ingenic_nand_drv.c | 4 +- drivers/mtd/nand/raw/intel-nand-controller.c | 2 +- .../mtd/nand/raw/loongson-nand-controller.c | 2 +- drivers/mtd/nand/raw/lpc32xx_mlc.c | 4 +- drivers/mtd/nand/raw/lpc32xx_slc.c | 4 +- drivers/mtd/nand/raw/marvell_nand.c | 7 +- drivers/mtd/nand/raw/meson_nand.c | 5 +- drivers/mtd/nand/raw/mpc5121_nfc.c | 2 +- drivers/mtd/nand/raw/mtk_nand.c | 5 +- drivers/mtd/nand/raw/mxc_nand.c | 3 +- drivers/mtd/nand/raw/mxic_nand.c | 3 +- drivers/mtd/nand/raw/nand_base.c | 2 +- .../nand/raw/nuvoton-ma35d1-nand-controller.c | 5 +- drivers/mtd/nand/raw/omap2.c | 3 +- drivers/mtd/nand/raw/omap_elm.c | 2 +- drivers/mtd/nand/raw/orion_nand.c | 7 +- drivers/mtd/nand/raw/pl35x-nand-controller.c | 4 +- drivers/mtd/nand/raw/plat_nand.c | 3 +- drivers/mtd/nand/raw/qcom_nandc.c | 8 +- .../mtd/nand/raw/renesas-nand-controller.c | 5 +- .../mtd/nand/raw/rockchip-nand-controller.c | 5 +- drivers/mtd/nand/raw/sh_flctl.c | 5 +- drivers/mtd/nand/raw/socrates_nand.c | 2 +- drivers/mtd/nand/raw/stm32_fmc2_nand.c | 2 +- drivers/mtd/nand/raw/sunxi_nand.c | 5 +- .../nand/raw/technologic-nand-controller.c | 2 +- drivers/mtd/nand/raw/tegra_nand.c | 4 +- drivers/mtd/nand/raw/txx9ndfmc.c | 2 +- drivers/mtd/nand/raw/vf610_nfc.c | 2 +- drivers/mtd/nand/raw/xway_nand.c | 3 +- drivers/mtd/nand/spi/core.c | 3 +- drivers/mtd/spi-nor/controllers/hisi-sfc.c | 6 +- drivers/mtd/spi-nor/controllers/nxp-spifi.c | 2 +- drivers/mtd/spi-nor/core.c | 7 +- drivers/mtd/spi-nor/sfdp.c | 11 +-- drivers/mtd/spi-nor/spansion.c | 5 +- drivers/mux/mmio.c | 9 +- drivers/net/arcnet/com20020-pci.c | 6 +- drivers/net/can/esd/esd_402_pci-core.c | 6 +- drivers/net/can/peak_canfd/peak_pciefd_main.c | 3 +- drivers/net/can/rcar/rcar_canfd.c | 2 +- drivers/net/can/sja1000/f81601.c | 2 +- .../net/can/spi/mcp251xfd/mcp251xfd-regmap.c | 24 ++--- drivers/net/can/usb/f81604.c | 2 +- .../net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 2 +- .../net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 2 +- drivers/net/can/usb/ucan.c | 4 +- drivers/net/dsa/b53/b53_common.c | 14 ++- drivers/net/dsa/b53/b53_mmap.c | 5 +- drivers/net/dsa/b53/b53_srab.c | 4 +- drivers/net/dsa/bcm_sf2.c | 6 +- drivers/net/dsa/dsa_loop.c | 4 +- drivers/net/dsa/hirschmann/hellcreek.c | 10 +- drivers/net/dsa/lan9303-core.c | 2 +- drivers/net/dsa/lan9303_i2c.c | 3 +- drivers/net/dsa/lan9303_mdio.c | 3 +- drivers/net/dsa/lantiq/lantiq_gswip.c | 10 +- drivers/net/dsa/lantiq/lantiq_gswip_common.c | 2 +- drivers/net/dsa/lantiq/mxl-gsw1xx.c | 2 +- drivers/net/dsa/microchip/ksz8.c | 8 +- drivers/net/dsa/microchip/ksz9477.c | 4 +- drivers/net/dsa/microchip/ksz_common.c | 4 +- drivers/net/dsa/microchip/lan937x_main.c | 4 +- drivers/net/dsa/motorcomm/chip.c | 6 +- drivers/net/dsa/motorcomm/leds.c | 2 +- drivers/net/dsa/mt7530-mdio.c | 7 +- drivers/net/dsa/mt7530-mmio.c | 2 +- drivers/net/dsa/mt7530.c | 4 +- drivers/net/dsa/mt7628.c | 4 +- drivers/net/dsa/mv88e6060.c | 4 +- drivers/net/dsa/mv88e6xxx/chip.c | 6 +- drivers/net/dsa/mxl862xx/mxl862xx.c | 4 +- drivers/net/dsa/netc/netc_main.c | 21 ++--- drivers/net/dsa/ocelot/felix.c | 12 +-- drivers/net/dsa/ocelot/felix_vsc9959.c | 5 +- drivers/net/dsa/ocelot/seville_vsc9953.c | 5 +- drivers/net/dsa/qca/ar9331.c | 2 +- drivers/net/dsa/qca/qca8k-8xxx.c | 4 +- drivers/net/dsa/rzn1_a5psw.c | 2 +- drivers/net/dsa/sja1105/sja1105_main.c | 9 +- drivers/net/dsa/vitesse-vsc73xx-core.c | 2 +- drivers/net/dsa/vitesse-vsc73xx-platform.c | 2 +- drivers/net/dsa/vitesse-vsc73xx-spi.c | 2 +- drivers/net/dsa/xrs700x/xrs700x.c | 12 +-- drivers/net/ethernet/actions/owl-emac.c | 6 +- drivers/net/ethernet/adi/adin1110.c | 2 +- drivers/net/ethernet/airoha/airoha_eth.c | 9 +- drivers/net/ethernet/airoha/airoha_npu.c | 2 +- drivers/net/ethernet/airoha/airoha_ppe.c | 2 +- drivers/net/ethernet/amd/pds_core/debugfs.c | 5 +- drivers/net/ethernet/amd/xgbe/xgbe-dcb.c | 6 +- drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c | 2 +- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 2 +- .../ethernet/apm/xgene/xgene_enet_ethtool.c | 4 +- .../net/ethernet/apm/xgene/xgene_enet_main.c | 23 ++--- drivers/net/ethernet/broadcom/asp2/bcmasp.c | 10 +- drivers/net/ethernet/broadcom/bcmsysport.c | 5 +- drivers/net/ethernet/cadence/macb_main.c | 2 +- .../net/ethernet/cavium/common/cavium_ptp.c | 2 +- .../net/ethernet/cavium/thunder/nic_main.c | 4 +- .../ethernet/cavium/thunder/nicvf_queues.c | 2 +- .../net/ethernet/cavium/thunder/thunder_bgx.c | 2 +- .../net/ethernet/cavium/thunder/thunder_xcv.c | 2 +- drivers/net/ethernet/cortina/gemini.c | 2 +- drivers/net/ethernet/davicom/dm9000.c | 2 +- drivers/net/ethernet/dec/tulip/eeprom.c | 4 +- .../net/ethernet/freescale/dpaa/dpaa_eth.c | 15 ++- .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 5 +- .../net/ethernet/freescale/dpaa2/dpaa2-ptp.c | 2 +- .../net/ethernet/freescale/enetc/enetc_cbdr.c | 3 +- .../net/ethernet/freescale/enetc/enetc_ierb.c | 2 +- .../net/ethernet/freescale/enetc/enetc_mdio.c | 2 +- .../freescale/enetc/enetc_pf_common.c | 9 +- .../ethernet/freescale/enetc/netc_blk_ctrl.c | 2 +- drivers/net/ethernet/freescale/fman/mac.c | 4 +- .../net/ethernet/hisilicon/hibmcge/hbg_main.c | 4 +- drivers/net/ethernet/hisilicon/hisi_femac.c | 6 +- .../ethernet/hisilicon/hns/hns_dsaf_gmac.c | 2 +- .../net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 6 +- .../ethernet/hisilicon/hns/hns_dsaf_misc.c | 2 +- .../net/ethernet/hisilicon/hns/hns_dsaf_ppe.c | 5 +- .../net/ethernet/hisilicon/hns/hns_dsaf_rcb.c | 5 +- .../ethernet/hisilicon/hns/hns_dsaf_xgmac.c | 2 +- .../hns3/hns3_common/hclge_comm_rss.c | 4 +- .../ethernet/hisilicon/hns3/hns3_debugfs.c | 3 +- .../net/ethernet/hisilicon/hns3/hns3_enet.c | 17 ++-- .../hisilicon/hns3/hns3pf/hclge_main.c | 19 ++-- .../hisilicon/hns3/hns3pf/hclge_ptp.c | 2 +- .../hisilicon/hns3/hns3vf/hclgevf_main.c | 16 ++-- drivers/net/ethernet/hisilicon/hns_mdio.c | 2 +- .../ethernet/huawei/hinic/hinic_hw_api_cmd.c | 6 +- .../net/ethernet/huawei/hinic/hinic_hw_cmdq.c | 8 +- .../net/ethernet/huawei/hinic/hinic_hw_dev.c | 9 +- .../net/ethernet/huawei/hinic/hinic_hw_eqs.c | 8 +- .../net/ethernet/huawei/hinic/hinic_hw_io.c | 16 ++-- .../net/ethernet/huawei/hinic/hinic_hw_wq.c | 18 ++-- .../net/ethernet/huawei/hinic/hinic_main.c | 8 +- drivers/net/ethernet/huawei/hinic/hinic_tx.c | 7 +- drivers/net/ethernet/ibm/emac/core.c | 3 +- drivers/net/ethernet/ibm/emac/mal.c | 3 +- drivers/net/ethernet/ibm/emac/rgmii.c | 3 +- drivers/net/ethernet/ibm/emac/tah.c | 3 +- drivers/net/ethernet/ibm/emac/zmii.c | 3 +- .../net/ethernet/intel/ice/devlink/devlink.c | 2 +- drivers/net/ethernet/intel/ice/ice_arfs.c | 10 +- drivers/net/ethernet/intel/ice/ice_common.c | 8 +- drivers/net/ethernet/intel/ice/ice_controlq.c | 8 +- drivers/net/ethernet/intel/ice/ice_ddp.c | 5 +- .../ethernet/intel/ice/ice_ethtool_ntuple.c | 24 ++--- .../net/ethernet/intel/ice/ice_flex_pipe.c | 83 ++++++++--------- drivers/net/ethernet/intel/ice/ice_flow.c | 8 +- drivers/net/ethernet/intel/ice/ice_fltr.c | 2 +- drivers/net/ethernet/intel/ice/ice_lib.c | 19 ++-- drivers/net/ethernet/intel/ice/ice_main.c | 11 +-- drivers/net/ethernet/intel/ice/ice_ptp.c | 6 +- drivers/net/ethernet/intel/ice/ice_sched.c | 41 ++++---- drivers/net/ethernet/intel/ice/ice_switch.c | 19 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 3 +- .../net/ethernet/intel/ice/ice_vlan_mode.c | 3 +- drivers/net/ethernet/intel/ice/virt/fdir.c | 16 ++-- drivers/net/ethernet/intel/igb/igb_hwmon.c | 3 +- .../net/ethernet/intel/ixgbe/ixgbe_sysfs.c | 3 +- drivers/net/ethernet/marvell/mv643xx_eth.c | 4 +- drivers/net/ethernet/marvell/mvneta.c | 10 +- drivers/net/ethernet/marvell/mvneta_bm.c | 8 +- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 25 ++--- .../net/ethernet/marvell/mvpp2/mvpp2_prs.c | 10 +- .../net/ethernet/marvell/mvpp2/mvpp2_tai.c | 2 +- .../net/ethernet/marvell/octeontx2/af/cgx.c | 2 +- .../marvell/octeontx2/af/cn20k/debugfs.c | 2 +- .../marvell/octeontx2/af/cn20k/mbox_init.c | 6 +- .../ethernet/marvell/octeontx2/af/common.h | 2 +- .../net/ethernet/marvell/octeontx2/af/mcs.c | 4 +- .../marvell/octeontx2/af/mcs_rvu_if.c | 8 +- .../net/ethernet/marvell/octeontx2/af/rvu.c | 36 +++---- .../marvell/octeontx2/af/rvu_debugfs.c | 2 +- .../ethernet/marvell/octeontx2/af/rvu_nix.c | 35 +++---- .../ethernet/marvell/octeontx2/af/rvu_npc.c | 17 ++-- .../ethernet/marvell/octeontx2/af/rvu_sdp.c | 5 +- .../ethernet/marvell/octeontx2/nic/cn20k.c | 3 +- .../marvell/octeontx2/nic/otx2_common.c | 12 +-- .../marvell/octeontx2/nic/otx2_flows.c | 13 +-- .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 15 ++- .../ethernet/marvell/octeontx2/nic/otx2_vf.c | 4 +- .../net/ethernet/marvell/octeontx2/nic/rep.c | 2 +- .../ethernet/marvell/prestera/prestera_pci.c | 2 +- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 +- drivers/net/ethernet/mediatek/mtk_ppe.c | 2 +- drivers/net/ethernet/mediatek/mtk_wed.c | 3 +- drivers/net/ethernet/mediatek/mtk_wed_wo.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/i2c.c | 2 +- .../microchip/lan966x/lan966x_ethtool.c | 5 +- .../ethernet/microchip/lan966x/lan966x_main.c | 7 +- .../microchip/sparx5/sparx5_ethtool.c | 6 +- .../microchip/sparx5/sparx5_mactable.c | 3 +- .../ethernet/microchip/sparx5/sparx5_main.c | 2 +- .../microchip/vcap/vcap_api_debugfs.c | 6 +- drivers/net/ethernet/mscc/ocelot.c | 2 +- drivers/net/ethernet/mscc/ocelot_fdma.c | 2 +- drivers/net/ethernet/mscc/ocelot_mm.c | 4 +- drivers/net/ethernet/mscc/ocelot_stats.c | 12 +-- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 11 +-- .../nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c | 2 +- .../net/ethernet/nebula-matrix/nbl/nbl_main.c | 2 +- drivers/net/ethernet/ni/nixge.c | 5 +- drivers/net/ethernet/oa_tc6.c | 2 +- .../ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 8 +- .../ethernet/pensando/ionic/ionic_debugfs.c | 9 +- .../net/ethernet/pensando/ionic/ionic_lif.c | 26 +++--- .../net/ethernet/pensando/ionic/ionic_phc.c | 2 +- .../ethernet/pensando/ionic/ionic_rx_filter.c | 6 +- drivers/net/ethernet/qualcomm/ppe/ppe.c | 5 +- .../net/ethernet/qualcomm/ppe/ppe_debugfs.c | 2 +- drivers/net/ethernet/realtek/r8169_main.c | 3 +- drivers/net/ethernet/renesas/rcar_gen4_ptp.c | 2 +- drivers/net/ethernet/renesas/rswitch_main.c | 6 +- drivers/net/ethernet/renesas/sh_eth.c | 4 +- .../net/ethernet/samsung/sxgbe/sxgbe_main.c | 14 ++- .../ethernet/samsung/sxgbe/sxgbe_platform.c | 10 +- .../ethernet/stmicro/stmmac/dwmac-anarion.c | 2 +- .../stmicro/stmmac/dwmac-dwc-qos-eth.c | 6 +- .../ethernet/stmicro/stmmac/dwmac-eic7700.c | 8 +- .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 2 +- .../ethernet/stmicro/stmmac/dwmac-ingenic.c | 2 +- .../stmicro/stmmac/dwmac-intel-plat.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 14 +-- .../ethernet/stmicro/stmmac/dwmac-ipq806x.c | 2 +- .../ethernet/stmicro/stmmac/dwmac-loongson.c | 8 +- .../ethernet/stmicro/stmmac/dwmac-loongson1.c | 2 +- .../ethernet/stmicro/stmmac/dwmac-mediatek.c | 10 +- .../net/ethernet/stmicro/stmmac/dwmac-meson.c | 2 +- .../ethernet/stmicro/stmmac/dwmac-meson8b.c | 4 +- .../ethernet/stmicro/stmmac/dwmac-motorcomm.c | 7 +- .../ethernet/stmicro/stmmac/dwmac-nuvoton.c | 2 +- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +- .../stmicro/stmmac/dwmac-renesas-gbeth.c | 6 +- .../net/ethernet/stmicro/stmmac/dwmac-rk.c | 6 +- .../net/ethernet/stmicro/stmmac/dwmac-s32.c | 2 +- .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 2 +- .../ethernet/stmicro/stmmac/dwmac-spacemit.c | 2 +- .../ethernet/stmicro/stmmac/dwmac-starfive.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac-sti.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac-tegra.c | 10 +- .../net/ethernet/stmicro/stmmac/dwmac-thead.c | 2 +- .../ethernet/stmicro/stmmac/dwmac-visconti.c | 2 +- drivers/net/ethernet/stmicro/stmmac/hwif.c | 2 +- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +- .../net/ethernet/stmicro/stmmac/stmmac_pci.c | 11 +-- .../net/ethernet/stmicro/stmmac/stmmac_pcs.c | 2 +- .../ethernet/stmicro/stmmac/stmmac_platform.c | 7 +- .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 20 ++-- drivers/net/ethernet/sunplus/spl2sw_driver.c | 2 +- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 6 +- drivers/net/ethernet/ti/am65-cpsw-qos.c | 5 +- drivers/net/ethernet/ti/am65-cpts.c | 2 +- drivers/net/ethernet/ti/cpsw-phy-sel.c | 2 +- drivers/net/ethernet/ti/cpsw.c | 12 +-- drivers/net/ethernet/ti/cpsw_ale.c | 2 +- drivers/net/ethernet/ti/cpsw_new.c | 13 +-- drivers/net/ethernet/ti/cpsw_sl.c | 2 +- drivers/net/ethernet/ti/cpts.c | 8 +- drivers/net/ethernet/ti/davinci_cpdma.c | 6 +- drivers/net/ethernet/ti/davinci_emac.c | 2 +- drivers/net/ethernet/ti/davinci_mdio.c | 2 +- drivers/net/ethernet/ti/icssg/icss_iep.c | 2 +- drivers/net/ethernet/ti/icssg/icssg_prueth.c | 2 +- .../net/ethernet/ti/icssg/icssg_prueth_sr1.c | 2 +- drivers/net/ethernet/ti/icssm/icssm_prueth.c | 2 +- drivers/net/ethernet/ti/netcp_core.c | 13 ++- drivers/net/ethernet/ti/netcp_ethss.c | 37 +++----- .../net/ethernet/wangxun/txgbe/txgbe_main.c | 2 +- .../net/ethernet/wangxun/txgbe/txgbe_phy.c | 2 +- drivers/net/ethernet/xilinx/ll_temac_main.c | 8 +- drivers/net/ethernet/xscale/ixp4xx_eth.c | 2 +- drivers/net/ieee802154/cc2520.c | 2 +- drivers/net/mdio/mdio-bcm-iproc.c | 2 +- drivers/net/mdio/mdio-bcm-unimac.c | 2 +- drivers/net/mdio/mdio-gpio.c | 2 +- drivers/net/mdio/mdio-mux-bcm-iproc.c | 2 +- drivers/net/mdio/mdio-mux-bcm6368.c | 2 +- drivers/net/mdio/mdio-mux-gpio.c | 2 +- drivers/net/mdio/mdio-mux-meson-g12a.c | 6 +- drivers/net/mdio/mdio-mux-meson-gxl.c | 2 +- drivers/net/mdio/mdio-mux-mmioreg.c | 2 +- drivers/net/mdio/mdio-mux-multiplexer.c | 2 +- drivers/net/mdio/mdio-mux.c | 4 +- drivers/net/mdio/mdio-realtek-rtl9300.c | 2 +- drivers/net/mdio/mdio-thunder.c | 2 +- drivers/net/mdio/mdio-xgene.c | 2 +- drivers/net/pcs/pcs-rzn1-miic.c | 2 +- drivers/net/pcs/pcs-xpcs-plat.c | 2 +- drivers/net/pcs/pcs-xpcs-rk.c | 2 +- drivers/net/phy/adin.c | 2 +- drivers/net/phy/adin1100.c | 2 +- drivers/net/phy/air_an8801.c | 2 +- drivers/net/phy/air_en8811h.c | 6 +- drivers/net/phy/aquantia/aquantia_main.c | 3 +- drivers/net/phy/as21xxx.c | 3 +- drivers/net/phy/bcm-cygnus.c | 7 +- drivers/net/phy/bcm-phy-ptp.c | 2 +- drivers/net/phy/bcm54140.c | 2 +- drivers/net/phy/bcm7xxx.c | 7 +- drivers/net/phy/broadcom.c | 9 +- drivers/net/phy/dp83822.c | 2 +- drivers/net/phy/dp83867.c | 3 +- drivers/net/phy/dp83869.c | 3 +- drivers/net/phy/dp83td510.c | 2 +- drivers/net/phy/dp83tg720.c | 2 +- drivers/net/phy/icplus.c | 2 +- drivers/net/phy/intel-xway.c | 2 +- drivers/net/phy/marvell-88q2xxx.c | 2 +- drivers/net/phy/marvell-88x2222.c | 2 +- drivers/net/phy/marvell.c | 2 +- drivers/net/phy/marvell10g.c | 2 +- drivers/net/phy/mediatek/mtk-2p5ge.c | 3 +- drivers/net/phy/mediatek/mtk-ge-soc.c | 5 +- drivers/net/phy/micrel.c | 19 ++-- drivers/net/phy/microchip.c | 2 +- drivers/net/phy/microchip_rds_ptp.c | 9 +- drivers/net/phy/microchip_t1.c | 2 +- drivers/net/phy/motorcomm.c | 2 +- drivers/net/phy/mscc/mscc_main.c | 6 +- drivers/net/phy/mscc/mscc_ptp.c | 3 +- drivers/net/phy/mxl-gpy.c | 2 +- drivers/net/phy/nxp-c45-tja11xx-macsec.c | 2 +- drivers/net/phy/nxp-c45-tja11xx.c | 2 +- drivers/net/phy/nxp-tja11xx.c | 4 +- drivers/net/phy/phy_device.c | 2 +- drivers/net/phy/qcom/at803x.c | 4 +- drivers/net/phy/qcom/qca807x.c | 6 +- drivers/net/phy/qcom/qca808x.c | 2 +- drivers/net/phy/qcom/qca83xx.c | 2 +- drivers/net/phy/realtek/realtek_main.c | 4 +- drivers/net/phy/smsc.c | 2 +- drivers/net/phy/xilinx_gmii2rgmii.c | 2 +- drivers/net/phy/xpowers/ac200.c | 2 +- drivers/net/phy/xpowers/ac300.c | 2 +- drivers/net/phy/xpowers/acx00.c | 2 +- drivers/net/pse-pd/pd692x0.c | 11 +-- drivers/net/pse-pd/pse_core.c | 12 +-- drivers/net/pse-pd/pse_regulator.c | 2 +- drivers/net/pse-pd/realtek-pse-mcu-i2c.c | 2 +- drivers/net/pse-pd/realtek-pse-mcu-uart.c | 2 +- drivers/net/pse-pd/si3474.c | 2 +- drivers/net/pse-pd/tps23881.c | 2 +- drivers/net/usb/asix_devices.c | 2 +- drivers/net/wan/framer/pef2256/pef2256.c | 2 +- drivers/net/wan/fsl_qmc_hdlc.c | 2 +- drivers/net/wan/ixp4xx_hss.c | 2 +- drivers/net/wireless/ath/ath10k/sdio.c | 6 +- drivers/net/wireless/ath/ath10k/snoc.c | 8 +- drivers/net/wireless/ath/ath10k/swap.c | 2 +- .../wireless/ath/ath9k/ath9k_pci_owl_loader.c | 2 +- drivers/net/wireless/ath/ath9k/init.c | 6 +- drivers/net/wireless/ath/ath9k/recv.c | 2 +- drivers/net/wireless/ath/carl9170/main.c | 4 +- .../wireless/broadcom/brcm80211/brcmfmac/of.c | 2 +- .../broadcom/brcm80211/brcmsmac/debug.c | 2 +- drivers/net/wireless/intel/iwlwifi/mei/main.c | 2 +- drivers/net/wireless/marvell/mwifiex/pcie.c | 2 +- drivers/net/wireless/marvell/mwifiex/sdio.c | 2 +- drivers/net/wireless/marvell/mwifiex/usb.c | 2 +- drivers/net/wireless/mediatek/mt76/mac80211.c | 10 +- .../net/wireless/mediatek/mt76/mt7615/sdio.c | 4 +- .../wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +- .../net/wireless/mediatek/mt76/mt76x02_dfs.c | 2 +- .../net/wireless/mediatek/mt76/mt7915/pci.c | 2 +- .../net/wireless/mediatek/mt76/mt7921/sdio.c | 5 +- .../wireless/mediatek/mt76/mt7925/debugfs.c | 2 +- .../net/wireless/mediatek/mt76/mt7925/main.c | 6 +- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 2 +- .../wireless/mediatek/mt76/mt792x_acpi_sar.c | 2 +- .../net/wireless/mediatek/mt76/mt792x_core.c | 3 +- .../net/wireless/mediatek/mt76/mt7996/pci.c | 2 +- drivers/net/wireless/mediatek/mt76/sdio.c | 10 +- drivers/net/wireless/mediatek/mt76/usb.c | 11 +-- drivers/net/wireless/mediatek/mt7601u/dma.c | 3 +- .../net/wireless/mediatek/mt7601u/eeprom.c | 2 +- drivers/net/wireless/mediatek/mt7601u/init.c | 6 +- drivers/net/wireless/nxp/nxpwifi/sdio.c | 6 +- drivers/net/wireless/realtek/rtw89/core.c | 4 +- drivers/net/wireless/realtek/rtw89/fw.c | 4 +- drivers/net/wireless/realtek/rtw89/phy.c | 4 +- drivers/net/wireless/silabs/wfx/bus_sdio.c | 2 +- drivers/net/wireless/silabs/wfx/bus_spi.c | 2 +- drivers/net/wireless/st/cw1200/cw1200_spi.c | 2 +- drivers/net/wireless/ti/wl1251/spi.c | 2 +- drivers/net/wireless/ti/wlcore/sdio.c | 4 +- drivers/net/wireless/ti/wlcore/spi.c | 4 +- drivers/net/wwan/mhi_wwan_mbim.c | 2 +- drivers/net/wwan/qcom_bam_dmux.c | 2 +- drivers/net/wwan/rpmsg_wwan_ctrl.c | 2 +- drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 2 +- drivers/net/wwan/t7xx/t7xx_hif_dpmaif.c | 2 +- drivers/net/wwan/t7xx/t7xx_modem_ops.c | 2 +- drivers/net/wwan/t7xx/t7xx_netdev.c | 2 +- drivers/net/wwan/t7xx/t7xx_pci.c | 2 +- drivers/net/wwan/t7xx/t7xx_port_proxy.c | 7 +- drivers/net/wwan/t7xx/t7xx_state_monitor.c | 2 +- drivers/nfc/fdp/fdp.c | 2 +- drivers/nfc/fdp/i2c.c | 2 +- drivers/nfc/microread/i2c.c | 3 +- drivers/nfc/nfcmrvl/i2c.c | 2 +- drivers/nfc/nfcmrvl/spi.c | 2 +- drivers/nfc/nfcmrvl/usb.c | 2 +- drivers/nfc/nxp-nci/core.c | 2 +- drivers/nfc/nxp-nci/i2c.c | 3 +- drivers/nfc/pn533/i2c.c | 3 +- drivers/nfc/pn533/usb.c | 2 +- drivers/nfc/pn544/i2c.c | 3 +- drivers/nfc/port100.c | 2 +- drivers/nfc/s3fwrn5/core.c | 2 +- drivers/nfc/s3fwrn5/i2c.c | 2 +- drivers/nfc/s3fwrn5/uart.c | 2 +- drivers/nfc/st-nci/core.c | 3 +- drivers/nfc/st-nci/i2c.c | 2 +- drivers/nfc/st-nci/ndlc.c | 2 +- drivers/nfc/st-nci/spi.c | 3 +- drivers/nfc/st21nfca/i2c.c | 3 +- drivers/nfc/st95hf/core.c | 4 +- drivers/nfc/trf7970a.c | 2 +- drivers/ntb/hw/epf/ntb_hw_epf.c | 2 +- drivers/ntb/hw/idt/ntb_hw_idt.c | 5 +- drivers/ntb/msi.c | 3 +- drivers/ntb/test/ntb_msi_test.c | 5 +- drivers/ntb/test/ntb_perf.c | 5 +- drivers/ntb/test/ntb_pingpong.c | 2 +- drivers/ntb/test/ntb_tool.c | 36 +++---- drivers/nvdimm/btt.c | 4 +- drivers/nvdimm/btt_devs.c | 2 +- drivers/nvdimm/dax_devs.c | 2 +- drivers/nvdimm/pfn_devs.c | 4 +- drivers/nvdimm/pmem.c | 2 +- drivers/nvdimm/virtio_pmem.c | 2 +- drivers/nvme/host/apple.c | 8 +- drivers/nvme/target/pci-epf.c | 2 +- drivers/nvmem/airoha-smc-efuses.c | 2 +- drivers/nvmem/apple-efuses.c | 2 +- drivers/nvmem/at24.c | 3 +- drivers/nvmem/at25.c | 2 +- drivers/nvmem/bcm-ocotp.c | 2 +- drivers/nvmem/brcm_nvram.c | 4 +- drivers/nvmem/core.c | 5 +- drivers/nvmem/eeprom_93xx46.c | 4 +- drivers/nvmem/imx-iim.c | 2 +- drivers/nvmem/imx-ocotp-ele.c | 2 +- drivers/nvmem/imx-ocotp-scu.c | 2 +- drivers/nvmem/imx-ocotp.c | 2 +- drivers/nvmem/jz4780-efuse.c | 2 +- drivers/nvmem/lan9662-otpc.c | 2 +- drivers/nvmem/layerscape-sfp.c | 2 +- drivers/nvmem/lpc18xx_eeprom.c | 2 +- drivers/nvmem/lpc18xx_otp.c | 2 +- drivers/nvmem/m24lr.c | 2 +- drivers/nvmem/max77759-nvmem.c | 2 +- drivers/nvmem/meson-efuse.c | 2 +- drivers/nvmem/meson-mx-efuse.c | 2 +- drivers/nvmem/microchip-otpc.c | 4 +- drivers/nvmem/mtk-efuse.c | 2 +- drivers/nvmem/mxs-ocotp.c | 2 +- drivers/nvmem/nintendo-otp.c | 2 +- drivers/nvmem/qcom-spmi-sdam.c | 2 +- drivers/nvmem/qfprom.c | 2 +- drivers/nvmem/qoriq-efuse.c | 2 +- drivers/nvmem/rave-sp-eeprom.c | 2 +- drivers/nvmem/rcar-efuse.c | 2 +- drivers/nvmem/rmem.c | 2 +- drivers/nvmem/rockchip-efuse.c | 3 +- drivers/nvmem/rockchip-otp.c | 3 +- drivers/nvmem/s32g-ocotp-nvmem.c | 2 +- drivers/nvmem/sc27xx-efuse.c | 2 +- drivers/nvmem/sec-qfprom.c | 2 +- drivers/nvmem/snvs_lpgpr.c | 2 +- drivers/nvmem/sprd-efuse.c | 2 +- drivers/nvmem/stm32-romem.c | 2 +- drivers/nvmem/sunplus-ocotp.c | 2 +- drivers/nvmem/sunxi_sid.c | 4 +- drivers/nvmem/u-boot-env.c | 2 +- drivers/nvmem/uniphier-efuse.c | 2 +- drivers/nvmem/vf610-ocotp.c | 2 +- drivers/of/unittest.c | 2 +- drivers/parisc/led.c | 2 +- drivers/parport/parport_serial.c | 2 +- drivers/pci/controller/cadence/pci-j721e.c | 4 +- drivers/pci/controller/cadence/pci-sky1.c | 4 +- .../pci/controller/cadence/pcie-cadence-ep.c | 11 +-- .../controller/cadence/pcie-cadence-plat.c | 2 +- drivers/pci/controller/cadence/pcie-cadence.c | 2 +- drivers/pci/controller/dwc/pci-dra7xx.c | 6 +- drivers/pci/controller/dwc/pci-exynos.c | 2 +- drivers/pci/controller/dwc/pci-imx6.c | 8 +- drivers/pci/controller/dwc/pci-keystone.c | 6 +- .../pci/controller/dwc/pci-layerscape-ep.c | 6 +- drivers/pci/controller/dwc/pci-layerscape.c | 4 +- drivers/pci/controller/dwc/pci-meson.c | 2 +- drivers/pci/controller/dwc/pcie-al.c | 8 +- drivers/pci/controller/dwc/pcie-amd-mdb.c | 2 +- drivers/pci/controller/dwc/pcie-andes-qilai.c | 2 +- drivers/pci/controller/dwc/pcie-armada8k.c | 4 +- drivers/pci/controller/dwc/pcie-artpec6.c | 4 +- .../controller/dwc/pcie-designware-debugfs.c | 8 +- .../pci/controller/dwc/pcie-designware-ep.c | 8 +- .../pci/controller/dwc/pcie-designware-host.c | 2 +- .../pci/controller/dwc/pcie-designware-plat.c | 4 +- drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 +- drivers/pci/controller/dwc/pcie-eswin.c | 4 +- drivers/pci/controller/dwc/pcie-fu740.c | 2 +- drivers/pci/controller/dwc/pcie-hisi.c | 6 +- drivers/pci/controller/dwc/pcie-histb.c | 4 +- drivers/pci/controller/dwc/pcie-intel-gw.c | 2 +- drivers/pci/controller/dwc/pcie-keembay.c | 2 +- drivers/pci/controller/dwc/pcie-kirin.c | 6 +- drivers/pci/controller/dwc/pcie-nxp-s32g.c | 4 +- drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 +- drivers/pci/controller/dwc/pcie-qcom.c | 14 +-- drivers/pci/controller/dwc/pcie-rcar-gen4.c | 2 +- drivers/pci/controller/dwc/pcie-sophgo.c | 2 +- drivers/pci/controller/dwc/pcie-spacemit-k1.c | 2 +- drivers/pci/controller/dwc/pcie-spear13xx.c | 4 +- drivers/pci/controller/dwc/pcie-stm32-ep.c | 2 +- drivers/pci/controller/dwc/pcie-stm32.c | 2 +- .../pci/controller/dwc/pcie-tegra194-acpi.c | 2 +- drivers/pci/controller/dwc/pcie-tegra194.c | 4 +- drivers/pci/controller/dwc/pcie-ultrarisc.c | 2 +- drivers/pci/controller/dwc/pcie-uniphier-ep.c | 2 +- drivers/pci/controller/dwc/pcie-uniphier.c | 2 +- drivers/pci/controller/dwc/pcie-visconti.c | 2 +- drivers/pci/controller/pci-host-common.c | 4 +- drivers/pci/controller/pci-loongson.c | 4 +- drivers/pci/controller/pci-mvebu.c | 2 +- drivers/pci/controller/pci-tegra.c | 34 +++---- drivers/pci/controller/pci-thunder-pem.c | 4 +- drivers/pci/controller/pci-xgene-msi.c | 3 +- drivers/pci/controller/pci-xgene.c | 2 +- drivers/pci/controller/pcie-altera-msi.c | 3 +- drivers/pci/controller/pcie-apple.c | 2 +- drivers/pci/controller/pcie-aspeed.c | 2 +- drivers/pci/controller/pcie-brcmstb.c | 2 +- drivers/pci/controller/pcie-hisi-error.c | 2 +- drivers/pci/controller/pcie-iproc-msi.c | 5 +- drivers/pci/controller/pcie-iproc.c | 5 +- drivers/pci/controller/pcie-mediatek.c | 2 +- drivers/pci/controller/pcie-mt7621.c | 2 +- drivers/pci/controller/pcie-rcar-ep.c | 10 +- drivers/pci/controller/pcie-rockchip-ep.c | 9 +- drivers/pci/controller/pcie-rzg3s-host.c | 14 +-- .../pci/controller/plda/pcie-microchip-host.c | 2 +- drivers/pci/controller/plda/pcie-starfive.c | 2 +- drivers/pci/controller/vmd.c | 5 +- drivers/pci/endpoint/functions/pci-epf-mhi.c | 2 +- drivers/pci/endpoint/functions/pci-epf-ntb.c | 4 +- drivers/pci/endpoint/functions/pci-epf-test.c | 2 +- drivers/pci/endpoint/functions/pci-epf-vntb.c | 4 +- drivers/pci/hotplug/octep_hp.c | 2 +- drivers/pci/of.c | 2 +- drivers/pci/p2pdma.c | 4 +- drivers/pci/pcie/aer.c | 2 +- drivers/pci/pcie/bwctrl.c | 3 +- drivers/pci/pwrctrl/generic.c | 2 +- drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c | 2 +- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 2 +- drivers/pcmcia/max1600.c | 2 +- drivers/pcmcia/sa1100_generic.c | 2 +- drivers/pcmcia/sa1111_jornada720.c | 2 +- drivers/peci/controller/peci-aspeed.c | 4 +- drivers/peci/controller/peci-npcm.c | 2 +- drivers/peci/cpu.c | 2 +- drivers/perf/alibaba_uncore_drw_pmu.c | 2 +- drivers/perf/amlogic/meson_ddr_pmu_core.c | 2 +- drivers/perf/arm-cci.c | 13 ++- drivers/perf/arm-ccn.c | 8 +- drivers/perf/arm-cmn.c | 9 +- drivers/perf/arm-ni.c | 4 +- drivers/perf/arm_cspmu/ampere_cspmu.c | 2 +- drivers/perf/arm_cspmu/arm_cspmu.c | 10 +- drivers/perf/arm_cspmu/nvidia_cspmu.c | 4 +- drivers/perf/arm_dmc620_pmu.c | 3 +- drivers/perf/arm_dsu_pmu.c | 2 +- drivers/perf/arm_smmuv3_pmu.c | 2 +- drivers/perf/arm_spe_pmu.c | 2 +- drivers/perf/cxl_pmu.c | 10 +- drivers/perf/dwc_pcie_pmu.c | 2 +- drivers/perf/fsl_imx8_ddr_perf.c | 2 +- drivers/perf/fsl_imx9_ddr_perf.c | 2 +- drivers/perf/fujitsu_uncore_pmu.c | 2 +- drivers/perf/hisilicon/hisi_pcie_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_cpa_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_hha_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_its_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_mn_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_noc_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_pa_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_uc_pmu.c | 2 +- drivers/perf/hisilicon/hns3_pmu.c | 2 +- drivers/perf/marvell_cn10k_ddr_pmu.c | 2 +- drivers/perf/marvell_cn10k_tad_pmu.c | 5 +- drivers/perf/marvell_pem_pmu.c | 2 +- drivers/perf/nvidia_t410_c2c_pmu.c | 2 +- drivers/perf/nvidia_t410_cmem_latency_pmu.c | 2 +- drivers/perf/qcom_l2_pmu.c | 5 +- drivers/perf/qcom_l3_pmu.c | 2 +- drivers/perf/starfive_starlink_pmu.c | 2 +- drivers/perf/thunderx2_pmu.c | 2 +- drivers/perf/xgene_pmu.c | 8 +- drivers/phy/allwinner/phy-sun4i-usb.c | 2 +- drivers/phy/allwinner/phy-sun50i-usb3.c | 2 +- drivers/phy/allwinner/phy-sun6i-mipi-dphy.c | 2 +- drivers/phy/allwinner/phy-sun9i-usb.c | 2 +- drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c | 2 +- .../amlogic/phy-meson-axg-mipi-pcie-analog.c | 2 +- drivers/phy/amlogic/phy-meson-axg-pcie.c | 2 +- .../amlogic/phy-meson-g12a-mipi-dphy-analog.c | 2 +- drivers/phy/amlogic/phy-meson-g12a-usb2.c | 2 +- .../phy/amlogic/phy-meson-g12a-usb3-pcie.c | 2 +- drivers/phy/amlogic/phy-meson-gxl-usb2.c | 2 +- drivers/phy/amlogic/phy-meson8-hdmi-tx.c | 2 +- drivers/phy/amlogic/phy-meson8b-usb2.c | 2 +- drivers/phy/apple/atc.c | 2 +- drivers/phy/aspeed/phy-aspeed-usb3.c | 2 +- drivers/phy/axiado/phy-axiado-emmc.c | 2 +- drivers/phy/broadcom/phy-bcm-cygnus-pcie.c | 2 +- drivers/phy/broadcom/phy-bcm-kona-usb2.c | 2 +- drivers/phy/broadcom/phy-bcm-ns-usb2.c | 2 +- drivers/phy/broadcom/phy-bcm-ns-usb3.c | 2 +- drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c | 6 +- drivers/phy/broadcom/phy-bcm-sr-pcie.c | 2 +- drivers/phy/broadcom/phy-bcm-sr-usb.c | 3 +- drivers/phy/broadcom/phy-bcm63xx-usbh.c | 2 +- drivers/phy/broadcom/phy-brcm-sata.c | 2 +- drivers/phy/broadcom/phy-brcm-usb.c | 2 +- drivers/phy/cadence/cdns-dphy-rx.c | 2 +- drivers/phy/cadence/cdns-dphy.c | 2 +- drivers/phy/cadence/phy-cadence-salvo.c | 2 +- drivers/phy/cadence/phy-cadence-sierra.c | 11 +-- drivers/phy/cadence/phy-cadence-torrent.c | 12 +-- drivers/phy/canaan/phy-k230-usb.c | 2 +- drivers/phy/eswin/phy-eic7700-sata.c | 2 +- .../phy/freescale/phy-fsl-imx8-mipi-dphy.c | 2 +- drivers/phy/freescale/phy-fsl-imx8m-pcie.c | 2 +- drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 4 +- drivers/phy/freescale/phy-fsl-imx8qm-hsio.c | 2 +- .../phy/freescale/phy-fsl-imx8qm-lvds-phy.c | 4 +- drivers/phy/freescale/phy-fsl-lynx-core.c | 5 +- drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 2 +- drivers/phy/hisilicon/phy-hi3660-usb3.c | 2 +- drivers/phy/hisilicon/phy-hi3670-pcie.c | 2 +- drivers/phy/hisilicon/phy-hi3670-usb3.c | 2 +- drivers/phy/hisilicon/phy-hi6220-usb.c | 2 +- drivers/phy/hisilicon/phy-hisi-inno-usb2.c | 2 +- drivers/phy/hisilicon/phy-histb-combphy.c | 2 +- drivers/phy/hisilicon/phy-hix5hd2-sata.c | 2 +- drivers/phy/ingenic/phy-ingenic-usb.c | 2 +- drivers/phy/intel/phy-intel-keembay-emmc.c | 2 +- drivers/phy/intel/phy-intel-keembay-usb.c | 2 +- drivers/phy/intel/phy-intel-lgm-combo.c | 2 +- drivers/phy/intel/phy-intel-lgm-emmc.c | 2 +- drivers/phy/lantiq/phy-lantiq-rcu-usb2.c | 2 +- drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c | 2 +- drivers/phy/marvell/phy-armada375-usb2.c | 2 +- drivers/phy/marvell/phy-armada38x-comphy.c | 2 +- drivers/phy/marvell/phy-berlin-sata.c | 7 +- drivers/phy/marvell/phy-berlin-usb.c | 2 +- drivers/phy/marvell/phy-mmp3-hsic.c | 2 +- drivers/phy/marvell/phy-mmp3-usb.c | 2 +- drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 4 +- drivers/phy/marvell/phy-mvebu-a3700-utmi.c | 2 +- drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 4 +- drivers/phy/marvell/phy-mvebu-cp110-utmi.c | 4 +- drivers/phy/marvell/phy-mvebu-sata.c | 2 +- drivers/phy/marvell/phy-pxa-28nm-hsic.c | 2 +- drivers/phy/marvell/phy-pxa-28nm-usb2.c | 2 +- drivers/phy/marvell/phy-pxa-usb.c | 2 +- drivers/phy/mediatek/phy-mtk-dp.c | 2 +- drivers/phy/mediatek/phy-mtk-hdmi.c | 2 +- drivers/phy/mediatek/phy-mtk-mipi-csi-0-5.c | 2 +- drivers/phy/mediatek/phy-mtk-mipi-dsi.c | 2 +- drivers/phy/mediatek/phy-mtk-pcie-sphy.c | 2 +- drivers/phy/mediatek/phy-mtk-pcie.c | 2 +- drivers/phy/mediatek/phy-mtk-tphy.c | 7 +- drivers/phy/mediatek/phy-mtk-ufs.c | 2 +- drivers/phy/mediatek/phy-mtk-xfi-tphy.c | 2 +- drivers/phy/mediatek/phy-mtk-xsphy.c | 4 +- drivers/phy/microchip/lan966x_serdes.c | 4 +- drivers/phy/microchip/sparx5_serdes.c | 4 +- drivers/phy/motorola/phy-cpcap-usb.c | 4 +- drivers/phy/motorola/phy-mapphone-mdm6600.c | 2 +- drivers/phy/mscc/phy-ocelot-serdes.c | 4 +- drivers/phy/nuvoton/phy-ma35d1-usb2.c | 2 +- drivers/phy/phy-airoha-pcie.c | 2 +- drivers/phy/phy-can-transceiver.c | 2 +- drivers/phy/phy-econet-pcie.c | 2 +- drivers/phy/phy-eyeq5-eth.c | 2 +- drivers/phy/phy-google-usb.c | 8 +- drivers/phy/phy-lgm-usb.c | 2 +- drivers/phy/phy-lpc18xx-usb-otg.c | 2 +- drivers/phy/phy-nxp-ptn3222.c | 2 +- drivers/phy/phy-pistachio-usb.c | 2 +- drivers/phy/phy-snps-eusb2.c | 5 +- drivers/phy/phy-xgene.c | 2 +- drivers/phy/qualcomm/phy-ath79-usb.c | 2 +- drivers/phy/qualcomm/phy-qcom-apq8064-sata.c | 2 +- drivers/phy/qualcomm/phy-qcom-edp.c | 4 +- .../phy/qualcomm/phy-qcom-eusb2-repeater.c | 4 +- drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c | 2 +- drivers/phy/qualcomm/phy-qcom-ipq806x-sata.c | 2 +- drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c | 2 +- drivers/phy/qualcomm/phy-qcom-m31-eusb2.c | 2 +- drivers/phy/qualcomm/phy-qcom-m31.c | 2 +- .../phy/qualcomm/phy-qcom-mipi-csi2-core.c | 2 +- drivers/phy/qualcomm/phy-qcom-pcie2.c | 4 +- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 7 +- .../phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c | 15 ++- .../phy/qualcomm/phy-qcom-qmp-pcie-multiphy.c | 37 ++++---- drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 9 +- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 7 +- .../phy/qualcomm/phy-qcom-qmp-usb-legacy.c | 9 +- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 7 +- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 7 +- drivers/phy/qualcomm/phy-qcom-qusb2.c | 2 +- drivers/phy/qualcomm/phy-qcom-sgmii-eth.c | 2 +- drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 4 +- .../phy/qualcomm/phy-qcom-uniphy-pcie-28lp.c | 2 +- drivers/phy/qualcomm/phy-qcom-usb-hs-28nm.c | 5 +- drivers/phy/qualcomm/phy-qcom-usb-hs.c | 2 +- drivers/phy/qualcomm/phy-qcom-usb-hsic.c | 2 +- drivers/phy/qualcomm/phy-qcom-usb-ss.c | 2 +- drivers/phy/ralink/phy-mt7621-pci.c | 2 +- drivers/phy/ralink/phy-ralink-usb.c | 2 +- drivers/phy/realtek/phy-rtk-usb2.c | 5 +- drivers/phy/realtek/phy-rtk-usb3.c | 5 +- drivers/phy/renesas/phy-rcar-gen2.c | 7 +- drivers/phy/renesas/phy-rcar-gen3-pcie.c | 2 +- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 2 +- drivers/phy/renesas/phy-rcar-gen3-usb3.c | 2 +- drivers/phy/renesas/phy-rzg3e-usb3.c | 2 +- drivers/phy/renesas/r8a779f0-ether-serdes.c | 2 +- drivers/phy/rockchip/phy-rockchip-dp.c | 2 +- drivers/phy/rockchip/phy-rockchip-dphy-rx0.c | 6 +- drivers/phy/rockchip/phy-rockchip-emmc.c | 2 +- .../phy/rockchip/phy-rockchip-inno-csidphy.c | 2 +- .../phy/rockchip/phy-rockchip-inno-dsidphy.c | 2 +- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 2 +- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 2 +- .../rockchip/phy-rockchip-naneng-combphy.c | 2 +- drivers/phy/rockchip/phy-rockchip-pcie.c | 2 +- .../phy/rockchip/phy-rockchip-samsung-dcphy.c | 2 +- .../phy/rockchip/phy-rockchip-samsung-hdptx.c | 2 +- .../phy/rockchip/phy-rockchip-snps-pcie3.c | 2 +- drivers/phy/rockchip/phy-rockchip-typec.c | 2 +- drivers/phy/rockchip/phy-rockchip-usb.c | 4 +- drivers/phy/rockchip/phy-rockchip-usbdp.c | 5 +- drivers/phy/samsung/phy-exynos-dp-video.c | 2 +- drivers/phy/samsung/phy-exynos-mipi-video.c | 2 +- drivers/phy/samsung/phy-exynos-pcie.c | 2 +- drivers/phy/samsung/phy-exynos5-usbdrd.c | 19 ++-- drivers/phy/samsung/phy-exynos5250-sata.c | 2 +- drivers/phy/samsung/phy-samsung-ufs.c | 5 +- drivers/phy/samsung/phy-samsung-usb2.c | 3 +- drivers/phy/socionext/phy-uniphier-ahci.c | 2 +- drivers/phy/socionext/phy-uniphier-pcie.c | 2 +- drivers/phy/socionext/phy-uniphier-usb2.c | 2 +- drivers/phy/socionext/phy-uniphier-usb3hs.c | 2 +- drivers/phy/socionext/phy-uniphier-usb3ss.c | 2 +- drivers/phy/sophgo/phy-cv1800-usb2.c | 2 +- drivers/phy/spacemit/phy-k1-pcie.c | 2 +- drivers/phy/spacemit/phy-k1-usb2.c | 2 +- drivers/phy/spacemit/phy-k3-combo.c | 2 +- drivers/phy/st/phy-miphy28lp.c | 5 +- drivers/phy/st/phy-spear1310-miphy.c | 2 +- drivers/phy/st/phy-spear1340-miphy.c | 2 +- drivers/phy/st/phy-stih407-usb.c | 2 +- drivers/phy/st/phy-stm32-combophy.c | 2 +- drivers/phy/st/phy-stm32-usbphyc.c | 8 +- drivers/phy/starfive/phy-jh7110-dphy-rx.c | 2 +- drivers/phy/starfive/phy-jh7110-dphy-tx.c | 2 +- drivers/phy/starfive/phy-jh7110-pcie.c | 2 +- drivers/phy/starfive/phy-jh7110-usb.c | 2 +- drivers/phy/sunplus/phy-sunplus-usb2.c | 2 +- drivers/phy/tegra/phy-tegra-mphy.c | 2 +- drivers/phy/tegra/phy-tegra194-p2u.c | 2 +- drivers/phy/tegra/xusb-tegra124.c | 2 +- drivers/phy/tegra/xusb-tegra186.c | 6 +- drivers/phy/tegra/xusb-tegra210.c | 2 +- drivers/phy/tegra/xusb.c | 14 +-- drivers/phy/ti/phy-am654-serdes.c | 4 +- drivers/phy/ti/phy-da8xx-usb.c | 2 +- drivers/phy/ti/phy-dm816x-usb.c | 4 +- drivers/phy/ti/phy-ds125df111.c | 2 +- drivers/phy/ti/phy-gmii-sel.c | 5 +- drivers/phy/ti/phy-j721e-wiz.c | 10 +- drivers/phy/ti/phy-omap-control.c | 3 +- drivers/phy/ti/phy-omap-usb2.c | 4 +- drivers/phy/ti/phy-ti-pipe3.c | 2 +- drivers/phy/ti/phy-tusb1210.c | 2 +- drivers/phy/ti/phy-twl4030-usb.c | 4 +- drivers/phy/xilinx/phy-zynqmp.c | 2 +- drivers/pinctrl/actions/pinctrl-owl.c | 9 +- drivers/pinctrl/airoha/pinctrl-airoha.c | 2 +- .../pinctrl/aspeed/pinctrl-aspeed-g7-soc1.c | 2 +- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 11 +-- drivers/pinctrl/bcm/pinctrl-bcm4908.c | 6 +- drivers/pinctrl/bcm/pinctrl-bcm6358.c | 2 +- drivers/pinctrl/bcm/pinctrl-bcm6368.c | 2 +- drivers/pinctrl/bcm/pinctrl-bcm63xx.c | 2 +- drivers/pinctrl/bcm/pinctrl-brcmstb.c | 2 +- drivers/pinctrl/bcm/pinctrl-cygnus-mux.c | 11 +-- drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 13 +-- drivers/pinctrl/bcm/pinctrl-ns.c | 7 +- drivers/pinctrl/bcm/pinctrl-ns2-mux.c | 10 +- drivers/pinctrl/bcm/pinctrl-nsp-gpio.c | 4 +- drivers/pinctrl/bcm/pinctrl-nsp-mux.c | 10 +- drivers/pinctrl/berlin/berlin-bg4ct.c | 2 +- drivers/pinctrl/berlin/berlin.c | 9 +- drivers/pinctrl/berlin/pinctrl-as370.c | 2 +- drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 2 +- drivers/pinctrl/cirrus/pinctrl-lochnagar.c | 9 +- drivers/pinctrl/cirrus/pinctrl-madera-core.c | 2 +- drivers/pinctrl/cix/pinctrl-sky1-base.c | 16 ++-- drivers/pinctrl/core.c | 2 +- drivers/pinctrl/freescale/pinctrl-imx-scmi.c | 4 +- drivers/pinctrl/freescale/pinctrl-imx.c | 22 ++--- drivers/pinctrl/freescale/pinctrl-imx1-core.c | 16 ++-- drivers/pinctrl/freescale/pinctrl-mxs.c | 21 ++--- drivers/pinctrl/intel/pinctrl-baytrail.c | 10 +- drivers/pinctrl/intel/pinctrl-cherryview.c | 13 ++- .../pinctrl/intel/pinctrl-intel-platform.c | 6 +- drivers/pinctrl/intel/pinctrl-intel.c | 20 ++-- drivers/pinctrl/intel/pinctrl-lynxpoint.c | 11 +-- drivers/pinctrl/mediatek/mtk-eint.c | 16 ++-- drivers/pinctrl/mediatek/pinctrl-moore.c | 9 +- .../pinctrl/mediatek/pinctrl-mtk-common-v2.c | 7 +- drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 20 ++-- drivers/pinctrl/mediatek/pinctrl-mtmips.c | 21 ++--- drivers/pinctrl/mediatek/pinctrl-paris.c | 16 ++-- drivers/pinctrl/meson/pinctrl-amlogic-a4.c | 15 +-- drivers/pinctrl/meson/pinctrl-meson.c | 2 +- .../pinctrl/microchip/pinctrl-mpfs-iomux0.c | 2 +- .../pinctrl/microchip/pinctrl-mpfs-mssio.c | 2 +- .../pinctrl/microchip/pinctrl-pic64gx-gpio2.c | 2 +- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 18 ++-- drivers/pinctrl/mvebu/pinctrl-armada-cp110.c | 3 +- drivers/pinctrl/mvebu/pinctrl-armada-xp.c | 3 +- drivers/pinctrl/mvebu/pinctrl-dove.c | 4 +- drivers/pinctrl/mvebu/pinctrl-mvebu.c | 20 ++-- drivers/pinctrl/nomadik/pinctrl-abx500.c | 2 +- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 2 +- drivers/pinctrl/nuvoton/pinctrl-ma35.c | 31 ++++--- drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 6 +- drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 7 +- drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 6 +- drivers/pinctrl/nxp/pinctrl-s32cc.c | 31 +++---- drivers/pinctrl/pinconf-generic.c | 4 +- drivers/pinctrl/pinctrl-ambarella.c | 5 +- drivers/pinctrl/pinctrl-amd.c | 9 +- drivers/pinctrl/pinctrl-amdisp.c | 2 +- drivers/pinctrl/pinctrl-apple-gpio.c | 12 +-- drivers/pinctrl/pinctrl-artpec6.c | 2 +- drivers/pinctrl/pinctrl-as3722.c | 2 +- drivers/pinctrl/pinctrl-at91-pio4.c | 45 ++++----- drivers/pinctrl/pinctrl-at91.c | 32 +++---- drivers/pinctrl/pinctrl-aw9523.c | 6 +- drivers/pinctrl/pinctrl-axp209.c | 4 +- drivers/pinctrl/pinctrl-bm1880.c | 2 +- drivers/pinctrl/pinctrl-cy8c95x0.c | 2 +- drivers/pinctrl/pinctrl-da850-pupd.c | 2 +- drivers/pinctrl/pinctrl-da9062.c | 2 +- drivers/pinctrl/pinctrl-digicolor.c | 7 +- drivers/pinctrl/pinctrl-eic7700.c | 4 +- drivers/pinctrl/pinctrl-ep93xx.c | 2 +- drivers/pinctrl/pinctrl-equilibrium.c | 21 ++--- drivers/pinctrl/pinctrl-eyeq5.c | 2 +- drivers/pinctrl/pinctrl-gemini.c | 2 +- drivers/pinctrl/pinctrl-generic-mux.c | 8 +- drivers/pinctrl/pinctrl-generic.c | 12 +-- drivers/pinctrl/pinctrl-ingenic.c | 14 +-- drivers/pinctrl/pinctrl-k210.c | 2 +- drivers/pinctrl/pinctrl-k230.c | 22 ++--- drivers/pinctrl/pinctrl-keembay.c | 17 ++-- drivers/pinctrl/pinctrl-loongson2.c | 2 +- drivers/pinctrl/pinctrl-lpc18xx.c | 2 +- drivers/pinctrl/pinctrl-max7360.c | 2 +- drivers/pinctrl/pinctrl-max77620.c | 2 +- drivers/pinctrl/pinctrl-mcp23s08_i2c.c | 2 +- drivers/pinctrl/pinctrl-mcp23s08_spi.c | 2 +- drivers/pinctrl/pinctrl-microchip-sgpio.c | 9 +- drivers/pinctrl/pinctrl-mlxbf3.c | 2 +- drivers/pinctrl/pinctrl-ocelot.c | 6 +- drivers/pinctrl/pinctrl-palmas.c | 2 +- drivers/pinctrl/pinctrl-pef2256.c | 2 +- drivers/pinctrl/pinctrl-pic32.c | 5 +- drivers/pinctrl/pinctrl-pistachio.c | 6 +- drivers/pinctrl/pinctrl-rk805.c | 2 +- drivers/pinctrl/pinctrl-rockchip.c | 15 +-- drivers/pinctrl/pinctrl-scmi.c | 7 +- drivers/pinctrl/pinctrl-single.c | 31 +++---- drivers/pinctrl/pinctrl-st.c | 24 ++--- drivers/pinctrl/pinctrl-stmfx.c | 2 +- drivers/pinctrl/pinctrl-sx150x.c | 2 +- drivers/pinctrl/pinctrl-tb10x.c | 5 +- drivers/pinctrl/pinctrl-th1520.c | 5 +- drivers/pinctrl/pinctrl-tps6594.c | 4 +- drivers/pinctrl/pinctrl-upboard.c | 6 +- drivers/pinctrl/pinctrl-xway.c | 5 +- drivers/pinctrl/pinctrl-zynq.c | 2 +- drivers/pinctrl/pinctrl-zynqmp.c | 14 +-- drivers/pinctrl/pinmux.c | 2 +- drivers/pinctrl/pxa/pinctrl-pxa2xx.c | 26 +++--- drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 2 +- drivers/pinctrl/qcom/pinctrl-msm.c | 5 +- drivers/pinctrl/qcom/pinctrl-qdf2xxx.c | 8 +- drivers/pinctrl/qcom/pinctrl-sc8180x.c | 2 +- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 8 +- drivers/pinctrl/qcom/pinctrl-spmi-mpp.c | 8 +- drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c | 14 +-- drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c | 14 +-- drivers/pinctrl/realtek/pinctrl-rtd.c | 2 +- drivers/pinctrl/renesas/core.c | 18 ++-- drivers/pinctrl/renesas/gpio.c | 10 +- drivers/pinctrl/renesas/pinctrl-rza1.c | 23 ++--- drivers/pinctrl/renesas/pinctrl-rza2.c | 9 +- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 80 ++++++++-------- drivers/pinctrl/renesas/pinctrl-rzn1.c | 16 +--- drivers/pinctrl/renesas/pinctrl-rzt2h.c | 8 +- drivers/pinctrl/renesas/pinctrl-rzv2m.c | 14 ++- drivers/pinctrl/renesas/pinctrl.c | 11 +-- drivers/pinctrl/samsung/pinctrl-exynos-arm.c | 2 +- drivers/pinctrl/samsung/pinctrl-exynos.c | 10 +- drivers/pinctrl/samsung/pinctrl-s3c64xx.c | 5 +- drivers/pinctrl/samsung/pinctrl-samsung.c | 15 +-- drivers/pinctrl/sophgo/pinctrl-cv18xx.c | 3 +- drivers/pinctrl/sophgo/pinctrl-sg2042-ops.c | 2 +- .../pinctrl/sophgo/pinctrl-sophgo-common.c | 8 +- drivers/pinctrl/spacemit/pinctrl-k1.c | 2 +- drivers/pinctrl/spear/pinctrl-plgpio.c | 12 +-- drivers/pinctrl/spear/pinctrl-spear.c | 2 +- drivers/pinctrl/sprd/pinctrl-sprd.c | 29 ++---- .../starfive/pinctrl-starfive-jh7100.c | 14 +-- .../starfive/pinctrl-starfive-jh7110.c | 18 ++-- .../starfive/pinctrl-starfive-jhb100.c | 8 +- drivers/pinctrl/stm32/pinctrl-stm32-hdp.c | 2 +- drivers/pinctrl/stm32/pinctrl-stm32.c | 23 ++--- drivers/pinctrl/sunplus/sppctl.c | 12 +-- drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c | 4 +- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 40 +++----- drivers/pinctrl/tegra/pinctrl-tegra-xusb.c | 2 +- drivers/pinctrl/tegra/pinctrl-tegra.c | 15 ++- drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 12 +-- drivers/pinctrl/ultrarisc/pinctrl-ultrarisc.c | 4 +- .../pinctrl/uniphier/pinctrl-uniphier-core.c | 5 +- drivers/pinctrl/visconti/pinctrl-common.c | 5 +- drivers/pinctrl/vt8500/pinctrl-vt8500.c | 2 +- drivers/pinctrl/vt8500/pinctrl-wm8505.c | 2 +- drivers/pinctrl/vt8500/pinctrl-wm8650.c | 2 +- drivers/pinctrl/vt8500/pinctrl-wm8750.c | 2 +- drivers/pinctrl/vt8500/pinctrl-wm8850.c | 2 +- drivers/platform/arm64/asus-glymur-ec.c | 2 +- drivers/platform/arm64/huawei-gaokun-ec.c | 2 +- drivers/platform/arm64/lenovo-thinkpad-t14s.c | 2 +- drivers/platform/arm64/lenovo-yoga-c630.c | 2 +- .../arm64/lenovo-yoga-slim7x-gen11-ec.c | 2 +- drivers/platform/arm64/qcom-hamoa-ec.c | 5 +- drivers/platform/chrome/cros_ec.c | 2 +- drivers/platform/chrome/cros_ec_debugfs.c | 2 +- drivers/platform/chrome/cros_ec_ishtp.c | 5 +- drivers/platform/chrome/cros_ec_lpc.c | 2 +- drivers/platform/chrome/cros_ec_rpmsg.c | 2 +- drivers/platform/chrome/cros_ec_sensorhub.c | 2 +- .../platform/chrome/cros_ec_sensorhub_ring.c | 18 ++-- drivers/platform/chrome/cros_ec_spi.c | 2 +- drivers/platform/chrome/cros_ec_typec.c | 6 +- drivers/platform/chrome/cros_ec_uart.c | 2 +- drivers/platform/chrome/cros_hps_i2c.c | 2 +- .../platform/chrome/cros_kbd_led_backlight.c | 2 +- drivers/platform/chrome/cros_typec_altmode.c | 4 +- drivers/platform/chrome/cros_typec_switch.c | 4 +- drivers/platform/chrome/cros_usbpd_logger.c | 2 +- drivers/platform/chrome/cros_usbpd_notify.c | 4 +- drivers/platform/chrome/wilco_ec/core.c | 2 +- drivers/platform/chrome/wilco_ec/debugfs.c | 2 +- .../platform/chrome/wilco_ec/keyboard_leds.c | 2 +- .../platform/cznic/turris-omnia-mcu-base.c | 2 +- drivers/platform/goldfish/goldfish_pipe.c | 2 +- drivers/platform/mellanox/mlx-platform.c | 3 +- drivers/platform/mellanox/mlxbf-pmc.c | 19 ++-- drivers/platform/mellanox/mlxbf-tmfifo.c | 2 +- drivers/platform/mellanox/mlxreg-dpu.c | 2 +- drivers/platform/mellanox/mlxreg-hotplug.c | 8 +- drivers/platform/mellanox/mlxreg-io.c | 9 +- drivers/platform/mellanox/mlxreg-lc.c | 2 +- drivers/platform/mellanox/nvsw-sn2201.c | 2 +- drivers/platform/olpc/olpc-xo175-ec.c | 2 +- .../raspberrypi/vchiq-interface/vchiq_arm.c | 4 +- drivers/platform/surface/surface3_power.c | 2 +- .../platform/surface/surface_acpi_notify.c | 2 +- .../platform/surface/surface_aggregator_hub.c | 2 +- .../surface/surface_aggregator_tabletsw.c | 2 +- drivers/platform/surface/surface_gpe.c | 2 +- drivers/platform/surface/surface_hotplug.c | 2 +- .../surface/surface_platform_profile.c | 2 +- drivers/platform/wmi/bmof.c | 2 +- drivers/platform/x86/acer-wmi-battery.c | 2 +- drivers/platform/x86/adv_swbutton.c | 2 +- drivers/platform/x86/amd/amd_halo_led.c | 2 +- drivers/platform/x86/amd/amd_isp4.c | 2 +- drivers/platform/x86/amd/hfi/hfi.c | 18 ++-- drivers/platform/x86/amd/hsmp/plat.c | 5 +- drivers/platform/x86/amd/pmc/mp2_stb.c | 2 +- drivers/platform/x86/amd/pmf/core.c | 2 +- drivers/platform/x86/amd/pmf/tee-if.c | 2 +- drivers/platform/x86/amd/x3d_vcache.c | 2 +- drivers/platform/x86/asus-tf103c-dock.c | 2 +- drivers/platform/x86/asus-wireless.c | 2 +- drivers/platform/x86/ayaneo-ec.c | 2 +- drivers/platform/x86/barco-p50-gpio.c | 2 +- drivers/platform/x86/bitland-mifs-wmi.c | 2 +- drivers/platform/x86/classmate-laptop.c | 4 +- drivers/platform/x86/compal-laptop.c | 2 +- drivers/platform/x86/dasharo-acpi.c | 2 +- .../platform/x86/dell/alienware-wmi-base.c | 2 +- .../platform/x86/dell/alienware-wmi-wmax.c | 8 +- .../platform/x86/dell/dell-dw5826e-reset.c | 2 +- drivers/platform/x86/dell/dell-rbtn.c | 2 +- drivers/platform/x86/dell/dell-smbios-base.c | 2 +- drivers/platform/x86/dell/dell-smbios-wmi.c | 3 +- drivers/platform/x86/dell/dell-smo8800.c | 2 +- .../platform/x86/dell/dell-uart-backlight.c | 2 +- drivers/platform/x86/dell/dell-wmi-aio.c | 2 +- drivers/platform/x86/dell/dell-wmi-base.c | 3 +- drivers/platform/x86/dell/dell-wmi-ddv.c | 6 +- .../platform/x86/dell/dell-wmi-descriptor.c | 2 +- drivers/platform/x86/dell/dell-wmi-privacy.c | 2 +- drivers/platform/x86/fujitsu-laptop.c | 12 +-- drivers/platform/x86/gpd-pocket-fan.c | 2 +- drivers/platform/x86/hp/hp-wmi.c | 2 +- .../platform/x86/inspur_platform_profile.c | 2 +- drivers/platform/x86/intel/bxtwc_tmu.c | 2 +- drivers/platform/x86/intel/bytcrc_pwrsrc.c | 2 +- drivers/platform/x86/intel/chtwc_int33fe.c | 2 +- .../platform/x86/intel/crystal_cove_charger.c | 2 +- drivers/platform/x86/intel/ehl_pse_io.c | 2 +- drivers/platform/x86/intel/hid.c | 2 +- drivers/platform/x86/intel/int0002_vgpio.c | 2 +- .../platform/x86/intel/int1092/intel_sar.c | 9 +- drivers/platform/x86/intel/int3472/discrete.c | 4 +- drivers/platform/x86/intel/int3472/tps68470.c | 10 +- drivers/platform/x86/intel/ishtp_eclite.c | 3 +- drivers/platform/x86/intel/plr_tpmi.c | 6 +- drivers/platform/x86/intel/pmc/core.c | 17 ++-- .../platform/x86/intel/pmc/ssram_telemetry.c | 2 +- drivers/platform/x86/intel/pmc/tgl.c | 3 +- drivers/platform/x86/intel/punit_ipc.c | 3 +- drivers/platform/x86/intel/sdsi.c | 2 +- .../intel/speed_select_if/isst_if_mbox_pci.c | 2 +- .../x86/intel/speed_select_if/isst_if_mmio.c | 2 +- .../intel/speed_select_if/isst_tpmi_core.c | 4 +- drivers/platform/x86/intel/tpmi_common.c | 6 +- .../uncore-frequency/uncore-frequency-tpmi.c | 14 +-- drivers/platform/x86/intel/vbtn.c | 2 +- drivers/platform/x86/intel/vsec.c | 2 +- drivers/platform/x86/intel/vsec_tpmi.c | 2 +- drivers/platform/x86/intel_ips.c | 2 +- drivers/platform/x86/lenovo/ideapad-laptop.c | 4 +- drivers/platform/x86/lenovo/wmi-camera.c | 2 +- drivers/platform/x86/lenovo/wmi-capdata.c | 6 +- drivers/platform/x86/lenovo/wmi-events.c | 2 +- drivers/platform/x86/lenovo/wmi-gamezone.c | 2 +- .../x86/lenovo/wmi-hotkey-utilities.c | 2 +- drivers/platform/x86/lenovo/wmi-other.c | 2 +- drivers/platform/x86/lenovo/yb9-kbdock.c | 2 +- drivers/platform/x86/lenovo/ymc.c | 2 +- .../lenovo/yoga-tab2-pro-1380-fastcharger.c | 2 +- drivers/platform/x86/lenovo/yogabook.c | 4 +- drivers/platform/x86/msi-wmi-platform.c | 4 +- drivers/platform/x86/quickstart.c | 2 +- drivers/platform/x86/redmi-wmi.c | 2 +- drivers/platform/x86/samsung-galaxybook.c | 8 +- drivers/platform/x86/sel3350-platform.c | 2 +- .../platform/x86/serial-multi-instantiate.c | 6 +- drivers/platform/x86/silicom-platform.c | 2 +- drivers/platform/x86/system76_acpi.c | 2 +- drivers/platform/x86/toshiba_haps.c | 2 +- drivers/platform/x86/tuxedo/nb04/wmi_ab.c | 4 +- drivers/platform/x86/uniwill/uniwill-acpi.c | 2 +- .../platform/x86/x86-android-tablets/other.c | 2 +- .../x86/x86-android-tablets/vexia_atla10_ec.c | 2 +- drivers/platform/x86/xiaomi-wmi.c | 2 +- drivers/platform/x86/xo15-ebook.c | 2 +- drivers/pmdomain/actions/owl-sps.c | 7 +- drivers/pmdomain/amlogic/meson-ee-pwrc.c | 12 +-- drivers/pmdomain/amlogic/meson-secure-pwrc.c | 12 +-- drivers/pmdomain/apple/pmgr-pwrstate.c | 2 +- drivers/pmdomain/arm/scmi_perf_domain.c | 6 +- drivers/pmdomain/arm/scmi_pm_domain.c | 6 +- drivers/pmdomain/arm/scpi_pm_domain.c | 6 +- drivers/pmdomain/bcm/bcm-pmb.c | 8 +- drivers/pmdomain/bcm/bcm2835-power.c | 9 +- drivers/pmdomain/bcm/bcm63xx-power.c | 12 +-- drivers/pmdomain/bcm/raspberrypi-power.c | 8 +- drivers/pmdomain/imx/imx8m-blk-ctrl.c | 11 +-- drivers/pmdomain/imx/imx8mp-blk-ctrl.c | 12 +-- drivers/pmdomain/imx/imx93-blk-ctrl.c | 13 ++- drivers/pmdomain/imx/imx93-pd.c | 2 +- drivers/pmdomain/imx/scu-pd.c | 6 +- .../marvell/pxa1908-power-controller.c | 2 +- .../pmdomain/mediatek/airoha-cpu-pmdomain.c | 2 +- drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c | 23 +++-- drivers/pmdomain/mediatek/mtk-pm-domains.c | 20 ++-- drivers/pmdomain/mediatek/mtk-scpsys.c | 8 +- drivers/pmdomain/qcom/cpr.c | 20 ++-- drivers/pmdomain/qcom/rpmhpd.c | 5 +- drivers/pmdomain/qcom/rpmpd.c | 5 +- drivers/pmdomain/renesas/r8a78000-mdlc.c | 2 +- .../pmdomain/riscv/riscv-rpmi-device-power.c | 8 +- drivers/pmdomain/rockchip/pm-domains.c | 20 ++-- drivers/pmdomain/samsung/exynos-pm-domains.c | 2 +- drivers/pmdomain/starfive/jh71xx-pmu.c | 9 +- drivers/pmdomain/sunxi/sun20i-ppu.c | 7 +- drivers/pmdomain/sunxi/sun50i-h6-prcm-ppu.c | 7 +- drivers/pmdomain/sunxi/sun55i-pck600.c | 6 +- drivers/pmdomain/tegra/powergate-bpmp.c | 2 +- drivers/pmdomain/thead/th1520-pm-domains.c | 9 +- drivers/pmdomain/ti/omap_prm.c | 6 +- drivers/pmdomain/ti/ti_sci_pm_domains.c | 8 +- drivers/pmdomain/xilinx/zynqmp-pm-domains.c | 7 +- drivers/power/reset/as3722-poweroff.c | 3 +- drivers/power/reset/at91-reset.c | 2 +- drivers/power/reset/at91-sama5d2_shdwc.c | 2 +- drivers/power/reset/atc260x-poweroff.c | 2 +- drivers/power/reset/ep93xx-restart.c | 2 +- drivers/power/reset/gemini-poweroff.c | 2 +- drivers/power/reset/gpio-poweroff.c | 2 +- drivers/power/reset/gpio-restart.c | 3 +- drivers/power/reset/ltc2952-poweroff.c | 2 +- drivers/power/reset/macsmc-reboot.c | 2 +- drivers/power/reset/mcf-rcm-reset.c | 2 +- drivers/power/reset/mt6323-poweroff.c | 2 +- drivers/power/reset/nvmem-reboot-mode.c | 2 +- drivers/power/reset/ocelot-reset.c | 2 +- .../power/reset/odroid-go-ultra-poweroff.c | 2 +- drivers/power/reset/pwr-mlxbf.c | 2 +- drivers/power/reset/qcom-pon.c | 2 +- drivers/power/reset/qemu-virt-ctrl.c | 2 +- drivers/power/reset/syscon-poweroff.c | 2 +- drivers/power/reset/syscon-reboot-mode.c | 2 +- drivers/power/reset/syscon-reboot.c | 2 +- drivers/power/reset/xgene-reboot.c | 2 +- drivers/power/sequencing/pwrseq-pcie-m2.c | 2 +- drivers/power/sequencing/pwrseq-qcom-wcn.c | 5 +- drivers/power/sequencing/pwrseq-thead-gpu.c | 2 +- drivers/power/supply/88pm860x_battery.c | 2 +- drivers/power/supply/88pm860x_charger.c | 2 +- drivers/power/supply/ab8500_btemp.c | 2 +- drivers/power/supply/ab8500_chargalg.c | 2 +- drivers/power/supply/ab8500_charger.c | 2 +- drivers/power/supply/ab8500_fg.c | 2 +- drivers/power/supply/acer_a500_battery.c | 2 +- drivers/power/supply/act8945a_charger.c | 2 +- drivers/power/supply/adp5061.c | 2 +- drivers/power/supply/axp20x_ac_power.c | 5 +- drivers/power/supply/axp20x_battery.c | 3 +- drivers/power/supply/axp20x_usb_power.c | 3 +- drivers/power/supply/axp288_charger.c | 2 +- drivers/power/supply/axp288_fuel_gauge.c | 2 +- drivers/power/supply/bd71828-power.c | 2 +- drivers/power/supply/bd99954-charger.c | 2 +- drivers/power/supply/bq2415x_charger.c | 2 +- drivers/power/supply/bq24190_charger.c | 2 +- drivers/power/supply/bq24257_charger.c | 2 +- drivers/power/supply/bq24735-charger.c | 4 +- drivers/power/supply/bq2515x_charger.c | 2 +- drivers/power/supply/bq25630_charger.c | 2 +- drivers/power/supply/bq256xx_charger.c | 2 +- drivers/power/supply/bq257xx_charger.c | 2 +- drivers/power/supply/bq25890_charger.c | 2 +- drivers/power/supply/bq25980_charger.c | 2 +- drivers/power/supply/bq27xxx_battery.c | 2 +- drivers/power/supply/bq27xxx_battery_hdq.c | 2 +- drivers/power/supply/bq27xxx_battery_i2c.c | 2 +- drivers/power/supply/chagall-battery.c | 2 +- drivers/power/supply/charger-manager.c | 30 +++--- drivers/power/supply/cpcap-battery.c | 4 +- drivers/power/supply/cpcap-charger.c | 4 +- drivers/power/supply/cros_charge-control.c | 2 +- .../power/supply/cros_peripheral_charger.c | 4 +- drivers/power/supply/cros_usbpd-charger.c | 5 +- drivers/power/supply/cw2015_battery.c | 7 +- drivers/power/supply/da9030_battery.c | 2 +- drivers/power/supply/da9052-battery.c | 3 +- drivers/power/supply/da9150-charger.c | 2 +- drivers/power/supply/da9150-fg.c | 4 +- drivers/power/supply/ds2760_battery.c | 2 +- drivers/power/supply/ds2780_battery.c | 2 +- drivers/power/supply/ds2781_battery.c | 2 +- drivers/power/supply/ds2782_battery.c | 2 +- drivers/power/supply/generic-adc-battery.c | 9 +- drivers/power/supply/goldfish_battery.c | 2 +- drivers/power/supply/gpio-charger.c | 7 +- drivers/power/supply/huawei-gaokun-battery.c | 2 +- drivers/power/supply/ingenic-battery.c | 2 +- drivers/power/supply/intel_dc_ti_battery.c | 2 +- drivers/power/supply/ip5xxx_power.c | 2 +- drivers/power/supply/ipaq_micro_battery.c | 2 +- drivers/power/supply/isp1704_charger.c | 2 +- drivers/power/supply/lego_ev3_battery.c | 2 +- .../power/supply/lenovo_yoga_c630_battery.c | 2 +- drivers/power/supply/lp8727_charger.c | 8 +- drivers/power/supply/lp8788-charger.c | 2 +- drivers/power/supply/lt3651-charger.c | 3 +- drivers/power/supply/ltc2941-battery-gauge.c | 2 +- drivers/power/supply/ltc4162-l-charger.c | 2 +- drivers/power/supply/macsmc-power.c | 12 +-- drivers/power/supply/max14577_charger.c | 4 +- .../power/supply/max14656_charger_detector.c | 2 +- drivers/power/supply/max17040_battery.c | 2 +- drivers/power/supply/max17042_battery.c | 4 +- drivers/power/supply/max1720x_battery.c | 2 +- drivers/power/supply/max1721x_battery.c | 2 +- drivers/power/supply/max77650-charger.c | 2 +- drivers/power/supply/max77693_charger.c | 2 +- drivers/power/supply/max77705_charger.c | 2 +- drivers/power/supply/max77759_charger.c | 2 +- drivers/power/supply/max77976_charger.c | 2 +- drivers/power/supply/max8903_charger.c | 9 +- drivers/power/supply/max8925_power.c | 7 +- drivers/power/supply/max8971_charger.c | 2 +- drivers/power/supply/max8997_charger.c | 2 +- drivers/power/supply/max8998_charger.c | 3 +- drivers/power/supply/mm8013.c | 2 +- drivers/power/supply/mp2629_charger.c | 2 +- drivers/power/supply/mt6360_charger.c | 2 +- drivers/power/supply/mt6370-charger.c | 2 +- drivers/power/supply/olpc_battery.c | 2 +- drivers/power/supply/pf1550-charger.c | 2 +- drivers/power/supply/pm8916_bms_vm.c | 2 +- drivers/power/supply/pm8916_lbc.c | 2 +- drivers/power/supply/power_supply_core.c | 21 ++--- drivers/power/supply/power_supply_hwmon.c | 2 +- drivers/power/supply/qcom_battmgr.c | 2 +- drivers/power/supply/qcom_smbb.c | 2 +- drivers/power/supply/qcom_smbx.c | 4 +- drivers/power/supply/rk817_charger.c | 2 +- drivers/power/supply/rn5t618_power.c | 2 +- drivers/power/supply/rt5033_battery.c | 2 +- drivers/power/supply/rt5033_charger.c | 2 +- drivers/power/supply/rt9455_charger.c | 2 +- drivers/power/supply/rt9467-charger.c | 2 +- drivers/power/supply/rt9471.c | 2 +- drivers/power/supply/rt9756.c | 4 +- drivers/power/supply/rx51_battery.c | 2 +- drivers/power/supply/s2m-charger.c | 2 +- drivers/power/supply/s2mu005-battery.c | 2 +- drivers/power/supply/sbs-battery.c | 2 +- drivers/power/supply/sbs-charger.c | 2 +- drivers/power/supply/sbs-manager.c | 2 +- drivers/power/supply/sc2731_charger.c | 2 +- drivers/power/supply/sc27xx_fuel_gauge.c | 2 +- drivers/power/supply/sgm41542_charger.c | 2 +- drivers/power/supply/smb347-charger.c | 2 +- drivers/power/supply/stc3117_fuel_gauge.c | 2 +- drivers/power/supply/surface-rt-ec.c | 2 +- drivers/power/supply/surface_battery.c | 2 +- drivers/power/supply/surface_charger.c | 2 +- drivers/power/supply/tps65090-charger.c | 4 +- drivers/power/supply/tps65217_charger.c | 2 +- drivers/power/supply/twl4030_charger.c | 4 +- drivers/power/supply/twl4030_madc_battery.c | 3 +- drivers/power/supply/twl6030_charger.c | 2 +- drivers/power/supply/ucs1002_power.c | 2 +- drivers/power/supply/ug3105_battery.c | 2 +- drivers/power/supply/wm831x_backup.c | 3 +- drivers/power/supply/wm831x_power.c | 3 +- drivers/power/supply/wm97xx_battery.c | 2 +- drivers/powercap/arm_scmi_powercap.c | 10 +- drivers/pps/clients/pps-gpio.c | 2 +- drivers/pps/generators/pps_gen_tio.c | 2 +- drivers/ptp/ptp_clockmatrix.c | 2 +- drivers/ptp/ptp_dfl_tod.c | 2 +- drivers/ptp/ptp_dte.c | 2 +- drivers/ptp/ptp_fc3.c | 2 +- drivers/ptp/ptp_idt82p33.c | 3 +- drivers/ptp/ptp_netc.c | 2 +- drivers/ptp/ptp_pch.c | 2 +- drivers/ptp/ptp_vmclock.c | 2 +- drivers/pwm/pwm-dwc.c | 2 +- drivers/pwm/pwm-lp3943.c | 7 +- drivers/pwm/pwm-sti.c | 3 +- drivers/regulator/act8865-regulator.c | 2 +- drivers/regulator/act8945a-regulator.c | 2 +- drivers/regulator/ad5398.c | 2 +- drivers/regulator/adp5055-regulator.c | 2 +- drivers/regulator/anatop-regulator.c | 2 +- drivers/regulator/arizona-ldo1.c | 4 +- drivers/regulator/arizona-micsupp.c | 4 +- drivers/regulator/as3722-regulator.c | 3 +- drivers/regulator/atc260x-regulator.c | 2 +- drivers/regulator/aw37503-regulator.c | 2 +- drivers/regulator/axp20x-regulator.c | 9 +- drivers/regulator/bcm590xx-regulator.c | 2 +- drivers/regulator/bd718x7-regulator.c | 5 +- drivers/regulator/bd9571mwv-regulator.c | 2 +- drivers/regulator/bd96801-regulator.c | 2 +- drivers/regulator/bq257xx-regulator.c | 2 +- drivers/regulator/cpcap-regulator.c | 2 +- drivers/regulator/cros-ec-regulator.c | 3 +- drivers/regulator/da9052-regulator.c | 3 +- drivers/regulator/da9055-regulator.c | 3 +- drivers/regulator/da9062-regulator.c | 4 +- drivers/regulator/da9063-regulator.c | 6 +- drivers/regulator/da9121-regulator.c | 4 +- drivers/regulator/da9210-regulator.c | 2 +- drivers/regulator/da9211-regulator.c | 4 +- drivers/regulator/devres.c | 5 +- drivers/regulator/fan53555.c | 5 +- drivers/regulator/fixed.c | 6 +- drivers/regulator/fp9931.c | 2 +- drivers/regulator/gpio-regulator.c | 17 ++-- drivers/regulator/hi6421-regulator.c | 2 +- drivers/regulator/hi6421v600-regulator.c | 2 +- drivers/regulator/irq_helpers.c | 2 +- drivers/regulator/isl6271a-regulator.c | 2 +- drivers/regulator/lp3971.c | 2 +- drivers/regulator/lp3972.c | 2 +- drivers/regulator/lp872x.c | 2 +- drivers/regulator/lp8755.c | 8 +- drivers/regulator/lp8788-buck.c | 2 +- drivers/regulator/lp8788-ldo.c | 4 +- drivers/regulator/ltc3589.c | 2 +- drivers/regulator/ltc3676.c | 2 +- drivers/regulator/max14577-regulator.c | 3 +- drivers/regulator/max1586.c | 9 +- drivers/regulator/max20086-regulator.c | 6 +- drivers/regulator/max20411-regulator.c | 2 +- drivers/regulator/max5970-regulator.c | 7 +- drivers/regulator/max77620-regulator.c | 2 +- drivers/regulator/max77650-regulator.c | 4 +- drivers/regulator/max77675-regulator.c | 2 +- drivers/regulator/max77686-regulator.c | 3 +- drivers/regulator/max77802-regulator.c | 4 +- drivers/regulator/max77826-regulator.c | 3 +- drivers/regulator/max77838-regulator.c | 3 +- drivers/regulator/max8649.c | 3 +- drivers/regulator/max8660.c | 8 +- drivers/regulator/max8907-regulator.c | 2 +- drivers/regulator/max8952.c | 5 +- drivers/regulator/max8973-regulator.c | 4 +- drivers/regulator/max8997-regulator.c | 7 +- drivers/regulator/max8998.c | 7 +- drivers/regulator/mc13783-regulator.c | 4 +- drivers/regulator/mc13892-regulator.c | 4 +- drivers/regulator/mc13xxx-regulator-core.c | 3 +- drivers/regulator/mcp16502.c | 2 +- drivers/regulator/mp886x.c | 2 +- drivers/regulator/mpq4210.c | 3 +- drivers/regulator/mpq7920.c | 3 +- drivers/regulator/mt6315-regulator.c | 4 +- drivers/regulator/mt6359-regulator.c | 6 +- drivers/regulator/mt6360-regulator.c | 2 +- drivers/regulator/mt6370-regulator.c | 2 +- drivers/regulator/of_regulator.c | 2 +- drivers/regulator/palmas-regulator.c | 6 +- drivers/regulator/pbias-regulator.c | 2 +- drivers/regulator/pca9450-regulator.c | 2 +- drivers/regulator/pf0900-regulator.c | 2 +- drivers/regulator/pf1550-regulator.c | 2 +- drivers/regulator/pf530x-regulator.c | 2 +- drivers/regulator/pf8x00-regulator.c | 2 +- drivers/regulator/pf9453-regulator.c | 2 +- drivers/regulator/pfuze100-regulator.c | 3 +- drivers/regulator/pv88060-regulator.c | 2 +- drivers/regulator/pv88080-regulator.c | 2 +- drivers/regulator/pv88090-regulator.c | 2 +- drivers/regulator/pwm-regulator.c | 2 +- drivers/regulator/qcom-labibb-regulator.c | 3 +- drivers/regulator/qcom-pm8008-regulator.c | 2 +- drivers/regulator/qcom-refgen-regulator.c | 2 +- drivers/regulator/qcom-rpmh-regulator.c | 2 +- drivers/regulator/qcom_smd-regulator.c | 2 +- drivers/regulator/qcom_spmi-regulator.c | 4 +- drivers/regulator/qcom_usb_vbus-regulator.c | 2 +- drivers/regulator/rk808-regulator.c | 2 +- .../regulator/rpi-panel-attiny-regulator.c | 2 +- drivers/regulator/rt4801-regulator.c | 2 +- drivers/regulator/rt4803.c | 2 +- drivers/regulator/rt5120-regulator.c | 2 +- drivers/regulator/rt5133-regulator.c | 2 +- drivers/regulator/rt5190a-regulator.c | 2 +- drivers/regulator/rt5739.c | 2 +- drivers/regulator/rt5759-regulator.c | 2 +- drivers/regulator/rt6160-regulator.c | 2 +- drivers/regulator/rt6190-regulator.c | 2 +- drivers/regulator/rt6245-regulator.c | 2 +- drivers/regulator/rt8092.c | 2 +- drivers/regulator/rtmv20-regulator.c | 2 +- drivers/regulator/rtq2208-regulator.c | 4 +- drivers/regulator/rtq6752-regulator.c | 2 +- drivers/regulator/s2dos05-regulator.c | 2 +- drivers/regulator/s2mpa01.c | 2 +- drivers/regulator/s2mps11.c | 3 +- drivers/regulator/s5m8767.c | 11 +-- drivers/regulator/scmi-regulator.c | 6 +- drivers/regulator/sgm3804-regulator.c | 2 +- drivers/regulator/slg51000-regulator.c | 2 +- drivers/regulator/stm32-pwr.c | 3 +- drivers/regulator/stm32-vrefbuf.c | 2 +- drivers/regulator/sy7636a-regulator.c | 2 +- drivers/regulator/sy8824x.c | 2 +- drivers/regulator/sy8827n.c | 2 +- drivers/regulator/ti-abb-regulator.c | 7 +- drivers/regulator/tps51632-regulator.c | 4 +- drivers/regulator/tps62360-regulator.c | 4 +- drivers/regulator/tps6287x-regulator.c | 2 +- drivers/regulator/tps65023-regulator.c | 2 +- drivers/regulator/tps6507x-regulator.c | 2 +- drivers/regulator/tps65090-regulator.c | 12 +-- drivers/regulator/tps65132-regulator.c | 2 +- drivers/regulator/tps65185.c | 2 +- drivers/regulator/tps65219-regulator.c | 2 +- drivers/regulator/tps6524x-regulator.c | 2 +- drivers/regulator/tps6586x-regulator.c | 2 +- drivers/regulator/tps65910-regulator.c | 23 ++--- drivers/regulator/tps6594-regulator.c | 12 +-- drivers/regulator/tps68470-regulator.c | 2 +- drivers/regulator/uniphier-regulator.c | 2 +- drivers/regulator/userspace-consumer.c | 6 +- drivers/regulator/vctrl-regulator.c | 9 +- drivers/regulator/vexpress-regulator.c | 2 +- drivers/regulator/virtual.c | 3 +- drivers/regulator/wm831x-dcdc.c | 10 +- drivers/regulator/wm831x-isink.c | 3 +- drivers/regulator/wm831x-ldo.c | 6 +- drivers/regulator/wm8994-regulator.c | 2 +- drivers/remoteproc/da8xx_remoteproc.c | 3 +- drivers/remoteproc/keystone_remoteproc.c | 3 +- drivers/remoteproc/mtk_scp.c | 2 +- drivers/remoteproc/omap_remoteproc.c | 11 +-- drivers/remoteproc/qcom_q6v5_adsp.c | 3 +- drivers/remoteproc/qcom_q6v5_pas.c | 3 +- drivers/remoteproc/qcom_wcnss.c | 5 +- drivers/remoteproc/qcom_wcnss_iris.c | 6 +- drivers/remoteproc/remoteproc_virtio.c | 2 +- drivers/remoteproc/stm32_rproc.c | 2 +- drivers/remoteproc/ti_k3_common.c | 5 +- drivers/remoteproc/ti_k3_r5_remoteproc.c | 9 +- drivers/remoteproc/ti_sci_proc.h | 2 +- drivers/remoteproc/xlnx_r5_remoteproc.c | 18 ++-- drivers/resctrl/mpam_devices.c | 4 +- drivers/reset/amlogic/reset-meson-audio-arb.c | 2 +- drivers/reset/amlogic/reset-meson-common.c | 2 +- drivers/reset/hisilicon/hi6220_reset.c | 2 +- drivers/reset/hisilicon/reset-hi3660.c | 2 +- drivers/reset/reset-a10sr.c | 3 +- drivers/reset/reset-aspeed.c | 2 +- drivers/reset/reset-ath79.c | 3 +- drivers/reset/reset-axs10x.c | 2 +- drivers/reset/reset-bcm6345.c | 3 +- drivers/reset/reset-berlin.c | 2 +- drivers/reset/reset-brcmstb-rescal.c | 2 +- drivers/reset/reset-brcmstb.c | 2 +- drivers/reset/reset-dr1v90.c | 2 +- drivers/reset/reset-eic7700-hsp.c | 2 +- drivers/reset/reset-eic7700.c | 2 +- drivers/reset/reset-eyeq.c | 2 +- drivers/reset/reset-gpio.c | 2 +- drivers/reset/reset-hsdk.c | 2 +- drivers/reset/reset-imx-scu.c | 2 +- drivers/reset/reset-imx7.c | 2 +- drivers/reset/reset-imx8mp-audiomix.c | 2 +- drivers/reset/reset-intel-gw.c | 2 +- drivers/reset/reset-k210.c | 2 +- drivers/reset/reset-k230.c | 2 +- drivers/reset/reset-lantiq.c | 2 +- drivers/reset/reset-lpc18xx.c | 2 +- drivers/reset/reset-ma35d1.c | 2 +- drivers/reset/reset-microchip-sparx5.c | 2 +- drivers/reset/reset-mpfs.c | 4 +- drivers/reset/reset-npcm.c | 2 +- drivers/reset/reset-pistachio.c | 2 +- drivers/reset/reset-qcom-aoss.c | 2 +- drivers/reset/reset-qcom-pdc.c | 2 +- drivers/reset/reset-raspberrypi.c | 2 +- drivers/reset/reset-rzg2l-usbphy-ctrl.c | 2 +- drivers/reset/reset-rzv2h-usb2phy.c | 2 +- drivers/reset/reset-scmi.c | 2 +- drivers/reset/reset-simple.c | 2 +- drivers/reset/reset-sky1-audss.c | 2 +- drivers/reset/reset-sky1.c | 2 +- drivers/reset/reset-sunplus.c | 2 +- drivers/reset/reset-tenstorrent-atlantis.c | 2 +- drivers/reset/reset-th1520.c | 2 +- drivers/reset/reset-ti-sci.c | 4 +- drivers/reset/reset-ti-syscon.c | 5 +- drivers/reset/reset-tn48m.c | 2 +- drivers/reset/reset-tps380x.c | 2 +- drivers/reset/reset-uniphier-glue.c | 2 +- drivers/reset/reset-uniphier.c | 2 +- drivers/reset/reset-zynq.c | 2 +- drivers/reset/reset-zynqmp.c | 2 +- .../reset/spacemit/reset-spacemit-common.c | 2 +- .../reset/starfive/reset-starfive-jh71x0.c | 2 +- drivers/reset/sti/reset-syscfg.c | 2 +- drivers/rpmsg/qcom_glink_native.c | 2 +- drivers/rpmsg/qcom_glink_rpm.c | 2 +- drivers/rpmsg/qcom_glink_smem.c | 4 +- drivers/rpmsg/qcom_glink_ssr.c | 2 +- drivers/rtc/rtc-88pm80x.c | 4 +- drivers/rtc/rtc-88pm860x.c | 3 +- drivers/rtc/rtc-ab-b5ze-s3.c | 2 +- drivers/rtc/rtc-ab-eoz9.c | 2 +- drivers/rtc/rtc-abx80x.c | 2 +- drivers/rtc/rtc-ac100.c | 8 +- drivers/rtc/rtc-amlogic-a4.c | 2 +- drivers/rtc/rtc-armada38x.c | 3 +- drivers/rtc/rtc-as3722.c | 2 +- drivers/rtc/rtc-asm9260.c | 2 +- drivers/rtc/rtc-aspeed.c | 2 +- drivers/rtc/rtc-at91sam9.c | 2 +- drivers/rtc/rtc-atcrtc100.c | 2 +- drivers/rtc/rtc-bd70528.c | 2 +- drivers/rtc/rtc-bq4802.c | 2 +- drivers/rtc/rtc-brcmstb-waketimer.c | 2 +- drivers/rtc/rtc-cadence.c | 2 +- drivers/rtc/rtc-cpcap.c | 2 +- drivers/rtc/rtc-cros-ec.c | 3 +- drivers/rtc/rtc-cv1800.c | 2 +- drivers/rtc/rtc-da9052.c | 2 +- drivers/rtc/rtc-da9055.c | 2 +- drivers/rtc/rtc-da9063.c | 2 +- drivers/rtc/rtc-digicolor.c | 2 +- drivers/rtc/rtc-ds1216.c | 2 +- drivers/rtc/rtc-ds1286.c | 2 +- drivers/rtc/rtc-ds1305.c | 2 +- drivers/rtc/rtc-ds1307.c | 10 +- drivers/rtc/rtc-ds1343.c | 2 +- drivers/rtc/rtc-ds1374.c | 2 +- drivers/rtc/rtc-ds1390.c | 2 +- drivers/rtc/rtc-ds1511.c | 2 +- drivers/rtc/rtc-ds1553.c | 2 +- drivers/rtc/rtc-ds1685.c | 2 +- drivers/rtc/rtc-ds1742.c | 2 +- drivers/rtc/rtc-ds2404.c | 2 +- drivers/rtc/rtc-ds3232.c | 2 +- drivers/rtc/rtc-ep93xx.c | 2 +- drivers/rtc/rtc-fm3130.c | 2 +- drivers/rtc/rtc-fsl-ftm-alarm.c | 2 +- drivers/rtc/rtc-ftrtc010.c | 2 +- drivers/rtc/rtc-gamecube.c | 2 +- drivers/rtc/rtc-goldfish.c | 2 +- drivers/rtc/rtc-hid-sensor-time.c | 4 +- drivers/rtc/rtc-hym8563.c | 2 +- drivers/rtc/rtc-imx-sm-bbm.c | 2 +- drivers/rtc/rtc-imxdi.c | 2 +- drivers/rtc/rtc-isl12022.c | 2 +- drivers/rtc/rtc-isl12026.c | 2 +- drivers/rtc/rtc-isl1208.c | 2 +- drivers/rtc/rtc-jz4740.c | 2 +- drivers/rtc/rtc-loongson.c | 2 +- drivers/rtc/rtc-lp8788.c | 2 +- drivers/rtc/rtc-lpc24xx.c | 2 +- drivers/rtc/rtc-lpc32xx.c | 2 +- drivers/rtc/rtc-m41t80.c | 3 +- drivers/rtc/rtc-m41t93.c | 2 +- drivers/rtc/rtc-m48t35.c | 2 +- drivers/rtc/rtc-m48t59.c | 5 +- drivers/rtc/rtc-m48t86.c | 2 +- drivers/rtc/rtc-ma35d1.c | 2 +- drivers/rtc/rtc-macsmc.c | 2 +- drivers/rtc/rtc-max31335.c | 2 +- drivers/rtc/rtc-max77686.c | 3 +- drivers/rtc/rtc-max8907.c | 2 +- drivers/rtc/rtc-max8925.c | 3 +- drivers/rtc/rtc-max8997.c | 3 +- drivers/rtc/rtc-max8998.c | 3 +- drivers/rtc/rtc-mc13xxx.c | 2 +- drivers/rtc/rtc-meson-vrtc.c | 2 +- drivers/rtc/rtc-meson.c | 2 +- drivers/rtc/rtc-moxart.c | 2 +- drivers/rtc/rtc-mpc5121.c | 2 +- drivers/rtc/rtc-mpfs.c | 2 +- drivers/rtc/rtc-msc313.c | 2 +- drivers/rtc/rtc-msm6242.c | 2 +- drivers/rtc/rtc-mt2712.c | 3 +- drivers/rtc/rtc-mt6397.c | 2 +- drivers/rtc/rtc-mt7622.c | 2 +- drivers/rtc/rtc-mv.c | 2 +- drivers/rtc/rtc-mxc.c | 2 +- drivers/rtc/rtc-mxc_v2.c | 2 +- drivers/rtc/rtc-nct3018y.c | 3 +- drivers/rtc/rtc-nct6694.c | 5 +- drivers/rtc/rtc-ntxec.c | 2 +- drivers/rtc/rtc-nvidia-vrs10.c | 2 +- drivers/rtc/rtc-nxp-bbnsm.c | 2 +- drivers/rtc/rtc-omap.c | 2 +- drivers/rtc/rtc-optee.c | 2 +- drivers/rtc/rtc-palmas.c | 3 +- drivers/rtc/rtc-pcf2123.c | 3 +- drivers/rtc/rtc-pcf2127.c | 2 +- drivers/rtc/rtc-pcf85063.c | 3 +- drivers/rtc/rtc-pcf8523.c | 2 +- drivers/rtc/rtc-pcf85363.c | 3 +- drivers/rtc/rtc-pcf8563.c | 3 +- drivers/rtc/rtc-pcf8583.c | 3 +- drivers/rtc/rtc-pic32.c | 2 +- drivers/rtc/rtc-pl030.c | 2 +- drivers/rtc/rtc-pl031.c | 3 +- drivers/rtc/rtc-pm8xxx.c | 2 +- drivers/rtc/rtc-pxa.c | 2 +- drivers/rtc/rtc-r7301.c | 2 +- drivers/rtc/rtc-raspberrypi.c | 2 +- drivers/rtc/rtc-rc5t583.c | 3 +- drivers/rtc/rtc-rc5t619.c | 2 +- drivers/rtc/rtc-renesas-rtca3.c | 2 +- drivers/rtc/rtc-rk808.c | 2 +- drivers/rtc/rtc-rp5c01.c | 2 +- drivers/rtc/rtc-rs5c348.c | 3 +- drivers/rtc/rtc-rs5c372.c | 3 +- drivers/rtc/rtc-rtd119x.c | 2 +- drivers/rtc/rtc-rv3028.c | 3 +- drivers/rtc/rtc-rv3029c2.c | 2 +- drivers/rtc/rtc-rv3032.c | 3 +- drivers/rtc/rtc-rv8803.c | 3 +- drivers/rtc/rtc-rx6110.c | 4 +- drivers/rtc/rtc-rx8010.c | 2 +- drivers/rtc/rtc-rx8025.c | 2 +- drivers/rtc/rtc-rx8111.c | 2 +- drivers/rtc/rtc-rzn1.c | 2 +- drivers/rtc/rtc-s32g.c | 2 +- drivers/rtc/rtc-s35390a.c | 2 +- drivers/rtc/rtc-s3c.c | 2 +- drivers/rtc/rtc-s5m.c | 2 +- drivers/rtc/rtc-sa1100.c | 2 +- drivers/rtc/rtc-sc27xx.c | 2 +- drivers/rtc/rtc-sd2405al.c | 2 +- drivers/rtc/rtc-sh.c | 2 +- drivers/rtc/rtc-snvs.c | 2 +- drivers/rtc/rtc-spacemit-p1.c | 2 +- drivers/rtc/rtc-spear.c | 2 +- drivers/rtc/rtc-ssd202d.c | 2 +- drivers/rtc/rtc-st-lpc.c | 2 +- drivers/rtc/rtc-stk17ta8.c | 2 +- drivers/rtc/rtc-stm32.c | 2 +- drivers/rtc/rtc-stmp3xxx.c | 2 +- drivers/rtc/rtc-sun6i.c | 2 +- drivers/rtc/rtc-sunplus.c | 2 +- drivers/rtc/rtc-sunxi.c | 2 +- drivers/rtc/rtc-tegra.c | 2 +- drivers/rtc/rtc-test.c | 2 +- drivers/rtc/rtc-ti-k3.c | 2 +- drivers/rtc/rtc-tps6586x.c | 2 +- drivers/rtc/rtc-tps65910.c | 3 +- drivers/rtc/rtc-tps6594.c | 2 +- drivers/rtc/rtc-twl.c | 2 +- drivers/rtc/rtc-vt8500.c | 3 +- drivers/rtc/rtc-wm831x.c | 2 +- drivers/rtc/rtc-xgene.c | 2 +- drivers/rtc/rtc-zynqmp.c | 2 +- drivers/rtc/sysfs.c | 2 +- drivers/sbus/char/display7seg.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_main.c | 5 +- drivers/scsi/isci/init.c | 4 +- drivers/scsi/isci/probe_roms.c | 2 +- drivers/slimbus/qcom-ngd-ctrl.c | 4 +- drivers/soc/amlogic/meson-canvas.c | 2 +- drivers/soc/amlogic/meson-clk-measure.c | 13 +-- drivers/soc/apple/apple-pmgr-misc.c | 2 +- drivers/soc/apple/mailbox.c | 2 +- drivers/soc/apple/sart.c | 2 +- drivers/soc/apple/tunable.c | 2 +- drivers/soc/aspeed/aspeed-lpc-ctrl.c | 2 +- drivers/soc/aspeed/aspeed-lpc-snoop.c | 2 +- drivers/soc/aspeed/aspeed-p2a-ctrl.c | 2 +- drivers/soc/aspeed/aspeed-uart-routing.c | 2 +- drivers/soc/atmel/sfr.c | 2 +- drivers/soc/cirrus/soc-ep93xx.c | 4 +- drivers/soc/fsl/dpio/dpio-driver.c | 2 +- drivers/soc/fsl/qbman/bman_portal.c | 2 +- drivers/soc/fsl/qbman/dpaa_sys.c | 2 +- drivers/soc/fsl/qbman/qman_portal.c | 2 +- drivers/soc/fsl/qe/gpio.c | 2 +- drivers/soc/fsl/qe/qe_ic.c | 2 +- drivers/soc/fsl/qe/qe_ports_ic.c | 2 +- drivers/soc/fsl/qe/qmc.c | 4 +- drivers/soc/fsl/qe/tsa.c | 2 +- drivers/soc/fsl/rcpm.c | 2 +- drivers/soc/fujitsu/a64fx-diag.c | 2 +- drivers/soc/hisilicon/kunpeng_hccs.c | 8 +- drivers/soc/imx/soc-imx8m.c | 4 +- drivers/soc/imx/soc-imx9.c | 2 +- drivers/soc/litex/litex_soc_ctrl.c | 2 +- drivers/soc/loongson/loongson2_guts.c | 2 +- drivers/soc/mediatek/mtk-devapc.c | 2 +- drivers/soc/mediatek/mtk-dvfsrc.c | 7 +- drivers/soc/mediatek/mtk-mmsys.c | 2 +- drivers/soc/mediatek/mtk-mutex.c | 2 +- drivers/soc/mediatek/mtk-pmic-wrap.c | 2 +- drivers/soc/mediatek/mtk-socinfo.c | 4 +- drivers/soc/mediatek/mtk-svs.c | 4 +- drivers/soc/pxa/ssp.c | 2 +- drivers/soc/qcom/apr.c | 2 +- drivers/soc/qcom/icc-bwmon.c | 2 +- drivers/soc/qcom/ice.c | 2 +- drivers/soc/qcom/llcc-qcom.c | 12 +-- drivers/soc/qcom/ocmem.c | 6 +- drivers/soc/qcom/pmic_glink.c | 2 +- drivers/soc/qcom/pmic_glink_altmode.c | 2 +- drivers/soc/qcom/pmic_pdcharger_ulog.c | 2 +- drivers/soc/qcom/qcom-geni-se.c | 7 +- drivers/soc/qcom/qcom-pbs.c | 2 +- drivers/soc/qcom/qcom_aoss.c | 7 +- drivers/soc/qcom/qcom_gsbi.c | 2 +- drivers/soc/qcom/qcom_stats.c | 3 +- drivers/soc/qcom/qmi_tmd.c | 2 +- drivers/soc/qcom/ramp_controller.c | 2 +- drivers/soc/qcom/rpm_master_stats.c | 2 +- drivers/soc/qcom/rpmh-rsc.c | 2 +- drivers/soc/qcom/smd-rpm.c | 2 +- drivers/soc/qcom/smem.c | 5 +- drivers/soc/qcom/smem_dramc.c | 2 +- drivers/soc/qcom/smp2p.c | 4 +- drivers/soc/qcom/smsm.c | 14 +-- drivers/soc/qcom/socinfo.c | 2 +- drivers/soc/qcom/spm.c | 4 +- drivers/soc/qcom/wcnss_ctrl.c | 2 +- drivers/soc/renesas/pwc-rzv2m.c | 2 +- drivers/soc/renesas/rcar-mfis.c | 7 +- drivers/soc/renesas/rz-sysc.c | 4 +- drivers/soc/rockchip/io-domain.c | 2 +- drivers/soc/samsung/exynos-asv.c | 2 +- drivers/soc/samsung/exynos-chipid.c | 2 +- drivers/soc/samsung/exynos-pmu.c | 3 +- drivers/soc/samsung/exynos-usi.c | 4 +- drivers/soc/starfive/socinfo/jhb100-socinfo.c | 2 +- drivers/soc/tegra/cbb/tegra194-cbb.c | 6 +- drivers/soc/tegra/cbb/tegra234-cbb.c | 2 +- drivers/soc/tegra/pmc.c | 14 +-- drivers/soc/ti/k3-ringacc.c | 4 +- drivers/soc/ti/knav_dma.c | 7 +- drivers/soc/ti/knav_qmss_acc.c | 6 +- drivers/soc/ti/knav_qmss_queue.c | 16 ++-- drivers/soc/ti/pruss.c | 5 +- drivers/soc/ti/smartreflex.c | 2 +- drivers/soc/ti/wkup_m3_ipc.c | 2 +- drivers/soc/versatile/soc-realview.c | 2 +- drivers/soc/vt8500/wmt-socinfo.c | 2 +- drivers/soc/xilinx/zynqmp_power.c | 12 +-- drivers/soundwire/amd_manager.c | 9 +- drivers/soundwire/cadence_master.c | 2 +- drivers/soundwire/intel.c | 8 +- drivers/soundwire/intel_ace2x.c | 8 +- drivers/soundwire/intel_auxdevice.c | 4 +- drivers/soundwire/mipi_disco.c | 61 +++++------- drivers/soundwire/qcom.c | 10 +- drivers/soundwire/sysfs_slave_dpn.c | 9 +- drivers/spi/spi-amlogic-spisg.c | 4 +- drivers/spi/spi-cs42l43.c | 6 +- drivers/spi/spi-dw-mmio.c | 7 +- drivers/spi/spi-dw-pci.c | 2 +- drivers/spi/spi-fsi.c | 2 +- drivers/spi/spi-fsl-dspi.c | 4 +- drivers/spi/spi-fsl-lib.c | 2 +- drivers/spi/spi-gpio.c | 5 +- drivers/spi/spi-intel.c | 11 +-- drivers/spi/spi-iproc-qspi.c | 2 +- drivers/spi/spi-kspi2.c | 4 +- drivers/spi/spi-mem.c | 2 +- drivers/spi/spi-meson-spicc.c | 8 +- drivers/spi/spi-mt65xx.c | 3 +- drivers/spi/spi-offload-trigger-pwm.c | 2 +- drivers/spi/spi-offload.c | 2 +- drivers/spi/spi-omap2-mcspi.c | 6 +- drivers/spi/spi-pci1xxxx.c | 9 +- drivers/spi/spi-pl022.c | 2 +- drivers/spi/spi-pxa2xx-pci.c | 2 +- drivers/spi/spi-pxa2xx-platform.c | 2 +- drivers/spi/spi-qcom-qspi.c | 3 +- drivers/spi/spi-qpic-snand.c | 2 +- drivers/spi/spi-s3c64xx.c | 2 +- drivers/spi/spi-sh-msiof.c | 2 +- drivers/spi/spi-slave-system-control.c | 2 +- drivers/spi/spi-slave-time.c | 2 +- drivers/spi/spi-tegra210-quad.c | 2 +- drivers/spi/spi-xlp.c | 2 +- drivers/spi/spi.c | 3 +- drivers/spmi/spmi-mtk-pmif.c | 2 +- drivers/spmi/spmi-pmic-arb.c | 16 ++-- drivers/staging/axis-fifo/axis-fifo.c | 2 +- drivers/staging/fbtft/fbtft-core.c | 11 +-- drivers/staging/greybus/audio_codec.c | 8 +- drivers/staging/greybus/audio_module.c | 4 +- drivers/staging/greybus/audio_topology.c | 24 ++--- .../staging/media/atomisp/pci/atomisp_v4l2.c | 2 +- drivers/staging/media/imx/imx-ic-common.c | 2 +- drivers/staging/media/imx/imx-ic-prp.c | 2 +- drivers/staging/media/imx/imx-ic-prpencvf.c | 2 +- drivers/staging/media/imx/imx-media-capture.c | 2 +- drivers/staging/media/imx/imx-media-csi.c | 2 +- .../staging/media/imx/imx-media-dev-common.c | 9 +- drivers/staging/media/imx/imx-media-fim.c | 2 +- drivers/staging/media/imx/imx-media-vdic.c | 2 +- drivers/staging/media/imx/imx6-mipi-csi2.c | 2 +- drivers/staging/media/ipu3/ipu3.c | 2 +- drivers/staging/media/ipu7/ipu7-fw-isys.c | 3 +- drivers/staging/media/ipu7/ipu7-isys-subdev.c | 4 +- drivers/staging/media/ipu7/ipu7-isys.c | 8 +- drivers/staging/media/ipu7/ipu7-mmu.c | 4 +- drivers/staging/media/ipu7/ipu7.c | 2 +- drivers/staging/media/meson/vdec/vdec.c | 2 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 2 +- .../staging/media/sunxi/sun6i-isp/sun6i_isp.c | 2 +- drivers/staging/media/tegra-video/csi.c | 6 +- drivers/staging/media/tegra-video/vi.c | 2 +- drivers/staging/media/tegra-video/vip.c | 2 +- drivers/staging/nvec/nvec.c | 2 +- drivers/staging/nvec/nvec_paz00.c | 2 +- drivers/staging/nvec/nvec_power.c | 2 +- drivers/staging/octeon/ethernet.c | 2 +- drivers/staging/sm750fb/sm750.c | 2 +- drivers/thermal/airoha_thermal.c | 4 +- drivers/thermal/amlogic_thermal.c | 2 +- drivers/thermal/armada_thermal.c | 9 +- drivers/thermal/broadcom/bcm2711_thermal.c | 2 +- drivers/thermal/broadcom/bcm2835_thermal.c | 4 +- drivers/thermal/broadcom/brcmstb_thermal.c | 2 +- drivers/thermal/broadcom/sr-thermal.c | 2 +- drivers/thermal/da9062-thermal.c | 3 +- drivers/thermal/db8500_thermal.c | 2 +- drivers/thermal/dove_thermal.c | 2 +- drivers/thermal/hisi_thermal.c | 7 +- drivers/thermal/imx8mm_thermal.c | 3 +- drivers/thermal/imx91_thermal.c | 2 +- drivers/thermal/imx_sc_thermal.c | 2 +- drivers/thermal/imx_thermal.c | 2 +- .../intel/int340x_thermal/int3401_thermal.c | 2 +- .../intel/int340x_thermal/int3402_thermal.c | 2 +- .../intel/int340x_thermal/int3403_thermal.c | 7 +- .../intel/int340x_thermal/int3406_thermal.c | 2 +- .../processor_thermal_device_pci.c | 4 +- .../processor_thermal_device_pci_legacy.c | 2 +- drivers/thermal/intel/intel_pch_thermal.c | 2 +- drivers/thermal/k3_bandgap.c | 4 +- drivers/thermal/k3_j72xx_bandgap.c | 7 +- drivers/thermal/khadas_mcu_fan.c | 2 +- drivers/thermal/kirkwood_thermal.c | 2 +- drivers/thermal/loongson2_thermal.c | 2 +- drivers/thermal/max77620_thermal.c | 2 +- drivers/thermal/mediatek/auxadc_thermal.c | 2 +- drivers/thermal/mediatek/lvts_thermal.c | 4 +- drivers/thermal/qcom/lmh.c | 2 +- drivers/thermal/qcom/qcom-spmi-adc-tm5-gen3.c | 6 +- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 6 +- drivers/thermal/qcom/qcom-spmi-mbg-tm.c | 2 +- drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 2 +- drivers/thermal/qcom/tsens.c | 4 +- drivers/thermal/qoriq_thermal.c | 3 +- drivers/thermal/renesas/rcar_gen3_thermal.c | 4 +- drivers/thermal/renesas/rcar_thermal.c | 4 +- drivers/thermal/renesas/rzg2l_thermal.c | 2 +- drivers/thermal/renesas/rzg3e_thermal.c | 2 +- drivers/thermal/renesas/rzg3s_thermal.c | 2 +- drivers/thermal/rockchip_thermal.c | 7 +- drivers/thermal/samsung/acpm-tmu.c | 4 +- drivers/thermal/samsung/exynos_tmu.c | 2 +- drivers/thermal/spacemit/k1_tsensor.c | 2 +- drivers/thermal/spear_thermal.c | 2 +- drivers/thermal/sprd_thermal.c | 4 +- drivers/thermal/st/st_thermal.c | 2 +- drivers/thermal/st/stm_thermal.c | 2 +- drivers/thermal/sun8i_thermal.c | 2 +- drivers/thermal/tegra/soctherm.c | 16 ++-- drivers/thermal/tegra/tegra-bpmp-thermal.c | 8 +- drivers/thermal/tegra/tegra30-tsensor.c | 2 +- drivers/thermal/thermal-generic-adc.c | 6 +- drivers/thermal/thermal_mmio.c | 2 +- drivers/thermal/ti-soc-thermal/ti-bandgap.c | 6 +- .../ti-soc-thermal/ti-thermal-common.c | 2 +- drivers/thermal/uniphier_thermal.c | 2 +- drivers/thunderbolt/dma_test.c | 2 +- drivers/thunderbolt/nhi.c | 11 +-- drivers/thunderbolt/pci.c | 2 +- drivers/tty/mips_ejtag_fdc.c | 2 +- drivers/tty/mxser.c | 3 +- drivers/tty/serial/8250/8250_aspeed_vuart.c | 2 +- drivers/tty/serial/8250/8250_bcm2835aux.c | 2 +- drivers/tty/serial/8250/8250_bcm7271.c | 3 +- drivers/tty/serial/8250/8250_dw.c | 2 +- drivers/tty/serial/8250/8250_exar.c | 2 +- drivers/tty/serial/8250/8250_fintek.c | 2 +- drivers/tty/serial/8250/8250_ingenic.c | 2 +- drivers/tty/serial/8250/8250_keba.c | 2 +- drivers/tty/serial/8250/8250_loongson.c | 2 +- drivers/tty/serial/8250/8250_lpc18xx.c | 2 +- drivers/tty/serial/8250/8250_lpss.c | 2 +- drivers/tty/serial/8250/8250_men_mcb.c | 4 +- drivers/tty/serial/8250/8250_mid.c | 6 +- drivers/tty/serial/8250/8250_mtk.c | 5 +- drivers/tty/serial/8250/8250_mxpcie.c | 2 +- drivers/tty/serial/8250/8250_ni.c | 2 +- drivers/tty/serial/8250/8250_omap.c | 2 +- drivers/tty/serial/8250/8250_pci.c | 2 +- drivers/tty/serial/8250/8250_pci1xxxx.c | 2 +- drivers/tty/serial/8250/8250_pericom.c | 2 +- drivers/tty/serial/8250/8250_pxa.c | 2 +- drivers/tty/serial/8250/8250_tegra.c | 2 +- drivers/tty/serial/8250/8250_uniphier.c | 2 +- drivers/tty/serial/amba-pl010.c | 3 +- drivers/tty/serial/amba-pl011.c | 6 +- drivers/tty/serial/ar933x_uart.c | 3 +- drivers/tty/serial/clps711x.c | 2 +- drivers/tty/serial/digicolor-usart.c | 2 +- drivers/tty/serial/fsl_linflexuart.c | 2 +- drivers/tty/serial/fsl_lpuart.c | 2 +- drivers/tty/serial/imx.c | 2 +- drivers/tty/serial/lantiq.c | 3 +- drivers/tty/serial/liteuart.c | 2 +- drivers/tty/serial/max310x.c | 2 +- drivers/tty/serial/men_z135_uart.c | 2 +- drivers/tty/serial/meson_uart.c | 2 +- drivers/tty/serial/mps2-uart.c | 2 +- drivers/tty/serial/mvebu-uart.c | 13 +-- drivers/tty/serial/mxs-auart.c | 2 +- drivers/tty/serial/omap-serial.c | 4 +- drivers/tty/serial/owl-uart.c | 2 +- drivers/tty/serial/pic32_uart.c | 2 +- drivers/tty/serial/qcom_geni_serial.c | 2 +- drivers/tty/serial/rda-uart.c | 2 +- drivers/tty/serial/rp2.c | 5 +- drivers/tty/serial/samsung_tty.c | 4 +- drivers/tty/serial/sc16is7xx.c | 2 +- drivers/tty/serial/sccnxp.c | 2 +- drivers/tty/serial/serial-tegra.c | 2 +- drivers/tty/serial/serial_mctrl_gpio.c | 2 +- drivers/tty/serial/sh-sci.c | 2 +- drivers/tty/serial/sifive.c | 2 +- drivers/tty/serial/sprd_serial.c | 2 +- drivers/tty/serial/sunplus-uart.c | 2 +- drivers/tty/serial/tegra-tcu.c | 2 +- drivers/tty/serial/tegra-utc.c | 2 +- drivers/tty/serial/uartlite.c | 3 +- drivers/tty/serial/vt8500_serial.c | 3 +- drivers/tty/serial/xilinx_uartps.c | 5 +- drivers/ufs/core/ufs-rpmb.c | 2 +- drivers/ufs/core/ufs-txeq.c | 5 +- drivers/ufs/core/ufshcd-crypto.c | 4 +- drivers/ufs/core/ufshcd.c | 3 +- drivers/ufs/host/cdns-pltfrm.c | 2 +- drivers/ufs/host/ti-j721e-ufs.c | 2 +- drivers/ufs/host/ufs-amd-versal2.c | 2 +- drivers/ufs/host/ufs-exynos.c | 4 +- drivers/ufs/host/ufs-hisi.c | 2 +- drivers/ufs/host/ufs-mediatek.c | 5 +- drivers/ufs/host/ufs-qcom.c | 6 +- drivers/ufs/host/ufs-renesas.c | 2 +- drivers/ufs/host/ufs-rockchip.c | 2 +- drivers/ufs/host/ufs-sprd.c | 2 +- drivers/ufs/host/ufshcd-pci.c | 2 +- drivers/ufs/host/ufshcd-pltfrm.c | 11 +-- drivers/uio/uio_aec.c | 2 +- drivers/uio/uio_cif.c | 2 +- drivers/uio/uio_dfl.c | 2 +- drivers/uio/uio_dmem_genirq.c | 4 +- drivers/uio/uio_fsl_elbc_gpcm.c | 4 +- drivers/uio/uio_hv_generic.c | 2 +- drivers/uio/uio_mf624.c | 2 +- drivers/uio/uio_netx.c | 2 +- drivers/uio/uio_pci_generic.c | 2 +- drivers/uio/uio_pci_generic_sva.c | 3 +- drivers/uio/uio_pdrv_genirq.c | 5 +- drivers/uio/uio_sercos3.c | 4 +- drivers/usb/cdns3/cdns3-gadget.c | 5 +- drivers/usb/cdns3/cdns3-imx.c | 2 +- drivers/usb/cdns3/cdns3-plat.c | 2 +- drivers/usb/cdns3/cdns3-starfive.c | 2 +- drivers/usb/cdns3/cdns3-ti.c | 2 +- drivers/usb/cdns3/cdnsp-gadget.c | 2 +- drivers/usb/cdns3/core.c | 2 +- drivers/usb/cdns3/host.c | 2 +- drivers/usb/chipidea/ci_hdrc_imx.c | 4 +- drivers/usb/chipidea/ci_hdrc_msm.c | 2 +- drivers/usb/chipidea/ci_hdrc_npcm.c | 2 +- drivers/usb/chipidea/ci_hdrc_pci.c | 2 +- drivers/usb/chipidea/ci_hdrc_tegra.c | 2 +- drivers/usb/chipidea/ci_hdrc_usb2.c | 4 +- drivers/usb/chipidea/core.c | 2 +- drivers/usb/chipidea/host.c | 2 +- drivers/usb/chipidea/udc.c | 2 +- drivers/usb/chipidea/usbmisc_imx.c | 2 +- drivers/usb/common/usb-conn-gpio.c | 2 +- drivers/usb/core/phy.c | 8 +- drivers/usb/dwc2/gadget.c | 12 +-- drivers/usb/dwc2/pci.c | 2 +- drivers/usb/dwc2/platform.c | 2 +- drivers/usb/dwc3/core.c | 4 +- drivers/usb/dwc3/dwc3-am62.c | 2 +- drivers/usb/dwc3/dwc3-apple.c | 2 +- drivers/usb/dwc3/dwc3-exynos.c | 2 +- drivers/usb/dwc3/dwc3-generic-plat.c | 2 +- drivers/usb/dwc3/dwc3-google.c | 2 +- drivers/usb/dwc3/dwc3-haps.c | 2 +- drivers/usb/dwc3/dwc3-imx.c | 2 +- drivers/usb/dwc3/dwc3-imx8mp.c | 2 +- drivers/usb/dwc3/dwc3-keystone.c | 2 +- drivers/usb/dwc3/dwc3-meson-g12a.c | 2 +- drivers/usb/dwc3/dwc3-octeon.c | 2 +- drivers/usb/dwc3/dwc3-of-simple.c | 2 +- drivers/usb/dwc3/dwc3-omap.c | 2 +- drivers/usb/dwc3/dwc3-pci.c | 2 +- drivers/usb/dwc3/dwc3-qcom-legacy.c | 5 +- drivers/usb/dwc3/dwc3-qcom.c | 2 +- drivers/usb/dwc3/dwc3-rtk.c | 2 +- drivers/usb/dwc3/dwc3-st.c | 2 +- drivers/usb/dwc3/dwc3-xilinx.c | 2 +- drivers/usb/fotg210/fotg210-core.c | 2 +- drivers/usb/gadget/udc/aspeed-vhub/core.c | 9 +- drivers/usb/gadget/udc/aspeed_udc.c | 2 +- drivers/usb/gadget/udc/at91_udc.c | 2 +- drivers/usb/gadget/udc/atmel_usba_udc.c | 5 +- drivers/usb/gadget/udc/bcm63xx_udc.c | 2 +- drivers/usb/gadget/udc/bdc/bdc_core.c | 5 +- drivers/usb/gadget/udc/cdns2/cdns2-pci.c | 2 +- drivers/usb/gadget/udc/gr_udc.c | 2 +- drivers/usb/gadget/udc/max3420_udc.c | 2 +- drivers/usb/gadget/udc/pch_udc.c | 2 +- drivers/usb/gadget/udc/r8a66597-udc.c | 2 +- drivers/usb/gadget/udc/renesas_usb3.c | 6 +- drivers/usb/gadget/udc/renesas_usbf.c | 2 +- drivers/usb/gadget/udc/rzv2m_usb3drd.c | 2 +- drivers/usb/gadget/udc/snps_udc_plat.c | 2 +- drivers/usb/gadget/udc/tegra-xudc.c | 22 ++--- drivers/usb/gadget/udc/udc-xilinx.c | 5 +- drivers/usb/host/bcma-hcd.c | 3 +- drivers/usb/host/ehci-sh.c | 3 +- drivers/usb/host/max3421-hcd.c | 2 +- drivers/usb/host/ohci-at91.c | 2 +- drivers/usb/host/ohci-pxa27x.c | 2 +- drivers/usb/host/oxu210hp-hcd.c | 2 +- drivers/usb/host/ssb-hcd.c | 3 +- drivers/usb/host/xhci-histb.c | 2 +- drivers/usb/host/xhci-mtk.c | 2 +- drivers/usb/host/xhci-tegra.c | 27 +++--- drivers/usb/isp1760/isp1760-core.c | 2 +- drivers/usb/misc/lvstest.c | 2 +- drivers/usb/misc/onboard_usb_dev.c | 2 +- drivers/usb/misc/qcom_eud.c | 2 +- drivers/usb/misc/usb-ljca.c | 2 +- drivers/usb/misc/usb251xb.c | 4 +- drivers/usb/misc/usb3503.c | 4 +- drivers/usb/misc/usb4604.c | 2 +- drivers/usb/misc/usbio.c | 2 +- drivers/usb/mtu3/mtu3_core.c | 2 +- drivers/usb/mtu3/mtu3_debugfs.c | 4 +- drivers/usb/mtu3/mtu3_plat.c | 6 +- drivers/usb/musb/da8xx.c | 4 +- drivers/usb/musb/jz4740.c | 2 +- drivers/usb/musb/mediatek.c | 4 +- drivers/usb/musb/mpfs.c | 4 +- drivers/usb/musb/musb_core.c | 4 +- drivers/usb/musb/musb_dsps.c | 4 +- drivers/usb/musb/omap2430.c | 8 +- drivers/usb/musb/sunxi.c | 2 +- drivers/usb/musb/tusb6010.c | 2 +- drivers/usb/musb/ux500.c | 4 +- drivers/usb/phy/phy-ab8500-usb.c | 4 +- drivers/usb/phy/phy-am335x-control.c | 2 +- drivers/usb/phy/phy-am335x.c | 2 +- drivers/usb/phy/phy-generic.c | 5 +- drivers/usb/phy/phy-gpio-vbus-usb.c | 6 +- drivers/usb/phy/phy-isp1301.c | 2 +- drivers/usb/phy/phy-keystone.c | 2 +- drivers/usb/phy/phy-mxs-usb.c | 2 +- drivers/usb/phy/phy-omap-otg.c | 2 +- drivers/usb/phy/phy-tahvo.c | 5 +- drivers/usb/phy/phy-tegra-usb.c | 5 +- drivers/usb/phy/phy-twl6030-usb.c | 2 +- drivers/usb/phy/phy-ulpi.c | 4 +- drivers/usb/renesas_usbhs/common.c | 2 +- .../usb/roles/intel-xhci-usb-role-switch.c | 2 +- drivers/usb/serial/f81232.c | 2 +- drivers/usb/serial/f81534.c | 5 +- drivers/usb/serial/mxuport.c | 3 +- drivers/usb/typec/altmodes/displayport.c | 2 +- drivers/usb/typec/altmodes/thunderbolt.c | 2 +- drivers/usb/typec/anx7411.c | 2 +- drivers/usb/typec/hd3ss3220.c | 3 +- drivers/usb/typec/mux/fsa4480.c | 2 +- drivers/usb/typec/mux/gpio-sbu-mux.c | 2 +- drivers/usb/typec/mux/intel_pmc_mux.c | 2 +- drivers/usb/typec/mux/it5205.c | 2 +- drivers/usb/typec/mux/nb7vpq904m.c | 2 +- drivers/usb/typec/mux/pi3usb30532.c | 2 +- drivers/usb/typec/mux/ps883x.c | 2 +- drivers/usb/typec/mux/ptn36502.c | 2 +- drivers/usb/typec/mux/tusb1046.c | 2 +- drivers/usb/typec/mux/wcd939x-usbss.c | 2 +- drivers/usb/typec/rt1719.c | 2 +- drivers/usb/typec/stusb160x.c | 2 +- drivers/usb/typec/tcpm/fusb302.c | 2 +- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 2 +- .../typec/tcpm/qcom/qcom_pmic_typec_pdphy.c | 5 +- .../typec/tcpm/qcom/qcom_pmic_typec_port.c | 5 +- drivers/usb/typec/tcpm/tcpci.c | 4 +- drivers/usb/typec/tcpm/tcpci_maxim_core.c | 2 +- drivers/usb/typec/tcpm/tcpci_mt6360.c | 2 +- drivers/usb/typec/tcpm/tcpci_mt6370.c | 2 +- drivers/usb/typec/tcpm/tcpci_rt1711h.c | 2 +- drivers/usb/typec/tcpm/tcpm.c | 12 +-- drivers/usb/typec/tcpm/wcove.c | 2 +- drivers/usb/typec/ucsi/cros_ec_ucsi.c | 2 +- drivers/usb/typec/ucsi/displayport.c | 2 +- drivers/usb/typec/ucsi/thunderbolt.c | 2 +- drivers/usb/typec/ucsi/ucsi_acpi.c | 2 +- drivers/usb/typec/ucsi/ucsi_ccg.c | 2 +- drivers/usb/typec/ucsi/ucsi_glink.c | 2 +- drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c | 5 +- drivers/usb/typec/ucsi/ucsi_stm32g0.c | 2 +- drivers/usb/typec/ucsi/ucsi_yoga_c630.c | 2 +- drivers/usb/typec/wusb3801.c | 2 +- drivers/vdpa/alibaba/eni_vdpa.c | 5 +- drivers/vdpa/octeon_ep/octep_vdpa_hw.c | 3 +- drivers/vdpa/octeon_ep/octep_vdpa_main.c | 6 +- drivers/vdpa/virtio_pci/vp_vdpa.c | 5 +- drivers/video/aperture.c | 2 +- drivers/video/backlight/88pm860x_bl.c | 3 +- drivers/video/backlight/aat2870_bl.c | 4 +- drivers/video/backlight/adp5520_bl.c | 2 +- drivers/video/backlight/adp8860_bl.c | 5 +- drivers/video/backlight/adp8870_bl.c | 5 +- drivers/video/backlight/ams369fg06.c | 2 +- drivers/video/backlight/apple_dwi_bl.c | 2 +- drivers/video/backlight/arcxcnn_bl.c | 7 +- drivers/video/backlight/as3711_bl.c | 2 +- drivers/video/backlight/aw99706.c | 2 +- drivers/video/backlight/bd6107.c | 2 +- drivers/video/backlight/cgbc_bl.c | 2 +- drivers/video/backlight/corgi_lcd.c | 2 +- drivers/video/backlight/da903x_bl.c | 2 +- drivers/video/backlight/da9052_bl.c | 2 +- drivers/video/backlight/ep93xx_bl.c | 2 +- drivers/video/backlight/gpio_backlight.c | 2 +- drivers/video/backlight/hx8357.c | 2 +- drivers/video/backlight/ili922x.c | 2 +- drivers/video/backlight/ili9320.c | 2 +- drivers/video/backlight/ktd253-backlight.c | 2 +- drivers/video/backlight/ktd2801-backlight.c | 2 +- drivers/video/backlight/ktz8866.c | 2 +- drivers/video/backlight/l4f00242t03.c | 3 +- drivers/video/backlight/led_bl.c | 8 +- drivers/video/backlight/lm3509_bl.c | 2 +- drivers/video/backlight/lm3533_bl.c | 2 +- drivers/video/backlight/lm3630a_bl.c | 8 +- drivers/video/backlight/lm3639_bl.c | 3 +- drivers/video/backlight/lms283gf05.c | 3 +- drivers/video/backlight/lms501kf03.c | 2 +- drivers/video/backlight/lp855x_bl.c | 6 +- drivers/video/backlight/lp8788_bl.c | 2 +- drivers/video/backlight/ltv350qv.c | 2 +- drivers/video/backlight/lv5207lp.c | 2 +- drivers/video/backlight/max25014.c | 2 +- drivers/video/backlight/max8925_bl.c | 7 +- drivers/video/backlight/mp3309c.c | 6 +- drivers/video/backlight/mt6370-backlight.c | 2 +- drivers/video/backlight/omap1_bl.c | 3 +- drivers/video/backlight/otm3225a.c | 2 +- drivers/video/backlight/pandora_bl.c | 2 +- drivers/video/backlight/platform_lcd.c | 3 +- drivers/video/backlight/pwm_bl.c | 12 +-- drivers/video/backlight/qcom-wled.c | 2 +- drivers/video/backlight/rt4831-backlight.c | 2 +- drivers/video/backlight/sky81452-backlight.c | 2 +- drivers/video/backlight/sy7758.c | 2 +- drivers/video/backlight/tdo24m.c | 2 +- drivers/video/backlight/tps65217_bl.c | 5 +- drivers/video/backlight/wm831x_bl.c | 2 +- drivers/video/fbdev/atmel_lcdfb.c | 2 +- drivers/video/fbdev/au1100fb.c | 2 +- drivers/video/fbdev/imxfb.c | 3 +- drivers/video/fbdev/mmp/hw/mmp_ctrl.c | 4 +- drivers/video/fbdev/ocfb.c | 2 +- .../omapfb/displays/connector-analog-tv.c | 2 +- .../omap2/omapfb/displays/connector-dvi.c | 2 +- .../omap2/omapfb/displays/connector-hdmi.c | 2 +- .../omap2/omapfb/displays/encoder-opa362.c | 2 +- .../omap2/omapfb/displays/encoder-tfp410.c | 2 +- .../omap2/omapfb/displays/encoder-tpd12s015.c | 2 +- .../fbdev/omap2/omapfb/displays/panel-dpi.c | 2 +- .../omap2/omapfb/displays/panel-dsi-cm.c | 2 +- .../displays/panel-lgphilips-lb035q02.c | 2 +- .../omapfb/displays/panel-nec-nl8048hl11.c | 2 +- .../omapfb/displays/panel-sharp-ls037v7dw01.c | 2 +- .../omapfb/displays/panel-sony-acx565akm.c | 2 +- .../omapfb/displays/panel-tpo-td028ttec1.c | 2 +- .../omapfb/displays/panel-tpo-td043mtea1.c | 2 +- drivers/video/fbdev/omap2/omapfb/dss/dpi.c | 4 +- drivers/video/fbdev/omap2/omapfb/dss/dsi.c | 2 +- .../video/fbdev/omap2/omapfb/dss/video-pll.c | 2 +- .../video/fbdev/omap2/omapfb/omapfb-main.c | 3 +- drivers/video/fbdev/omap2/omapfb/vrfb.c | 4 +- drivers/video/fbdev/pxa3xx-gcu.c | 2 +- drivers/video/fbdev/pxafb.c | 7 +- drivers/video/fbdev/s3c-fb.c | 2 +- drivers/video/fbdev/sa1100fb.c | 2 +- drivers/video/fbdev/simplefb.c | 11 +-- drivers/video/fbdev/ssd1307fb.c | 3 +- drivers/video/fbdev/xilinxfb.c | 2 +- drivers/virt/coco/sev-guest/sev-guest.c | 2 +- drivers/virt/vboxguest/vboxguest_core.c | 4 +- drivers/virt/vboxguest/vboxguest_linux.c | 2 +- drivers/virt/vmgenid.c | 2 +- drivers/virtio/virtio_rtc_class.c | 3 +- drivers/virtio/virtio_rtc_driver.c | 10 +- drivers/virtio/virtio_rtc_ptp.c | 2 +- drivers/w1/masters/amd_axi_w1.c | 2 +- drivers/w1/masters/ds2482.c | 2 +- drivers/w1/masters/mxc_w1.c | 3 +- drivers/w1/masters/omap_hdq.c | 2 +- drivers/w1/masters/sgi_w1.c | 3 +- drivers/w1/masters/w1-gpio.c | 4 +- drivers/w1/masters/w1-uart.c | 2 +- drivers/w1/slaves/w1_ds250x.c | 2 +- drivers/w1/slaves/w1_ds28e17.c | 2 +- drivers/watchdog/airoha_wdt.c | 2 +- drivers/watchdog/apple_wdt.c | 2 +- drivers/watchdog/arm_smc_wdt.c | 2 +- drivers/watchdog/armada_37xx_wdt.c | 3 +- drivers/watchdog/asm9260_wdt.c | 2 +- drivers/watchdog/aspeed_wdt.c | 2 +- drivers/watchdog/at91sam9_wdt.c | 2 +- drivers/watchdog/atcwdt200_wdt.c | 2 +- drivers/watchdog/bcm2835_wdt.c | 2 +- drivers/watchdog/bcm7038_wdt.c | 2 +- drivers/watchdog/bcm_kona_wdt.c | 2 +- drivers/watchdog/bd9576_wdt.c | 2 +- drivers/watchdog/bd96801_wdt.c | 2 +- drivers/watchdog/cadence_wdt.c | 2 +- drivers/watchdog/cgbc_wdt.c | 2 +- drivers/watchdog/cpwd.c | 2 +- drivers/watchdog/cros_ec_wdt.c | 2 +- drivers/watchdog/da9052_wdt.c | 2 +- drivers/watchdog/da9055_wdt.c | 2 +- drivers/watchdog/da9062_wdt.c | 2 +- drivers/watchdog/da9063_wdt.c | 2 +- drivers/watchdog/davinci_wdt.c | 2 +- drivers/watchdog/digicolor_wdt.c | 2 +- drivers/watchdog/dw_wdt.c | 4 +- drivers/watchdog/ebc-c384_wdt.c | 2 +- drivers/watchdog/ep93xx_wdt.c | 2 +- drivers/watchdog/f71808e_wdt.c | 2 +- drivers/watchdog/ftwdt010_wdt.c | 2 +- drivers/watchdog/gpio_wdt.c | 2 +- drivers/watchdog/gunyah_wdt.c | 2 +- drivers/watchdog/gxp-wdt.c | 2 +- drivers/watchdog/i6300esb.c | 2 +- drivers/watchdog/iTCO_wdt.c | 2 +- drivers/watchdog/imgpdc_wdt.c | 2 +- drivers/watchdog/imx2_wdt.c | 2 +- drivers/watchdog/imx7ulp_wdt.c | 2 +- drivers/watchdog/imx_sc_wdt.c | 2 +- drivers/watchdog/intel-mid_wdt.c | 2 +- drivers/watchdog/intel_oc_wdt.c | 2 +- drivers/watchdog/ixp4xx_wdt.c | 2 +- drivers/watchdog/jz4740_wdt.c | 3 +- drivers/watchdog/keembay_wdt.c | 2 +- drivers/watchdog/kempld_wdt.c | 2 +- drivers/watchdog/lantiq_wdt.c | 2 +- drivers/watchdog/lenovo_se10_wdt.c | 2 +- drivers/watchdog/lenovo_se30_wdt.c | 2 +- drivers/watchdog/lenovo_se30g2_se60_wdt.c | 2 +- drivers/watchdog/loongson1_wdt.c | 2 +- drivers/watchdog/lpc18xx_wdt.c | 2 +- drivers/watchdog/ma35d1_wdt.c | 2 +- drivers/watchdog/marvell_gti_wdt.c | 2 +- drivers/watchdog/max63xx_wdt.c | 2 +- drivers/watchdog/max77620_wdt.c | 2 +- drivers/watchdog/mena21_wdt.c | 2 +- drivers/watchdog/menf21bmc_wdt.c | 2 +- drivers/watchdog/menz69_wdt.c | 2 +- drivers/watchdog/meson_gxbb_wdt.c | 2 +- drivers/watchdog/meson_wdt.c | 2 +- drivers/watchdog/mlx_wdt.c | 2 +- drivers/watchdog/moxart_wdt.c | 2 +- drivers/watchdog/mpc8xxx_wdt.c | 2 +- drivers/watchdog/msc313e_wdt.c | 2 +- drivers/watchdog/mt7621_wdt.c | 2 +- drivers/watchdog/mtk_wdt.c | 2 +- drivers/watchdog/nct6694_wdt.c | 5 +- drivers/watchdog/ni903x_wdt.c | 2 +- drivers/watchdog/nic7018_wdt.c | 2 +- drivers/watchdog/npcm_wdt.c | 2 +- drivers/watchdog/of_xilinx_wdt.c | 2 +- drivers/watchdog/omap_wdt.c | 2 +- drivers/watchdog/orion_wdt.c | 3 +- drivers/watchdog/pic32-dmt.c | 2 +- drivers/watchdog/pic32-wdt.c | 2 +- drivers/watchdog/pm8916_wdt.c | 2 +- drivers/watchdog/pseries-wdt.c | 2 +- drivers/watchdog/qcom-wdt.c | 2 +- drivers/watchdog/rave-sp-wdt.c | 2 +- drivers/watchdog/realtek_otto_wdt.c | 2 +- drivers/watchdog/renesas_wdt.c | 2 +- drivers/watchdog/renesas_wwdt.c | 2 +- drivers/watchdog/retu_wdt.c | 4 +- drivers/watchdog/riowd.c | 2 +- drivers/watchdog/rn5t618_wdt.c | 2 +- drivers/watchdog/rt2880_wdt.c | 2 +- drivers/watchdog/rtd119x_wdt.c | 2 +- drivers/watchdog/rti_wdt.c | 2 +- drivers/watchdog/rza_wdt.c | 2 +- drivers/watchdog/rzg2l_wdt.c | 2 +- drivers/watchdog/rzn1_wdt.c | 2 +- drivers/watchdog/rzv2h_wdt.c | 2 +- drivers/watchdog/s32g_wdt.c | 2 +- drivers/watchdog/s3c2410_wdt.c | 2 +- drivers/watchdog/sama5d4_wdt.c | 2 +- drivers/watchdog/sbsa_gwdt.c | 2 +- drivers/watchdog/shwdt.c | 2 +- drivers/watchdog/sl28cpld_wdt.c | 2 +- drivers/watchdog/sp5100_tco.c | 2 +- drivers/watchdog/sp805_wdt.c | 2 +- drivers/watchdog/sprd_wdt.c | 2 +- drivers/watchdog/st_lpc_wdt.c | 2 +- drivers/watchdog/starfive-wdt.c | 2 +- drivers/watchdog/stm32_iwdg.c | 2 +- drivers/watchdog/stpmic1_wdt.c | 2 +- drivers/watchdog/sunplus_wdt.c | 2 +- drivers/watchdog/sunxi_wdt.c | 2 +- drivers/watchdog/tegra_wdt.c | 2 +- drivers/watchdog/tqmx86_wdt.c | 2 +- drivers/watchdog/ts4800_wdt.c | 2 +- drivers/watchdog/ts72xx_wdt.c | 2 +- drivers/watchdog/twl4030_wdt.c | 2 +- drivers/watchdog/uniphier_wdt.c | 2 +- drivers/watchdog/visconti_wdt.c | 2 +- drivers/watchdog/wdat_wdt.c | 11 +-- drivers/watchdog/wm831x_wdt.c | 2 +- drivers/watchdog/xilinx_wwdt.c | 2 +- drivers/watchdog/ziirave_wdt.c | 2 +- drivers/xen/grant-dma-iommu.c | 2 +- drivers/xen/grant-dma-ops.c | 2 +- fs/debugfs/file.c | 2 +- fs/fuse/virtio_fs.c | 2 +- include/drm/drm_kunit_helpers.h | 2 +- include/sound/cs35l56.h | 6 +- kernel/dma/map_benchmark.c | 2 +- kernel/irq/devres.c | 2 +- kernel/power/energy_model.c | 3 +- net/bluetooth/leds.c | 2 +- net/dsa/conduit.c | 2 +- net/nfc/nci/rsp.c | 13 +-- net/nfc/nci/spi.c | 2 +- net/qrtr/mhi.c | 2 +- net/qrtr/smd.c | 2 +- net/rfkill/rfkill-gpio.c | 2 +- sound/drivers/serial-u16550.c | 2 +- sound/firewire/bebob/bebob_maudio.c | 3 +- .../motu/motu-command-dsp-message-parser.c | 2 +- .../motu/motu-register-dsp-message-parser.c | 2 +- sound/firewire/oxfw/oxfw-scs1x.c | 3 +- sound/firewire/oxfw/oxfw-spkr.c | 3 +- sound/hda/codecs/generic.c | 2 +- sound/hda/codecs/side-codecs/aw88399_hda.c | 4 +- .../codecs/side-codecs/cirrus_scodec_test.c | 2 +- sound/hda/codecs/side-codecs/cs35l41_hda.c | 2 +- .../codecs/side-codecs/cs35l41_hda_property.c | 17 ++-- .../hda/codecs/side-codecs/cs35l56_hda_i2c.c | 2 +- .../hda/codecs/side-codecs/cs35l56_hda_spi.c | 2 +- sound/hda/codecs/side-codecs/hda_component.c | 2 +- .../hda/codecs/side-codecs/tas2781_hda_i2c.c | 4 +- .../hda/codecs/side-codecs/tas2781_hda_spi.c | 6 +- sound/hda/controllers/acpi.c | 5 +- sound/hda/controllers/cix-ipbloq.c | 2 +- sound/hda/controllers/intel.c | 2 +- sound/hda/controllers/tegra.c | 2 +- sound/isa/sb/emu8000.c | 2 +- sound/isa/sb/sb_common.c | 2 +- sound/isa/wss/wss_lib.c | 2 +- sound/pci/cs46xx/cs46xx_lib.c | 6 +- sound/pci/maestro3.c | 4 +- sound/pci/rme9652/hdspm.c | 2 +- sound/soc/adi/axi-i2s.c | 2 +- sound/soc/adi/axi-spdif.c | 2 +- sound/soc/amd/acp-da7219-max98357a.c | 3 +- sound/soc/amd/acp-es8336.c | 2 +- sound/soc/amd/acp-pcm-dma.c | 3 +- sound/soc/amd/acp/acp-legacy-mach.c | 2 +- sound/soc/amd/acp/acp-mach-common.c | 4 +- sound/soc/amd/acp/acp-pci.c | 4 +- sound/soc/amd/acp/acp-sdw-legacy-mach.c | 24 ++--- sound/soc/amd/acp/acp-sdw-sof-mach.c | 16 ++-- sound/soc/amd/acp/acp-sof-mach.c | 2 +- sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c | 2 +- sound/soc/amd/acp3x-rt5682-max9836.c | 2 +- sound/soc/amd/acp7x/pci-acp7x.c | 6 +- sound/soc/amd/ps/pci-ps.c | 8 +- sound/soc/amd/ps/ps-pdm-dma.c | 2 +- sound/soc/amd/ps/ps-sdw-dma.c | 2 +- sound/soc/amd/raven/acp3x-i2s.c | 3 +- sound/soc/amd/raven/acp3x-pcm-dma.c | 2 +- sound/soc/amd/raven/pci-acp3x.c | 3 +- sound/soc/amd/renoir/acp3x-pdm-dma.c | 2 +- sound/soc/amd/renoir/rn-pci-acp3x.c | 3 +- sound/soc/amd/vangogh/acp5x-i2s.c | 3 +- sound/soc/amd/vangogh/acp5x-mach.c | 2 +- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 2 +- sound/soc/amd/vangogh/pci-acp5x.c | 3 +- sound/soc/amd/yc/acp6x-pdm-dma.c | 2 +- sound/soc/amd/yc/pci-acp6x.c | 7 +- sound/soc/apple/mca.c | 3 +- sound/soc/atmel/atmel-classd.c | 8 +- sound/soc/atmel/atmel-i2s.c | 2 +- sound/soc/atmel/atmel-pdmic.c | 10 +- sound/soc/atmel/mchp-i2s-mcc.c | 2 +- sound/soc/atmel/mchp-pdmc.c | 2 +- sound/soc/atmel/mchp-spdifrx.c | 2 +- sound/soc/atmel/mchp-spdiftx.c | 2 +- sound/soc/atmel/mikroe-proto.c | 2 +- sound/soc/atmel/sam9x5_wm8731.c | 6 +- sound/soc/atmel/tse850-pcm5142.c | 2 +- sound/soc/au1x/ac97c.c | 2 +- sound/soc/au1x/dbdma2.c | 4 +- sound/soc/au1x/dma.c | 2 +- sound/soc/au1x/i2sc.c | 2 +- sound/soc/au1x/psc-ac97.c | 3 +- sound/soc/au1x/psc-i2s.c | 3 +- sound/soc/bcm/bcm2835-i2s.c | 3 +- sound/soc/bcm/bcm63xx-i2s-whistler.c | 2 +- sound/soc/bcm/cygnus-ssp.c | 2 +- sound/soc/cirrus/ep93xx-i2s.c | 2 +- sound/soc/codecs/88pm860x-codec.c | 3 +- sound/soc/codecs/ab8500-codec.c | 3 +- sound/soc/codecs/ad1836.c | 3 +- sound/soc/codecs/ad193x.c | 2 +- sound/soc/codecs/adau1372.c | 2 +- sound/soc/codecs/adau1373.c | 2 +- sound/soc/codecs/adau1701.c | 2 +- sound/soc/codecs/adau17x1.c | 2 +- sound/soc/codecs/adau1977.c | 2 +- sound/soc/codecs/adau7002.c | 3 +- sound/soc/codecs/adau7118.c | 2 +- sound/soc/codecs/adav80x.c | 2 +- sound/soc/codecs/ak4104.c | 3 +- sound/soc/codecs/ak4118.c | 3 +- sound/soc/codecs/ak4375.c | 2 +- sound/soc/codecs/ak4458.c | 2 +- sound/soc/codecs/ak4535.c | 3 +- sound/soc/codecs/ak4613.c | 2 +- sound/soc/codecs/ak4619.c | 2 +- sound/soc/codecs/ak4642.c | 2 +- sound/soc/codecs/ak5386.c | 2 +- sound/soc/codecs/ak5558.c | 2 +- sound/soc/codecs/alc5623.c | 3 +- sound/soc/codecs/alc5632.c | 3 +- sound/soc/codecs/arizona-jack.c | 3 +- sound/soc/codecs/audio-iio-aux.c | 2 +- sound/soc/codecs/aw8738.c | 2 +- sound/soc/codecs/aw87390.c | 8 +- sound/soc/codecs/aw88081.c | 7 +- sound/soc/codecs/aw88166.c | 8 +- sound/soc/codecs/aw88261.c | 7 +- sound/soc/codecs/aw88395/aw88395.c | 6 +- sound/soc/codecs/aw88395/aw88395_device.c | 2 +- sound/soc/codecs/aw88395/aw88395_lib.c | 18 ++-- sound/soc/codecs/aw88399-lib.c | 6 +- sound/soc/codecs/aw88399.c | 2 +- sound/soc/codecs/bd28623.c | 2 +- sound/soc/codecs/cpcap.c | 2 +- sound/soc/codecs/cros_ec_codec.c | 2 +- sound/soc/codecs/cs35l32.c | 5 +- sound/soc/codecs/cs35l33.c | 3 +- sound/soc/codecs/cs35l34.c | 5 +- sound/soc/codecs/cs35l35.c | 5 +- sound/soc/codecs/cs35l36.c | 5 +- sound/soc/codecs/cs35l41-i2c.c | 2 +- sound/soc/codecs/cs35l41-spi.c | 2 +- sound/soc/codecs/cs35l45-i2c.c | 2 +- sound/soc/codecs/cs35l45-spi.c | 2 +- sound/soc/codecs/cs35l56-i2c.c | 2 +- sound/soc/codecs/cs35l56-sdw.c | 4 +- sound/soc/codecs/cs35l56-shared-test.c | 2 +- sound/soc/codecs/cs35l56-spi.c | 2 +- sound/soc/codecs/cs40l50-codec.c | 2 +- sound/soc/codecs/cs4234.c | 2 +- sound/soc/codecs/cs4265.c | 3 +- sound/soc/codecs/cs4270.c | 3 +- sound/soc/codecs/cs4271.c | 2 +- sound/soc/codecs/cs42l42-i2c.c | 2 +- sound/soc/codecs/cs42l42-sdw.c | 4 +- sound/soc/codecs/cs42l43.c | 2 +- sound/soc/codecs/cs42l51.c | 3 +- sound/soc/codecs/cs42l52.c | 4 +- sound/soc/codecs/cs42l56.c | 2 +- sound/soc/codecs/cs42l73.c | 4 +- sound/soc/codecs/cs42l83-i2c.c | 2 +- sound/soc/codecs/cs42l84.c | 3 +- sound/soc/codecs/cs42xx8.c | 2 +- sound/soc/codecs/cs43130.c | 2 +- sound/soc/codecs/cs4341.c | 4 +- sound/soc/codecs/cs4349.c | 2 +- sound/soc/codecs/cs47l15.c | 3 +- sound/soc/codecs/cs47l24.c | 3 +- sound/soc/codecs/cs47l35.c | 2 +- sound/soc/codecs/cs47l85.c | 3 +- sound/soc/codecs/cs47l90.c | 3 +- sound/soc/codecs/cs47l92.c | 2 +- sound/soc/codecs/cs48l32.c | 2 +- sound/soc/codecs/cs530x-i2c.c | 2 +- sound/soc/codecs/cs530x-spi.c | 2 +- sound/soc/codecs/cs53l30.c | 2 +- sound/soc/codecs/cx2072x.c | 3 +- sound/soc/codecs/da7210.c | 6 +- sound/soc/codecs/da7213.c | 4 +- sound/soc/codecs/da7218.c | 7 +- sound/soc/codecs/da7219-aad.c | 4 +- sound/soc/codecs/da7219.c | 5 +- sound/soc/codecs/da732x.c | 3 +- sound/soc/codecs/da9055.c | 3 +- sound/soc/codecs/dmic.c | 4 +- sound/soc/codecs/es7134.c | 2 +- sound/soc/codecs/es7241.c | 2 +- sound/soc/codecs/es8311.c | 2 +- sound/soc/codecs/es8316.c | 3 +- sound/soc/codecs/es8323.c | 2 +- sound/soc/codecs/es8326.c | 2 +- sound/soc/codecs/es8328.c | 2 +- sound/soc/codecs/es8375.c | 2 +- sound/soc/codecs/es8389.c | 2 +- sound/soc/codecs/es9039q2m.c | 2 +- sound/soc/codecs/es9356.c | 12 +-- sound/soc/codecs/framer-codec.c | 2 +- sound/soc/codecs/fs-amp-lib.c | 2 +- sound/soc/codecs/fs210x.c | 2 +- sound/soc/codecs/hda.c | 4 +- sound/soc/codecs/hdac_hda.c | 2 +- sound/soc/codecs/hdac_hdmi.c | 12 +-- sound/soc/codecs/hdmi-codec.c | 6 +- sound/soc/codecs/idt821034.c | 2 +- sound/soc/codecs/inno_rk3036.c | 2 +- sound/soc/codecs/jz4725b.c | 2 +- sound/soc/codecs/jz4740.c | 3 +- sound/soc/codecs/jz4760.c | 2 +- sound/soc/codecs/jz4770.c | 2 +- sound/soc/codecs/lm49453.c | 3 +- sound/soc/codecs/lochnagar-sc.c | 2 +- sound/soc/codecs/lpass-macro-common.c | 2 +- sound/soc/codecs/lpass-rx-macro.c | 2 +- sound/soc/codecs/lpass-tx-macro.c | 2 +- sound/soc/codecs/lpass-va-macro.c | 2 +- sound/soc/codecs/lpass-wsa-macro.c | 2 +- sound/soc/codecs/max9759.c | 2 +- sound/soc/codecs/max9768.c | 2 +- sound/soc/codecs/max98088.c | 3 +- sound/soc/codecs/max98090.c | 3 +- sound/soc/codecs/max98095.c | 3 +- sound/soc/codecs/max98357a.c | 2 +- sound/soc/codecs/max98363.c | 7 +- sound/soc/codecs/max98371.c | 3 +- sound/soc/codecs/max98373-i2c.c | 7 +- sound/soc/codecs/max98373-sdw.c | 17 ++-- sound/soc/codecs/max98388.c | 2 +- sound/soc/codecs/max98390.c | 2 +- sound/soc/codecs/max98396.c | 2 +- sound/soc/codecs/max9850.c | 3 +- sound/soc/codecs/max98504.c | 2 +- sound/soc/codecs/max98520.c | 2 +- sound/soc/codecs/max9860.c | 2 +- sound/soc/codecs/max9867.c | 2 +- sound/soc/codecs/max98925.c | 3 +- sound/soc/codecs/max98926.c | 3 +- sound/soc/codecs/max98927.c | 2 +- sound/soc/codecs/mc13783.c | 2 +- sound/soc/codecs/ml26124.c | 2 +- sound/soc/codecs/msm8916-wcd-analog.c | 2 +- sound/soc/codecs/msm8916-wcd-digital.c | 2 +- sound/soc/codecs/mt6351.c | 4 +- sound/soc/codecs/mt6357.c | 2 +- sound/soc/codecs/mt6358.c | 4 +- sound/soc/codecs/mt6359-accdet.c | 11 +-- sound/soc/codecs/mt6359.c | 2 +- sound/soc/codecs/mt6660.c | 2 +- sound/soc/codecs/nau8315.c | 2 +- sound/soc/codecs/nau8325.c | 2 +- sound/soc/codecs/nau8360.c | 2 +- sound/soc/codecs/nau8540.c | 2 +- sound/soc/codecs/nau8810.c | 2 +- sound/soc/codecs/nau8821.c | 2 +- sound/soc/codecs/nau8822.c | 2 +- sound/soc/codecs/nau8824.c | 2 +- sound/soc/codecs/nau8825.c | 2 +- sound/soc/codecs/ntp8835.c | 2 +- sound/soc/codecs/ntp8918.c | 2 +- sound/soc/codecs/pcm1681.c | 2 +- sound/soc/codecs/pcm1754.c | 2 +- sound/soc/codecs/pcm1789.c | 3 +- sound/soc/codecs/pcm179x.c | 3 +- sound/soc/codecs/pcm186x.c | 2 +- sound/soc/codecs/pcm3008.c | 2 +- sound/soc/codecs/pcm3060-i2c.c | 2 +- sound/soc/codecs/pcm3060-spi.c | 2 +- sound/soc/codecs/pcm3168a.c | 2 +- sound/soc/codecs/pcm5102a.c | 2 +- sound/soc/codecs/pcm512x.c | 7 +- sound/soc/codecs/pcm6240.c | 9 +- sound/soc/codecs/peb2466.c | 2 +- sound/soc/codecs/pm4125-sdw.c | 2 +- sound/soc/codecs/pm4125.c | 2 +- sound/soc/codecs/rk3308_codec.c | 2 +- sound/soc/codecs/rk3328_codec.c | 2 +- sound/soc/codecs/rk817_codec.c | 4 +- sound/soc/codecs/rt1011.c | 3 +- sound/soc/codecs/rt1015.c | 2 +- sound/soc/codecs/rt1015p.c | 2 +- sound/soc/codecs/rt1016.c | 3 +- sound/soc/codecs/rt1017-sdca-sdw.c | 10 +- sound/soc/codecs/rt1019.c | 3 +- sound/soc/codecs/rt1305.c | 3 +- sound/soc/codecs/rt1308-sdw.c | 7 +- sound/soc/codecs/rt1308.c | 3 +- sound/soc/codecs/rt1316-sdw.c | 10 +- sound/soc/codecs/rt1318-sdw.c | 10 +- sound/soc/codecs/rt1318.c | 3 +- sound/soc/codecs/rt1320-sdw.c | 12 +-- sound/soc/codecs/rt274.c | 3 +- sound/soc/codecs/rt286.c | 3 +- sound/soc/codecs/rt298.c | 3 +- sound/soc/codecs/rt5514.c | 3 +- sound/soc/codecs/rt5575.c | 2 +- sound/soc/codecs/rt5616.c | 3 +- sound/soc/codecs/rt5631.c | 3 +- sound/soc/codecs/rt5640.c | 4 +- sound/soc/codecs/rt5645.c | 3 +- sound/soc/codecs/rt5651.c | 3 +- sound/soc/codecs/rt5659.c | 3 +- sound/soc/codecs/rt5660.c | 3 +- sound/soc/codecs/rt5663.c | 3 +- sound/soc/codecs/rt5665.c | 3 +- sound/soc/codecs/rt5668.c | 3 +- sound/soc/codecs/rt5670.c | 4 +- sound/soc/codecs/rt5677.c | 3 +- sound/soc/codecs/rt5682-i2c.c | 3 +- sound/soc/codecs/rt5682-sdw.c | 12 +-- sound/soc/codecs/rt5682s.c | 2 +- sound/soc/codecs/rt700-sdw.c | 10 +- sound/soc/codecs/rt700.c | 2 +- sound/soc/codecs/rt711-sdca-sdw.c | 11 +-- sound/soc/codecs/rt711-sdca.c | 2 +- sound/soc/codecs/rt711-sdw.c | 10 +- sound/soc/codecs/rt711.c | 2 +- sound/soc/codecs/rt712-sdca-dmic.c | 6 +- sound/soc/codecs/rt712-sdca-sdw.c | 8 +- sound/soc/codecs/rt712-sdca.c | 2 +- sound/soc/codecs/rt715-sdca-sdw.c | 5 +- sound/soc/codecs/rt715-sdca.c | 2 +- sound/soc/codecs/rt715-sdw.c | 5 +- sound/soc/codecs/rt715.c | 2 +- sound/soc/codecs/rt721-sdca-sdw.c | 8 +- sound/soc/codecs/rt721-sdca.c | 2 +- sound/soc/codecs/rt722-sdca-sdw.c | 8 +- sound/soc/codecs/rt722-sdca.c | 2 +- sound/soc/codecs/rt766-sdca.c | 4 +- sound/soc/codecs/rt9120.c | 2 +- sound/soc/codecs/rt9123.c | 2 +- sound/soc/codecs/rt9123p.c | 2 +- sound/soc/codecs/rtq9124.c | 2 +- sound/soc/codecs/rtq9128.c | 2 +- sound/soc/codecs/sdw-mockup.c | 12 +-- sound/soc/codecs/sgtl5000.c | 2 +- sound/soc/codecs/simple-amplifier.c | 12 +-- sound/soc/codecs/simple-mux.c | 2 +- sound/soc/codecs/sma1303.c | 3 +- sound/soc/codecs/sma1307.c | 3 +- sound/soc/codecs/sn624x-sdca-sdw.c | 12 +-- sound/soc/codecs/src4xxx.c | 2 +- sound/soc/codecs/ssm2305.c | 2 +- sound/soc/codecs/ssm2518.c | 2 +- sound/soc/codecs/ssm2602.c | 2 +- sound/soc/codecs/ssm3515.c | 2 +- sound/soc/codecs/ssm4567.c | 2 +- sound/soc/codecs/sta32x.c | 5 +- sound/soc/codecs/sta350.c | 4 +- sound/soc/codecs/sta529.c | 2 +- sound/soc/codecs/sti-sas.c | 3 +- sound/soc/codecs/tac5xx2-sdw.c | 8 +- sound/soc/codecs/tas2552.c | 2 +- sound/soc/codecs/tas2562.c | 2 +- sound/soc/codecs/tas2764.c | 3 +- sound/soc/codecs/tas2770.c | 3 +- sound/soc/codecs/tas2780.c | 3 +- sound/soc/codecs/tas2781-comlib-i2c.c | 2 +- sound/soc/codecs/tas2781-fmwlib.c | 2 +- sound/soc/codecs/tas2781-i2c.c | 26 ++---- sound/soc/codecs/tas2783-sdw.c | 5 +- sound/soc/codecs/tas5086.c | 2 +- sound/soc/codecs/tas571x.c | 2 +- sound/soc/codecs/tas5720.c | 2 +- sound/soc/codecs/tas5805m.c | 2 +- sound/soc/codecs/tas6424.c | 2 +- sound/soc/codecs/tas675x.c | 2 +- sound/soc/codecs/tda7419.c | 4 +- sound/soc/codecs/tfa9879.c | 2 +- sound/soc/codecs/tfa989x.c | 2 +- sound/soc/codecs/tlv320adc3xxx.c | 2 +- sound/soc/codecs/tlv320adcx140.c | 2 +- sound/soc/codecs/tlv320aic23.c | 2 +- sound/soc/codecs/tlv320aic26.c | 2 +- sound/soc/codecs/tlv320aic31xx.c | 2 +- sound/soc/codecs/tlv320aic32x4-clk.c | 2 +- sound/soc/codecs/tlv320aic32x4.c | 2 +- sound/soc/codecs/tlv320aic3x.c | 4 +- sound/soc/codecs/tlv320dac33.c | 4 +- sound/soc/codecs/tpa6130a2.c | 2 +- sound/soc/codecs/ts3a227e.c | 2 +- sound/soc/codecs/tscs42xx.c | 2 +- sound/soc/codecs/tscs454.c | 2 +- sound/soc/codecs/twl4030.c | 7 +- sound/soc/codecs/twl6040.c | 2 +- sound/soc/codecs/uda1334.c | 3 +- sound/soc/codecs/uda1342.c | 2 +- sound/soc/codecs/uda1380.c | 5 +- sound/soc/codecs/wcd9335.c | 2 +- sound/soc/codecs/wcd934x.c | 2 +- sound/soc/codecs/wcd9378-sdca.c | 6 +- sound/soc/codecs/wcd937x-sdw.c | 2 +- sound/soc/codecs/wcd937x.c | 2 +- sound/soc/codecs/wcd938x-sdw.c | 2 +- sound/soc/codecs/wcd938x.c | 3 +- sound/soc/codecs/wcd939x-sdw.c | 2 +- sound/soc/codecs/wcd939x.c | 3 +- sound/soc/codecs/wm0010.c | 3 +- sound/soc/codecs/wm1250-ev1.c | 2 +- sound/soc/codecs/wm2000.c | 2 +- sound/soc/codecs/wm2200.c | 3 +- sound/soc/codecs/wm5100.c | 3 +- sound/soc/codecs/wm5102.c | 3 +- sound/soc/codecs/wm5110.c | 3 +- sound/soc/codecs/wm8350.c | 3 +- sound/soc/codecs/wm8400.c | 3 +- sound/soc/codecs/wm8510.c | 6 +- sound/soc/codecs/wm8523.c | 3 +- sound/soc/codecs/wm8524.c | 3 +- sound/soc/codecs/wm8580.c | 3 +- sound/soc/codecs/wm8711.c | 6 +- sound/soc/codecs/wm8728.c | 6 +- sound/soc/codecs/wm8731-i2c.c | 3 +- sound/soc/codecs/wm8731-spi.c | 2 +- sound/soc/codecs/wm8737.c | 6 +- sound/soc/codecs/wm8741.c | 6 +- sound/soc/codecs/wm8750.c | 6 +- sound/soc/codecs/wm8753.c | 6 +- sound/soc/codecs/wm8770.c | 3 +- sound/soc/codecs/wm8776.c | 6 +- sound/soc/codecs/wm8782.c | 2 +- sound/soc/codecs/wm8804.c | 2 +- sound/soc/codecs/wm8900.c | 6 +- sound/soc/codecs/wm8903.c | 5 +- sound/soc/codecs/wm8904.c | 5 +- sound/soc/codecs/wm8940.c | 3 +- sound/soc/codecs/wm8955.c | 3 +- sound/soc/codecs/wm8960.c | 3 +- sound/soc/codecs/wm8961.c | 3 +- sound/soc/codecs/wm8962.c | 2 +- sound/soc/codecs/wm8971.c | 3 +- sound/soc/codecs/wm8974.c | 2 +- sound/soc/codecs/wm8978.c | 3 +- sound/soc/codecs/wm8983.c | 4 +- sound/soc/codecs/wm8985.c | 4 +- sound/soc/codecs/wm8988.c | 6 +- sound/soc/codecs/wm8990.c | 3 +- sound/soc/codecs/wm8991.c | 2 +- sound/soc/codecs/wm8993.c | 3 +- sound/soc/codecs/wm8994.c | 3 +- sound/soc/codecs/wm8995.c | 4 +- sound/soc/codecs/wm8996.c | 3 +- sound/soc/codecs/wm8997.c | 3 +- sound/soc/codecs/wm8998.c | 3 +- sound/soc/codecs/wm9081.c | 3 +- sound/soc/codecs/wm9090.c | 2 +- sound/soc/codecs/wm9705.c | 2 +- sound/soc/codecs/wm9712.c | 2 +- sound/soc/codecs/wm9713.c | 2 +- sound/soc/codecs/wm_hubs.c | 2 +- sound/soc/codecs/wsa881x.c | 2 +- sound/soc/codecs/wsa883x.c | 2 +- sound/soc/codecs/wsa884x.c | 2 +- sound/soc/codecs/wsa885x.c | 2 +- sound/soc/codecs/zl38060.c | 2 +- sound/soc/dwc/dwc-i2s.c | 4 +- sound/soc/fsl/fsl-asoc-card.c | 4 +- sound/soc/fsl/fsl_asrc.c | 4 +- sound/soc/fsl/fsl_asrc_m2m.c | 2 +- sound/soc/fsl/fsl_aud2htx.c | 2 +- sound/soc/fsl/fsl_audmix.c | 2 +- sound/soc/fsl/fsl_dma.c | 2 +- sound/soc/fsl/fsl_easrc.c | 4 +- sound/soc/fsl/fsl_esai.c | 2 +- sound/soc/fsl/fsl_micfil.c | 2 +- sound/soc/fsl/fsl_mqs.c | 2 +- sound/soc/fsl/fsl_qmc_audio.c | 18 ++-- sound/soc/fsl/fsl_rpmsg.c | 4 +- sound/soc/fsl/fsl_sai.c | 4 +- sound/soc/fsl/fsl_spdif.c | 2 +- sound/soc/fsl/fsl_ssi.c | 2 +- sound/soc/fsl/fsl_xcvr.c | 2 +- sound/soc/fsl/imx-audio-rpmsg.c | 2 +- sound/soc/fsl/imx-audmix.c | 20 ++-- sound/soc/fsl/imx-audmux.c | 2 +- sound/soc/fsl/imx-card.c | 14 +-- sound/soc/fsl/imx-es8328.c | 2 +- sound/soc/fsl/imx-hdmi.c | 2 +- sound/soc/fsl/imx-pcm-dma.c | 3 +- sound/soc/fsl/imx-pcm-rpmsg.c | 2 +- sound/soc/fsl/imx-rpmsg.c | 2 +- sound/soc/fsl/imx-sgtl5000.c | 2 +- sound/soc/fsl/lpc3xxx-i2s.c | 2 +- sound/soc/fsl/mpc5200_dma.c | 2 +- sound/soc/fsl/pcm030-audio-fabric.c | 3 +- sound/soc/generic/audio-graph-card.c | 2 +- .../generic/audio-graph-card2-custom-sample.c | 2 +- sound/soc/generic/audio-graph-card2.c | 9 +- sound/soc/generic/simple-card-utils.c | 17 ++-- sound/soc/generic/simple-card.c | 2 +- sound/soc/generic/test-component.c | 8 +- sound/soc/google/chv3-i2s.c | 2 +- sound/soc/hisilicon/hi6210-i2s.c | 2 +- sound/soc/img/img-i2s-in.c | 6 +- sound/soc/img/img-i2s-out.c | 6 +- sound/soc/img/img-parallel-out.c | 2 +- sound/soc/img/img-spdif-in.c | 2 +- sound/soc/img/img-spdif-out.c | 2 +- sound/soc/img/pistachio-internal-dac.c | 2 +- sound/soc/intel/atom/sst-atom-controls.c | 2 +- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 4 +- sound/soc/intel/atom/sst/sst.c | 5 +- sound/soc/intel/avs/board_selection.c | 4 +- sound/soc/intel/avs/boards/da7219.c | 12 +-- sound/soc/intel/avs/boards/dmic.c | 8 +- sound/soc/intel/avs/boards/es8336.c | 12 +-- sound/soc/intel/avs/boards/hdaudio.c | 14 +-- sound/soc/intel/avs/boards/i2s_test.c | 8 +- sound/soc/intel/avs/boards/max98357a.c | 10 +- sound/soc/intel/avs/boards/max98373.c | 10 +- sound/soc/intel/avs/boards/max98927.c | 10 +- sound/soc/intel/avs/boards/nau8825.c | 12 +-- sound/soc/intel/avs/boards/pcm3168a.c | 6 +- sound/soc/intel/avs/boards/probe.c | 8 +- sound/soc/intel/avs/boards/rt274.c | 12 +-- sound/soc/intel/avs/boards/rt286.c | 12 +-- sound/soc/intel/avs/boards/rt298.c | 12 +-- sound/soc/intel/avs/boards/rt5514.c | 10 +- sound/soc/intel/avs/boards/rt5640.c | 12 +-- sound/soc/intel/avs/boards/rt5663.c | 12 +-- sound/soc/intel/avs/boards/rt5682.c | 12 +-- sound/soc/intel/avs/boards/ssm4567.c | 10 +- sound/soc/intel/avs/core.c | 4 +- sound/soc/intel/avs/loader.c | 8 +- sound/soc/intel/avs/pcm.c | 7 +- sound/soc/intel/avs/topology.c | 24 ++--- sound/soc/intel/boards/bdw-rt5650.c | 3 +- sound/soc/intel/boards/bdw-rt5677.c | 3 +- sound/soc/intel/boards/bytcht_es8316.c | 2 +- sound/soc/intel/boards/bytcr_rt5640.c | 2 +- sound/soc/intel/boards/bytcr_rt5651.c | 2 +- sound/soc/intel/boards/bytcr_wm5102.c | 2 +- sound/soc/intel/boards/cht_bsw_max98090_ti.c | 2 +- sound/soc/intel/boards/cht_bsw_nau8824.c | 2 +- sound/soc/intel/boards/cht_bsw_rt5645.c | 2 +- sound/soc/intel/boards/cht_bsw_rt5672.c | 2 +- sound/soc/intel/boards/cht_rt5677.c | 4 +- sound/soc/intel/boards/ehl_rt5660.c | 4 +- sound/soc/intel/boards/skl_hda_dsp_generic.c | 2 +- sound/soc/intel/boards/sof_board_helpers.c | 28 ++---- sound/soc/intel/boards/sof_es8336.c | 19 ++-- sound/soc/intel/boards/sof_pcm512x.c | 18 ++-- sound/soc/intel/boards/sof_sdw.c | 18 ++-- sound/soc/intel/boards/sof_wm8804.c | 2 +- sound/soc/intel/catpt/device.c | 2 +- sound/soc/intel/catpt/dsp.c | 2 +- sound/soc/intel/keembay/kmb_platform.c | 2 +- sound/soc/jz4740/jz4740-i2s.c | 2 +- sound/soc/kirkwood/kirkwood-i2s.c | 2 +- sound/soc/loongson/loongson1_ac97.c | 2 +- sound/soc/loongson/loongson_card.c | 2 +- sound/soc/loongson/loongson_i2s_pci.c | 2 +- sound/soc/loongson/loongson_i2s_plat.c | 2 +- sound/soc/mediatek/an7581/an7581-afe-pcm.c | 13 +-- sound/soc/mediatek/an7581/an7581-dai-etdm.c | 5 +- sound/soc/mediatek/common/mtk-afe-fe-dai.c | 4 +- .../mediatek/common/mtk-afe-platform-driver.c | 7 +- sound/soc/mediatek/common/mtk-btcvsd.c | 6 +- .../soc/mediatek/common/mtk-dsp-sof-common.c | 7 +- .../mediatek/common/mtk-soundcard-driver.c | 8 +- sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 13 +-- sound/soc/mediatek/mt2701/mt2701-cs42448.c | 3 +- sound/soc/mediatek/mt6797/mt6797-afe-clk.c | 3 +- sound/soc/mediatek/mt6797/mt6797-afe-pcm.c | 13 +-- sound/soc/mediatek/mt6797/mt6797-dai-adda.c | 2 +- .../soc/mediatek/mt6797/mt6797-dai-hostless.c | 2 +- sound/soc/mediatek/mt6797/mt6797-dai-pcm.c | 2 +- sound/soc/mediatek/mt7986/mt7986-afe-pcm.c | 16 ++-- sound/soc/mediatek/mt7986/mt7986-dai-etdm.c | 5 +- sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 10 +- sound/soc/mediatek/mt8183/mt8183-afe-clk.c | 3 +- sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 12 +-- .../mediatek/mt8183/mt8183-da7219-max98357.c | 2 +- sound/soc/mediatek/mt8183/mt8183-dai-adda.c | 2 +- .../soc/mediatek/mt8183/mt8183-dai-hostless.c | 2 +- sound/soc/mediatek/mt8183/mt8183-dai-i2s.c | 6 +- sound/soc/mediatek/mt8183/mt8183-dai-pcm.c | 2 +- sound/soc/mediatek/mt8183/mt8183-dai-tdm.c | 5 +- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 2 +- sound/soc/mediatek/mt8186/mt8186-afe-clk.c | 3 +- sound/soc/mediatek/mt8186/mt8186-afe-pcm.c | 11 +-- sound/soc/mediatek/mt8186/mt8186-audsys-clk.c | 5 +- sound/soc/mediatek/mt8186/mt8186-dai-adda.c | 2 +- .../soc/mediatek/mt8186/mt8186-dai-hostless.c | 2 +- .../soc/mediatek/mt8186/mt8186-dai-hw-gain.c | 2 +- sound/soc/mediatek/mt8186/mt8186-dai-i2s.c | 2 +- sound/soc/mediatek/mt8186/mt8186-dai-pcm.c | 5 +- sound/soc/mediatek/mt8186/mt8186-dai-src.c | 2 +- sound/soc/mediatek/mt8186/mt8186-dai-tdm.c | 5 +- sound/soc/mediatek/mt8186/mt8186-mt6366.c | 2 +- sound/soc/mediatek/mt8188/mt8188-afe-clk.c | 3 +- sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 18 ++-- sound/soc/mediatek/mt8188/mt8188-audsys-clk.c | 5 +- sound/soc/mediatek/mt8188/mt8188-dai-adda.c | 6 +- sound/soc/mediatek/mt8188/mt8188-dai-dmic.c | 5 +- sound/soc/mediatek/mt8188/mt8188-dai-etdm.c | 6 +- sound/soc/mediatek/mt8188/mt8188-dai-pcm.c | 5 +- sound/soc/mediatek/mt8189/mt8189-afe-clk.c | 4 +- sound/soc/mediatek/mt8189/mt8189-afe-pcm.c | 13 +-- sound/soc/mediatek/mt8189/mt8189-dai-adda.c | 6 +- sound/soc/mediatek/mt8189/mt8189-dai-i2s.c | 2 +- sound/soc/mediatek/mt8189/mt8189-dai-pcm.c | 2 +- sound/soc/mediatek/mt8189/mt8189-dai-tdm.c | 5 +- sound/soc/mediatek/mt8192/mt8192-afe-clk.c | 3 +- sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 13 +-- sound/soc/mediatek/mt8192/mt8192-dai-adda.c | 2 +- sound/soc/mediatek/mt8192/mt8192-dai-i2s.c | 2 +- sound/soc/mediatek/mt8192/mt8192-dai-pcm.c | 2 +- sound/soc/mediatek/mt8192/mt8192-dai-tdm.c | 5 +- sound/soc/mediatek/mt8195/mt8195-afe-clk.c | 3 +- sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 18 ++-- sound/soc/mediatek/mt8195/mt8195-audsys-clk.c | 5 +- sound/soc/mediatek/mt8195/mt8195-dai-adda.c | 6 +- sound/soc/mediatek/mt8195/mt8195-dai-etdm.c | 6 +- sound/soc/mediatek/mt8195/mt8195-dai-pcm.c | 5 +- sound/soc/mediatek/mt8195/mt8195-mt6359.c | 2 +- sound/soc/mediatek/mt8196/mt8196-afe-clk.c | 4 +- sound/soc/mediatek/mt8196/mt8196-afe-pcm.c | 13 +-- sound/soc/mediatek/mt8196/mt8196-dai-adda.c | 6 +- sound/soc/mediatek/mt8196/mt8196-dai-i2s.c | 2 +- sound/soc/mediatek/mt8196/mt8196-dai-tdm.c | 5 +- sound/soc/mediatek/mt8365/mt8365-afe-pcm.c | 17 ++-- sound/soc/mediatek/mt8365/mt8365-dai-adda.c | 2 +- sound/soc/mediatek/mt8365/mt8365-dai-dmic.c | 4 +- sound/soc/mediatek/mt8365/mt8365-dai-i2s.c | 2 +- sound/soc/mediatek/mt8365/mt8365-dai-pcm.c | 5 +- sound/soc/mediatek/mt8365/mt8365-mt6357.c | 3 +- sound/soc/meson/aiu.c | 4 +- sound/soc/meson/axg-card.c | 15 ++- sound/soc/meson/axg-fifo.c | 2 +- sound/soc/meson/axg-pdm.c | 2 +- sound/soc/meson/axg-spdifin.c | 4 +- sound/soc/meson/axg-spdifout.c | 2 +- sound/soc/meson/axg-tdm-formatter.c | 2 +- sound/soc/meson/axg-tdm-interface.c | 2 +- sound/soc/meson/g12a-toacodec.c | 2 +- sound/soc/meson/gx-card.c | 4 +- sound/soc/meson/gx-formatter.c | 4 +- sound/soc/meson/meson-card-utils.c | 4 +- sound/soc/meson/t9015.c | 2 +- sound/soc/mxs/mxs-saif.c | 2 +- sound/soc/pxa/mmp-sspa.c | 3 +- sound/soc/qcom/apq8016_sbc.c | 2 +- sound/soc/qcom/apq8096.c | 2 +- sound/soc/qcom/common.c | 4 +- sound/soc/qcom/lpass-apq8016.c | 4 +- sound/soc/qcom/lpass-cpu.c | 15 ++- sound/soc/qcom/lpass-platform.c | 14 ++- sound/soc/qcom/lpass-sc7180.c | 4 +- sound/soc/qcom/lpass-sc7280.c | 4 +- sound/soc/qcom/qaif-cpu.c | 6 +- sound/soc/qcom/qdsp6/q6adm.c | 2 +- sound/soc/qcom/qdsp6/q6afe-dai.c | 2 +- sound/soc/qcom/qdsp6/q6afe.c | 2 +- sound/soc/qcom/qdsp6/q6apm-dai.c | 2 +- sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 2 +- sound/soc/qcom/qdsp6/q6apm.c | 2 +- sound/soc/qcom/qdsp6/q6asm-dai.c | 5 +- sound/soc/qcom/qdsp6/q6asm.c | 2 +- sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c | 4 +- sound/soc/qcom/qdsp6/q6prm.c | 2 +- sound/soc/qcom/qdsp6/q6usb.c | 2 +- sound/soc/qcom/sc7180.c | 2 +- sound/soc/qcom/sc7280.c | 2 +- sound/soc/qcom/sc8280xp.c | 4 +- sound/soc/qcom/sdm845.c | 4 +- sound/soc/qcom/sm8250.c | 4 +- sound/soc/qcom/storm.c | 2 +- sound/soc/qcom/x1e80100.c | 4 +- sound/soc/renesas/fsi.c | 2 +- sound/soc/renesas/rcar/adg.c | 2 +- sound/soc/renesas/rcar/cmd.c | 2 +- sound/soc/renesas/rcar/core.c | 6 +- sound/soc/renesas/rcar/ctu.c | 2 +- sound/soc/renesas/rcar/dma.c | 4 +- sound/soc/renesas/rcar/dvc.c | 2 +- sound/soc/renesas/rcar/gen.c | 2 +- sound/soc/renesas/rcar/mix.c | 2 +- sound/soc/renesas/rcar/msiof.c | 2 +- sound/soc/renesas/rcar/src.c | 4 +- sound/soc/renesas/rcar/ssi.c | 2 +- sound/soc/renesas/rcar/ssiu.c | 4 +- sound/soc/renesas/rz-ssi.c | 4 +- sound/soc/renesas/siu_dai.c | 2 +- sound/soc/rockchip/rk3288_hdmi_analog.c | 3 +- sound/soc/rockchip/rk3399_gru_sound.c | 7 +- sound/soc/rockchip/rockchip_i2s.c | 2 +- sound/soc/rockchip/rockchip_i2s_tdm.c | 2 +- sound/soc/rockchip/rockchip_pdm.c | 2 +- sound/soc/rockchip/rockchip_sai.c | 2 +- sound/soc/rockchip/rockchip_spdif.c | 2 +- sound/soc/samsung/aries_wm8994.c | 2 +- sound/soc/samsung/dmaengine.c | 2 +- sound/soc/samsung/i2s.c | 9 +- sound/soc/samsung/midas_wm1811.c | 2 +- sound/soc/samsung/odroid.c | 2 +- sound/soc/samsung/snow.c | 2 +- sound/soc/samsung/tm2_wm5110.c | 2 +- sound/soc/sdca/sdca_asoc.c | 30 +++--- sound/soc/sdca/sdca_class.c | 2 +- sound/soc/sdca/sdca_class_function.c | 4 +- sound/soc/sdca/sdca_functions.c | 41 ++++---- sound/soc/sdca/sdca_interrupts.c | 2 +- sound/soc/sdw_utils/soc_sdw_utils.c | 2 +- sound/soc/soc-ac97.c | 2 +- sound/soc/soc-compress.c | 5 +- sound/soc/soc-core.c | 33 +++---- sound/soc/soc-dai.c | 2 +- sound/soc/soc-dapm.c | 2 +- sound/soc/soc-topology.c | 22 ++--- sound/soc/sof/amd/acp-common.c | 7 +- sound/soc/sof/amd/acp.c | 5 +- sound/soc/sof/core.c | 4 +- sound/soc/sof/debug.c | 6 +- sound/soc/sof/imx/imx-common.c | 2 +- sound/soc/sof/imx/imx8.c | 2 +- sound/soc/sof/intel/hda-dai.c | 2 +- sound/soc/sof/intel/hda-stream.c | 3 +- sound/soc/sof/intel/hda.c | 12 +-- sound/soc/sof/ipc.c | 2 +- sound/soc/sof/ipc3-dtrace.c | 6 +- sound/soc/sof/ipc4-loader.c | 8 +- sound/soc/sof/ipc4-mtrace.c | 3 +- sound/soc/sof/ipc4-telemetry.c | 2 +- sound/soc/sof/ipc4-topology.c | 2 +- sound/soc/sof/mediatek/mt8186/mt8186-clk.c | 2 +- sound/soc/sof/mediatek/mt8186/mt8186.c | 4 +- sound/soc/sof/mediatek/mt8195/mt8195-clk.c | 2 +- sound/soc/sof/mediatek/mt8195/mt8195.c | 4 +- sound/soc/sof/nocodec.c | 4 +- sound/soc/sof/sof-acpi-dev.c | 2 +- sound/soc/sof/sof-client-ipc-flood-test.c | 2 +- .../soc/sof/sof-client-ipc-kernel-injector.c | 2 +- sound/soc/sof/sof-client-ipc-msg-injector.c | 2 +- sound/soc/sof/sof-client-probes.c | 6 +- sound/soc/sof/sof-of-dev.c | 2 +- sound/soc/sof/sof-pci-dev.c | 2 +- sound/soc/sophgo/cv1800b-sound-adc.c | 2 +- sound/soc/sophgo/cv1800b-sound-dac.c | 2 +- sound/soc/sophgo/cv1800b-tdm.c | 2 +- sound/soc/spacemit/k1_i2s.c | 2 +- sound/soc/spear/spdif_in.c | 2 +- sound/soc/spear/spdif_out.c | 2 +- sound/soc/sprd/sprd-mcdt.c | 2 +- sound/soc/sprd/sprd-pcm-compress.c | 2 +- sound/soc/sprd/sprd-pcm-dma.c | 4 +- sound/soc/starfive/jh7110_pwmdac.c | 2 +- sound/soc/starfive/jh7110_tdm.c | 2 +- sound/soc/sti/sti_uniperif.c | 6 +- sound/soc/stm/stm32_adfsdm.c | 2 +- sound/soc/stm/stm32_i2s.c | 7 +- sound/soc/stm/stm32_sai.c | 2 +- sound/soc/stm/stm32_sai_sub.c | 4 +- sound/soc/stm/stm32_spdifrx.c | 5 +- sound/soc/sunxi/sun4i-codec.c | 19 ++-- sound/soc/sunxi/sun4i-i2s.c | 2 +- sound/soc/sunxi/sun4i-spdif.c | 2 +- sound/soc/sunxi/sun50i-dmic.c | 2 +- sound/soc/sunxi/sun8i-codec.c | 2 +- sound/soc/tegra/tegra186_asrc.c | 2 +- sound/soc/tegra/tegra186_dspk.c | 2 +- sound/soc/tegra/tegra20_ac97.c | 3 +- sound/soc/tegra/tegra20_das.c | 2 +- sound/soc/tegra/tegra20_i2s.c | 2 +- sound/soc/tegra/tegra20_spdif.c | 3 +- sound/soc/tegra/tegra210_admaif.c | 8 +- sound/soc/tegra/tegra210_adx.c | 9 +- sound/soc/tegra/tegra210_ahub.c | 2 +- sound/soc/tegra/tegra210_amx.c | 11 +-- sound/soc/tegra/tegra210_dmic.c | 2 +- sound/soc/tegra/tegra210_i2s.c | 2 +- sound/soc/tegra/tegra210_mixer.c | 2 +- sound/soc/tegra/tegra210_mvc.c | 2 +- sound/soc/tegra/tegra210_ope.c | 2 +- sound/soc/tegra/tegra210_sfc.c | 2 +- sound/soc/tegra/tegra30_ahub.c | 3 +- sound/soc/tegra/tegra30_i2s.c | 2 +- sound/soc/tegra/tegra_asoc_machine.c | 2 +- sound/soc/tegra/tegra_audio_graph_card.c | 2 +- sound/soc/tegra/tegra_isomgr_bw.c | 2 +- sound/soc/ti/davinci-evm.c | 2 +- sound/soc/ti/davinci-i2s.c | 3 +- sound/soc/ti/davinci-mcasp.c | 23 ++--- sound/soc/ti/edma-pcm.c | 2 +- sound/soc/ti/j721e-evm.c | 9 +- sound/soc/ti/omap-abe-twl6040.c | 2 +- sound/soc/ti/omap-dmic.c | 2 +- sound/soc/ti/omap-hdmi.c | 6 +- sound/soc/ti/omap-mcbsp-st.c | 2 +- sound/soc/ti/omap-mcbsp.c | 2 +- sound/soc/ti/omap-mcpdm.c | 2 +- sound/soc/ti/omap-twl4030.c | 2 +- sound/soc/ti/rx51.c | 2 +- sound/soc/ti/sdma-pcm.c | 2 +- sound/soc/uniphier/aio-cpu.c | 6 +- sound/soc/uniphier/evea.c | 2 +- sound/soc/ux500/ux500_msp_dai.c | 12 +-- sound/soc/ux500/ux500_msp_i2s.c | 2 +- sound/soc/xilinx/xlnx_formatter_pcm.c | 2 +- sound/soc/xilinx/xlnx_i2s.c | 2 +- sound/soc/xilinx/xlnx_spdif.c | 2 +- sound/soc/xtensa/xtfpga-i2s.c | 2 +- sound/virtio/virtio_card.c | 2 +- sound/virtio/virtio_chmap.c | 8 +- sound/virtio/virtio_jack.c | 3 +- sound/virtio/virtio_kctl.c | 10 +- sound/virtio/virtio_pcm.c | 12 +-- sound/xen/xen_snd_front.c | 3 +- sound/xen/xen_snd_front_alsa.c | 20 ++-- sound/xen/xen_snd_front_cfg.c | 20 ++-- 5975 files changed, 10144 insertions(+), 12235 deletions(-) diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c index ed6d4f0cd621..5fee6c451bf6 100644 --- a/arch/arc/kernel/perf_event.c +++ b/arch/arc/kernel/perf_event.c @@ -672,18 +672,21 @@ static void arc_pmu_add_raw_event_attr(int j, char *str) static int arc_pmu_raw_alloc(struct device *dev) { - arc_pmu->attr = devm_kmalloc_array(dev, arc_pmu->n_events + 1, - sizeof(*arc_pmu->attr), GFP_KERNEL | __GFP_ZERO); + arc_pmu->attr = devm_kmalloc_objs(dev, *arc_pmu->attr, + arc_pmu->n_events + 1, + GFP_KERNEL | __GFP_ZERO); if (!arc_pmu->attr) return -ENOMEM; - arc_pmu->attrs = devm_kmalloc_array(dev, arc_pmu->n_events + 1, - sizeof(*arc_pmu->attrs), GFP_KERNEL | __GFP_ZERO); + arc_pmu->attrs = devm_kmalloc_objs(dev, *arc_pmu->attrs, + arc_pmu->n_events + 1, + GFP_KERNEL | __GFP_ZERO); if (!arc_pmu->attrs) return -ENOMEM; - arc_pmu->raw_entry = devm_kmalloc_array(dev, arc_pmu->n_events, - sizeof(*arc_pmu->raw_entry), GFP_KERNEL | __GFP_ZERO); + arc_pmu->raw_entry = devm_kmalloc_objs(dev, *arc_pmu->raw_entry, + arc_pmu->n_events, + GFP_KERNEL | __GFP_ZERO); if (!arc_pmu->raw_entry) return -ENOMEM; @@ -747,7 +750,7 @@ static int arc_pmu_device_probe(struct platform_device *pdev) if (WARN(!cc_bcr.v, "Counters exist but No countable conditions?")) return -EINVAL; - arc_pmu = devm_kzalloc(&pdev->dev, sizeof(struct arc_pmu), GFP_KERNEL); + arc_pmu = devm_kzalloc_obj(&pdev->dev, struct arc_pmu); if (!arc_pmu) return -ENOMEM; diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c index a0f854cf4748..a6558378b32f 100644 --- a/arch/arm/common/sa1111.c +++ b/arch/arm/common/sa1111.c @@ -800,7 +800,7 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq) if (!pd) return -EINVAL; - sachip = devm_kzalloc(me, sizeof(struct sa1111), GFP_KERNEL); + sachip = devm_kzalloc_obj(me, struct sa1111); if (!sachip) return -ENOMEM; diff --git a/arch/arm/mach-imx/src.c b/arch/arm/mach-imx/src.c index c3c80b4c3d53..e49525276f4a 100644 --- a/arch/arm/mach-imx/src.c +++ b/arch/arm/mach-imx/src.c @@ -219,7 +219,7 @@ static int imx_src_probe(struct platform_device *pdev) { struct reset_controller_dev *rcdev; - rcdev = devm_kzalloc(&pdev->dev, sizeof(*rcdev), GFP_KERNEL); + rcdev = devm_kzalloc_obj(&pdev->dev, *rcdev); if (!rcdev) return -ENOMEM; diff --git a/arch/arm/mach-omap1/omap-dma.c b/arch/arm/mach-omap1/omap-dma.c index aebe5e55ff60..dec2c0d307f4 100644 --- a/arch/arm/mach-omap1/omap-dma.c +++ b/arch/arm/mach-omap1/omap-dma.c @@ -770,8 +770,7 @@ static int omap_system_dma_probe(struct platform_device *pdev) dma_chan_count = dma_lch_count; enable_1510_mode = d->dev_caps & ENABLE_1510_MODE; - dma_chan = devm_kcalloc(&pdev->dev, dma_lch_count, - sizeof(*dma_chan), GFP_KERNEL); + dma_chan = devm_kzalloc_objs(&pdev->dev, *dma_chan, dma_lch_count); if (!dma_chan) return -ENOMEM; diff --git a/arch/mips/pci/pci-ar2315.c b/arch/mips/pci/pci-ar2315.c index 17fa97ec6ffb..f72802e6c29a 100644 --- a/arch/mips/pci/pci-ar2315.c +++ b/arch/mips/pci/pci-ar2315.c @@ -413,7 +413,7 @@ static int ar2315_pci_probe(struct platform_device *pdev) struct resource *res; int irq, err; - apc = devm_kzalloc(dev, sizeof(*apc), GFP_KERNEL); + apc = devm_kzalloc_obj(dev, *apc); if (!apc) return -ENOMEM; diff --git a/arch/mips/pci/pci-ar71xx.c b/arch/mips/pci/pci-ar71xx.c index 118760b3fa82..0e514b03dd48 100644 --- a/arch/mips/pci/pci-ar71xx.c +++ b/arch/mips/pci/pci-ar71xx.c @@ -331,8 +331,7 @@ static int ar71xx_pci_probe(struct platform_device *pdev) struct resource *res; u32 t; - apc = devm_kzalloc(&pdev->dev, sizeof(struct ar71xx_pci_controller), - GFP_KERNEL); + apc = devm_kzalloc_obj(&pdev->dev, struct ar71xx_pci_controller); if (!apc) return -ENOMEM; diff --git a/arch/mips/pci/pci-ar724x.c b/arch/mips/pci/pci-ar724x.c index 807558b251ef..c36d910967ae 100644 --- a/arch/mips/pci/pci-ar724x.c +++ b/arch/mips/pci/pci-ar724x.c @@ -367,8 +367,7 @@ static int ar724x_pci_probe(struct platform_device *pdev) if (id == -1) id = 0; - apc = devm_kzalloc(&pdev->dev, sizeof(struct ar724x_pci_controller), - GFP_KERNEL); + apc = devm_kzalloc_obj(&pdev->dev, struct ar724x_pci_controller); if (!apc) return -ENOMEM; diff --git a/arch/mips/pci/pci-rt3883.c b/arch/mips/pci/pci-rt3883.c index 14454ece485d..7327d3768904 100644 --- a/arch/mips/pci/pci-rt3883.c +++ b/arch/mips/pci/pci-rt3883.c @@ -410,7 +410,7 @@ static int rt3883_pci_probe(struct platform_device *pdev) int err; int mode; - rpc = devm_kzalloc(dev, sizeof(*rpc), GFP_KERNEL); + rpc = devm_kzalloc_obj(dev, *rpc); if (!rpc) return -ENOMEM; diff --git a/arch/mips/ralink/timer.c b/arch/mips/ralink/timer.c index 06bc2c01420f..1f767f25b5b0 100644 --- a/arch/mips/ralink/timer.c +++ b/arch/mips/ralink/timer.c @@ -102,7 +102,7 @@ static int rt_timer_probe(struct platform_device *pdev) struct rt_timer *rt; struct clk *clk; - rt = devm_kzalloc(&pdev->dev, sizeof(*rt), GFP_KERNEL); + rt = devm_kzalloc_obj(&pdev->dev, *rt); if (!rt) { dev_err(&pdev->dev, "failed to allocate memory\n"); return -ENOMEM; diff --git a/arch/powerpc/platforms/512x/mpc512x_lpbfifo.c b/arch/powerpc/platforms/512x/mpc512x_lpbfifo.c index f251e0f68262..58c79a2914c0 100644 --- a/arch/powerpc/platforms/512x/mpc512x_lpbfifo.c +++ b/arch/powerpc/platforms/512x/mpc512x_lpbfifo.c @@ -382,8 +382,8 @@ static int get_cs_ranges(struct device *dev) of_range_parser_init(&parser, lb_node); lpbfifo.cs_n = of_range_count(&parser); - lpbfifo.cs_ranges = devm_kcalloc(dev, lpbfifo.cs_n, - sizeof(struct cs_range), GFP_KERNEL); + lpbfifo.cs_ranges = devm_kzalloc_objs(dev, struct cs_range, + lpbfifo.cs_n); if (!lpbfifo.cs_ranges) goto end; diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c index e8163fdee69a..0dacf4d2258d 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c @@ -713,7 +713,7 @@ static int mpc52xx_gpt_probe(struct platform_device *ofdev) { struct mpc52xx_gpt_priv *gpt; - gpt = devm_kzalloc(&ofdev->dev, sizeof *gpt, GFP_KERNEL); + gpt = devm_kzalloc_obj(&ofdev->dev, *gpt); if (!gpt) return -ENOMEM; diff --git a/arch/powerpc/platforms/8xx/cpm1-ic.c b/arch/powerpc/platforms/8xx/cpm1-ic.c index 3292071e4da3..f9b37e098728 100644 --- a/arch/powerpc/platforms/8xx/cpm1-ic.c +++ b/arch/powerpc/platforms/8xx/cpm1-ic.c @@ -91,7 +91,7 @@ static int cpm_pic_probe(struct platform_device *pdev) if (!res) return -ENODEV; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/arch/powerpc/platforms/8xx/cpm1.c b/arch/powerpc/platforms/8xx/cpm1.c index b31376bf6778..39e59b13a071 100644 --- a/arch/powerpc/platforms/8xx/cpm1.c +++ b/arch/powerpc/platforms/8xx/cpm1.c @@ -491,7 +491,7 @@ int cpm1_gpiochip_add16(struct device *dev) struct gpio_chip *gc; u32 mask; - cpm1_gc = devm_kzalloc(dev, sizeof(*cpm1_gc), GFP_KERNEL); + cpm1_gc = devm_kzalloc_obj(dev, *cpm1_gc); if (!cpm1_gc) return -ENOMEM; @@ -635,7 +635,7 @@ int cpm1_gpiochip_add32(struct device *dev) struct cpm1_gpio32_chip *cpm1_gc; struct gpio_chip *gc; - cpm1_gc = devm_kzalloc(dev, sizeof(*cpm1_gc), GFP_KERNEL); + cpm1_gc = devm_kzalloc_obj(dev, *cpm1_gc); if (!cpm1_gc) return -ENOMEM; diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c index b5d200e3ad68..104bd803fcd6 100644 --- a/arch/powerpc/sysdev/cpm_common.c +++ b/arch/powerpc/sysdev/cpm_common.c @@ -199,7 +199,7 @@ int cpm2_gpiochip_add32(struct device *dev) struct cpm2_gpio32_chip *cpm2_gc; struct gpio_chip *gc; - cpm2_gc = devm_kzalloc(dev, sizeof(*cpm2_gc), GFP_KERNEL); + cpm2_gc = devm_kzalloc_obj(dev, *cpm2_gc); if (!cpm2_gc) return -ENOMEM; diff --git a/arch/sparc/kernel/leon_pci_grpci1.c b/arch/sparc/kernel/leon_pci_grpci1.c index b2b639bee068..d02067feaea8 100644 --- a/arch/sparc/kernel/leon_pci_grpci1.c +++ b/arch/sparc/kernel/leon_pci_grpci1.c @@ -528,7 +528,7 @@ static int grpci1_of_probe(struct platform_device *ofdev) return -EIO; } - priv = devm_kzalloc(&ofdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&ofdev->dev, *priv); if (!priv) { dev_err(&ofdev->dev, "memory allocation failed\n"); return -ENOMEM; diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c index 881c34098a74..787308e26db7 100644 --- a/arch/um/drivers/virtio_uml.c +++ b/arch/um/drivers/virtio_uml.c @@ -1196,7 +1196,7 @@ virtio_uml_create_pdata(struct platform_device *pdev) if (!np) return ERR_PTR(-EINVAL); - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); diff --git a/arch/x86/platform/intel-mid/pwr.c b/arch/x86/platform/intel-mid/pwr.c index cd7e0c71adde..3b1ca888c23f 100644 --- a/arch/x86/platform/intel-mid/pwr.c +++ b/arch/x86/platform/intel-mid/pwr.c @@ -358,7 +358,7 @@ static int mid_pwr_probe(struct pci_dev *pdev, const struct pci_device_id *id) return ret; } - pwr = devm_kzalloc(dev, sizeof(*pwr), GFP_KERNEL); + pwr = devm_kzalloc_obj(dev, *pwr); if (!pwr) return -ENOMEM; diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c index 3d07dd5de4fa..f834be86788a 100644 --- a/crypto/crypto_engine.c +++ b/crypto/crypto_engine.c @@ -439,7 +439,7 @@ struct crypto_engine *crypto_engine_alloc_init_and_set(struct device *dev, if (!dev) return NULL; - engine = devm_kzalloc(dev, sizeof(*engine), GFP_KERNEL); + engine = devm_kzalloc_obj(dev, *engine); if (!engine) return NULL; diff --git a/drivers/accel/qaic/mhi_controller.c b/drivers/accel/qaic/mhi_controller.c index c720b70b1e0f..f47854fb88e2 100644 --- a/drivers/accel/qaic/mhi_controller.c +++ b/drivers/accel/qaic/mhi_controller.c @@ -1011,7 +1011,7 @@ struct mhi_controller *qaic_mhi_register_controller(struct pci_dev *pci_dev, voi struct mhi_controller *mhi_cntrl; int ret; - mhi_cntrl = devm_kzalloc(&pci_dev->dev, sizeof(*mhi_cntrl), GFP_KERNEL); + mhi_cntrl = devm_kzalloc_obj(&pci_dev->dev, *mhi_cntrl); if (!mhi_cntrl) return ERR_PTR(-ENOMEM); @@ -1032,7 +1032,7 @@ struct mhi_controller *qaic_mhi_register_controller(struct pci_dev *pci_dev, voi mhi_cntrl->regs = mhi_bar; mhi_cntrl->reg_len = SZ_4K; mhi_cntrl->nr_irqs = 1; - mhi_cntrl->irq = devm_kmalloc(&pci_dev->dev, sizeof(*mhi_cntrl->irq), GFP_KERNEL); + mhi_cntrl->irq = devm_kmalloc_obj(&pci_dev->dev, *mhi_cntrl->irq); if (!mhi_cntrl->irq) return ERR_PTR(-ENOMEM); diff --git a/drivers/accel/qaic/qaic_debugfs.c b/drivers/accel/qaic/qaic_debugfs.c index 909a4d774d90..8ee979fdbe8e 100644 --- a/drivers/accel/qaic/qaic_debugfs.c +++ b/drivers/accel/qaic/qaic_debugfs.c @@ -221,7 +221,7 @@ static int qaic_bootlog_mhi_probe(struct mhi_device *mhi_dev, const struct mhi_d qdev->bootlog_ch = mhi_dev; for (i = 0; i < BOOTLOG_POOL_SIZE; i++) { - msg = devm_kzalloc(&qdev->pdev->dev, sizeof(*msg), GFP_KERNEL); + msg = devm_kzalloc_obj(&qdev->pdev->dev, *msg); if (!msg) { ret = -ENOMEM; goto mhi_unprepare; diff --git a/drivers/accel/qaic/qaic_drv.c b/drivers/accel/qaic/qaic_drv.c index 9e1e184efe0d..90c0d31e414a 100644 --- a/drivers/accel/qaic/qaic_drv.c +++ b/drivers/accel/qaic/qaic_drv.c @@ -415,7 +415,7 @@ static struct qaic_device *create_qdev(struct pci_dev *pdev, struct drm_device *drm; int i, ret; - qdev = devm_kzalloc(dev, struct_size(qdev, dbc, DBC_NUM), GFP_KERNEL); + qdev = devm_kzalloc_flex(dev, *qdev, dbc, DBC_NUM); if (!qdev) return NULL; diff --git a/drivers/accel/qaic/sahara.c b/drivers/accel/qaic/sahara.c index e951181e424f..18884b4ac5c6 100644 --- a/drivers/accel/qaic/sahara.c +++ b/drivers/accel/qaic/sahara.c @@ -800,7 +800,7 @@ static int sahara_mhi_probe(struct mhi_device *mhi_dev, const struct mhi_device_ int ret; int i; - context = devm_kzalloc(&mhi_dev->dev, sizeof(*context), GFP_KERNEL); + context = devm_kzalloc_obj(&mhi_dev->dev, *context); if (!context) return -ENOMEM; diff --git a/drivers/accel/rocket/rocket_device.c b/drivers/accel/rocket/rocket_device.c index efd004194c1a..db137e2ec15e 100644 --- a/drivers/accel/rocket/rocket_device.c +++ b/drivers/accel/rocket/rocket_device.c @@ -33,7 +33,7 @@ struct rocket_device *rocket_device_init(struct platform_device *pdev, rdev->max_cores = num_cores; - rdev->cores = devm_kcalloc(dev, num_cores, sizeof(*rdev->cores), GFP_KERNEL); + rdev->cores = devm_kzalloc_objs(dev, *rdev->cores, num_cores); if (!rdev->cores) return ERR_PTR(-ENOMEM); diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index f19d6dd43473..14a06c9c6380 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c @@ -202,7 +202,7 @@ static int acpi_ac_probe(struct platform_device *pdev) if (!adev) return -ENODEV; - ac = devm_kzalloc(dev, sizeof(*ac), GFP_KERNEL); + ac = devm_kzalloc_obj(dev, *ac); if (!ac) return -ENOMEM; diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c index 9fc667d6776c..ea226fd98756 100644 --- a/drivers/acpi/acpi_apd.c +++ b/drivers/acpi/acpi_apd.c @@ -72,7 +72,7 @@ static int fch_misc_setup(struct apd_private_data *pdata) struct list_head resource_list; int ret; - clk_data = devm_kzalloc(&adev->dev, sizeof(*clk_data), GFP_KERNEL); + clk_data = devm_kzalloc_obj(&adev->dev, *clk_data); if (!clk_data) return -ENOMEM; diff --git a/drivers/acpi/acpi_tad.c b/drivers/acpi/acpi_tad.c index 45459a4cafae..5fcb0bee3710 100644 --- a/drivers/acpi/acpi_tad.c +++ b/drivers/acpi/acpi_tad.c @@ -853,7 +853,7 @@ static int acpi_tad_probe(struct platform_device *pdev) if (!(caps & ACPI_TAD_AC_WAKE)) caps &= ~ACPI_TAD_DC_WAKE; - dd = devm_kzalloc(dev, sizeof(*dd), GFP_KERNEL); + dd = devm_kzalloc_obj(dev, *dd); if (!dd) return -ENOMEM; diff --git a/drivers/acpi/apei/ghes-nvidia.c b/drivers/acpi/apei/ghes-nvidia.c index 597275d81de8..bdd797fcb054 100644 --- a/drivers/acpi/apei/ghes-nvidia.c +++ b/drivers/acpi/apei/ghes-nvidia.c @@ -112,7 +112,7 @@ static int nvidia_ghes_probe(struct platform_device *pdev) struct nvidia_ghes_private *priv; int ret; - priv = devm_kmalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kmalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 6edea559a5bc..1db23627addf 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -1476,7 +1476,7 @@ static int acpi_battery_probe(struct platform_device *pdev) if (device->dep_unmet) return -EPROBE_DEFER; - battery = devm_kzalloc(dev, sizeof(*battery), GFP_KERNEL); + battery = devm_kzalloc_obj(dev, *battery); if (!battery) return -ENOMEM; diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 34c7173b5a6c..91a4e9698f7a 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -687,7 +687,7 @@ static int acpi_button_probe(struct platform_device *pdev) lid_init_state == ACPI_BUTTON_LID_INIT_DISABLED) return -ENODEV; - button = devm_kzalloc(dev, sizeof(*button), GFP_KERNEL); + button = devm_kzalloc_obj(dev, *button); if (!button) return -ENOMEM; diff --git a/drivers/acpi/evged.c b/drivers/acpi/evged.c index 5c35cbc7f6ff..b79ee3f5c1c3 100644 --- a/drivers/acpi/evged.c +++ b/drivers/acpi/evged.c @@ -115,7 +115,7 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares, return AE_ERROR; } - event = devm_kzalloc(dev, sizeof(*event), GFP_KERNEL); + event = devm_kzalloc_obj(dev, *event); if (!event) return AE_ERROR; @@ -143,7 +143,7 @@ static int ged_probe(struct platform_device *pdev) struct acpi_ged_device *geddev; acpi_status acpi_ret; - geddev = devm_kzalloc(&pdev->dev, sizeof(*geddev), GFP_KERNEL); + geddev = devm_kzalloc_obj(&pdev->dev, *geddev); if (!geddev) return -ENOMEM; diff --git a/drivers/acpi/fan_core.c b/drivers/acpi/fan_core.c index 3674f9613d40..4324ff5d9c4c 100644 --- a/drivers/acpi/fan_core.c +++ b/drivers/acpi/fan_core.c @@ -287,7 +287,7 @@ static int acpi_fan_get_fps(struct device *dev, struct acpi_device *device) } fan->fps_count = obj->package.count - 1; /* minus revision field */ - fan->fps = devm_kcalloc(dev, fan->fps_count, sizeof(*fan->fps), GFP_KERNEL); + fan->fps = devm_kzalloc_objs(dev, *fan->fps, fan->fps_count); if (!fan->fps) return -ENOMEM; @@ -475,7 +475,7 @@ static int acpi_fan_probe(struct platform_device *pdev) if (!device) return -ENODEV; - fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL); + fan = devm_kzalloc_obj(&pdev->dev, *fan); if (!fan) { dev_err(&device->dev, "No memory for fan\n"); return -ENOMEM; diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index cb771d9cadb2..591d2608374f 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -1060,8 +1060,7 @@ static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc, if (found) nfit_mem = found; else { - nfit_mem = devm_kzalloc(acpi_desc->dev, - sizeof(*nfit_mem), GFP_KERNEL); + nfit_mem = devm_kzalloc_obj(acpi_desc->dev, *nfit_mem); if (!nfit_mem) return -ENOMEM; INIT_LIST_HEAD(&nfit_mem->list); @@ -1095,10 +1094,9 @@ static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc, continue; nfit_mem->nfit_flush = nfit_flush; flush = nfit_flush->flush; - nfit_mem->flush_wpq = devm_kcalloc(acpi_desc->dev, - flush->hint_count, - sizeof(struct resource), - GFP_KERNEL); + nfit_mem->flush_wpq = devm_kzalloc_objs(acpi_desc->dev, + struct resource, + flush->hint_count); if (!nfit_mem->flush_wpq) return -ENOMEM; for (i = 0; i < flush->hint_count; i++) { @@ -2287,7 +2285,7 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc, if (!info || !info2) return -ENOMEM; - nd_set = devm_kzalloc(dev, sizeof(*nd_set), GFP_KERNEL); + nd_set = devm_kzalloc_obj(dev, *nd_set); if (!nd_set) return -ENOMEM; import_guid(&nd_set->type_guid, spa->range_guid); @@ -2541,7 +2539,7 @@ static int acpi_nfit_insert_resource(struct acpi_nfit_desc *acpi_desc, if (is_pmem == REGION_INTERSECTS) return 0; - res = devm_kzalloc(acpi_desc->dev, sizeof(*res), GFP_KERNEL); + res = devm_kzalloc_obj(acpi_desc->dev, *res); if (!res) return -ENOMEM; @@ -3391,7 +3389,7 @@ static int acpi_nfit_probe(struct platform_device *pdev) return rc; sz = tbl->length; - acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL); + acpi_desc = devm_kzalloc_obj(dev, *acpi_desc); if (!acpi_desc) return -ENOMEM; acpi_nfit_desc_init(acpi_desc, dev); @@ -3456,7 +3454,7 @@ static void acpi_nfit_update_notify(struct device *dev, acpi_handle handle) } if (!acpi_desc) { - acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL); + acpi_desc = devm_kzalloc_obj(dev, *acpi_desc); if (!acpi_desc) return; acpi_nfit_desc_init(acpi_desc, dev); diff --git a/drivers/acpi/pfr_telemetry.c b/drivers/acpi/pfr_telemetry.c index 2387376832a1..458cb99ae216 100644 --- a/drivers/acpi/pfr_telemetry.c +++ b/drivers/acpi/pfr_telemetry.c @@ -373,7 +373,7 @@ static int acpi_pfrt_log_probe(struct platform_device *pdev) return -ENODEV; } - pfrt_log_dev = devm_kzalloc(&pdev->dev, sizeof(*pfrt_log_dev), GFP_KERNEL); + pfrt_log_dev = devm_kzalloc_obj(&pdev->dev, *pfrt_log_dev); if (!pfrt_log_dev) return -ENOMEM; diff --git a/drivers/acpi/pfr_update.c b/drivers/acpi/pfr_update.c index 98ace679601b..459c2938b975 100644 --- a/drivers/acpi/pfr_update.c +++ b/drivers/acpi/pfr_update.c @@ -554,7 +554,7 @@ static int acpi_pfru_probe(struct platform_device *pdev) return -ENODEV; } - pfru_dev = devm_kzalloc(&pdev->dev, sizeof(*pfru_dev), GFP_KERNEL); + pfru_dev = devm_kzalloc_obj(&pdev->dev, *pfru_dev); if (!pfru_dev) return -ENOMEM; diff --git a/drivers/acpi/pmic/intel_pmic.c b/drivers/acpi/pmic/intel_pmic.c index 9bd46defc5a2..367adef02cd7 100644 --- a/drivers/acpi/pmic/intel_pmic.c +++ b/drivers/acpi/pmic/intel_pmic.c @@ -262,7 +262,7 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle, if (!handle) return -ENODEV; - opregion = devm_kzalloc(dev, sizeof(*opregion), GFP_KERNEL); + opregion = devm_kzalloc_obj(dev, *opregion); if (!opregion) return -ENOMEM; diff --git a/drivers/acpi/pmic/tps68470_pmic.c b/drivers/acpi/pmic/tps68470_pmic.c index 0d1a82eeb4b0..ffd615ff55d3 100644 --- a/drivers/acpi/pmic/tps68470_pmic.c +++ b/drivers/acpi/pmic/tps68470_pmic.c @@ -384,7 +384,7 @@ static int tps68470_pmic_opregion_probe(struct platform_device *pdev) return -ENODEV; } - opregion = devm_kzalloc(dev, sizeof(*opregion), GFP_KERNEL); + opregion = devm_kzalloc_obj(dev, *opregion); if (!opregion) return -ENOMEM; diff --git a/drivers/ata/acard-ahci.c b/drivers/ata/acard-ahci.c index 402d3304b94b..044b0bfdf46f 100644 --- a/drivers/ata/acard-ahci.c +++ b/drivers/ata/acard-ahci.c @@ -281,7 +281,7 @@ static int acard_ahci_port_start(struct ata_port *ap) dma_addr_t mem_dma; size_t dma_sz, rx_fis_sz; - pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); + pp = devm_kzalloc_obj(dev, *pp); if (!pp) return -ENOMEM; @@ -378,7 +378,7 @@ static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id if (rc) return rc; - hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); + hpriv = devm_kzalloc_obj(dev, *hpriv); if (!hpriv) return -ENOMEM; diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 4916d9bf3293..839adb0afea6 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -2931,7 +2931,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (rc) return rc; - hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); + hpriv = devm_kzalloc_obj(dev, *hpriv); if (!hpriv) return -ENOMEM; hpriv->flags |= (unsigned long)pi.private_data; diff --git a/drivers/ata/ahci_brcm.c b/drivers/ata/ahci_brcm.c index 48460e515722..59d26613efa2 100644 --- a/drivers/ata/ahci_brcm.c +++ b/drivers/ata/ahci_brcm.c @@ -443,7 +443,7 @@ static int brcm_ahci_probe(struct platform_device *pdev) struct ahci_host_priv *hpriv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/ata/ahci_ceva.c b/drivers/ata/ahci_ceva.c index 008869d9499b..95edb7a13069 100644 --- a/drivers/ata/ahci_ceva.c +++ b/drivers/ata/ahci_ceva.c @@ -268,7 +268,7 @@ static int ceva_ahci_probe(struct platform_device *pdev) enum dev_dma_attr attr; int rc; - cevapriv = devm_kzalloc(dev, sizeof(*cevapriv), GFP_KERNEL); + cevapriv = devm_kzalloc_obj(dev, *cevapriv); if (!cevapriv) return -ENOMEM; diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c index 59b9ca26fd44..7c607fe16b14 100644 --- a/drivers/ata/ahci_da850.c +++ b/drivers/ata/ahci_da850.c @@ -178,7 +178,7 @@ static int ahci_da850_probe(struct platform_device *pdev) * getting procedure with the explicitly specified ids. */ if (hpriv->n_clks < 2) { - hpriv->clks = devm_kcalloc(dev, 2, sizeof(*hpriv->clks), GFP_KERNEL); + hpriv->clks = devm_kzalloc_objs(dev, *hpriv->clks, 2); if (!hpriv->clks) return -ENOMEM; diff --git a/drivers/ata/ahci_dwc.c b/drivers/ata/ahci_dwc.c index feb8a8539b8e..c49da659387a 100644 --- a/drivers/ata/ahci_dwc.c +++ b/drivers/ata/ahci_dwc.c @@ -111,7 +111,7 @@ static struct ahci_host_priv *ahci_dwc_get_resources(struct platform_device *pde struct ahci_dwc_host_priv *dpriv; struct ahci_host_priv *hpriv; - dpriv = devm_kzalloc(&pdev->dev, sizeof(*dpriv), GFP_KERNEL); + dpriv = devm_kzalloc_obj(&pdev->dev, *dpriv); if (!dpriv) return ERR_PTR(-ENOMEM); diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index 6aaa18e29abc..882dcb87ba5f 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c @@ -863,7 +863,7 @@ static int imx_ahci_probe(struct platform_device *pdev) unsigned int reg_val; int ret; - imxpriv = devm_kzalloc(dev, sizeof(*imxpriv), GFP_KERNEL); + imxpriv = devm_kzalloc_obj(dev, *imxpriv); if (!imxpriv) return -ENOMEM; diff --git a/drivers/ata/ahci_mtk.c b/drivers/ata/ahci_mtk.c index 7295b9066ae2..fe0643585b20 100644 --- a/drivers/ata/ahci_mtk.c +++ b/drivers/ata/ahci_mtk.c @@ -129,7 +129,7 @@ static int mtk_ahci_probe(struct platform_device *pdev) struct ahci_host_priv *hpriv; int err; - plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL); + plat = devm_kzalloc_obj(dev, *plat); if (!plat) return -ENOMEM; diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c index fc6b8cd75b32..a5578c27147a 100644 --- a/drivers/ata/ahci_qoriq.c +++ b/drivers/ata/ahci_qoriq.c @@ -274,7 +274,7 @@ static int ahci_qoriq_probe(struct platform_device *pdev) if (!(of_id || acpi_id)) return -ENODEV; - qoriq_priv = devm_kzalloc(dev, sizeof(*qoriq_priv), GFP_KERNEL); + qoriq_priv = devm_kzalloc_obj(dev, *qoriq_priv); if (!qoriq_priv) return -ENOMEM; diff --git a/drivers/ata/ahci_seattle.c b/drivers/ata/ahci_seattle.c index 9758fa0260ac..b73b86e74c4a 100644 --- a/drivers/ata/ahci_seattle.c +++ b/drivers/ata/ahci_seattle.c @@ -127,7 +127,7 @@ static const struct ata_port_info *ahci_seattle_get_port_info( struct seattle_plat_data *plat_data; u32 val; - plat_data = devm_kzalloc(dev, sizeof(*plat_data), GFP_KERNEL); + plat_data = devm_kzalloc_obj(dev, *plat_data); if (!plat_data) return &ahci_port_info; diff --git a/drivers/ata/ahci_st.c b/drivers/ata/ahci_st.c index eea75961038c..7192769311f4 100644 --- a/drivers/ata/ahci_st.c +++ b/drivers/ata/ahci_st.c @@ -153,7 +153,7 @@ static int st_ahci_probe(struct platform_device *pdev) struct ahci_host_priv *hpriv; int err; - drv_data = devm_kzalloc(&pdev->dev, sizeof(*drv_data), GFP_KERNEL); + drv_data = devm_kzalloc_obj(&pdev->dev, *drv_data); if (!drv_data) return -ENOMEM; diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c index 554f05e09f98..2b9b98643128 100644 --- a/drivers/ata/ahci_tegra.c +++ b/drivers/ata/ahci_tegra.c @@ -523,7 +523,7 @@ static int tegra_ahci_probe(struct platform_device *pdev) if (IS_ERR(hpriv)) return PTR_ERR(hpriv); - tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL); + tegra = devm_kzalloc_obj(&pdev->dev, *tegra); if (!tegra) return -ENOMEM; @@ -578,9 +578,8 @@ static int tegra_ahci_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(tegra->pmc), "failed to get PMC\n"); - tegra->supplies = devm_kcalloc(&pdev->dev, - tegra->soc->num_supplies, - sizeof(*tegra->supplies), GFP_KERNEL); + tegra->supplies = devm_kzalloc_objs(&pdev->dev, *tegra->supplies, + tegra->soc->num_supplies); if (!tegra->supplies) return -ENOMEM; diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index 2ebfe86e429b..8a34d8741fe9 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c @@ -739,7 +739,7 @@ static int xgene_ahci_probe(struct platform_device *pdev) if (IS_ERR(hpriv)) return PTR_ERR(hpriv); - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index e3aa5c86fb48..b0ec0a57ef71 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c @@ -1855,7 +1855,7 @@ static int piix_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (rc) return rc; - hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); + hpriv = devm_kzalloc_obj(dev, *hpriv); if (!hpriv) return -ENOMEM; diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 001a6f5e4172..5ce34683d468 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c @@ -2514,7 +2514,7 @@ static int ahci_port_start(struct ata_port *ap) dma_addr_t mem_dma; size_t dma_sz, rx_fis_sz; - pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); + pp = devm_kzalloc_obj(dev, *pp); if (!pp) return -ENOMEM; diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index ae342080556a..992702df87da 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c @@ -539,7 +539,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, * No clock bulk found: fallback to manually getting * the optional clock. */ - hpriv->clks = devm_kzalloc(dev, sizeof(*hpriv->clks), GFP_KERNEL); + hpriv->clks = devm_kzalloc_obj(dev, *hpriv->clks); if (!hpriv->clks) { rc = -ENOMEM; goto err_out; diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index a4f0f81844a1..67b2272c7c91 100644 --- a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c @@ -197,7 +197,7 @@ static int pacpi_port_start(struct ata_port *ap) if (ACPI_HANDLE(&ap->tdev) == NULL) return -ENODEV; - acpi = ap->private_data = devm_kzalloc(&pdev->dev, sizeof(struct pata_acpi), GFP_KERNEL); + acpi = ap->private_data = devm_kzalloc_obj(&pdev->dev, struct pata_acpi); if (ap->private_data == NULL) return -ENOMEM; acpi->mask[0] = pacpi_discover_modes(ap, &ap->link.device[0]); diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c index a652a1b57338..12f1324461d1 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c @@ -804,7 +804,7 @@ static int arasan_cf_probe(struct platform_device *pdev) irq_handler_t irq_handler = NULL; int ret; - acdev = devm_kzalloc(&pdev->dev, sizeof(*acdev), GFP_KERNEL); + acdev = devm_kzalloc_obj(&pdev->dev, *acdev); if (!acdev) return -ENOMEM; diff --git a/drivers/ata/pata_atp867x.c b/drivers/ata/pata_atp867x.c index 6154a2bf19be..7d1283d3ad7d 100644 --- a/drivers/ata/pata_atp867x.c +++ b/drivers/ata/pata_atp867x.c @@ -340,7 +340,7 @@ static int atp867x_set_priv(struct ata_port *ap) int port = ap->port_no; dp = ap->private_data = - devm_kzalloc(&pdev->dev, sizeof(*dp), GFP_KERNEL); + devm_kzalloc_obj(&pdev->dev, *dp); if (dp == NULL) return -ENOMEM; diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c index 84eb36d02d7d..6bf58d0dc0ab 100644 --- a/drivers/ata/pata_cmd640.c +++ b/drivers/ata/pata_cmd640.c @@ -153,7 +153,7 @@ static int cmd640_port_start(struct ata_port *ap) struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct cmd640_reg *timing; - timing = devm_kzalloc(&pdev->dev, sizeof(struct cmd640_reg), GFP_KERNEL); + timing = devm_kzalloc_obj(&pdev->dev, struct cmd640_reg); if (timing == NULL) return -ENOMEM; timing->last = -1; /* Force a load */ diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c index 339ee5e43e9f..cb4e4c0478b0 100644 --- a/drivers/ata/pata_ep93xx.c +++ b/drivers/ata/pata_ep93xx.c @@ -945,7 +945,7 @@ static int ep93xx_pata_probe(struct platform_device *pdev) if (IS_ERR(ide_base)) return PTR_ERR(ide_base); - drv_data = devm_kzalloc(&pdev->dev, sizeof(*drv_data), GFP_KERNEL); + drv_data = devm_kzalloc_obj(&pdev->dev, *drv_data); if (!drv_data) return -ENOMEM; diff --git a/drivers/ata/pata_ftide010.c b/drivers/ata/pata_ftide010.c index c41da296eb38..0b9678c7cc4f 100644 --- a/drivers/ata/pata_ftide010.c +++ b/drivers/ata/pata_ftide010.c @@ -460,7 +460,7 @@ static int pata_ftide010_probe(struct platform_device *pdev) int ret; int i; - ftide = devm_kzalloc(dev, sizeof(*ftide), GFP_KERNEL); + ftide = devm_kzalloc_obj(dev, *ftide); if (!ftide) return -ENOMEM; ftide->dev = dev; diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c index 70f056e47e6b..ff9322ee18f7 100644 --- a/drivers/ata/pata_icside.c +++ b/drivers/ata/pata_icside.c @@ -489,7 +489,7 @@ static int pata_icside_probe(struct expansion_card *ec, if (ret) goto out; - state = devm_kzalloc(&ec->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&ec->dev, *state); if (!state) { ret = -ENOMEM; goto release; diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c index ad559058cfe6..462efc17d55f 100644 --- a/drivers/ata/pata_imx.c +++ b/drivers/ata/pata_imx.c @@ -135,8 +135,7 @@ static int pata_imx_probe(struct platform_device *pdev) if (irq < 0) return irq; - priv = devm_kzalloc(&pdev->dev, - sizeof(struct pata_imx_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct pata_imx_priv); if (!priv) return -ENOMEM; diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index fc762dcc61bf..fd14bfee6847 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c @@ -746,7 +746,7 @@ static int it821x_port_start(struct ata_port *ap) if (ret < 0) return ret; - itdev = devm_kzalloc(&pdev->dev, sizeof(struct it821x_dev), GFP_KERNEL); + itdev = devm_kzalloc_obj(&pdev->dev, struct it821x_dev); if (itdev == NULL) return -ENOMEM; ap->private_data = itdev; diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c index 80f6a91acf6f..220429326511 100644 --- a/drivers/ata/pata_ixp4xx_cf.c +++ b/drivers/ata/pata_ixp4xx_cf.c @@ -242,7 +242,7 @@ static int ixp4xx_pata_probe(struct platform_device *pdev) int ret; int irq; - ixpp = devm_kzalloc(dev, sizeof(*ixpp), GFP_KERNEL); + ixpp = devm_kzalloc_obj(dev, *ixpp); if (!ixpp) return -ENOMEM; diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c index dd93f613f959..a11a1eae2ae8 100644 --- a/drivers/ata/pata_macio.c +++ b/drivers/ata/pata_macio.c @@ -1146,8 +1146,7 @@ static int pata_macio_attach(struct macio_dev *mdev, macio_enable_devres(mdev); /* Allocate and init private data structure */ - priv = devm_kzalloc(&mdev->ofdev.dev, - sizeof(struct pata_macio_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&mdev->ofdev.dev, struct pata_macio_priv); if (!priv) return -ENOMEM; @@ -1288,8 +1287,7 @@ static int pata_macio_pci_attach(struct pci_dev *pdev, } /* Allocate and init private data structure */ - priv = devm_kzalloc(&pdev->dev, - sizeof(struct pata_macio_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct pata_macio_priv); if (!priv) return -ENOMEM; diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c index 1739743427cf..6400278d5314 100644 --- a/drivers/ata/pata_mpc52xx.c +++ b/drivers/ata/pata_mpc52xx.c @@ -737,7 +737,7 @@ static int mpc52xx_ata_probe(struct platform_device *op) } /* Prepare our private structure */ - priv = devm_kzalloc(&op->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&op->dev, *priv); if (!priv) { rv = -ENOMEM; goto err1; diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c index df42ebe98db7..3448700b007c 100644 --- a/drivers/ata/pata_octeon_cf.c +++ b/drivers/ata/pata_octeon_cf.c @@ -821,7 +821,7 @@ static int octeon_cf_probe(struct platform_device *pdev) if (node == NULL) return -EINVAL; - cf_port = devm_kzalloc(&pdev->dev, sizeof(*cf_port), GFP_KERNEL); + cf_port = devm_kzalloc_obj(&pdev->dev, *cf_port); if (!cf_port) return -ENOMEM; diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c index 87479bc893b2..289f03637365 100644 --- a/drivers/ata/pata_platform.c +++ b/drivers/ata/pata_platform.c @@ -127,7 +127,7 @@ int __pata_platform_probe(struct device *dev, struct resource *io_res, return -ENOMEM; ap = host->ports[0]; - ap->ops = devm_kzalloc(dev, sizeof(*ap->ops), GFP_KERNEL); + ap->ops = devm_kzalloc_obj(dev, *ap->ops); if (!ap->ops) return -ENOMEM; ap->ops->inherits = &ata_sff_port_ops; diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c index a694f6a178e3..ed8c19db207c 100644 --- a/drivers/ata/pata_pxa.c +++ b/drivers/ata/pata_pxa.c @@ -244,8 +244,7 @@ static int pxa_ata_probe(struct platform_device *pdev) /* * Allocate and load driver's internal data structure */ - data = devm_kzalloc(&pdev->dev, sizeof(struct pata_pxa_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct pata_pxa_data); if (!data) return -ENOMEM; diff --git a/drivers/ata/pata_rb532_cf.c b/drivers/ata/pata_rb532_cf.c index 0144e597707e..ef100a68f671 100644 --- a/drivers/ata/pata_rb532_cf.c +++ b/drivers/ata/pata_rb532_cf.c @@ -130,7 +130,7 @@ static int rb532_pata_driver_probe(struct platform_device *pdev) if (!ah) return -ENOMEM; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/ata/pata_rdc.c b/drivers/ata/pata_rdc.c index 6ff4c11e937d..b68aa46b0988 100644 --- a/drivers/ata/pata_rdc.c +++ b/drivers/ata/pata_rdc.c @@ -326,7 +326,7 @@ static int rdc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (rc) return rc; - hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); + hpriv = devm_kzalloc_obj(dev, *hpriv); if (!hpriv) return -ENOMEM; diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index cb53fe698c6e..e0ada6fb78c6 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c @@ -435,7 +435,7 @@ static int via_port_start(struct ata_port *ap) if (ret < 0) return ret; - vp = devm_kzalloc(&pdev->dev, sizeof(struct via_port), GFP_KERNEL); + vp = devm_kzalloc_obj(&pdev->dev, struct via_port); if (vp == NULL) return -ENOMEM; ap->private_data = vp; diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c index 30aaf5c5337b..31626555b8fd 100644 --- a/drivers/ata/pdc_adma.c +++ b/drivers/ata/pdc_adma.c @@ -508,7 +508,7 @@ static int adma_port_start(struct ata_port *ap) struct adma_port_priv *pp; adma_enter_reg_mode(ap); - pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); + pp = devm_kzalloc_obj(dev, *pp); if (!pp) return -ENOMEM; pp->pkt = dmam_alloc_coherent(dev, ADMA_PKT_BYTES, &pp->pkt_dma, diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c index aa816a1a4c54..486ea94a0184 100644 --- a/drivers/ata/sata_dwc_460ex.c +++ b/drivers/ata/sata_dwc_460ex.c @@ -226,7 +226,7 @@ static int sata_dwc_dma_init_old(struct platform_device *pdev, { struct device *dev = &pdev->dev; - hsdev->dma = devm_kzalloc(dev, sizeof(*hsdev->dma), GFP_KERNEL); + hsdev->dma = devm_kzalloc_obj(dev, *hsdev->dma); if (!hsdev->dma) return -ENOMEM; @@ -1129,7 +1129,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) /* Allocate DWC SATA device */ host = ata_host_alloc_pinfo(dev, ppi, SATA_DWC_MAX_PORTS); - hsdev = devm_kzalloc(dev, sizeof(*hsdev), GFP_KERNEL); + hsdev = devm_kzalloc_obj(dev, *hsdev); if (!host || !hsdev) return -ENOMEM; diff --git a/drivers/ata/sata_gemini.c b/drivers/ata/sata_gemini.c index 56ae2820df58..9d87603ef531 100644 --- a/drivers/ata/sata_gemini.c +++ b/drivers/ata/sata_gemini.c @@ -293,7 +293,7 @@ static int gemini_sata_probe(struct platform_device *pdev) u32 gmask; int ret; - sg = devm_kzalloc(dev, sizeof(*sg), GFP_KERNEL); + sg = devm_kzalloc_obj(dev, *sg); if (!sg) return -ENOMEM; sg->dev = dev; diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c index a0b6e197cfb5..435e658b2c66 100644 --- a/drivers/ata/sata_highbank.c +++ b/drivers/ata/sata_highbank.c @@ -473,12 +473,12 @@ static int ahci_highbank_probe(struct platform_device *pdev) if (!irq) return -EINVAL; - hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); + hpriv = devm_kzalloc_obj(dev, *hpriv); if (!hpriv) { dev_err(dev, "can't alloc ahci_host_priv\n"); return -ENOMEM; } - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) { dev_err(dev, "can't alloc ecx_plat_data\n"); return -ENOMEM; diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index c408d04d9bf7..08c0bddcb7cc 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c @@ -1675,7 +1675,7 @@ static int mv_port_start(struct ata_port *ap) unsigned long flags; int tag; - pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); + pp = devm_kzalloc_obj(dev, *pp); if (!pp) return -ENOMEM; ap->private_data = pp; @@ -4067,18 +4067,14 @@ static int mv_platform_probe(struct platform_device *pdev) return irq; host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); - hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); + hpriv = devm_kzalloc_obj(&pdev->dev, *hpriv); if (!host || !hpriv) return -ENOMEM; - hpriv->port_clks = devm_kcalloc(&pdev->dev, - n_ports, sizeof(struct clk *), - GFP_KERNEL); + hpriv->port_clks = devm_kzalloc_objs(&pdev->dev, struct clk *, n_ports); if (!hpriv->port_clks) return -ENOMEM; - hpriv->port_phys = devm_kcalloc(&pdev->dev, - n_ports, sizeof(struct phy *), - GFP_KERNEL); + hpriv->port_phys = devm_kzalloc_objs(&pdev->dev, struct phy *, n_ports); if (!hpriv->port_phys) return -ENOMEM; host->private_data = hpriv; @@ -4361,7 +4357,7 @@ static int mv_pci_init_one(struct pci_dev *pdev, n_ports = mv_get_hc_count(ppi[0]->flags) * MV_PORTS_PER_HC; host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); - hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); + hpriv = devm_kzalloc_obj(&pdev->dev, *hpriv); if (!host || !hpriv) return -ENOMEM; host->private_data = hpriv; diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 8624cd4e88cc..4ddfaac9decd 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c @@ -1145,7 +1145,7 @@ static int nv_adma_port_start(struct ata_port *ap) if (rc) return rc; - pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); + pp = devm_kzalloc_obj(dev, *pp); if (!pp) return -ENOMEM; @@ -1960,7 +1960,7 @@ static int nv_swncq_port_start(struct ata_port *ap) if (rc) return rc; - pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); + pp = devm_kzalloc_obj(dev, *pp); if (!pp) return -ENOMEM; @@ -2376,7 +2376,7 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (rc) return rc; - hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); + hpriv = devm_kzalloc_obj(&pdev->dev, *hpriv); if (!hpriv) return -ENOMEM; hpriv->type = type; diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index 6da1dea00b84..9ca1ba5583ee 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c @@ -322,7 +322,7 @@ static int pdc_common_port_start(struct ata_port *ap) if (rc) return rc; - pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); + pp = devm_kzalloc_obj(dev, *pp); if (!pp) return -ENOMEM; @@ -1189,7 +1189,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev, dev_err(&pdev->dev, "failed to allocate host\n"); return -ENOMEM; } - hpriv = devm_kzalloc(&pdev->dev, sizeof *hpriv, GFP_KERNEL); + hpriv = devm_kzalloc_obj(&pdev->dev, *hpriv); if (!hpriv) return -ENOMEM; spin_lock_init(&hpriv->hard_reset_lock); diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c index f38310b84f51..2b1962c03336 100644 --- a/drivers/ata/sata_qstor.c +++ b/drivers/ata/sata_qstor.c @@ -461,7 +461,7 @@ static int qs_port_start(struct ata_port *ap) void __iomem *chan = mmio_base + (ap->port_no * 0x4000); u64 addr; - pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); + pp = devm_kzalloc_obj(dev, *pp); if (!pp) return -ENOMEM; pp->pkt = dmam_alloc_coherent(dev, QS_PKT_BYTES, &pp->pkt_dma, diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c index 487eadd4073f..419b37878c4f 100644 --- a/drivers/ata/sata_rcar.c +++ b/drivers/ata/sata_rcar.c @@ -867,7 +867,7 @@ static int sata_rcar_probe(struct platform_device *pdev) if (irq < 0) return irq; - priv = devm_kzalloc(dev, sizeof(struct sata_rcar_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct sata_rcar_priv); if (!priv) return -ENOMEM; diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 38291ae772c9..7acd55b17b18 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c @@ -1199,7 +1199,7 @@ static int sil24_port_start(struct ata_port *ap) size_t cb_size = sizeof(*cb) * SIL24_MAX_CMDS; dma_addr_t cb_dma; - pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); + pp = devm_kzalloc_obj(dev, *pp); if (!pp) return -ENOMEM; diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c index cab40c10ad6b..e7c28e7c5bb8 100644 --- a/drivers/ata/sata_sx4.c +++ b/drivers/ata/sata_sx4.c @@ -284,7 +284,7 @@ static int pdc_port_start(struct ata_port *ap) struct device *dev = ap->host->dev; struct pdc_port_priv *pp; - pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); + pp = devm_kzalloc_obj(dev, *pp); if (!pp) return -ENOMEM; @@ -1402,7 +1402,7 @@ static int pdc_sata_init_one(struct pci_dev *pdev, /* allocate host */ host = ata_host_alloc_pinfo(&pdev->dev, ppi, 4); - hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); + hpriv = devm_kzalloc_obj(&pdev->dev, *hpriv); if (!host || !hpriv) return -ENOMEM; diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c index 122133199ea7..452bd5670e03 100644 --- a/drivers/ata/sata_uli.c +++ b/drivers/ata/sata_uli.c @@ -150,7 +150,7 @@ static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (!host) return -ENOMEM; - hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); + hpriv = devm_kzalloc_obj(&pdev->dev, *hpriv); if (!hpriv) return -ENOMEM; host->private_data = hpriv; diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index cfd8ff1f529c..b9bc23e2fd04 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c @@ -742,7 +742,7 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (rc) return rc; - hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); + hpriv = devm_kzalloc_obj(&pdev->dev, *hpriv); if (!hpriv) return -ENOMEM; host->private_data = hpriv; diff --git a/drivers/auxdisplay/arm-charlcd.c b/drivers/auxdisplay/arm-charlcd.c index ea684f3446c3..8b8e701281d6 100644 --- a/drivers/auxdisplay/arm-charlcd.c +++ b/drivers/auxdisplay/arm-charlcd.c @@ -258,7 +258,7 @@ static int __init charlcd_probe(struct platform_device *pdev) int ret; struct charlcd *lcd; - lcd = devm_kzalloc(dev, sizeof(*lcd), GFP_KERNEL); + lcd = devm_kzalloc_obj(dev, *lcd); if (!lcd) return -ENOMEM; diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c index 19b5c14e58ff..83dee9f8a8a5 100644 --- a/drivers/auxdisplay/ht16k33.c +++ b/drivers/auxdisplay/ht16k33.c @@ -663,7 +663,7 @@ static int ht16k33_probe(struct i2c_client *client) return -EIO; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/auxdisplay/img-ascii-lcd.c b/drivers/auxdisplay/img-ascii-lcd.c index 32e1863ef4b2..be513594f61d 100644 --- a/drivers/auxdisplay/img-ascii-lcd.c +++ b/drivers/auxdisplay/img-ascii-lcd.c @@ -232,7 +232,7 @@ static int img_ascii_lcd_probe(struct platform_device *pdev) struct img_ascii_lcd_ctx *ctx; int err; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/auxdisplay/max6959.c b/drivers/auxdisplay/max6959.c index 888788a1ff08..c31341637515 100644 --- a/drivers/auxdisplay/max6959.c +++ b/drivers/auxdisplay/max6959.c @@ -119,7 +119,7 @@ static int max6959_i2c_probe(struct i2c_client *client) struct max6959_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/auxdisplay/seg-led-gpio.c b/drivers/auxdisplay/seg-led-gpio.c index bc463118fe51..0248a8026f1f 100644 --- a/drivers/auxdisplay/seg-led-gpio.c +++ b/drivers/auxdisplay/seg-led-gpio.c @@ -63,7 +63,7 @@ static int seg_led_probe(struct platform_device *pdev) struct seg_led_priv *priv; struct device *dev = &pdev->dev; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/base/pinctrl.c b/drivers/base/pinctrl.c index 0bbc83231234..f2b420924359 100644 --- a/drivers/base/pinctrl.c +++ b/drivers/base/pinctrl.c @@ -27,7 +27,7 @@ int pinctrl_bind_pins(struct device *dev) if (dev_of_node_reused(dev)) return 0; - dev->pins = devm_kzalloc(dev, sizeof(*(dev->pins)), GFP_KERNEL); + dev->pins = devm_kzalloc_obj(dev, *(dev->pins)); if (!dev->pins) return -ENOMEM; diff --git a/drivers/base/regmap/regmap-sdw-mbq.c b/drivers/base/regmap/regmap-sdw-mbq.c index b0312f57c980..cba33a7d5b49 100644 --- a/drivers/base/regmap/regmap-sdw-mbq.c +++ b/drivers/base/regmap/regmap-sdw-mbq.c @@ -214,7 +214,7 @@ regmap_sdw_mbq_gen_context(struct device *dev, { struct regmap_mbq_context *ctx; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return ERR_PTR(-ENOMEM); diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 83f1f5942135..e01f24bc66fb 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1237,8 +1237,7 @@ static void regmap_field_init(struct regmap_field *rm_field, struct regmap_field *devm_regmap_field_alloc(struct device *dev, struct regmap *regmap, struct reg_field reg_field) { - struct regmap_field *rm_field = devm_kzalloc(dev, - sizeof(*rm_field), GFP_KERNEL); + struct regmap_field *rm_field = devm_kzalloc_obj(dev, *rm_field); if (!rm_field) return ERR_PTR(-ENOMEM); @@ -1306,7 +1305,7 @@ int devm_regmap_field_bulk_alloc(struct device *dev, struct regmap_field *rf; int i; - rf = devm_kcalloc(dev, num_fields, sizeof(*rf), GFP_KERNEL); + rf = devm_kzalloc_objs(dev, *rf, num_fields); if (!rf) return -ENOMEM; diff --git a/drivers/bcma/host_soc.c b/drivers/bcma/host_soc.c index 20b1816c570b..50816d7bda2a 100644 --- a/drivers/bcma/host_soc.c +++ b/drivers/bcma/host_soc.c @@ -208,7 +208,7 @@ static int bcma_host_soc_probe(struct platform_device *pdev) int err; /* Alloc */ - bus = devm_kzalloc(dev, sizeof(*bus), GFP_KERNEL); + bus = devm_kzalloc_obj(dev, *bus); if (!bus) return -ENOMEM; diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c index c738ad0408cb..23790eebacb7 100644 --- a/drivers/bluetooth/bcm203x.c +++ b/drivers/bluetooth/bcm203x.c @@ -161,7 +161,7 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id if (intf->cur_altsetting->desc.bInterfaceNumber != 0) return -ENODEV; - data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&intf->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index d31d797639b5..391574c3dd3d 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c @@ -649,7 +649,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i } /* Initialize control structure and load firmware */ - data = devm_kzalloc(&intf->dev, sizeof(struct bfusb_data), GFP_KERNEL); + data = devm_kzalloc_obj(&intf->dev, struct bfusb_data); if (!data) return -ENOMEM; diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index e63d1af250ec..94bcf0418cea 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c @@ -376,7 +376,7 @@ static int bpa10x_probe(struct usb_interface *intf, if (intf->cur_altsetting->desc.bInterfaceNumber != 0) return -ENODEV; - data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&intf->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c index 4178fd000fe7..dd439e9b6538 100644 --- a/drivers/bluetooth/btintel_pcie.c +++ b/drivers/bluetooth/btintel_pcie.c @@ -225,8 +225,7 @@ static int btintel_pcie_alloc_dbgc_buf(struct btintel_pcie_data *data, struct data_buf *b; int i; - *buf = devm_kcalloc(&data->pdev->dev, buf_count, - sizeof(**buf), GFP_KERNEL); + *buf = devm_kzalloc_objs(&data->pdev->dev, **buf, buf_count); if (!*buf) { BT_ERR("Failed to allocate dbgc buf: %u", buf_index + 1); return -ENOMEM; @@ -4061,7 +4060,7 @@ static int btintel_pcie_probe(struct pci_dev *pdev, if (!pdev) return -ENODEV; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c index b91fc63bc9fe..4fd241693a10 100644 --- a/drivers/bluetooth/btmrvl_sdio.c +++ b/drivers/bluetooth/btmrvl_sdio.c @@ -81,8 +81,7 @@ static int btmrvl_sdio_probe_of(struct device *dev, card->plt_of_node = dev->of_node; - card->plt_wake_cfg = devm_kzalloc(dev, sizeof(*card->plt_wake_cfg), - GFP_KERNEL); + card->plt_wake_cfg = devm_kzalloc_obj(dev, *card->plt_wake_cfg); cfg = card->plt_wake_cfg; if (cfg && card->plt_of_node) { cfg->irq_bt = irq_of_parse_and_map(card->plt_of_node, 0); @@ -1517,7 +1516,7 @@ static int btmrvl_sdio_probe(struct sdio_func *func, BT_INFO("vendor=0x%x, device=0x%x, class=%d, fn=%d", id->vendor, id->device, id->class, func->num); - card = devm_kzalloc(&func->dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(&func->dev, *card); if (!card) return -ENOMEM; diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c index b9563df72983..f63a05f6c6c6 100644 --- a/drivers/bluetooth/btmtksdio.c +++ b/drivers/bluetooth/btmtksdio.c @@ -1418,7 +1418,7 @@ static int btmtksdio_probe(struct sdio_func *func, bool restore_node; int err; - bdev = devm_kzalloc(&func->dev, sizeof(*bdev), GFP_KERNEL); + bdev = devm_kzalloc_obj(&func->dev, *bdev); if (!bdev) return -ENOMEM; diff --git a/drivers/bluetooth/btmtkuart.c b/drivers/bluetooth/btmtkuart.c index 4af6fbbbd302..00c43cb6aedc 100644 --- a/drivers/bluetooth/btmtkuart.c +++ b/drivers/bluetooth/btmtkuart.c @@ -849,7 +849,7 @@ static int btmtkuart_probe(struct serdev_device *serdev) struct hci_dev *hdev; int err; - bdev = devm_kzalloc(&serdev->dev, sizeof(*bdev), GFP_KERNEL); + bdev = devm_kzalloc_obj(&serdev->dev, *bdev); if (!bdev) return -ENOMEM; diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c index 5c730e336114..f219bd458619 100644 --- a/drivers/bluetooth/btnxpuart.c +++ b/drivers/bluetooth/btnxpuart.c @@ -1847,7 +1847,7 @@ static int nxp_serdev_probe(struct serdev_device *serdev) bdaddr_t ba = {0}; int err; - nxpdev = devm_kzalloc(&serdev->dev, sizeof(*nxpdev), GFP_KERNEL); + nxpdev = devm_kzalloc_obj(&serdev->dev, *nxpdev); if (!nxpdev) return -ENOMEM; diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c index d669ea4eb3eb..5a0cd7f88086 100644 --- a/drivers/bluetooth/btqcomsmd.c +++ b/drivers/bluetooth/btqcomsmd.c @@ -144,7 +144,7 @@ static int btqcomsmd_probe(struct platform_device *pdev) void *wcnss; int ret; - btq = devm_kzalloc(&pdev->dev, sizeof(*btq), GFP_KERNEL); + btq = devm_kzalloc_obj(&pdev->dev, *btq); if (!btq) return -ENOMEM; diff --git a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c index 8325655ce6aa..a194fc85abfb 100644 --- a/drivers/bluetooth/btsdio.c +++ b/drivers/bluetooth/btsdio.c @@ -300,7 +300,7 @@ static int btsdio_probe(struct sdio_func *func, } } - data = devm_kzalloc(&func->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&func->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/bluetooth/hci_aml.c b/drivers/bluetooth/hci_aml.c index 067fbf278b44..6ee7b653eb74 100644 --- a/drivers/bluetooth/hci_aml.c +++ b/drivers/bluetooth/hci_aml.c @@ -696,7 +696,7 @@ static int aml_serdev_probe(struct serdev_device *serdev) struct aml_serdev *amldev; int err; - amldev = devm_kzalloc(&serdev->dev, sizeof(*amldev), GFP_KERNEL); + amldev = devm_kzalloc_obj(&serdev->dev, *amldev); if (!amldev) return -ENOMEM; diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index e70b9f3fd968..83091e5c5702 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -1240,7 +1240,7 @@ static int bcm_probe(struct platform_device *pdev) struct bcm_device *dev; int ret; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; @@ -1509,7 +1509,7 @@ static int bcm_serdev_probe(struct serdev_device *serdev) const struct bcm_device_data *data; int err; - bcmdev = devm_kzalloc(&serdev->dev, sizeof(*bcmdev), GFP_KERNEL); + bcmdev = devm_kzalloc_obj(&serdev->dev, *bcmdev); if (!bcmdev) return -ENOMEM; diff --git a/drivers/bluetooth/hci_bcm4377.c b/drivers/bluetooth/hci_bcm4377.c index 66d49b471544..efd3a6424301 100644 --- a/drivers/bluetooth/hci_bcm4377.c +++ b/drivers/bluetooth/hci_bcm4377.c @@ -1558,9 +1558,8 @@ static int bcm4377_alloc_transfer_ring(struct bcm4377_data *bcm4377, return -ENOMEM; if (ring->allow_wait) { - ring->events = devm_kcalloc(&bcm4377->pdev->dev, - ring->n_entries, - sizeof(*ring->events), GFP_KERNEL); + ring->events = devm_kzalloc_objs(&bcm4377->pdev->dev, + *ring->events, ring->n_entries); if (!ring->events) return -ENOMEM; } @@ -2283,7 +2282,7 @@ static int bcm4377_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (ret) return ret; - bcm4377 = devm_kzalloc(&pdev->dev, sizeof(*bcm4377), GFP_KERNEL); + bcm4377 = devm_kzalloc_obj(&pdev->dev, *bcm4377); if (!bcm4377) return -ENOMEM; diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index 37f4d9327e72..8ef4dc13a071 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c @@ -857,7 +857,7 @@ static int h5_serdev_probe(struct serdev_device *serdev) struct h5 *h5; const struct h5_device_data *data; - h5 = devm_kzalloc(dev, sizeof(*h5), GFP_KERNEL); + h5 = devm_kzalloc_obj(dev, *h5); if (!h5) return -ENOMEM; diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c index d10ce7a0ba3e..f8c04491c4b3 100644 --- a/drivers/bluetooth/hci_intel.c +++ b/drivers/bluetooth/hci_intel.c @@ -1128,7 +1128,7 @@ static int intel_probe(struct platform_device *pdev) struct intel_device *idev; int ret; - idev = devm_kzalloc(&pdev->dev, sizeof(*idev), GFP_KERNEL); + idev = devm_kzalloc_obj(&pdev->dev, *idev); if (!idev) return -ENOMEM; diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c index 35adf869cc1f..3c9d98eebc6d 100644 --- a/drivers/bluetooth/hci_ll.c +++ b/drivers/bluetooth/hci_ll.c @@ -696,7 +696,7 @@ static int hci_ti_probe(struct serdev_device *serdev) struct nvmem_cell *bdaddr_cell; u32 max_speed = 3000000; - lldev = devm_kzalloc(&serdev->dev, sizeof(struct ll_device), GFP_KERNEL); + lldev = devm_kzalloc_obj(&serdev->dev, struct ll_device); if (!lldev) return -ENOMEM; hu = &lldev->hu; diff --git a/drivers/bluetooth/hci_mrvl.c b/drivers/bluetooth/hci_mrvl.c index 5798a8db016e..57e2d80827df 100644 --- a/drivers/bluetooth/hci_mrvl.c +++ b/drivers/bluetooth/hci_mrvl.c @@ -463,7 +463,7 @@ static int mrvl_serdev_probe(struct serdev_device *serdev) struct mrvl_serdev *mrvldev; const struct hci_uart_proto *mrvl_proto = device_get_match_data(&serdev->dev); - mrvldev = devm_kzalloc(&serdev->dev, sizeof(*mrvldev), GFP_KERNEL); + mrvldev = devm_kzalloc_obj(&serdev->dev, *mrvldev); if (!mrvldev) return -ENOMEM; diff --git a/drivers/bluetooth/hci_nokia.c b/drivers/bluetooth/hci_nokia.c index be2923231e71..6de109d8c07b 100644 --- a/drivers/bluetooth/hci_nokia.c +++ b/drivers/bluetooth/hci_nokia.c @@ -702,7 +702,7 @@ static int nokia_bluetooth_serdev_probe(struct serdev_device *serdev) struct clk *sysclk; int err = 0; - btdev = devm_kzalloc(dev, sizeof(*btdev), GFP_KERNEL); + btdev = devm_kzalloc_obj(dev, *btdev); if (!btdev) return -ENOMEM; diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 7089e9b639b2..e480d38109cf 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -2372,7 +2372,7 @@ static int qca_init_regulators(struct qca_power *qca, int ret; int i; - bulk = devm_kcalloc(qca->dev, num_vregs, sizeof(*bulk), GFP_KERNEL); + bulk = devm_kzalloc_objs(qca->dev, *bulk, num_vregs); if (!bulk) return -ENOMEM; @@ -2403,7 +2403,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) int err; bool power_ctrl_enabled = true; - qcadev = devm_kzalloc(&serdev->dev, sizeof(*qcadev), GFP_KERNEL); + qcadev = devm_kzalloc_obj(&serdev->dev, *qcadev); if (!qcadev) return -ENOMEM; @@ -2435,9 +2435,8 @@ static int qca_serdev_probe(struct serdev_device *serdev) case QCA_WCN6750: case QCA_WCN6855: case QCA_WCN7850: - qcadev->bt_power = devm_kzalloc(&serdev->dev, - sizeof(struct qca_power), - GFP_KERNEL); + qcadev->bt_power = devm_kzalloc_obj(&serdev->dev, + struct qca_power); if (!qcadev->bt_power) return -ENOMEM; break; diff --git a/drivers/bus/brcmstb_gisb.c b/drivers/bus/brcmstb_gisb.c index 91ef99c42344..113a09e10328 100644 --- a/drivers/bus/brcmstb_gisb.c +++ b/drivers/bus/brcmstb_gisb.c @@ -422,7 +422,7 @@ static int __init brcmstb_gisb_arb_probe(struct platform_device *pdev) tea_irq = platform_get_irq(pdev, 1); bp_irq = platform_get_irq(pdev, 2); - gdev = devm_kzalloc(&pdev->dev, sizeof(*gdev), GFP_KERNEL); + gdev = devm_kzalloc_obj(&pdev->dev, *gdev); if (!gdev) return -ENOMEM; diff --git a/drivers/bus/fsl-mc/dprc-driver.c b/drivers/bus/fsl-mc/dprc-driver.c index a81188cb06f2..675f1e66390c 100644 --- a/drivers/bus/fsl-mc/dprc-driver.c +++ b/drivers/bus/fsl-mc/dprc-driver.c @@ -266,9 +266,8 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, int i; child_obj_desc_array = - devm_kmalloc_array(&mc_bus_dev->dev, num_child_objects, - sizeof(*child_obj_desc_array), - GFP_KERNEL); + devm_kmalloc_objs(&mc_bus_dev->dev, *child_obj_desc_array, + num_child_objects); if (!child_obj_desc_array) return -ENOMEM; diff --git a/drivers/bus/fsl-mc/fsl-mc-allocator.c b/drivers/bus/fsl-mc/fsl-mc-allocator.c index d2ea59471323..562461dc747b 100644 --- a/drivers/bus/fsl-mc/fsl-mc-allocator.c +++ b/drivers/bus/fsl-mc/fsl-mc-allocator.c @@ -60,8 +60,7 @@ static int __must_check fsl_mc_resource_pool_add_device(struct fsl_mc_bus res_pool->free_count > res_pool->max_count) goto out_unlock; - resource = devm_kzalloc(&mc_bus_dev->dev, sizeof(*resource), - GFP_KERNEL); + resource = devm_kzalloc_obj(&mc_bus_dev->dev, *resource); if (!resource) { error = -ENOMEM; dev_err(&mc_bus_dev->dev, @@ -375,9 +374,8 @@ int fsl_mc_populate_irq_pool(struct fsl_mc_device *mc_bus_dev, if (error < 0) return error; - irq_resources = devm_kcalloc(&mc_bus_dev->dev, - irq_count, sizeof(*irq_resources), - GFP_KERNEL); + irq_resources = devm_kzalloc_objs(&mc_bus_dev->dev, *irq_resources, + irq_count); if (!irq_resources) { error = -ENOMEM; goto cleanup_msi_irqs; @@ -472,8 +470,7 @@ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev) return -ENOSPC; } - irqs = devm_kcalloc(&mc_dev->dev, irq_count, sizeof(irqs[0]), - GFP_KERNEL); + irqs = devm_kzalloc_objs(&mc_dev->dev, irqs[0], irq_count); if (!irqs) return -ENOMEM; diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c index 0c37b6780c84..a50d197a7858 100644 --- a/drivers/bus/fsl-mc/fsl-mc-bus.c +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c @@ -981,9 +981,8 @@ static int get_mc_addr_translation_ranges(struct device *dev, return 0; } - *ranges = devm_kcalloc(dev, *num_ranges, - sizeof(struct fsl_mc_addr_translation_range), - GFP_KERNEL); + *ranges = devm_kzalloc_objs(dev, struct fsl_mc_addr_translation_range, + *num_ranges); if (!(*ranges)) return -ENOMEM; @@ -1064,7 +1063,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) u32 mc_portal_size, mc_stream_id; struct resource *plat_res; - mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL); + mc = devm_kzalloc_obj(&pdev->dev, *mc); if (!mc) return -ENOMEM; diff --git a/drivers/bus/fsl-mc/mc-io.c b/drivers/bus/fsl-mc/mc-io.c index cd8754763f40..ca66bbef4602 100644 --- a/drivers/bus/fsl-mc/mc-io.c +++ b/drivers/bus/fsl-mc/mc-io.c @@ -73,7 +73,7 @@ int __must_check fsl_create_mc_io(struct device *dev, void __iomem *mc_portal_virt_addr; struct resource *res; - mc_io = devm_kzalloc(dev, sizeof(*mc_io), GFP_KERNEL); + mc_io = devm_kzalloc_obj(dev, *mc_io); if (!mc_io) return -ENOMEM; diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c index 53dd1573e323..c82e81807d09 100644 --- a/drivers/bus/hisi_lpc.c +++ b/drivers/bus/hisi_lpc.c @@ -422,8 +422,7 @@ static int hisi_lpc_acpi_set_io_res(struct acpi_device *adev, return count ? count : -EIO; } - resources = devm_kcalloc(hostdev, count, sizeof(*resources), - GFP_KERNEL); + resources = devm_kzalloc_objs(hostdev, *resources, count); if (!resources) { dev_warn(hostdev, "could not allocate memory for %d resources\n", count); @@ -611,7 +610,7 @@ static int hisi_lpc_probe(struct platform_device *pdev) resource_size_t io_end; int ret; - lpcdev = devm_kzalloc(dev, sizeof(*lpcdev), GFP_KERNEL); + lpcdev = devm_kzalloc_obj(dev, *lpcdev); if (!lpcdev) return -ENOMEM; @@ -621,7 +620,7 @@ static int hisi_lpc_probe(struct platform_device *pdev) if (IS_ERR(lpcdev->membase)) return PTR_ERR(lpcdev->membase); - range = devm_kzalloc(dev, sizeof(*range), GFP_KERNEL); + range = devm_kzalloc_obj(dev, *range); if (!range) return -ENOMEM; diff --git a/drivers/bus/imx-aipstz.c b/drivers/bus/imx-aipstz.c index 83371e5b35a2..6de2b0cd641c 100644 --- a/drivers/bus/imx-aipstz.c +++ b/drivers/bus/imx-aipstz.c @@ -50,7 +50,7 @@ static int imx_aipstz_probe(struct platform_device *pdev) { struct imx_aipstz_data *data; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return dev_err_probe(&pdev->dev, -ENOMEM, "failed to allocate data memory\n"); diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c index 87070155b057..477c1633dc16 100644 --- a/drivers/bus/imx-weim.c +++ b/drivers/bus/imx-weim.c @@ -269,7 +269,7 @@ static int weim_probe(struct platform_device *pdev) void __iomem *base; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/bus/intel-ixp4xx-eb.c b/drivers/bus/intel-ixp4xx-eb.c index 320cf307db05..fdca1c1c59a7 100644 --- a/drivers/bus/intel-ixp4xx-eb.c +++ b/drivers/bus/intel-ixp4xx-eb.c @@ -351,7 +351,7 @@ static int ixp4xx_exp_probe(struct platform_device *pdev) u32 val; int ret; - eb = devm_kzalloc(dev, sizeof(*eb), GFP_KERNEL); + eb = devm_kzalloc_obj(dev, *eb); if (!eb) return -ENOMEM; diff --git a/drivers/bus/mhi/ep/clients/loopback.c b/drivers/bus/mhi/ep/clients/loopback.c index 8da0c184aa3e..e45e498b7764 100644 --- a/drivers/bus/mhi/ep/clients/loopback.c +++ b/drivers/bus/mhi/ep/clients/loopback.c @@ -78,7 +78,7 @@ static int mhi_ep_loopback_probe(struct mhi_ep_device *mhi_dev, const struct mhi { struct mhi_ep_loopback *mhi_ep_lb; - mhi_ep_lb = devm_kzalloc(&mhi_dev->dev, sizeof(*mhi_ep_lb), GFP_KERNEL); + mhi_ep_lb = devm_kzalloc_obj(&mhi_dev->dev, *mhi_ep_lb); if (!mhi_ep_lb) return -ENOMEM; diff --git a/drivers/bus/mhi/host/clients/loopback.c b/drivers/bus/mhi/host/clients/loopback.c index 35312f025598..92ebaea31fe8 100644 --- a/drivers/bus/mhi/host/clients/loopback.c +++ b/drivers/bus/mhi/host/clients/loopback.c @@ -261,7 +261,7 @@ static int mhi_loopback_probe(struct mhi_device *mhi_dev, struct mhi_loopback *loopback; int ret; - loopback = devm_kzalloc(&mhi_dev->dev, sizeof(*loopback), GFP_KERNEL); + loopback = devm_kzalloc_obj(&mhi_dev->dev, *loopback); if (!loopback) return -ENOMEM; diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c index 7193a384cca4..ca9ef4aaa014 100644 --- a/drivers/bus/mhi/host/pci_generic.c +++ b/drivers/bus/mhi/host/pci_generic.c @@ -1241,7 +1241,7 @@ static int mhi_pci_get_irqs(struct mhi_controller *mhi_cntrl, mhi_cntrl->nr_irqs = 1; } - irq = devm_kcalloc(&pdev->dev, mhi_cntrl->nr_irqs, sizeof(int), GFP_KERNEL); + irq = devm_kzalloc_objs(&pdev->dev, int, mhi_cntrl->nr_irqs); if (!irq) return -ENOMEM; @@ -1392,7 +1392,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) dev_info(&pdev->dev, "MHI PCI device found: %s\n", info->name); /* mhi_pdev.mhi_cntrl must be zero-initialized */ - mhi_pdev = devm_kzalloc(&pdev->dev, sizeof(*mhi_pdev), GFP_KERNEL); + mhi_pdev = devm_kzalloc_obj(&pdev->dev, *mhi_pdev); if (!mhi_pdev) return -ENOMEM; diff --git a/drivers/bus/moxtet.c b/drivers/bus/moxtet.c index 0d68c1a9f493..93f1913c3356 100644 --- a/drivers/bus/moxtet.c +++ b/drivers/bus/moxtet.c @@ -773,8 +773,7 @@ static int moxtet_probe(struct spi_device *spi) if (ret < 0) return ret; - moxtet = devm_kzalloc(&spi->dev, sizeof(struct moxtet), - GFP_KERNEL); + moxtet = devm_kzalloc_obj(&spi->dev, struct moxtet); if (!moxtet) return -ENOMEM; diff --git a/drivers/bus/omap_l3_noc.c b/drivers/bus/omap_l3_noc.c index eb1ba6319fda..56794c67d865 100644 --- a/drivers/bus/omap_l3_noc.c +++ b/drivers/bus/omap_l3_noc.c @@ -245,7 +245,7 @@ static int omap_l3_probe(struct platform_device *pdev) return -EINVAL; } - l3 = devm_kzalloc(&pdev->dev, sizeof(*l3), GFP_KERNEL); + l3 = devm_kzalloc_obj(&pdev->dev, *l3); if (!l3) return -ENOMEM; diff --git a/drivers/bus/qcom-ssc-block-bus.c b/drivers/bus/qcom-ssc-block-bus.c index 7f5fd4e0940d..6e2ea812815e 100644 --- a/drivers/bus/qcom-ssc-block-bus.c +++ b/drivers/bus/qcom-ssc-block-bus.c @@ -258,7 +258,7 @@ static int qcom_ssc_block_bus_probe(struct platform_device *pdev) struct resource *res; int ret; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c index c920bd6fbaaf..535658ba5e4b 100644 --- a/drivers/bus/simple-pm-bus.c +++ b/drivers/bus/simple-pm-bus.c @@ -54,7 +54,7 @@ static int simple_pm_bus_probe(struct platform_device *pdev) return -ENODEV; } - bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); + bus = devm_kzalloc_obj(&pdev->dev, *bus); if (!bus) return -ENOMEM; diff --git a/drivers/bus/stm32_dbg_bus.c b/drivers/bus/stm32_dbg_bus.c index e30ef3465609..78a7cb06b287 100644 --- a/drivers/bus/stm32_dbg_bus.c +++ b/drivers/bus/stm32_dbg_bus.c @@ -118,7 +118,7 @@ static int stm32_dbg_bus_plat_probe(struct platform_device *pdev) if (!stm32_dbg_bus_priv) return -EPROBE_DEFER; - dbg_controller = devm_kzalloc(&pdev->dev, sizeof(*dbg_controller), GFP_KERNEL); + dbg_controller = devm_kzalloc_obj(&pdev->dev, *dbg_controller); if (!dbg_controller) return dev_err_probe(&pdev->dev, -ENOMEM, "Couldn't allocate debug controller\n"); @@ -192,7 +192,7 @@ static int stm32_dbg_bus_probe(struct tee_client_device *tee_dev) return dev_err_probe(dev, -EBUSY, "A STM32 debug bus device is already initialized\n"); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/bus/stm32_etzpc.c b/drivers/bus/stm32_etzpc.c index 4918a14e507e..f5be63c4aaeb 100644 --- a/drivers/bus/stm32_etzpc.c +++ b/drivers/bus/stm32_etzpc.c @@ -78,7 +78,7 @@ static int stm32_etzpc_probe(struct platform_device *pdev) void __iomem *mmio; int rc; - etzpc_controller = devm_kzalloc(&pdev->dev, sizeof(*etzpc_controller), GFP_KERNEL); + etzpc_controller = devm_kzalloc_obj(&pdev->dev, *etzpc_controller); if (!etzpc_controller) return -ENOMEM; diff --git a/drivers/bus/stm32_firewall.c b/drivers/bus/stm32_firewall.c index e3619dba8b06..b3ff9f9a1cd9 100644 --- a/drivers/bus/stm32_firewall.c +++ b/drivers/bus/stm32_firewall.c @@ -201,7 +201,7 @@ int stm32_firewall_get_grant_all_access(struct device *dev, struct stm32_firewal return 0; } - loc_firewall = devm_kcalloc(dev, *nb_firewall, sizeof(*loc_firewall), GFP_KERNEL); + loc_firewall = devm_kzalloc_objs(dev, *loc_firewall, *nb_firewall); if (!loc_firewall) return -ENOMEM; diff --git a/drivers/bus/stm32_rifsc.c b/drivers/bus/stm32_rifsc.c index 19d10379dcef..842c8541ed2f 100644 --- a/drivers/bus/stm32_rifsc.c +++ b/drivers/bus/stm32_rifsc.c @@ -608,7 +608,7 @@ static int stm32_rifsc_register_debugfs(struct stm32_firewall_controller *rifsc_ struct rifsc_dbg_private *rifsc_priv; struct dentry *root = NULL; - rifsc_priv = devm_kzalloc(rifsc_controller->dev, sizeof(*rifsc_priv), GFP_KERNEL); + rifsc_priv = devm_kzalloc_obj(rifsc_controller->dev, *rifsc_priv); if (!rifsc_priv) return -ENOMEM; @@ -736,7 +736,7 @@ static int stm32_rifsc_probe(struct platform_device *pdev) void __iomem *mmio; int rc; - rifsc_controller = devm_kzalloc(&pdev->dev, sizeof(*rifsc_controller), GFP_KERNEL); + rifsc_controller = devm_kzalloc_obj(&pdev->dev, *rifsc_controller); if (!rifsc_controller) return -ENOMEM; diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c index daf0ea563e47..db59189e3fb4 100644 --- a/drivers/bus/sunxi-rsb.c +++ b/drivers/bus/sunxi-rsb.c @@ -757,7 +757,7 @@ static int sunxi_rsb_probe(struct platform_device *pdev) "clock-frequency (%u Hz) is too high (max = 20MHz)\n", clk_freq); - rsb = devm_kzalloc(dev, sizeof(*rsb), GFP_KERNEL); + rsb = devm_kzalloc_obj(dev, *rsb); if (!rsb) return -ENOMEM; diff --git a/drivers/bus/tegra-aconnect.c b/drivers/bus/tegra-aconnect.c index 9b2b227332b2..f5e685199f06 100644 --- a/drivers/bus/tegra-aconnect.c +++ b/drivers/bus/tegra-aconnect.c @@ -26,8 +26,7 @@ static int tegra_aconnect_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -EINVAL; - aconnect = devm_kzalloc(&pdev->dev, sizeof(struct tegra_aconnect), - GFP_KERNEL); + aconnect = devm_kzalloc_obj(&pdev->dev, struct tegra_aconnect); if (!aconnect) return -ENOMEM; diff --git a/drivers/bus/tegra-gmi.c b/drivers/bus/tegra-gmi.c index 9c09141961d8..50f03dfac74f 100644 --- a/drivers/bus/tegra-gmi.c +++ b/drivers/bus/tegra-gmi.c @@ -213,7 +213,7 @@ static int tegra_gmi_probe(struct platform_device *pdev) struct tegra_gmi *gmi; int err; - gmi = devm_kzalloc(dev, sizeof(*gmi), GFP_KERNEL); + gmi = devm_kzalloc_obj(dev, *gmi); if (!gmi) return -ENOMEM; diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c index e118b900c9ac..12285ad9ef51 100644 --- a/drivers/bus/ti-sysc.c +++ b/drivers/bus/ti-sysc.c @@ -442,10 +442,8 @@ static int sysc_get_clocks(struct sysc *ddata) const char *name; int nr_fck = 0, nr_ick = 0, i, error = 0; - ddata->clock_roles = devm_kcalloc(ddata->dev, - SYSC_MAX_CLOCKS, - sizeof(*ddata->clock_roles), - GFP_KERNEL); + ddata->clock_roles = devm_kzalloc_objs(ddata->dev, *ddata->clock_roles, + SYSC_MAX_CLOCKS); if (!ddata->clock_roles) return -ENOMEM; @@ -485,9 +483,8 @@ static int sysc_get_clocks(struct sysc *ddata) if (!nr_ick) ddata->nr_clocks++; - ddata->clocks = devm_kcalloc(ddata->dev, - ddata->nr_clocks, sizeof(*ddata->clocks), - GFP_KERNEL); + ddata->clocks = devm_kzalloc_objs(ddata->dev, *ddata->clocks, + ddata->nr_clocks); if (!ddata->clocks) return -ENOMEM; @@ -2845,7 +2842,7 @@ static int sysc_init_pdata(struct sysc *ddata) if (!pdata) return 0; - mdata = devm_kzalloc(ddata->dev, sizeof(*mdata), GFP_KERNEL); + mdata = devm_kzalloc_obj(ddata->dev, *mdata); if (!mdata) return -ENOMEM; @@ -3151,7 +3148,7 @@ static int sysc_probe(struct platform_device *pdev) struct sysc *ddata; int error; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/bus/ts-nbus.c b/drivers/bus/ts-nbus.c index 2328c48b9b12..f7ce77136bc3 100644 --- a/drivers/bus/ts-nbus.c +++ b/drivers/bus/ts-nbus.c @@ -272,7 +272,7 @@ static int ts_nbus_probe(struct platform_device *pdev) struct ts_nbus *ts_nbus; int ret; - ts_nbus = devm_kzalloc(dev, sizeof(*ts_nbus), GFP_KERNEL); + ts_nbus = devm_kzalloc_obj(dev, *ts_nbus); if (!ts_nbus) return -ENOMEM; diff --git a/drivers/bus/uniphier-system-bus.c b/drivers/bus/uniphier-system-bus.c index cb5c89ce7b86..473536614bbe 100644 --- a/drivers/bus/uniphier-system-bus.c +++ b/drivers/bus/uniphier-system-bus.c @@ -180,7 +180,7 @@ static int uniphier_system_bus_probe(struct platform_device *pdev) struct of_range range; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/bus/vexpress-config.c b/drivers/bus/vexpress-config.c index adaf5bd2b36d..9f57f6581b54 100644 --- a/drivers/bus/vexpress-config.c +++ b/drivers/bus/vexpress-config.c @@ -355,7 +355,7 @@ static int vexpress_syscfg_probe(struct platform_device *pdev) int master; u32 dt_hbi; - syscfg = devm_kzalloc(&pdev->dev, sizeof(*syscfg), GFP_KERNEL); + syscfg = devm_kzalloc_obj(&pdev->dev, *syscfg); if (!syscfg) return -ENOMEM; syscfg->dev = &pdev->dev; @@ -365,7 +365,7 @@ static int vexpress_syscfg_probe(struct platform_device *pdev) if (IS_ERR(syscfg->base)) return PTR_ERR(syscfg->base); - bridge = devm_kmalloc(&pdev->dev, sizeof(*bridge), GFP_KERNEL); + bridge = devm_kmalloc_obj(&pdev->dev, *bridge); if (!bridge) return -ENOMEM; diff --git a/drivers/char/hw_random/airoha-trng.c b/drivers/char/hw_random/airoha-trng.c index 98c131ee9891..1fdaa26bd924 100644 --- a/drivers/char/hw_random/airoha-trng.c +++ b/drivers/char/hw_random/airoha-trng.c @@ -171,7 +171,7 @@ static int airoha_trng_probe(struct platform_device *pdev) int irq, ret; u32 val; - trng = devm_kzalloc(dev, sizeof(*trng), GFP_KERNEL); + trng = devm_kzalloc_obj(dev, *trng); if (!trng) return -ENOMEM; diff --git a/drivers/char/hw_random/arm_smccc_trng.c b/drivers/char/hw_random/arm_smccc_trng.c index 01c1a30cbab8..f25ee2b67ea2 100644 --- a/drivers/char/hw_random/arm_smccc_trng.c +++ b/drivers/char/hw_random/arm_smccc_trng.c @@ -104,7 +104,7 @@ static int smccc_trng_probe(struct arm_smccc_device *sdev) if (!smccc_probe_trng()) return -ENODEV; - trng = devm_kzalloc(&sdev->dev, sizeof(*trng), GFP_KERNEL); + trng = devm_kzalloc_obj(&sdev->dev, *trng); if (!trng) return -ENOMEM; diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c index fe444196e6b3..633a5d8a9b93 100644 --- a/drivers/char/hw_random/atmel-rng.c +++ b/drivers/char/hw_random/atmel-rng.c @@ -112,7 +112,7 @@ static int atmel_trng_probe(struct platform_device *pdev) const struct atmel_trng_data *data; int ret; - trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL); + trng = devm_kzalloc_obj(&pdev->dev, *trng); if (!trng) return -ENOMEM; diff --git a/drivers/char/hw_random/ba431-rng.c b/drivers/char/hw_random/ba431-rng.c index 810c8cd5629a..f70c30bd89ae 100644 --- a/drivers/char/hw_random/ba431-rng.c +++ b/drivers/char/hw_random/ba431-rng.c @@ -171,7 +171,7 @@ static int ba431_trng_probe(struct platform_device *pdev) struct ba431_trng *ba431; int ret; - ba431 = devm_kzalloc(&pdev->dev, sizeof(*ba431), GFP_KERNEL); + ba431 = devm_kzalloc_obj(&pdev->dev, *ba431); if (!ba431) return -ENOMEM; diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c index 6d6ac409efcf..aa02d598b50e 100644 --- a/drivers/char/hw_random/bcm2835-rng.c +++ b/drivers/char/hw_random/bcm2835-rng.c @@ -146,7 +146,7 @@ static int bcm2835_rng_probe(struct platform_device *pdev) struct bcm2835_rng_priv *priv; int err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/hw_random/bcm74110-rng.c b/drivers/char/hw_random/bcm74110-rng.c index 4ff9ac45202a..fc4df7bf0f10 100644 --- a/drivers/char/hw_random/bcm74110-rng.c +++ b/drivers/char/hw_random/bcm74110-rng.c @@ -84,7 +84,7 @@ static int bcm74110_rng_probe(struct platform_device *pdev) struct bcm74110_priv *priv; int rc; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/hw_random/cavium-rng-vf.c b/drivers/char/hw_random/cavium-rng-vf.c index c1b8918b2292..14eb74a70f89 100644 --- a/drivers/char/hw_random/cavium-rng-vf.c +++ b/drivers/char/hw_random/cavium-rng-vf.c @@ -206,7 +206,7 @@ static int cavium_rng_probe_vf(struct pci_dev *pdev, struct cavium_rng *rng; int ret; - rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); + rng = devm_kzalloc_obj(&pdev->dev, *rng); if (!rng) return -ENOMEM; diff --git a/drivers/char/hw_random/cavium-rng.c b/drivers/char/hw_random/cavium-rng.c index 3e2c042009f6..ab55c23aa965 100644 --- a/drivers/char/hw_random/cavium-rng.c +++ b/drivers/char/hw_random/cavium-rng.c @@ -26,7 +26,7 @@ static int cavium_rng_probe(struct pci_dev *pdev, struct cavium_rng_pf *rng; int iov_err; - rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); + rng = devm_kzalloc_obj(&pdev->dev, *rng); if (!rng) return -ENOMEM; diff --git a/drivers/char/hw_random/cctrng.c b/drivers/char/hw_random/cctrng.c index 03401ee59a8e..b869915d7048 100644 --- a/drivers/char/hw_random/cctrng.c +++ b/drivers/char/hw_random/cctrng.c @@ -461,7 +461,7 @@ static int cctrng_probe(struct platform_device *pdev) BUILD_BUG_ON(CCTRNG_DATA_BUF_WORDS < 6); BUILD_BUG_ON((CCTRNG_DATA_BUF_WORDS & (CCTRNG_DATA_BUF_WORDS-1)) != 0); - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/char/hw_random/cn10k-rng.c b/drivers/char/hw_random/cn10k-rng.c index 3b4e78182e14..097f860b7e28 100644 --- a/drivers/char/hw_random/cn10k-rng.c +++ b/drivers/char/hw_random/cn10k-rng.c @@ -179,7 +179,7 @@ static int cn10k_rng_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct cn10k_rng *rng; int err; - rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); + rng = devm_kzalloc_obj(&pdev->dev, *rng); if (!rng) return -ENOMEM; diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c index 1fcc7eb121c2..47fa7ffd9604 100644 --- a/drivers/char/hw_random/exynos-trng.c +++ b/drivers/char/hw_random/exynos-trng.c @@ -185,7 +185,7 @@ static int exynos_trng_probe(struct platform_device *pdev) struct exynos_trng_dev *trng; int ret = -ENOMEM; - trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL); + trng = devm_kzalloc_obj(&pdev->dev, *trng); if (!trng) return ret; diff --git a/drivers/char/hw_random/hisi-rng.c b/drivers/char/hw_random/hisi-rng.c index 4e501d5c121f..c1d9ee4ece82 100644 --- a/drivers/char/hw_random/hisi-rng.c +++ b/drivers/char/hw_random/hisi-rng.c @@ -75,7 +75,7 @@ static int hisi_rng_probe(struct platform_device *pdev) struct hisi_rng *rng; int ret; - rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); + rng = devm_kzalloc_obj(&pdev->dev, *rng); if (!rng) return -ENOMEM; diff --git a/drivers/char/hw_random/hisi-trng-v2.c b/drivers/char/hw_random/hisi-trng-v2.c index 9e0ecea56ad6..611f41911359 100644 --- a/drivers/char/hw_random/hisi-trng-v2.c +++ b/drivers/char/hw_random/hisi-trng-v2.c @@ -58,7 +58,7 @@ static int hisi_trng_probe(struct platform_device *pdev) struct hisi_trng *trng; int ret; - trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL); + trng = devm_kzalloc_obj(&pdev->dev, *trng); if (!trng) return -ENOMEM; diff --git a/drivers/char/hw_random/histb-rng.c b/drivers/char/hw_random/histb-rng.c index 445b80beed62..7be48b010e97 100644 --- a/drivers/char/hw_random/histb-rng.c +++ b/drivers/char/hw_random/histb-rng.c @@ -122,7 +122,7 @@ static int histb_rng_probe(struct platform_device *pdev) void __iomem *base; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c index 6e2483664f9b..8dfd7821225c 100644 --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -250,7 +250,7 @@ static int __init imx_rngc_probe(struct platform_device *pdev) u32 ver_id; u8 rng_type; - rngc = devm_kzalloc(&pdev->dev, sizeof(*rngc), GFP_KERNEL); + rngc = devm_kzalloc_obj(&pdev->dev, *rngc); if (!rngc) return -ENOMEM; diff --git a/drivers/char/hw_random/ingenic-rng.c b/drivers/char/hw_random/ingenic-rng.c index bbfd662d25a6..79a2b0ffcab7 100644 --- a/drivers/char/hw_random/ingenic-rng.c +++ b/drivers/char/hw_random/ingenic-rng.c @@ -85,7 +85,7 @@ static int ingenic_rng_probe(struct platform_device *pdev) struct ingenic_rng *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/hw_random/ingenic-trng.c b/drivers/char/hw_random/ingenic-trng.c index 0dbe116346fd..0c51d01034ca 100644 --- a/drivers/char/hw_random/ingenic-trng.c +++ b/drivers/char/hw_random/ingenic-trng.c @@ -78,7 +78,7 @@ static int ingenic_trng_probe(struct platform_device *pdev) struct clk *clk; int ret; - trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL); + trng = devm_kzalloc_obj(&pdev->dev, *trng); if (!trng) return -ENOMEM; diff --git a/drivers/char/hw_random/iproc-rng200.c b/drivers/char/hw_random/iproc-rng200.c index 2e2aafca5cf0..0d70723ffe2d 100644 --- a/drivers/char/hw_random/iproc-rng200.c +++ b/drivers/char/hw_random/iproc-rng200.c @@ -169,7 +169,7 @@ static int iproc_rng200_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/hw_random/jh7110-trng.c b/drivers/char/hw_random/jh7110-trng.c index 61eb4db7ac01..bc5328566659 100644 --- a/drivers/char/hw_random/jh7110-trng.c +++ b/drivers/char/hw_random/jh7110-trng.c @@ -280,7 +280,7 @@ static int starfive_trng_probe(struct platform_device *pdev) int irq; struct starfive_trng *trng; - trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL); + trng = devm_kzalloc_obj(&pdev->dev, *trng); if (!trng) return -ENOMEM; diff --git a/drivers/char/hw_random/ks-sa-rng.c b/drivers/char/hw_random/ks-sa-rng.c index 4494f1e4ab4d..030bb759ce9e 100644 --- a/drivers/char/hw_random/ks-sa-rng.c +++ b/drivers/char/hw_random/ks-sa-rng.c @@ -208,7 +208,7 @@ static int ks_sa_rng_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - ks_sa_rng = devm_kzalloc(dev, sizeof(*ks_sa_rng), GFP_KERNEL); + ks_sa_rng = devm_kzalloc_obj(dev, *ks_sa_rng); if (!ks_sa_rng) return -ENOMEM; diff --git a/drivers/char/hw_random/meson-rng.c b/drivers/char/hw_random/meson-rng.c index 75225eb9fef6..f4ee3a001062 100644 --- a/drivers/char/hw_random/meson-rng.c +++ b/drivers/char/hw_random/meson-rng.c @@ -90,7 +90,7 @@ static int meson_rng_probe(struct platform_device *pdev) struct clk *core_clk; const struct meson_rng_priv *priv; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/char/hw_random/mpfs-rng.c b/drivers/char/hw_random/mpfs-rng.c index 0994024daa70..8fd8342110af 100644 --- a/drivers/char/hw_random/mpfs-rng.c +++ b/drivers/char/hw_random/mpfs-rng.c @@ -67,7 +67,7 @@ static int mpfs_rng_probe(struct platform_device *pdev) struct mpfs_rng *rng_priv; int ret; - rng_priv = devm_kzalloc(dev, sizeof(*rng_priv), GFP_KERNEL); + rng_priv = devm_kzalloc_obj(dev, *rng_priv); if (!rng_priv) return -ENOMEM; diff --git a/drivers/char/hw_random/mtk-rng.c b/drivers/char/hw_random/mtk-rng.c index 1f9793010e6c..127b82d979e8 100644 --- a/drivers/char/hw_random/mtk-rng.c +++ b/drivers/char/hw_random/mtk-rng.c @@ -167,7 +167,7 @@ static int mtk_rng_probe(struct platform_device *pdev) int ret; struct mtk_rng *priv; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/hw_random/mxc-rnga.c b/drivers/char/hw_random/mxc-rnga.c index e3fcb8bcc29b..a1e3c30966a8 100644 --- a/drivers/char/hw_random/mxc-rnga.c +++ b/drivers/char/hw_random/mxc-rnga.c @@ -136,7 +136,7 @@ static int mxc_rnga_probe(struct platform_device *pdev) int err; struct mxc_rng *mxc_rng; - mxc_rng = devm_kzalloc(&pdev->dev, sizeof(*mxc_rng), GFP_KERNEL); + mxc_rng = devm_kzalloc_obj(&pdev->dev, *mxc_rng); if (!mxc_rng) return -ENOMEM; diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c index ea6d5599242f..e52c30e9348b 100644 --- a/drivers/char/hw_random/n2-drv.c +++ b/drivers/char/hw_random/n2-drv.c @@ -700,7 +700,7 @@ static int n2rng_probe(struct platform_device *op) struct n2rng *np; n2rng_driver_version(); - np = devm_kzalloc(&op->dev, sizeof(*np), GFP_KERNEL); + np = devm_kzalloc_obj(&op->dev, *np); if (!np) goto out; np->op = op; @@ -745,8 +745,7 @@ static int n2rng_probe(struct platform_device *op) dev_info(&op->dev, "Registered RNG HVAPI major %lu minor %lu\n", np->hvapi_major, np->hvapi_minor); - np->units = devm_kcalloc(&op->dev, np->num_units, sizeof(*np->units), - GFP_KERNEL); + np->units = devm_kzalloc_objs(&op->dev, *np->units, np->num_units); err = -ENOMEM; if (!np->units) goto out_hvapi_unregister; diff --git a/drivers/char/hw_random/npcm-rng.c b/drivers/char/hw_random/npcm-rng.c index 40d6e29dea03..a85f745963be 100644 --- a/drivers/char/hw_random/npcm-rng.c +++ b/drivers/char/hw_random/npcm-rng.c @@ -90,7 +90,7 @@ static int npcm_rng_probe(struct platform_device *pdev) struct npcm_rng *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/hw_random/octeon-rng.c b/drivers/char/hw_random/octeon-rng.c index 412f54405036..c3dee6b182a8 100644 --- a/drivers/char/hw_random/octeon-rng.c +++ b/drivers/char/hw_random/octeon-rng.c @@ -68,7 +68,7 @@ static int octeon_rng_probe(struct platform_device *pdev) .data_read = octeon_rng_data_read }; - rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); + rng = devm_kzalloc_obj(&pdev->dev, *rng); if (!rng) return -ENOMEM; diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c index 22cde35ebe5d..49d7f021fd31 100644 --- a/drivers/char/hw_random/omap-rng.c +++ b/drivers/char/hw_random/omap-rng.c @@ -423,7 +423,7 @@ static int omap_rng_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - priv = devm_kzalloc(dev, sizeof(struct omap_rng_dev), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct omap_rng_dev); if (!priv) return -ENOMEM; diff --git a/drivers/char/hw_random/omap3-rom-rng.c b/drivers/char/hw_random/omap3-rom-rng.c index 0797add0d782..59024f209068 100644 --- a/drivers/char/hw_random/omap3-rom-rng.c +++ b/drivers/char/hw_random/omap3-rom-rng.c @@ -109,7 +109,7 @@ static int omap3_rom_rng_probe(struct platform_device *pdev) struct omap_rom_rng *ddata; int ret = 0; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/char/hw_random/pic32-rng.c b/drivers/char/hw_random/pic32-rng.c index 1c764924f2dd..6d7a7ce81025 100644 --- a/drivers/char/hw_random/pic32-rng.c +++ b/drivers/char/hw_random/pic32-rng.c @@ -78,7 +78,7 @@ static int pic32_rng_probe(struct platform_device *pdev) struct pic32_rng *priv; struct clk *clk; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/hw_random/qcom-rng.c b/drivers/char/hw_random/qcom-rng.c index 4d046caafe5b..6040f24daff8 100644 --- a/drivers/char/hw_random/qcom-rng.c +++ b/drivers/char/hw_random/qcom-rng.c @@ -106,7 +106,7 @@ static int qcom_rng_probe(struct platform_device *pdev) return 0; } - rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); + rng = devm_kzalloc_obj(&pdev->dev, *rng); if (!rng) return -ENOMEM; diff --git a/drivers/char/hw_random/rockchip-rng.c b/drivers/char/hw_random/rockchip-rng.c index 6e3ed4b85605..fc389832c72f 100644 --- a/drivers/char/hw_random/rockchip-rng.c +++ b/drivers/char/hw_random/rockchip-rng.c @@ -389,7 +389,7 @@ static int rk_rng_probe(struct platform_device *pdev) struct rk_rng *rk_rng; int ret; - rk_rng = devm_kzalloc(dev, sizeof(*rk_rng), GFP_KERNEL); + rk_rng = devm_kzalloc_obj(dev, *rk_rng); if (!rk_rng) return -ENOMEM; diff --git a/drivers/char/hw_random/st-rng.c b/drivers/char/hw_random/st-rng.c index 23749817d83c..483e77e4a99c 100644 --- a/drivers/char/hw_random/st-rng.c +++ b/drivers/char/hw_random/st-rng.c @@ -76,7 +76,7 @@ static int st_rng_probe(struct platform_device *pdev) void __iomem *base; int ret; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c index 739263eb56ba..dec8685aca32 100644 --- a/drivers/char/hw_random/stm32-rng.c +++ b/drivers/char/hw_random/stm32-rng.c @@ -530,7 +530,7 @@ static int stm32_rng_probe(struct platform_device *ofdev) struct stm32_rng_private *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_random/timeriomem-rng.c index e61f06393209..18b758240a6e 100644 --- a/drivers/char/hw_random/timeriomem-rng.c +++ b/drivers/char/hw_random/timeriomem-rng.c @@ -114,8 +114,7 @@ static int timeriomem_rng_probe(struct platform_device *pdev) } /* Allocate memory for the device structure (and zero it) */ - priv = devm_kzalloc(&pdev->dev, - sizeof(struct timeriomem_rng_private), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct timeriomem_rng_private); if (!priv) return -ENOMEM; diff --git a/drivers/char/hw_random/xgene-rng.c b/drivers/char/hw_random/xgene-rng.c index 5fa6d28c8746..8baabc573f72 100644 --- a/drivers/char/hw_random/xgene-rng.c +++ b/drivers/char/hw_random/xgene-rng.c @@ -315,7 +315,7 @@ static int xgene_rng_probe(struct platform_device *pdev) struct clk *clk; int rc = 0; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/char/hw_random/xilinx-trng.c b/drivers/char/hw_random/xilinx-trng.c index 290bf5bc82db..e23bdbf4ba8d 100644 --- a/drivers/char/hw_random/xilinx-trng.c +++ b/drivers/char/hw_random/xilinx-trng.c @@ -291,7 +291,7 @@ static int xtrng_probe(struct platform_device *pdev) struct xilinx_rng *rng; int ret; - rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); + rng = devm_kzalloc_obj(&pdev->dev, *rng); if (!rng) return -ENOMEM; diff --git a/drivers/char/hw_random/xiphera-trng.c b/drivers/char/hw_random/xiphera-trng.c index ab5d852ff69f..923acf79277d 100644 --- a/drivers/char/hw_random/xiphera-trng.c +++ b/drivers/char/hw_random/xiphera-trng.c @@ -62,7 +62,7 @@ static int xiphera_trng_probe(struct platform_device *pdev) struct xiphera_trng *trng; struct device *dev = &pdev->dev; - trng = devm_kzalloc(dev, sizeof(*trng), GFP_KERNEL); + trng = devm_kzalloc_obj(dev, *trng); if (!trng) return -ENOMEM; diff --git a/drivers/char/ipmi/bt-bmc.c b/drivers/char/ipmi/bt-bmc.c index a179d4797011..21869ae224af 100644 --- a/drivers/char/ipmi/bt-bmc.c +++ b/drivers/char/ipmi/bt-bmc.c @@ -413,7 +413,7 @@ static int bt_bmc_probe(struct platform_device *pdev) dev = &pdev->dev; dev_info(dev, "Found bt bmc device\n"); - bt_bmc = devm_kzalloc(dev, sizeof(*bt_bmc), GFP_KERNEL); + bt_bmc = devm_kzalloc_obj(dev, *bt_bmc); if (!bt_bmc) return -ENOMEM; diff --git a/drivers/char/ipmi/ipmb_dev_int.c b/drivers/char/ipmi/ipmb_dev_int.c index eae31ec92382..5edc2be85947 100644 --- a/drivers/char/ipmi/ipmb_dev_int.c +++ b/drivers/char/ipmi/ipmb_dev_int.c @@ -305,8 +305,7 @@ static int ipmb_probe(struct i2c_client *client) struct ipmb_dev *ipmb_dev; int ret; - ipmb_dev = devm_kzalloc(&client->dev, sizeof(*ipmb_dev), - GFP_KERNEL); + ipmb_dev = devm_kzalloc_obj(&client->dev, *ipmb_dev); if (!ipmb_dev) return -ENOMEM; diff --git a/drivers/char/ipmi/ipmi_ipmb.c b/drivers/char/ipmi/ipmi_ipmb.c index 1f1e5718f082..3685a7d23b39 100644 --- a/drivers/char/ipmi/ipmi_ipmb.c +++ b/drivers/char/ipmi/ipmi_ipmb.c @@ -458,7 +458,7 @@ static int ipmi_ipmb_probe(struct i2c_client *client) struct i2c_client *slave = NULL; int rv; - iidev = devm_kzalloc(&client->dev, sizeof(*iidev), GFP_KERNEL); + iidev = devm_kzalloc_obj(&client->dev, *iidev); if (!iidev) return -ENOMEM; diff --git a/drivers/char/ipmi/ipmi_powernv.c b/drivers/char/ipmi/ipmi_powernv.c index 52a1130defe5..b184a792561d 100644 --- a/drivers/char/ipmi/ipmi_powernv.c +++ b/drivers/char/ipmi/ipmi_powernv.c @@ -221,7 +221,7 @@ static int ipmi_powernv_probe(struct platform_device *pdev) dev = &pdev->dev; - ipmi = devm_kzalloc(dev, sizeof(*ipmi), GFP_KERNEL); + ipmi = devm_kzalloc_obj(dev, *ipmi); if (!ipmi) return -ENOMEM; diff --git a/drivers/char/ipmi/kcs_bmc_aspeed.c b/drivers/char/ipmi/kcs_bmc_aspeed.c index a13a3470c17a..c99e6ac64b1e 100644 --- a/drivers/char/ipmi/kcs_bmc_aspeed.c +++ b/drivers/char/ipmi/kcs_bmc_aspeed.c @@ -586,7 +586,7 @@ static int aspeed_kcs_probe(struct platform_device *pdev) have_upstream_irq = !rc; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/ipmi/kcs_bmc_cdev_ipmi.c b/drivers/char/ipmi/kcs_bmc_cdev_ipmi.c index cf670e891966..b303d5929e88 100644 --- a/drivers/char/ipmi/kcs_bmc_cdev_ipmi.c +++ b/drivers/char/ipmi/kcs_bmc_cdev_ipmi.c @@ -474,7 +474,7 @@ static int kcs_bmc_ipmi_add_device(struct kcs_bmc_device *kcs_bmc) struct kcs_bmc_ipmi *priv; int rc; - priv = devm_kzalloc(kcs_bmc->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(kcs_bmc->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/ipmi/kcs_bmc_npcm7xx.c b/drivers/char/ipmi/kcs_bmc_npcm7xx.c index 4808a61bf273..75c2efd91ca8 100644 --- a/drivers/char/ipmi/kcs_bmc_npcm7xx.c +++ b/drivers/char/ipmi/kcs_bmc_npcm7xx.c @@ -177,7 +177,7 @@ static int npcm7xx_kcs_probe(struct platform_device *pdev) return -ENODEV; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/ipmi/kcs_bmc_serio.c b/drivers/char/ipmi/kcs_bmc_serio.c index 1a95d6f258ea..31b55e567b01 100644 --- a/drivers/char/ipmi/kcs_bmc_serio.c +++ b/drivers/char/ipmi/kcs_bmc_serio.c @@ -72,7 +72,7 @@ static int kcs_bmc_serio_add_device(struct kcs_bmc_device *kcs_bmc) struct kcs_bmc_serio *priv; struct serio *port; - priv = devm_kzalloc(kcs_bmc->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(kcs_bmc->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/ipmi/ssif_bmc.c b/drivers/char/ipmi/ssif_bmc.c index 6036897725f3..545c9cb78ed1 100644 --- a/drivers/char/ipmi/ssif_bmc.c +++ b/drivers/char/ipmi/ssif_bmc.c @@ -825,7 +825,7 @@ static int ssif_bmc_probe(struct i2c_client *client) struct ssif_bmc_ctx *ssif_bmc; int ret; - ssif_bmc = devm_kzalloc(&client->dev, sizeof(*ssif_bmc), GFP_KERNEL); + ssif_bmc = devm_kzalloc_obj(&client->dev, *ssif_bmc); if (!ssif_bmc) return -ENOMEM; diff --git a/drivers/char/tpm/st33zp24/i2c.c b/drivers/char/tpm/st33zp24/i2c.c index 81348487c125..a345a32a9726 100644 --- a/drivers/char/tpm/st33zp24/i2c.c +++ b/drivers/char/tpm/st33zp24/i2c.c @@ -110,8 +110,7 @@ static int st33zp24_i2c_probe(struct i2c_client *client) return -ENODEV; } - phy = devm_kzalloc(&client->dev, sizeof(struct st33zp24_i2c_phy), - GFP_KERNEL); + phy = devm_kzalloc_obj(&client->dev, struct st33zp24_i2c_phy); if (!phy) return -ENOMEM; diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c index 5149231f3de2..fbdaff8245b8 100644 --- a/drivers/char/tpm/st33zp24/spi.c +++ b/drivers/char/tpm/st33zp24/spi.c @@ -223,8 +223,7 @@ static int st33zp24_spi_probe(struct spi_device *dev) { struct st33zp24_spi_phy *phy; - phy = devm_kzalloc(&dev->dev, sizeof(struct st33zp24_spi_phy), - GFP_KERNEL); + phy = devm_kzalloc_obj(&dev->dev, struct st33zp24_spi_phy); if (!phy) return -ENOMEM; diff --git a/drivers/char/tpm/st33zp24/st33zp24.c b/drivers/char/tpm/st33zp24/st33zp24.c index c15a9b7aaff8..91d1278fe95a 100644 --- a/drivers/char/tpm/st33zp24/st33zp24.c +++ b/drivers/char/tpm/st33zp24/st33zp24.c @@ -459,8 +459,7 @@ int st33zp24_probe(void *phy_id, const struct st33zp24_phy_ops *ops, if (IS_ERR(chip)) return PTR_ERR(chip); - tpm_dev = devm_kzalloc(dev, sizeof(struct st33zp24_dev), - GFP_KERNEL); + tpm_dev = devm_kzalloc_obj(dev, struct st33zp24_dev); if (!tpm_dev) return -ENOMEM; diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c index 2c3f6bdd7873..6f6aaa3d5f2b 100644 --- a/drivers/char/tpm/tpm_atmel.c +++ b/drivers/char/tpm/tpm_atmel.c @@ -242,7 +242,7 @@ static int __init init_atmel(void) goto err_rel_reg; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) { rc = -ENOMEM; goto err_unreg_dev; diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c index ceb4100ba400..46cd753c0cab 100644 --- a/drivers/char/tpm/tpm_crb.c +++ b/drivers/char/tpm/tpm_crb.c @@ -815,7 +815,7 @@ static int crb_acpi_probe(struct platform_device *pdev) goto out; } - priv = devm_kzalloc(dev, sizeof(struct crb_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct crb_priv); if (!priv) { rc = -ENOMEM; goto out; diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c index b82490439633..340b4884835c 100644 --- a/drivers/char/tpm/tpm_ftpm_tee.c +++ b/drivers/char/tpm/tpm_ftpm_tee.c @@ -176,8 +176,7 @@ static int ftpm_tee_probe_generic(struct device *dev) struct ftpm_tee_private *pvt_data = NULL; struct tee_ioctl_open_session_arg sess_arg; - pvt_data = devm_kzalloc(dev, sizeof(struct ftpm_tee_private), - GFP_KERNEL); + pvt_data = devm_kzalloc_obj(dev, struct ftpm_tee_private); if (!pvt_data) return -ENOMEM; diff --git a/drivers/char/tpm/tpm_i2c_atmel.c b/drivers/char/tpm/tpm_i2c_atmel.c index dcb91d0497d0..ab058bfc9c99 100644 --- a/drivers/char/tpm/tpm_i2c_atmel.c +++ b/drivers/char/tpm/tpm_i2c_atmel.c @@ -170,7 +170,7 @@ static int i2c_atmel_probe(struct i2c_client *client) if (IS_ERR(chip)) return PTR_ERR(chip); - priv = devm_kzalloc(dev, sizeof(struct priv_data), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct priv_data); if (!priv) return -ENOMEM; diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c index 387661380913..b01e42ad121e 100644 --- a/drivers/char/tpm/tpm_i2c_nuvoton.c +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c @@ -545,7 +545,7 @@ static int i2c_nuvoton_probe(struct i2c_client *client) if (IS_ERR(chip)) return PTR_ERR(chip); - priv = devm_kzalloc(dev, sizeof(struct priv_data), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct priv_data); if (!priv) return -ENOMEM; diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c index 80536785278a..523672385ac6 100644 --- a/drivers/char/tpm/tpm_nsc.c +++ b/drivers/char/tpm/tpm_nsc.c @@ -331,7 +331,7 @@ static int __init init_nsc(void) if ((rc = platform_device_add(pdev)) < 0) goto err_put_dev; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) { rc = -ENOMEM; goto err_del_dev; diff --git a/drivers/char/tpm/tpm_svsm.c b/drivers/char/tpm/tpm_svsm.c index b74d60f687d5..4d1ffb741542 100644 --- a/drivers/char/tpm/tpm_svsm.c +++ b/drivers/char/tpm/tpm_svsm.c @@ -61,7 +61,7 @@ static int __init tpm_svsm_probe(struct platform_device *pdev) struct tpm_chip *chip; int err; - priv = devm_kmalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kmalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 737d0fe4bb61..6f8344894ea5 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c @@ -228,7 +228,7 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info) if (rc) return rc; - phy = devm_kzalloc(dev, sizeof(struct tpm_tis_tcg_phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, struct tpm_tis_tcg_phy); if (phy == NULL) return -ENOMEM; diff --git a/drivers/char/tpm/tpm_tis_i2c.c b/drivers/char/tpm/tpm_tis_i2c.c index cde0b093ed58..8adc7dfd3d7f 100644 --- a/drivers/char/tpm/tpm_tis_i2c.c +++ b/drivers/char/tpm/tpm_tis_i2c.c @@ -336,8 +336,7 @@ static int tpm_tis_i2c_probe(struct i2c_client *dev) const u8 locality = 0; int ret; - phy = devm_kzalloc(&dev->dev, sizeof(struct tpm_tis_i2c_phy), - GFP_KERNEL); + phy = devm_kzalloc_obj(&dev->dev, struct tpm_tis_i2c_phy); if (!phy) return -ENOMEM; diff --git a/drivers/char/tpm/tpm_tis_i2c_cr50.c b/drivers/char/tpm/tpm_tis_i2c_cr50.c index 6c0ea5ca2b92..0acfc36eff16 100644 --- a/drivers/char/tpm/tpm_tis_i2c_cr50.c +++ b/drivers/char/tpm/tpm_tis_i2c_cr50.c @@ -729,7 +729,7 @@ static int tpm_cr50_i2c_probe(struct i2c_client *client) if (IS_ERR(chip)) return PTR_ERR(chip); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/char/tpm/tpm_tis_spi_cr50.c b/drivers/char/tpm/tpm_tis_spi_cr50.c index 32920b4cecfb..5e62ea1778d7 100644 --- a/drivers/char/tpm/tpm_tis_spi_cr50.c +++ b/drivers/char/tpm/tpm_tis_spi_cr50.c @@ -270,7 +270,7 @@ int cr50_spi_probe(struct spi_device *spi) int ret; struct tpm_chip *chip; - cr50_phy = devm_kzalloc(&spi->dev, sizeof(*cr50_phy), GFP_KERNEL); + cr50_phy = devm_kzalloc_obj(&spi->dev, *cr50_phy); if (!cr50_phy) return -ENOMEM; diff --git a/drivers/char/tpm/tpm_tis_spi_main.c b/drivers/char/tpm/tpm_tis_spi_main.c index 727f1c78d6dd..77b84cf9e9c9 100644 --- a/drivers/char/tpm/tpm_tis_spi_main.c +++ b/drivers/char/tpm/tpm_tis_spi_main.c @@ -267,8 +267,7 @@ static int tpm_tis_spi_probe(struct spi_device *dev) struct tpm_tis_spi_phy *phy; int irq; - phy = devm_kzalloc(&dev->dev, sizeof(struct tpm_tis_spi_phy), - GFP_KERNEL); + phy = devm_kzalloc_obj(&dev->dev, struct tpm_tis_spi_phy); if (!phy) return -ENOMEM; diff --git a/drivers/char/tpm/tpm_tis_synquacer.c b/drivers/char/tpm/tpm_tis_synquacer.c index eac39730a856..81b648224d67 100644 --- a/drivers/char/tpm/tpm_tis_synquacer.c +++ b/drivers/char/tpm/tpm_tis_synquacer.c @@ -95,7 +95,7 @@ static int tpm_tis_synquacer_init(struct device *dev, { struct tpm_tis_synquacer_phy *phy; - phy = devm_kzalloc(dev, sizeof(struct tpm_tis_synquacer_phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, struct tpm_tis_synquacer_phy); if (phy == NULL) return -ENOMEM; diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index bbeb9b6060dc..36b309c17838 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c @@ -631,7 +631,7 @@ static int hwicap_setup(struct platform_device *pdev, int id, devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR + id); - drvdata = devm_kzalloc(dev, sizeof(struct hwicap_drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, struct hwicap_drvdata); if (!drvdata) { retval = -ENOMEM; goto failed; diff --git a/drivers/char/xillybus/xillybus_core.c b/drivers/char/xillybus/xillybus_core.c index 7189c6d97e7d..9cae835c4399 100644 --- a/drivers/char/xillybus/xillybus_core.c +++ b/drivers/char/xillybus/xillybus_core.c @@ -383,9 +383,8 @@ static int xilly_get_dma_buffers(struct xilly_endpoint *ep, } if (buffers) { /* Not the message buffer */ - this_buffer = devm_kcalloc(dev, bufnum, - sizeof(struct xilly_buffer), - GFP_KERNEL); + this_buffer = devm_kzalloc_objs(dev, struct xilly_buffer, + bufnum); if (!this_buffer) return -ENOMEM; } @@ -485,14 +484,12 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, .regdirection = 0x80000000, }; - channel = devm_kcalloc(dev, ep->num_channels, - sizeof(struct xilly_channel), GFP_KERNEL); + channel = devm_kzalloc_objs(dev, struct xilly_channel, ep->num_channels); if (!channel) return -ENOMEM; - ep->channels = devm_kcalloc(dev, ep->num_channels + 1, - sizeof(struct xilly_channel *), - GFP_KERNEL); + ep->channels = devm_kzalloc_objs(dev, struct xilly_channel *, + ep->num_channels + 1); if (!ep->channels) return -ENOMEM; @@ -565,9 +562,8 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, bytebufsize = bufsize << channel->log2_element_size; - buffers = devm_kcalloc(dev, bufnum, - sizeof(struct xilly_buffer *), - GFP_KERNEL); + buffers = devm_kzalloc_objs(dev, struct xilly_buffer *, + bufnum); if (!buffers) return -ENOMEM; } else { @@ -1857,7 +1853,7 @@ struct xilly_endpoint *xillybus_init_endpoint(struct device *dev) { struct xilly_endpoint *endpoint; - endpoint = devm_kzalloc(dev, sizeof(*endpoint), GFP_KERNEL); + endpoint = devm_kzalloc_obj(dev, *endpoint); if (!endpoint) return NULL; diff --git a/drivers/clk/actions/owl-s500.c b/drivers/clk/actions/owl-s500.c index c69a7e2f0645..00437234670e 100644 --- a/drivers/clk/actions/owl-s500.c +++ b/drivers/clk/actions/owl-s500.c @@ -605,7 +605,7 @@ static int s500_clk_probe(struct platform_device *pdev) desc = &s500_clk_desc; owl_clk_regmap_init(pdev, desc); - reset = devm_kzalloc(&pdev->dev, sizeof(*reset), GFP_KERNEL); + reset = devm_kzalloc_obj(&pdev->dev, *reset); if (!reset) return -ENOMEM; diff --git a/drivers/clk/actions/owl-s700.c b/drivers/clk/actions/owl-s700.c index 3e48105602aa..134c1c2820ce 100644 --- a/drivers/clk/actions/owl-s700.c +++ b/drivers/clk/actions/owl-s700.c @@ -623,7 +623,7 @@ static int s700_clk_probe(struct platform_device *pdev) * FIXME: Reset controller registration should be moved to * common code, once all SoCs of Owl family supports it. */ - reset = devm_kzalloc(&pdev->dev, sizeof(*reset), GFP_KERNEL); + reset = devm_kzalloc_obj(&pdev->dev, *reset); if (!reset) return -ENOMEM; diff --git a/drivers/clk/actions/owl-s900.c b/drivers/clk/actions/owl-s900.c index 7dc6e07fb60e..feb12d363964 100644 --- a/drivers/clk/actions/owl-s900.c +++ b/drivers/clk/actions/owl-s900.c @@ -766,7 +766,7 @@ static int s900_clk_probe(struct platform_device *pdev) * FIXME: Reset controller registration should be moved to * common code, once all SoCs of Owl family supports it. */ - reset = devm_kzalloc(&pdev->dev, sizeof(*reset), GFP_KERNEL); + reset = devm_kzalloc_obj(&pdev->dev, *reset); if (!reset) return -ENOMEM; diff --git a/drivers/clk/anlogic/cru_dr1.c b/drivers/clk/anlogic/cru_dr1.c index 10f8751a8838..478a52d5fa36 100644 --- a/drivers/clk/anlogic/cru_dr1.c +++ b/drivers/clk/anlogic/cru_dr1.c @@ -183,7 +183,7 @@ int dr1_cru_clk_register(struct device *dev, void __iomem *base, struct clk_hw_onecell_data *priv; int i, ret; - priv = devm_kzalloc(dev, struct_size(priv, hws, nr_clks), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, hws, nr_clks); if (!priv) return -ENOMEM; diff --git a/drivers/clk/aspeed/clk-aspeed.c b/drivers/clk/aspeed/clk-aspeed.c index d32a3e9f300a..fe9058edd9e8 100644 --- a/drivers/clk/aspeed/clk-aspeed.c +++ b/drivers/clk/aspeed/clk-aspeed.c @@ -397,7 +397,7 @@ static int aspeed_clk_probe(struct platform_device *pdev) return PTR_ERR(map); } - ar = devm_kzalloc(dev, sizeof(*ar), GFP_KERNEL); + ar = devm_kzalloc_obj(dev, *ar); if (!ar) return -ENOMEM; diff --git a/drivers/clk/aspeed/clk-ast2600.c b/drivers/clk/aspeed/clk-ast2600.c index cc3d26602b16..5ae7b775812f 100644 --- a/drivers/clk/aspeed/clk-ast2600.c +++ b/drivers/clk/aspeed/clk-ast2600.c @@ -492,7 +492,7 @@ static int aspeed_g6_clk_probe(struct platform_device *pdev) return PTR_ERR(map); } - ar = devm_kzalloc(dev, sizeof(*ar), GFP_KERNEL); + ar = devm_kzalloc_obj(dev, *ar); if (!ar) return -ENOMEM; diff --git a/drivers/clk/aspeed/clk-ast2700.c b/drivers/clk/aspeed/clk-ast2700.c index 495b7fa3395b..62f490d9e188 100644 --- a/drivers/clk/aspeed/clk-ast2700.c +++ b/drivers/clk/aspeed/clk-ast2700.c @@ -890,7 +890,7 @@ static int ast2700_soc_clk_probe(struct platform_device *pdev) int ret; int i; - clk_ctrl = devm_kzalloc(dev, sizeof(*clk_ctrl), GFP_KERNEL); + clk_ctrl = devm_kzalloc_obj(dev, *clk_ctrl); if (!clk_ctrl) return -ENOMEM; clk_ctrl->dev = dev; @@ -911,8 +911,8 @@ static int ast2700_soc_clk_probe(struct platform_device *pdev) clk_ctrl->clk_data = clk_data; reset_name = devm_kasprintf(dev, GFP_KERNEL, "reset%d", clk_data->scu); - clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, clk_data->nr_clks), - GFP_KERNEL); + clk_hw_data = devm_kzalloc_flex(dev, *clk_hw_data, hws, + clk_data->nr_clks); if (!clk_hw_data) return -ENOMEM; diff --git a/drivers/clk/axs10x/i2s_pll_clock.c b/drivers/clk/axs10x/i2s_pll_clock.c index 6f3e1151b354..5247bb5620dd 100644 --- a/drivers/clk/axs10x/i2s_pll_clock.c +++ b/drivers/clk/axs10x/i2s_pll_clock.c @@ -170,7 +170,7 @@ static int i2s_pll_clk_probe(struct platform_device *pdev) struct i2s_pll_clk *pll_clk; struct clk_init_data init; - pll_clk = devm_kzalloc(dev, sizeof(*pll_clk), GFP_KERNEL); + pll_clk = devm_kzalloc_obj(dev, *pll_clk); if (!pll_clk) return -ENOMEM; diff --git a/drivers/clk/axs10x/pll_clock.c b/drivers/clk/axs10x/pll_clock.c index 5ab1c220c62d..6102fa64fd7b 100644 --- a/drivers/clk/axs10x/pll_clock.c +++ b/drivers/clk/axs10x/pll_clock.c @@ -222,7 +222,7 @@ static int axs10x_pll_clk_probe(struct platform_device *pdev) struct clk_init_data init = { }; int ret; - pll_clk = devm_kzalloc(dev, sizeof(*pll_clk), GFP_KERNEL); + pll_clk = devm_kzalloc_obj(dev, *pll_clk); if (!pll_clk) return -ENOMEM; diff --git a/drivers/clk/bcm/clk-bcm2711-dvp.c b/drivers/clk/bcm/clk-bcm2711-dvp.c index e79720e85685..301a2d13b8fa 100644 --- a/drivers/clk/bcm/clk-bcm2711-dvp.c +++ b/drivers/clk/bcm/clk-bcm2711-dvp.c @@ -29,14 +29,12 @@ static int clk_dvp_probe(struct platform_device *pdev) void __iomem *base; int ret; - dvp = devm_kzalloc(&pdev->dev, sizeof(*dvp), GFP_KERNEL); + dvp = devm_kzalloc_obj(&pdev->dev, *dvp); if (!dvp) return -ENOMEM; platform_set_drvdata(pdev, dvp); - dvp->data = devm_kzalloc(&pdev->dev, - struct_size(dvp->data, hws, NR_CLOCKS), - GFP_KERNEL); + dvp->data = devm_kzalloc_flex(&pdev->dev, *dvp->data, hws, NR_CLOCKS); if (!dvp->data) return -ENOMEM; data = dvp->data; diff --git a/drivers/clk/bcm/clk-bcm2835-aux.c b/drivers/clk/bcm/clk-bcm2835-aux.c index 0fafa5cba442..351a63e5cdfc 100644 --- a/drivers/clk/bcm/clk-bcm2835-aux.c +++ b/drivers/clk/bcm/clk-bcm2835-aux.c @@ -30,10 +30,7 @@ static int bcm2835_aux_clk_probe(struct platform_device *pdev) if (IS_ERR(reg)) return PTR_ERR(reg); - onecell = devm_kmalloc(dev, - struct_size(onecell, hws, - BCM2835_AUX_CLOCK_COUNT), - GFP_KERNEL); + onecell = devm_kmalloc_flex(dev, *onecell, hws, BCM2835_AUX_CLOCK_COUNT); if (!onecell) return -ENOMEM; onecell->num = BCM2835_AUX_CLOCK_COUNT; diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index 118df86d717c..b668c406512a 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -403,7 +403,7 @@ static void bcm2835_debugfs_regset(struct bcm2835_cprman *cprman, u32 base, { struct debugfs_regset32 *regset; - regset = devm_kzalloc(cprman->dev, sizeof(*regset), GFP_KERNEL); + regset = devm_kzalloc_obj(cprman->dev, *regset); if (!regset) return; @@ -760,7 +760,7 @@ static void bcm2835_pll_debug_init(struct clk_hw *hw, const struct bcm2835_pll_data *data = pll->data; struct debugfs_reg32 *regs; - regs = devm_kcalloc(cprman->dev, 7, sizeof(*regs), GFP_KERNEL); + regs = devm_kzalloc_objs(cprman->dev, *regs, 7); if (!regs) return; @@ -890,7 +890,7 @@ static void bcm2835_pll_divider_debug_init(struct clk_hw *hw, const struct bcm2835_pll_divider_data *data = divider->data; struct debugfs_reg32 *regs; - regs = devm_kcalloc(cprman->dev, 7, sizeof(*regs), GFP_KERNEL); + regs = devm_kzalloc_objs(cprman->dev, *regs, 7); if (!regs) return; @@ -1400,7 +1400,7 @@ bcm2835_register_pll_divider(struct bcm2835_cprman *cprman, init.ops = &bcm2835_pll_divider_clk_ops; init.flags = divider_data->flags | CLK_IGNORE_UNUSED; - divider = devm_kzalloc(cprman->dev, sizeof(*divider), GFP_KERNEL); + divider = devm_kzalloc_obj(cprman->dev, *divider); if (!divider) return NULL; @@ -1485,7 +1485,7 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman, init.flags &= ~CLK_IS_CRITICAL; } - clock = devm_kzalloc(cprman->dev, sizeof(*clock), GFP_KERNEL); + clock = devm_kzalloc_obj(cprman->dev, *clock); if (!clock) return NULL; @@ -2279,9 +2279,7 @@ static int bcm2835_clk_probe(struct platform_device *pdev) if (!pdata) return -ENODEV; - cprman = devm_kzalloc(dev, - struct_size(cprman, onecell.hws, asize), - GFP_KERNEL); + cprman = devm_kzalloc_flex(dev, *cprman, onecell.hws, asize); if (!cprman) return -ENOMEM; diff --git a/drivers/clk/bcm/clk-bcm63268-timer.c b/drivers/clk/bcm/clk-bcm63268-timer.c index 463710d272a1..d74ec2f506be 100644 --- a/drivers/clk/bcm/clk-bcm63268-timer.c +++ b/drivers/clk/bcm/clk-bcm63268-timer.c @@ -158,8 +158,7 @@ static int bcm63268_tclk_probe(struct platform_device *pdev) maxbit = max(maxbit, entry->bit); maxbit++; - hw = devm_kzalloc(&pdev->dev, struct_size(hw, data.hws, maxbit), - GFP_KERNEL); + hw = devm_kzalloc_flex(&pdev->dev, *hw, data.hws, maxbit); if (!hw) return -ENOMEM; diff --git a/drivers/clk/bcm/clk-bcm63xx-gate.c b/drivers/clk/bcm/clk-bcm63xx-gate.c index d6d857474436..de86975bc7b3 100644 --- a/drivers/clk/bcm/clk-bcm63xx-gate.c +++ b/drivers/clk/bcm/clk-bcm63xx-gate.c @@ -496,8 +496,7 @@ static int clk_bcm63xx_probe(struct platform_device *pdev) maxbit = max_t(u8, maxbit, entry->bit); maxbit++; - hw = devm_kzalloc(&pdev->dev, struct_size(hw, data.hws, maxbit), - GFP_KERNEL); + hw = devm_kzalloc_flex(&pdev->dev, *hw, data.hws, maxbit); if (!hw) return -ENOMEM; diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c index 9882f243d681..fef0da31bda2 100644 --- a/drivers/clk/bcm/clk-raspberrypi.c +++ b/drivers/clk/bcm/clk-raspberrypi.c @@ -377,7 +377,7 @@ static struct clk_hw *raspberrypi_clk_register(struct raspberrypi_clk *rpi, u32 min_rate, max_rate; int ret; - data = devm_kzalloc(rpi->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(rpi->dev, *data); if (!data) return ERR_PTR(-ENOMEM); data->rpi = rpi; @@ -459,9 +459,7 @@ static int raspberrypi_discover_clocks(struct raspberrypi_clk *rpi, * RPI_FIRMWARE_GET_CLOCKS is zeroed. So allocate an additional * zero element as sentinel. */ - clks = devm_kcalloc(rpi->dev, - RPI_FIRMWARE_NUM_CLK_ID + 1, sizeof(*clks), - GFP_KERNEL); + clks = devm_kzalloc_objs(rpi->dev, *clks, RPI_FIRMWARE_NUM_CLK_ID + 1); if (!clks) return -ENOMEM; @@ -528,7 +526,7 @@ static int raspberrypi_clk_probe(struct platform_device *pdev) if (!firmware) return -EPROBE_DEFER; - rpi = devm_kzalloc(dev, sizeof(*rpi), GFP_KERNEL); + rpi = devm_kzalloc_obj(dev, *rpi); if (!rpi) return -ENOMEM; @@ -536,9 +534,8 @@ static int raspberrypi_clk_probe(struct platform_device *pdev) rpi->firmware = firmware; platform_set_drvdata(pdev, rpi); - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, - RPI_FIRMWARE_NUM_CLK_ID), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, + RPI_FIRMWARE_NUM_CLK_ID); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/cix/clk-sky1-audss.c b/drivers/clk/cix/clk-sky1-audss.c index e096b8121df3..99715c089c52 100644 --- a/drivers/clk/cix/clk-sky1-audss.c +++ b/drivers/clk/cix/clk-sky1-audss.c @@ -824,7 +824,7 @@ static struct clk_hw *sky1_audss_clk_register(struct device *dev, struct clk_parent_data *parent_data; int i; - parent_data = devm_kcalloc(dev, num_parents, sizeof(*parent_data), GFP_KERNEL); + parent_data = devm_kzalloc_objs(dev, *parent_data, num_parents); if (!parent_data) return ERR_PTR(-ENOMEM); @@ -832,7 +832,7 @@ static struct clk_hw *sky1_audss_clk_register(struct device *dev, parent_data[i].name = parent_names[i]; if (mux_cfg->offset >= 0) { - sky1_mux = devm_kzalloc(dev, sizeof(*sky1_mux), GFP_KERNEL); + sky1_mux = devm_kzalloc_obj(dev, *sky1_mux); if (!sky1_mux) return ERR_PTR(-ENOMEM); @@ -848,7 +848,7 @@ static struct clk_hw *sky1_audss_clk_register(struct device *dev, } if (div_cfg->offset >= 0) { - sky1_div = devm_kzalloc(dev, sizeof(*sky1_div), GFP_KERNEL); + sky1_div = devm_kzalloc_obj(dev, *sky1_div); if (!sky1_div) return ERR_PTR(-ENOMEM); @@ -863,7 +863,7 @@ static struct clk_hw *sky1_audss_clk_register(struct device *dev, } if (gate_cfg->offset >= 0) { - sky1_gate = devm_kzalloc(dev, sizeof(*sky1_gate), GFP_KERNEL); + sky1_gate = devm_kzalloc_obj(dev, *sky1_gate); if (!sky1_gate) return ERR_PTR(-ENOMEM); @@ -973,15 +973,14 @@ static int sky1_audss_clk_probe(struct platform_device *pdev) if (!devtype_data) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; spin_lock_init(&priv->lock); - priv->clk_data = devm_kzalloc(dev, - struct_size(priv->clk_data, hws, SKY1_AUDSS_NUM_CLKS), - GFP_KERNEL); + priv->clk_data = devm_kzalloc_flex(dev, *priv->clk_data, hws, + SKY1_AUDSS_NUM_CLKS); if (!priv->clk_data) return -ENOMEM; diff --git a/drivers/clk/clk-apple-nco.c b/drivers/clk/clk-apple-nco.c index 434c067968bb..e96438c8c909 100644 --- a/drivers/clk/clk-apple-nco.c +++ b/drivers/clk/clk-apple-nco.c @@ -275,13 +275,13 @@ static int applnco_probe(struct platform_device *pdev) nchannels = (resource_size(res) - NCO_CHANNEL_REGSIZE) / NCO_CHANNEL_STRIDE + 1; - onecell_data = devm_kzalloc(&pdev->dev, struct_size(onecell_data, hws, - nchannels), GFP_KERNEL); + onecell_data = devm_kzalloc_flex(&pdev->dev, *onecell_data, hws, + nchannels); if (!onecell_data) return -ENOMEM; onecell_data->num = nchannels; - tbl = devm_kzalloc(&pdev->dev, sizeof(*tbl), GFP_KERNEL); + tbl = devm_kzalloc_obj(&pdev->dev, *tbl); if (!tbl) return -ENOMEM; applnco_compute_tables(tbl); @@ -289,7 +289,7 @@ static int applnco_probe(struct platform_device *pdev) for (i = 0; i < nchannels; i++) { struct applnco_channel *chan; - chan = devm_kzalloc(&pdev->dev, sizeof(*chan), GFP_KERNEL); + chan = devm_kzalloc_obj(&pdev->dev, *chan); if (!chan) return -ENOMEM; chan->base = base + NCO_CHANNEL_STRIDE * i; diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c index e53256c56dfa..8f3b9d1d76a1 100644 --- a/drivers/clk/clk-axi-clkgen.c +++ b/drivers/clk/clk-axi-clkgen.c @@ -579,7 +579,7 @@ static int axi_clkgen_probe(struct platform_device *pdev) if (!dflt_limits) return -ENODEV; - axi_clkgen = devm_kzalloc(&pdev->dev, sizeof(*axi_clkgen), GFP_KERNEL); + axi_clkgen = devm_kzalloc_obj(&pdev->dev, *axi_clkgen); if (!axi_clkgen) return -ENOMEM; diff --git a/drivers/clk/clk-bd718x7.c b/drivers/clk/clk-bd718x7.c index 1698b763bcb7..c1232784e5ce 100644 --- a/drivers/clk/clk-bd718x7.c +++ b/drivers/clk/clk-bd718x7.c @@ -92,7 +92,7 @@ static int bd71837_clk_probe(struct platform_device *pdev) }; enum rohm_chip_type chip = platform_get_device_id(pdev)->driver_data; - c = devm_kzalloc(&pdev->dev, sizeof(*c), GFP_KERNEL); + c = devm_kzalloc_obj(&pdev->dev, *c); if (!c) return -ENOMEM; diff --git a/drivers/clk/clk-bm1880.c b/drivers/clk/clk-bm1880.c index 122e57176c1c..da8ff672ee0f 100644 --- a/drivers/clk/clk-bm1880.c +++ b/drivers/clk/clk-bm1880.c @@ -889,8 +889,7 @@ static int bm1880_clk_probe(struct platform_device *pdev) ARRAY_SIZE(bm1880_composite_clks) + ARRAY_SIZE(bm1880_gate_clks); - clk_data = devm_kzalloc(dev, struct_size(clk_data, hw_data.hws, - num_clks), GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hw_data.hws, num_clks); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c index 828125a8610b..c2cb58052fa6 100644 --- a/drivers/clk/clk-cdce706.c +++ b/drivers/clk/clk-cdce706.c @@ -641,7 +641,7 @@ static int cdce706_probe(struct i2c_client *client) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - cdce = devm_kzalloc(&client->dev, sizeof(*cdce), GFP_KERNEL); + cdce = devm_kzalloc_obj(&client->dev, *cdce); if (!cdce) return -ENOMEM; diff --git a/drivers/clk/clk-cdce925.c b/drivers/clk/clk-cdce925.c index 56b69d4fe4c2..52d350f91496 100644 --- a/drivers/clk/clk-cdce925.c +++ b/drivers/clk/clk-cdce925.c @@ -648,7 +648,7 @@ static int cdce925_probe(struct i2c_client *client) if (err) return err; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/clk/clk-cs2000-cp.c b/drivers/clk/clk-cs2000-cp.c index aa1823b3100e..54b9d239d822 100644 --- a/drivers/clk/clk-cs2000-cp.c +++ b/drivers/clk/clk-cs2000-cp.c @@ -574,7 +574,7 @@ static int cs2000_probe(struct i2c_client *client) struct device *dev = &client->dev; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c index 24fdec2e6198..cf09f82222f6 100644 --- a/drivers/clk/clk-en7523.c +++ b/drivers/clk/clk-en7523.c @@ -641,7 +641,7 @@ static struct clk_hw *en7523_register_pcie_clk(struct device *dev, }; struct en_clk_gate *cg; - cg = devm_kzalloc(dev, sizeof(*cg), GFP_KERNEL); + cg = devm_kzalloc_obj(dev, *cg); if (!cg) return NULL; @@ -859,7 +859,7 @@ static int en7581_reset_register(struct device *dev, void __iomem *base, { struct en_rst_data *rst_data; - rst_data = devm_kzalloc(dev, sizeof(*rst_data), GFP_KERNEL); + rst_data = devm_kzalloc_obj(dev, *rst_data); if (!rst_data) return -ENOMEM; @@ -1022,8 +1022,7 @@ static int en7581_serdes_phy_register(struct device *dev) for (i = 0; i < EN_SERDES_PHY_NUM; i++) { struct en_serdes_phy_instance *instance; - instance = devm_kzalloc(dev, sizeof(*instance), - GFP_KERNEL); + instance = devm_kzalloc_obj(dev, *instance); if (!instance) return -ENOMEM; @@ -1193,15 +1192,14 @@ static int en7523_clk_probe(struct platform_device *pdev) soc_data = device_get_match_data(&pdev->dev); - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; spin_lock_init(&priv->lock); - clk_data = devm_kzalloc(&pdev->dev, - struct_size(clk_data, hws, soc_data->num_clocks), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(&pdev->dev, *clk_data, hws, + soc_data->num_clocks); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/clk-ep93xx.c b/drivers/clk/clk-ep93xx.c index 972aadd11493..63a6775ac1f3 100644 --- a/drivers/clk/clk-ep93xx.c +++ b/drivers/clk/clk-ep93xx.c @@ -672,7 +672,7 @@ static int ep93xx_clk_probe(struct auxiliary_device *adev, int ret; u32 value; - priv = devm_kzalloc(dev, struct_size(priv, reg, 10), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, reg, 10); if (!priv) return -ENOMEM; diff --git a/drivers/clk/clk-fsl-sai.c b/drivers/clk/clk-fsl-sai.c index eded6a5fac21..293d78ab0372 100644 --- a/drivers/clk/clk-fsl-sai.c +++ b/drivers/clk/clk-fsl-sai.c @@ -110,7 +110,7 @@ static int fsl_sai_clk_probe(struct platform_device *pdev) void __iomem *base; int ret; - sai_clk = devm_kzalloc(dev, sizeof(*sai_clk), GFP_KERNEL); + sai_clk = devm_kzalloc_obj(dev, *sai_clk); if (!sai_clk) return -ENOMEM; diff --git a/drivers/clk/clk-gemini.c b/drivers/clk/clk-gemini.c index 4e874392e3b0..2e2fcc0f5e7c 100644 --- a/drivers/clk/clk-gemini.c +++ b/drivers/clk/clk-gemini.c @@ -281,7 +281,7 @@ static int gemini_clk_probe(struct platform_device *pdev) int ret; int i; - gr = devm_kzalloc(dev, sizeof(*gr), GFP_KERNEL); + gr = devm_kzalloc_obj(dev, *gr); if (!gr) return -ENOMEM; diff --git a/drivers/clk/clk-gpio.c b/drivers/clk/clk-gpio.c index 918b2c6444ee..df0856a39c8d 100644 --- a/drivers/clk/clk-gpio.c +++ b/drivers/clk/clk-gpio.c @@ -151,7 +151,7 @@ static struct clk_hw *clk_register_gpio(struct device *dev, u8 num_parents, { .index = 1 }, }; - clk_gpio = devm_kzalloc(dev, sizeof(*clk_gpio), GFP_KERNEL); + clk_gpio = devm_kzalloc_obj(dev, *clk_gpio); if (!clk_gpio) return ERR_PTR(-ENOMEM); @@ -362,7 +362,7 @@ static int clk_gated_fixed_probe(struct platform_device *pdev) u32 rate; int ret; - clk = devm_kzalloc(dev, sizeof(*clk), GFP_KERNEL); + clk = devm_kzalloc_obj(dev, *clk); if (!clk) return -ENOMEM; diff --git a/drivers/clk/clk-hi655x.c b/drivers/clk/clk-hi655x.c index cf8ddcfb380c..ef5c5fd62cb6 100644 --- a/drivers/clk/clk-hi655x.c +++ b/drivers/clk/clk-hi655x.c @@ -83,7 +83,7 @@ static int hi655x_clk_probe(struct platform_device *pdev) }; int ret; - hi655x_clk = devm_kzalloc(&pdev->dev, sizeof(*hi655x_clk), GFP_KERNEL); + hi655x_clk = devm_kzalloc_obj(&pdev->dev, *hi655x_clk); if (!hi655x_clk) return -ENOMEM; diff --git a/drivers/clk/clk-hsdk-pll.c b/drivers/clk/clk-hsdk-pll.c index 0e257cce588e..bb7b40164864 100644 --- a/drivers/clk/clk-hsdk-pll.c +++ b/drivers/clk/clk-hsdk-pll.c @@ -311,7 +311,7 @@ static int hsdk_pll_clk_probe(struct platform_device *pdev) struct clk_init_data init = { }; struct device *dev = &pdev->dev; - pll_clk = devm_kzalloc(dev, sizeof(*pll_clk), GFP_KERNEL); + pll_clk = devm_kzalloc_obj(dev, *pll_clk); if (!pll_clk) return -ENOMEM; diff --git a/drivers/clk/clk-k230.c b/drivers/clk/clk-k230.c index f34a3e6d3bca..a21625edf99f 100644 --- a/drivers/clk/clk-k230.c +++ b/drivers/clk/clk-k230.c @@ -2372,7 +2372,7 @@ static int k230_clk_init_plls(struct platform_device *pdev) /* used for all the plls */ spinlock_t *lock; - lock = devm_kzalloc(&pdev->dev, sizeof(*lock), GFP_KERNEL); + lock = devm_kzalloc_obj(&pdev->dev, *lock); if (!lock) return -ENOMEM; @@ -2401,7 +2401,7 @@ static int k230_clk_init_clks(struct platform_device *pdev, /* used for all the clocks */ spinlock_t *lock; - lock = devm_kzalloc(&pdev->dev, sizeof(*lock), GFP_KERNEL); + lock = devm_kzalloc_obj(&pdev->dev, *lock); if (!lock) return -ENOMEM; @@ -2425,8 +2425,7 @@ static int k230_clk_probe(struct platform_device *pdev) int ret; struct clk_hw_onecell_data *hw_data; - hw_data = devm_kzalloc(&pdev->dev, struct_size(hw_data, hws, K230_CLK_NUM), - GFP_KERNEL); + hw_data = devm_kzalloc_flex(&pdev->dev, *hw_data, hws, K230_CLK_NUM); if (!hw_data) return -ENOMEM; diff --git a/drivers/clk/clk-lan966x.c b/drivers/clk/clk-lan966x.c index 3c7a48c616bb..754bbef835e7 100644 --- a/drivers/clk/clk-lan966x.c +++ b/drivers/clk/clk-lan966x.c @@ -208,7 +208,7 @@ static struct clk_hw *lan966x_gck_clk_register(struct device *dev, int i) struct lan966x_gck *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return ERR_PTR(-ENOMEM); @@ -260,8 +260,7 @@ static int lan966x_clk_probe(struct platform_device *pdev) if (!data) return -EINVAL; - hw_data = devm_kzalloc(dev, struct_size(hw_data, hws, data->num_total_clks), - GFP_KERNEL); + hw_data = devm_kzalloc_flex(dev, *hw_data, hws, data->num_total_clks); if (!hw_data) return -ENOMEM; diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c index 755f9837c53a..e6e771e8eb14 100644 --- a/drivers/clk/clk-lmk04832.c +++ b/drivers/clk/clk-lmk04832.c @@ -1396,7 +1396,7 @@ static int lmk04832_probe(struct spi_device *spi) info = &lmk04832_device_info; - lmk = devm_kzalloc(&spi->dev, sizeof(struct lmk04832), GFP_KERNEL); + lmk = devm_kzalloc_obj(&spi->dev, struct lmk04832); if (!lmk) return -ENOMEM; @@ -1414,23 +1414,22 @@ static int lmk04832_probe(struct spi_device *spi) return dev_err_probe(lmk->dev, PTR_ERR(lmk->reset_gpio), "failed to get reset GPIO\n"); - lmk->dclk = devm_kcalloc(lmk->dev, info->num_channels >> 1, - sizeof(struct lmk_dclk), GFP_KERNEL); + lmk->dclk = devm_kzalloc_objs(lmk->dev, struct lmk_dclk, + info->num_channels >> 1); if (!lmk->dclk) { ret = -ENOMEM; return ret; } - lmk->clkout = devm_kcalloc(lmk->dev, info->num_channels, - sizeof(*lmk->clkout), GFP_KERNEL); + lmk->clkout = devm_kzalloc_objs(lmk->dev, *lmk->clkout, + info->num_channels); if (!lmk->clkout) { ret = -ENOMEM; return ret; } - lmk->clk_data = devm_kzalloc(lmk->dev, struct_size(lmk->clk_data, hws, - info->num_channels), - GFP_KERNEL); + lmk->clk_data = devm_kzalloc_flex(lmk->dev, *lmk->clk_data, hws, + info->num_channels); if (!lmk->clk_data) { ret = -ENOMEM; return ret; diff --git a/drivers/clk/clk-lochnagar.c b/drivers/clk/clk-lochnagar.c index 5561a2c66b69..76da48fbba24 100644 --- a/drivers/clk/clk-lochnagar.c +++ b/drivers/clk/clk-lochnagar.c @@ -246,7 +246,7 @@ static int lochnagar_clk_probe(struct platform_device *pdev) struct lochnagar_config *conf; int ret, i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/clk/clk-loongson2.c b/drivers/clk/clk-loongson2.c index 9c4c6c99db3e..c620797893a3 100644 --- a/drivers/clk/clk-loongson2.c +++ b/drivers/clk/clk-loongson2.c @@ -326,7 +326,7 @@ static struct clk_hw *loongson2_clk_register(const char *parent, struct loongson2_clk_data *clk; struct clk_init_data init = { }; - clk = devm_kzalloc(clp->dev, sizeof(*clk), GFP_KERNEL); + clk = devm_kzalloc_obj(clp->dev, *clk); if (!clk) return ERR_PTR(-ENOMEM); @@ -373,8 +373,7 @@ static int loongson2_clk_probe(struct platform_device *pdev) for (p = data; p->name; p++) clks_num = max(clks_num, p->id + 1); - clp = devm_kzalloc(dev, struct_size(clp, clk_data.hws, clks_num), - GFP_KERNEL); + clp = devm_kzalloc_flex(dev, *clp, clk_data.hws, clks_num); if (!clp) return -ENOMEM; diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c index e6fde914c5ef..6c9fbce4f81d 100644 --- a/drivers/clk/clk-max77686.c +++ b/drivers/clk/clk-max77686.c @@ -189,7 +189,7 @@ static int max77686_clk_probe(struct platform_device *pdev) return -EINVAL; } - drv_data = devm_kzalloc(dev, struct_size(drv_data, max_clk_data, num_clks), GFP_KERNEL); + drv_data = devm_kzalloc_flex(dev, *drv_data, max_clk_data, num_clks); if (!drv_data) return -ENOMEM; diff --git a/drivers/clk/clk-max9485.c b/drivers/clk/clk-max9485.c index 0515e3e41162..9c48c0c3a998 100644 --- a/drivers/clk/clk-max9485.c +++ b/drivers/clk/clk-max9485.c @@ -268,7 +268,7 @@ static int max9485_i2c_probe(struct i2c_client *client) const char *xclk_name; int i, ret; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/clk/clk-npcm8xx.c b/drivers/clk/clk-npcm8xx.c index 2138c011411d..cc98131b4307 100644 --- a/drivers/clk/clk-npcm8xx.c +++ b/drivers/clk/clk-npcm8xx.c @@ -260,7 +260,7 @@ npcm8xx_clk_register_pll(struct device *dev, void __iomem *pllcon, struct clk_init_data init = {}; int ret; - pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); + pll = devm_kzalloc_obj(dev, *pll); if (!pll) return ERR_PTR(-ENOMEM); @@ -291,9 +291,8 @@ static int npcm8xx_clk_probe(struct auxiliary_device *adev, struct clk_hw *hw; unsigned int i; - npcm8xx_clk_data = devm_kzalloc(dev, struct_size(npcm8xx_clk_data, hws, - NPCM8XX_NUM_CLOCKS), - GFP_KERNEL); + npcm8xx_clk_data = devm_kzalloc_flex(dev, *npcm8xx_clk_data, hws, + NPCM8XX_NUM_CLOCKS); if (!npcm8xx_clk_data) return -ENOMEM; diff --git a/drivers/clk/clk-palmas.c b/drivers/clk/clk-palmas.c index fdbf8445ebc2..ad35441ac209 100644 --- a/drivers/clk/clk-palmas.c +++ b/drivers/clk/clk-palmas.c @@ -250,7 +250,7 @@ static int palmas_clks_probe(struct platform_device *pdev) if (!match_data) return 1; - cinfo = devm_kzalloc(&pdev->dev, sizeof(*cinfo), GFP_KERNEL); + cinfo = devm_kzalloc_obj(&pdev->dev, *cinfo); if (!cinfo) return -ENOMEM; diff --git a/drivers/clk/clk-plldig.c b/drivers/clk/clk-plldig.c index 14357f3e4561..4c29a9374500 100644 --- a/drivers/clk/clk-plldig.c +++ b/drivers/clk/clk-plldig.c @@ -225,7 +225,7 @@ static int plldig_clk_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/clk/clk-pwm.c b/drivers/clk/clk-pwm.c index 2001c7c9367c..b1e464d5dd29 100644 --- a/drivers/clk/clk-pwm.c +++ b/drivers/clk/clk-pwm.c @@ -102,7 +102,7 @@ static int clk_pwm_probe(struct platform_device *pdev) const char *clk_name; int ret; - clk_pwm = devm_kzalloc(&pdev->dev, sizeof(*clk_pwm), GFP_KERNEL); + clk_pwm = devm_kzalloc_obj(&pdev->dev, *clk_pwm); if (!clk_pwm) return -ENOMEM; diff --git a/drivers/clk/clk-renesas-pcie.c b/drivers/clk/clk-renesas-pcie.c index 864bf89cecd0..d7fa7e6aec62 100644 --- a/drivers/clk/clk-renesas-pcie.c +++ b/drivers/clk/clk-renesas-pcie.c @@ -284,8 +284,8 @@ static int rs9_probe(struct i2c_client *client) if (!chip_info) return -EINVAL; - rs9 = devm_kzalloc(&client->dev, struct_size(rs9, onecell.hws, - chip_info->num_clks), GFP_KERNEL); + rs9 = devm_kzalloc_flex(&client->dev, *rs9, onecell.hws, + chip_info->num_clks); if (!rs9) return -ENOMEM; diff --git a/drivers/clk/clk-rk808.c b/drivers/clk/clk-rk808.c index 5a75b5c91555..ff0cec86d2e6 100644 --- a/drivers/clk/clk-rk808.c +++ b/drivers/clk/clk-rk808.c @@ -155,8 +155,7 @@ static int rk808_clkout_probe(struct platform_device *pdev) device_set_of_node_from_dev(dev, dev->parent); - rk808_clkout = devm_kzalloc(dev, - sizeof(*rk808_clkout), GFP_KERNEL); + rk808_clkout = devm_kzalloc_obj(dev, *rk808_clkout); if (!rk808_clkout) return -ENOMEM; diff --git a/drivers/clk/clk-rp1.c b/drivers/clk/clk-rp1.c index 0f7d9fd77481..1dd276dd2bb3 100644 --- a/drivers/clk/clk-rp1.c +++ b/drivers/clk/clk-rp1.c @@ -2394,8 +2394,7 @@ static int rp1_clk_probe(struct platform_device *pdev) struct clk_hw **hws; unsigned int i; - clockman = devm_kzalloc(dev, struct_size(clockman, onecell.hws, asize), - GFP_KERNEL); + clockman = devm_kzalloc_flex(dev, *clockman, onecell.hws, asize); if (!clockman) return -ENOMEM; diff --git a/drivers/clk/clk-rpmi.c b/drivers/clk/clk-rpmi.c index 921296aafa68..40c11c373556 100644 --- a/drivers/clk/clk-rpmi.c +++ b/drivers/clk/clk-rpmi.c @@ -452,11 +452,11 @@ static struct clk_hw *rpmi_clk_enumerate(struct rpmi_clk_context *context, u32 c struct clk_hw *clk_hw; int ret; - rates = devm_kzalloc(dev, sizeof(*rates), GFP_KERNEL); + rates = devm_kzalloc_obj(dev, *rates); if (!rates) return ERR_PTR(-ENOMEM); - rpmi_clk = devm_kzalloc(dev, sizeof(*rpmi_clk), GFP_KERNEL); + rpmi_clk = devm_kzalloc_obj(dev, *rpmi_clk); if (!rpmi_clk) return ERR_PTR(-ENOMEM); @@ -518,7 +518,7 @@ static int rpmi_clk_probe(struct platform_device *pdev) struct clk_hw *hw_ptr; struct device *dev = &pdev->dev; - context = devm_kzalloc(dev, sizeof(*context), GFP_KERNEL); + context = devm_kzalloc_obj(dev, *context); if (!context) return -ENOMEM; context->dev = dev; @@ -578,8 +578,7 @@ static int rpmi_clk_probe(struct platform_device *pdev) if (!num_clocks) return dev_err_probe(dev, -ENODEV, "No clocks found\n"); - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, num_clocks), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, num_clocks); if (!clk_data) return dev_err_probe(dev, -ENOMEM, "No memory for clock data\n"); clk_data->num = num_clocks; diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c index 94969d97d6e9..0d3d38b3ab09 100644 --- a/drivers/clk/clk-s2mps11.c +++ b/drivers/clk/clk-s2mps11.c @@ -127,14 +127,13 @@ static int s2mps11_clk_probe(struct platform_device *pdev) int i, ret = 0; enum sec_device_type hwid = platform_get_device_id(pdev)->driver_data; - s2mps11_clks = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM, - sizeof(*s2mps11_clks), GFP_KERNEL); + s2mps11_clks = devm_kzalloc_objs(&pdev->dev, *s2mps11_clks, + S2MPS11_CLKS_NUM); if (!s2mps11_clks) return -ENOMEM; - clk_data = devm_kzalloc(&pdev->dev, - struct_size(clk_data, hws, S2MPS11_CLKS_NUM), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(&pdev->dev, *clk_data, hws, + S2MPS11_CLKS_NUM); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c index 2dd50c5b4ea8..1903b4e8442d 100644 --- a/drivers/clk/clk-scmi.c +++ b/drivers/clk/clk-scmi.c @@ -215,7 +215,7 @@ scmi_clk_ops_alloc(struct device *dev, unsigned long feats_key) struct scmi_clk_oem *oem_data = dev_get_drvdata(dev); struct clk_ops *ops; - ops = devm_kzalloc(dev, sizeof(*ops), GFP_KERNEL); + ops = devm_kzalloc_obj(dev, *ops); if (!ops) return NULL; /* @@ -378,8 +378,7 @@ static int scmi_clocks_probe(struct scmi_device *sdev) return -EINVAL; } - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, count), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, count); if (!clk_data) return -ENOMEM; @@ -391,7 +390,7 @@ static int scmi_clocks_probe(struct scmi_device *sdev) transport_is_atomic = handle->is_transport_atomic(handle, &atomic_threshold_us); - sclks = devm_kcalloc(dev, count, sizeof(*sclks), GFP_KERNEL); + sclks = devm_kzalloc_objs(dev, *sclks, count); if (!sclks) return -ENOMEM; @@ -428,8 +427,9 @@ static int scmi_clocks_probe(struct scmi_device *sdev) /* Initialize clock parent data. */ if (sclk->info->num_parents > 0) { - sclk->parent_data = devm_kcalloc(dev, sclk->info->num_parents, - sizeof(*sclk->parent_data), GFP_KERNEL); + sclk->parent_data = devm_kzalloc_objs(dev, + *sclk->parent_data, + sclk->info->num_parents); if (!sclk->parent_data) return -ENOMEM; diff --git a/drivers/clk/clk-scpi.c b/drivers/clk/clk-scpi.c index e2eec7be5c19..e73de76504af 100644 --- a/drivers/clk/clk-scpi.c +++ b/drivers/clk/clk-scpi.c @@ -189,13 +189,12 @@ static int scpi_clk_add(struct device *dev, struct device_node *np, return -EINVAL; } - clk_data = devm_kmalloc(dev, sizeof(*clk_data), GFP_KERNEL); + clk_data = devm_kmalloc_obj(dev, *clk_data); if (!clk_data) return -ENOMEM; clk_data->clk_num = count; - clk_data->clk = devm_kcalloc(dev, count, sizeof(*clk_data->clk), - GFP_KERNEL); + clk_data->clk = devm_kzalloc_objs(dev, *clk_data->clk, count); if (!clk_data->clk) return -ENOMEM; @@ -204,7 +203,7 @@ static int scpi_clk_add(struct device *dev, struct device_node *np, const char *name; u32 val; - sclk = devm_kzalloc(dev, sizeof(*sclk), GFP_KERNEL); + sclk = devm_kzalloc_obj(dev, *sclk); if (!sclk) return -ENOMEM; diff --git a/drivers/clk/clk-si514.c b/drivers/clk/clk-si514.c index 07091b91420d..76d8016fd167 100644 --- a/drivers/clk/clk-si514.c +++ b/drivers/clk/clk-si514.c @@ -341,7 +341,7 @@ static int si514_probe(struct i2c_client *client) struct clk_si514 *data; int err; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/clk/clk-si521xx.c b/drivers/clk/clk-si521xx.c index 84dc3621df93..7d96c3631677 100644 --- a/drivers/clk/clk-si521xx.c +++ b/drivers/clk/clk-si521xx.c @@ -298,7 +298,7 @@ static int si521xx_probe(struct i2c_client *client) if (!chip_info) return -EINVAL; - si = devm_kzalloc(&client->dev, sizeof(*si), GFP_KERNEL); + si = devm_kzalloc_obj(&client->dev, *si); if (!si) return -ENOMEM; diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c index 88522333525b..8fe16c4612b2 100644 --- a/drivers/clk/clk-si5341.c +++ b/drivers/clk/clk-si5341.c @@ -1567,7 +1567,7 @@ static int si5341_probe(struct i2c_client *client) bool initialization_required; u32 status; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c index 70daba62305c..7a87695fd914 100644 --- a/drivers/clk/clk-si5351.c +++ b/drivers/clk/clk-si5351.c @@ -1195,7 +1195,7 @@ static int si5351_dt_parse(struct i2c_client *client, if (np == NULL) return 0; - pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&client->dev, *pdata); if (!pdata) return -ENOMEM; @@ -1464,7 +1464,7 @@ static int si5351_i2c_probe(struct i2c_client *client) if (!pdata) return -EINVAL; - drvdata = devm_kzalloc(&client->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&client->dev, *drvdata); if (!drvdata) return -ENOMEM; @@ -1639,10 +1639,10 @@ static int si5351_i2c_probe(struct i2c_client *client) else parent_names[1] = si5351_pll_names[1]; - drvdata->msynth = devm_kcalloc(&client->dev, num_clocks, - sizeof(*drvdata->msynth), GFP_KERNEL); - drvdata->clkout = devm_kcalloc(&client->dev, num_clocks, - sizeof(*drvdata->clkout), GFP_KERNEL); + drvdata->msynth = devm_kzalloc_objs(&client->dev, *drvdata->msynth, + num_clocks); + drvdata->clkout = devm_kzalloc_objs(&client->dev, *drvdata->clkout, + num_clocks); drvdata->num_clkout = num_clocks; if (WARN_ON(!drvdata->msynth || !drvdata->clkout)) { diff --git a/drivers/clk/clk-si544.c b/drivers/clk/clk-si544.c index 3924ec3e2163..a8479c9fe2db 100644 --- a/drivers/clk/clk-si544.c +++ b/drivers/clk/clk-si544.c @@ -449,7 +449,7 @@ static int si544_probe(struct i2c_client *client) struct clk_si544 *data; int err; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/clk/clk-si570.c b/drivers/clk/clk-si570.c index ac9013e7379c..4a413f2b31c5 100644 --- a/drivers/clk/clk-si570.c +++ b/drivers/clk/clk-si570.c @@ -417,7 +417,7 @@ static int si570_probe(struct i2c_client *client) bool skip_recall; int err; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/clk/clk-sp7021.c b/drivers/clk/clk-sp7021.c index 36528a71a2e6..3cba389206e9 100644 --- a/drivers/clk/clk-sp7021.c +++ b/drivers/clk/clk-sp7021.c @@ -560,7 +560,7 @@ static struct clk_hw *sp_pll_register(struct device *dev, const char *name, }; int ret; - pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); + pll = devm_kzalloc_obj(dev, *pll); if (!pll) return ERR_PTR(-ENOMEM); @@ -613,8 +613,7 @@ static int sp7021_clk_probe(struct platform_device *pdev) for (i = 0; i < ARRAY_SIZE(sp_clken); i++) writel((sp_clken[i] << 16) | sp_clken[i], clk_base + i * 4); - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, CLK_MAX), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, CLK_MAX); if (!clk_data) return -ENOMEM; clk_data->num = CLK_MAX; diff --git a/drivers/clk/clk-sparx5.c b/drivers/clk/clk-sparx5.c index b2facc9c95d4..a3d025622267 100644 --- a/drivers/clk/clk-sparx5.c +++ b/drivers/clk/clk-sparx5.c @@ -256,7 +256,7 @@ static int s5_clk_probe(struct platform_device *pdev) .parent_data = &pdata, }; - s5_clk = devm_kzalloc(dev, sizeof(*s5_clk), GFP_KERNEL); + s5_clk = devm_kzalloc_obj(dev, *s5_clk); if (!s5_clk) return -ENOMEM; diff --git a/drivers/clk/clk-tps68470.c b/drivers/clk/clk-tps68470.c index 9511248c6bc9..53b871d710ea 100644 --- a/drivers/clk/clk-tps68470.c +++ b/drivers/clk/clk-tps68470.c @@ -206,8 +206,7 @@ static int tps68470_clk_probe(struct platform_device *pdev) int ret; int i; - tps68470_clkdata = devm_kzalloc(&pdev->dev, sizeof(*tps68470_clkdata), - GFP_KERNEL); + tps68470_clkdata = devm_kzalloc_obj(&pdev->dev, *tps68470_clkdata); if (!tps68470_clkdata) return -ENOMEM; diff --git a/drivers/clk/clk-twl.c b/drivers/clk/clk-twl.c index 20bc3bf8fd62..53731d7de6d7 100644 --- a/drivers/clk/clk-twl.c +++ b/drivers/clk/clk-twl.c @@ -153,14 +153,12 @@ static int twl_clks_probe(struct platform_device *pdev) for (count = 0; hw_data[count].init.name; count++) ; - clk_data = devm_kzalloc(&pdev->dev, - struct_size(clk_data, hws, count), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(&pdev->dev, *clk_data, hws, count); if (!clk_data) return -ENOMEM; clk_data->num = count; - cinfo = devm_kcalloc(&pdev->dev, count, sizeof(*cinfo), GFP_KERNEL); + cinfo = devm_kzalloc_objs(&pdev->dev, *cinfo, count); if (!cinfo) return -ENOMEM; diff --git a/drivers/clk/clk-twl6040.c b/drivers/clk/clk-twl6040.c index b8d1cfe5b0e1..8d7f48ea69d0 100644 --- a/drivers/clk/clk-twl6040.c +++ b/drivers/clk/clk-twl6040.c @@ -129,7 +129,7 @@ static int twl6040_pdmclk_probe(struct platform_device *pdev) struct twl6040_pdmclk *clkdata; int ret; - clkdata = devm_kzalloc(&pdev->dev, sizeof(*clkdata), GFP_KERNEL); + clkdata = devm_kzalloc_obj(&pdev->dev, *clkdata); if (!clkdata) return -ENOMEM; diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c index d91749be785c..1cf8526975eb 100644 --- a/drivers/clk/clk-versaclock5.c +++ b/drivers/clk/clk-versaclock5.c @@ -957,7 +957,7 @@ static int vc5_probe(struct i2c_client *client) unsigned int n, idx = 0; int ret; - vc5 = devm_kzalloc(&client->dev, sizeof(*vc5), GFP_KERNEL); + vc5 = devm_kzalloc_obj(&client->dev, *vc5); if (!vc5) return -ENOMEM; diff --git a/drivers/clk/clk-versaclock7.c b/drivers/clk/clk-versaclock7.c index 1340d2f512be..3eeaac126b70 100644 --- a/drivers/clk/clk-versaclock7.c +++ b/drivers/clk/clk-versaclock7.c @@ -1108,7 +1108,7 @@ static int vc7_probe(struct i2c_client *client) unsigned long apll_rate; int ret; - vc7 = devm_kzalloc(&client->dev, sizeof(*vc7), GFP_KERNEL); + vc7 = devm_kzalloc_obj(&client->dev, *vc7); if (!vc7) return -ENOMEM; diff --git a/drivers/clk/clk-wm831x.c b/drivers/clk/clk-wm831x.c index 263e927138c2..f5967754ff52 100644 --- a/drivers/clk/clk-wm831x.c +++ b/drivers/clk/clk-wm831x.c @@ -350,7 +350,7 @@ static int wm831x_clk_probe(struct platform_device *pdev) struct wm831x_clk *clkdata; int ret; - clkdata = devm_kzalloc(&pdev->dev, sizeof(*clkdata), GFP_KERNEL); + clkdata = devm_kzalloc_obj(&pdev->dev, *clkdata); if (!clkdata) return -ENOMEM; diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c index 9d7fced898ae..51ffd80456fb 100644 --- a/drivers/clk/davinci/da8xx-cfgchip.c +++ b/drivers/clk/davinci/da8xx-cfgchip.c @@ -100,7 +100,7 @@ da8xx_cfgchip_gate_clk_register(struct device *dev, parent_name = __clk_get_name(parent); - gate = devm_kzalloc(dev, sizeof(*gate), GFP_KERNEL); + gate = devm_kzalloc_obj(dev, *gate); if (!gate) return ERR_PTR(-ENOMEM); @@ -244,7 +244,7 @@ da8xx_cfgchip_mux_clk_register(struct device *dev, struct clk_init_data init = {}; int ret; - mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(dev, *mux); if (!mux) return ERR_PTR(-ENOMEM); @@ -516,7 +516,7 @@ da8xx_cfgchip_register_usb0_clk48(struct device *dev, return dev_err_cast_probe(dev, fck_clk, "Missing fck clock\n"); } - usb0 = devm_kzalloc(dev, sizeof(*usb0), GFP_KERNEL); + usb0 = devm_kzalloc_obj(dev, *usb0); if (!usb0) return ERR_PTR(-ENOMEM); @@ -585,7 +585,7 @@ da8xx_cfgchip_register_usb1_clk48(struct device *dev, struct clk_init_data init = {}; int ret; - usb1 = devm_kzalloc(dev, sizeof(*usb1), GFP_KERNEL); + usb1 = devm_kzalloc_obj(dev, *usb1); if (!usb1) return ERR_PTR(-ENOMEM); @@ -651,8 +651,7 @@ static int of_da8xx_usb_phy_clk_init(struct device *dev, struct regmap *regmap) struct da8xx_usb0_clk48 *usb0; struct da8xx_usb1_clk48 *usb1; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, 2), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, 2); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/eswin/clk-eic7700-hsp.c b/drivers/clk/eswin/clk-eic7700-hsp.c index 6ddb8fbd605e..d3dd867da3d9 100644 --- a/drivers/clk/eswin/clk-eic7700-hsp.c +++ b/drivers/clk/eswin/clk-eic7700-hsp.c @@ -128,7 +128,7 @@ hsp_clk_register_gate(struct device *dev, unsigned int id, const char *name, struct clk_hw *hw; int ret; - gate = devm_kzalloc(dev, sizeof(*gate), GFP_KERNEL); + gate = devm_kzalloc_obj(dev, *gate); if (!gate) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/eswin/clk.c b/drivers/clk/eswin/clk.c index 79d1e4c5e637..e8851283ccdb 100644 --- a/drivers/clk/eswin/clk.c +++ b/drivers/clk/eswin/clk.c @@ -29,9 +29,8 @@ struct eswin_clock_data *eswin_clk_init(struct platform_device *pdev, { struct eswin_clock_data *eclk_data; - eclk_data = devm_kzalloc(&pdev->dev, - struct_size(eclk_data, clk_data.hws, nr_clks), - GFP_KERNEL); + eclk_data = devm_kzalloc_flex(&pdev->dev, *eclk_data, clk_data.hws, + nr_clks); if (!eclk_data) return ERR_PTR(-ENOMEM); @@ -423,7 +422,7 @@ struct clk_hw *eswin_register_clkdiv(struct device *dev, unsigned int id, struct clk_hw *clk_hw; int ret; - dclk = devm_kzalloc(dev, sizeof(*dclk), GFP_KERNEL); + dclk = devm_kzalloc_obj(dev, *dclk); if (!dclk) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/hisilicon/clk-hi3519.c b/drivers/clk/hisilicon/clk-hi3519.c index 0c50acd8543a..9db7f17ced1e 100644 --- a/drivers/clk/hisilicon/clk-hi3519.c +++ b/drivers/clk/hisilicon/clk-hi3519.c @@ -144,7 +144,7 @@ static int hi3519_clk_probe(struct platform_device *pdev) { struct hi3519_crg_data *crg; - crg = devm_kmalloc(&pdev->dev, sizeof(*crg), GFP_KERNEL); + crg = devm_kmalloc_obj(&pdev->dev, *crg); if (!crg) return -ENOMEM; diff --git a/drivers/clk/hisilicon/clk-hi3559a.c b/drivers/clk/hisilicon/clk-hi3559a.c index fea6fb9e98f5..85d5222a0fa8 100644 --- a/drivers/clk/hisilicon/clk-hi3559a.c +++ b/drivers/clk/hisilicon/clk-hi3559a.c @@ -460,7 +460,7 @@ static void hisi_clk_register_pll(struct hi3559av100_pll_clock *clks, struct clk *clk = NULL; int i; - p_clk = devm_kcalloc(dev, nums, sizeof(*p_clk), GFP_KERNEL); + p_clk = devm_kzalloc_objs(dev, *p_clk, nums); if (!p_clk) return; @@ -785,7 +785,7 @@ static int hi3559av100_crg_probe(struct platform_device *pdev) { struct hisi_crg_dev *crg; - crg = devm_kmalloc(&pdev->dev, sizeof(*crg), GFP_KERNEL); + crg = devm_kmalloc_obj(&pdev->dev, *crg); if (!crg) return -ENOMEM; diff --git a/drivers/clk/hisilicon/clk-hi6220-stub.c b/drivers/clk/hisilicon/clk-hi6220-stub.c index a70544d2bdb9..5191f8bf8b94 100644 --- a/drivers/clk/hisilicon/clk-hi6220-stub.c +++ b/drivers/clk/hisilicon/clk-hi6220-stub.c @@ -201,7 +201,7 @@ static int hi6220_stub_clk_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; int ret; - stub_clk = devm_kzalloc(dev, sizeof(*stub_clk), GFP_KERNEL); + stub_clk = devm_kzalloc_obj(dev, *stub_clk); if (!stub_clk) return -ENOMEM; diff --git a/drivers/clk/hisilicon/clk-hisi-phase.c b/drivers/clk/hisilicon/clk-hisi-phase.c index d8e555d9728d..3cd4e5f27c88 100644 --- a/drivers/clk/hisilicon/clk-hisi-phase.c +++ b/drivers/clk/hisilicon/clk-hisi-phase.c @@ -97,7 +97,7 @@ struct clk *clk_register_hisi_phase(struct device *dev, struct clk_init_data init = {}; struct clk_hisi_phase *phase; - phase = devm_kzalloc(dev, sizeof(struct clk_hisi_phase), GFP_KERNEL); + phase = devm_kzalloc_obj(dev, struct clk_hisi_phase); if (!phase) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/hisilicon/clk.c b/drivers/clk/hisilicon/clk.c index 08050ff1c8cf..69afa8cd5737 100644 --- a/drivers/clk/hisilicon/clk.c +++ b/drivers/clk/hisilicon/clk.c @@ -30,7 +30,7 @@ struct hisi_clock_data *hisi_clk_alloc(struct platform_device *pdev, struct resource *res; struct clk **clk_table; - clk_data = devm_kmalloc(&pdev->dev, sizeof(*clk_data), GFP_KERNEL); + clk_data = devm_kmalloc_obj(&pdev->dev, *clk_data); if (!clk_data) return NULL; @@ -42,9 +42,7 @@ struct hisi_clock_data *hisi_clk_alloc(struct platform_device *pdev, if (!clk_data->base) return NULL; - clk_table = devm_kmalloc_array(&pdev->dev, nr_clks, - sizeof(*clk_table), - GFP_KERNEL); + clk_table = devm_kmalloc_objs(&pdev->dev, *clk_table, nr_clks); if (!clk_table) return NULL; diff --git a/drivers/clk/hisilicon/crg-hi3516cv300.c b/drivers/clk/hisilicon/crg-hi3516cv300.c index b66140f74c51..b25ec8e0b65a 100644 --- a/drivers/clk/hisilicon/crg-hi3516cv300.c +++ b/drivers/clk/hisilicon/crg-hi3516cv300.c @@ -262,7 +262,7 @@ static int hi3516cv300_crg_probe(struct platform_device *pdev) { struct hisi_crg_dev *crg; - crg = devm_kmalloc(&pdev->dev, sizeof(*crg), GFP_KERNEL); + crg = devm_kmalloc_obj(&pdev->dev, *crg); if (!crg) return -ENOMEM; diff --git a/drivers/clk/hisilicon/crg-hi3798cv200.c b/drivers/clk/hisilicon/crg-hi3798cv200.c index 8eabd1cc229f..cfdf4f923b33 100644 --- a/drivers/clk/hisilicon/crg-hi3798cv200.c +++ b/drivers/clk/hisilicon/crg-hi3798cv200.c @@ -345,7 +345,7 @@ static int hi3798cv200_crg_probe(struct platform_device *pdev) { struct hisi_crg_dev *crg; - crg = devm_kmalloc(&pdev->dev, sizeof(*crg), GFP_KERNEL); + crg = devm_kmalloc_obj(&pdev->dev, *crg); if (!crg) return -ENOMEM; diff --git a/drivers/clk/hisilicon/reset.c b/drivers/clk/hisilicon/reset.c index c3b7daac9313..398895608a76 100644 --- a/drivers/clk/hisilicon/reset.c +++ b/drivers/clk/hisilicon/reset.c @@ -91,7 +91,7 @@ struct hisi_reset_controller *hisi_reset_init(struct platform_device *pdev) { struct hisi_reset_controller *rstc; - rstc = devm_kzalloc(&pdev->dev, sizeof(*rstc), GFP_KERNEL); + rstc = devm_kzalloc_obj(&pdev->dev, *rstc); if (!rstc) return NULL; diff --git a/drivers/clk/imx/clk-imx8-acm.c b/drivers/clk/imx/clk-imx8-acm.c index 07dca6f31cf8..bb0198d3bb16 100644 --- a/drivers/clk/imx/clk-imx8-acm.c +++ b/drivers/clk/imx/clk-imx8-acm.c @@ -269,16 +269,13 @@ static int clk_imx_acm_attach_pm_domains(struct device *dev, if (dev_pm->num_domains <= 1) return 0; - dev_pm->pd_dev = devm_kmalloc_array(dev, dev_pm->num_domains, - sizeof(*dev_pm->pd_dev), - GFP_KERNEL); + dev_pm->pd_dev = devm_kmalloc_objs(dev, *dev_pm->pd_dev, + dev_pm->num_domains); if (!dev_pm->pd_dev) return -ENOMEM; - dev_pm->pd_dev_link = devm_kmalloc_array(dev, - dev_pm->num_domains, - sizeof(*dev_pm->pd_dev_link), - GFP_KERNEL); + dev_pm->pd_dev_link = devm_kmalloc_objs(dev, *dev_pm->pd_dev_link, + dev_pm->num_domains); if (!dev_pm->pd_dev_link) return -ENOMEM; @@ -344,7 +341,7 @@ static int imx8_acm_clk_probe(struct platform_device *pdev) if (WARN_ON(IS_ERR(base))) return PTR_ERR(base); - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; @@ -352,8 +349,8 @@ static int imx8_acm_clk_probe(struct platform_device *pdev) priv->soc_data = of_device_get_match_data(dev); platform_set_drvdata(pdev, priv); - clk_hw_data = devm_kzalloc(&pdev->dev, struct_size(clk_hw_data, hws, IMX_ADMA_ACM_CLK_END), - GFP_KERNEL); + clk_hw_data = devm_kzalloc_flex(&pdev->dev, *clk_hw_data, hws, + IMX_ADMA_ACM_CLK_END); if (!clk_hw_data) return -ENOMEM; diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index ab77e148e70c..9d4c3064dd2c 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -323,8 +323,7 @@ static int imx8mn_clocks_probe(struct platform_device *pdev) void __iomem *base; int ret; - clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, - IMX8MN_CLK_END), GFP_KERNEL); + clk_hw_data = devm_kzalloc_flex(dev, *clk_hw_data, hws, IMX8MN_CLK_END); if (WARN_ON(!clk_hw_data)) return -ENOMEM; diff --git a/drivers/clk/imx/clk-imx8mp-audiomix.c b/drivers/clk/imx/clk-imx8mp-audiomix.c index 2225796a9c08..57de091a93cf 100644 --- a/drivers/clk/imx/clk-imx8mp-audiomix.c +++ b/drivers/clk/imx/clk-imx8mp-audiomix.c @@ -278,9 +278,8 @@ static int clk_imx8mp_audiomix_probe(struct platform_device *pdev) struct clk_hw *hw; int i, ret; - priv = devm_kzalloc(dev, - struct_size(priv, clk_data.hws, IMX8MP_CLK_AUDIOMIX_END), - GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, clk_data.hws, + IMX8MP_CLK_AUDIOMIX_END); if (!priv) return -ENOMEM; diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c index fe6dac70f1a1..c621beb1fa0a 100644 --- a/drivers/clk/imx/clk-imx8mp.c +++ b/drivers/clk/imx/clk-imx8mp.c @@ -565,7 +565,7 @@ static int imx8mp_clocks_probe(struct platform_device *pdev) if (WARN_ON(IS_ERR(ccm_base))) return PTR_ERR(ccm_base); - clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, IMX8MP_CLK_END), GFP_KERNEL); + clk_hw_data = devm_kzalloc_flex(dev, *clk_hw_data, hws, IMX8MP_CLK_END); if (WARN_ON(!clk_hw_data)) return -ENOMEM; diff --git a/drivers/clk/imx/clk-imx8mq.c b/drivers/clk/imx/clk-imx8mq.c index cedc8a02aa1f..a1f34e05ef77 100644 --- a/drivers/clk/imx/clk-imx8mq.c +++ b/drivers/clk/imx/clk-imx8mq.c @@ -288,7 +288,7 @@ static int imx8mq_clocks_probe(struct platform_device *pdev) void __iomem *base; int err; - clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, IMX8MQ_CLK_END), GFP_KERNEL); + clk_hw_data = devm_kzalloc_flex(dev, *clk_hw_data, hws, IMX8MQ_CLK_END); if (WARN_ON(!clk_hw_data)) return -ENOMEM; diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-imx8qxp-lpcg.c index f0cf6cf91899..9ad016106b1e 100644 --- a/drivers/clk/imx/clk-imx8qxp-lpcg.c +++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c @@ -208,8 +208,8 @@ static int imx_lpcg_parse_clks_from_dt(struct platform_device *pdev, * And the cost is very limited few pointers. */ - clk_data = devm_kzalloc(&pdev->dev, struct_size(clk_data, hws, - IMX_LPCG_MAX_CLKS), GFP_KERNEL); + clk_data = devm_kzalloc_flex(&pdev->dev, *clk_data, hws, + IMX_LPCG_MAX_CLKS); if (!clk_data) return -ENOMEM; @@ -323,8 +323,8 @@ static int imx8qxp_lpcg_clk_probe(struct platform_device *pdev) if (!base) return -ENOMEM; - clk_data = devm_kzalloc(&pdev->dev, struct_size(clk_data, hws, - ss_lpcg->num_max), GFP_KERNEL); + clk_data = devm_kzalloc_flex(&pdev->dev, *clk_data, hws, + ss_lpcg->num_max); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/imx/clk-imx8ulp-sim-lpav.c b/drivers/clk/imx/clk-imx8ulp-sim-lpav.c index 990c95b89b75..0607ca8a4f0e 100644 --- a/drivers/clk/imx/clk-imx8ulp-sim-lpav.c +++ b/drivers/clk/imx/clk-imx8ulp-sim-lpav.c @@ -74,9 +74,8 @@ static int clk_imx8ulp_sim_lpav_probe(struct platform_device *pdev) struct clk_hw *hw; int i, ret; - data = devm_kzalloc(&pdev->dev, - struct_size(data, clk_data.hws, ARRAY_SIZE(gates)), - GFP_KERNEL); + data = devm_kzalloc_flex(&pdev->dev, *data, clk_data.hws, + ARRAY_SIZE(gates)); if (!data) return -ENOMEM; diff --git a/drivers/clk/imx/clk-imx8ulp.c b/drivers/clk/imx/clk-imx8ulp.c index 535b6364ca7e..a2ac3b837115 100644 --- a/drivers/clk/imx/clk-imx8ulp.c +++ b/drivers/clk/imx/clk-imx8ulp.c @@ -127,7 +127,7 @@ static int imx8ulp_pcc_reset_init(struct platform_device *pdev, void __iomem *ba struct device *dev = &pdev->dev; struct pcc_reset_dev *pcc_reset; - pcc_reset = devm_kzalloc(dev, sizeof(*pcc_reset), GFP_KERNEL); + pcc_reset = devm_kzalloc_obj(dev, *pcc_reset); if (!pcc_reset) return -ENOMEM; @@ -149,8 +149,7 @@ static int imx8ulp_clk_cgc1_init(struct platform_device *pdev) struct clk_hw **clks; void __iomem *base; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, IMX8ULP_CLK_CGC1_END), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, IMX8ULP_CLK_CGC1_END); if (!clk_data) return -ENOMEM; @@ -233,8 +232,7 @@ static int imx8ulp_clk_cgc2_init(struct platform_device *pdev) struct clk_hw **clks; void __iomem *base; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, IMX8ULP_CLK_CGC2_END), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, IMX8ULP_CLK_CGC2_END); if (!clk_data) return -ENOMEM; @@ -316,8 +314,7 @@ static int imx8ulp_clk_pcc3_init(struct platform_device *pdev) void __iomem *base; int ret; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, IMX8ULP_CLK_PCC3_END), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, IMX8ULP_CLK_PCC3_END); if (!clk_data) return -ENOMEM; @@ -399,8 +396,7 @@ static int imx8ulp_clk_pcc4_init(struct platform_device *pdev) void __iomem *base; int ret; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, IMX8ULP_CLK_PCC4_END), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, IMX8ULP_CLK_PCC4_END); if (!clk_data) return -ENOMEM; @@ -454,8 +450,7 @@ static int imx8ulp_clk_pcc5_init(struct platform_device *pdev) void __iomem *base; int ret; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, IMX8ULP_CLK_PCC5_END), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, IMX8ULP_CLK_PCC5_END); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c index c5f358a75f30..1f10833659df 100644 --- a/drivers/clk/imx/clk-imx93.c +++ b/drivers/clk/imx/clk-imx93.c @@ -281,8 +281,7 @@ static int imx93_clocks_probe(struct platform_device *pdev) int i, ret; const unsigned long plat = (unsigned long)device_get_match_data(&pdev->dev); - clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, - IMX93_CLK_END), GFP_KERNEL); + clk_hw_data = devm_kzalloc_flex(dev, *clk_hw_data, hws, IMX93_CLK_END); if (!clk_hw_data) return -ENOMEM; diff --git a/drivers/clk/imx/clk-imx95-blk-ctl.c b/drivers/clk/imx/clk-imx95-blk-ctl.c index bc6957299cec..84b6609343b1 100644 --- a/drivers/clk/imx/clk-imx95-blk-ctl.c +++ b/drivers/clk/imx/clk-imx95-blk-ctl.c @@ -370,7 +370,7 @@ static int imx95_bc_probe(struct platform_device *pdev) void __iomem *base; int i, ret; - bc = devm_kzalloc(dev, sizeof(*bc), GFP_KERNEL); + bc = devm_kzalloc_obj(dev, *bc); if (!bc) return -ENOMEM; bc->dev = dev; @@ -397,8 +397,8 @@ static int imx95_bc_probe(struct platform_device *pdev) if (!bc->pdata) return devm_of_platform_populate(dev); - clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, bc->pdata->num_clks), - GFP_KERNEL); + clk_hw_data = devm_kzalloc_flex(dev, *clk_hw_data, hws, + bc->pdata->num_clks); if (!clk_hw_data) return -ENOMEM; diff --git a/drivers/clk/imx/clk-imxrt1050.c b/drivers/clk/imx/clk-imxrt1050.c index efd1ac9d8eeb..db152c66d66f 100644 --- a/drivers/clk/imx/clk-imxrt1050.c +++ b/drivers/clk/imx/clk-imxrt1050.c @@ -42,8 +42,8 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev) struct device_node *anp; int ret; - clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, - IMXRT1050_CLK_END), GFP_KERNEL); + clk_hw_data = devm_kzalloc_flex(dev, *clk_hw_data, hws, + IMXRT1050_CLK_END); if (WARN_ON(!clk_hw_data)) return -ENOMEM; diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c index 9d2094bd48e3..967f77900358 100644 --- a/drivers/clk/keystone/sci-clk.c +++ b/drivers/clk/keystone/sci-clk.c @@ -493,9 +493,8 @@ static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider) gap_size = 0; if (num_clks == max_clks) { - tmp_clks = devm_kmalloc_array(dev, max_clks + 64, - sizeof(sci_clk), - GFP_KERNEL); + tmp_clks = devm_kmalloc_objs(dev, sci_clk, + max_clks + 64); memcpy(tmp_clks, clks, max_clks * sizeof(sci_clk)); if (max_clks) devm_kfree(dev, clks); @@ -503,7 +502,7 @@ static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider) clks = tmp_clks; } - sci_clk = devm_kzalloc(dev, sizeof(*sci_clk), GFP_KERNEL); + sci_clk = devm_kzalloc_obj(dev, *sci_clk); if (!sci_clk) return -ENOMEM; sci_clk->dev_id = dev_id; @@ -581,8 +580,7 @@ static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider) break; if (args.args_count == 2 && args.np == dev->of_node) { - sci_clk = devm_kzalloc(dev, sizeof(*sci_clk), - GFP_KERNEL); + sci_clk = devm_kzalloc_obj(dev, *sci_clk); if (!sci_clk) return -ENOMEM; @@ -630,9 +628,8 @@ static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider) continue; } - sci_clk = devm_kzalloc(dev, - sizeof(*sci_clk), - GFP_KERNEL); + sci_clk = devm_kzalloc_obj(dev, + *sci_clk); if (!sci_clk) return -ENOMEM; sci_clk->dev_id = args.args[0]; @@ -650,8 +647,7 @@ static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider) list_sort(NULL, &clks, _cmp_sci_clk_list); - provider->clocks = devm_kmalloc_array(dev, num_clks, sizeof(sci_clk), - GFP_KERNEL); + provider->clocks = devm_kmalloc_objs(dev, sci_clk, num_clks); if (!provider->clocks) return -ENOMEM; @@ -695,7 +691,7 @@ static int ti_sci_clk_probe(struct platform_device *pdev) if (IS_ERR(handle)) return PTR_ERR(handle); - provider = devm_kzalloc(dev, sizeof(*provider), GFP_KERNEL); + provider = devm_kzalloc_obj(dev, *provider); if (!provider) return -ENOMEM; diff --git a/drivers/clk/keystone/syscon-clk.c b/drivers/clk/keystone/syscon-clk.c index 338174be4121..baab59f12be4 100644 --- a/drivers/clk/keystone/syscon-clk.c +++ b/drivers/clk/keystone/syscon-clk.c @@ -71,7 +71,7 @@ static struct clk_hw char *name = NULL; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return ERR_PTR(-ENOMEM); @@ -145,8 +145,7 @@ static int ti_syscon_gate_clk_probe(struct platform_device *pdev) "must specify a parent clock\n"); } - hw_data = devm_kzalloc(dev, struct_size(hw_data, hws, num_clks), - GFP_KERNEL); + hw_data = devm_kzalloc_flex(dev, *hw_data, hws, num_clks); if (!hw_data) return -ENOMEM; diff --git a/drivers/clk/mediatek/clk-mt8173-mfgtop.c b/drivers/clk/mediatek/clk-mt8173-mfgtop.c index 5669ca9954dc..3f4a1320930d 100644 --- a/drivers/clk/mediatek/clk-mt8173-mfgtop.c +++ b/drivers/clk/mediatek/clk-mt8173-mfgtop.c @@ -115,7 +115,7 @@ static int clk_mt8173_mfgtop_probe(struct platform_device *pdev) struct mt8173_mfgtop_data *data; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/clk/mediatek/clk-mt8183.c b/drivers/clk/mediatek/clk-mt8183.c index 140fcf524ce6..14eac8fb970b 100644 --- a/drivers/clk/mediatek/clk-mt8183.c +++ b/drivers/clk/mediatek/clk-mt8183.c @@ -838,7 +838,7 @@ static int clk_mt8183_reg_mfg_mux_notifier(struct device *dev, struct clk *clk) struct mtk_mux_nb *mfg_mux_nb; int i; - mfg_mux_nb = devm_kzalloc(dev, sizeof(*mfg_mux_nb), GFP_KERNEL); + mfg_mux_nb = devm_kzalloc_obj(dev, *mfg_mux_nb); if (!mfg_mux_nb) return -ENOMEM; diff --git a/drivers/clk/mediatek/clk-mt8186-topckgen.c b/drivers/clk/mediatek/clk-mt8186-topckgen.c index 14f1cbdbbd13..38bb5baa0404 100644 --- a/drivers/clk/mediatek/clk-mt8186-topckgen.c +++ b/drivers/clk/mediatek/clk-mt8186-topckgen.c @@ -687,7 +687,7 @@ static int clk_mt8186_reg_mfg_mux_notifier(struct device *dev, struct clk *clk) struct mtk_mux_nb *mfg_mux_nb; int i; - mfg_mux_nb = devm_kzalloc(dev, sizeof(*mfg_mux_nb), GFP_KERNEL); + mfg_mux_nb = devm_kzalloc_obj(dev, *mfg_mux_nb); if (!mfg_mux_nb) return -ENOMEM; diff --git a/drivers/clk/mediatek/clk-mt8188-topckgen.c b/drivers/clk/mediatek/clk-mt8188-topckgen.c index 694d894aaa33..4abc8161cf51 100644 --- a/drivers/clk/mediatek/clk-mt8188-topckgen.c +++ b/drivers/clk/mediatek/clk-mt8188-topckgen.c @@ -1242,7 +1242,7 @@ static int clk_mt8188_reg_mfg_mux_notifier(struct device *dev, struct clk *clk) { struct mtk_mux_nb *mfg_mux_nb; - mfg_mux_nb = devm_kzalloc(dev, sizeof(*mfg_mux_nb), GFP_KERNEL); + mfg_mux_nb = devm_kzalloc_obj(dev, *mfg_mux_nb); if (!mfg_mux_nb) return -ENOMEM; diff --git a/drivers/clk/mediatek/clk-mt8192.c b/drivers/clk/mediatek/clk-mt8192.c index a1a7caf557fa..90ce24c5dcb2 100644 --- a/drivers/clk/mediatek/clk-mt8192.c +++ b/drivers/clk/mediatek/clk-mt8192.c @@ -968,7 +968,7 @@ static int clk_mt8192_reg_mfg_mux_notifier(struct device *dev, struct clk *clk) struct mtk_mux_nb *mfg_mux_nb; int i; - mfg_mux_nb = devm_kzalloc(dev, sizeof(*mfg_mux_nb), GFP_KERNEL); + mfg_mux_nb = devm_kzalloc_obj(dev, *mfg_mux_nb); if (!mfg_mux_nb) return -ENOMEM; diff --git a/drivers/clk/mediatek/clk-mt8195-topckgen.c b/drivers/clk/mediatek/clk-mt8195-topckgen.c index b2fecd37cfd4..f91d7f1aecd6 100644 --- a/drivers/clk/mediatek/clk-mt8195-topckgen.c +++ b/drivers/clk/mediatek/clk-mt8195-topckgen.c @@ -1246,7 +1246,7 @@ static int clk_mt8195_reg_mfg_mux_notifier(struct device *dev, struct clk *clk) { struct mtk_mux_nb *mfg_mux_nb; - mfg_mux_nb = devm_kzalloc(dev, sizeof(*mfg_mux_nb), GFP_KERNEL); + mfg_mux_nb = devm_kzalloc_obj(dev, *mfg_mux_nb); if (!mfg_mux_nb) return -ENOMEM; diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index 3dfdd3a422f8..009d02255be3 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -52,8 +52,7 @@ struct clk_hw_onecell_data *mtk_devm_alloc_clk_data(struct device *dev, { struct clk_hw_onecell_data *clk_data; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, clk_num), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, clk_num); if (!clk_data) return NULL; diff --git a/drivers/clk/mediatek/reset.c b/drivers/clk/mediatek/reset.c index 2e3303975096..9fa4caa03306 100644 --- a/drivers/clk/mediatek/reset.c +++ b/drivers/clk/mediatek/reset.c @@ -142,7 +142,7 @@ int mtk_register_reset_controller_with_dev(struct device *dev, return PTR_ERR(regmap); } - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/clk/meson/meson-aoclk.c b/drivers/clk/meson/meson-aoclk.c index 8f6bdea18119..589e394022e7 100644 --- a/drivers/clk/meson/meson-aoclk.c +++ b/drivers/clk/meson/meson-aoclk.c @@ -55,7 +55,7 @@ int meson_aoclkc_probe(struct platform_device *pdev) data = container_of(clkc_data, struct meson_aoclk_data, clkc_data); - rstc = devm_kzalloc(dev, sizeof(*rstc), GFP_KERNEL); + rstc = devm_kzalloc_obj(dev, *rstc); if (!rstc) return -ENOMEM; diff --git a/drivers/clk/microchip/clk-mpfs-ccc.c b/drivers/clk/microchip/clk-mpfs-ccc.c index 40c17593e594..e35ced413f90 100644 --- a/drivers/clk/microchip/clk-mpfs-ccc.c +++ b/drivers/clk/microchip/clk-mpfs-ccc.c @@ -234,8 +234,8 @@ static int mpfs_ccc_probe(struct platform_device *pdev) void __iomem *pll_base[ARRAY_SIZE(mpfs_ccc_pll_clks)]; int ret; - clk_data = devm_kzalloc(&pdev->dev, struct_size(clk_data, hw_data.hws, MPFS_CCC_NUM_CLKS), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(&pdev->dev, *clk_data, hw_data.hws, + MPFS_CCC_NUM_CLKS); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/microchip/clk-mpfs.c b/drivers/clk/microchip/clk-mpfs.c index 7f044775aea8..02fe0153140c 100644 --- a/drivers/clk/microchip/clk-mpfs.c +++ b/drivers/clk/microchip/clk-mpfs.c @@ -516,7 +516,7 @@ static int mpfs_clk_probe(struct platform_device *pdev) num_clks = ARRAY_SIZE(mpfs_msspll_clks) + ARRAY_SIZE(mpfs_msspll_out_clks) + ARRAY_SIZE(mpfs_cfg_clks) + ARRAY_SIZE(mpfs_periph_clks) + 1; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hw_data.hws, num_clks), GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hw_data.hws, num_clks); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/microchip/clk-pic32.c b/drivers/clk/microchip/clk-pic32.c index 9d128fba2cde..363fe6a1c7fc 100644 --- a/drivers/clk/microchip/clk-pic32.c +++ b/drivers/clk/microchip/clk-pic32.c @@ -218,7 +218,7 @@ struct clk *pic32_periph_clk_register(const struct pic32_periph_clk_data *desc, struct pic32_periph_clk *pbclk; struct clk *clk; - pbclk = devm_kzalloc(core->dev, sizeof(*pbclk), GFP_KERNEL); + pbclk = devm_kzalloc_obj(core->dev, *pbclk); if (!pbclk) return ERR_PTR(-ENOMEM); @@ -556,7 +556,7 @@ struct clk *pic32_refo_clk_register(const struct pic32_ref_osc_data *data, struct pic32_ref_osc *refo; struct clk *clk; - refo = devm_kzalloc(core->dev, sizeof(*refo), GFP_KERNEL); + refo = devm_kzalloc_obj(core->dev, *refo); if (!refo) return ERR_PTR(-ENOMEM); @@ -733,7 +733,7 @@ struct clk *pic32_spll_clk_register(const struct pic32_sys_pll_data *data, struct pic32_sys_pll *spll; struct clk *clk; - spll = devm_kzalloc(core->dev, sizeof(*spll), GFP_KERNEL); + spll = devm_kzalloc_obj(core->dev, *spll); if (!spll) return ERR_PTR(-ENOMEM); @@ -921,7 +921,7 @@ struct clk *pic32_sys_clk_register(const struct pic32_sys_clk_data *data, struct pic32_sys_clk *sclk; struct clk *clk; - sclk = devm_kzalloc(core->dev, sizeof(*sclk), GFP_KERNEL); + sclk = devm_kzalloc_obj(core->dev, *sclk); if (!sclk) return ERR_PTR(-ENOMEM); @@ -1003,7 +1003,7 @@ struct clk *pic32_sosc_clk_register(const struct pic32_sec_osc_data *data, { struct pic32_sec_osc *sosc; - sosc = devm_kzalloc(core->dev, sizeof(*sosc), GFP_KERNEL); + sosc = devm_kzalloc_obj(core->dev, *sosc); if (!sosc) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/microchip/clk-pic32mzda.c b/drivers/clk/microchip/clk-pic32mzda.c index e11cbdd982a6..fc4357ec7103 100644 --- a/drivers/clk/microchip/clk-pic32mzda.c +++ b/drivers/clk/microchip/clk-pic32mzda.c @@ -157,7 +157,7 @@ static int pic32mzda_clk_probe(struct platform_device *pdev) struct clk **clks; int nr_clks, i, ret; - cd = devm_kzalloc(&pdev->dev, sizeof(*cd), GFP_KERNEL); + cd = devm_kzalloc_obj(&pdev->dev, *cd); if (!cd) return -ENOMEM; diff --git a/drivers/clk/mmp/clk-audio.c b/drivers/clk/mmp/clk-audio.c index ed27fc796c94..19233684fbf9 100644 --- a/drivers/clk/mmp/clk-audio.c +++ b/drivers/clk/mmp/clk-audio.c @@ -351,10 +351,8 @@ static int mmp2_audio_clk_probe(struct platform_device *pdev) struct mmp2_audio_clk *priv; int ret; - priv = devm_kzalloc(&pdev->dev, - struct_size(priv, clk_data.hws, - CLK_AUDIO_NR_CLKS), - GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, clk_data.hws, + CLK_AUDIO_NR_CLKS); if (!priv) return -ENOMEM; diff --git a/drivers/clk/mmp/clk-pxa1908-apbc.c b/drivers/clk/mmp/clk-pxa1908-apbc.c index 16c1f13bca1f..85842e9a6cb3 100644 --- a/drivers/clk/mmp/clk-pxa1908-apbc.c +++ b/drivers/clk/mmp/clk-pxa1908-apbc.c @@ -123,7 +123,7 @@ static int pxa1908_apbc_probe(struct platform_device *pdev) { struct pxa1908_clk_unit *pxa_unit; - pxa_unit = devm_kzalloc(&pdev->dev, sizeof(*pxa_unit), GFP_KERNEL); + pxa_unit = devm_kzalloc_obj(&pdev->dev, *pxa_unit); if (!pxa_unit) return -ENOMEM; diff --git a/drivers/clk/mmp/clk-pxa1908-apbcp.c b/drivers/clk/mmp/clk-pxa1908-apbcp.c index 4e646e8b7440..0383711308f2 100644 --- a/drivers/clk/mmp/clk-pxa1908-apbcp.c +++ b/drivers/clk/mmp/clk-pxa1908-apbcp.c @@ -70,7 +70,7 @@ static int pxa1908_apbcp_probe(struct platform_device *pdev) { struct pxa1908_clk_unit *pxa_unit; - pxa_unit = devm_kzalloc(&pdev->dev, sizeof(*pxa_unit), GFP_KERNEL); + pxa_unit = devm_kzalloc_obj(&pdev->dev, *pxa_unit); if (!pxa_unit) return -ENOMEM; diff --git a/drivers/clk/mmp/clk-pxa1908-apmu.c b/drivers/clk/mmp/clk-pxa1908-apmu.c index 7594a495a009..cf71d5d47d72 100644 --- a/drivers/clk/mmp/clk-pxa1908-apmu.c +++ b/drivers/clk/mmp/clk-pxa1908-apmu.c @@ -88,7 +88,7 @@ static int pxa1908_apmu_probe(struct platform_device *pdev) struct pxa1908_clk_unit *pxa_unit; struct auxiliary_device *adev; - pxa_unit = devm_kzalloc(&pdev->dev, sizeof(*pxa_unit), GFP_KERNEL); + pxa_unit = devm_kzalloc_obj(&pdev->dev, *pxa_unit); if (!pxa_unit) return -ENOMEM; diff --git a/drivers/clk/mmp/clk-pxa1908-mpmu.c b/drivers/clk/mmp/clk-pxa1908-mpmu.c index 90b4b2488574..8b6e77f0d00f 100644 --- a/drivers/clk/mmp/clk-pxa1908-mpmu.c +++ b/drivers/clk/mmp/clk-pxa1908-mpmu.c @@ -77,7 +77,7 @@ static int pxa1908_mpmu_probe(struct platform_device *pdev) { struct pxa1908_clk_unit *pxa_unit; - pxa_unit = devm_kzalloc(&pdev->dev, sizeof(*pxa_unit), GFP_KERNEL); + pxa_unit = devm_kzalloc_obj(&pdev->dev, *pxa_unit); if (!pxa_unit) return -ENOMEM; diff --git a/drivers/clk/mstar/clk-msc313-cpupll.c b/drivers/clk/mstar/clk-msc313-cpupll.c index 3e643be02fe2..56a5723ca79a 100644 --- a/drivers/clk/mstar/clk-msc313-cpupll.c +++ b/drivers/clk/mstar/clk-msc313-cpupll.c @@ -187,7 +187,7 @@ static int msc313_cpupll_probe(struct platform_device *pdev) struct msc313_cpupll *cpupll; int ret; - cpupll = devm_kzalloc(&pdev->dev, sizeof(*cpupll), GFP_KERNEL); + cpupll = devm_kzalloc_obj(&pdev->dev, *cpupll); if (!cpupll) return -ENOMEM; diff --git a/drivers/clk/mstar/clk-msc313-mpll.c b/drivers/clk/mstar/clk-msc313-mpll.c index bd45aa0aec01..d9ccce5bc99f 100644 --- a/drivers/clk/mstar/clk-msc313-mpll.c +++ b/drivers/clk/mstar/clk-msc313-mpll.c @@ -79,7 +79,7 @@ static int msc313_mpll_probe(struct platform_device *pdev) struct clk_hw *divhw; int ret, i; - mpll = devm_kzalloc(dev, sizeof(*mpll), GFP_KERNEL); + mpll = devm_kzalloc_obj(dev, *mpll); if (!mpll) return -ENOMEM; @@ -104,8 +104,8 @@ static int msc313_mpll_probe(struct platform_device *pdev) if (IS_ERR(mpll->loop_div_second)) return PTR_ERR(mpll->loop_div_second); - mpll->clk_data = devm_kzalloc(dev, struct_size(mpll->clk_data, hws, - NUMOUTPUTS), GFP_KERNEL); + mpll->clk_data = devm_kzalloc_flex(dev, *mpll->clk_data, hws, + NUMOUTPUTS); if (!mpll->clk_data) return -ENOMEM; diff --git a/drivers/clk/mvebu/ap-cpu-clk.c b/drivers/clk/mvebu/ap-cpu-clk.c index b1c6fceb91b2..467ecbb1a84f 100644 --- a/drivers/clk/mvebu/ap-cpu-clk.c +++ b/drivers/clk/mvebu/ap-cpu-clk.c @@ -273,14 +273,11 @@ static int ap_cpu_clock_probe(struct platform_device *pdev) * DFS for AP806 is controlled per cluster (2 CPUs per cluster), * so allocate structs per cluster */ - ap_cpu_clk = devm_kcalloc(dev, nclusters, sizeof(*ap_cpu_clk), - GFP_KERNEL); + ap_cpu_clk = devm_kzalloc_objs(dev, *ap_cpu_clk, nclusters); if (!ap_cpu_clk) return -ENOMEM; - ap_cpu_data = devm_kzalloc(dev, struct_size(ap_cpu_data, hws, - nclusters), - GFP_KERNEL); + ap_cpu_data = devm_kzalloc_flex(dev, *ap_cpu_data, hws, nclusters); if (!ap_cpu_data) return -ENOMEM; diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c index 3123771b9c99..336e5db0da81 100644 --- a/drivers/clk/mvebu/armada-37xx-periph.c +++ b/drivers/clk/mvebu/armada-37xx-periph.c @@ -745,14 +745,12 @@ static int armada_3700_periph_clock_probe(struct platform_device *pdev) while (data[num_periph].name) num_periph++; - driver_data = devm_kzalloc(dev, sizeof(*driver_data), GFP_KERNEL); + driver_data = devm_kzalloc_obj(dev, *driver_data); if (!driver_data) return -ENOMEM; - driver_data->hw_data = devm_kzalloc(dev, - struct_size(driver_data->hw_data, - hws, num_periph), - GFP_KERNEL); + driver_data->hw_data = devm_kzalloc_flex(dev, *driver_data->hw_data, + hws, num_periph); if (!driver_data->hw_data) return -ENOMEM; driver_data->hw_data->num = num_periph; diff --git a/drivers/clk/mvebu/armada-37xx-tbg.c b/drivers/clk/mvebu/armada-37xx-tbg.c index 1a16f9c0b1d8..efc98d009486 100644 --- a/drivers/clk/mvebu/armada-37xx-tbg.c +++ b/drivers/clk/mvebu/armada-37xx-tbg.c @@ -88,9 +88,7 @@ static int armada_3700_tbg_clock_probe(struct platform_device *pdev) void __iomem *reg; int i; - hw_tbg_data = devm_kzalloc(&pdev->dev, - struct_size(hw_tbg_data, hws, NUM_TBG), - GFP_KERNEL); + hw_tbg_data = devm_kzalloc_flex(&pdev->dev, *hw_tbg_data, hws, NUM_TBG); if (!hw_tbg_data) return -ENOMEM; hw_tbg_data->num = NUM_TBG; diff --git a/drivers/clk/mvebu/armada-37xx-xtal.c b/drivers/clk/mvebu/armada-37xx-xtal.c index ca88e5e78b06..43ec90b391ab 100644 --- a/drivers/clk/mvebu/armada-37xx-xtal.c +++ b/drivers/clk/mvebu/armada-37xx-xtal.c @@ -27,7 +27,7 @@ static int armada_3700_xtal_clock_probe(struct platform_device *pdev) u32 reg; int ret; - xtal_hw = devm_kzalloc(&pdev->dev, sizeof(*xtal_hw), GFP_KERNEL); + xtal_hw = devm_kzalloc_obj(&pdev->dev, *xtal_hw); if (!xtal_hw) return -ENOMEM; diff --git a/drivers/clk/mvebu/cp110-system-controller.c b/drivers/clk/mvebu/cp110-system-controller.c index fa95eb7197af..02e2b82c60a1 100644 --- a/drivers/clk/mvebu/cp110-system-controller.c +++ b/drivers/clk/mvebu/cp110-system-controller.c @@ -255,9 +255,8 @@ static int cp110_syscon_common_probe(struct platform_device *pdev, if (ret) return ret; - cp110_clk_data = devm_kzalloc(dev, struct_size(cp110_clk_data, hws, - CP110_CLK_NUM), - GFP_KERNEL); + cp110_clk_data = devm_kzalloc_flex(dev, *cp110_clk_data, hws, + CP110_CLK_NUM); if (!cp110_clk_data) return -ENOMEM; cp110_clk_data->num = CP110_CLK_NUM; diff --git a/drivers/clk/nuvoton/clk-ma35d1-divider.c b/drivers/clk/nuvoton/clk-ma35d1-divider.c index e992e7c30341..b70f460c48d5 100644 --- a/drivers/clk/nuvoton/clk-ma35d1-divider.c +++ b/drivers/clk/nuvoton/clk-ma35d1-divider.c @@ -90,14 +90,14 @@ struct clk_hw *ma35d1_reg_adc_clkdiv(struct device *dev, const char *name, int ret; int i; - div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL); + div = devm_kzalloc_obj(dev, *div); if (!div) return ERR_PTR(-ENOMEM); max_div = clk_div_mask(width) + 1; min_div = 1; - table = devm_kcalloc(dev, max_div + 1, sizeof(*table), GFP_KERNEL); + table = devm_kzalloc_objs(dev, *table, max_div + 1); if (!table) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/nuvoton/clk-ma35d1-pll.c b/drivers/clk/nuvoton/clk-ma35d1-pll.c index c7c0dc91a012..8b7133284d46 100644 --- a/drivers/clk/nuvoton/clk-ma35d1-pll.c +++ b/drivers/clk/nuvoton/clk-ma35d1-pll.c @@ -336,7 +336,7 @@ struct clk_hw *ma35d1_reg_clk_pll(struct device *dev, u32 id, u8 u8mode, const c struct clk_hw *hw; int ret; - pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); + pll = devm_kzalloc_obj(dev, *pll); if (!pll) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/nuvoton/clk-ma35d1.c b/drivers/clk/nuvoton/clk-ma35d1.c index c914079cee2d..e95f72bb8103 100644 --- a/drivers/clk/nuvoton/clk-ma35d1.c +++ b/drivers/clk/nuvoton/clk-ma35d1.c @@ -467,9 +467,8 @@ static int ma35d1_clocks_probe(struct platform_device *pdev) u32 pllmode[PLL_MAX_NUM]; int ret; - ma35d1_hw_data = devm_kzalloc(dev, - struct_size(ma35d1_hw_data, hws, MA35D1_CLK_COUNT), - GFP_KERNEL); + ma35d1_hw_data = devm_kzalloc_flex(dev, *ma35d1_hw_data, hws, + MA35D1_CLK_COUNT); if (!ma35d1_hw_data) return -ENOMEM; diff --git a/drivers/clk/qcom/a53-pll.c b/drivers/clk/qcom/a53-pll.c index 0549b214fcfc..062158e9f634 100644 --- a/drivers/clk/qcom/a53-pll.c +++ b/drivers/clk/qcom/a53-pll.c @@ -59,7 +59,7 @@ static struct pll_freq_tbl *qcom_a53pll_get_freq_tbl(struct device *dev) if (count <= 0) return NULL; - freq_tbl = devm_kcalloc(dev, count + 1, sizeof(*freq_tbl), GFP_KERNEL); + freq_tbl = devm_kzalloc_objs(dev, *freq_tbl, count + 1); if (!freq_tbl) return NULL; @@ -94,7 +94,7 @@ static int qcom_a53pll_probe(struct platform_device *pdev) struct clk_init_data init = { }; int ret; - pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); + pll = devm_kzalloc_obj(dev, *pll); if (!pll) return -ENOMEM; diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c index ef31386831eb..5365b0d8b518 100644 --- a/drivers/clk/qcom/apcs-msm8916.c +++ b/drivers/clk/qcom/apcs-msm8916.c @@ -58,7 +58,7 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) return ret; } - a53cc = devm_kzalloc(dev, sizeof(*a53cc), GFP_KERNEL); + a53cc = devm_kzalloc_obj(dev, *a53cc); if (!a53cc) return -ENOMEM; diff --git a/drivers/clk/qcom/apcs-sdx55.c b/drivers/clk/qcom/apcs-sdx55.c index 90dd1f1855c2..9afc932f1691 100644 --- a/drivers/clk/qcom/apcs-sdx55.c +++ b/drivers/clk/qcom/apcs-sdx55.c @@ -61,7 +61,7 @@ static int qcom_apcs_sdx55_clk_probe(struct platform_device *pdev) return -ENODEV; } - a7cc = devm_kzalloc(dev, sizeof(*a7cc), GFP_KERNEL); + a7cc = devm_kzalloc_obj(dev, *a7cc); if (!a7cc) return -ENOMEM; diff --git a/drivers/clk/qcom/apss-ipq6018.c b/drivers/clk/qcom/apss-ipq6018.c index c89d126ebac3..32347e6d8775 100644 --- a/drivers/clk/qcom/apss-ipq6018.c +++ b/drivers/clk/qcom/apss-ipq6018.c @@ -132,9 +132,8 @@ static int apss_ipq6018_probe(struct platform_device *pdev) case QCOM_ID_IPQ5332: case QCOM_ID_IPQ5322: case QCOM_ID_IPQ5300: - cpu_clk_notifier = devm_kzalloc(&pdev->dev, - sizeof(*cpu_clk_notifier), - GFP_KERNEL); + cpu_clk_notifier = devm_kzalloc_obj(&pdev->dev, + *cpu_clk_notifier); if (!cpu_clk_notifier) return -ENOMEM; diff --git a/drivers/clk/qcom/clk-cpu-8996.c b/drivers/clk/qcom/clk-cpu-8996.c index 21d13c0841ed..3e9042ec398a 100644 --- a/drivers/clk/qcom/clk-cpu-8996.c +++ b/drivers/clk/qcom/clk-cpu-8996.c @@ -586,7 +586,7 @@ static int qcom_cpu_clk_msm8996_driver_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - data = devm_kzalloc(dev, struct_size(data, hws, 2), GFP_KERNEL); + data = devm_kzalloc_flex(dev, *data, hws, 2); if (!data) return -ENOMEM; data->num = 2; diff --git a/drivers/clk/qcom/clk-ref.c b/drivers/clk/qcom/clk-ref.c index 3efdf6749770..91113743e0be 100644 --- a/drivers/clk/qcom/clk-ref.c +++ b/drivers/clk/qcom/clk-ref.c @@ -123,9 +123,9 @@ static int qcom_clk_ref_register(struct device *dev, struct regmap *regmap, clk_ref->desc = *desc; if (clk_ref->desc.num_regulators) { - clk_ref->regulators = devm_kcalloc(dev, clk_ref->desc.num_regulators, - sizeof(*clk_ref->regulators), - GFP_KERNEL); + clk_ref->regulators = devm_kzalloc_objs(dev, + *clk_ref->regulators, + clk_ref->desc.num_regulators); if (!clk_ref->regulators) return -ENOMEM; @@ -188,8 +188,7 @@ int qcom_clk_ref_probe(struct platform_device *pdev, if (IS_ERR(regmap)) return PTR_ERR(regmap); - provider = devm_kzalloc(dev, struct_size(provider, refs, num_clk_refs), - GFP_KERNEL); + provider = devm_kzalloc_flex(dev, *provider, refs, num_clk_refs); if (!provider) return -ENOMEM; diff --git a/drivers/clk/qcom/clk-rpm.c b/drivers/clk/qcom/clk-rpm.c index 74f569b58017..44599579dfae 100644 --- a/drivers/clk/qcom/clk-rpm.c +++ b/drivers/clk/qcom/clk-rpm.c @@ -533,7 +533,7 @@ static int rpm_clk_probe(struct platform_device *pdev) rpm_clks = desc->clks; num_clks = desc->num_clks; - rcc = devm_kzalloc(&pdev->dev, sizeof(*rcc), GFP_KERNEL); + rcc = devm_kzalloc_obj(&pdev->dev, *rcc); if (!rcc) return -ENOMEM; diff --git a/drivers/clk/qcom/clk-spmi-pmic-div.c b/drivers/clk/qcom/clk-spmi-pmic-div.c index 3e2ac6745325..5025011301fa 100644 --- a/drivers/clk/qcom/clk-spmi-pmic-div.c +++ b/drivers/clk/qcom/clk-spmi-pmic-div.c @@ -230,7 +230,7 @@ static int spmi_pmic_clkdiv_probe(struct platform_device *pdev) if (!nclks) return -EINVAL; - cc = devm_kzalloc(dev, struct_size(cc, clks, nclks), GFP_KERNEL); + cc = devm_kzalloc_flex(dev, *cc, clks, nclks); if (!cc) return -ENOMEM; cc->nclks = nclks; diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c index 08fd62ac780d..e5c2dad23e3f 100644 --- a/drivers/clk/qcom/common.c +++ b/drivers/clk/qcom/common.c @@ -167,7 +167,7 @@ static int _qcom_cc_register_board_clk(struct device *dev, const char *path, } if (!node) { - fixed = devm_kzalloc(dev, sizeof(*fixed), GFP_KERNEL); + fixed = devm_kzalloc_obj(dev, *fixed); if (!fixed) return -ENOMEM; @@ -184,7 +184,7 @@ static int _qcom_cc_register_board_clk(struct device *dev, const char *path, of_node_put(node); if (add_factor) { - factor = devm_kzalloc(dev, sizeof(*factor), GFP_KERNEL); + factor = devm_kzalloc_obj(dev, *factor); if (!factor) return -ENOMEM; @@ -268,7 +268,7 @@ static int qcom_cc_icc_register(struct device *dev, if (!desc->icc_hws) return 0; - icd = devm_kcalloc(dev, desc->num_icc_hws, sizeof(*icd), GFP_KERNEL); + icd = devm_kzalloc_objs(dev, *icd, desc->num_icc_hws); if (!icd) return -ENOMEM; @@ -333,7 +333,7 @@ int qcom_cc_really_probe(struct device *dev, size_t num_clk_hws = desc->num_clk_hws; struct clk_hw **clk_hws = desc->clk_hws; - cc = devm_kzalloc(dev, sizeof(*cc), GFP_KERNEL); + cc = devm_kzalloc_obj(dev, *cc); if (!cc) return -ENOMEM; @@ -372,7 +372,7 @@ int qcom_cc_really_probe(struct device *dev, goto put_rpm; if (desc->gdscs && desc->num_gdscs) { - scd = devm_kzalloc(dev, sizeof(*scd), GFP_KERNEL); + scd = devm_kzalloc_obj(dev, *scd); if (!scd) { ret = -ENOMEM; goto put_rpm; diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c index b99d70149af3..be9c14eb7b06 100644 --- a/drivers/clk/qcom/gdsc.c +++ b/drivers/clk/qcom/gdsc.c @@ -603,12 +603,11 @@ int gdsc_register(struct gdsc_desc *desc, struct gdsc **scs = desc->scs; size_t num = desc->num; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; - data->domains = devm_kcalloc(dev, num, sizeof(*data->domains), - GFP_KERNEL); + data->domains = devm_kzalloc_objs(dev, *data->domains, num); if (!data->domains) return -ENOMEM; diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c index 385964196185..c7373bbb6c3a 100644 --- a/drivers/clk/qcom/hfpll.c +++ b/drivers/clk/qcom/hfpll.c @@ -121,7 +121,7 @@ static int qcom_hfpll_probe(struct platform_device *pdev) int ret; struct clk_parent_data pdata = { .index = 0 }; - h = devm_kzalloc(dev, sizeof(*h), GFP_KERNEL); + h = devm_kzalloc_obj(dev, *h); if (!h) return -ENOMEM; diff --git a/drivers/clk/qcom/ipq-cmn-pll.c b/drivers/clk/qcom/ipq-cmn-pll.c index 74a2043632b7..f4d63258dc2b 100644 --- a/drivers/clk/qcom/ipq-cmn-pll.c +++ b/drivers/clk/qcom/ipq-cmn-pll.c @@ -443,7 +443,7 @@ static struct clk_hw *ipq_cmn_pll_clk_hw_register(struct platform_device *pdev) if (IS_ERR(regmap)) return ERR_CAST(regmap); - cmn_pll = devm_kzalloc(dev, sizeof(*cmn_pll), GFP_KERNEL); + cmn_pll = devm_kzalloc_obj(dev, *cmn_pll); if (!cmn_pll) return ERR_PTR(-ENOMEM); @@ -471,7 +471,7 @@ static struct clk_hw *ipq_cmn_pll_regmap_div_register(struct device *dev, struct clk_regmap_div *div_clk; int ret; - div_clk = devm_kzalloc(dev, sizeof(*div_clk), GFP_KERNEL); + div_clk = devm_kzalloc_obj(dev, *div_clk); if (!div_clk) return ERR_PTR(-ENOMEM); @@ -617,7 +617,7 @@ static struct clk_hw *ipq_cmn_pll_pon_clk_register(struct device *dev, struct clk_regmap *pon_clk; int ret; - pon_clk = devm_kzalloc(dev, sizeof(*pon_clk), GFP_KERNEL); + pon_clk = devm_kzalloc_obj(dev, *pon_clk); if (!pon_clk) return ERR_PTR(-ENOMEM); @@ -728,7 +728,7 @@ static struct clk_hw *ipq_cmn_pll_ephy_raw_register(struct device *dev, struct clk_init_data init = {}; int ret; - ephy_raw_clk = devm_kzalloc(dev, sizeof(*ephy_raw_clk), GFP_KERNEL); + ephy_raw_clk = devm_kzalloc_obj(dev, *ephy_raw_clk); if (!ephy_raw_clk) return ERR_PTR(-ENOMEM); @@ -772,7 +772,7 @@ static struct clk_hw *ipq_cmn_pll_register_fixed_gate(struct device *dev, struct clk_init_data init = {}; int ret; - gate_clk = devm_kzalloc(dev, sizeof(*gate_clk), GFP_KERNEL); + gate_clk = devm_kzalloc_obj(dev, *gate_clk); if (!gate_clk) return ERR_PTR(-ENOMEM); @@ -819,8 +819,7 @@ static int ipq_cmn_pll_register_clks(struct platform_device *pdev) for (p = fixed_clk; p->name; p++) num_clks++; - hw_data = devm_kzalloc(dev, struct_size(hw_data, hws, num_clks + 1), - GFP_KERNEL); + hw_data = devm_kzalloc_flex(dev, *hw_data, hws, num_clks + 1); if (!hw_data) return -ENOMEM; diff --git a/drivers/clk/qcom/krait-cc.c b/drivers/clk/qcom/krait-cc.c index f29d6dd1f3ac..37fe990ef6b8 100644 --- a/drivers/clk/qcom/krait-cc.c +++ b/drivers/clk/qcom/krait-cc.c @@ -92,7 +92,7 @@ krait_add_div(struct device *dev, int id, const char *s, unsigned int offset) char *parent_name; int cpu, ret; - div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL); + div = devm_kzalloc_obj(dev, *div); if (!div) return ERR_PTR(-ENOMEM); @@ -158,7 +158,7 @@ krait_add_sec_mux(struct device *dev, int id, const char *s, struct clk_hw *clk; char *parent_name; - mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(dev, *mux); if (!mux) return ERR_PTR(-ENOMEM); @@ -239,7 +239,7 @@ krait_add_pri_mux(struct device *dev, struct clk_hw *hfpll_div, struct clk_hw *s struct clk_hw *clk; char *hfpll_name; - mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(dev, *mux); if (!mux) return ERR_PTR(-ENOMEM); @@ -365,7 +365,7 @@ static int krait_cc_probe(struct platform_device *pdev) } /* Krait configurations have at most 4 CPUs and one L2 */ - clks = devm_kcalloc(dev, clks_max, sizeof(*clks), GFP_KERNEL); + clks = devm_kzalloc_objs(dev, *clks, clks_max); if (!clks) return -ENOMEM; diff --git a/drivers/clk/qcom/lpass-gfm-sm8250.c b/drivers/clk/qcom/lpass-gfm-sm8250.c index 65d380e30eed..13115a316c05 100644 --- a/drivers/clk/qcom/lpass-gfm-sm8250.c +++ b/drivers/clk/qcom/lpass-gfm-sm8250.c @@ -243,7 +243,7 @@ static int lpass_gfm_clk_driver_probe(struct platform_device *pdev) if (!data) return -EINVAL; - cc = devm_kzalloc(dev, sizeof(*cc), GFP_KERNEL); + cc = devm_kzalloc_obj(dev, *cc); if (!cc) return -ENOMEM; diff --git a/drivers/clk/ralink/clk-mt7621.c b/drivers/clk/ralink/clk-mt7621.c index 350c2b6fb46f..f09d6527c9fd 100644 --- a/drivers/clk/ralink/clk-mt7621.c +++ b/drivers/clk/ralink/clk-mt7621.c @@ -468,7 +468,7 @@ static int mt7621_reset_init(struct device *dev, struct regmap *sysc) { struct mt7621_rst *rst_data; - rst_data = devm_kzalloc(dev, sizeof(*rst_data), GFP_KERNEL); + rst_data = devm_kzalloc_obj(dev, *rst_data); if (!rst_data) return -ENOMEM; @@ -491,7 +491,7 @@ static int mt7621_clk_probe(struct platform_device *pdev) struct mt7621_clk_priv *priv; int ret, i, count; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -517,8 +517,7 @@ static int mt7621_clk_probe(struct platform_device *pdev) count = ARRAY_SIZE(mt7621_clks_base) + ARRAY_SIZE(mt7621_fixed_clks) + ARRAY_SIZE(mt7621_gates); - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, count), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, count); if (!clk_data) return -ENOMEM; clk_data->num = count; diff --git a/drivers/clk/ralink/clk-mtmips.c b/drivers/clk/ralink/clk-mtmips.c index 370e5c36863d..ef0e14f25a32 100644 --- a/drivers/clk/ralink/clk-mtmips.c +++ b/drivers/clk/ralink/clk-mtmips.c @@ -1079,7 +1079,7 @@ static int mtmips_reset_init(struct device *dev, struct regmap *sysc) { struct mtmips_rst *rst_data; - rst_data = devm_kzalloc(dev, sizeof(*rst_data), GFP_KERNEL); + rst_data = devm_kzalloc_obj(dev, *rst_data); if (!rst_data) return -ENOMEM; @@ -1101,7 +1101,7 @@ static int mtmips_clk_probe(struct platform_device *pdev) struct mtmips_clk_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/clk/renesas/clk-vbattb.c b/drivers/clk/renesas/clk-vbattb.c index bd97a68bed1b..58dac430b698 100644 --- a/drivers/clk/renesas/clk-vbattb.c +++ b/drivers/clk/renesas/clk-vbattb.c @@ -100,11 +100,11 @@ static int vbattb_clk_probe(struct platform_device *pdev) if (ret) return ret; - vbclk = devm_kzalloc(dev, sizeof(*vbclk), GFP_KERNEL); + vbclk = devm_kzalloc_obj(dev, *vbclk); if (!vbclk) return -ENOMEM; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, num_clks), GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, num_clks); if (!clk_data) return -ENOMEM; clk_data->num = num_clks; diff --git a/drivers/clk/renesas/r8a78000-cpg.c b/drivers/clk/renesas/r8a78000-cpg.c index b8024e76743e..6fee05a899f4 100644 --- a/drivers/clk/renesas/r8a78000-cpg.c +++ b/drivers/clk/renesas/r8a78000-cpg.c @@ -126,7 +126,7 @@ static int r8a78000_cpg_probe(struct platform_device *pdev) if (!map) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c index 3df3f2b2c6de..871a915c24b8 100644 --- a/drivers/clk/renesas/r9a06g032-clocks.c +++ b/drivers/clk/renesas/r9a06g032-clocks.c @@ -805,7 +805,7 @@ static int r9a06g032_add_clk_domain(struct device *dev) struct device_node *np = dev->of_node; struct generic_pm_domain *pd; - pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(dev, *pd); if (!pd) return -ENOMEM; @@ -1318,9 +1318,8 @@ static int __init r9a06g032_clocks_probe(struct platform_device *pdev) struct regbit uart_group_sel[2]; int error; - clocks = devm_kzalloc(dev, sizeof(*clocks), GFP_KERNEL); - clks = devm_kcalloc(dev, R9A06G032_CLOCK_COUNT, sizeof(struct clk *), - GFP_KERNEL); + clocks = devm_kzalloc_obj(dev, *clocks); + clks = devm_kzalloc_objs(dev, struct clk *, R9A06G032_CLOCK_COUNT); if (!clocks || !clks) return -ENOMEM; diff --git a/drivers/clk/renesas/r9a09g077-cpg.c b/drivers/clk/renesas/r9a09g077-cpg.c index 5a0e7df1eb06..7dd1f44b26e3 100644 --- a/drivers/clk/renesas/r9a09g077-cpg.c +++ b/drivers/clk/renesas/r9a09g077-cpg.c @@ -563,12 +563,12 @@ r9a09g077_cpg_fselxspi_div_clk_register(struct device *dev, if (IS_ERR(parent)) return ERR_CAST(parent); - div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL); + div = devm_kzalloc_obj(dev, *div); if (!div) return ERR_PTR(-ENOMEM); if (!xspi_div_ops) { - xspi_div_ops = devm_kzalloc(dev, sizeof(*xspi_div_ops), GFP_KERNEL); + xspi_div_ops = devm_kzalloc_obj(dev, *xspi_div_ops); if (!xspi_div_ops) return ERR_PTR(-ENOMEM); memcpy(xspi_div_ops, &clk_divider_ops, @@ -714,7 +714,7 @@ r9a09g077_cpg_pll3_clk_register(struct device *dev, if (IS_ERR(parent)) return ERR_CAST(parent); - pll_clk = devm_kzalloc(dev, sizeof(*pll_clk), GFP_KERNEL); + pll_clk = devm_kzalloc_obj(dev, *pll_clk); if (!pll_clk) return ERR_PTR(-ENOMEM); @@ -843,7 +843,7 @@ r9a09g077_cpg_lcdc_div_clk_register(struct device *dev, if (IS_ERR(parent)) return ERR_CAST(parent); - clk_hw_data = devm_kzalloc(dev, sizeof(*clk_hw_data), GFP_KERNEL); + clk_hw_data = devm_kzalloc_obj(dev, *clk_hw_data); if (!clk_hw_data) return ERR_PTR(-ENOMEM); @@ -991,7 +991,7 @@ static int r9a09g077_post_init(struct device *dev, struct cpg_mssr_pub *pub) if (!regmap_cfg) return -ENOMEM; - sysc_reg = devm_kzalloc(dev, sizeof(*sysc_reg), GFP_KERNEL); + sysc_reg = devm_kzalloc_obj(dev, *sysc_reg); if (!sysc_reg) return -ENOMEM; diff --git a/drivers/clk/renesas/rcar-usb2-clock-sel.c b/drivers/clk/renesas/rcar-usb2-clock-sel.c index 421ae973ea8e..2703004453c0 100644 --- a/drivers/clk/renesas/rcar-usb2-clock-sel.c +++ b/drivers/clk/renesas/rcar-usb2-clock-sel.c @@ -142,7 +142,7 @@ static int rcar_usb2_clock_sel_probe(struct platform_device *pdev) struct clk_init_data init = {}; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c index ffac4409a161..1ed11ce4a04c 100644 --- a/drivers/clk/renesas/renesas-cpg-mssr.c +++ b/drivers/clk/renesas/renesas-cpg-mssr.c @@ -685,7 +685,7 @@ static int __init cpg_mssr_add_clk_domain(struct device *dev, size_t pm_size = num_core_pm_clks * sizeof(core_pm_clks[0]); int ret; - pd = devm_kzalloc(dev, struct_size(pd, core_pm_clks, num_core_pm_clks), GFP_KERNEL); + pd = devm_kzalloc_flex(dev, *pd, core_pm_clks, num_core_pm_clks); if (!pd) return -ENOMEM; diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cpg.c index f6293c968bcf..dc2bcbab18f1 100644 --- a/drivers/clk/renesas/rzg2l-cpg.c +++ b/drivers/clk/renesas/rzg2l-cpg.c @@ -343,7 +343,7 @@ static int rzg2l_register_notifier(struct clk_hw *hw, const struct cpg_core_clk if (!core->notifier) return 0; - nb = devm_kzalloc(priv->dev, sizeof(*nb), GFP_KERNEL); + nb = devm_kzalloc_obj(priv->dev, *nb); if (!nb) return -ENOMEM; @@ -428,7 +428,7 @@ rzg3s_cpg_div_clk_register(const struct cpg_core_clk *core, struct rzg2l_cpg_pri parent_name = __clk_get_name(parent); - div_hw_data = devm_kzalloc(priv->dev, sizeof(*div_hw_data), GFP_KERNEL); + div_hw_data = devm_kzalloc_obj(priv->dev, *div_hw_data); if (!div_hw_data) return ERR_PTR(-ENOMEM); @@ -584,7 +584,7 @@ rzg2l_cpg_sd_mux_clk_register(const struct cpg_core_clk *core, struct clk_hw *clk_hw; int ret; - sd_mux_hw_data = devm_kzalloc(priv->dev, sizeof(*sd_mux_hw_data), GFP_KERNEL); + sd_mux_hw_data = devm_kzalloc_obj(priv->dev, *sd_mux_hw_data); if (!sd_mux_hw_data) return ERR_PTR(-ENOMEM); @@ -841,7 +841,7 @@ rzg2l_cpg_dsi_div_clk_register(const struct cpg_core_clk *core, if (IS_ERR(parent)) return ERR_CAST(parent); - clk_hw_data = devm_kzalloc(priv->dev, sizeof(*clk_hw_data), GFP_KERNEL); + clk_hw_data = devm_kzalloc_obj(priv->dev, *clk_hw_data); if (!clk_hw_data) return ERR_PTR(-ENOMEM); @@ -926,7 +926,7 @@ rzg3l_cpg_lvds_div_clk_register(const struct cpg_core_clk *core, if (IS_ERR(parent)) return ERR_CAST(parent); - ff = devm_kzalloc(priv->dev, sizeof(*ff), GFP_KERNEL); + ff = devm_kzalloc_obj(priv->dev, *ff); if (!ff) return ERR_PTR(-ENOMEM); @@ -1041,7 +1041,7 @@ rzg3l_cpg_dsi_div_clk_register(const struct cpg_core_clk *core, if (IS_ERR(parent)) return ERR_CAST(parent); - clk_hw_data = devm_kzalloc(priv->dev, sizeof(*clk_hw_data), GFP_KERNEL); + clk_hw_data = devm_kzalloc_obj(priv->dev, *clk_hw_data); if (!clk_hw_data) return ERR_PTR(-ENOMEM); @@ -1132,7 +1132,7 @@ rzg2l_cpg_pll5_4_mux_clk_register(const struct cpg_core_clk *core, struct clk_hw *clk_hw; int ret; - clk_hw_data = devm_kzalloc(priv->dev, sizeof(*clk_hw_data), GFP_KERNEL); + clk_hw_data = devm_kzalloc_obj(priv->dev, *clk_hw_data); if (!clk_hw_data) return ERR_PTR(-ENOMEM); @@ -1266,7 +1266,7 @@ rzg2l_cpg_sipll5_register(const struct cpg_core_clk *core, if (IS_ERR(parent)) return ERR_CAST(parent); - sipll5 = devm_kzalloc(priv->dev, sizeof(*sipll5), GFP_KERNEL); + sipll5 = devm_kzalloc_obj(priv->dev, *sipll5); if (!sipll5) return ERR_PTR(-ENOMEM); @@ -1392,7 +1392,7 @@ rzg2l_cpg_pll_clk_register(const struct cpg_core_clk *core, if (IS_ERR(parent)) return ERR_CAST(parent); - pll_clk = devm_kzalloc(dev, sizeof(*pll_clk), GFP_KERNEL); + pll_clk = devm_kzalloc_obj(dev, *pll_clk); if (!pll_clk) return ERR_PTR(-ENOMEM); @@ -1529,7 +1529,7 @@ rzg3l_cpg_dsi_mux_clk_register(const struct cpg_core_clk *core, struct clk_mux *mux_data; int ret; - mux_data = devm_kzalloc(priv->dev, sizeof(*mux_data), GFP_KERNEL); + mux_data = devm_kzalloc_obj(priv->dev, *mux_data); if (!mux_data) return ERR_PTR(-ENOMEM); @@ -2284,7 +2284,7 @@ rzg2l_cpg_register_mod_clk(const struct rzg2l_mod_clk *mod, goto fail; } - clock = devm_kzalloc(dev, sizeof(*clock), GFP_KERNEL); + clock = devm_kzalloc_obj(dev, *clock); if (!clock) { clk = ERR_PTR(-ENOMEM); goto fail; @@ -2314,7 +2314,7 @@ rzg2l_cpg_register_mod_clk(const struct rzg2l_mod_clk *mod, struct mstop *mstop = rzg2l_mod_clock_get_mstop(priv, mod->mstop_conf); if (!mstop) { - mstop = devm_kzalloc(dev, sizeof(*mstop), GFP_KERNEL); + mstop = devm_kzalloc_obj(dev, *mstop); if (!mstop) { clk = ERR_PTR(-ENOMEM); goto fail; @@ -2628,7 +2628,7 @@ static int __init rzg2l_cpg_probe(struct platform_device *pdev) info = of_device_get_match_data(dev); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -2641,7 +2641,7 @@ static int __init rzg2l_cpg_probe(struct platform_device *pdev) return PTR_ERR(priv->base); nclks = info->num_total_core_clks + info->num_hw_mod_clks; - clks = devm_kmalloc_array(dev, nclks, sizeof(*clks), GFP_KERNEL); + clks = devm_kmalloc_objs(dev, *clks, nclks); if (!clks) return -ENOMEM; diff --git a/drivers/clk/renesas/rzv2h-cpg.c b/drivers/clk/renesas/rzv2h-cpg.c index 7ce94680c79a..656cee9c7b64 100644 --- a/drivers/clk/renesas/rzv2h-cpg.c +++ b/drivers/clk/renesas/rzv2h-cpg.c @@ -348,7 +348,7 @@ rzv2h_cpg_plldsi_div_clk_register(const struct cpg_core_clk *core, if (IS_ERR(parent)) return ERR_CAST(parent); - clk_hw_data = devm_kzalloc(priv->dev, sizeof(*clk_hw_data), GFP_KERNEL); + clk_hw_data = devm_kzalloc_obj(priv->dev, *clk_hw_data); if (!clk_hw_data) return ERR_PTR(-ENOMEM); @@ -594,7 +594,7 @@ rzv2h_cpg_plldsi_smux_clk_register(const struct cpg_core_clk *core, return ERR_PTR(-EINVAL); } - clk_hw_data = devm_kzalloc(priv->dev, sizeof(*clk_hw_data), GFP_KERNEL); + clk_hw_data = devm_kzalloc_obj(priv->dev, *clk_hw_data); if (!clk_hw_data) return ERR_PTR(-ENOMEM); @@ -721,7 +721,7 @@ rzv2h_cpg_pll_clk_register(const struct cpg_core_clk *core, if (IS_ERR(parent)) return ERR_CAST(parent); - pll_clk = devm_kzalloc(dev, sizeof(*pll_clk), GFP_KERNEL); + pll_clk = devm_kzalloc_obj(dev, *pll_clk); if (!pll_clk) return ERR_PTR(-ENOMEM); @@ -844,7 +844,7 @@ rzv2h_cpg_ddiv_clk_register(const struct cpg_core_clk *core, if ((shift + width) > 16) return ERR_PTR(-EINVAL); - ddiv = devm_kzalloc(priv->dev, sizeof(*ddiv), GFP_KERNEL); + ddiv = devm_kzalloc_obj(priv->dev, *ddiv); if (!ddiv) return ERR_PTR(-ENOMEM); @@ -924,7 +924,7 @@ rzv2h_cpg_fixed_mod_status_clk_register(const struct cpg_core_clk *core, parent_name = clk_hw_get_name(parent); - clk_hw_data = devm_kzalloc(priv->dev, sizeof(*clk_hw_data), GFP_KERNEL); + clk_hw_data = devm_kzalloc_obj(priv->dev, *clk_hw_data); if (!clk_hw_data) return ERR_PTR(-ENOMEM); @@ -1030,8 +1030,8 @@ rzv2h_cpg_register_core_clk(const struct cpg_core_clk *core, break; case CLK_TYPE_FF_MOD_STATUS: if (!priv->ff_mod_status_ops) { - priv->ff_mod_status_ops = - devm_kzalloc(dev, sizeof(*priv->ff_mod_status_ops), GFP_KERNEL); + priv->ff_mod_status_ops = devm_kzalloc_obj(dev, + *priv->ff_mod_status_ops); if (!priv->ff_mod_status_ops) { clk_hw = ERR_PTR(-ENOMEM); goto fail; @@ -1240,7 +1240,7 @@ rzv2h_cpg_register_mod_clk(const struct rzv2h_mod_clk *mod, goto fail; } - clock = devm_kzalloc(dev, sizeof(*clock), GFP_KERNEL); + clock = devm_kzalloc_obj(dev, *clock); if (!clock) { ret = -ENOMEM; goto fail; @@ -1522,7 +1522,7 @@ static int __init rzv2h_cpg_add_pm_domains(struct rzv2h_cpg_priv *priv) struct rzv2h_cpg_pd *pd; int ret; - pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(dev, *pd); if (!pd) return -ENOMEM; @@ -1553,7 +1553,7 @@ static int __init rzv2h_cpg_probe(struct platform_device *pdev) info = of_device_get_match_data(dev); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -1566,12 +1566,12 @@ static int __init rzv2h_cpg_probe(struct platform_device *pdev) return PTR_ERR(priv->base); nclks = info->num_total_core_clks + info->num_hw_mod_clks; - clks = devm_kmalloc_array(dev, nclks, sizeof(*clks), GFP_KERNEL); + clks = devm_kmalloc_objs(dev, *clks, nclks); if (!clks) return -ENOMEM; - priv->mstop_count = devm_kcalloc(dev, info->num_mstop_bits, - sizeof(*priv->mstop_count), GFP_KERNEL); + priv->mstop_count = devm_kzalloc_objs(dev, *priv->mstop_count, + info->num_mstop_bits); if (!priv->mstop_count) return -ENOMEM; diff --git a/drivers/clk/rockchip/clk-rk3528.c b/drivers/clk/rockchip/clk-rk3528.c index a5ff64b93f8f..9c246b7b84d8 100644 --- a/drivers/clk/rockchip/clk-rk3528.c +++ b/drivers/clk/rockchip/clk-rk3528.c @@ -1138,7 +1138,7 @@ static int __init clk_rk3528_probe(struct platform_device *pdev) rockchip_clk_register_branches(ctx, rk3528_clk_branches, nr_branches); if (!IS_ERR(vo_grf)) { - vo_grf_e = devm_kzalloc(dev, sizeof(*vo_grf_e), GFP_KERNEL); + vo_grf_e = devm_kzalloc_obj(dev, *vo_grf_e); if (!vo_grf_e) return -ENOMEM; @@ -1151,7 +1151,7 @@ static int __init clk_rk3528_probe(struct platform_device *pdev) } if (!IS_ERR(vpu_grf)) { - vpu_grf_e = devm_kzalloc(dev, sizeof(*vpu_grf_e), GFP_KERNEL); + vpu_grf_e = devm_kzalloc_obj(dev, *vpu_grf_e); if (!vpu_grf_e) return -ENOMEM; diff --git a/drivers/clk/samsung/clk-acpm.c b/drivers/clk/samsung/clk-acpm.c index e5a2d3ab34cb..d5f1e73e05f8 100644 --- a/drivers/clk/samsung/clk-acpm.c +++ b/drivers/clk/samsung/clk-acpm.c @@ -165,15 +165,14 @@ static int acpm_clk_probe(struct platform_device *pdev) count = drv_data->nr_clks; mbox_chan_id = drv_data->mbox_chan_id; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, count), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, count); if (!clk_data) return -ENOMEM; clk_data->num = count; hws = clk_data->hws; - aclks = devm_kcalloc(dev, count, sizeof(*aclks), GFP_KERNEL); + aclks = devm_kzalloc_objs(dev, *aclks, count); if (!aclks) return -ENOMEM; diff --git a/drivers/clk/samsung/clk-exynos-arm64.c b/drivers/clk/samsung/clk-exynos-arm64.c index 35d4de233cc1..eac59c8df6fa 100644 --- a/drivers/clk/samsung/clk-exynos-arm64.c +++ b/drivers/clk/samsung/clk-exynos-arm64.c @@ -202,8 +202,7 @@ static int __init exynos_arm64_cmu_prepare_pm(struct device *dev, if (!data->nr_pclks) return 0; - data->pclks = devm_kcalloc(dev, sizeof(struct clk *), data->nr_pclks, - GFP_KERNEL); + data->pclks = devm_kzalloc_objs(dev, struct clk *, data->nr_pclks); if (!data->pclks) { ret = -ENOMEM; goto free_sysreg_save; @@ -284,7 +283,7 @@ int __init exynos_arm64_register_cmu_pm(struct platform_device *pdev, cmu = of_device_get_match_data(dev); - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/clk/samsung/clk-exynos-audss.c b/drivers/clk/samsung/clk-exynos-audss.c index e11ac67819ef..7b15c580a882 100644 --- a/drivers/clk/samsung/clk-exynos-audss.c +++ b/drivers/clk/samsung/clk-exynos-audss.c @@ -141,10 +141,7 @@ static int exynos_audss_clk_probe(struct platform_device *pdev) epll = ERR_PTR(-ENODEV); - clk_data = devm_kzalloc(dev, - struct_size(clk_data, hws, - EXYNOS_AUDSS_MAX_CLKS), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, EXYNOS_AUDSS_MAX_CLKS); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c index 9c8b17cb5e7c..2d65f86e5d48 100644 --- a/drivers/clk/samsung/clk-exynos-clkout.c +++ b/drivers/clk/samsung/clk-exynos-clkout.c @@ -117,9 +117,8 @@ static int exynos_clkout_probe(struct platform_device *pdev) int parent_count, ret, i; u32 mux_mask; - clkout = devm_kzalloc(&pdev->dev, - struct_size(clkout, data.hws, EXYNOS_CLKOUT_NR_CLKS), - GFP_KERNEL); + clkout = devm_kzalloc_flex(&pdev->dev, *clkout, data.hws, + EXYNOS_CLKOUT_NR_CLKS); if (!clkout) return -ENOMEM; diff --git a/drivers/clk/samsung/clk-s5pv210-audss.c b/drivers/clk/samsung/clk-s5pv210-audss.c index 1b83fdd496e9..b1f2744b93c8 100644 --- a/drivers/clk/samsung/clk-s5pv210-audss.c +++ b/drivers/clk/samsung/clk-s5pv210-audss.c @@ -77,9 +77,7 @@ static int s5pv210_audss_clk_probe(struct platform_device *pdev) if (IS_ERR(reg_base)) return PTR_ERR(reg_base); - clk_data = devm_kzalloc(&pdev->dev, - struct_size(clk_data, hws, AUDSS_MAX_CLKS), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(&pdev->dev, *clk_data, hws, AUDSS_MAX_CLKS); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/sifive/sifive-prci.c b/drivers/clk/sifive/sifive-prci.c index 4d1cc7adb2b3..402b905d010e 100644 --- a/drivers/clk/sifive/sifive-prci.c +++ b/drivers/clk/sifive/sifive-prci.c @@ -567,7 +567,7 @@ static int sifive_prci_probe(struct platform_device *pdev) desc = of_device_get_match_data(&pdev->dev); - pd = devm_kzalloc(dev, struct_size(pd, hw_clks.hws, desc->num_clks), GFP_KERNEL); + pd = devm_kzalloc_flex(dev, *pd, hw_clks.hws, desc->num_clks); if (!pd) return -ENOMEM; diff --git a/drivers/clk/socfpga/clk-agilex.c b/drivers/clk/socfpga/clk-agilex.c index 2bdea1997b5e..3d4d9f35b927 100644 --- a/drivers/clk/socfpga/clk-agilex.c +++ b/drivers/clk/socfpga/clk-agilex.c @@ -468,8 +468,7 @@ static int agilex_clkmgr_init(struct platform_device *pdev) num_clks = AGILEX_NUM_CLKS; - clk_data = devm_kzalloc(dev, struct_size(clk_data, clk_data.hws, - num_clks), GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, clk_data.hws, num_clks); if (!clk_data) return -ENOMEM; @@ -508,8 +507,7 @@ static int n5x_clkmgr_init(struct platform_device *pdev) num_clks = AGILEX_NUM_CLKS; - clk_data = devm_kzalloc(dev, struct_size(clk_data, clk_data.hws, - num_clks), GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, clk_data.hws, num_clks); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/socfpga/clk-agilex5.c b/drivers/clk/socfpga/clk-agilex5.c index f7f0ad884f64..572fbb419284 100644 --- a/drivers/clk/socfpga/clk-agilex5.c +++ b/drivers/clk/socfpga/clk-agilex5.c @@ -500,8 +500,7 @@ static int agilex5_clkmgr_init(struct platform_device *pdev) num_clks = AGILEX5_NUM_CLKS; - clk_data = devm_kzalloc(dev, struct_size(clk_data, clk_data.hws, - num_clks), GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, clk_data.hws, num_clks); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/socfpga/clk-s10.c b/drivers/clk/socfpga/clk-s10.c index b4bf4e2d38e1..aad66f8d069d 100644 --- a/drivers/clk/socfpga/clk-s10.c +++ b/drivers/clk/socfpga/clk-s10.c @@ -397,8 +397,7 @@ static int s10_clkmgr_init(struct platform_device *pdev) } num_clks = STRATIX10_NUM_CLKS; - clk_data = devm_kzalloc(dev, struct_size(clk_data, clk_data.hws, - num_clks), GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, clk_data.hws, num_clks); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/sophgo/clk-cv1800.c b/drivers/clk/sophgo/clk-cv1800.c index a4116ac1adcb..c1cf9e042d22 100644 --- a/drivers/clk/sophgo/clk-cv1800.c +++ b/drivers/clk/sophgo/clk-cv1800.c @@ -1504,7 +1504,7 @@ static int cv1800_clk_probe(struct platform_device *pdev) return -EINVAL; } - ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(dev, *ctrl); if (!ctrl) return -ENOMEM; diff --git a/drivers/clk/sophgo/clk-sg2042-clkgen.c b/drivers/clk/sophgo/clk-sg2042-clkgen.c index 9725ac4e050a..6abc2c973c49 100644 --- a/drivers/clk/sophgo/clk-sg2042-clkgen.c +++ b/drivers/clk/sophgo/clk-sg2042-clkgen.c @@ -1054,9 +1054,8 @@ static int sg2042_init_clkdata(struct platform_device *pdev, { struct sg2042_clk_data *clk_data = NULL; - clk_data = devm_kzalloc(&pdev->dev, - struct_size(clk_data, onecell_data.hws, num_clks), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(&pdev->dev, *clk_data, onecell_data.hws, + num_clks); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/sophgo/clk-sg2042-pll.c b/drivers/clk/sophgo/clk-sg2042-pll.c index 110b6ee06fe4..4f2eed02eb59 100644 --- a/drivers/clk/sophgo/clk-sg2042-pll.c +++ b/drivers/clk/sophgo/clk-sg2042-pll.c @@ -495,9 +495,8 @@ static int sg2042_init_clkdata(struct platform_device *pdev, { struct sg2042_clk_data *clk_data; - clk_data = devm_kzalloc(&pdev->dev, - struct_size(clk_data, onecell_data.hws, num_clks), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(&pdev->dev, *clk_data, onecell_data.hws, + num_clks); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/sophgo/clk-sg2042-rpgate.c b/drivers/clk/sophgo/clk-sg2042-rpgate.c index 5b38d4f15525..639fb3b4627d 100644 --- a/drivers/clk/sophgo/clk-sg2042-rpgate.c +++ b/drivers/clk/sophgo/clk-sg2042-rpgate.c @@ -227,9 +227,8 @@ static int sg2042_init_clkdata(struct platform_device *pdev, { struct sg2042_clk_data *clk_data; - clk_data = devm_kzalloc(&pdev->dev, - struct_size(clk_data, onecell_data.hws, num_clks), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(&pdev->dev, *clk_data, onecell_data.hws, + num_clks); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/sophgo/clk-sg2044-pll.c b/drivers/clk/sophgo/clk-sg2044-pll.c index 94c0f519ba6d..2ea9fb355205 100644 --- a/drivers/clk/sophgo/clk-sg2044-pll.c +++ b/drivers/clk/sophgo/clk-sg2044-pll.c @@ -593,7 +593,7 @@ static int sg2044_pll_probe(struct platform_device *pdev) if (!desc) return dev_err_probe(dev, -EINVAL, "no match data for platform\n"); - ctrl = devm_kzalloc(dev, struct_size(ctrl, data.hws, desc->num_pll), GFP_KERNEL); + ctrl = devm_kzalloc_flex(dev, *ctrl, data.hws, desc->num_pll); if (!ctrl) return -ENOMEM; diff --git a/drivers/clk/sophgo/clk-sg2044.c b/drivers/clk/sophgo/clk-sg2044.c index f67f99c926b6..e98b08db8556 100644 --- a/drivers/clk/sophgo/clk-sg2044.c +++ b/drivers/clk/sophgo/clk-sg2044.c @@ -1774,7 +1774,7 @@ static int sg2044_clk_probe(struct platform_device *pdev) num_clks = desc->num_div + desc->num_gate + desc->num_mux; - ctrl = devm_kzalloc(dev, struct_size(ctrl, data.hws, num_clks), GFP_KERNEL); + ctrl = devm_kzalloc_flex(dev, *ctrl, data.hws, num_clks); if (!ctrl) return -ENOMEM; diff --git a/drivers/clk/spacemit/ccu_common.c b/drivers/clk/spacemit/ccu_common.c index 8696bb9cba2d..1ec07e2d5369 100644 --- a/drivers/clk/spacemit/ccu_common.c +++ b/drivers/clk/spacemit/ccu_common.c @@ -23,8 +23,7 @@ static int spacemit_ccu_register(struct device *dev, if (!data->hws) return 0; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, data->num), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, data->num); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/starfive/clk-starfive-jh7100-audio.c b/drivers/clk/starfive/clk-starfive-jh7100-audio.c index de1cf717e391..b9fb23018500 100644 --- a/drivers/clk/starfive/clk-starfive-jh7100-audio.c +++ b/drivers/clk/starfive/clk-starfive-jh7100-audio.c @@ -89,7 +89,7 @@ static int jh7100_audclk_probe(struct platform_device *pdev) unsigned int idx; int ret; - priv = devm_kzalloc(&pdev->dev, struct_size(priv, reg, JH7100_AUDCLK_END), GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, reg, JH7100_AUDCLK_END); if (!priv) return -ENOMEM; diff --git a/drivers/clk/starfive/clk-starfive-jh7100.c b/drivers/clk/starfive/clk-starfive-jh7100.c index 761e46ed0ffd..079da88ec66c 100644 --- a/drivers/clk/starfive/clk-starfive-jh7100.c +++ b/drivers/clk/starfive/clk-starfive-jh7100.c @@ -286,7 +286,7 @@ static int __init clk_starfive_jh7100_probe(struct platform_device *pdev) unsigned int idx; int ret; - priv = devm_kzalloc(&pdev->dev, struct_size(priv, reg, JH7100_CLK_PLL0_OUT), GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, reg, JH7100_CLK_PLL0_OUT); if (!priv) return -ENOMEM; diff --git a/drivers/clk/starfive/clk-starfive-jh7110-aon.c b/drivers/clk/starfive/clk-starfive-jh7110-aon.c index 6f67587f4335..fc8a4e78d5d9 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110-aon.c +++ b/drivers/clk/starfive/clk-starfive-jh7110-aon.c @@ -60,9 +60,7 @@ static int jh7110_aoncrg_probe(struct platform_device *pdev) unsigned int idx; int ret; - priv = devm_kzalloc(&pdev->dev, - struct_size(priv, reg, JH7110_AONCLK_END), - GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, reg, JH7110_AONCLK_END); if (!priv) return -ENOMEM; diff --git a/drivers/clk/starfive/clk-starfive-jh7110-isp.c b/drivers/clk/starfive/clk-starfive-jh7110-isp.c index c02c8b29a123..d39ce4a2a8e9 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110-isp.c +++ b/drivers/clk/starfive/clk-starfive-jh7110-isp.c @@ -104,13 +104,11 @@ static int jh7110_ispcrg_probe(struct platform_device *pdev) unsigned int idx; int ret; - priv = devm_kzalloc(&pdev->dev, - struct_size(priv, reg, JH7110_ISPCLK_END), - GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, reg, JH7110_ISPCLK_END); if (!priv) return -ENOMEM; - top = devm_kzalloc(&pdev->dev, sizeof(*top), GFP_KERNEL); + top = devm_kzalloc_obj(&pdev->dev, *top); if (!top) return -ENOMEM; diff --git a/drivers/clk/starfive/clk-starfive-jh7110-pll.c b/drivers/clk/starfive/clk-starfive-jh7110-pll.c index 56dc58a04f8a..b85f337eaf06 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110-pll.c +++ b/drivers/clk/starfive/clk-starfive-jh7110-pll.c @@ -459,7 +459,7 @@ static int __init jh7110_pll_probe(struct platform_device *pdev) unsigned int idx; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/clk/starfive/clk-starfive-jh7110-stg.c b/drivers/clk/starfive/clk-starfive-jh7110-stg.c index 2a5ad0e07d1d..1c11966203ad 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110-stg.c +++ b/drivers/clk/starfive/clk-starfive-jh7110-stg.c @@ -81,8 +81,7 @@ static int jh7110_stgcrg_probe(struct platform_device *pdev) unsigned int idx; int ret; - priv = devm_kzalloc(&pdev->dev, struct_size(priv, reg, JH7110_STGCLK_END), - GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, reg, JH7110_STGCLK_END); if (!priv) return -ENOMEM; diff --git a/drivers/clk/starfive/clk-starfive-jh7110-sys.c b/drivers/clk/starfive/clk-starfive-jh7110-sys.c index 847c0a39e5ab..44766b094b60 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110-sys.c +++ b/drivers/clk/starfive/clk-starfive-jh7110-sys.c @@ -410,9 +410,7 @@ static int __init jh7110_syscrg_probe(struct platform_device *pdev) int ret; struct clk *pllclk; - priv = devm_kzalloc(&pdev->dev, - struct_size(priv, reg, JH7110_SYSCLK_END), - GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, reg, JH7110_SYSCLK_END); if (!priv) return -ENOMEM; diff --git a/drivers/clk/starfive/clk-starfive-jh7110-vout.c b/drivers/clk/starfive/clk-starfive-jh7110-vout.c index aeba42cd3c44..d4181cce9c15 100644 --- a/drivers/clk/starfive/clk-starfive-jh7110-vout.c +++ b/drivers/clk/starfive/clk-starfive-jh7110-vout.c @@ -111,13 +111,11 @@ static int jh7110_voutcrg_probe(struct platform_device *pdev) unsigned int idx; int ret; - priv = devm_kzalloc(&pdev->dev, - struct_size(priv, reg, JH7110_VOUTCLK_END), - GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, reg, JH7110_VOUTCLK_END); if (!priv) return -ENOMEM; - top = devm_kzalloc(&pdev->dev, sizeof(*top), GFP_KERNEL); + top = devm_kzalloc_obj(&pdev->dev, *top); if (!top) return -ENOMEM; diff --git a/drivers/clk/starfive/clk-starfive-jh71x0.c b/drivers/clk/starfive/clk-starfive-jh71x0.c index 80e9157347eb..2d1713c1693b 100644 --- a/drivers/clk/starfive/clk-starfive-jh71x0.c +++ b/drivers/clk/starfive/clk-starfive-jh71x0.c @@ -209,7 +209,7 @@ static void jh71x0_clk_debug_init(struct clk_hw *hw, struct dentry *dentry) struct jh71x0_clk_priv *priv = jh71x0_priv_from(clk); struct debugfs_regset32 *regset; - regset = devm_kzalloc(priv->dev, sizeof(*regset), GFP_KERNEL); + regset = devm_kzalloc_obj(priv->dev, *regset); if (!regset) return; diff --git a/drivers/clk/stm32/clk-stm32-core.c b/drivers/clk/stm32/clk-stm32-core.c index e921c25a929c..edabc160a6f2 100644 --- a/drivers/clk/stm32/clk-stm32-core.c +++ b/drivers/clk/stm32/clk-stm32-core.c @@ -30,7 +30,7 @@ static int stm32_rcc_clock_init(struct device *dev, max_binding = data->maxbinding; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, max_binding), GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, max_binding); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/stm32/clk-stm32mp1.c b/drivers/clk/stm32/clk-stm32mp1.c index b265e3f3e94c..8f0a5495a1ad 100644 --- a/drivers/clk/stm32/clk-stm32mp1.c +++ b/drivers/clk/stm32/clk-stm32mp1.c @@ -490,7 +490,7 @@ static struct clk_hw *_get_stm32_mux(struct device *dev, void __iomem *base, struct clk_hw *mux_hw; if (cfg->mmux) { - mmux = devm_kzalloc(dev, sizeof(*mmux), GFP_KERNEL); + mmux = devm_kzalloc_obj(dev, *mmux); if (!mmux) return ERR_PTR(-ENOMEM); @@ -505,7 +505,7 @@ static struct clk_hw *_get_stm32_mux(struct device *dev, void __iomem *base, cfg->mmux->hws[cfg->mmux->nbr_clk++] = mux_hw; } else { - mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(dev, *mux); if (!mux) return ERR_PTR(-ENOMEM); @@ -527,7 +527,7 @@ static struct clk_hw *_get_stm32_div(struct device *dev, void __iomem *base, { struct clk_divider *div; - div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL); + div = devm_kzalloc_obj(dev, *div); if (!div) return ERR_PTR(-ENOMEM); @@ -551,7 +551,7 @@ static struct clk_hw *_get_stm32_gate(struct device *dev, void __iomem *base, struct clk_hw *gate_hw; if (cfg->mgate) { - mgate = devm_kzalloc(dev, sizeof(*mgate), GFP_KERNEL); + mgate = devm_kzalloc_obj(dev, *mgate); if (!mgate) return ERR_PTR(-ENOMEM); @@ -566,7 +566,7 @@ static struct clk_hw *_get_stm32_gate(struct device *dev, void __iomem *base, gate_hw = &mgate->gate.hw; } else { - gate = devm_kzalloc(dev, sizeof(*gate), GFP_KERNEL); + gate = devm_kzalloc_obj(dev, *gate); if (!gate) return ERR_PTR(-ENOMEM); @@ -907,7 +907,7 @@ static struct clk_hw *clk_register_pll(struct device *dev, const char *name, struct clk_hw *hw; int err; - element = devm_kzalloc(dev, sizeof(*element), GFP_KERNEL); + element = devm_kzalloc_obj(dev, *element); if (!element) return ERR_PTR(-ENOMEM); @@ -1046,7 +1046,7 @@ static struct clk_hw *clk_register_cktim(struct device *dev, const char *name, struct clk_hw *hw; int err; - tim_ker = devm_kzalloc(dev, sizeof(*tim_ker), GFP_KERNEL); + tim_ker = devm_kzalloc_obj(dev, *tim_ker); if (!tim_ker) return ERR_PTR(-ENOMEM); @@ -2215,8 +2215,7 @@ static int stm32_rcc_clock_init(struct device *dev, void __iomem *base, max_binding = data->maxbinding; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, max_binding), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, max_binding); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/sunxi/clk-sun6i-apb0-gates.c b/drivers/clk/sunxi/clk-sun6i-apb0-gates.c index b0a93b4fb051..a10ebd1998fb 100644 --- a/drivers/clk/sunxi/clk-sun6i-apb0-gates.c +++ b/drivers/clk/sunxi/clk-sun6i-apb0-gates.c @@ -59,15 +59,14 @@ static int sun6i_a31_apb0_gates_clk_probe(struct platform_device *pdev) if (!clk_parent) return -EINVAL; - clk_data = devm_kzalloc(&pdev->dev, sizeof(struct clk_onecell_data), - GFP_KERNEL); + clk_data = devm_kzalloc_obj(&pdev->dev, struct clk_onecell_data); if (!clk_data) return -ENOMEM; /* Worst-case size approximation and memory allocation */ ngates = find_last_bit(data->mask, SUN6I_APB0_GATES_MAX_SIZE); - clk_data->clks = devm_kcalloc(&pdev->dev, (ngates + 1), - sizeof(struct clk *), GFP_KERNEL); + clk_data->clks = devm_kzalloc_objs(&pdev->dev, struct clk *, + (ngates + 1)); if (!clk_data->clks) return -ENOMEM; diff --git a/drivers/clk/sunxi/clk-sun9i-mmc.c b/drivers/clk/sunxi/clk-sun9i-mmc.c index 91074017c04f..552c5a2818b5 100644 --- a/drivers/clk/sunxi/clk-sun9i-mmc.c +++ b/drivers/clk/sunxi/clk-sun9i-mmc.c @@ -101,7 +101,7 @@ static int sun9i_a80_mmc_config_clk_probe(struct platform_device *pdev) struct resource *r; int count, i, ret; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; @@ -116,8 +116,7 @@ static int sun9i_a80_mmc_config_clk_probe(struct platform_device *pdev) clk_data = &data->clk_data; clk_data->clk_num = count; - clk_data->clks = devm_kcalloc(&pdev->dev, count, sizeof(struct clk *), - GFP_KERNEL); + clk_data->clks = devm_kzalloc_objs(&pdev->dev, struct clk *, count); if (!clk_data->clks) return -ENOMEM; diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c index b0d03229c3be..0bb28f96274f 100644 --- a/drivers/clk/tegra/clk-bpmp.c +++ b/drivers/clk/tegra/clk-bpmp.c @@ -518,7 +518,7 @@ tegra_bpmp_clk_register(struct tegra_bpmp *bpmp, unsigned int i; int err; - clk = devm_kzalloc(bpmp->dev, struct_size(clk, parents, info->num_parents), GFP_KERNEL); + clk = devm_kzalloc_flex(bpmp->dev, *clk, parents, info->num_parents); if (!clk) return ERR_PTR(-ENOMEM); @@ -637,7 +637,7 @@ static int tegra_bpmp_register_clocks(struct tegra_bpmp *bpmp, bpmp->num_clocks = count; - bpmp->clocks = devm_kcalloc(bpmp->dev, count, sizeof(*bpmp->clocks), GFP_KERNEL); + bpmp->clocks = devm_kzalloc_objs(bpmp->dev, *bpmp->clocks, count); if (!bpmp->clocks) return -ENOMEM; diff --git a/drivers/clk/tegra/clk-device.c b/drivers/clk/tegra/clk-device.c index a75f71462df2..0183b1547f13 100644 --- a/drivers/clk/tegra/clk-device.c +++ b/drivers/clk/tegra/clk-device.c @@ -117,7 +117,7 @@ static int tegra_clock_probe(struct platform_device *pdev) if (!dev->pm_domain) return -EINVAL; - clk_dev = devm_kzalloc(dev, sizeof(*clk_dev), GFP_KERNEL); + clk_dev = devm_kzalloc_obj(dev, *clk_dev); if (!clk_dev) return -ENOMEM; diff --git a/drivers/clk/tegra/clk-dfll.c b/drivers/clk/tegra/clk-dfll.c index 22dc29432eff..8e7a7b769b2f 100644 --- a/drivers/clk/tegra/clk-dfll.c +++ b/drivers/clk/tegra/clk-dfll.c @@ -1948,7 +1948,7 @@ int tegra_dfll_register(struct platform_device *pdev, return -EINVAL; } - td = devm_kzalloc(&pdev->dev, sizeof(*td), GFP_KERNEL); + td = devm_kzalloc_obj(&pdev->dev, *td); if (!td) return -ENOMEM; td->dev = &pdev->dev; diff --git a/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c b/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c index 457a77c5bb62..112901b4606f 100644 --- a/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c +++ b/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c @@ -675,7 +675,7 @@ static int tegra124_dfll_fcpu_probe(struct platform_device *pdev) return -ENODEV; } - soc = devm_kzalloc(&pdev->dev, sizeof(*soc), GFP_KERNEL); + soc = devm_kzalloc_obj(&pdev->dev, *soc); if (!soc) return -ENOMEM; diff --git a/drivers/clk/tenstorrent/atlantis-prcm.c b/drivers/clk/tenstorrent/atlantis-prcm.c index 6d28aa2ba881..eccc8015da23 100644 --- a/drivers/clk/tenstorrent/atlantis-prcm.c +++ b/drivers/clk/tenstorrent/atlantis-prcm.c @@ -784,8 +784,7 @@ static int atlantis_prcm_clocks_register(struct device *dev, struct clk_hw_onecell_data *clk_data; int i, ret; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, data->num), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, data->num); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/thead/clk-th1520-ap.c b/drivers/clk/thead/clk-th1520-ap.c index 3a6847f1c950..abcb7637ba3b 100644 --- a/drivers/clk/thead/clk-th1520-ap.c +++ b/drivers/clk/thead/clk-th1520-ap.c @@ -1524,7 +1524,7 @@ static int th1520_clk_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, -ENODEV, "No device match data found\n"); - priv = devm_kzalloc(dev, struct_size(priv, hws, plat_data->nr_clks), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, hws, plat_data->nr_clks); if (!priv) return -ENOMEM; diff --git a/drivers/clk/ti/adpll.c b/drivers/clk/ti/adpll.c index 0d729c9980a5..bc5d5bdbeaca 100644 --- a/drivers/clk/ti/adpll.c +++ b/drivers/clk/ti/adpll.c @@ -488,10 +488,8 @@ static int ti_adpll_init_dco(struct ti_adpll_data *d) const char *postfix; int width, err; - d->outputs.clks = devm_kcalloc(d->dev, - MAX_ADPLL_OUTPUTS, - sizeof(struct clk *), - GFP_KERNEL); + d->outputs.clks = devm_kzalloc_objs(d->dev, struct clk *, + MAX_ADPLL_OUTPUTS); if (!d->outputs.clks) return -ENOMEM; @@ -583,7 +581,7 @@ static int ti_adpll_init_clkout(struct ti_adpll_data *d, struct clk *clock; int err; - co = devm_kzalloc(d->dev, sizeof(*co), GFP_KERNEL); + co = devm_kzalloc_obj(d->dev, *co); if (!co) return -ENOMEM; co->adpll = d; @@ -595,7 +593,7 @@ static int ti_adpll_init_clkout(struct ti_adpll_data *d, if (err) return err; - ops = devm_kzalloc(d->dev, sizeof(*ops), GFP_KERNEL); + ops = devm_kzalloc_obj(d->dev, *ops); if (!ops) return -ENOMEM; @@ -866,7 +864,7 @@ static int ti_adpll_probe(struct platform_device *pdev) struct resource *res; int err; - d = devm_kzalloc(dev, sizeof(*d), GFP_KERNEL); + d = devm_kzalloc_obj(dev, *d); if (!d) return -ENOMEM; d->dev = dev; @@ -888,10 +886,8 @@ static int ti_adpll_probe(struct platform_device *pdev) if (err) return err; - d->clocks = devm_kcalloc(d->dev, - TI_ADPLL_NR_CLOCKS, - sizeof(struct ti_adpll_clock), - GFP_KERNEL); + d->clocks = devm_kzalloc_objs(d->dev, struct ti_adpll_clock, + TI_ADPLL_NR_CLOCKS); if (!d->clocks) return -ENOMEM; diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c index fb41f55d44e7..895534167af8 100644 --- a/drivers/clk/ti/clk-dra7-atl.c +++ b/drivers/clk/ti/clk-dra7-atl.c @@ -212,7 +212,7 @@ static int of_dra7_atl_clk_probe(struct platform_device *pdev) if (!node) return -ENODEV; - cinfo = devm_kzalloc(&pdev->dev, sizeof(*cinfo), GFP_KERNEL); + cinfo = devm_kzalloc_obj(&pdev->dev, *cinfo); if (!cinfo) return -ENOMEM; diff --git a/drivers/clk/ultrarisc/clk-ultrarisc.c b/drivers/clk/ultrarisc/clk-ultrarisc.c index bbcd2234ea71..0cc5904c932f 100644 --- a/drivers/clk/ultrarisc/clk-ultrarisc.c +++ b/drivers/clk/ultrarisc/clk-ultrarisc.c @@ -151,7 +151,7 @@ static struct clk_hw *ultrarisc_clk_register_pll(struct device *dev, }; int ret; - pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); + pll = devm_kzalloc_obj(dev, *pll); if (!pll) return ERR_PTR(-ENOMEM); @@ -182,7 +182,7 @@ ultrarisc_clk_register_divider(struct device *dev, if (!lock) return ERR_PTR(-EINVAL); - divider = devm_kzalloc(dev, sizeof(*divider), GFP_KERNEL); + divider = devm_kzalloc_obj(dev, *divider); if (!divider) return ERR_PTR(-ENOMEM); @@ -350,15 +350,13 @@ int ultrarisc_clk_probe(struct platform_device *pdev, if (!soc_data) return -EINVAL; - lock = devm_kzalloc(dev, sizeof(*lock), GFP_KERNEL); + lock = devm_kzalloc_obj(dev, *lock); if (!lock) return -ENOMEM; spin_lock_init(lock); - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, - soc_data->num_clks), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, soc_data->num_clks); if (!clk_data) return -ENOMEM; diff --git a/drivers/clk/uniphier/clk-uniphier-core.c b/drivers/clk/uniphier/clk-uniphier-core.c index 37b495e68107..dc91286123b3 100644 --- a/drivers/clk/uniphier/clk-uniphier-core.c +++ b/drivers/clk/uniphier/clk-uniphier-core.c @@ -63,8 +63,7 @@ static int uniphier_clk_probe(struct platform_device *pdev) for (p = data; p->name; p++) clk_num = max(clk_num, p->idx + 1); - hw_data = devm_kzalloc(dev, struct_size(hw_data, hws, clk_num), - GFP_KERNEL); + hw_data = devm_kzalloc_flex(dev, *hw_data, hws, clk_num); if (!hw_data) return -ENOMEM; diff --git a/drivers/clk/uniphier/clk-uniphier-cpugear.c b/drivers/clk/uniphier/clk-uniphier-cpugear.c index 165c6832b722..d1a1992842e5 100644 --- a/drivers/clk/uniphier/clk-uniphier-cpugear.c +++ b/drivers/clk/uniphier/clk-uniphier-cpugear.c @@ -82,7 +82,7 @@ struct clk_hw *uniphier_clk_register_cpugear(struct device *dev, struct clk_init_data init = {}; int ret; - gear = devm_kzalloc(dev, sizeof(*gear), GFP_KERNEL); + gear = devm_kzalloc_obj(dev, *gear); if (!gear) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/uniphier/clk-uniphier-fixed-factor.c b/drivers/clk/uniphier/clk-uniphier-fixed-factor.c index c86683fce205..2184b92caf09 100644 --- a/drivers/clk/uniphier/clk-uniphier-fixed-factor.c +++ b/drivers/clk/uniphier/clk-uniphier-fixed-factor.c @@ -17,7 +17,7 @@ struct clk_hw *uniphier_clk_register_fixed_factor(struct device *dev, struct clk_fixed_factor *fix; int ret; - fix = devm_kzalloc(dev, sizeof(*fix), GFP_KERNEL); + fix = devm_kzalloc_obj(dev, *fix); if (!fix) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/uniphier/clk-uniphier-fixed-rate.c b/drivers/clk/uniphier/clk-uniphier-fixed-rate.c index 63f49d3bab80..720e26a5fd39 100644 --- a/drivers/clk/uniphier/clk-uniphier-fixed-rate.c +++ b/drivers/clk/uniphier/clk-uniphier-fixed-rate.c @@ -18,7 +18,7 @@ struct clk_hw *uniphier_clk_register_fixed_rate(struct device *dev, int ret; /* allocate fixed-rate clock */ - fixed = devm_kzalloc(dev, sizeof(*fixed), GFP_KERNEL); + fixed = devm_kzalloc_obj(dev, *fixed); if (!fixed) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/uniphier/clk-uniphier-gate.c b/drivers/clk/uniphier/clk-uniphier-gate.c index 9f49e6bb6b20..533704bdc8fe 100644 --- a/drivers/clk/uniphier/clk-uniphier-gate.c +++ b/drivers/clk/uniphier/clk-uniphier-gate.c @@ -65,7 +65,7 @@ struct clk_hw *uniphier_clk_register_gate(struct device *dev, struct uniphier_clk_gate *gate; int ret; - gate = devm_kzalloc(dev, sizeof(*gate), GFP_KERNEL); + gate = devm_kzalloc_obj(dev, *gate); if (!gate) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/uniphier/clk-uniphier-mux.c b/drivers/clk/uniphier/clk-uniphier-mux.c index a63ad4df8e65..60e9a10e1c12 100644 --- a/drivers/clk/uniphier/clk-uniphier-mux.c +++ b/drivers/clk/uniphier/clk-uniphier-mux.c @@ -62,7 +62,7 @@ struct clk_hw *uniphier_clk_register_mux(struct device *dev, struct uniphier_clk_mux *mux; int ret; - mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(dev, *mux); if (!mux) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c index 2127a949e56c..c6249b7b3461 100644 --- a/drivers/clk/ux500/clk-sysctrl.c +++ b/drivers/clk/ux500/clk-sysctrl.c @@ -140,7 +140,7 @@ static struct clk *clk_reg_sysctrl(struct device *dev, return ERR_PTR(-EINVAL); } - clk = devm_kzalloc(dev, sizeof(*clk), GFP_KERNEL); + clk = devm_kzalloc_obj(dev, *clk); if (!clk) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/versatile/clk-vexpress-osc.c b/drivers/clk/versatile/clk-vexpress-osc.c index 72e872ec6b7c..0ee1c5d6d705 100644 --- a/drivers/clk/versatile/clk-vexpress-osc.c +++ b/drivers/clk/versatile/clk-vexpress-osc.c @@ -69,7 +69,7 @@ static int vexpress_osc_probe(struct platform_device *pdev) u32 range[2]; int ret; - osc = devm_kzalloc(&pdev->dev, sizeof(*osc), GFP_KERNEL); + osc = devm_kzalloc_obj(&pdev->dev, *osc); if (!osc) return -ENOMEM; diff --git a/drivers/clk/visconti/clkc.c b/drivers/clk/visconti/clkc.c index 4018d1298880..a75163b69751 100644 --- a/drivers/clk/visconti/clkc.c +++ b/drivers/clk/visconti/clkc.c @@ -87,13 +87,13 @@ static struct clk_hw *visconti_clk_register_gate(struct device *dev, struct clk_hw *hw; int ret; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); pdata->name = pdata->fw_name = parent_name; - gate = devm_kzalloc(dev, sizeof(*gate), GFP_KERNEL); + gate = devm_kzalloc_obj(dev, *gate); if (!gate) return ERR_PTR(-ENOMEM); @@ -139,7 +139,7 @@ int visconti_clk_register_gates(struct visconti_clk_provider *ctx, char *dev_name; u8 rs_idx; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; @@ -191,7 +191,7 @@ struct visconti_clk_provider *visconti_init_clk(struct device *dev, struct visconti_clk_provider *ctx; int i; - ctx = devm_kzalloc(dev, struct_size(ctx, clk_data.hws, nr_clks), GFP_KERNEL); + ctx = devm_kzalloc_flex(dev, *ctx, clk_data.hws, nr_clks); if (!ctx) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/visconti/reset.c b/drivers/clk/visconti/reset.c index e3c3d7804612..78a56eecc431 100644 --- a/drivers/clk/visconti/reset.c +++ b/drivers/clk/visconti/reset.c @@ -92,7 +92,7 @@ int visconti_register_reset_controller(struct device *dev, { struct visconti_reset *reset; - reset = devm_kzalloc(dev, sizeof(*reset), GFP_KERNEL); + reset = devm_kzalloc_obj(dev, *reset); if (!reset) return -ENOMEM; diff --git a/drivers/clk/x86/clk-cgu-pll.c b/drivers/clk/x86/clk-cgu-pll.c index 409dbf55f4ca..4dc5ce9c7795 100644 --- a/drivers/clk/x86/clk-cgu-pll.c +++ b/drivers/clk/x86/clk-cgu-pll.c @@ -106,7 +106,7 @@ lgm_clk_register_pll(struct lgm_clk_provider *ctx, init.parent_data = list->parent_data; init.num_parents = list->num_parents; - pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); + pll = devm_kzalloc_obj(dev, *pll); if (!pll) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/x86/clk-cgu.c b/drivers/clk/x86/clk-cgu.c index 92ee05d75af2..e0c48c0f6d43 100644 --- a/drivers/clk/x86/clk-cgu.c +++ b/drivers/clk/x86/clk-cgu.c @@ -91,7 +91,7 @@ lgm_clk_register_mux(struct lgm_clk_provider *ctx, struct clk_hw *hw; int ret; - mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(dev, *mux); if (!mux) return ERR_PTR(-ENOMEM); @@ -203,7 +203,7 @@ lgm_clk_register_divider(struct lgm_clk_provider *ctx, struct clk_hw *hw; int ret; - div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL); + div = devm_kzalloc_obj(dev, *div); if (!div) return ERR_PTR(-ENOMEM); @@ -304,7 +304,7 @@ lgm_clk_register_gate(struct lgm_clk_provider *ctx, struct clk_hw *hw; int ret; - gate = devm_kzalloc(dev, sizeof(*gate), GFP_KERNEL); + gate = devm_kzalloc_obj(dev, *gate); if (!gate) return ERR_PTR(-ENOMEM); @@ -547,7 +547,7 @@ int lgm_clk_register_ddiv(struct lgm_clk_provider *ctx, struct clk_init_data init = {}; struct lgm_clk_ddiv *ddiv; - ddiv = devm_kzalloc(dev, sizeof(*ddiv), GFP_KERNEL); + ddiv = devm_kzalloc_obj(dev, *ddiv); if (!ddiv) return -ENOMEM; diff --git a/drivers/clk/x86/clk-lgm.c b/drivers/clk/x86/clk-lgm.c index f69455dd1c98..e3cad72431c3 100644 --- a/drivers/clk/x86/clk-lgm.c +++ b/drivers/clk/x86/clk-lgm.c @@ -428,8 +428,7 @@ static int lgm_cgu_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; int ret; - ctx = devm_kzalloc(dev, struct_size(ctx, clk_data.hws, CLK_NR_CLKS), - GFP_KERNEL); + ctx = devm_kzalloc_flex(dev, *ctx, clk_data.hws, CLK_NR_CLKS); if (!ctx) return -ENOMEM; diff --git a/drivers/clk/x86/clk-lpss-atom.c b/drivers/clk/x86/clk-lpss-atom.c index aa9d0bb98f8b..8b05e439cada 100644 --- a/drivers/clk/x86/clk-lpss-atom.c +++ b/drivers/clk/x86/clk-lpss-atom.c @@ -18,7 +18,7 @@ static int lpss_atom_clk_probe(struct platform_device *pdev) struct lpss_clk_data *drvdata; struct clk *clk; - drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-atom.c index 3a59f370cdea..8aa4a993a03b 100644 --- a/drivers/clk/x86/clk-pmc-atom.c +++ b/drivers/clk/x86/clk-pmc-atom.c @@ -155,7 +155,7 @@ static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id, struct clk_plt *pclk; int ret; - pclk = devm_kzalloc(&pdev->dev, sizeof(*pclk), GFP_KERNEL); + pclk = devm_kzalloc_obj(&pdev->dev, *pclk); if (!pclk) return ERR_PTR(-ENOMEM); @@ -209,7 +209,7 @@ static struct clk_plt_fixed *plt_clk_register_fixed_rate(struct platform_device { struct clk_plt_fixed *pclk; - pclk = devm_kzalloc(&pdev->dev, sizeof(*pclk), GFP_KERNEL); + pclk = devm_kzalloc_obj(&pdev->dev, *pclk); if (!pclk) return ERR_PTR(-ENOMEM); @@ -268,8 +268,7 @@ static const char **plt_clk_register_parents(struct platform_device *pdev, while (clks[nparents].name) nparents++; - data->parents = devm_kcalloc(&pdev->dev, nparents, - sizeof(*data->parents), GFP_KERNEL); + data->parents = devm_kzalloc_objs(&pdev->dev, *data->parents, nparents); if (!data->parents) return ERR_PTR(-ENOMEM); @@ -315,7 +314,7 @@ static int plt_clk_probe(struct platform_device *pdev) if (!pmc_data || !pmc_data->clks) return -EINVAL; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c index 71abd46b3593..9f8830b40122 100644 --- a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c +++ b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c @@ -941,7 +941,7 @@ static struct clk_hw *clk_wzrd_register_divf(struct device *dev, struct clk_hw *hw; int ret; - div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL); + div = devm_kzalloc_obj(dev, *div); if (!div) return ERR_PTR(-ENOMEM); @@ -985,7 +985,7 @@ static struct clk_hw *clk_wzrd_ver_register_divider(struct device *dev, struct clk_hw *hw; int ret; - div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL); + div = devm_kzalloc_obj(dev, *div); if (!div) return ERR_PTR(-ENOMEM); @@ -1031,7 +1031,7 @@ static struct clk_hw *clk_wzrd_register_divider(struct device *dev, struct clk_hw *hw; int ret; - div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL); + div = devm_kzalloc_obj(dev, *div); if (!div) return ERR_PTR(-ENOMEM); @@ -1298,8 +1298,8 @@ static int clk_wzrd_probe(struct platform_device *pdev) if (ret || nr_outputs > WZRD_NUM_OUTPUTS) return -EINVAL; - clk_wzrd = devm_kzalloc(&pdev->dev, struct_size(clk_wzrd, clk_data.hws, nr_outputs), - GFP_KERNEL); + clk_wzrd = devm_kzalloc_flex(&pdev->dev, *clk_wzrd, clk_data.hws, + nr_outputs); if (!clk_wzrd) return -ENOMEM; platform_set_drvdata(pdev, clk_wzrd); diff --git a/drivers/clk/xilinx/xlnx_vcu.c b/drivers/clk/xilinx/xlnx_vcu.c index ccd9d7c0b180..90bf38cba1e2 100644 --- a/drivers/clk/xilinx/xlnx_vcu.c +++ b/drivers/clk/xilinx/xlnx_vcu.c @@ -417,7 +417,7 @@ static struct clk_hw *xvcu_register_pll(struct device *dev, init.num_parents = 1; init.flags = flags; - pll = devm_kmalloc(dev, sizeof(*pll), GFP_KERNEL); + pll = devm_kmalloc_obj(dev, *pll); if (!pll) return ERR_PTR(-ENOMEM); @@ -454,7 +454,7 @@ static struct clk_hw *xvcu_clk_hw_register_leaf(struct device *dev, /* Protect register shared by clocks */ spinlock_t *lock; - lock = devm_kzalloc(dev, sizeof(*lock), GFP_KERNEL); + lock = devm_kzalloc_obj(dev, *lock); if (!lock) return ERR_PTR(-ENOMEM); spin_lock_init(lock); @@ -532,7 +532,7 @@ static int xvcu_register_clock_provider(struct xvcu_device *xvcu) struct clk_hw *hw; void __iomem *reg_base = xvcu->vcu_slcr_ba; - data = devm_kzalloc(dev, struct_size(data, hws, CLK_XVCU_NUM_CLOCKS), GFP_KERNEL); + data = devm_kzalloc_flex(dev, *data, hws, CLK_XVCU_NUM_CLOCKS); if (!data) return -ENOMEM; data->num = CLK_XVCU_NUM_CLOCKS; @@ -612,7 +612,7 @@ static int xvcu_probe(struct platform_device *pdev) void __iomem *regs; int ret; - xvcu = devm_kzalloc(&pdev->dev, sizeof(*xvcu), GFP_KERNEL); + xvcu = devm_kzalloc_obj(&pdev->dev, *xvcu); if (!xvcu) return -ENOMEM; diff --git a/drivers/clk/zte/clk-regmap.c b/drivers/clk/zte/clk-regmap.c index 022b2be7bb3d..81fbfb5a52c3 100644 --- a/drivers/clk/zte/clk-regmap.c +++ b/drivers/clk/zte/clk-regmap.c @@ -63,7 +63,7 @@ struct clk_hw *zx_clk_register_gate(struct device *dev, struct regmap *regmap, struct zte_clk_regmap *clk; int res; - clk = devm_kzalloc(dev, sizeof(*clk), GFP_KERNEL); + clk = devm_kzalloc_obj(dev, *clk); if (!clk) return ERR_PTR(-ENOMEM); @@ -141,7 +141,7 @@ struct clk_hw *zx_clk_register_divider(struct device *dev, struct regmap *regmap struct zte_clk_regmap *clk; int res; - clk = devm_kzalloc(dev, sizeof(*clk), GFP_KERNEL); + clk = devm_kzalloc_obj(dev, *clk); if (!clk) return ERR_PTR(-ENOMEM); @@ -215,7 +215,7 @@ struct clk_hw *zx_clk_register_mux(struct device *dev, struct regmap *regmap, for (i = 0; i < desc->num_parents; ++i) parents[i] = zx_get_parent(&desc->parents[i], clocks); - clk = devm_kzalloc(dev, sizeof(*clk), GFP_KERNEL); + clk = devm_kzalloc_obj(dev, *clk); if (!clk) return ERR_PTR(-ENOMEM); diff --git a/drivers/clk/zte/clk-zx.c b/drivers/clk/zte/clk-zx.c index aef0f7c753e6..ec5afe4aa18f 100644 --- a/drivers/clk/zte/clk-zx.c +++ b/drivers/clk/zte/clk-zx.c @@ -123,7 +123,7 @@ int zx_clk_common_probe(struct device *dev, struct device_node *of_node, if (IS_ERR(map)) return PTR_ERR(map); - clocks = devm_kcalloc(dev, data->num_clocks, sizeof(*clocks), GFP_KERNEL); + clocks = devm_kzalloc_objs(dev, *clocks, data->num_clocks); if (!clocks) return -ENOMEM; @@ -167,7 +167,7 @@ int zx_clk_common_probe(struct device *dev, struct device_node *of_node, clocks[i] = hw; } - exports = devm_kzalloc(dev, struct_size(exports, hws, data->num_exports), GFP_KERNEL); + exports = devm_kzalloc_flex(dev, *exports, hws, data->num_exports); if (!exports) return -ENOMEM; exports->num = data->num_exports; diff --git a/drivers/clk/zte/pll-zx.c b/drivers/clk/zte/pll-zx.c index d3687495d06c..3e89e69c86a1 100644 --- a/drivers/clk/zte/pll-zx.c +++ b/drivers/clk/zte/pll-zx.c @@ -522,7 +522,7 @@ struct clk_hw *zx_clk_register_pll(struct device *dev, struct regmap *regmap, unsigned int i; int res; - pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); + pll = devm_kzalloc_obj(dev, *pll); if (!pll) return ERR_PTR(-ENOMEM); diff --git a/drivers/clocksource/arm_arch_timer_mmio.c b/drivers/clocksource/arm_arch_timer_mmio.c index d678f764d3bb..975c31ff5cfd 100644 --- a/drivers/clocksource/arm_arch_timer_mmio.c +++ b/drivers/clocksource/arm_arch_timer_mmio.c @@ -378,13 +378,13 @@ static int arch_timer_mmio_probe(struct platform_device *pdev) np = pdev->dev.of_node; - at = devm_kmalloc(&pdev->dev, sizeof(*at), GFP_KERNEL | __GFP_ZERO); + at = devm_kmalloc_obj(&pdev->dev, *at, GFP_KERNEL | __GFP_ZERO); if (!at) return -ENOMEM; if (np) { - at->gt_block = devm_kmalloc(&pdev->dev, sizeof(*at->gt_block), - GFP_KERNEL | __GFP_ZERO); + at->gt_block = devm_kmalloc_obj(&pdev->dev, *at->gt_block, + GFP_KERNEL | __GFP_ZERO); if (!at->gt_block) return -ENOMEM; ret = of_populate_gt_block(pdev, at); diff --git a/drivers/clocksource/em_sti.c b/drivers/clocksource/em_sti.c index 73a3357d173d..1d62ed67fdd7 100644 --- a/drivers/clocksource/em_sti.c +++ b/drivers/clocksource/em_sti.c @@ -281,7 +281,7 @@ static int em_sti_probe(struct platform_device *pdev) struct em_sti_priv *p; int irq, ret; - p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(&pdev->dev, *p); if (p == NULL) return -ENOMEM; diff --git a/drivers/clocksource/ingenic-ost.c b/drivers/clocksource/ingenic-ost.c index e0ec33307c84..0bb3cf6c077d 100644 --- a/drivers/clocksource/ingenic-ost.c +++ b/drivers/clocksource/ingenic-ost.c @@ -77,7 +77,7 @@ static int __init ingenic_ost_probe(struct platform_device *pdev) if (!soc_info) return -EINVAL; - ost = devm_kzalloc(dev, sizeof(*ost), GFP_KERNEL); + ost = devm_kzalloc_obj(dev, *ost); if (!ost) return -ENOMEM; diff --git a/drivers/clocksource/timer-nxp-stm.c b/drivers/clocksource/timer-nxp-stm.c index 6fe098a4a33f..ca6c0df0e548 100644 --- a/drivers/clocksource/timer-nxp-stm.c +++ b/drivers/clocksource/timer-nxp-stm.c @@ -434,7 +434,7 @@ static int nxp_stm_timer_probe(struct platform_device *pdev) if (IS_ERR(clk)) return dev_err_probe(dev, PTR_ERR(clk), "Clock not found\n"); - stm_timer = devm_kzalloc(dev, sizeof(*stm_timer), GFP_KERNEL); + stm_timer = devm_kzalloc_obj(dev, *stm_timer); if (!stm_timer) return -ENOMEM; diff --git a/drivers/clocksource/timer-rzn1.c b/drivers/clocksource/timer-rzn1.c index 25ebebff3c63..918e80ce5c62 100644 --- a/drivers/clocksource/timer-rzn1.c +++ b/drivers/clocksource/timer-rzn1.c @@ -442,8 +442,7 @@ static int rzn1_timer_probe(struct platform_device *pdev) struct clk *clk; int ret; - tab_timers = devm_kcalloc(dev, RZN1_TIMER_NB_TIMERS, sizeof(*tab_timers), - GFP_KERNEL); + tab_timers = devm_kzalloc_objs(dev, *tab_timers, RZN1_TIMER_NB_TIMERS); if (!tab_timers) return -ENOMEM; diff --git a/drivers/clocksource/timer-stm32-lp.c b/drivers/clocksource/timer-stm32-lp.c index 3d804128c765..be97d453165e 100644 --- a/drivers/clocksource/timer-stm32-lp.c +++ b/drivers/clocksource/timer-stm32-lp.c @@ -224,7 +224,7 @@ static int stm32_clkevent_lp_probe(struct platform_device *pdev) unsigned long rate; int ret, irq; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c index bcf155fb9cac..b35454cd6610 100644 --- a/drivers/clocksource/timer-sun5i.c +++ b/drivers/clocksource/timer-sun5i.c @@ -264,7 +264,7 @@ static int sun5i_timer_probe(struct platform_device *pdev) unsigned long rate; int irq, ret; - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/clocksource/timer-tegra186.c b/drivers/clocksource/timer-tegra186.c index 0f626ecf61b0..7938fc4eb1a8 100644 --- a/drivers/clocksource/timer-tegra186.c +++ b/drivers/clocksource/timer-tegra186.c @@ -126,7 +126,7 @@ static struct tegra186_tmr *tegra186_tmr_create(struct tegra186_timer *tegra, unsigned int offset = 0x10000 + index * 0x10000; struct tegra186_tmr *tmr; - tmr = devm_kzalloc(tegra->dev, sizeof(*tmr), GFP_KERNEL); + tmr = devm_kzalloc_obj(tegra->dev, *tmr); if (!tmr) return ERR_PTR(-ENOMEM); @@ -349,7 +349,7 @@ static struct tegra186_wdt *tegra186_wdt_create(struct tegra186_timer *tegra, offset += tegra->soc->num_timers * 0x10000 + index * 0x10000; - wdt = devm_kzalloc(tegra->dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(tegra->dev, *wdt); if (!wdt) return ERR_PTR(-ENOMEM); @@ -466,7 +466,7 @@ static int tegra186_timer_probe(struct platform_device *pdev) int irq; int err; - tegra = devm_kzalloc(dev, sizeof(*tegra), GFP_KERNEL); + tegra = devm_kzalloc_obj(dev, *tegra); if (!tegra) return -ENOMEM; @@ -484,7 +484,7 @@ static int tegra186_timer_probe(struct platform_device *pdev) irq = err; - tegra->wdts = devm_kcalloc(dev, tegra->soc->num_wdts, sizeof(*tegra->wdts), GFP_KERNEL); + tegra->wdts = devm_kzalloc_objs(dev, *tegra->wdts, tegra->soc->num_wdts); if (!tegra->wdts) return -ENOMEM; diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c index c6aea234572c..de22cab48a62 100644 --- a/drivers/clocksource/timer-ti-dm.c +++ b/drivers/clocksource/timer-ti-dm.c @@ -1262,7 +1262,7 @@ static int omap_dm_timer_setup_clocksource(struct dmtimer *timer) timer->reserved = 1; - clksrc = devm_kzalloc(dev, sizeof(*clksrc), GFP_KERNEL); + clksrc = devm_kzalloc_obj(dev, *clksrc); if (!clksrc) return -ENOMEM; @@ -1354,7 +1354,7 @@ static int omap_dm_timer_setup_clockevent(struct dmtimer *timer) struct omap_dm_timer_clockevent *clkevt; int ret; - clkevt = devm_kzalloc(dev, sizeof(*clkevt), GFP_KERNEL); + clkevt = devm_kzalloc_obj(dev, *clkevt); if (!clkevt) return -ENOMEM; @@ -1418,7 +1418,7 @@ static int omap_dm_timer_probe(struct platform_device *pdev) return -ENODEV; } - timer = devm_kzalloc(dev, sizeof(*timer), GFP_KERNEL); + timer = devm_kzalloc_obj(dev, *timer); if (!timer) return -ENOMEM; diff --git a/drivers/counter/counter-sysfs.c b/drivers/counter/counter-sysfs.c index ed85da907982..c4aa74564657 100644 --- a/drivers/counter/counter-sysfs.c +++ b/drivers/counter/counter-sysfs.c @@ -536,7 +536,7 @@ static int counter_avail_attr_create(struct device *const dev, struct counter_attribute *counter_attr; struct device_attribute *dev_attr; - counter_attr = devm_kzalloc(dev, sizeof(*counter_attr), GFP_KERNEL); + counter_attr = devm_kzalloc_obj(dev, *counter_attr); if (!counter_attr) return -ENOMEM; @@ -574,7 +574,7 @@ static int counter_attr_create(struct device *const dev, struct counter_attribute *counter_attr; struct device_attribute *dev_attr; - counter_attr = devm_kzalloc(dev, sizeof(*counter_attr), GFP_KERNEL); + counter_attr = devm_kzalloc_obj(dev, *counter_attr); if (!counter_attr) return -ENOMEM; @@ -683,7 +683,7 @@ static int counter_name_attr_create(struct device *const dev, { struct counter_attribute *counter_attr; - counter_attr = devm_kzalloc(dev, sizeof(*counter_attr), GFP_KERNEL); + counter_attr = devm_kzalloc_obj(dev, *counter_attr); if (!counter_attr) return -ENOMEM; @@ -718,7 +718,7 @@ static int counter_comp_id_attr_create(struct device *const dev, struct counter_attribute *counter_attr; /* Allocate Counter attribute */ - counter_attr = devm_kzalloc(dev, sizeof(*counter_attr), GFP_KERNEL); + counter_attr = devm_kzalloc_obj(dev, *counter_attr); if (!counter_attr) return -ENOMEM; @@ -781,7 +781,7 @@ static int counter_array_attrs_create(struct device *const dev, return -ENOMEM; /* Allocate and configure array element */ - element = devm_kzalloc(dev, sizeof(*element), GFP_KERNEL); + element = devm_kzalloc_obj(dev, *element); if (!element) return -ENOMEM; element->type = array->type; @@ -1124,8 +1124,7 @@ int counter_sysfs_add(struct counter_device *const counter) struct counter_attribute *p; /* Allocate space for attribute groups (signals, counts, and ext) */ - cattr_groups = devm_kcalloc(dev, num_groups, sizeof(*cattr_groups), - GFP_KERNEL); + cattr_groups = devm_kzalloc_objs(dev, *cattr_groups, num_groups); if (!cattr_groups) return -ENOMEM; @@ -1139,13 +1138,12 @@ int counter_sysfs_add(struct counter_device *const counter) return err; /* Allocate attribute group pointers for association with device */ - dev->groups = devm_kcalloc(dev, num_groups + 1, sizeof(*dev->groups), - GFP_KERNEL); + dev->groups = devm_kzalloc_objs(dev, *dev->groups, num_groups + 1); if (!dev->groups) return -ENOMEM; /* Allocate space for attribute groups */ - groups = devm_kcalloc(dev, num_groups, sizeof(*groups), GFP_KERNEL); + groups = devm_kzalloc_objs(dev, *groups, num_groups); if (!groups) return -ENOMEM; @@ -1154,10 +1152,8 @@ int counter_sysfs_add(struct counter_device *const counter) groups[i].name = cattr_groups[i].name; /* Allocate space for attribute pointers */ - groups[i].attrs = devm_kcalloc(dev, - cattr_groups[i].num_attr + 1, - sizeof(*groups[i].attrs), - GFP_KERNEL); + groups[i].attrs = devm_kzalloc_objs(dev, *groups[i].attrs, + cattr_groups[i].num_attr + 1); if (!groups[i].attrs) return -ENOMEM; diff --git a/drivers/cpufreq/airoha-cpufreq.c b/drivers/cpufreq/airoha-cpufreq.c index 8283c528d0c1..b1dd5e286c2c 100644 --- a/drivers/cpufreq/airoha-cpufreq.c +++ b/drivers/cpufreq/airoha-cpufreq.c @@ -52,7 +52,7 @@ static int airoha_cpufreq_probe(struct platform_device *pdev) if (!cpu_dev) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c index 7d902856ac01..f7f250034c94 100644 --- a/drivers/cpufreq/brcmstb-avs-cpufreq.c +++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c @@ -438,8 +438,7 @@ brcm_avs_get_freq_table(struct device *dev, struct private_data *priv) * We allocate space for the 5 different P-STATES AVS, * plus extra space for a terminating element. */ - table = devm_kcalloc(dev, AVS_PSTATE_MAX + 1 + 1, sizeof(*table), - GFP_KERNEL); + table = devm_kzalloc_objs(dev, *table, AVS_PSTATE_MAX + 1 + 1); if (!table) return ERR_PTR(-ENOMEM); @@ -555,7 +554,7 @@ static int brcm_avs_prepare_init(struct platform_device *pdev) int ret; dev = &pdev->dev; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index 7d5079fd1688..eb15650f99bf 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -169,7 +169,7 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu) if (!cpu_dev) return -EPROBE_DEFER; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 731f5721ff1e..84f32478e021 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -400,8 +400,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) } /* Make imx6_soc_volt array's size same as arm opp number */ - imx6_soc_volt = devm_kcalloc(&pdev->dev, num, sizeof(*imx6_soc_volt), - GFP_KERNEL); + imx6_soc_volt = devm_kzalloc_objs(&pdev->dev, *imx6_soc_volt, num); if (imx6_soc_volt == NULL) { ret = -ENOMEM; goto free_freq_table; diff --git a/drivers/cpufreq/loongson3_cpufreq.c b/drivers/cpufreq/loongson3_cpufreq.c index aea7c31e155a..2eca082a8611 100644 --- a/drivers/cpufreq/loongson3_cpufreq.c +++ b/drivers/cpufreq/loongson3_cpufreq.c @@ -279,7 +279,7 @@ static int configure_freq_table(int cpu) boost_level = ret; freq_level = min(max_level, FREQ_MAX_LEVEL); - data = devm_kzalloc(&pdev->dev, struct_size(data, table, freq_level + 1), GFP_KERNEL); + data = devm_kzalloc_flex(&pdev->dev, *data, table, freq_level + 1); if (!data) return -ENOMEM; diff --git a/drivers/cpufreq/mediatek-cpufreq-hw.c b/drivers/cpufreq/mediatek-cpufreq-hw.c index ae4500ab4891..2c57371ad502 100644 --- a/drivers/cpufreq/mediatek-cpufreq-hw.c +++ b/drivers/cpufreq/mediatek-cpufreq-hw.c @@ -190,8 +190,7 @@ static int mtk_cpu_create_freq_table(struct platform_device *pdev, u32 temp, i, freq, prev_freq = 0; void __iomem *base_table; - data->table = devm_kcalloc(dev, LUT_MAX_ENTRIES + 1, - sizeof(*data->table), GFP_KERNEL); + data->table = devm_kzalloc_objs(dev, *data->table, LUT_MAX_ENTRIES + 1); if (!data->table) return -ENOMEM; @@ -229,7 +228,7 @@ static int mtk_cpu_resources_init(struct platform_device *pdev, int ret, i; int index; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; @@ -392,7 +391,7 @@ static int mtk_cpufreq_hw_driver_probe(struct platform_device *pdev) if (!data) return -EINVAL; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c index f9b1eca176eb..b3d059a2e42d 100644 --- a/drivers/cpufreq/mediatek-cpufreq.c +++ b/drivers/cpufreq/mediatek-cpufreq.c @@ -645,7 +645,7 @@ static int mtk_cpufreq_probe(struct platform_device *pdev) if (info) continue; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) { ret = dev_err_probe(&pdev->dev, -ENOMEM, "Failed to allocate dvfs_info\n"); diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index 060a460716f7..2f731ec31774 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -696,7 +696,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) if (!qcom_cpufreq.soc_data) return -ENODEV; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, num_domains), GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, num_domains); if (!clk_data) return -ENOMEM; diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c index 375f12d5d11a..efcbf3107ef5 100644 --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c @@ -507,8 +507,7 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) if (!ret) return -ENOENT; - drv = devm_kzalloc(&pdev->dev, struct_size(drv, cpus, num_possible_cpus()), - GFP_KERNEL); + drv = devm_kzalloc_flex(&pdev->dev, *drv, cpus, num_possible_cpus()); if (!drv) return -ENOMEM; diff --git a/drivers/cpufreq/tegra124-cpufreq.c b/drivers/cpufreq/tegra124-cpufreq.c index f8a76bbecef9..b0e23511bd05 100644 --- a/drivers/cpufreq/tegra124-cpufreq.c +++ b/drivers/cpufreq/tegra124-cpufreq.c @@ -64,7 +64,7 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev) if (!np) return -ENODEV; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/cpufreq/tegra186-cpufreq.c b/drivers/cpufreq/tegra186-cpufreq.c index 4fa6894f6371..549a678cf963 100644 --- a/drivers/cpufreq/tegra186-cpufreq.c +++ b/drivers/cpufreq/tegra186-cpufreq.c @@ -309,8 +309,7 @@ static struct cpufreq_frequency_table *tegra_cpufreq_bpmp_read_lut( (*num_rates)++; } - table = devm_kcalloc(&pdev->dev, *num_rates + 1, sizeof(*table), - GFP_KERNEL); + table = devm_kzalloc_objs(&pdev->dev, *table, *num_rates + 1); if (!table) { table = ERR_PTR(-ENOMEM); goto free; @@ -356,9 +355,8 @@ static int tegra186_cpufreq_probe(struct platform_device *pdev) int num_rates = 0; u32 edvd_val, cpu; - data = devm_kzalloc(&pdev->dev, - struct_size(data, clusters, TEGRA186_NUM_CLUSTERS), - GFP_KERNEL); + data = devm_kzalloc_flex(&pdev->dev, *data, clusters, + TEGRA186_NUM_CLUSTERS); if (!data) return -ENOMEM; diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c index 1eb96e9f3310..8599914f2194 100644 --- a/drivers/cpufreq/tegra194-cpufreq.c +++ b/drivers/cpufreq/tegra194-cpufreq.c @@ -663,8 +663,7 @@ tegra_cpufreq_bpmp_read_lut(struct platform_device *pdev, struct tegra_bpmp *bpm num_freqs += (delta_ndiv % freq_table_step_size) ? 1 : 0; - freq_table = devm_kcalloc(&pdev->dev, num_freqs + 1, - sizeof(*freq_table), GFP_KERNEL); + freq_table = devm_kzalloc_objs(&pdev->dev, *freq_table, num_freqs + 1); if (!freq_table) return ERR_PTR(-ENOMEM); @@ -713,7 +712,7 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) int err, i; u32 cpu; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; @@ -726,8 +725,8 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) return -EINVAL; } - data->bpmp_luts = devm_kcalloc(&pdev->dev, data->soc->num_clusters, - sizeof(*data->bpmp_luts), GFP_KERNEL); + data->bpmp_luts = devm_kzalloc_objs(&pdev->dev, *data->bpmp_luts, + data->soc->num_clusters); if (!data->bpmp_luts) return -ENOMEM; @@ -738,9 +737,8 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) return PTR_ERR(data->regs); } - data->cpu_data = devm_kcalloc(&pdev->dev, data->soc->num_clusters * - data->soc->maxcpus_per_cluster, - sizeof(*data->cpu_data), GFP_KERNEL); + data->cpu_data = devm_kzalloc_objs(&pdev->dev, *data->cpu_data, + data->soc->num_clusters * data->soc->maxcpus_per_cluster); if (!data->cpu_data) return -ENOMEM; diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c index 0f96492341f2..543bc99f1255 100644 --- a/drivers/cpufreq/ti-cpufreq.c +++ b/drivers/cpufreq/ti-cpufreq.c @@ -528,7 +528,7 @@ static int ti_cpufreq_probe(struct platform_device *pdev) if (!match) return -ENODEV; - opp_data = devm_kzalloc(&pdev->dev, sizeof(*opp_data), GFP_KERNEL); + opp_data = devm_kzalloc_obj(&pdev->dev, *opp_data); if (!opp_data) return -ENOMEM; diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index 0187d6a9096a..3c48876aef85 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -283,8 +283,7 @@ static int psci_dt_cpu_init_idle(struct device *dev, struct cpuidle_driver *drv, struct psci_cpuidle_data *data = per_cpu_ptr(&psci_cpuidle_data, cpu); state_count++; /* Add WFI state too */ - psci_states = devm_kcalloc(dev, state_count, sizeof(*psci_states), - GFP_KERNEL); + psci_states = devm_kzalloc_objs(dev, *psci_states, state_count); if (!psci_states) return -ENOMEM; @@ -370,7 +369,7 @@ static int psci_idle_init_cpu(struct device *dev, int cpu) if (ret) return ret; - drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(dev, *drv); if (!drv) return -ENOMEM; diff --git a/drivers/cpuidle/cpuidle-qcom-spm.c b/drivers/cpuidle/cpuidle-qcom-spm.c index 7ab6f68b96a8..12b81f0842ca 100644 --- a/drivers/cpuidle/cpuidle-qcom-spm.c +++ b/drivers/cpuidle/cpuidle-qcom-spm.c @@ -105,7 +105,7 @@ static int spm_cpuidle_register(struct device *cpuidle_dev, int cpu) if (!pdev) return -ENODEV; - data = devm_kzalloc(cpuidle_dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(cpuidle_dev, *data); if (!data) { put_device(&pdev->dev); return -ENOMEM; diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c index a13e90bb43bd..eacffd4c02fe 100644 --- a/drivers/cpuidle/cpuidle-riscv-sbi.c +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c @@ -245,7 +245,7 @@ static int sbi_cpuidle_dt_init_states(struct device *dev, if (!cpu_node) return -ENODEV; - states = devm_kcalloc(dev, state_count, sizeof(*states), GFP_KERNEL); + states = devm_kzalloc_objs(dev, *states, state_count); if (!states) return -ENOMEM; @@ -291,7 +291,7 @@ static int sbi_cpuidle_init_cpu(struct device *dev, int cpu) unsigned int state_count = 0; int ret = 0; - drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(dev, *drv); if (!drv) return -ENOMEM; diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c index 35ef0930e77f..b4ea7acfad99 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c @@ -327,7 +327,7 @@ static int sun4i_ss_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - ss = devm_kzalloc(&pdev->dev, sizeof(*ss), GFP_KERNEL); + ss = devm_kzalloc_obj(&pdev->dev, *ss); if (!ss) return -ENOMEM; diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c index 21762bd408e5..6f46c530fe26 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c @@ -696,8 +696,7 @@ static int sun8i_ce_allocate_chanlist(struct sun8i_ce_dev *ce) { int i, err; - ce->chanlist = devm_kcalloc(ce->dev, MAXFLOW, - sizeof(struct sun8i_ce_flow), GFP_KERNEL); + ce->chanlist = devm_kzalloc_objs(ce->dev, struct sun8i_ce_flow, MAXFLOW); if (!ce->chanlist) return -ENOMEM; @@ -932,7 +931,7 @@ static int sun8i_ce_probe(struct platform_device *pdev) int err, irq; u32 v; - ce = devm_kzalloc(&pdev->dev, sizeof(*ce), GFP_KERNEL); + ce = devm_kzalloc_obj(&pdev->dev, *ce); if (!ce) return -ENOMEM; diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c index 2167dd9f44c7..0a7362350d0f 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c @@ -521,8 +521,7 @@ static int allocate_flows(struct sun8i_ss_dev *ss) { int i, j, err; - ss->flows = devm_kcalloc(ss->dev, MAXFLOW, sizeof(struct sun8i_ss_flow), - GFP_KERNEL); + ss->flows = devm_kzalloc_objs(ss->dev, struct sun8i_ss_flow, MAXFLOW); if (!ss->flows) return -ENOMEM; @@ -783,7 +782,7 @@ static int sun8i_ss_probe(struct platform_device *pdev) int err, irq; u32 v; - ss = devm_kzalloc(&pdev->dev, sizeof(*ss), GFP_KERNEL); + ss = devm_kzalloc_obj(&pdev->dev, *ss); if (!ss) return -ENOMEM; diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c index acf18b71e54d..5b5b76882cba 100644 --- a/drivers/crypto/amcc/crypto4xx_core.c +++ b/drivers/crypto/amcc/crypto4xx_core.c @@ -1248,15 +1248,13 @@ static int crypto4xx_probe(struct platform_device *ofdev) of_node_put(np); - core_dev = devm_kzalloc( - &ofdev->dev, sizeof(struct crypto4xx_core_device), GFP_KERNEL); + core_dev = devm_kzalloc_obj(&ofdev->dev, struct crypto4xx_core_device); if (!core_dev) return -ENOMEM; dev_set_drvdata(dev, core_dev); core_dev->ofdev = ofdev; - core_dev->dev = devm_kzalloc( - &ofdev->dev, sizeof(struct crypto4xx_device), GFP_KERNEL); + core_dev->dev = devm_kzalloc_obj(&ofdev->dev, struct crypto4xx_device); if (!core_dev->dev) return -ENOMEM; diff --git a/drivers/crypto/amlogic/amlogic-gxl-core.c b/drivers/crypto/amlogic/amlogic-gxl-core.c index d5d84524c110..48dbdf452034 100644 --- a/drivers/crypto/amlogic/amlogic-gxl-core.c +++ b/drivers/crypto/amlogic/amlogic-gxl-core.c @@ -156,8 +156,7 @@ static int meson_allocate_chanlist(struct meson_dev *mc) { int i, err; - mc->chanlist = devm_kcalloc(mc->dev, MAXFLOW, - sizeof(struct meson_flow), GFP_KERNEL); + mc->chanlist = devm_kzalloc_objs(mc->dev, struct meson_flow, MAXFLOW); if (!mc->chanlist) return -ENOMEM; @@ -233,7 +232,7 @@ static int meson_crypto_probe(struct platform_device *pdev) struct meson_dev *mc; int err, i; - mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL); + mc = devm_kzalloc_obj(&pdev->dev, *mc); if (!mc) return -ENOMEM; diff --git a/drivers/crypto/aspeed/aspeed-acry.c b/drivers/crypto/aspeed/aspeed-acry.c index 97327ba2c24b..7ef7013aeb7d 100644 --- a/drivers/crypto/aspeed/aspeed-acry.c +++ b/drivers/crypto/aspeed/aspeed-acry.c @@ -708,8 +708,7 @@ static int aspeed_acry_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int rc; - acry_dev = devm_kzalloc(dev, sizeof(struct aspeed_acry_dev), - GFP_KERNEL); + acry_dev = devm_kzalloc_obj(dev, struct aspeed_acry_dev); if (!acry_dev) return -ENOMEM; diff --git a/drivers/crypto/aspeed/aspeed-hace.c b/drivers/crypto/aspeed/aspeed-hace.c index 6555d7b2afe5..4c44304ad866 100644 --- a/drivers/crypto/aspeed/aspeed-hace.c +++ b/drivers/crypto/aspeed/aspeed-hace.c @@ -103,8 +103,7 @@ static int aspeed_hace_probe(struct platform_device *pdev) struct aspeed_hace_dev *hace_dev; int rc; - hace_dev = devm_kzalloc(&pdev->dev, sizeof(struct aspeed_hace_dev), - GFP_KERNEL); + hace_dev = devm_kzalloc_obj(&pdev->dev, struct aspeed_hace_dev); if (!hace_dev) return -ENOMEM; diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c index 84392411b98d..cf6b5aa0269f 100644 --- a/drivers/crypto/atmel-aes.c +++ b/drivers/crypto/atmel-aes.c @@ -2332,7 +2332,7 @@ static int atmel_aes_probe(struct platform_device *pdev) struct resource *aes_res; int err; - aes_dd = devm_kzalloc(&pdev->dev, sizeof(*aes_dd), GFP_KERNEL); + aes_dd = devm_kzalloc_obj(&pdev->dev, *aes_dd); if (!aes_dd) return -ENOMEM; diff --git a/drivers/crypto/atmel-i2c.c b/drivers/crypto/atmel-i2c.c index 24bded47a32b..109e2a7ae0dc 100644 --- a/drivers/crypto/atmel-i2c.c +++ b/drivers/crypto/atmel-i2c.c @@ -375,7 +375,7 @@ int atmel_i2c_probe(struct i2c_client *client) return -EINVAL; } - i2c_priv = devm_kmalloc(dev, sizeof(*i2c_priv), GFP_KERNEL); + i2c_priv = devm_kmalloc_obj(dev, *i2c_priv); if (!i2c_priv) return -ENOMEM; diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c index 4b883a8dcf30..d0216e3c5c76 100644 --- a/drivers/crypto/atmel-sha.c +++ b/drivers/crypto/atmel-sha.c @@ -2587,7 +2587,7 @@ static int atmel_sha_probe(struct platform_device *pdev) struct resource *sha_res; int err; - sha_dd = devm_kzalloc(&pdev->dev, sizeof(*sha_dd), GFP_KERNEL); + sha_dd = devm_kzalloc_obj(&pdev->dev, *sha_dd); if (!sha_dd) return -ENOMEM; diff --git a/drivers/crypto/atmel-tdes.c b/drivers/crypto/atmel-tdes.c index 6b561b333ac6..c86d06169ab9 100644 --- a/drivers/crypto/atmel-tdes.c +++ b/drivers/crypto/atmel-tdes.c @@ -905,7 +905,7 @@ static int atmel_tdes_probe(struct platform_device *pdev) struct resource *tdes_res; int err; - tdes_dd = devm_kzalloc(&pdev->dev, sizeof(*tdes_dd), GFP_KERNEL); + tdes_dd = devm_kzalloc_obj(&pdev->dev, *tdes_dd); if (!tdes_dd) return -ENOMEM; diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c index 2bf8d71c86f4..e84ae65dbb63 100644 --- a/drivers/crypto/axis/artpec6_crypto.c +++ b/drivers/crypto/axis/artpec6_crypto.c @@ -2858,8 +2858,7 @@ static int artpec6_crypto_probe(struct platform_device *pdev) if (irq < 0) return -ENODEV; - ac = devm_kzalloc(&pdev->dev, sizeof(struct artpec6_crypto), - GFP_KERNEL); + ac = devm_kzalloc_obj(&pdev->dev, struct artpec6_crypto); if (!ac) return -ENOMEM; diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c index e9d9ca7441b6..8c3e9525c134 100644 --- a/drivers/crypto/bcm/cipher.c +++ b/drivers/crypto/bcm/cipher.c @@ -4290,8 +4290,8 @@ static int spu_mb_init(struct device *dev) struct mbox_client *mcl = &iproc_priv.mcl; int err, i; - iproc_priv.mbox = devm_kcalloc(dev, iproc_priv.spu.num_chan, - sizeof(struct mbox_chan *), GFP_KERNEL); + iproc_priv.mbox = devm_kzalloc_objs(dev, struct mbox_chan *, + iproc_priv.spu.num_chan); if (!iproc_priv.mbox) return -ENOMEM; diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c index c95afcb2c751..ef67122bef57 100644 --- a/drivers/crypto/caam/caamalg_qi2.c +++ b/drivers/crypto/caam/caamalg_qi2.c @@ -5223,7 +5223,7 @@ static int dpaa2_caam_probe(struct fsl_mc_device *dpseci_dev) dev = &dpseci_dev->dev; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c index 0eb43c862516..de5d5ab0f642 100644 --- a/drivers/crypto/caam/caamrng.c +++ b/drivers/crypto/caam/caamrng.c @@ -284,7 +284,7 @@ int caam_rng_init(struct device *ctrldev) if (!devres_open_group(ctrldev, caam_rng_init, GFP_KERNEL)) return -ENOMEM; - ctx = devm_kzalloc(ctrldev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(ctrldev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index 320be5d77737..6a9db10396b6 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -873,7 +873,7 @@ static int caam_probe(struct platform_device *pdev) bool reg_access = true; const struct caam_imx_data *imx_soc_data; - ctrlpriv = devm_kzalloc(&pdev->dev, sizeof(*ctrlpriv), GFP_KERNEL); + ctrlpriv = devm_kzalloc_obj(&pdev->dev, *ctrlpriv); if (!ctrlpriv) return -ENOMEM; diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index cf725a6ac0fb..0c03d7bcba19 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -542,8 +542,7 @@ static int caam_jr_init(struct device *dev) if (!jrp->outring) return -ENOMEM; - jrp->entinfo = devm_kcalloc(dev, JOBR_DEPTH, sizeof(*jrp->entinfo), - GFP_KERNEL); + jrp->entinfo = devm_kzalloc_objs(dev, *jrp->entinfo, JOBR_DEPTH); if (!jrp->entinfo) return -ENOMEM; @@ -612,7 +611,7 @@ static int caam_jr_probe(struct platform_device *pdev) return irq; jrdev = &pdev->dev; - jrpriv = devm_kzalloc(jrdev, sizeof(*jrpriv), GFP_KERNEL); + jrpriv = devm_kzalloc_obj(jrdev, *jrpriv); if (!jrpriv) return -ENOMEM; diff --git a/drivers/crypto/cavium/cpt/cptpf_main.c b/drivers/crypto/cavium/cpt/cptpf_main.c index 4234f9f156a3..c90b7b83f2f6 100644 --- a/drivers/crypto/cavium/cpt/cptpf_main.c +++ b/drivers/crypto/cavium/cpt/cptpf_main.c @@ -553,7 +553,7 @@ static int cpt_probe(struct pci_dev *pdev, const struct pci_device_id *ent) num_vfs = 4; } - cpt = devm_kzalloc(dev, sizeof(*cpt), GFP_KERNEL); + cpt = devm_kzalloc_obj(dev, *cpt); if (!cpt) return -ENOMEM; diff --git a/drivers/crypto/cavium/cpt/cptvf_main.c b/drivers/crypto/cavium/cpt/cptvf_main.c index e07448098ac0..ab7a2e83c0e7 100644 --- a/drivers/crypto/cavium/cpt/cptvf_main.c +++ b/drivers/crypto/cavium/cpt/cptvf_main.c @@ -665,7 +665,7 @@ static int cptvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) struct cpt_vf *cptvf; int err; - cptvf = devm_kzalloc(dev, sizeof(*cptvf), GFP_KERNEL); + cptvf = devm_kzalloc_obj(dev, *cptvf); if (!cptvf) return -ENOMEM; diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index aff3348b8351..41d9bdac95d7 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c @@ -477,7 +477,7 @@ struct ccp_device *ccp_alloc_struct(struct sp_device *sp) struct device *dev = sp->dev; struct ccp_device *ccp; - ccp = devm_kzalloc(dev, sizeof(*ccp), GFP_KERNEL); + ccp = devm_kzalloc_obj(dev, *ccp); if (!ccp) return NULL; ccp->dev = dev; diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c index b386a7063818..ebe62fe0b31f 100644 --- a/drivers/crypto/ccp/ccp-dmaengine.c +++ b/drivers/crypto/ccp/ccp-dmaengine.c @@ -675,9 +675,8 @@ int ccp_dmaengine_register(struct ccp_device *ccp) if (!dmaengine) return 0; - ccp->ccp_dma_chan = devm_kcalloc(ccp->dev, ccp->cmd_q_count, - sizeof(*(ccp->ccp_dma_chan)), - GFP_KERNEL); + ccp->ccp_dma_chan = devm_kzalloc_objs(ccp->dev, *(ccp->ccp_dma_chan), + ccp->cmd_q_count); if (!ccp->ccp_dma_chan) return -ENOMEM; diff --git a/drivers/crypto/ccp/dbc.c b/drivers/crypto/ccp/dbc.c index 4db49a14550c..0a2065d7308f 100644 --- a/drivers/crypto/ccp/dbc.c +++ b/drivers/crypto/ccp/dbc.c @@ -195,7 +195,7 @@ int dbc_dev_init(struct psp_device *psp) struct psp_dbc_device *dbc_dev; int ret; - dbc_dev = devm_kzalloc(dev, sizeof(*dbc_dev), GFP_KERNEL); + dbc_dev = devm_kzalloc_obj(dev, *dbc_dev); if (!dbc_dev) return -ENOMEM; diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c index 1b8ed3389733..d4b145bcf78b 100644 --- a/drivers/crypto/ccp/platform-access.c +++ b/drivers/crypto/ccp/platform-access.c @@ -208,7 +208,7 @@ int platform_access_dev_init(struct psp_device *psp) struct device *dev = psp->dev; struct psp_platform_access_device *pa_dev; - pa_dev = devm_kzalloc(dev, sizeof(*pa_dev), GFP_KERNEL); + pa_dev = devm_kzalloc_obj(dev, *pa_dev); if (!pa_dev) return -ENOMEM; diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c index b14ce51065d5..4e64217f8c2d 100644 --- a/drivers/crypto/ccp/psp-dev.c +++ b/drivers/crypto/ccp/psp-dev.c @@ -109,7 +109,7 @@ static struct psp_device *psp_alloc_struct(struct sp_device *sp) struct device *dev = sp->dev; struct psp_device *psp; - psp = devm_kzalloc(dev, sizeof(*psp), GFP_KERNEL); + psp = devm_kzalloc_obj(dev, *psp); if (!psp) return NULL; diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c index 5c996ab63895..ba0325979f61 100644 --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -2854,7 +2854,7 @@ int sev_dev_init(struct psp_device *psp) return 0; } - sev = devm_kzalloc(dev, sizeof(*sev), GFP_KERNEL); + sev = devm_kzalloc_obj(dev, *sev); if (!sev) goto e_err; diff --git a/drivers/crypto/ccp/sfs.c b/drivers/crypto/ccp/sfs.c index 530141f8bc74..e4a81fcb11fb 100644 --- a/drivers/crypto/ccp/sfs.c +++ b/drivers/crypto/ccp/sfs.c @@ -258,7 +258,7 @@ int sfs_dev_init(struct psp_device *psp) struct page *page; int ret = -ENOMEM; - sfs_dev = devm_kzalloc(dev, sizeof(*sfs_dev), GFP_KERNEL); + sfs_dev = devm_kzalloc_obj(dev, *sfs_dev); if (!sfs_dev) return -ENOMEM; diff --git a/drivers/crypto/ccp/sp-dev.c b/drivers/crypto/ccp/sp-dev.c index f204aa5df96e..331fa730bc41 100644 --- a/drivers/crypto/ccp/sp-dev.c +++ b/drivers/crypto/ccp/sp-dev.c @@ -178,7 +178,7 @@ struct sp_device *sp_alloc_struct(struct device *dev) { struct sp_device *sp; - sp = devm_kzalloc(dev, sizeof(*sp), GFP_KERNEL); + sp = devm_kzalloc_obj(dev, *sp); if (!sp) return NULL; diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c index ede6ff9ad0c2..892dc00c25c2 100644 --- a/drivers/crypto/ccp/sp-pci.c +++ b/drivers/crypto/ccp/sp-pci.c @@ -242,7 +242,7 @@ static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (!sp) goto e_err; - sp_pci = devm_kzalloc(dev, sizeof(*sp_pci), GFP_KERNEL); + sp_pci = devm_kzalloc_obj(dev, *sp_pci); if (!sp_pci) goto e_err; diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c index c7ac840cbe13..786761707937 100644 --- a/drivers/crypto/ccp/sp-platform.c +++ b/drivers/crypto/ccp/sp-platform.c @@ -107,7 +107,7 @@ static int sp_platform_probe(struct platform_device *pdev) if (!sp) goto e_err; - sp_platform = devm_kzalloc(dev, sizeof(*sp_platform), GFP_KERNEL); + sp_platform = devm_kzalloc_obj(dev, *sp_platform); if (!sp_platform) goto e_err; diff --git a/drivers/crypto/ccp/tee-dev.c b/drivers/crypto/ccp/tee-dev.c index 3e3645980e89..4bdc41e6d914 100644 --- a/drivers/crypto/ccp/tee-dev.c +++ b/drivers/crypto/ccp/tee-dev.c @@ -193,7 +193,7 @@ int tee_dev_init(struct psp_device *psp) int ret; ret = -ENOMEM; - tee = devm_kzalloc(dev, sizeof(*tee), GFP_KERNEL); + tee = devm_kzalloc_obj(dev, *tee); if (!tee) goto e_err; diff --git a/drivers/crypto/ccree/cc_aead.c b/drivers/crypto/ccree/cc_aead.c index d57a98f89e53..849b18a44c61 100644 --- a/drivers/crypto/ccree/cc_aead.c +++ b/drivers/crypto/ccree/cc_aead.c @@ -2564,7 +2564,7 @@ static struct cc_crypto_alg *cc_create_aead_alg(struct cc_alg_template *tmpl, struct cc_crypto_alg *t_alg; struct aead_alg *alg; - t_alg = devm_kzalloc(dev, sizeof(*t_alg), GFP_KERNEL); + t_alg = devm_kzalloc_obj(dev, *t_alg); if (!t_alg) return ERR_PTR(-ENOMEM); @@ -2615,7 +2615,7 @@ int cc_aead_alloc(struct cc_drvdata *drvdata) int alg; struct device *dev = drvdata_to_dev(drvdata); - aead_handle = devm_kmalloc(dev, sizeof(*aead_handle), GFP_KERNEL); + aead_handle = devm_kmalloc_obj(dev, *aead_handle); if (!aead_handle) { rc = -ENOMEM; goto fail0; diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c index 5339b3796c80..039039141609 100644 --- a/drivers/crypto/ccree/cc_cipher.c +++ b/drivers/crypto/ccree/cc_cipher.c @@ -1379,7 +1379,7 @@ static struct cc_crypto_alg *cc_create_alg(const struct cc_alg_template *tmpl, struct cc_crypto_alg *t_alg; struct skcipher_alg *alg; - t_alg = devm_kzalloc(dev, sizeof(*t_alg), GFP_KERNEL); + t_alg = devm_kzalloc_obj(dev, *t_alg); if (!t_alg) return ERR_PTR(-ENOMEM); diff --git a/drivers/crypto/ccree/cc_debugfs.c b/drivers/crypto/ccree/cc_debugfs.c index 8f008f024f8f..380cd3a46d46 100644 --- a/drivers/crypto/ccree/cc_debugfs.c +++ b/drivers/crypto/ccree/cc_debugfs.c @@ -65,7 +65,7 @@ int cc_debugfs_init(struct cc_drvdata *drvdata) struct device *dev = drvdata_to_dev(drvdata); struct debugfs_regset32 *regset, *verset; - regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL); + regset = devm_kzalloc_obj(dev, *regset); if (!regset) return -ENOMEM; @@ -80,7 +80,7 @@ int cc_debugfs_init(struct cc_drvdata *drvdata) debugfs_create_regset32("regs", 0400, drvdata->dir, regset); debugfs_create_bool("coherent", 0400, drvdata->dir, &drvdata->coherent); - verset = devm_kzalloc(dev, sizeof(*verset), GFP_KERNEL); + verset = devm_kzalloc_obj(dev, *verset); /* Failing here is not important enough to fail the module load */ if (!verset) return 0; diff --git a/drivers/crypto/ccree/cc_driver.c b/drivers/crypto/ccree/cc_driver.c index 28a23cd572d6..fdd4b74953a7 100644 --- a/drivers/crypto/ccree/cc_driver.c +++ b/drivers/crypto/ccree/cc_driver.c @@ -316,7 +316,7 @@ static int init_cc_resources(struct platform_device *plat_dev) int irq; int rc = 0; - new_drvdata = devm_kzalloc(dev, sizeof(*new_drvdata), GFP_KERNEL); + new_drvdata = devm_kzalloc_obj(dev, *new_drvdata); if (!new_drvdata) return -ENOMEM; diff --git a/drivers/crypto/ccree/cc_fips.c b/drivers/crypto/ccree/cc_fips.c index 702aefc21447..b6f27188c12f 100644 --- a/drivers/crypto/ccree/cc_fips.c +++ b/drivers/crypto/ccree/cc_fips.c @@ -136,7 +136,7 @@ int cc_fips_init(struct cc_drvdata *p_drvdata) if (p_drvdata->hw_rev < CC_HW_REV_712) return 0; - fips_h = devm_kzalloc(dev, sizeof(*fips_h), GFP_KERNEL); + fips_h = devm_kzalloc_obj(dev, *fips_h); if (!fips_h) return -ENOMEM; diff --git a/drivers/crypto/ccree/cc_hash.c b/drivers/crypto/ccree/cc_hash.c index 5de721a2ca30..949ba58ebf2d 100644 --- a/drivers/crypto/ccree/cc_hash.c +++ b/drivers/crypto/ccree/cc_hash.c @@ -1827,7 +1827,7 @@ static struct cc_hash_alg *cc_alloc_hash_alg(struct cc_hash_template *template, struct crypto_alg *alg; struct ahash_alg *halg; - t_crypto_alg = devm_kzalloc(dev, sizeof(*t_crypto_alg), GFP_KERNEL); + t_crypto_alg = devm_kzalloc_obj(dev, *t_crypto_alg); if (!t_crypto_alg) return ERR_PTR(-ENOMEM); @@ -1956,7 +1956,7 @@ int cc_hash_alloc(struct cc_drvdata *drvdata) int rc = 0; int alg; - hash_handle = devm_kzalloc(dev, sizeof(*hash_handle), GFP_KERNEL); + hash_handle = devm_kzalloc_obj(dev, *hash_handle); if (!hash_handle) return -ENOMEM; diff --git a/drivers/crypto/gemini/sl3516-ce-core.c b/drivers/crypto/gemini/sl3516-ce-core.c index c1df5f96ea42..ac0e6ef2b7b1 100644 --- a/drivers/crypto/gemini/sl3516-ce-core.c +++ b/drivers/crypto/gemini/sl3516-ce-core.c @@ -398,7 +398,7 @@ static int sl3516_ce_probe(struct platform_device *pdev) int err, irq; u32 v; - ce = devm_kzalloc(&pdev->dev, sizeof(*ce), GFP_KERNEL); + ce = devm_kzalloc_obj(&pdev->dev, *ce); if (!ce) return -ENOMEM; diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c index fd3c34daceb7..4f8851468c91 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_main.c +++ b/drivers/crypto/hisilicon/hpre/hpre_main.c @@ -1043,7 +1043,7 @@ static int hpre_pf_comm_regs_debugfs_init(struct hisi_qm *qm) struct device *dev = &qm->pdev->dev; struct debugfs_regset32 *regset; - regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL); + regset = devm_kzalloc_obj(dev, *regset); if (!regset) return -ENOMEM; @@ -1074,7 +1074,7 @@ static int hpre_cluster_debugfs_init(struct hisi_qm *qm) return -EINVAL; tmp_d = debugfs_create_dir(buf, qm->debug.debug_root); - regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL); + regset = devm_kzalloc_obj(dev, *regset); if (!regset) return -ENOMEM; @@ -1203,7 +1203,7 @@ static int hpre_pre_store_cap_reg(struct hisi_qm *qm) size_t i, size; size = ARRAY_SIZE(hpre_cap_query_info); - hpre_cap = devm_kcalloc(dev, size, sizeof(*hpre_cap), GFP_KERNEL); + hpre_cap = devm_kzalloc_objs(dev, *hpre_cap, size); if (!hpre_cap) return -ENOMEM; @@ -1581,7 +1581,7 @@ static int hpre_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct hpre *hpre; int ret; - hpre = devm_kzalloc(&pdev->dev, sizeof(*hpre), GFP_KERNEL); + hpre = devm_kzalloc_obj(&pdev->dev, *hpre); if (!hpre) return -ENOMEM; diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index ce6266fcd74d..5f223e3487c7 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -5731,7 +5731,7 @@ static int qm_pre_store_caps(struct hisi_qm *qm) size_t i, size; size = ARRAY_SIZE(qm_cap_query_info); - qm_cap = devm_kcalloc(&pdev->dev, sizeof(*qm_cap), size, GFP_KERNEL); + qm_cap = devm_kzalloc_objs(&pdev->dev, *qm_cap, size); if (!qm_cap) return -ENOMEM; diff --git a/drivers/crypto/hisilicon/sec2/sec_main.c b/drivers/crypto/hisilicon/sec2/sec_main.c index 1e0412c70c72..dcadcd99aeb1 100644 --- a/drivers/crypto/hisilicon/sec2/sec_main.c +++ b/drivers/crypto/hisilicon/sec2/sec_main.c @@ -953,7 +953,7 @@ static int sec_core_debug_init(struct hisi_qm *qm) tmp_d = debugfs_create_dir("sec_dfx", qm->debug.debug_root); - regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL); + regset = devm_kzalloc_obj(dev, *regset); if (!regset) return -ENOMEM; @@ -1274,7 +1274,7 @@ static int sec_pre_store_cap_reg(struct hisi_qm *qm) size_t i, size; size = ARRAY_SIZE(sec_cap_query_info); - sec_cap = devm_kcalloc(&pdev->dev, size, sizeof(*sec_cap), GFP_KERNEL); + sec_cap = devm_kzalloc_objs(&pdev->dev, *sec_cap, size); if (!sec_cap) return -ENOMEM; @@ -1413,7 +1413,7 @@ static int sec_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct hisi_qm *qm; int ret; - sec = devm_kzalloc(&pdev->dev, sizeof(*sec), GFP_KERNEL); + sec = devm_kzalloc_obj(&pdev->dev, *sec); if (!sec) return -ENOMEM; diff --git a/drivers/crypto/hisilicon/zip/zip_main.c b/drivers/crypto/hisilicon/zip/zip_main.c index 10091ad4a6a8..1c7ae10cc272 100644 --- a/drivers/crypto/hisilicon/zip/zip_main.c +++ b/drivers/crypto/hisilicon/zip/zip_main.c @@ -907,7 +907,7 @@ static int hisi_zip_core_debug_init(struct hisi_qm *qm) scnprintf(buf, sizeof(buf), "decomp_core%d", i - zip_comp_core_num); - regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL); + regset = devm_kzalloc_obj(dev, *regset); if (!regset) return -ENOENT; @@ -1361,7 +1361,7 @@ static int hisi_zip_pf_probe_init(struct hisi_zip *hisi_zip) struct hisi_zip_ctrl *ctrl; int ret; - ctrl = devm_kzalloc(&qm->pdev->dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(&qm->pdev->dev, *ctrl); if (!ctrl) return -ENOMEM; @@ -1389,7 +1389,7 @@ static int zip_pre_store_cap_reg(struct hisi_qm *qm) size_t i, size; size = ARRAY_SIZE(zip_cap_query_info); - zip_cap = devm_kcalloc(&pdev->dev, size, sizeof(*zip_cap), GFP_KERNEL); + zip_cap = devm_kzalloc_objs(&pdev->dev, *zip_cap, size); if (!zip_cap) return -ENOMEM; @@ -1524,7 +1524,7 @@ static int hisi_zip_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct hisi_qm *qm; int ret; - hisi_zip = devm_kzalloc(&pdev->dev, sizeof(*hisi_zip), GFP_KERNEL); + hisi_zip = devm_kzalloc_obj(&pdev->dev, *hisi_zip); if (!hisi_zip) return -ENOMEM; diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c index 1ccfc0eccc73..a958a58e9c4a 100644 --- a/drivers/crypto/img-hash.c +++ b/drivers/crypto/img-hash.c @@ -926,7 +926,7 @@ static int img_hash_probe(struct platform_device *pdev) int irq; int err; - hdev = devm_kzalloc(dev, sizeof(*hdev), GFP_KERNEL); + hdev = devm_kzalloc_obj(dev, *hdev); if (hdev == NULL) return -ENOMEM; diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c index e62785952b0d..50a66a3b4a2f 100644 --- a/drivers/crypto/inside-secure/eip93/eip93-main.c +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c @@ -415,7 +415,7 @@ static int eip93_crypto_probe(struct platform_device *pdev) u32 ver, algo_flags; int ret; - eip93 = devm_kzalloc(dev, struct_size(eip93, ring, 1), GFP_KERNEL); + eip93 = devm_kzalloc_flex(dev, *eip93, ring, 1); if (!eip93) return -ENOMEM; diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c index 71b920e17e98..c8b559bf084f 100644 --- a/drivers/crypto/inside-secure/safexcel.c +++ b/drivers/crypto/inside-secure/safexcel.c @@ -1609,9 +1609,7 @@ static int safexcel_probe_generic(void *pdev, } /* Register the ring IRQ handlers and configure the rings */ - priv->ring = devm_kcalloc(dev, priv->config.rings, - sizeof(*priv->ring), - GFP_KERNEL); + priv->ring = devm_kzalloc_objs(dev, *priv->ring, priv->config.rings); if (!priv->ring) return -ENOMEM; @@ -1628,16 +1626,15 @@ static int safexcel_probe_generic(void *pdev, goto err_cleanup_rings; } - priv->ring[i].rdr_req = devm_kcalloc(dev, - EIP197_DEFAULT_RING_SIZE, - sizeof(*priv->ring[i].rdr_req), - GFP_KERNEL); + priv->ring[i].rdr_req = devm_kzalloc_objs(dev, + *priv->ring[i].rdr_req, + EIP197_DEFAULT_RING_SIZE); if (!priv->ring[i].rdr_req) { ret = -ENOMEM; goto err_cleanup_rings; } - ring_irq = devm_kzalloc(dev, sizeof(*ring_irq), GFP_KERNEL); + ring_irq = devm_kzalloc_obj(dev, *ring_irq); if (!ring_irq) { ret = -ENOMEM; goto err_cleanup_rings; @@ -1737,7 +1734,7 @@ static int safexcel_probe(struct platform_device *pdev) struct safexcel_crypto_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -1891,7 +1888,7 @@ static int safexcel_pci_probe(struct pci_dev *pdev, ent->vendor, ent->device, ent->subvendor, ent->subdevice, ent->driver_data); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/crypto/intel/keembay/keembay-ocs-aes-core.c b/drivers/crypto/intel/keembay/keembay-ocs-aes-core.c index 660830c36e14..91fc0991a1e4 100644 --- a/drivers/crypto/intel/keembay/keembay-ocs-aes-core.c +++ b/drivers/crypto/intel/keembay/keembay-ocs-aes-core.c @@ -1585,7 +1585,7 @@ static int kmb_ocs_aes_probe(struct platform_device *pdev) struct ocs_aes_dev *aes_dev; int rc; - aes_dev = devm_kzalloc(dev, sizeof(*aes_dev), GFP_KERNEL); + aes_dev = devm_kzalloc_obj(dev, *aes_dev); if (!aes_dev) return -ENOMEM; diff --git a/drivers/crypto/intel/keembay/keembay-ocs-ecc.c b/drivers/crypto/intel/keembay/keembay-ocs-ecc.c index 9bdee39dc4e1..e8d6001be894 100644 --- a/drivers/crypto/intel/keembay/keembay-ocs-ecc.c +++ b/drivers/crypto/intel/keembay/keembay-ocs-ecc.c @@ -872,7 +872,7 @@ static int kmb_ocs_ecc_probe(struct platform_device *pdev) struct ocs_ecc_dev *ecc_dev; int rc; - ecc_dev = devm_kzalloc(dev, sizeof(*ecc_dev), GFP_KERNEL); + ecc_dev = devm_kzalloc_obj(dev, *ecc_dev); if (!ecc_dev) return -ENOMEM; diff --git a/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c b/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c index 9a67bb4ecc82..c2bc05901418 100644 --- a/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c +++ b/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c @@ -1179,7 +1179,7 @@ static int kmb_ocs_hcu_probe(struct platform_device *pdev) struct ocs_hcu_dev *hcu_dev; int rc; - hcu_dev = devm_kzalloc(dev, sizeof(*hcu_dev), GFP_KERNEL); + hcu_dev = devm_kzalloc_obj(dev, *hcu_dev); if (!hcu_dev) return -ENOMEM; diff --git a/drivers/crypto/intel/qat/qat_420xx/adf_drv.c b/drivers/crypto/intel/qat/qat_420xx/adf_drv.c index 0f0827e2b0bd..7f6da12ab757 100644 --- a/drivers/crypto/intel/qat/qat_420xx/adf_drv.c +++ b/drivers/crypto/intel/qat/qat_420xx/adf_drv.c @@ -50,7 +50,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return -EINVAL; } - accel_dev = devm_kzalloc(&pdev->dev, sizeof(*accel_dev), GFP_KERNEL); + accel_dev = devm_kzalloc_obj(&pdev->dev, *accel_dev); if (!accel_dev) return -ENOMEM; @@ -69,7 +69,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) accel_dev->owner = THIS_MODULE; /* Allocate and initialise device hardware meta-data structure */ - hw_data = devm_kzalloc(&pdev->dev, sizeof(*hw_data), GFP_KERNEL); + hw_data = devm_kzalloc_obj(&pdev->dev, *hw_data); if (!hw_data) { ret = -ENOMEM; goto out_err; diff --git a/drivers/crypto/intel/qat/qat_4xxx/adf_drv.c b/drivers/crypto/intel/qat/qat_4xxx/adf_drv.c index aa95f762cb4b..df00316e444e 100644 --- a/drivers/crypto/intel/qat/qat_4xxx/adf_drv.c +++ b/drivers/crypto/intel/qat/qat_4xxx/adf_drv.c @@ -52,7 +52,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return -EINVAL; } - accel_dev = devm_kzalloc(&pdev->dev, sizeof(*accel_dev), GFP_KERNEL); + accel_dev = devm_kzalloc_obj(&pdev->dev, *accel_dev); if (!accel_dev) return -ENOMEM; @@ -71,7 +71,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) accel_dev->owner = THIS_MODULE; /* Allocate and initialise device hardware meta-data structure */ - hw_data = devm_kzalloc(&pdev->dev, sizeof(*hw_data), GFP_KERNEL); + hw_data = devm_kzalloc_obj(&pdev->dev, *hw_data); if (!hw_data) { ret = -ENOMEM; goto out_err; diff --git a/drivers/crypto/intel/qat/qat_6xxx/adf_drv.c b/drivers/crypto/intel/qat/qat_6xxx/adf_drv.c index 319b4251ad46..0ace2aa71bc7 100644 --- a/drivers/crypto/intel/qat/qat_6xxx/adf_drv.c +++ b/drivers/crypto/intel/qat/qat_6xxx/adf_drv.c @@ -103,7 +103,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return dev_err_probe(dev, -EINVAL, "Invalid NUMA configuration.\n"); } - accel_dev = devm_kzalloc(dev, sizeof(*accel_dev), GFP_KERNEL); + accel_dev = devm_kzalloc_obj(dev, *accel_dev); if (!accel_dev) return -ENOMEM; @@ -113,7 +113,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) accel_pci_dev->pci_dev = pdev; accel_dev->owner = THIS_MODULE; - hw_data = devm_kzalloc(dev, sizeof(*hw_data), GFP_KERNEL); + hw_data = devm_kzalloc_obj(dev, *hw_data); if (!hw_data) return -ENOMEM; diff --git a/drivers/crypto/marvell/cesa/cesa.c b/drivers/crypto/marvell/cesa/cesa.c index 564b09773507..f0fec5b3ccba 100644 --- a/drivers/crypto/marvell/cesa/cesa.c +++ b/drivers/crypto/marvell/cesa/cesa.c @@ -337,7 +337,7 @@ static int mv_cesa_dev_dma_init(struct mv_cesa_dev *cesa) if (!cesa->caps->has_tdma) return 0; - dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL); + dma = devm_kzalloc_obj(dev, *dma); if (!dma) return -ENOMEM; @@ -436,8 +436,7 @@ static int mv_cesa_probe(struct platform_device *pdev) return -ENOTSUPP; } - cesa = devm_kzalloc(dev, struct_size(cesa, engines, caps->nengines), - GFP_KERNEL); + cesa = devm_kzalloc_flex(dev, *cesa, engines, caps->nengines); if (!cesa) return -ENOMEM; diff --git a/drivers/crypto/marvell/octeontx/otx_cptpf_main.c b/drivers/crypto/marvell/octeontx/otx_cptpf_main.c index e4c828606a73..3ed692a1181c 100644 --- a/drivers/crypto/marvell/octeontx/otx_cptpf_main.c +++ b/drivers/crypto/marvell/octeontx/otx_cptpf_main.c @@ -193,7 +193,7 @@ static int otx_cpt_probe(struct pci_dev *pdev, struct otx_cpt_device *cpt; int err; - cpt = devm_kzalloc(dev, sizeof(*cpt), GFP_KERNEL); + cpt = devm_kzalloc_obj(dev, *cpt); if (!cpt) return -ENOMEM; diff --git a/drivers/crypto/marvell/octeontx/otx_cptvf_main.c b/drivers/crypto/marvell/octeontx/otx_cptvf_main.c index 159c1d290a36..e11c00478220 100644 --- a/drivers/crypto/marvell/octeontx/otx_cptvf_main.c +++ b/drivers/crypto/marvell/octeontx/otx_cptvf_main.c @@ -785,7 +785,7 @@ static int otx_cptvf_probe(struct pci_dev *pdev, struct otx_cptvf *cptvf; int err; - cptvf = devm_kzalloc(dev, sizeof(*cptvf), GFP_KERNEL); + cptvf = devm_kzalloc_obj(dev, *cptvf); if (!cptvf) return -ENOMEM; diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c b/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c index 79f6c2bb9d8b..14c998a9df8b 100644 --- a/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c +++ b/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c @@ -727,7 +727,7 @@ static int otx2_cptpf_probe(struct pci_dev *pdev, struct otx2_cptpf_dev *cptpf; int err, num_vec; - cptpf = devm_kzalloc(dev, sizeof(*cptpf), GFP_KERNEL); + cptpf = devm_kzalloc_obj(dev, *cptpf); if (!cptpf) return -ENOMEM; diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c b/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c index 09ab85e6061c..366346e2d8fa 100644 --- a/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c +++ b/drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c @@ -357,7 +357,7 @@ static int otx2_cptvf_probe(struct pci_dev *pdev, struct otx2_cptvf_dev *cptvf; int ret; - cptvf = devm_kzalloc(dev, sizeof(*cptvf), GFP_KERNEL); + cptvf = devm_kzalloc_obj(dev, *cptvf); if (!cptvf) return -ENOMEM; diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c index d104d958cb61..479fdaba8337 100644 --- a/drivers/crypto/mxs-dcp.c +++ b/drivers/crypto/mxs-dcp.c @@ -1076,7 +1076,7 @@ static int mxs_dcp_probe(struct platform_device *pdev) if (dcp_irq < 0) return dcp_irq; - sdcp = devm_kzalloc(dev, sizeof(*sdcp), GFP_KERNEL); + sdcp = devm_kzalloc_obj(dev, *sdcp); if (!sdcp) return -ENOMEM; diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c index d40074e5a142..815b8fb34cf4 100644 --- a/drivers/crypto/omap-aes.c +++ b/drivers/crypto/omap-aes.c @@ -1060,7 +1060,7 @@ static int omap_aes_probe(struct platform_device *pdev) if (IS_ERR(io_base)) return PTR_ERR(io_base); - dd = devm_kzalloc(dev, sizeof(struct omap_aes_dev), GFP_KERNEL); + dd = devm_kzalloc_obj(dev, struct omap_aes_dev); if (dd == NULL) { dev_err(dev, "unable to alloc data struct.\n"); goto err_data; diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c index 4b5a8d13f505..a3dffd632ded 100644 --- a/drivers/crypto/omap-des.c +++ b/drivers/crypto/omap-des.c @@ -961,7 +961,7 @@ static int omap_des_probe(struct platform_device *pdev) int err = -ENOMEM, i, j, irq = -1; u32 reg; - dd = devm_kzalloc(dev, sizeof(struct omap_des_dev), GFP_KERNEL); + dd = devm_kzalloc_obj(dev, struct omap_des_dev); if (dd == NULL) { dev_err(dev, "unable to alloc data struct.\n"); goto err_data; diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index 5e739415a010..2c0568a15c3a 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c @@ -2001,7 +2001,7 @@ static int omap_sham_probe(struct platform_device *pdev) if (irq < 0) return irq; - dd = devm_kzalloc(dev, sizeof(struct omap_sham_dev), GFP_KERNEL); + dd = devm_kzalloc_obj(dev, struct omap_sham_dev); if (dd == NULL) { dev_err(dev, "unable to alloc data struct.\n"); err = -ENOMEM; diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c index bf3c1bc3ba7b..a009c791417b 100644 --- a/drivers/crypto/qce/core.c +++ b/drivers/crypto/qce/core.c @@ -196,7 +196,7 @@ static int qce_crypto_probe(struct platform_device *pdev) struct qce_device *qce; int ret; - qce = devm_kzalloc(dev, sizeof(*qce), GFP_KERNEL); + qce = devm_kzalloc_obj(dev, *qce); if (!qce) return -ENOMEM; diff --git a/drivers/crypto/rockchip/rk3288_crypto.c b/drivers/crypto/rockchip/rk3288_crypto.c index b2b629fffc05..bb23a179c257 100644 --- a/drivers/crypto/rockchip/rk3288_crypto.c +++ b/drivers/crypto/rockchip/rk3288_crypto.c @@ -319,8 +319,7 @@ static int rk_crypto_probe(struct platform_device *pdev) struct rk_crypto_info *crypto_info, *first; int err = 0; - crypto_info = devm_kzalloc(&pdev->dev, - sizeof(*crypto_info), GFP_KERNEL); + crypto_info = devm_kzalloc_obj(&pdev->dev, *crypto_info); if (!crypto_info) { err = -ENOMEM; goto err_crypto; diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c index a70102799223..d06419c75f54 100644 --- a/drivers/crypto/s5p-sss.c +++ b/drivers/crypto/s5p-sss.c @@ -2139,7 +2139,7 @@ static int s5p_aes_probe(struct platform_device *pdev) if (s5p_dev) return -EEXIST; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/crypto/sa2ul.c b/drivers/crypto/sa2ul.c index 4557eae94164..c84315b1d093 100644 --- a/drivers/crypto/sa2ul.c +++ b/drivers/crypto/sa2ul.c @@ -2293,7 +2293,7 @@ static int sa_ul_probe(struct platform_device *pdev) u32 status, val; int ret; - dev_data = devm_kzalloc(dev, sizeof(*dev_data), GFP_KERNEL); + dev_data = devm_kzalloc_obj(dev, *dev_data); if (!dev_data) return -ENOMEM; diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index d586f1315de1..81a3a3f2af20 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -1285,7 +1285,7 @@ static int sahara_probe(struct platform_device *pdev) int err; int i; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/crypto/starfive/jh7110-cryp.c b/drivers/crypto/starfive/jh7110-cryp.c index 856290347b95..6cfe044b168c 100644 --- a/drivers/crypto/starfive/jh7110-cryp.c +++ b/drivers/crypto/starfive/jh7110-cryp.c @@ -89,7 +89,7 @@ static int starfive_cryp_probe(struct platform_device *pdev) struct resource *res; int ret; - cryp = devm_kzalloc(&pdev->dev, sizeof(*cryp), GFP_KERNEL); + cryp = devm_kzalloc_obj(&pdev->dev, *cryp); if (!cryp) return -ENOMEM; diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32-cryp.c index 3fc2db290b0f..2611ff882768 100644 --- a/drivers/crypto/stm32/stm32-cryp.c +++ b/drivers/crypto/stm32/stm32-cryp.c @@ -2567,7 +2567,7 @@ static int stm32_cryp_probe(struct platform_device *pdev) struct reset_control *rst; int irq, ret; - cryp = devm_kzalloc(dev, sizeof(*cryp), GFP_KERNEL); + cryp = devm_kzalloc_obj(dev, *cryp); if (!cryp) return -ENOMEM; diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c index e6a1e9b9f88d..fed05f5ef263 100644 --- a/drivers/crypto/stm32/stm32-hash.c +++ b/drivers/crypto/stm32/stm32-hash.c @@ -2332,7 +2332,7 @@ static int stm32_hash_probe(struct platform_device *pdev) struct resource *res; int ret, irq; - hdev = devm_kzalloc(dev, sizeof(*hdev), GFP_KERNEL); + hdev = devm_kzalloc_obj(dev, *hdev); if (!hdev) return -ENOMEM; diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index c7d9ce2905be..8a9f0d1e7df9 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -3255,8 +3255,7 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev, struct talitos_crypto_alg *t_alg; struct crypto_alg *alg; - t_alg = devm_kzalloc(dev, sizeof(struct talitos_crypto_alg), - GFP_KERNEL); + t_alg = devm_kzalloc_obj(dev, struct talitos_crypto_alg); if (!t_alg) return ERR_PTR(-ENOMEM); @@ -3419,7 +3418,7 @@ static int talitos_probe(struct platform_device *ofdev) if (IS_ERR(reg)) return PTR_ERR(reg); - priv = devm_kzalloc(dev, struct_size(priv, chan, num_channels), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, chan, num_channels); if (!priv) return -ENOMEM; @@ -3520,10 +3519,9 @@ static int talitos_probe(struct platform_device *ofdev) spin_lock_init(&priv->chan[i].head_lock); spin_lock_init(&priv->chan[i].tail_lock); - priv->chan[i].fifo = devm_kcalloc(dev, - priv->fifo_len, - sizeof(struct talitos_request), - GFP_KERNEL); + priv->chan[i].fifo = devm_kzalloc_objs(dev, + struct talitos_request, + priv->fifo_len); if (!priv->chan[i].fifo) { dev_err(dev, "failed to allocate request fifo %d\n", i); err = -ENOMEM; diff --git a/drivers/crypto/tegra/tegra-se-main.c b/drivers/crypto/tegra/tegra-se-main.c index 497ff270489c..b90ea2efa631 100644 --- a/drivers/crypto/tegra/tegra-se-main.c +++ b/drivers/crypto/tegra/tegra-se-main.c @@ -280,7 +280,7 @@ static int tegra_se_probe(struct platform_device *pdev) struct tegra_se *se; int ret; - se = devm_kzalloc(dev, sizeof(*se), GFP_KERNEL); + se = devm_kzalloc_obj(dev, *se); if (!se) return -ENOMEM; diff --git a/drivers/crypto/ti/dthev2-common.c b/drivers/crypto/ti/dthev2-common.c index ba6cde75d361..5916edff8e95 100644 --- a/drivers/crypto/ti/dthev2-common.c +++ b/drivers/crypto/ti/dthev2-common.c @@ -143,7 +143,7 @@ static int dthe_probe(struct platform_device *pdev) struct dthe_data *dev_data; int ret; - dev_data = devm_kzalloc(dev, sizeof(*dev_data), GFP_KERNEL); + dev_data = devm_kzalloc_obj(dev, *dev_data); if (!dev_data) return -ENOMEM; diff --git a/drivers/crypto/xilinx/zynqmp-aes-gcm.c b/drivers/crypto/xilinx/zynqmp-aes-gcm.c index d9bd6dcd23a6..9b6e78506518 100644 --- a/drivers/crypto/xilinx/zynqmp-aes-gcm.c +++ b/drivers/crypto/xilinx/zynqmp-aes-gcm.c @@ -928,7 +928,7 @@ static int xilinx_aes_aead_probe(struct platform_device *pdev) if (aead_dev) return -ENODEV; - aead_dev = devm_kzalloc(dev, sizeof(*aead_dev), GFP_KERNEL); + aead_dev = devm_kzalloc_obj(dev, *aead_dev); if (!aead_dev) return -ENOMEM; aead_dev->dev = dev; diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c index b7ce6b59c680..4516ad48f5be 100644 --- a/drivers/cxl/acpi.c +++ b/drivers/cxl/acpi.c @@ -126,8 +126,7 @@ static int cxl_parse_cxims(union acpi_subtable_headers *header, void *arg, return -ENXIO; } - cximsd = devm_kzalloc(dev, struct_size(cximsd, xormaps, nr_maps), - GFP_KERNEL); + cximsd = devm_kzalloc_flex(dev, *cximsd, xormaps, nr_maps); if (!cximsd) return -ENOMEM; cximsd->nr_maps = nr_maps; @@ -909,7 +908,7 @@ static int cxl_acpi_probe(struct platform_device *pdev) if (rc) return rc; - cxl_res = devm_kzalloc(host, sizeof(*cxl_res), GFP_KERNEL); + cxl_res = devm_kzalloc_obj(host, *cxl_res); if (!cxl_res) return -ENOMEM; cxl_res->name = "CXL mem"; diff --git a/drivers/cxl/core/edac.c b/drivers/cxl/core/edac.c index 34b81e8dfbbb..2eceee68c165 100644 --- a/drivers/cxl/core/edac.c +++ b/drivers/cxl/core/edac.c @@ -382,7 +382,7 @@ static int cxl_memdev_scrub_init(struct cxl_memdev *cxlmd, if (!(le32_to_cpu(feat_entry->flags) & CXL_FEATURE_F_CHANGEABLE)) return -EOPNOTSUPP; - cxl_ps_ctx = devm_kzalloc(&cxlmd->dev, sizeof(*cxl_ps_ctx), GFP_KERNEL); + cxl_ps_ctx = devm_kzalloc_obj(&cxlmd->dev, *cxl_ps_ctx); if (!cxl_ps_ctx) return -ENOMEM; @@ -450,7 +450,7 @@ static int cxl_region_scrub_init(struct cxl_region *cxlr, cxlmd->scrub_region_id = CXL_SCRUB_NO_REGION; } - cxl_ps_ctx = devm_kzalloc(&cxlr->dev, sizeof(*cxl_ps_ctx), GFP_KERNEL); + cxl_ps_ctx = devm_kzalloc_obj(&cxlr->dev, *cxl_ps_ctx); if (!cxl_ps_ctx) return -ENOMEM; @@ -801,8 +801,7 @@ static int cxl_memdev_ecs_init(struct cxl_memdev *cxlmd, if (!num_media_frus) return -EOPNOTSUPP; - cxl_ecs_ctx = - devm_kzalloc(&cxlmd->dev, sizeof(*cxl_ecs_ctx), GFP_KERNEL); + cxl_ecs_ctx = devm_kzalloc_obj(&cxlmd->dev, *cxl_ecs_ctx); if (!cxl_ecs_ctx) return -ENOMEM; @@ -1641,8 +1640,7 @@ static int cxl_memdev_sparing_init(struct cxl_memdev *cxlmd, if (!(le32_to_cpu(feat_entry->flags) & CXL_FEATURE_F_CHANGEABLE)) return -EOPNOTSUPP; - cxl_sparing_ctx = devm_kzalloc(&cxlmd->dev, sizeof(*cxl_sparing_ctx), - GFP_KERNEL); + cxl_sparing_ctx = devm_kzalloc_obj(&cxlmd->dev, *cxl_sparing_ctx); if (!cxl_sparing_ctx) return -ENOMEM; @@ -1968,8 +1966,7 @@ static int cxl_memdev_soft_ppr_init(struct cxl_memdev *cxlmd, if (!(le32_to_cpu(feat_entry->flags) & CXL_FEATURE_F_CHANGEABLE)) return -EOPNOTSUPP; - cxl_sppr_ctx = - devm_kzalloc(&cxlmd->dev, sizeof(*cxl_sppr_ctx), GFP_KERNEL); + cxl_sppr_ctx = devm_kzalloc_obj(&cxlmd->dev, *cxl_sppr_ctx); if (!cxl_sppr_ctx) return -ENOMEM; diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c index fdcef20e01ba..6329eb3b9214 100644 --- a/drivers/cxl/core/hdm.c +++ b/drivers/cxl/core/hdm.c @@ -142,7 +142,7 @@ static struct cxl_hdm *devm_cxl_setup_hdm(struct cxl_port *port, struct cxl_hdm *cxlhdm; int rc; - cxlhdm = devm_kzalloc(dev, sizeof(*cxlhdm), GFP_KERNEL); + cxlhdm = devm_kzalloc_obj(dev, *cxlhdm); if (!cxlhdm) return ERR_PTR(-ENOMEM); cxlhdm->port = port; diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c index 6fba230905c1..702ae9ebdcde 100644 --- a/drivers/cxl/mem.c +++ b/drivers/cxl/mem.c @@ -237,8 +237,7 @@ EXPORT_SYMBOL_NS_GPL(devm_cxl_add_classdev, "CXL"); struct cxl_memdev *devm_cxl_probe_mem(struct cxl_dev_state *cxlds, struct range *hpa_range) { - struct cxl_attach_region *attach = - devm_kmalloc(cxlds->dev, sizeof(*attach), GFP_KERNEL); + struct cxl_attach_region *attach = devm_kmalloc_obj(cxlds->dev, *attach); struct cxl_memdev *cxlmd; if (!attach) diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index 3ed7c3e70042..8ce58917c32d 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -102,7 +102,7 @@ static int cxl_request_irq(struct cxl_dev_state *cxlds, int irq, struct device *dev = cxlds->dev; struct cxl_dev_id *dev_id; - dev_id = devm_kzalloc(dev, sizeof(*dev_id), GFP_KERNEL); + dev_id = devm_kzalloc_obj(dev, *dev_id); if (!dev_id) return -ENOMEM; dev_id->cxlds = cxlds; diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c index a9f50281875d..7ac1dc8740cf 100644 --- a/drivers/cxl/pmem.c +++ b/drivers/cxl/pmem.c @@ -409,7 +409,7 @@ static int cxl_pmem_region_probe(struct device *dev) memset(&mappings, 0, sizeof(mappings)); memset(&ndr_desc, 0, sizeof(ndr_desc)); - res = devm_kzalloc(dev, sizeof(*res), GFP_KERNEL); + res = devm_kzalloc_obj(dev, *res); if (!res) return -ENOMEM; @@ -438,7 +438,7 @@ static int cxl_pmem_region_probe(struct device *dev) NUMA_NO_NODE, ndr_desc.target_node); } - nd_set = devm_kzalloc(dev, sizeof(*nd_set), GFP_KERNEL); + nd_set = devm_kzalloc_obj(dev, *nd_set); if (!nd_set) return -ENOMEM; diff --git a/drivers/dax/device.c b/drivers/dax/device.c index d0c9b4e03b47..e52f4886fbaa 100644 --- a/drivers/dax/device.c +++ b/drivers/dax/device.c @@ -402,9 +402,8 @@ static int dev_dax_probe(struct dev_dax *dev_dax) return -EINVAL; } - pgmap = devm_kzalloc(dev, - struct_size(pgmap, ranges, dev_dax->nr_range - 1), - GFP_KERNEL); + pgmap = devm_kzalloc_flex(dev, *pgmap, ranges, + dev_dax->nr_range - 1); if (!pgmap) return -ENOMEM; diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 82dd9a43dc62..172336437ce9 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -185,10 +185,9 @@ static int set_freq_table(struct devfreq *devfreq) return -EINVAL; devfreq->max_state = count; - devfreq->freq_table = devm_kcalloc(devfreq->dev.parent, - devfreq->max_state, - sizeof(*devfreq->freq_table), - GFP_KERNEL); + devfreq->freq_table = devm_kzalloc_objs(devfreq->dev.parent, + *devfreq->freq_table, + devfreq->max_state); if (!devfreq->freq_table) return -ENOMEM; @@ -893,10 +892,9 @@ struct devfreq *devfreq_add_device(struct device *dev, goto err_devfreq; } - devfreq->stats.time_in_state = devm_kcalloc(&devfreq->dev, - devfreq->max_state, - sizeof(*devfreq->stats.time_in_state), - GFP_KERNEL); + devfreq->stats.time_in_state = devm_kzalloc_objs(&devfreq->dev, + *devfreq->stats.time_in_state, + devfreq->max_state); if (!devfreq->stats.time_in_state) { mutex_unlock(&devfreq->lock); err = -ENOMEM; diff --git a/drivers/devfreq/event/exynos-nocp.c b/drivers/devfreq/event/exynos-nocp.c index 6a3efd782ad0..c0c6e69652c6 100644 --- a/drivers/devfreq/event/exynos-nocp.c +++ b/drivers/devfreq/event/exynos-nocp.c @@ -237,7 +237,7 @@ static int exynos_nocp_probe(struct platform_device *pdev) struct exynos_nocp *nocp; int ret; - nocp = devm_kzalloc(&pdev->dev, sizeof(*nocp), GFP_KERNEL); + nocp = devm_kzalloc_obj(&pdev->dev, *nocp); if (!nocp) return -ENOMEM; diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c index 88cd4dfe87e1..549718816ca0 100644 --- a/drivers/devfreq/event/exynos-ppmu.c +++ b/drivers/devfreq/event/exynos-ppmu.c @@ -517,7 +517,7 @@ static int of_get_devfreq_events(struct device_node *np, } count = of_get_child_count(events_np); - desc = devm_kcalloc(dev, count, sizeof(*desc), GFP_KERNEL); + desc = devm_kzalloc_objs(dev, *desc, count); if (!desc) { of_node_put(events_np); return -ENOMEM; @@ -648,7 +648,7 @@ static int exynos_ppmu_probe(struct platform_device *pdev) struct devfreq_event_desc *desc; int i, ret = 0, size; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c index 255aee1bdd91..16b25779d2f8 100644 --- a/drivers/devfreq/event/rockchip-dfi.c +++ b/drivers/devfreq/event/rockchip-dfi.c @@ -829,7 +829,7 @@ static int rockchip_dfi_probe(struct platform_device *pdev) if (!soc_init) return -EINVAL; - dfi = devm_kzalloc(dev, sizeof(*dfi), GFP_KERNEL); + dfi = devm_kzalloc_obj(dev, *dfi); if (!dfi) return -ENOMEM; diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index b9ea7ad2e51b..fc8a4ed3f0da 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -288,7 +288,7 @@ static int exynos_bus_profile_init(struct exynos_bus *bus, profile->get_dev_status = exynos_bus_get_dev_status; profile->exit = exynos_bus_exit; - ondemand_data = devm_kzalloc(dev, sizeof(*ondemand_data), GFP_KERNEL); + ondemand_data = devm_kzalloc_obj(dev, *ondemand_data); if (!ondemand_data) return -ENOMEM; @@ -352,7 +352,7 @@ static int exynos_bus_profile_init_passive(struct exynos_bus *bus, if (IS_ERR(parent_devfreq)) return -EPROBE_DEFER; - passive_data = devm_kzalloc(dev, sizeof(*passive_data), GFP_KERNEL); + passive_data = devm_kzalloc_obj(dev, *passive_data); if (!passive_data) return -ENOMEM; @@ -385,14 +385,14 @@ static int exynos_bus_probe(struct platform_device *pdev) return -EINVAL; } - bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); + bus = devm_kzalloc_obj(&pdev->dev, *bus); if (!bus) return -ENOMEM; mutex_init(&bus->lock); bus->dev = &pdev->dev; platform_set_drvdata(pdev, bus); - profile = devm_kzalloc(dev, sizeof(*profile), GFP_KERNEL); + profile = devm_kzalloc_obj(dev, *profile); if (!profile) return -ENOMEM; diff --git a/drivers/devfreq/hisi_uncore_freq.c b/drivers/devfreq/hisi_uncore_freq.c index ac55641b0259..4941d5088173 100644 --- a/drivers/devfreq/hisi_uncore_freq.c +++ b/drivers/devfreq/hisi_uncore_freq.c @@ -563,7 +563,7 @@ static int hisi_uncore_devfreq_register(struct hisi_uncore_freq *uncore) if (rc) return dev_err_probe(dev, rc, "Failed to get plat init freq\n"); - profile = devm_kzalloc(dev, sizeof(*profile), GFP_KERNEL); + profile = devm_kzalloc_obj(dev, *profile); if (!profile) return -ENOMEM; @@ -601,7 +601,7 @@ static int hisi_uncore_freq_probe(struct platform_device *pdev) u32 cap; int rc; - uncore = devm_kzalloc(dev, sizeof(*uncore), GFP_KERNEL); + uncore = devm_kzalloc_obj(dev, *uncore); if (!uncore) return -ENOMEM; diff --git a/drivers/devfreq/imx-bus.c b/drivers/devfreq/imx-bus.c index 49798f542d68..f00bf1bf305a 100644 --- a/drivers/devfreq/imx-bus.c +++ b/drivers/devfreq/imx-bus.c @@ -90,7 +90,7 @@ static int imx_bus_probe(struct platform_device *pdev) const char *gov = DEVFREQ_GOV_USERSPACE; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/devfreq/imx8m-ddrc.c b/drivers/devfreq/imx8m-ddrc.c index 52beeb5b7d65..2f205cda347f 100644 --- a/drivers/devfreq/imx8m-ddrc.c +++ b/drivers/devfreq/imx8m-ddrc.c @@ -369,7 +369,7 @@ static int imx8m_ddrc_probe(struct platform_device *pdev) const char *gov = DEVFREQ_GOV_USERSPACE; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/devfreq/mtk-cci-devfreq.c b/drivers/devfreq/mtk-cci-devfreq.c index 4c22be728f6a..3eb5545e0eb6 100644 --- a/drivers/devfreq/mtk-cci-devfreq.c +++ b/drivers/devfreq/mtk-cci-devfreq.c @@ -255,7 +255,7 @@ static int mtk_ccifreq_probe(struct platform_device *pdev) unsigned long rate, opp_volt; int ret; - drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(dev, *drv); if (!drv) return -ENOMEM; @@ -352,7 +352,7 @@ static int mtk_ccifreq_probe(struct platform_device *pdev) goto out_remove_opp_table; } - passive_data = devm_kzalloc(dev, sizeof(*passive_data), GFP_KERNEL); + passive_data = devm_kzalloc_obj(dev, *passive_data); if (!passive_data) { ret = -ENOMEM; goto out_remove_opp_table; diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c index dbdce7636ca5..f5b662fb8413 100644 --- a/drivers/devfreq/rk3399_dmc.c +++ b/drivers/devfreq/rk3399_dmc.c @@ -342,7 +342,7 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) u32 ddr_type; u32 val; - data = devm_kzalloc(dev, sizeof(struct rk3399_dmcfreq), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct rk3399_dmcfreq); if (!data) return -ENOMEM; diff --git a/drivers/devfreq/sun8i-a33-mbus.c b/drivers/devfreq/sun8i-a33-mbus.c index 4bd5657558d6..db2554e38e3f 100644 --- a/drivers/devfreq/sun8i-a33-mbus.c +++ b/drivers/devfreq/sun8i-a33-mbus.c @@ -344,7 +344,7 @@ static int sun8i_a33_mbus_probe(struct platform_device *pdev) max_state = variant->max_dram_divider - variant->min_dram_divider + 1; - priv = devm_kzalloc(dev, struct_size(priv, freq_table, max_state), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, freq_table, max_state); if (!priv) return -ENOMEM; diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c index 401aac6a9f07..20b41fbede04 100644 --- a/drivers/devfreq/tegra30-devfreq.c +++ b/drivers/devfreq/tegra30-devfreq.c @@ -842,7 +842,7 @@ static int tegra_devfreq_probe(struct platform_device *pdev) .config_clks = tegra_devfreq_config_clks_nop, }; - tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL); + tegra = devm_kzalloc_obj(&pdev->dev, *tegra); if (!tegra) return -ENOMEM; diff --git a/drivers/dma/altera-msgdma.c b/drivers/dma/altera-msgdma.c index 412f4bce1d4a..567aea0fac38 100644 --- a/drivers/dma/altera-msgdma.c +++ b/drivers/dma/altera-msgdma.c @@ -819,7 +819,7 @@ static int msgdma_probe(struct platform_device *pdev) struct resource *dma_res; int ret; - mdev = devm_kzalloc(&pdev->dev, sizeof(*mdev), GFP_NOWAIT); + mdev = devm_kzalloc_obj(&pdev->dev, *mdev, GFP_NOWAIT); if (!mdev) return -ENOMEM; diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 543c2eb8cfa8..e2bc7d5b2f31 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -2571,7 +2571,7 @@ static int pl08x_of_probe(struct amba_device *adev, int ret; int i; - pd = devm_kzalloc(&adev->dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(&adev->dev, *pd); if (!pd) return -ENOMEM; @@ -2658,10 +2658,8 @@ static int pl08x_of_probe(struct amba_device *adev, * translation time. */ if (pl08x->vd->signals) { - chanp = devm_kcalloc(&adev->dev, - pl08x->vd->signals, - sizeof(struct pl08x_channel_data), - GFP_KERNEL); + chanp = devm_kzalloc_objs(&adev->dev, struct pl08x_channel_data, + pl08x->vd->signals); if (!chanp) return -ENOMEM; diff --git a/drivers/dma/amd/ae4dma/ae4dma-pci.c b/drivers/dma/amd/ae4dma/ae4dma-pci.c index 2c63907db228..8ca34d4457cc 100644 --- a/drivers/dma/amd/ae4dma/ae4dma-pci.c +++ b/drivers/dma/amd/ae4dma/ae4dma-pci.c @@ -79,11 +79,11 @@ static int ae4_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) int bar_mask; int ret = 0; - ae4 = devm_kzalloc(dev, sizeof(*ae4), GFP_KERNEL); + ae4 = devm_kzalloc_obj(dev, *ae4); if (!ae4) return -ENOMEM; - ae4->ae4_msix = devm_kzalloc(dev, sizeof(struct ae4_msix), GFP_KERNEL); + ae4->ae4_msix = devm_kzalloc_obj(dev, struct ae4_msix); if (!ae4->ae4_msix) return -ENOMEM; diff --git a/drivers/dma/amd/ptdma/ptdma-dmaengine.c b/drivers/dma/amd/ptdma/ptdma-dmaengine.c index 628c49ce5de9..dc6ce4a3afa9 100644 --- a/drivers/dma/amd/ptdma/ptdma-dmaengine.c +++ b/drivers/dma/amd/ptdma/ptdma-dmaengine.c @@ -572,11 +572,10 @@ int pt_dmaengine_register(struct pt_device *pt) ae4 = container_of(pt, struct ae4_device, pt); if (ae4) - pt->pt_dma_chan = devm_kcalloc(pt->dev, ae4->cmd_q_count, - sizeof(*pt->pt_dma_chan), GFP_KERNEL); + pt->pt_dma_chan = devm_kzalloc_objs(pt->dev, *pt->pt_dma_chan, + ae4->cmd_q_count); else - pt->pt_dma_chan = devm_kzalloc(pt->dev, sizeof(*pt->pt_dma_chan), - GFP_KERNEL); + pt->pt_dma_chan = devm_kzalloc_obj(pt->dev, *pt->pt_dma_chan); if (!pt->pt_dma_chan) return -ENOMEM; diff --git a/drivers/dma/amd/ptdma/ptdma-pci.c b/drivers/dma/amd/ptdma/ptdma-pci.c index 22739ff0c3c5..68df877e4ca7 100644 --- a/drivers/dma/amd/ptdma/ptdma-pci.c +++ b/drivers/dma/amd/ptdma/ptdma-pci.c @@ -37,7 +37,7 @@ static struct pt_device *pt_alloc_struct(struct device *dev) { struct pt_device *pt; - pt = devm_kzalloc(dev, sizeof(*pt), GFP_KERNEL); + pt = devm_kzalloc_obj(dev, *pt); if (!pt) return NULL; @@ -131,7 +131,7 @@ static int pt_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (!pt) goto e_err; - pt_msix = devm_kzalloc(dev, sizeof(*pt_msix), GFP_KERNEL); + pt_msix = devm_kzalloc_obj(dev, *pt_msix); if (!pt_msix) goto e_err; diff --git a/drivers/dma/amd/qdma/qdma.c b/drivers/dma/amd/qdma/qdma.c index 3e61e8c4356a..435d7bb131ad 100644 --- a/drivers/dma/amd/qdma/qdma.c +++ b/drivers/dma/amd/qdma/qdma.c @@ -447,8 +447,7 @@ static int qdma_alloc_queues(struct qdma_device *qdev, pidx_base = QDMA_REG_OFF(qdev, QDMA_REGO_C2H_PIDX); } - *queues = devm_kcalloc(&qdev->pdev->dev, qdev->chan_num, sizeof(*q), - GFP_KERNEL); + *queues = devm_kzalloc_objs(&qdev->pdev->dev, *q, qdev->chan_num); if (!*queues) return -ENOMEM; @@ -954,9 +953,8 @@ static int qdmam_alloc_qintr_rings(struct qdma_device *qdev) int ret, i; qdev->qintr_ring_num = qdev->queue_irq_num; - qdev->qintr_rings = devm_kcalloc(dev, qdev->qintr_ring_num, - sizeof(*qdev->qintr_rings), - GFP_KERNEL); + qdev->qintr_rings = devm_kzalloc_objs(dev, *qdev->qintr_rings, + qdev->qintr_ring_num); if (!qdev->qintr_rings) return -ENOMEM; @@ -1043,7 +1041,7 @@ static int amd_qdma_probe(struct platform_device *pdev) void __iomem *regs; int ret; - qdev = devm_kzalloc(&pdev->dev, sizeof(*qdev), GFP_KERNEL); + qdev = devm_kzalloc_obj(&pdev->dev, *qdev); if (!qdev) return -ENOMEM; diff --git a/drivers/dma/apple-admac.c b/drivers/dma/apple-admac.c index 9a1c79c12268..4531a301c018 100644 --- a/drivers/dma/apple-admac.c +++ b/drivers/dma/apple-admac.c @@ -835,7 +835,7 @@ static int admac_probe(struct platform_device *pdev) return -EINVAL; } - ad = devm_kzalloc(&pdev->dev, struct_size(ad, channels, nchannels), GFP_KERNEL); + ad = devm_kzalloc_flex(&pdev->dev, *ad, channels, nchannels); if (!ad) return -ENOMEM; diff --git a/drivers/dma/arm-dma350.c b/drivers/dma/arm-dma350.c index 52f5242ea332..9bef78c2df81 100644 --- a/drivers/dma/arm-dma350.c +++ b/drivers/dma/arm-dma350.c @@ -556,7 +556,7 @@ static int d350_probe(struct platform_device *pdev) dma_set_mask_and_coherent(dev, DMA_BIT_MASK(aw)); coherent = device_get_dma_attr(dev) == DEV_DMA_COHERENT; - dmac = devm_kzalloc(dev, struct_size(dmac, channels, nchan), GFP_KERNEL); + dmac = devm_kzalloc_flex(dev, *dmac, channels, nchan); if (!dmac) return -ENOMEM; diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 3fedc907db63..b024aa2d34b2 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1971,9 +1971,8 @@ static int __init at_dma_probe(struct platform_device *pdev) if (!plat_dat) return -ENODEV; - atdma = devm_kzalloc(&pdev->dev, - struct_size(atdma, chan, plat_dat->nr_channels), - GFP_KERNEL); + atdma = devm_kzalloc_flex(&pdev->dev, *atdma, chan, + plat_dat->nr_channels); if (!atdma) return -ENOMEM; diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index d40a8b40dddc..ef0dfe9d37ba 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -2290,9 +2290,7 @@ static int at_xdmac_probe(struct platform_device *pdev) return -EINVAL; } - atxdmac = devm_kzalloc(&pdev->dev, - struct_size(atxdmac, chan, nr_channels), - GFP_KERNEL); + atxdmac = devm_kzalloc_flex(&pdev->dev, *atxdmac, chan, nr_channels); if (!atxdmac) { dev_err(&pdev->dev, "can't allocate at_xdmac structure\n"); return -ENOMEM; diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c index 0de03611252e..7b4e9de0f531 100644 --- a/drivers/dma/bcm-sba-raid.c +++ b/drivers/dma/bcm-sba-raid.c @@ -1489,9 +1489,8 @@ static int sba_prealloc_channel_resources(struct sba_device *sba) INIT_LIST_HEAD(&sba->reqs_free_list); for (i = 0; i < sba->max_req; i++) { - req = devm_kzalloc(sba->dev, - struct_size(req, cmds, sba->max_cmd_per_req), - GFP_KERNEL); + req = devm_kzalloc_flex(sba->dev, *req, cmds, + sba->max_cmd_per_req); if (!req) { ret = -ENOMEM; goto fail_free_cmds_pool; @@ -1619,7 +1618,7 @@ static int sba_probe(struct platform_device *pdev) struct of_phandle_args args; /* Allocate main SBA struct */ - sba = devm_kzalloc(&pdev->dev, sizeof(*sba), GFP_KERNEL); + sba = devm_kzalloc_obj(&pdev->dev, *sba); if (!sba) return -ENOMEM; diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c index 06d830d36882..d41b0f6ec427 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c @@ -802,7 +802,7 @@ static int bcm2835_dma_chan_init(struct bcm2835_dmadev *d, int chan_id, { struct bcm2835_chan *c; - c = devm_kzalloc(d->ddev.dev, sizeof(*c), GFP_KERNEL); + c = devm_kzalloc_obj(d->ddev.dev, *c); if (!c) return -ENOMEM; @@ -899,7 +899,7 @@ static int bcm2835_dma_probe(struct platform_device *pdev) return rc; } - od = devm_kzalloc(&pdev->dev, sizeof(*od), GFP_KERNEL); + od = devm_kzalloc_obj(&pdev->dev, *od); if (!od) return -ENOMEM; diff --git a/drivers/dma/cv1800b-dmamux.c b/drivers/dma/cv1800b-dmamux.c index f7a952fcbc7d..8d3de599151e 100644 --- a/drivers/dma/cv1800b-dmamux.c +++ b/drivers/dma/cv1800b-dmamux.c @@ -200,7 +200,7 @@ static int cv1800_dmamux_probe(struct platform_device *pdev) if (IS_ERR(regmap)) return PTR_ERR(regmap); - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; @@ -209,7 +209,7 @@ static int cv1800_dmamux_probe(struct platform_device *pdev) init_llist_head(&data->reserve_maps); for (i = 0; i <= MAX_DMA_CH_ID; i++) { - tmp = devm_kmalloc(dev, sizeof(*tmp), GFP_KERNEL); + tmp = devm_kmalloc_obj(dev, *tmp); if (!tmp) { /* It is OK for not allocating all channel */ dev_warn(dev, "can not allocate channel %u\n", i); diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c index d47ff27e1408..dbc31b185c4d 100644 --- a/drivers/dma/dma-axi-dmac.c +++ b/drivers/dma/dma-axi-dmac.c @@ -1215,7 +1215,7 @@ static int axi_dmac_probe(struct platform_device *pdev) u32 irq_mask = 0; int ret; - dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL); + dmac = devm_kzalloc_obj(&pdev->dev, *dmac); if (!dmac) return -ENOMEM; diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c index ac2094e65ecf..e610aba09418 100644 --- a/drivers/dma/dma-jz4780.c +++ b/drivers/dma/dma-jz4780.c @@ -867,8 +867,7 @@ static int jz4780_dma_probe(struct platform_device *pdev) if (!soc_data) return -EINVAL; - jzdma = devm_kzalloc(dev, struct_size(jzdma, chan, - soc_data->nb_channels), GFP_KERNEL); + jzdma = devm_kzalloc_flex(dev, *jzdma, chan, soc_data->nb_channels); if (!jzdma) return -ENOMEM; diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c index 7520c78f55cc..940b196b69d1 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -1477,15 +1477,15 @@ static int dw_probe(struct platform_device *pdev) u32 i; int ret; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; - dw = devm_kzalloc(&pdev->dev, sizeof(*dw), GFP_KERNEL); + dw = devm_kzalloc_obj(&pdev->dev, *dw); if (!dw) return -ENOMEM; - hdata = devm_kzalloc(&pdev->dev, sizeof(*hdata), GFP_KERNEL); + hdata = devm_kzalloc_obj(&pdev->dev, *hdata); if (!hdata) return -ENOMEM; @@ -1528,8 +1528,7 @@ static int dw_probe(struct platform_device *pdev) if (ret) return ret; - dw->chan = devm_kcalloc(chip->dev, hdata->nr_channels, - sizeof(*dw->chan), GFP_KERNEL); + dw->chan = devm_kzalloc_objs(chip->dev, *dw->chan, hdata->nr_channels); if (!dw->chan) return -ENOMEM; diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index b08bb31657c9..d682074eaa0e 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -1264,7 +1264,7 @@ static int dw_edma_irq_request(struct dw_edma *dw, if (chip->nr_irqs < 1 || !chip->ops->irq_vector) return -EINVAL; - dw->irq = devm_kcalloc(dev, chip->nr_irqs, sizeof(*dw->irq), GFP_KERNEL); + dw->irq = devm_kzalloc_objs(dev, *dw->irq, chip->nr_irqs); if (!dw->irq) return -ENOMEM; @@ -1370,7 +1370,7 @@ int dw_edma_probe(struct dw_edma_chip *chip) } } - dw = devm_kzalloc(dev, sizeof(*dw), GFP_KERNEL); + dw = devm_kzalloc_obj(dev, *dw); if (!dw) return -ENOMEM; @@ -1411,8 +1411,8 @@ int dw_edma_probe(struct dw_edma_chip *chip) dw->wr_ch_cnt, dw->rd_ch_cnt); /* Allocate channels */ - dw->chan = devm_kcalloc(dev, dw->wr_ch_cnt + dw->rd_ch_cnt, - sizeof(*dw->chan), GFP_KERNEL); + dw->chan = devm_kzalloc_objs(dev, *dw->chan, + dw->wr_ch_cnt + dw->rd_ch_cnt); if (!dw->chan) return -ENOMEM; diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index fab4faf68b77..94fbf222e790 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -472,7 +472,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, } /* Data structure allocation */ - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c index 406f169b09a7..adc971df9e7c 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c +++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c @@ -103,8 +103,7 @@ static void dw_edma_debugfs_create_x32(struct dw_edma *dw, struct dw_edma_debugfs_entry *entries; int i; - entries = devm_kcalloc(dw->chip->dev, nr_entries, sizeof(*entries), - GFP_KERNEL); + entries = devm_kzalloc_objs(dw->chip->dev, *entries, nr_entries); if (!entries) return; diff --git a/drivers/dma/dw-edma/dw-hdma-v0-debugfs.c b/drivers/dma/dw-edma/dw-hdma-v0-debugfs.c index 3fa16e045a58..9f062fe2e368 100644 --- a/drivers/dma/dw-edma/dw-hdma-v0-debugfs.c +++ b/drivers/dma/dw-edma/dw-hdma-v0-debugfs.c @@ -58,8 +58,7 @@ static void dw_hdma_debugfs_create_x32(struct dw_edma *dw, struct dw_hdma_debugfs_entry *entries; int i; - entries = devm_kcalloc(dw->chip->dev, nr_entries, sizeof(*entries), - GFP_KERNEL); + entries = devm_kzalloc_objs(dw->chip->dev, *entries, nr_entries); if (!entries) return; diff --git a/drivers/dma/dw/acpi.c b/drivers/dma/dw/acpi.c index b6452fffa657..ed3a4652667f 100644 --- a/drivers/dma/dw/acpi.c +++ b/drivers/dma/dw/acpi.c @@ -31,7 +31,7 @@ void dw_dma_acpi_controller_register(struct dw_dma *dw) if (!has_acpi_companion(dev)) return; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return; diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c index 575b7bb6af9a..f8bcc3fd5796 100644 --- a/drivers/dma/dw/core.c +++ b/drivers/dma/dw/core.c @@ -1152,7 +1152,7 @@ int do_dma_probe(struct dw_dma_chip *chip) unsigned int i; int ret; - dw->pdata = devm_kzalloc(chip->dev, sizeof(*dw->pdata), GFP_KERNEL); + dw->pdata = devm_kzalloc_obj(chip->dev, *dw->pdata); if (!dw->pdata) return -ENOMEM; @@ -1195,8 +1195,7 @@ int do_dma_probe(struct dw_dma_chip *chip) pdata = dw->pdata; } - dw->chan = devm_kcalloc(chip->dev, pdata->nr_channels, sizeof(*dw->chan), - GFP_KERNEL); + dw->chan = devm_kzalloc_objs(chip->dev, *dw->chan, pdata->nr_channels); if (!dw->chan) { ret = -ENOMEM; goto err_pdata; diff --git a/drivers/dma/dw/dw.c b/drivers/dma/dw/dw.c index e56974e7d4af..c023ac5accb0 100644 --- a/drivers/dma/dw/dw.c +++ b/drivers/dma/dw/dw.c @@ -117,7 +117,7 @@ int dw_dma_probe(struct dw_dma_chip *chip) { struct dw_dma *dw; - dw = devm_kzalloc(chip->dev, sizeof(*dw), GFP_KERNEL); + dw = devm_kzalloc_obj(chip->dev, *dw); if (!dw) return -ENOMEM; diff --git a/drivers/dma/dw/idma32.c b/drivers/dma/dw/idma32.c index dac617c183e6..abdd45d89a64 100644 --- a/drivers/dma/dw/idma32.c +++ b/drivers/dma/dw/idma32.c @@ -262,7 +262,7 @@ int idma32_dma_probe(struct dw_dma_chip *chip) { struct dw_dma *dw; - dw = devm_kzalloc(chip->dev, sizeof(*dw), GFP_KERNEL); + dw = devm_kzalloc_obj(chip->dev, *dw); if (!dw) return -ENOMEM; diff --git a/drivers/dma/dw/of.c b/drivers/dma/dw/of.c index 523ca806837c..5c26a0cc8e84 100644 --- a/drivers/dma/dw/of.c +++ b/drivers/dma/dw/of.c @@ -64,7 +64,7 @@ struct dw_dma_platform_data *dw_dma_parse_dt(struct platform_device *pdev) if (nr_channels > DW_DMA_MAX_NR_CHANNELS) return NULL; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return NULL; diff --git a/drivers/dma/dw/pci.c b/drivers/dma/dw/pci.c index a3aae3d1c093..756551c5cad1 100644 --- a/drivers/dma/dw/pci.c +++ b/drivers/dma/dw/pci.c @@ -40,7 +40,7 @@ static int dw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid) if (!data) return -ENOMEM; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c index 5c1c97eb28a4..7e76391475ac 100644 --- a/drivers/dma/dw/platform.c +++ b/drivers/dma/dw/platform.c @@ -37,7 +37,7 @@ static int dw_probe(struct platform_device *pdev) if (!data) return -ENOMEM; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/dma/dw/rzn1-dmamux.c b/drivers/dma/dw/rzn1-dmamux.c index fb495ee6edfc..ddcd111d57ee 100644 --- a/drivers/dma/dw/rzn1-dmamux.c +++ b/drivers/dma/dw/rzn1-dmamux.c @@ -127,7 +127,7 @@ static int rzn1_dmamux_probe(struct platform_device *pdev) struct device_node *dmac_node; struct rzn1_dmamux_data *dmamux; - dmamux = devm_kzalloc(&pdev->dev, sizeof(*dmamux), GFP_KERNEL); + dmamux = devm_kzalloc_obj(&pdev->dev, *dmamux); if (!dmamux) return -ENOMEM; diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c index cbfe74fc8d71..8a0b66a7d886 100644 --- a/drivers/dma/ep93xx_dma.c +++ b/drivers/dma/ep93xx_dma.c @@ -1372,8 +1372,7 @@ static struct ep93xx_dma_engine *ep93xx_dma_of_probe(struct platform_device *pde if (!data) return ERR_PTR(dev_err_probe(dev, -ENODEV, "No device match found\n")); - edma = devm_kzalloc(dev, struct_size(edma, channels, data->num_channels), - GFP_KERNEL); + edma = devm_kzalloc_flex(dev, *edma, channels, data->num_channels); if (!edma) return ERR_PTR(-ENOMEM); diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 630285c85482..da5139911488 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -719,8 +719,7 @@ static int fsl_edma_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, ret, "Can't get dma-channels.\n"); - fsl_edma = devm_kzalloc(&pdev->dev, struct_size(fsl_edma, chans, chans), - GFP_KERNEL); + fsl_edma = devm_kzalloc_flex(&pdev->dev, *fsl_edma, chans, chans); if (!fsl_edma) return -ENOMEM; diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c index df843fad0ece..27c632e6fa78 100644 --- a/drivers/dma/fsl-qdma.c +++ b/drivers/dma/fsl-qdma.c @@ -559,8 +559,7 @@ static struct fsl_qdma_queue dev_err(&pdev->dev, "Get wrong status_size.\n"); return NULL; } - status_head = devm_kzalloc(&pdev->dev, - sizeof(*status_head), GFP_KERNEL); + status_head = devm_kzalloc_obj(&pdev->dev, *status_head); if (!status_head) return NULL; diff --git a/drivers/dma/fsl_raid.c b/drivers/dma/fsl_raid.c index 9cc289f7129e..fbfd3b6fa586 100644 --- a/drivers/dma/fsl_raid.c +++ b/drivers/dma/fsl_raid.c @@ -645,7 +645,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, re_priv = dev_get_drvdata(dev); dma_dev = &re_priv->dma_dev; - chan = devm_kzalloc(dev, sizeof(*chan), GFP_KERNEL); + chan = devm_kzalloc_obj(dev, *chan); if (!chan) return -ENOMEM; @@ -767,7 +767,7 @@ static int fsl_re_probe(struct platform_device *ofdev) if (IS_ERR(re_regs)) return PTR_ERR(re_regs); - re_priv = devm_kzalloc(dev, sizeof(*re_priv), GFP_KERNEL); + re_priv = devm_kzalloc_obj(dev, *re_priv); if (!re_priv) return -ENOMEM; diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index c751a2e49e6d..d3ec1819aa5d 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -853,8 +853,7 @@ static struct debugfs_reg32 *hisi_dma_get_ch_regs(struct hisi_dma_dev *hdma_dev, else *regs_sz = regs_sz_comm + ARRAY_SIZE(hisi_dma_hip09_chan_regs); - regs = devm_kcalloc(dev, *regs_sz, sizeof(struct debugfs_reg32), - GFP_KERNEL); + regs = devm_kzalloc_objs(dev, struct debugfs_reg32, *regs_sz); if (!regs) return NULL; memcpy(regs, hisi_dma_comm_chan_regs, sizeof(hisi_dma_comm_chan_regs)); @@ -882,8 +881,7 @@ static int hisi_dma_create_chan_dir(struct hisi_dma_dev *hdma_dev) dev = &hdma_dev->pdev->dev; - regsets = devm_kcalloc(dev, hdma_dev->chan_num, - sizeof(*regsets), GFP_KERNEL); + regsets = devm_kzalloc_objs(dev, *regsets, hdma_dev->chan_num); if (!regsets) return -ENOMEM; @@ -921,7 +919,7 @@ static void hisi_dma_create_debugfs(struct hisi_dma_dev *hdma_dev) if (hdma_dev->dma_dev.dbg_dev_root == NULL) return; - regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL); + regset = devm_kzalloc_obj(dev, *regset); if (!regset) return; @@ -980,8 +978,7 @@ static int hisi_dma_probe(struct pci_dev *pdev, const struct pci_device_id *id) return ret; chan_num = hisi_dma_get_chan_num(pdev); - hdma_dev = devm_kzalloc(dev, struct_size(hdma_dev, chan, chan_num), - GFP_KERNEL); + hdma_dev = devm_kzalloc_flex(dev, *hdma_dev, chan, chan_num); if (!hdma_dev) return -ENOMEM; diff --git a/drivers/dma/hsu/hsu.c b/drivers/dma/hsu/hsu.c index f62d60d7bc6b..ce24e840af59 100644 --- a/drivers/dma/hsu/hsu.c +++ b/drivers/dma/hsu/hsu.c @@ -431,7 +431,7 @@ int hsu_dma_probe(struct hsu_dma_chip *chip) unsigned short i; int ret; - hsu = devm_kzalloc(chip->dev, sizeof(*hsu), GFP_KERNEL); + hsu = devm_kzalloc_obj(chip->dev, *hsu); if (!hsu) return -ENOMEM; @@ -440,8 +440,7 @@ int hsu_dma_probe(struct hsu_dma_chip *chip) /* Calculate nr_channels from the IO space length */ hsu->nr_channels = (chip->length - chip->offset) / HSU_DMA_CHAN_LENGTH; - hsu->chan = devm_kcalloc(chip->dev, hsu->nr_channels, - sizeof(*hsu->chan), GFP_KERNEL); + hsu->chan = devm_kzalloc_objs(chip->dev, *hsu->chan, hsu->nr_channels); if (!hsu->chan) return -ENOMEM; diff --git a/drivers/dma/hsu/pci.c b/drivers/dma/hsu/pci.c index 0fcc0c0c22fc..ed5fbcb2959e 100644 --- a/drivers/dma/hsu/pci.c +++ b/drivers/dma/hsu/pci.c @@ -73,7 +73,7 @@ static int hsu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (ret) return ret; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c index 657629b100fa..e3db213e564b 100644 --- a/drivers/dma/idma64.c +++ b/drivers/dma/idma64.c @@ -535,15 +535,14 @@ static int idma64_probe(struct idma64_chip *chip) unsigned short i; int ret; - idma64 = devm_kzalloc(chip->dev, sizeof(*idma64), GFP_KERNEL); + idma64 = devm_kzalloc_obj(chip->dev, *idma64); if (!idma64) return -ENOMEM; idma64->regs = chip->regs; chip->idma64 = idma64; - idma64->chan = devm_kcalloc(chip->dev, nr_chan, sizeof(*idma64->chan), - GFP_KERNEL); + idma64->chan = devm_kzalloc_objs(chip->dev, *idma64->chan, nr_chan); if (!idma64->chan) return -ENOMEM; @@ -631,7 +630,7 @@ static int idma64_platform_probe(struct platform_device *pdev) struct device *sysdev = dev->parent; int ret; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/dma/img-mdc-dma.c b/drivers/dma/img-mdc-dma.c index a3192d49b6c8..b91807d5ae82 100644 --- a/drivers/dma/img-mdc-dma.c +++ b/drivers/dma/img-mdc-dma.c @@ -889,7 +889,7 @@ static int mdc_dma_probe(struct platform_device *pdev) u32 val; int ret; - mdma = devm_kzalloc(&pdev->dev, sizeof(*mdma), GFP_KERNEL); + mdma = devm_kzalloc_obj(&pdev->dev, *mdma); if (!mdma) return -ENOMEM; platform_set_drvdata(pdev, mdma); diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index 81c6276436f8..ca1d08e90a06 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -1039,7 +1039,7 @@ static int __init imxdma_probe(struct platform_device *pdev) int ret, i; int irq, irq_err; - imxdma = devm_kzalloc(&pdev->dev, sizeof(*imxdma), GFP_KERNEL); + imxdma = devm_kzalloc_obj(&pdev->dev, *imxdma); if (!imxdma) return -ENOMEM; diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 36368835a845..749f1fe77907 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -2248,7 +2248,7 @@ static int sdma_probe(struct platform_device *pdev) if (ret) return ret; - sdma = devm_kzalloc(&pdev->dev, sizeof(*sdma), GFP_KERNEL); + sdma = devm_kzalloc_obj(&pdev->dev, *sdma); if (!sdma) return -ENOMEM; diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c index e84f197fea76..079dda13cf0c 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c @@ -835,7 +835,7 @@ static int k3_dma_probe(struct platform_device *op) struct k3_dma_dev *d; int i, ret, irq = 0; - d = devm_kzalloc(&op->dev, sizeof(*d), GFP_KERNEL); + d = devm_kzalloc_obj(&op->dev, *d); if (!d) return -ENOMEM; @@ -882,8 +882,7 @@ static int k3_dma_probe(struct platform_device *op) return -ENOMEM; /* init phy channel */ - d->phy = devm_kcalloc(&op->dev, - d->dma_channels, sizeof(struct k3_dma_phy), GFP_KERNEL); + d->phy = devm_kzalloc_objs(&op->dev, struct k3_dma_phy, d->dma_channels); if (d->phy == NULL) return -ENOMEM; @@ -917,8 +916,8 @@ static int k3_dma_probe(struct platform_device *op) d->slave.copy_align = DMAENGINE_ALIGN_8_BYTES; /* init virtual channel */ - d->chans = devm_kcalloc(&op->dev, - d->dma_requests, sizeof(struct k3_dma_chan), GFP_KERNEL); + d->chans = devm_kzalloc_objs(&op->dev, struct k3_dma_chan, + d->dma_requests); if (d->chans == NULL) return -ENOMEM; diff --git a/drivers/dma/lgm/lgm-dma.c b/drivers/dma/lgm/lgm-dma.c index c1f859472a96..fb024946c8cf 100644 --- a/drivers/dma/lgm/lgm-dma.c +++ b/drivers/dma/lgm/lgm-dma.c @@ -1567,7 +1567,7 @@ static int intel_ldma_probe(struct platform_device *pdev) u32 id, bitn = 32, j; int i, ret; - d = devm_kzalloc(dev, sizeof(*d), GFP_KERNEL); + d = devm_kzalloc_obj(dev, *d); if (!d) return -ENOMEM; @@ -1641,12 +1641,12 @@ static int intel_ldma_probe(struct platform_device *pdev) INIT_LIST_HEAD(&dma_dev->channels); /* Port Initializations */ - d->ports = devm_kcalloc(dev, d->port_nrs, sizeof(*p), GFP_KERNEL); + d->ports = devm_kzalloc_objs(dev, *p, d->port_nrs); if (!d->ports) return -ENOMEM; /* Channels Initializations */ - d->chans = devm_kcalloc(d->dev, d->chan_nrs, sizeof(*c), GFP_KERNEL); + d->chans = devm_kzalloc_objs(d->dev, *c, d->chan_nrs); if (!d->chans) return -ENOMEM; diff --git a/drivers/dma/loongson/loongson1-apb-dma.c b/drivers/dma/loongson/loongson1-apb-dma.c index 46b4bfef45e2..10a1920ff6c2 100644 --- a/drivers/dma/loongson/loongson1-apb-dma.c +++ b/drivers/dma/loongson/loongson1-apb-dma.c @@ -565,7 +565,7 @@ static int ls1x_dma_probe(struct platform_device *pdev) "Invalid number of IRQ channels: %d\n", ret); - dma = devm_kzalloc(dev, struct_size(dma, chan, ret), GFP_KERNEL); + dma = devm_kzalloc_flex(dev, *dma, chan, ret); if (!dma) return -ENOMEM; dma->nr_chans = ret; diff --git a/drivers/dma/loongson/loongson2-apb-cmc-dma.c b/drivers/dma/loongson/loongson2-apb-cmc-dma.c index 2037120b23ca..ae5f2afee54c 100644 --- a/drivers/dma/loongson/loongson2-apb-cmc-dma.c +++ b/drivers/dma/loongson/loongson2-apb-cmc-dma.c @@ -546,7 +546,7 @@ static int loongson2_cmc_dma_acpi_controller_register(struct loongson2_cmc_dma_d if (!is_acpi_node(dev_fwnode(dev))) return 0; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; @@ -616,7 +616,7 @@ static int loongson2_cmc_dma_probe(struct platform_device *pdev) nr_chans = config->max_channels; } - lddev = devm_kzalloc(dev, struct_size(lddev, chan, nr_chans), GFP_KERNEL); + lddev = devm_kzalloc_flex(dev, *lddev, chan, nr_chans); if (!lddev) return -ENOMEM; diff --git a/drivers/dma/loongson/loongson2-apb-dma.c b/drivers/dma/loongson/loongson2-apb-dma.c index 16a0c1c60d59..10c60fab3d4e 100644 --- a/drivers/dma/loongson/loongson2-apb-dma.c +++ b/drivers/dma/loongson/loongson2-apb-dma.c @@ -598,7 +598,7 @@ static int ls2x_dma_probe(struct platform_device *pdev) struct dma_device *ddev; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/dma/lpc18xx-dmamux.c b/drivers/dma/lpc18xx-dmamux.c index d3ff521951b8..40a338f0d44b 100644 --- a/drivers/dma/lpc18xx-dmamux.c +++ b/drivers/dma/lpc18xx-dmamux.c @@ -124,7 +124,7 @@ static int lpc18xx_dmamux_probe(struct platform_device *pdev) struct lpc18xx_dmamux_data *dmamux; int ret; - dmamux = devm_kzalloc(&pdev->dev, sizeof(*dmamux), GFP_KERNEL); + dmamux = devm_kzalloc_obj(&pdev->dev, *dmamux); if (!dmamux) return -ENOMEM; @@ -155,9 +155,8 @@ static int lpc18xx_dmamux_probe(struct platform_device *pdev) return ret; } - dmamux->muxes = devm_kcalloc(&pdev->dev, dmamux->dma_master_requests, - sizeof(struct lpc18xx_dmamux), - GFP_KERNEL); + dmamux->muxes = devm_kzalloc_objs(&pdev->dev, struct lpc18xx_dmamux, + dmamux->dma_master_requests); if (!dmamux->muxes) return -ENOMEM; diff --git a/drivers/dma/lpc32xx-dmamux.c b/drivers/dma/lpc32xx-dmamux.c index 33be714740dd..4fbeb3496acf 100644 --- a/drivers/dma/lpc32xx-dmamux.c +++ b/drivers/dma/lpc32xx-dmamux.c @@ -165,7 +165,7 @@ static int lpc32xx_dmamux_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct lpc32xx_dmamux_data *dmamux; - dmamux = devm_kzalloc(&pdev->dev, sizeof(*dmamux), GFP_KERNEL); + dmamux = devm_kzalloc_obj(&pdev->dev, *dmamux); if (!dmamux) return -ENOMEM; diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c index 9e1c6400c77b..77a73cf679e1 100644 --- a/drivers/dma/mcf-edma-main.c +++ b/drivers/dma/mcf-edma-main.c @@ -169,8 +169,7 @@ static int mcf_edma_probe(struct platform_device *pdev) chans = pdata->dma_channels; } - mcf_edma = devm_kzalloc(&pdev->dev, struct_size(mcf_edma, chans, chans), - GFP_KERNEL); + mcf_edma = devm_kzalloc_flex(&pdev->dev, *mcf_edma, chans, chans); if (!mcf_edma) return -ENOMEM; diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c index 80791e30aec2..a7000608ddea 100644 --- a/drivers/dma/mediatek/mtk-cqdma.c +++ b/drivers/dma/mediatek/mtk-cqdma.c @@ -751,7 +751,7 @@ static int mtk_cqdma_probe(struct platform_device *pdev) int err; u32 i; - cqdma = devm_kzalloc(&pdev->dev, sizeof(*cqdma), GFP_KERNEL); + cqdma = devm_kzalloc_obj(&pdev->dev, *cqdma); if (!cqdma) return -ENOMEM; @@ -800,15 +800,14 @@ static int mtk_cqdma_probe(struct platform_device *pdev) cqdma->dma_channels = MTK_CQDMA_NR_PCHANS; } - cqdma->pc = devm_kcalloc(&pdev->dev, cqdma->dma_channels, - sizeof(*cqdma->pc), GFP_KERNEL); + cqdma->pc = devm_kzalloc_objs(&pdev->dev, *cqdma->pc, + cqdma->dma_channels); if (!cqdma->pc) return -ENOMEM; /* initialization for PCs */ for (i = 0; i < cqdma->dma_channels; ++i) { - cqdma->pc[i] = devm_kcalloc(&pdev->dev, 1, - sizeof(**cqdma->pc), GFP_KERNEL); + cqdma->pc[i] = devm_kzalloc_objs(&pdev->dev, **cqdma->pc, 1); if (!cqdma->pc[i]) return -ENOMEM; @@ -836,8 +835,8 @@ static int mtk_cqdma_probe(struct platform_device *pdev) } /* allocate resource for VCs */ - cqdma->vc = devm_kcalloc(&pdev->dev, cqdma->dma_requests, - sizeof(*cqdma->vc), GFP_KERNEL); + cqdma->vc = devm_kzalloc_objs(&pdev->dev, *cqdma->vc, + cqdma->dma_requests); if (!cqdma->vc) return -ENOMEM; diff --git a/drivers/dma/mediatek/mtk-hsdma.c b/drivers/dma/mediatek/mtk-hsdma.c index 27cb370106c7..ad5883cf6165 100644 --- a/drivers/dma/mediatek/mtk-hsdma.c +++ b/drivers/dma/mediatek/mtk-hsdma.c @@ -906,7 +906,7 @@ static int mtk_hsdma_probe(struct platform_device *pdev) struct dma_device *dd; int i, err; - hsdma = devm_kzalloc(&pdev->dev, sizeof(*hsdma), GFP_KERNEL); + hsdma = devm_kzalloc_obj(&pdev->dev, *hsdma); if (!hsdma) return -ENOMEM; @@ -962,13 +962,13 @@ static int mtk_hsdma_probe(struct platform_device *pdev) MTK_HSDMA_NR_VCHANS); } - hsdma->pc = devm_kcalloc(&pdev->dev, MTK_HSDMA_NR_MAX_PCHANS, - sizeof(*hsdma->pc), GFP_KERNEL); + hsdma->pc = devm_kzalloc_objs(&pdev->dev, *hsdma->pc, + MTK_HSDMA_NR_MAX_PCHANS); if (!hsdma->pc) return -ENOMEM; - hsdma->vc = devm_kcalloc(&pdev->dev, hsdma->dma_requests, - sizeof(*hsdma->vc), GFP_KERNEL); + hsdma->vc = devm_kzalloc_objs(&pdev->dev, *hsdma->vc, + hsdma->dma_requests); if (!hsdma->vc) return -ENOMEM; diff --git a/drivers/dma/mediatek/mtk-uart-apdma.c b/drivers/dma/mediatek/mtk-uart-apdma.c index f74e9a328588..bf242c4c262f 100644 --- a/drivers/dma/mediatek/mtk-uart-apdma.c +++ b/drivers/dma/mediatek/mtk-uart-apdma.c @@ -484,7 +484,7 @@ static int mtk_uart_apdma_probe(struct platform_device *pdev) unsigned int bit_mask, i; int rc; - mtkd = devm_kzalloc(&pdev->dev, sizeof(*mtkd), GFP_KERNEL); + mtkd = devm_kzalloc_obj(&pdev->dev, *mtkd); if (!mtkd) return -ENOMEM; @@ -529,7 +529,7 @@ static int mtk_uart_apdma_probe(struct platform_device *pdev) } for (i = 0; i < mtkd->dma_requests; i++) { - c = devm_kzalloc(mtkd->ddev.dev, sizeof(*c), GFP_KERNEL); + c = devm_kzalloc_obj(mtkd->ddev.dev, *c); if (!c) { rc = -ENOMEM; goto err_no_dma; diff --git a/drivers/dma/milbeaut-hdmac.c b/drivers/dma/milbeaut-hdmac.c index b4ebc09e80d0..642209721585 100644 --- a/drivers/dma/milbeaut-hdmac.c +++ b/drivers/dma/milbeaut-hdmac.c @@ -467,8 +467,7 @@ static int milbeaut_hdmac_probe(struct platform_device *pdev) if (ret) return ret; - mdev = devm_kzalloc(dev, struct_size(mdev, channels, nr_chans), - GFP_KERNEL); + mdev = devm_kzalloc_flex(dev, *mdev, channels, nr_chans); if (!mdev) return -ENOMEM; diff --git a/drivers/dma/milbeaut-xdmac.c b/drivers/dma/milbeaut-xdmac.c index 0bfa247e746e..630c498bb9af 100644 --- a/drivers/dma/milbeaut-xdmac.c +++ b/drivers/dma/milbeaut-xdmac.c @@ -318,8 +318,7 @@ static int milbeaut_xdmac_probe(struct platform_device *pdev) if (nr_chans < 0) return nr_chans; - mdev = devm_kzalloc(dev, struct_size(mdev, channels, nr_chans), - GFP_KERNEL); + mdev = devm_kzalloc_flex(dev, *mdev, channels, nr_chans); if (!mdev) return -ENOMEM; diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c index 8abd24e2ffc7..6045d6d1cc79 100644 --- a/drivers/dma/mmp_pdma.c +++ b/drivers/dma/mmp_pdma.c @@ -1149,7 +1149,7 @@ static int mmp_pdma_chan_init(struct mmp_pdma_device *pdev, int idx, int irq) struct mmp_pdma_chan *chan; int ret; - chan = devm_kzalloc(pdev->dev, sizeof(*chan), GFP_KERNEL); + chan = devm_kzalloc_obj(pdev->dev, *chan); if (chan == NULL) return -ENOMEM; @@ -1263,7 +1263,7 @@ static int mmp_pdma_probe(struct platform_device *op) DMA_SLAVE_BUSWIDTH_1_BYTE | DMA_SLAVE_BUSWIDTH_2_BYTES | DMA_SLAVE_BUSWIDTH_4_BYTES; - pdev = devm_kzalloc(&op->dev, sizeof(*pdev), GFP_KERNEL); + pdev = devm_kzalloc_obj(&op->dev, *pdev); if (!pdev) return -ENOMEM; @@ -1306,8 +1306,7 @@ static int mmp_pdma_probe(struct platform_device *op) irq_num++; } - pdev->phy = devm_kcalloc(pdev->dev, dma_channels, sizeof(*pdev->phy), - GFP_KERNEL); + pdev->phy = devm_kzalloc_objs(pdev->dev, *pdev->phy, dma_channels); if (pdev->phy == NULL) return -ENOMEM; diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c index ba03321eeff7..d7dd58970060 100644 --- a/drivers/dma/mmp_tdma.c +++ b/drivers/dma/mmp_tdma.c @@ -569,7 +569,7 @@ static int mmp_tdma_chan_init(struct mmp_tdma_device *tdev, } /* alloc channel */ - tdmac = devm_kzalloc(tdev->dev, sizeof(*tdmac), GFP_KERNEL); + tdmac = devm_kzalloc_obj(tdev->dev, *tdmac); if (!tdmac) return -ENOMEM; @@ -643,7 +643,7 @@ static int mmp_tdma_probe(struct platform_device *pdev) type = (kernel_ulong_t)device_get_match_data(&pdev->dev); /* always have couple channels */ - tdev = devm_kzalloc(&pdev->dev, sizeof(*tdev), GFP_KERNEL); + tdev = devm_kzalloc_obj(&pdev->dev, *tdev); if (!tdev) return -ENOMEM; diff --git a/drivers/dma/moxart-dma.c b/drivers/dma/moxart-dma.c index 28be93eed4cc..45233d59d358 100644 --- a/drivers/dma/moxart-dma.c +++ b/drivers/dma/moxart-dma.c @@ -558,7 +558,7 @@ static int moxart_probe(struct platform_device *pdev) struct moxart_chan *ch; struct moxart_dmadev *mdc; - mdc = devm_kzalloc(dev, sizeof(*mdc), GFP_KERNEL); + mdc = devm_kzalloc_obj(dev, *mdc); if (!mdc) return -ENOMEM; diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c index 0adc8e01057e..f67421f2d6d3 100644 --- a/drivers/dma/mpc512x_dma.c +++ b/drivers/dma/mpc512x_dma.c @@ -907,7 +907,7 @@ static int mpc_dma_probe(struct platform_device *op) int retval, i; u8 chancnt; - mdma = devm_kzalloc(dev, sizeof(struct mpc_dma), GFP_KERNEL); + mdma = devm_kzalloc_obj(dev, struct mpc_dma); if (!mdma) { retval = -ENOMEM; goto err; diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index c4e0dce3ca64..92fb996f5b3f 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -1044,7 +1044,7 @@ mv_xor_channel_add(struct mv_xor_device *xordev, struct mv_xor_chan *mv_chan; struct dma_device *dma_dev; - mv_chan = devm_kzalloc(&pdev->dev, sizeof(*mv_chan), GFP_KERNEL); + mv_chan = devm_kzalloc_obj(&pdev->dev, *mv_chan); if (!mv_chan) return ERR_PTR(-ENOMEM); @@ -1321,7 +1321,7 @@ static int mv_xor_probe(struct platform_device *pdev) dev_notice(&pdev->dev, "Marvell shared XOR driver\n"); - xordev = devm_kzalloc(&pdev->dev, sizeof(*xordev), GFP_KERNEL); + xordev = devm_kzalloc_obj(&pdev->dev, *xordev); if (!xordev) return -ENOMEM; diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c index cad4d4fb51ac..1920dcd5886e 100644 --- a/drivers/dma/mv_xor_v2.c +++ b/drivers/dma/mv_xor_v2.c @@ -721,7 +721,7 @@ static int mv_xor_v2_probe(struct platform_device *pdev) BUILD_BUG_ON(sizeof(struct mv_xor_v2_descriptor) != MV_XOR_V2_EXT_DESC_SIZE); - xor_dev = devm_kzalloc(&pdev->dev, sizeof(*xor_dev), GFP_KERNEL); + xor_dev = devm_kzalloc_obj(&pdev->dev, *xor_dev); if (!xor_dev) return -ENOMEM; @@ -781,9 +781,8 @@ static int mv_xor_v2_probe(struct platform_device *pdev) } /* alloc memory for the SW descriptors */ - xor_dev->sw_desq = devm_kcalloc(&pdev->dev, - MV_XOR_V2_DESC_NUM, sizeof(*sw_desc), - GFP_KERNEL); + xor_dev->sw_desq = devm_kzalloc_objs(&pdev->dev, *sw_desc, + MV_XOR_V2_DESC_NUM); if (!xor_dev->sw_desq) { ret = -ENOMEM; goto free_hw_desq; diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c index 7acb3d29dad3..cfe4d759d65f 100644 --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c @@ -748,7 +748,7 @@ static int mxs_dma_probe(struct platform_device *pdev) struct mxs_dma_engine *mxs_dma; int ret, i; - mxs_dma = devm_kzalloc(dev, sizeof(*mxs_dma), GFP_KERNEL); + mxs_dma = devm_kzalloc_obj(dev, *mxs_dma); if (!mxs_dma) return -ENOMEM; diff --git a/drivers/dma/nbpfaxi.c b/drivers/dma/nbpfaxi.c index 744cd14d7872..c9010938c30f 100644 --- a/drivers/dma/nbpfaxi.c +++ b/drivers/dma/nbpfaxi.c @@ -1321,8 +1321,7 @@ static int nbpf_probe(struct platform_device *pdev) cfg = of_device_get_match_data(dev); num_channels = cfg->num_channels; - nbpf = devm_kzalloc(dev, struct_size(nbpf, chan, num_channels), - GFP_KERNEL); + nbpf = devm_kzalloc_flex(dev, *nbpf, chan, num_channels); if (!nbpf) return -ENOMEM; diff --git a/drivers/dma/owl-dma.c b/drivers/dma/owl-dma.c index 9dc88d804a2e..31a6c6e01a75 100644 --- a/drivers/dma/owl-dma.c +++ b/drivers/dma/owl-dma.c @@ -1089,7 +1089,7 @@ static int owl_dma_probe(struct platform_device *pdev) struct owl_dma *od; int ret, i, nr_channels, nr_requests; - od = devm_kzalloc(&pdev->dev, sizeof(*od), GFP_KERNEL); + od = devm_kzalloc_obj(&pdev->dev, *od); if (!od) return -ENOMEM; @@ -1164,8 +1164,8 @@ static int owl_dma_probe(struct platform_device *pdev) } /* Init physical channel */ - od->pchans = devm_kcalloc(&pdev->dev, od->nr_pchans, - sizeof(struct owl_dma_pchan), GFP_KERNEL); + od->pchans = devm_kzalloc_objs(&pdev->dev, struct owl_dma_pchan, + od->nr_pchans); if (!od->pchans) return -ENOMEM; @@ -1177,8 +1177,8 @@ static int owl_dma_probe(struct platform_device *pdev) } /* Init virtual channel */ - od->vchans = devm_kcalloc(&pdev->dev, od->nr_vchans, - sizeof(struct owl_dma_vchan), GFP_KERNEL); + od->vchans = devm_kzalloc_objs(&pdev->dev, struct owl_dma_vchan, + od->nr_vchans); if (!od->vchans) return -ENOMEM; diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index c2d0b473b8f4..977a9fde80ad 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -3024,7 +3024,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) return ret; /* Allocate a new DMAC and its Channels */ - pl330 = devm_kzalloc(&adev->dev, sizeof(*pl330), GFP_KERNEL); + pl330 = devm_kzalloc_obj(&adev->dev, *pl330); if (!pl330) return -ENOMEM; diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c index 4f0d1d531f01..bf03009bb966 100644 --- a/drivers/dma/pxa_dma.c +++ b/drivers/dma/pxa_dma.c @@ -1239,8 +1239,7 @@ static int pxad_init_phys(struct platform_device *op, if (irq0 < 0) return irq0; - pdev->phys = devm_kcalloc(&op->dev, nb_phy_chans, - sizeof(pdev->phys[0]), GFP_KERNEL); + pdev->phys = devm_kzalloc_objs(&op->dev, pdev->phys[0], nb_phy_chans); if (!pdev->phys) return -ENOMEM; @@ -1324,7 +1323,7 @@ static int pxad_init_dmadev(struct platform_device *op, return ret; for (i = 0; i < nr_phy_chans; i++) { - c = devm_kzalloc(&op->dev, sizeof(*c), GFP_KERNEL); + c = devm_kzalloc_obj(&op->dev, *c); if (!c) return -ENOMEM; @@ -1348,7 +1347,7 @@ static int pxad_probe(struct platform_device *op) DMA_SLAVE_BUSWIDTH_1_BYTE | DMA_SLAVE_BUSWIDTH_2_BYTES | DMA_SLAVE_BUSWIDTH_4_BYTES; - pdev = devm_kzalloc(&op->dev, sizeof(*pdev), GFP_KERNEL); + pdev = devm_kzalloc_obj(&op->dev, *pdev); if (!pdev) return -ENOMEM; diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index f67a93a37d48..e62e411dc8f8 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -1249,7 +1249,7 @@ static int bam_dma_probe(struct platform_device *pdev) const struct of_device_id *match; int ret, i; - bdev = devm_kzalloc(&pdev->dev, sizeof(*bdev), GFP_KERNEL); + bdev = devm_kzalloc_obj(&pdev->dev, *bdev); if (!bdev) return -ENOMEM; @@ -1318,8 +1318,8 @@ static int bam_dma_probe(struct platform_device *pdev) tasklet_setup(&bdev->task, dma_tasklet); - bdev->channels = devm_kcalloc(bdev->dev, bdev->num_channels, - sizeof(*bdev->channels), GFP_KERNEL); + bdev->channels = devm_kzalloc_objs(bdev->dev, *bdev->channels, + bdev->num_channels); if (!bdev->channels) { ret = -ENOMEM; diff --git a/drivers/dma/qcom/gpi.c b/drivers/dma/qcom/gpi.c index c41bfac65ddf..d3c3d0f35afb 100644 --- a/drivers/dma/qcom/gpi.c +++ b/drivers/dma/qcom/gpi.c @@ -2170,7 +2170,7 @@ static int gpi_probe(struct platform_device *pdev) u32 ee_offset; int ret; - gpi_dev = devm_kzalloc(&pdev->dev, sizeof(*gpi_dev), GFP_KERNEL); + gpi_dev = devm_kzalloc_obj(&pdev->dev, *gpi_dev); if (!gpi_dev) return -ENOMEM; diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c index 1349066b1544..85844965f0d8 100644 --- a/drivers/dma/qcom/hidma.c +++ b/drivers/dma/qcom/hidma.c @@ -194,7 +194,7 @@ static int hidma_chan_init(struct hidma_dev *dmadev, u32 dma_sig) struct hidma_chan *mchan; struct dma_device *ddev; - mchan = devm_kzalloc(dmadev->ddev.dev, sizeof(*mchan), GFP_KERNEL); + mchan = devm_kzalloc_obj(dmadev->ddev.dev, *mchan); if (!mchan) return -ENOMEM; @@ -640,8 +640,7 @@ hidma_create_sysfs_entry(struct hidma_dev *dev, char *name, int mode) struct device_attribute *attrs; char *name_copy; - attrs = devm_kmalloc(dev->ddev.dev, sizeof(struct device_attribute), - GFP_KERNEL); + attrs = devm_kmalloc_obj(dev->ddev.dev, struct device_attribute); if (!attrs) return NULL; @@ -783,7 +782,7 @@ static int hidma_probe(struct platform_device *pdev) goto bailout; } - dmadev = devm_kzalloc(&pdev->dev, sizeof(*dmadev), GFP_KERNEL); + dmadev = devm_kzalloc_obj(&pdev->dev, *dmadev); if (!dmadev) { rc = -ENOMEM; goto bailout; diff --git a/drivers/dma/qcom/hidma_ll.c b/drivers/dma/qcom/hidma_ll.c index f081aa787f0c..20a484254c92 100644 --- a/drivers/dma/qcom/hidma_ll.c +++ b/drivers/dma/qcom/hidma_ll.c @@ -721,7 +721,7 @@ struct hidma_lldev *hidma_ll_init(struct device *dev, u32 nr_tres, /* need an extra space */ nr_tres += 1; - lldev = devm_kzalloc(dev, sizeof(struct hidma_lldev), GFP_KERNEL); + lldev = devm_kzalloc_obj(dev, struct hidma_lldev); if (!lldev) return NULL; diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c index 4805ce390ffa..e890e9deb987 100644 --- a/drivers/dma/qcom/hidma_mgmt.c +++ b/drivers/dma/qcom/hidma_mgmt.c @@ -183,7 +183,7 @@ static int hidma_mgmt_probe(struct platform_device *pdev) goto out; } - mgmtdev = devm_kzalloc(&pdev->dev, sizeof(*mgmtdev), GFP_KERNEL); + mgmtdev = devm_kzalloc_obj(&pdev->dev, *mgmtdev); if (!mgmtdev) { rc = -ENOMEM; goto out; @@ -265,18 +265,15 @@ static int hidma_mgmt_probe(struct platform_device *pdev) } else max_rd_xactions = mgmtdev->max_rd_xactions; - mgmtdev->priority = devm_kcalloc(&pdev->dev, - mgmtdev->dma_channels, - sizeof(*mgmtdev->priority), - GFP_KERNEL); + mgmtdev->priority = devm_kzalloc_objs(&pdev->dev, *mgmtdev->priority, + mgmtdev->dma_channels); if (!mgmtdev->priority) { rc = -ENOMEM; goto out; } - mgmtdev->weight = devm_kcalloc(&pdev->dev, - mgmtdev->dma_channels, - sizeof(*mgmtdev->weight), GFP_KERNEL); + mgmtdev->weight = devm_kzalloc_objs(&pdev->dev, *mgmtdev->weight, + mgmtdev->dma_channels); if (!mgmtdev->weight) { rc = -ENOMEM; goto out; diff --git a/drivers/dma/qcom/hidma_mgmt_sys.c b/drivers/dma/qcom/hidma_mgmt_sys.c index 9672ef9ee8fc..01b5d790c8a9 100644 --- a/drivers/dma/qcom/hidma_mgmt_sys.c +++ b/drivers/dma/qcom/hidma_mgmt_sys.c @@ -184,8 +184,7 @@ static int create_sysfs_entry(struct hidma_mgmt_dev *dev, char *name, int mode) struct device_attribute *attrs; char *name_copy; - attrs = devm_kmalloc(&dev->pdev->dev, - sizeof(struct device_attribute), GFP_KERNEL); + attrs = devm_kmalloc_obj(&dev->pdev->dev, struct device_attribute); if (!attrs) return -ENOMEM; @@ -209,7 +208,7 @@ static int create_sysfs_entry_channel(struct hidma_mgmt_dev *mdev, char *name, struct hidma_chan_attr *chattr; char *name_copy; - chattr = devm_kmalloc(&mdev->pdev->dev, sizeof(*chattr), GFP_KERNEL); + chattr = devm_kmalloc_obj(&mdev->pdev->dev, *chattr); if (!chattr) return -ENOMEM; diff --git a/drivers/dma/qcom/qcom_adm.c b/drivers/dma/qcom/qcom_adm.c index 07fbe32d31fa..b38ee75a9637 100644 --- a/drivers/dma/qcom/qcom_adm.c +++ b/drivers/dma/qcom/qcom_adm.c @@ -748,7 +748,7 @@ static int adm_dma_probe(struct platform_device *pdev) int ret; u32 i; - adev = devm_kzalloc(&pdev->dev, sizeof(*adev), GFP_KERNEL); + adev = devm_kzalloc_obj(&pdev->dev, *adev); if (!adev) return -ENOMEM; @@ -824,8 +824,8 @@ static int adm_dma_probe(struct platform_device *pdev) reset_control_deassert(adev->c1_reset); reset_control_deassert(adev->c2_reset); - adev->channels = devm_kcalloc(adev->dev, ADM_MAX_CHANNELS, - sizeof(*adev->channels), GFP_KERNEL); + adev->channels = devm_kzalloc_objs(adev->dev, *adev->channels, + ADM_MAX_CHANNELS); if (!adev->channels) { ret = -ENOMEM; diff --git a/drivers/dma/sf-pdma/sf-pdma.c b/drivers/dma/sf-pdma/sf-pdma.c index 6f79cc28703e..4770ec3470cb 100644 --- a/drivers/dma/sf-pdma/sf-pdma.c +++ b/drivers/dma/sf-pdma/sf-pdma.c @@ -513,8 +513,7 @@ static int sf_pdma_probe(struct platform_device *pdev) return -EINVAL; } - pdma = devm_kzalloc(&pdev->dev, struct_size(pdma, chans, n_chans), - GFP_KERNEL); + pdma = devm_kzalloc_flex(&pdev->dev, *pdma, chans, n_chans); if (!pdma) return -ENOMEM; diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c index 3ad8aba5dcd4..dc3900d4d99c 100644 --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -1856,7 +1856,7 @@ static int rcar_dmac_probe(struct platform_device *pdev) if (!data) return -EINVAL; - dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL); + dmac = devm_kzalloc_obj(&pdev->dev, *dmac); if (!dmac) return -ENOMEM; @@ -1884,8 +1884,8 @@ static int rcar_dmac_probe(struct platform_device *pdev) if (data->broken_ipmmu_microTLB0 && device_iommu_mapped(&pdev->dev)) dmac->channels_mask &= ~BIT(0); - dmac->channels = devm_kcalloc(&pdev->dev, dmac->n_channels, - sizeof(*dmac->channels), GFP_KERNEL); + dmac->channels = devm_kzalloc_objs(&pdev->dev, *dmac->channels, + dmac->n_channels); if (!dmac->channels) return -ENOMEM; diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index fdd7131e890a..adad6e34d16b 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -1411,7 +1411,7 @@ static int rz_dmac_probe(struct platform_device *pdev) int irq; u8 i; - dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL); + dmac = devm_kzalloc_obj(&pdev->dev, *dmac); if (!dmac) return -ENOMEM; @@ -1423,8 +1423,8 @@ static int rz_dmac_probe(struct platform_device *pdev) if (ret < 0) return ret; - dmac->channels = devm_kcalloc(&pdev->dev, dmac->n_channels, - sizeof(*dmac->channels), GFP_KERNEL); + dmac->channels = devm_kzalloc_objs(&pdev->dev, *dmac->channels, + dmac->n_channels); if (!dmac->channels) return -ENOMEM; diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c index 603e15102e45..af32fddc2328 100644 --- a/drivers/dma/sh/shdmac.c +++ b/drivers/dma/sh/shdmac.c @@ -532,8 +532,7 @@ static int sh_dmae_chan_probe(struct sh_dmae_device *shdev, int id, struct shdma_chan *schan; int err; - sh_chan = devm_kzalloc(sdev->dma_dev.dev, sizeof(struct sh_dmae_chan), - GFP_KERNEL); + sh_chan = devm_kzalloc_obj(sdev->dma_dev.dev, struct sh_dmae_chan); if (!sh_chan) return -ENOMEM; @@ -719,8 +718,7 @@ static int sh_dmae_probe(struct platform_device *pdev) if (!errirq_res) return -ENODEV; - shdev = devm_kzalloc(&pdev->dev, sizeof(struct sh_dmae_device), - GFP_KERNEL); + shdev = devm_kzalloc_obj(&pdev->dev, struct sh_dmae_device); if (!shdev) return -ENOMEM; diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c index 16509be0d360..679053407f09 100644 --- a/drivers/dma/sh/usb-dmac.c +++ b/drivers/dma/sh/usb-dmac.c @@ -768,7 +768,7 @@ static int usb_dmac_probe(struct platform_device *pdev) int ret; u8 i; - dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL); + dmac = devm_kzalloc_obj(&pdev->dev, *dmac); if (!dmac) return -ENOMEM; @@ -779,8 +779,8 @@ static int usb_dmac_probe(struct platform_device *pdev) if (ret < 0) return ret; - dmac->channels = devm_kcalloc(&pdev->dev, dmac->n_channels, - sizeof(*dmac->channels), GFP_KERNEL); + dmac->channels = devm_kzalloc_objs(&pdev->dev, *dmac->channels, + dmac->n_channels); if (!dmac->channels) return -ENOMEM; diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 60b3067a0099..55ccbb902926 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -1114,9 +1114,7 @@ static int sprd_dma_probe(struct platform_device *pdev) return ret; } - sdev = devm_kzalloc(&pdev->dev, - struct_size(sdev, channels, chn_count), - GFP_KERNEL); + sdev = devm_kzalloc_flex(&pdev->dev, *sdev, channels, chn_count); if (!sdev) return -ENOMEM; diff --git a/drivers/dma/st_fdma.c b/drivers/dma/st_fdma.c index 35dbff5f9f1a..a82058e27aa4 100644 --- a/drivers/dma/st_fdma.c +++ b/drivers/dma/st_fdma.c @@ -746,7 +746,7 @@ static int st_fdma_probe(struct platform_device *pdev) drvdata = device_get_match_data(&pdev->dev); - fdev = devm_kzalloc(&pdev->dev, sizeof(*fdev), GFP_KERNEL); + fdev = devm_kzalloc_obj(&pdev->dev, *fdev); if (!fdev) return -ENOMEM; @@ -756,8 +756,8 @@ static int st_fdma_probe(struct platform_device *pdev) goto err; } - fdev->chans = devm_kcalloc(&pdev->dev, fdev->nr_channels, - sizeof(struct st_fdma_chan), GFP_KERNEL); + fdev->chans = devm_kzalloc_objs(&pdev->dev, struct st_fdma_chan, + fdev->nr_channels); if (!fdev->chans) return -ENOMEM; diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 35fc4d3ea500..8b89d44f9b0d 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -3543,21 +3543,17 @@ static int __init d40_hw_detect_init(struct platform_device *pdev, base->gen_dmac.init_reg_size = ARRAY_SIZE(dma_init_reg_v4a); } - base->phy_res = devm_kcalloc(dev, num_phy_chans, - sizeof(*base->phy_res), - GFP_KERNEL); + base->phy_res = devm_kzalloc_objs(dev, *base->phy_res, num_phy_chans); if (!base->phy_res) return -ENOMEM; - base->lookup_phy_chans = devm_kcalloc(dev, num_phy_chans, - sizeof(*base->lookup_phy_chans), - GFP_KERNEL); + base->lookup_phy_chans = devm_kzalloc_objs(dev, *base->lookup_phy_chans, + num_phy_chans); if (!base->lookup_phy_chans) return -ENOMEM; - base->lookup_log_chans = devm_kcalloc(dev, num_log_chans, - sizeof(*base->lookup_log_chans), - GFP_KERNEL); + base->lookup_log_chans = devm_kzalloc_objs(dev, *base->lookup_log_chans, + num_log_chans); if (!base->lookup_log_chans) return -ENOMEM; @@ -3567,16 +3563,14 @@ static int __init d40_hw_detect_init(struct platform_device *pdev, if (!base->reg_val_backup_chan) return -ENOMEM; - base->lcla_pool.alloc_map = devm_kcalloc(dev, num_phy_chans - * D40_LCLA_LINK_PER_EVENT_GRP, - sizeof(*base->lcla_pool.alloc_map), - GFP_KERNEL); + base->lcla_pool.alloc_map = devm_kzalloc_objs(dev, + *base->lcla_pool.alloc_map, + num_phy_chans * D40_LCLA_LINK_PER_EVENT_GRP); if (!base->lcla_pool.alloc_map) return -ENOMEM; - base->regs_interrupt = devm_kmalloc_array(dev, base->gen_dmac.il_size, - sizeof(*base->regs_interrupt), - GFP_KERNEL); + base->regs_interrupt = devm_kmalloc_objs(dev, *base->regs_interrupt, + base->gen_dmac.il_size); if (!base->regs_interrupt) return -ENOMEM; @@ -3738,7 +3732,7 @@ static int __init d40_of_probe(struct device *dev, const __be32 *list; int ret; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/dma/stm32/stm32-dma.c b/drivers/dma/stm32/stm32-dma.c index 4688cebaf7f7..ba8121d37f51 100644 --- a/drivers/dma/stm32/stm32-dma.c +++ b/drivers/dma/stm32/stm32-dma.c @@ -1566,7 +1566,7 @@ static int stm32_dma_probe(struct platform_device *pdev) struct reset_control *rst; int i, ret; - dmadev = devm_kzalloc(&pdev->dev, sizeof(*dmadev), GFP_KERNEL); + dmadev = devm_kzalloc_obj(&pdev->dev, *dmadev); if (!dmadev) return -ENOMEM; diff --git a/drivers/dma/stm32/stm32-dma3.c b/drivers/dma/stm32/stm32-dma3.c index 4fe226541efa..34d913b09453 100644 --- a/drivers/dma/stm32/stm32-dma3.c +++ b/drivers/dma/stm32/stm32-dma3.c @@ -1733,7 +1733,7 @@ static int stm32_dma3_probe(struct platform_device *pdev) u64 hwcfgr; int ret; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; platform_set_drvdata(pdev, ddata); @@ -1829,8 +1829,8 @@ static int stm32_dma3_probe(struct platform_device *pdev) ddata->axi_max_burst_len); } - ddata->chans = devm_kcalloc(&pdev->dev, ddata->dma_channels, sizeof(*ddata->chans), - GFP_KERNEL); + ddata->chans = devm_kzalloc_objs(&pdev->dev, *ddata->chans, + ddata->dma_channels); if (!ddata->chans) { ret = -ENOMEM; goto err_clk_disable; diff --git a/drivers/dma/stm32/stm32-mdma.c b/drivers/dma/stm32/stm32-mdma.c index 04639e4b554e..4851c1c7ce0c 100644 --- a/drivers/dma/stm32/stm32-mdma.c +++ b/drivers/dma/stm32/stm32-mdma.c @@ -1615,9 +1615,7 @@ static int stm32_mdma_probe(struct platform_device *pdev) if (count < 0) count = 0; - dmadev = devm_kzalloc(&pdev->dev, - struct_size(dmadev, ahb_addr_masks, count), - GFP_KERNEL); + dmadev = devm_kzalloc_flex(&pdev->dev, *dmadev, ahb_addr_masks, count); if (!dmadev) return -ENOMEM; dmadev->nr_ahb_addr_masks = count; diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c index 225e4a53502b..c877defeddfe 100644 --- a/drivers/dma/sun4i-dma.c +++ b/drivers/dma/sun4i-dma.c @@ -1228,7 +1228,7 @@ static int sun4i_dma_probe(struct platform_device *pdev) struct sun4i_dma_dev *priv; int i, j, ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; @@ -1289,13 +1289,12 @@ static int sun4i_dma_probe(struct platform_device *pdev) priv->slave.dev = &pdev->dev; - priv->pchans = devm_kcalloc(&pdev->dev, priv->cfg->dma_nr_max_channels, - sizeof(struct sun4i_dma_pchan), GFP_KERNEL); - priv->vchans = devm_kcalloc(&pdev->dev, SUN4I_DMA_NR_MAX_VCHANS, - sizeof(struct sun4i_dma_vchan), GFP_KERNEL); - priv->pchans_used = devm_kcalloc(&pdev->dev, - BITS_TO_LONGS(priv->cfg->dma_nr_max_channels), - sizeof(unsigned long), GFP_KERNEL); + priv->pchans = devm_kzalloc_objs(&pdev->dev, struct sun4i_dma_pchan, + priv->cfg->dma_nr_max_channels); + priv->vchans = devm_kzalloc_objs(&pdev->dev, struct sun4i_dma_vchan, + SUN4I_DMA_NR_MAX_VCHANS); + priv->pchans_used = devm_kzalloc_objs(&pdev->dev, unsigned long, + BITS_TO_LONGS(priv->cfg->dma_nr_max_channels)); if (!priv->vchans || !priv->pchans || !priv->pchans_used) return -ENOMEM; diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c index cf06cd9bb385..3b849833e08f 100644 --- a/drivers/dma/sun6i-dma.c +++ b/drivers/dma/sun6i-dma.c @@ -1392,7 +1392,7 @@ static int sun6i_dma_probe(struct platform_device *pdev) struct sun6i_dma_dev *sdc; int ret, i; - sdc = devm_kzalloc(&pdev->dev, sizeof(*sdc), GFP_KERNEL); + sdc = devm_kzalloc_obj(&pdev->dev, *sdc); if (!sdc) return -ENOMEM; @@ -1489,13 +1489,13 @@ static int sun6i_dma_probe(struct platform_device *pdev) if (!sdc->num_vchans) sdc->num_vchans = 2 * (sdc->max_request + 1); - sdc->pchans = devm_kcalloc(&pdev->dev, sdc->num_pchans, - sizeof(struct sun6i_pchan), GFP_KERNEL); + sdc->pchans = devm_kzalloc_objs(&pdev->dev, struct sun6i_pchan, + sdc->num_pchans); if (!sdc->pchans) return -ENOMEM; - sdc->vchans = devm_kcalloc(&pdev->dev, sdc->num_vchans, - sizeof(struct sun6i_vchan), GFP_KERNEL); + sdc->vchans = devm_kzalloc_objs(&pdev->dev, struct sun6i_vchan, + sdc->num_vchans); if (!sdc->vchans) return -ENOMEM; diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c index e76c58f213d8..ec12b7288b43 100644 --- a/drivers/dma/tegra186-gpc-dma.c +++ b/drivers/dma/tegra186-gpc-dma.c @@ -1429,9 +1429,8 @@ static int tegra_dma_probe(struct platform_device *pdev) cdata = of_device_get_match_data(&pdev->dev); - tdma = devm_kzalloc(&pdev->dev, - struct_size(tdma, channels, cdata->nr_channels), - GFP_KERNEL); + tdma = devm_kzalloc_flex(&pdev->dev, *tdma, channels, + cdata->nr_channels); if (!tdma) return -ENOMEM; diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c index 21a381d022cf..607f8e0848ac 100644 --- a/drivers/dma/tegra210-adma.c +++ b/drivers/dma/tegra210-adma.c @@ -1044,9 +1044,8 @@ static int tegra_adma_probe(struct platform_device *pdev) "device match data not found\n"); } - tdma = devm_kzalloc(&pdev->dev, - struct_size(tdma, channels, cdata->nr_channels), - GFP_KERNEL); + tdma = devm_kzalloc_flex(&pdev->dev, *tdma, channels, + cdata->nr_channels); if (!tdma) return -ENOMEM; diff --git a/drivers/dma/ti/cppi41.c b/drivers/dma/ti/cppi41.c index 88756dccd62c..f392978deea0 100644 --- a/drivers/dma/ti/cppi41.c +++ b/drivers/dma/ti/cppi41.c @@ -781,7 +781,7 @@ static int cppi41_add_chans(struct device *dev, struct cppi41_dd *cdd) */ n_chans *= 2; - chans = devm_kcalloc(dev, n_chans, sizeof(*chans), GFP_KERNEL); + chans = devm_kzalloc_objs(dev, *chans, n_chans); if (!chans) return -ENOMEM; @@ -1043,7 +1043,7 @@ static int cppi41_dma_probe(struct platform_device *pdev) if (!glue_info) return -EINVAL; - cdd = devm_kzalloc(&pdev->dev, sizeof(*cdd), GFP_KERNEL); + cdd = devm_kzalloc_obj(&pdev->dev, *cdd); if (!cdd) return -ENOMEM; diff --git a/drivers/dma/ti/dma-crossbar.c b/drivers/dma/ti/dma-crossbar.c index f6d75ee94e8d..b1e66792e7de 100644 --- a/drivers/dma/ti/dma-crossbar.c +++ b/drivers/dma/ti/dma-crossbar.c @@ -144,7 +144,7 @@ static int ti_am335x_xbar_probe(struct platform_device *pdev) if (!node) return -ENODEV; - xbar = devm_kzalloc(&pdev->dev, sizeof(*xbar), GFP_KERNEL); + xbar = devm_kzalloc_obj(&pdev->dev, *xbar); if (!xbar) return -ENOMEM; @@ -340,7 +340,7 @@ static int ti_dra7_xbar_probe(struct platform_device *pdev) if (!node) return -ENODEV; - xbar = devm_kzalloc(&pdev->dev, sizeof(*xbar), GFP_KERNEL); + xbar = devm_kzalloc_obj(&pdev->dev, *xbar); if (!xbar) return -ENOMEM; @@ -366,9 +366,8 @@ static int ti_dra7_xbar_probe(struct platform_device *pdev) } of_node_put(dma_node); - xbar->dma_inuse = devm_kcalloc(&pdev->dev, - BITS_TO_LONGS(xbar->dma_requests), - sizeof(unsigned long), GFP_KERNEL); + xbar->dma_inuse = devm_kzalloc_objs(&pdev->dev, unsigned long, + BITS_TO_LONGS(xbar->dma_requests)); if (!xbar->dma_inuse) return -ENOMEM; diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c index 51935eb6f827..f3a98654d126 100644 --- a/drivers/dma/ti/edma.c +++ b/drivers/dma/ti/edma.c @@ -1962,7 +1962,7 @@ static void edma_dma_init(struct edma_cc *ecc, bool legacy_mode) INIT_LIST_HEAD(&s_ddev->channels); if (memcpy_channels) { - m_ddev = devm_kzalloc(ecc->dev, sizeof(*m_ddev), GFP_KERNEL); + m_ddev = devm_kzalloc_obj(ecc->dev, *m_ddev); if (!m_ddev) { dev_warn(ecc->dev, "memcpy is disabled due to OoM\n"); memcpy_channels = NULL; @@ -2064,8 +2064,8 @@ static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata, * priority. So Q0 is the highest priority queue and the last queue has * the lowest priority. */ - queue_priority_map = devm_kcalloc(dev, ecc->num_tc + 1, - sizeof(*queue_priority_map), GFP_KERNEL); + queue_priority_map = devm_kzalloc_objs(dev, *queue_priority_map, + ecc->num_tc + 1); if (!queue_priority_map) return -ENOMEM; @@ -2137,7 +2137,7 @@ static struct edma_soc_info *edma_setup_info_from_dt(struct device *dev, struct property *prop; int sz, ret; - info = devm_kzalloc(dev, sizeof(struct edma_soc_info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, struct edma_soc_info); if (!info) return ERR_PTR(-ENOMEM); @@ -2159,8 +2159,7 @@ static struct edma_soc_info *edma_setup_info_from_dt(struct device *dev, size_t nelm = sz / sizeof(s32); s32 *memcpy_ch; - memcpy_ch = devm_kcalloc(dev, nelm + 1, sizeof(s32), - GFP_KERNEL); + memcpy_ch = devm_kzalloc_objs(dev, s32, nelm + 1); if (!memcpy_ch) return ERR_PTR(-ENOMEM); @@ -2190,14 +2189,13 @@ static struct edma_soc_info *edma_setup_info_from_dt(struct device *dev, if (!tmp) return ERR_PTR(-ENOMEM); - rsv_info = devm_kzalloc(dev, sizeof(*rsv_info), GFP_KERNEL); + rsv_info = devm_kzalloc_obj(dev, *rsv_info); if (!rsv_info) { kfree(tmp); return ERR_PTR(-ENOMEM); } - rsv_slots = devm_kcalloc(dev, nelm + 1, sizeof(*rsv_slots), - GFP_KERNEL); + rsv_slots = devm_kzalloc_objs(dev, *rsv_slots, nelm + 1); if (!rsv_slots) { kfree(tmp); return ERR_PTR(-ENOMEM); @@ -2318,7 +2316,7 @@ static int edma_probe(struct platform_device *pdev) if (ret) return ret; - ecc = devm_kzalloc(dev, sizeof(*ecc), GFP_KERNEL); + ecc = devm_kzalloc_obj(dev, *ecc); if (!ecc) return -ENOMEM; @@ -2358,15 +2356,14 @@ static int edma_probe(struct platform_device *pdev) goto err_disable_pm; /* Allocate memory based on the information we got from the IP */ - ecc->slave_chans = devm_kcalloc(dev, ecc->num_channels, - sizeof(*ecc->slave_chans), GFP_KERNEL); + ecc->slave_chans = devm_kzalloc_objs(dev, *ecc->slave_chans, + ecc->num_channels); - ecc->slot_inuse = devm_kcalloc(dev, BITS_TO_LONGS(ecc->num_slots), - sizeof(unsigned long), GFP_KERNEL); + ecc->slot_inuse = devm_kzalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ecc->num_slots)); - ecc->channels_mask = devm_kcalloc(dev, - BITS_TO_LONGS(ecc->num_channels), - sizeof(unsigned long), GFP_KERNEL); + ecc->channels_mask = devm_kzalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ecc->num_channels)); if (!ecc->slave_chans || !ecc->slot_inuse || !ecc->channels_mask) { ret = -ENOMEM; goto err_disable_pm; @@ -2457,8 +2454,8 @@ static int edma_probe(struct platform_device *pdev) unsigned int array_max; struct of_phandle_args tc_args; - ecc->tc_list = devm_kcalloc(dev, ecc->num_tc, - sizeof(*ecc->tc_list), GFP_KERNEL); + ecc->tc_list = devm_kzalloc_objs(dev, *ecc->tc_list, + ecc->num_tc); if (!ecc->tc_list) { ret = -ENOMEM; goto err_reg1; diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c index 70eaf7ee57e6..f10f61a40f91 100644 --- a/drivers/dma/ti/k3-udma-glue.c +++ b/drivers/dma/ti/k3-udma-glue.c @@ -379,7 +379,7 @@ k3_udma_glue_request_tx_chn(struct device *dev, const char *name, struct k3_udma_glue_tx_channel *tx_chn; int ret; - tx_chn = devm_kzalloc(dev, sizeof(*tx_chn), GFP_KERNEL); + tx_chn = devm_kzalloc_obj(dev, *tx_chn); if (!tx_chn) return ERR_PTR(-ENOMEM); @@ -416,7 +416,7 @@ k3_udma_glue_request_tx_chn_for_thread_id(struct device *dev, struct k3_udma_glue_tx_channel *tx_chn; int ret; - tx_chn = devm_kzalloc(dev, sizeof(*tx_chn), GFP_KERNEL); + tx_chn = devm_kzalloc_obj(dev, *tx_chn); if (!tx_chn) return ERR_PTR(-ENOMEM); @@ -951,7 +951,7 @@ k3_udma_glue_request_rx_chn_priv(struct device *dev, const char *name, (cfg->def_flow_cfg || cfg->flow_id_use_rxchan_id)) return ERR_PTR(-EINVAL); - rx_chn = devm_kzalloc(dev, sizeof(*rx_chn), GFP_KERNEL); + rx_chn = devm_kzalloc_obj(dev, *rx_chn); if (!rx_chn) return ERR_PTR(-ENOMEM); @@ -1033,8 +1033,7 @@ k3_udma_glue_request_rx_chn_priv(struct device *dev, const char *name, rx_chn->flow_num = cfg->flow_id_num; - rx_chn->flows = devm_kcalloc(dev, rx_chn->flow_num, - sizeof(*rx_chn->flows), GFP_KERNEL); + rx_chn->flows = devm_kzalloc_objs(dev, *rx_chn->flows, rx_chn->flow_num); if (!rx_chn->flows) { ret = -ENOMEM; goto err; @@ -1085,8 +1084,7 @@ k3_udma_glue_request_remote_rx_chn_common(struct k3_udma_glue_rx_channel *rx_chn rx_chn->common.psdata_size, rx_chn->common.swdata_size); - rx_chn->flows = devm_kcalloc(dev, rx_chn->flow_num, - sizeof(*rx_chn->flows), GFP_KERNEL); + rx_chn->flows = devm_kzalloc_objs(dev, *rx_chn->flows, rx_chn->flow_num); if (!rx_chn->flows) return -ENOMEM; @@ -1142,7 +1140,7 @@ k3_udma_glue_request_remote_rx_chn(struct device *dev, const char *name, * Linux can only request and manipulate by dedicated RX flows */ - rx_chn = devm_kzalloc(dev, sizeof(*rx_chn), GFP_KERNEL); + rx_chn = devm_kzalloc_obj(dev, *rx_chn); if (!rx_chn) return ERR_PTR(-ENOMEM); @@ -1190,7 +1188,7 @@ k3_udma_glue_request_remote_rx_chn_for_thread_id(struct device *dev, * Linux can only request and manipulate by dedicated RX flows */ - rx_chn = devm_kzalloc(dev, sizeof(*rx_chn), GFP_KERNEL); + rx_chn = devm_kzalloc_obj(dev, *rx_chn); if (!rx_chn) return ERR_PTR(-ENOMEM); diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c index 78a67cb9d6e0..75bd1977fb42 100644 --- a/drivers/dma/ti/k3-udma.c +++ b/drivers/dma/ti/k3-udma.c @@ -4613,26 +4613,19 @@ static int udma_setup_resources(struct udma_dev *ud) ud->rchan_tpl.start_idx[0] = ud->tchan_tpl.start_idx[0]; ud->rchan_tpl.start_idx[1] = ud->tchan_tpl.start_idx[1]; - ud->tchan_map = devm_kmalloc_array(dev, BITS_TO_LONGS(ud->tchan_cnt), - sizeof(unsigned long), GFP_KERNEL); - ud->tchans = devm_kcalloc(dev, ud->tchan_cnt, sizeof(*ud->tchans), - GFP_KERNEL); - ud->rchan_map = devm_kmalloc_array(dev, BITS_TO_LONGS(ud->rchan_cnt), - sizeof(unsigned long), GFP_KERNEL); - ud->rchans = devm_kcalloc(dev, ud->rchan_cnt, sizeof(*ud->rchans), - GFP_KERNEL); - ud->rflow_gp_map = devm_kmalloc_array(dev, BITS_TO_LONGS(ud->rflow_cnt), - sizeof(unsigned long), - GFP_KERNEL); - ud->rflow_gp_map_allocated = devm_kcalloc(dev, - BITS_TO_LONGS(ud->rflow_cnt), - sizeof(unsigned long), - GFP_KERNEL); - ud->rflow_in_use = devm_kcalloc(dev, BITS_TO_LONGS(ud->rflow_cnt), - sizeof(unsigned long), - GFP_KERNEL); - ud->rflows = devm_kcalloc(dev, ud->rflow_cnt, sizeof(*ud->rflows), - GFP_KERNEL); + ud->tchan_map = devm_kmalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ud->tchan_cnt)); + ud->tchans = devm_kzalloc_objs(dev, *ud->tchans, ud->tchan_cnt); + ud->rchan_map = devm_kmalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ud->rchan_cnt)); + ud->rchans = devm_kzalloc_objs(dev, *ud->rchans, ud->rchan_cnt); + ud->rflow_gp_map = devm_kmalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ud->rflow_cnt)); + ud->rflow_gp_map_allocated = devm_kzalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ud->rflow_cnt)); + ud->rflow_in_use = devm_kzalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ud->rflow_cnt)); + ud->rflows = devm_kzalloc_objs(dev, *ud->rflows, ud->rflow_cnt); if (!ud->tchan_map || !ud->rchan_map || !ud->rflow_gp_map || !ud->rflow_gp_map_allocated || !ud->tchans || !ud->rchans || @@ -4787,24 +4780,19 @@ static int bcdma_setup_resources(struct udma_dev *ud) ud->tchan_tpl.levels = 1; } - ud->bchan_map = devm_kmalloc_array(dev, BITS_TO_LONGS(ud->bchan_cnt), - sizeof(unsigned long), GFP_KERNEL); - ud->bchans = devm_kcalloc(dev, ud->bchan_cnt, sizeof(*ud->bchans), - GFP_KERNEL); - ud->tchan_map = devm_kmalloc_array(dev, BITS_TO_LONGS(ud->tchan_cnt), - sizeof(unsigned long), GFP_KERNEL); - ud->tchans = devm_kcalloc(dev, ud->tchan_cnt, sizeof(*ud->tchans), - GFP_KERNEL); - ud->rchan_map = devm_kmalloc_array(dev, BITS_TO_LONGS(ud->rchan_cnt), - sizeof(unsigned long), GFP_KERNEL); - ud->rchans = devm_kcalloc(dev, ud->rchan_cnt, sizeof(*ud->rchans), - GFP_KERNEL); + ud->bchan_map = devm_kmalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ud->bchan_cnt)); + ud->bchans = devm_kzalloc_objs(dev, *ud->bchans, ud->bchan_cnt); + ud->tchan_map = devm_kmalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ud->tchan_cnt)); + ud->tchans = devm_kzalloc_objs(dev, *ud->tchans, ud->tchan_cnt); + ud->rchan_map = devm_kmalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ud->rchan_cnt)); + ud->rchans = devm_kzalloc_objs(dev, *ud->rchans, ud->rchan_cnt); /* BCDMA do not really have flows, but the driver expect it */ - ud->rflow_in_use = devm_kcalloc(dev, BITS_TO_LONGS(ud->rchan_cnt), - sizeof(unsigned long), - GFP_KERNEL); - ud->rflows = devm_kcalloc(dev, ud->rchan_cnt, sizeof(*ud->rflows), - GFP_KERNEL); + ud->rflow_in_use = devm_kzalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ud->rchan_cnt)); + ud->rflows = devm_kzalloc_objs(dev, *ud->rflows, ud->rchan_cnt); if (!ud->bchan_map || !ud->tchan_map || !ud->rchan_map || !ud->rflow_in_use || !ud->bchans || !ud->tchans || !ud->rchans || @@ -4999,21 +4987,17 @@ static int pktdma_setup_resources(struct udma_dev *ud) ud->rchan_tpl.start_idx[0] = ud->tchan_tpl.start_idx[0]; ud->rchan_tpl.start_idx[1] = ud->tchan_tpl.start_idx[1]; - ud->tchan_map = devm_kmalloc_array(dev, BITS_TO_LONGS(ud->tchan_cnt), - sizeof(unsigned long), GFP_KERNEL); - ud->tchans = devm_kcalloc(dev, ud->tchan_cnt, sizeof(*ud->tchans), - GFP_KERNEL); - ud->rchan_map = devm_kmalloc_array(dev, BITS_TO_LONGS(ud->rchan_cnt), - sizeof(unsigned long), GFP_KERNEL); - ud->rchans = devm_kcalloc(dev, ud->rchan_cnt, sizeof(*ud->rchans), - GFP_KERNEL); - ud->rflow_in_use = devm_kcalloc(dev, BITS_TO_LONGS(ud->rflow_cnt), - sizeof(unsigned long), - GFP_KERNEL); - ud->rflows = devm_kcalloc(dev, ud->rflow_cnt, sizeof(*ud->rflows), - GFP_KERNEL); - ud->tflow_map = devm_kmalloc_array(dev, BITS_TO_LONGS(ud->tflow_cnt), - sizeof(unsigned long), GFP_KERNEL); + ud->tchan_map = devm_kmalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ud->tchan_cnt)); + ud->tchans = devm_kzalloc_objs(dev, *ud->tchans, ud->tchan_cnt); + ud->rchan_map = devm_kmalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ud->rchan_cnt)); + ud->rchans = devm_kzalloc_objs(dev, *ud->rchans, ud->rchan_cnt); + ud->rflow_in_use = devm_kzalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ud->rflow_cnt)); + ud->rflows = devm_kzalloc_objs(dev, *ud->rflows, ud->rflow_cnt); + ud->tflow_map = devm_kmalloc_objs(dev, unsigned long, + BITS_TO_LONGS(ud->tflow_cnt)); if (!ud->tchan_map || !ud->rchan_map || !ud->tflow_map || !ud->tchans || !ud->rchans || !ud->rflows || !ud->rflow_in_use) @@ -5158,8 +5142,7 @@ static int setup_resources(struct udma_dev *ud) if (!ch_count) return -ENODEV; - ud->channels = devm_kcalloc(dev, ch_count, sizeof(*ud->channels), - GFP_KERNEL); + ud->channels = devm_kzalloc_objs(dev, *ud->channels, ch_count); if (!ud->channels) return -ENOMEM; @@ -5418,7 +5401,7 @@ static int udma_probe(struct platform_device *pdev) if (ret) dev_err(dev, "failed to set dma mask stuff\n"); - ud = devm_kzalloc(dev, sizeof(*ud), GFP_KERNEL); + ud = devm_kzalloc_obj(dev, *ud); if (!ud) return -ENOMEM; diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c index 55ece7fd0d99..93b6a4682085 100644 --- a/drivers/dma/ti/omap-dma.c +++ b/drivers/dma/ti/omap-dma.c @@ -1660,7 +1660,7 @@ static int omap_dma_probe(struct platform_device *pdev) int rc, i, irq; u32 val; - od = devm_kzalloc(&pdev->dev, sizeof(*od), GFP_KERNEL); + od = devm_kzalloc_obj(&pdev->dev, *od); if (!od) return -ENOMEM; @@ -1754,9 +1754,7 @@ static int omap_dma_probe(struct platform_device *pdev) if (od->plat->dma_attr->dev_caps & HS_CHANNELS_RESERVED) bitmap_set(od->lch_bitmap, 0, 2); - od->lch_map = devm_kcalloc(&pdev->dev, od->lch_count, - sizeof(*od->lch_map), - GFP_KERNEL); + od->lch_map = devm_kzalloc_objs(&pdev->dev, *od->lch_map, od->lch_count); if (!od->lch_map) return -ENOMEM; diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c index ecfaa6a76516..04de7f7ef31d 100644 --- a/drivers/dma/txx9dmac.c +++ b/drivers/dma/txx9dmac.c @@ -1083,7 +1083,7 @@ static int __init txx9dmac_chan_probe(struct platform_device *pdev) int ch = pdev->id % TXX9_DMA_MAX_NR_CHANNELS; int irq; - dc = devm_kzalloc(&pdev->dev, sizeof(*dc), GFP_KERNEL); + dc = devm_kzalloc_obj(&pdev->dev, *dc); if (!dc) return -ENOMEM; @@ -1171,7 +1171,7 @@ static int __init txx9dmac_probe(struct platform_device *pdev) if (IS_ERR(regs)) return PTR_ERR(regs); - ddev = devm_kzalloc(&pdev->dev, sizeof(*ddev), GFP_KERNEL); + ddev = devm_kzalloc_obj(&pdev->dev, *ddev); if (!ddev) return -ENOMEM; diff --git a/drivers/dma/uniphier-mdmac.c b/drivers/dma/uniphier-mdmac.c index a8aa904b88be..a5e38879dd54 100644 --- a/drivers/dma/uniphier-mdmac.c +++ b/drivers/dma/uniphier-mdmac.c @@ -392,8 +392,7 @@ static int uniphier_mdmac_probe(struct platform_device *pdev) if (ret) return ret; - mdev = devm_kzalloc(dev, struct_size(mdev, channels, nr_chans), - GFP_KERNEL); + mdev = devm_kzalloc_flex(dev, *mdev, channels, nr_chans); if (!mdev) return -ENOMEM; diff --git a/drivers/dma/uniphier-xdmac.c b/drivers/dma/uniphier-xdmac.c index 120c0d4f12dd..ed51952b6f86 100644 --- a/drivers/dma/uniphier-xdmac.c +++ b/drivers/dma/uniphier-xdmac.c @@ -492,8 +492,7 @@ static int uniphier_xdmac_probe(struct platform_device *pdev) if (nr_chans > XDMAC_MAX_CHANS) nr_chans = XDMAC_MAX_CHANS; - xdev = devm_kzalloc(dev, struct_size(xdev, channels, nr_chans), - GFP_KERNEL); + xdev = devm_kzalloc_flex(dev, *xdev, channels, nr_chans); if (!xdev) return -ENOMEM; diff --git a/drivers/dma/xgene-dma.c b/drivers/dma/xgene-dma.c index 8d1c58ca0d48..3714099aef07 100644 --- a/drivers/dma/xgene-dma.c +++ b/drivers/dma/xgene-dma.c @@ -1701,7 +1701,7 @@ static int xgene_dma_probe(struct platform_device *pdev) struct xgene_dma *pdma; int ret, i; - pdma = devm_kzalloc(&pdev->dev, sizeof(*pdma), GFP_KERNEL); + pdma = devm_kzalloc_obj(&pdev->dev, *pdma); if (!pdma) return -ENOMEM; diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c index 8d4a5d14e8db..9d827c9a1267 100644 --- a/drivers/dma/xilinx/xdma.c +++ b/drivers/dma/xilinx/xdma.c @@ -444,8 +444,7 @@ static int xdma_alloc_channels(struct xdma_device *xdev, return -EINVAL; } - *chans = devm_kcalloc(&xdev->pdev->dev, *chan_num, sizeof(**chans), - GFP_KERNEL); + *chans = devm_kzalloc_objs(&xdev->pdev->dev, **chans, *chan_num); if (!*chans) return -ENOMEM; @@ -1206,7 +1205,7 @@ static int xdma_probe(struct platform_device *pdev) return -EINVAL; } - xdev = devm_kzalloc(&pdev->dev, sizeof(*xdev), GFP_KERNEL); + xdev = devm_kzalloc_obj(&pdev->dev, *xdev); if (!xdev) return -ENOMEM; diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 0336941d4095..b89f2c3c1579 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -3033,7 +3033,7 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev, int err; /* Allocate and initialize the channel structure */ - chan = devm_kzalloc(xdev->dev, sizeof(*chan), GFP_KERNEL); + chan = devm_kzalloc_obj(xdev->dev, *chan); if (!chan) return -ENOMEM; @@ -3285,7 +3285,7 @@ static int xilinx_dma_probe(struct platform_device *pdev) int i, err; /* Allocate and initialize the DMA engine structure */ - xdev = devm_kzalloc(&pdev->dev, sizeof(*xdev), GFP_KERNEL); + xdev = devm_kzalloc_obj(&pdev->dev, *xdev); if (!xdev) return -ENOMEM; diff --git a/drivers/dma/xilinx/xilinx_dpdma.c b/drivers/dma/xilinx/xilinx_dpdma.c index d9a3542c4531..687fc8ef3d8e 100644 --- a/drivers/dma/xilinx/xilinx_dpdma.c +++ b/drivers/dma/xilinx/xilinx_dpdma.c @@ -1656,7 +1656,7 @@ static int xilinx_dpdma_chan_init(struct xilinx_dpdma_device *xdev, { struct xilinx_dpdma_chan *chan; - chan = devm_kzalloc(xdev->dev, sizeof(*chan), GFP_KERNEL); + chan = devm_kzalloc_obj(xdev->dev, *chan); if (!chan) return -ENOMEM; @@ -1730,7 +1730,7 @@ static int xilinx_dpdma_probe(struct platform_device *pdev) unsigned int i; int ret; - xdev = devm_kzalloc(&pdev->dev, sizeof(*xdev), GFP_KERNEL); + xdev = devm_kzalloc_obj(&pdev->dev, *xdev); if (!xdev) return -ENOMEM; diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c index 3b7dfa53f972..bc85dca47412 100644 --- a/drivers/dma/xilinx/zynqmp_dma.c +++ b/drivers/dma/xilinx/zynqmp_dma.c @@ -919,7 +919,7 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev, const struct zynqmp_dma_config *match_data; int err, ret; - chan = devm_kzalloc(zdev->dev, sizeof(*chan), GFP_KERNEL); + chan = devm_kzalloc_obj(zdev->dev, *chan); if (!chan) return -ENOMEM; chan->dev = zdev->dev; @@ -1089,7 +1089,7 @@ static int zynqmp_dma_probe(struct platform_device *pdev) struct dma_device *p; int ret; - zdev = devm_kzalloc(&pdev->dev, sizeof(*zdev), GFP_KERNEL); + zdev = devm_kzalloc_obj(&pdev->dev, *zdev); if (!zdev) return -ENOMEM; diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c index bb95dab847b3..12175d0cbc43 100644 --- a/drivers/edac/altera_edac.c +++ b/drivers/edac/altera_edac.c @@ -2113,7 +2113,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev) struct altr_arria10_edac *edac; struct device_node *child; - edac = devm_kzalloc(&pdev->dev, sizeof(*edac), GFP_KERNEL); + edac = devm_kzalloc_obj(&pdev->dev, *edac); if (!edac) return -ENOMEM; diff --git a/drivers/edac/ecs.c b/drivers/edac/ecs.c index 51c451c7f0f0..332872d4214c 100644 --- a/drivers/edac/ecs.c +++ b/drivers/edac/ecs.c @@ -149,14 +149,13 @@ static int ecs_create_desc(struct device *ecs_dev, const struct attribute_group struct edac_ecs_context *ecs_ctx; u32 fru; - ecs_ctx = devm_kzalloc(ecs_dev, sizeof(*ecs_ctx), GFP_KERNEL); + ecs_ctx = devm_kzalloc_obj(ecs_dev, *ecs_ctx); if (!ecs_ctx) return -ENOMEM; ecs_ctx->num_media_frus = num_media_frus; - ecs_ctx->fru_ctxs = devm_kcalloc(ecs_dev, num_media_frus, - sizeof(*ecs_ctx->fru_ctxs), - GFP_KERNEL); + ecs_ctx->fru_ctxs = devm_kzalloc_objs(ecs_dev, *ecs_ctx->fru_ctxs, + num_media_frus); if (!ecs_ctx->fru_ctxs) return -ENOMEM; diff --git a/drivers/edac/mem_repair.c b/drivers/edac/mem_repair.c index 108d69209146..9812ce098cf6 100644 --- a/drivers/edac/mem_repair.c +++ b/drivers/edac/mem_repair.c @@ -314,7 +314,7 @@ static int mem_repair_create_desc(struct device *dev, struct edac_mem_repair_context *ctx; struct attribute_group *group; int i; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/edac/octeon_edac-pc.c b/drivers/edac/octeon_edac-pc.c index aa1219db0b17..49952b7cb7db 100644 --- a/drivers/edac/octeon_edac-pc.c +++ b/drivers/edac/octeon_edac-pc.c @@ -83,8 +83,7 @@ static int co_cache_error_event(struct notifier_block *this, static int co_cache_error_probe(struct platform_device *pdev) { - struct co_cache_error *p = devm_kzalloc(&pdev->dev, sizeof(*p), - GFP_KERNEL); + struct co_cache_error *p = devm_kzalloc_obj(&pdev->dev, *p); if (!p) return -ENOMEM; diff --git a/drivers/edac/scrub.c b/drivers/edac/scrub.c index f9d02af2fc3a..e725e2bf0a8d 100644 --- a/drivers/edac/scrub.c +++ b/drivers/edac/scrub.c @@ -169,7 +169,7 @@ static int scrub_create_desc(struct device *scrub_dev, [SCRUB_CUR_CYCLE_DURATION] = EDAC_SCRUB_ATTR_RW(current_cycle_duration, instance) }; - scrub_ctx = devm_kzalloc(scrub_dev, sizeof(*scrub_ctx), GFP_KERNEL); + scrub_ctx = devm_kzalloc_obj(scrub_dev, *scrub_ctx); if (!scrub_ctx) return -ENOMEM; diff --git a/drivers/edac/sifive_edac.c b/drivers/edac/sifive_edac.c index a2b193dc6604..efbf5676c1ca 100644 --- a/drivers/edac/sifive_edac.c +++ b/drivers/edac/sifive_edac.c @@ -44,7 +44,7 @@ static int ecc_register(struct platform_device *pdev) { struct sifive_edac_priv *p; - p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(&pdev->dev, *p); if (!p) return -ENOMEM; diff --git a/drivers/edac/versalnet_edac.c b/drivers/edac/versalnet_edac.c index eae9fea60db1..d59ba3904cda 100644 --- a/drivers/edac/versalnet_edac.c +++ b/drivers/edac/versalnet_edac.c @@ -903,7 +903,7 @@ static int mc_probe(struct platform_device *pdev) goto err_rproc_boot; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) { rc = -ENOMEM; goto err_alloc; diff --git a/drivers/edac/xgene_edac.c b/drivers/edac/xgene_edac.c index 62b8166dc287..1956affcdc59 100644 --- a/drivers/edac/xgene_edac.c +++ b/drivers/edac/xgene_edac.c @@ -1847,7 +1847,7 @@ static int xgene_edac_probe(struct platform_device *pdev) struct resource *res; int rc; - edac = devm_kzalloc(&pdev->dev, sizeof(*edac), GFP_KERNEL); + edac = devm_kzalloc_obj(&pdev->dev, *edac); if (!edac) return -ENOMEM; diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c index e735f43dcdeb..9557b470c07d 100644 --- a/drivers/extcon/extcon-adc-jack.c +++ b/drivers/extcon/extcon-adc-jack.c @@ -100,7 +100,7 @@ static int adc_jack_probe(struct platform_device *pdev) struct adc_jack_pdata *pdata = dev_get_platdata(&pdev->dev); int i, err = 0; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c index 19856dddade6..2a42647308b0 100644 --- a/drivers/extcon/extcon-axp288.c +++ b/drivers/extcon/extcon-axp288.c @@ -368,7 +368,7 @@ static int axp288_extcon_probe(struct platform_device *pdev) struct acpi_device *adev; int ret, i, pirq; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/extcon/extcon-fsa9480.c b/drivers/extcon/extcon-fsa9480.c index a031eb0914a0..89ffd9efb0cc 100644 --- a/drivers/extcon/extcon-fsa9480.c +++ b/drivers/extcon/extcon-fsa9480.c @@ -267,7 +267,7 @@ static int fsa9480_probe(struct i2c_client *client) return -EINVAL; } - info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&client->dev, *info); if (!info) return -ENOMEM; info->dev = &client->dev; diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c index 4105df74f2b0..4d919b68455b 100644 --- a/drivers/extcon/extcon-gpio.c +++ b/drivers/extcon/extcon-gpio.c @@ -70,7 +70,7 @@ static int gpio_extcon_probe(struct platform_device *pdev) int irq; int ret; - data = devm_kzalloc(dev, sizeof(struct gpio_extcon_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct gpio_extcon_data); if (!data) return -ENOMEM; diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c index 99a9dfc62e2b..9281c5addf0a 100644 --- a/drivers/extcon/extcon-intel-cht-wc.c +++ b/drivers/extcon/extcon-intel-cht-wc.c @@ -500,7 +500,7 @@ static int cht_wc_extcon_probe(struct platform_device *pdev) if (irq < 0) return irq; - ext = devm_kzalloc(&pdev->dev, sizeof(*ext), GFP_KERNEL); + ext = devm_kzalloc_obj(&pdev->dev, *ext); if (!ext) return -ENOMEM; diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c index 7d16d5b7d58f..387aa2d87fc8 100644 --- a/drivers/extcon/extcon-intel-int3496.c +++ b/drivers/extcon/extcon-intel-int3496.c @@ -125,7 +125,7 @@ static int int3496_probe(struct platform_device *pdev) } } - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/extcon/extcon-intel-mrfld.c b/drivers/extcon/extcon-intel-mrfld.c index 7246d704fa3d..61bf7a585783 100644 --- a/drivers/extcon/extcon-intel-mrfld.c +++ b/drivers/extcon/extcon-intel-mrfld.c @@ -204,7 +204,7 @@ static int mrfld_extcon_probe(struct platform_device *pdev) if (irq < 0) return irq; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/extcon/extcon-lc824206xa.c b/drivers/extcon/extcon-lc824206xa.c index 56938748aea8..506bba82697f 100644 --- a/drivers/extcon/extcon-lc824206xa.c +++ b/drivers/extcon/extcon-lc824206xa.c @@ -419,7 +419,7 @@ static int lc824206xa_probe(struct i2c_client *client) struct lc824206xa_data *data; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/extcon/extcon-max14526.c b/drivers/extcon/extcon-max14526.c index bf8997827475..a491328937d6 100644 --- a/drivers/extcon/extcon-max14526.c +++ b/drivers/extcon/extcon-max14526.c @@ -204,7 +204,7 @@ static int max14526_probe(struct i2c_client *client) struct max14526_data *priv; int ret, dev_id, rev, i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c index 5476f48ed74b..7eefc13e9f59 100644 --- a/drivers/extcon/extcon-max14577.c +++ b/drivers/extcon/extcon-max14577.c @@ -664,7 +664,7 @@ static int max14577_muic_probe(struct platform_device *pdev) int i; u8 id; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/extcon/extcon-max3355.c b/drivers/extcon/extcon-max3355.c index d687d178aff1..5bcb6861b36c 100644 --- a/drivers/extcon/extcon-max3355.c +++ b/drivers/extcon/extcon-max3355.c @@ -56,8 +56,7 @@ static int max3355_probe(struct platform_device *pdev) struct gpio_desc *gpiod; int irq, err; - data = devm_kzalloc(&pdev->dev, sizeof(struct max3355_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct max3355_data); if (!data) return -ENOMEM; diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c index 2c567e0b7b7f..d6ae6f596dbd 100644 --- a/drivers/extcon/extcon-max77693.c +++ b/drivers/extcon/extcon-max77693.c @@ -1079,8 +1079,7 @@ static int max77693_muic_probe(struct platform_device *pdev) int i; unsigned int id; - info = devm_kzalloc(&pdev->dev, sizeof(struct max77693_muic_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct max77693_muic_info); if (!info) return -ENOMEM; diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c index 2ae9f7f1a67f..c16606b23855 100644 --- a/drivers/extcon/extcon-max77843.c +++ b/drivers/extcon/extcon-max77843.c @@ -815,7 +815,7 @@ static int max77843_muic_probe(struct platform_device *pdev) bool attached; int i, ret; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c index 9cddf08e0696..4e2a07e6c8a6 100644 --- a/drivers/extcon/extcon-max8997.c +++ b/drivers/extcon/extcon-max8997.c @@ -639,8 +639,7 @@ static int max8997_muic_probe(struct platform_device *pdev) bool attached; int ret, i; - info = devm_kzalloc(&pdev->dev, sizeof(struct max8997_muic_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct max8997_muic_info); if (!info) return -ENOMEM; diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c index d339b8680445..9a75c6cee2df 100644 --- a/drivers/extcon/extcon-palmas.c +++ b/drivers/extcon/extcon-palmas.c @@ -184,7 +184,7 @@ static int palmas_usb_probe(struct platform_device *pdev) return -EINVAL; } - palmas_usb = devm_kzalloc(&pdev->dev, sizeof(*palmas_usb), GFP_KERNEL); + palmas_usb = devm_kzalloc_obj(&pdev->dev, *palmas_usb); if (!palmas_usb) return -ENOMEM; diff --git a/drivers/extcon/extcon-ptn5150.c b/drivers/extcon/extcon-ptn5150.c index eca1b140aeb0..0b96b58b4212 100644 --- a/drivers/extcon/extcon-ptn5150.c +++ b/drivers/extcon/extcon-ptn5150.c @@ -263,7 +263,7 @@ static int ptn5150_i2c_probe(struct i2c_client *i2c) if (!np) return -EINVAL; - info = devm_kzalloc(&i2c->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&i2c->dev, *info); if (!info) return -ENOMEM; i2c_set_clientdata(i2c, info); diff --git a/drivers/extcon/extcon-qcom-spmi-misc.c b/drivers/extcon/extcon-qcom-spmi-misc.c index 3c522c9c92f3..a8200426f8ea 100644 --- a/drivers/extcon/extcon-qcom-spmi-misc.c +++ b/drivers/extcon/extcon-qcom-spmi-misc.c @@ -89,7 +89,7 @@ static int qcom_usb_extcon_probe(struct platform_device *pdev) struct qcom_usb_extcon_info *info; int ret; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/extcon/extcon-rt8973a.c b/drivers/extcon/extcon-rt8973a.c index 19bb49f13fb0..234c12311743 100644 --- a/drivers/extcon/extcon-rt8973a.c +++ b/drivers/extcon/extcon-rt8973a.c @@ -557,7 +557,7 @@ static int rt8973a_muic_i2c_probe(struct i2c_client *i2c) if (!np) return -EINVAL; - info = devm_kzalloc(&i2c->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&i2c->dev, *info); if (!info) return -ENOMEM; i2c_set_clientdata(i2c, info); diff --git a/drivers/extcon/extcon-rtk-type-c.c b/drivers/extcon/extcon-rtk-type-c.c index da0b3fd3676e..d85a51cb4abc 100644 --- a/drivers/extcon/extcon-rtk-type-c.c +++ b/drivers/extcon/extcon-rtk-type-c.c @@ -1321,7 +1321,7 @@ static int extcon_rtk_type_c_probe(struct platform_device *pdev) const struct type_c_cfg *type_c_cfg; int ret = 0; - type_c = devm_kzalloc(dev, sizeof(*type_c), GFP_KERNEL); + type_c = devm_kzalloc_obj(dev, *type_c); if (!type_c) return -ENOMEM; @@ -1368,8 +1368,7 @@ static int extcon_rtk_type_c_probe(struct platform_device *pdev) goto err; } - type_c->type_c_cfg = devm_kzalloc(dev, sizeof(*type_c->type_c_cfg), - GFP_KERNEL); + type_c->type_c_cfg = devm_kzalloc_obj(dev, *type_c->type_c_cfg); if (!type_c->type_c_cfg) return -ENOMEM; diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c index c8c4b9ef72aa..9ab2553f1f55 100644 --- a/drivers/extcon/extcon-sm5502.c +++ b/drivers/extcon/extcon-sm5502.c @@ -681,7 +681,7 @@ static int sm5022_muic_i2c_probe(struct i2c_client *i2c) if (!np) return -EINVAL; - info = devm_kzalloc(&i2c->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&i2c->dev, *info); if (!info) return -ENOMEM; i2c_set_clientdata(i2c, info); diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c index e35fd1f699a6..680e925cc1c6 100644 --- a/drivers/extcon/extcon-usb-gpio.c +++ b/drivers/extcon/extcon-usb-gpio.c @@ -103,7 +103,7 @@ static int usb_extcon_probe(struct platform_device *pdev) if (!np) return -EINVAL; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/extcon/extcon-usbc-cros-ec.c b/drivers/extcon/extcon-usbc-cros-ec.c index a2ef710b0d6d..9dcafc77985e 100644 --- a/drivers/extcon/extcon-usbc-cros-ec.c +++ b/drivers/extcon/extcon-usbc-cros-ec.c @@ -388,7 +388,7 @@ static int extcon_cros_ec_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; int numports, ret; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c index 920b03421850..a824df652464 100644 --- a/drivers/extcon/extcon-usbc-tusb320.c +++ b/drivers/extcon/extcon-usbc-tusb320.c @@ -517,7 +517,7 @@ static int tusb320_probe(struct i2c_client *client) u32 irq_trigger_type = IRQF_TRIGGER_FALLING; struct irq_data *irq_d; - priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&client->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index c06e8d87239c..20e561ed395d 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -3788,7 +3788,8 @@ static int pci_probe(struct pci_dev *dev, reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, ~0); ohci->ir_context_mask = ohci->ir_context_support; ohci->n_ir = hweight32(ohci->ir_context_mask); - ohci->ir_context_list = devm_kcalloc(&dev->dev, ohci->n_ir, sizeof(struct iso_context), GFP_KERNEL); + ohci->ir_context_list = devm_kzalloc_objs(&dev->dev, struct iso_context, + ohci->n_ir); if (!ohci->ir_context_list) return -ENOMEM; @@ -3802,7 +3803,8 @@ static int pci_probe(struct pci_dev *dev, reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, ~0); ohci->it_context_mask = ohci->it_context_support; ohci->n_it = hweight32(ohci->it_context_mask); - ohci->it_context_list = devm_kcalloc(&dev->dev, ohci->n_it, sizeof(struct iso_context), GFP_KERNEL); + ohci->it_context_list = devm_kzalloc_objs(&dev->dev, struct iso_context, + ohci->n_it); if (!ohci->it_context_list) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index 0278705d809e..6b5d50b35a48 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -271,9 +271,9 @@ static int iter_clk_possible_parents_update_state(struct scmi_iterator_state *st if (!st->max_resources) { int num_parents = st->num_returned + st->num_remaining; - p->clkd->info.parents = devm_kcalloc(p->dev, num_parents, - sizeof(*p->clkd->info.parents), - GFP_KERNEL); + p->clkd->info.parents = devm_kzalloc_objs(p->dev, + *p->clkd->info.parents, + num_parents); if (!p->clkd->info.parents) return -ENOMEM; @@ -484,8 +484,8 @@ iter_clk_describe_update_state(struct scmi_iterator_state *st, if (!st->max_resources) { unsigned int tot_rates = st->num_returned + st->num_remaining; - p->clkd->r.rates = devm_kcalloc(p->dev, tot_rates, - sizeof(*p->clkd->r.rates), GFP_KERNEL); + p->clkd->r.rates = devm_kzalloc_objs(p->dev, *p->clkd->r.rates, + tot_rates); if (!p->clkd->r.rates) return -ENOMEM; @@ -1237,7 +1237,7 @@ static int scmi_clock_protocol_init(const struct scmi_protocol_handle *ph) dev_dbg(ph->dev, "Clock Version %d.%d\n", PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); - cinfo = devm_kzalloc(ph->dev, sizeof(*cinfo), GFP_KERNEL); + cinfo = devm_kzalloc_obj(ph->dev, *cinfo); if (!cinfo) return -ENOMEM; @@ -1245,8 +1245,8 @@ static int scmi_clock_protocol_init(const struct scmi_protocol_handle *ph) if (ret) return ret; - cinfo->clkds = devm_kcalloc(ph->dev, cinfo->num_clocks, - sizeof(*cinfo->clkds), GFP_KERNEL); + cinfo->clkds = devm_kzalloc_objs(ph->dev, *cinfo->clkds, + cinfo->num_clocks); if (!cinfo->clkds) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 1e6f69b14321..05092301db29 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -2032,7 +2032,7 @@ scmi_common_fastchannel_init(const struct scmi_protocol_handle *ph, *p_addr = addr; if (p_db && SUPPORTS_DOORBELL(flags)) { - db = devm_kzalloc(ph->dev, sizeof(*db), GFP_KERNEL); + db = devm_kzalloc_obj(ph->dev, *db); if (!db) { ret = -ENOMEM; goto err_db; @@ -2275,7 +2275,7 @@ scmi_alloc_init_protocol_instance(struct scmi_info *info, goto out; } - pi = devm_kzalloc(handle->dev, sizeof(*pi), GFP_KERNEL); + pi = devm_kzalloc_obj(handle->dev, *pi); if (!pi) goto clean; @@ -2718,7 +2718,7 @@ static int __scmi_xfer_info_init(struct scmi_info *sinfo, */ INIT_HLIST_HEAD(&info->free_xfers); for (i = 0; i < info->max_msg; i++) { - xfer = devm_kzalloc(dev, sizeof(*xfer), GFP_KERNEL); + xfer = devm_kzalloc_obj(dev, *xfer); if (!xfer) return -ENOMEM; @@ -2803,7 +2803,7 @@ static int scmi_chan_setup(struct scmi_info *info, struct fwnode_handle *fwnode, goto idr_alloc; } - cinfo = devm_kzalloc(info->dev, sizeof(*cinfo), GFP_KERNEL); + cinfo = devm_kzalloc_obj(info->dev, *cinfo); if (!cinfo) return -ENOMEM; @@ -3121,7 +3121,7 @@ static struct scmi_debug_info *scmi_debugfs_common_setup(struct scmi_info *info) struct scmi_debug_info *dbg; const char *c_ptr = NULL; - dbg = devm_kzalloc(info->dev, sizeof(*dbg), GFP_KERNEL); + dbg = devm_kzalloc_obj(info->dev, *dbg); if (!dbg) return NULL; @@ -3339,7 +3339,7 @@ static int scmi_probe(struct platform_device *pdev) goto out_err; } - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c index fb60fb07c0ed..bc046f2f83a6 100644 --- a/drivers/firmware/arm_scmi/notify.c +++ b/drivers/firmware/arm_scmi/notify.c @@ -706,9 +706,8 @@ scmi_allocate_registered_events_desc(struct scmi_notify_instance *ni, if (WARN_ON(ni->registered_protocols[proto_id])) return ERR_PTR(-EINVAL); - pd = devm_kzalloc(ni->handle->dev, - struct_size(pd, registered_events, num_events), - GFP_KERNEL); + pd = devm_kzalloc_flex(ni->handle->dev, *pd, registered_events, + num_events); if (!pd) return ERR_PTR(-ENOMEM); @@ -794,9 +793,8 @@ int scmi_register_protocol_events(const struct scmi_handle *handle, u8 proto_id, int id; struct scmi_registered_event *r_evt; - r_evt = devm_kzalloc(ni->handle->dev, - struct_size(r_evt, sources, num_sources), - GFP_KERNEL); + r_evt = devm_kzalloc_flex(ni->handle->dev, *r_evt, sources, + num_sources); if (!r_evt) return -ENOMEM; @@ -1662,7 +1660,7 @@ int scmi_notification_init(struct scmi_handle *handle) if (!gid) return -ENOMEM; - ni = devm_kzalloc(handle->dev, sizeof(*ni), GFP_KERNEL); + ni = devm_kzalloc_obj(handle->dev, *ni); if (!ni) goto err; diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c index 4583d02bee1c..0116ffb2b279 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -830,7 +830,7 @@ static void scmi_perf_domain_init_fc(const struct scmi_protocol_handle *ph, { struct scmi_fc_info *fc; - fc = devm_kcalloc(ph->dev, PERF_FC_MAX, sizeof(*fc), GFP_KERNEL); + fc = devm_kzalloc_objs(ph->dev, *fc, PERF_FC_MAX); if (!fc) return; @@ -1274,7 +1274,7 @@ static int scmi_perf_protocol_init(const struct scmi_protocol_handle *ph) dev_dbg(ph->dev, "Performance Version %d.%d\n", PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); - pinfo = devm_kzalloc(ph->dev, sizeof(*pinfo), GFP_KERNEL); + pinfo = devm_kzalloc_obj(ph->dev, *pinfo); if (!pinfo) return -ENOMEM; @@ -1282,8 +1282,8 @@ static int scmi_perf_protocol_init(const struct scmi_protocol_handle *ph) if (ret) return ret; - pinfo->dom_info = devm_kcalloc(ph->dev, pinfo->num_domains, - sizeof(*pinfo->dom_info), GFP_KERNEL); + pinfo->dom_info = devm_kzalloc_objs(ph->dev, *pinfo->dom_info, + pinfo->num_domains); if (!pinfo->dom_info) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/pinctrl.c b/drivers/firmware/arm_scmi/pinctrl.c index cc45eaa0018a..18761ffbf893 100644 --- a/drivers/firmware/arm_scmi/pinctrl.c +++ b/drivers/firmware/arm_scmi/pinctrl.c @@ -834,7 +834,7 @@ static int scmi_pinctrl_protocol_init(const struct scmi_protocol_handle *ph) dev_dbg(ph->dev, "Pinctrl Version %d.%d\n", PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); - pinfo = devm_kzalloc(ph->dev, sizeof(*pinfo), GFP_KERNEL); + pinfo = devm_kzalloc_obj(ph->dev, *pinfo); if (!pinfo) return -ENOMEM; @@ -842,18 +842,17 @@ static int scmi_pinctrl_protocol_init(const struct scmi_protocol_handle *ph) if (ret) return ret; - pinfo->pins = devm_kcalloc(ph->dev, pinfo->nr_pins, - sizeof(*pinfo->pins), GFP_KERNEL); + pinfo->pins = devm_kzalloc_objs(ph->dev, *pinfo->pins, pinfo->nr_pins); if (!pinfo->pins) return -ENOMEM; - pinfo->groups = devm_kcalloc(ph->dev, pinfo->nr_groups, - sizeof(*pinfo->groups), GFP_KERNEL); + pinfo->groups = devm_kzalloc_objs(ph->dev, *pinfo->groups, + pinfo->nr_groups); if (!pinfo->groups) return -ENOMEM; - pinfo->functions = devm_kcalloc(ph->dev, pinfo->nr_functions, - sizeof(*pinfo->functions), GFP_KERNEL); + pinfo->functions = devm_kzalloc_objs(ph->dev, *pinfo->functions, + pinfo->nr_functions); if (!pinfo->functions) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/power.c b/drivers/firmware/arm_scmi/power.c index 28ef63a4ecc2..62294927112b 100644 --- a/drivers/firmware/arm_scmi/power.c +++ b/drivers/firmware/arm_scmi/power.c @@ -331,7 +331,7 @@ static int scmi_power_protocol_init(const struct scmi_protocol_handle *ph) dev_dbg(ph->dev, "Power Version %d.%d\n", PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); - pinfo = devm_kzalloc(ph->dev, sizeof(*pinfo), GFP_KERNEL); + pinfo = devm_kzalloc_obj(ph->dev, *pinfo); if (!pinfo) return -ENOMEM; @@ -339,8 +339,8 @@ static int scmi_power_protocol_init(const struct scmi_protocol_handle *ph) if (ret) return ret; - pinfo->dom_info = devm_kcalloc(ph->dev, pinfo->num_domains, - sizeof(*pinfo->dom_info), GFP_KERNEL); + pinfo->dom_info = devm_kzalloc_objs(ph->dev, *pinfo->dom_info, + pinfo->num_domains); if (!pinfo->dom_info) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/powercap.c b/drivers/firmware/arm_scmi/powercap.c index 27e3c805e927..e6dd18c6a154 100644 --- a/drivers/firmware/arm_scmi/powercap.c +++ b/drivers/firmware/arm_scmi/powercap.c @@ -721,7 +721,7 @@ static void scmi_powercap_domain_init_fc(const struct scmi_protocol_handle *ph, { struct scmi_fc_info *fc; - fc = devm_kcalloc(ph->dev, POWERCAP_FC_MAX, sizeof(*fc), GFP_KERNEL); + fc = devm_kzalloc_objs(ph->dev, *fc, POWERCAP_FC_MAX); if (!fc) return; @@ -975,7 +975,7 @@ scmi_powercap_protocol_init(const struct scmi_protocol_handle *ph) dev_dbg(ph->dev, "Powercap Version %d.%d\n", PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); - pinfo = devm_kzalloc(ph->dev, sizeof(*pinfo), GFP_KERNEL); + pinfo = devm_kzalloc_obj(ph->dev, *pinfo); if (!pinfo) return -ENOMEM; @@ -983,14 +983,13 @@ scmi_powercap_protocol_init(const struct scmi_protocol_handle *ph) if (ret) return ret; - pinfo->powercaps = devm_kcalloc(ph->dev, pinfo->num_domains, - sizeof(*pinfo->powercaps), - GFP_KERNEL); + pinfo->powercaps = devm_kzalloc_objs(ph->dev, *pinfo->powercaps, + pinfo->num_domains); if (!pinfo->powercaps) return -ENOMEM; - pinfo->states = devm_kcalloc(ph->dev, pinfo->num_domains, - sizeof(*pinfo->states), GFP_KERNEL); + pinfo->states = devm_kzalloc_objs(ph->dev, *pinfo->states, + pinfo->num_domains); if (!pinfo->states) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/raw_mode.c b/drivers/firmware/arm_scmi/raw_mode.c index f01bf2f6ce1d..7e42dd6cc2af 100644 --- a/drivers/firmware/arm_scmi/raw_mode.c +++ b/drivers/firmware/arm_scmi/raw_mode.c @@ -1098,11 +1098,11 @@ scmi_raw_queue_init(struct scmi_raw_mode_info *raw) struct device *dev = raw->handle->dev; struct scmi_raw_queue *q; - q = devm_kzalloc(dev, sizeof(*q), GFP_KERNEL); + q = devm_kzalloc_obj(dev, *q); if (!q) return ERR_PTR(-ENOMEM); - rb = devm_kcalloc(dev, raw->tx_max_msg, sizeof(*rb), GFP_KERNEL); + rb = devm_kzalloc_objs(dev, *rb, raw->tx_max_msg); if (!rb) return ERR_PTR(-ENOMEM); @@ -1129,7 +1129,7 @@ static int scmi_xfer_raw_worker_init(struct scmi_raw_mode_info *raw) struct scmi_xfer_raw_waiter *rw; struct device *dev = raw->handle->dev; - rw = devm_kcalloc(dev, raw->tx_max_msg, sizeof(*rw), GFP_KERNEL); + rw = devm_kzalloc_objs(dev, *rw, raw->tx_max_msg); if (!rw) return -ENOMEM; @@ -1241,7 +1241,7 @@ void *scmi_raw_mode_init(const struct scmi_handle *handle, return ERR_PTR(-EINVAL); dev = handle->dev; - raw = devm_kzalloc(dev, sizeof(*raw), GFP_KERNEL); + raw = devm_kzalloc_obj(dev, *raw); if (!raw) return ERR_PTR(-ENOMEM); diff --git a/drivers/firmware/arm_scmi/reset.c b/drivers/firmware/arm_scmi/reset.c index 2cdddc28ba47..7d92d98b7999 100644 --- a/drivers/firmware/arm_scmi/reset.c +++ b/drivers/firmware/arm_scmi/reset.c @@ -345,7 +345,7 @@ static int scmi_reset_protocol_init(const struct scmi_protocol_handle *ph) dev_dbg(ph->dev, "Reset Version %d.%d\n", PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); - pinfo = devm_kzalloc(ph->dev, sizeof(*pinfo), GFP_KERNEL); + pinfo = devm_kzalloc_obj(ph->dev, *pinfo); if (!pinfo) return -ENOMEM; @@ -353,8 +353,8 @@ static int scmi_reset_protocol_init(const struct scmi_protocol_handle *ph) if (ret) return ret; - pinfo->dom_info = devm_kcalloc(ph->dev, pinfo->num_domains, - sizeof(*pinfo->dom_info), GFP_KERNEL); + pinfo->dom_info = devm_kzalloc_objs(ph->dev, *pinfo->dom_info, + pinfo->num_domains); if (!pinfo->dom_info) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/scmi_power_control.c b/drivers/firmware/arm_scmi/scmi_power_control.c index 955736336061..e791a206768c 100644 --- a/drivers/firmware/arm_scmi/scmi_power_control.c +++ b/drivers/firmware/arm_scmi/scmi_power_control.c @@ -341,7 +341,7 @@ static int scmi_syspower_probe(struct scmi_device *sdev) if (ret) return ret; - sc = devm_kzalloc(&sdev->dev, sizeof(*sc), GFP_KERNEL); + sc = devm_kzalloc_obj(&sdev->dev, *sc); if (!sc) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c index b14bb1146356..8cc78393c20f 100644 --- a/drivers/firmware/arm_scmi/sensors.c +++ b/drivers/firmware/arm_scmi/sensors.c @@ -319,10 +319,8 @@ static int iter_intervals_update_state(struct scmi_iterator_state *st, /* Direct allocation when exceeding pre-allocated */ if (s->intervals.count >= SCMI_MAX_PREALLOC_POOL) { s->intervals.desc = - devm_kcalloc(dev, - s->intervals.count, - sizeof(*s->intervals.desc), - GFP_KERNEL); + devm_kzalloc_objs(dev, *s->intervals.desc, + s->intervals.count); if (!s->intervals.desc) { s->intervals.segmented = false; s->intervals.count = 0; @@ -537,8 +535,7 @@ static int scmi_sensor_axis_description(const struct scmi_protocol_handle *ph, .s = s, }; - s->axis = devm_kcalloc(ph->dev, s->num_axis, - sizeof(*s->axis), GFP_KERNEL); + s->axis = devm_kzalloc_objs(ph->dev, *s->axis, s->num_axis); if (!s->axis) return -ENOMEM; @@ -1160,15 +1157,15 @@ static int scmi_sensors_protocol_init(const struct scmi_protocol_handle *ph) dev_dbg(ph->dev, "Sensor Version %d.%d\n", PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); - sinfo = devm_kzalloc(ph->dev, sizeof(*sinfo), GFP_KERNEL); + sinfo = devm_kzalloc_obj(ph->dev, *sinfo); if (!sinfo) return -ENOMEM; ret = scmi_sensor_attributes_get(ph, sinfo); if (ret) return ret; - sinfo->sensors = devm_kcalloc(ph->dev, sinfo->num_sensors, - sizeof(*sinfo->sensors), GFP_KERNEL); + sinfo->sensors = devm_kzalloc_objs(ph->dev, *sinfo->sensors, + sinfo->num_sensors); if (!sinfo->sensors) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/system.c b/drivers/firmware/arm_scmi/system.c index 0f51c36f6a9d..7e0148fb4641 100644 --- a/drivers/firmware/arm_scmi/system.c +++ b/drivers/firmware/arm_scmi/system.c @@ -145,7 +145,7 @@ static int scmi_system_protocol_init(const struct scmi_protocol_handle *ph) dev_dbg(ph->dev, "System Power Version %d.%d\n", PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); - pinfo = devm_kzalloc(ph->dev, sizeof(*pinfo), GFP_KERNEL); + pinfo = devm_kzalloc_obj(ph->dev, *pinfo); if (!pinfo) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/transports/mailbox.c b/drivers/firmware/arm_scmi/transports/mailbox.c index 56af2cb0f424..0677005dc6d3 100644 --- a/drivers/firmware/arm_scmi/transports/mailbox.c +++ b/drivers/firmware/arm_scmi/transports/mailbox.c @@ -200,7 +200,7 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, if (!tx && !p2a_chan) return -ENODEV; - smbox = devm_kzalloc(dev, sizeof(*smbox), GFP_KERNEL); + smbox = devm_kzalloc_obj(dev, *smbox); if (!smbox) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/transports/optee.c b/drivers/firmware/arm_scmi/transports/optee.c index 6022f74d28f3..c4e9f4a8242a 100644 --- a/drivers/firmware/arm_scmi/transports/optee.c +++ b/drivers/firmware/arm_scmi/transports/optee.c @@ -383,7 +383,7 @@ static int scmi_optee_chan_setup(struct scmi_chan_info *cinfo, struct device *de if (!tx) return -ENODEV; - channel = devm_kzalloc(dev, sizeof(*channel), GFP_KERNEL); + channel = devm_kzalloc_obj(dev, *channel); if (!channel) return -ENOMEM; @@ -553,7 +553,7 @@ static int scmi_optee_service_probe(struct tee_client_device *scmi_pta) if (IS_ERR(tee_ctx)) return -ENODEV; - agent = devm_kzalloc(dev, sizeof(*agent), GFP_KERNEL); + agent = devm_kzalloc_obj(dev, *agent); if (!agent) { ret = -ENOMEM; goto err; diff --git a/drivers/firmware/arm_scmi/transports/pcc.c b/drivers/firmware/arm_scmi/transports/pcc.c index 26942e0402e3..aecd033ecdd9 100644 --- a/drivers/firmware/arm_scmi/transports/pcc.c +++ b/drivers/firmware/arm_scmi/transports/pcc.c @@ -727,7 +727,7 @@ static int pcc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, struct mbox_client *cl; int ret, ss_id; - smbox = devm_kzalloc(dev, sizeof(*smbox), GFP_KERNEL); + smbox = devm_kzalloc_obj(dev, *smbox); if (!smbox) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/transports/smc.c b/drivers/firmware/arm_scmi/transports/smc.c index 7fb2736247a3..d8cc87e77738 100644 --- a/drivers/firmware/arm_scmi/transports/smc.c +++ b/drivers/firmware/arm_scmi/transports/smc.c @@ -148,7 +148,7 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, if (!tx) return -ENODEV; - scmi_info = devm_kzalloc(dev, sizeof(*scmi_info), GFP_KERNEL); + scmi_info = devm_kzalloc_obj(dev, *scmi_info); if (!scmi_info) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/transports/virtio.c b/drivers/firmware/arm_scmi/transports/virtio.c index 3d608c8c4fe8..e218e3d8eb14 100644 --- a/drivers/firmware/arm_scmi/transports/virtio.c +++ b/drivers/firmware/arm_scmi/transports/virtio.c @@ -444,7 +444,7 @@ static int virtio_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, for (i = 0; i < vioch->max_msg; i++) { struct scmi_vio_msg *msg; - msg = devm_kzalloc(dev, sizeof(*msg), GFP_KERNEL); + msg = devm_kzalloc_obj(dev, *msg); if (!msg) return -ENOMEM; @@ -838,7 +838,7 @@ static int scmi_vio_probe(struct virtio_device *vdev) have_vq_rx = scmi_vio_have_vq_rx(vdev); vq_cnt = have_vq_rx ? VIRTIO_SCMI_VQ_MAX_CNT : 1; - channels = devm_kcalloc(dev, vq_cnt, sizeof(*channels), GFP_KERNEL); + channels = devm_kzalloc_objs(dev, *channels, vq_cnt); if (!channels) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c index 33f9ebf6092b..cdf6fa911770 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c +++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c @@ -350,7 +350,7 @@ static int scmi_imx_bbm_protocol_init(const struct scmi_protocol_handle *ph) dev_info(ph->dev, "NXP SM BBM Version %d.%d\n", PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); - binfo = devm_kzalloc(ph->dev, sizeof(*binfo), GFP_KERNEL); + binfo = devm_kzalloc_obj(ph->dev, *binfo); if (!binfo) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c index 753274af11d2..c439e71bf201 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c +++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c @@ -238,7 +238,7 @@ static int scmi_imx_cpu_protocol_init(const struct scmi_protocol_handle *ph) dev_info(ph->dev, "NXP SM CPU Protocol Version %d.%d\n", PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); - info = devm_kzalloc(ph->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(ph->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c index c56ae247774d..339cc8dde81a 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c +++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c @@ -231,7 +231,7 @@ static int scmi_imx_lmm_protocol_init(const struct scmi_protocol_handle *ph) dev_info(ph->dev, "NXP SM LMM Version %d.%d\n", PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); - info = devm_kzalloc(ph->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(ph->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c index 637973fb45e6..2cec3dbb56ad 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c +++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c @@ -553,7 +553,7 @@ static int scmi_imx_misc_protocol_init(const struct scmi_protocol_handle *ph) dev_info(ph->dev, "NXP SM MISC Version %d.%d\n", PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); - minfo = devm_kzalloc(ph->dev, sizeof(*minfo), GFP_KERNEL); + minfo = devm_kzalloc_obj(ph->dev, *minfo); if (!minfo) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/voltage.c b/drivers/firmware/arm_scmi/voltage.c index b9391c1ee8a0..e2fe690af408 100644 --- a/drivers/firmware/arm_scmi/voltage.c +++ b/drivers/firmware/arm_scmi/voltage.c @@ -409,7 +409,7 @@ static int scmi_voltage_protocol_init(const struct scmi_protocol_handle *ph) dev_dbg(ph->dev, "Voltage Version %d.%d\n", PROTOCOL_REV_MAJOR(ph->version), PROTOCOL_REV_MINOR(ph->version)); - vinfo = devm_kzalloc(ph->dev, sizeof(*vinfo), GFP_KERNEL); + vinfo = devm_kzalloc_obj(ph->dev, *vinfo); if (!vinfo) return -ENOMEM; @@ -418,9 +418,8 @@ static int scmi_voltage_protocol_init(const struct scmi_protocol_handle *ph) return ret; if (vinfo->num_domains) { - vinfo->domains = devm_kcalloc(ph->dev, vinfo->num_domains, - sizeof(*vinfo->domains), - GFP_KERNEL); + vinfo->domains = devm_kzalloc_objs(ph->dev, *vinfo->domains, + vinfo->num_domains); if (!vinfo->domains) return -ENOMEM; ret = scmi_voltage_descriptors_get(ph, vinfo); diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c index 68a730d22037..f80a9c48e281 100644 --- a/drivers/firmware/arm_scpi.c +++ b/drivers/firmware/arm_scpi.c @@ -889,7 +889,7 @@ static int scpi_alloc_xfer_list(struct device *dev, struct scpi_chan *ch) int i; struct scpi_xfer *xfers; - xfers = devm_kcalloc(dev, MAX_SCPI_XFERS, sizeof(*xfers), GFP_KERNEL); + xfers = devm_kzalloc_objs(dev, *xfers, MAX_SCPI_XFERS); if (!xfers) return -ENOMEM; @@ -918,7 +918,7 @@ static int scpi_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; struct scpi_drvinfo *scpi_drvinfo; - scpi_drvinfo = devm_kzalloc(dev, sizeof(*scpi_drvinfo), GFP_KERNEL); + scpi_drvinfo = devm_kzalloc_obj(dev, *scpi_drvinfo); if (!scpi_drvinfo) return -ENOMEM; @@ -931,7 +931,7 @@ static int scpi_probe(struct platform_device *pdev) } scpi_drvinfo->channels = - devm_kcalloc(dev, count, sizeof(struct scpi_chan), GFP_KERNEL); + devm_kzalloc_objs(dev, struct scpi_chan, count); if (!scpi_drvinfo->channels) return -ENOMEM; diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c index 844c68036975..705b4f1d0d00 100644 --- a/drivers/firmware/cirrus/cs_dsp.c +++ b/drivers/firmware/cirrus/cs_dsp.c @@ -3608,7 +3608,7 @@ static int cs_dsp_populate_wseq(struct cs_dsp *dsp, struct cs_dsp_wseq *wseq) chunk = cs_dsp_chunk(words, wseq->ctl->len); while (!cs_dsp_chunk_end(&chunk)) { - op = devm_kzalloc(dsp->dev, sizeof(*op), GFP_KERNEL); + op = devm_kzalloc_obj(dsp->dev, *op); if (!op) { ret = -ENOMEM; goto err_free; @@ -3738,7 +3738,7 @@ int cs_dsp_wseq_write(struct cs_dsp *dsp, struct cs_dsp_wseq *wseq, return -EINVAL; } - op_new = devm_kzalloc(dsp->dev, sizeof(*op_new), GFP_KERNEL); + op_new = devm_kzalloc_obj(dsp->dev, *op_new); if (!op_new) return -ENOMEM; diff --git a/drivers/firmware/coreboot/cbmem.c b/drivers/firmware/coreboot/cbmem.c index 4d20477ed9b2..731c53a709d8 100644 --- a/drivers/firmware/coreboot/cbmem.c +++ b/drivers/firmware/coreboot/cbmem.c @@ -99,7 +99,7 @@ static int cbmem_entry_probe(struct coreboot_device *dev) { struct cbmem_entry *entry; - entry = devm_kzalloc(&dev->dev, sizeof(*entry), GFP_KERNEL); + entry = devm_kzalloc_obj(&dev->dev, *entry); if (!entry) return -ENOMEM; diff --git a/drivers/firmware/coreboot/coreboot-cfr.c b/drivers/firmware/coreboot/coreboot-cfr.c index c30e6075f396..453c146d39b7 100644 --- a/drivers/firmware/coreboot/coreboot-cfr.c +++ b/drivers/firmware/coreboot/coreboot-cfr.c @@ -1116,7 +1116,7 @@ static int coreboot_cfr_probe(struct coreboot_device *dev) if (!efivar_is_available()) return -EPROBE_DEFER; - data = devm_kzalloc(&dev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&dev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/firmware/imx/imx-dsp.c b/drivers/firmware/imx/imx-dsp.c index 7e3f45ddf0c1..b0a2f1264aaf 100644 --- a/drivers/firmware/imx/imx-dsp.c +++ b/drivers/firmware/imx/imx-dsp.c @@ -146,7 +146,7 @@ static int imx_dsp_probe(struct platform_device *pdev) device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); - dsp_ipc = devm_kzalloc(dev, sizeof(*dsp_ipc), GFP_KERNEL); + dsp_ipc = devm_kzalloc_obj(dev, *dsp_ipc); if (!dsp_ipc) return -ENOMEM; diff --git a/drivers/firmware/imx/imx-scu-irq.c b/drivers/firmware/imx/imx-scu-irq.c index a68d38f89254..bc22b10ddb20 100644 --- a/drivers/firmware/imx/imx-scu-irq.c +++ b/drivers/firmware/imx/imx-scu-irq.c @@ -219,7 +219,7 @@ int imx_scu_enable_general_irq_channel(struct device *dev) if (ret) return ret; - cl = devm_kzalloc(dev, sizeof(*cl), GFP_KERNEL); + cl = devm_kzalloc_obj(dev, *cl); if (!cl) return -ENOMEM; diff --git a/drivers/firmware/imx/imx-scu-soc.c b/drivers/firmware/imx/imx-scu-soc.c index 497192320562..517ba10414fe 100644 --- a/drivers/firmware/imx/imx-scu-soc.c +++ b/drivers/firmware/imx/imx-scu-soc.c @@ -106,8 +106,7 @@ int imx_scu_soc_init(struct device *dev) if (ret) return ret; - soc_dev_attr = devm_kzalloc(dev, sizeof(*soc_dev_attr), - GFP_KERNEL); + soc_dev_attr = devm_kzalloc_obj(dev, *soc_dev_attr); if (!soc_dev_attr) return -ENOMEM; diff --git a/drivers/firmware/imx/imx-scu.c b/drivers/firmware/imx/imx-scu.c index 203aac421252..b9cc6da4dfce 100644 --- a/drivers/firmware/imx/imx-scu.c +++ b/drivers/firmware/imx/imx-scu.c @@ -281,7 +281,7 @@ static int imx_scu_probe(struct platform_device *pdev) int ret; int i; - sc_ipc = devm_kzalloc(dev, sizeof(*sc_ipc), GFP_KERNEL); + sc_ipc = devm_kzalloc_obj(dev, *sc_ipc); if (!sc_ipc) return -ENOMEM; diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c index ab9751a59b55..875975664f48 100644 --- a/drivers/firmware/meson/meson_sm.c +++ b/drivers/firmware/meson/meson_sm.c @@ -314,7 +314,7 @@ static int __init meson_sm_probe(struct platform_device *pdev) const struct meson_sm_chip *chip; struct meson_sm_firmware *fw; - fw = devm_kzalloc(dev, sizeof(*fw), GFP_KERNEL); + fw = devm_kzalloc_obj(dev, *fw); if (!fw) return -ENOMEM; diff --git a/drivers/firmware/microchip/mpfs-auto-update.c b/drivers/firmware/microchip/mpfs-auto-update.c index b97d34bd2354..1a5d7db93445 100644 --- a/drivers/firmware/microchip/mpfs-auto-update.c +++ b/drivers/firmware/microchip/mpfs-auto-update.c @@ -414,7 +414,7 @@ static int mpfs_auto_update_probe(struct platform_device *pdev) struct fw_upload *fw_uploader; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/firmware/mtk-adsp-ipc.c b/drivers/firmware/mtk-adsp-ipc.c index 2b79371c61c9..eb835ed54ac8 100644 --- a/drivers/firmware/mtk-adsp-ipc.c +++ b/drivers/firmware/mtk-adsp-ipc.c @@ -78,7 +78,7 @@ static int mtk_adsp_ipc_probe(struct platform_device *pdev) device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); - adsp_ipc = devm_kzalloc(dev, sizeof(*adsp_ipc), GFP_KERNEL); + adsp_ipc = devm_kzalloc_obj(dev, *adsp_ipc); if (!adsp_ipc) return -ENOMEM; diff --git a/drivers/firmware/qcom/qcom_pas.c b/drivers/firmware/qcom/qcom_pas.c index 24485dd0fa10..ae21eed58c3c 100644 --- a/drivers/firmware/qcom/qcom_pas.c +++ b/drivers/firmware/qcom/qcom_pas.c @@ -35,7 +35,7 @@ struct qcom_pas_context *devm_qcom_pas_context_alloc(struct device *dev, { struct qcom_pas_context *ctx; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return ERR_PTR(-ENOMEM); diff --git a/drivers/firmware/qcom/qcom_pas_tee.c b/drivers/firmware/qcom/qcom_pas_tee.c index ac33a00687aa..d248e2229c2f 100644 --- a/drivers/firmware/qcom/qcom_pas_tee.c +++ b/drivers/firmware/qcom/qcom_pas_tee.c @@ -422,7 +422,7 @@ static int qcom_pas_tee_probe(struct tee_client_device *pas_dev) }; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c b/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c index befa68d1dcaf..a9e768968269 100644 --- a/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c +++ b/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c @@ -807,7 +807,7 @@ static int qcom_uefisecapp_probe(struct auxiliary_device *aux_dev, struct qcuefi_client *qcuefi; int status; - qcuefi = devm_kzalloc(&aux_dev->dev, sizeof(*qcuefi), GFP_KERNEL); + qcuefi = devm_kzalloc_obj(&aux_dev->dev, *qcuefi); if (!qcuefi) return -ENOMEM; diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index 43e250faea75..b1a821d3b1bc 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -2728,7 +2728,7 @@ static int qcom_scm_probe(struct platform_device *pdev) int irq, ret; int i; - scm = devm_kzalloc(&pdev->dev, sizeof(*scm), GFP_KERNEL); + scm = devm_kzalloc_obj(&pdev->dev, *scm); if (!scm) return -ENOMEM; @@ -2797,8 +2797,8 @@ static int qcom_scm_probe(struct platform_device *pdev) ret = qcom_scm_query_waitq_count(scm); scm->wq_cnt = ret < 0 ? QCOM_SCM_DEFAULT_WAITQ_COUNT : ret; - scm->waitq_comps = devm_kcalloc(&pdev->dev, scm->wq_cnt, sizeof(*scm->waitq_comps), - GFP_KERNEL); + scm->waitq_comps = devm_kzalloc_objs(&pdev->dev, *scm->waitq_comps, + scm->wq_cnt); if (!scm->waitq_comps) return -ENOMEM; diff --git a/drivers/firmware/samsung/exynos-acpm.c b/drivers/firmware/samsung/exynos-acpm.c index 942a2e9f02f5..a575caf871b9 100644 --- a/drivers/firmware/samsung/exynos-acpm.c +++ b/drivers/firmware/samsung/exynos-acpm.c @@ -630,8 +630,7 @@ static int acpm_channels_init(struct acpm_info *acpm) int i, ret; acpm->num_chans = readl(&shmem->num_chans); - acpm->chans = devm_kcalloc(dev, acpm->num_chans, sizeof(*acpm->chans), - GFP_KERNEL); + acpm->chans = devm_kzalloc_objs(dev, *acpm->chans, acpm->num_chans); if (!acpm->chans) return -ENOMEM; @@ -709,7 +708,7 @@ static int acpm_probe(struct platform_device *pdev) struct resource res; int ret; - acpm = devm_kzalloc(dev, sizeof(*acpm), GFP_KERNEL); + acpm = devm_kzalloc_obj(dev, *acpm); if (!acpm) return -ENOMEM; diff --git a/drivers/firmware/stratix10-rsu.c b/drivers/firmware/stratix10-rsu.c index b360f752d191..d0a63fd28200 100644 --- a/drivers/firmware/stratix10-rsu.c +++ b/drivers/firmware/stratix10-rsu.c @@ -1092,7 +1092,7 @@ static int stratix10_rsu_probe(struct platform_device *pdev) struct stratix10_rsu_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c index 993b857f3b75..ef9d39c9ff01 100644 --- a/drivers/firmware/stratix10-svc.c +++ b/drivers/firmware/stratix10-svc.c @@ -2399,7 +2399,7 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev) if (ret) return ret; } else { - sh_memory = devm_kzalloc(dev, sizeof(*sh_memory), GFP_KERNEL); + sh_memory = devm_kzalloc_obj(dev, *sh_memory); if (!sh_memory) return -ENOMEM; @@ -2414,8 +2414,7 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev) } /* allocate service controller and supporting channel */ - controller = devm_kzalloc(dev, struct_size(controller, chans, SVC_NUM_CHANNEL), - GFP_KERNEL); + controller = devm_kzalloc_flex(dev, *controller, chans, SVC_NUM_CHANNEL); if (!controller) { ret = -ENOMEM; goto err_destroy_pool; @@ -2480,7 +2479,7 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev) platform_set_drvdata(pdev, controller); /* add svc client device(s) */ - svc = devm_kzalloc(dev, sizeof(*svc), GFP_KERNEL); + svc = devm_kzalloc_obj(dev, *svc); if (!svc) { ret = -ENOMEM; goto err_free_fifos; diff --git a/drivers/firmware/tegra/bpmp-tegra186.c b/drivers/firmware/tegra/bpmp-tegra186.c index 64863db7a715..5a97496600ac 100644 --- a/drivers/firmware/tegra/bpmp-tegra186.c +++ b/drivers/firmware/tegra/bpmp-tegra186.c @@ -114,8 +114,7 @@ static int tegra186_bpmp_channel_init(struct tegra_bpmp_channel *channel, unsigned int offset; int err; - channel->ivc = devm_kzalloc(bpmp->dev, sizeof(*channel->ivc), - GFP_KERNEL); + channel->ivc = devm_kzalloc_obj(bpmp->dev, *channel->ivc); if (!channel->ivc) return -ENOMEM; @@ -325,7 +324,7 @@ static int tegra186_bpmp_init(struct tegra_bpmp *bpmp) struct tegra186_bpmp *priv; int err; - priv = devm_kzalloc(bpmp->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(bpmp->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/firmware/tegra/bpmp-tegra210.c b/drivers/firmware/tegra/bpmp-tegra210.c index 6295f5640c15..a33bb027c8b8 100644 --- a/drivers/firmware/tegra/bpmp-tegra210.c +++ b/drivers/firmware/tegra/bpmp-tegra210.c @@ -166,7 +166,7 @@ static int tegra210_bpmp_init(struct tegra_bpmp *bpmp) unsigned int i; int err; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c index 753472b53bd8..5fbd6a3e69e0 100644 --- a/drivers/firmware/tegra/bpmp.c +++ b/drivers/firmware/tegra/bpmp.c @@ -509,7 +509,7 @@ int tegra_bpmp_request_mrq(struct tegra_bpmp *bpmp, unsigned int mrq, if (!handler) return -EINVAL; - entry = devm_kzalloc(bpmp->dev, sizeof(*entry), GFP_KERNEL); + entry = devm_kzalloc_obj(bpmp->dev, *entry); if (!entry) return -ENOMEM; @@ -740,7 +740,7 @@ static int tegra_bpmp_probe(struct platform_device *pdev) size_t size; int err; - bpmp = devm_kzalloc(&pdev->dev, sizeof(*bpmp), GFP_KERNEL); + bpmp = devm_kzalloc_obj(&pdev->dev, *bpmp); if (!bpmp) return -ENOMEM; @@ -764,19 +764,17 @@ static int tegra_bpmp_probe(struct platform_device *pdev) return -ENOMEM; spin_lock_init(&bpmp->atomic_tx_lock); - bpmp->tx_channel = devm_kzalloc(&pdev->dev, sizeof(*bpmp->tx_channel), - GFP_KERNEL); + bpmp->tx_channel = devm_kzalloc_obj(&pdev->dev, *bpmp->tx_channel); if (!bpmp->tx_channel) return -ENOMEM; - bpmp->rx_channel = devm_kzalloc(&pdev->dev, sizeof(*bpmp->rx_channel), - GFP_KERNEL); + bpmp->rx_channel = devm_kzalloc_obj(&pdev->dev, *bpmp->rx_channel); if (!bpmp->rx_channel) return -ENOMEM; - bpmp->threaded_channels = devm_kcalloc(&pdev->dev, bpmp->threaded.count, - sizeof(*bpmp->threaded_channels), - GFP_KERNEL); + bpmp->threaded_channels = devm_kzalloc_objs(&pdev->dev, + *bpmp->threaded_channels, + bpmp->threaded.count); if (!bpmp->threaded_channels) return -ENOMEM; diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index fc513157f18f..fd1ff28c5989 100644 --- a/drivers/firmware/ti_sci.c +++ b/drivers/firmware/ti_sci.c @@ -3693,13 +3693,12 @@ devm_ti_sci_get_resource_sets(const struct ti_sci_handle *handle, bool valid_set = false; int i, ret, res_count; - res = devm_kzalloc(dev, sizeof(*res), GFP_KERNEL); + res = devm_kzalloc_obj(dev, *res); if (!res) return ERR_PTR(-ENOMEM); res->sets = sets; - res->desc = devm_kcalloc(dev, res->sets, sizeof(*res->desc), - GFP_KERNEL); + res->desc = devm_kzalloc_objs(dev, *res->desc, res->sets); if (!res->desc) return ERR_PTR(-ENOMEM); @@ -4086,7 +4085,7 @@ static int ti_sci_probe(struct platform_device *pdev) desc = device_get_match_data(dev); - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; @@ -4117,10 +4116,8 @@ static int ti_sci_probe(struct platform_device *pdev) 1 << 8 * sizeof(((struct ti_sci_msg_hdr *)0)->seq))) return -EINVAL; - minfo->xfer_block = devm_kcalloc(dev, - desc->max_msgs, - sizeof(*minfo->xfer_block), - GFP_KERNEL); + minfo->xfer_block = devm_kzalloc_objs(dev, *minfo->xfer_block, + desc->max_msgs); if (!minfo->xfer_block) return -ENOMEM; diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c index 1eac9948148f..47fb6e39e0fc 100644 --- a/drivers/firmware/turris-mox-rwtm.c +++ b/drivers/firmware/turris-mox-rwtm.c @@ -428,7 +428,7 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - rwtm = devm_kzalloc(dev, sizeof(*rwtm), GFP_KERNEL); + rwtm = devm_kzalloc_obj(dev, *rwtm); if (!rwtm) return -ENOMEM; diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index d76660c55354..727a9888a933 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -2284,7 +2284,7 @@ static int zynqmp_firmware_probe(struct platform_device *pdev) if (ret >= 0 && ((ret & FIRMWARE_VERSION_MASK) >= PM_API_VERSION_1)) feature_check_enabled = true; - devinfo = devm_kzalloc(dev, sizeof(*devinfo), GFP_KERNEL); + devinfo = devm_kzalloc_obj(dev, *devinfo); if (!devinfo) return -ENOMEM; diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c index 507e29d3a79f..d736f9fa1898 100644 --- a/drivers/fpga/altera-cvp.c +++ b/drivers/fpga/altera-cvp.c @@ -628,7 +628,7 @@ static int altera_cvp_probe(struct pci_dev *pdev, return -ENODEV; } - conf = devm_kzalloc(&pdev->dev, sizeof(*conf), GFP_KERNEL); + conf = devm_kzalloc_obj(&pdev->dev, *conf); if (!conf) return -ENOMEM; diff --git a/drivers/fpga/altera-fpga2sdram.c b/drivers/fpga/altera-fpga2sdram.c index e41492988dd6..96ab4ec6cce0 100644 --- a/drivers/fpga/altera-fpga2sdram.c +++ b/drivers/fpga/altera-fpga2sdram.c @@ -94,7 +94,7 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev) struct regmap *sysmgr; int ret = 0; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/fpga/altera-freeze-bridge.c b/drivers/fpga/altera-freeze-bridge.c index c24c976117c8..30d03ba14481 100644 --- a/drivers/fpga/altera-freeze-bridge.c +++ b/drivers/fpga/altera-freeze-bridge.c @@ -230,7 +230,7 @@ static int altera_freeze_br_probe(struct platform_device *pdev) return -EINVAL; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/fpga/altera-pr-ip-core.c b/drivers/fpga/altera-pr-ip-core.c index df8671af4a92..b5eefc64e001 100644 --- a/drivers/fpga/altera-pr-ip-core.c +++ b/drivers/fpga/altera-pr-ip-core.c @@ -179,7 +179,7 @@ int alt_pr_register(struct device *dev, void __iomem *reg_base) struct fpga_manager *mgr; u32 val; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/fpga/altera-ps-spi.c b/drivers/fpga/altera-ps-spi.c index d0ec3539b31f..94c3fa288544 100644 --- a/drivers/fpga/altera-ps-spi.c +++ b/drivers/fpga/altera-ps-spi.c @@ -235,7 +235,7 @@ static int altera_ps_probe(struct spi_device *spi) struct altera_ps_conf *conf; struct fpga_manager *mgr; - conf = devm_kzalloc(&spi->dev, sizeof(*conf), GFP_KERNEL); + conf = devm_kzalloc_obj(&spi->dev, *conf); if (!conf) return -ENOMEM; diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c index 097a97eeea66..245468b7b922 100644 --- a/drivers/fpga/dfl-afu-main.c +++ b/drivers/fpga/dfl-afu-main.c @@ -860,7 +860,7 @@ static int afu_dev_init(struct platform_device *pdev) struct dfl_feature_dev_data *fdata = to_dfl_feature_dev_data(&pdev->dev); struct dfl_afu *afu; - afu = devm_kzalloc(&pdev->dev, sizeof(*afu), GFP_KERNEL); + afu = devm_kzalloc_obj(&pdev->dev, *afu); if (!afu) return -ENOMEM; diff --git a/drivers/fpga/dfl-afu-region.c b/drivers/fpga/dfl-afu-region.c index b11a5b21e666..6bd28afcb589 100644 --- a/drivers/fpga/dfl-afu-region.c +++ b/drivers/fpga/dfl-afu-region.c @@ -55,7 +55,7 @@ int afu_mmio_region_add(struct dfl_feature_dev_data *fdata, struct dfl_afu *afu; int ret = 0; - region = devm_kzalloc(dev, sizeof(*region), GFP_KERNEL); + region = devm_kzalloc_obj(dev, *region); if (!region) return -ENOMEM; diff --git a/drivers/fpga/dfl-fme-br.c b/drivers/fpga/dfl-fme-br.c index 28b0f9d062ac..85a1b60d2965 100644 --- a/drivers/fpga/dfl-fme-br.c +++ b/drivers/fpga/dfl-fme-br.c @@ -62,7 +62,7 @@ static int fme_br_probe(struct platform_device *pdev) struct fme_br_priv *priv; struct fpga_bridge *br; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/fpga/dfl-fme-main.c b/drivers/fpga/dfl-fme-main.c index 8aca2fb20e87..b5f22d97742e 100644 --- a/drivers/fpga/dfl-fme-main.c +++ b/drivers/fpga/dfl-fme-main.c @@ -678,7 +678,7 @@ static int fme_dev_init(struct platform_device *pdev) struct dfl_feature_dev_data *fdata = to_dfl_feature_dev_data(&pdev->dev); struct dfl_fme *fme; - fme = devm_kzalloc(&pdev->dev, sizeof(*fme), GFP_KERNEL); + fme = devm_kzalloc_obj(&pdev->dev, *fme); if (!fme) return -ENOMEM; diff --git a/drivers/fpga/dfl-fme-mgr.c b/drivers/fpga/dfl-fme-mgr.c index ab228d8837a0..90d73ae6d814 100644 --- a/drivers/fpga/dfl-fme-mgr.c +++ b/drivers/fpga/dfl-fme-mgr.c @@ -281,7 +281,7 @@ static int fme_mgr_probe(struct platform_device *pdev) struct fme_mgr_priv *priv; struct fpga_manager *mgr; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -297,7 +297,7 @@ static int fme_mgr_probe(struct platform_device *pdev) info.name = "DFL FME FPGA Manager"; info.mops = &fme_mgr_ops; info.priv = priv; - info.compat_id = devm_kzalloc(dev, sizeof(*info.compat_id), GFP_KERNEL); + info.compat_id = devm_kzalloc_obj(dev, *info.compat_id); if (!info.compat_id) return -ENOMEM; diff --git a/drivers/fpga/dfl-fme-perf.c b/drivers/fpga/dfl-fme-perf.c index 495edc448b68..a0e3abc64c9e 100644 --- a/drivers/fpga/dfl-fme-perf.c +++ b/drivers/fpga/dfl-fme-perf.c @@ -966,7 +966,7 @@ static int fme_perf_init(struct platform_device *pdev, struct fme_perf_priv *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/fpga/dfl-fme-pr.c b/drivers/fpga/dfl-fme-pr.c index b878b260af38..3ef1ecb7edd5 100644 --- a/drivers/fpga/dfl-fme-pr.c +++ b/drivers/fpga/dfl-fme-pr.c @@ -233,7 +233,7 @@ dfl_fme_create_bridge(struct dfl_feature_dev_data *fdata, int port_id) struct dfl_fme_bridge *fme_br; int ret = -ENOMEM; - fme_br = devm_kzalloc(dev, sizeof(*fme_br), GFP_KERNEL); + fme_br = devm_kzalloc_obj(dev, *fme_br); if (!fme_br) return ERR_PTR(ret); @@ -306,7 +306,7 @@ dfl_fme_create_region(struct dfl_feature_dev_data *fdata, struct dfl_fme_region *fme_region; int ret = -ENOMEM; - fme_region = devm_kzalloc(dev, sizeof(*fme_region), GFP_KERNEL); + fme_region = devm_kzalloc_obj(dev, *fme_region); if (!fme_region) return ERR_PTR(ret); diff --git a/drivers/fpga/dfl-n3000-nios.c b/drivers/fpga/dfl-n3000-nios.c index 9ddf1d1d392f..c0bd2c8845d0 100644 --- a/drivers/fpga/dfl-n3000-nios.c +++ b/drivers/fpga/dfl-n3000-nios.c @@ -529,7 +529,7 @@ static int n3000_nios_probe(struct dfl_device *ddev) struct n3000_nios *nn; int ret; - nn = devm_kzalloc(dev, sizeof(*nn), GFP_KERNEL); + nn = devm_kzalloc_obj(dev, *nn); if (!nn) return -ENOMEM; diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c index e25205c6d8f0..2e9046175c75 100644 --- a/drivers/fpga/dfl-pci.c +++ b/drivers/fpga/dfl-pci.c @@ -116,7 +116,7 @@ static int cci_init_drvdata(struct pci_dev *pcidev) { struct cci_drvdata *drvdata; - drvdata = devm_kzalloc(&pcidev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pcidev->dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c index 4c63c7c8579b..6f5fa7b2fc54 100644 --- a/drivers/fpga/dfl.c +++ b/drivers/fpga/dfl.c @@ -754,17 +754,17 @@ binfo_create_feature_dev_data(struct build_feature_devs_info *binfo) if (WARN_ON_ONCE(type >= DFL_ID_MAX)) return ERR_PTR(-EINVAL); - fdata = devm_kzalloc(binfo->dev, sizeof(*fdata), GFP_KERNEL); + fdata = devm_kzalloc_obj(binfo->dev, *fdata); if (!fdata) return ERR_PTR(-ENOMEM); - fdata->features = devm_kcalloc(binfo->dev, binfo->feature_num, - sizeof(*fdata->features), GFP_KERNEL); + fdata->features = devm_kzalloc_objs(binfo->dev, *fdata->features, + binfo->feature_num); if (!fdata->features) return ERR_PTR(-ENOMEM); - fdata->resources = devm_kcalloc(binfo->dev, binfo->feature_num, - sizeof(*fdata->resources), GFP_KERNEL); + fdata->resources = devm_kzalloc_objs(binfo->dev, *fdata->resources, + binfo->feature_num); if (!fdata->resources) return ERR_PTR(-ENOMEM); @@ -834,8 +834,8 @@ binfo_create_feature_dev_data(struct build_feature_devs_info *binfo) } if (finfo->nr_irqs) { - ctx = devm_kcalloc(binfo->dev, finfo->nr_irqs, - sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_objs(binfo->dev, *ctx, + finfo->nr_irqs); if (!ctx) return ERR_PTR(-ENOMEM); @@ -1425,7 +1425,7 @@ struct dfl_fpga_enum_info *dfl_fpga_enum_info_alloc(struct device *dev) get_device(dev); - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) { put_device(dev); return NULL; @@ -1481,7 +1481,7 @@ int dfl_fpga_enum_info_add_dfl(struct dfl_fpga_enum_info *info, { struct dfl_fpga_enum_dfl *dfl; - dfl = devm_kzalloc(info->dev, sizeof(*dfl), GFP_KERNEL); + dfl = devm_kzalloc_obj(info->dev, *dfl); if (!dfl) return -ENOMEM; @@ -1568,7 +1568,7 @@ dfl_fpga_feature_devs_enumerate(struct dfl_fpga_enum_info *info) if (!info->dev) return ERR_PTR(-ENODEV); - cdev = devm_kzalloc(info->dev, sizeof(*cdev), GFP_KERNEL); + cdev = devm_kzalloc_obj(info->dev, *cdev); if (!cdev) return ERR_PTR(-ENOMEM); @@ -1583,7 +1583,7 @@ dfl_fpga_feature_devs_enumerate(struct dfl_fpga_enum_info *info) } /* create and init build info for enumeration */ - binfo = devm_kzalloc(info->dev, sizeof(*binfo), GFP_KERNEL); + binfo = devm_kzalloc_obj(info->dev, *binfo); if (!binfo) { ret = -ENOMEM; goto unregister_region_exit; diff --git a/drivers/fpga/efinix-spi.c b/drivers/fpga/efinix-spi.c index ed9a41232a32..beade2255987 100644 --- a/drivers/fpga/efinix-spi.c +++ b/drivers/fpga/efinix-spi.c @@ -209,7 +209,7 @@ static int efinix_spi_probe(struct spi_device *spi) return dev_err_probe(&spi->dev, -EINVAL, "Unsupported SPI mode, set CPHA and CPOL\n"); - conf = devm_kzalloc(&spi->dev, sizeof(*conf), GFP_KERNEL); + conf = devm_kzalloc_obj(&spi->dev, *conf); if (!conf) return -ENOMEM; diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c index 5a0b7780b335..6f70fa26e5c3 100644 --- a/drivers/fpga/fpga-mgr.c +++ b/drivers/fpga/fpga-mgr.c @@ -112,7 +112,7 @@ struct fpga_image_info *fpga_image_info_alloc(struct device *dev) get_device(dev); - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) { put_device(dev); return NULL; diff --git a/drivers/fpga/ice40-spi.c b/drivers/fpga/ice40-spi.c index f72d38d9fe4f..bbe8aa30e876 100644 --- a/drivers/fpga/ice40-spi.c +++ b/drivers/fpga/ice40-spi.c @@ -138,7 +138,7 @@ static int ice40_fpga_probe(struct spi_device *spi) struct fpga_manager *mgr; int ret; - priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&spi->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/fpga/intel-m10-bmc-sec-update.c b/drivers/fpga/intel-m10-bmc-sec-update.c index 7d23d914df3f..af8e7c8af44b 100644 --- a/drivers/fpga/intel-m10-bmc-sec-update.c +++ b/drivers/fpga/intel-m10-bmc-sec-update.c @@ -690,7 +690,7 @@ static int m10bmc_sec_probe(struct platform_device *pdev) unsigned int len; int ret; - sec = devm_kzalloc(&pdev->dev, sizeof(*sec), GFP_KERNEL); + sec = devm_kzalloc_obj(&pdev->dev, *sec); if (!sec) return -ENOMEM; diff --git a/drivers/fpga/lattice-sysconfig-spi.c b/drivers/fpga/lattice-sysconfig-spi.c index b39c62f56864..694972eafbe6 100644 --- a/drivers/fpga/lattice-sysconfig-spi.c +++ b/drivers/fpga/lattice-sysconfig-spi.c @@ -94,7 +94,7 @@ static int sysconfig_spi_probe(struct spi_device *spi) struct sysconfig_priv *priv; const u32 *spi_max_speed; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/fpga/microchip-spi.c b/drivers/fpga/microchip-spi.c index cc8f6d7bb978..d20b7bea7ccb 100644 --- a/drivers/fpga/microchip-spi.c +++ b/drivers/fpga/microchip-spi.c @@ -373,7 +373,7 @@ static int mpf_probe(struct spi_device *spi) struct fpga_manager *mgr; struct mpf_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/fpga/socfpga-a10.c b/drivers/fpga/socfpga-a10.c index 0165a3c86932..17b101a9c37c 100644 --- a/drivers/fpga/socfpga-a10.c +++ b/drivers/fpga/socfpga-a10.c @@ -473,7 +473,7 @@ static int socfpga_a10_fpga_probe(struct platform_device *pdev) struct fpga_manager *mgr; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/fpga/socfpga.c b/drivers/fpga/socfpga.c index b08b4bb8f650..bd078170b76c 100644 --- a/drivers/fpga/socfpga.c +++ b/drivers/fpga/socfpga.c @@ -548,7 +548,7 @@ static int socfpga_fpga_probe(struct platform_device *pdev) struct fpga_manager *mgr; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c index 5aed560050c2..23c5f7c90412 100644 --- a/drivers/fpga/stratix10-soc.c +++ b/drivers/fpga/stratix10-soc.c @@ -405,7 +405,7 @@ static int s10_probe(struct platform_device *pdev) struct fpga_manager *mgr; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/fpga/ts73xx-fpga.c b/drivers/fpga/ts73xx-fpga.c index 3460e4809f86..b2408d4a73a8 100644 --- a/drivers/fpga/ts73xx-fpga.c +++ b/drivers/fpga/ts73xx-fpga.c @@ -105,7 +105,7 @@ static int ts73xx_fpga_probe(struct platform_device *pdev) struct ts73xx_fpga_priv *priv; struct fpga_manager *mgr; - priv = devm_kzalloc(kdev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(kdev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/fpga/xilinx-pr-decoupler.c b/drivers/fpga/xilinx-pr-decoupler.c index 45b65a3264af..1405ddbe88f1 100644 --- a/drivers/fpga/xilinx-pr-decoupler.c +++ b/drivers/fpga/xilinx-pr-decoupler.c @@ -108,7 +108,7 @@ static int xlnx_pr_decoupler_probe(struct platform_device *pdev) struct fpga_bridge *br; int err; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/fpga/xilinx-selectmap.c b/drivers/fpga/xilinx-selectmap.c index ff167b23fded..447eea83b5d5 100644 --- a/drivers/fpga/xilinx-selectmap.c +++ b/drivers/fpga/xilinx-selectmap.c @@ -56,7 +56,7 @@ static int xilinx_selectmap_probe(struct platform_device *pdev) struct xilinx_selectmap_conf *conf; void __iomem *base; - conf = devm_kzalloc(&pdev->dev, sizeof(*conf), GFP_KERNEL); + conf = devm_kzalloc_obj(&pdev->dev, *conf); if (!conf) return -ENOMEM; diff --git a/drivers/fpga/xilinx-spi.c b/drivers/fpga/xilinx-spi.c index 765626cad69a..ff2607d1ec0f 100644 --- a/drivers/fpga/xilinx-spi.c +++ b/drivers/fpga/xilinx-spi.c @@ -46,7 +46,7 @@ static int xilinx_spi_probe(struct spi_device *spi) { struct xilinx_fpga_core *core; - core = devm_kzalloc(&spi->dev, sizeof(*core), GFP_KERNEL); + core = devm_kzalloc_obj(&spi->dev, *core); if (!core) return -ENOMEM; diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c index 2f8ba32e4002..97351ed9dcaf 100644 --- a/drivers/fpga/zynq-fpga.c +++ b/drivers/fpga/zynq-fpga.c @@ -557,7 +557,7 @@ static int zynq_fpga_probe(struct platform_device *pdev) struct fpga_manager *mgr; int err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; spin_lock_init(&priv->dma_lock); diff --git a/drivers/fpga/zynqmp-fpga.c b/drivers/fpga/zynqmp-fpga.c index f3434e2c487b..ed6f5dac1a78 100644 --- a/drivers/fpga/zynqmp-fpga.c +++ b/drivers/fpga/zynqmp-fpga.c @@ -109,7 +109,7 @@ static int zynqmp_fpga_probe(struct platform_device *pdev) struct zynqmp_fpga_priv *priv; struct fpga_manager *mgr; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c index 416d176f0936..e66405fa5215 100644 --- a/drivers/fsi/fsi-occ.c +++ b/drivers/fsi/fsi-occ.c @@ -629,7 +629,7 @@ static int occ_probe(struct platform_device *pdev) .name = "occ-hwmon", }; - occ = devm_kzalloc(dev, sizeof(*occ), GFP_KERNEL); + occ = devm_kzalloc_obj(dev, *occ); if (!occ) return -ENOMEM; diff --git a/drivers/fsi/i2cr-scom.c b/drivers/fsi/i2cr-scom.c index 83b3c0348791..8b3e1b3f4c06 100644 --- a/drivers/fsi/i2cr-scom.c +++ b/drivers/fsi/i2cr-scom.c @@ -90,7 +90,7 @@ static int i2cr_scom_probe(struct fsi_device *fsi_dev) if (!is_fsi_master_i2cr(fsi_dev->slave->master)) return -ENODEV; - scom = devm_kzalloc(dev, sizeof(*scom), GFP_KERNEL); + scom = devm_kzalloc_obj(dev, *scom); if (!scom) return -ENOMEM; diff --git a/drivers/gnss/sirf.c b/drivers/gnss/sirf.c index 79375d14bbb6..0f9a86c24216 100644 --- a/drivers/gnss/sirf.c +++ b/drivers/gnss/sirf.c @@ -399,7 +399,7 @@ static int sirf_probe(struct serdev_device *serdev) struct sirf_data *data; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c index cf5a50102d49..7ddf578ba530 100644 --- a/drivers/gpio/gpio-104-dio-48e.c +++ b/drivers/gpio/gpio-104-dio-48e.c @@ -238,7 +238,7 @@ static int dio48e_probe(struct device *dev, unsigned int id) return -EBUSY; } - dio48egpio = devm_kzalloc(dev, sizeof(*dio48egpio), GFP_KERNEL); + dio48egpio = devm_kzalloc_obj(dev, *dio48egpio); if (!dio48egpio) return -ENOMEM; @@ -290,7 +290,7 @@ static int dio48e_probe(struct device *dev, unsigned int id) return dev_err_probe(dev, PTR_ERR(pit_config.map), "Unable to initialize i8254 register map\n"); - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c index fb017569cfa8..93d7ccaded83 100644 --- a/drivers/gpio/gpio-104-idi-48.c +++ b/drivers/gpio/gpio-104-idi-48.c @@ -148,7 +148,7 @@ static int idi_48_probe(struct device *dev, unsigned int id) return dev_err_probe(dev, PTR_ERR(map), "Unable to initialize register map\n"); - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index 5ca61cf5206a..6f15b7c2358b 100644 --- a/drivers/gpio/gpio-74x164.c +++ b/drivers/gpio/gpio-74x164.c @@ -128,7 +128,7 @@ static int gen_74x164_probe(struct spi_device *spi) if (ret) return dev_err_probe(dev, ret, "Missing 'registers-number' property.\n"); - chip = devm_kzalloc(dev, struct_size(chip, buffer, nregs), GFP_KERNEL); + chip = devm_kzalloc_flex(dev, *chip, buffer, nregs); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-74xx-mmio.c b/drivers/gpio/gpio-74xx-mmio.c index cdac37926f8e..adb2d75b0461 100644 --- a/drivers/gpio/gpio-74xx-mmio.c +++ b/drivers/gpio/gpio-74xx-mmio.c @@ -112,7 +112,7 @@ static int mmio_74xx_gpio_probe(struct platform_device *pdev) void __iomem *dat; int err; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c index 0410e3adbf54..6368621a356a 100644 --- a/drivers/gpio/gpio-adnp.c +++ b/drivers/gpio/gpio-adnp.c @@ -480,7 +480,7 @@ static int adnp_i2c_probe(struct i2c_client *client) if (err < 0) return err; - adnp = devm_kzalloc(&client->dev, sizeof(*adnp), GFP_KERNEL); + adnp = devm_kzalloc_obj(&client->dev, *adnp); if (!adnp) return -ENOMEM; diff --git a/drivers/gpio/gpio-adp5520.c b/drivers/gpio/gpio-adp5520.c index 6305c8b7dc05..52b8835a7b25 100644 --- a/drivers/gpio/gpio-adp5520.c +++ b/drivers/gpio/gpio-adp5520.c @@ -105,7 +105,7 @@ static int adp5520_gpio_probe(struct platform_device *pdev) return -ENODEV; } - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (dev == NULL) return -ENOMEM; diff --git a/drivers/gpio/gpio-adp5585.c b/drivers/gpio/gpio-adp5585.c index 7c04a7e86c8f..e7b416143987 100644 --- a/drivers/gpio/gpio-adp5585.c +++ b/drivers/gpio/gpio-adp5585.c @@ -400,7 +400,7 @@ static int adp5585_gpio_probe(struct platform_device *pdev) struct gpio_chip *gc; int ret; - adp5585_gpio = devm_kzalloc(dev, sizeof(*adp5585_gpio), GFP_KERNEL); + adp5585_gpio = devm_kzalloc_obj(dev, *adp5585_gpio); if (!adp5585_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-aggregator.c b/drivers/gpio/gpio-aggregator.c index b0b65416d74d..dbf5115edceb 100644 --- a/drivers/gpio/gpio-aggregator.c +++ b/drivers/gpio/gpio-aggregator.c @@ -472,9 +472,8 @@ static int gpiochip_fwd_setup_delay_line(struct gpiochip_fwd *fwd) { struct gpio_chip *chip = &fwd->chip; - fwd->delay_timings = devm_kcalloc(chip->parent, chip->ngpio, - sizeof(*fwd->delay_timings), - GFP_KERNEL); + fwd->delay_timings = devm_kzalloc_objs(chip->parent, + *fwd->delay_timings, chip->ngpio); if (!fwd->delay_timings) return -ENOMEM; @@ -695,11 +694,11 @@ struct gpiochip_fwd *devm_gpiochip_fwd_alloc(struct device *dev, struct gpiochip_fwd *fwd; struct gpio_chip *chip; - fwd = devm_kzalloc(dev, struct_size(fwd, tmp, fwd_tmp_size(ngpios)), GFP_KERNEL); + fwd = devm_kzalloc_flex(dev, *fwd, tmp, fwd_tmp_size(ngpios)); if (!fwd) return ERR_PTR(-ENOMEM); - fwd->descs = devm_kcalloc(dev, ngpios, sizeof(*fwd->descs), GFP_KERNEL); + fwd->descs = devm_kzalloc_objs(dev, *fwd->descs, ngpios); if (!fwd->descs) return ERR_PTR(-ENOMEM); @@ -1604,7 +1603,7 @@ static int gpio_aggregator_probe(struct platform_device *pdev) if (n < 0) return n; - descs = devm_kmalloc_array(dev, n, sizeof(*descs), GFP_KERNEL); + descs = devm_kmalloc_objs(dev, *descs, n); if (!descs) return -ENOMEM; diff --git a/drivers/gpio/gpio-altera-a10sr.c b/drivers/gpio/gpio-altera-a10sr.c index a41e5575ee37..b075d2fb6041 100644 --- a/drivers/gpio/gpio-altera-a10sr.c +++ b/drivers/gpio/gpio-altera-a10sr.c @@ -81,7 +81,7 @@ static int altr_a10sr_gpio_probe(struct platform_device *pdev) struct altr_a10sr_gpio *gpio; struct altr_a10sr *a10sr = dev_get_drvdata(pdev->dev.parent); - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-altera.c b/drivers/gpio/gpio-altera.c index a6ac9356229c..5284d01614a5 100644 --- a/drivers/gpio/gpio-altera.c +++ b/drivers/gpio/gpio-altera.c @@ -174,7 +174,7 @@ static int altera_gpio_probe(struct platform_device *pdev) struct gpio_irq_chip *girq; int mapped_irq; - altera_gc = devm_kzalloc(&pdev->dev, sizeof(*altera_gc), GFP_KERNEL); + altera_gc = devm_kzalloc_obj(&pdev->dev, *altera_gc); if (!altera_gc) return -ENOMEM; @@ -241,8 +241,7 @@ static int altera_gpio_probe(struct platform_device *pdev) else girq->parent_handler = altera_gpio_irq_edge_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, 1, sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(&pdev->dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; girq->default_type = IRQ_TYPE_NONE; diff --git a/drivers/gpio/gpio-amd-fch.c b/drivers/gpio/gpio-amd-fch.c index 9b9d75acf35a..d13dc7c72aef 100644 --- a/drivers/gpio/gpio-amd-fch.c +++ b/drivers/gpio/gpio-amd-fch.c @@ -137,7 +137,7 @@ static int amd_fch_gpio_probe(struct platform_device *pdev) return -ENOENT; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-amdpt.c b/drivers/gpio/gpio-amdpt.c index 8458a6949c65..e886cf9e14ea 100644 --- a/drivers/gpio/gpio-amdpt.c +++ b/drivers/gpio/gpio-amdpt.c @@ -78,7 +78,7 @@ static int pt_gpio_probe(struct platform_device *pdev) return -ENODEV; } - pt_gpio = devm_kzalloc(dev, sizeof(struct pt_gpio_chip), GFP_KERNEL); + pt_gpio = devm_kzalloc_obj(dev, struct pt_gpio_chip); if (!pt_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-arizona.c b/drivers/gpio/gpio-arizona.c index 88cf013f0d90..5a6182ad804b 100644 --- a/drivers/gpio/gpio-arizona.c +++ b/drivers/gpio/gpio-arizona.c @@ -155,8 +155,7 @@ static int arizona_gpio_probe(struct platform_device *pdev) device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); - arizona_gpio = devm_kzalloc(&pdev->dev, sizeof(*arizona_gpio), - GFP_KERNEL); + arizona_gpio = devm_kzalloc_obj(&pdev->dev, *arizona_gpio); if (!arizona_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-aspeed-sgpio.c b/drivers/gpio/gpio-aspeed-sgpio.c index 4225261f61c8..b5504ea8c93d 100644 --- a/drivers/gpio/gpio-aspeed-sgpio.c +++ b/drivers/gpio/gpio-aspeed-sgpio.c @@ -610,7 +610,7 @@ static int aspeed_sgpio_probe(struct platform_device *pdev) unsigned long apb_freq; int rc; - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index dc53b2decb66..5d94fac3a962 100644 --- a/drivers/gpio/gpio-aspeed.c +++ b/drivers/gpio/gpio-aspeed.c @@ -1307,7 +1307,7 @@ static int aspeed_gpio_probe(struct platform_device *pdev) int rc, irq, i, banks, err; u32 ngpio; - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; @@ -1353,7 +1353,7 @@ static int aspeed_gpio_probe(struct platform_device *pdev) if (gpio->config->require_dcache) { /* Allocate a cache of the output registers */ banks = DIV_ROUND_UP(gpio->chip.ngpio, 32); - gpio->dcache = devm_kcalloc(&pdev->dev, banks, sizeof(u32), GFP_KERNEL); + gpio->dcache = devm_kzalloc_objs(&pdev->dev, u32, banks); if (!gpio->dcache) return -ENOMEM; /* @@ -1377,7 +1377,7 @@ static int aspeed_gpio_probe(struct platform_device *pdev) girq->parent_handler = aspeed_gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, 1, sizeof(*girq->parents), GFP_KERNEL); + girq->parents = devm_kzalloc_objs(&pdev->dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; girq->parents[0] = gpio->irq; diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c index aa37579c9608..423e6399b6f6 100644 --- a/drivers/gpio/gpio-ath79.c +++ b/drivers/gpio/gpio-ath79.c @@ -228,9 +228,7 @@ static int ath79_gpio_register_wifi_descriptors(struct device *dev, int i; /* Create a gpiod lookup using gpiochip-local offsets + 1 for NULL */ - lookup = devm_kzalloc(dev, - struct_size(lookup, table, ATH79K_WIFI_DESCS + 1), - GFP_KERNEL); + lookup = devm_kzalloc_flex(dev, *lookup, table, ATH79K_WIFI_DESCS + 1); if (!lookup) return -ENOMEM; @@ -274,7 +272,7 @@ static int ath79_gpio_probe(struct platform_device *pdev) bool oe_inverted; int err; - ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(dev, *ctrl); if (!ctrl) return -ENOMEM; @@ -317,8 +315,7 @@ static int ath79_gpio_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &ath79_gpio_irqchip); girq->parent_handler = ath79_gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; girq->parents[0] = platform_get_irq(pdev, 0); diff --git a/drivers/gpio/gpio-axiado-sgpio.c b/drivers/gpio/gpio-axiado-sgpio.c index b57a5074ccef..3af222b718e6 100644 --- a/drivers/gpio/gpio-axiado-sgpio.c +++ b/drivers/gpio/gpio-axiado-sgpio.c @@ -557,7 +557,7 @@ static int axiado_sgpio_probe(struct platform_device *pdev) u32 sgpio_freq; int irq, rc; - sgpio = devm_kzalloc(&pdev->dev, sizeof(*sgpio), GFP_KERNEL); + sgpio = devm_kzalloc_obj(&pdev->dev, *sgpio); if (!sgpio) return -ENOMEM; @@ -592,10 +592,8 @@ static int axiado_sgpio_probe(struct platform_device *pdev) sgpio->nsignals = ngpio / 2; - sgpio->din_shadow = devm_kcalloc(&pdev->dev, - DIV_ROUND_UP(sgpio->nsignals, - SGPIO_BANK_SIZE), - sizeof(*sgpio->din_shadow), GFP_KERNEL); + sgpio->din_shadow = devm_kzalloc_objs(&pdev->dev, *sgpio->din_shadow, + DIV_ROUND_UP(sgpio->nsignals, SGPIO_BANK_SIZE)); sgpio->irq_unmasked = devm_bitmap_zalloc(&pdev->dev, sgpio->nsignals, GFP_KERNEL); sgpio->irq_rising = devm_bitmap_zalloc(&pdev->dev, sgpio->nsignals, diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c index b0beffe48b7d..a58084fd9020 100644 --- a/drivers/gpio/gpio-bcm-kona.c +++ b/drivers/gpio/gpio-bcm-kona.c @@ -591,7 +591,7 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev) return dev_err_probe(dev, ret, "Couldn't determine GPIO banks\n"); } - kona_gpio = devm_kzalloc(dev, struct_size(kona_gpio, banks, ret), GFP_KERNEL); + kona_gpio = devm_kzalloc_flex(dev, *kona_gpio, banks, ret); if (!kona_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-bd71815.c b/drivers/gpio/gpio-bd71815.c index afb18a5a9d79..18c51a4b0692 100644 --- a/drivers/gpio/gpio-bd71815.c +++ b/drivers/gpio/gpio-bd71815.c @@ -137,7 +137,7 @@ static int gpo_bd71815_probe(struct platform_device *pdev) /* The device-tree and regmap come from MFD => use parent for that */ parent = dev->parent; - g = devm_kzalloc(dev, sizeof(*g), GFP_KERNEL); + g = devm_kzalloc_obj(dev, *g); if (!g) return -ENOMEM; diff --git a/drivers/gpio/gpio-bd71828.c b/drivers/gpio/gpio-bd71828.c index e439dbfffc62..21cf4f6f133e 100644 --- a/drivers/gpio/gpio-bd71828.c +++ b/drivers/gpio/gpio-bd71828.c @@ -97,7 +97,7 @@ static int bd71828_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct bd71828_gpio *bdgpio; - bdgpio = devm_kzalloc(dev, sizeof(*bdgpio), GFP_KERNEL); + bdgpio = devm_kzalloc_obj(dev, *bdgpio); if (!bdgpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-bd72720.c b/drivers/gpio/gpio-bd72720.c index c124d964e4cf..ed925804c256 100644 --- a/drivers/gpio/gpio-bd72720.c +++ b/drivers/gpio/gpio-bd72720.c @@ -254,7 +254,7 @@ static int gpo_bd72720_probe(struct platform_device *pdev) /* The device-tree and regmap come from MFD => use parent for that */ parent = dev->parent; - g = devm_kzalloc(dev, sizeof(*g), GFP_KERNEL); + g = devm_kzalloc_obj(dev, *g); if (!g) return -ENOMEM; diff --git a/drivers/gpio/gpio-bd73800.c b/drivers/gpio/gpio-bd73800.c index 2be2a885820e..4dac18580678 100644 --- a/drivers/gpio/gpio-bd73800.c +++ b/drivers/gpio/gpio-bd73800.c @@ -149,7 +149,7 @@ static int gpo_bd73800_probe(struct platform_device *pdev) /* The device-tree and regmap come from MFD => use parent for that */ parent = dev->parent; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/gpio/gpio-bd9571mwv.c b/drivers/gpio/gpio-bd9571mwv.c index f829fc40c02b..d06062e7e90c 100644 --- a/drivers/gpio/gpio-bd9571mwv.c +++ b/drivers/gpio/gpio-bd9571mwv.c @@ -98,7 +98,7 @@ static int bd9571mwv_gpio_probe(struct platform_device *pdev) { struct bd9571mwv_gpio *gpio; - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-blzp1600.c b/drivers/gpio/gpio-blzp1600.c index 0f8c826ba876..cd5072853cbb 100644 --- a/drivers/gpio/gpio-blzp1600.c +++ b/drivers/gpio/gpio-blzp1600.c @@ -222,7 +222,7 @@ static int blzp1600_gpio_probe(struct platform_device *pdev) struct gpio_chip *gc; int ret; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; @@ -258,7 +258,7 @@ static int blzp1600_gpio_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &blzp1600_gpio_irqchip); girq->parent_handler = blzp1600_gpio_irqhandler; girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, 1, sizeof(*girq->parents), GFP_KERNEL); + girq->parents = devm_kzalloc_objs(&pdev->dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c index 44ca798cf832..d6524deef60b 100644 --- a/drivers/gpio/gpio-brcmstb.c +++ b/drivers/gpio/gpio-brcmstb.c @@ -638,7 +638,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev) unsigned long flags = 0; bool need_wakeup_event = false; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; platform_set_drvdata(pdev, priv); @@ -690,7 +690,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev) continue; } - bank = devm_kzalloc(dev, sizeof(*bank), GFP_KERNEL); + bank = devm_kzalloc_obj(dev, *bank); if (!bank) { err = -ENOMEM; goto fail; diff --git a/drivers/gpio/gpio-bt8xx.c b/drivers/gpio/gpio-bt8xx.c index f3a2321bc388..57b0f05a09a2 100644 --- a/drivers/gpio/gpio-bt8xx.c +++ b/drivers/gpio/gpio-bt8xx.c @@ -161,7 +161,7 @@ static int bt8xxgpio_probe(struct pci_dev *dev, if (IS_ERR(mmio)) return PTR_ERR(mmio); - bg = devm_kzalloc(&dev->dev, sizeof(struct bt8xxgpio), GFP_KERNEL); + bg = devm_kzalloc_obj(&dev->dev, struct bt8xxgpio); if (!bg) return -ENOMEM; diff --git a/drivers/gpio/gpio-by-pinctrl.c b/drivers/gpio/gpio-by-pinctrl.c index f54efd635f13..3f4cb8da6c26 100644 --- a/drivers/gpio/gpio-by-pinctrl.c +++ b/drivers/gpio/gpio-by-pinctrl.c @@ -66,7 +66,7 @@ static int pin_control_gpio_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct gpio_chip *chip; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-cadence.c b/drivers/gpio/gpio-cadence.c index d7790fc35c22..6baa5d6cd167 100644 --- a/drivers/gpio/gpio-cadence.c +++ b/drivers/gpio/gpio-cadence.c @@ -189,7 +189,7 @@ static int cdns_gpio_probe(struct platform_device *pdev) u32 num_gpios = 32; struct clk *clk; - cgpio = devm_kzalloc(&pdev->dev, sizeof(*cgpio), GFP_KERNEL); + cgpio = devm_kzalloc_obj(&pdev->dev, *cgpio); if (!cgpio) return -ENOMEM; @@ -267,9 +267,7 @@ static int cdns_gpio_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &cdns_gpio_irqchip); girq->parent_handler = cdns_gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(&pdev->dev, *girq->parents, 1); if (!girq->parents) { ret = -ENOMEM; goto err_revert_dir; diff --git a/drivers/gpio/gpio-cgbc.c b/drivers/gpio/gpio-cgbc.c index 84b5ed3c6e22..488dc8212a82 100644 --- a/drivers/gpio/gpio-cgbc.c +++ b/drivers/gpio/gpio-cgbc.c @@ -154,7 +154,7 @@ static int cgbc_gpio_probe(struct platform_device *pdev) struct gpio_chip *chip; int ret; - gpio = devm_kzalloc(dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-clps711x.c b/drivers/gpio/gpio-clps711x.c index 24ff2347d599..663f5400870f 100644 --- a/drivers/gpio/gpio-clps711x.c +++ b/drivers/gpio/gpio-clps711x.c @@ -26,7 +26,7 @@ static int clps711x_gpio_probe(struct platform_device *pdev) if ((id < 0) || (id > 4)) return -ENODEV; - gen_gc = devm_kzalloc(&pdev->dev, sizeof(*gen_gc), GFP_KERNEL); + gen_gc = devm_kzalloc_obj(&pdev->dev, *gen_gc); if (!gen_gc) return -ENOMEM; diff --git a/drivers/gpio/gpio-creg-snps.c b/drivers/gpio/gpio-creg-snps.c index 157ab90f5ba8..f30ef9948348 100644 --- a/drivers/gpio/gpio-creg-snps.c +++ b/drivers/gpio/gpio-creg-snps.c @@ -139,7 +139,7 @@ static int creg_gpio_probe(struct platform_device *pdev) u32 ngpios; int ret; - hcg = devm_kzalloc(dev, sizeof(struct creg_gpio), GFP_KERNEL); + hcg = devm_kzalloc_obj(dev, struct creg_gpio); if (!hcg) return -ENOMEM; diff --git a/drivers/gpio/gpio-cros-ec.c b/drivers/gpio/gpio-cros-ec.c index b48b684d817f..d06d74bd86d8 100644 --- a/drivers/gpio/gpio-cros-ec.c +++ b/drivers/gpio/gpio-cros-ec.c @@ -107,7 +107,7 @@ static int cros_ec_gpio_init_names(struct cros_ec_device *cros_ec, struct gpio_c const char **names; char *str; - names = devm_kcalloc(gc->parent, gc->ngpio, sizeof(*names), GFP_KERNEL); + names = devm_kzalloc_objs(gc->parent, *names, gc->ngpio); if (!names) return -ENOMEM; gc->names = names; @@ -174,7 +174,7 @@ static int cros_ec_gpio_probe(struct platform_device *pdev) return ngpios; } - gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL); + gc = devm_kzalloc_obj(dev, *gc); if (!gc) return -ENOMEM; diff --git a/drivers/gpio/gpio-crystalcove.c b/drivers/gpio/gpio-crystalcove.c index ab7fab5b9754..566fba32c531 100644 --- a/drivers/gpio/gpio-crystalcove.c +++ b/drivers/gpio/gpio-crystalcove.c @@ -340,7 +340,7 @@ static int crystalcove_gpio_probe(struct platform_device *pdev) if (irq < 0) return irq; - cg = devm_kzalloc(&pdev->dev, sizeof(*cg), GFP_KERNEL); + cg = devm_kzalloc_obj(&pdev->dev, *cg); if (!cg) return -ENOMEM; diff --git a/drivers/gpio/gpio-cs5535.c b/drivers/gpio/gpio-cs5535.c index 5f5373d86397..405471df5a38 100644 --- a/drivers/gpio/gpio-cs5535.c +++ b/drivers/gpio/gpio-cs5535.c @@ -289,7 +289,7 @@ static int cs5535_gpio_probe(struct platform_device *pdev) int err = -EIO; ulong mask_orig = mask; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-da9052.c b/drivers/gpio/gpio-da9052.c index 495f0ee58505..54dd51df57c3 100644 --- a/drivers/gpio/gpio-da9052.c +++ b/drivers/gpio/gpio-da9052.c @@ -186,7 +186,7 @@ static int da9052_gpio_probe(struct platform_device *pdev) struct da9052_gpio *gpio; struct da9052_pdata *pdata; - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-da9055.c b/drivers/gpio/gpio-da9055.c index 1949a6ea8ec6..32f6f1967a17 100644 --- a/drivers/gpio/gpio-da9055.c +++ b/drivers/gpio/gpio-da9055.c @@ -130,7 +130,7 @@ static int da9055_gpio_probe(struct platform_device *pdev) struct da9055_gpio *gpio; struct da9055_pdata *pdata; - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c index fc2b9bef7efc..303b5409e284 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c @@ -200,7 +200,7 @@ static int davinci_gpio_probe(struct platform_device *pdev) return -EINVAL; } - chips = devm_kzalloc(dev, sizeof(*chips), GFP_KERNEL); + chips = devm_kzalloc_obj(dev, *chips); if (!chips) return -ENOMEM; @@ -564,10 +564,8 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) * gpio irqs. Pass the irq bank's corresponding controller to * the chained irq handler. */ - irqdata = devm_kzalloc(&pdev->dev, - sizeof(struct - davinci_gpio_irq_data), - GFP_KERNEL); + irqdata = devm_kzalloc_obj(&pdev->dev, + struct davinci_gpio_irq_data); if (!irqdata) { irq_domain_remove(chips->irq_domain); return -ENOMEM; diff --git a/drivers/gpio/gpio-dln2.c b/drivers/gpio/gpio-dln2.c index aef4345d265e..2a56d99d289a 100644 --- a/drivers/gpio/gpio-dln2.c +++ b/drivers/gpio/gpio-dln2.c @@ -453,7 +453,7 @@ static int dln2_gpio_probe(struct platform_device *pdev) dev_warn(dev, "clamping pins to %d\n", DLN2_GPIO_MAX_PINS); } - dln2 = devm_kzalloc(&pdev->dev, sizeof(*dln2), GFP_KERNEL); + dln2 = devm_kzalloc_obj(&pdev->dev, *dln2); if (!dln2) return -ENOMEM; diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c index aa7c08e60707..802088448953 100644 --- a/drivers/gpio/gpio-dwapb.c +++ b/drivers/gpio/gpio-dwapb.c @@ -475,7 +475,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, struct gpio_irq_chip *girq; int err; - pirq = devm_kzalloc(gpio->dev, sizeof(*pirq), GFP_KERNEL); + pirq = devm_kzalloc_obj(gpio->dev, *pirq); if (!pirq) return; @@ -538,7 +538,7 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio, port->idx = pp->idx; #ifdef CONFIG_PM_SLEEP - port->ctx = devm_kzalloc(gpio->dev, sizeof(*port->ctx), GFP_KERNEL); + port->ctx = devm_kzalloc_obj(gpio->dev, *port->ctx); if (!port->ctx) return -ENOMEM; #endif @@ -615,7 +615,7 @@ static struct dwapb_platform_data *dwapb_gpio_get_pdata(struct device *dev) if (nports == 0) return ERR_PTR(-ENODEV); - pdata = devm_kzalloc(dev, struct_size(pdata, properties, nports), GFP_KERNEL); + pdata = devm_kzalloc_flex(dev, *pdata, properties, nports); if (!pdata) return ERR_PTR(-ENOMEM); @@ -741,7 +741,7 @@ static int dwapb_gpio_probe(struct platform_device *pdev) if (IS_ERR(pdata)) return PTR_ERR(pdata); - gpio = devm_kzalloc(&pdev->dev, struct_size(gpio, ports, pdata->nports), GFP_KERNEL); + gpio = devm_kzalloc_flex(&pdev->dev, *gpio, ports, pdata->nports); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c index 86eb9624d38a..f0ce3c1c7654 100644 --- a/drivers/gpio/gpio-eic-sprd.c +++ b/drivers/gpio/gpio-eic-sprd.c @@ -617,7 +617,7 @@ static int sprd_eic_probe(struct platform_device *pdev) return -EINVAL; } - sprd_eic = devm_kzalloc(dev, sizeof(*sprd_eic), GFP_KERNEL); + sprd_eic = devm_kzalloc_obj(dev, *sprd_eic); if (!sprd_eic) return -ENOMEM; diff --git a/drivers/gpio/gpio-elkhartlake.c b/drivers/gpio/gpio-elkhartlake.c index b96e7928b6e5..da8010fbd53f 100644 --- a/drivers/gpio/gpio-elkhartlake.c +++ b/drivers/gpio/gpio-elkhartlake.c @@ -32,7 +32,7 @@ static int ehl_gpio_probe(struct auxiliary_device *adev, const struct auxiliary_ if (!data) return -ENODATA; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c index a214b0672726..a66e8af619ef 100644 --- a/drivers/gpio/gpio-em.c +++ b/drivers/gpio/gpio-em.c @@ -273,7 +273,7 @@ static int em_gio_probe(struct platform_device *pdev) unsigned int ngpios; int irq[2], ret; - p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(dev, *p); if (!p) return -ENOMEM; diff --git a/drivers/gpio/gpio-en7523.c b/drivers/gpio/gpio-en7523.c index 14ad3ca9e623..b1a50f4387a9 100644 --- a/drivers/gpio/gpio-en7523.c +++ b/drivers/gpio/gpio-en7523.c @@ -79,7 +79,7 @@ static int airoha_gpio_probe(struct platform_device *pdev) struct airoha_gpio_ctrl *ctrl; int err; - ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(dev, *ctrl); if (!ctrl) return -ENOMEM; diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c index 8784e433e1ff..9beff7d9bbff 100644 --- a/drivers/gpio/gpio-ep93xx.c +++ b/drivers/gpio/gpio-ep93xx.c @@ -282,7 +282,7 @@ static int ep93xx_setup_irqs(struct platform_device *pdev, return PTR_ERR(intr); gc->set_config = ep93xx_gpio_set_config; - egc->eic = devm_kzalloc(dev, sizeof(*egc->eic), GFP_KERNEL); + egc->eic = devm_kzalloc_obj(dev, *egc->eic); if (!egc->eic) return -ENOMEM; @@ -292,8 +292,8 @@ static int ep93xx_setup_irqs(struct platform_device *pdev, if (girq->num_parents == 0) return -EINVAL; - girq->parents = devm_kcalloc(dev, girq->num_parents, sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, + girq->num_parents); if (!girq->parents) return -ENOMEM; @@ -337,7 +337,7 @@ static int ep93xx_gpio_probe(struct platform_device *pdev) void __iomem *dir; int ret; - egc = devm_kzalloc(&pdev->dev, sizeof(*egc), GFP_KERNEL); + egc = devm_kzalloc_obj(&pdev->dev, *egc); if (!egc) return -ENOMEM; diff --git a/drivers/gpio/gpio-exar.c b/drivers/gpio/gpio-exar.c index f629cc526f3e..ad7a653b0617 100644 --- a/drivers/gpio/gpio-exar.c +++ b/drivers/gpio/gpio-exar.c @@ -173,7 +173,7 @@ static int gpio_exar_probe(struct platform_device *pdev) if (ret) return ret; - exar_gpio = devm_kzalloc(dev, sizeof(*exar_gpio), GFP_KERNEL); + exar_gpio = devm_kzalloc_obj(dev, *exar_gpio); if (!exar_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-f7188x.c b/drivers/gpio/gpio-f7188x.c index fb007b978729..37138139302d 100644 --- a/drivers/gpio/gpio-f7188x.c +++ b/drivers/gpio/gpio-f7188x.c @@ -459,7 +459,7 @@ static int f7188x_gpio_probe(struct platform_device *pdev) struct f7188x_sio *sio = dev_get_platdata(&pdev->dev); struct f7188x_gpio_data *data; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/gpio/gpio-ftgpio010.c b/drivers/gpio/gpio-ftgpio010.c index 11e6907c3b54..d98aec5f195d 100644 --- a/drivers/gpio/gpio-ftgpio010.c +++ b/drivers/gpio/gpio-ftgpio010.c @@ -242,7 +242,7 @@ static int ftgpio_gpio_probe(struct platform_device *pdev) int irq; int ret; - g = devm_kzalloc(dev, sizeof(*g), GFP_KERNEL); + g = devm_kzalloc_obj(dev, *g); if (!g) return -ENOMEM; @@ -291,8 +291,7 @@ static int ftgpio_gpio_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &ftgpio_irq_chip); girq->parent_handler = ftgpio_gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; diff --git a/drivers/gpio/gpio-ge.c b/drivers/gpio/gpio-ge.c index d0c8e16f1d48..1ce736016649 100644 --- a/drivers/gpio/gpio-ge.c +++ b/drivers/gpio/gpio-ge.c @@ -58,7 +58,7 @@ static int __init gef_gpio_probe(struct platform_device *pdev) void __iomem *regs; int ret; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-graniterapids.c b/drivers/gpio/gpio-graniterapids.c index 2d0fe3abd5e0..da9716d504f5 100644 --- a/drivers/gpio/gpio-graniterapids.c +++ b/drivers/gpio/gpio-graniterapids.c @@ -320,7 +320,7 @@ static int gnr_gpio_probe(struct platform_device *pdev) int irq, ret; u32 offset; - priv = devm_kzalloc(dev, struct_size(priv, pad_backup, num_backup_pins), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, pad_backup, num_backup_pins); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-grgpio.c b/drivers/gpio/gpio-grgpio.c index e4fa84e22726..0fa873d3810e 100644 --- a/drivers/gpio/gpio-grgpio.c +++ b/drivers/gpio/gpio-grgpio.c @@ -336,7 +336,7 @@ static int grgpio_probe(struct platform_device *ofdev) int size; int i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-gw-pld.c b/drivers/gpio/gpio-gw-pld.c index bf1f91c3c4a8..6621a0706cef 100644 --- a/drivers/gpio/gpio-gw-pld.c +++ b/drivers/gpio/gpio-gw-pld.c @@ -73,7 +73,7 @@ static int gw_pld_probe(struct i2c_client *client) struct gw_pld *gw; int ret; - gw = devm_kzalloc(dev, sizeof(*gw), GFP_KERNEL); + gw = devm_kzalloc_obj(dev, *gw); if (!gw) return -ENOMEM; diff --git a/drivers/gpio/gpio-hisi.c b/drivers/gpio/gpio-hisi.c index 42d41cf87ac7..5d3b5286c4fc 100644 --- a/drivers/gpio/gpio-hisi.c +++ b/drivers/gpio/gpio-hisi.c @@ -279,7 +279,7 @@ static int hisi_gpio_probe(struct platform_device *pdev) if (WARN_ON(port_num != 1)) return -ENODEV; - hisi_gpio = devm_kzalloc(dev, sizeof(*hisi_gpio), GFP_KERNEL); + hisi_gpio = devm_kzalloc_obj(dev, *hisi_gpio); if (!hisi_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-hlwd.c b/drivers/gpio/gpio-hlwd.c index 043ce5ef3b07..9b6e97f9acbb 100644 --- a/drivers/gpio/gpio-hlwd.c +++ b/drivers/gpio/gpio-hlwd.c @@ -226,7 +226,7 @@ static int hlwd_gpio_probe(struct platform_device *pdev) u32 ngpios; int res; - hlwd = devm_kzalloc(&pdev->dev, sizeof(*hlwd), GFP_KERNEL); + hlwd = devm_kzalloc_obj(&pdev->dev, *hlwd); if (!hlwd) return -ENOMEM; @@ -289,9 +289,7 @@ static int hlwd_gpio_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &hlwd_gpio_irq_chip); girq->parent_handler = hlwd_gpio_irqhandler; girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(&pdev->dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; girq->parents[0] = hlwd->irq; diff --git a/drivers/gpio/gpio-htc-egpio.c b/drivers/gpio/gpio-htc-egpio.c index 25a4d4494f3c..18ac57e7ee43 100644 --- a/drivers/gpio/gpio-htc-egpio.c +++ b/drivers/gpio/gpio-htc-egpio.c @@ -271,7 +271,7 @@ static int __init egpio_probe(struct platform_device *pdev) int ret; /* Initialize ei data structure. */ - ei = devm_kzalloc(&pdev->dev, struct_size(ei, chip, pdata->num_chips), GFP_KERNEL); + ei = devm_kzalloc_flex(&pdev->dev, *ei, chip, pdata->num_chips); if (!ei) return -ENOMEM; diff --git a/drivers/gpio/gpio-idio-16.c b/drivers/gpio/gpio-idio-16.c index 9ac967c6b430..b9aa8bb9347a 100644 --- a/drivers/gpio/gpio-idio-16.c +++ b/drivers/gpio/gpio-idio-16.c @@ -119,12 +119,12 @@ int devm_idio_16_regmap_register(struct device *const dev, if (!config->regmap_irqs) return -EINVAL; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; data->map = config->map; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-idt3243x.c b/drivers/gpio/gpio-idt3243x.c index 031b5c127fd6..43e5e905fb43 100644 --- a/drivers/gpio/gpio-idt3243x.c +++ b/drivers/gpio/gpio-idt3243x.c @@ -136,7 +136,7 @@ static int idt_gpio_probe(struct platform_device *pdev) int ret; - ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(dev, *ctrl); if (!ctrl) return -ENOMEM; @@ -177,9 +177,8 @@ static int idt_gpio_probe(struct platform_device *pdev) girq->init_hw = idt_gpio_irq_init_hw; girq->parent_handler = idt_gpio_dispatch; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, girq->num_parents, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, + girq->num_parents); if (!girq->parents) return -ENOMEM; diff --git a/drivers/gpio/gpio-imx-scu.c b/drivers/gpio/gpio-imx-scu.c index 0a75afecf9f8..fee133c6812b 100644 --- a/drivers/gpio/gpio-imx-scu.c +++ b/drivers/gpio/gpio-imx-scu.c @@ -82,7 +82,7 @@ static int imx_scu_gpio_probe(struct platform_device *pdev) struct gpio_chip *gc; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-ixp4xx.c b/drivers/gpio/gpio-ixp4xx.c index 669b139cd499..2c9fb2baf7d0 100644 --- a/drivers/gpio/gpio-ixp4xx.c +++ b/drivers/gpio/gpio-ixp4xx.c @@ -216,7 +216,7 @@ static int ixp4xx_gpio_probe(struct platform_device *pdev) u32 val; int ret; - g = devm_kzalloc(dev, sizeof(*g), GFP_KERNEL); + g = devm_kzalloc_obj(dev, *g); if (!g) return -ENOMEM; g->dev = dev; diff --git a/drivers/gpio/gpio-janz-ttl.c b/drivers/gpio/gpio-janz-ttl.c index b0c4a3346e7d..36eda7f9b45a 100644 --- a/drivers/gpio/gpio-janz-ttl.c +++ b/drivers/gpio/gpio-janz-ttl.c @@ -152,7 +152,7 @@ static int ttl_probe(struct platform_device *pdev) return -ENXIO; } - mod = devm_kzalloc(&pdev->dev, sizeof(*mod), GFP_KERNEL); + mod = devm_kzalloc_obj(&pdev->dev, *mod); if (!mod) return -ENOMEM; diff --git a/drivers/gpio/gpio-kempld.c b/drivers/gpio/gpio-kempld.c index 5a63df3ea5fa..490d9db5fd96 100644 --- a/drivers/gpio/gpio-kempld.c +++ b/drivers/gpio/gpio-kempld.c @@ -396,7 +396,7 @@ static int kempld_gpio_probe(struct platform_device *pdev) return -ENODEV; } - gpio = devm_kzalloc(dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-latch.c b/drivers/gpio/gpio-latch.c index 88757402ea96..a22e9676e589 100644 --- a/drivers/gpio/gpio-latch.c +++ b/drivers/gpio/gpio-latch.c @@ -141,7 +141,7 @@ static int gpio_latch_probe(struct platform_device *pdev) struct gpio_latch_priv *priv; unsigned int n_latches; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-ljca.c b/drivers/gpio/gpio-ljca.c index f32d1d237795..067e5c472abd 100644 --- a/drivers/gpio/gpio-ljca.c +++ b/drivers/gpio/gpio-ljca.c @@ -404,7 +404,7 @@ static int ljca_gpio_probe(struct auxiliary_device *auxdev, struct gpio_irq_chip *girq; int ret; - ljca_gpio = devm_kzalloc(&auxdev->dev, sizeof(*ljca_gpio), GFP_KERNEL); + ljca_gpio = devm_kzalloc_obj(&auxdev->dev, *ljca_gpio); if (!ljca_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-logicvc.c b/drivers/gpio/gpio-logicvc.c index cb9dbcc290ad..4137cd18bf7f 100644 --- a/drivers/gpio/gpio-logicvc.c +++ b/drivers/gpio/gpio-logicvc.c @@ -93,7 +93,7 @@ static int logicvc_gpio_probe(struct platform_device *pdev) struct logicvc_gpio *logicvc; int ret; - logicvc = devm_kzalloc(dev, sizeof(*logicvc), GFP_KERNEL); + logicvc = devm_kzalloc_obj(dev, *logicvc); if (!logicvc) return -ENOMEM; diff --git a/drivers/gpio/gpio-loongson-64bit.c b/drivers/gpio/gpio-loongson-64bit.c index 0fdf15faa344..fa975a42539b 100644 --- a/drivers/gpio/gpio-loongson-64bit.c +++ b/drivers/gpio/gpio-loongson-64bit.c @@ -261,8 +261,8 @@ static int loongson_gpio_init_irqchip(struct platform_device *pdev, gpio_irq_chip_set_chip(&chip->irq, data->girqchip); chip->irq.num_parents = data->intr_num; - chip->irq.parents = devm_kcalloc(&pdev->dev, data->intr_num, - sizeof(*chip->irq.parents), GFP_KERNEL); + chip->irq.parents = devm_kzalloc_objs(&pdev->dev, *chip->irq.parents, + data->intr_num); if (!chip->irq.parents) return -ENOMEM; @@ -336,7 +336,7 @@ static int loongson_gpio_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct reset_control *rst; - lgpio = devm_kzalloc(dev, sizeof(*lgpio), GFP_KERNEL); + lgpio = devm_kzalloc_obj(dev, *lgpio); if (!lgpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-loongson.c b/drivers/gpio/gpio-loongson.c index f3e0559f969d..042e3fb0a033 100644 --- a/drivers/gpio/gpio-loongson.c +++ b/drivers/gpio/gpio-loongson.c @@ -98,7 +98,7 @@ static int loongson_gpio_probe(struct platform_device *pdev) struct gpio_chip *gc; struct device *dev = &pdev->dev; - gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL); + gc = devm_kzalloc_obj(dev, *gc); if (!gc) return -ENOMEM; diff --git a/drivers/gpio/gpio-loongson1.c b/drivers/gpio/gpio-loongson1.c index 9750a7a17508..006329270e3c 100644 --- a/drivers/gpio/gpio-loongson1.c +++ b/drivers/gpio/gpio-loongson1.c @@ -51,7 +51,7 @@ static int ls1x_gpio_probe(struct platform_device *pdev) struct ls1x_gpio_chip *ls1x_gc; int ret; - ls1x_gc = devm_kzalloc(dev, sizeof(*ls1x_gc), GFP_KERNEL); + ls1x_gc = devm_kzalloc_obj(dev, *ls1x_gc); if (!ls1x_gc) return -ENOMEM; diff --git a/drivers/gpio/gpio-lp3943.c b/drivers/gpio/gpio-lp3943.c index e8e00daff7df..c171da92c534 100644 --- a/drivers/gpio/gpio-lp3943.c +++ b/drivers/gpio/gpio-lp3943.c @@ -195,8 +195,7 @@ static int lp3943_gpio_probe(struct platform_device *pdev) struct lp3943 *lp3943 = dev_get_drvdata(pdev->dev.parent); struct lp3943_gpio *lp3943_gpio; - lp3943_gpio = devm_kzalloc(&pdev->dev, sizeof(*lp3943_gpio), - GFP_KERNEL); + lp3943_gpio = devm_kzalloc_obj(&pdev->dev, *lp3943_gpio); if (!lp3943_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-lp873x.c b/drivers/gpio/gpio-lp873x.c index 0d1bd9df265a..67ec9bee1331 100644 --- a/drivers/gpio/gpio-lp873x.c +++ b/drivers/gpio/gpio-lp873x.c @@ -136,7 +136,7 @@ static int lp873x_gpio_probe(struct platform_device *pdev) struct lp873x_gpio *gpio; int ret; - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-lp87565.c b/drivers/gpio/gpio-lp87565.c index 3ac78f2b0fa7..822f1a02b3d5 100644 --- a/drivers/gpio/gpio-lp87565.c +++ b/drivers/gpio/gpio-lp87565.c @@ -152,7 +152,7 @@ static int lp87565_gpio_probe(struct platform_device *pdev) struct lp87565 *lp87565; int ret; - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-lpc18xx.c b/drivers/gpio/gpio-lpc18xx.c index 37a2342eb2e6..2a1e083cd92d 100644 --- a/drivers/gpio/gpio-lpc18xx.c +++ b/drivers/gpio/gpio-lpc18xx.c @@ -225,7 +225,7 @@ static int lpc18xx_gpio_pin_ic_probe(struct lpc18xx_gpio_chip *gc) if (!parent_domain) return -ENXIO; - ic = devm_kzalloc(dev, sizeof(*ic), GFP_KERNEL); + ic = devm_kzalloc_obj(dev, *ic); if (!ic) return -ENOMEM; @@ -340,7 +340,7 @@ static int lpc18xx_gpio_probe(struct platform_device *pdev) int index, ret; struct clk *clk; - gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL); + gc = devm_kzalloc_obj(dev, *gc); if (!gc) return -ENOMEM; diff --git a/drivers/gpio/gpio-ltc4283.c b/drivers/gpio/gpio-ltc4283.c index 88aa6216006a..804554901078 100644 --- a/drivers/gpio/gpio-ltc4283.c +++ b/drivers/gpio/gpio-ltc4283.c @@ -173,7 +173,7 @@ static int ltc4283_gpio_probe(struct auxiliary_device *adev, struct ltc4283_gpio *st; struct gpio_chip *gc; - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/gpio/gpio-macsmc.c b/drivers/gpio/gpio-macsmc.c index b0952d066a9d..bb6dc5db0487 100644 --- a/drivers/gpio/gpio-macsmc.c +++ b/drivers/gpio/gpio-macsmc.c @@ -239,7 +239,7 @@ static int macsmc_gpio_probe(struct platform_device *pdev) smc_key key; int ret; - smcgp = devm_kzalloc(&pdev->dev, sizeof(*smcgp), GFP_KERNEL); + smcgp = devm_kzalloc_obj(&pdev->dev, *smcgp); if (!smcgp) return -ENOMEM; diff --git a/drivers/gpio/gpio-madera.c b/drivers/gpio/gpio-madera.c index 551faf9655b2..c384e567341a 100644 --- a/drivers/gpio/gpio-madera.c +++ b/drivers/gpio/gpio-madera.c @@ -121,8 +121,7 @@ static int madera_gpio_probe(struct platform_device *pdev) struct madera_gpio *madera_gpio; int ret; - madera_gpio = devm_kzalloc(&pdev->dev, sizeof(*madera_gpio), - GFP_KERNEL); + madera_gpio = devm_kzalloc_obj(&pdev->dev, *madera_gpio); if (!madera_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-max3191x.c b/drivers/gpio/gpio-max3191x.c index 6e6504ab740a..7dced73143cb 100644 --- a/drivers/gpio/gpio-max3191x.c +++ b/drivers/gpio/gpio-max3191x.c @@ -347,7 +347,7 @@ static int max3191x_probe(struct spi_device *spi) struct max3191x_chip *max3191x; int n, ret; - max3191x = devm_kzalloc(dev, sizeof(*max3191x), GFP_KERNEL); + max3191x = devm_kzalloc_obj(dev, *max3191x); if (!max3191x) return -ENOMEM; spi_set_drvdata(spi, max3191x); diff --git a/drivers/gpio/gpio-max7300.c b/drivers/gpio/gpio-max7300.c index 62f2434c0d79..6a7b013273cc 100644 --- a/drivers/gpio/gpio-max7300.c +++ b/drivers/gpio/gpio-max7300.c @@ -36,7 +36,7 @@ static int max7300_probe(struct i2c_client *client) I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - ts = devm_kzalloc(&client->dev, sizeof(struct max7301), GFP_KERNEL); + ts = devm_kzalloc_obj(&client->dev, struct max7301); if (!ts) return -ENOMEM; diff --git a/drivers/gpio/gpio-max7301.c b/drivers/gpio/gpio-max7301.c index 11813f41d460..6955291e75bf 100644 --- a/drivers/gpio/gpio-max7301.c +++ b/drivers/gpio/gpio-max7301.c @@ -52,7 +52,7 @@ static int max7301_probe(struct spi_device *spi) if (ret < 0) return ret; - ts = devm_kzalloc(&spi->dev, sizeof(struct max7301), GFP_KERNEL); + ts = devm_kzalloc_obj(&spi->dev, struct max7301); if (!ts) return -ENOMEM; diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c index 24c67c912954..d595efacd83a 100644 --- a/drivers/gpio/gpio-max732x.c +++ b/drivers/gpio/gpio-max732x.c @@ -604,7 +604,7 @@ static struct max732x_platform_data *of_gpio_max732x(struct device *dev) { struct max732x_platform_data *pdata; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return NULL; @@ -634,7 +634,7 @@ static int max732x_probe(struct i2c_client *client) return -EINVAL; } - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (chip == NULL) return -ENOMEM; chip->client = client; diff --git a/drivers/gpio/gpio-max7360.c b/drivers/gpio/gpio-max7360.c index 6755d58c4534..e02f4f2d8cca 100644 --- a/drivers/gpio/gpio-max7360.c +++ b/drivers/gpio/gpio-max7360.c @@ -170,7 +170,7 @@ static int max7360_gpio_probe(struct platform_device *pdev) "Failed to get IRQ\n"); /* Create custom IRQ configuration. */ - irq_chip = devm_kzalloc(dev, sizeof(*irq_chip), GFP_KERNEL); + irq_chip = devm_kzalloc_obj(dev, *irq_chip); if (!irq_chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c index 2bf3b55a61b5..2108ce044279 100644 --- a/drivers/gpio/gpio-max77620.c +++ b/drivers/gpio/gpio-max77620.c @@ -316,7 +316,7 @@ static int max77620_gpio_probe(struct platform_device *pdev) gpio_irq = ret; - mgpio = devm_kzalloc(&pdev->dev, sizeof(*mgpio), GFP_KERNEL); + mgpio = devm_kzalloc_obj(&pdev->dev, *mgpio); if (!mgpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-max77650.c b/drivers/gpio/gpio-max77650.c index 4540da4c1418..1ee183807b1d 100644 --- a/drivers/gpio/gpio-max77650.c +++ b/drivers/gpio/gpio-max77650.c @@ -145,7 +145,7 @@ static int max77650_gpio_probe(struct platform_device *pdev) parent = dev->parent; i2c = to_i2c_client(parent); - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-max77759.c b/drivers/gpio/gpio-max77759.c index da3c77dd574e..99dacf800cdb 100644 --- a/drivers/gpio/gpio-max77759.c +++ b/drivers/gpio/gpio-max77759.c @@ -435,7 +435,7 @@ static int max77759_gpio_probe(struct platform_device *pdev) struct gpio_irq_chip *girq; int ret; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-mb86s7x.c b/drivers/gpio/gpio-mb86s7x.c index 78bcae130e0e..14707f2170a1 100644 --- a/drivers/gpio/gpio-mb86s7x.c +++ b/drivers/gpio/gpio-mb86s7x.c @@ -158,7 +158,7 @@ static int mb86s70_gpio_probe(struct platform_device *pdev) struct clk *clk; int ret; - gchip = devm_kzalloc(&pdev->dev, sizeof(*gchip), GFP_KERNEL); + gchip = devm_kzalloc_obj(&pdev->dev, *gchip); if (gchip == NULL) return -ENOMEM; diff --git a/drivers/gpio/gpio-mc33880.c b/drivers/gpio/gpio-mc33880.c index 9a40e9579e95..d48719660eae 100644 --- a/drivers/gpio/gpio-mc33880.c +++ b/drivers/gpio/gpio-mc33880.c @@ -92,7 +92,7 @@ static int mc33880_probe(struct spi_device *spi) if (ret < 0) return ret; - mc = devm_kzalloc(&spi->dev, sizeof(struct mc33880), GFP_KERNEL); + mc = devm_kzalloc_obj(&spi->dev, struct mc33880); if (!mc) return -ENOMEM; diff --git a/drivers/gpio/gpio-menz127.c b/drivers/gpio/gpio-menz127.c index f51e7517f551..f4936c2eec3d 100644 --- a/drivers/gpio/gpio-menz127.c +++ b/drivers/gpio/gpio-menz127.c @@ -147,8 +147,7 @@ static int men_z127_probe(struct mcb_device *mdev, int ret; unsigned long sz; - men_z127_gpio = devm_kzalloc(dev, sizeof(struct men_z127_gpio), - GFP_KERNEL); + men_z127_gpio = devm_kzalloc_obj(dev, struct men_z127_gpio); if (!men_z127_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c index 4335a5d8e4f6..b926e564d82b 100644 --- a/drivers/gpio/gpio-merrifield.c +++ b/drivers/gpio/gpio-merrifield.c @@ -88,7 +88,7 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id /* Release the IO mapping, since we already get the info from BAR1 */ pcim_iounmap_region(pdev, 1); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c index 391188c0f2c2..28df539c2710 100644 --- a/drivers/gpio/gpio-ml-ioh.c +++ b/drivers/gpio/gpio-ml-ioh.c @@ -434,7 +434,7 @@ static int ioh_gpio_probe(struct pci_dev *pdev, return -ENOMEM; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-mlxbf.c b/drivers/gpio/gpio-mlxbf.c index a18fedbc463e..0c2f607a1b1d 100644 --- a/drivers/gpio/gpio-mlxbf.c +++ b/drivers/gpio/gpio-mlxbf.c @@ -56,7 +56,7 @@ static int mlxbf_gpio_probe(struct platform_device *pdev) struct gpio_chip *gc; int ret; - gs = devm_kzalloc(&pdev->dev, sizeof(*gs), GFP_KERNEL); + gs = devm_kzalloc_obj(&pdev->dev, *gs); if (!gs) return -ENOMEM; diff --git a/drivers/gpio/gpio-mlxbf2.c b/drivers/gpio/gpio-mlxbf2.c index 4e5c5d196a50..b3b107c07cbe 100644 --- a/drivers/gpio/gpio-mlxbf2.c +++ b/drivers/gpio/gpio-mlxbf2.c @@ -356,7 +356,7 @@ mlxbf2_gpio_probe(struct platform_device *pdev) name = dev_name(dev); - gs = devm_kzalloc(dev, sizeof(*gs), GFP_KERNEL); + gs = devm_kzalloc_obj(dev, *gs); if (!gs) return -ENOMEM; diff --git a/drivers/gpio/gpio-mlxbf3.c b/drivers/gpio/gpio-mlxbf3.c index 929f64c5140a..3a39d273f2b9 100644 --- a/drivers/gpio/gpio-mlxbf3.c +++ b/drivers/gpio/gpio-mlxbf3.c @@ -188,7 +188,7 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev) struct gpio_chip *gc; int ret, irq; - gs = devm_kzalloc(dev, sizeof(*gs), GFP_KERNEL); + gs = devm_kzalloc_obj(dev, *gs); if (!gs) return -ENOMEM; diff --git a/drivers/gpio/gpio-mm-lantiq.c b/drivers/gpio/gpio-mm-lantiq.c index 1bd98c50a459..37f8a5cc7794 100644 --- a/drivers/gpio/gpio-mm-lantiq.c +++ b/drivers/gpio/gpio-mm-lantiq.c @@ -103,7 +103,7 @@ static int ltq_mm_probe(struct platform_device *pdev) struct ltq_mm *chip; u32 shadow; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c index 0709ffaab4de..6d4b659fbc26 100644 --- a/drivers/gpio/gpio-mmio.c +++ b/drivers/gpio/gpio-mmio.c @@ -826,7 +826,7 @@ static int gpio_mmio_pdev_probe(struct platform_device *pdev) if (IS_ERR(dirin)) return PTR_ERR(dirin); - gen_gc = devm_kzalloc(&pdev->dev, sizeof(*gen_gc), GFP_KERNEL); + gen_gc = devm_kzalloc_obj(&pdev->dev, *gen_gc); if (!gen_gc) return -ENOMEM; diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c index 1c6a2f3414f1..0e37d2369b78 100644 --- a/drivers/gpio/gpio-mockup.c +++ b/drivers/gpio/gpio-mockup.c @@ -381,7 +381,7 @@ static void gpio_mockup_debugfs_setup(struct device *dev, if (!name) return; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return; @@ -436,7 +436,7 @@ static int gpio_mockup_probe(struct platform_device *pdev) if (rv) name = dev_name(dev); - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; @@ -460,8 +460,7 @@ static int gpio_mockup_probe(struct platform_device *pdev) gc->request = gpio_mockup_request; gc->free = gpio_mockup_free; - chip->lines = devm_kcalloc(dev, gc->ngpio, - sizeof(*chip->lines), GFP_KERNEL); + chip->lines = devm_kzalloc_objs(dev, *chip->lines, gc->ngpio); if (!chip->lines) return -ENOMEM; diff --git a/drivers/gpio/gpio-moxtet.c b/drivers/gpio/gpio-moxtet.c index 4eb9f1a2779b..f86c4f9e0b90 100644 --- a/drivers/gpio/gpio-moxtet.c +++ b/drivers/gpio/gpio-moxtet.c @@ -125,7 +125,7 @@ static int moxtet_gpio_probe(struct device *dev) return -ENOTSUPP; } - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-mpc5200.c b/drivers/gpio/gpio-mpc5200.c index 00f209157fd0..4d0781eac9b6 100644 --- a/drivers/gpio/gpio-mpc5200.c +++ b/drivers/gpio/gpio-mpc5200.c @@ -141,7 +141,7 @@ static int mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev) struct gpio_chip *gc; int ret; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; @@ -303,7 +303,7 @@ static int mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev) struct mpc52xx_gpio __iomem *regs; int ret; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index a6868f673831..7b20ca4d7367 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c @@ -329,7 +329,7 @@ static int mpc8xxx_probe(struct platform_device *pdev) struct gpio_chip *gc; int ret; - mpc8xxx_gc = devm_kzalloc(dev, sizeof(*mpc8xxx_gc), GFP_KERNEL); + mpc8xxx_gc = devm_kzalloc_obj(dev, *mpc8xxx_gc); if (!mpc8xxx_gc) return -ENOMEM; diff --git a/drivers/gpio/gpio-mpfs.c b/drivers/gpio/gpio-mpfs.c index 7f0751d7b1c4..0f1264f5490b 100644 --- a/drivers/gpio/gpio-mpfs.c +++ b/drivers/gpio/gpio-mpfs.c @@ -208,7 +208,7 @@ static int mpfs_gpio_probe(struct platform_device *pdev) void __iomem *base; int ngpios, nirqs, ret; - mpfs_gpio = devm_kzalloc(dev, sizeof(*mpfs_gpio), GFP_KERNEL); + mpfs_gpio = devm_kzalloc_obj(dev, *mpfs_gpio); if (!mpfs_gpio) return -ENOMEM; @@ -253,8 +253,8 @@ static int mpfs_gpio_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &mpfs_gpio_irqchip); girq->num_parents = nirqs; - girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents, - sizeof(*girq->parents), GFP_KERNEL); + girq->parents = devm_kzalloc_objs(&pdev->dev, *girq->parents, + girq->num_parents); if (!girq->parents) return -ENOMEM; diff --git a/drivers/gpio/gpio-mpsse.c b/drivers/gpio/gpio-mpsse.c index 61c5ca96314b..a16b6875b2e2 100644 --- a/drivers/gpio/gpio-mpsse.c +++ b/drivers/gpio/gpio-mpsse.c @@ -602,7 +602,7 @@ static int gpio_mpsse_probe(struct usb_interface *interface, struct mpsse_quirk *quirk = (void *)id->driver_info; dev = &interface->dev; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-msc313.c b/drivers/gpio/gpio-msc313.c index 7345afdc78de..45227413db58 100644 --- a/drivers/gpio/gpio-msc313.c +++ b/drivers/gpio/gpio-msc313.c @@ -631,7 +631,7 @@ static int msc313_gpio_probe(struct platform_device *pdev) if (!parent_domain) return -ENODEV; - gpio = devm_kzalloc(dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(dev, *gpio); if (!gpio) return -ENOMEM; @@ -647,7 +647,7 @@ static int msc313_gpio_probe(struct platform_device *pdev) platform_set_drvdata(pdev, gpio); - gpiochip = devm_kzalloc(dev, sizeof(*gpiochip), GFP_KERNEL); + gpiochip = devm_kzalloc_obj(dev, *gpiochip); if (!gpiochip) return -ENOMEM; diff --git a/drivers/gpio/gpio-mt7621.c b/drivers/gpio/gpio-mt7621.c index a86f6b1060fc..e6a7f98656c8 100644 --- a/drivers/gpio/gpio-mt7621.c +++ b/drivers/gpio/gpio-mt7621.c @@ -450,7 +450,7 @@ mt7621_gpio_probe(struct platform_device *pdev) int i; int ret; - mtk = devm_kzalloc(dev, sizeof(*mtk), GFP_KERNEL); + mtk = devm_kzalloc_obj(dev, *mtk); if (!mtk) return -ENOMEM; diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 267e6d5bacd0..579526ab7600 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c @@ -1200,8 +1200,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev) have_irqs = err != 0; - mvchip = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_gpio_chip), - GFP_KERNEL); + mvchip = devm_kzalloc_obj(&pdev->dev, struct mvebu_gpio_chip); if (!mvchip) return -ENOMEM; diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index 32ded7b548fb..7dabe8073dc6 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c @@ -425,7 +425,7 @@ static int mxc_gpio_probe(struct platform_device *pdev) int irq_base; int err; - port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(&pdev->dev, *port); if (!port) return -ENOMEM; diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c index 900315aba85a..09e16ce6a9fa 100644 --- a/drivers/gpio/gpio-mxs.c +++ b/drivers/gpio/gpio-mxs.c @@ -266,7 +266,7 @@ static int mxs_gpio_probe(struct platform_device *pdev) int irq_base; int err; - port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(&pdev->dev, *port); if (!port) return -ENOMEM; diff --git a/drivers/gpio/gpio-nct6694.c b/drivers/gpio/gpio-nct6694.c index a38add1cde29..9d51bf52e99a 100644 --- a/drivers/gpio/gpio-nct6694.c +++ b/drivers/gpio/gpio-nct6694.c @@ -398,7 +398,7 @@ static int nct6694_gpio_probe(struct platform_device *pdev) int ret, i; char **names; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c index 208fed631975..dfb74a05c965 100644 --- a/drivers/gpio/gpio-nomadik.c +++ b/drivers/gpio/gpio-nomadik.c @@ -545,7 +545,7 @@ struct nmk_gpio_chip *nmk_gpio_populate_chip(struct fwnode_handle *fwnode, } #endif - nmk_chip = devm_kzalloc(dev, sizeof(*nmk_chip), GFP_KERNEL); + nmk_chip = devm_kzalloc_obj(dev, *nmk_chip); if (!nmk_chip) { ret = -ENOMEM; goto err_put_pdev; diff --git a/drivers/gpio/gpio-novalake-events.c b/drivers/gpio/gpio-novalake-events.c index b3bf0038f84a..29c226da439b 100644 --- a/drivers/gpio/gpio-novalake-events.c +++ b/drivers/gpio/gpio-novalake-events.c @@ -266,7 +266,7 @@ static int nvl_gpio_probe(struct platform_device *pdev) if (!regs) return -ENOMEM; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; raw_spin_lock_init(&priv->lock); diff --git a/drivers/gpio/gpio-npcm-sgpio.c b/drivers/gpio/gpio-npcm-sgpio.c index 83c77a2c0623..703016e08fff 100644 --- a/drivers/gpio/gpio-npcm-sgpio.c +++ b/drivers/gpio/gpio-npcm-sgpio.c @@ -503,7 +503,7 @@ static int npcm_sgpio_probe(struct platform_device *pdev) int rc; u32 nin_gpios, nout_gpios; - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-octeon.c b/drivers/gpio/gpio-octeon.c index 777e20c608dc..8b166c09fa5c 100644 --- a/drivers/gpio/gpio-octeon.c +++ b/drivers/gpio/gpio-octeon.c @@ -88,7 +88,7 @@ static int octeon_gpio_probe(struct platform_device *pdev) void __iomem *reg_base; int err = 0; - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; chip = &gpio->chip; diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index a9b9a3d9631e..a9734b2a1d60 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1401,7 +1401,7 @@ static int omap_gpio_probe(struct platform_device *pdev) if (!pdata) return -EINVAL; - bank = devm_kzalloc(dev, sizeof(*bank), GFP_KERNEL); + bank = devm_kzalloc_obj(dev, *bank); if (!bank) return -ENOMEM; diff --git a/drivers/gpio/gpio-palmas.c b/drivers/gpio/gpio-palmas.c index e64ee0487718..c3cf2e88576c 100644 --- a/drivers/gpio/gpio-palmas.c +++ b/drivers/gpio/gpio-palmas.c @@ -171,8 +171,7 @@ static int palmas_gpio_probe(struct platform_device *pdev) if (!dev_data) dev_data = &palmas_dev_data; - palmas_gpio = devm_kzalloc(&pdev->dev, - sizeof(*palmas_gpio), GFP_KERNEL); + palmas_gpio = devm_kzalloc_obj(&pdev->dev, *palmas_gpio); if (!palmas_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index afec5ec23696..b662bcf7b9be 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -1211,7 +1211,7 @@ static int pca953x_probe(struct i2c_client *client) int ret; const struct regmap_config *regmap_config; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (chip == NULL) return -ENOMEM; diff --git a/drivers/gpio/gpio-pca9570.c b/drivers/gpio/gpio-pca9570.c index db027c10494f..1b00d2cd5791 100644 --- a/drivers/gpio/gpio-pca9570.c +++ b/drivers/gpio/gpio-pca9570.c @@ -122,7 +122,7 @@ static int pca9570_probe(struct i2c_client *client) struct pca9570 *gpio; int ret; - gpio = devm_kzalloc(&client->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&client->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c index 1ba6a09542f3..4c38397a441f 100644 --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c @@ -297,7 +297,7 @@ static int pcf857x_probe(struct i2c_client *client) int status; /* Allocate, initialize, and register this gpio_chip. */ - gpio = devm_kzalloc(&client->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&client->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c index 07a5617b314b..aec1651a7750 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c @@ -357,7 +357,7 @@ static int pch_gpio_probe(struct pci_dev *pdev, struct pch_gpio *chip; int irq_base; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (chip == NULL) return -ENOMEM; diff --git a/drivers/gpio/gpio-pcie-idio-24.c b/drivers/gpio/gpio-pcie-idio-24.c index b99f4863443d..55a7f7653982 100644 --- a/drivers/gpio/gpio-pcie-idio-24.c +++ b/drivers/gpio/gpio-pcie-idio-24.c @@ -321,7 +321,7 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id) return dev_err_probe(dev, PTR_ERR(intcsr_map), "Unable to initialize PEX8311 register map\n"); - idio24gpio = devm_kzalloc(dev, sizeof(*idio24gpio), GFP_KERNEL); + idio24gpio = devm_kzalloc_obj(dev, *idio24gpio); if (!idio24gpio) return -ENOMEM; @@ -335,7 +335,7 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* Initialize all IRQ type configuration to IRQ_TYPE_EDGE_BOTH */ idio24gpio->irq_type = GENMASK(7, 0); - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-pisosr.c b/drivers/gpio/gpio-pisosr.c index 2732ea8c16b7..7314ac899f59 100644 --- a/drivers/gpio/gpio-pisosr.c +++ b/drivers/gpio/gpio-pisosr.c @@ -115,7 +115,7 @@ static int pisosr_gpio_probe(struct spi_device *spi) u32 ngpios; int ret; - gpio = devm_kzalloc(dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index fcd44e34f65e..a506fa745c97 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c @@ -309,7 +309,7 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) struct gpio_irq_chip *girq; int ret, irq; - pl061 = devm_kzalloc(dev, sizeof(*pl061), GFP_KERNEL); + pl061 = devm_kzalloc_obj(dev, *pl061); if (pl061 == NULL) return -ENOMEM; @@ -344,8 +344,7 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) gpio_irq_chip_set_chip(girq, &pl061_irq_chip); girq->parent_handler = pl061_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; girq->parents[0] = irq; diff --git a/drivers/gpio/gpio-pmic-eic-sprd.c b/drivers/gpio/gpio-pmic-eic-sprd.c index cb015fb5c946..844b63735083 100644 --- a/drivers/gpio/gpio-pmic-eic-sprd.c +++ b/drivers/gpio/gpio-pmic-eic-sprd.c @@ -308,7 +308,7 @@ static int sprd_pmic_eic_probe(struct platform_device *pdev) struct sprd_pmic_eic *pmic_eic; int ret; - pmic_eic = devm_kzalloc(&pdev->dev, sizeof(*pmic_eic), GFP_KERNEL); + pmic_eic = devm_kzalloc_obj(&pdev->dev, *pmic_eic); if (!pmic_eic) return -ENOMEM; diff --git a/drivers/gpio/gpio-ppc44x.c b/drivers/gpio/gpio-ppc44x.c index 189667e0e1ba..3dd1bb8686ff 100644 --- a/drivers/gpio/gpio-ppc44x.c +++ b/drivers/gpio/gpio-ppc44x.c @@ -157,7 +157,7 @@ static int ppc44x_gpio_probe(struct platform_device *ofdev) if (IS_ERR(regs)) return PTR_ERR(regs); - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index 3ff21e899278..17e95ee4fef6 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c @@ -345,8 +345,7 @@ static int pxa_init_gpio_chip(struct pxa_gpio_chip *pchip, int ngpio, void __iom int i, gpio, nbanks = DIV_ROUND_UP(ngpio, 32); struct pxa_gpio_bank *bank; - pchip->banks = devm_kcalloc(pchip->dev, nbanks, sizeof(*pchip->banks), - GFP_KERNEL); + pchip->banks = devm_kzalloc_objs(pchip->dev, *pchip->banks, nbanks); if (!pchip->banks) return -ENOMEM; @@ -617,7 +616,7 @@ static int pxa_gpio_probe(struct platform_device *pdev) int gpio, ret; int irq0 = 0, irq1 = 0, irq_mux; - pchip = devm_kzalloc(&pdev->dev, sizeof(*pchip), GFP_KERNEL); + pchip = devm_kzalloc_obj(&pdev->dev, *pchip); if (!pchip) return -ENOMEM; pchip->dev = &pdev->dev; diff --git a/drivers/gpio/gpio-raspberrypi-exp.c b/drivers/gpio/gpio-raspberrypi-exp.c index 40413e06b69c..c4c8a8b11866 100644 --- a/drivers/gpio/gpio-raspberrypi-exp.c +++ b/drivers/gpio/gpio-raspberrypi-exp.c @@ -217,7 +217,7 @@ static int rpi_exp_gpio_probe(struct platform_device *pdev) if (!fw) return -EPROBE_DEFER; - rpi_gpio = devm_kzalloc(dev, sizeof(*rpi_gpio), GFP_KERNEL); + rpi_gpio = devm_kzalloc_obj(dev, *rpi_gpio); if (!rpi_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-rc5t583.c b/drivers/gpio/gpio-rc5t583.c index 5a69e4534591..7f904cf9c3b7 100644 --- a/drivers/gpio/gpio-rc5t583.c +++ b/drivers/gpio/gpio-rc5t583.c @@ -108,8 +108,7 @@ static int rc5t583_gpio_probe(struct platform_device *pdev) struct rc5t583_platform_data *pdata = dev_get_platdata(rc5t583->dev); struct rc5t583_gpio *rc5t583_gpio; - rc5t583_gpio = devm_kzalloc(&pdev->dev, sizeof(*rc5t583_gpio), - GFP_KERNEL); + rc5t583_gpio = devm_kzalloc_obj(&pdev->dev, *rc5t583_gpio); if (!rc5t583_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index 54dc47d45de7..1a229a5bc152 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c @@ -549,7 +549,7 @@ static int gpio_rcar_probe(struct platform_device *pdev) unsigned int npins; int ret; - p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(dev, *p); if (!p) return -ENOMEM; diff --git a/drivers/gpio/gpio-rda.c b/drivers/gpio/gpio-rda.c index f6c05fdbe63f..cf8465d93ffe 100644 --- a/drivers/gpio/gpio-rda.c +++ b/drivers/gpio/gpio-rda.c @@ -216,7 +216,7 @@ static int rda_gpio_probe(struct platform_device *pdev) u32 ngpios; int ret; - rda_gpio = devm_kzalloc(dev, sizeof(*rda_gpio), GFP_KERNEL); + rda_gpio = devm_kzalloc_obj(dev, *rda_gpio); if (!rda_gpio) return -ENOMEM; @@ -266,9 +266,7 @@ static int rda_gpio_probe(struct platform_device *pdev) girq->parent_handler = rda_gpio_irq_handler; girq->parent_handler_data = rda_gpio; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; girq->parents[0] = rda_gpio->irq; diff --git a/drivers/gpio/gpio-rdc321x.c b/drivers/gpio/gpio-rdc321x.c index ba62b81aa8ae..6047aeca28db 100644 --- a/drivers/gpio/gpio-rdc321x.c +++ b/drivers/gpio/gpio-rdc321x.c @@ -129,8 +129,7 @@ static int rdc321x_gpio_probe(struct platform_device *pdev) return -ENODEV; } - rdc321x_gpio_dev = devm_kzalloc(&pdev->dev, sizeof(struct rdc321x_gpio), - GFP_KERNEL); + rdc321x_gpio_dev = devm_kzalloc_obj(&pdev->dev, struct rdc321x_gpio); if (!rdc321x_gpio_dev) return -ENOMEM; diff --git a/drivers/gpio/gpio-realtek-otto.c b/drivers/gpio/gpio-realtek-otto.c index 5d98ad597d9e..947cfd0542cd 100644 --- a/drivers/gpio/gpio-realtek-otto.c +++ b/drivers/gpio/gpio-realtek-otto.c @@ -372,7 +372,7 @@ static int realtek_gpio_probe(struct platform_device *pdev) unsigned int nr_cpus; int cpu, err, irq; - ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(dev, *ctrl); if (!ctrl) return -ENOMEM; @@ -443,8 +443,8 @@ static int realtek_gpio_probe(struct platform_device *pdev) girq->handler = handle_bad_irq; girq->parent_handler = realtek_gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, girq->num_parents, - sizeof(*girq->parents), GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, + girq->num_parents); if (!girq->parents) return -ENOMEM; girq->parents[0] = irq; diff --git a/drivers/gpio/gpio-reg.c b/drivers/gpio/gpio-reg.c index 296c210b228c..76aa67f94c0b 100644 --- a/drivers/gpio/gpio-reg.c +++ b/drivers/gpio/gpio-reg.c @@ -148,7 +148,7 @@ struct gpio_chip *gpio_reg_init(struct device *dev, void __iomem *reg, int ret; if (dev) - r = devm_kzalloc(dev, sizeof(*r), GFP_KERNEL); + r = devm_kzalloc_obj(dev, *r); else r = kzalloc_obj(*r); diff --git a/drivers/gpio/gpio-rtd.c b/drivers/gpio/gpio-rtd.c index d46b40dd5283..7e37bad09dc4 100644 --- a/drivers/gpio/gpio-rtd.c +++ b/drivers/gpio/gpio-rtd.c @@ -529,7 +529,7 @@ static int rtd_gpio_probe(struct platform_device *pdev) struct rtd_gpio *data; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/gpio/gpio-rtd1625.c b/drivers/gpio/gpio-rtd1625.c index bebd1b8ede48..cf4f61603dfb 100644 --- a/drivers/gpio/gpio-rtd1625.c +++ b/drivers/gpio/gpio-rtd1625.c @@ -543,7 +543,7 @@ static int rtd1625_gpio_probe(struct platform_device *pdev) void __iomem *irq_base; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; @@ -562,8 +562,8 @@ static int rtd1625_gpio_probe(struct platform_device *pdev) raw_spin_lock_init(&data->lock); platform_set_drvdata(pdev, data); - data->save_regs = devm_kcalloc(dev, data->info->num_gpios, sizeof(*data->save_regs), - GFP_KERNEL); + data->save_regs = devm_kzalloc_objs(dev, *data->save_regs, + data->info->num_gpios); if (!data->save_regs) return -ENOMEM; diff --git a/drivers/gpio/gpio-sama5d2-piobu.c b/drivers/gpio/gpio-sama5d2-piobu.c index 5005688f6e67..ce625ae73215 100644 --- a/drivers/gpio/gpio-sama5d2-piobu.c +++ b/drivers/gpio/gpio-sama5d2-piobu.c @@ -185,7 +185,7 @@ static int sama5d2_piobu_probe(struct platform_device *pdev) struct sama5d2_piobu *piobu; int ret, i; - piobu = devm_kzalloc(&pdev->dev, sizeof(*piobu), GFP_KERNEL); + piobu = devm_kzalloc_obj(&pdev->dev, *piobu); if (!piobu) return -ENOMEM; diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c index 5e361742a11a..fc23f2699fc9 100644 --- a/drivers/gpio/gpio-sch.c +++ b/drivers/gpio/gpio-sch.c @@ -329,7 +329,7 @@ static int sch_gpio_probe(struct platform_device *pdev) void __iomem *regs; int ret; - sch = devm_kzalloc(dev, sizeof(*sch), GFP_KERNEL); + sch = devm_kzalloc_obj(dev, *sch); if (!sch) return -ENOMEM; diff --git a/drivers/gpio/gpio-sch311x.c b/drivers/gpio/gpio-sch311x.c index f95566998d30..855041c4d5dc 100644 --- a/drivers/gpio/gpio-sch311x.c +++ b/drivers/gpio/gpio-sch311x.c @@ -279,7 +279,7 @@ static int sch311x_gpio_probe(struct platform_device *pdev) return -EBUSY; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-shared-proxy.c b/drivers/gpio/gpio-shared-proxy.c index bc69b8729d19..81a841a94096 100644 --- a/drivers/gpio/gpio-shared-proxy.c +++ b/drivers/gpio/gpio-shared-proxy.c @@ -263,7 +263,7 @@ static int gpio_shared_proxy_probe(struct auxiliary_device *adev, if (IS_ERR(shared_desc)) return PTR_ERR(shared_desc); - proxy = devm_kzalloc(dev, sizeof(*proxy), GFP_KERNEL); + proxy = devm_kzalloc_obj(dev, *proxy); if (!proxy) return -ENOMEM; diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c index e9a992cd4b9c..0b52b20e5136 100644 --- a/drivers/gpio/gpio-sifive.c +++ b/drivers/gpio/gpio-sifive.c @@ -184,7 +184,7 @@ static int sifive_gpio_probe(struct platform_device *pdev) struct sifive_gpio *chip; int ret, ngpio; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c index 1de940bec11a..ce205e88c0ab 100644 --- a/drivers/gpio/gpio-sim.c +++ b/drivers/gpio/gpio-sim.c @@ -364,17 +364,16 @@ static int gpio_sim_setup_sysfs(struct gpio_sim_chip *chip) struct attribute **attrs; int i, ret; - chip->attr_groups = devm_kcalloc(dev, sizeof(*chip->attr_groups), - num_lines + 1, GFP_KERNEL); + chip->attr_groups = devm_kzalloc_objs(dev, *chip->attr_groups, + num_lines + 1); if (!chip->attr_groups) return -ENOMEM; for (i = 0; i < num_lines; i++) { - attr_group = devm_kzalloc(dev, sizeof(*attr_group), GFP_KERNEL); - attrs = devm_kcalloc(dev, GPIO_SIM_NUM_ATTRS, sizeof(*attrs), - GFP_KERNEL); - val_attr = devm_kzalloc(dev, sizeof(*val_attr), GFP_KERNEL); - pull_attr = devm_kzalloc(dev, sizeof(*pull_attr), GFP_KERNEL); + attr_group = devm_kzalloc_obj(dev, *attr_group); + attrs = devm_kzalloc_objs(dev, *attrs, GPIO_SIM_NUM_ATTRS); + val_attr = devm_kzalloc_obj(dev, *val_attr); + pull_attr = devm_kzalloc_obj(dev, *pull_attr); if (!attr_group || !attrs || !val_attr || !pull_attr) return -ENOMEM; @@ -438,7 +437,7 @@ static int gpio_sim_add_bank(struct fwnode_handle *swnode, struct device *dev) return -ENOMEM; } - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-siox.c b/drivers/gpio/gpio-siox.c index d60680ace144..c82238302aba 100644 --- a/drivers/gpio/gpio-siox.c +++ b/drivers/gpio/gpio-siox.c @@ -222,7 +222,7 @@ static int gpio_siox_probe(struct siox_device *sdevice) struct gpio_chip *gc; int ret; - ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/gpio/gpio-sl28cpld.c b/drivers/gpio/gpio-sl28cpld.c index ca7a9b9bcf48..9aea06fff329 100644 --- a/drivers/gpio/gpio-sl28cpld.c +++ b/drivers/gpio/gpio-sl28cpld.c @@ -60,7 +60,7 @@ static int sl28cpld_gpio_irq_init(struct platform_device *pdev, if (irq < 0) return irq; - irq_chip = devm_kzalloc(dev, sizeof(*irq_chip), GFP_KERNEL); + irq_chip = devm_kzalloc_obj(dev, *irq_chip); if (!irq_chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-sloppy-logic-analyzer.c b/drivers/gpio/gpio-sloppy-logic-analyzer.c index 0717649a6820..3acf80f7d7f9 100644 --- a/drivers/gpio/gpio-sloppy-logic-analyzer.c +++ b/drivers/gpio/gpio-sloppy-logic-analyzer.c @@ -236,7 +236,7 @@ static int gpio_la_poll_probe(struct platform_device *pdev) unsigned int i, meta_len = 0; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-sodaville.c b/drivers/gpio/gpio-sodaville.c index e2a784df275c..c1eac5d5dbce 100644 --- a/drivers/gpio/gpio-sodaville.c +++ b/drivers/gpio/gpio-sodaville.c @@ -186,7 +186,7 @@ static int sdv_gpio_probe(struct pci_dev *pdev, int ret; u32 mux_val; - sd = devm_kzalloc(&pdev->dev, sizeof(*sd), GFP_KERNEL); + sd = devm_kzalloc_obj(&pdev->dev, *sd); if (!sd) return -ENOMEM; diff --git a/drivers/gpio/gpio-spacemit-k1.c b/drivers/gpio/gpio-spacemit-k1.c index 5fe813b7f9bb..98f0177ff509 100644 --- a/drivers/gpio/gpio-spacemit-k1.c +++ b/drivers/gpio/gpio-spacemit-k1.c @@ -274,7 +274,7 @@ static int spacemit_gpio_probe(struct platform_device *pdev) void __iomem *regs; int i, irq, ret; - sg = devm_kzalloc(dev, sizeof(*sg), GFP_KERNEL); + sg = devm_kzalloc_obj(dev, *sg); if (!sg) return -ENOMEM; diff --git a/drivers/gpio/gpio-spear-spics.c b/drivers/gpio/gpio-spear-spics.c index 96a0e1211500..6f6a5f3612d5 100644 --- a/drivers/gpio/gpio-spear-spics.c +++ b/drivers/gpio/gpio-spear-spics.c @@ -111,7 +111,7 @@ static int spics_gpio_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct spear_spics *spics; - spics = devm_kzalloc(&pdev->dev, sizeof(*spics), GFP_KERNEL); + spics = devm_kzalloc_obj(&pdev->dev, *spics); if (!spics) return -ENOMEM; diff --git a/drivers/gpio/gpio-sprd.c b/drivers/gpio/gpio-sprd.c index 042a83f60eaa..65e77a2d6536 100644 --- a/drivers/gpio/gpio-sprd.c +++ b/drivers/gpio/gpio-sprd.c @@ -223,7 +223,7 @@ static int sprd_gpio_probe(struct platform_device *pdev) struct gpio_irq_chip *irq; struct sprd_gpio *sprd_gpio; - sprd_gpio = devm_kzalloc(&pdev->dev, sizeof(*sprd_gpio), GFP_KERNEL); + sprd_gpio = devm_kzalloc_obj(&pdev->dev, *sprd_gpio); if (!sprd_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index ccdf13a741b7..bc9fa928f997 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c @@ -483,7 +483,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev) return -EINVAL; } - stmpe_gpio = devm_kzalloc(dev, sizeof(*stmpe_gpio), GFP_KERNEL); + stmpe_gpio = devm_kzalloc_obj(dev, *stmpe_gpio); if (!stmpe_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c index 78d6c78d4aab..477f956844eb 100644 --- a/drivers/gpio/gpio-stp-xway.c +++ b/drivers/gpio/gpio-stp-xway.c @@ -237,7 +237,7 @@ static int xway_stp_probe(struct platform_device *pdev) struct clk *clk; int ret = 0; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c index 40064d4cf47f..9dd53bde3978 100644 --- a/drivers/gpio/gpio-syscon.c +++ b/drivers/gpio/gpio-syscon.c @@ -212,7 +212,7 @@ static int syscon_gpio_probe(struct platform_device *pdev) int ret; bool use_parent_regmap = false; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-tangier.c b/drivers/gpio/gpio-tangier.c index ba5a8ede8912..4a262354fdfc 100644 --- a/drivers/gpio/gpio-tangier.c +++ b/drivers/gpio/gpio-tangier.c @@ -419,7 +419,7 @@ int devm_tng_gpio_probe(struct device *dev, struct tng_gpio *gpio) struct gpio_irq_chip *girq; int ret; - gpio->ctx = devm_kcalloc(dev, nctx, sizeof(*gpio->ctx), GFP_KERNEL); + gpio->ctx = devm_kzalloc_objs(dev, *gpio->ctx, nctx); if (!gpio->ctx) return -ENOMEM; @@ -445,8 +445,8 @@ int devm_tng_gpio_probe(struct device *dev, struct tng_gpio *gpio) girq->init_hw = tng_irq_init_hw; girq->parent_handler = tng_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, girq->num_parents, - sizeof(*girq->parents), GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, + girq->num_parents); if (!girq->parents) return -ENOMEM; diff --git a/drivers/gpio/gpio-tb10x.c b/drivers/gpio/gpio-tb10x.c index 7fb8e6223bd1..3cd516ae9419 100644 --- a/drivers/gpio/gpio-tb10x.c +++ b/drivers/gpio/gpio-tb10x.c @@ -99,7 +99,7 @@ static int tb10x_gpio_probe(struct platform_device *pdev) if (of_property_read_u32(np, "abilis,ngpio", &ngpio)) return -EINVAL; - tb10x_gpio = devm_kzalloc(dev, sizeof(*tb10x_gpio), GFP_KERNEL); + tb10x_gpio = devm_kzalloc_obj(dev, *tb10x_gpio); if (tb10x_gpio == NULL) return -ENOMEM; diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c index 90d048f9da08..85488980f65c 100644 --- a/drivers/gpio/gpio-tc3589x.c +++ b/drivers/gpio/gpio-tc3589x.c @@ -312,8 +312,7 @@ static int tc3589x_gpio_probe(struct platform_device *pdev) if (irq < 0) return irq; - tc3589x_gpio = devm_kzalloc(&pdev->dev, sizeof(struct tc3589x_gpio), - GFP_KERNEL); + tc3589x_gpio = devm_kzalloc_obj(&pdev->dev, struct tc3589x_gpio); if (!tc3589x_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index ccda3a56d599..88de78123da0 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c @@ -682,7 +682,7 @@ static int tegra_gpio_probe(struct platform_device *pdev) unsigned int i, j; int ret; - tgi = devm_kzalloc(&pdev->dev, sizeof(*tgi), GFP_KERNEL); + tgi = devm_kzalloc_obj(&pdev->dev, *tgi); if (!tgi) return -ENOMEM; @@ -717,13 +717,12 @@ static int tegra_gpio_probe(struct platform_device *pdev) if (tgi->soc->debounce_supported) tgi->gc.set_config = tegra_gpio_set_config; - tgi->bank_info = devm_kcalloc(&pdev->dev, tgi->bank_count, - sizeof(*tgi->bank_info), GFP_KERNEL); + tgi->bank_info = devm_kzalloc_objs(&pdev->dev, *tgi->bank_info, + tgi->bank_count); if (!tgi->bank_info) return -ENOMEM; - tgi->irqs = devm_kcalloc(&pdev->dev, tgi->bank_count, - sizeof(*tgi->irqs), GFP_KERNEL); + tgi->irqs = devm_kzalloc_objs(&pdev->dev, *tgi->irqs, tgi->bank_count); if (!tgi->irqs) return -ENOMEM; diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c index 34e084c95d7a..6ee18b150b5c 100644 --- a/drivers/gpio/gpio-tegra186.c +++ b/drivers/gpio/gpio-tegra186.c @@ -865,7 +865,7 @@ static int tegra186_gpio_probe(struct platform_device *pdev) if (err < 0) return err; - gpio = devm_kzalloc(&pdev->dev, struct_size(gpio, irq, err), GFP_KERNEL); + gpio = devm_kzalloc_flex(&pdev->dev, *gpio, irq, err); if (!gpio) return -ENOMEM; @@ -929,8 +929,7 @@ static int tegra186_gpio_probe(struct platform_device *pdev) for (i = 0; i < gpio->soc->num_ports; i++) gpio->gpio.ngpio += gpio->soc->ports[i].pins; - names = devm_kcalloc(gpio->gpio.parent, gpio->gpio.ngpio, - sizeof(*names), GFP_KERNEL); + names = devm_kzalloc_objs(gpio->gpio.parent, *names, gpio->gpio.ngpio); if (!names) return -ENOMEM; @@ -988,8 +987,8 @@ static int tegra186_gpio_probe(struct platform_device *pdev) * currently program. */ if (gpio->num_irqs_per_bank > 1) { - irq->parents = devm_kcalloc(&pdev->dev, gpio->num_banks, - sizeof(*irq->parents), GFP_KERNEL); + irq->parents = devm_kzalloc_objs(&pdev->dev, *irq->parents, + gpio->num_banks); if (!irq->parents) return -ENOMEM; @@ -1020,8 +1019,7 @@ static int tegra186_gpio_probe(struct platform_device *pdev) } } - irq->map = devm_kcalloc(&pdev->dev, gpio->gpio.ngpio, - sizeof(*irq->map), GFP_KERNEL); + irq->map = devm_kzalloc_objs(&pdev->dev, *irq->map, gpio->gpio.ngpio); if (!irq->map) return -ENOMEM; diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c index be96853063ba..0cc1bf618ff1 100644 --- a/drivers/gpio/gpio-thunderx.c +++ b/drivers/gpio/gpio-thunderx.c @@ -439,7 +439,7 @@ static int thunderx_gpio_probe(struct pci_dev *pdev, int ngpio, i; int err = 0; - txgpio = devm_kzalloc(dev, sizeof(*txgpio), GFP_KERNEL); + txgpio = devm_kzalloc_obj(dev, *txgpio); if (!txgpio) return -ENOMEM; @@ -479,18 +479,14 @@ static int thunderx_gpio_probe(struct pci_dev *pdev, txgpio->base_msi = (c >> 8) & 0xff; } - txgpio->msix_entries = devm_kcalloc(dev, - ngpio, sizeof(struct msix_entry), - GFP_KERNEL); + txgpio->msix_entries = devm_kzalloc_objs(dev, struct msix_entry, ngpio); if (!txgpio->msix_entries) { err = -ENOMEM; goto out; } - txgpio->line_entries = devm_kcalloc(dev, - ngpio, - sizeof(struct thunderx_line), - GFP_KERNEL); + txgpio->line_entries = devm_kzalloc_objs(dev, struct thunderx_line, + ngpio); if (!txgpio->line_entries) { err = -ENOMEM; goto out; diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c index 727fa1b5ad3b..164976bd6b7e 100644 --- a/drivers/gpio/gpio-timberdale.c +++ b/drivers/gpio/gpio-timberdale.c @@ -226,7 +226,7 @@ static int timbgpio_probe(struct platform_device *pdev) struct timbgpio *tgpio; int irq = platform_get_irq(pdev, 0); - tgpio = devm_kzalloc(dev, sizeof(*tgpio), GFP_KERNEL); + tgpio = devm_kzalloc_obj(dev, *tgpio); if (!tgpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-tpic2810.c b/drivers/gpio/gpio-tpic2810.c index c38538653e99..cf3227422d8f 100644 --- a/drivers/gpio/gpio-tpic2810.c +++ b/drivers/gpio/gpio-tpic2810.c @@ -97,7 +97,7 @@ static int tpic2810_probe(struct i2c_client *client) { struct tpic2810 *gpio; - gpio = devm_kzalloc(&client->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&client->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-tps65086.c b/drivers/gpio/gpio-tps65086.c index f29d8485ab33..ce3f997367c5 100644 --- a/drivers/gpio/gpio-tps65086.c +++ b/drivers/gpio/gpio-tps65086.c @@ -79,7 +79,7 @@ static int tps65086_gpio_probe(struct platform_device *pdev) { struct tps65086_gpio *gpio; - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-tps65218.c b/drivers/gpio/gpio-tps65218.c index bf85663349fb..fef73fa62b54 100644 --- a/drivers/gpio/gpio-tps65218.c +++ b/drivers/gpio/gpio-tps65218.c @@ -181,8 +181,7 @@ static int tps65218_gpio_probe(struct platform_device *pdev) struct tps65218 *tps65218 = dev_get_drvdata(pdev->dev.parent); struct tps65218_gpio *tps65218_gpio; - tps65218_gpio = devm_kzalloc(&pdev->dev, sizeof(*tps65218_gpio), - GFP_KERNEL); + tps65218_gpio = devm_kzalloc_obj(&pdev->dev, *tps65218_gpio); if (!tps65218_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-tps65219.c b/drivers/gpio/gpio-tps65219.c index 6958466455d0..2d520baa616e 100644 --- a/drivers/gpio/gpio-tps65219.c +++ b/drivers/gpio/gpio-tps65219.c @@ -230,7 +230,7 @@ static int tps65219_gpio_probe(struct platform_device *pdev) struct tps65219 *tps = dev_get_drvdata(pdev->dev.parent); struct tps65219_gpio *gpio; - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-tps6586x.c b/drivers/gpio/gpio-tps6586x.c index aaacbb54bf5d..f7664443c74b 100644 --- a/drivers/gpio/gpio-tps6586x.c +++ b/drivers/gpio/gpio-tps6586x.c @@ -83,8 +83,7 @@ static int tps6586x_gpio_probe(struct platform_device *pdev) device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); pdata = dev_get_platdata(pdev->dev.parent); - tps6586x_gpio = devm_kzalloc(&pdev->dev, - sizeof(*tps6586x_gpio), GFP_KERNEL); + tps6586x_gpio = devm_kzalloc_obj(&pdev->dev, *tps6586x_gpio); if (!tps6586x_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c index 25e9f41efe78..884ef70a1301 100644 --- a/drivers/gpio/gpio-tps65910.c +++ b/drivers/gpio/gpio-tps65910.c @@ -116,8 +116,7 @@ static int tps65910_gpio_probe(struct platform_device *pdev) device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); - tps65910_gpio = devm_kzalloc(&pdev->dev, - sizeof(*tps65910_gpio), GFP_KERNEL); + tps65910_gpio = devm_kzalloc_obj(&pdev->dev, *tps65910_gpio); if (!tps65910_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-tps65912.c b/drivers/gpio/gpio-tps65912.c index cf3fa49a7097..93e3cd3352b4 100644 --- a/drivers/gpio/gpio-tps65912.c +++ b/drivers/gpio/gpio-tps65912.c @@ -103,7 +103,7 @@ static int tps65912_gpio_probe(struct platform_device *pdev) struct tps65912 *tps = dev_get_drvdata(pdev->dev.parent); struct tps65912_gpio *gpio; - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-tps68470.c b/drivers/gpio/gpio-tps68470.c index 8541acecfbbe..7989b411043b 100644 --- a/drivers/gpio/gpio-tps68470.c +++ b/drivers/gpio/gpio-tps68470.c @@ -142,8 +142,7 @@ static int tps68470_gpio_probe(struct platform_device *pdev) struct tps68470_gpio_data *tps68470_gpio; int ret; - tps68470_gpio = devm_kzalloc(&pdev->dev, sizeof(*tps68470_gpio), - GFP_KERNEL); + tps68470_gpio = devm_kzalloc_obj(&pdev->dev, *tps68470_gpio); if (!tps68470_gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c index eedfc0e371e3..49e1dd433026 100644 --- a/drivers/gpio/gpio-tqmx86.c +++ b/drivers/gpio/gpio-tqmx86.c @@ -344,7 +344,7 @@ static int tqmx86_gpio_probe(struct platform_device *pdev) if (!io_base) return -ENOMEM; - gpio = devm_kzalloc(dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(dev, *gpio); if (!gpio) return -ENOMEM; @@ -389,9 +389,7 @@ static int tqmx86_gpio_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &tqmx86_gpio_irq_chip); girq->parent_handler = tqmx86_gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(&pdev->dev, *girq->parents, 1); if (!girq->parents) { ret = -ENOMEM; goto out_pm_dis; diff --git a/drivers/gpio/gpio-ts4800.c b/drivers/gpio/gpio-ts4800.c index 0207c2b813f4..9b249ccbf22c 100644 --- a/drivers/gpio/gpio-ts4800.c +++ b/drivers/gpio/gpio-ts4800.c @@ -23,7 +23,7 @@ static int ts4800_gpio_probe(struct platform_device *pdev) void __iomem *base_addr; int retval; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-ts4900.c b/drivers/gpio/gpio-ts4900.c index b46b48e56c56..123282bbf3ec 100644 --- a/drivers/gpio/gpio-ts4900.c +++ b/drivers/gpio/gpio-ts4900.c @@ -145,7 +145,7 @@ static int ts4900_gpio_probe(struct i2c_client *client) if (device_property_read_u32(&client->dev, "ngpios", &ngpio)) ngpio = DEFAULT_PIN_NUMBER; - priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&client->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c index a851702befde..3e06ef9e2233 100644 --- a/drivers/gpio/gpio-twl4030.c +++ b/drivers/gpio/gpio-twl4030.c @@ -472,7 +472,7 @@ static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev) { struct twl4030_gpio_platform_data *omap_twl_info; - omap_twl_info = devm_kzalloc(dev, sizeof(*omap_twl_info), GFP_KERNEL); + omap_twl_info = devm_kzalloc_obj(dev, *omap_twl_info); if (!omap_twl_info) return NULL; @@ -506,8 +506,7 @@ static int gpio_twl4030_probe(struct platform_device *pdev) struct gpio_twl4030_priv *priv; int ret, irq_base; - priv = devm_kzalloc(&pdev->dev, sizeof(struct gpio_twl4030_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct gpio_twl4030_priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-uniphier.c b/drivers/gpio/gpio-uniphier.c index 0574dde5b5bb..cafbd5f957d6 100644 --- a/drivers/gpio/gpio-uniphier.c +++ b/drivers/gpio/gpio-uniphier.c @@ -366,8 +366,7 @@ static int uniphier_gpio_probe(struct platform_device *pdev) return ret; nregs = uniphier_gpio_get_nbanks(ngpios) * 2 + 3; - priv = devm_kzalloc(dev, struct_size(priv, saved_vals, nregs), - GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, saved_vals, nregs); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-usbio.c b/drivers/gpio/gpio-usbio.c index 489c8ac6299e..d1cbe97bcf9b 100644 --- a/drivers/gpio/gpio-usbio.c +++ b/drivers/gpio/gpio-usbio.c @@ -190,7 +190,7 @@ static int usbio_gpio_probe(struct auxiliary_device *adev, if (!bank_desc) return -EINVAL; - gpio = devm_kzalloc(dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c index adfa2c2d5873..bc7d3aa7dfca 100644 --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c @@ -226,7 +226,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) int ret; bool dual_base; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; @@ -333,9 +333,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &vf610_irqchip); girq->parent_handler = vf610_gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(&pdev->dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; girq->parents[0] = port->irq; diff --git a/drivers/gpio/gpio-viperboard.c b/drivers/gpio/gpio-viperboard.c index 89087fd48a81..b8d6dff5b663 100644 --- a/drivers/gpio/gpio-viperboard.c +++ b/drivers/gpio/gpio-viperboard.c @@ -396,7 +396,7 @@ static int vprbrd_gpio_probe(struct platform_device *pdev) struct vprbrd_gpio *vb_gpio; int ret; - vb_gpio = devm_kzalloc(&pdev->dev, sizeof(*vb_gpio), GFP_KERNEL); + vb_gpio = devm_kzalloc_obj(&pdev->dev, *vb_gpio); if (vb_gpio == NULL) return -ENOMEM; diff --git a/drivers/gpio/gpio-virtio.c b/drivers/gpio/gpio-virtio.c index ed6e0e90fa8a..d0ae3d57c640 100644 --- a/drivers/gpio/gpio-virtio.c +++ b/drivers/gpio/gpio-virtio.c @@ -512,7 +512,7 @@ static const char **virtio_gpio_get_names(struct virtio_gpio *vgpio, return NULL; } - names = devm_kcalloc(dev, ngpio, sizeof(*names), GFP_KERNEL); + names = devm_kzalloc_objs(dev, *names, ngpio); if (!names) return NULL; @@ -541,7 +541,7 @@ static int virtio_gpio_probe(struct virtio_device *vdev) u16 ngpio; int ret, i; - vgpio = devm_kzalloc(dev, sizeof(*vgpio), GFP_KERNEL); + vgpio = devm_kzalloc_obj(dev, *vgpio); if (!vgpio) return -ENOMEM; @@ -556,7 +556,7 @@ static int virtio_gpio_probe(struct virtio_device *vdev) return -EINVAL; } - vgpio->lines = devm_kcalloc(dev, ngpio, sizeof(*vgpio->lines), GFP_KERNEL); + vgpio->lines = devm_kzalloc_objs(dev, *vgpio->lines, ngpio); if (!vgpio->lines) return -ENOMEM; @@ -584,11 +584,12 @@ static int virtio_gpio_probe(struct virtio_device *vdev) /* Interrupt support */ if (virtio_has_feature(vdev, VIRTIO_GPIO_F_IRQ)) { - vgpio->irq_lines = devm_kcalloc(dev, ngpio, sizeof(*vgpio->irq_lines), GFP_KERNEL); + vgpio->irq_lines = devm_kzalloc_objs(dev, *vgpio->irq_lines, + ngpio); if (!vgpio->irq_lines) return -ENOMEM; - gpio_irq_chip = devm_kzalloc(dev, sizeof(*gpio_irq_chip), GFP_KERNEL); + gpio_irq_chip = devm_kzalloc_obj(dev, *gpio_irq_chip); if (!gpio_irq_chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-virtuser.c b/drivers/gpio/gpio-virtuser.c index 70ddccccc1c4..e05d255b7eb2 100644 --- a/drivers/gpio/gpio-virtuser.c +++ b/drivers/gpio/gpio-virtuser.c @@ -773,7 +773,7 @@ static int gpio_virtuser_dbgfs_init_line_array_attrs(struct device *dev, struct gpio_virtuser_line_array_data *data; char *name; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; @@ -803,7 +803,7 @@ static int gpio_virtuser_dbgfs_init_line_attrs(struct device *dev, char *name; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; @@ -917,7 +917,7 @@ static int gpio_virtuser_probe(struct platform_device *pdev) if (num_ids == 0) return dev_err_probe(dev, -EINVAL, "No GPIO IDs specified\n"); - ids = devm_kcalloc(dev, num_ids, sizeof(*ids), GFP_KERNEL); + ids = devm_kzalloc_objs(dev, *ids, num_ids); if (!ids) return -ENOMEM; diff --git a/drivers/gpio/gpio-visconti.c b/drivers/gpio/gpio-visconti.c index 6d5d829634ad..7701587a0328 100644 --- a/drivers/gpio/gpio-visconti.c +++ b/drivers/gpio/gpio-visconti.c @@ -167,7 +167,7 @@ static int visconti_gpio_probe(struct platform_device *pdev) struct device_node *irq_parent; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-vx855.c b/drivers/gpio/gpio-vx855.c index 84b3a973a503..f7e1530121b8 100644 --- a/drivers/gpio/gpio-vx855.c +++ b/drivers/gpio/gpio-vx855.c @@ -237,7 +237,7 @@ static int vx855gpio_probe(struct platform_device *pdev) if (!res_gpi || !res_gpo) return -EBUSY; - vg = devm_kzalloc(&pdev->dev, sizeof(*vg), GFP_KERNEL); + vg = devm_kzalloc_obj(&pdev->dev, *vg); if (!vg) return -ENOMEM; diff --git a/drivers/gpio/gpio-waveshare-dsi.c b/drivers/gpio/gpio-waveshare-dsi.c index 38f52351bb58..dc8d946cfd23 100644 --- a/drivers/gpio/gpio-waveshare-dsi.c +++ b/drivers/gpio/gpio-waveshare-dsi.c @@ -121,7 +121,7 @@ static int waveshare_gpio_probe(struct i2c_client *i2c) unsigned int data; int ret; - state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/gpio/gpio-wcd934x.c b/drivers/gpio/gpio-wcd934x.c index b526493c84e4..8a645f033be4 100644 --- a/drivers/gpio/gpio-wcd934x.c +++ b/drivers/gpio/gpio-wcd934x.c @@ -82,7 +82,7 @@ static int wcd_gpio_probe(struct platform_device *pdev) struct wcd_gpio_data *data; struct gpio_chip *chip; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c index 4a5e20e936a9..7852176a2150 100644 --- a/drivers/gpio/gpio-wcove.c +++ b/drivers/gpio/gpio-wcove.c @@ -425,7 +425,7 @@ static int wcove_gpio_probe(struct platform_device *pdev) dev = &pdev->dev; - wg = devm_kzalloc(dev, sizeof(*wg), GFP_KERNEL); + wg = devm_kzalloc_obj(dev, *wg); if (!wg) return -ENOMEM; diff --git a/drivers/gpio/gpio-wm831x.c b/drivers/gpio/gpio-wm831x.c index 489479d6f32b..059deb56d040 100644 --- a/drivers/gpio/gpio-wm831x.c +++ b/drivers/gpio/gpio-wm831x.c @@ -267,8 +267,7 @@ static int wm831x_gpio_probe(struct platform_device *pdev) device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); - wm831x_gpio = devm_kzalloc(&pdev->dev, sizeof(*wm831x_gpio), - GFP_KERNEL); + wm831x_gpio = devm_kzalloc_obj(&pdev->dev, *wm831x_gpio); if (wm831x_gpio == NULL) return -ENOMEM; diff --git a/drivers/gpio/gpio-wm8350.c b/drivers/gpio/gpio-wm8350.c index 46923b23a72e..35edf26e7be6 100644 --- a/drivers/gpio/gpio-wm8350.c +++ b/drivers/gpio/gpio-wm8350.c @@ -104,8 +104,7 @@ static int wm8350_gpio_probe(struct platform_device *pdev) struct wm8350_platform_data *pdata = dev_get_platdata(wm8350->dev); struct wm8350_gpio_data *wm8350_gpio; - wm8350_gpio = devm_kzalloc(&pdev->dev, sizeof(*wm8350_gpio), - GFP_KERNEL); + wm8350_gpio = devm_kzalloc_obj(&pdev->dev, *wm8350_gpio); if (wm8350_gpio == NULL) return -ENOMEM; diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c index a0665cf3ff2f..92e1eb3c763b 100644 --- a/drivers/gpio/gpio-wm8994.c +++ b/drivers/gpio/gpio-wm8994.c @@ -267,8 +267,7 @@ static int wm8994_gpio_probe(struct platform_device *pdev) struct wm8994_pdata *pdata = dev_get_platdata(wm8994->dev); struct wm8994_gpio *wm8994_gpio; - wm8994_gpio = devm_kzalloc(&pdev->dev, sizeof(*wm8994_gpio), - GFP_KERNEL); + wm8994_gpio = devm_kzalloc_obj(&pdev->dev, *wm8994_gpio); if (wm8994_gpio == NULL) return -ENOMEM; diff --git a/drivers/gpio/gpio-ws16c48.c b/drivers/gpio/gpio-ws16c48.c index 6289b0510cf2..cd0c35c057cb 100644 --- a/drivers/gpio/gpio-ws16c48.c +++ b/drivers/gpio/gpio-ws16c48.c @@ -252,7 +252,7 @@ static int ws16c48_probe(struct device *dev, unsigned int id) struct regmap_irq_chip *chip; struct regmap_irq_chip_data *chip_data; - ws16c48gpio = devm_kzalloc(dev, sizeof(*ws16c48gpio), GFP_KERNEL); + ws16c48gpio = devm_kzalloc_obj(dev, *ws16c48gpio); if (!ws16c48gpio) return -ENOMEM; @@ -271,7 +271,7 @@ static int ws16c48_probe(struct device *dev, unsigned int id) return dev_err_probe(dev, PTR_ERR(ws16c48gpio->map), "Unable to initialize register map\n"); - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-xgene-sb.c b/drivers/gpio/gpio-xgene-sb.c index 3675456b1e9b..c87e15d6e150 100644 --- a/drivers/gpio/gpio-xgene-sb.c +++ b/drivers/gpio/gpio-xgene-sb.c @@ -245,7 +245,7 @@ static int xgene_gpio_sb_probe(struct platform_device *pdev) struct irq_domain *parent_domain = NULL; u32 val32; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpio/gpio-xgene.c b/drivers/gpio/gpio-xgene.c index 809668449dbe..8c8e6168fbe1 100644 --- a/drivers/gpio/gpio-xgene.c +++ b/drivers/gpio/gpio-xgene.c @@ -162,7 +162,7 @@ static int xgene_gpio_probe(struct platform_device *pdev) { struct xgene_gpio *gpio; - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; diff --git a/drivers/gpio/gpio-xgs-iproc.c b/drivers/gpio/gpio-xgs-iproc.c index 77eb29dcc217..edffb435cf58 100644 --- a/drivers/gpio/gpio-xgs-iproc.c +++ b/drivers/gpio/gpio-xgs-iproc.c @@ -221,7 +221,7 @@ static int iproc_gpio_probe(struct platform_device *pdev) u32 num_gpios; int irq, ret; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c index 9406ce85f933..7a93afae0ea0 100644 --- a/drivers/gpio/gpio-xilinx.c +++ b/drivers/gpio/gpio-xilinx.c @@ -540,7 +540,7 @@ static int xgpio_probe(struct platform_device *pdev) struct gpio_irq_chip *girq; u32 temp; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; @@ -633,8 +633,7 @@ static int xgpio_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &xgpio_irq_chip); girq->parent_handler = xgpio_irqhandler; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, 1); if (!girq->parents) { status = -ENOMEM; goto err_pm_put; diff --git a/drivers/gpio/gpio-xlp.c b/drivers/gpio/gpio-xlp.c index aede6324387f..e9618608f2a0 100644 --- a/drivers/gpio/gpio-xlp.c +++ b/drivers/gpio/gpio-xlp.c @@ -244,7 +244,7 @@ static int xlp_gpio_probe(struct platform_device *pdev) void __iomem *gpio_base; int irq, err; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; @@ -283,9 +283,7 @@ static int xlp_gpio_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &xlp_gpio_irq_chip); girq->parent_handler = xlp_gpio_generic_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(&pdev->dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; girq->parents[0] = irq; diff --git a/drivers/gpio/gpio-xra1403.c b/drivers/gpio/gpio-xra1403.c index fe0fba6ea902..421de68abe07 100644 --- a/drivers/gpio/gpio-xra1403.c +++ b/drivers/gpio/gpio-xra1403.c @@ -149,7 +149,7 @@ static int xra1403_probe(struct spi_device *spi) struct gpio_desc *reset_gpio; int ret; - xra = devm_kzalloc(&spi->dev, sizeof(*xra), GFP_KERNEL); + xra = devm_kzalloc_obj(&spi->dev, *xra); if (!xra) return -ENOMEM; diff --git a/drivers/gpio/gpio-zevio.c b/drivers/gpio/gpio-zevio.c index 288a86c8294a..b30b6a8a9d77 100644 --- a/drivers/gpio/gpio-zevio.c +++ b/drivers/gpio/gpio-zevio.c @@ -175,7 +175,7 @@ static int zevio_gpio_probe(struct platform_device *pdev) struct zevio_gpio *controller; int status, i; - controller = devm_kzalloc(&pdev->dev, sizeof(*controller), GFP_KERNEL); + controller = devm_kzalloc_obj(&pdev->dev, *controller); if (!controller) return -ENOMEM; diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c index 13e4c5f0e297..365c4fcf6d02 100644 --- a/drivers/gpio/gpio-zynq.c +++ b/drivers/gpio/gpio-zynq.c @@ -908,7 +908,7 @@ static int zynq_gpio_probe(struct platform_device *pdev) struct gpio_chip *chip; struct gpio_irq_chip *girq; - gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + gpio = devm_kzalloc_obj(&pdev->dev, *gpio); if (!gpio) return -ENOMEM; @@ -968,9 +968,7 @@ static int zynq_gpio_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &zynq_gpio_edge_irqchip); girq->parent_handler = zynq_gpio_irqhandler; girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(&pdev->dev, *girq->parents, 1); if (!girq->parents) { ret = -ENOMEM; goto err_pm_put; diff --git a/drivers/gpio/gpio-zynqmp-modepin.c b/drivers/gpio/gpio-zynqmp-modepin.c index 5e651482e985..ad5b772cfde7 100644 --- a/drivers/gpio/gpio-zynqmp-modepin.c +++ b/drivers/gpio/gpio-zynqmp-modepin.c @@ -118,7 +118,7 @@ static int modepin_gpio_probe(struct platform_device *pdev) struct gpio_chip *chip; int status; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/gpio/gpiolib-kunit.c b/drivers/gpio/gpiolib-kunit.c index f005854e7ff7..6ab9a9e290b3 100644 --- a/drivers/gpio/gpiolib-kunit.c +++ b/drivers/gpio/gpiolib-kunit.c @@ -90,11 +90,11 @@ static int gpio_test_provider_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct gpio_chip *gc; - gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL); + gc = devm_kzalloc_obj(dev, *gc); if (!gc) return -ENOMEM; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; @@ -572,7 +572,7 @@ static int gpio_unbind_consumer_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c index f105e3a2dce2..ee4d7cb311c2 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c @@ -355,7 +355,7 @@ static int d71_enum_resources(struct komeda_dev *mdev) u32 i, value, offset; int err; - d71 = devm_kzalloc(mdev->dev, sizeof(*d71), GFP_KERNEL); + d71 = devm_kzalloc_obj(mdev->dev, *d71); if (!d71) return -ENOMEM; diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c index 9aad1d1d28ec..1732f4574638 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c @@ -188,7 +188,7 @@ struct komeda_dev *komeda_dev_create(struct device *dev) if (!komeda_identify) return ERR_PTR(-ENODEV); - mdev = devm_kzalloc(dev, sizeof(*mdev), GFP_KERNEL); + mdev = devm_kzalloc_obj(dev, *mdev); if (!mdev) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c index 67fffab018ae..703ff7827835 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c @@ -63,7 +63,7 @@ static int komeda_platform_probe(struct platform_device *pdev) if (err) return dev_err_probe(dev, err, "DMA mask error\n"); - mdrv = devm_kzalloc(dev, sizeof(*mdrv), GFP_KERNEL); + mdrv = devm_kzalloc_obj(dev, *mdrv); if (!mdrv) return -ENOMEM; diff --git a/drivers/gpu/drm/armada/armada_510.c b/drivers/gpu/drm/armada/armada_510.c index 93cd7e1a08ab..78edbec91ee2 100644 --- a/drivers/gpu/drm/armada/armada_510.c +++ b/drivers/gpu/drm/armada/armada_510.c @@ -23,7 +23,7 @@ static int armada510_crtc_init(struct armada_crtc *dcrtc, struct device *dev) struct clk *clk; int idx; - v = devm_kzalloc(dev, sizeof(*v), GFP_KERNEL); + v = devm_kzalloc_obj(dev, *v); if (!v) return -ENOMEM; diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index c3ef44074477..d3964adbb106 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1037,8 +1037,7 @@ static int adv7511_init_regulators(struct adv7511 *adv) unsigned int i; int ret; - adv->supplies = devm_kcalloc(dev, num_supplies, - sizeof(*adv->supplies), GFP_KERNEL); + adv->supplies = devm_kzalloc_objs(dev, *adv->supplies, num_supplies); if (!adv->supplies) return -ENOMEM; diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c index cc221483ef0d..9555c12231bd 100644 --- a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c @@ -110,7 +110,7 @@ static int imx8mp_hdmi_pai_bind(struct device *dev, struct device *master, void void __iomem *base; int ret; - hdmi_pai = devm_kzalloc(dev, sizeof(*hdmi_pai), GFP_KERNEL); + hdmi_pai = devm_kzalloc_obj(dev, *hdmi_pai); if (!hdmi_pai) return -ENOMEM; diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c index ea43f59f06b2..9d38f4c06514 100644 --- a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c @@ -121,7 +121,7 @@ static int imx8mp_dw_hdmi_probe(struct platform_device *pdev) struct device_node *remote; struct imx8mp_hdmi *hdmi; - hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL); + hdmi = devm_kzalloc_obj(dev, *hdmi); if (!hdmi) return -ENOMEM; diff --git a/drivers/gpu/drm/bridge/imx/imx8qm-ldb.c b/drivers/gpu/drm/bridge/imx/imx8qm-ldb.c index 5884af991547..547a10228094 100644 --- a/drivers/gpu/drm/bridge/imx/imx8qm-ldb.c +++ b/drivers/gpu/drm/bridge/imx/imx8qm-ldb.c @@ -442,7 +442,7 @@ static int imx8qm_ldb_probe(struct platform_device *pdev) int pixel_order; int ret, i; - imx8qm_ldb = devm_kzalloc(dev, sizeof(*imx8qm_ldb), GFP_KERNEL); + imx8qm_ldb = devm_kzalloc_obj(dev, *imx8qm_ldb); if (!imx8qm_ldb) return -ENOMEM; diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c index b95c640564e4..8c1356e5d920 100644 --- a/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c +++ b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c @@ -593,7 +593,7 @@ static int imx8qxp_ldb_probe(struct platform_device *pdev) struct ldb_channel *ldb_ch; int ret, i; - imx8qxp_ldb = devm_kzalloc(dev, sizeof(*imx8qxp_ldb), GFP_KERNEL); + imx8qxp_ldb = devm_kzalloc_obj(dev, *imx8qxp_ldb); if (!imx8qxp_ldb) return -ENOMEM; diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c index a5a1bf42325b..cb399434374e 100644 --- a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c +++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c @@ -272,7 +272,7 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev) u32 i; int ret; - pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); + pc = devm_kzalloc_obj(dev, *pc); if (!pc) return -ENOMEM; diff --git a/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c b/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c index 8f312f9edf97..6453ea779606 100644 --- a/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c @@ -834,7 +834,7 @@ static int imx93_dsi_probe(struct platform_device *pdev) struct imx93_dsi *dsi; int ret; - dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); + dsi = devm_kzalloc_obj(dev, *dsi); if (!dsi) return -ENOMEM; diff --git a/drivers/gpu/drm/bridge/inno-hdmi.c b/drivers/gpu/drm/bridge/inno-hdmi.c index ea3447d4f285..4d9d06d04196 100644 --- a/drivers/gpu/drm/bridge/inno-hdmi.c +++ b/drivers/gpu/drm/bridge/inno-hdmi.c @@ -1033,7 +1033,7 @@ static struct i2c_adapter *inno_hdmi_i2c_adapter(struct inno_hdmi *hdmi) struct inno_hdmi_i2c *i2c; int ret; - i2c = devm_kzalloc(hdmi->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(hdmi->dev, *i2c); if (!i2c) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c index 9549dabde941..f7925b9bd95e 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c @@ -248,7 +248,7 @@ static int dw_hdmi_cec_probe(struct platform_device *pdev) * hardware device here, so that userspace can see the association * between the HDMI hardware and its associated CEC chardev. */ - cec = devm_kzalloc(&pdev->dev, sizeof(*cec), GFP_KERNEL); + cec = devm_kzalloc_obj(&pdev->dev, *cec); if (!cec) return -ENOMEM; diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-gp-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-gp-audio.c index df7a37eb47f4..6d8fd25080e6 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-gp-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-gp-audio.c @@ -161,7 +161,7 @@ static int snd_dw_hdmi_probe(struct platform_device *pdev) .data = data, }; - dw = devm_kzalloc(&pdev->dev, sizeof(*dw), GFP_KERNEL); + dw = devm_kzalloc_obj(&pdev->dev, *dw); if (!dw) return -ENOMEM; diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c index b268c9376087..62835485d66a 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c @@ -506,7 +506,7 @@ static struct i2c_adapter *dw_hdmi_qp_i2c_adapter(struct dw_hdmi_qp *hdmi) struct i2c_adapter *adap; int ret; - i2c = devm_kzalloc(hdmi->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(hdmi->dev, *i2c); if (!i2c) return ERR_PTR(-ENOMEM); @@ -1187,7 +1187,7 @@ struct dw_hdmi_qp *dw_hdmi_qp_bind(struct platform_device *pdev, hdmi->bridge.hdmi_cec_dev = dev; hdmi->bridge.hdmi_cec_adapter_name = dev_name(dev); - hdmi->cec = devm_kzalloc(hdmi->dev, sizeof(*hdmi->cec), GFP_KERNEL); + hdmi->cec = devm_kzalloc_obj(hdmi->dev, *hdmi->cec); if (!hdmi->cec) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 75057eabe5b5..e75b128fad2c 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -512,7 +512,7 @@ static struct i2c_adapter *dw_hdmi_i2c_adapter(struct dw_hdmi *hdmi) struct dw_hdmi_i2c *i2c; int ret; - i2c = devm_kzalloc(hdmi->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(hdmi->dev, *i2c); if (!i2c) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/bridge/th1520-dw-hdmi.c b/drivers/gpu/drm/bridge/th1520-dw-hdmi.c index 2fa7f2d46b3d..ff01e8865f8e 100644 --- a/drivers/gpu/drm/bridge/th1520-dw-hdmi.c +++ b/drivers/gpu/drm/bridge/th1520-dw-hdmi.c @@ -108,7 +108,7 @@ static int th1520_dw_hdmi_probe(struct platform_device *pdev) struct dw_hdmi_plat_data *plat_data; struct device *dev = &pdev->dev; - hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL); + hdmi = devm_kzalloc_obj(dev, *hdmi); if (!hdmi) return -ENOMEM; diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c index 488fd123a01a..614b45d7db5e 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -4699,7 +4699,7 @@ int drm_panel_dp_aux_backlight(struct drm_panel *panel, struct drm_dp_aux *aux) return 0; } - bl = devm_kzalloc(panel->dev, sizeof(*bl), GFP_KERNEL); + bl = devm_kzalloc_obj(panel->dev, *bl); if (!bl) return -ENOMEM; diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c index 5c23182f4d33..6a4aab75ebba 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -1907,7 +1907,7 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev) struct etnaviv_gpu *gpu; int err; - gpu = devm_kzalloc(dev, sizeof(*gpu), GFP_KERNEL); + gpu = devm_kzalloc_obj(dev, *gpu); if (!gpu) return -ENOMEM; diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index 9ae0fa4667a9..4393ed768996 100644 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c @@ -794,7 +794,7 @@ static int exynos5433_decon_probe(struct platform_device *pdev) int ret; int i; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index bb74b17f9753..3ab5d3586792 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -688,7 +688,7 @@ static int decon_probe(struct platform_device *pdev) if (!dev->of_node) return -ENODEV; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/gpu/drm/exynos/exynos_dp.c b/drivers/gpu/drm/exynos/exynos_dp.c index 82c238829921..4db7400c8a23 100644 --- a/drivers/gpu/drm/exynos/exynos_dp.c +++ b/drivers/gpu/drm/exynos/exynos_dp.c @@ -148,8 +148,7 @@ static int exynos_dp_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct exynos_dp_device *dp; - dp = devm_kzalloc(&pdev->dev, sizeof(struct exynos_dp_device), - GFP_KERNEL); + dp = devm_kzalloc_obj(&pdev->dev, struct exynos_dp_device); if (!dp) return -ENOMEM; diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c index 74d3a2bebb74..53b012a7acc0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c @@ -173,7 +173,7 @@ static int exynos_dpi_parse_dt(struct exynos_dpi *ctx) of_node_put(np); - vm = devm_kzalloc(dev, sizeof(*ctx->vm), GFP_KERNEL); + vm = devm_kzalloc_obj(dev, *ctx->vm); if (!vm) return -ENOMEM; @@ -227,7 +227,7 @@ struct drm_encoder *exynos_dpi_probe(struct device *dev) struct exynos_dpi *ctx; int ret; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 2f83f3249242..b4d06cac20cb 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -113,7 +113,7 @@ static int exynos_dsi_register_host(struct samsung_dsim *dsim) { struct exynos_dsi *dsi; - dsi = devm_kzalloc(dsim->dev, sizeof(*dsi), GFP_KERNEL); + dsi = devm_kzalloc_obj(dsim->dev, *dsi); if (!dsi) return -ENOMEM; diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index 09e33a26caaf..9c2ad95799ee 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c @@ -1273,7 +1273,7 @@ static int fimc_probe(struct platform_device *pdev) if (exynos_drm_check_fimc_device(dev) != 0) return -ENODEV; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; @@ -1282,8 +1282,7 @@ static int fimc_probe(struct platform_device *pdev) /* construct formats/limits array */ num_formats = ARRAY_SIZE(fimc_formats) + ARRAY_SIZE(fimc_tiled_formats); - formats = devm_kcalloc(dev, num_formats, sizeof(*formats), - GFP_KERNEL); + formats = devm_kzalloc_objs(dev, *formats, num_formats); if (!formats) return -ENOMEM; diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index dead68b517db..60af868ac214 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -1190,7 +1190,7 @@ static int fimd_probe(struct platform_device *pdev) if (!dev->of_node) return -ENODEV; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index e92a4d872c41..280c1a41342a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -1453,7 +1453,7 @@ static int g2d_probe(struct platform_device *pdev) struct g2d_data *g2d; int ret; - g2d = devm_kzalloc(dev, sizeof(*g2d), GFP_KERNEL); + g2d = devm_kzalloc_obj(dev, *g2d); if (!g2d) return -ENOMEM; diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index d9637ddfcfc4..4a07deeb382b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c @@ -1222,7 +1222,7 @@ static int gsc_probe(struct platform_device *pdev) struct gsc_context *ctx; int num_formats, ret, i, j; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; @@ -1233,7 +1233,7 @@ static int gsc_probe(struct platform_device *pdev) /* construct formats/limits array */ num_formats = ARRAY_SIZE(gsc_formats) + ARRAY_SIZE(gsc_tiled_formats); - formats = devm_kcalloc(dev, num_formats, sizeof(*formats), GFP_KERNEL); + formats = devm_kzalloc_objs(dev, *formats, num_formats); if (!formats) return -ENOMEM; diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c index 7b0f4a98a70a..955ea0cb87b6 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c +++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c @@ -283,7 +283,7 @@ static int rotator_probe(struct platform_device *pdev) int irq; int ret; - rot = devm_kzalloc(dev, sizeof(*rot), GFP_KERNEL); + rot = devm_kzalloc_obj(dev, *rot); if (!rot) return -ENOMEM; diff --git a/drivers/gpu/drm/exynos/exynos_drm_scaler.c b/drivers/gpu/drm/exynos/exynos_drm_scaler.c index c8a1b6b0a29c..2bfbafd5c414 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_scaler.c +++ b/drivers/gpu/drm/exynos/exynos_drm_scaler.c @@ -490,7 +490,7 @@ static int scaler_probe(struct platform_device *pdev) int irq; int ret, i; - scaler = devm_kzalloc(dev, sizeof(*scaler), GFP_KERNEL); + scaler = devm_kzalloc_obj(dev, *scaler); if (!scaler) return -ENOMEM; diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index fa3a8d21559d..13700ffac423 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -491,7 +491,7 @@ static int vidi_probe(struct platform_device *pdev) struct vidi_context *ctx; struct device *dev = &pdev->dev; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 055dc04f9b3e..d67a493c8fe4 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -1738,7 +1738,7 @@ static int hdmi_clk_init(struct hdmi_context *hdata) if (!count) return 0; - clks = devm_kcalloc(dev, count, sizeof(*clks), GFP_KERNEL); + clks = devm_kzalloc_objs(dev, *clks, count); if (!clks) return -ENOMEM; @@ -1975,7 +1975,7 @@ static int hdmi_probe(struct platform_device *pdev) struct hdmi_context *hdata; int ret; - hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL); + hdata = devm_kzalloc_obj(dev, struct hdmi_context); if (!hdata) return -ENOMEM; diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 69dea5049309..9b210ff7449f 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1231,7 +1231,7 @@ static int mixer_probe(struct platform_device *pdev) struct mixer_context *ctx; int ret; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) { DRM_DEV_ERROR(dev, "failed to alloc mixer context.\n"); return -ENOMEM; diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c index 3bbfc1b56a65..6709b3b1a3ea 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c @@ -268,7 +268,7 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev) int ret; u8 div_ratio_shift = 0; - fsl_dev = devm_kzalloc(dev, sizeof(*fsl_dev), GFP_KERNEL); + fsl_dev = devm_kzalloc_obj(dev, *fsl_dev); if (!fsl_dev) return -ENOMEM; diff --git a/drivers/gpu/drm/fsl-dcu/fsl_tcon.c b/drivers/gpu/drm/fsl-dcu/fsl_tcon.c index 49bbd00c77ae..dd81962a03dd 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_tcon.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_tcon.c @@ -67,7 +67,7 @@ struct fsl_tcon *fsl_tcon_init(struct device *dev) if (!np) return NULL; - tcon = devm_kzalloc(dev, sizeof(*tcon), GFP_KERNEL); + tcon = devm_kzalloc_obj(dev, *tcon); if (!tcon) goto err_node_put; diff --git a/drivers/gpu/drm/gud/gud_drv.c b/drivers/gpu/drm/gud/gud_drv.c index 680447f426f3..ea98f641c0b9 100644 --- a/drivers/gpu/drm/gud/gud_drv.c +++ b/drivers/gpu/drm/gud/gud_drv.c @@ -512,7 +512,7 @@ static int gud_probe(struct usb_interface *intf, const struct usb_device_id *id) /* Format init */ formats_dev = devm_kmalloc(dev, GUD_FORMATS_MAX_NUM, GFP_KERNEL); /* Add room for emulated XRGB8888 */ - formats = devm_kmalloc_array(dev, GUD_FORMATS_MAX_NUM + 1, sizeof(*formats), GFP_KERNEL); + formats = devm_kmalloc_objs(dev, *formats, GUD_FORMATS_MAX_NUM + 1); if (!formats_dev || !formats) return -ENOMEM; diff --git a/drivers/gpu/drm/hisilicon/hibmc/dp/dp_hw.c b/drivers/gpu/drm/hisilicon/hibmc/dp/dp_hw.c index d5bd3c45649b..6cbd16ebc798 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/dp/dp_hw.c +++ b/drivers/gpu/drm/hisilicon/hibmc/dp/dp_hw.c @@ -157,7 +157,7 @@ int hibmc_dp_hw_init(struct hibmc_dp *dp) struct hibmc_dp_dev *dp_dev; int ret; - dp_dev = devm_kzalloc(drm_dev->dev, sizeof(struct hibmc_dp_dev), GFP_KERNEL); + dp_dev = devm_kzalloc_obj(drm_dev->dev, struct hibmc_dp_dev); if (!dp_dev) return -ENOMEM; diff --git a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c index 62c5bd3277da..df89a8f18c8f 100644 --- a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c +++ b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c @@ -851,7 +851,7 @@ static int dsi_probe(struct platform_device *pdev) struct dsi_hw_ctx *ctx; int ret; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) { DRM_ERROR("failed to allocate dsi data.\n"); return -ENOMEM; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index bca839dd600b..dd78a917903b 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -850,7 +850,7 @@ static void *ade_hw_ctx_alloc(struct platform_device *pdev, struct ade_hw_ctx *ctx = NULL; int ret; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) { DRM_ERROR("failed to alloc ade_hw_ctx\n"); return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 8a11c2df5b88..578c898dcba0 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -112,7 +112,7 @@ static int kirin_drm_private_init(struct drm_device *dev, int ret; u32 ch; - kirin_priv = devm_kzalloc(dev->dev, sizeof(*kirin_priv), GFP_KERNEL); + kirin_priv = devm_kzalloc_obj(dev->dev, *kirin_priv); if (!kirin_priv) { DRM_ERROR("failed to alloc kirin_drm_private\n"); return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dc/dc-cf.c b/drivers/gpu/drm/imx/dc/dc-cf.c index 7c2f7abc5099..30576170f0c0 100644 --- a/drivers/gpu/drm/imx/dc/dc-cf.c +++ b/drivers/gpu/drm/imx/dc/dc-cf.c @@ -90,7 +90,7 @@ static int dc_cf_bind(struct device *dev, struct device *master, void *data) struct dc_cf *cf; int id; - cf = devm_kzalloc(dev, sizeof(*cf), GFP_KERNEL); + cf = devm_kzalloc_obj(dev, *cf); if (!cf) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dc/dc-de.c b/drivers/gpu/drm/imx/dc/dc-de.c index 15056590b04d..67fa7aff777d 100644 --- a/drivers/gpu/drm/imx/dc/dc-de.c +++ b/drivers/gpu/drm/imx/dc/dc-de.c @@ -56,7 +56,7 @@ static int dc_de_bind(struct device *dev, struct device *master, void *data) struct dc_de *de; int ret, id; - de = devm_kzalloc(dev, sizeof(*de), GFP_KERNEL); + de = devm_kzalloc_obj(dev, *de); if (!de) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dc/dc-drv.c b/drivers/gpu/drm/imx/dc/dc-drv.c index 13795a2ad735..30e2545280e0 100644 --- a/drivers/gpu/drm/imx/dc/dc-drv.c +++ b/drivers/gpu/drm/imx/dc/dc-drv.c @@ -158,7 +158,7 @@ static int dc_probe(struct platform_device *pdev) struct dc_priv *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dc/dc-ed.c b/drivers/gpu/drm/imx/dc/dc-ed.c index de1b71315eab..b0c0013914b8 100644 --- a/drivers/gpu/drm/imx/dc/dc-ed.c +++ b/drivers/gpu/drm/imx/dc/dc-ed.c @@ -197,7 +197,7 @@ static int dc_ed_bind(struct device *dev, struct device *master, void *data) struct dc_ed *ed; int id; - ed = devm_kzalloc(dev, sizeof(*ed), GFP_KERNEL); + ed = devm_kzalloc_obj(dev, *ed); if (!ed) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dc/dc-fg.c b/drivers/gpu/drm/imx/dc/dc-fg.c index 3741dc66c0d9..c5a9d614756a 100644 --- a/drivers/gpu/drm/imx/dc/dc-fg.c +++ b/drivers/gpu/drm/imx/dc/dc-fg.c @@ -308,7 +308,7 @@ static int dc_fg_bind(struct device *dev, struct device *master, void *data) struct dc_fg *fg; int id; - fg = devm_kzalloc(dev, sizeof(*fg), GFP_KERNEL); + fg = devm_kzalloc_obj(dev, *fg); if (!fg) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dc/dc-fl.c b/drivers/gpu/drm/imx/dc/dc-fl.c index 9f03df44a63a..b88085363b87 100644 --- a/drivers/gpu/drm/imx/dc/dc-fl.c +++ b/drivers/gpu/drm/imx/dc/dc-fl.c @@ -102,7 +102,7 @@ static int dc_fl_bind(struct device *dev, struct device *master, void *data) struct dc_fu *fu; int i, id; - fl = devm_kzalloc(dev, sizeof(*fl), GFP_KERNEL); + fl = devm_kzalloc_obj(dev, *fl); if (!fl) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dc/dc-fw.c b/drivers/gpu/drm/imx/dc/dc-fw.c index 14512c01ea78..758cade1d766 100644 --- a/drivers/gpu/drm/imx/dc/dc-fw.c +++ b/drivers/gpu/drm/imx/dc/dc-fw.c @@ -132,7 +132,7 @@ static int dc_fw_bind(struct device *dev, struct device *master, void *data) struct dc_fu *fu; int i, id; - fw = devm_kzalloc(dev, sizeof(*fw), GFP_KERNEL); + fw = devm_kzalloc_obj(dev, *fw); if (!fw) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dc/dc-ic.c b/drivers/gpu/drm/imx/dc/dc-ic.c index fa87bf1f4508..64f058a466e4 100644 --- a/drivers/gpu/drm/imx/dc/dc-ic.c +++ b/drivers/gpu/drm/imx/dc/dc-ic.c @@ -120,11 +120,11 @@ static int dc_ic_probe(struct platform_device *pdev) void __iomem *base; int i, ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; - entry = devm_kcalloc(dev, IRQ_COUNT, sizeof(*entry), GFP_KERNEL); + entry = devm_kzalloc_objs(dev, *entry, IRQ_COUNT); if (!entry) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dc/dc-lb.c b/drivers/gpu/drm/imx/dc/dc-lb.c index cb614f3c2f69..1332ce2dc1b8 100644 --- a/drivers/gpu/drm/imx/dc/dc-lb.c +++ b/drivers/gpu/drm/imx/dc/dc-lb.c @@ -250,7 +250,7 @@ static int dc_lb_bind(struct device *dev, struct device *master, void *data) void __iomem *base_cfg; struct dc_lb *lb; - lb = devm_kzalloc(dev, sizeof(*lb), GFP_KERNEL); + lb = devm_kzalloc_obj(dev, *lb); if (!lb) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dc/dc-pe.c b/drivers/gpu/drm/imx/dc/dc-pe.c index 4eb8c11de99c..718426ccff52 100644 --- a/drivers/gpu/drm/imx/dc/dc-pe.c +++ b/drivers/gpu/drm/imx/dc/dc-pe.c @@ -22,7 +22,7 @@ static int dc_pe_bind(struct device *dev, struct device *master, void *data) struct dc_pe *pe; int ret; - pe = devm_kzalloc(dev, sizeof(*pe), GFP_KERNEL); + pe = devm_kzalloc_obj(dev, *pe); if (!pe) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dc/dc-tc.c b/drivers/gpu/drm/imx/dc/dc-tc.c index d0d4faba790e..7588c17c0e5c 100644 --- a/drivers/gpu/drm/imx/dc/dc-tc.c +++ b/drivers/gpu/drm/imx/dc/dc-tc.c @@ -78,7 +78,7 @@ static int dc_tc_bind(struct device *dev, struct device *master, void *data) struct dc_tc *tc; int id; - tc = devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL); + tc = devm_kzalloc_obj(dev, *tc); if (!tc) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dcss/dcss-blkctl.c b/drivers/gpu/drm/imx/dcss/dcss-blkctl.c index 803e3fcdb50f..9214ed37dbae 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-blkctl.c +++ b/drivers/gpu/drm/imx/dcss/dcss-blkctl.c @@ -42,7 +42,7 @@ int dcss_blkctl_init(struct dcss_dev *dcss, unsigned long blkctl_base) { struct dcss_blkctl *blkctl; - blkctl = devm_kzalloc(dcss->dev, sizeof(*blkctl), GFP_KERNEL); + blkctl = devm_kzalloc_obj(dcss->dev, *blkctl); if (!blkctl) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dcss/dcss-ctxld.c b/drivers/gpu/drm/imx/dcss/dcss-ctxld.c index e41d5c2a3ea4..3c8e13bade33 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-ctxld.c +++ b/drivers/gpu/drm/imx/dcss/dcss-ctxld.c @@ -202,7 +202,7 @@ int dcss_ctxld_init(struct dcss_dev *dcss, unsigned long ctxld_base) struct dcss_ctxld *ctxld; int ret; - ctxld = devm_kzalloc(dcss->dev, sizeof(*ctxld), GFP_KERNEL); + ctxld = devm_kzalloc_obj(dcss->dev, *ctxld); if (!ctxld) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dcss/dcss-dev.c b/drivers/gpu/drm/imx/dcss/dcss-dev.c index 7fd0c4c14205..45a91e43bab1 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-dev.c +++ b/drivers/gpu/drm/imx/dcss/dcss-dev.c @@ -185,7 +185,7 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output) return ERR_PTR(-EBUSY); } - dcss = devm_kzalloc(dev, sizeof(*dcss), GFP_KERNEL); + dcss = devm_kzalloc_obj(dev, *dcss); if (!dcss) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/imx/dcss/dcss-dpr.c b/drivers/gpu/drm/imx/dcss/dcss-dpr.c index 072eb209249f..2428b884b033 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-dpr.c +++ b/drivers/gpu/drm/imx/dcss/dcss-dpr.c @@ -155,7 +155,7 @@ int dcss_dpr_init(struct dcss_dev *dcss, unsigned long dpr_base) { struct dcss_dpr *dpr; - dpr = devm_kzalloc(dcss->dev, sizeof(*dpr), GFP_KERNEL); + dpr = devm_kzalloc_obj(dcss->dev, *dpr); if (!dpr) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dcss/dcss-drv.c b/drivers/gpu/drm/imx/dcss/dcss-drv.c index 19b027cc1dc4..19c618f6423e 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-drv.c +++ b/drivers/gpu/drm/imx/dcss/dcss-drv.c @@ -51,7 +51,7 @@ static int dcss_drv_platform_probe(struct platform_device *pdev) of_node_put(remote); - mdrv = devm_kzalloc(dev, sizeof(*mdrv), GFP_KERNEL); + mdrv = devm_kzalloc_obj(dev, *mdrv); if (!mdrv) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dcss/dcss-dtg.c b/drivers/gpu/drm/imx/dcss/dcss-dtg.c index 6bbfd9aa27ac..a419731eb09f 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-dtg.c +++ b/drivers/gpu/drm/imx/dcss/dcss-dtg.c @@ -150,7 +150,7 @@ int dcss_dtg_init(struct dcss_dev *dcss, unsigned long dtg_base) int ret = 0; struct dcss_dtg *dtg; - dtg = devm_kzalloc(dcss->dev, sizeof(*dtg), GFP_KERNEL); + dtg = devm_kzalloc_obj(dcss->dev, *dtg); if (!dtg) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dcss/dcss-scaler.c b/drivers/gpu/drm/imx/dcss/dcss-scaler.c index 5c7f8d952ec1..76d21ade5218 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-scaler.c +++ b/drivers/gpu/drm/imx/dcss/dcss-scaler.c @@ -321,7 +321,7 @@ int dcss_scaler_init(struct dcss_dev *dcss, unsigned long scaler_base) { struct dcss_scaler *scaler; - scaler = devm_kzalloc(dcss->dev, sizeof(*scaler), GFP_KERNEL); + scaler = devm_kzalloc_obj(dcss->dev, *scaler); if (!scaler) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/dcss/dcss-ss.c b/drivers/gpu/drm/imx/dcss/dcss-ss.c index 0df81866fb7b..2846faa9a8b6 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-ss.c +++ b/drivers/gpu/drm/imx/dcss/dcss-ss.c @@ -83,7 +83,7 @@ int dcss_ss_init(struct dcss_dev *dcss, unsigned long ss_base) { struct dcss_ss *ss; - ss = devm_kzalloc(dcss->dev, sizeof(*ss), GFP_KERNEL); + ss = devm_kzalloc_obj(dcss->dev, *ss); if (!ss) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c b/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c index 398f3cce5532..09babdcf3289 100644 --- a/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c +++ b/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c @@ -224,7 +224,7 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev) struct imx_hdmi *hdmi; int ret; - hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); + hdmi = devm_kzalloc_obj(&pdev->dev, *hdmi); if (!hdmi) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/ipuv3/imx-ldb.c b/drivers/gpu/drm/imx/ipuv3/imx-ldb.c index 63d6a1e7c1bd..523c184aafd4 100644 --- a/drivers/gpu/drm/imx/ipuv3/imx-ldb.c +++ b/drivers/gpu/drm/imx/ipuv3/imx-ldb.c @@ -505,7 +505,7 @@ static int imx_ldb_probe(struct platform_device *pdev) int ret; int i; - imx_ldb = devm_kzalloc(dev, sizeof(*imx_ldb), GFP_KERNEL); + imx_ldb = devm_kzalloc_obj(dev, *imx_ldb); if (!imx_ldb) return -ENOMEM; diff --git a/drivers/gpu/drm/imx/ipuv3/imx-tve.c b/drivers/gpu/drm/imx/ipuv3/imx-tve.c index 4ece79374372..a55e1cdd3344 100644 --- a/drivers/gpu/drm/imx/ipuv3/imx-tve.c +++ b/drivers/gpu/drm/imx/ipuv3/imx-tve.c @@ -546,7 +546,7 @@ static int imx_tve_probe(struct platform_device *pdev) int irq; int ret; - tve = devm_kzalloc(dev, sizeof(*tve), GFP_KERNEL); + tve = devm_kzalloc_obj(dev, *tve); if (!tve) return -ENOMEM; diff --git a/drivers/gpu/drm/ingenic/ingenic-ipu.c b/drivers/gpu/drm/ingenic/ingenic-ipu.c index bf24882e8d9f..7f3cc8a75898 100644 --- a/drivers/gpu/drm/ingenic/ingenic-ipu.c +++ b/drivers/gpu/drm/ingenic/ingenic-ipu.c @@ -816,7 +816,7 @@ static int ingenic_ipu_bind(struct device *dev, struct device *master, void *d) unsigned int sharpness_max; int err, irq; - ipu = devm_kzalloc(dev, sizeof(*ipu), GFP_KERNEL); + ipu = devm_kzalloc_obj(dev, *ipu); if (!ipu) return -ENOMEM; diff --git a/drivers/gpu/drm/kmb/kmb_dsi.c b/drivers/gpu/drm/kmb/kmb_dsi.c index 13adba96bc78..6ca5aeff5d14 100644 --- a/drivers/gpu/drm/kmb/kmb_dsi.c +++ b/drivers/gpu/drm/kmb/kmb_dsi.c @@ -1412,7 +1412,7 @@ struct kmb_dsi *kmb_dsi_init(struct platform_device *pdev) struct kmb_dsi *kmb_dsi; struct device *dev = get_device(&pdev->dev); - kmb_dsi = devm_kzalloc(dev, sizeof(*kmb_dsi), GFP_KERNEL); + kmb_dsi = devm_kzalloc_obj(dev, *kmb_dsi); if (!kmb_dsi) { dev_err(dev, "failed to allocate kmb_dsi\n"); return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/lima/lima_drv.c b/drivers/gpu/drm/lima/lima_drv.c index 9a0eb1092ad3..5113d9512464 100644 --- a/drivers/gpu/drm/lima/lima_drv.c +++ b/drivers/gpu/drm/lima/lima_drv.c @@ -377,7 +377,7 @@ static int lima_pdev_probe(struct platform_device *pdev) if (err) return err; - ldev = devm_kzalloc(&pdev->dev, sizeof(*ldev), GFP_KERNEL); + ldev = devm_kzalloc_obj(&pdev->dev, *ldev); if (!ldev) { err = -ENOMEM; goto err_out0; diff --git a/drivers/gpu/drm/logicvc/logicvc_crtc.c b/drivers/gpu/drm/logicvc/logicvc_crtc.c index af92a573c3f2..ded957744ef1 100644 --- a/drivers/gpu/drm/logicvc/logicvc_crtc.c +++ b/drivers/gpu/drm/logicvc/logicvc_crtc.c @@ -252,7 +252,7 @@ int logicvc_crtc_init(struct logicvc_drm *logicvc) struct logicvc_layer *layer_primary; int ret; - crtc = devm_kzalloc(dev, sizeof(*crtc), GFP_KERNEL); + crtc = devm_kzalloc_obj(dev, *crtc); if (!crtc) return -ENOMEM; diff --git a/drivers/gpu/drm/logicvc/logicvc_interface.c b/drivers/gpu/drm/logicvc/logicvc_interface.c index 81f760dc07f8..67972bc70682 100644 --- a/drivers/gpu/drm/logicvc/logicvc_interface.c +++ b/drivers/gpu/drm/logicvc/logicvc_interface.c @@ -154,7 +154,7 @@ int logicvc_interface_init(struct logicvc_drm *logicvc) bool native_connector = logicvc_interface_native_connector(logicvc); int ret; - interface = devm_kzalloc(dev, sizeof(*interface), GFP_KERNEL); + interface = devm_kzalloc_obj(dev, *interface); if (!interface) { ret = -ENOMEM; goto error_early; diff --git a/drivers/gpu/drm/logicvc/logicvc_layer.c b/drivers/gpu/drm/logicvc/logicvc_layer.c index 947416856381..86976a78d18e 100644 --- a/drivers/gpu/drm/logicvc/logicvc_layer.c +++ b/drivers/gpu/drm/logicvc/logicvc_layer.c @@ -470,7 +470,7 @@ static int logicvc_layer_init(struct logicvc_drm *logicvc, unsigned int zpos; int ret; - layer = devm_kzalloc(dev, sizeof(*layer), GFP_KERNEL); + layer = devm_kzalloc_obj(dev, *layer); if (!layer) { ret = -ENOMEM; goto error; diff --git a/drivers/gpu/drm/mcde/mcde_clk_div.c b/drivers/gpu/drm/mcde/mcde_clk_div.c index 8c5af2677357..e3402e180ec6 100644 --- a/drivers/gpu/drm/mcde/mcde_clk_div.c +++ b/drivers/gpu/drm/mcde/mcde_clk_div.c @@ -165,10 +165,10 @@ int mcde_init_clock_divider(struct mcde *mcde) parent_name = __clk_get_name(mcde->lcd_clk); /* Allocate 2 clocks */ - fifoa = devm_kzalloc(dev, sizeof(*fifoa), GFP_KERNEL); + fifoa = devm_kzalloc_obj(dev, *fifoa); if (!fifoa) return -ENOMEM; - fifob = devm_kzalloc(dev, sizeof(*fifob), GFP_KERNEL); + fifob = devm_kzalloc_obj(dev, *fifob); if (!fifob) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_cec.c b/drivers/gpu/drm/mediatek/mtk_cec.c index 4a40e510e7db..0a5856d80f6d 100644 --- a/drivers/gpu/drm/mediatek/mtk_cec.c +++ b/drivers/gpu/drm/mediatek/mtk_cec.c @@ -187,7 +187,7 @@ static int mtk_cec_probe(struct platform_device *pdev) struct mtk_cec *cec; int ret; - cec = devm_kzalloc(dev, sizeof(*cec), GFP_KERNEL); + cec = devm_kzalloc_obj(dev, *cec); if (!cec) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_crtc.c b/drivers/gpu/drm/mediatek/mtk_crtc.c index 2920f3198ef6..1941222a97ab 100644 --- a/drivers/gpu/drm/mediatek/mtk_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_crtc.c @@ -1047,9 +1047,8 @@ int mtk_crtc_create(struct drm_device *drm_dev, const unsigned int *path, } } - mtk_crtc = devm_kzalloc(dev, - struct_size(mtk_crtc, ddp_comp, path_len + (conn_routes ? 1 : 0)), - GFP_KERNEL); + mtk_crtc = devm_kzalloc_flex(dev, *mtk_crtc, ddp_comp, + path_len + (conn_routes ? 1 : 0)); if (!mtk_crtc) return -ENOMEM; @@ -1089,8 +1088,8 @@ int mtk_crtc_create(struct drm_device *drm_dev, const unsigned int *path, for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) num_comp_planes += mtk_crtc_num_comp_planes(mtk_crtc, i); - mtk_crtc->planes = devm_kcalloc(dev, num_comp_planes, - sizeof(struct drm_plane), GFP_KERNEL); + mtk_crtc->planes = devm_kzalloc_objs(dev, struct drm_plane, + num_comp_planes); if (!mtk_crtc->planes) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_ddp_comp.c index 9672ea1f91a2..282614507f62 100644 --- a/drivers/gpu/drm/mediatek/mtk_ddp_comp.c +++ b/drivers/gpu/drm/mediatek/mtk_ddp_comp.c @@ -682,7 +682,7 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node, struct mtk_d type == MTK_DSI) return 0; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c b/drivers/gpu/drm/mediatek/mtk_disp_aal.c index abc9e5525d03..192c1a7d58df 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_aal.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_aal.c @@ -170,7 +170,7 @@ static int mtk_disp_aal_probe(struct platform_device *pdev) struct mtk_disp_aal *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c b/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c index 6d7bf4afa78d..5f64a0a6e1b2 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c @@ -134,7 +134,7 @@ static int mtk_disp_ccorr_probe(struct platform_device *pdev) struct mtk_disp_ccorr *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_disp_color.c b/drivers/gpu/drm/mediatek/mtk_disp_color.c index 39c7de4cdcc1..7af9966c036d 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_color.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_color.c @@ -98,7 +98,7 @@ static int mtk_disp_color_probe(struct platform_device *pdev) struct mtk_disp_color *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c index 8afd15006df2..787f68e7d189 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c @@ -258,7 +258,7 @@ static int mtk_disp_gamma_probe(struct platform_device *pdev) struct mtk_disp_gamma *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_disp_merge.c b/drivers/gpu/drm/mediatek/mtk_disp_merge.c index b174dda091d3..6f00e8cd1b5c 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_merge.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_merge.c @@ -309,7 +309,7 @@ static int mtk_disp_merge_probe(struct platform_device *pdev) struct mtk_disp_merge *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c index 97a899e4bd99..5445870716f9 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c @@ -614,7 +614,7 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev) int irq; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c index 6a259872b0a9..16fb340e5bd2 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c @@ -640,7 +640,7 @@ static int mtk_disp_ovl_adaptor_probe(struct platform_device *pdev) struct component_match *match = NULL; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c index c9d41d75e7f2..67bd9e1cad59 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c @@ -316,7 +316,7 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev) int irq; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index dc8e3e917dd7..a8bf0690756a 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -1066,7 +1066,7 @@ static int mtk_drm_probe(struct platform_device *pdev) int ret; int i; - private = devm_kzalloc(dev, sizeof(*private), GFP_KERNEL); + private = devm_kzalloc_obj(dev, *private); if (!private) return -ENOMEM; @@ -1102,9 +1102,9 @@ static int mtk_drm_probe(struct platform_device *pdev) private->data = mtk_drm_data; } - private->all_drm_private = devm_kmalloc_array(dev, private->data->mmsys_dev_num, - sizeof(*private->all_drm_private), - GFP_KERNEL); + private->all_drm_private = devm_kmalloc_objs(dev, + *private->all_drm_private, + private->data->mmsys_dev_num); if (!private->all_drm_private) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c index 96832d0cca37..4ba3b7b4b110 100644 --- a/drivers/gpu/drm/mediatek/mtk_ethdr.c +++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c @@ -325,7 +325,7 @@ static int mtk_ethdr_probe(struct platform_device *pdev) int ret; int i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c index 042b98e5a519..a36d8dd6b761 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c @@ -416,7 +416,7 @@ struct mtk_hdmi *mtk_hdmi_common_probe(struct platform_device *pdev) hdmi->dev = dev; hdmi->conf = hdmi_conf; - hdmi->clk = devm_kcalloc(dev, ver_conf->num_clocks, sizeof(*hdmi->clk), GFP_KERNEL); + hdmi->clk = devm_kzalloc_objs(dev, *hdmi->clk, ver_conf->num_clocks); if (!hdmi->clk) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c b/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c index 2acbdb025d89..c4fb4e209461 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c @@ -273,7 +273,7 @@ static int mtk_hdmi_ddc_probe(struct platform_device *pdev) struct resource *mem; int ret; - ddc = devm_kzalloc(dev, sizeof(struct mtk_hdmi_ddc), GFP_KERNEL); + ddc = devm_kzalloc_obj(dev, struct mtk_hdmi_ddc); if (!ddc) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_ddc_v2.c b/drivers/gpu/drm/mediatek/mtk_hdmi_ddc_v2.c index 1ec973d3f52c..31c93763e7cf 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_ddc_v2.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_ddc_v2.c @@ -346,7 +346,7 @@ static int mtk_hdmi_ddc_v2_probe(struct platform_device *pdev) struct mtk_hdmi_ddc *ddc; int ret; - ddc = devm_kzalloc(dev, sizeof(*ddc), GFP_KERNEL); + ddc = devm_kzalloc_obj(dev, *ddc); if (!ddc) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c index f903656ea0ef..fa53511f461d 100644 --- a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c +++ b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c @@ -293,7 +293,7 @@ static int mtk_mdp_rdma_probe(struct platform_device *pdev) struct mtk_mdp_rdma *priv; int ret = 0; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/mediatek/mtk_padding.c b/drivers/gpu/drm/mediatek/mtk_padding.c index b4e3e5a3428b..97bcc11566c6 100644 --- a/drivers/gpu/drm/mediatek/mtk_padding.c +++ b/drivers/gpu/drm/mediatek/mtk_padding.c @@ -98,7 +98,7 @@ static int mtk_padding_probe(struct platform_device *pdev) struct resource *res; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c index 056dbea8deec..d1317ddcdfab 100644 --- a/drivers/gpu/drm/meson/meson_crtc.c +++ b/drivers/gpu/drm/meson/meson_crtc.c @@ -677,8 +677,7 @@ int meson_crtc_create(struct meson_drm *priv) struct drm_crtc *crtc; int ret; - meson_crtc = devm_kzalloc(priv->drm->dev, sizeof(*meson_crtc), - GFP_KERNEL); + meson_crtc = devm_kzalloc_obj(priv->drm->dev, *meson_crtc); if (!meson_crtc) return -ENOMEM; diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 49ff9f1f16d3..38bf2811d068 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -202,7 +202,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) if (IS_ERR(drm)) return PTR_ERR(drm); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) { ret = -ENOMEM; goto free_drm; diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c index fef1702acb14..eb33c70f29c3 100644 --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c @@ -686,8 +686,7 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, return -ENODEV; } - meson_dw_hdmi = devm_kzalloc(dev, sizeof(*meson_dw_hdmi), - GFP_KERNEL); + meson_dw_hdmi = devm_kzalloc_obj(dev, *meson_dw_hdmi); if (!meson_dw_hdmi) return -ENOMEM; diff --git a/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c index 867918e9f498..c27a64bd1529 100644 --- a/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c +++ b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c @@ -267,7 +267,7 @@ static int meson_dw_mipi_dsi_probe(struct platform_device *pdev) struct meson_dw_mipi_dsi *mipi_dsi; struct device *dev = &pdev->dev; - mipi_dsi = devm_kzalloc(dev, sizeof(*mipi_dsi), GFP_KERNEL); + mipi_dsi = devm_kzalloc_obj(dev, *mipi_dsi); if (!mipi_dsi) return -ENOMEM; diff --git a/drivers/gpu/drm/meson/meson_overlay.c b/drivers/gpu/drm/meson/meson_overlay.c index 930119e18a4f..bb48cdf846bc 100644 --- a/drivers/gpu/drm/meson/meson_overlay.c +++ b/drivers/gpu/drm/meson/meson_overlay.c @@ -839,8 +839,7 @@ int meson_overlay_create(struct meson_drm *priv) DRM_DEBUG_DRIVER("\n"); - meson_overlay = devm_kzalloc(priv->drm->dev, sizeof(*meson_overlay), - GFP_KERNEL); + meson_overlay = devm_kzalloc_obj(priv->drm->dev, *meson_overlay); if (!meson_overlay) return -ENOMEM; diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c index cf8c90158fcf..76eb8b80ad8a 100644 --- a/drivers/gpu/drm/meson/meson_plane.c +++ b/drivers/gpu/drm/meson/meson_plane.c @@ -537,8 +537,7 @@ int meson_plane_create(struct meson_drm *priv) const uint64_t *format_modifiers = format_modifiers_default; int ret; - meson_plane = devm_kzalloc(priv->drm->dev, sizeof(*meson_plane), - GFP_KERNEL); + meson_plane = devm_kzalloc_obj(priv->drm->dev, *meson_plane); if (!meson_plane) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/adreno/a6xx_hfi.c b/drivers/gpu/drm/msm/adreno/a6xx_hfi.c index 6b34e704a70d..a9f9fa2adadf 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_hfi.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_hfi.c @@ -806,7 +806,7 @@ static int a6xx_hfi_send_bw_table(struct a6xx_gmu *gmu) if (gmu->bw_table) goto send; - msg = devm_kzalloc(gmu->dev, sizeof(*msg), GFP_KERNEL); + msg = devm_kzalloc_obj(gmu->dev, *msg); if (!msg) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index da3556eb6ecc..1b6286dccfc0 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -258,7 +258,7 @@ void dpu_debugfs_create_regset32(const char *name, umode_t mode, if (WARN_ON(!name || !dpu_kms || !length)) return; - regset = devm_kzalloc(&dpu_kms->pdev->dev, sizeof(*regset), GFP_KERNEL); + regset = devm_kzalloc_obj(&dpu_kms->pdev->dev, *regset); if (!regset) return; @@ -1386,7 +1386,7 @@ static int dpu_dev_probe(struct platform_device *pdev) if (!msm_disp_drv_should_bind(&pdev->dev, true)) return -ENODEV; - dpu_kms = devm_kzalloc(dev, sizeof(*dpu_kms), GFP_KERNEL); + dpu_kms = devm_kzalloc_obj(dev, *dpu_kms); if (!dpu_kms) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c index c299fef1a400..ab7b62381685 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c @@ -511,7 +511,7 @@ static int mdp4_probe(struct platform_device *pdev) struct mdp4_kms *mdp4_kms; int irq; - mdp4_kms = devm_kzalloc(dev, sizeof(*mdp4_kms), GFP_KERNEL); + mdp4_kms = devm_kzalloc_obj(dev, *mdp4_kms); if (!mdp4_kms) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_pll.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_pll.c index 04c49bf3d854..b873a6854a05 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_pll.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_pll.c @@ -141,7 +141,7 @@ static struct clk_hw *mdp4_lvds_pll_init(struct drm_device *dev) struct mdp4_lvds_pll *lvds_pll; int ret; - lvds_pll = devm_kzalloc(dev->dev, sizeof(*lvds_pll), GFP_KERNEL); + lvds_pll = devm_kzalloc_obj(dev->dev, *lvds_pll); if (!lvds_pll) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c index c54aaab2f5bd..f5b90368f435 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c @@ -1108,7 +1108,7 @@ struct mdp5_cfg_handler *mdp5_cfg_init(struct mdp5_kms *mdp5_kms, const struct mdp5_cfg_handler *cfg_handlers; int i, num_handlers; - cfg_handler = devm_kzalloc(dev->dev, sizeof(*cfg_handler), GFP_KERNEL); + cfg_handler = devm_kzalloc_obj(dev->dev, *cfg_handler); if (unlikely(!cfg_handler)) { return ERR_PTR(-ENOMEM); } diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c index 1eca140616c6..5cc648ddfb2b 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c @@ -618,7 +618,7 @@ struct mdp5_ctl_manager *mdp5_ctlm_init(struct drm_device *dev, unsigned long flags; int c, ret; - ctl_mgr = devm_kzalloc(dev->dev, sizeof(*ctl_mgr), GFP_KERNEL); + ctl_mgr = devm_kzalloc_obj(dev->dev, *ctl_mgr); if (!ctl_mgr) { DRM_DEV_ERROR(dev->dev, "failed to allocate CTL manager\n"); return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 3934cd060b27..ff6751b2ae62 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -685,7 +685,7 @@ static int interface_init(struct mdp5_kms *mdp5_kms) if (intf_types[i] == INTF_DISABLED) continue; - intf = devm_kzalloc(dev->dev, sizeof(*intf), GFP_KERNEL); + intf = devm_kzalloc_obj(dev->dev, *intf); if (!intf) { DRM_DEV_ERROR(dev->dev, "failed to construct INTF%d\n", i); return -ENOMEM; @@ -817,7 +817,7 @@ static int mdp5_dev_probe(struct platform_device *pdev) if (!msm_disp_drv_should_bind(&pdev->dev, false)) return -ENODEV; - mdp5_kms = devm_kzalloc(&pdev->dev, sizeof(*mdp5_kms), GFP_KERNEL); + mdp5_kms = devm_kzalloc_obj(&pdev->dev, *mdp5_kms); if (!mdp5_kms) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_mixer.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_mixer.c index 253b29629ed7..c920d4fea0fe 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_mixer.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_mixer.c @@ -149,7 +149,7 @@ struct mdp5_hw_mixer *mdp5_mixer_init(struct drm_device *dev, { struct mdp5_hw_mixer *mixer; - mixer = devm_kzalloc(dev->dev, sizeof(*mixer), GFP_KERNEL); + mixer = devm_kzalloc_obj(dev->dev, *mixer); if (!mixer) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c index 606e18973ea4..b830910a1619 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c @@ -157,7 +157,7 @@ struct mdp5_hw_pipe *mdp5_pipe_init(struct drm_device *dev, { struct mdp5_hw_pipe *hwpipe; - hwpipe = devm_kzalloc(dev->dev, sizeof(*hwpipe), GFP_KERNEL); + hwpipe = devm_kzalloc_obj(dev->dev, *hwpipe); if (!hwpipe) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c index 890d2f31510e..40dcc6dd1575 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c @@ -364,7 +364,7 @@ struct mdp5_smp *mdp5_smp_init(struct mdp5_kms *mdp5_kms, const struct mdp5_smp_ struct mdp5_global_state *global_state; struct mdp5_smp *smp; - smp = devm_kzalloc(dev->dev, sizeof(*smp), GFP_KERNEL); + smp = devm_kzalloc_obj(dev->dev, *smp); if (unlikely(!smp)) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/msm/dp/dp_audio.c b/drivers/gpu/drm/msm/dp/dp_audio.c index df222943ae57..8960f015612d 100644 --- a/drivers/gpu/drm/msm/dp/dp_audio.c +++ b/drivers/gpu/drm/msm/dp/dp_audio.c @@ -348,7 +348,7 @@ struct msm_dp_audio *msm_dp_audio_get(struct platform_device *pdev, goto error; } - audio = devm_kzalloc(&pdev->dev, sizeof(*audio), GFP_KERNEL); + audio = devm_kzalloc_obj(&pdev->dev, *audio); if (!audio) { rc = -ENOMEM; goto error; diff --git a/drivers/gpu/drm/msm/dp/dp_aux.c b/drivers/gpu/drm/msm/dp/dp_aux.c index 3825a2fb48e2..b52393dcc067 100644 --- a/drivers/gpu/drm/msm/dp/dp_aux.c +++ b/drivers/gpu/drm/msm/dp/dp_aux.c @@ -686,7 +686,7 @@ struct drm_dp_aux *msm_dp_aux_get(struct device *dev, { struct msm_dp_aux_private *aux; - aux = devm_kzalloc(dev, sizeof(*aux), GFP_KERNEL); + aux = devm_kzalloc_obj(dev, *aux); if (!aux) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c index abd3dcdad03c..47647fdec9de 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c @@ -2779,7 +2779,8 @@ static int msm_dp_ctrl_clk_init(struct msm_dp_ctrl *msm_dp_ctrl) dev = ctrl->dev; ctrl->num_core_clks = ARRAY_SIZE(core_clks); - ctrl->core_clks = devm_kcalloc(dev, ctrl->num_core_clks, sizeof(*ctrl->core_clks), GFP_KERNEL); + ctrl->core_clks = devm_kzalloc_objs(dev, *ctrl->core_clks, + ctrl->num_core_clks); if (!ctrl->core_clks) return -ENOMEM; @@ -2791,7 +2792,8 @@ static int msm_dp_ctrl_clk_init(struct msm_dp_ctrl *msm_dp_ctrl) return rc; ctrl->num_link_clks = ARRAY_SIZE(ctrl_clks); - ctrl->link_clks = devm_kcalloc(dev, ctrl->num_link_clks, sizeof(*ctrl->link_clks), GFP_KERNEL); + ctrl->link_clks = devm_kzalloc_objs(dev, *ctrl->link_clks, + ctrl->num_link_clks); if (!ctrl->link_clks) return -ENOMEM; @@ -2845,7 +2847,7 @@ struct msm_dp_ctrl *msm_dp_ctrl_get(struct device *dev, struct msm_dp_link *link return ERR_PTR(-EINVAL); } - ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(dev, *ctrl); if (!ctrl) { DRM_ERROR("Mem allocation failure\n"); return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/msm/dp/dp_debug.c b/drivers/gpu/drm/msm/dp/dp_debug.c index 00fb1a7ba40e..fe164270e789 100644 --- a/drivers/gpu/drm/msm/dp/dp_debug.c +++ b/drivers/gpu/drm/msm/dp/dp_debug.c @@ -210,7 +210,7 @@ int msm_dp_debug_init(struct device *dev, struct msm_dp_panel *panel, return -EINVAL; } - debug = devm_kzalloc(dev, sizeof(*debug), GFP_KERNEL); + debug = devm_kzalloc_obj(dev, *debug); if (!debug) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 9299ce616fdb..c0c150e2c575 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -1248,7 +1248,7 @@ static int msm_dp_display_probe(struct platform_device *pdev) return -ENODEV; } - dp = devm_kzalloc(&pdev->dev, sizeof(*dp), GFP_KERNEL); + dp = devm_kzalloc_obj(&pdev->dev, *dp); if (!dp) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/dp/dp_link.c b/drivers/gpu/drm/msm/dp/dp_link.c index 34a91e194a12..15cf692c23da 100644 --- a/drivers/gpu/drm/msm/dp/dp_link.c +++ b/drivers/gpu/drm/msm/dp/dp_link.c @@ -1333,7 +1333,7 @@ struct msm_dp_link *msm_dp_link_get(struct device *dev, struct drm_dp_aux *aux) return ERR_PTR(-EINVAL); } - link = devm_kzalloc(dev, sizeof(*link), GFP_KERNEL); + link = devm_kzalloc_obj(dev, *link); if (!link) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/msm/dp/dp_panel.c b/drivers/gpu/drm/msm/dp/dp_panel.c index d3468b73fdc3..7f89532a331a 100644 --- a/drivers/gpu/drm/msm/dp/dp_panel.c +++ b/drivers/gpu/drm/msm/dp/dp_panel.c @@ -807,7 +807,7 @@ struct msm_dp_panel *msm_dp_panel_get(struct device *dev, struct drm_dp_aux *aux return ERR_PTR(-EINVAL); } - panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL); + panel = devm_kzalloc_obj(dev, *panel); if (!panel) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index c726fc628a08..090726be5061 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -86,7 +86,7 @@ static struct msm_dsi *dsi_init(struct platform_device *pdev) if (!pdev) return ERR_PTR(-ENXIO); - msm_dsi = devm_kzalloc(&pdev->dev, sizeof(*msm_dsi), GFP_KERNEL); + msm_dsi = devm_kzalloc_obj(&pdev->dev, *msm_dsi); if (!msm_dsi) return ERR_PTR(-ENOMEM); DBG("dsi probed=%p", msm_dsi); diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index d92659d80f17..78f0fd259421 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -2011,7 +2011,7 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi) const struct msm_dsi_config *cfg; int ret; - msm_host = devm_kzalloc(&pdev->dev, sizeof(*msm_host), GFP_KERNEL); + msm_host = devm_kzalloc_obj(&pdev->dev, *msm_host); if (!msm_host) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c index 1fb3899b88bf..a14e71d8c8a4 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c @@ -617,13 +617,12 @@ static int dsi_phy_driver_probe(struct platform_device *pdev) u32 phy_type; int ret; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; - phy->provided_clocks = devm_kzalloc(dev, - struct_size(phy->provided_clocks, hws, NUM_PROVIDED_CLKS), - GFP_KERNEL); + phy->provided_clocks = devm_kzalloc_flex(dev, *phy->provided_clocks, + hws, NUM_PROVIDED_CLKS); if (!phy->provided_clocks) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c index ec486ff02c9b..12dac309f3af 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c @@ -679,7 +679,7 @@ static int dsi_pll_10nm_init(struct msm_dsi_phy *phy) struct dsi_pll_10nm *pll_10nm; int ret; - pll_10nm = devm_kzalloc(&pdev->dev, sizeof(*pll_10nm), GFP_KERNEL); + pll_10nm = devm_kzalloc_obj(&pdev->dev, *pll_10nm); if (!pll_10nm) return -ENOMEM; @@ -918,7 +918,7 @@ static int dsi_10nm_phy_parse_dt(struct msm_dsi_phy *phy) u8 level; int ret, i; - tuning_cfg = devm_kzalloc(dev, sizeof(*tuning_cfg), GFP_KERNEL); + tuning_cfg = devm_kzalloc_obj(dev, *tuning_cfg); if (!tuning_cfg) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c index a156c7e7cea8..bc0f11bb7e4c 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c @@ -781,7 +781,7 @@ static struct clk_hw *pll_14nm_postdiv_register(struct dsi_pll_14nm *pll_14nm, }; int ret; - pll_postdiv = devm_kzalloc(dev, sizeof(*pll_postdiv), GFP_KERNEL); + pll_postdiv = devm_kzalloc_obj(dev, *pll_postdiv); if (!pll_postdiv) return ERR_PTR(-ENOMEM); @@ -879,7 +879,7 @@ static int dsi_pll_14nm_init(struct msm_dsi_phy *phy) if (!pdev) return -ENODEV; - pll_14nm = devm_kzalloc(&pdev->dev, sizeof(*pll_14nm), GFP_KERNEL); + pll_14nm = devm_kzalloc_obj(&pdev->dev, *pll_14nm); if (!pll_14nm) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c index d00e415b9a99..d06208099804 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c @@ -698,7 +698,7 @@ static int dsi_pll_28nm_init(struct msm_dsi_phy *phy) if (!pdev) return -ENODEV; - pll_28nm = devm_kzalloc(&pdev->dev, sizeof(*pll_28nm), GFP_KERNEL); + pll_28nm = devm_kzalloc_obj(&pdev->dev, *pll_28nm); if (!pll_28nm) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c index 8dcce9581dc3..8b0fee435a5c 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c @@ -393,7 +393,7 @@ static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm, struct clk_hw **prov DBG("%d", pll_28nm->phy->id); - bytediv = devm_kzalloc(dev, sizeof(*bytediv), GFP_KERNEL); + bytediv = devm_kzalloc_obj(dev, *bytediv); if (!bytediv) return -ENOMEM; @@ -448,7 +448,7 @@ static int dsi_pll_28nm_8960_init(struct msm_dsi_phy *phy) if (!pdev) return -ENODEV; - pll_28nm = devm_kzalloc(&pdev->dev, sizeof(*pll_28nm), GFP_KERNEL); + pll_28nm = devm_kzalloc_obj(&pdev->dev, *pll_28nm); if (!pll_28nm) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c index 5d805a797abd..ce86dbf61889 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c @@ -863,7 +863,7 @@ static int dsi_pll_7nm_init(struct msm_dsi_phy *phy) struct dsi_pll_7nm *pll_7nm; int ret; - pll_7nm = devm_kzalloc(&pdev->dev, sizeof(*pll_7nm), GFP_KERNEL); + pll_7nm = devm_kzalloc_obj(&pdev->dev, *pll_7nm); if (!pll_7nm) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index 474006084633..133b4b1f17ab 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -276,7 +276,7 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev) if (!config) return -EINVAL; - hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL); + hdmi = devm_kzalloc_obj(dev, *hdmi); if (!hdmi) return -ENOMEM; @@ -320,9 +320,8 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev) goto err_put_bridge; } - hdmi->pwr_regs = devm_kcalloc(dev, config->pwr_reg_cnt, - sizeof(hdmi->pwr_regs[0]), - GFP_KERNEL); + hdmi->pwr_regs = devm_kzalloc_objs(dev, hdmi->pwr_regs[0], + config->pwr_reg_cnt); if (!hdmi->pwr_regs) { ret = -ENOMEM; goto err_put_bridge; @@ -337,9 +336,8 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev) goto err_put_bridge; } - hdmi->pwr_clks = devm_kcalloc(dev, config->pwr_clk_cnt, - sizeof(hdmi->pwr_clks[0]), - GFP_KERNEL); + hdmi->pwr_clks = devm_kzalloc_objs(dev, hdmi->pwr_clks[0], + config->pwr_clk_cnt); if (!hdmi->pwr_clks) { ret = -ENOMEM; goto err_put_bridge; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_phy.c b/drivers/gpu/drm/msm/hdmi/hdmi_phy.c index ebb600d77cd8..c805724dfda7 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_phy.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_phy.c @@ -14,13 +14,11 @@ static int msm_hdmi_phy_resource_init(struct hdmi_phy *phy) struct device *dev = &phy->pdev->dev; int i, ret; - phy->regs = devm_kcalloc(dev, cfg->num_regs, sizeof(phy->regs[0]), - GFP_KERNEL); + phy->regs = devm_kzalloc_objs(dev, phy->regs[0], cfg->num_regs); if (!phy->regs) return -ENOMEM; - phy->clks = devm_kcalloc(dev, cfg->num_clks, sizeof(phy->clks[0]), - GFP_KERNEL); + phy->clks = devm_kzalloc_objs(dev, phy->clks[0], cfg->num_clks); if (!phy->clks) return -ENOMEM; @@ -156,7 +154,7 @@ static int msm_hdmi_phy_probe(struct platform_device *pdev) struct hdmi_phy *phy; int ret; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENODEV; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c b/drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c index 71da20322b3d..44d509bf5db3 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c @@ -701,7 +701,7 @@ int msm_hdmi_pll_8996_init(struct platform_device *pdev) struct hdmi_pll_8996 *pll; int i, ret; - pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); + pll = devm_kzalloc_obj(dev, *pll); if (!pll) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_phy_8998.c b/drivers/gpu/drm/msm/hdmi/hdmi_phy_8998.c index 05c3ffad858d..19642e0dfc93 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_phy_8998.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_phy_8998.c @@ -705,7 +705,7 @@ int msm_hdmi_pll_8998_init(struct platform_device *pdev) struct hdmi_pll_8998 *pll; int ret, i; - pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); + pll = devm_kzalloc_obj(dev, *pll); if (!pll) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_pll_8960.c b/drivers/gpu/drm/msm/hdmi/hdmi_pll_8960.c index 6ba6bbdb7e05..14e58075ebf3 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_pll_8960.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_pll_8960.c @@ -431,7 +431,7 @@ int msm_hdmi_pll_8960_init(struct platform_device *pdev) if (WARN_ON(freqtbl[i].rate < freqtbl[i + 1].rate)) return -EINVAL; - pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); + pll = devm_kzalloc_obj(dev, *pll); if (!pll) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 5e8f3ce26b32..c3111deaa646 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1137,7 +1137,7 @@ int msm_drv_probe(struct device *master_dev, struct component_match *match = NULL; int ret; - priv = devm_kzalloc(master_dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(master_dev, *priv); if (!priv) return -ENOMEM; @@ -1178,7 +1178,7 @@ int msm_gpu_probe(struct platform_device *pdev, struct msm_drm_private *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c index e69b122f2687..259d362475c8 100644 --- a/drivers/gpu/drm/msm/msm_mdss.c +++ b/drivers/gpu/drm/msm/msm_mdss.c @@ -360,7 +360,8 @@ static int mdp5_mdss_parse_clock(struct platform_device *pdev, struct clk_bulk_d if (!pdev) return -EINVAL; - bulk = devm_kcalloc(&pdev->dev, MDP5_MDSS_NUM_CLOCKS, sizeof(struct clk_bulk_data), GFP_KERNEL); + bulk = devm_kzalloc_objs(&pdev->dev, struct clk_bulk_data, + MDP5_MDSS_NUM_CLOCKS); if (!bulk) return -ENOMEM; @@ -388,7 +389,7 @@ static struct msm_mdss *msm_mdss_init(struct platform_device *pdev, bool is_mdp5 if (ret) return ERR_PTR(ret); - msm_mdss = devm_kzalloc(&pdev->dev, sizeof(*msm_mdss), GFP_KERNEL); + msm_mdss = devm_kzalloc_obj(&pdev->dev, *msm_mdss); if (!msm_mdss) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c b/drivers/gpu/drm/mxsfb/lcdif_drv.c index e2173c4d6fc2..6e614480d1c8 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_drv.c +++ b/drivers/gpu/drm/mxsfb/lcdif_drv.c @@ -74,7 +74,7 @@ static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif) "Failed to get bridge for endpoint%u\n", of_ep.id); - encoder = devm_kzalloc(dev, sizeof(*encoder), GFP_KERNEL); + encoder = devm_kzalloc_obj(dev, *encoder); if (!encoder) return dev_err_probe(dev, -ENOMEM, "Failed to allocate encoder for endpoint%u\n", @@ -131,7 +131,7 @@ static int lcdif_load(struct drm_device *drm) struct lcdif_drm_private *lcdif; int ret; - lcdif = devm_kzalloc(&pdev->dev, sizeof(*lcdif), GFP_KERNEL); + lcdif = devm_kzalloc_obj(&pdev->dev, *lcdif); if (!lcdif) return -ENOMEM; diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index 641691fc92c8..87e829355893 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -247,7 +247,7 @@ static int mxsfb_load(struct drm_device *drm, struct device_node *ep; int ret; - mxsfb = devm_kzalloc(&pdev->dev, sizeof(*mxsfb), GFP_KERNEL); + mxsfb = devm_kzalloc_obj(&pdev->dev, *mxsfb); if (!mxsfb) return -ENOMEM; diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c index a4ac113e1690..0bfdb467b026 100644 --- a/drivers/gpu/drm/omapdrm/dss/base.c +++ b/drivers/gpu/drm/omapdrm/dss/base.c @@ -209,7 +209,7 @@ static void omapdss_walk_device(struct device *dev, struct device_node *node, if (ret < 0) return; - comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL); + comp = devm_kzalloc_obj(dev, *comp); if (comp) { comp->node = node; comp->dss_core_component = dss_core; diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 78b74217f952..2a23b4c59c29 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -3769,8 +3769,7 @@ static int dispc_init_gamma_tables(struct dispc_device *dispc) !dispc_has_feature(dispc, FEAT_MGR_LCD3)) continue; - gt = devm_kmalloc_array(&dispc->pdev->dev, gdesc->len, - sizeof(u32), GFP_KERNEL); + gt = devm_kmalloc_objs(&dispc->pdev->dev, u32, gdesc->len); if (!gt) return -ENOMEM; diff --git a/drivers/gpu/drm/omapdrm/dss/video-pll.c b/drivers/gpu/drm/omapdrm/dss/video-pll.c index b6b52049f753..8eedb09b16a2 100644 --- a/drivers/gpu/drm/omapdrm/dss/video-pll.c +++ b/drivers/gpu/drm/omapdrm/dss/video-pll.c @@ -163,7 +163,7 @@ struct dss_pll *dss_video_pll_init(struct dss_device *dss, return ERR_CAST(clk); } - vpll = devm_kzalloc(&pdev->dev, sizeof(*vpll), GFP_KERNEL); + vpll = devm_kzalloc_obj(&pdev->dev, *vpll); if (!vpll) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index f83b93a1a414..f7add22ccf69 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -782,7 +782,7 @@ static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel) u32 absent_ms = 0; int ret; - desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL); + desc = devm_kzalloc_obj(dev, *desc); if (!desc) return -ENOMEM; panel->desc = desc; diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c index 8115a3158492..0bab6f086717 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c @@ -494,8 +494,7 @@ static int ili9341_dpi_probe(struct spi_device *spi, struct gpio_desc *dc, if (IS_ERR(ili)) return PTR_ERR(ili); - ili->dbi = devm_kzalloc(dev, sizeof(struct mipi_dbi), - GFP_KERNEL); + ili->dbi = devm_kzalloc_obj(dev, struct mipi_dbi); if (!ili->dbi) return -ENOMEM; diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c index 89915d58f69d..086393ddcab7 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c @@ -119,7 +119,7 @@ static int ili9806e_dsi_probe(struct mipi_dsi_device *dsi) struct ili9806e_dsi_panel *ctx; int ret; - ctx = devm_kzalloc(dev, sizeof(struct ili9806e_dsi_panel), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, struct ili9806e_dsi_panel); if (!ctx) return -ENOMEM; diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-spi.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-spi.c index 187bcb084dd9..9271c3c89a7f 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-spi.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-spi.c @@ -109,7 +109,7 @@ static int ili9806e_spi_probe(struct spi_device *spi) struct ili9806e_spi_panel *ctx; int err; - ctx = devm_kzalloc(dev, sizeof(struct ili9806e_spi_panel), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, struct ili9806e_spi_panel); if (!ctx) return -ENOMEM; diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c index 80afeeab9475..a061d548ff0d 100644 --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c @@ -390,9 +390,8 @@ static int innolux_panel_add(struct mipi_dsi_device *dsi, innolux->desc = desc; - innolux->supplies = devm_kcalloc(dev, desc->num_supplies, - sizeof(*innolux->supplies), - GFP_KERNEL); + innolux->supplies = devm_kzalloc_objs(dev, *innolux->supplies, + desc->num_supplies); if (!innolux->supplies) return -ENOMEM; diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67191.c b/drivers/gpu/drm/panel/panel-raydium-rm67191.c index 2af6aa47a551..e3b806e8a3a7 100644 --- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c +++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c @@ -507,8 +507,8 @@ static int rad_init_regulators(struct rad_panel *rad) int i; rad->num_supplies = ARRAY_SIZE(rad_supply_names); - rad->supplies = devm_kcalloc(dev, rad->num_supplies, - sizeof(*rad->supplies), GFP_KERNEL); + rad->supplies = devm_kzalloc_objs(dev, *rad->supplies, + rad->num_supplies); if (!rad->supplies) return -ENOMEM; diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c index c8bec2b1e7c1..94cb84d179e2 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c @@ -48,7 +48,7 @@ static int s6e63m0_spi_probe(struct spi_device *spi) struct mipi_dbi *dbi; int ret; - dbi = devm_kzalloc(dev, sizeof(*dbi), GFP_KERNEL); + dbi = devm_kzalloc_obj(dev, *dbi); if (!dbi) return -ENOMEM; diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index a944c34642dc..bf2e1dd88f40 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -449,11 +449,11 @@ static struct panel_desc *panel_dpi_probe(struct device *dev) int ret; np = dev->of_node; - desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL); + desc = devm_kzalloc_obj(dev, *desc); if (!desc) return ERR_PTR(-ENOMEM); - timing = devm_kzalloc(dev, sizeof(*timing), GFP_KERNEL); + timing = devm_kzalloc_obj(dev, *timing); if (!timing) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/panel/panel-visionox-r66451.c b/drivers/gpu/drm/panel/panel-visionox-r66451.c index 1efb139bb711..bd4053f9e7af 100644 --- a/drivers/gpu/drm/panel/panel-visionox-r66451.c +++ b/drivers/gpu/drm/panel/panel-visionox-r66451.c @@ -261,7 +261,7 @@ static int visionox_r66451_probe(struct mipi_dsi_device *dsi) if (IS_ERR(ctx)) return PTR_ERR(ctx); - dsc = devm_kzalloc(dev, sizeof(*dsc), GFP_KERNEL); + dsc = devm_kzalloc_obj(dev, *dsc); if (!dsc) return -ENOMEM; diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c index fb0a1b45007b..40eda3612f84 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -146,9 +146,9 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev) { int ret, i; - pfdev->regulators = devm_kcalloc(pfdev->base.dev, pfdev->comp->num_supplies, - sizeof(*pfdev->regulators), - GFP_KERNEL); + pfdev->regulators = devm_kzalloc_objs(pfdev->base.dev, + *pfdev->regulators, + pfdev->comp->num_supplies); if (!pfdev->regulators) return -ENOMEM; diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c index 4ddf4b722ddf..3a46dd61cf87 100644 --- a/drivers/gpu/drm/panfrost/panfrost_job.c +++ b/drivers/gpu/drm/panfrost/panfrost_job.c @@ -869,7 +869,7 @@ int panfrost_jm_init(struct panfrost_device *pfdev) if (!panfrost_has_hw_feature(pfdev, HW_FEATURE_JOBCHAIN_DISAMBIGUATION)) args.credit_limit = 1; - js = devm_kzalloc(pfdev->base.dev, sizeof(*js), GFP_KERNEL); + js = devm_kzalloc_obj(pfdev->base.dev, *js); if (!js) return -ENOMEM; pfdev->js = js; diff --git a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c index a9def452d5ef..3e65589a1093 100644 --- a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c +++ b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c @@ -402,7 +402,7 @@ int panfrost_perfcnt_init(struct panfrost_device *pfdev) COUNTERS_PER_BLOCK * BYTES_PER_COUNTER; } - perfcnt = devm_kzalloc(pfdev->base.dev, sizeof(*perfcnt), GFP_KERNEL); + perfcnt = devm_kzalloc_obj(pfdev->base.dev, *perfcnt); if (!perfcnt) return -ENOMEM; diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index 89d44e970510..cbb09b446c2d 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -242,7 +242,7 @@ static int pl111_amba_probe(struct amba_device *amba_dev, struct drm_device *drm; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c b/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c index 5bced9d778e8..36762ec172d1 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c @@ -168,7 +168,7 @@ static int rcar_cmm_probe(struct platform_device *pdev) { struct rcar_cmm *rcmm; - rcmm = devm_kzalloc(&pdev->dev, sizeof(*rcmm), GFP_KERNEL); + rcmm = devm_kzalloc_obj(&pdev->dev, *rcmm); if (!rcmm) return -ENOMEM; platform_set_drvdata(pdev, rcmm); diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index ccdd4b9ecdb8..3a80600eece1 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -442,7 +442,7 @@ static int rockchip_dp_probe(struct platform_device *pdev) if (!dp_data) return -ENODEV; - dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL); + dp = devm_kzalloc_obj(dev, *dp); if (!dp) return -ENOMEM; diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index 68aa66915e8a..335177aacdef 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -1125,7 +1125,7 @@ static int cdn_dp_probe(struct platform_device *pdev) if (IS_ERR(extcon) || IS_ERR(phy)) continue; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c index aab3353945de..30d6f83cd5da 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -1409,7 +1409,7 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) of_device_get_match_data(dev); int ret, i; - dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); + dsi = devm_kzalloc_obj(dev, *dsi); if (!dsi) return -ENOMEM; diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c index 6db88665060d..3609ac34b911 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c @@ -385,7 +385,7 @@ static int dw_mipi_dsi2_rockchip_probe(struct platform_device *pdev) void __iomem *base; int i; - dsi2 = devm_kzalloc(dev, sizeof(*dsi2), GFP_KERNEL); + dsi2 = devm_kzalloc_obj(dev, *dsi2); if (!dsi2) return -ENOMEM; diff --git a/drivers/gpu/drm/rockchip/rk3066_hdmi.c b/drivers/gpu/drm/rockchip/rk3066_hdmi.c index 273f61758b10..d24f4832293e 100644 --- a/drivers/gpu/drm/rockchip/rk3066_hdmi.c +++ b/drivers/gpu/drm/rockchip/rk3066_hdmi.c @@ -650,7 +650,7 @@ static struct i2c_adapter *rk3066_hdmi_i2c_adapter(struct rk3066_hdmi *hdmi) struct rk3066_hdmi_i2c *i2c; int ret; - i2c = devm_kzalloc(hdmi->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(hdmi->dev, *i2c); if (!i2c) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 3099408e9d05..ba417f7e9e47 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -163,7 +163,7 @@ static int rockchip_drm_bind(struct device *dev) dev_set_drvdata(dev, drm_dev); - private = devm_kzalloc(drm_dev->dev, sizeof(*private), GFP_KERNEL); + private = devm_kzalloc_obj(drm_dev->dev, *private); if (!private) { ret = -ENOMEM; goto err_free; diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index b327a475b5bb..69e72727da24 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -2194,8 +2194,7 @@ static int vop_bind(struct device *dev, struct device *master, void *data) return -ENODEV; /* Allocate vop struct and its vop_win array */ - vop = devm_kzalloc(dev, struct_size(vop, win, vop_data->win_size), - GFP_KERNEL); + vop = devm_kzalloc_flex(dev, *vop, win, vop_data->win_size); if (!vop) return -ENOMEM; diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c index 505c6c56736d..9cd437dc8c93 100644 --- a/drivers/gpu/drm/rockchip/rockchip_lvds.c +++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c @@ -456,8 +456,7 @@ static int rk3288_lvds_probe(struct platform_device *pdev, return dev_err_probe(lvds->dev, PTR_ERR(lvds->pclk), "could not get or prepare pclk_lvds\n"); - lvds->pins = devm_kzalloc(lvds->dev, sizeof(*lvds->pins), - GFP_KERNEL); + lvds->pins = devm_kzalloc_obj(lvds->dev, *lvds->pins); if (!lvds->pins) return -ENOMEM; @@ -683,7 +682,7 @@ static int rockchip_lvds_probe(struct platform_device *pdev) if (!dev->of_node) return -ENODEV; - lvds = devm_kzalloc(&pdev->dev, sizeof(*lvds), GFP_KERNEL); + lvds = devm_kzalloc_obj(&pdev->dev, *lvds); if (!lvds) return -ENOMEM; diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c index 0e1830bc40ee..319a24f46a91 100644 --- a/drivers/gpu/drm/rockchip/rockchip_rgb.c +++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c @@ -87,7 +87,7 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev, struct drm_bridge *bridge; struct drm_connector *connector; - rgb = devm_kzalloc(dev, sizeof(*rgb), GFP_KERNEL); + rgb = devm_kzalloc_obj(dev, *rgb); if (!rgb) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitronix/st7571-i2c.c index 44bc94be33d6..c96490b6e499 100644 --- a/drivers/gpu/drm/sitronix/st7571-i2c.c +++ b/drivers/gpu/drm/sitronix/st7571-i2c.c @@ -88,7 +88,7 @@ static int st7571_i2c_probe(struct i2c_client *client) struct st7571_i2c_transport *t; struct regmap *regmap; - t = devm_kzalloc(&client->dev, sizeof(*t), GFP_KERNEL); + t = devm_kzalloc_obj(&client->dev, *t); if (!t) return -ENOMEM; diff --git a/drivers/gpu/drm/solomon/ssd130x-spi.c b/drivers/gpu/drm/solomon/ssd130x-spi.c index c41064aa8221..a938630a3c66 100644 --- a/drivers/gpu/drm/solomon/ssd130x-spi.c +++ b/drivers/gpu/drm/solomon/ssd130x-spi.c @@ -72,7 +72,7 @@ static int ssd130x_spi_probe(struct spi_device *spi) return dev_err_probe(dev, PTR_ERR(dc), "Failed to get dc gpio\n"); - t = devm_kzalloc(dev, sizeof(*t), GFP_KERNEL); + t = devm_kzalloc_obj(dev, *t); if (!t) return -ENOMEM; diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c index 23b0e1dc547a..48bf1ba035f7 100644 --- a/drivers/gpu/drm/sprd/sprd_dsi.c +++ b/drivers/gpu/drm/sprd/sprd_dsi.c @@ -1032,7 +1032,7 @@ static int sprd_dsi_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct sprd_dsi *dsi; - dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); + dsi = devm_kzalloc_obj(dev, *dsi); if (!dsi) return -ENOMEM; diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c index 8c529b0cca8b..b6ca9361532c 100644 --- a/drivers/gpu/drm/sti/sti_compositor.c +++ b/drivers/gpu/drm/sti/sti_compositor.c @@ -179,7 +179,7 @@ static int sti_compositor_probe(struct platform_device *pdev) struct sti_compositor *compo; unsigned int i; - compo = devm_kzalloc(dev, sizeof(*compo), GFP_KERNEL); + compo = devm_kzalloc_obj(dev, *compo); if (!compo) { DRM_ERROR("Failed to allocate compositor context\n"); return -ENOMEM; diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c index 6a3ddb7fc17d..66f56355309f 100644 --- a/drivers/gpu/drm/sti/sti_cursor.c +++ b/drivers/gpu/drm/sti/sti_cursor.c @@ -371,7 +371,7 @@ struct drm_plane *sti_cursor_create(struct drm_device *drm_dev, size_t size; int res; - cursor = devm_kzalloc(dev, sizeof(*cursor), GFP_KERNEL); + cursor = devm_kzalloc_obj(dev, *cursor); if (!cursor) { DRM_ERROR("Failed to allocate memory for cursor\n"); return NULL; diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c index cdb19b75f5e1..aafec7fec149 100644 --- a/drivers/gpu/drm/sti/sti_dvo.c +++ b/drivers/gpu/drm/sti/sti_dvo.c @@ -454,7 +454,7 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data) if (!encoder) return -ENOMEM; - connector = devm_kzalloc(dev, sizeof(*connector), GFP_KERNEL); + connector = devm_kzalloc_obj(dev, *connector); if (!connector) return -ENOMEM; diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index 89511abd4b39..d0c886029c57 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -926,7 +926,7 @@ struct drm_plane *sti_gdp_create(struct drm_device *drm_dev, struct sti_gdp *gdp; int res; - gdp = devm_kzalloc(dev, sizeof(*gdp), GFP_KERNEL); + gdp = devm_kzalloc_obj(dev, *gdp); if (!gdp) { DRM_ERROR("Failed to allocate memory for GDP\n"); return NULL; diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c index b4def2b25cec..0b95d3f07897 100644 --- a/drivers/gpu/drm/sti/sti_hda.c +++ b/drivers/gpu/drm/sti/sti_hda.c @@ -697,7 +697,7 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data) if (!encoder) return -ENOMEM; - connector = devm_kzalloc(dev, sizeof(*connector), GFP_KERNEL); + connector = devm_kzalloc_obj(dev, *connector); if (!connector) return -ENOMEM; diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index 7ba9e0b7ba6c..e7a092ce7fe8 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -1293,7 +1293,7 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) if (!encoder) return -EINVAL; - connector = devm_kzalloc(dev, sizeof(*connector), GFP_KERNEL); + connector = devm_kzalloc_obj(dev, *connector); if (!connector) return -EINVAL; diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c index b367f7f84f5f..360d213f2094 100644 --- a/drivers/gpu/drm/sti/sti_hqvdp.c +++ b/drivers/gpu/drm/sti/sti_hqvdp.c @@ -1360,7 +1360,7 @@ static int sti_hqvdp_probe(struct platform_device *pdev) DRM_DEBUG_DRIVER("\n"); - hqvdp = devm_kzalloc(dev, sizeof(*hqvdp), GFP_KERNEL); + hqvdp = devm_kzalloc_obj(dev, *hqvdp); if (!hqvdp) { DRM_ERROR("Failed to allocate HQVDP context\n"); return -ENOMEM; diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c index 06c1b81912f7..61f862e43f59 100644 --- a/drivers/gpu/drm/sti/sti_mixer.c +++ b/drivers/gpu/drm/sti/sti_mixer.c @@ -360,7 +360,7 @@ struct sti_mixer *sti_mixer_create(struct device *dev, int id, void __iomem *baseaddr) { - struct sti_mixer *mixer = devm_kzalloc(dev, sizeof(*mixer), GFP_KERNEL); + struct sti_mixer *mixer = devm_kzalloc_obj(dev, *mixer); dev_dbg(dev, "%s\n", __func__); if (!mixer) { diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c index 6a464b035de8..2f5ef863e8ff 100644 --- a/drivers/gpu/drm/sti/sti_tvout.c +++ b/drivers/gpu/drm/sti/sti_tvout.c @@ -660,7 +660,7 @@ sti_tvout_create_dvo_encoder(struct drm_device *dev, struct sti_tvout_encoder *encoder; struct drm_encoder *drm_encoder; - encoder = devm_kzalloc(tvout->dev, sizeof(*encoder), GFP_KERNEL); + encoder = devm_kzalloc_obj(tvout->dev, *encoder); if (!encoder) return NULL; @@ -712,7 +712,7 @@ static struct drm_encoder *sti_tvout_create_hda_encoder(struct drm_device *dev, struct sti_tvout_encoder *encoder; struct drm_encoder *drm_encoder; - encoder = devm_kzalloc(tvout->dev, sizeof(*encoder), GFP_KERNEL); + encoder = devm_kzalloc_obj(tvout->dev, *encoder); if (!encoder) return NULL; @@ -760,7 +760,7 @@ static struct drm_encoder *sti_tvout_create_hdmi_encoder(struct drm_device *dev, struct sti_tvout_encoder *encoder; struct drm_encoder *drm_encoder; - encoder = devm_kzalloc(tvout->dev, sizeof(*encoder), GFP_KERNEL); + encoder = devm_kzalloc_obj(tvout->dev, *encoder); if (!encoder) return NULL; @@ -844,7 +844,7 @@ static int sti_tvout_probe(struct platform_device *pdev) if (!node) return -ENODEV; - tvout = devm_kzalloc(dev, sizeof(*tvout), GFP_KERNEL); + tvout = devm_kzalloc_obj(dev, *tvout); if (!tvout) return -ENOMEM; diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c index 2d818397918d..d706d9eb0095 100644 --- a/drivers/gpu/drm/sti/sti_vid.c +++ b/drivers/gpu/drm/sti/sti_vid.c @@ -209,7 +209,7 @@ struct sti_vid *sti_vid_create(struct device *dev, struct drm_device *drm_dev, { struct sti_vid *vid; - vid = devm_kzalloc(dev, sizeof(*vid), GFP_KERNEL); + vid = devm_kzalloc_obj(dev, *vid); if (!vid) { DRM_ERROR("Failed to allocate memory for VID\n"); return NULL; diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c index ce6bc7e7b135..7d80cd8279c3 100644 --- a/drivers/gpu/drm/sti/sti_vtg.c +++ b/drivers/gpu/drm/sti/sti_vtg.c @@ -387,7 +387,7 @@ static int vtg_probe(struct platform_device *pdev) struct sti_vtg *vtg; int ret; - vtg = devm_kzalloc(dev, sizeof(*vtg), GFP_KERNEL); + vtg = devm_kzalloc_obj(dev, *vtg); if (!vtg) return -ENOMEM; vtg->regs = devm_platform_ioremap_resource(pdev, 0); diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c index a3eae5b2c26e..c9bd2c2e87ff 100644 --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c @@ -609,7 +609,7 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev) const struct dw_mipi_dsi_plat_data *pdata = of_device_get_match_data(dev); int ret; - dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); + dsi = devm_kzalloc_obj(dev, *dsi); if (!dsi) return -ENOMEM; diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index adf5b6e09ca6..f01ab79127c7 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c @@ -792,7 +792,7 @@ static int sun4i_backend_bind(struct device *dev, struct device *master, void __iomem *regs; int i, ret; - backend = devm_kzalloc(dev, sizeof(*backend), GFP_KERNEL); + backend = devm_kzalloc_obj(dev, *backend); if (!backend) return -ENOMEM; dev_set_drvdata(dev, backend); diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c index e6a20e2f0ade..f618df8f15ad 100644 --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c @@ -198,7 +198,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm, struct drm_plane *primary = NULL, *cursor = NULL; int ret, i; - scrtc = devm_kzalloc(drm->dev, sizeof(*scrtc), GFP_KERNEL); + scrtc = devm_kzalloc_obj(drm->dev, *scrtc); if (!scrtc) return ERR_PTR(-ENOMEM); scrtc->engine = engine; diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index e9baca360160..f8bbca6eb49c 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -69,7 +69,7 @@ static int sun4i_drv_bind(struct device *dev) if (IS_ERR(drm)) return PTR_ERR(drm); - drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(dev, *drv); if (!drv) { ret = -ENOMEM; goto free_drm; diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c index 5e9c4b97c84c..7dc0a09bb3c5 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c @@ -563,7 +563,7 @@ static int sun4i_frontend_bind(struct device *dev, struct device *master, struct sun4i_drv *drv = drm->dev_private; void __iomem *regs; - frontend = devm_kzalloc(dev, sizeof(*frontend), GFP_KERNEL); + frontend = devm_kzalloc_obj(dev, *frontend); if (!frontend) return -ENOMEM; diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c index b1beadb9bb59..2e2bd4de0317 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c @@ -117,7 +117,7 @@ int sun4i_ddc_create(struct sun4i_hdmi *hdmi, struct clk *parent) if (!parent_name) return -ENODEV; - ddc = devm_kzalloc(hdmi->dev, sizeof(*ddc), GFP_KERNEL); + ddc = devm_kzalloc_obj(hdmi->dev, *ddc); if (!ddc) return -ENOMEM; diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index 6f4fe0c8efae..721cd327b92f 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -520,7 +520,7 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master, u32 reg; int ret; - hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL); + hdmi = devm_kzalloc_obj(dev, *hdmi); if (!hdmi) return -ENOMEM; dev_set_drvdata(dev, hdmi); diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c index f5f62eb0eeca..c58930af56a9 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c @@ -297,7 +297,7 @@ int sun4i_hdmi_i2c_create(struct device *dev, struct sun4i_hdmi *hdmi) if (ret) return ret; - adap = devm_kzalloc(dev, sizeof(*adap), GFP_KERNEL); + adap = devm_kzalloc_obj(dev, *adap); if (!adap) return -ENOMEM; diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c index fbf7da9d9592..20c71d1916f6 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c @@ -214,7 +214,7 @@ int sun4i_tmds_create(struct sun4i_hdmi *hdmi) if (!parents[1]) return -ENODEV; - tmds = devm_kzalloc(hdmi->dev, sizeof(*tmds), GFP_KERNEL); + tmds = devm_kzalloc_obj(hdmi->dev, *tmds); if (!tmds) return -ENOMEM; diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c index 7ec6d8131908..cdfefbeee7b8 100644 --- a/drivers/gpu/drm/sun4i/sun4i_layer.c +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c @@ -193,7 +193,7 @@ static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm, struct sun4i_layer *layer; int ret; - layer = devm_kzalloc(drm->dev, sizeof(*layer), GFP_KERNEL); + layer = devm_kzalloc_obj(drm->dev, *layer); if (!layer) return ERR_PTR(-ENOMEM); @@ -234,8 +234,8 @@ struct drm_plane **sun4i_layers_init(struct drm_device *drm, int i; /* We need to have a sentinel at the need, hence the overallocation */ - planes = devm_kcalloc(drm->dev, SUN4I_BACKEND_NUM_LAYERS + 1, - sizeof(*planes), GFP_KERNEL); + planes = devm_kzalloc_objs(drm->dev, *planes, + SUN4I_BACKEND_NUM_LAYERS + 1); if (!planes) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/sun4i/sun4i_lvds.c b/drivers/gpu/drm/sun4i/sun4i_lvds.c index 6b98d20a8890..1073c985ff62 100644 --- a/drivers/gpu/drm/sun4i/sun4i_lvds.c +++ b/drivers/gpu/drm/sun4i/sun4i_lvds.c @@ -110,7 +110,7 @@ int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon) struct sun4i_lvds *lvds; int ret; - lvds = devm_kzalloc(drm->dev, sizeof(*lvds), GFP_KERNEL); + lvds = devm_kzalloc_obj(drm->dev, *lvds); if (!lvds) return -ENOMEM; encoder = &lvds->encoder; diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c index 3da9a9283c6e..94fda035a0ec 100644 --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c @@ -201,7 +201,7 @@ int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon) struct sun4i_rgb *rgb; int ret; - rgb = devm_kzalloc(drm->dev, sizeof(*rgb), GFP_KERNEL); + rgb = devm_kzalloc_obj(drm->dev, *rgb); if (!rgb) return -ENOMEM; rgb->tcon = tcon; diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index bf405a2aa324..20740fa10ce8 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -1127,7 +1127,7 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master, return -EPROBE_DEFER; } - tcon = devm_kzalloc(dev, sizeof(*tcon), GFP_KERNEL); + tcon = devm_kzalloc_obj(dev, *tcon); if (!tcon) return -ENOMEM; dev_set_drvdata(dev, tcon); diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c b/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c index 4afb12bd5281..f8cb096ef1f8 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c @@ -178,7 +178,7 @@ int sun4i_dclk_create(struct device *dev, struct sun4i_tcon *tcon) if (ret) return ret; - dclk = devm_kzalloc(dev, sizeof(*dclk), GFP_KERNEL); + dclk = devm_kzalloc_obj(dev, *dclk); if (!dclk) return -ENOMEM; dclk->tcon = tcon; diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c index ce22f1662c0c..8de687367270 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tv.c +++ b/drivers/gpu/drm/sun4i/sun4i_tv.c @@ -437,7 +437,7 @@ static int sun4i_tv_bind(struct device *dev, struct device *master, void __iomem *regs; int ret; - tv = devm_kzalloc(dev, sizeof(*tv), GFP_KERNEL); + tv = devm_kzalloc_obj(dev, *tv); if (!tv) return -ENOMEM; tv->drv = drv; diff --git a/drivers/gpu/drm/sun4i/sun6i_drc.c b/drivers/gpu/drm/sun4i/sun6i_drc.c index 0050c1b46ea8..5af6f07fe854 100644 --- a/drivers/gpu/drm/sun4i/sun6i_drc.c +++ b/drivers/gpu/drm/sun4i/sun6i_drc.c @@ -24,7 +24,7 @@ static int sun6i_drc_bind(struct device *dev, struct device *master, struct sun6i_drc *drc; int ret; - drc = devm_kzalloc(dev, sizeof(*drc), GFP_KERNEL); + drc = devm_kzalloc_obj(dev, *drc); if (!drc) return -ENOMEM; dev_set_drvdata(dev, drc); diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index d504ae583294..c4e3a2a8a2c1 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -1119,7 +1119,7 @@ static int sun6i_dsi_probe(struct platform_device *pdev) if (!variant) return -EINVAL; - dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); + dsi = devm_kzalloc_obj(dev, *dsi); if (!dsi) return -ENOMEM; dev_set_drvdata(dev, dsi); diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index bd3923ef5a41..cf1994341595 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -112,7 +112,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, if (!pdev->dev.of_node) return -ENODEV; - hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); + hdmi = devm_kzalloc_obj(&pdev->dev, *hdmi); if (!hdmi) return -ENOMEM; diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c index 489ea94693ff..0d284804e11f 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -677,7 +677,7 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev) struct sun8i_hdmi_phy *phy; void __iomem *regs; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c index a4d31fe3abff..1e7ec8156fe6 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c @@ -157,7 +157,7 @@ int sun8i_phy_clk_create(struct sun8i_hdmi_phy *phy, struct device *dev, return -ENODEV; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c index b6cd7352e76c..dbde80b32080 100644 --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c @@ -321,7 +321,7 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm, unsigned int phy_index; int i; - planes = devm_kcalloc(drm->dev, plane_cnt + 1, sizeof(*planes), GFP_KERNEL); + planes = devm_kzalloc_objs(drm->dev, *planes, plane_cnt + 1); if (!planes) return ERR_PTR(-ENOMEM); @@ -529,7 +529,7 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, return ret; } - mixer = devm_kzalloc(dev, sizeof(*mixer), GFP_KERNEL); + mixer = devm_kzalloc_obj(dev, *mixer); if (!mixer) return -ENOMEM; dev_set_drvdata(dev, mixer); diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c index 9cbd655518b2..86e1e8fed03a 100644 --- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c +++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c @@ -183,12 +183,11 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, quirks = of_device_get_match_data(&pdev->dev); - tcon_top = devm_kzalloc(dev, sizeof(*tcon_top), GFP_KERNEL); + tcon_top = devm_kzalloc_obj(dev, *tcon_top); if (!tcon_top) return -ENOMEM; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, CLK_NUM), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, CLK_NUM); if (!clk_data) return -ENOMEM; clk_data->num = CLK_NUM; diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c index bad102134726..cf66f676824e 100644 --- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c +++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c @@ -255,7 +255,7 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm, struct sun8i_layer *layer; int ret; - layer = devm_kzalloc(drm->dev, sizeof(*layer), GFP_KERNEL); + layer = devm_kzalloc_obj(drm->dev, *layer); if (!layer) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c index 2e9cda45c04e..6b19fafd50ad 100644 --- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c +++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c @@ -398,7 +398,7 @@ struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm, const u32 *formats; int ret; - layer = devm_kzalloc(drm->dev, sizeof(*layer), GFP_KERNEL); + layer = devm_kzalloc_obj(drm->dev, *layer); if (!layer) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/sysfb/simpledrm.c b/drivers/gpu/drm/sysfb/simpledrm.c index 21ddf4502ecc..deaeb7d1fd94 100644 --- a/drivers/gpu/drm/sysfb/simpledrm.c +++ b/drivers/gpu/drm/sysfb/simpledrm.c @@ -523,15 +523,13 @@ static int simpledrm_device_attach_genpd(struct simpledrm_device *sdev) if (sdev->pwr_dom_count <= 1) return 0; - sdev->pwr_dom_devs = devm_kcalloc(dev, sdev->pwr_dom_count, - sizeof(*sdev->pwr_dom_devs), - GFP_KERNEL); + sdev->pwr_dom_devs = devm_kzalloc_objs(dev, *sdev->pwr_dom_devs, + sdev->pwr_dom_count); if (!sdev->pwr_dom_devs) return -ENOMEM; - sdev->pwr_dom_links = devm_kcalloc(dev, sdev->pwr_dom_count, - sizeof(*sdev->pwr_dom_links), - GFP_KERNEL); + sdev->pwr_dom_links = devm_kzalloc_objs(dev, *sdev->pwr_dom_links, + sdev->pwr_dom_count); if (!sdev->pwr_dom_links) return -ENOMEM; diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index b0bfa946e697..c9df14544ced 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -3290,7 +3290,7 @@ static int tegra_dc_probe(struct platform_device *pdev) return err; } - dc = devm_kzalloc(&pdev->dev, sizeof(*dc), GFP_KERNEL); + dc = devm_kzalloc_obj(&pdev->dev, *dc); if (!dc) return -ENOMEM; diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c index e5297ac5c0fc..a61d153312f9 100644 --- a/drivers/gpu/drm/tegra/dpaux.c +++ b/drivers/gpu/drm/tegra/dpaux.c @@ -450,7 +450,7 @@ static int tegra_dpaux_probe(struct platform_device *pdev) u32 value; int err; - dpaux = devm_kzalloc(&pdev->dev, sizeof(*dpaux), GFP_KERNEL); + dpaux = devm_kzalloc_obj(&pdev->dev, *dpaux); if (!dpaux) return -ENOMEM; diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index 7b595310e737..b694c4abc564 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -1602,7 +1602,7 @@ static int tegra_dsi_probe(struct platform_device *pdev) struct tegra_dsi *dsi; int err; - dsi = devm_kzalloc(&pdev->dev, sizeof(*dsi), GFP_KERNEL); + dsi = devm_kzalloc_obj(&pdev->dev, *dsi); if (!dsi) return -ENOMEM; diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c index 892e3450b281..a190add03b08 100644 --- a/drivers/gpu/drm/tegra/gr2d.c +++ b/drivers/gpu/drm/tegra/gr2d.c @@ -236,7 +236,7 @@ static int gr2d_probe(struct platform_device *pdev) unsigned int i; int err; - gr2d = devm_kzalloc(dev, sizeof(*gr2d), GFP_KERNEL); + gr2d = devm_kzalloc_obj(dev, *gr2d); if (!gr2d) return -ENOMEM; @@ -244,7 +244,7 @@ static int gr2d_probe(struct platform_device *pdev) gr2d->soc = of_device_get_match_data(dev); - syncpts = devm_kzalloc(dev, sizeof(*syncpts), GFP_KERNEL); + syncpts = devm_kzalloc_obj(dev, *syncpts); if (!syncpts) return -ENOMEM; diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c index 1ec6ced959e4..930976fa0ab8 100644 --- a/drivers/gpu/drm/tegra/gr3d.c +++ b/drivers/gpu/drm/tegra/gr3d.c @@ -471,7 +471,7 @@ static int gr3d_probe(struct platform_device *pdev) unsigned int i; int err; - gr3d = devm_kzalloc(&pdev->dev, sizeof(*gr3d), GFP_KERNEL); + gr3d = devm_kzalloc_obj(&pdev->dev, *gr3d); if (!gr3d) return -ENOMEM; @@ -479,7 +479,7 @@ static int gr3d_probe(struct platform_device *pdev) gr3d->soc = of_device_get_match_data(&pdev->dev); - syncpts = devm_kzalloc(&pdev->dev, sizeof(*syncpts), GFP_KERNEL); + syncpts = devm_kzalloc_obj(&pdev->dev, *syncpts); if (!syncpts) return -ENOMEM; diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index 0d2c0ab0a63e..54880e5d5256 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c @@ -1800,7 +1800,7 @@ static int tegra_hdmi_probe(struct platform_device *pdev) struct tegra_hdmi *hdmi; int err; - hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); + hdmi = devm_kzalloc_obj(&pdev->dev, *hdmi); if (!hdmi) return -ENOMEM; diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c index 448f49f3a7d7..12429ca53ead 100644 --- a/drivers/gpu/drm/tegra/hub.c +++ b/drivers/gpu/drm/tegra/hub.c @@ -1074,7 +1074,7 @@ static int tegra_display_hub_probe(struct platform_device *pdev) return err; } - hub = devm_kzalloc(&pdev->dev, sizeof(*hub), GFP_KERNEL); + hub = devm_kzalloc_obj(&pdev->dev, *hub); if (!hub) return -ENOMEM; @@ -1106,8 +1106,8 @@ static int tegra_display_hub_probe(struct platform_device *pdev) return err; } - hub->wgrps = devm_kcalloc(&pdev->dev, hub->soc->num_wgrps, - sizeof(*hub->wgrps), GFP_KERNEL); + hub->wgrps = devm_kzalloc_objs(&pdev->dev, *hub->wgrps, + hub->soc->num_wgrps); if (!hub->wgrps) return -ENOMEM; @@ -1131,8 +1131,7 @@ static int tegra_display_hub_probe(struct platform_device *pdev) hub->num_heads = of_get_child_count(pdev->dev.of_node); - hub->clk_heads = devm_kcalloc(&pdev->dev, hub->num_heads, sizeof(clk), - GFP_KERNEL); + hub->clk_heads = devm_kzalloc_objs(&pdev->dev, clk, hub->num_heads); if (!hub->clk_heads) return -ENOMEM; diff --git a/drivers/gpu/drm/tegra/nvdec.c b/drivers/gpu/drm/tegra/nvdec.c index 7a38664e890e..18a8f6e4ced0 100644 --- a/drivers/gpu/drm/tegra/nvdec.c +++ b/drivers/gpu/drm/tegra/nvdec.c @@ -434,13 +434,13 @@ static int nvdec_probe(struct platform_device *pdev) return err; } - nvdec = devm_kzalloc(dev, sizeof(*nvdec), GFP_KERNEL); + nvdec = devm_kzalloc_obj(dev, *nvdec); if (!nvdec) return -ENOMEM; nvdec->config = of_device_get_match_data(dev); - syncpts = devm_kzalloc(dev, sizeof(*syncpts), GFP_KERNEL); + syncpts = devm_kzalloc_obj(dev, *syncpts); if (!syncpts) return -ENOMEM; diff --git a/drivers/gpu/drm/tegra/nvjpg.c b/drivers/gpu/drm/tegra/nvjpg.c index 94503fd0d52d..e302a8d1f6e7 100644 --- a/drivers/gpu/drm/tegra/nvjpg.c +++ b/drivers/gpu/drm/tegra/nvjpg.c @@ -243,7 +243,7 @@ static int nvjpg_probe(struct platform_device *pdev) return err; } - nvjpg = devm_kzalloc(dev, sizeof(*nvjpg), GFP_KERNEL); + nvjpg = devm_kzalloc_obj(dev, *nvjpg); if (!nvjpg) return -ENOMEM; diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c index b6d09a8d8e5e..40a02cf5939a 100644 --- a/drivers/gpu/drm/tegra/rgb.c +++ b/drivers/gpu/drm/tegra/rgb.c @@ -228,7 +228,7 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc) if (!of_device_is_available(np)) return -ENODEV; - rgb = devm_kzalloc(dc->dev, sizeof(*rgb), GFP_KERNEL); + rgb = devm_kzalloc_obj(dc->dev, *rgb); if (!rgb) return -ENOMEM; diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index e384cbd0cbf7..c7267921f04d 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -604,7 +604,7 @@ static struct clk *tegra_clk_sor_pad_register(struct tegra_sor *sor, struct clk_init_data init; struct clk *clk; - pad = devm_kzalloc(sor->dev, sizeof(*pad), GFP_KERNEL); + pad = devm_kzalloc_obj(sor->dev, *pad); if (!pad) return ERR_PTR(-ENOMEM); @@ -3747,7 +3747,7 @@ static int tegra_sor_probe(struct platform_device *pdev) struct tegra_sor *sor; int err; - sor = devm_kzalloc(&pdev->dev, sizeof(*sor), GFP_KERNEL); + sor = devm_kzalloc_obj(&pdev->dev, *sor); if (!sor) return -ENOMEM; diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index fe097e967551..3c2b1ff55deb 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -502,13 +502,13 @@ static int vic_probe(struct platform_device *pdev) return err; } - vic = devm_kzalloc(dev, sizeof(*vic), GFP_KERNEL); + vic = devm_kzalloc_obj(dev, *vic); if (!vic) return -ENOMEM; vic->config = of_device_get_match_data(dev); - syncpts = devm_kzalloc(dev, sizeof(*syncpts), GFP_KERNEL); + syncpts = devm_kzalloc_obj(dev, *syncpts); if (!syncpts) return -ENOMEM; diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c index 2a0ec11a6c90..b8568abafac5 100644 --- a/drivers/gpu/drm/tidss/tidss_dispc.c +++ b/drivers/gpu/drm/tidss/tidss_dispc.c @@ -2944,7 +2944,7 @@ int dispc_init(struct tidss_device *tidss) dma_set_max_seg_size(dev, UINT_MAX); - dispc = devm_kzalloc(dev, sizeof(*dispc), GFP_KERNEL); + dispc = devm_kzalloc_obj(dev, *dispc); if (!dispc) return -ENOMEM; @@ -2954,8 +2954,8 @@ int dispc_init(struct tidss_device *tidss) dispc_init_errata(dispc); - dispc->fourccs = devm_kcalloc(dev, ARRAY_SIZE(dispc_color_formats), - sizeof(*dispc->fourccs), GFP_KERNEL); + dispc->fourccs = devm_kzalloc_objs(dev, *dispc->fourccs, + ARRAY_SIZE(dispc_color_formats)); if (!dispc->fourccs) return -ENOMEM; @@ -3007,9 +3007,7 @@ int dispc_init(struct tidss_device *tidss) } dispc->vp_clk[i] = clk; - gamma_table = devm_kmalloc_array(dev, gamma_size, - sizeof(*gamma_table), - GFP_KERNEL); + gamma_table = devm_kmalloc_objs(dev, *gamma_table, gamma_size); if (!gamma_table) return -ENOMEM; dispc->vp_data[i].gamma_table = gamma_table; diff --git a/drivers/gpu/drm/tiny/panel-mipi-dbi.c b/drivers/gpu/drm/tiny/panel-mipi-dbi.c index 60cd65cae41d..3f462d79a6d3 100644 --- a/drivers/gpu/drm/tiny/panel-mipi-dbi.c +++ b/drivers/gpu/drm/tiny/panel-mipi-dbi.c @@ -170,7 +170,7 @@ panel_mipi_dbi_check_commands(struct device *dev, const struct firmware *fw) return ERR_PTR(-EINVAL); } - commands = devm_kzalloc(dev, sizeof(*commands), GFP_KERNEL); + commands = devm_kzalloc_obj(dev, *commands); if (!commands) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c index 2bcb9dc86ffd..f03e72363a78 100644 --- a/drivers/gpu/drm/tve200/tve200_drv.c +++ b/drivers/gpu/drm/tve200/tve200_drv.c @@ -152,7 +152,7 @@ static int tve200_probe(struct platform_device *pdev) int irq; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/drm/vboxvideo/vbox_main.c b/drivers/gpu/drm/vboxvideo/vbox_main.c index aa6664542b20..77c3ccad5b3d 100644 --- a/drivers/gpu/drm/vboxvideo/vbox_main.c +++ b/drivers/gpu/drm/vboxvideo/vbox_main.c @@ -35,8 +35,8 @@ static int vbox_accel_init(struct vbox_private *vbox) struct vbva_buffer *vbva; unsigned int i; - vbox->vbva_info = devm_kcalloc(vbox->ddev.dev, vbox->num_crtcs, - sizeof(*vbox->vbva_info), GFP_KERNEL); + vbox->vbva_info = devm_kzalloc_objs(vbox->ddev.dev, *vbox->vbva_info, + vbox->num_crtcs); if (!vbox->vbva_info) return -ENOMEM; @@ -156,9 +156,9 @@ int vbox_hw_init(struct vbox_private *vbox) return ret; } - vbox->last_mode_hints = devm_kcalloc(vbox->ddev.dev, vbox->num_crtcs, - sizeof(struct vbva_modehint), - GFP_KERNEL); + vbox->last_mode_hints = devm_kzalloc_objs(vbox->ddev.dev, + struct vbva_modehint, + vbox->num_crtcs); if (!vbox->last_mode_hints) return -ENOMEM; diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c index ed3bab119979..5c1c99533b30 100644 --- a/drivers/gpu/drm/vc4/vc4_v3d.c +++ b/drivers/gpu/drm/vc4/vc4_v3d.c @@ -403,7 +403,7 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data) struct vc4_v3d *v3d = NULL; int ret; - v3d = devm_kzalloc(&pdev->dev, sizeof(*v3d), GFP_KERNEL); + v3d = devm_kzalloc_obj(&pdev->dev, *v3d); if (!v3d) return -ENOMEM; diff --git a/drivers/gpu/drm/verisilicon/vs_dc.c b/drivers/gpu/drm/verisilicon/vs_dc.c index dad9967bc10b..f912da60575c 100644 --- a/drivers/gpu/drm/verisilicon/vs_dc.c +++ b/drivers/gpu/drm/verisilicon/vs_dc.c @@ -71,7 +71,7 @@ static int vs_dc_probe(struct platform_device *pdev) return ret; } - dc = devm_kzalloc(dev, sizeof(*dc), GFP_KERNEL); + dc = devm_kzalloc_obj(dev, *dc); if (!dc) return -ENOMEM; diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c index 5edeac961ec3..e11e429b98c7 100644 --- a/drivers/gpu/drm/xe/xe_hwmon.c +++ b/drivers/gpu/drm/xe/xe_hwmon.c @@ -1573,7 +1573,7 @@ int xe_hwmon_register(struct xe_device *xe) if (IS_SRIOV_VF(xe)) return 0; - hwmon = devm_kzalloc(dev, sizeof(*hwmon), GFP_KERNEL); + hwmon = devm_kzalloc_obj(dev, *hwmon); if (!hwmon) return -ENOMEM; diff --git a/drivers/gpu/drm/xe/xe_i2c.c b/drivers/gpu/drm/xe/xe_i2c.c index b82caaff80d7..27784636b7b7 100644 --- a/drivers/gpu/drm/xe/xe_i2c.c +++ b/drivers/gpu/drm/xe/xe_i2c.c @@ -360,7 +360,7 @@ int xe_i2c_probe(struct xe_device *xe) if (ep.cookie != XE_I2C_EP_COOKIE_DEVICE) return 0; - i2c = devm_kzalloc(drm_dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(drm_dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/gpu/drm/xe/xe_sysctrl.c b/drivers/gpu/drm/xe/xe_sysctrl.c index 4067e1dfdcd5..5abb1a8c9134 100644 --- a/drivers/gpu/drm/xe/xe_sysctrl.c +++ b/drivers/gpu/drm/xe/xe_sysctrl.c @@ -85,7 +85,7 @@ int xe_sysctrl_init(struct xe_device *xe) if (!xe->info.has_sysctrl) return 0; - sc->mmio = devm_kzalloc(xe->drm.dev, sizeof(*sc->mmio), GFP_KERNEL); + sc->mmio = devm_kzalloc_obj(xe->drm.dev, *sc->mmio); if (!sc->mmio) return -ENOMEM; diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c index e1890d0c7369..19d120569a4e 100644 --- a/drivers/gpu/drm/xen/xen_drm_front.c +++ b/drivers/gpu/drm/xen/xen_drm_front.c @@ -695,8 +695,7 @@ static int xen_drv_probe(struct xenbus_device *xb_dev, return ret; } - front_info = devm_kzalloc(&xb_dev->dev, - sizeof(*front_info), GFP_KERNEL); + front_info = devm_kzalloc_obj(&xb_dev->dev, *front_info); if (!front_info) return -ENOMEM; diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp_audio.c b/drivers/gpu/drm/xlnx/zynqmp_dp_audio.c index 1a46a046103f..3410938ffef5 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp_audio.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp_audio.c @@ -308,7 +308,7 @@ int zynqmp_audio_init(struct zynqmp_dpsub *dpsub) if (!dpsub->aud_clk) return 0; - audio = devm_kzalloc(dev, sizeof(*audio), GFP_KERNEL); + audio = devm_kzalloc_obj(dev, *audio); if (!audio) return -ENOMEM; diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c index e1106fbcc4ef..faaab789ccdb 100644 --- a/drivers/gpu/host1x/dev.c +++ b/drivers/gpu/host1x/dev.c @@ -599,7 +599,7 @@ static int host1x_probe(struct platform_device *pdev) struct host1x *host; int err, i; - host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(&pdev->dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/gpu/host1x/intr.c b/drivers/gpu/host1x/intr.c index 6a383e0c6eb9..30f3dff4487b 100644 --- a/drivers/gpu/host1x/intr.c +++ b/drivers/gpu/host1x/intr.c @@ -116,7 +116,8 @@ int host1x_intr_init(struct host1x *host) INIT_LIST_HEAD(&syncpt->fences.list); } - irq_data = devm_kcalloc(host->dev, host->num_syncpt_irqs, sizeof(irq_data[0]), GFP_KERNEL); + irq_data = devm_kzalloc_objs(host->dev, irq_data[0], + host->num_syncpt_irqs); if (!irq_data) return -ENOMEM; diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c index 5cc3cd46d321..fe74ff6fc6f2 100644 --- a/drivers/gpu/host1x/syncpt.c +++ b/drivers/gpu/host1x/syncpt.c @@ -293,13 +293,11 @@ int host1x_syncpt_init(struct host1x *host) struct host1x_syncpt *syncpt; unsigned int i; - syncpt = devm_kcalloc(host->dev, host->info->nb_pts, sizeof(*syncpt), - GFP_KERNEL); + syncpt = devm_kzalloc_objs(host->dev, *syncpt, host->info->nb_pts); if (!syncpt) return -ENOMEM; - bases = devm_kcalloc(host->dev, host->info->nb_bases, sizeof(*bases), - GFP_KERNEL); + bases = devm_kzalloc_objs(host->dev, *bases, host->info->nb_bases); if (!bases) return -ENOMEM; diff --git a/drivers/gpu/host1x/tegra114-mipi.c b/drivers/gpu/host1x/tegra114-mipi.c index c084a09784d1..49ed05d1a623 100644 --- a/drivers/gpu/host1x/tegra114-mipi.c +++ b/drivers/gpu/host1x/tegra114-mipi.c @@ -449,7 +449,7 @@ static int tegra_mipi_probe(struct platform_device *pdev) if (!match) return -ENODEV; - mipi = devm_kzalloc(&pdev->dev, sizeof(*mipi), GFP_KERNEL); + mipi = devm_kzalloc_obj(&pdev->dev, *mipi); if (!mipi) return -ENOMEM; diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c index 5db100bb1e4d..d18c68e2a555 100644 --- a/drivers/gpu/ipu-v3/ipu-common.c +++ b/drivers/gpu/ipu-v3/ipu-common.c @@ -1290,7 +1290,7 @@ static int ipu_probe(struct platform_device *pdev) ipu_base = res->start; - ipu = devm_kzalloc(&pdev->dev, sizeof(*ipu), GFP_KERNEL); + ipu = devm_kzalloc_obj(&pdev->dev, *ipu); if (!ipu) return -ENODEV; diff --git a/drivers/gpu/ipu-v3/ipu-cpmem.c b/drivers/gpu/ipu-v3/ipu-cpmem.c index 07866b1369c6..ed5bfe42c316 100644 --- a/drivers/gpu/ipu-v3/ipu-cpmem.c +++ b/drivers/gpu/ipu-v3/ipu-cpmem.c @@ -930,7 +930,7 @@ int ipu_cpmem_init(struct ipu_soc *ipu, struct device *dev, unsigned long base) { struct ipu_cpmem *cpmem; - cpmem = devm_kzalloc(dev, sizeof(*cpmem), GFP_KERNEL); + cpmem = devm_kzalloc_obj(dev, *cpmem); if (!cpmem) return -ENOMEM; diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c index d576b7d28437..9d41bdd5af21 100644 --- a/drivers/gpu/ipu-v3/ipu-csi.c +++ b/drivers/gpu/ipu-v3/ipu-csi.c @@ -683,7 +683,7 @@ int ipu_csi_init(struct ipu_soc *ipu, struct device *dev, int id, if (id > 1) return -ENODEV; - csi = devm_kzalloc(dev, sizeof(*csi), GFP_KERNEL); + csi = devm_kzalloc_obj(dev, *csi); if (!csi) return -ENOMEM; diff --git a/drivers/gpu/ipu-v3/ipu-dc.c b/drivers/gpu/ipu-v3/ipu-dc.c index b038a6d7307b..73f2f985e387 100644 --- a/drivers/gpu/ipu-v3/ipu-dc.c +++ b/drivers/gpu/ipu-v3/ipu-dc.c @@ -349,7 +349,7 @@ int ipu_dc_init(struct ipu_soc *ipu, struct device *dev, }; int i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/ipu-v3/ipu-di.c b/drivers/gpu/ipu-v3/ipu-di.c index 0a34e0ab4fe6..d420bd577a23 100644 --- a/drivers/gpu/ipu-v3/ipu-di.c +++ b/drivers/gpu/ipu-v3/ipu-di.c @@ -717,7 +717,7 @@ int ipu_di_init(struct ipu_soc *ipu, struct device *dev, int id, if (id > 1) return -ENODEV; - di = devm_kzalloc(dev, sizeof(*di), GFP_KERNEL); + di = devm_kzalloc_obj(dev, *di); if (!di) return -ENOMEM; diff --git a/drivers/gpu/ipu-v3/ipu-dmfc.c b/drivers/gpu/ipu-v3/ipu-dmfc.c index ae682084a10a..d512e5df7ab4 100644 --- a/drivers/gpu/ipu-v3/ipu-dmfc.c +++ b/drivers/gpu/ipu-v3/ipu-dmfc.c @@ -175,7 +175,7 @@ int ipu_dmfc_init(struct ipu_soc *ipu, struct device *dev, unsigned long base, struct ipu_dmfc_priv *priv; int i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/ipu-v3/ipu-dp.c b/drivers/gpu/ipu-v3/ipu-dp.c index 6a558205db96..bfe388ebcad1 100644 --- a/drivers/gpu/ipu-v3/ipu-dp.c +++ b/drivers/gpu/ipu-v3/ipu-dp.c @@ -346,7 +346,7 @@ int ipu_dp_init(struct ipu_soc *ipu, struct device *dev, unsigned long base) struct ipu_dp_priv *priv; int i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; priv->dev = dev; diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c index acd76ecc5221..3f0c1d97eb48 100644 --- a/drivers/gpu/ipu-v3/ipu-ic.c +++ b/drivers/gpu/ipu-v3/ipu-ic.c @@ -627,7 +627,7 @@ int ipu_ic_init(struct ipu_soc *ipu, struct device *dev, struct ipu_ic_priv *priv; int i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c index 493be4d4b091..b1c867229cae 100644 --- a/drivers/gpu/ipu-v3/ipu-image-convert.c +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c @@ -2428,7 +2428,7 @@ int ipu_image_convert_init(struct ipu_soc *ipu, struct device *dev) struct ipu_image_convert_priv *priv; int i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/ipu-v3/ipu-pre.c b/drivers/gpu/ipu-v3/ipu-pre.c index 7aac70368b00..394081114faa 100644 --- a/drivers/gpu/ipu-v3/ipu-pre.c +++ b/drivers/gpu/ipu-v3/ipu-pre.c @@ -312,7 +312,7 @@ static int ipu_pre_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct ipu_pre *pre; - pre = devm_kzalloc(dev, sizeof(*pre), GFP_KERNEL); + pre = devm_kzalloc_obj(dev, *pre); if (!pre) return -ENOMEM; diff --git a/drivers/gpu/ipu-v3/ipu-prg.c b/drivers/gpu/ipu-v3/ipu-prg.c index d38d3ba54d72..9fd5c7092319 100644 --- a/drivers/gpu/ipu-v3/ipu-prg.c +++ b/drivers/gpu/ipu-v3/ipu-prg.c @@ -362,7 +362,7 @@ static int ipu_prg_probe(struct platform_device *pdev) u32 val; int i, ret; - prg = devm_kzalloc(dev, sizeof(*prg), GFP_KERNEL); + prg = devm_kzalloc_obj(dev, *prg); if (!prg) return -ENOMEM; diff --git a/drivers/gpu/ipu-v3/ipu-smfc.c b/drivers/gpu/ipu-v3/ipu-smfc.c index 46ffc0a5906d..ff283484d5b8 100644 --- a/drivers/gpu/ipu-v3/ipu-smfc.c +++ b/drivers/gpu/ipu-v3/ipu-smfc.c @@ -175,7 +175,7 @@ int ipu_smfc_init(struct ipu_soc *ipu, struct device *dev, struct ipu_smfc_priv *priv; int i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/gpu/ipu-v3/ipu-vdi.c b/drivers/gpu/ipu-v3/ipu-vdi.c index af9631fd4256..279f724eb0a4 100644 --- a/drivers/gpu/ipu-v3/ipu-vdi.c +++ b/drivers/gpu/ipu-v3/ipu-vdi.c @@ -200,7 +200,7 @@ int ipu_vdi_init(struct ipu_soc *ipu, struct device *dev, { struct ipu_vdi *vdi; - vdi = devm_kzalloc(dev, sizeof(*vdi), GFP_KERNEL); + vdi = devm_kzalloc_obj(dev, *vdi); if (!vdi) return -ENOMEM; diff --git a/drivers/greybus/gb-beagleplay.c b/drivers/greybus/gb-beagleplay.c index 244966d56c9b..13cbd8c5e9d4 100644 --- a/drivers/greybus/gb-beagleplay.c +++ b/drivers/greybus/gb-beagleplay.c @@ -1191,7 +1191,7 @@ static int gb_beagleplay_probe(struct serdev_device *serdev) int ret = 0; struct gb_beagleplay *bg; - bg = devm_kmalloc(&serdev->dev, sizeof(*bg), GFP_KERNEL); + bg = devm_kmalloc_obj(&serdev->dev, *bg); if (!bg) return -ENOMEM; diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c index b3cb13b8c5e8..443922bb2052 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c @@ -444,7 +444,7 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i dmi_check_system(dmi_sfh_table); - privdata = devm_kzalloc(&pdev->dev, sizeof(*privdata), GFP_KERNEL); + privdata = devm_kzalloc_obj(&pdev->dev, *privdata); if (!privdata) return -ENOMEM; @@ -477,7 +477,7 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i return rc; } - privdata->cl_data = devm_kzalloc(&pdev->dev, sizeof(struct amdtp_cl_data), GFP_KERNEL); + privdata->cl_data = devm_kzalloc_obj(&pdev->dev, struct amdtp_cl_data); if (!privdata->cl_data) return -ENOMEM; diff --git a/drivers/hid/hid-a4tech.c b/drivers/hid/hid-a4tech.c index 54bfaf61182b..42ff8c6a2e55 100644 --- a/drivers/hid/hid-a4tech.c +++ b/drivers/hid/hid-a4tech.c @@ -115,7 +115,7 @@ static int a4_probe(struct hid_device *hdev, const struct hid_device_id *id) struct a4tech_sc *a4; int ret; - a4 = devm_kzalloc(&hdev->dev, sizeof(*a4), GFP_KERNEL); + a4 = devm_kzalloc_obj(&hdev->dev, *a4); if (a4 == NULL) { hid_err(hdev, "can't alloc device descriptor\n"); return -ENOMEM; diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c index 0556cb5645eb..19e40d402aa8 100644 --- a/drivers/hid/hid-alps.c +++ b/drivers/hid/hid-alps.c @@ -788,7 +788,7 @@ static int alps_probe(struct hid_device *hdev, const struct hid_device_id *id) { struct alps_dev *data = NULL; int ret; - data = devm_kzalloc(&hdev->dev, sizeof(struct alps_dev), GFP_KERNEL); + data = devm_kzalloc_obj(&hdev->dev, struct alps_dev); if (!data) return -ENOMEM; diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index 5b32fb8c77f3..82d085f63030 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c @@ -859,7 +859,7 @@ static int apple_backlight_init(struct hid_device *hdev) hid_dbg(hdev, "backlight config: off=%u, on_min=%u, on_max=%u\n", rep->backlight_off, rep->backlight_on_min, rep->backlight_on_max); - asc->backlight = devm_kzalloc(&hdev->dev, sizeof(*asc->backlight), GFP_KERNEL); + asc->backlight = devm_kzalloc_obj(&hdev->dev, *asc->backlight); if (!asc->backlight) { ret = -ENOMEM; goto cleanup_and_exit; @@ -930,7 +930,7 @@ static int apple_magic_backlight_init(struct hid_device *hdev) if (hdev->collection[0].usage != HID_USAGE_MAGIC_BL) return -ENODEV; - backlight = devm_kzalloc(&hdev->dev, sizeof(*backlight), GFP_KERNEL); + backlight = devm_kzalloc_obj(&hdev->dev, *backlight); if (!backlight) return -ENOMEM; @@ -963,7 +963,7 @@ static int apple_probe(struct hid_device *hdev, if (quirks & APPLE_IGNORE_MOUSE && hdev->type == HID_TYPE_USBMOUSE) return -ENODEV; - asc = devm_kzalloc(&hdev->dev, sizeof(*asc), GFP_KERNEL); + asc = devm_kzalloc_obj(&hdev->dev, *asc); if (asc == NULL) { hid_err(hdev, "can't alloc apple descriptor\n"); return -ENOMEM; diff --git a/drivers/hid/hid-appleir.c b/drivers/hid/hid-appleir.c index adaa44a858ed..22b80c4bde7b 100644 --- a/drivers/hid/hid-appleir.c +++ b/drivers/hid/hid-appleir.c @@ -296,7 +296,7 @@ static int appleir_probe(struct hid_device *hid, const struct hid_device_id *id) int ret; struct appleir *appleir; - appleir = devm_kzalloc(&hid->dev, sizeof(struct appleir), GFP_KERNEL); + appleir = devm_kzalloc_obj(&hid->dev, struct appleir); if (!appleir) return -ENOMEM; diff --git a/drivers/hid/hid-appletb-bl.c b/drivers/hid/hid-appletb-bl.c index bad2aead8780..f5015fbe224e 100644 --- a/drivers/hid/hid-appletb-bl.c +++ b/drivers/hid/hid-appletb-bl.c @@ -124,7 +124,7 @@ static int appletb_bl_probe(struct hid_device *hdev, const struct hid_device_id if (aux1_field->report != brightness_field->report) return dev_err_probe(dev, -ENODEV, "Encountered unexpected report structure\n"); - bl = devm_kzalloc(dev, sizeof(*bl), GFP_KERNEL); + bl = devm_kzalloc_obj(dev, *bl); if (!bl) return -ENOMEM; diff --git a/drivers/hid/hid-appletb-kbd.c b/drivers/hid/hid-appletb-kbd.c index 3cc3a13b71a6..ed82945be762 100644 --- a/drivers/hid/hid-appletb-kbd.c +++ b/drivers/hid/hid-appletb-kbd.c @@ -447,7 +447,7 @@ static int appletb_kbd_probe(struct hid_device *hdev, const struct hid_device_id if (!mode_field) return -ENODEV; - kbd = devm_kzalloc(dev, sizeof(*kbd), GFP_KERNEL); + kbd = devm_kzalloc_obj(dev, *kbd); if (!kbd) return -ENOMEM; diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index f6aa1be09ad5..d7b044b3a831 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -816,7 +816,7 @@ static void asus_work(struct work_struct *work) static int asus_worker_create(struct hid_device *hdev, struct asus_drvdata *drvdata) { - drvdata->worker = devm_kzalloc(&hdev->dev, sizeof(struct asus_worker), GFP_KERNEL); + drvdata->worker = devm_kzalloc_obj(&hdev->dev, struct asus_worker); if (!drvdata->worker) return -ENOMEM; @@ -1439,7 +1439,7 @@ static int asus_xgm_init(struct hid_device *hdev, struct asus_drvdata *drvdata) const char *name; int ret; - drvdata->xgm_led = devm_kzalloc(&hdev->dev, sizeof(*drvdata->xgm_led), GFP_KERNEL); + drvdata->xgm_led = devm_kzalloc_obj(&hdev->dev, *drvdata->xgm_led); if (drvdata->xgm_led == NULL) return -ENOMEM; @@ -1513,7 +1513,7 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) bool is_vendor = false; int ret; - drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&hdev->dev, *drvdata); if (drvdata == NULL) return -ENOMEM; diff --git a/drivers/hid/hid-bigbenff.c b/drivers/hid/hid-bigbenff.c index 3c87317ccc6b..08e0e9ab37ca 100644 --- a/drivers/hid/hid-bigbenff.c +++ b/drivers/hid/hid-bigbenff.c @@ -435,7 +435,7 @@ static int bigben_probe(struct hid_device *hid, const struct hid_device_id *id) struct bigben_device *bigben; int error; - bigben = devm_kzalloc(&hid->dev, sizeof(*bigben), GFP_KERNEL); + bigben = devm_kzalloc_obj(&hid->dev, *bigben); if (!bigben) return -ENOMEM; diff --git a/drivers/hid/hid-corsair-void.c b/drivers/hid/hid-corsair-void.c index 7be8c974d11e..1b12eb190fa0 100644 --- a/drivers/hid/hid-corsair-void.c +++ b/drivers/hid/hid-corsair-void.c @@ -649,8 +649,7 @@ static int corsair_void_probe(struct hid_device *hid_dev, if (!hid_is_usb(hid_dev)) return -EINVAL; - drvdata = devm_kzalloc(&hid_dev->dev, sizeof(*drvdata), - GFP_KERNEL); + drvdata = devm_kzalloc_obj(&hid_dev->dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hid/hid-corsair.c b/drivers/hid/hid-corsair.c index 278c6efb565d..3e80f22c6cc8 100644 --- a/drivers/hid/hid-corsair.c +++ b/drivers/hid/hid-corsair.c @@ -561,8 +561,7 @@ static int corsair_probe(struct hid_device *dev, const struct hid_device_id *id) usbif = to_usb_interface(dev->dev.parent); - drvdata = devm_kzalloc(&dev->dev, sizeof(struct corsair_drvdata), - GFP_KERNEL); + drvdata = devm_kzalloc_obj(&dev->dev, struct corsair_drvdata); if (drvdata == NULL) return -ENOMEM; drvdata->quirks = quirks; diff --git a/drivers/hid/hid-cougar.c b/drivers/hid/hid-cougar.c index 7156658166f5..c8ae18f13223 100644 --- a/drivers/hid/hid-cougar.c +++ b/drivers/hid/hid-cougar.c @@ -198,7 +198,7 @@ static int cougar_probe(struct hid_device *hdev, unsigned int connect_mask; int error; - cougar = devm_kzalloc(&hdev->dev, sizeof(*cougar), GFP_KERNEL); + cougar = devm_kzalloc_obj(&hdev->dev, *cougar); if (!cougar) return -ENOMEM; hid_set_drvdata(hdev, cougar); diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index 6b938f75e72f..597797155dcf 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -1227,7 +1227,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) u32 addr; int ret; - dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&hdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/hid/hid-creative-sb0540.c b/drivers/hid/hid-creative-sb0540.c index dfd6add353d1..ecbd148d7b98 100644 --- a/drivers/hid/hid-creative-sb0540.c +++ b/drivers/hid/hid-creative-sb0540.c @@ -223,8 +223,7 @@ static int creative_sb0540_probe(struct hid_device *hid, int ret; struct creative_sb0540 *creative_sb0540; - creative_sb0540 = devm_kzalloc(&hid->dev, - sizeof(struct creative_sb0540), GFP_KERNEL); + creative_sb0540 = devm_kzalloc_obj(&hid->dev, struct creative_sb0540); if (!creative_sb0540) return -ENOMEM; diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c index f18fddc176d0..282c76fb5634 100644 --- a/drivers/hid/hid-cypress.c +++ b/drivers/hid/hid-cypress.c @@ -135,7 +135,7 @@ static int cp_probe(struct hid_device *hdev, const struct hid_device_id *id) int ret; struct cp_device *cp_device; - cp_device = devm_kzalloc(&hdev->dev, sizeof(*cp_device), GFP_KERNEL); + cp_device = devm_kzalloc_obj(&hdev->dev, *cp_device); if (!cp_device) return -ENOMEM; diff --git a/drivers/hid/hid-elan.c b/drivers/hid/hid-elan.c index 0190ad567ce4..7c6ba1adfd98 100644 --- a/drivers/hid/hid-elan.c +++ b/drivers/hid/hid-elan.c @@ -463,7 +463,7 @@ static int elan_probe(struct hid_device *hdev, const struct hid_device_id *id) int ret; struct elan_drvdata *drvdata; - drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&hdev->dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 64c9c940db46..3bcae8cf814e 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -1010,7 +1010,7 @@ static int ft260_probe(struct hid_device *hdev, const struct hid_device_id *id) if (!hid_is_usb(hdev)) return -EINVAL; - dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&hdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/hid/hid-goodix-spi.c b/drivers/hid/hid-goodix-spi.c index 03d549efbdce..a2c6b92f74ee 100644 --- a/drivers/hid/hid-goodix-spi.c +++ b/drivers/hid/hid-goodix-spi.c @@ -686,7 +686,7 @@ static int goodix_spi_probe(struct spi_device *spi) if (error) return error; - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c index 847b1ddefeec..6296eb686ca9 100644 --- a/drivers/hid/hid-google-hammer.c +++ b/drivers/hid/hid-google-hammer.c @@ -342,8 +342,7 @@ static int hammer_register_leds(struct hid_device *hdev) { struct hammer_kbd_leds *kbd_backlight; - kbd_backlight = devm_kzalloc(&hdev->dev, sizeof(*kbd_backlight), - GFP_KERNEL); + kbd_backlight = devm_kzalloc_obj(&hdev->dev, *kbd_backlight); if (!kbd_backlight) return -ENOMEM; @@ -482,7 +481,7 @@ static int hammer_probe(struct hid_device *hdev, struct vivaldi_data *vdata; int error; - vdata = devm_kzalloc(&hdev->dev, sizeof(*vdata), GFP_KERNEL); + vdata = devm_kzalloc_obj(&hdev->dev, *vdata); if (!vdata) return -ENOMEM; diff --git a/drivers/hid/hid-google-stadiaff.c b/drivers/hid/hid-google-stadiaff.c index 0214aae6b0fa..c7b27684cd3b 100644 --- a/drivers/hid/hid-google-stadiaff.c +++ b/drivers/hid/hid-google-stadiaff.c @@ -89,8 +89,7 @@ static int stadia_input_configured(struct hid_device *hid, struct hid_input *hid if (!report) return -ENODEV; - stadiaff = devm_kzalloc(&hid->dev, sizeof(struct stadiaff_device), - GFP_KERNEL); + stadiaff = devm_kzalloc_obj(&hid->dev, struct stadiaff_device); if (!stadiaff) return -ENOMEM; diff --git a/drivers/hid/hid-gt683r.c b/drivers/hid/hid-gt683r.c index 29ccb0accfba..10270fa1c5d8 100644 --- a/drivers/hid/hid-gt683r.c +++ b/drivers/hid/hid-gt683r.c @@ -229,7 +229,7 @@ static int gt683r_led_probe(struct hid_device *hdev, char *name; struct gt683r_led *led; - led = devm_kzalloc(&hdev->dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(&hdev->dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/hid/hid-hyperx.c b/drivers/hid/hid-hyperx.c index 18d2dc24cc76..8a79c3d2ad2f 100644 --- a/drivers/hid/hid-hyperx.c +++ b/drivers/hid/hid-hyperx.c @@ -83,7 +83,7 @@ static int hyperx_probe(struct hid_device *hdev, const struct hid_device_id *id) struct hyperx_drvdata *drvdata; int ret; - drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&hdev->dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index edd6bbf8342b..a4d3536c7af2 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -562,11 +562,11 @@ static int hidinput_setup_battery(struct hid_device *dev, unsigned report_type, if (quirks & HID_BATTERY_QUIRK_IGNORE) return 0; - bat = devm_kzalloc(&dev->dev, sizeof(*bat), GFP_KERNEL); + bat = devm_kzalloc_obj(&dev->dev, *bat); if (!bat) return -ENOMEM; - psy_desc = devm_kzalloc(&dev->dev, sizeof(*psy_desc), GFP_KERNEL); + psy_desc = devm_kzalloc_obj(&dev->dev, *psy_desc); if (!psy_desc) { error = -ENOMEM; goto err_free_bat; diff --git a/drivers/hid/hid-led.c b/drivers/hid/hid-led.c index 7d82f8d426bb..d5893c3ad46e 100644 --- a/drivers/hid/hid-led.c +++ b/drivers/hid/hid-led.c @@ -451,7 +451,7 @@ static int hidled_probe(struct hid_device *hdev, const struct hid_device_id *id) unsigned int minor; int ret, i; - ldev = devm_kzalloc(&hdev->dev, sizeof(*ldev), GFP_KERNEL); + ldev = devm_kzalloc_obj(&hdev->dev, *ldev); if (!ldev) return -ENOMEM; @@ -479,8 +479,8 @@ static int hidled_probe(struct hid_device *hdev, const struct hid_device_id *id) return ret; } - ldev->rgb = devm_kcalloc(&hdev->dev, ldev->config->num_leds, - sizeof(struct hidled_rgb), GFP_KERNEL); + ldev->rgb = devm_kzalloc_objs(&hdev->dev, struct hidled_rgb, + ldev->config->num_leds); if (!ldev->rgb) return -ENOMEM; diff --git a/drivers/hid/hid-lenovo-go-s.c b/drivers/hid/hid-lenovo-go-s.c index 7102786ce124..c922ed6ef83f 100644 --- a/drivers/hid/hid-lenovo-go-s.c +++ b/drivers/hid/hid-lenovo-go-s.c @@ -1624,7 +1624,7 @@ static int hid_gos_cfg_probe(struct hid_device *hdev, struct gos_cfg_drvdata *drvdata; int ret; - drvdata = devm_kzalloc(&hdev->dev, sizeof(struct gos_cfg_drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&hdev->dev, struct gos_cfg_drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c index 617bba662659..30bd3f794243 100644 --- a/drivers/hid/hid-lenovo.c +++ b/drivers/hid/hid-lenovo.c @@ -1257,9 +1257,7 @@ static int lenovo_probe_tpkbd(struct hid_device *hdev) if (ret) hid_warn(hdev, "Could not create sysfs group: %d\n", ret); - data_pointer = devm_kzalloc(&hdev->dev, - sizeof(struct lenovo_drvdata), - GFP_KERNEL); + data_pointer = devm_kzalloc_obj(&hdev->dev, struct lenovo_drvdata); if (data_pointer == NULL) { hid_err(hdev, "Could not allocate memory for driver data\n"); ret = -ENOMEM; @@ -1297,9 +1295,7 @@ static int lenovo_probe_cptkbd(struct hid_device *hdev) return 0; } - cptkbd_data = devm_kzalloc(&hdev->dev, - sizeof(*cptkbd_data), - GFP_KERNEL); + cptkbd_data = devm_kzalloc_obj(&hdev->dev, *cptkbd_data); if (cptkbd_data == NULL) { hid_err(hdev, "can't alloc keyboard descriptor\n"); return -ENOMEM; @@ -1351,7 +1347,7 @@ static int lenovo_probe_tp10ubkbd(struct hid_device *hdev) if (!found) return 0; - data = devm_kzalloc(&hdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&hdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hid/hid-letsketch.c b/drivers/hid/hid-letsketch.c index b52e93a91ae5..51f43324ddb8 100644 --- a/drivers/hid/hid-letsketch.c +++ b/drivers/hid/hid-letsketch.c @@ -286,7 +286,7 @@ static int letsketch_probe(struct hid_device *hdev, const struct hid_device_id * if (ret) return ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hid/hid-lg-g15.c b/drivers/hid/hid-lg-g15.c index 02ef3e2094b4..c2a83b006afa 100644 --- a/drivers/hid/hid-lg-g15.c +++ b/drivers/hid/hid-lg-g15.c @@ -966,7 +966,7 @@ static void lg_g15_setup_led_rgb(struct lg_g15_data *g15, int index) gled->mcdev.led_cdev.max_brightness = 255; gled->mcdev.num_colors = 3; - subled_info = devm_kcalloc(&g15->hdev->dev, 3, sizeof(*subled_info), GFP_KERNEL); + subled_info = devm_kzalloc_objs(&g15->hdev->dev, *subled_info, 3); if (!subled_info) return; @@ -1148,7 +1148,7 @@ static int lg_g15_probe(struct hid_device *hdev, const struct hid_device_id *id) if (!has_ff000000) return hid_hw_start(hdev, HID_CONNECT_DEFAULT); - g15 = devm_kzalloc(&hdev->dev, sizeof(*g15), GFP_KERNEL); + g15 = devm_kzalloc_obj(&hdev->dev, *g15); if (!g15) return -ENOMEM; diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index 27d83b8bbaaf..60fc6b86a085 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c @@ -3135,8 +3135,7 @@ static int wtp_allocate(struct hid_device *hdev, const struct hid_device_id *id) struct hidpp_device *hidpp = hid_get_drvdata(hdev); struct wtp_data *wd; - wd = devm_kzalloc(&hdev->dev, sizeof(struct wtp_data), - GFP_KERNEL); + wd = devm_kzalloc_obj(&hdev->dev, struct wtp_data); if (!wd) return -ENOMEM; @@ -3391,8 +3390,7 @@ static int k400_allocate(struct hid_device *hdev) struct hidpp_device *hidpp = hid_get_drvdata(hdev); struct k400_private_data *k400; - k400 = devm_kzalloc(&hdev->dev, sizeof(struct k400_private_data), - GFP_KERNEL); + k400 = devm_kzalloc_obj(&hdev->dev, struct k400_private_data); if (!k400) return -ENOMEM; @@ -4675,7 +4673,7 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) unsigned int connect_mask = HID_CONNECT_DEFAULT; /* report_fixup needs drvdata to be set before we call hid_parse */ - hidpp = devm_kzalloc(&hdev->dev, sizeof(*hidpp), GFP_KERNEL); + hidpp = devm_kzalloc_obj(&hdev->dev, *hidpp); if (!hidpp) return -ENOMEM; diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index e6d4d4930526..a01e84a18ded 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c @@ -901,7 +901,7 @@ static int magicmouse_probe(struct hid_device *hdev, struct hid_report *report; int ret; - msc = devm_kzalloc(&hdev->dev, sizeof(*msc), GFP_KERNEL); + msc = devm_kzalloc_obj(&hdev->dev, *msc); if (msc == NULL) { hid_err(hdev, "can't alloc magicmouse descriptor\n"); return -ENOMEM; diff --git a/drivers/hid/hid-mcp2200.c b/drivers/hid/hid-mcp2200.c index c6fd5fb5d578..45cf4becae91 100644 --- a/drivers/hid/hid-mcp2200.c +++ b/drivers/hid/hid-mcp2200.c @@ -329,7 +329,7 @@ static int mcp2200_probe(struct hid_device *hdev, const struct hid_device_id *id int ret; struct mcp2200 *mcp; - mcp = devm_kzalloc(&hdev->dev, sizeof(*mcp), GFP_KERNEL); + mcp = devm_kzalloc_obj(&hdev->dev, *mcp); if (!mcp) return -ENOMEM; diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c index 053377dbced2..3f05d6e288f9 100644 --- a/drivers/hid/hid-mcp2221.c +++ b/drivers/hid/hid-mcp2221.c @@ -1252,7 +1252,7 @@ static int mcp2221_probe(struct hid_device *hdev, int ret; struct mcp2221 *mcp; - mcp = devm_kzalloc(&hdev->dev, sizeof(*mcp), GFP_KERNEL); + mcp = devm_kzalloc_obj(&hdev->dev, *mcp); if (!mcp) return -ENOMEM; @@ -1323,7 +1323,7 @@ static int mcp2221_probe(struct hid_device *hdev, #if IS_REACHABLE(CONFIG_GPIOLIB) /* Setup GPIO chip */ - mcp->gc = devm_kzalloc(&hdev->dev, sizeof(*mcp->gc), GFP_KERNEL); + mcp->gc = devm_kzalloc_obj(&hdev->dev, *mcp->gc); if (!mcp->gc) return -ENOMEM; diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c index a7d3493a6141..226733718c48 100644 --- a/drivers/hid/hid-microsoft.c +++ b/drivers/hid/hid-microsoft.c @@ -337,9 +337,8 @@ static int ms_input_configured(struct hid_device *hdev, struct hid_input *hidinp ms->hdev = hdev; INIT_WORK(&ms->ff_worker, ms_ff_worker); - ms->output_report_dmabuf = devm_kzalloc(&hdev->dev, - sizeof(struct xb1s_ff_report), - GFP_KERNEL); + ms->output_report_dmabuf = devm_kzalloc_obj(&hdev->dev, + struct xb1s_ff_report); if (ms->output_report_dmabuf == NULL) return -ENOMEM; @@ -353,7 +352,7 @@ static int ms_probe(struct hid_device *hdev, const struct hid_device_id *id) struct ms_data *ms; int ret; - ms = devm_kzalloc(&hdev->dev, sizeof(*ms), GFP_KERNEL); + ms = devm_kzalloc_obj(&hdev->dev, *ms); if (ms == NULL) return -ENOMEM; diff --git a/drivers/hid/hid-msi.c b/drivers/hid/hid-msi.c index 3225d3bf6125..23d731f700c9 100644 --- a/drivers/hid/hid-msi.c +++ b/drivers/hid/hid-msi.c @@ -1829,7 +1829,7 @@ static int claw_probe(struct hid_device *hdev, u8 ep) struct claw_drvdata *drvdata; int ret; - drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&hdev->dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 4e19a0c4d238..3afca07025ea 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -623,7 +623,7 @@ static struct mt_usages *mt_allocate_usage(struct hid_device *hdev, { struct mt_usages *usage; - usage = devm_kzalloc(&hdev->dev, sizeof(*usage), GFP_KERNEL); + usage = devm_kzalloc_obj(&hdev->dev, *usage); if (!usage) return NULL; @@ -652,8 +652,7 @@ static struct mt_application *mt_allocate_application(struct mt_device *td, unsigned int application = report->application; struct mt_application *mt_application; - mt_application = devm_kzalloc(&td->hdev->dev, sizeof(*mt_application), - GFP_KERNEL); + mt_application = devm_kzalloc_obj(&td->hdev->dev, *mt_application); if (!mt_application) return NULL; @@ -711,7 +710,7 @@ static struct mt_report_data *mt_allocate_report_data(struct mt_device *td, struct hid_field *field; int r, n; - rdata = devm_kzalloc(&td->hdev->dev, sizeof(*rdata), GFP_KERNEL); + rdata = devm_kzalloc_obj(&td->hdev->dev, *rdata); if (!rdata) return NULL; @@ -2127,12 +2126,12 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) } } - td = devm_kzalloc(&hdev->dev, sizeof(struct mt_device), GFP_KERNEL); + td = devm_kzalloc_obj(&hdev->dev, struct mt_device); if (!td) { dev_err(&hdev->dev, "cannot allocate multitouch data\n"); return -ENOMEM; } - td->haptic = devm_kzalloc(&hdev->dev, sizeof(*(td->haptic)), GFP_KERNEL); + td->haptic = devm_kzalloc_obj(&hdev->dev, *(td->haptic)); if (!td->haptic) return -ENOMEM; diff --git a/drivers/hid/hid-nintendo-switch2-usb.c b/drivers/hid/hid-nintendo-switch2-usb.c index 8b3b6841035d..623473f3d216 100644 --- a/drivers/hid/hid-nintendo-switch2-usb.c +++ b/drivers/hid/hid-nintendo-switch2-usb.c @@ -359,7 +359,7 @@ static int switch2_usb_probe(struct usb_interface *intf, const struct usb_device return ret; } - ns2_usb = devm_kzalloc(&intf->dev, sizeof(*ns2_usb), GFP_KERNEL); + ns2_usb = devm_kzalloc_obj(&intf->dev, *ns2_usb); if (!ns2_usb) return -ENOMEM; diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c index 4d40f67f3e64..eb3274db8ccb 100644 --- a/drivers/hid/hid-nintendo.c +++ b/drivers/hid/hid-nintendo.c @@ -2730,7 +2730,7 @@ static int joycon_probe(struct hid_device *hdev, hid_dbg(hdev, "probe - start\n"); - ctlr = devm_kzalloc(&hdev->dev, sizeof(*ctlr), GFP_KERNEL); + ctlr = devm_kzalloc_obj(&hdev->dev, *ctlr); if (!ctlr) { ret = -ENOMEM; goto err; @@ -3687,7 +3687,7 @@ static int switch2_init_input(struct switch2_controller *ns2) player_led_pattern = ns2->player_id % JC_NUM_LED_PATTERNS; hid_dbg(hdev, "assigned player %d led pattern", player_led_pattern + 1); - ns2->leds = devm_kcalloc(&input->dev, JC_NUM_LEDS, sizeof(*ns2->leds), GFP_KERNEL); + ns2->leds = devm_kzalloc_objs(&input->dev, *ns2->leds, JC_NUM_LEDS); if (!ns2->leds) { input_unregister_device(input); return -ENOMEM; diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c index b0c40a245bf8..9d81a686d2b7 100644 --- a/drivers/hid/hid-nvidia-shield.c +++ b/drivers/hid/hid-nvidia-shield.c @@ -864,7 +864,7 @@ static struct shield_device *thunderstrike_create(struct hid_device *hdev) struct thunderstrike *ts; int ret; - ts = devm_kzalloc(&hdev->dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&hdev->dev, *ts); if (!ts) return ERR_PTR(-ENOMEM); diff --git a/drivers/hid/hid-oxp.c b/drivers/hid/hid-oxp.c index 1e691ebc1199..2b6432fec1ea 100644 --- a/drivers/hid/hid-oxp.c +++ b/drivers/hid/hid-oxp.c @@ -1483,12 +1483,12 @@ static int oxp_cfg_probe(struct hid_device *hdev, u16 up) return 0; skip_rgb: - bmap_1 = devm_kzalloc(&hdev->dev, sizeof(struct oxp_bmap_page_1), GFP_KERNEL); + bmap_1 = devm_kzalloc_obj(&hdev->dev, struct oxp_bmap_page_1); if (!bmap_1) return dev_err_probe(&hdev->dev, -ENOMEM, "Unable to allocate button map page 1\n"); - bmap_2 = devm_kzalloc(&hdev->dev, sizeof(struct oxp_bmap_page_2), GFP_KERNEL); + bmap_2 = devm_kzalloc_obj(&hdev->dev, struct oxp_bmap_page_2); if (!bmap_2) return dev_err_probe(&hdev->dev, -ENOMEM, "Unable to allocate button map page 2\n"); diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c index acb9eb18f7cc..7186dbd27c79 100644 --- a/drivers/hid/hid-plantronics.c +++ b/drivers/hid/hid-plantronics.c @@ -186,7 +186,7 @@ static int plantronics_probe(struct hid_device *hdev, struct plt_drv_data *drv_data; int ret; - drv_data = devm_kzalloc(&hdev->dev, sizeof(*drv_data), GFP_KERNEL); + drv_data = devm_kzalloc_obj(&hdev->dev, *drv_data); if (!drv_data) return -ENOMEM; diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c index f9dc9378cf77..143eb891e4a1 100644 --- a/drivers/hid/hid-playstation.c +++ b/drivers/hid/hid-playstation.c @@ -877,8 +877,8 @@ static int ps_lightbar_register(struct ps_device *ps_dev, struct led_classdev_mc struct led_classdev *led_cdev; int ret; - mc_led_info = devm_kmalloc_array(&hdev->dev, 3, sizeof(*mc_led_info), - GFP_KERNEL | __GFP_ZERO); + mc_led_info = devm_kmalloc_objs(&hdev->dev, *mc_led_info, 3, + GFP_KERNEL | __GFP_ZERO); if (!mc_led_info) return -ENOMEM; @@ -1754,7 +1754,7 @@ static struct ps_device *dualsense_create(struct hid_device *hdev) dualsense_player_led_set_brightness } }; - ds = devm_kzalloc(&hdev->dev, sizeof(*ds), GFP_KERNEL); + ds = devm_kzalloc_obj(&hdev->dev, *ds); if (!ds) return ERR_PTR(-ENOMEM); @@ -2747,7 +2747,7 @@ static struct ps_device *dualshock4_create(struct hid_device *hdev) dualshock4_led_set_brightness, dualshock4_led_set_blink }, }; - ds4 = devm_kzalloc(&hdev->dev, sizeof(*ds4), GFP_KERNEL); + ds4 = devm_kzalloc_obj(&hdev->dev, *ds4); if (!ds4) return ERR_PTR(-ENOMEM); diff --git a/drivers/hid/hid-pulsar.c b/drivers/hid/hid-pulsar.c index b0b34849f2b3..a1f0dcda92df 100644 --- a/drivers/hid/hid-pulsar.c +++ b/drivers/hid/hid-pulsar.c @@ -655,7 +655,7 @@ static int pulsar_probe(struct hid_device *hdev, const struct hid_device_id *id) intf->cur_altsetting->desc.bInterfaceNumber != USB_INTERFACE) return hid_hw_start(hdev, HID_CONNECT_DEFAULT); - drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&hdev->dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hid/hid-pxrc.c b/drivers/hid/hid-pxrc.c index e3755d8b85c2..87a906d7da54 100644 --- a/drivers/hid/hid-pxrc.c +++ b/drivers/hid/hid-pxrc.c @@ -75,7 +75,7 @@ static int pxrc_probe(struct hid_device *hdev, const struct hid_device_id *id) int ret; struct pxrc_priv *priv; - priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&hdev->dev, *priv); if (!priv) return -ENOMEM; hid_set_drvdata(hdev, priv); diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index ecc19387f6b0..20dda1992f98 100644 --- a/drivers/hid/hid-rmi.c +++ b/drivers/hid/hid-rmi.c @@ -669,7 +669,7 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id) struct hid_report *output_report; struct hid_report *feature_report; - data = devm_kzalloc(&hdev->dev, sizeof(struct rmi_data), GFP_KERNEL); + data = devm_kzalloc_obj(&hdev->dev, struct rmi_data); if (!data) return -ENOMEM; diff --git a/drivers/hid/hid-saitek.c b/drivers/hid/hid-saitek.c index 6fe7c087c594..71f23dbf290e 100644 --- a/drivers/hid/hid-saitek.c +++ b/drivers/hid/hid-saitek.c @@ -40,7 +40,7 @@ static int saitek_probe(struct hid_device *hdev, struct saitek_sc *ssc; int ret; - ssc = devm_kzalloc(&hdev->dev, sizeof(*ssc), GFP_KERNEL); + ssc = devm_kzalloc_obj(&hdev->dev, *ssc); if (ssc == NULL) { hid_err(hdev, "can't alloc saitek descriptor\n"); return -ENOMEM; diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c index c2b425afd951..c12272479d82 100644 --- a/drivers/hid/hid-sensor-custom.c +++ b/drivers/hid/hid-sensor-custom.c @@ -977,8 +977,7 @@ static int hid_sensor_custom_probe(struct platform_device *pdev) int ret; const struct hid_sensor_custom_match *match; - sensor_inst = devm_kzalloc(&pdev->dev, sizeof(*sensor_inst), - GFP_KERNEL); + sensor_inst = devm_kzalloc_obj(&pdev->dev, *sensor_inst); if (!sensor_inst) return -ENOMEM; diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index 6470a290ebfc..81c8e723f9ba 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -685,7 +685,7 @@ static int sensor_hub_probe(struct hid_device *hdev, struct hid_sensor_hub_device *last_hsdev = NULL; struct hid_sensor_hub_device *collection_hsdev = NULL; - sd = devm_kzalloc(&hdev->dev, sizeof(*sd), GFP_KERNEL); + sd = devm_kzalloc_obj(&hdev->dev, *sd); if (!sd) { hid_err(hdev, "cannot allocate Sensor data\n"); return -ENOMEM; @@ -717,10 +717,9 @@ static int sensor_hub_probe(struct hid_device *hdev, ret = -EINVAL; goto err_stop_hw; } - sd->hid_sensor_hub_client_devs = devm_kcalloc(&hdev->dev, - dev_cnt, - sizeof(struct mfd_cell), - GFP_KERNEL); + sd->hid_sensor_hub_client_devs = devm_kzalloc_objs(&hdev->dev, + struct mfd_cell, + dev_cnt); if (sd->hid_sensor_hub_client_devs == NULL) { hid_err(hdev, "Failed to allocate memory for mfd cells\n"); ret = -ENOMEM; @@ -733,8 +732,7 @@ static int sensor_hub_probe(struct hid_device *hdev, if (collection->type == HID_COLLECTION_PHYSICAL || collection->type == HID_COLLECTION_APPLICATION) { - hsdev = devm_kzalloc(&hdev->dev, sizeof(*hsdev), - GFP_KERNEL); + hsdev = devm_kzalloc_obj(&hdev->dev, *hsdev); if (!hsdev) { hid_err(hdev, "cannot allocate hid_sensor_hub_device\n"); ret = -ENOMEM; @@ -744,9 +742,8 @@ static int sensor_hub_probe(struct hid_device *hdev, hsdev->vendor_id = hdev->vendor; hsdev->product_id = hdev->product; hsdev->usage = collection->usage; - hsdev->mutex_ptr = devm_kzalloc(&hdev->dev, - sizeof(struct mutex), - GFP_KERNEL); + hsdev->mutex_ptr = devm_kzalloc_obj(&hdev->dev, + struct mutex); if (!hsdev->mutex_ptr) { ret = -ENOMEM; goto err_stop_hw; diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 50f5ad6bbeb4..228e74819037 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -602,7 +602,7 @@ static int ghl_init_urb(struct sony_sc *sc, struct usb_device *usbdev, pipe = usb_sndctrlpipe(usbdev, 0); - cr = devm_kzalloc(&sc->hdev->dev, sizeof(*cr), GFP_ATOMIC); + cr = devm_kzalloc_obj(&sc->hdev->dev, *cr, GFP_ATOMIC); if (!cr) return -ENOMEM; @@ -2338,7 +2338,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) !strcmp(hdev->name, "ShanWan PS(R) Ga`epad")) quirks |= SHANWAN_GAMEPAD; - sc = devm_kzalloc(&hdev->dev, sizeof(*sc), GFP_KERNEL); + sc = devm_kzalloc_obj(&hdev->dev, *sc); if (!sc) return -ENOMEM; diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c index 0f364d43aa4b..b9a788be9efe 100644 --- a/drivers/hid/hid-steam.c +++ b/drivers/hid/hid-steam.c @@ -1758,7 +1758,7 @@ static int steam_probe(struct hid_device *hdev, if (!steam_is_valve_interface(hdev, id->driver_data)) return hid_hw_start(hdev, HID_CONNECT_DEFAULT); - steam = devm_kzalloc(&hdev->dev, sizeof(*steam), GFP_KERNEL); + steam = devm_kzalloc_obj(&hdev->dev, *steam); if (!steam) return -ENOMEM; diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c index 7292da0313e1..0170276091b9 100644 --- a/drivers/hid/hid-steelseries.c +++ b/drivers/hid/hid-steelseries.c @@ -261,7 +261,7 @@ static int steelseries_srws1_probe(struct hid_device *hdev, size_t name_sz; char *name; - drv_data = devm_kzalloc(&hdev->dev, sizeof(*drv_data), GFP_KERNEL); + drv_data = devm_kzalloc_obj(&hdev->dev, *drv_data); if (drv_data == NULL) { hid_err(hdev, "can't alloc SRW-S1 memory\n"); return -ENOMEM; @@ -578,7 +578,7 @@ static int steelseries_probe(struct hid_device *hdev, const struct hid_device_id #endif } - sd = devm_kzalloc(&hdev->dev, sizeof(*sd), GFP_KERNEL); + sd = devm_kzalloc_obj(&hdev->dev, *sd); if (!sd) return -ENOMEM; hid_set_drvdata(hdev, sd); diff --git a/drivers/hid/hid-u2fzero.c b/drivers/hid/hid-u2fzero.c index 82404b6e2d25..8ad6a1f4b5c2 100644 --- a/drivers/hid/hid-u2fzero.c +++ b/drivers/hid/hid-u2fzero.c @@ -313,7 +313,7 @@ static int u2fzero_probe(struct hid_device *hdev, if (!hid_is_usb(hdev)) return -EINVAL; - dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&hdev->dev, *dev); if (dev == NULL) return -ENOMEM; diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c index 0b8a83fa6c5b..eea4238b9421 100644 --- a/drivers/hid/hid-uclogic-core.c +++ b/drivers/hid/hid-uclogic-core.c @@ -214,7 +214,7 @@ static int uclogic_probe(struct hid_device *hdev, hdev->quirks |= HID_QUIRK_HIDINPUT_FORCE; /* Allocate and assign driver data */ - drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&hdev->dev, *drvdata); if (drvdata == NULL) { rc = -ENOMEM; goto failure; diff --git a/drivers/hid/hid-udraw-ps3.c b/drivers/hid/hid-udraw-ps3.c index b2e17ef2ea27..bf9cac524df3 100644 --- a/drivers/hid/hid-udraw-ps3.c +++ b/drivers/hid/hid-udraw-ps3.c @@ -409,7 +409,7 @@ static int udraw_probe(struct hid_device *hdev, const struct hid_device_id *id) struct udraw *udraw; int ret; - udraw = devm_kzalloc(&hdev->dev, sizeof(struct udraw), GFP_KERNEL); + udraw = devm_kzalloc_obj(&hdev->dev, struct udraw); if (!udraw) return -ENOMEM; diff --git a/drivers/hid/hid-vivaldi.c b/drivers/hid/hid-vivaldi.c index cda5938fb070..6ee6e617536b 100644 --- a/drivers/hid/hid-vivaldi.c +++ b/drivers/hid/hid-vivaldi.c @@ -20,7 +20,7 @@ static int vivaldi_probe(struct hid_device *hdev, struct vivaldi_data *drvdata; int ret; - drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&hdev->dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hid/hid-zydacron.c b/drivers/hid/hid-zydacron.c index 02de153d5628..0b739d0cbbc7 100644 --- a/drivers/hid/hid-zydacron.c +++ b/drivers/hid/hid-zydacron.c @@ -169,7 +169,7 @@ static int zc_probe(struct hid_device *hdev, const struct hid_device_id *id) int ret; struct zc_device *zc; - zc = devm_kzalloc(&hdev->dev, sizeof(*zc), GFP_KERNEL); + zc = devm_kzalloc_obj(&hdev->dev, *zc); if (zc == NULL) { hid_err(hdev, "can't alloc descriptor\n"); return -ENOMEM; diff --git a/drivers/hid/i2c-hid/i2c-hid-acpi.c b/drivers/hid/i2c-hid/i2c-hid-acpi.c index 9371db200fc4..4362c85dfa7e 100644 --- a/drivers/hid/i2c-hid/i2c-hid-acpi.c +++ b/drivers/hid/i2c-hid/i2c-hid-acpi.c @@ -78,7 +78,7 @@ static int i2c_hid_acpi_probe(struct i2c_client *client) return ret; hid_descriptor_address = ret; - ihid_acpi = devm_kzalloc(dev, sizeof(*ihid_acpi), GFP_KERNEL); + ihid_acpi = devm_kzalloc_obj(dev, *ihid_acpi); if (!ihid_acpi) return -ENOMEM; diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index a8a9854854f5..896ce29e7647 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -1249,7 +1249,7 @@ int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, return client->irq; } - ihid = devm_kzalloc(&client->dev, sizeof(*ihid), GFP_KERNEL); + ihid = devm_kzalloc_obj(&client->dev, *ihid); if (!ihid) return -ENOMEM; diff --git a/drivers/hid/i2c-hid/i2c-hid-of-elan.c b/drivers/hid/i2c-hid/i2c-hid-of-elan.c index 919e32c47e12..667d5e28e747 100644 --- a/drivers/hid/i2c-hid/i2c-hid-of-elan.c +++ b/drivers/hid/i2c-hid/i2c-hid-of-elan.c @@ -101,7 +101,7 @@ static int i2c_hid_of_elan_probe(struct i2c_client *client) int ret; u32 quirks = 0; - ihid_elan = devm_kzalloc(&client->dev, sizeof(*ihid_elan), GFP_KERNEL); + ihid_elan = devm_kzalloc_obj(&client->dev, *ihid_elan); if (!ihid_elan) return -ENOMEM; diff --git a/drivers/hid/i2c-hid/i2c-hid-of-goodix.c b/drivers/hid/i2c-hid/i2c-hid-of-goodix.c index f4dbcd1d1d47..26049399d210 100644 --- a/drivers/hid/i2c-hid/i2c-hid-of-goodix.c +++ b/drivers/hid/i2c-hid/i2c-hid-of-goodix.c @@ -82,8 +82,7 @@ static int i2c_hid_of_goodix_probe(struct i2c_client *client) { struct i2c_hid_of_goodix *ihid_goodix; - ihid_goodix = devm_kzalloc(&client->dev, sizeof(*ihid_goodix), - GFP_KERNEL); + ihid_goodix = devm_kzalloc_obj(&client->dev, *ihid_goodix); if (!ihid_goodix) return -ENOMEM; diff --git a/drivers/hid/i2c-hid/i2c-hid-of.c b/drivers/hid/i2c-hid/i2c-hid-of.c index 59393d71ddb9..ec26652272fe 100644 --- a/drivers/hid/i2c-hid/i2c-hid-of.c +++ b/drivers/hid/i2c-hid/i2c-hid-of.c @@ -83,7 +83,7 @@ static int i2c_hid_of_probe(struct i2c_client *client) int ret; u32 val; - ihid_of = devm_kzalloc(dev, sizeof(*ihid_of), GFP_KERNEL); + ihid_of = devm_kzalloc_obj(dev, *ihid_of); if (!ihid_of) return -ENOMEM; diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c index abf9c9a31c39..1b2b0e05f7b7 100644 --- a/drivers/hid/intel-ish-hid/ipc/ipc.c +++ b/drivers/hid/intel-ish-hid/ipc/ipc.c @@ -980,9 +980,7 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev) for (i = 0; i < IPC_TX_FIFO_SIZE; i++) { struct wr_msg_ctl_info *tx_buf; - tx_buf = devm_kzalloc(&pdev->dev, - sizeof(struct wr_msg_ctl_info), - GFP_KERNEL); + tx_buf = devm_kzalloc_obj(&pdev->dev, struct wr_msg_ctl_info); if (!tx_buf) { /* * IPC buffers may be limited or not available diff --git a/drivers/hid/intel-ish-hid/ishtp-fw-loader.c b/drivers/hid/intel-ish-hid/ishtp-fw-loader.c index f4a671d6386c..ac2dd247250f 100644 --- a/drivers/hid/intel-ish-hid/ishtp-fw-loader.c +++ b/drivers/hid/intel-ish-hid/ishtp-fw-loader.c @@ -916,9 +916,7 @@ static int loader_ishtp_cl_probe(struct ishtp_cl_device *cl_device) struct ishtp_cl_data *client_data; int rv; - client_data = devm_kzalloc(ishtp_device(cl_device), - sizeof(*client_data), - GFP_KERNEL); + client_data = devm_kzalloc_obj(ishtp_device(cl_device), *client_data); if (!client_data) return -ENOMEM; diff --git a/drivers/hid/intel-ish-hid/ishtp-hid-client.c b/drivers/hid/intel-ish-hid/ishtp-hid-client.c index ec5e8afe77bd..4a56fb3eb366 100644 --- a/drivers/hid/intel-ish-hid/ishtp-hid-client.c +++ b/drivers/hid/intel-ish-hid/ishtp-hid-client.c @@ -125,11 +125,9 @@ static void process_recv(struct ishtp_cl *hid_ishtp_cl, void *recv_buf, break; client_data->hid_dev_count = (unsigned int)*payload; if (!client_data->hid_devices) - client_data->hid_devices = devm_kcalloc( - cl_data_to_dev(client_data), - client_data->hid_dev_count, - sizeof(struct device_info), - GFP_KERNEL); + client_data->hid_devices = devm_kzalloc_objs(cl_data_to_dev(client_data), + struct device_info, + client_data->hid_dev_count); if (!client_data->hid_devices) { dev_err(cl_data_to_dev(client_data), "Mem alloc failed for hid device info\n"); @@ -793,9 +791,7 @@ static int hid_ishtp_cl_probe(struct ishtp_cl_device *cl_device) if (!cl_device) return -ENODEV; - client_data = devm_kzalloc(ishtp_device(cl_device), - sizeof(*client_data), - GFP_KERNEL); + client_data = devm_kzalloc_obj(ishtp_device(cl_device), *client_data); if (!client_data) return -ENOMEM; diff --git a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c index 7a913f717efa..29319b6227f3 100644 --- a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c +++ b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c @@ -389,7 +389,7 @@ static struct quicki2c_device *quicki2c_dev_init(struct pci_dev *pdev, void __io struct quicki2c_device *qcdev; int ret; - qcdev = devm_kzalloc(dev, sizeof(struct quicki2c_device), GFP_KERNEL); + qcdev = devm_kzalloc_obj(dev, struct quicki2c_device); if (!qcdev) return ERR_PTR(-ENOMEM); diff --git a/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c b/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c index 53023e30cf8d..bf49d8ce5f07 100644 --- a/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c +++ b/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c @@ -368,7 +368,7 @@ static struct quickspi_device *quickspi_dev_init(struct pci_dev *pdev, void __io struct quickspi_device *qsdev; int ret; - qsdev = devm_kzalloc(dev, sizeof(struct quickspi_device), GFP_KERNEL); + qsdev = devm_kzalloc_obj(dev, struct quickspi_device); if (!qsdev) return ERR_PTR(-ENOMEM); diff --git a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c index 7b4a58e1416d..7feda41601e5 100644 --- a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c +++ b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c @@ -197,7 +197,7 @@ struct thc_device *thc_dev_init(struct device *device, void __iomem *mem_addr) struct thc_device *thc_dev; int ret; - thc_dev = devm_kzalloc(device, sizeof(*thc_dev), GFP_KERNEL); + thc_dev = devm_kzalloc_obj(device, *thc_dev); if (!thc_dev) return ERR_PTR(-ENOMEM); diff --git a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c index 7ceb8aeeccd3..c80ef8c20574 100644 --- a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c +++ b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c @@ -322,7 +322,7 @@ struct thc_dma_context *thc_dma_init(struct thc_device *dev) { struct thc_dma_context *dma_ctx; - dma_ctx = devm_kzalloc(dev->dev, sizeof(*dma_ctx), GFP_KERNEL); + dma_ctx = devm_kzalloc_obj(dev->dev, *dma_ctx); if (!dma_ctx) return NULL; diff --git a/drivers/hid/surface-hid/surface_hid.c b/drivers/hid/surface-hid/surface_hid.c index eae47e0d95ed..e55403266894 100644 --- a/drivers/hid/surface-hid/surface_hid.c +++ b/drivers/hid/surface-hid/surface_hid.c @@ -199,7 +199,7 @@ static int surface_hid_probe(struct ssam_device *sdev) { struct surface_hid_device *shid; - shid = devm_kzalloc(&sdev->dev, sizeof(*shid), GFP_KERNEL); + shid = devm_kzalloc_obj(&sdev->dev, *shid); if (!shid) return -ENOMEM; diff --git a/drivers/hid/surface-hid/surface_kbd.c b/drivers/hid/surface-hid/surface_kbd.c index 036829ba47d4..4821d44955bf 100644 --- a/drivers/hid/surface-hid/surface_kbd.c +++ b/drivers/hid/surface-hid/surface_kbd.c @@ -241,7 +241,7 @@ static int surface_kbd_probe(struct platform_device *pdev) if (IS_ERR(ctrl)) return PTR_ERR(ctrl) == -ENODEV ? -EPROBE_DEFER : PTR_ERR(ctrl); - shid = devm_kzalloc(&pdev->dev, sizeof(*shid), GFP_KERNEL); + shid = devm_kzalloc_obj(&pdev->dev, *shid); if (!shid) return -ENOMEM; diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 628372ab818a..2d2a4d56a8da 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -1495,7 +1495,7 @@ static int wacom_led_groups_alloc_and_register_one(struct device *dev, if (!devres_open_group(dev, &wacom->led.groups[group_id], GFP_KERNEL)) return -ENOMEM; - leds = devm_kcalloc(dev, count, sizeof(struct wacom_led), GFP_KERNEL); + leds = devm_kzalloc_objs(dev, struct wacom_led, count); if (!leds) { error = -ENOMEM; goto err; @@ -1595,8 +1595,7 @@ static int wacom_led_groups_allocate(struct wacom *wacom, int count) struct wacom_group_leds *groups; int error; - groups = devm_kcalloc(dev, count, sizeof(struct wacom_group_leds), - GFP_KERNEL); + groups = devm_kzalloc_objs(dev, struct wacom_group_leds, count); if (!groups) return -ENOMEM; @@ -2059,8 +2058,7 @@ static int wacom_initialize_remotes(struct wacom *wacom) if (wacom->wacom_wac.features.type != REMOTE) return 0; - remote = devm_kzalloc(&wacom->hdev->dev, sizeof(*wacom->remote), - GFP_KERNEL); + remote = devm_kzalloc_obj(&wacom->hdev->dev, *wacom->remote); if (!remote) return -ENOMEM; @@ -2934,7 +2932,7 @@ static int wacom_probe(struct hid_device *hdev, /* hid-core sets this quirk for the boot interface */ hdev->quirks &= ~HID_QUIRK_NOGET; - wacom = devm_kzalloc(&hdev->dev, sizeof(struct wacom), GFP_KERNEL); + wacom = devm_kzalloc_obj(&hdev->dev, struct wacom); if (!wacom) return -ENOMEM; diff --git a/drivers/hsi/clients/nokia-modem.c b/drivers/hsi/clients/nokia-modem.c index 88924d757616..eeb92d0f336d 100644 --- a/drivers/hsi/clients/nokia-modem.c +++ b/drivers/hsi/clients/nokia-modem.c @@ -87,8 +87,7 @@ static int nokia_modem_gpio_probe(struct device *dev) return -EINVAL; } - modem->gpios = devm_kcalloc(dev, gpio_count, sizeof(*modem->gpios), - GFP_KERNEL); + modem->gpios = devm_kzalloc_objs(dev, *modem->gpios, gpio_count); if (!modem->gpios) return -ENOMEM; @@ -138,7 +137,7 @@ static int nokia_modem_probe(struct device *dev) return -ENXIO; } - modem = devm_kzalloc(dev, sizeof(*modem), GFP_KERNEL); + modem = devm_kzalloc_obj(dev, *modem); if (!modem) return -ENOMEM; diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c index 0f5a6f7522ad..d0269793d262 100644 --- a/drivers/hsi/controllers/omap_ssi_core.c +++ b/drivers/hsi/controllers/omap_ssi_core.c @@ -342,7 +342,7 @@ static int ssi_add_controller(struct hsi_controller *ssi, struct omap_ssi_controller *omap_ssi; int err; - omap_ssi = devm_kzalloc(&ssi->device, sizeof(*omap_ssi), GFP_KERNEL); + omap_ssi = devm_kzalloc_obj(&ssi->device, *omap_ssi); if (!omap_ssi) return -ENOMEM; @@ -373,8 +373,8 @@ static int ssi_add_controller(struct hsi_controller *ssi, if (err < 0) goto out_err; - omap_ssi->port = devm_kcalloc(&ssi->device, ssi->num_ports, - sizeof(*omap_ssi->port), GFP_KERNEL); + omap_ssi->port = devm_kzalloc_objs(&ssi->device, *omap_ssi->port, + ssi->num_ports); if (!omap_ssi->port) { err = -ENOMEM; goto out_err; diff --git a/drivers/hsi/controllers/omap_ssi_port.c b/drivers/hsi/controllers/omap_ssi_port.c index 63e8bc44630a..a6d654be8c4a 100644 --- a/drivers/hsi/controllers/omap_ssi_port.c +++ b/drivers/hsi/controllers/omap_ssi_port.c @@ -1142,7 +1142,7 @@ static int ssi_port_probe(struct platform_device *pd) goto error; } - omap_port = devm_kzalloc(&port->device, sizeof(*omap_port), GFP_KERNEL); + omap_port = devm_kzalloc_obj(&port->device, *omap_port); if (!omap_port) { err = -ENOMEM; goto error; diff --git a/drivers/hte/hte-tegra194.c b/drivers/hte/hte-tegra194.c index 189f7fcffbe2..dea5f9e79005 100644 --- a/drivers/hte/hte-tegra194.c +++ b/drivers/hte/hte-tegra194.c @@ -818,11 +818,11 @@ static int tegra_hte_probe(struct platform_device *pdev) dev = &pdev->dev; - hte_dev = devm_kzalloc(dev, sizeof(*hte_dev), GFP_KERNEL); + hte_dev = devm_kzalloc_obj(dev, *hte_dev); if (!hte_dev) return -ENOMEM; - gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL); + gc = devm_kzalloc_obj(dev, *gc); if (!gc) return -ENOMEM; @@ -845,8 +845,7 @@ static int tegra_hte_probe(struct platform_device *pdev) if (ret != 0) hte_dev->itr_thrshld = 1; - hte_dev->sl = devm_kcalloc(dev, slices, sizeof(*hte_dev->sl), - GFP_KERNEL); + hte_dev->sl = devm_kzalloc_objs(dev, *hte_dev->sl, slices); if (!hte_dev->sl) return -ENOMEM; @@ -869,9 +868,8 @@ static int tegra_hte_probe(struct platform_device *pdev) if (hte_dev->prov_data && hte_dev->prov_data->type == HTE_TEGRA_TYPE_GPIO) { - hte_dev->line_data = devm_kcalloc(dev, nlines, - sizeof(*hte_dev->line_data), - GFP_KERNEL); + hte_dev->line_data = devm_kzalloc_objs(dev, *hte_dev->line_data, + nlines); if (!hte_dev->line_data) return -ENOMEM; diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c index 3bb959d16dbf..f9d9ba0cb852 100644 --- a/drivers/hwmon/abituguru.c +++ b/drivers/hwmon/abituguru.c @@ -1268,8 +1268,7 @@ static int abituguru_probe(struct platform_device *pdev) 0x00, 0x01, 0x03, 0x04, 0x0A, 0x08, 0x0E, 0x02, 0x09, 0x06, 0x05, 0x0B, 0x0F, 0x0D, 0x07, 0x0C }; - data = devm_kzalloc(&pdev->dev, sizeof(struct abituguru_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct abituguru_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index b70330dc2198..56d95443d69f 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c @@ -965,8 +965,7 @@ static int abituguru3_probe(struct platform_device *pdev) u8 buf[2]; u16 id; - data = devm_kzalloc(&pdev->dev, sizeof(struct abituguru3_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct abituguru3_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c index 59424103f634..efb2b6b8c9b4 100644 --- a/drivers/hwmon/ad7314.c +++ b/drivers/hwmon/ad7314.c @@ -110,7 +110,7 @@ static int ad7314_probe(struct spi_device *spi_dev) struct ad7314_data *chip; struct device *hwmon_dev; - chip = devm_kzalloc(&spi_dev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&spi_dev->dev, *chip); if (chip == NULL) return -ENOMEM; diff --git a/drivers/hwmon/ad7414.c b/drivers/hwmon/ad7414.c index c2df631ae93a..19f8fa776754 100644 --- a/drivers/hwmon/ad7414.c +++ b/drivers/hwmon/ad7414.c @@ -180,7 +180,7 @@ static int ad7414_probe(struct i2c_client *client) I2C_FUNC_SMBUS_READ_WORD_DATA)) return -EOPNOTSUPP; - data = devm_kzalloc(dev, sizeof(struct ad7414_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct ad7414_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ad7418.c b/drivers/hwmon/ad7418.c index a0c9cf5e12cc..c2185bba04f2 100644 --- a/drivers/hwmon/ad7418.c +++ b/drivers/hwmon/ad7418.c @@ -242,7 +242,7 @@ static int ad7418_probe(struct i2c_client *client) I2C_FUNC_SMBUS_WORD_DATA)) return -EOPNOTSUPP; - data = devm_kzalloc(dev, sizeof(struct ad7418_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct ad7418_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/adc128d818.c b/drivers/hwmon/adc128d818.c index e45adc0b84d1..82be274364a0 100644 --- a/drivers/hwmon/adc128d818.c +++ b/drivers/hwmon/adc128d818.c @@ -434,7 +434,7 @@ static int adc128_probe(struct i2c_client *client) bool external_vref; int err, vref; - data = devm_kzalloc(dev, sizeof(struct adc128_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct adc128_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c index 937fd9ef98b1..db00b88e01a5 100644 --- a/drivers/hwmon/adcxx.c +++ b/drivers/hwmon/adcxx.c @@ -154,7 +154,7 @@ static int adcxx_probe(struct spi_device *spi) int status; int i; - adc = devm_kzalloc(&spi->dev, sizeof(*adc), GFP_KERNEL); + adc = devm_kzalloc_obj(&spi->dev, *adc); if (!adc) return -ENOMEM; diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c index ccac7ba601e9..34c58460045d 100644 --- a/drivers/hwmon/adm1025.c +++ b/drivers/hwmon/adm1025.c @@ -524,7 +524,7 @@ static int adm1025_probe(struct i2c_client *client) struct adm1025_data *data; u8 config; - data = devm_kzalloc(dev, sizeof(struct adm1025_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct adm1025_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index 3ad82c01f81d..24f81de9bfe0 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c @@ -1830,7 +1830,7 @@ static int adm1026_probe(struct i2c_client *client) struct device *hwmon_dev; struct adm1026_data *data; - data = devm_kzalloc(dev, sizeof(struct adm1026_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct adm1026_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c index 6cb0a238e059..5602989dfd2f 100644 --- a/drivers/hwmon/adm1029.c +++ b/drivers/hwmon/adm1029.c @@ -361,7 +361,7 @@ static int adm1029_probe(struct i2c_client *client) struct adm1029_data *data; struct device *hwmon_dev; - data = devm_kzalloc(dev, sizeof(struct adm1029_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct adm1029_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index 24d0d4146c87..7a0db1bc92cc 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c @@ -1027,7 +1027,7 @@ static int adm1031_probe(struct i2c_client *client) struct device *hwmon_dev; struct adm1031_data *data; - data = devm_kzalloc(dev, sizeof(struct adm1031_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct adm1031_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/adm1177.c b/drivers/hwmon/adm1177.c index 85ad4a3009bd..7e266d6cc56a 100644 --- a/drivers/hwmon/adm1177.c +++ b/drivers/hwmon/adm1177.c @@ -199,7 +199,7 @@ static int adm1177_probe(struct i2c_client *client) u32 prop; int ret; - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c index 586650e8d043..7d9922046088 100644 --- a/drivers/hwmon/adm9240.c +++ b/drivers/hwmon/adm9240.c @@ -774,7 +774,7 @@ static int adm9240_probe(struct i2c_client *client) struct adm9240_data *data; int err; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c index f8f2f621dfea..261978af17c5 100644 --- a/drivers/hwmon/ads7828.c +++ b/drivers/hwmon/ads7828.c @@ -112,7 +112,7 @@ static int ads7828_probe(struct i2c_client *client) unsigned int regval; enum ads7828_chips chip; - data = devm_kzalloc(dev, sizeof(struct ads7828_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct ads7828_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c index d1cbff0e8572..36297bc6d047 100644 --- a/drivers/hwmon/ads7871.c +++ b/drivers/hwmon/ads7871.c @@ -189,7 +189,7 @@ static int ads7871_probe(struct spi_device *spi) spi->bits_per_word = 8; spi_setup(spi); - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c index 598f31647544..eaa4fe5b377d 100644 --- a/drivers/hwmon/adt7411.c +++ b/drivers/hwmon/adt7411.c @@ -648,7 +648,7 @@ static int adt7411_probe(struct i2c_client *client) struct device *hwmon_dev; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c index 376331f7fa17..6b22b17b89ac 100644 --- a/drivers/hwmon/adt7462.c +++ b/drivers/hwmon/adt7462.c @@ -1793,7 +1793,7 @@ static int adt7462_probe(struct i2c_client *client) struct adt7462_data *data; struct device *hwmon_dev; - data = devm_kzalloc(dev, sizeof(struct adt7462_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct adt7462_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c index f652532f2f32..d6fba2b05749 100644 --- a/drivers/hwmon/adt7470.c +++ b/drivers/hwmon/adt7470.c @@ -1469,7 +1469,7 @@ static int adt7470_probe(struct i2c_client *client) int freq_val; int err; - data = devm_kzalloc(dev, sizeof(struct adt7470_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct adt7470_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c index cd0b69ecb640..992a49192c3e 100644 --- a/drivers/hwmon/adt7475.c +++ b/drivers/hwmon/adt7475.c @@ -1817,7 +1817,7 @@ static int adt7475_probe(struct i2c_client *client) int i, ret = 0, revision, group_num = 0; u8 config3; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (data == NULL) return -ENOMEM; diff --git a/drivers/hwmon/adt7x10.c b/drivers/hwmon/adt7x10.c index f99d38e82d0b..d3e01f8661f9 100644 --- a/drivers/hwmon/adt7x10.c +++ b/drivers/hwmon/adt7x10.c @@ -321,7 +321,7 @@ int adt7x10_probe(struct device *dev, const char *name, int irq, struct device *hdev; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/aht10.c b/drivers/hwmon/aht10.c index 6c263cb57766..89d18793137c 100644 --- a/drivers/hwmon/aht10.c +++ b/drivers/hwmon/aht10.c @@ -340,7 +340,7 @@ static int aht10_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -ENOENT; - data = devm_kzalloc(device, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(device, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c index 5e6611d6e1bd..575b2492ec2d 100644 --- a/drivers/hwmon/amc6821.c +++ b/drivers/hwmon/amc6821.c @@ -1039,7 +1039,7 @@ static int amc6821_probe(struct i2c_client *client) struct device_node *fan_np __free(device_node) = NULL; int err; - data = devm_kzalloc(dev, sizeof(struct amc6821_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct amc6821_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c index 1ca70e726298..6fbb3962f791 100644 --- a/drivers/hwmon/aquacomputer_d5next.c +++ b/drivers/hwmon/aquacomputer_d5next.c @@ -1520,7 +1520,7 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) struct aqc_data *priv; int ret; - priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&hdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/arctic_fan_controller.c b/drivers/hwmon/arctic_fan_controller.c index 9eb83a149cd6..e2e0bb8f2a7f 100644 --- a/drivers/hwmon/arctic_fan_controller.c +++ b/drivers/hwmon/arctic_fan_controller.c @@ -283,7 +283,7 @@ static int arctic_fan_probe(struct hid_device *hdev, if (ret) return ret; - priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&hdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/as370-hwmon.c b/drivers/hwmon/as370-hwmon.c index 702449c0fb86..e8151a4a2e0d 100644 --- a/drivers/hwmon/as370-hwmon.c +++ b/drivers/hwmon/as370-hwmon.c @@ -97,7 +97,7 @@ static int as370_hwmon_probe(struct platform_device *pdev) struct as370_hwmon *hwmon; struct device *dev = &pdev->dev; - hwmon = devm_kzalloc(dev, sizeof(*hwmon), GFP_KERNEL); + hwmon = devm_kzalloc_obj(dev, *hwmon); if (!hwmon) return -ENOMEM; diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index 5f5c94505166..89068cd4faf0 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c @@ -779,8 +779,7 @@ static int asb100_probe(struct i2c_client *client) int err; struct asb100_data *data; - data = devm_kzalloc(&client->dev, sizeof(struct asb100_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct asb100_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/asc7621.c b/drivers/hwmon/asc7621.c index e8145bb13ab3..94d254336a08 100644 --- a/drivers/hwmon/asc7621.c +++ b/drivers/hwmon/asc7621.c @@ -1095,8 +1095,7 @@ asc7621_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - data = devm_kzalloc(&client->dev, sizeof(struct asc7621_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct asc7621_data); if (data == NULL) return -ENOMEM; diff --git a/drivers/hwmon/aspeed-g6-pwm-tach.c b/drivers/hwmon/aspeed-g6-pwm-tach.c index 5d611a8e5269..f07c9a036b69 100644 --- a/drivers/hwmon/aspeed-g6-pwm-tach.c +++ b/drivers/hwmon/aspeed-g6-pwm-tach.c @@ -462,7 +462,7 @@ static int aspeed_pwm_tach_probe(struct platform_device *pdev) struct aspeed_pwm_tach_data *priv; struct pwm_chip *chip; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; priv->dev = dev; diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-tacho.c index bfce589c3fb1..9e64b3d5a787 100644 --- a/drivers/hwmon/aspeed-pwm-tacho.c +++ b/drivers/hwmon/aspeed-pwm-tacho.c @@ -822,7 +822,7 @@ static int aspeed_create_pwm_cooling(struct device *dev, int ret; struct aspeed_cooling_device *cdev; - cdev = devm_kzalloc(dev, sizeof(*cdev), GFP_KERNEL); + cdev = devm_kzalloc_obj(dev, *cdev); if (!cdev) return -ENOMEM; @@ -919,7 +919,7 @@ static int aspeed_pwm_tacho_probe(struct platform_device *pdev) regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(regs)) return PTR_ERR(regs); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; mutex_init(&priv->tach_lock); diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c index 19f423e45ce5..a3cb595e713b 100644 --- a/drivers/hwmon/asus-ec-sensors.c +++ b/drivers/hwmon/asus-ec-sensors.c @@ -1476,8 +1476,7 @@ static int asus_ec_probe(struct platform_device *pdev) if (!pboard_info) return -ENODEV; - ec_data = devm_kzalloc(dev, sizeof(struct ec_sensors_data), - GFP_KERNEL); + ec_data = devm_kzalloc_obj(dev, struct ec_sensors_data); if (!ec_data) return -ENOMEM; @@ -1526,8 +1525,8 @@ static int asus_ec_probe(struct platform_device *pdev) } ec_data->nr_sensors = hweight_long(ec_data->board_info->sensors); - ec_data->sensors = devm_kcalloc(dev, ec_data->nr_sensors, - sizeof(struct ec_sensor), GFP_KERNEL); + ec_data->sensors = devm_kzalloc_objs(dev, struct ec_sensor, + ec_data->nr_sensors); if (!ec_data->sensors) return -ENOMEM; @@ -1538,8 +1537,7 @@ static int asus_ec_probe(struct platform_device *pdev) } setup_sensor_data(ec_data); - ec_data->registers = devm_kcalloc(dev, ec_data->nr_registers, - sizeof(u16), GFP_KERNEL); + ec_data->registers = devm_kzalloc_objs(dev, u16, ec_data->nr_registers); ec_data->read_buffer = devm_kcalloc(dev, ec_data->nr_registers, sizeof(u8), GFP_KERNEL); @@ -1558,13 +1556,12 @@ static int asus_ec_probe(struct platform_device *pdev) if (nr_count[hwmon_temp]) nr_count[hwmon_chip]++, nr_types++; - asus_ec_hwmon_chan = devm_kcalloc( - dev, nr_types, sizeof(*asus_ec_hwmon_chan), GFP_KERNEL); + asus_ec_hwmon_chan = devm_kzalloc_objs(dev, *asus_ec_hwmon_chan, + nr_types); if (!asus_ec_hwmon_chan) return -ENOMEM; - ptr_asus_ec_ci = devm_kcalloc(dev, nr_types + 1, - sizeof(*ptr_asus_ec_ci), GFP_KERNEL); + ptr_asus_ec_ci = devm_kzalloc_objs(dev, *ptr_asus_ec_ci, nr_types + 1); if (!ptr_asus_ec_ci) return -ENOMEM; diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c index 868c4e14d26a..db6e286be619 100644 --- a/drivers/hwmon/asus_atk0110.c +++ b/drivers/hwmon/asus_atk0110.c @@ -886,7 +886,7 @@ static int atk_add_sensor(struct atk_data *data, union acpi_object *obj) limit1 = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT1); limit2 = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT2); - sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(dev, *sensor); if (!sensor) return -ENOMEM; @@ -1165,7 +1165,7 @@ static int atk_init_attribute_groups(struct atk_data *data) int len = (data->voltage_count + data->temperature_count + data->fan_count) * 4 + 1; - attrs = devm_kcalloc(dev, len, sizeof(struct attribute *), GFP_KERNEL); + attrs = devm_kzalloc_objs(dev, struct attribute *, len); if (!attrs) return -ENOMEM; @@ -1284,7 +1284,7 @@ static int atk_probe(struct platform_device *pdev) if (!handle) return -ENODEV; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/asus_rog_ryujin.c b/drivers/hwmon/asus_rog_ryujin.c index 5ced69e94ead..0b4f9cd427ab 100644 --- a/drivers/hwmon/asus_rog_ryujin.c +++ b/drivers/hwmon/asus_rog_ryujin.c @@ -530,7 +530,7 @@ static int rog_ryujin_probe(struct hid_device *hdev, const struct hid_device_id if (!id->driver_data) return -EINVAL; - priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&hdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/asus_wmi_sensors.c b/drivers/hwmon/asus_wmi_sensors.c index 621e3506972d..372796d05bb0 100644 --- a/drivers/hwmon/asus_wmi_sensors.c +++ b/drivers/hwmon/asus_wmi_sensors.c @@ -252,7 +252,7 @@ static int asus_wmi_hwmon_add_chan_info(struct hwmon_channel_info *asus_wmi_hwmo { u32 *cfg; - cfg = devm_kcalloc(dev, num + 1, sizeof(*cfg), GFP_KERNEL); + cfg = devm_kzalloc_objs(dev, *cfg, num + 1); if (!cfg) return -ENOMEM; @@ -538,23 +538,21 @@ static int asus_wmi_configure_sensor_setup(struct device *dev, if (nr_count[hwmon_temp]) nr_count[hwmon_chip]++, nr_types++; - asus_wmi_hwmon_chan = devm_kcalloc(dev, nr_types, - sizeof(*asus_wmi_hwmon_chan), - GFP_KERNEL); + asus_wmi_hwmon_chan = devm_kzalloc_objs(dev, *asus_wmi_hwmon_chan, + nr_types); if (!asus_wmi_hwmon_chan) return -ENOMEM; - ptr_asus_wmi_ci = devm_kcalloc(dev, nr_types + 1, - sizeof(*ptr_asus_wmi_ci), GFP_KERNEL); + ptr_asus_wmi_ci = devm_kzalloc_objs(dev, *ptr_asus_wmi_ci, nr_types + 1); if (!ptr_asus_wmi_ci) return -ENOMEM; asus_wmi_chip_info.info = ptr_asus_wmi_ci; chip_info = &asus_wmi_chip_info; - sensor_data->wmi.info_by_id = devm_kcalloc(dev, sensor_data->wmi.sensor_count, - sizeof(*sensor_data->wmi.info_by_id), - GFP_KERNEL); + sensor_data->wmi.info_by_id = devm_kzalloc_objs(dev, + *sensor_data->wmi.info_by_id, + sensor_data->wmi.sensor_count); if (!sensor_data->wmi.info_by_id) return -ENOMEM; @@ -571,16 +569,15 @@ static int asus_wmi_configure_sensor_setup(struct device *dev, *ptr_asus_wmi_ci++ = asus_wmi_hwmon_chan++; - sensor_data->wmi.info[type] = devm_kcalloc(dev, - nr_count[type], - sizeof(*sensor_data->wmi.info[type]), - GFP_KERNEL); + sensor_data->wmi.info[type] = devm_kzalloc_objs(dev, + *sensor_data->wmi.info[type], + nr_count[type]); if (!sensor_data->wmi.info[type]) return -ENOMEM; } for (i = sensor_data->wmi.sensor_count - 1; i >= 0; i--) { - temp_sensor = devm_kzalloc(dev, sizeof(*temp_sensor), GFP_KERNEL); + temp_sensor = devm_kzalloc_obj(dev, *temp_sensor); if (!temp_sensor) return -ENOMEM; @@ -620,7 +617,7 @@ static int asus_wmi_probe(struct wmi_device *wdev, const void *context) if (!dmi_check_system(asus_wmi_dmi_table)) return -ENODEV; - sensor_data = devm_kzalloc(dev, sizeof(*sensor_data), GFP_KERNEL); + sensor_data = devm_kzalloc_obj(dev, *sensor_data); if (!sensor_data) return -ENOMEM; diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index f5de4894f0a2..10f9f38406d7 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c @@ -251,7 +251,7 @@ static int atxp1_probe(struct i2c_client *client) struct atxp1_data *data; struct device *hwmon_dev; - data = devm_kzalloc(dev, sizeof(struct atxp1_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct atxp1_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/axi-fan-control.c b/drivers/hwmon/axi-fan-control.c index 04a767d762b3..b3718a217484 100644 --- a/drivers/hwmon/axi-fan-control.c +++ b/drivers/hwmon/axi-fan-control.c @@ -456,7 +456,7 @@ static int axi_fan_control_probe(struct platform_device *pdev) if (!id) return -EINVAL; - ctl = devm_kzalloc(&pdev->dev, sizeof(*ctl), GFP_KERNEL); + ctl = devm_kzalloc_obj(&pdev->dev, *ctl); if (!ctl) return -ENOMEM; diff --git a/drivers/hwmon/axiado-pwm-fan.c b/drivers/hwmon/axiado-pwm-fan.c index 6fca5292eb25..09dd3e72c579 100644 --- a/drivers/hwmon/axiado-pwm-fan.c +++ b/drivers/hwmon/axiado-pwm-fan.c @@ -239,7 +239,7 @@ static int axiado_pwm_fan_probe(struct platform_device *pdev) struct clk *tach_clk; int ret; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/hwmon/axiado-tsadc.c b/drivers/hwmon/axiado-tsadc.c index c111df6f0044..a6277cc65e80 100644 --- a/drivers/hwmon/axiado-tsadc.c +++ b/drivers/hwmon/axiado-tsadc.c @@ -217,7 +217,7 @@ static int axiado_tsadc_probe(struct platform_device *pdev) struct clk *refclk; int ret; - tsadc = devm_kzalloc(dev, sizeof(*tsadc), GFP_KERNEL); + tsadc = devm_kzalloc_obj(dev, *tsadc); if (!tsadc) return -ENOMEM; diff --git a/drivers/hwmon/cgbc-hwmon.c b/drivers/hwmon/cgbc-hwmon.c index 230062a46907..ba21ed8f0cea 100644 --- a/drivers/hwmon/cgbc-hwmon.c +++ b/drivers/hwmon/cgbc-hwmon.c @@ -309,7 +309,7 @@ static int cgbc_hwmon_probe(struct platform_device *pdev) struct device *hwmon_dev; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/chipcap2.c b/drivers/hwmon/chipcap2.c index 9bef767b589e..c42b09ce67f7 100644 --- a/drivers/hwmon/chipcap2.c +++ b/drivers/hwmon/chipcap2.c @@ -711,7 +711,7 @@ static int cc2_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -EOPNOTSUPP; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/corsair-cpro.c b/drivers/hwmon/corsair-cpro.c index e6d31d367698..f6edeaf265f7 100644 --- a/drivers/hwmon/corsair-cpro.c +++ b/drivers/hwmon/corsair-cpro.c @@ -589,7 +589,7 @@ static int ccp_probe(struct hid_device *hdev, const struct hid_device_id *id) bool fw_valid, bl_valid; int ret; - ccp = devm_kzalloc(&hdev->dev, sizeof(*ccp), GFP_KERNEL); + ccp = devm_kzalloc_obj(&hdev->dev, *ccp); if (!ccp) return -ENOMEM; diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c index b545461d4ced..7258d0e4ce16 100644 --- a/drivers/hwmon/corsair-psu.c +++ b/drivers/hwmon/corsair-psu.c @@ -776,7 +776,7 @@ static int corsairpsu_probe(struct hid_device *hdev, const struct hid_device_id struct corsairpsu_data *priv; int ret; - priv = devm_kzalloc(&hdev->dev, sizeof(struct corsairpsu_data), GFP_KERNEL); + priv = devm_kzalloc_obj(&hdev->dev, struct corsairpsu_data); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/cros_ec_hwmon.c b/drivers/hwmon/cros_ec_hwmon.c index 27af13f0941c..685cb42534d9 100644 --- a/drivers/hwmon/cros_ec_hwmon.c +++ b/drivers/hwmon/cros_ec_hwmon.c @@ -538,7 +538,7 @@ static void cros_ec_hwmon_register_fan_cooling_devices(struct device *dev, if (!(priv->usable_fans & BIT(i))) continue; - cpriv = devm_kzalloc(dev, sizeof(*cpriv), GFP_KERNEL); + cpriv = devm_kzalloc_obj(dev, *cpriv); if (!cpriv) continue; @@ -577,7 +577,7 @@ static int cros_ec_hwmon_probe(struct platform_device *pdev) if (thermal_version == 0) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/da9052-hwmon.c b/drivers/hwmon/da9052-hwmon.c index 588e96790850..a795b71c54f6 100644 --- a/drivers/hwmon/da9052-hwmon.c +++ b/drivers/hwmon/da9052-hwmon.c @@ -398,7 +398,7 @@ static int da9052_hwmon_probe(struct platform_device *pdev) struct device *hwmon_dev; int err, tsiref_uv; - hwmon = devm_kzalloc(dev, sizeof(struct da9052_hwmon), GFP_KERNEL); + hwmon = devm_kzalloc_obj(dev, struct da9052_hwmon); if (!hwmon) return -ENOMEM; diff --git a/drivers/hwmon/da9055-hwmon.c b/drivers/hwmon/da9055-hwmon.c index 7d330baa0f05..9607ea2dae6f 100644 --- a/drivers/hwmon/da9055-hwmon.c +++ b/drivers/hwmon/da9055-hwmon.c @@ -238,7 +238,7 @@ static int da9055_hwmon_probe(struct platform_device *pdev) struct device *hwmon_dev; int hwmon_irq, ret; - hwmon = devm_kzalloc(dev, sizeof(struct da9055_hwmon), GFP_KERNEL); + hwmon = devm_kzalloc_obj(dev, struct da9055_hwmon); if (!hwmon) return -ENOMEM; diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index 88837f028405..5ec487843faa 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -1142,7 +1142,7 @@ static int dell_smm_init_cdev(struct device *dev, u8 fan_num) if (!name) return -ENOMEM; - cdata = devm_kmalloc(dev, sizeof(*cdata), GFP_KERNEL); + cdata = devm_kmalloc_obj(dev, *cdata); if (cdata) { cdata->fan_num = fan_num; cdata->data = data; @@ -1196,9 +1196,9 @@ static int dell_smm_init_hwmon(struct device *dev) i + 1); } - data->fan_nominal_speed[i] = devm_kmalloc_array(dev, data->i8k_fan_max + 1, - sizeof(*data->fan_nominal_speed[i]), - GFP_KERNEL); + data->fan_nominal_speed[i] = devm_kmalloc_objs(dev, + *data->fan_nominal_speed[i], + data->i8k_fan_max + 1); if (!data->fan_nominal_speed[i]) continue; @@ -1231,7 +1231,7 @@ static int dell_smm_init_data(struct device *dev, const struct dell_smm_ops *ops { struct dell_smm_data *data; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; @@ -1726,7 +1726,7 @@ static int dell_smm_wmi_probe(struct wmi_device *wdev, const void *context) struct dell_smm_ops *ops; int ret; - ops = devm_kzalloc(&wdev->dev, sizeof(*ops), GFP_KERNEL); + ops = devm_kzalloc_obj(&wdev->dev, *ops); if (!ops) return -ENOMEM; diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c index 7e839308e58f..7d8cb1fc4b90 100644 --- a/drivers/hwmon/dme1737.c +++ b/drivers/hwmon/dme1737.c @@ -2467,7 +2467,7 @@ static int dme1737_i2c_probe(struct i2c_client *client) struct device *dev = &client->dev; int err; - data = devm_kzalloc(dev, sizeof(struct dme1737_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct dme1737_data); if (!data) return -ENOMEM; @@ -2636,7 +2636,7 @@ static int dme1737_isa_probe(struct platform_device *pdev) return -EBUSY; } - data = devm_kzalloc(dev, sizeof(struct dme1737_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct dme1737_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index 0618f6de9679..9c4590efee7a 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c @@ -347,8 +347,7 @@ static int ds1621_probe(struct i2c_client *client) struct ds1621_data *data; struct device *hwmon_dev; - data = devm_kzalloc(&client->dev, sizeof(struct ds1621_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct ds1621_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ds620.c b/drivers/hwmon/ds620.c index 25287f0fa4c2..4b7cc41e7a4f 100644 --- a/drivers/hwmon/ds620.c +++ b/drivers/hwmon/ds620.c @@ -217,7 +217,7 @@ static int ds620_probe(struct i2c_client *client) struct device *hwmon_dev; struct ds620_data *data; - data = devm_kzalloc(dev, sizeof(struct ds620_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct ds620_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/eic7700-pvt.c b/drivers/hwmon/eic7700-pvt.c index d7403ab33f4e..130cdd2683e6 100644 --- a/drivers/hwmon/eic7700-pvt.c +++ b/drivers/hwmon/eic7700-pvt.c @@ -301,7 +301,7 @@ static struct pvt_hwmon *eic7700_pvt_create_data(struct platform_device *pdev) struct device *dev = &pdev->dev; struct pvt_hwmon *pvt; - pvt = devm_kzalloc(dev, sizeof(*pvt), GFP_KERNEL); + pvt = devm_kzalloc_obj(dev, *pvt); if (!pvt) return ERR_PTR(-ENOMEM); diff --git a/drivers/hwmon/emc1403.c b/drivers/hwmon/emc1403.c index d737505acd9d..13ecc7372d9f 100644 --- a/drivers/hwmon/emc1403.c +++ b/drivers/hwmon/emc1403.c @@ -662,8 +662,7 @@ static int emc1403_probe(struct i2c_client *client) return dev_err_probe(&client->dev, ret, "Failed to enable regulator\n"); - data = devm_kzalloc(&client->dev, sizeof(struct thermal_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct thermal_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/emc1812.c b/drivers/hwmon/emc1812.c index 68575c27d090..b031d8174c4d 100644 --- a/drivers/hwmon/emc1812.c +++ b/drivers/hwmon/emc1812.c @@ -888,7 +888,7 @@ static int emc1812_probe(struct i2c_client *client) struct device *hwmon_dev; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c index 4adc23ffaf72..831a5d684127 100644 --- a/drivers/hwmon/emc2103.c +++ b/drivers/hwmon/emc2103.c @@ -564,8 +564,7 @@ emc2103_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - data = devm_kzalloc(&client->dev, sizeof(struct emc2103_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct emc2103_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c index eef3b021671b..434e70e76f5f 100644 --- a/drivers/hwmon/emc2305.c +++ b/drivers/hwmon/emc2305.c @@ -641,7 +641,7 @@ static int emc2305_probe(struct i2c_client *client) if (vendor != EMC2305_VENDOR) return -ENODEV; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/emc6w201.c b/drivers/hwmon/emc6w201.c index c13ea8748683..f34da4502984 100644 --- a/drivers/hwmon/emc6w201.c +++ b/drivers/hwmon/emc6w201.c @@ -450,7 +450,7 @@ static int emc6w201_probe(struct i2c_client *client) struct emc6w201_data *data; struct device *hwmon_dev; - data = devm_kzalloc(dev, sizeof(struct emc6w201_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct emc6w201_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c index 820f894d9ffd..8a004da5f424 100644 --- a/drivers/hwmon/f71805f.c +++ b/drivers/hwmon/f71805f.c @@ -1378,8 +1378,7 @@ static int f71805f_probe(struct platform_device *pdev) "f71872f", }; - data = devm_kzalloc(&pdev->dev, sizeof(struct f71805f_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct f71805f_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index 204059d2de6c..3e75ddc57ab6 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c @@ -2346,8 +2346,7 @@ static int f71882fg_probe(struct platform_device *pdev) int size; u8 start_reg, reg; - data = devm_kzalloc(&pdev->dev, sizeof(struct f71882fg_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct f71882fg_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index cc3a9612f2c0..de81d041294b 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c @@ -798,8 +798,7 @@ static int f75375_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - data = devm_kzalloc(&client->dev, sizeof(struct f75375_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct f75375_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index ad4ed4162b57..151fbdaa6e38 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c @@ -302,9 +302,8 @@ static int fam15h_power_init_attrs(struct pci_dev *pdev, if (boot_cpu_has(X86_FEATURE_ACC_POWER)) n += 2; - fam15h_power_attrs = devm_kcalloc(&pdev->dev, n, - sizeof(*fam15h_power_attrs), - GFP_KERNEL); + fam15h_power_attrs = devm_kzalloc_objs(&pdev->dev, *fam15h_power_attrs, + n); if (!fam15h_power_attrs) return -ENOMEM; @@ -460,7 +459,7 @@ static int fam15h_power_probe(struct pci_dev *pdev, if (!should_load_on_this_node(pdev)) return -ENODEV; - data = devm_kzalloc(dev, sizeof(struct fam15h_power_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct fam15h_power_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ftsteutates.c b/drivers/hwmon/ftsteutates.c index 10d786960ed6..76e69139e56d 100644 --- a/drivers/hwmon/ftsteutates.c +++ b/drivers/hwmon/ftsteutates.c @@ -632,8 +632,7 @@ static int fts_probe(struct i2c_client *client) return -ENODEV; } - data = devm_kzalloc(&client->dev, sizeof(struct fts_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct fts_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/g760a.c b/drivers/hwmon/g760a.c index e2166ee76286..808f4a7e77d0 100644 --- a/drivers/hwmon/g760a.c +++ b/drivers/hwmon/g760a.c @@ -179,7 +179,7 @@ static int g760a_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - data = devm_kzalloc(dev, sizeof(struct g760a_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct g760a_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/g762.c b/drivers/hwmon/g762.c index 407cf7af4fdd..0e5f9ab5456b 100644 --- a/drivers/hwmon/g762.c +++ b/drivers/hwmon/g762.c @@ -1076,7 +1076,7 @@ static int g762_probe(struct i2c_client *client) I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; - data = devm_kzalloc(dev, sizeof(struct g762_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct g762_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/gigabyte_waterforce.c b/drivers/hwmon/gigabyte_waterforce.c index f4d0376dd68e..9e96fb9e290e 100644 --- a/drivers/hwmon/gigabyte_waterforce.c +++ b/drivers/hwmon/gigabyte_waterforce.c @@ -319,7 +319,7 @@ static int waterforce_probe(struct hid_device *hdev, const struct hid_device_id struct waterforce_data *priv; int ret; - priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&hdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c index 742c130cec7f..cf4b117e4068 100644 --- a/drivers/hwmon/gl518sm.c +++ b/drivers/hwmon/gl518sm.c @@ -618,7 +618,7 @@ static int gl518_probe(struct i2c_client *client) struct gl518_data *data; int revision; - data = devm_kzalloc(dev, sizeof(struct gl518_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct gl518_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c index f4fe39912ee2..2e3d5b0a3660 100644 --- a/drivers/hwmon/gl520sm.c +++ b/drivers/hwmon/gl520sm.c @@ -860,7 +860,7 @@ static int gl520_probe(struct i2c_client *client) struct device *hwmon_dev; struct gl520_data *data; - data = devm_kzalloc(dev, sizeof(struct gl520_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct gl520_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/gpd-fan.c b/drivers/hwmon/gpd-fan.c index ed212615b2fe..dee93e00815d 100644 --- a/drivers/hwmon/gpd-fan.c +++ b/drivers/hwmon/gpd-fan.c @@ -644,7 +644,7 @@ static int gpd_fan_probe(struct platform_device *pdev) return dev_err_probe(dev, -EBUSY, "Failed to request region\n"); - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index 3f78375eeb44..690a7534948d 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c @@ -466,9 +466,7 @@ static int gpio_fan_get_of_data(struct gpio_fan_data *fan_data) dev_err(dev, "DT properties empty / missing"); return -ENODEV; } - gpios = devm_kcalloc(dev, - fan_data->num_gpios, sizeof(struct gpio_desc *), - GFP_KERNEL); + gpios = devm_kzalloc_objs(dev, struct gpio_desc *, fan_data->num_gpios); if (!gpios) return -ENOMEM; for (i = 0; i < fan_data->num_gpios; i++) { @@ -496,9 +494,8 @@ static int gpio_fan_get_of_data(struct gpio_fan_data *fan_data) * Speed map is in the form * this needs splitting into pairs to create gpio_fan_speed structs */ - speed = devm_kcalloc(dev, - fan_data->num_speed, sizeof(struct gpio_fan_speed), - GFP_KERNEL); + speed = devm_kzalloc_objs(dev, struct gpio_fan_speed, + fan_data->num_speed); if (!speed) return -ENOMEM; p = NULL; @@ -541,8 +538,7 @@ static int gpio_fan_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - fan_data = devm_kzalloc(dev, sizeof(struct gpio_fan_data), - GFP_KERNEL); + fan_data = devm_kzalloc_obj(dev, struct gpio_fan_data); if (!fan_data) return -ENOMEM; diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c index 105b9f9dbec3..83005d8ae47e 100644 --- a/drivers/hwmon/gsc-hwmon.c +++ b/drivers/hwmon/gsc-hwmon.c @@ -248,8 +248,7 @@ gsc_hwmon_get_devtree_pdata(struct device *dev) if (nchannels == 0) return ERR_PTR(-ENODEV); - pdata = devm_kzalloc(dev, struct_size(pdata, channels, nchannels), - GFP_KERNEL); + pdata = devm_kzalloc_flex(dev, *pdata, channels, nchannels); if (!pdata) return ERR_PTR(-ENOMEM); pdata->nchannels = nchannels; @@ -314,7 +313,7 @@ static int gsc_hwmon_probe(struct platform_device *pdev) return PTR_ERR(pdata); } - hwmon = devm_kzalloc(dev, sizeof(*hwmon), GFP_KERNEL); + hwmon = devm_kzalloc_obj(dev, *hwmon); if (!hwmon) return -ENOMEM; hwmon->gsc = gsc; diff --git a/drivers/hwmon/gxp-fan-ctrl.c b/drivers/hwmon/gxp-fan-ctrl.c index 64f85d7e748e..c96210a30852 100644 --- a/drivers/hwmon/gxp-fan-ctrl.c +++ b/drivers/hwmon/gxp-fan-ctrl.c @@ -111,8 +111,7 @@ static int gxp_fan_ctrl_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device *hwmon_dev; - drvdata = devm_kzalloc(dev, sizeof(struct gxp_fan_ctrl_drvdata), - GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, struct gxp_fan_ctrl_drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwmon/hih6130.c b/drivers/hwmon/hih6130.c index 6a79aab5d128..bbfe78c7b9ac 100644 --- a/drivers/hwmon/hih6130.c +++ b/drivers/hwmon/hih6130.c @@ -215,7 +215,7 @@ static int hih6130_probe(struct i2c_client *client) return -ENODEV; } - hih6130 = devm_kzalloc(dev, sizeof(*hih6130), GFP_KERNEL); + hih6130 = devm_kzalloc_obj(dev, *hih6130); if (!hih6130) return -ENOMEM; diff --git a/drivers/hwmon/honor-fmi.c b/drivers/hwmon/honor-fmi.c index 3421e40a132f..c43a736b99ed 100644 --- a/drivers/hwmon/honor-fmi.c +++ b/drivers/hwmon/honor-fmi.c @@ -117,7 +117,7 @@ static int honor_fmi_probe(struct platform_device *pdev) if (!dmi_check_system(honor_fmi_dmi_table)) return -ENODEV; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/hp-wmi-sensors.c b/drivers/hwmon/hp-wmi-sensors.c index d8bcfeb8d5b2..86692f695917 100644 --- a/drivers/hwmon/hp-wmi-sensors.c +++ b/drivers/hwmon/hp-wmi-sensors.c @@ -842,8 +842,7 @@ populate_numeric_sensor_from_wobj(struct device *dev, if (err) return err; - possible_states = devm_kcalloc(dev, size, sizeof(*possible_states), - GFP_KERNEL); + possible_states = devm_kzalloc_objs(dev, *possible_states, size); if (!possible_states) return -ENOMEM; @@ -1704,7 +1703,7 @@ static int init_platform_events(struct device *dev, return 0; } - pevents_arr = devm_kcalloc(dev, count, sizeof(*pevents), GFP_KERNEL); + pevents_arr = devm_kzalloc_objs(dev, *pevents, count); if (!pevents_arr) return -ENOMEM; @@ -1756,7 +1755,7 @@ static int init_numeric_sensors(struct hp_wmi_sensors *state, if (!icount) return -ENODATA; - info_arr = devm_kcalloc(dev, icount, sizeof(*info), GFP_KERNEL); + info_arr = devm_kzalloc_objs(dev, *info, icount); if (!info_arr) return -ENOMEM; @@ -1803,9 +1802,8 @@ static int init_numeric_sensors(struct hp_wmi_sensors *state, c = channel_index[type]++; if (!info_map[type]) { - info_map[type] = devm_kcalloc(dev, channel_count[type], - sizeof(*info_map[type]), - GFP_KERNEL); + info_map[type] = devm_kzalloc_objs(dev, *info_map[type], + channel_count[type]); if (!info_map[type]) return -ENOMEM; } @@ -1952,13 +1950,12 @@ static int make_chip_info(struct hp_wmi_sensors *state, bool has_events) if (channel_count[type]) type_count++; - channel_info = devm_kcalloc(dev, type_count, - sizeof(*channel_info), GFP_KERNEL); + channel_info = devm_kzalloc_objs(dev, *channel_info, type_count); if (!channel_info) return -ENOMEM; - ptr_channel_info = devm_kcalloc(dev, type_count + 1, - sizeof(*ptr_channel_info), GFP_KERNEL); + ptr_channel_info = devm_kzalloc_objs(dev, *ptr_channel_info, + type_count + 1); if (!ptr_channel_info) return -ENOMEM; @@ -1969,8 +1966,7 @@ static int make_chip_info(struct hp_wmi_sensors *state, bool has_events) if (!count) continue; - config = devm_kcalloc(dev, count + 1, - sizeof(*config), GFP_KERNEL); + config = devm_kzalloc_objs(dev, *config, count + 1); if (!config) return -ENOMEM; @@ -2063,7 +2059,7 @@ static int hp_wmi_sensors_probe(struct wmi_device *wdev, const void *context) struct device *dev = &wdev->dev; struct hp_wmi_sensors *state; - state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/hwmon/hs3001.c b/drivers/hwmon/hs3001.c index b263cbeca074..fde3f5683f74 100644 --- a/drivers/hwmon/hs3001.c +++ b/drivers/hwmon/hs3001.c @@ -191,7 +191,7 @@ static int hs3001_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -EOPNOTSUPP; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/htu31.c b/drivers/hwmon/htu31.c index 5d2cdbdb773b..7cdc6159b6e6 100644 --- a/drivers/hwmon/htu31.c +++ b/drivers/hwmon/htu31.c @@ -287,7 +287,7 @@ static int htu31_probe(struct i2c_client *client) struct htu31_data *data; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 3f32b0e83b53..73a818806d3d 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -233,7 +233,7 @@ static int hwmon_thermal_add_sensor(struct device *dev, int index) struct thermal_zone_device *tzd; int err; - tdata = devm_kzalloc(dev, sizeof(*tdata), GFP_KERNEL); + tdata = devm_kzalloc_obj(dev, *tdata); if (!tdata) return -ENOMEM; diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c index 70ca833259ab..75ba50215bc6 100644 --- a/drivers/hwmon/ibmpowernv.c +++ b/drivers/hwmon/ibmpowernv.c @@ -352,8 +352,8 @@ static int init_sensor_group_data(struct platform_device *pdev, if (!pdata->nr_sensor_groups) goto out; - sgrp_data = devm_kcalloc(&pdev->dev, pdata->nr_sensor_groups, - sizeof(*sgrp_data), GFP_KERNEL); + sgrp_data = devm_kzalloc_objs(&pdev->dev, *sgrp_data, + pdata->nr_sensor_groups); if (!sgrp_data) { ret = -ENOMEM; goto out; @@ -465,10 +465,9 @@ static int populate_attr_groups(struct platform_device *pdev) of_node_put(opal); for (type = 0; type < MAX_SENSOR_TYPE; type++) { - sensor_groups[type].group.attrs = devm_kcalloc(&pdev->dev, - sensor_groups[type].attr_count + 1, - sizeof(struct attribute *), - GFP_KERNEL); + sensor_groups[type].group.attrs = devm_kzalloc_objs(&pdev->dev, + struct attribute *, + sensor_groups[type].attr_count + 1); if (!sensor_groups[type].group.attrs) return -ENOMEM; @@ -558,9 +557,7 @@ static int create_device_attrs(struct platform_device *pdev) u32 count = 0; u32 group_attr_id[MAX_SENSOR_TYPE] = {0}; - sdata = devm_kcalloc(&pdev->dev, - pdata->sensors_count, sizeof(*sdata), - GFP_KERNEL); + sdata = devm_kzalloc_objs(&pdev->dev, *sdata, pdata->sensors_count); if (!sdata) return -ENOMEM; @@ -665,7 +662,7 @@ static int ibmpowernv_probe(struct platform_device *pdev) struct device *hwmon_dev; int err; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c index 6502e20517a8..84140068c5f6 100644 --- a/drivers/hwmon/iio_hwmon.c +++ b/drivers/hwmon/iio_hwmon.c @@ -96,7 +96,7 @@ static int iio_hwmon_probe(struct platform_device *pdev) "Failed to get channels\n"); } - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); buf = (void *)devm_get_free_pages(dev, GFP_KERNEL, 0); if (!st || !buf) return -ENOMEM; @@ -107,9 +107,7 @@ static int iio_hwmon_probe(struct platform_device *pdev) while (st->channels[st->num_channels].indio_dev) st->num_channels++; - st->attrs = devm_kcalloc(dev, - 2 * st->num_channels + 1, sizeof(*st->attrs), - GFP_KERNEL); + st->attrs = devm_kzalloc_objs(dev, *st->attrs, 2 * st->num_channels + 1); if (st->attrs == NULL) return -ENOMEM; @@ -117,7 +115,7 @@ static int iio_hwmon_probe(struct platform_device *pdev) const char *prefix; int n; - a = devm_kzalloc(dev, sizeof(*a), GFP_KERNEL); + a = devm_kzalloc_obj(dev, *a); if (a == NULL) return -ENOMEM; @@ -166,7 +164,7 @@ static int iio_hwmon_probe(struct platform_device *pdev) if (iio_read_channel_label(&st->channels[i], buf) < 0) continue; - a = devm_kzalloc(dev, sizeof(*a), GFP_KERNEL); + a = devm_kzalloc_obj(dev, *a); if (a == NULL) return -ENOMEM; diff --git a/drivers/hwmon/ina209.c b/drivers/hwmon/ina209.c index 39aca2cdf27f..4dd7159d651f 100644 --- a/drivers/hwmon/ina209.c +++ b/drivers/hwmon/ina209.c @@ -534,7 +534,7 @@ static int ina209_probe(struct i2c_client *client) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) return -ENODEV; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ina238.c b/drivers/hwmon/ina238.c index 3632bbca607e..49e3de561a1d 100644 --- a/drivers/hwmon/ina238.c +++ b/drivers/hwmon/ina238.c @@ -891,7 +891,7 @@ static int ina238_probe(struct i2c_client *client) chip = (uintptr_t)i2c_get_match_data(client); - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 19b35f3bf3a3..aa5b39a87622 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -1092,7 +1092,7 @@ static int ina2xx_probe(struct i2c_client *client) chip = (uintptr_t)i2c_get_match_data(client); - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c index 3ab5de3a1110..35aa255b8c62 100644 --- a/drivers/hwmon/ina3221.c +++ b/drivers/hwmon/ina3221.c @@ -821,7 +821,7 @@ static int ina3221_probe(struct i2c_client *client) char name[32]; int i, ret; - ina = devm_kzalloc(dev, sizeof(*ina), GFP_KERNEL); + ina = devm_kzalloc_obj(dev, *ina); if (!ina) return -ENOMEM; diff --git a/drivers/hwmon/intel-m10-bmc-hwmon.c b/drivers/hwmon/intel-m10-bmc-hwmon.c index d75303ed93e5..fdbb68743ae4 100644 --- a/drivers/hwmon/intel-m10-bmc-hwmon.c +++ b/drivers/hwmon/intel-m10-bmc-hwmon.c @@ -733,7 +733,7 @@ static int m10bmc_hwmon_probe(struct platform_device *pdev) struct device *hwmon_dev, *dev = &pdev->dev; struct m10bmc_hwmon *hw; - hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL); + hw = devm_kzalloc_obj(dev, *hw); if (!hw) return -ENOMEM; diff --git a/drivers/hwmon/isl28022.c b/drivers/hwmon/isl28022.c index 0c60d2ef28f5..2c04f73ac9e1 100644 --- a/drivers/hwmon/isl28022.c +++ b/drivers/hwmon/isl28022.c @@ -448,7 +448,7 @@ static int isl28022_probe(struct i2c_client *client) I2C_FUNC_SMBUS_WORD_DATA)) return -ENODEV; - data = devm_kzalloc(dev, sizeof(struct isl28022_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct isl28022_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 2757d428a23d..bbb3f9788c2e 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -3666,7 +3666,7 @@ static int it87_probe(struct platform_device *pdev) return -EBUSY; } - data = devm_kzalloc(&pdev->dev, sizeof(struct it87_data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct it87_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c index f6cae24cca9e..3a0308a5c656 100644 --- a/drivers/hwmon/jc42.c +++ b/drivers/hwmon/jc42.c @@ -478,7 +478,7 @@ static int jc42_probe(struct i2c_client *client) struct jc42_data *data; int ret; - data = devm_kzalloc(dev, sizeof(struct jc42_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct jc42_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index 76f8829dd63d..03f849bb958d 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c @@ -450,7 +450,7 @@ static int k10temp_probe(struct pci_dev *pdev, const struct pci_device_id *id) "unreliable CPU thermal sensor; check erratum 319\n"); } - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c index 53241164570e..b769d99cbb5f 100644 --- a/drivers/hwmon/k8temp.c +++ b/drivers/hwmon/k8temp.c @@ -139,7 +139,7 @@ static int k8temp_probe(struct pci_dev *pdev, struct k8temp_data *data; struct device *hwmon_dev; - data = devm_kzalloc(&pdev->dev, sizeof(struct k8temp_data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct k8temp_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/kb9002.c b/drivers/hwmon/kb9002.c index 9f4521630f3a..fe412c257835 100644 --- a/drivers/hwmon/kb9002.c +++ b/drivers/hwmon/kb9002.c @@ -389,7 +389,7 @@ static int kb9002_probe(struct i2c_client *client) I2C_FUNC_SMBUS_PEC)) return -ENODEV; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/kbatt.c b/drivers/hwmon/kbatt.c index 501b8f4ded33..79370f4667b2 100644 --- a/drivers/hwmon/kbatt.c +++ b/drivers/hwmon/kbatt.c @@ -110,7 +110,7 @@ static int kbatt_probe(struct auxiliary_device *auxdev, struct kbatt *kbatt; int retval; - kbatt = devm_kzalloc(dev, sizeof(*kbatt), GFP_KERNEL); + kbatt = devm_kzalloc_obj(dev, *kbatt); if (!kbatt) return -ENOMEM; diff --git a/drivers/hwmon/kfan.c b/drivers/hwmon/kfan.c index f353acb66749..e093a6a09267 100644 --- a/drivers/hwmon/kfan.c +++ b/drivers/hwmon/kfan.c @@ -192,7 +192,7 @@ static int kfan_probe(struct auxiliary_device *auxdev, struct kfan *kfan; u8 status; - kfan = devm_kzalloc(dev, sizeof(*kfan), GFP_KERNEL); + kfan = devm_kzalloc_obj(dev, *kfan); if (!kfan) return -ENOMEM; diff --git a/drivers/hwmon/lan966x-hwmon.c b/drivers/hwmon/lan966x-hwmon.c index 4071bc2afa32..015ea55120e9 100644 --- a/drivers/hwmon/lan966x-hwmon.c +++ b/drivers/hwmon/lan966x-hwmon.c @@ -340,7 +340,7 @@ static int lan966x_hwmon_probe(struct platform_device *pdev) struct device *hwmon_dev; int ret; - hwmon = devm_kzalloc(dev, sizeof(*hwmon), GFP_KERNEL); + hwmon = devm_kzalloc_obj(dev, *hwmon); if (!hwmon) return -ENOMEM; diff --git a/drivers/hwmon/lenovo-ec-sensors.c b/drivers/hwmon/lenovo-ec-sensors.c index 24a182abf9a3..46b6e2447b14 100644 --- a/drivers/hwmon/lenovo-ec-sensors.c +++ b/drivers/hwmon/lenovo-ec-sensors.c @@ -515,7 +515,7 @@ static int lenovo_ec_probe(struct platform_device *pdev) const struct dmi_system_id *dmi_id; int app_id; - ec_data = devm_kzalloc(dev, sizeof(struct ec_sensors_data), GFP_KERNEL); + ec_data = devm_kzalloc_obj(dev, struct ec_sensors_data); if (!ec_data) return -ENOMEM; diff --git a/drivers/hwmon/lineage-pem.c b/drivers/hwmon/lineage-pem.c index 2553e49f8401..edbd68fd7e89 100644 --- a/drivers/hwmon/lineage-pem.c +++ b/drivers/hwmon/lineage-pem.c @@ -429,7 +429,7 @@ static int pem_probe(struct i2c_client *client) | I2C_FUNC_SMBUS_WRITE_BYTE)) return -ENODEV; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index 607758bf7c58..5a2a3428be2d 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c @@ -1503,7 +1503,7 @@ static int lm63_probe(struct i2c_client *client) int groups = 0; int ret; - data = devm_kzalloc(dev, sizeof(struct lm63_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm63_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c index b29bac7a4cc1..66e332c3a0f6 100644 --- a/drivers/hwmon/lm70.c +++ b/drivers/hwmon/lm70.c @@ -176,7 +176,7 @@ static int lm70_probe(struct spi_device *spi) /* NOTE: we assume 8-bit words, and convert to 16 bits manually */ - p_lm70 = devm_kzalloc(&spi->dev, sizeof(*p_lm70), GFP_KERNEL); + p_lm70 = devm_kzalloc_obj(&spi->dev, *p_lm70); if (!p_lm70) return -ENOMEM; diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c index 63ee67481a16..86090d17fd8b 100644 --- a/drivers/hwmon/lm73.c +++ b/drivers/hwmon/lm73.c @@ -197,7 +197,7 @@ lm73_probe(struct i2c_client *client) struct lm73_data *data; int ctrl; - data = devm_kzalloc(dev, sizeof(struct lm73_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm73_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index 2d2d752aeac9..6a7cac6fd37f 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c @@ -736,7 +736,7 @@ static int lm75_generic_probe(struct device *dev, const char *name, struct lm75_data *data; int status, err; - data = devm_kzalloc(dev, sizeof(struct lm75_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm75_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c index 96c5c2584d37..1f8402be599c 100644 --- a/drivers/hwmon/lm77.c +++ b/drivers/hwmon/lm77.c @@ -321,7 +321,7 @@ static int lm77_probe(struct i2c_client *client) struct device *hwmon_dev; struct lm77_data *data; - data = devm_kzalloc(dev, sizeof(struct lm77_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm77_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index e4834f9eca6a..65464c9e831e 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c @@ -633,7 +633,7 @@ static int lm78_i2c_probe(struct i2c_client *client) struct device *hwmon_dev; struct lm78_data *data; - data = devm_kzalloc(dev, sizeof(struct lm78_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm78_data); if (!data) return -ENOMEM; @@ -794,7 +794,7 @@ static int lm78_isa_probe(struct platform_device *pdev) 2, "lm78")) return -EBUSY; - data = devm_kzalloc(dev, sizeof(struct lm78_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm78_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c index 94f3dabaaa6f..079f79d9b02f 100644 --- a/drivers/hwmon/lm80.c +++ b/drivers/hwmon/lm80.c @@ -597,7 +597,7 @@ static int lm80_probe(struct i2c_client *client) struct device *hwmon_dev; struct lm80_data *data; - data = devm_kzalloc(dev, sizeof(struct lm80_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm80_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c index 8d49df8c9314..b2ceb9886058 100644 --- a/drivers/hwmon/lm83.c +++ b/drivers/hwmon/lm83.c @@ -423,7 +423,7 @@ static int lm83_probe(struct i2c_client *client) struct device *hwmon_dev; struct lm83_data *data; - data = devm_kzalloc(dev, sizeof(struct lm83_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm83_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 27ef127ccc2c..80bd1f47114d 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c @@ -1551,7 +1551,7 @@ static int lm85_probe(struct i2c_client *client) struct lm85_data *data; int idx = 0; - data = devm_kzalloc(dev, sizeof(struct lm85_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm85_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c index c09074f44708..0e46759bb8e7 100644 --- a/drivers/hwmon/lm87.c +++ b/drivers/hwmon/lm87.c @@ -925,7 +925,7 @@ static int lm87_probe(struct i2c_client *client) int err; unsigned int group_tail = 0; - data = devm_kzalloc(&client->dev, sizeof(struct lm87_data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct lm87_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 3faeb2c6ab01..500ba3b4feeb 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -2787,7 +2787,7 @@ static int lm90_probe(struct i2c_client *client) if (err) return dev_err_probe(dev, err, "Failed to enable regulator\n"); - data = devm_kzalloc(dev, sizeof(struct lm90_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm90_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c index 4aadbabc27bb..a6cbacea2ddc 100644 --- a/drivers/hwmon/lm92.c +++ b/drivers/hwmon/lm92.c @@ -384,7 +384,7 @@ static int lm92_probe(struct i2c_client *client) if (IS_ERR(regmap)) return PTR_ERR(regmap); - data = devm_kzalloc(dev, sizeof(struct lm92_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm92_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm93.c b/drivers/hwmon/lm93.c index d58a3c2a8593..161a1fdb5148 100644 --- a/drivers/hwmon/lm93.c +++ b/drivers/hwmon/lm93.c @@ -2605,7 +2605,7 @@ static int lm93_probe(struct i2c_client *client) return -ENODEV; } - data = devm_kzalloc(dev, sizeof(struct lm93_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm93_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm95234.c b/drivers/hwmon/lm95234.c index 74f280b90e3e..4cb0681a58c5 100644 --- a/drivers/hwmon/lm95234.c +++ b/drivers/hwmon/lm95234.c @@ -508,7 +508,7 @@ static int lm95234_probe(struct i2c_client *client) struct regmap *regmap; int err; - data = devm_kzalloc(dev, sizeof(struct lm95234_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm95234_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm95241.c b/drivers/hwmon/lm95241.c index 0cb0edb3845d..99651f95ce98 100644 --- a/drivers/hwmon/lm95241.c +++ b/drivers/hwmon/lm95241.c @@ -423,7 +423,7 @@ static int lm95241_probe(struct i2c_client *client) struct lm95241_data *data; struct device *hwmon_dev; - data = devm_kzalloc(dev, sizeof(struct lm95241_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm95241_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lm95245.c b/drivers/hwmon/lm95245.c index 925574b8b0ca..9bd0ad310cec 100644 --- a/drivers/hwmon/lm95245.c +++ b/drivers/hwmon/lm95245.c @@ -524,7 +524,7 @@ static int lm95245_probe(struct i2c_client *client) struct device *hwmon_dev; int ret; - data = devm_kzalloc(dev, sizeof(struct lm95245_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm95245_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/lochnagar-hwmon.c b/drivers/hwmon/lochnagar-hwmon.c index c1ba72f6132e..24a255d4c46b 100644 --- a/drivers/hwmon/lochnagar-hwmon.c +++ b/drivers/hwmon/lochnagar-hwmon.c @@ -364,7 +364,7 @@ static int lochnagar_hwmon_probe(struct platform_device *pdev) struct lochnagar_hwmon *priv; int i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/ltc2945.c b/drivers/hwmon/ltc2945.c index b521100afe53..6ba07a34dd51 100644 --- a/drivers/hwmon/ltc2945.c +++ b/drivers/hwmon/ltc2945.c @@ -479,7 +479,7 @@ static int ltc2945_probe(struct i2c_client *client) struct regmap *regmap; struct ltc2945_data *data; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; dev_set_drvdata(dev, data); diff --git a/drivers/hwmon/ltc2947-core.c b/drivers/hwmon/ltc2947-core.c index 6eba857d4ef8..d3b5a8f6af1c 100644 --- a/drivers/hwmon/ltc2947-core.c +++ b/drivers/hwmon/ltc2947-core.c @@ -1071,7 +1071,7 @@ int ltc2947_core_probe(struct regmap *map, const char *name) struct device *hwmon; int ret; - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/hwmon/ltc2990.c b/drivers/hwmon/ltc2990.c index a2725e4b2f21..bd915f8f968b 100644 --- a/drivers/hwmon/ltc2990.c +++ b/drivers/hwmon/ltc2990.c @@ -210,7 +210,7 @@ static int ltc2990_i2c_probe(struct i2c_client *i2c) I2C_FUNC_SMBUS_WORD_DATA)) return -ENODEV; - data = devm_kzalloc(&i2c->dev, sizeof(struct ltc2990_data), GFP_KERNEL); + data = devm_kzalloc_obj(&i2c->dev, struct ltc2990_data); if (unlikely(!data)) return -ENOMEM; diff --git a/drivers/hwmon/ltc2991.c b/drivers/hwmon/ltc2991.c index bc8d803e8cc9..8101f6ced994 100644 --- a/drivers/hwmon/ltc2991.c +++ b/drivers/hwmon/ltc2991.c @@ -382,7 +382,7 @@ static int ltc2991_i2c_probe(struct i2c_client *client) struct device *hwmon_dev; struct ltc2991_state *st; - st = devm_kzalloc(&client->dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(&client->dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/hwmon/ltc2992.c b/drivers/hwmon/ltc2992.c index 43b6029c0840..15003798f99f 100644 --- a/drivers/hwmon/ltc2992.c +++ b/drivers/hwmon/ltc2992.c @@ -918,7 +918,7 @@ static int ltc2992_i2c_probe(struct i2c_client *client) struct ltc2992_state *st; int ret; - st = devm_kzalloc(&client->dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(&client->dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/hwmon/ltc4151.c b/drivers/hwmon/ltc4151.c index fa7c57aae5f5..ded4f6ea357b 100644 --- a/drivers/hwmon/ltc4151.c +++ b/drivers/hwmon/ltc4151.c @@ -165,7 +165,7 @@ static int ltc4151_probe(struct i2c_client *client) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ltc4215.c b/drivers/hwmon/ltc4215.c index 3d439fbbbef9..c31448f0992d 100644 --- a/drivers/hwmon/ltc4215.c +++ b/drivers/hwmon/ltc4215.c @@ -228,7 +228,7 @@ static int ltc4215_probe(struct i2c_client *client) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ltc4245.c b/drivers/hwmon/ltc4245.c index d87aa9c32c87..b05938edcd0c 100644 --- a/drivers/hwmon/ltc4245.c +++ b/drivers/hwmon/ltc4245.c @@ -442,7 +442,7 @@ static int ltc4245_probe(struct i2c_client *client) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ltc4261.c b/drivers/hwmon/ltc4261.c index a2e52ca0b06e..cf83f343e709 100644 --- a/drivers/hwmon/ltc4261.c +++ b/drivers/hwmon/ltc4261.c @@ -205,7 +205,7 @@ static int ltc4261_probe(struct i2c_client *client) return -ENODEV; } - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ltc4282.c b/drivers/hwmon/ltc4282.c index 54ba4b8542e9..7b3f08bd4960 100644 --- a/drivers/hwmon/ltc4282.c +++ b/drivers/hwmon/ltc4282.c @@ -1658,7 +1658,7 @@ static int ltc4282_probe(struct i2c_client *i2c) struct ltc4282_state *st; int ret; - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/hwmon/ltc4283.c b/drivers/hwmon/ltc4283.c index 9ec409bc2648..a7436ea87ec5 100644 --- a/drivers/hwmon/ltc4283.c +++ b/drivers/hwmon/ltc4283.c @@ -1727,7 +1727,7 @@ static int ltc4283_probe(struct i2c_client *client) struct ltc4283_hwmon *st; int ret, id; - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/hwmon/macsmc-hwmon.c b/drivers/hwmon/macsmc-hwmon.c index 1500ec2cc9f8..e40a03f9a9da 100644 --- a/drivers/hwmon/macsmc-hwmon.c +++ b/drivers/hwmon/macsmc-hwmon.c @@ -573,8 +573,9 @@ static int macsmc_hwmon_populate_sensors(struct macsmc_hwmon *hwmon, } if (n_current) { - hwmon->curr.sensors = devm_kcalloc(hwmon->dev, n_current, - sizeof(struct macsmc_hwmon_sensor), GFP_KERNEL); + hwmon->curr.sensors = devm_kzalloc_objs(hwmon->dev, + struct macsmc_hwmon_sensor, + n_current); if (!hwmon->curr.sensors) return -ENOMEM; @@ -596,8 +597,9 @@ static int macsmc_hwmon_populate_sensors(struct macsmc_hwmon *hwmon, } if (n_fan) { - hwmon->fan.fans = devm_kcalloc(hwmon->dev, n_fan, - sizeof(struct macsmc_hwmon_fan), GFP_KERNEL); + hwmon->fan.fans = devm_kzalloc_objs(hwmon->dev, + struct macsmc_hwmon_fan, + n_fan); if (!hwmon->fan.fans) return -ENOMEM; @@ -613,8 +615,9 @@ static int macsmc_hwmon_populate_sensors(struct macsmc_hwmon *hwmon, } if (n_power) { - hwmon->power.sensors = devm_kcalloc(hwmon->dev, n_power, - sizeof(struct macsmc_hwmon_sensor), GFP_KERNEL); + hwmon->power.sensors = devm_kzalloc_objs(hwmon->dev, + struct macsmc_hwmon_sensor, + n_power); if (!hwmon->power.sensors) return -ENOMEM; @@ -636,8 +639,9 @@ static int macsmc_hwmon_populate_sensors(struct macsmc_hwmon *hwmon, } if (n_temperature) { - hwmon->temp.sensors = devm_kcalloc(hwmon->dev, n_temperature, - sizeof(struct macsmc_hwmon_sensor), GFP_KERNEL); + hwmon->temp.sensors = devm_kzalloc_objs(hwmon->dev, + struct macsmc_hwmon_sensor, + n_temperature); if (!hwmon->temp.sensors) return -ENOMEM; @@ -659,8 +663,9 @@ static int macsmc_hwmon_populate_sensors(struct macsmc_hwmon *hwmon, } if (n_voltage) { - hwmon->volt.sensors = devm_kcalloc(hwmon->dev, n_voltage, - sizeof(struct macsmc_hwmon_sensor), GFP_KERNEL); + hwmon->volt.sensors = devm_kzalloc_objs(hwmon->dev, + struct macsmc_hwmon_sensor, + n_voltage); if (!hwmon->volt.sensors) return -ENOMEM; @@ -711,8 +716,8 @@ static int macsmc_hwmon_create_infos(struct macsmc_hwmon *hwmon) if (hwmon->curr.count) { channel_info = &hwmon->curr.channel_info; channel_info->type = hwmon_curr; - channel_info->config = devm_kcalloc(hwmon->dev, hwmon->curr.count + 1, - sizeof(u32), GFP_KERNEL); + channel_info->config = devm_kzalloc_objs(hwmon->dev, u32, + hwmon->curr.count + 1); if (!channel_info->config) return -ENOMEM; @@ -723,8 +728,8 @@ static int macsmc_hwmon_create_infos(struct macsmc_hwmon *hwmon) if (hwmon->fan.count) { channel_info = &hwmon->fan.channel_info; channel_info->type = hwmon_fan; - channel_info->config = devm_kcalloc(hwmon->dev, hwmon->fan.count + 1, - sizeof(u32), GFP_KERNEL); + channel_info->config = devm_kzalloc_objs(hwmon->dev, u32, + hwmon->fan.count + 1); if (!channel_info->config) return -ENOMEM; @@ -735,8 +740,8 @@ static int macsmc_hwmon_create_infos(struct macsmc_hwmon *hwmon) if (hwmon->power.count) { channel_info = &hwmon->power.channel_info; channel_info->type = hwmon_power; - channel_info->config = devm_kcalloc(hwmon->dev, hwmon->power.count + 1, - sizeof(u32), GFP_KERNEL); + channel_info->config = devm_kzalloc_objs(hwmon->dev, u32, + hwmon->power.count + 1); if (!channel_info->config) return -ENOMEM; @@ -747,8 +752,8 @@ static int macsmc_hwmon_create_infos(struct macsmc_hwmon *hwmon) if (hwmon->temp.count) { channel_info = &hwmon->temp.channel_info; channel_info->type = hwmon_temp; - channel_info->config = devm_kcalloc(hwmon->dev, hwmon->temp.count + 1, - sizeof(u32), GFP_KERNEL); + channel_info->config = devm_kzalloc_objs(hwmon->dev, u32, + hwmon->temp.count + 1); if (!channel_info->config) return -ENOMEM; @@ -759,8 +764,8 @@ static int macsmc_hwmon_create_infos(struct macsmc_hwmon *hwmon) if (hwmon->volt.count) { channel_info = &hwmon->volt.channel_info; channel_info->type = hwmon_in; - channel_info->config = devm_kcalloc(hwmon->dev, hwmon->volt.count + 1, - sizeof(u32), GFP_KERNEL); + channel_info->config = devm_kzalloc_objs(hwmon->dev, u32, + hwmon->volt.count + 1); if (!channel_info->config) return -ENOMEM; @@ -785,8 +790,7 @@ static int macsmc_hwmon_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - hwmon = devm_kzalloc(&pdev->dev, sizeof(*hwmon), - GFP_KERNEL); + hwmon = devm_kzalloc_obj(&pdev->dev, *hwmon); if (!hwmon) return -ENOMEM; diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c index 5cc08c720b52..a2658db7628d 100644 --- a/drivers/hwmon/max1111.c +++ b/drivers/hwmon/max1111.c @@ -192,7 +192,7 @@ static int max1111_probe(struct spi_device *spi) if (err < 0) return err; - data = devm_kzalloc(&spi->dev, sizeof(struct max1111_data), GFP_KERNEL); + data = devm_kzalloc_obj(&spi->dev, struct max1111_data); if (data == NULL) return -ENOMEM; diff --git a/drivers/hwmon/max127.c b/drivers/hwmon/max127.c index b294e86d52d1..e62c0e603e11 100644 --- a/drivers/hwmon/max127.c +++ b/drivers/hwmon/max127.c @@ -294,7 +294,7 @@ static int max127_probe(struct i2c_client *client) struct max127_data *data; struct device *dev = &client->dev; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/max16065.c b/drivers/hwmon/max16065.c index f8b421754220..878f8a110d61 100644 --- a/drivers/hwmon/max16065.c +++ b/drivers/hwmon/max16065.c @@ -518,7 +518,7 @@ static int max16065_probe(struct i2c_client *client) | I2C_FUNC_SMBUS_READ_WORD_DATA)) return -ENODEV; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (unlikely(!data)) return -ENOMEM; diff --git a/drivers/hwmon/max1668.c b/drivers/hwmon/max1668.c index 32548f56409c..6a31cef98ff3 100644 --- a/drivers/hwmon/max1668.c +++ b/drivers/hwmon/max1668.c @@ -276,7 +276,7 @@ static int max1668_probe(struct i2c_client *client) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; - data = devm_kzalloc(dev, sizeof(struct max1668_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct max1668_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/max197.c b/drivers/hwmon/max197.c index 0d315087b504..a613abfdc2db 100644 --- a/drivers/hwmon/max197.c +++ b/drivers/hwmon/max197.c @@ -271,7 +271,7 @@ static int max197_probe(struct platform_device *pdev) return -EINVAL; } - data = devm_kzalloc(&pdev->dev, sizeof(struct max197_data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct max197_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/max31722.c b/drivers/hwmon/max31722.c index 6c5c86c75c36..f360148cc412 100644 --- a/drivers/hwmon/max31722.c +++ b/drivers/hwmon/max31722.c @@ -74,7 +74,7 @@ static int max31722_probe(struct spi_device *spi) int ret; struct max31722_data *data; - data = devm_kzalloc(&spi->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&spi->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/max31730.c b/drivers/hwmon/max31730.c index d132be2d6487..1d5bcafbd09b 100644 --- a/drivers/hwmon/max31730.c +++ b/drivers/hwmon/max31730.c @@ -302,7 +302,7 @@ max31730_probe(struct i2c_client *client) I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) return -EIO; - data = devm_kzalloc(dev, sizeof(struct max31730_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct max31730_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/max31760.c b/drivers/hwmon/max31760.c index 8d3be064b025..d88c1eff9146 100644 --- a/drivers/hwmon/max31760.c +++ b/drivers/hwmon/max31760.c @@ -521,7 +521,7 @@ static int max31760_probe(struct i2c_client *client) struct device *hwmon_dev; int ret; - state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/hwmon/max31790.c b/drivers/hwmon/max31790.c index db8a0f6f1829..26a738600c48 100644 --- a/drivers/hwmon/max31790.c +++ b/drivers/hwmon/max31790.c @@ -495,7 +495,7 @@ static int max31790_probe(struct i2c_client *client) I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) return -ENODEV; - data = devm_kzalloc(dev, sizeof(struct max31790_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct max31790_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/max31827.c b/drivers/hwmon/max31827.c index 6a7048fdd8ab..5abf6d9229c6 100644 --- a/drivers/hwmon/max31827.c +++ b/drivers/hwmon/max31827.c @@ -589,7 +589,7 @@ static int max31827_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) return -EOPNOTSUPP; - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/hwmon/max6620.c b/drivers/hwmon/max6620.c index 100acf357b5f..a1a26dc42cc2 100644 --- a/drivers/hwmon/max6620.c +++ b/drivers/hwmon/max6620.c @@ -455,7 +455,7 @@ static int max6620_probe(struct i2c_client *client) struct device *hwmon_dev; int err; - data = devm_kzalloc(dev, sizeof(struct max6620_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct max6620_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/max6621.c b/drivers/hwmon/max6621.c index 1a644d787143..867a66b738fa 100644 --- a/drivers/hwmon/max6621.c +++ b/drivers/hwmon/max6621.c @@ -485,7 +485,7 @@ static int max6621_probe(struct i2c_client *client) int i; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c index dd5f4b3b128d..9858ac2d2a1d 100644 --- a/drivers/hwmon/max6639.c +++ b/drivers/hwmon/max6639.c @@ -706,7 +706,7 @@ static int max6639_probe(struct i2c_client *client) struct device *hwmon_dev; int err; - data = devm_kzalloc(dev, sizeof(struct max6639_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct max6639_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c index 90c37f5647bc..9ad95c9ea5b0 100644 --- a/drivers/hwmon/max6650.c +++ b/drivers/hwmon/max6650.c @@ -768,7 +768,7 @@ static int max6650_probe(struct i2c_client *client) struct device *hwmon_dev; int err; - data = devm_kzalloc(dev, sizeof(struct max6650_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct max6650_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/max6697.c b/drivers/hwmon/max6697.c index c864093f015c..a41cee06a749 100644 --- a/drivers/hwmon/max6697.c +++ b/drivers/hwmon/max6697.c @@ -546,7 +546,7 @@ static int max6697_probe(struct i2c_client *client) if (IS_ERR(regmap)) return PTR_ERR(regmap); - data = devm_kzalloc(dev, sizeof(struct max6697_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct max6697_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/mc13783-adc.c b/drivers/hwmon/mc13783-adc.c index b217b39a046a..dac08f7ab387 100644 --- a/drivers/hwmon/mc13783-adc.c +++ b/drivers/hwmon/mc13783-adc.c @@ -230,7 +230,7 @@ static int __init mc13783_adc_probe(struct platform_device *pdev) const struct platform_device_id *id = platform_get_device_id(pdev); char *dash; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/mc34vr500.c b/drivers/hwmon/mc34vr500.c index 8cb9d5c09033..646ebb2332e8 100644 --- a/drivers/hwmon/mc34vr500.c +++ b/drivers/hwmon/mc34vr500.c @@ -174,7 +174,7 @@ static int mc34vr500_probe(struct i2c_client *client) if (IS_ERR(regmap)) return PTR_ERR(regmap); - data = devm_kzalloc(dev, sizeof(struct mc34vr500_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct mc34vr500_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/mcp3021.c b/drivers/hwmon/mcp3021.c index d6b0ebf27941..087b595bf5ad 100644 --- a/drivers/hwmon/mcp3021.c +++ b/drivers/hwmon/mcp3021.c @@ -126,8 +126,7 @@ static int mcp3021_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -ENODEV; - data = devm_kzalloc(&client->dev, sizeof(struct mcp3021_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct mcp3021_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/mcp9982.c b/drivers/hwmon/mcp9982.c index 2cd41dcbd9af..0c0f5304d29f 100644 --- a/drivers/hwmon/mcp9982.c +++ b/drivers/hwmon/mcp9982.c @@ -923,7 +923,7 @@ static int mcp9982_probe(struct i2c_client *client) struct device *hwmon_dev; int ret; - priv = devm_kzalloc(dev, sizeof(struct mcp9982_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct mcp9982_priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/menf21bmc_hwmon.c b/drivers/hwmon/menf21bmc_hwmon.c index adb50115c32b..4ab44c7076cd 100644 --- a/drivers/hwmon/menf21bmc_hwmon.c +++ b/drivers/hwmon/menf21bmc_hwmon.c @@ -192,8 +192,7 @@ static int menf21bmc_hwmon_probe(struct platform_device *pdev) struct i2c_client *i2c_client = to_i2c_client(pdev->dev.parent); struct device *hwmon_dev; - drv_data = devm_kzalloc(&pdev->dev, sizeof(struct menf21bmc_hwmon), - GFP_KERNEL); + drv_data = devm_kzalloc_obj(&pdev->dev, struct menf21bmc_hwmon); if (!drv_data) return -ENOMEM; diff --git a/drivers/hwmon/minisforum-um780xtx.c b/drivers/hwmon/minisforum-um780xtx.c index bbd77a0ce25d..c1a9fe73ce65 100644 --- a/drivers/hwmon/minisforum-um780xtx.c +++ b/drivers/hwmon/minisforum-um780xtx.c @@ -425,7 +425,7 @@ static int um780xtx_probe(struct platform_device *pdev) struct device *hwmon; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; platform_set_drvdata(pdev, data); diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c index 860de6cfd8a4..3e0b188c59fc 100644 --- a/drivers/hwmon/mlxreg-fan.c +++ b/drivers/hwmon/mlxreg-fan.c @@ -608,7 +608,7 @@ static int mlxreg_fan_probe(struct platform_device *pdev) return -EINVAL; } - fan = devm_kzalloc(dev, sizeof(*fan), GFP_KERNEL); + fan = devm_kzalloc_obj(dev, *fan); if (!fan) return -ENOMEM; diff --git a/drivers/hwmon/mr75203.c b/drivers/hwmon/mr75203.c index 449f2ce13a2d..d1945a28098b 100644 --- a/drivers/hwmon/mr75203.c +++ b/drivers/hwmon/mr75203.c @@ -664,8 +664,7 @@ static int pvt_get_active_channel(struct device *dev, struct pvt_device *pvt, * vm_map = [0 0 0 0 0 1 1 2 2 2 2] * ch_map = [0 1 2 3 4 0 1 0 1 2 3] */ - pvt->vd = devm_kcalloc(dev, pvt->vm_channels.total, sizeof(*pvt->vd), - GFP_KERNEL); + pvt->vd = devm_kzalloc_objs(dev, *pvt->vd, pvt->vm_channels.total); if (!pvt->vd) return -ENOMEM; @@ -772,7 +771,7 @@ static int mr75203_probe(struct platform_device *pdev) struct pvt_device *pvt; int ret; - pvt = devm_kzalloc(dev, sizeof(*pvt), GFP_KERNEL); + pvt = devm_kzalloc_obj(dev, *pvt); if (!pvt) return -ENOMEM; @@ -815,7 +814,7 @@ static int mr75203_probe(struct platform_device *pdev) if (!val) return -ENODEV; - pvt_info = devm_kcalloc(dev, val + 2, sizeof(*pvt_info), GFP_KERNEL); + pvt_info = devm_kzalloc_objs(dev, *pvt_info, val + 2); if (!pvt_info) return -ENOMEM; pvt_info[0] = HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ); @@ -830,8 +829,7 @@ static int mr75203_probe(struct platform_device *pdev) if (ret) return ret; - temp_config = devm_kcalloc(dev, ts_num + 1, - sizeof(*temp_config), GFP_KERNEL); + temp_config = devm_kzalloc_objs(dev, *temp_config, ts_num + 1); if (!temp_config) return -ENOMEM; @@ -881,8 +879,8 @@ static int mr75203_probe(struct platform_device *pdev) if (ret) return ret; - in_config = devm_kcalloc(dev, pvt->vm_channels.total + 1, - sizeof(*in_config), GFP_KERNEL); + in_config = devm_kzalloc_objs(dev, *in_config, + pvt->vm_channels.total + 1); if (!in_config) return -ENOMEM; diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c index e1c36c95affb..4e395e7bf9a7 100644 --- a/drivers/hwmon/nct6683.c +++ b/drivers/hwmon/nct6683.c @@ -433,12 +433,11 @@ nct6683_create_attr_group(struct device *dev, if (count == 0) return ERR_PTR(-EINVAL); - group = devm_kzalloc(dev, sizeof(*group), GFP_KERNEL); + group = devm_kzalloc_obj(dev, *group); if (group == NULL) return ERR_PTR(-ENOMEM); - attrs = devm_kcalloc(dev, repeat * count + 1, sizeof(*attrs), - GFP_KERNEL); + attrs = devm_kzalloc_objs(dev, *attrs, repeat * count + 1); if (attrs == NULL) return ERR_PTR(-ENOMEM); @@ -1209,7 +1208,7 @@ static int nct6683_probe(struct platform_device *pdev) if (!devm_request_region(dev, res->start, IOREGION_LENGTH, DRVNAME)) return -EBUSY; - data = devm_kzalloc(dev, sizeof(struct nct6683_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct nct6683_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/nct6694-hwmon.c b/drivers/hwmon/nct6694-hwmon.c index 9a9a4db434c4..32f96867635f 100644 --- a/drivers/hwmon/nct6694-hwmon.c +++ b/drivers/hwmon/nct6694-hwmon.c @@ -906,17 +906,15 @@ static int nct6694_hwmon_probe(struct platform_device *pdev) struct device *hwmon_dev; int ret; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; - data->rpt = devm_kzalloc(&pdev->dev, sizeof(union nct6694_hwmon_rpt), - GFP_KERNEL); + data->rpt = devm_kzalloc_obj(&pdev->dev, union nct6694_hwmon_rpt); if (!data->rpt) return -ENOMEM; - data->msg = devm_kzalloc(&pdev->dev, sizeof(union nct6694_hwmon_msg), - GFP_KERNEL); + data->msg = devm_kzalloc_obj(&pdev->dev, union nct6694_hwmon_msg); if (!data->msg) return -ENOMEM; diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c index cf27b9c7a89e..6e97e4f08b90 100644 --- a/drivers/hwmon/nct6775-core.c +++ b/drivers/hwmon/nct6775-core.c @@ -1130,12 +1130,11 @@ static int nct6775_add_template_attr_group(struct device *dev, struct nct6775_da if (count == 0) return -EINVAL; - group = devm_kzalloc(dev, sizeof(*group), GFP_KERNEL); + group = devm_kzalloc_obj(dev, *group); if (group == NULL) return -ENOMEM; - attrs = devm_kcalloc(dev, repeat * count + 1, sizeof(*attrs), - GFP_KERNEL); + attrs = devm_kzalloc_objs(dev, *attrs, repeat * count + 1); if (attrs == NULL) return -ENOMEM; diff --git a/drivers/hwmon/nct6775-i2c.c b/drivers/hwmon/nct6775-i2c.c index 07783910c058..b1a2ee5e36a8 100644 --- a/drivers/hwmon/nct6775-i2c.c +++ b/drivers/hwmon/nct6775-i2c.c @@ -157,7 +157,7 @@ static int nct6775_i2c_probe(struct i2c_client *client) struct nct6775_data *data; struct device *dev = &client->dev; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/nct6775-platform.c b/drivers/hwmon/nct6775-platform.c index d359c28f3e0f..7e09fd387d96 100644 --- a/drivers/hwmon/nct6775-platform.c +++ b/drivers/hwmon/nct6775-platform.c @@ -977,7 +977,7 @@ static int nct6775_platform_probe(struct platform_device *pdev) return -EBUSY; } - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/nct7363.c b/drivers/hwmon/nct7363.c index 20f14d5e0c94..d5e287455f8f 100644 --- a/drivers/hwmon/nct7363.c +++ b/drivers/hwmon/nct7363.c @@ -401,7 +401,7 @@ static int nct7363_probe(struct i2c_client *client) struct device *hwmon_dev; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c index 10d1a41fe211..476f469d12bd 100644 --- a/drivers/hwmon/nct7802.c +++ b/drivers/hwmon/nct7802.c @@ -1258,7 +1258,7 @@ static int nct7802_probe(struct i2c_client *client) struct device *hwmon_dev; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (data == NULL) return -ENOMEM; diff --git a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c index 00331e23224a..e7efb0cbe085 100644 --- a/drivers/hwmon/nct7904.c +++ b/drivers/hwmon/nct7904.c @@ -1016,7 +1016,7 @@ static int nct7904_probe(struct i2c_client *client) u32 mask; u8 val, bit; - data = devm_kzalloc(dev, sizeof(struct nct7904_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct nct7904_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c index 9af3bd0b6fb6..f41fe7587f81 100644 --- a/drivers/hwmon/npcm750-pwm-fan.c +++ b/drivers/hwmon/npcm750-pwm-fan.c @@ -848,7 +848,7 @@ static int npcm7xx_create_pwm_cooling(struct device *dev, int ret; struct npcm7xx_cooling_device *cdev; - cdev = devm_kzalloc(dev, sizeof(*cdev), GFP_KERNEL); + cdev = devm_kzalloc_obj(dev, *cdev); if (!cdev) return -ENOMEM; @@ -944,7 +944,7 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev) np = dev->of_node; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/nsa320-hwmon.c b/drivers/hwmon/nsa320-hwmon.c index 5c99acc09677..2aaaf9842c18 100644 --- a/drivers/hwmon/nsa320-hwmon.c +++ b/drivers/hwmon/nsa320-hwmon.c @@ -160,7 +160,7 @@ static int nsa320_hwmon_probe(struct platform_device *pdev) struct nsa320_hwmon *hwmon; struct device *classdev; - hwmon = devm_kzalloc(&pdev->dev, sizeof(*hwmon), GFP_KERNEL); + hwmon = devm_kzalloc_obj(&pdev->dev, *hwmon); if (!hwmon) return -ENOMEM; diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c index 4fa7f522f245..3ed5048e3dee 100644 --- a/drivers/hwmon/ntc_thermistor.c +++ b/drivers/hwmon/ntc_thermistor.c @@ -650,7 +650,7 @@ static int ntc_thermistor_probe(struct platform_device *pdev) struct ntc_data *data; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/nzxt-kraken2.c b/drivers/hwmon/nzxt-kraken2.c index 034698232758..58e8b9b5a4c5 100644 --- a/drivers/hwmon/nzxt-kraken2.c +++ b/drivers/hwmon/nzxt-kraken2.c @@ -128,7 +128,7 @@ static int kraken2_probe(struct hid_device *hdev, struct kraken2_priv_data *priv; int ret; - priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&hdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/nzxt-kraken3.c b/drivers/hwmon/nzxt-kraken3.c index a185e8b27532..5237e4e7aeb6 100644 --- a/drivers/hwmon/nzxt-kraken3.c +++ b/drivers/hwmon/nzxt-kraken3.c @@ -878,7 +878,7 @@ static int kraken3_probe(struct hid_device *hdev, const struct hid_device_id *id const char *device_name; int ret; - priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&hdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/nzxt-smart2.c b/drivers/hwmon/nzxt-smart2.c index efc78a8f58c8..e80c358c7645 100644 --- a/drivers/hwmon/nzxt-smart2.c +++ b/drivers/hwmon/nzxt-smart2.c @@ -727,7 +727,7 @@ static int nzxt_smart2_hid_probe(struct hid_device *hdev, struct drvdata *drvdata; int ret; - drvdata = devm_kzalloc(&hdev->dev, sizeof(struct drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&hdev->dev, struct drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c index 175208d712b0..2fdb293042f7 100644 --- a/drivers/hwmon/occ/common.c +++ b/drivers/hwmon/occ/common.c @@ -860,15 +860,13 @@ static int occ_setup_sensor_attrs(struct occ *occ) sensors->extended.num_sensors = 0; } - occ->attrs = devm_kcalloc(dev, num_attrs, sizeof(*occ->attrs), - GFP_KERNEL); + occ->attrs = devm_kzalloc_objs(dev, *occ->attrs, num_attrs); if (!occ->attrs) return -ENOMEM; /* null-terminated list */ - occ->group.attrs = devm_kcalloc(dev, num_attrs + 1, - sizeof(*occ->group.attrs), - GFP_KERNEL); + occ->group.attrs = devm_kzalloc_objs(dev, *occ->group.attrs, + num_attrs + 1); if (!occ->group.attrs) return -ENOMEM; diff --git a/drivers/hwmon/occ/p8_i2c.c b/drivers/hwmon/occ/p8_i2c.c index 5817a099c622..b4c8e2ea3759 100644 --- a/drivers/hwmon/occ/p8_i2c.c +++ b/drivers/hwmon/occ/p8_i2c.c @@ -210,8 +210,7 @@ static int p8_i2c_occ_send_cmd(struct occ *occ, u8 *cmd, size_t len, static int p8_i2c_occ_probe(struct i2c_client *client) { struct occ *occ; - struct p8_i2c_occ *ctx = devm_kzalloc(&client->dev, sizeof(*ctx), - GFP_KERNEL); + struct p8_i2c_occ *ctx = devm_kzalloc_obj(&client->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c index 4b4cbba58d79..5a4190300046 100644 --- a/drivers/hwmon/occ/p9_sbe.c +++ b/drivers/hwmon/occ/p9_sbe.c @@ -134,8 +134,7 @@ static int p9_sbe_occ_probe(struct platform_device *pdev) { int rc; struct occ *occ; - struct p9_sbe_occ *ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), - GFP_KERNEL); + struct p9_sbe_occ *ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index 0f8aa6b42164..689c948a7d0b 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c @@ -1445,7 +1445,7 @@ static int pc87360_probe(struct platform_device *pdev) int use_thermistors = 0; struct device *dev = &pdev->dev; - data = devm_kzalloc(dev, sizeof(struct pc87360_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct pc87360_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pc87427.c b/drivers/hwmon/pc87427.c index 571402a89368..f0ead97e2eac 100644 --- a/drivers/hwmon/pc87427.c +++ b/drivers/hwmon/pc87427.c @@ -1054,8 +1054,7 @@ static int pc87427_probe(struct platform_device *pdev) struct pc87427_data *data; int i, err, res_count; - data = devm_kzalloc(&pdev->dev, sizeof(struct pc87427_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct pc87427_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pcf8591.c b/drivers/hwmon/pcf8591.c index c0220ebfd4b6..ec98e6b66c49 100644 --- a/drivers/hwmon/pcf8591.c +++ b/drivers/hwmon/pcf8591.c @@ -185,8 +185,7 @@ static int pcf8591_probe(struct i2c_client *client) struct pcf8591_data *data; int err; - data = devm_kzalloc(&client->dev, sizeof(struct pcf8591_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct pcf8591_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/peci/cputemp.c b/drivers/hwmon/peci/cputemp.c index 457089c561b4..9a8a2f14ff7c 100644 --- a/drivers/hwmon/peci/cputemp.c +++ b/drivers/hwmon/peci/cputemp.c @@ -450,7 +450,7 @@ static int peci_cputemp_probe(struct auxiliary_device *adev, struct peci_cputemp *priv; struct device *hwmon_dev; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/peci/dimmtemp.c b/drivers/hwmon/peci/dimmtemp.c index bd3e8715dfec..829635705dfa 100644 --- a/drivers/hwmon/peci/dimmtemp.c +++ b/drivers/hwmon/peci/dimmtemp.c @@ -375,7 +375,7 @@ static int peci_dimmtemp_probe(struct auxiliary_device *adev, const struct auxil struct peci_dimmtemp *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/adm1266.c b/drivers/hwmon/pmbus/adm1266.c index 22ccb721dd51..7fdf7a6892f1 100644 --- a/drivers/hwmon/pmbus/adm1266.c +++ b/drivers/hwmon/pmbus/adm1266.c @@ -610,7 +610,7 @@ static int adm1266_probe(struct i2c_client *client) int ret; int i; - data = devm_kzalloc(&client->dev, sizeof(struct adm1266_data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct adm1266_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c index beb32a878d1c..a558e222a9df 100644 --- a/drivers/hwmon/pmbus/adm1275.c +++ b/drivers/hwmon/pmbus/adm1275.c @@ -600,8 +600,7 @@ static int adm1275_probe(struct i2c_client *client) if (device_config < 0) return device_config; - data = devm_kzalloc(&client->dev, sizeof(struct adm1275_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct adm1275_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/dps920ab.c b/drivers/hwmon/pmbus/dps920ab.c index 0d2901c314c2..527a043346ac 100644 --- a/drivers/hwmon/pmbus/dps920ab.c +++ b/drivers/hwmon/pmbus/dps920ab.c @@ -139,7 +139,7 @@ static int dps920ab_probe(struct i2c_client *client) struct dps920ab_data *data; int ret; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/fsp-3y.c b/drivers/hwmon/pmbus/fsp-3y.c index 44cf2db9364b..e71546ab28f6 100644 --- a/drivers/hwmon/pmbus/fsp-3y.c +++ b/drivers/hwmon/pmbus/fsp-3y.c @@ -228,7 +228,7 @@ static int fsp3y_probe(struct i2c_client *client) const struct i2c_device_id *id; int rv; - data = devm_kzalloc(&client->dev, sizeof(struct fsp3y_data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct fsp3y_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/hac300s.c b/drivers/hwmon/pmbus/hac300s.c index 761e53890ebc..9172928e37b9 100644 --- a/drivers/hwmon/pmbus/hac300s.c +++ b/drivers/hwmon/pmbus/hac300s.c @@ -86,7 +86,7 @@ static int hac300s_probe(struct i2c_client *client) struct hac300s_data *data; int rv; - data = devm_kzalloc(&client->dev, sizeof(struct hac300s_data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct hac300s_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c index 2498c6f4778e..05ead1a73bcc 100644 --- a/drivers/hwmon/pmbus/ibm-cffps.c +++ b/drivers/hwmon/pmbus/ibm-cffps.c @@ -536,7 +536,7 @@ static int ibm_cffps_probe(struct i2c_client *client) * Don't fail the probe if there isn't enough memory for leds and * debugfs. */ - psu = devm_kzalloc(&client->dev, sizeof(*psu), GFP_KERNEL); + psu = devm_kzalloc_obj(&client->dev, *psu); if (!psu) return 0; diff --git a/drivers/hwmon/pmbus/ina233.c b/drivers/hwmon/pmbus/ina233.c index c72aa258b7c6..06c55920e9dd 100644 --- a/drivers/hwmon/pmbus/ina233.c +++ b/drivers/hwmon/pmbus/ina233.c @@ -93,8 +93,7 @@ static int ina233_probe(struct i2c_client *client) u16 calibration; struct pmbus_driver_info *info; - info = devm_kzalloc(dev, sizeof(struct pmbus_driver_info), - GFP_KERNEL); + info = devm_kzalloc_obj(dev, struct pmbus_driver_info); if (!info) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/ir35221.c b/drivers/hwmon/pmbus/ir35221.c index b2120fc76f40..010ad9777053 100644 --- a/drivers/hwmon/pmbus/ir35221.c +++ b/drivers/hwmon/pmbus/ir35221.c @@ -99,8 +99,7 @@ static int ir35221_probe(struct i2c_client *client) return -ENODEV; } - info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&client->dev, struct pmbus_driver_info); if (!info) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/isl68137.c b/drivers/hwmon/pmbus/isl68137.c index 15b4e3f15f11..3b615bffd7b7 100644 --- a/drivers/hwmon/pmbus/isl68137.c +++ b/drivers/hwmon/pmbus/isl68137.c @@ -329,7 +329,7 @@ static int isl68137_probe(struct i2c_client *client) struct isl68137_data *data; int i, err; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c index 497802c646e9..742244b86570 100644 --- a/drivers/hwmon/pmbus/lm25066.c +++ b/drivers/hwmon/pmbus/lm25066.c @@ -475,8 +475,7 @@ static int lm25066_probe(struct i2c_client *client) I2C_FUNC_SMBUS_READ_BYTE_DATA)) return -ENODEV; - data = devm_kzalloc(&client->dev, sizeof(struct lm25066_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct lm25066_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c index aea7b6c93e74..58c83d4f398d 100644 --- a/drivers/hwmon/pmbus/ltc2978.c +++ b/drivers/hwmon/pmbus/ltc2978.c @@ -720,8 +720,7 @@ static int ltc2978_probe(struct i2c_client *client) I2C_FUNC_SMBUS_READ_WORD_DATA)) return -ENODEV; - data = devm_kzalloc(&client->dev, sizeof(struct ltc2978_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct ltc2978_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/ltc4286.c b/drivers/hwmon/pmbus/ltc4286.c index 8190706d1beb..ea2f9a5a4b24 100644 --- a/drivers/hwmon/pmbus/ltc4286.c +++ b/drivers/hwmon/pmbus/ltc4286.c @@ -196,7 +196,7 @@ static int ltc4286_probe(struct i2c_client *client) if (rsense > (INT_MAX / 1024)) return -EINVAL; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/max16601.c b/drivers/hwmon/pmbus/max16601.c index 3dd1f6fd003b..da9a8e10b386 100644 --- a/drivers/hwmon/pmbus/max16601.c +++ b/drivers/hwmon/pmbus/max16601.c @@ -333,7 +333,7 @@ static int max16601_probe(struct i2c_client *client) return -ENODEV; } - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/max20730.c b/drivers/hwmon/pmbus/max20730.c index 4031f894e6ae..1006a4db022d 100644 --- a/drivers/hwmon/pmbus/max20730.c +++ b/drivers/hwmon/pmbus/max20730.c @@ -320,7 +320,7 @@ static int max20730_init_debugfs(struct i2c_client *client, return ret; data->mfr_voutmin = ret; - psu = devm_kzalloc(&client->dev, sizeof(*psu), GFP_KERNEL); + psu = devm_kzalloc_obj(&client->dev, *psu); if (!psu) return -ENOMEM; psu->client = client; @@ -717,7 +717,7 @@ static int max20730_probe(struct i2c_client *client) chip_id = (uintptr_t)i2c_get_match_data(client); - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; data->id = chip_id; diff --git a/drivers/hwmon/pmbus/max20826.c b/drivers/hwmon/pmbus/max20826.c index 013a97189fde..47ec2be2f3a2 100644 --- a/drivers/hwmon/pmbus/max20826.c +++ b/drivers/hwmon/pmbus/max20826.c @@ -909,7 +909,7 @@ static void max20826_init_debugfs(struct max20826 *st) struct max20826_debugfs_entry *entry; char name[32]; - entry = devm_kzalloc(dev, sizeof(*entry), GFP_KERNEL); + entry = devm_kzalloc_obj(dev, *entry); if (!entry) return; @@ -930,7 +930,7 @@ static int max20826_probe(struct i2c_client *client) struct max20826 *st; int ret; - st = devm_kzalloc(&client->dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(&client->dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/max20830.c b/drivers/hwmon/pmbus/max20830.c index 4d25a084af09..3bd75a2103e2 100644 --- a/drivers/hwmon/pmbus/max20830.c +++ b/drivers/hwmon/pmbus/max20830.c @@ -91,7 +91,7 @@ static int max20830_probe(struct i2c_client *client) struct max20830_data *data; int i, ret; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/max31785.c b/drivers/hwmon/pmbus/max31785.c index bdcce810a479..1816744e2d79 100644 --- a/drivers/hwmon/pmbus/max31785.c +++ b/drivers/hwmon/pmbus/max31785.c @@ -407,7 +407,7 @@ static int max31785_probe(struct i2c_client *client) I2C_FUNC_SMBUS_WORD_DATA)) return -ENODEV; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c index 7f71dfe48643..b59e9fd42401 100644 --- a/drivers/hwmon/pmbus/max34440.c +++ b/drivers/hwmon/pmbus/max34440.c @@ -790,8 +790,7 @@ static int max34440_probe(struct i2c_client *client) struct max34440_data *data; int rv; - data = devm_kzalloc(&client->dev, sizeof(struct max34440_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct max34440_data); if (!data) return -ENOMEM; data->id = (uintptr_t)i2c_get_match_data(client); diff --git a/drivers/hwmon/pmbus/mp2856.c b/drivers/hwmon/pmbus/mp2856.c index 3d6621e36fd3..9415bb017c1a 100644 --- a/drivers/hwmon/pmbus/mp2856.c +++ b/drivers/hwmon/pmbus/mp2856.c @@ -399,8 +399,7 @@ static int mp2856_probe(struct i2c_client *client) enum chips chip_id; int ret; - data = devm_kzalloc(&client->dev, sizeof(struct mp2856_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct mp2856_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/mp2869.c b/drivers/hwmon/pmbus/mp2869.c index 76c6017507b3..994524150192 100644 --- a/drivers/hwmon/pmbus/mp2869.c +++ b/drivers/hwmon/pmbus/mp2869.c @@ -620,8 +620,7 @@ static int mp2869_probe(struct i2c_client *client) struct pmbus_driver_info *info; struct mp2869_data *data; - data = devm_kzalloc(&client->dev, sizeof(struct mp2869_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct mp2869_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/mp2888.c b/drivers/hwmon/pmbus/mp2888.c index 7a2ecffba960..4d4e97983706 100644 --- a/drivers/hwmon/pmbus/mp2888.c +++ b/drivers/hwmon/pmbus/mp2888.c @@ -357,7 +357,7 @@ static int mp2888_probe(struct i2c_client *client) struct mp2888_data *data; int ret; - data = devm_kzalloc(&client->dev, sizeof(struct mp2888_data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct mp2888_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/mp2891.c b/drivers/hwmon/pmbus/mp2891.c index 316c1fc0d6cc..db315ff40b6b 100644 --- a/drivers/hwmon/pmbus/mp2891.c +++ b/drivers/hwmon/pmbus/mp2891.c @@ -562,7 +562,7 @@ static int mp2891_probe(struct i2c_client *client) { struct mp2891_data *data; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/mp2925.c b/drivers/hwmon/pmbus/mp2925.c index 0a58b1ffd791..b293996b39f0 100644 --- a/drivers/hwmon/pmbus/mp2925.c +++ b/drivers/hwmon/pmbus/mp2925.c @@ -295,7 +295,7 @@ static int mp2925_probe(struct i2c_client *client) { struct mp2925_data *data; - data = devm_kzalloc(&client->dev, sizeof(struct mp2925_data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct mp2925_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/mp29502.c b/drivers/hwmon/pmbus/mp29502.c index afc5e8c07e25..2f3a47bfcb93 100644 --- a/drivers/hwmon/pmbus/mp29502.c +++ b/drivers/hwmon/pmbus/mp29502.c @@ -630,8 +630,7 @@ static int mp29502_probe(struct i2c_client *client) struct pmbus_driver_info *info; struct mp29502_data *data; - data = devm_kzalloc(&client->dev, sizeof(struct mp29502_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct mp29502_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c index 8e5193933ceb..a11ec6756990 100644 --- a/drivers/hwmon/pmbus/mp2975.c +++ b/drivers/hwmon/pmbus/mp2975.c @@ -999,8 +999,7 @@ static int mp2975_probe(struct i2c_client *client) if (!ddinfo) return -ENODEV; - data = devm_kzalloc(&client->dev, sizeof(struct mp2975_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct mp2975_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/mp2985.c b/drivers/hwmon/pmbus/mp2985.c index b0a4796ca8ce..33ab6a916538 100644 --- a/drivers/hwmon/pmbus/mp2985.c +++ b/drivers/hwmon/pmbus/mp2985.c @@ -364,7 +364,7 @@ static int mp2985_probe(struct i2c_client *client) { struct mp2985_data *data; - data = devm_kzalloc(&client->dev, sizeof(struct mp2985_data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct mp2985_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/mp5926.c b/drivers/hwmon/pmbus/mp5926.c index a40647472b16..6b5e2135896d 100644 --- a/drivers/hwmon/pmbus/mp5926.c +++ b/drivers/hwmon/pmbus/mp5926.c @@ -123,8 +123,7 @@ static int mp5926_probe(struct i2c_client *client) struct pmbus_driver_info *info; int ret; - data = devm_kzalloc(&client->dev, sizeof(struct mp5926_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct mp5926_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/mp5990.c b/drivers/hwmon/pmbus/mp5990.c index f8a5d1b42ff7..c5d597d48c7b 100644 --- a/drivers/hwmon/pmbus/mp5990.c +++ b/drivers/hwmon/pmbus/mp5990.c @@ -161,8 +161,7 @@ static int mp5990_probe(struct i2c_client *client) enum chips chip; int ret; - data = devm_kzalloc(&client->dev, sizeof(struct mp5990_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct mp5990_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/mp9941.c b/drivers/hwmon/pmbus/mp9941.c index d9049d326c80..c940ffa14e94 100644 --- a/drivers/hwmon/pmbus/mp9941.c +++ b/drivers/hwmon/pmbus/mp9941.c @@ -281,7 +281,7 @@ static int mp9941_probe(struct i2c_client *client) { struct mp9941_data *data; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/mp9945.c b/drivers/hwmon/pmbus/mp9945.c index 199480d85515..affed1187146 100644 --- a/drivers/hwmon/pmbus/mp9945.c +++ b/drivers/hwmon/pmbus/mp9945.c @@ -197,7 +197,7 @@ static int mp9945_probe(struct i2c_client *client) struct mp9945_data *data; int ret; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/mpq7932.c b/drivers/hwmon/pmbus/mpq7932.c index f49610adff89..822177adbb3f 100644 --- a/drivers/hwmon/pmbus/mpq7932.c +++ b/drivers/hwmon/pmbus/mpq7932.c @@ -106,7 +106,7 @@ static int mpq7932_probe(struct i2c_client *client) struct device *dev = &client->dev; int i; - data = devm_kzalloc(dev, sizeof(struct mpq7932_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct mpq7932_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/mpq82d00.c b/drivers/hwmon/pmbus/mpq82d00.c index d51fcffcc6d9..c8f7b5873e39 100644 --- a/drivers/hwmon/pmbus/mpq82d00.c +++ b/drivers/hwmon/pmbus/mpq82d00.c @@ -211,7 +211,7 @@ static int mpq82d00_probe(struct i2c_client *client) { struct mpq82d00_data *data; - data = devm_kzalloc(&client->dev, sizeof(struct mpq82d00_data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct mpq82d00_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/mpq8646.c b/drivers/hwmon/pmbus/mpq8646.c index 6ac82beb0981..67eea4327138 100644 --- a/drivers/hwmon/pmbus/mpq8646.c +++ b/drivers/hwmon/pmbus/mpq8646.c @@ -769,9 +769,8 @@ static void mpq8646_debugfs_register_unsafe(struct mpq8646_priv *priv, debugfs_create_file_unsafe("restore_all", 0200, root, priv, &mpq8646_dbg_restore_all_fops); - ctx = devm_kcalloc(&priv->client->dev, - ARRAY_SIZE(mpq8646_dbg_regs_unsafe), - sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_objs(&priv->client->dev, *ctx, + ARRAY_SIZE(mpq8646_dbg_regs_unsafe)); if (!ctx) return; for (i = 0; i < ARRAY_SIZE(mpq8646_dbg_regs_unsafe); i++) { @@ -830,10 +829,9 @@ static void mpq8646_debugfs_register(struct mpq8646_priv *priv) root, priv, &mpq8646_dbg_poll_interval_fops); - priv->dbg_reg_ctx = devm_kcalloc(&priv->client->dev, - ARRAY_SIZE(mpq8646_dbg_regs), - sizeof(*priv->dbg_reg_ctx), - GFP_KERNEL); + priv->dbg_reg_ctx = devm_kzalloc_objs(&priv->client->dev, + *priv->dbg_reg_ctx, + ARRAY_SIZE(mpq8646_dbg_regs)); if (!priv->dbg_reg_ctx) return; for (i = 0; i < ARRAY_SIZE(mpq8646_dbg_regs); i++) { @@ -882,7 +880,7 @@ static int mpq8646_probe(struct i2c_client *client) u32 voltage_scale; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; priv->client = client; diff --git a/drivers/hwmon/pmbus/pim4328.c b/drivers/hwmon/pmbus/pim4328.c index 9056dc387e87..76dbf6c66457 100644 --- a/drivers/hwmon/pmbus/pim4328.c +++ b/drivers/hwmon/pmbus/pim4328.c @@ -145,8 +145,7 @@ static int pim4328_probe(struct i2c_client *client) | I2C_FUNC_SMBUS_BLOCK_DATA)) return -ENODEV; - data = devm_kzalloc(&client->dev, sizeof(struct pim4328_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct pim4328_data); if (!data) return -ENOMEM; @@ -175,8 +174,7 @@ static int pim4328_probe(struct i2c_client *client) info->read_byte_data = pim4328_read_byte_data; info->read_word_data = pim4328_read_word_data; - pdata = devm_kzalloc(dev, sizeof(struct pmbus_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, struct pmbus_platform_data); if (!pdata) return -ENOMEM; dev->platform_data = pdata; diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c index 7a7eac90d62e..28889fb743b3 100644 --- a/drivers/hwmon/pmbus/pmbus.c +++ b/drivers/hwmon/pmbus/pmbus.c @@ -168,14 +168,13 @@ static int pmbus_probe(struct i2c_client *client) struct device *dev = &client->dev; struct pmbus_device_info *device_info; - info = devm_kzalloc(dev, sizeof(struct pmbus_driver_info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, struct pmbus_driver_info); if (!info) return -ENOMEM; device_info = (struct pmbus_device_info *)i2c_get_match_data(client); if (device_info->flags) { - pdata = devm_kzalloc(dev, sizeof(struct pmbus_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, struct pmbus_platform_data); if (!pdata) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index d69f1bde1795..093b543b95b5 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -1458,7 +1458,7 @@ static int pmbus_add_boolean(struct pmbus_data *data, if (WARN((s1 && !s2) || (!s1 && s2), "Bad s1/s2 parameters\n")) return -EINVAL; - boolean = devm_kzalloc(data->dev, sizeof(*boolean), GFP_KERNEL); + boolean = devm_kzalloc_obj(data->dev, *boolean); if (!boolean) return -ENOMEM; @@ -1517,7 +1517,7 @@ static int pmbus_thermal_add_sensor(struct pmbus_data *pmbus_data, struct pmbus_thermal_data *tdata; struct thermal_zone_device *tzd; - tdata = devm_kzalloc(dev, sizeof(*tdata), GFP_KERNEL); + tdata = devm_kzalloc_obj(dev, *tdata); if (!tdata) return -ENOMEM; @@ -1547,7 +1547,7 @@ static struct pmbus_sensor *pmbus_add_sensor(struct pmbus_data *data, struct sensor_device_attribute *a; struct pmbus_sensor *sensor; - sensor = devm_kzalloc(data->dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(data->dev, *sensor); if (!sensor) return NULL; a = &sensor->attribute; @@ -1593,7 +1593,7 @@ static int pmbus_add_label(struct pmbus_data *data, struct sensor_device_attribute *a; struct pmbus_label *label; - label = devm_kzalloc(data->dev, sizeof(*label), GFP_KERNEL); + label = devm_kzalloc_obj(data->dev, *label); if (!label) return -ENOMEM; @@ -2571,7 +2571,7 @@ static int pmbus_add_samples_attr(struct pmbus_data *data, int page, struct sensor_device_attribute *a; struct pmbus_samples_reg *reg; - reg = devm_kzalloc(data->dev, sizeof(*reg), GFP_KERNEL); + reg = devm_kzalloc_obj(data->dev, *reg); if (!reg) return -ENOMEM; @@ -3804,10 +3804,8 @@ static void pmbus_init_debugfs(struct i2c_client *client, * page specific: * ARRAY_SIZE(pmbus_debugfs_status_data) + 1 */ - entries = devm_kcalloc(data->dev, - ARRAY_SIZE(pmbus_debugfs_block_data) + 2 + - data->info->pages * (ARRAY_SIZE(pmbus_debugfs_status_data) + 1), - sizeof(*entries), GFP_KERNEL); + entries = devm_kzalloc_objs(data->dev, *entries, + ARRAY_SIZE(pmbus_debugfs_block_data) + 2 + data->info->pages * (ARRAY_SIZE(pmbus_debugfs_status_data) + 1)); if (!entries) return; @@ -3896,7 +3894,7 @@ int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info) | I2C_FUNC_SMBUS_WORD_DATA)) return -ENODEV; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/q54sj108a2.c b/drivers/hwmon/pmbus/q54sj108a2.c index ecac405d7536..babb58d217c9 100644 --- a/drivers/hwmon/pmbus/q54sj108a2.c +++ b/drivers/hwmon/pmbus/q54sj108a2.c @@ -344,7 +344,7 @@ static int q54sj108a2_probe(struct i2c_client *client) if (ret) return ret; - psu = devm_kzalloc(&client->dev, sizeof(*psu), GFP_KERNEL); + psu = devm_kzalloc_obj(&client->dev, *psu); if (!psu) return 0; diff --git a/drivers/hwmon/pmbus/tda38640.c b/drivers/hwmon/pmbus/tda38640.c index 803926633370..8e67f3f0add9 100644 --- a/drivers/hwmon/pmbus/tda38640.c +++ b/drivers/hwmon/pmbus/tda38640.c @@ -164,7 +164,7 @@ static int tda38640_probe(struct i2c_client *client) struct tda38640_data *data; int svid; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; memcpy(&data->info, &tda38640_info, sizeof(tda38640_info)); diff --git a/drivers/hwmon/pmbus/tps25990.c b/drivers/hwmon/pmbus/tps25990.c index 0d5c99053f23..a4ee30c07e88 100644 --- a/drivers/hwmon/pmbus/tps25990.c +++ b/drivers/hwmon/pmbus/tps25990.c @@ -530,7 +530,7 @@ static int tps25990_probe(struct i2c_client *client) chip_id = (enum chips)(unsigned long)i2c_get_match_data(client); - data = devm_kzalloc(dev, sizeof(struct tps25990_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct tps25990_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/ucd9000.c b/drivers/hwmon/pmbus/ucd9000.c index f76c2913c9ca..ef2b67fb2787 100644 --- a/drivers/hwmon/pmbus/ucd9000.c +++ b/drivers/hwmon/pmbus/ucd9000.c @@ -468,9 +468,7 @@ static int ucd9000_init_debugfs(struct i2c_client *client, mid->driver_data == ucd90320 || mid->driver_data == ucd90910) { gpi_count = mid->driver_data == ucd90320 ? UCD90320_GPI_COUNT : UCD9000_GPI_COUNT; - entries = devm_kcalloc(&client->dev, - gpi_count, sizeof(*entries), - GFP_KERNEL); + entries = devm_kzalloc_objs(&client->dev, *entries, gpi_count); if (!entries) return -ENOMEM; @@ -542,8 +540,7 @@ static int ucd9000_probe(struct i2c_client *client) "Device mismatch: Configured %s, detected %s\n", client->name, mid->name); - data = devm_kzalloc(&client->dev, sizeof(struct ucd9000_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct ucd9000_data); if (!data) return -ENOMEM; info = &data->info; diff --git a/drivers/hwmon/pmbus/ucd9200.c b/drivers/hwmon/pmbus/ucd9200.c index 5e07bba111a1..f038c07411a4 100644 --- a/drivers/hwmon/pmbus/ucd9200.c +++ b/drivers/hwmon/pmbus/ucd9200.c @@ -112,8 +112,7 @@ static int ucd9200_probe(struct i2c_client *client) "Device mismatch: Configured %s, detected %s\n", client->name, mid->name); - info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&client->dev, struct pmbus_driver_info); if (!info) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/vt7505.c b/drivers/hwmon/pmbus/vt7505.c index 6a66f06eddb8..d0aa964141aa 100644 --- a/drivers/hwmon/pmbus/vt7505.c +++ b/drivers/hwmon/pmbus/vt7505.c @@ -176,7 +176,7 @@ static int vt7505_probe(struct i2c_client *client) if (!chip) return -ENODEV; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/xdp720.c b/drivers/hwmon/pmbus/xdp720.c index 5a162084f338..71f4d066cab2 100644 --- a/drivers/hwmon/pmbus/xdp720.c +++ b/drivers/hwmon/pmbus/xdp720.c @@ -80,7 +80,7 @@ static int xdp720_probe(struct i2c_client *client) u32 rimon; int gimon; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pmbus/zl6100.c b/drivers/hwmon/pmbus/zl6100.c index 5db2a7818d16..bccf9806b695 100644 --- a/drivers/hwmon/pmbus/zl6100.c +++ b/drivers/hwmon/pmbus/zl6100.c @@ -312,8 +312,7 @@ static int zl6100_probe(struct i2c_client *client) "Device mismatch: Configured %s, detected %s\n", client->name, mid->name); - data = devm_kzalloc(&client->dev, sizeof(struct zl6100_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct zl6100_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/powerz.c b/drivers/hwmon/powerz.c index 6e1359144cab..5442408f6e8d 100644 --- a/drivers/hwmon/powerz.c +++ b/drivers/hwmon/powerz.c @@ -227,7 +227,7 @@ static int powerz_probe(struct usb_interface *intf, parent = &intf->dev; - priv = devm_kzalloc(parent, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(parent, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/powr1220.c b/drivers/hwmon/powr1220.c index 6e211601ea26..93374e093eac 100644 --- a/drivers/hwmon/powr1220.c +++ b/drivers/hwmon/powr1220.c @@ -280,7 +280,7 @@ static int powr1220_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/prom21-xhci.c b/drivers/hwmon/prom21-xhci.c index d40d0c53ce45..846aac4eb73e 100644 --- a/drivers/hwmon/prom21-xhci.c +++ b/drivers/hwmon/prom21-xhci.c @@ -182,7 +182,7 @@ static int prom21_xhci_probe(struct auxiliary_device *auxdev, pdata->rsrc_len < PROM21_XHCI_DATA_OFFSET + sizeof(u32)) return dev_err_probe(dev, -ENODEV, "invalid MMIO resource\n"); - hwmon = devm_kzalloc(dev, sizeof(*hwmon), GFP_KERNEL); + hwmon = devm_kzalloc_obj(dev, *hwmon); if (!hwmon) return -ENOMEM; diff --git a/drivers/hwmon/pt5161l.c b/drivers/hwmon/pt5161l.c index 1638f54f8eae..ea05617c79c9 100644 --- a/drivers/hwmon/pt5161l.c +++ b/drivers/hwmon/pt5161l.c @@ -583,7 +583,7 @@ static int pt5161l_probe(struct i2c_client *client) struct device *hwmon_dev; struct pt5161l_data *data; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c index 9cabbe9f8462..f21150a56625 100644 --- a/drivers/hwmon/pwm-fan.c +++ b/drivers/hwmon/pwm-fan.c @@ -514,7 +514,7 @@ static int pwm_fan_probe(struct platform_device *pdev) int channel_count = 1; /* We always have a PWM channel. */ int i; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; @@ -590,23 +590,21 @@ static int pwm_fan_probe(struct platform_device *pdev) if (ctx->tach_count) { channel_count++; /* We also have a FAN channel. */ - ctx->tachs = devm_kcalloc(dev, ctx->tach_count, - sizeof(struct pwm_fan_tach), - GFP_KERNEL); + ctx->tachs = devm_kzalloc_objs(dev, struct pwm_fan_tach, + ctx->tach_count); if (!ctx->tachs) return -ENOMEM; ctx->fan_channel.type = hwmon_fan; - fan_channel_config = devm_kcalloc(dev, ctx->tach_count + 1, - sizeof(u32), GFP_KERNEL); + fan_channel_config = devm_kzalloc_objs(dev, u32, + ctx->tach_count + 1); if (!fan_channel_config) return -ENOMEM; ctx->fan_channel.config = fan_channel_config; - ctx->pulses_per_revolution = devm_kmalloc_array(dev, - ctx->tach_count, - sizeof(*ctx->pulses_per_revolution), - GFP_KERNEL); + ctx->pulses_per_revolution = devm_kmalloc_objs(dev, + *ctx->pulses_per_revolution, + ctx->tach_count); if (!ctx->pulses_per_revolution) return -ENOMEM; @@ -618,8 +616,7 @@ static int pwm_fan_probe(struct platform_device *pdev) ctx->pulses_per_revolution, ctx->tach_count); } - channels = devm_kcalloc(dev, channel_count + 1, - sizeof(*channels), GFP_KERNEL); + channels = devm_kzalloc_objs(dev, *channels, channel_count + 1); if (!channels) return -ENOMEM; diff --git a/drivers/hwmon/qnap-mcu-hwmon.c b/drivers/hwmon/qnap-mcu-hwmon.c index c1c1e9d6f340..a027b67af267 100644 --- a/drivers/hwmon/qnap-mcu-hwmon.c +++ b/drivers/hwmon/qnap-mcu-hwmon.c @@ -299,7 +299,7 @@ static int qnap_mcu_hwmon_probe(struct platform_device *pdev) struct device *hwmon; int ret; - hwm = devm_kzalloc(dev, sizeof(*hwm), GFP_KERNEL); + hwm = devm_kzalloc_obj(dev, *hwm); if (!hwm) return -ENOMEM; diff --git a/drivers/hwmon/raspberrypi-hwmon.c b/drivers/hwmon/raspberrypi-hwmon.c index 7b1d2829f012..c60d8f2467e0 100644 --- a/drivers/hwmon/raspberrypi-hwmon.c +++ b/drivers/hwmon/raspberrypi-hwmon.c @@ -210,7 +210,7 @@ static int rpi_hwmon_probe(struct platform_device *pdev) long voltage; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/sch5627.c b/drivers/hwmon/sch5627.c index 04e701ce2e74..bcafa4ac543c 100644 --- a/drivers/hwmon/sch5627.c +++ b/drivers/hwmon/sch5627.c @@ -522,8 +522,7 @@ static int sch5627_probe(struct platform_device *pdev) struct device *hwmon_dev; int build_code, build_id, hwmon_rev, val; - data = devm_kzalloc(&pdev->dev, sizeof(struct sch5627_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct sch5627_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/sch5636.c b/drivers/hwmon/sch5636.c index 8c9b6e24d09f..89e6c69d576a 100644 --- a/drivers/hwmon/sch5636.c +++ b/drivers/hwmon/sch5636.c @@ -392,8 +392,7 @@ static int sch5636_probe(struct platform_device *pdev) int i, err, val, revision[2]; char id[4]; - data = devm_kzalloc(&pdev->dev, sizeof(struct sch5636_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct sch5636_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c index febb8ba7dc2c..3ca9e6c6149a 100644 --- a/drivers/hwmon/sch56xx-common.c +++ b/drivers/hwmon/sch56xx-common.c @@ -509,7 +509,7 @@ void sch56xx_watchdog_register(struct device *parent, u16 addr, u32 revision, return; } - data = devm_kzalloc(parent, sizeof(struct sch56xx_watchdog_data), GFP_KERNEL); + data = devm_kzalloc_obj(parent, struct sch56xx_watchdog_data); if (!data) return; diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index 9ae8f774297e..d4195d14a983 100644 --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c @@ -196,7 +196,7 @@ static int scmi_thermal_sensor_register(struct device *dev, struct scmi_thermal_sensor *th_sensor; struct thermal_zone_device *tzd; - th_sensor = devm_kzalloc(dev, sizeof(*th_sensor), GFP_KERNEL); + th_sensor = devm_kzalloc_obj(dev, *th_sensor); if (!th_sensor) return -ENOMEM; @@ -254,7 +254,7 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) if (!nr_sensors) return -EIO; - scmi_sensors = devm_kzalloc(dev, sizeof(*scmi_sensors), GFP_KERNEL); + scmi_sensors = devm_kzalloc_obj(dev, *scmi_sensors); if (!scmi_sensors) return -ENOMEM; @@ -282,13 +282,11 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) if (nr_count[hwmon_temp]) nr_count_temp = nr_count[hwmon_temp]; - scmi_hwmon_chan = devm_kcalloc(dev, nr_types, sizeof(*scmi_hwmon_chan), - GFP_KERNEL); + scmi_hwmon_chan = devm_kzalloc_objs(dev, *scmi_hwmon_chan, nr_types); if (!scmi_hwmon_chan) return -ENOMEM; - ptr_scmi_ci = devm_kcalloc(dev, nr_types + 1, sizeof(*ptr_scmi_ci), - GFP_KERNEL); + ptr_scmi_ci = devm_kzalloc_objs(dev, *ptr_scmi_ci, nr_types + 1); if (!ptr_scmi_ci) return -ENOMEM; @@ -304,9 +302,8 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) *ptr_scmi_ci++ = scmi_hwmon_chan++; scmi_sensors->info[type] = - devm_kcalloc(dev, nr_count[type], - sizeof(*scmi_sensors->info[type]), - GFP_KERNEL); + devm_kzalloc_objs(dev, *scmi_sensors->info[type], + nr_count[type]); if (!scmi_sensors->info[type]) return -ENOMEM; } diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c index a0d220609565..2358580a6c3c 100644 --- a/drivers/hwmon/scpi-hwmon.c +++ b/drivers/hwmon/scpi-hwmon.c @@ -154,17 +154,17 @@ static int scpi_hwmon_probe(struct platform_device *pdev) if (!nr_sensors) return -ENODEV; - scpi_sensors = devm_kzalloc(dev, sizeof(*scpi_sensors), GFP_KERNEL); + scpi_sensors = devm_kzalloc_obj(dev, *scpi_sensors); if (!scpi_sensors) return -ENOMEM; - scpi_sensors->data = devm_kcalloc(dev, nr_sensors, - sizeof(*scpi_sensors->data), GFP_KERNEL); + scpi_sensors->data = devm_kzalloc_objs(dev, *scpi_sensors->data, + nr_sensors); if (!scpi_sensors->data) return -ENOMEM; - scpi_sensors->attrs = devm_kcalloc(dev, (nr_sensors * 2) + 1, - sizeof(*scpi_sensors->attrs), GFP_KERNEL); + scpi_sensors->attrs = devm_kzalloc_objs(dev, *scpi_sensors->attrs, + (nr_sensors * 2) + 1); if (!scpi_sensors->attrs) return -ENOMEM; @@ -269,7 +269,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev) if (sensor->info.class != TEMPERATURE) continue; - zone = devm_kzalloc(dev, sizeof(*zone), GFP_KERNEL); + zone = devm_kzalloc_obj(dev, *zone); if (!zone) return -ENOMEM; diff --git a/drivers/hwmon/sfctemp.c b/drivers/hwmon/sfctemp.c index b78b2c099a12..2f2bf0b922f1 100644 --- a/drivers/hwmon/sfctemp.c +++ b/drivers/hwmon/sfctemp.c @@ -239,7 +239,7 @@ static int sfctemp_probe(struct platform_device *pdev) struct sfctemp *sfctemp; int ret; - sfctemp = devm_kzalloc(dev, sizeof(*sfctemp), GFP_KERNEL); + sfctemp = devm_kzalloc_obj(dev, *sfctemp); if (!sfctemp) return -ENOMEM; diff --git a/drivers/hwmon/sg2042-mcu.c b/drivers/hwmon/sg2042-mcu.c index 591f5f572fe4..61408e14fb14 100644 --- a/drivers/hwmon/sg2042-mcu.c +++ b/drivers/hwmon/sg2042-mcu.c @@ -311,7 +311,7 @@ static int sg2042_mcu_i2c_probe(struct i2c_client *client) I2C_FUNC_SMBUS_BLOCK_DATA)) return -ENODEV; - mcu = devm_kmalloc(dev, sizeof(*mcu), GFP_KERNEL); + mcu = devm_kmalloc_obj(dev, *mcu); if (!mcu) return -ENOMEM; diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c index 7bb2105d1ae2..b4f7d8d7ca12 100644 --- a/drivers/hwmon/sht15.c +++ b/drivers/hwmon/sht15.c @@ -918,7 +918,7 @@ static int sht15_probe(struct platform_device *pdev) int ret; struct sht15_data *data; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/sht21.c b/drivers/hwmon/sht21.c index 085492669eeb..fef3faba2a53 100644 --- a/drivers/hwmon/sht21.c +++ b/drivers/hwmon/sht21.c @@ -260,7 +260,7 @@ static int sht21_probe(struct i2c_client *client) return -ENODEV; } - sht21 = devm_kzalloc(dev, sizeof(*sht21), GFP_KERNEL); + sht21 = devm_kzalloc_obj(dev, *sht21); if (!sht21) return -ENOMEM; diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c index a0f5ba5c888d..c217a4d0c9f1 100644 --- a/drivers/hwmon/sht3x.c +++ b/drivers/hwmon/sht3x.c @@ -896,7 +896,7 @@ static int sht3x_probe(struct i2c_client *client) if (ret != SHT3X_CMD_LENGTH) return ret < 0 ? ret : -ENODEV; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/sht4x.c b/drivers/hwmon/sht4x.c index 8372b4fc902e..63a2212c5da0 100644 --- a/drivers/hwmon/sht4x.c +++ b/drivers/hwmon/sht4x.c @@ -428,7 +428,7 @@ static int sht4x_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -EOPNOTSUPP; - data = devm_kzalloc(device, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(device, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/shtc1.c b/drivers/hwmon/shtc1.c index 362a73cf661b..7f31aa981545 100644 --- a/drivers/hwmon/shtc1.c +++ b/drivers/hwmon/shtc1.c @@ -225,7 +225,7 @@ static int shtc1_probe(struct i2c_client *client) return -ENODEV; } - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index b7a7bcd6d3af..be2bad5b0445 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c @@ -643,8 +643,7 @@ static int sis5595_probe(struct platform_device *pdev) DRIVER_NAME)) return -EBUSY; - data = devm_kzalloc(&pdev->dev, sizeof(struct sis5595_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct sis5595_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/sl28cpld-hwmon.c b/drivers/hwmon/sl28cpld-hwmon.c index 9c83b4f2a34b..60e5884bf289 100644 --- a/drivers/hwmon/sl28cpld-hwmon.c +++ b/drivers/hwmon/sl28cpld-hwmon.c @@ -83,7 +83,7 @@ static int sl28cpld_hwmon_probe(struct platform_device *pdev) if (!pdev->dev.parent) return -ENODEV; - hwmon = devm_kzalloc(&pdev->dev, sizeof(*hwmon), GFP_KERNEL); + hwmon = devm_kzalloc_obj(&pdev->dev, *hwmon); if (!hwmon) return -ENOMEM; diff --git a/drivers/hwmon/smpro-hwmon.c b/drivers/hwmon/smpro-hwmon.c index 37d859f6c8f3..32680e69096c 100644 --- a/drivers/hwmon/smpro-hwmon.c +++ b/drivers/hwmon/smpro-hwmon.c @@ -436,7 +436,7 @@ static int smpro_hwmon_probe(struct platform_device *pdev) struct smpro_hwmon *hwmon; struct device *hwmon_dev; - hwmon = devm_kzalloc(&pdev->dev, sizeof(struct smpro_hwmon), GFP_KERNEL); + hwmon = devm_kzalloc_obj(&pdev->dev, struct smpro_hwmon); if (!hwmon) return -ENOMEM; diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index c26d6eae0e4e..7e286dde5915 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c @@ -232,7 +232,7 @@ static int smsc47b397_probe(struct platform_device *pdev) return -EBUSY; } - data = devm_kzalloc(dev, sizeof(struct smsc47b397_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct smsc47b397_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index 595bceb78d76..8fbc99fb6acc 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c @@ -724,7 +724,7 @@ static int __init smsc47m1_probe(struct platform_device *pdev) if (err < 0) return err; - data = devm_kzalloc(dev, sizeof(struct smsc47m1_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct smsc47m1_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/smsc47m192.c b/drivers/hwmon/smsc47m192.c index 1429b66e09b0..21362c810ce4 100644 --- a/drivers/hwmon/smsc47m192.c +++ b/drivers/hwmon/smsc47m192.c @@ -594,7 +594,7 @@ static int smsc47m192_probe(struct i2c_client *client) struct smsc47m192_data *data; int config; - data = devm_kzalloc(dev, sizeof(struct smsc47m192_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct smsc47m192_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/socfpga-hwmon.c b/drivers/hwmon/socfpga-hwmon.c index 5fe5ccab1e4f..7e327b523270 100644 --- a/drivers/hwmon/socfpga-hwmon.c +++ b/drivers/hwmon/socfpga-hwmon.c @@ -525,7 +525,7 @@ static int socfpga_hwmon_probe(struct platform_device *pdev) return -ENODEV; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/sparx5-temp.c b/drivers/hwmon/sparx5-temp.c index aa9178073744..069e160c7a61 100644 --- a/drivers/hwmon/sparx5-temp.c +++ b/drivers/hwmon/sparx5-temp.c @@ -106,7 +106,7 @@ static int s5_temp_probe(struct platform_device *pdev) struct device *hwmon_dev; struct s5_hwmon *hwmon; - hwmon = devm_kzalloc(&pdev->dev, sizeof(*hwmon), GFP_KERNEL); + hwmon = devm_kzalloc_obj(&pdev->dev, *hwmon); if (!hwmon) return -ENOMEM; diff --git a/drivers/hwmon/spd5118.c b/drivers/hwmon/spd5118.c index 52f354489341..b54f9240a6ed 100644 --- a/drivers/hwmon/spd5118.c +++ b/drivers/hwmon/spd5118.c @@ -531,7 +531,7 @@ static int spd5118_common_probe(struct device *dev, struct regmap *regmap) struct device *hwmon_dev; int err; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/stts751.c b/drivers/hwmon/stts751.c index ce23681f7981..0a500264658a 100644 --- a/drivers/hwmon/stts751.c +++ b/drivers/hwmon/stts751.c @@ -768,7 +768,7 @@ static int stts751_probe(struct i2c_client *client) bool smbus_nto; int rev_id; - priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&client->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/hwmon/surface_temp.c b/drivers/hwmon/surface_temp.c index cd21f331f157..8510bfa60b0d 100644 --- a/drivers/hwmon/surface_temp.c +++ b/drivers/hwmon/surface_temp.c @@ -191,7 +191,7 @@ static int ssam_temp_probe(struct ssam_device *sdev) if (status) return status; - ssam_temp = devm_kzalloc(&sdev->dev, sizeof(*ssam_temp), GFP_KERNEL); + ssam_temp = devm_kzalloc_obj(&sdev->dev, *ssam_temp); if (!ssam_temp) return -ENOMEM; diff --git a/drivers/hwmon/tc654.c b/drivers/hwmon/tc654.c index 4af9f0e2c0bc..957166f17d39 100644 --- a/drivers/hwmon/tc654.c +++ b/drivers/hwmon/tc654.c @@ -519,7 +519,7 @@ static int tc654_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; - data = devm_kzalloc(dev, sizeof(struct tc654_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct tc654_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/tc74.c b/drivers/hwmon/tc74.c index e9113519be53..5a59fe835d87 100644 --- a/drivers/hwmon/tc74.c +++ b/drivers/hwmon/tc74.c @@ -113,7 +113,7 @@ static int tc74_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EOPNOTSUPP; - data = devm_kzalloc(dev, sizeof(struct tc74_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct tc74_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/thmc50.c b/drivers/hwmon/thmc50.c index b385ef64af75..62a71d3b2f2f 100644 --- a/drivers/hwmon/thmc50.c +++ b/drivers/hwmon/thmc50.c @@ -384,7 +384,7 @@ static int thmc50_probe(struct i2c_client *client) struct device *hwmon_dev; int idx = 0; - data = devm_kzalloc(dev, sizeof(struct thmc50_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct thmc50_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c index 8c8463ddb6c4..c80ce74eb65b 100644 --- a/drivers/hwmon/tmp102.c +++ b/drivers/hwmon/tmp102.c @@ -309,7 +309,7 @@ static int tmp102_probe(struct i2c_client *client) if (err < 0 && err != -ENODEV) return dev_err_probe(dev, err, "Failed to enable regulator\n"); - tmp102 = devm_kzalloc(dev, sizeof(*tmp102), GFP_KERNEL); + tmp102 = devm_kzalloc_obj(dev, *tmp102); if (!tmp102) return -ENOMEM; diff --git a/drivers/hwmon/tmp108.c b/drivers/hwmon/tmp108.c index 91d20a1ce112..604a3dd8af6b 100644 --- a/drivers/hwmon/tmp108.c +++ b/drivers/hwmon/tmp108.c @@ -450,7 +450,7 @@ static int tmp108_common_probe(struct device *dev, struct regmap *regmap, char * if (err) return dev_err_probe(dev, err, "Failed to enable regulator\n"); - tmp108 = devm_kzalloc(dev, sizeof(*tmp108), GFP_KERNEL); + tmp108 = devm_kzalloc_obj(dev, *tmp108); if (!tmp108) return -ENOMEM; diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c index 83aafe4bd3e7..2fceeacdc88c 100644 --- a/drivers/hwmon/tmp401.c +++ b/drivers/hwmon/tmp401.c @@ -673,7 +673,7 @@ static int tmp401_probe(struct i2c_client *client) struct tmp401_data *data; int status; - data = devm_kzalloc(dev, sizeof(struct tmp401_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct tmp401_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index ed00ccfdd7b3..c2887262b216 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -429,7 +429,7 @@ static int tmp421_probe(struct i2c_client *client) struct tmp421_data *data; int i, err; - data = devm_kzalloc(dev, sizeof(struct tmp421_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct tmp421_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/tmp464.c b/drivers/hwmon/tmp464.c index c3e031044d1e..7d77713e07bf 100644 --- a/drivers/hwmon/tmp464.c +++ b/drivers/hwmon/tmp464.c @@ -645,7 +645,7 @@ static int tmp464_probe(struct i2c_client *client) dev_err(&client->dev, "i2c functionality check failed\n"); return -ENODEV; } - data = devm_kzalloc(dev, sizeof(struct tmp464_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct tmp464_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/tmp513.c b/drivers/hwmon/tmp513.c index b160aa045f89..a3a4772a37e9 100644 --- a/drivers/hwmon/tmp513.c +++ b/drivers/hwmon/tmp513.c @@ -716,7 +716,7 @@ static int tmp51x_probe(struct i2c_client *client) struct device *hwmon_dev; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/tps23861.c b/drivers/hwmon/tps23861.c index 4cb3960d5170..6b31c9284fb8 100644 --- a/drivers/hwmon/tps23861.c +++ b/drivers/hwmon/tps23861.c @@ -509,7 +509,7 @@ static int tps23861_probe(struct i2c_client *client) struct device *hwmon_dev; u32 shunt_resistor; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/tsc1641.c b/drivers/hwmon/tsc1641.c index fc53cd5bb6e0..7dd298cc7404 100644 --- a/drivers/hwmon/tsc1641.c +++ b/drivers/hwmon/tsc1641.c @@ -696,7 +696,7 @@ static int tsc1641_probe(struct i2c_client *client) struct device *hwmon_dev; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/tvs-mpfs.c b/drivers/hwmon/tvs-mpfs.c index aad00676518b..bd150cef24e1 100644 --- a/drivers/hwmon/tvs-mpfs.c +++ b/drivers/hwmon/tvs-mpfs.c @@ -351,7 +351,7 @@ static int mpfs_tvs_probe(struct platform_device *pdev) struct device *hwmon_dev; struct mpfs_tvs *data; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/ultra45_env.c b/drivers/hwmon/ultra45_env.c index e4f1bb538628..1b6dbfb2ccc7 100644 --- a/drivers/hwmon/ultra45_env.c +++ b/drivers/hwmon/ultra45_env.c @@ -254,7 +254,7 @@ static const struct attribute_group env_group = { static int env_probe(struct platform_device *op) { - struct env *p = devm_kzalloc(&op->dev, sizeof(*p), GFP_KERNEL); + struct env *p = devm_kzalloc_obj(&op->dev, *p); int err = -ENOMEM; if (!p) diff --git a/drivers/hwmon/vexpress-hwmon.c b/drivers/hwmon/vexpress-hwmon.c index a2e350f52a9e..d38ac040eeee 100644 --- a/drivers/hwmon/vexpress-hwmon.c +++ b/drivers/hwmon/vexpress-hwmon.c @@ -209,7 +209,7 @@ static int vexpress_hwmon_probe(struct platform_device *pdev) struct vexpress_hwmon_data *data; const struct vexpress_hwmon_type *type; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; platform_set_drvdata(pdev, data); diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c index ec421201049d..ec48587f63fe 100644 --- a/drivers/hwmon/via-cputemp.c +++ b/drivers/hwmon/via-cputemp.c @@ -114,8 +114,7 @@ static int via_cputemp_probe(struct platform_device *pdev) int err; u64 val; - data = devm_kzalloc(&pdev->dev, sizeof(struct via_cputemp_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct via_cputemp_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index bbaeb808cc15..790b3c5a205f 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c @@ -755,8 +755,7 @@ static int via686a_probe(struct platform_device *pdev) return -ENODEV; } - data = devm_kzalloc(&pdev->dev, sizeof(struct via686a_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct via686a_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c index 1e52cabd6e24..5bc9e6e68df3 100644 --- a/drivers/hwmon/vt1211.c +++ b/drivers/hwmon/vt1211.c @@ -1158,7 +1158,7 @@ static int vt1211_probe(struct platform_device *pdev) struct resource *res; int i, err; - data = devm_kzalloc(dev, sizeof(struct vt1211_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct vt1211_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c index 5757a0979f3f..1fe361bc30e2 100644 --- a/drivers/hwmon/vt8231.c +++ b/drivers/hwmon/vt8231.c @@ -843,7 +843,7 @@ static int vt8231_probe(struct platform_device *pdev) return -ENODEV; } - data = devm_kzalloc(&pdev->dev, sizeof(struct vt8231_data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct vt8231_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index a23edd35c19f..9c08ab662dc6 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c @@ -1709,7 +1709,7 @@ static int __init w83627ehf_probe(struct platform_device *pdev) if (!devm_request_region(dev, res->start, IOREGION_LENGTH, DRVNAME)) return -EBUSY; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index bb993bb09f40..a26f4cdfb8e2 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c @@ -1686,7 +1686,7 @@ static int w83627hf_probe(struct platform_device *pdev) return -EBUSY; } - data = devm_kzalloc(dev, sizeof(struct w83627hf_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct w83627hf_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index c40f84e53469..59d2b9d40920 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c @@ -1198,7 +1198,7 @@ static int w83781d_probe(struct i2c_client *client) struct w83781d_data *data; int err; - data = devm_kzalloc(dev, sizeof(struct w83781d_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct w83781d_data); if (!data) return -ENOMEM; @@ -1768,8 +1768,7 @@ w83781d_isa_probe(struct platform_device *pdev) "w83781d")) return -EBUSY; - data = devm_kzalloc(&pdev->dev, sizeof(struct w83781d_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct w83781d_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c index 4b07a25ae59e..8bb457326c0b 100644 --- a/drivers/hwmon/w83791d.c +++ b/drivers/hwmon/w83791d.c @@ -1357,8 +1357,7 @@ static int w83791d_probe(struct i2c_client *client) (val1 >> 5) & 0x07, (val1 >> 1) & 0x0f, val1); #endif - data = devm_kzalloc(&client->dev, sizeof(struct w83791d_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct w83791d_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index f715c79389a5..2de6d7b68583 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c @@ -1358,7 +1358,7 @@ w83792d_probe(struct i2c_client *client) struct device *dev = &client->dev; int i, val1, err; - data = devm_kzalloc(dev, sizeof(struct w83792d_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct w83792d_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c index c5ce0bf1b08e..96fbb0a5006f 100644 --- a/drivers/hwmon/w83795.c +++ b/drivers/hwmon/w83795.c @@ -2142,7 +2142,7 @@ static int w83795_probe(struct i2c_client *client) struct w83795_data *data; int err; - data = devm_kzalloc(dev, sizeof(struct w83795_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct w83795_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c index e42506a3bcbe..0a078e23aed4 100644 --- a/drivers/hwmon/w83l785ts.c +++ b/drivers/hwmon/w83l785ts.c @@ -168,7 +168,7 @@ static int w83l785ts_probe(struct i2c_client *client) struct device *dev = &client->dev; int err; - data = devm_kzalloc(dev, sizeof(struct w83l785ts_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct w83l785ts_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c index a72397083cc4..d16afda34e41 100644 --- a/drivers/hwmon/w83l786ng.c +++ b/drivers/hwmon/w83l786ng.c @@ -723,7 +723,7 @@ w83l786ng_probe(struct i2c_client *client) int i; u8 reg_tmp; - data = devm_kzalloc(dev, sizeof(struct w83l786ng_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct w83l786ng_data); if (!data) return -ENOMEM; diff --git a/drivers/hwmon/xgene-hwmon.c b/drivers/hwmon/xgene-hwmon.c index eebbb741deac..0823882189aa 100644 --- a/drivers/hwmon/xgene-hwmon.c +++ b/drivers/hwmon/xgene-hwmon.c @@ -608,7 +608,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev) struct mbox_client *cl; int rc; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/hwmon/yogafan.c b/drivers/hwmon/yogafan.c index aa3284560715..6d1284c09048 100644 --- a/drivers/hwmon/yogafan.c +++ b/drivers/hwmon/yogafan.c @@ -326,7 +326,7 @@ static int yoga_fan_probe(struct platform_device *pdev) return -ENODEV; cfg = dmi_id->driver_data; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c index 1832e0c3af6b..7c5e04f1fee7 100644 --- a/drivers/hwspinlock/omap_hwspinlock.c +++ b/drivers/hwspinlock/omap_hwspinlock.c @@ -111,8 +111,7 @@ static int omap_hwspinlock_probe(struct platform_device *pdev) num_locks = i * 32; /* actual number of locks in this device */ - bank = devm_kzalloc(&pdev->dev, struct_size(bank, lock, num_locks), - GFP_KERNEL); + bank = devm_kzalloc_flex(&pdev->dev, *bank, lock, num_locks); if (!bank) return -ENOMEM; diff --git a/drivers/hwspinlock/sprd_hwspinlock.c b/drivers/hwspinlock/sprd_hwspinlock.c index 22e2ffb91743..24655544eae9 100644 --- a/drivers/hwspinlock/sprd_hwspinlock.c +++ b/drivers/hwspinlock/sprd_hwspinlock.c @@ -92,9 +92,8 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - sprd_hwlock = devm_kzalloc(&pdev->dev, - struct_size(sprd_hwlock, bank.lock, SPRD_HWLOCKS_NUM), - GFP_KERNEL); + sprd_hwlock = devm_kzalloc_flex(&pdev->dev, *sprd_hwlock, bank.lock, + SPRD_HWLOCKS_NUM); if (!sprd_hwlock) return -ENOMEM; diff --git a/drivers/hwspinlock/stm32_hwspinlock.c b/drivers/hwspinlock/stm32_hwspinlock.c index bb5c7e5f7a80..70fbe111c2dc 100644 --- a/drivers/hwspinlock/stm32_hwspinlock.c +++ b/drivers/hwspinlock/stm32_hwspinlock.c @@ -79,7 +79,7 @@ static int stm32_hwspinlock_probe(struct platform_device *pdev) if (IS_ERR(io_base)) return PTR_ERR(io_base); - hw = devm_kzalloc(dev, struct_size(hw, bank.lock, STM32_MUTEX_NUM_LOCKS), GFP_KERNEL); + hw = devm_kzalloc_flex(dev, *hw, bank.lock, STM32_MUTEX_NUM_LOCKS); if (!hw) return -ENOMEM; diff --git a/drivers/hwspinlock/sun6i_hwspinlock.c b/drivers/hwspinlock/sun6i_hwspinlock.c index c2d314588046..29431a71e74e 100644 --- a/drivers/hwspinlock/sun6i_hwspinlock.c +++ b/drivers/hwspinlock/sun6i_hwspinlock.c @@ -100,7 +100,7 @@ static int sun6i_hwspinlock_probe(struct platform_device *pdev) if (IS_ERR(io_base)) return PTR_ERR(io_base); - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; @@ -154,8 +154,8 @@ static int sun6i_hwspinlock_probe(struct platform_device *pdev) goto bank_fail; } - priv->bank = devm_kzalloc(&pdev->dev, struct_size(priv->bank, lock, priv->nlocks), - GFP_KERNEL); + priv->bank = devm_kzalloc_flex(&pdev->dev, *priv->bank, lock, + priv->nlocks); if (!priv->bank) { err = -ENOMEM; goto bank_fail; diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index ad8dafea7d2f..d1f9c89dfeee 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -518,7 +518,7 @@ static int __catu_probe(struct device *dev, struct resource *res) struct coresight_platform_data *pdata = NULL; void __iomem *base; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c index 3a806c1d50ea..a5e688da638b 100644 --- a/drivers/hwtracing/coresight/coresight-cpu-debug.c +++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c @@ -562,7 +562,7 @@ static int __debug_probe(struct device *dev, struct resource *res) void __iomem *base; int ret; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-ctcu-core.c b/drivers/hwtracing/coresight/coresight-ctcu-core.c index 9043cad42f01..a2709bdeab2b 100644 --- a/drivers/hwtracing/coresight/coresight-ctcu-core.c +++ b/drivers/hwtracing/coresight/coresight-ctcu-core.c @@ -189,7 +189,7 @@ static int ctcu_probe(struct platform_device *pdev) if (!desc.name) return -ENOMEM; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-cti-core.c b/drivers/hwtracing/coresight/coresight-cti-core.c index b2c9a4db13b4..17786ffa92ce 100644 --- a/drivers/hwtracing/coresight/coresight-cti-core.c +++ b/drivers/hwtracing/coresight/coresight-cti-core.c @@ -232,7 +232,7 @@ struct cti_trig_con *cti_allocate_trig_con(struct device *dev, int in_sigs, struct cti_trig_con *tc = NULL; struct cti_trig_grp *in = NULL, *out = NULL; - tc = devm_kzalloc(dev, sizeof(struct cti_trig_con), GFP_KERNEL); + tc = devm_kzalloc_obj(dev, struct cti_trig_con); if (!tc) return tc; @@ -664,7 +664,7 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id) struct resource *res = &adev->res; /* driver data*/ - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c index 5d5a195c4359..8ab2ed499a8f 100644 --- a/drivers/hwtracing/coresight/coresight-cti-platform.c +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c @@ -471,7 +471,7 @@ coresight_cti_get_platform_data(struct device *dev) * empty struct enables us to use the standard coresight component * registration code. */ - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) { ret = -ENOMEM; goto error; diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c index 2ed5d8eb1dda..44e5f26bb9ac 100644 --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c @@ -1018,8 +1018,7 @@ static int cti_create_con_sysfs_attr(struct device *dev, struct dev_ext_attribute *eattr; char *name; - eattr = devm_kzalloc(dev, sizeof(struct dev_ext_attribute), - GFP_KERNEL); + eattr = devm_kzalloc_obj(dev, struct dev_ext_attribute); if (eattr) { name = devm_kstrdup(dev, con_attr_names[attr_type], GFP_KERNEL); @@ -1055,7 +1054,7 @@ cti_create_con_sysfs_group(struct device *dev, struct cti_device *ctidev, struct attribute_group *group = NULL; int grp_idx; - group = devm_kzalloc(dev, sizeof(struct attribute_group), GFP_KERNEL); + group = devm_kzalloc_obj(dev, struct attribute_group); if (!group) return NULL; @@ -1083,8 +1082,8 @@ static int cti_create_con_attr_set(struct device *dev, int con_idx, return -ENOMEM; /* allocate NULL terminated array of attributes */ - tc->con_attrs = devm_kcalloc(dev, CTI_CON_ATTR_MAX + 1, - sizeof(struct attribute *), GFP_KERNEL); + tc->con_attrs = devm_kzalloc_objs(dev, struct attribute *, + CTI_CON_ATTR_MAX + 1); if (!tc->con_attrs) return -ENOMEM; @@ -1131,9 +1130,8 @@ static int cti_create_cons_groups(struct device *dev, struct cti_device *ctidev) /* nr groups = dynamic + static + NULL terminator */ nr_groups = ctidev->nr_trig_con + CORESIGHT_CTI_STATIC_GROUPS_MAX; - ctidev->con_groups = devm_kcalloc(dev, nr_groups, - sizeof(*ctidev->con_groups), - GFP_KERNEL); + ctidev->con_groups = devm_kzalloc_objs(dev, *ctidev->con_groups, + nr_groups); if (!ctidev->con_groups) return -ENOMEM; return 0; diff --git a/drivers/hwtracing/coresight/coresight-dummy.c b/drivers/hwtracing/coresight/coresight-dummy.c index c176a2f57300..3ba1477f4e15 100644 --- a/drivers/hwtracing/coresight/coresight-dummy.c +++ b/drivers/hwtracing/coresight/coresight-dummy.c @@ -117,7 +117,7 @@ static int dummy_probe(struct platform_device *pdev) struct coresight_desc desc = { 0 }; int ret = 0, trace_id = 0; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index a827f76b8144..676596bd8095 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -724,7 +724,7 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) if (!desc.name) return -ENOMEM; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 80502e8b0840..492cc3be8749 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -919,7 +919,7 @@ etm_perf_add_symlink_group(struct device *dev, const char *name, const char *gro if (!etm_perf_up) return ERR_PTR(-EPROBE_DEFER); - ea = devm_kzalloc(dev, sizeof(*ea), GFP_KERNEL); + ea = devm_kzalloc_obj(dev, *ea); if (!ea) return ERR_PTR(-ENOMEM); diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/hwtracing/coresight/coresight-etm3x-core.c index b670a324bb41..d371da07896a 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c @@ -809,7 +809,7 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index e21be6468e95..726b0ec9cc2d 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -2224,9 +2224,8 @@ static int etm4_add_coresight_dev(struct etm4_init_arg *init_arg) pm_save = pm_save_enable != PARAM_PM_SAVE_NEVER; if (pm_save) { - drvdata->save_state = devm_kmalloc(dev, - sizeof(struct etmv4_save_state), - GFP_KERNEL); + drvdata->save_state = devm_kmalloc_obj(dev, + struct etmv4_save_state); if (!drvdata->save_state) return -ENOMEM; } @@ -2307,7 +2306,7 @@ static int etm4_probe(struct device *dev) if (smp_call_function_single(drvdata->cpu, etm4_init_arch_data, &init_arg, 1)) { /* The CPU was offline, try again once it comes online. */ - delayed = devm_kmalloc(dev, sizeof(*delayed), GFP_KERNEL); + delayed = devm_kmalloc_obj(dev, *delayed); if (!delayed) { cpus_read_unlock(); return -ENOMEM; @@ -2338,7 +2337,7 @@ static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) if (IS_ERR(base)) return PTR_ERR(base); - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; @@ -2357,7 +2356,7 @@ static int etm4_probe_platform_dev(struct platform_device *pdev) struct etmv4_drvdata *drvdata; int ret; - drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index 0abc11f0690c..2d41c487880d 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -225,7 +225,7 @@ static int funnel_probe(struct device *dev, struct resource *res) if (!desc.name) return -ENOMEM; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-kunit-tests.c b/drivers/hwtracing/coresight/coresight-kunit-tests.c index c8f361767c45..0c37f2233984 100644 --- a/drivers/hwtracing/coresight/coresight-kunit-tests.c +++ b/drivers/hwtracing/coresight/coresight-kunit-tests.c @@ -8,12 +8,10 @@ static struct coresight_device *coresight_test_device(struct device *dev) { - struct coresight_device *csdev = devm_kcalloc(dev, 1, - sizeof(struct coresight_device), - GFP_KERNEL); - csdev->pdata = devm_kcalloc(dev, 1, - sizeof(struct coresight_platform_data), - GFP_KERNEL); + struct coresight_device *csdev = devm_kzalloc_objs(dev, + struct coresight_device, + 1); + csdev->pdata = devm_kzalloc_objs(dev, struct coresight_platform_data, 1); return csdev; } diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 93c2d075cad6..6657a817719a 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -51,8 +51,7 @@ coresight_add_out_conn(struct device *dev, if (!pdata->out_conns) return ERR_PTR(-ENOMEM); - conn = devm_kmalloc(dev, sizeof(struct coresight_connection), - GFP_KERNEL); + conn = devm_kmalloc_obj(dev, struct coresight_connection); if (!conn) return ERR_PTR(-ENOMEM); @@ -835,7 +834,7 @@ coresight_get_platform_data(struct device *dev) if (IS_ERR_OR_NULL(fwnode)) goto error; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) { ret = -ENOMEM; goto error; diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 2f382de357ee..1118a7904475 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -232,7 +232,7 @@ static int replicator_probe(struct device *dev, struct resource *res) if (!desc.name) return -ENOMEM; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 4e860519a73f..babaa424b045 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -836,7 +836,7 @@ static int __stm_probe(struct device *dev, struct resource *res) if (!desc.name) return -ENOMEM; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-syscfg-configfs.c b/drivers/hwtracing/coresight/coresight-syscfg-configfs.c index 2b40e556be87..71ac86587d12 100644 --- a/drivers/hwtracing/coresight/coresight-syscfg-configfs.c +++ b/drivers/hwtracing/coresight/coresight-syscfg-configfs.c @@ -14,7 +14,7 @@ static struct config_item_type *cscfg_create_ci_type(void) { struct config_item_type *ci_type; - ci_type = devm_kzalloc(cscfg_device(), sizeof(*ci_type), GFP_KERNEL); + ci_type = devm_kzalloc_obj(cscfg_device(), *ci_type); if (ci_type) ci_type->ct_owner = THIS_MODULE; @@ -186,8 +186,8 @@ static int cscfg_add_preset_groups(struct cscfg_fs_config *cfg_view) return 0; for (preset_num = 1; preset_num <= config_desc->nr_presets; preset_num++) { - cfg_fs_preset = devm_kzalloc(cscfg_device(), - sizeof(struct cscfg_fs_preset), GFP_KERNEL); + cfg_fs_preset = devm_kzalloc_obj(cscfg_device(), + struct cscfg_fs_preset); if (!cfg_fs_preset) return -ENOMEM; @@ -211,7 +211,7 @@ static struct config_group *cscfg_create_config_group(struct cscfg_config_desc * if (!dev) return ERR_PTR(-EINVAL); - cfg_view = devm_kzalloc(dev, sizeof(struct cscfg_fs_config), GFP_KERNEL); + cfg_view = devm_kzalloc_obj(dev, struct cscfg_fs_config); if (!cfg_view) return ERR_PTR(-ENOMEM); @@ -328,7 +328,7 @@ static int cscfg_create_params_group_items(struct cscfg_feature_desc *feat_desc, /* parameter items - as groups with default_value attribute */ for (i = 0; i < feat_desc->nr_params; i++) { - param_item = devm_kzalloc(dev, sizeof(struct cscfg_fs_param), GFP_KERNEL); + param_item = devm_kzalloc_obj(dev, struct cscfg_fs_param); if (!param_item) return -ENOMEM; param_item->feat_desc = feat_desc; @@ -352,12 +352,12 @@ static struct config_group *cscfg_create_feature_group(struct cscfg_feature_desc if (!dev) return ERR_PTR(-EINVAL); - feat_view = devm_kzalloc(dev, sizeof(struct cscfg_fs_feature), GFP_KERNEL); + feat_view = devm_kzalloc_obj(dev, struct cscfg_fs_feature); if (!feat_view) return ERR_PTR(-ENOMEM); if (feat_desc->nr_params) { - params_group = devm_kzalloc(dev, sizeof(struct config_group), GFP_KERNEL); + params_group = devm_kzalloc_obj(dev, struct config_group); if (!params_group) return ERR_PTR(-ENOMEM); diff --git a/drivers/hwtracing/coresight/coresight-syscfg.c b/drivers/hwtracing/coresight/coresight-syscfg.c index 2bfdd7b45e49..8ddebbbb40c2 100644 --- a/drivers/hwtracing/coresight/coresight-syscfg.c +++ b/drivers/hwtracing/coresight/coresight-syscfg.c @@ -126,7 +126,7 @@ cscfg_alloc_csdev_feat(struct coresight_device *csdev, struct cscfg_feature_desc struct device *dev = csdev->dev.parent; int i; - feat_csdev = devm_kzalloc(dev, sizeof(struct cscfg_feature_csdev), GFP_KERNEL); + feat_csdev = devm_kzalloc_obj(dev, struct cscfg_feature_csdev); if (!feat_csdev) return NULL; @@ -139,9 +139,9 @@ cscfg_alloc_csdev_feat(struct coresight_device *csdev, struct cscfg_feature_desc * feature descriptor. */ if (feat_csdev->nr_params) { - feat_csdev->params_csdev = devm_kcalloc(dev, feat_csdev->nr_params, - sizeof(struct cscfg_parameter_csdev), - GFP_KERNEL); + feat_csdev->params_csdev = devm_kzalloc_objs(dev, + struct cscfg_parameter_csdev, + feat_csdev->nr_params); if (!feat_csdev->params_csdev) return NULL; @@ -158,9 +158,9 @@ cscfg_alloc_csdev_feat(struct coresight_device *csdev, struct cscfg_feature_desc * will fill out according to feature descriptor and device requirements. */ feat_csdev->nr_regs = feat_desc->nr_regs; - feat_csdev->regs_csdev = devm_kcalloc(dev, feat_csdev->nr_regs, - sizeof(struct cscfg_regval_csdev), - GFP_KERNEL); + feat_csdev->regs_csdev = devm_kzalloc_objs(dev, + struct cscfg_regval_csdev, + feat_csdev->nr_regs); if (!feat_csdev->regs_csdev) return NULL; diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c index bc5a133ada3e..2e67e4a6d963 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-core.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -774,7 +774,7 @@ static int __tmc_probe(struct device *dev, struct resource *res) struct coresight_desc desc = { 0 }; const char *dev_list = NULL; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-tnoc.c b/drivers/hwtracing/coresight/coresight-tnoc.c index 929d316b4b36..d80217208ba4 100644 --- a/drivers/hwtracing/coresight/coresight-tnoc.c +++ b/drivers/hwtracing/coresight/coresight-tnoc.c @@ -198,7 +198,7 @@ static int _tnoc_probe(struct device *dev, struct resource *res) return PTR_ERR(pdata); dev->platform_data = pdata; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/hwtracing/coresight/coresight-tpda.c index 89c8f71f0aff..9f1502fdfffe 100644 --- a/drivers/hwtracing/coresight/coresight-tpda.c +++ b/drivers/hwtracing/coresight/coresight-tpda.c @@ -565,7 +565,7 @@ static int tpda_probe(struct amba_device *adev, const struct amba_id *id) return PTR_ERR(pdata); adev->dev.platform_data = pdata; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c index 8464edbba2d4..102b8b7edf87 100644 --- a/drivers/hwtracing/coresight/coresight-tpdm.c +++ b/drivers/hwtracing/coresight/coresight-tpdm.c @@ -582,15 +582,13 @@ static int tpdm_datasets_setup(struct tpdm_drvdata *drvdata) drvdata->datasets |= pidr & GENMASK(TPDM_DATASETS - 1, 0); if (tpdm_has_dsb_dataset(drvdata) && (!drvdata->dsb)) { - drvdata->dsb = devm_kzalloc(drvdata->dev, - sizeof(*drvdata->dsb), GFP_KERNEL); + drvdata->dsb = devm_kzalloc_obj(drvdata->dev, *drvdata->dsb); if (!drvdata->dsb) return -ENOMEM; } if ((tpdm_has_cmb_dataset(drvdata) || tpdm_has_mcmb_dataset(drvdata)) && (!drvdata->cmb)) { - drvdata->cmb = devm_kzalloc(drvdata->dev, - sizeof(*drvdata->cmb), GFP_KERNEL); + drvdata->cmb = devm_kzalloc_obj(drvdata->dev, *drvdata->cmb); if (!drvdata->cmb) return -ENOMEM; } @@ -605,8 +603,7 @@ static int static_tpdm_datasets_setup(struct tpdm_drvdata *drvdata, struct devic /* setup datasets for static TPDM */ if (fwnode_property_present(dev->fwnode, "qcom,dsb-element-bits") && (!drvdata->dsb)) { - drvdata->dsb = devm_kzalloc(drvdata->dev, - sizeof(*drvdata->dsb), GFP_KERNEL); + drvdata->dsb = devm_kzalloc_obj(drvdata->dev, *drvdata->dsb); if (!drvdata->dsb) return -ENOMEM; @@ -614,8 +611,7 @@ static int static_tpdm_datasets_setup(struct tpdm_drvdata *drvdata, struct devic if (fwnode_property_present(dev->fwnode, "qcom,cmb-element-bits") && (!drvdata->cmb)) { - drvdata->cmb = devm_kzalloc(drvdata->dev, - sizeof(*drvdata->cmb), GFP_KERNEL); + drvdata->cmb = devm_kzalloc_obj(drvdata->dev, *drvdata->cmb); if (!drvdata->cmb) return -ENOMEM; @@ -1414,7 +1410,7 @@ static int tpdm_probe(struct device *dev, struct resource *res) dev->platform_data = pdata; /* driver data*/ - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; drvdata->dev = dev; diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c index 7b029d2eb389..45113e45c3bd 100644 --- a/drivers/hwtracing/coresight/coresight-tpiu.c +++ b/drivers/hwtracing/coresight/coresight-tpiu.c @@ -136,7 +136,7 @@ static int __tpiu_probe(struct device *dev, struct resource *res) if (!desc.name) return -ENOMEM; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c index eca8e13a9744..3fa663c7f026 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.c +++ b/drivers/hwtracing/coresight/coresight-trbe.c @@ -1337,7 +1337,7 @@ static void arm_trbe_register_coresight_cpu(struct trbe_drvdata *drvdata, int cp * coresight_platform_data structure and assign that back * into the device for that purpose. */ - desc.pdata = devm_kzalloc(dev, sizeof(*desc.pdata), GFP_KERNEL); + desc.pdata = devm_kzalloc_obj(dev, *desc.pdata); if (!desc.pdata) goto cpu_clear; @@ -1587,7 +1587,7 @@ static int arm_trbe_device_probe(struct platform_device *pdev) return -EOPNOTSUPP; } - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/ultrasoc-smb.c b/drivers/hwtracing/coresight/ultrasoc-smb.c index b107d4606fcd..6a778f96804d 100644 --- a/drivers/hwtracing/coresight/ultrasoc-smb.c +++ b/drivers/hwtracing/coresight/ultrasoc-smb.c @@ -538,7 +538,7 @@ static int smb_probe(struct platform_device *pdev) struct smb_drv_data *drvdata; int ret; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/intel_th/gth.c b/drivers/hwtracing/intel_th/gth.c index 3883f99fd5d5..dd659a637f0b 100644 --- a/drivers/hwtracing/intel_th/gth.c +++ b/drivers/hwtracing/intel_th/gth.c @@ -374,9 +374,8 @@ static int intel_th_master_attributes(struct gth_device *gth) if (!attrs) return -ENOMEM; - master_attrs = devm_kcalloc(gth->dev, nattrs, - sizeof(struct master_attribute), - GFP_KERNEL); + master_attrs = devm_kzalloc_objs(gth->dev, struct master_attribute, + nattrs); if (!master_attrs) return -ENOMEM; @@ -418,9 +417,7 @@ static int intel_th_output_attributes(struct gth_device *gth) if (!attrs) return -ENOMEM; - out_attrs = devm_kcalloc(gth->dev, nattrs, - sizeof(struct output_attribute), - GFP_KERNEL); + out_attrs = devm_kzalloc_objs(gth->dev, struct output_attribute, nattrs); if (!out_attrs) return -ENOMEM; @@ -758,7 +755,7 @@ static int intel_th_gth_probe(struct intel_th_device *thdev) if (!base) return -ENOMEM; - gth = devm_kzalloc(dev, sizeof(*gth), GFP_KERNEL); + gth = devm_kzalloc_obj(dev, *gth); if (!gth) return -ENOMEM; diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c index 84d99d7b1d20..47928dd7d1e9 100644 --- a/drivers/hwtracing/intel_th/msu.c +++ b/drivers/hwtracing/intel_th/msu.c @@ -2139,7 +2139,7 @@ static int intel_th_msc_probe(struct intel_th_device *thdev) if (!base) return -ENOMEM; - msc = devm_kzalloc(dev, sizeof(*msc), GFP_KERNEL); + msc = devm_kzalloc_obj(dev, *msc); if (!msc) return -ENOMEM; diff --git a/drivers/hwtracing/intel_th/pti.c b/drivers/hwtracing/intel_th/pti.c index 09132ab8bc23..ffd9eed66708 100644 --- a/drivers/hwtracing/intel_th/pti.c +++ b/drivers/hwtracing/intel_th/pti.c @@ -213,7 +213,7 @@ static int intel_th_pti_probe(struct intel_th_device *thdev) if (!base) return -ENOMEM; - pti = devm_kzalloc(dev, sizeof(*pti), GFP_KERNEL); + pti = devm_kzalloc_obj(dev, *pti); if (!pti) return -ENOMEM; diff --git a/drivers/hwtracing/intel_th/sth.c b/drivers/hwtracing/intel_th/sth.c index 428f595a28a0..dfc51ff2372f 100644 --- a/drivers/hwtracing/intel_th/sth.c +++ b/drivers/hwtracing/intel_th/sth.c @@ -207,7 +207,7 @@ static int intel_th_sth_probe(struct intel_th_device *thdev) if (!channels) return -ENOMEM; - sth = devm_kzalloc(dev, sizeof(*sth), GFP_KERNEL); + sth = devm_kzalloc_obj(dev, *sth); if (!sth) return -ENOMEM; diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c index 52f168f8b459..6ed65b44a4af 100644 --- a/drivers/hwtracing/ptt/hisi_ptt.c +++ b/drivers/hwtracing/ptt/hisi_ptt.c @@ -704,8 +704,8 @@ static int hisi_ptt_config_trace_buf(struct hisi_ptt *hisi_ptt) struct device *dev = &hisi_ptt->pdev->dev; int i; - ctrl->trace_buf = devm_kcalloc(dev, HISI_PTT_TRACE_BUF_CNT, - sizeof(*ctrl->trace_buf), GFP_KERNEL); + ctrl->trace_buf = devm_kzalloc_objs(dev, *ctrl->trace_buf, + HISI_PTT_TRACE_BUF_CNT); if (!ctrl->trace_buf) return -ENOMEM; @@ -1311,7 +1311,7 @@ static int hisi_ptt_probe(struct pci_dev *pdev, return ret; } - hisi_ptt = devm_kzalloc(&pdev->dev, sizeof(*hisi_ptt), GFP_KERNEL); + hisi_ptt = devm_kzalloc_obj(&pdev->dev, *hisi_ptt); if (!hisi_ptt) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-altera.c b/drivers/i2c/busses/i2c-altera.c index 2da73173ce24..0174805ff822 100644 --- a/drivers/i2c/busses/i2c-altera.c +++ b/drivers/i2c/busses/i2c-altera.c @@ -385,7 +385,7 @@ static int altr_i2c_probe(struct platform_device *pdev) struct altr_i2c_dev *idev = NULL; int irq, ret; - idev = devm_kzalloc(&pdev->dev, sizeof(*idev), GFP_KERNEL); + idev = devm_kzalloc_obj(&pdev->dev, *idev); if (!idev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-amd-asf-plat.c b/drivers/i2c/busses/i2c-amd-asf-plat.c index 2a5711411ee5..868361e8d929 100644 --- a/drivers/i2c/busses/i2c-amd-asf-plat.c +++ b/drivers/i2c/busses/i2c-amd-asf-plat.c @@ -307,7 +307,7 @@ static int amd_asf_probe(struct platform_device *pdev) struct resource *eoi_addr; int ret, irq; - asf_dev = devm_kzalloc(dev, sizeof(*asf_dev), GFP_KERNEL); + asf_dev = devm_kzalloc_obj(dev, *asf_dev); if (!asf_dev) return dev_err_probe(dev, -ENOMEM, "Failed to allocate memory\n"); diff --git a/drivers/i2c/busses/i2c-amd-mp2-pci.c b/drivers/i2c/busses/i2c-amd-mp2-pci.c index 5b41d18b62d3..cc24a4f648fa 100644 --- a/drivers/i2c/busses/i2c-amd-mp2-pci.c +++ b/drivers/i2c/busses/i2c-amd-mp2-pci.c @@ -345,7 +345,7 @@ static int amd_mp2_pci_probe(struct pci_dev *pci_dev, struct amd_mp2_dev *privdata; int rc; - privdata = devm_kzalloc(&pci_dev->dev, sizeof(*privdata), GFP_KERNEL); + privdata = devm_kzalloc_obj(&pci_dev->dev, *privdata); if (!privdata) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-amd-mp2-plat.c b/drivers/i2c/busses/i2c-amd-mp2-plat.c index cc5961364bcc..6fa369be3981 100644 --- a/drivers/i2c/busses/i2c-amd-mp2-plat.c +++ b/drivers/i2c/busses/i2c-amd-mp2-plat.c @@ -266,7 +266,7 @@ static int i2c_amd_probe(struct platform_device *pdev) /* The MP2 PCI device should get probed later */ return -EPROBE_DEFER; - i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL); + i2c_dev = devm_kzalloc_obj(&pdev->dev, *i2c_dev); if (!i2c_dev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c index dd9ac4bb6704..d99fca834a26 100644 --- a/drivers/i2c/busses/i2c-amd8111.c +++ b/drivers/i2c/busses/i2c-amd8111.c @@ -427,7 +427,7 @@ static int amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id) if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO)) return -ENODEV; - smbus = devm_kzalloc(&dev->dev, sizeof(struct amd_smbus), GFP_KERNEL); + smbus = devm_kzalloc_obj(&dev->dev, struct amd_smbus); if (!smbus) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c index a26b74c71206..0ff95416fcf1 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -1002,7 +1002,7 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) struct clk *parent_clk; int irq, ret; - bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); + bus = devm_kzalloc_obj(&pdev->dev, *bus); if (!bus) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-at91-core.c b/drivers/i2c/busses/i2c-at91-core.c index 8ca4556d9664..2a515a2e4ef5 100644 --- a/drivers/i2c/busses/i2c-at91-core.c +++ b/drivers/i2c/busses/i2c-at91-core.c @@ -200,7 +200,7 @@ static int at91_twi_probe(struct platform_device *pdev) int rc; u32 phy_addr; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c index b78b38ddac46..e468b0c0121d 100644 --- a/drivers/i2c/busses/i2c-au1550.c +++ b/drivers/i2c/busses/i2c-au1550.c @@ -303,8 +303,7 @@ i2c_au1550_probe(struct platform_device *pdev) struct i2c_au1550_data *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(struct i2c_au1550_data), - GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct i2c_au1550_data); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-axxia.c b/drivers/i2c/busses/i2c-axxia.c index 0555eeb6903a..d1744c0ae7bb 100644 --- a/drivers/i2c/busses/i2c-axxia.c +++ b/drivers/i2c/busses/i2c-axxia.c @@ -724,7 +724,7 @@ static int axxia_i2c_probe(struct platform_device *pdev) void __iomem *base; int ret = 0; - idev = devm_kzalloc(&pdev->dev, sizeof(*idev), GFP_KERNEL); + idev = devm_kzalloc_obj(&pdev->dev, *idev); if (!idev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index 66bb3bfdaa4c..58327b8c7781 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -1102,8 +1102,7 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev) struct i2c_adapter *adap; int irq, ret; - iproc_i2c = devm_kzalloc(&pdev->dev, sizeof(*iproc_i2c), - GFP_KERNEL); + iproc_i2c = devm_kzalloc_obj(&pdev->dev, *iproc_i2c); if (!iproc_i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-bcm-kona.c b/drivers/i2c/busses/i2c-bcm-kona.c index d4f287b31fd7..0d52f3724c93 100644 --- a/drivers/i2c/busses/i2c-bcm-kona.c +++ b/drivers/i2c/busses/i2c-bcm-kona.c @@ -741,7 +741,7 @@ static int bcm_kona_i2c_probe(struct platform_device *pdev) struct i2c_adapter *adap; /* Allocate memory for private data structure */ - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c index b30f7e0e45f1..0fea44d4df6e 100644 --- a/drivers/i2c/busses/i2c-bcm2835.c +++ b/drivers/i2c/busses/i2c-bcm2835.c @@ -181,7 +181,7 @@ static struct clk *bcm2835_i2c_register_div(struct device *dev, init.num_parents = 1; init.flags = 0; - priv = devm_kzalloc(dev, sizeof(struct clk_bcm2835_i2c), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct clk_bcm2835_i2c); if (priv == NULL) return ERR_PTR(-ENOMEM); @@ -413,7 +413,7 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) struct clk *mclk; u32 bus_clk_rate; - i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL); + i2c_dev = devm_kzalloc_obj(&pdev->dev, *i2c_dev); if (!i2c_dev) return -ENOMEM; platform_set_drvdata(pdev, i2c_dev); diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c index 5fa30e8926c5..52762249d46a 100644 --- a/drivers/i2c/busses/i2c-brcmstb.c +++ b/drivers/i2c/busses/i2c-brcmstb.c @@ -617,11 +617,11 @@ static int brcmstb_i2c_probe(struct platform_device *pdev) int rc; /* Allocate memory for private data structure */ - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; - dev->bsc_regmap = devm_kzalloc(&pdev->dev, sizeof(*dev->bsc_regmap), GFP_KERNEL); + dev->bsc_regmap = devm_kzalloc_obj(&pdev->dev, *dev->bsc_regmap); if (!dev->bsc_regmap) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c index da8770182a18..0c6887da47d1 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -1497,7 +1497,7 @@ static int cdns_i2c_probe(struct platform_device *pdev) int ret, irq; const struct of_device_id *match; - id = devm_kzalloc(&pdev->dev, sizeof(*id), GFP_KERNEL); + id = devm_kzalloc_obj(&pdev->dev, *id); if (!id) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-cbus-gpio.c b/drivers/i2c/busses/i2c-cbus-gpio.c index 8065c7e4462e..3ec1eab1eb07 100644 --- a/drivers/i2c/busses/i2c-cbus-gpio.c +++ b/drivers/i2c/busses/i2c-cbus-gpio.c @@ -212,12 +212,11 @@ static int cbus_i2c_probe(struct platform_device *pdev) struct i2c_adapter *adapter; struct cbus_host *chost; - adapter = devm_kzalloc(&pdev->dev, sizeof(struct i2c_adapter), - GFP_KERNEL); + adapter = devm_kzalloc_obj(&pdev->dev, struct i2c_adapter); if (!adapter) return -ENOMEM; - chost = devm_kzalloc(&pdev->dev, sizeof(*chost), GFP_KERNEL); + chost = devm_kzalloc_obj(&pdev->dev, *chost); if (!chost) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-cgbc.c b/drivers/i2c/busses/i2c-cgbc.c index 25a74fa51aa0..164be9b99eb3 100644 --- a/drivers/i2c/busses/i2c-cgbc.c +++ b/drivers/i2c/busses/i2c-cgbc.c @@ -365,7 +365,7 @@ static int cgbc_i2c_probe(struct platform_device *pdev) struct cgbc_i2c_data *i2c; int ret; - i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c index 606ac071cb80..0f1701b61efa 100644 --- a/drivers/i2c/busses/i2c-cht-wc.c +++ b/drivers/i2c/busses/i2c-cht-wc.c @@ -434,7 +434,7 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev) if (irq < 0) return irq; - adap = devm_kzalloc(&pdev->dev, sizeof(*adap), GFP_KERNEL); + adap = devm_kzalloc_obj(&pdev->dev, *adap); if (!adap) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-cp2615.c b/drivers/i2c/busses/i2c-cp2615.c index 951de6249834..5032198aee05 100644 --- a/drivers/i2c/busses/i2c-cp2615.c +++ b/drivers/i2c/busses/i2c-cp2615.c @@ -293,7 +293,7 @@ cp2615_i2c_probe(struct usb_interface *usbif, const struct usb_device_id *id) if (ret) return ret; - adap = devm_kzalloc(&usbif->dev, sizeof(struct i2c_adapter), GFP_KERNEL); + adap = devm_kzalloc_obj(&usbif->dev, struct i2c_adapter); if (!adap) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-cros-ec-tunnel.c b/drivers/i2c/busses/i2c-cros-ec-tunnel.c index a83e735d2086..3ba4bde51b1f 100644 --- a/drivers/i2c/busses/i2c-cros-ec-tunnel.c +++ b/drivers/i2c/busses/i2c-cros-ec-tunnel.c @@ -255,7 +255,7 @@ static int ec_i2c_probe(struct platform_device *pdev) return -EINVAL; } - bus = devm_kzalloc(dev, sizeof(*bus), GFP_KERNEL); + bus = devm_kzalloc_obj(dev, *bus); if (bus == NULL) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index e15eef163a8f..34f5f99dfd62 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -746,7 +746,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) if (irq < 0) return irq; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-designware-amdisp.c b/drivers/i2c/busses/i2c-designware-amdisp.c index 9f0ec0fae6f2..04137def8b24 100644 --- a/drivers/i2c/busses/i2c-designware-amdisp.c +++ b/drivers/i2c/busses/i2c-designware-amdisp.c @@ -32,7 +32,7 @@ static int amd_isp_dw_i2c_plat_probe(struct platform_device *pdev) struct i2c_adapter *adap; int ret; - isp_i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*isp_i2c_dev), GFP_KERNEL); + isp_i2c_dev = devm_kzalloc_obj(&pdev->dev, *isp_i2c_dev); if (!isp_i2c_dev) return -ENOMEM; isp_i2c_dev->dev = &pdev->dev; diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 468287922363..ce9b5afad95d 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -230,7 +230,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, if (r) return dev_err_probe(device, r, "I/O memory remapping failed\n"); - dev = devm_kzalloc(device, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(device, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 1da6b0314b6a..13dd7c50486a 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -144,7 +144,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) else if (irq < 0) return irq; - dev = devm_kzalloc(device, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(device, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-digicolor.c b/drivers/i2c/busses/i2c-digicolor.c index 38d7f31aee79..896a9bb447f6 100644 --- a/drivers/i2c/busses/i2c-digicolor.c +++ b/drivers/i2c/busses/i2c-digicolor.c @@ -291,7 +291,7 @@ static int dc_i2c_probe(struct platform_device *pdev) struct dc_i2c *i2c; int ret = 0, irq; - i2c = devm_kzalloc(&pdev->dev, sizeof(struct dc_i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, struct dc_i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-dln2.c b/drivers/i2c/busses/i2c-dln2.c index bde2ef098862..8ee1834aa619 100644 --- a/drivers/i2c/busses/i2c-dln2.c +++ b/drivers/i2c/busses/i2c-dln2.c @@ -191,7 +191,7 @@ static int dln2_i2c_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct dln2_platform_data *pdata = dev_get_platdata(&pdev->dev); - dln2 = devm_kzalloc(dev, sizeof(*dln2), GFP_KERNEL); + dln2 = devm_kzalloc_obj(dev, *dln2); if (!dln2) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-emev2.c b/drivers/i2c/busses/i2c-emev2.c index ece019b3d066..7ad209eee565 100644 --- a/drivers/i2c/busses/i2c-emev2.c +++ b/drivers/i2c/busses/i2c-emev2.c @@ -363,7 +363,7 @@ static int em_i2c_probe(struct platform_device *pdev) struct clk *sclk; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c index 9c1c5f3c09f6..9686a7b5cb6d 100644 --- a/drivers/i2c/busses/i2c-exynos5.c +++ b/drivers/i2c/busses/i2c-exynos5.c @@ -890,7 +890,7 @@ static int exynos5_i2c_probe(struct platform_device *pdev) struct exynos5_i2c *i2c; int ret; - i2c = devm_kzalloc(&pdev->dev, sizeof(struct exynos5_i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, struct exynos5_i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c index b2dc5ae1d0e4..405062a4c718 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -683,7 +683,7 @@ static int fsi_i2c_probe(struct fsi_device *fsi_dev) u32 port_no, ports, stat; int rc; - i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c index 56d6847cbf6d..9eb8865fc1d5 100644 --- a/drivers/i2c/busses/i2c-gpio.c +++ b/drivers/i2c/busses/i2c-gpio.c @@ -528,7 +528,7 @@ static int i2c_gpio_probe(struct platform_device *pdev) enum gpiod_flags gflags; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-gxp.c b/drivers/i2c/busses/i2c-gxp.c index 6a5cef7e4383..19daabdb7850 100644 --- a/drivers/i2c/busses/i2c-gxp.c +++ b/drivers/i2c/busses/i2c-gxp.c @@ -522,8 +522,7 @@ static int gxp_i2c_probe(struct platform_device *pdev) regmap_update_bits(i2cg_map, GXP_I2CINTEN, 0x00000FFF, 0); } - drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), - GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-hisi.c b/drivers/i2c/busses/i2c-hisi.c index fca1ca011312..1ad79a38b2ac 100644 --- a/drivers/i2c/busses/i2c-hisi.c +++ b/drivers/i2c/busses/i2c-hisi.c @@ -463,7 +463,7 @@ static int hisi_i2c_probe(struct platform_device *pdev) u32 hw_version; int ret; - ctlr = devm_kzalloc(dev, sizeof(*ctlr), GFP_KERNEL); + ctlr = devm_kzalloc_obj(dev, *ctlr); if (!ctlr) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c index 95ab910b80c0..27284185a2de 100644 --- a/drivers/i2c/busses/i2c-hix5hd2.c +++ b/drivers/i2c/busses/i2c-hix5hd2.c @@ -394,7 +394,7 @@ static int hix5hd2_i2c_probe(struct platform_device *pdev) unsigned int freq; int irq, ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 810f61e39cad..9d3cc705de4c 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1333,9 +1333,7 @@ static void i801_add_mux(struct i801_priv *priv) gpio_data.idle = I2C_MUX_GPIO_NO_IDLE; /* Register GPIO descriptor lookup table */ - lookup = devm_kzalloc(dev, - struct_size(lookup, table, mux_config->n_gpios + 1), - GFP_KERNEL); + lookup = devm_kzalloc_flex(dev, *lookup, table, mux_config->n_gpios + 1); if (!lookup) return; lookup->dev_id = "i2c-mux-gpio"; @@ -1547,7 +1545,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) int err, i, bar = SMBBAR; struct i801_priv *priv; - priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&dev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-icy.c b/drivers/i2c/busses/i2c-icy.c index 55496e48ccd1..4eb569b1c019 100644 --- a/drivers/i2c/busses/i2c-icy.c +++ b/drivers/i2c/busses/i2c-icy.c @@ -128,11 +128,11 @@ static int icy_probe(struct zorro_dev *z, .swnode = &icy_ltc2990_node, }; - i2c = devm_kzalloc(&z->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&z->dev, *i2c); if (!i2c) return -ENOMEM; - algo_data = devm_kzalloc(&z->dev, sizeof(*algo_data), GFP_KERNEL); + algo_data = devm_kzalloc_obj(&z->dev, *algo_data); if (!algo_data) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c index 88192c25c44c..9d2ee449a40b 100644 --- a/drivers/i2c/busses/i2c-img-scb.c +++ b/drivers/i2c/busses/i2c-img-scb.c @@ -1327,7 +1327,7 @@ static int img_i2c_probe(struct platform_device *pdev) int irq, ret; u32 val; - i2c = devm_kzalloc(&pdev->dev, sizeof(struct img_i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, struct img_i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 1d8e99893fa0..22df20e2d467 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -1406,7 +1406,7 @@ static int lpi2c_dma_init(struct device *dev, dma_addr_t phy_addr) if (!group) return -ENOMEM; - dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL); + dma = devm_kzalloc_obj(dev, *dma); if (!dma) { ret = -ENOMEM; goto release_group; @@ -1483,7 +1483,7 @@ static int lpi2c_imx_probe(struct platform_device *pdev) unsigned int temp; int ret; - lpi2c_imx = devm_kzalloc(&pdev->dev, sizeof(*lpi2c_imx), GFP_KERNEL); + lpi2c_imx = devm_kzalloc_obj(&pdev->dev, *lpi2c_imx); if (!lpi2c_imx) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index ccf08cd63151..89f2b764bbc4 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -405,7 +405,7 @@ static int i2c_imx_dma_request(struct imx_i2c_struct *i2c_imx, dma_addr_t phy_ad struct device *dev = i2c_imx->adapter.dev.parent; int ret; - dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL); + dma = devm_kzalloc_obj(dev, *dma); if (!dma) return -ENOMEM; @@ -1837,7 +1837,7 @@ static int i2c_imx_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(base), "can't get IO memory\n"); phy_addr = (dma_addr_t)res->start; - i2c_imx = devm_kzalloc(&pdev->dev, sizeof(*i2c_imx), GFP_KERNEL); + i2c_imx = devm_kzalloc_obj(&pdev->dev, *i2c_imx); if (!i2c_imx) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c index a2ac992f9cb0..820c2577f5f5 100644 --- a/drivers/i2c/busses/i2c-isch.c +++ b/drivers/i2c/busses/i2c-isch.c @@ -277,7 +277,7 @@ static int smbus_sch_probe(struct platform_device *pdev) struct sch_i2c *priv; struct resource *res; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c index 7aaefb21416a..463f22c73a6f 100644 --- a/drivers/i2c/busses/i2c-ismt.c +++ b/drivers/i2c/busses/i2c-ismt.c @@ -886,7 +886,7 @@ ismt_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct ismt_priv *priv; unsigned long start, len; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c index 695be3b21460..f771c6025b4b 100644 --- a/drivers/i2c/busses/i2c-jz4780.c +++ b/drivers/i2c/busses/i2c-jz4780.c @@ -766,7 +766,7 @@ static int jz4780_i2c_probe(struct platform_device *pdev) unsigned short tmp; struct jz4780_i2c *i2c; - i2c = devm_kzalloc(&pdev->dev, sizeof(struct jz4780_i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, struct jz4780_i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-k1.c b/drivers/i2c/busses/i2c-k1.c index 4e1d67541132..ff32876e24d3 100644 --- a/drivers/i2c/busses/i2c-k1.c +++ b/drivers/i2c/busses/i2c-k1.c @@ -826,7 +826,7 @@ static int spacemit_i2c_probe(struct platform_device *pdev) struct reset_control *rst; int ret; - i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-keba.c b/drivers/i2c/busses/i2c-keba.c index 9420c8b342b5..ee9e69d6c2f0 100644 --- a/drivers/i2c/busses/i2c-keba.c +++ b/drivers/i2c/busses/i2c-keba.c @@ -512,12 +512,12 @@ static int ki2c_probe(struct auxiliary_device *auxdev, struct ki2c *ki2c; int ret; - ki2c = devm_kzalloc(dev, sizeof(*ki2c), GFP_KERNEL); + ki2c = devm_kzalloc_obj(dev, *ki2c); if (!ki2c) return -ENOMEM; ki2c->auxdev = container_of(auxdev, struct keba_i2c_auxdev, auxdev); - ki2c->client = devm_kcalloc(dev, ki2c->auxdev->info_size, - sizeof(*ki2c->client), GFP_KERNEL); + ki2c->client = devm_kzalloc_objs(dev, *ki2c->client, + ki2c->auxdev->info_size); if (!ki2c->client) return -ENOMEM; ki2c->client_size = ki2c->auxdev->info_size; diff --git a/drivers/i2c/busses/i2c-kempld.c b/drivers/i2c/busses/i2c-kempld.c index d0438960c272..a222f91b221b 100644 --- a/drivers/i2c/busses/i2c-kempld.c +++ b/drivers/i2c/busses/i2c-kempld.c @@ -295,7 +295,7 @@ static int kempld_i2c_probe(struct platform_device *pdev) int ret; u8 ctrl; - i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-ljca.c b/drivers/i2c/busses/i2c-ljca.c index da3370968c8e..7fc948b92b29 100644 --- a/drivers/i2c/busses/i2c-ljca.c +++ b/drivers/i2c/busses/i2c-ljca.c @@ -277,7 +277,7 @@ static int ljca_i2c_probe(struct auxiliary_device *auxdev, struct ljca_i2c_dev *ljca_i2c; int ret; - ljca_i2c = devm_kzalloc(&auxdev->dev, sizeof(*ljca_i2c), GFP_KERNEL); + ljca_i2c = devm_kzalloc_obj(&auxdev->dev, *ljca_i2c); if (!ljca_i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c index ccd13c4fb83e..cb0c899a18a8 100644 --- a/drivers/i2c/busses/i2c-lpc2k.c +++ b/drivers/i2c/busses/i2c-lpc2k.c @@ -350,7 +350,7 @@ static int i2c_lpc2k_probe(struct platform_device *pdev) u32 clkrate; int ret; - i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-ls2x-v2.c b/drivers/i2c/busses/i2c-ls2x-v2.c index 9df73557ecc4..f99af3fb8a96 100644 --- a/drivers/i2c/busses/i2c-ls2x-v2.c +++ b/drivers/i2c/busses/i2c-ls2x-v2.c @@ -480,7 +480,7 @@ static int loongson2_i2c_probe(struct platform_device *pdev) void __iomem *base; int irq, ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-ls2x.c b/drivers/i2c/busses/i2c-ls2x.c index ef2e2a26981e..616d007e876e 100644 --- a/drivers/i2c/busses/i2c-ls2x.c +++ b/drivers/i2c/busses/i2c-ls2x.c @@ -291,7 +291,7 @@ static int ls2x_i2c_probe(struct platform_device *pdev) struct ls2x_i2c_priv *priv; struct device *dev = &pdev->dev; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-mchp-pci1xxxx.c b/drivers/i2c/busses/i2c-mchp-pci1xxxx.c index bc0f1a0c8ee1..806c6c593f6d 100644 --- a/drivers/i2c/busses/i2c-mchp-pci1xxxx.c +++ b/drivers/i2c/busses/i2c-mchp-pci1xxxx.c @@ -1133,7 +1133,7 @@ static int pci1xxxx_i2c_probe_pci(struct pci_dev *pdev, struct pci1xxxx_i2c *i2c; int ret; - i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c index 0d9032953e48..9e03953df5d7 100644 --- a/drivers/i2c/busses/i2c-meson.c +++ b/drivers/i2c/busses/i2c-meson.c @@ -460,7 +460,7 @@ static int meson_i2c_probe(struct platform_device *pdev) struct i2c_timings timings; int irq, ret = 0; - i2c = devm_kzalloc(&pdev->dev, sizeof(struct meson_i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, struct meson_i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-microchip-corei2c.c b/drivers/i2c/busses/i2c-microchip-corei2c.c index 5a429f17359f..e5fa28f20228 100644 --- a/drivers/i2c/busses/i2c-microchip-corei2c.c +++ b/drivers/i2c/busses/i2c-microchip-corei2c.c @@ -541,7 +541,7 @@ static int mchp_corei2c_probe(struct platform_device *pdev) struct resource *res; int irq, ret; - idev = devm_kzalloc(&pdev->dev, sizeof(*idev), GFP_KERNEL); + idev = devm_kzalloc_obj(&pdev->dev, *idev); if (!idev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c index 0cc8b9e5f333..432d9588f32d 100644 --- a/drivers/i2c/busses/i2c-mlxbf.c +++ b/drivers/i2c/busses/i2c-mlxbf.c @@ -1044,8 +1044,7 @@ static int mlxbf_i2c_init_resource(struct platform_device *pdev, if (!res || *res || type >= MLXBF_I2C_END_RES) return -EINVAL; - tmp_res = devm_kzalloc(dev, sizeof(struct mlxbf_i2c_resource), - GFP_KERNEL); + tmp_res = devm_kzalloc_obj(dev, struct mlxbf_i2c_resource); if (!tmp_res) return -ENOMEM; @@ -2240,7 +2239,7 @@ static int mlxbf_i2c_probe(struct platform_device *pdev) u32 resource_version; int irq, ret; - priv = devm_kzalloc(dev, sizeof(struct mlxbf_i2c_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct mlxbf_i2c_priv); if (!priv) return -ENOMEM; @@ -2259,15 +2258,15 @@ static int mlxbf_i2c_probe(struct platform_device *pdev) priv->resource_version = resource_version; if (priv->chip->type < MLXBF_I2C_CHIP_TYPE_3 && resource_version == 0) { - priv->timer = devm_kzalloc(dev, sizeof(struct mlxbf_i2c_resource), GFP_KERNEL); + priv->timer = devm_kzalloc_obj(dev, struct mlxbf_i2c_resource); if (!priv->timer) return -ENOMEM; - priv->mst = devm_kzalloc(dev, sizeof(struct mlxbf_i2c_resource), GFP_KERNEL); + priv->mst = devm_kzalloc_obj(dev, struct mlxbf_i2c_resource); if (!priv->mst) return -ENOMEM; - priv->slv = devm_kzalloc(dev, sizeof(struct mlxbf_i2c_resource), GFP_KERNEL); + priv->slv = devm_kzalloc_obj(dev, struct mlxbf_i2c_resource); if (!priv->slv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-mlxcpld.c b/drivers/i2c/busses/i2c-mlxcpld.c index 07d3cadbf510..237bed92ff22 100644 --- a/drivers/i2c/busses/i2c-mlxcpld.c +++ b/drivers/i2c/busses/i2c-mlxcpld.c @@ -529,7 +529,7 @@ static int mlxcpld_i2c_probe(struct platform_device *pdev) int err; u8 val; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index a21fa45bd64c..24628102d225 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c @@ -779,7 +779,7 @@ static int fsl_i2c_probe(struct platform_device *op) int result; u32 clock; - i2c = devm_kzalloc(&op->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&op->dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c index 307925fb78e3..45d0d7156d6e 100644 --- a/drivers/i2c/busses/i2c-mt65xx.c +++ b/drivers/i2c/busses/i2c-mt65xx.c @@ -1388,7 +1388,7 @@ static int mtk_i2c_probe(struct platform_device *pdev) struct mtk_i2c *i2c; int i, irq, speed_clk; - i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-mt7621.c b/drivers/i2c/busses/i2c-mt7621.c index 9ea5e3f9a763..826abb9252e3 100644 --- a/drivers/i2c/busses/i2c-mt7621.c +++ b/drivers/i2c/busses/i2c-mt7621.c @@ -274,7 +274,7 @@ static int mtk_i2c_probe(struct platform_device *pdev) struct i2c_adapter *adap; int ret; - i2c = devm_kzalloc(&pdev->dev, sizeof(struct mtk_i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, struct mtk_i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 1acba628e16c..06780dc1f1a4 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -983,8 +983,7 @@ mv64xxx_i2c_probe(struct platform_device *pd) if ((!pdata && !pd->dev.of_node)) return -ENODEV; - drv_data = devm_kzalloc(&pd->dev, sizeof(struct mv64xxx_i2c_data), - GFP_KERNEL); + drv_data = devm_kzalloc_obj(&pd->dev, struct mv64xxx_i2c_data); if (!drv_data) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index eee4fdcd9df3..0e634c23919b 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c @@ -810,7 +810,7 @@ static int mxs_i2c_probe(struct platform_device *pdev) struct i2c_adapter *adap; int err, irq; - i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-nct6694.c b/drivers/i2c/busses/i2c-nct6694.c index 1413ab6f9462..158a533dfba7 100644 --- a/drivers/i2c/busses/i2c-nct6694.c +++ b/drivers/i2c/busses/i2c-nct6694.c @@ -149,7 +149,7 @@ static int nct6694_i2c_probe(struct platform_device *pdev) struct nct6694_i2c_data *data; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index c3878670da9c..2bed98e1b3ef 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -1099,7 +1099,7 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) if (match) match_flags = (unsigned long)match->data; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c index f667a873b81e..8e75795aa3fe 100644 --- a/drivers/i2c/busses/i2c-npcm7xx.c +++ b/drivers/i2c/busses/i2c-npcm7xx.c @@ -2500,7 +2500,7 @@ static int npcm_i2c_probe_bus(struct platform_device *pdev) int irq; int ret; - bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); + bus = devm_kzalloc_obj(&pdev->dev, *bus); if (!bus) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-nt72676.c b/drivers/i2c/busses/i2c-nt72676.c index 1308d692fc40..bf5dc71552f0 100644 --- a/drivers/i2c/busses/i2c-nt72676.c +++ b/drivers/i2c/busses/i2c-nt72676.c @@ -627,7 +627,7 @@ static int nvt_i2c_probe(struct platform_device *pdev) struct nvt_i2c_bus *i2c; int ret; - i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c index 14c059b03945..1f74a39c2f1f 100644 --- a/drivers/i2c/busses/i2c-nvidia-gpu.c +++ b/drivers/i2c/busses/i2c-nvidia-gpu.c @@ -275,7 +275,7 @@ static int gpu_i2c_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct gpu_i2c_dev *i2cd; int status; - i2cd = devm_kzalloc(dev, sizeof(*i2cd), GFP_KERNEL); + i2cd = devm_kzalloc_obj(dev, *i2cd); if (!i2cd) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c index 2d18c1035837..2c87a77f4d58 100644 --- a/drivers/i2c/busses/i2c-ocores.c +++ b/drivers/i2c/busses/i2c-ocores.c @@ -586,7 +586,7 @@ static int ocores_i2c_probe(struct platform_device *pdev) int ret; int i; - i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-octeon-platdrv.c b/drivers/i2c/busses/i2c-octeon-platdrv.c index edfca7b20f29..6c9e108cefc3 100644 --- a/drivers/i2c/busses/i2c-octeon-platdrv.c +++ b/drivers/i2c/busses/i2c-octeon-platdrv.c @@ -155,7 +155,7 @@ static int octeon_i2c_probe(struct platform_device *pdev) return irq; } - i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, *i2c); if (!i2c) { result = -ENOMEM; goto out; diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index f02d294db42a..4dd111f77ea0 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -1355,7 +1355,7 @@ omap_i2c_probe(struct platform_device *pdev) if (irq < 0) return irq; - omap = devm_kzalloc(&pdev->dev, sizeof(struct omap_i2c_dev), GFP_KERNEL); + omap = devm_kzalloc_obj(&pdev->dev, struct omap_i2c_dev); if (!omap) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-opal.c b/drivers/i2c/busses/i2c-opal.c index c9b62892397a..8db3596f0bec 100644 --- a/drivers/i2c/busses/i2c-opal.c +++ b/drivers/i2c/busses/i2c-opal.c @@ -209,7 +209,7 @@ static int i2c_opal_probe(struct platform_device *pdev) return -EIO; } - adapter = devm_kzalloc(&pdev->dev, sizeof(*adapter), GFP_KERNEL); + adapter = devm_kzalloc_obj(&pdev->dev, *adapter); if (!adapter) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-owl.c b/drivers/i2c/busses/i2c-owl.c index 84a195e35886..1937a2467512 100644 --- a/drivers/i2c/busses/i2c-owl.c +++ b/drivers/i2c/busses/i2c-owl.c @@ -439,7 +439,7 @@ static int owl_i2c_probe(struct platform_device *pdev) struct owl_i2c_dev *i2c_dev; int ret, irq; - i2c_dev = devm_kzalloc(dev, sizeof(*i2c_dev), GFP_KERNEL); + i2c_dev = devm_kzalloc_obj(dev, *i2c_dev); if (!i2c_dev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-pasemi-pci.c b/drivers/i2c/busses/i2c-pasemi-pci.c index b9ccb54ec77e..4c3aa7e1c294 100644 --- a/drivers/i2c/busses/i2c-pasemi-pci.c +++ b/drivers/i2c/busses/i2c-pasemi-pci.c @@ -33,7 +33,7 @@ static int pasemi_smb_pci_probe(struct pci_dev *dev, if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO)) return -ENODEV; - smbus = devm_kzalloc(&dev->dev, sizeof(*smbus), GFP_KERNEL); + smbus = devm_kzalloc_obj(&dev->dev, *smbus); if (!smbus) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-pasemi-platform.c b/drivers/i2c/busses/i2c-pasemi-platform.c index a486a37d3863..579797dd4b3a 100644 --- a/drivers/i2c/busses/i2c-pasemi-platform.c +++ b/drivers/i2c/busses/i2c-pasemi-platform.c @@ -51,8 +51,7 @@ static int pasemi_platform_i2c_probe(struct platform_device *pdev) int error; int irq_num; - data = devm_kzalloc(dev, sizeof(struct pasemi_platform_i2c_data), - GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct pasemi_platform_i2c_data); if (!data) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c index c0f35ebbe37d..649d4b273d1e 100644 --- a/drivers/i2c/busses/i2c-pca-platform.c +++ b/drivers/i2c/busses/i2c-pca-platform.c @@ -142,7 +142,7 @@ static int i2c_pca_pf_probe(struct platform_device *pdev) if (irq < 0) irq = 0; - i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index e1cc2b2bd628..9df76f4b15b7 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c @@ -612,7 +612,7 @@ static int i2c_pnx_probe(struct platform_device *pdev) unsigned long freq; struct resource *res; - alg_data = devm_kzalloc(&pdev->dev, sizeof(*alg_data), GFP_KERNEL); + alg_data = devm_kzalloc_obj(&pdev->dev, *alg_data); if (!alg_data) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index c9927a389aaf..bbc5a6141b0b 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -1432,7 +1432,7 @@ static int i2c_pxa_probe(struct platform_device *dev) struct resource *res; int ret, irq; - i2c = devm_kzalloc(&dev->dev, sizeof(struct pxa_i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&dev->dev, struct pxa_i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c index 76a5dedf659f..476526b099c3 100644 --- a/drivers/i2c/busses/i2c-qcom-cci.c +++ b/drivers/i2c/busses/i2c-qcom-cci.c @@ -672,7 +672,7 @@ static int cci_probe(struct platform_device *pdev) int ret, i; u32 val; - cci = devm_kzalloc(dev, sizeof(*cci), GFP_KERNEL); + cci = devm_kzalloc_obj(dev, *cci); if (!cci) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index 50f4fc133085..ef48ab3e8b94 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -1183,7 +1183,7 @@ static int geni_i2c_probe(struct platform_device *pdev) int ret; struct device *dev = &pdev->dev; - gi2c = devm_kzalloc(dev, sizeof(*gi2c), GFP_KERNEL); + gi2c = devm_kzalloc_obj(dev, *gi2c); if (!gi2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index ce30634e1f40..731bce9f9a92 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -1705,7 +1705,7 @@ static int qup_i2c_probe(struct platform_device *pdev) int blocks; bool is_qup_v1; - qup = devm_kzalloc(&pdev->dev, sizeof(*qup), GFP_KERNEL); + qup = devm_kzalloc_obj(&pdev->dev, *qup); if (!qup) return -ENOMEM; @@ -1744,18 +1744,16 @@ static int qup_i2c_probe(struct platform_device *pdev) qup->max_xfer_sg_len = (MX_BLOCKS << 1); blocks = (MX_DMA_BLOCKS << 1) + 1; - qup->btx.sg = devm_kcalloc(&pdev->dev, - blocks, sizeof(*qup->btx.sg), - GFP_KERNEL); + qup->btx.sg = devm_kzalloc_objs(&pdev->dev, *qup->btx.sg, + blocks); if (!qup->btx.sg) { ret = -ENOMEM; goto fail_dma; } sg_init_table(qup->btx.sg, blocks); - qup->brx.sg = devm_kcalloc(&pdev->dev, - blocks, sizeof(*qup->brx.sg), - GFP_KERNEL); + qup->brx.sg = devm_kzalloc_objs(&pdev->dev, *qup->brx.sg, + blocks); if (!qup->brx.sg) { ret = -ENOMEM; goto fail_dma; diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 755064804cb2..fcb15be59cb5 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -1133,7 +1133,7 @@ static int rcar_i2c_probe(struct platform_device *pdev) /* Otherwise logic will break because some bytes must always use PIO */ BUILD_BUG_ON_MSG(RCAR_MIN_DMA_LEN < 3, "Invalid min DMA length"); - priv = devm_kzalloc(dev, sizeof(struct rcar_i2c_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct rcar_i2c_priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index 2fa48219b66b..26b9d608fa28 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -523,7 +523,7 @@ static int riic_i2c_probe(struct platform_device *pdev) struct i2c_adapter *adap; int i, ret; - riic = devm_kzalloc(dev, sizeof(*riic), GFP_KERNEL); + riic = devm_kzalloc_obj(dev, *riic); if (!riic) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index fcede9f6ed54..9ec3beced9f9 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c @@ -1244,7 +1244,7 @@ static int rk3x_i2c_probe(struct platform_device *pdev) int irq; unsigned long clk_rate; - i2c = devm_kzalloc(&pdev->dev, sizeof(struct rk3x_i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, struct rk3x_i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-robotfuzz-osif.c b/drivers/i2c/busses/i2c-robotfuzz-osif.c index 412fa8e37f69..60f68c3f9a23 100644 --- a/drivers/i2c/busses/i2c-robotfuzz-osif.c +++ b/drivers/i2c/busses/i2c-robotfuzz-osif.c @@ -137,7 +137,7 @@ static int osif_probe(struct usb_interface *interface, struct osif_priv *priv; u16 version; - priv = devm_kzalloc(&interface->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&interface->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-rtl9300.c b/drivers/i2c/busses/i2c-rtl9300.c index 3a8225b0666c..a9dd85a286d4 100644 --- a/drivers/i2c/busses/i2c-rtl9300.c +++ b/drivers/i2c/busses/i2c-rtl9300.c @@ -474,7 +474,7 @@ static int rtl9300_i2c_probe(struct platform_device *pdev) u32 clock_freq, scl_num, sda_num; int ret, i = 0; - i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-rzv2m.c b/drivers/i2c/busses/i2c-rzv2m.c index 206a99e722a3..905e87c0e14b 100644 --- a/drivers/i2c/busses/i2c-rzv2m.c +++ b/drivers/i2c/busses/i2c-rzv2m.c @@ -414,7 +414,7 @@ static int rzv2m_i2c_probe(struct platform_device *pdev) struct resource *res; int irq, ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 15e14a6fe6dc..35583d7f34a7 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -1020,11 +1020,11 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) } } - i2c = devm_kzalloc(&pdev->dev, sizeof(struct s3c24xx_i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, struct s3c24xx_i2c); if (!i2c) return -ENOMEM; - i2c->pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + i2c->pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!i2c->pdata) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index 3a55f803e4f1..1aefa1bb54ce 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c @@ -870,7 +870,7 @@ static int sh_mobile_i2c_probe(struct platform_device *dev) int ret; u32 bus_speed; - pd = devm_kzalloc(&dev->dev, sizeof(struct sh_mobile_i2c_data), GFP_KERNEL); + pd = devm_kzalloc_obj(&dev->dev, struct sh_mobile_i2c_data); if (!pd) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c index c42925f9a330..5d4367aa9667 100644 --- a/drivers/i2c/busses/i2c-sprd.c +++ b/drivers/i2c/busses/i2c-sprd.c @@ -486,7 +486,7 @@ static int sprd_i2c_probe(struct platform_device *pdev) pdev->id = of_alias_get_id(dev->of_node, "i2c"); - i2c_dev = devm_kzalloc(dev, sizeof(struct sprd_i2c), GFP_KERNEL); + i2c_dev = devm_kzalloc_obj(dev, struct sprd_i2c); if (!i2c_dev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c index 0a2b43b5577b..9453e89c7041 100644 --- a/drivers/i2c/busses/i2c-st.c +++ b/drivers/i2c/busses/i2c-st.c @@ -797,7 +797,7 @@ static int st_i2c_probe(struct platform_device *pdev) struct i2c_adapter *adap; int ret; - i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL); + i2c_dev = devm_kzalloc_obj(&pdev->dev, *i2c_dev); if (!i2c_dev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-stm32.c b/drivers/i2c/busses/i2c-stm32.c index 064e47d6c96f..5160491f47f0 100644 --- a/drivers/i2c/busses/i2c-stm32.c +++ b/drivers/i2c/busses/i2c-stm32.c @@ -18,7 +18,7 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev, struct dma_slave_config dma_sconfig; int ret; - dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL); + dma = devm_kzalloc_obj(dev, *dma); if (!dma) return ERR_PTR(-ENOMEM); diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm32f4.c index 579ab29ef554..48c95e09e86e 100644 --- a/drivers/i2c/busses/i2c-stm32f4.c +++ b/drivers/i2c/busses/i2c-stm32f4.c @@ -759,7 +759,7 @@ static int stm32f4_i2c_probe(struct platform_device *pdev) struct reset_control *rst; int ret; - i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL); + i2c_dev = devm_kzalloc_obj(&pdev->dev, *i2c_dev); if (!i2c_dev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c index 6bd281a9ef72..2e1cc6a92b81 100644 --- a/drivers/i2c/busses/i2c-stm32f7.c +++ b/drivers/i2c/busses/i2c-stm32f7.c @@ -2096,7 +2096,7 @@ static int stm32f7_i2c_enable_smbus_alert(struct stm32f7_i2c_dev *i2c_dev) struct device *dev = i2c_dev->dev; void __iomem *base = i2c_dev->base; - alert = devm_kzalloc(dev, sizeof(*alert), GFP_KERNEL); + alert = devm_kzalloc_obj(dev, *alert); if (!alert) return -ENOMEM; @@ -2161,7 +2161,7 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) dma_addr_t phy_addr; int irq_error, irq_event, ret; - i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL); + i2c_dev = devm_kzalloc_obj(&pdev->dev, *i2c_dev); if (!i2c_dev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-sun6i-p2wi.c b/drivers/i2c/busses/i2c-sun6i-p2wi.c index 4f70b12a9559..cf150dc77267 100644 --- a/drivers/i2c/busses/i2c-sun6i-p2wi.c +++ b/drivers/i2c/busses/i2c-sun6i-p2wi.c @@ -205,7 +205,7 @@ static int p2wi_probe(struct platform_device *pdev) if (of_get_child_count(np) > 1) return dev_err_probe(dev, -EINVAL, "P2WI only supports one target device\n"); - p2wi = devm_kzalloc(dev, sizeof(struct p2wi), GFP_KERNEL); + p2wi = devm_kzalloc_obj(dev, struct p2wi); if (!p2wi) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c index 968cbe32161e..b34dd9b5c793 100644 --- a/drivers/i2c/busses/i2c-synquacer.c +++ b/drivers/i2c/busses/i2c-synquacer.c @@ -539,7 +539,7 @@ static int synquacer_i2c_probe(struct platform_device *pdev) u32 bus_speed; int ret; - i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-tegra-bpmp.c b/drivers/i2c/busses/i2c-tegra-bpmp.c index bb0de6db6391..25dcde183b42 100644 --- a/drivers/i2c/busses/i2c-tegra-bpmp.c +++ b/drivers/i2c/busses/i2c-tegra-bpmp.c @@ -286,7 +286,7 @@ static int tegra_bpmp_i2c_probe(struct platform_device *pdev) u32 value; int err; - i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 76d21bc51c61..a81ff2c339f2 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -2271,7 +2271,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) struct resource *res; int err; - i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL); + i2c_dev = devm_kzalloc_obj(&pdev->dev, *i2c_dev); if (!i2c_dev) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-thunderx-pcidrv.c b/drivers/i2c/busses/i2c-thunderx-pcidrv.c index 3959f23fc440..d58c97caf6b6 100644 --- a/drivers/i2c/busses/i2c-thunderx-pcidrv.c +++ b/drivers/i2c/busses/i2c-thunderx-pcidrv.c @@ -160,7 +160,7 @@ static int thunder_i2c_probe_pci(struct pci_dev *pdev, struct octeon_i2c *i2c; int ret; - i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c index 7190802a493c..5885eab3355a 100644 --- a/drivers/i2c/busses/i2c-uniphier-f.c +++ b/drivers/i2c/busses/i2c-uniphier-f.c @@ -517,7 +517,7 @@ static int uniphier_fi2c_probe(struct platform_device *pdev) unsigned long clk_rate; int irq, ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c index ad7bbf5e2466..8c53957c40ef 100644 --- a/drivers/i2c/busses/i2c-uniphier.c +++ b/drivers/i2c/busses/i2c-uniphier.c @@ -312,7 +312,7 @@ static int uniphier_i2c_probe(struct platform_device *pdev) unsigned long clk_rate; int irq, ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-usbio.c b/drivers/i2c/busses/i2c-usbio.c index 66da1e90848a..12a4154860a4 100644 --- a/drivers/i2c/busses/i2c-usbio.c +++ b/drivers/i2c/busses/i2c-usbio.c @@ -237,7 +237,7 @@ static int usbio_i2c_probe(struct auxiliary_device *adev, if (!i2c_desc) return -EINVAL; - i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c index a1ab6ef6f071..ad2fc895bb8d 100644 --- a/drivers/i2c/busses/i2c-versatile.c +++ b/drivers/i2c/busses/i2c-versatile.c @@ -66,7 +66,7 @@ static int i2c_versatile_probe(struct platform_device *dev) struct i2c_versatile *i2c; int ret; - i2c = devm_kzalloc(&dev->dev, sizeof(struct i2c_versatile), GFP_KERNEL); + i2c = devm_kzalloc_obj(&dev->dev, struct i2c_versatile); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-viai2c-common.c b/drivers/i2c/busses/i2c-viai2c-common.c index 5a53ed95a59b..7ba99c3e0cfd 100644 --- a/drivers/i2c/busses/i2c-viai2c-common.c +++ b/drivers/i2c/busses/i2c-viai2c-common.c @@ -179,7 +179,7 @@ int viai2c_init(struct platform_device *pdev, struct viai2c **pi2c, int plat) { struct viai2c *i2c; - i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(&pdev->dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-viai2c-zhaoxin.c b/drivers/i2c/busses/i2c-viai2c-zhaoxin.c index 81f0bfdf919f..9ba37a8f1aa1 100644 --- a/drivers/i2c/busses/i2c-viai2c-zhaoxin.c +++ b/drivers/i2c/busses/i2c-viai2c-zhaoxin.c @@ -307,7 +307,7 @@ static int zxi2c_probe(struct platform_device *pdev) if (error) return error; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; i2c->pltfm_priv = priv; diff --git a/drivers/i2c/busses/i2c-viperboard.c b/drivers/i2c/busses/i2c-viperboard.c index f596efcc291c..018c23c52034 100644 --- a/drivers/i2c/busses/i2c-viperboard.c +++ b/drivers/i2c/busses/i2c-viperboard.c @@ -360,7 +360,7 @@ static int vprbrd_i2c_probe(struct platform_device *pdev) int ret; int pipe; - vb_i2c = devm_kzalloc(&pdev->dev, sizeof(*vb_i2c), GFP_KERNEL); + vb_i2c = devm_kzalloc_obj(&pdev->dev, *vb_i2c); if (vb_i2c == NULL) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-virtio.c b/drivers/i2c/busses/i2c-virtio.c index 5da6fef92bec..d6103dbca0c8 100644 --- a/drivers/i2c/busses/i2c-virtio.c +++ b/drivers/i2c/busses/i2c-virtio.c @@ -197,7 +197,7 @@ static int virtio_i2c_probe(struct virtio_device *vdev) return dev_err_probe(&vdev->dev, -EINVAL, "Zero-length request feature is mandatory\n"); - vi = devm_kzalloc(&vdev->dev, sizeof(*vi), GFP_KERNEL); + vi = devm_kzalloc_obj(&vdev->dev, *vi); if (!vi) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c index 08a126aa83df..a09d479f3b0d 100644 --- a/drivers/i2c/busses/i2c-xgene-slimpro.c +++ b/drivers/i2c/busses/i2c-xgene-slimpro.c @@ -440,7 +440,7 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev) struct mbox_client *cl; int rc; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index ba560462d451..ab7916745ad3 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -1463,7 +1463,7 @@ static int xiic_i2c_probe(struct platform_device *pdev) u8 i; u32 sr; - i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); + i2c = devm_kzalloc_obj(dev, *i2c); if (!i2c) return -ENOMEM; diff --git a/drivers/i2c/busses/i2c-xlp9xx.c b/drivers/i2c/busses/i2c-xlp9xx.c index 44cad95ee8ab..ce253a41752d 100644 --- a/drivers/i2c/busses/i2c-xlp9xx.c +++ b/drivers/i2c/busses/i2c-xlp9xx.c @@ -508,7 +508,7 @@ static int xlp9xx_i2c_probe(struct platform_device *pdev) struct xlp9xx_i2c_dev *priv; int err = 0; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/i2c/i2c-slave-testunit.c b/drivers/i2c/i2c-slave-testunit.c index 4a1bf1aa504b..5807149b5177 100644 --- a/drivers/i2c/i2c-slave-testunit.c +++ b/drivers/i2c/i2c-slave-testunit.c @@ -237,7 +237,7 @@ static int i2c_slave_testunit_probe(struct i2c_client *client) { struct testunit_data *tu; - tu = devm_kzalloc(&client->dev, sizeof(struct testunit_data), GFP_KERNEL); + tu = devm_kzalloc_obj(&client->dev, struct testunit_data); if (!tu) return -ENOMEM; diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c index 069f08f68bc1..188ced93c18b 100644 --- a/drivers/i2c/i2c-smbus.c +++ b/drivers/i2c/i2c-smbus.c @@ -172,8 +172,7 @@ static int smbalert_probe(struct i2c_client *ara) struct gpio_desc *gpiod; int res, irq; - alert = devm_kzalloc(&ara->dev, sizeof(struct i2c_smbus_alert), - GFP_KERNEL); + alert = devm_kzalloc_obj(&ara->dev, struct i2c_smbus_alert); if (!alert) return -ENOMEM; diff --git a/drivers/i2c/i2c-stub.c b/drivers/i2c/i2c-stub.c index 8590b3433777..b87b5fd5473e 100644 --- a/drivers/i2c/i2c-stub.c +++ b/drivers/i2c/i2c-stub.c @@ -99,7 +99,7 @@ static struct smbus_block_data *stub_find_block(struct device *dev, } } if (rb == NULL && create) { - rb = devm_kzalloc(dev, sizeof(*rb), GFP_KERNEL); + rb = devm_kzalloc_obj(dev, *rb); if (rb == NULL) return rb; rb->command = command; diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c index 2403c0bf7c43..c15f4c2d267b 100644 --- a/drivers/i2c/muxes/i2c-demux-pinctrl.c +++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c @@ -218,10 +218,9 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) return -EINVAL; } - priv = devm_kzalloc(&pdev->dev, struct_size(priv, chan, num_chan), - GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, chan, num_chan); - props = devm_kcalloc(&pdev->dev, num_chan, sizeof(*props), GFP_KERNEL); + props = devm_kzalloc_objs(&pdev->dev, *props, num_chan); if (!priv || !props) return -ENOMEM; diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c index 9b46b84e84fb..6c23d17722af 100644 --- a/drivers/i2c/muxes/i2c-mux-gpio.c +++ b/drivers/i2c/muxes/i2c-mux-gpio.c @@ -134,7 +134,7 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev) unsigned int initial_state; int i, ngpios, ret; - mux = devm_kzalloc(&pdev->dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(&pdev->dev, *mux); if (!mux) return -ENOMEM; diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-gpmux.c index ab8e11661052..182bff1eeb5d 100644 --- a/drivers/i2c/muxes/i2c-mux-gpmux.c +++ b/drivers/i2c/muxes/i2c-mux-gpmux.c @@ -80,7 +80,7 @@ static int i2c_mux_probe(struct platform_device *pdev) if (!np) return -ENODEV; - mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(dev, *mux); if (!mux) return -ENOMEM; diff --git a/drivers/i2c/muxes/i2c-mux-reg.c b/drivers/i2c/muxes/i2c-mux-reg.c index 13da757100fe..6c1cd4df77e8 100644 --- a/drivers/i2c/muxes/i2c-mux-reg.c +++ b/drivers/i2c/muxes/i2c-mux-reg.c @@ -152,7 +152,7 @@ static int i2c_mux_reg_probe(struct platform_device *pdev) struct resource *res; int i, ret, nr; - mux = devm_kzalloc(&pdev->dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(&pdev->dev, *mux); if (!mux) return -ENOMEM; diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 01e05bad8661..9928c5dffb5b 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -3123,7 +3123,7 @@ i3c_master_add_i2c_boardinfo(struct i3c_master_controller *master, struct device *dev = &master->dev; int ret; - boardinfo = devm_kzalloc(dev, sizeof(*boardinfo), GFP_KERNEL); + boardinfo = devm_kzalloc_obj(dev, *boardinfo); if (!boardinfo) return -ENOMEM; @@ -3169,7 +3169,7 @@ i3c_master_add_i3c_boardinfo(struct i3c_master_controller *master, enum i3c_addr_slot_status addrstatus; u32 init_dyn_addr = 0, static_addr_method = 0; - boardinfo = devm_kzalloc(dev, sizeof(*boardinfo), GFP_KERNEL); + boardinfo = devm_kzalloc_obj(dev, *boardinfo); if (!boardinfo) return -ENOMEM; diff --git a/drivers/i3c/master/adi-i3c-master.c b/drivers/i3c/master/adi-i3c-master.c index ad57b7500678..fbbf72d024de 100644 --- a/drivers/i3c/master/adi-i3c-master.c +++ b/drivers/i3c/master/adi-i3c-master.c @@ -942,7 +942,7 @@ static int adi_i3c_master_probe(struct platform_device *pdev) unsigned int version; int ret, irq; - master = devm_kzalloc(&pdev->dev, sizeof(*master), GFP_KERNEL); + master = devm_kzalloc_obj(&pdev->dev, *master); if (!master) return -ENOMEM; @@ -975,9 +975,8 @@ static int adi_i3c_master_probe(struct platform_device *pdev) master->free_rr_slots = GENMASK(ADI_MAX_DEVS, 1); spin_lock_init(&master->ibi.lock); master->ibi.num_slots = 15; - master->ibi.slots = devm_kcalloc(&pdev->dev, master->ibi.num_slots, - sizeof(*master->ibi.slots), - GFP_KERNEL); + master->ibi.slots = devm_kzalloc_objs(&pdev->dev, *master->ibi.slots, + master->ibi.num_slots); if (!master->ibi.slots) return -ENOMEM; diff --git a/drivers/i3c/master/amd-i3c-master.c b/drivers/i3c/master/amd-i3c-master.c index b62157729a5b..0c63e5f742de 100644 --- a/drivers/i3c/master/amd-i3c-master.c +++ b/drivers/i3c/master/amd-i3c-master.c @@ -1070,7 +1070,7 @@ static int xi3c_master_probe(struct platform_device *pdev) struct xi3c_master *master; int ret; - master = devm_kzalloc(&pdev->dev, sizeof(*master), GFP_KERNEL); + master = devm_kzalloc_obj(&pdev->dev, *master); if (!master) return -ENOMEM; diff --git a/drivers/i3c/master/ast2600-i3c-master.c b/drivers/i3c/master/ast2600-i3c-master.c index e05e83812c71..9d16c36749ec 100644 --- a/drivers/i3c/master/ast2600-i3c-master.c +++ b/drivers/i3c/master/ast2600-i3c-master.c @@ -129,7 +129,7 @@ static int ast2600_i3c_probe(struct platform_device *pdev) struct ast2600_i3c *i3c; int rc; - i3c = devm_kzalloc(&pdev->dev, sizeof(*i3c), GFP_KERNEL); + i3c = devm_kzalloc_obj(&pdev->dev, *i3c); if (!i3c) return -ENOMEM; diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c index d1119f203d1b..34aa8f8e1a0a 100644 --- a/drivers/i3c/master/dw-i3c-master.c +++ b/drivers/i3c/master/dw-i3c-master.c @@ -1802,7 +1802,7 @@ static int dw_i3c_probe(struct platform_device *pdev) { struct dw_i3c_master *master; - master = devm_kzalloc(&pdev->dev, sizeof(*master), GFP_KERNEL); + master = devm_kzalloc_obj(&pdev->dev, *master); if (!master) return -ENOMEM; diff --git a/drivers/i3c/master/i3c-master-cdns.c b/drivers/i3c/master/i3c-master-cdns.c index 2d98c1ce9b12..6477c8380bd8 100644 --- a/drivers/i3c/master/i3c-master-cdns.c +++ b/drivers/i3c/master/i3c-master-cdns.c @@ -1547,7 +1547,7 @@ static int cdns_i3c_master_probe(struct platform_device *pdev) int ret, irq; u32 val; - master = devm_kzalloc(&pdev->dev, sizeof(*master), GFP_KERNEL); + master = devm_kzalloc_obj(&pdev->dev, *master); if (!master) return -ENOMEM; @@ -1601,9 +1601,8 @@ static int cdns_i3c_master_probe(struct platform_device *pdev) spin_lock_init(&master->ibi.lock); master->ibi.num_slots = CONF_STATUS1_IBI_HW_RES(val); - master->ibi.slots = devm_kcalloc(&pdev->dev, master->ibi.num_slots, - sizeof(*master->ibi.slots), - GFP_KERNEL); + master->ibi.slots = devm_kzalloc_objs(&pdev->dev, *master->ibi.slots, + master->ibi.num_slots); if (!master->ibi.slots) return -ENOMEM; diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index 23853ca134fb..478bbe5d314e 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -171,7 +171,7 @@ static int i3c_hci_bus_init(struct i3c_master_controller *m) if (ret) return ret; - hci->ibi_devs = devm_kcalloc(dev, hci->DAT_entries, sizeof(*hci->ibi_devs), GFP_KERNEL); + hci->ibi_devs = devm_kzalloc_objs(dev, *hci->ibi_devs, hci->DAT_entries); if (!hci->ibi_devs) return -ENOMEM; @@ -1190,7 +1190,7 @@ static int i3c_hci_probe(struct platform_device *pdev) struct i3c_hci *hci; int irq, ret; - hci = devm_kzalloc(&pdev->dev, sizeof(*hci), GFP_KERNEL); + hci = devm_kzalloc_obj(&pdev->dev, *hci); if (!hci) return -ENOMEM; diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c index 5b8e10d05cee..78fa42b2dc94 100644 --- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c +++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c @@ -165,7 +165,7 @@ static void intel_reset(void __iomem *priv) static int intel_i3c_init(struct mipi_i3c_hci_pci *hci) { - struct intel_host *host = devm_kzalloc(&hci->pci->dev, sizeof(*host), GFP_KERNEL); + struct intel_host *host = devm_kzalloc_obj(&hci->pci->dev, *host); void __iomem *priv = hci->base + INTEL_PRIV_OFFSET; if (!host) @@ -426,7 +426,7 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci, struct mipi_i3c_hci_pci *hci; int ret; - hci = devm_kzalloc(&pci->dev, sizeof(*hci), GFP_KERNEL); + hci = devm_kzalloc_obj(&pci->dev, *hci); if (!hci) return -ENOMEM; diff --git a/drivers/i3c/master/mipi-i3c-hci/pio.c b/drivers/i3c/master/mipi-i3c-hci/pio.c index 439578a6eb54..bc1d63ffd959 100644 --- a/drivers/i3c/master/mipi-i3c-hci/pio.c +++ b/drivers/i3c/master/mipi-i3c-hci/pio.c @@ -239,7 +239,7 @@ static int hci_pio_init(struct i3c_hci *hci) u32 size_val; u32 cmd_sz, resp_sz, ibi_val; - pio = devm_kzalloc(hci->master.dev.parent, sizeof(*pio), GFP_KERNEL); + pio = devm_kzalloc_obj(hci->master.dev.parent, *pio); if (!pio) return -ENOMEM; diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/renesas-i3c.c index 28c0927a0179..5719b78f0503 100644 --- a/drivers/i3c/master/renesas-i3c.c +++ b/drivers/i3c/master/renesas-i3c.c @@ -1457,7 +1457,7 @@ static int renesas_i3c_probe(struct platform_device *pdev) struct renesas_i3c *i3c; int ret, i; - i3c = devm_kzalloc(&pdev->dev, sizeof(*i3c), GFP_KERNEL); + i3c = devm_kzalloc_obj(&pdev->dev, *i3c); if (!i3c) return -ENOMEM; diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index e700392f0801..2632ac6dc1c0 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -2003,7 +2003,7 @@ static int svc_i3c_master_probe(struct platform_device *pdev) struct svc_i3c_master *master; int ret, i; - master = devm_kzalloc(dev, sizeof(*master), GFP_KERNEL); + master = devm_kzalloc_obj(dev, *master); if (!master) return -ENOMEM; @@ -2055,9 +2055,8 @@ static int svc_i3c_master_probe(struct platform_device *pdev) spin_lock_init(&master->ibi.lock); master->ibi.num_slots = SVC_I3C_MAX_DEVS; - master->ibi.slots = devm_kcalloc(&pdev->dev, master->ibi.num_slots, - sizeof(*master->ibi.slots), - GFP_KERNEL); + master->ibi.slots = devm_kzalloc_objs(&pdev->dev, *master->ibi.slots, + master->ibi.num_slots); if (!master->ibi.slots) { ret = -ENOMEM; goto err_disable_clks; diff --git a/drivers/iio/accel/adxl367_i2c.c b/drivers/iio/accel/adxl367_i2c.c index 42e747f5d1a1..a1f135cb6ca1 100644 --- a/drivers/iio/accel/adxl367_i2c.c +++ b/drivers/iio/accel/adxl367_i2c.c @@ -45,7 +45,7 @@ static int adxl367_i2c_probe(struct i2c_client *client) struct adxl367_i2c_state *st; struct regmap *regmap; - st = devm_kzalloc(&client->dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(&client->dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/iio/accel/adxl367_spi.c b/drivers/iio/accel/adxl367_spi.c index 1d1418452bdc..72462b7f09cd 100644 --- a/drivers/iio/accel/adxl367_spi.c +++ b/drivers/iio/accel/adxl367_spi.c @@ -90,7 +90,7 @@ static int adxl367_spi_probe(struct spi_device *spi) struct adxl367_spi_state *st; struct regmap *regmap; - st = devm_kzalloc(&spi->dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(&spi->dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c index 8eaa1dd6a89b..3f8be5d526bc 100644 --- a/drivers/iio/adc/ab8500-gpadc.c +++ b/drivers/iio/adc/ab8500-gpadc.c @@ -1039,13 +1039,11 @@ static int ab8500_gpadc_parse_channels(struct ab8500_gpadc *gpadc, } dev_info(gpadc->dev, "found %d ADC channels\n", nchans); - iio_chans = devm_kcalloc(gpadc->dev, nchans, - sizeof(*iio_chans), GFP_KERNEL); + iio_chans = devm_kzalloc_objs(gpadc->dev, *iio_chans, nchans); if (!iio_chans) return -ENOMEM; - gpadc->chans = devm_kcalloc(gpadc->dev, nchans, - sizeof(*gpadc->chans), GFP_KERNEL); + gpadc->chans = devm_kzalloc_objs(gpadc->dev, *gpadc->chans, nchans); if (!gpadc->chans) return -ENOMEM; diff --git a/drivers/iio/adc/ad4062.c b/drivers/iio/adc/ad4062.c index 8e5984055b15..ce87cb88b456 100644 --- a/drivers/iio/adc/ad4062.c +++ b/drivers/iio/adc/ad4062.c @@ -1431,7 +1431,7 @@ static int ad4062_gpio_init(struct ad4062_state *st) if (!device_property_read_bool(dev, "gpio-controller")) return 0; - gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL); + gc = devm_kzalloc_obj(dev, *gc); if (!gc) return -ENOMEM; diff --git a/drivers/iio/adc/ad4851.c b/drivers/iio/adc/ad4851.c index 480d1798f17b..f5a9b99128ea 100644 --- a/drivers/iio/adc/ad4851.c +++ b/drivers/iio/adc/ad4851.c @@ -970,7 +970,7 @@ static int ad4851_parse_channels_common(struct iio_dev *indio_dev, return dev_err_probe(dev, -EINVAL, "Too many channels: %u\n", num_channels); - channels = devm_kcalloc(dev, num_channels, sizeof(*channels), GFP_KERNEL); + channels = devm_kzalloc_objs(dev, *channels, num_channels); if (!channels) return -ENOMEM; diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c index fc5dbc624856..c2c1662bd10d 100644 --- a/drivers/iio/adc/ad7124.c +++ b/drivers/iio/adc/ad7124.c @@ -1228,13 +1228,11 @@ static int ad7124_parse_channel_config(struct iio_dev *indio_dev, /* Add one for temperature */ st->num_channels = min(num_channels + 1, AD7124_MAX_CHANNELS); - chan = devm_kcalloc(dev, st->num_channels, - sizeof(*chan), GFP_KERNEL); + chan = devm_kzalloc_objs(dev, *chan, st->num_channels); if (!chan) return -ENOMEM; - channels = devm_kcalloc(dev, st->num_channels, sizeof(*channels), - GFP_KERNEL); + channels = devm_kzalloc_objs(dev, *channels, st->num_channels); if (!channels) return -ENOMEM; diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c index 24904be5090a..ece526def7a3 100644 --- a/drivers/iio/adc/ad7173.c +++ b/drivers/iio/adc/ad7173.c @@ -1201,8 +1201,8 @@ static int ad7173_setup(struct iio_dev *indio_dev) st->interface_mode = 0x0; st->config_usage_counter = 0; - st->config_cnts = devm_kcalloc(dev, st->info->num_configs, - sizeof(*st->config_cnts), GFP_KERNEL); + st->config_cnts = devm_kzalloc_objs(dev, *st->config_cnts, + st->info->num_configs); if (!st->config_cnts) return -ENOMEM; @@ -1801,12 +1801,11 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev) indio_dev->num_channels = num_channels; st->num_channels = num_channels; - chan_arr = devm_kcalloc(dev, sizeof(*chan_arr), st->num_channels, GFP_KERNEL); + chan_arr = devm_kzalloc_objs(dev, *chan_arr, st->num_channels); if (!chan_arr) return -ENOMEM; - chans_st_arr = devm_kcalloc(dev, st->num_channels, sizeof(*st->channels), - GFP_KERNEL); + chans_st_arr = devm_kzalloc_objs(dev, *st->channels, st->num_channels); if (!chans_st_arr) return -ENOMEM; diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c index 8bd810546311..5aa540c10b5f 100644 --- a/drivers/iio/adc/ad7192.c +++ b/drivers/iio/adc/ad7192.c @@ -1238,8 +1238,7 @@ static int ad7194_parse_channels(struct iio_dev *indio_dev) num_channels += AD7194_CH_BASE_NR; - ad7194_channels = devm_kcalloc(dev, num_channels, - sizeof(*ad7194_channels), GFP_KERNEL); + ad7194_channels = devm_kzalloc_objs(dev, *ad7194_channels, num_channels); if (!ad7194_channels) return -ENOMEM; diff --git a/drivers/iio/adc/ad7280a.c b/drivers/iio/adc/ad7280a.c index 5ae0d694d20c..bfba94a02363 100644 --- a/drivers/iio/adc/ad7280a.c +++ b/drivers/iio/adc/ad7280a.c @@ -670,8 +670,8 @@ static int ad7280_channel_init(struct ad7280_state *st, bool irq_present) { int dev, cnt = 0; - st->channels = devm_kcalloc(&st->spi->dev, (st->slave_num + 1) * 12 + 1, - sizeof(*st->channels), GFP_KERNEL); + st->channels = devm_kzalloc_objs(&st->spi->dev, *st->channels, + (st->slave_num + 1) * 12 + 1); if (!st->channels) return -ENOMEM; diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c index cebb8ed8dcb1..3132ed226bb4 100644 --- a/drivers/iio/adc/ad7606.c +++ b/drivers/iio/adc/ad7606.c @@ -1400,8 +1400,7 @@ static int ad7606_probe_channels(struct iio_dev *indio_dev) if (slow_bus) indio_dev->num_channels++; - channels = devm_kcalloc(dev, indio_dev->num_channels, sizeof(*channels), - GFP_KERNEL); + channels = devm_kzalloc_objs(dev, *channels, indio_dev->num_channels); if (!channels) return -ENOMEM; diff --git a/drivers/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c index 8c479fa50a23..9699e63df96f 100644 --- a/drivers/iio/adc/ad7606_spi.c +++ b/drivers/iio/adc/ad7606_spi.c @@ -284,7 +284,7 @@ static int ad7606_spi_offload_probe(struct device *dev, }; int ret; - bus_data = devm_kzalloc(dev, sizeof(*bus_data), GFP_KERNEL); + bus_data = devm_kzalloc_obj(dev, *bus_data); if (!bus_data) return -ENOMEM; st->bus_data = bus_data; diff --git a/drivers/iio/adc/ad7768.c b/drivers/iio/adc/ad7768.c index aa2db87a1b9f..d307609f6653 100644 --- a/drivers/iio/adc/ad7768.c +++ b/drivers/iio/adc/ad7768.c @@ -1424,7 +1424,7 @@ static int ad7768_parse_config(struct iio_dev *indio_dev, if (num_channels > st->chip_info->num_channels) return dev_err_probe(dev, -ENOSPC, "Invalid number of channels\n"); - chan = devm_kcalloc(dev, num_channels, sizeof(*chan), GFP_KERNEL); + chan = devm_kzalloc_objs(dev, *chan, num_channels); if (!chan) return -ENOMEM; diff --git a/drivers/iio/adc/ad7944.c b/drivers/iio/adc/ad7944.c index 12656d3cdcec..f3e7ee15f5f9 100644 --- a/drivers/iio/adc/ad7944.c +++ b/drivers/iio/adc/ad7944.c @@ -571,7 +571,7 @@ static int ad7944_chain_mode_alloc(struct device *dev, /* 1 channel for each device in chain plus 1 for soft timestamp */ - chan = devm_kcalloc(dev, n_chain_dev + 1, sizeof(*chan), GFP_KERNEL); + chan = devm_kzalloc_objs(dev, *chan, n_chain_dev + 1); if (!chan) return -ENOMEM; @@ -612,7 +612,7 @@ static int ad7944_chain_mode_alloc(struct device *dev, return dev_err_probe(dev, -EINVAL, "chain is limited to 32 devices\n"); - scan_masks = devm_kcalloc(dev, 2, sizeof(*scan_masks), GFP_KERNEL); + scan_masks = devm_kzalloc_objs(dev, *scan_masks, 2); if (!scan_masks) return -ENOMEM; diff --git a/drivers/iio/adc/ad9467.c b/drivers/iio/adc/ad9467.c index 34b7b1256f0d..587d2c64ec55 100644 --- a/drivers/iio/adc/ad9467.c +++ b/drivers/iio/adc/ad9467.c @@ -1037,8 +1037,8 @@ static int ad9467_scale_fill(struct ad9467_state *st) const struct ad9467_chip_info *info = st->info; unsigned int i, val1, val2; - st->scales = devm_kmalloc_array(&st->spi->dev, info->num_scales, - sizeof(*st->scales), GFP_KERNEL); + st->scales = devm_kmalloc_objs(&st->spi->dev, *st->scales, + info->num_scales); if (!st->scales) return -ENOMEM; @@ -1285,8 +1285,8 @@ static void ad9467_debugfs_init(struct iio_dev *indio_dev) if (!IS_ENABLED(CONFIG_DEBUG_FS)) return; - st->chan_test = devm_kcalloc(&st->spi->dev, st->info->num_channels, - sizeof(*st->chan_test), GFP_KERNEL); + st->chan_test = devm_kzalloc_objs(&st->spi->dev, *st->chan_test, + st->info->num_channels); if (!st->chan_test) return; diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c index 119ddc5a13e2..32a1e0f5a694 100644 --- a/drivers/iio/adc/ad_sigma_delta.c +++ b/drivers/iio/adc/ad_sigma_delta.c @@ -822,8 +822,8 @@ int devm_ad_sd_setup_buffer_and_trigger(struct device *dev, struct iio_dev *indi struct ad_sigma_delta *sigma_delta = iio_device_get_drvdata(indio_dev); int ret; - sigma_delta->slots = devm_kcalloc(dev, sigma_delta->num_slots, - sizeof(*sigma_delta->slots), GFP_KERNEL); + sigma_delta->slots = devm_kzalloc_objs(dev, *sigma_delta->slots, + sigma_delta->num_slots); if (!sigma_delta->slots) return -ENOMEM; diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c index 8b7c45d51dbe..4b77b7169d95 100644 --- a/drivers/iio/adc/adi-axi-adc.c +++ b/drivers/iio/adc/adi-axi-adc.c @@ -731,7 +731,7 @@ static int adi_axi_adc_probe(struct platform_device *pdev) struct clk *clk; int ret; - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 0ac74ad92fca..433f81cbf4bc 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c @@ -633,9 +633,8 @@ static int at91_adc_trigger_init(struct iio_dev *idev) struct at91_adc_state *st = iio_priv(idev); int i, ret; - st->trig = devm_kcalloc(&idev->dev, - st->caps->trigger_number, sizeof(*st->trig), - GFP_KERNEL); + st->trig = devm_kzalloc_objs(&idev->dev, *st->trig, + st->caps->trigger_number); if (st->trig == NULL) { ret = -ENOMEM; diff --git a/drivers/iio/adc/cc10001_adc.c b/drivers/iio/adc/cc10001_adc.c index d42b747325aa..5348ca44b3e0 100644 --- a/drivers/iio/adc/cc10001_adc.c +++ b/drivers/iio/adc/cc10001_adc.c @@ -268,9 +268,8 @@ static int cc10001_adc_channel_init(struct iio_dev *indio_dev, indio_dev->num_channels = bitmap_weight(&channel_map, CC10001_ADC_NUM_CHANNELS) + 1; - chan_array = devm_kcalloc(&indio_dev->dev, indio_dev->num_channels, - sizeof(struct iio_chan_spec), - GFP_KERNEL); + chan_array = devm_kzalloc_objs(&indio_dev->dev, struct iio_chan_spec, + indio_dev->num_channels); if (!chan_array) return -ENOMEM; diff --git a/drivers/iio/adc/industrialio-adc.c b/drivers/iio/adc/industrialio-adc.c index b4057230e749..4a141affc8bf 100644 --- a/drivers/iio/adc/industrialio-adc.c +++ b/drivers/iio/adc/industrialio-adc.c @@ -49,8 +49,7 @@ int devm_iio_adc_device_alloc_chaninfo_se(struct device *dev, if (!num_chan) return -ENOENT; - chan_array = devm_kcalloc(dev, num_chan, sizeof(*chan_array), - GFP_KERNEL); + chan_array = devm_kzalloc_objs(dev, *chan_array, num_chan); if (!chan_array) return -ENOMEM; diff --git a/drivers/iio/adc/max11410.c b/drivers/iio/adc/max11410.c index 23ae684cf08b..cbef7978c93e 100644 --- a/drivers/iio/adc/max11410.c +++ b/drivers/iio/adc/max11410.c @@ -710,12 +710,11 @@ static int max11410_parse_channels(struct max11410_state *st, /* Reserve space for soft timestamp channel */ num_ch++; - channels = devm_kcalloc(dev, num_ch, sizeof(*channels), GFP_KERNEL); + channels = devm_kzalloc_objs(dev, *channels, num_ch); if (!channels) return -ENOMEM; - st->channels = devm_kcalloc(dev, num_ch, sizeof(*st->channels), - GFP_KERNEL); + st->channels = devm_kzalloc_objs(dev, *st->channels, num_ch); if (!st->channels) return -ENOMEM; @@ -779,9 +778,9 @@ static int max11410_parse_channels(struct max11410_state *st, if (sig_path == MAX11410_PGA_SIG_PATH_PGA) { __set_bit(IIO_CHAN_INFO_SCALE, &chanspec.info_mask_separate_available); - cfg->scale_avail = devm_kcalloc(dev, MAX11410_SCALE_AVAIL_SIZE * 2, - sizeof(*cfg->scale_avail), - GFP_KERNEL); + cfg->scale_avail = devm_kzalloc_objs(dev, + *cfg->scale_avail, + MAX11410_SCALE_AVAIL_SIZE * 2); if (!cfg->scale_avail) return -ENOMEM; diff --git a/drivers/iio/adc/mcp3564.c b/drivers/iio/adc/mcp3564.c index 259ac4ebdedf..6d60952dd33f 100644 --- a/drivers/iio/adc/mcp3564.c +++ b/drivers/iio/adc/mcp3564.c @@ -1017,7 +1017,7 @@ static int mcp3564_parse_fw_children(struct iio_dev *indio_dev) return dev_err_probe(dev, -EINVAL, "Too many channels %d > %d\n", num_ch, adc->chip_info->num_channels); - channels = devm_kcalloc(dev, num_ch, sizeof(*channels), GFP_KERNEL); + channels = devm_kzalloc_objs(dev, *channels, num_ch); if (!channels) return -ENOMEM; diff --git a/drivers/iio/adc/pac1934.c b/drivers/iio/adc/pac1934.c index 5e901ab25c8e..b77f07a45be2 100644 --- a/drivers/iio/adc/pac1934.c +++ b/drivers/iio/adc/pac1934.c @@ -1447,7 +1447,7 @@ static int pac1934_prep_custom_attributes(struct pac1934_chip_info *info, if (info->active_channels[i]) active_channels_count++; - pac1934_group = devm_kzalloc(dev, sizeof(*pac1934_group), GFP_KERNEL); + pac1934_group = devm_kzalloc_obj(dev, *pac1934_group); if (!pac1934_group) return -ENOMEM; diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c index f777986a6aba..0b1ada5696af 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c @@ -836,7 +836,7 @@ static int palmas_gpadc_get_adc_dt_data(struct platform_device *pdev, int ret; u32 pval; - gp_data = devm_kzalloc(&pdev->dev, sizeof(*gp_data), GFP_KERNEL); + gp_data = devm_kzalloc_obj(&pdev->dev, *gp_data); if (!gp_data) return -ENOMEM; diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c index 3cdf90c4444b..bb86b2f3a8c8 100644 --- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c +++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c @@ -836,13 +836,12 @@ static int pm8xxx_xoadc_parse_channels(struct pm8xxx_xoadc *adc) } dev_dbg(adc->dev, "found %d ADC channels\n", adc->nchans); - adc->iio_chans = devm_kcalloc(adc->dev, adc->nchans, - sizeof(*adc->iio_chans), GFP_KERNEL); + adc->iio_chans = devm_kzalloc_objs(adc->dev, *adc->iio_chans, + adc->nchans); if (!adc->iio_chans) return -ENOMEM; - adc->chans = devm_kcalloc(adc->dev, adc->nchans, - sizeof(*adc->chans), GFP_KERNEL); + adc->chans = devm_kzalloc_objs(adc->dev, *adc->chans, adc->nchans); if (!adc->chans) return -ENOMEM; diff --git a/drivers/iio/adc/qcom-spmi-adc5-gen3.c b/drivers/iio/adc/qcom-spmi-adc5-gen3.c index c68c6c5f6aca..be12bb6781cb 100644 --- a/drivers/iio/adc/qcom-spmi-adc5-gen3.c +++ b/drivers/iio/adc/qcom-spmi-adc5-gen3.c @@ -561,13 +561,12 @@ static int adc5_get_fw_data(struct adc5_chip *adc) if (!adc->nchannels) return dev_err_probe(dev, -EINVAL, "No ADC channels found\n"); - adc->iio_chans = devm_kcalloc(dev, adc->nchannels, - sizeof(*adc->iio_chans), GFP_KERNEL); + adc->iio_chans = devm_kzalloc_objs(dev, *adc->iio_chans, adc->nchannels); if (!adc->iio_chans) return -ENOMEM; - adc->chan_props = devm_kcalloc(dev, adc->nchannels, - sizeof(*adc->chan_props), GFP_KERNEL); + adc->chan_props = devm_kzalloc_objs(dev, *adc->chan_props, + adc->nchannels); if (!adc->chan_props) return -ENOMEM; @@ -615,7 +614,7 @@ static int adc5_gen3_add_aux_tm_device(struct adc5_chip *adc) struct tm5_aux_dev_wrapper *aux_device; int i, ret, i_tm = 0; - aux_device = devm_kzalloc(adc->dev, sizeof(*aux_device), GFP_KERNEL); + aux_device = devm_kzalloc_obj(adc->dev, *aux_device); if (!aux_device) return -ENOMEM; @@ -623,9 +622,9 @@ static int adc5_gen3_add_aux_tm_device(struct adc5_chip *adc) aux_device->aux_dev.dev.parent = adc->dev; aux_device->aux_dev.dev.release = adc5_gen3_aux_device_release; - aux_device->tm_props = devm_kcalloc(adc->dev, adc->n_tm_channels, - sizeof(*aux_device->tm_props), - GFP_KERNEL); + aux_device->tm_props = devm_kzalloc_objs(adc->dev, + *aux_device->tm_props, + adc->n_tm_channels); if (!aux_device->tm_props) return -ENOMEM; @@ -741,8 +740,7 @@ static int adc5_gen3_probe(struct platform_device *pdev) adc->dev_data.num_sdams = ret; - reg = devm_kcalloc(dev, adc->dev_data.num_sdams, sizeof(u32), - GFP_KERNEL); + reg = devm_kzalloc_objs(dev, u32, adc->dev_data.num_sdams); if (!reg) return -ENOMEM; @@ -752,9 +750,8 @@ static int adc5_gen3_probe(struct platform_device *pdev) return dev_err_probe(dev, ret, "Failed to read reg property\n"); - adc->dev_data.base = devm_kcalloc(dev, adc->dev_data.num_sdams, - sizeof(*adc->dev_data.base), - GFP_KERNEL); + adc->dev_data.base = devm_kzalloc_objs(dev, *adc->dev_data.base, + adc->dev_data.num_sdams); if (!adc->dev_data.base) return -ENOMEM; diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c index 83ecd3adf65f..d57ba8526e0c 100644 --- a/drivers/iio/adc/qcom-spmi-adc5.c +++ b/drivers/iio/adc/qcom-spmi-adc5.c @@ -831,13 +831,13 @@ static int adc5_get_fw_data(struct adc5_chip *adc) if (!adc->nchannels) return dev_err_probe(adc->dev, -EINVAL, "no channels defined\n"); - adc->iio_chans = devm_kcalloc(adc->dev, adc->nchannels, - sizeof(*adc->iio_chans), GFP_KERNEL); + adc->iio_chans = devm_kzalloc_objs(adc->dev, *adc->iio_chans, + adc->nchannels); if (!adc->iio_chans) return -ENOMEM; - adc->chan_props = devm_kcalloc(adc->dev, adc->nchannels, - sizeof(*adc->chan_props), GFP_KERNEL); + adc->chan_props = devm_kzalloc_objs(adc->dev, *adc->chan_props, + adc->nchannels); if (!adc->chan_props) return -ENOMEM; diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c index d7a2df3c810e..ea7571c5cedf 100644 --- a/drivers/iio/adc/qcom-spmi-vadc.c +++ b/drivers/iio/adc/qcom-spmi-vadc.c @@ -760,13 +760,13 @@ static int vadc_get_fw_data(struct vadc_priv *vadc) if (!vadc->nchannels) return -EINVAL; - vadc->iio_chans = devm_kcalloc(vadc->dev, vadc->nchannels, - sizeof(*vadc->iio_chans), GFP_KERNEL); + vadc->iio_chans = devm_kzalloc_objs(vadc->dev, *vadc->iio_chans, + vadc->nchannels); if (!vadc->iio_chans) return -ENOMEM; - vadc->chan_props = devm_kcalloc(vadc->dev, vadc->nchannels, - sizeof(*vadc->chan_props), GFP_KERNEL); + vadc->chan_props = devm_kzalloc_objs(vadc->dev, *vadc->chan_props, + vadc->nchannels); if (!vadc->chan_props) return -ENOMEM; diff --git a/drivers/iio/adc/rzg2l_adc.c b/drivers/iio/adc/rzg2l_adc.c index 3b95f47445a8..340813f6f890 100644 --- a/drivers/iio/adc/rzg2l_adc.c +++ b/drivers/iio/adc/rzg2l_adc.c @@ -335,7 +335,7 @@ static int rzg2l_adc_parse_properties(struct platform_device *pdev, struct rzg2l int num_channels; u8 i; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/iio/adc/sd_adc_modulator.c b/drivers/iio/adc/sd_adc_modulator.c index def44d8831dc..c5f69a079e0e 100644 --- a/drivers/iio/adc/sd_adc_modulator.c +++ b/drivers/iio/adc/sd_adc_modulator.c @@ -111,7 +111,7 @@ static int iio_sd_mod_probe(struct platform_device *pdev) if (!device_property_present(dev, "#io-backend-cells")) return iio_sd_mod_register(pdev); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c index a42d82d61cb8..4ff91997c8e6 100644 --- a/drivers/iio/adc/stm32-adc-core.c +++ b/drivers/iio/adc/stm32-adc-core.c @@ -713,7 +713,7 @@ static int stm32_adc_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; platform_set_drvdata(pdev, &priv->common); diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c index 600f975f1d7b..521085f0bc52 100644 --- a/drivers/iio/adc/stm32-adc.c +++ b/drivers/iio/adc/stm32-adc.c @@ -2436,8 +2436,8 @@ static int stm32_adc_chan_fw_init(struct iio_dev *indio_dev, bool timestamping) if (timestamping) num_channels++; - channels = devm_kcalloc(&indio_dev->dev, num_channels, - sizeof(struct iio_chan_spec), GFP_KERNEL); + channels = devm_kzalloc_objs(&indio_dev->dev, struct iio_chan_spec, + num_channels); if (!channels) return -ENOMEM; diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c index 674767da3ac3..898fd882509c 100644 --- a/drivers/iio/adc/stm32-dfsdm-adc.c +++ b/drivers/iio/adc/stm32-dfsdm-adc.c @@ -1613,7 +1613,7 @@ static int stm32_dfsdm_audio_init(struct device *dev, struct iio_dev *indio_dev) if (num_ch == 1) legacy = true; - ch = devm_kzalloc(&indio_dev->dev, sizeof(*ch), GFP_KERNEL); + ch = devm_kzalloc_obj(&indio_dev->dev, *ch); if (!ch) return -ENOMEM; @@ -1679,13 +1679,13 @@ static int stm32_dfsdm_adc_init(struct device *dev, struct iio_dev *indio_dev) /* Generic binding. SD modulator IIO device not used. Use SD modulator backend. */ adc->hwc = NULL; - adc->backend = devm_kcalloc(&indio_dev->dev, num_ch, sizeof(*adc->backend), - GFP_KERNEL); + adc->backend = devm_kzalloc_objs(&indio_dev->dev, *adc->backend, + num_ch); if (!adc->backend) return -ENOMEM; } - ch = devm_kcalloc(&indio_dev->dev, num_ch, sizeof(*ch), GFP_KERNEL); + ch = devm_kzalloc_objs(&indio_dev->dev, *ch, num_ch); if (!ch) return -ENOMEM; indio_dev->channels = ch; diff --git a/drivers/iio/adc/stm32-dfsdm-core.c b/drivers/iio/adc/stm32-dfsdm-core.c index 47e2d1338e9e..fe70968646b1 100644 --- a/drivers/iio/adc/stm32-dfsdm-core.c +++ b/drivers/iio/adc/stm32-dfsdm-core.c @@ -370,7 +370,7 @@ static int stm32_dfsdm_probe(struct platform_device *pdev) struct stm32_dfsdm *dfsdm; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; @@ -398,13 +398,13 @@ static int stm32_dfsdm_probe(struct platform_device *pdev) if (ret < 0) return ret; - dfsdm->fl_list = devm_kcalloc(&pdev->dev, dfsdm->num_fls, - sizeof(*dfsdm->fl_list), GFP_KERNEL); + dfsdm->fl_list = devm_kzalloc_objs(&pdev->dev, *dfsdm->fl_list, + dfsdm->num_fls); if (!dfsdm->fl_list) return -ENOMEM; - dfsdm->ch_list = devm_kcalloc(&pdev->dev, dfsdm->num_chs, - sizeof(*dfsdm->ch_list), GFP_KERNEL); + dfsdm->ch_list = devm_kzalloc_objs(&pdev->dev, *dfsdm->ch_list, + dfsdm->num_chs); if (!dfsdm->ch_list) return -ENOMEM; diff --git a/drivers/iio/adc/ti-ads1119.c b/drivers/iio/adc/ti-ads1119.c index b0f04741ddc6..67699be4a3e9 100644 --- a/drivers/iio/adc/ti-ads1119.c +++ b/drivers/iio/adc/ti-ads1119.c @@ -615,15 +615,14 @@ static int ads1119_alloc_and_config_channels(struct iio_dev *indio_dev) st->num_channels_cfg, ADS1119_MAX_CHANNELS); - st->channels_cfg = devm_kcalloc(dev, st->num_channels_cfg, - sizeof(*st->channels_cfg), GFP_KERNEL); + st->channels_cfg = devm_kzalloc_objs(dev, *st->channels_cfg, + st->num_channels_cfg); if (!st->channels_cfg) return -ENOMEM; /* Allocate one more iio channel for the timestamp */ num_channels = st->num_channels_cfg + 1; - iio_channels = devm_kcalloc(dev, num_channels, sizeof(*iio_channels), - GFP_KERNEL); + iio_channels = devm_kzalloc_objs(dev, *iio_channels, num_channels); if (!iio_channels) return -ENOMEM; diff --git a/drivers/iio/adc/ti-ads112c04.c b/drivers/iio/adc/ti-ads112c04.c index acf7209db761..9c4faa11a63a 100644 --- a/drivers/iio/adc/ti-ads112c04.c +++ b/drivers/iio/adc/ti-ads112c04.c @@ -290,7 +290,7 @@ static int ads112c04_parse_channels(struct iio_dev *indio_dev, "num of channel nodes exceeds %d\n", ADS112C04_MAX_CHANNELS); - channels = devm_kcalloc(dev, num_channels, sizeof(*channels), GFP_KERNEL); + channels = devm_kzalloc_objs(dev, *channels, num_channels); if (!channels) return -ENOMEM; diff --git a/drivers/iio/adc/ti-ads112c14.c b/drivers/iio/adc/ti-ads112c14.c index 3c877126b0be..6645ddd6b11a 100644 --- a/drivers/iio/adc/ti-ads112c14.c +++ b/drivers/iio/adc/ti-ads112c14.c @@ -1926,21 +1926,19 @@ static int ads112c14_parse_channels(struct iio_dev *indio_dev, num_child_nodes = device_get_named_child_node_count(dev, "channel"); - data->measurements = devm_kcalloc(dev, num_child_nodes, - sizeof(*data->measurements), GFP_KERNEL); + data->measurements = devm_kzalloc_objs(dev, *data->measurements, + num_child_nodes); if (!data->measurements) return -ENOMEM; num_data_chans = num_child_nodes + ARRAY_SIZE(ads112c14_sys_mon_channels); - data->channel_states = devm_kcalloc(dev, num_data_chans, - sizeof(*data->channel_states), - GFP_KERNEL); + data->channel_states = devm_kzalloc_objs(dev, *data->channel_states, + num_data_chans); if (!data->channel_states) return -ENOMEM; - channels = devm_kcalloc(dev, num_data_chans + 1, - sizeof(*channels), GFP_KERNEL); + channels = devm_kzalloc_objs(dev, *channels, num_data_chans + 1); if (!channels) return -ENOMEM; diff --git a/drivers/iio/adc/ti-ads131e08.c b/drivers/iio/adc/ti-ads131e08.c index 1d25f887cadb..631dbc255193 100644 --- a/drivers/iio/adc/ti-ads131e08.c +++ b/drivers/iio/adc/ti-ads131e08.c @@ -722,13 +722,12 @@ static int ads131e08_alloc_channels(struct iio_dev *indio_dev) return -EINVAL; } - channels = devm_kcalloc(&st->spi->dev, num_channels, - sizeof(*channels), GFP_KERNEL); + channels = devm_kzalloc_objs(&st->spi->dev, *channels, num_channels); if (!channels) return -ENOMEM; - channel_config = devm_kcalloc(&st->spi->dev, num_channels, - sizeof(*channel_config), GFP_KERNEL); + channel_config = devm_kzalloc_objs(&st->spi->dev, *channel_config, + num_channels); if (!channel_config) return -ENOMEM; diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index e53c839e87ef..0c3e0e9e8364 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c @@ -403,8 +403,7 @@ static int tiadc_channel_init(struct device *dev, struct iio_dev *indio_dev, int i; indio_dev->num_channels = channels; - chan_array = devm_kcalloc(dev, channels, sizeof(*chan_array), - GFP_KERNEL); + chan_array = devm_kzalloc_objs(dev, *chan_array, channels); if (!chan_array) return -ENOMEM; diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c index 31b1c01baa27..e7fd371b3404 100644 --- a/drivers/iio/adc/twl6030-gpadc.c +++ b/drivers/iio/adc/twl6030-gpadc.c @@ -893,10 +893,8 @@ static int twl6030_gpadc_probe(struct platform_device *pdev) gpadc = iio_priv(indio_dev); - gpadc->twl6030_cal_tbl = devm_kcalloc(dev, - pdata->nchannels, - sizeof(*gpadc->twl6030_cal_tbl), - GFP_KERNEL); + gpadc->twl6030_cal_tbl = devm_kzalloc_objs(dev, *gpadc->twl6030_cal_tbl, + pdata->nchannels); if (!gpadc->twl6030_cal_tbl) return -ENOMEM; diff --git a/drivers/iio/adc/versal-sysmon-core.c b/drivers/iio/adc/versal-sysmon-core.c index 1b55d343982e..f7f177b501ba 100644 --- a/drivers/iio/adc/versal-sysmon-core.c +++ b/drivers/iio/adc/versal-sysmon-core.c @@ -877,7 +877,7 @@ static int sysmon_parse_fw(struct iio_dev *indio_dev, struct device *dev, int ir num_static = ARRAY_SIZE(temp_channels); num_chan = size_add(num_temp, size_add(num_static, num_supply)); - sysmon_channels = devm_kcalloc(dev, num_chan, sizeof(*sysmon_channels), GFP_KERNEL); + sysmon_channels = devm_kzalloc_objs(dev, *sysmon_channels, num_chan); if (!sysmon_channels) return -ENOMEM; diff --git a/drivers/iio/adc/versal-sysmon.c b/drivers/iio/adc/versal-sysmon.c index 529d0486c9f9..7d850ea1f401 100644 --- a/drivers/iio/adc/versal-sysmon.c +++ b/drivers/iio/adc/versal-sysmon.c @@ -56,7 +56,7 @@ static int sysmon_platform_probe(struct platform_device *pdev) struct sysmon_mmio *mmio; struct regmap *regmap; - mmio = devm_kzalloc(dev, sizeof(*mmio), GFP_KERNEL); + mmio = devm_kzalloc_obj(dev, *mmio); if (!mmio) return -ENOMEM; diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c index 158e6133abf5..90269d673069 100644 --- a/drivers/iio/adc/xilinx-ams.c +++ b/drivers/iio/adc/xilinx-ams.c @@ -1240,7 +1240,7 @@ static int ams_parse_firmware(struct iio_dev *indio_dev) ARRAY_SIZE(ams_ctrl_channels); /* Initialize buffer for channel specification */ - ams_channels = devm_kcalloc(dev, ams_size, sizeof(*ams_channels), GFP_KERNEL); + ams_channels = devm_kzalloc_objs(dev, *ams_channels, ams_size); if (!ams_channels) return -ENOMEM; diff --git a/drivers/iio/addac/ad74115.c b/drivers/iio/addac/ad74115.c index 9b9d7a12ce87..e27c39b06e44 100644 --- a/drivers/iio/addac/ad74115.c +++ b/drivers/iio/addac/ad74115.c @@ -1539,8 +1539,7 @@ static int ad74115_setup_iio_channels(struct iio_dev *indio_dev) struct device *dev = &st->spi->dev; struct iio_chan_spec *channels; - channels = devm_kcalloc(dev, sizeof(*channels), - indio_dev->num_channels, GFP_KERNEL); + channels = devm_kzalloc_objs(dev, *channels, indio_dev->num_channels); if (!channels) return -ENOMEM; diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c index 2e5a58e48a89..76bad554f028 100644 --- a/drivers/iio/addac/ad74413r.c +++ b/drivers/iio/addac/ad74413r.c @@ -1269,8 +1269,8 @@ static int ad74413r_setup_channels(struct iio_dev *indio_dev) unsigned int i, num_chans, chan_i; int ret; - channels = devm_kcalloc(st->dev, sizeof(*channels), - indio_dev->num_channels, GFP_KERNEL); + channels = devm_kzalloc_objs(st->dev, *channels, + indio_dev->num_channels); if (!channels) return -ENOMEM; diff --git a/drivers/iio/amplifiers/adl8113.c b/drivers/iio/amplifiers/adl8113.c index 1f1cfca980b4..97f66884ab8d 100644 --- a/drivers/iio/amplifiers/adl8113.c +++ b/drivers/iio/amplifiers/adl8113.c @@ -157,8 +157,7 @@ static int adl8113_init_gain_configs(struct device *dev, struct adl8113_state *s * - Internal amp and bypass (always present) * - External bypass A and B (optional if configured) */ - st->gain_configs = devm_kcalloc(dev, 4, sizeof(*st->gain_configs), - GFP_KERNEL); + st->gain_configs = devm_kzalloc_objs(dev, *st->gain_configs, 4); if (!st->gain_configs) return -ENOMEM; diff --git a/drivers/iio/chemical/bme680_spi.c b/drivers/iio/chemical/bme680_spi.c index 2175b9564fa1..fcc4b18b9a44 100644 --- a/drivers/iio/chemical/bme680_spi.c +++ b/drivers/iio/chemical/bme680_spi.c @@ -112,7 +112,7 @@ static int bme680_spi_probe(struct spi_device *spi) struct bme680_spi_bus_context *bus_context; struct regmap *regmap; - bus_context = devm_kzalloc(&spi->dev, sizeof(*bus_context), GFP_KERNEL); + bus_context = devm_kzalloc_obj(&spi->dev, *bus_context); if (!bus_context) return -ENOMEM; diff --git a/drivers/iio/chemical/scd30_serial.c b/drivers/iio/chemical/scd30_serial.c index 31b0fc957b08..c80453ab0339 100644 --- a/drivers/iio/chemical/scd30_serial.c +++ b/drivers/iio/chemical/scd30_serial.c @@ -218,7 +218,7 @@ static int scd30_serdev_probe(struct serdev_device *serdev) struct scd30_serdev_priv *priv; int irq, ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/iio/chemical/sps30_serial.c b/drivers/iio/chemical/sps30_serial.c index 0cdba8703e93..c8a9d5444496 100644 --- a/drivers/iio/chemical/sps30_serial.c +++ b/drivers/iio/chemical/sps30_serial.c @@ -389,7 +389,7 @@ static int sps30_serial_probe(struct serdev_device *serdev) struct sps30_serial_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_activity.c b/drivers/iio/common/cros_ec_sensors/cros_ec_activity.c index 6762685e6876..f9e348d83140 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_activity.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_activity.c @@ -244,8 +244,7 @@ static int cros_ec_sensors_probe(struct platform_device *pdev) /* Allocate a channel per activity and one for timestamp */ nb_activities = hweight_long(activities) + 1; - st->channels = devm_kcalloc(dev, nb_activities, - sizeof(*st->channels), GFP_KERNEL); + st->channels = devm_kzalloc_objs(dev, *st->channels, nb_activities); if (!st->channels) return -ENOMEM; diff --git a/drivers/iio/common/scmi_sensors/scmi_iio.c b/drivers/iio/common/scmi_sensors/scmi_iio.c index 442b40ef27cf..5222c2dce7d5 100644 --- a/drivers/iio/common/scmi_sensors/scmi_iio.c +++ b/drivers/iio/common/scmi_sensors/scmi_iio.c @@ -509,10 +509,8 @@ static int scmi_iio_set_sampling_freq_avail(struct iio_dev *iio_dev) int i; sensor->freq_avail = - devm_kcalloc(&iio_dev->dev, - array_size(sensor->sensor_info->intervals.count, 2), - sizeof(*sensor->freq_avail), - GFP_KERNEL); + devm_kzalloc_objs(&iio_dev->dev, *sensor->freq_avail, + array_size(sensor->sensor_info->intervals.count, 2)); if (!sensor->freq_avail) return -ENOMEM; @@ -585,9 +583,7 @@ scmi_alloc_iiodev(struct scmi_device *sdev, iiodev->info = &scmi_iio_info; iio_channels = - devm_kcalloc(dev, iiodev->num_channels, - sizeof(*iio_channels), - GFP_KERNEL); + devm_kzalloc_objs(dev, *iio_channels, iiodev->num_channels); if (!iio_channels) return ERR_PTR(-ENOMEM); diff --git a/drivers/iio/common/ssp_sensors/ssp_dev.c b/drivers/iio/common/ssp_sensors/ssp_dev.c index 828fcfe1d4f1..40b658d39294 100644 --- a/drivers/iio/common/ssp_sensors/ssp_dev.c +++ b/drivers/iio/common/ssp_sensors/ssp_dev.c @@ -441,7 +441,7 @@ static struct ssp_data *ssp_parse_dt(struct device *dev) { struct ssp_data *data; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return NULL; diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 76f91696f66a..54be24c7d939 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -294,7 +294,7 @@ static struct st_sensors_platform_data *st_sensors_dev_probe(struct device *dev, if (!dev_fwnode(dev)) return NULL; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); if (!device_property_read_u32(dev, "st,drdy-int-pin", &val) && (val <= 2)) diff --git a/drivers/iio/dac/ad3530r.c b/drivers/iio/dac/ad3530r.c index 9e043639801d..d5703a435ea3 100644 --- a/drivers/iio/dac/ad3530r.c +++ b/drivers/iio/dac/ad3530r.c @@ -811,7 +811,7 @@ static int ad3530r_parse_channel_cfg(struct iio_dev *indio_dev) if (!num_chan) return dev_err_probe(dev, -ENOENT, "No channels configured\n"); - channels = devm_kcalloc(dev, num_chan, sizeof(*channels), GFP_KERNEL); + channels = devm_kzalloc_objs(dev, *channels, num_chan); if (!channels) return -ENOMEM; diff --git a/drivers/iio/dac/ad5380.c b/drivers/iio/dac/ad5380.c index 4a5ad419f4ea..38ff892d6740 100644 --- a/drivers/iio/dac/ad5380.c +++ b/drivers/iio/dac/ad5380.c @@ -345,8 +345,8 @@ static int ad5380_alloc_channels(struct device *dev, struct iio_dev *indio_dev) struct iio_chan_spec *channels; unsigned int i; - channels = devm_kcalloc(dev, st->chip_info->num_channels, - sizeof(struct iio_chan_spec), GFP_KERNEL); + channels = devm_kzalloc_objs(dev, struct iio_chan_spec, + st->chip_info->num_channels); if (!channels) return -ENOMEM; diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c index 4720733d66b2..fcbb334899a6 100644 --- a/drivers/iio/dac/ad5592r-base.c +++ b/drivers/iio/dac/ad5592r-base.c @@ -510,9 +510,7 @@ static int ad5592r_alloc_channels(struct iio_dev *iio_dev) st->channel_offstate[reg] = tmp; } - channels = devm_kcalloc(st->dev, - 1 + 2 * num_channels, sizeof(*channels), - GFP_KERNEL); + channels = devm_kzalloc_objs(st->dev, *channels, 1 + 2 * num_channels); if (!channels) return -ENOMEM; diff --git a/drivers/iio/dac/ad5686-spi.c b/drivers/iio/dac/ad5686-spi.c index 69cd9753f339..92952ceee078 100644 --- a/drivers/iio/dac/ad5686-spi.c +++ b/drivers/iio/dac/ad5686-spi.c @@ -163,8 +163,7 @@ static int ad5686_spi_probe(struct spi_device *spi) /* read operation requires at least 2 transfers */ capacity = max(info->num_channels, 2); - bus_data = devm_kzalloc(dev, struct_size(bus_data, xfers, capacity), - GFP_KERNEL); + bus_data = devm_kzalloc_flex(dev, *bus_data, xfers, capacity); if (!bus_data) return -ENOMEM; diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c index 730289dd8ef6..8143f056a0ef 100644 --- a/drivers/iio/dac/ad5755.c +++ b/drivers/iio/dac/ad5755.c @@ -707,7 +707,7 @@ static struct ad5755_platform_data *ad5755_parse_fw(struct device *dev) if (!dev_fwnode(dev)) return NULL; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return NULL; diff --git a/drivers/iio/dac/adi-axi-dac.c b/drivers/iio/dac/adi-axi-dac.c index f4f3bc67c68e..812805dd291f 100644 --- a/drivers/iio/dac/adi-axi-dac.c +++ b/drivers/iio/dac/adi-axi-dac.c @@ -892,7 +892,7 @@ static int axi_dac_probe(struct platform_device *pdev) struct clk *clk; int ret; - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/iio/dac/ltc2664.c b/drivers/iio/dac/ltc2664.c index 35bec55ebde1..22827dcaed0b 100644 --- a/drivers/iio/dac/ltc2664.c +++ b/drivers/iio/dac/ltc2664.c @@ -619,10 +619,9 @@ static int ltc2664_setup(struct ltc2664_state *st) * Duplicate the default channel configuration as it can change during * @ltc2664_channel_config() */ - st->iio_channels = devm_kcalloc(&st->spi->dev, - chip_info->num_channels, - sizeof(struct iio_chan_spec), - GFP_KERNEL); + st->iio_channels = devm_kzalloc_objs(&st->spi->dev, + struct iio_chan_spec, + chip_info->num_channels); if (!st->iio_channels) return -ENOMEM; diff --git a/drivers/iio/dac/max22007.c b/drivers/iio/dac/max22007.c index e2c7e2ad37ba..b52c055bdeee 100644 --- a/drivers/iio/dac/max22007.c +++ b/drivers/iio/dac/max22007.c @@ -335,7 +335,7 @@ static int max22007_parse_channel_cfg(struct max22007_state *st, u8 *num_channel if (!num_chan) return dev_err_probe(dev, -ENODEV, "no channels configured\n"); - st->iio_chans = devm_kcalloc(dev, num_chan, sizeof(*st->iio_chans), GFP_KERNEL); + st->iio_chans = devm_kzalloc_objs(dev, *st->iio_chans, num_chan); if (!st->iio_chans) return -ENOMEM; diff --git a/drivers/iio/dac/mcp47feb02-core.c b/drivers/iio/dac/mcp47feb02-core.c index 88bffbab0854..c5392df029c3 100644 --- a/drivers/iio/dac/mcp47feb02-core.c +++ b/drivers/iio/dac/mcp47feb02-core.c @@ -761,7 +761,7 @@ static int mcp47feb02_parse_fw(struct iio_dev *indio_dev, if (!num_channels) return dev_err_probe(dev, -EINVAL, "No channel specified in the devicetree.\n"); - channels = devm_kcalloc(dev, num_channels, sizeof(*channels), GFP_KERNEL); + channels = devm_kzalloc_objs(dev, *channels, num_channels); if (!channels) return -ENOMEM; diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c index b5795c14f0fe..9c61264c3d73 100644 --- a/drivers/iio/dac/stm32-dac-core.c +++ b/drivers/iio/dac/stm32-dac-core.c @@ -96,7 +96,7 @@ static int stm32_dac_probe(struct platform_device *pdev) struct reset_control *rst; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; platform_set_drvdata(pdev, &priv->common); diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c index ec45c0f65fe3..e4b76e13679b 100644 --- a/drivers/iio/frequency/adf4350.c +++ b/drivers/iio/frequency/adf4350.c @@ -504,7 +504,7 @@ static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev) struct adf4350_platform_data *pdata; unsigned int tmp; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return NULL; diff --git a/drivers/iio/imu/bmi323/bmi323_i2c.c b/drivers/iio/imu/bmi323/bmi323_i2c.c index e835b91ea6b4..52110cae83d8 100644 --- a/drivers/iio/imu/bmi323/bmi323_i2c.c +++ b/drivers/iio/imu/bmi323/bmi323_i2c.c @@ -78,7 +78,7 @@ static int bmi323_i2c_probe(struct i2c_client *i2c) struct bmi323_i2c_priv *priv; struct regmap *regmap; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/iio/imu/bno055/bno055_ser_core.c b/drivers/iio/imu/bno055/bno055_ser_core.c index 01f05feaae0a..6810e19e1631 100644 --- a/drivers/iio/imu/bno055/bno055_ser_core.c +++ b/drivers/iio/imu/bno055/bno055_ser_core.c @@ -502,7 +502,7 @@ static int bno055_ser_probe(struct serdev_device *serdev) struct regmap *regmap; int ret; - priv = devm_kzalloc(&serdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&serdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c index cd2e53416f5b..890d9a8fd683 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c @@ -753,7 +753,7 @@ int inv_icm42600_core_probe(struct regmap *regmap, int chip, open_drain = device_property_read_bool(dev, "drive-open-drain"); - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c b/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c index f4ef75da22c7..2c0a15d6344a 100644 --- a/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c +++ b/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c @@ -580,7 +580,7 @@ int inv_icm42607_core_probe(struct regmap *regmap, struct inv_icm42607_state *st; int ret; - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/iio/imu/inv_icm45600/inv_icm45600_core.c b/drivers/iio/imu/inv_icm45600/inv_icm45600_core.c index c1d7aa7e950d..0e2267622492 100644 --- a/drivers/iio/imu/inv_icm45600/inv_icm45600_core.c +++ b/drivers/iio/imu/inv_icm45600/inv_icm45600_core.c @@ -710,7 +710,7 @@ int inv_icm45600_core_probe(struct regmap *regmap, const struct inv_icm45600_chi if (IS_ERR(regmap_custom)) return dev_err_probe(dev, PTR_ERR(regmap_custom), "Failed to register regmap\n"); - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c index c288437d53ea..8ef48daf1822 100644 --- a/drivers/iio/imu/kmx61.c +++ b/drivers/iio/imu/kmx61.c @@ -1279,7 +1279,7 @@ static int kmx61_probe(struct i2c_client *client) struct kmx61_data *data; const char *name = NULL; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/iio/imu/smi330/smi330_i2c.c b/drivers/iio/imu/smi330/smi330_i2c.c index eb9413e22e14..60a5270e9366 100644 --- a/drivers/iio/imu/smi330/smi330_i2c.c +++ b/drivers/iio/imu/smi330/smi330_i2c.c @@ -87,7 +87,7 @@ static int smi330_i2c_probe(struct i2c_client *i2c) struct smi330_i2c_priv *priv; struct regmap *regmap; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c index 360f1365f892..823f8ac66c25 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c @@ -2923,7 +2923,7 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, const char *name = NULL; int i, err; - hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL); + hw = devm_kzalloc_obj(dev, *hw); if (!hw) return -ENOMEM; diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c index cbc47fa5b101..a27a336e84d2 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c @@ -766,8 +766,8 @@ st_lsm6dsx_shub_alloc_iiodev(struct st_lsm6dsx_hw *hw, IIO_CHAN_SOFT_TIMESTAMP(3), }; - ext_channels = devm_kcalloc(hw->dev, ARRAY_SIZE(magn_channels), - sizeof(*ext_channels), GFP_KERNEL); + ext_channels = devm_kzalloc_objs(hw->dev, *ext_channels, + ARRAY_SIZE(magn_channels)); if (!ext_channels) return NULL; diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c index 6581d14e2bcf..f8c25167391e 100644 --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c @@ -59,7 +59,7 @@ static int st_lsm9ds0_i2c_probe(struct i2c_client *client) st_sensors_dev_name_probe(dev, client->name, sizeof(client->name)); - lsm9ds0 = devm_kzalloc(dev, sizeof(*lsm9ds0), GFP_KERNEL); + lsm9ds0 = devm_kzalloc_obj(dev, *lsm9ds0); if (!lsm9ds0) return -ENOMEM; diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c index e67f09e1f093..5209858a12df 100644 --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c @@ -52,7 +52,7 @@ static int st_lsm9ds0_spi_probe(struct spi_device *spi) st_sensors_dev_name_probe(dev, spi->modalias, sizeof(spi->modalias)); - lsm9ds0 = devm_kzalloc(dev, sizeof(*lsm9ds0), GFP_KERNEL); + lsm9ds0 = devm_kzalloc_obj(dev, *lsm9ds0); if (!lsm9ds0) return -ENOMEM; diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c index fbf5c39d7655..733915728de4 100644 --- a/drivers/iio/industrialio-backend.c +++ b/drivers/iio/industrialio-backend.c @@ -543,7 +543,7 @@ int devm_iio_backend_request_buffer(struct device *dev, struct iio_backend_buffer_pair *pair; struct iio_buffer *buffer; - pair = devm_kzalloc(dev, sizeof(*pair), GFP_KERNEL); + pair = devm_kzalloc_obj(dev, *pair); if (!pair) return -ENOMEM; @@ -1177,7 +1177,7 @@ int devm_iio_backend_register(struct device *dev, * the backend object lifetime with the device being passed since * removing it will tear the frontend/consumer down. */ - back = devm_kzalloc(dev, sizeof(*back), GFP_KERNEL); + back = devm_kzalloc_obj(dev, *back); if (!back) return -ENOMEM; diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c index ad18f233ee16..120661efabbd 100644 --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c @@ -370,9 +370,8 @@ static int magn_3d_parse_report(struct platform_device *pdev, st->magn[2].index, st->magn[2].report_id); /* Setup IIO channel array */ - _channels = devm_kcalloc(&pdev->dev, attr_count, - sizeof(struct iio_chan_spec), - GFP_KERNEL); + _channels = devm_kzalloc_objs(&pdev->dev, struct iio_chan_spec, + attr_count); if (!_channels) { dev_err(&pdev->dev, "failed to allocate space for iio channels\n"); @@ -380,9 +379,8 @@ static int magn_3d_parse_report(struct platform_device *pdev, } /* attr_count include timestamp channel, and the iio_vals should be aligned to 8byte */ - st->iio_vals = devm_kcalloc(&pdev->dev, - ((attr_count + 1) % 2 + (attr_count + 1) / 2) * 2, - sizeof(u32), GFP_KERNEL); + st->iio_vals = devm_kzalloc_objs(&pdev->dev, u32, + ((attr_count + 1) % 2 + (attr_count + 1) / 2) * 2); if (!st->iio_vals) { dev_err(&pdev->dev, "failed to allocate space for iio values array\n"); diff --git a/drivers/iio/multiplexer/iio-mux.c b/drivers/iio/multiplexer/iio-mux.c index 562457a67382..0928976d097d 100644 --- a/drivers/iio/multiplexer/iio-mux.c +++ b/drivers/iio/multiplexer/iio-mux.c @@ -249,10 +249,8 @@ static int mux_configure_chan_ext_info(struct device *dev, struct mux *mux, if (!page) return -ENOMEM; - child->ext_info_cache = devm_kcalloc(dev, - num_ext_info, - sizeof(*child->ext_info_cache), - GFP_KERNEL); + child->ext_info_cache = devm_kzalloc_objs(dev, *child->ext_info_cache, + num_ext_info); if (!child->ext_info_cache) return -ENOMEM; @@ -361,7 +359,7 @@ static int mux_probe(struct platform_device *pdev) if (all_children < 0) return all_children; - labels = devm_kmalloc_array(dev, all_children, sizeof(*labels), GFP_KERNEL); + labels = devm_kmalloc_objs(dev, *labels, all_children); if (!labels) return -ENOMEM; diff --git a/drivers/iio/pressure/mpl115_spi.c b/drivers/iio/pressure/mpl115_spi.c index 3cff616e8d2f..9eacba5d8d22 100644 --- a/drivers/iio/pressure/mpl115_spi.c +++ b/drivers/iio/pressure/mpl115_spi.c @@ -25,7 +25,7 @@ static int mpl115_spi_init(struct device *dev) struct spi_device *spi = to_spi_device(dev); struct mpl115_spi_buf *buf; - buf = devm_kzalloc(dev, sizeof(*buf), GFP_KERNEL); + buf = devm_kzalloc_obj(dev, *buf); if (!buf) return -ENOMEM; diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c index 6655453c9abf..94c558673a86 100644 --- a/drivers/iio/temperature/ltc2983.c +++ b/drivers/iio/temperature/ltc2983.c @@ -504,7 +504,7 @@ __ltc2983_custom_sensor_new(struct ltc2983_data *st, const struct fwnode_handle return dev_err_ptr_probe(dev, -EINVAL, "Number of entries either 0 or not even\n"); - new_custom = devm_kzalloc(dev, sizeof(*new_custom), GFP_KERNEL); + new_custom = devm_kzalloc_obj(dev, *new_custom); if (!new_custom) return ERR_PTR(-ENOMEM); @@ -779,7 +779,7 @@ ltc2983_thermocouple_new(const struct fwnode_handle *child, struct ltc2983_data u32 oc_current; int ret; - thermo = devm_kzalloc(dev, sizeof(*thermo), GFP_KERNEL); + thermo = devm_kzalloc_obj(dev, *thermo); if (!thermo) return ERR_PTR(-ENOMEM); @@ -868,7 +868,7 @@ ltc2983_rtd_new(const struct fwnode_handle *child, struct ltc2983_data *st, struct device *dev = &st->spi->dev; u32 excitation_current = 0, n_wires = 2; - rtd = devm_kzalloc(dev, sizeof(*rtd), GFP_KERNEL); + rtd = devm_kzalloc_obj(dev, *rtd); if (!rtd) return ERR_PTR(-ENOMEM); @@ -1031,7 +1031,7 @@ ltc2983_thermistor_new(const struct fwnode_handle *child, struct ltc2983_data *s u32 excitation_current = 0; int ret = 0; - thermistor = devm_kzalloc(dev, sizeof(*thermistor), GFP_KERNEL); + thermistor = devm_kzalloc_obj(dev, *thermistor); if (!thermistor) return ERR_PTR(-ENOMEM); @@ -1167,7 +1167,7 @@ ltc2983_copper_trace_new(const struct fwnode_handle *child, struct ltc2983_data "Invalid channel %d for copper trace\n", sensor->chan); - ct = devm_kzalloc(dev, sizeof(*ct), GFP_KERNEL); + ct = devm_kzalloc_obj(dev, *ct); if (!ct) return ERR_PTR(-ENOMEM); @@ -1266,7 +1266,7 @@ ltc2983_leak_detector_new(const struct fwnode_handle *child, struct ltc2983_data "Invalid channel %d for leak detector\n", sensor->chan); - ld = devm_kzalloc(dev, sizeof(*ld), GFP_KERNEL); + ld = devm_kzalloc_obj(dev, *ld); if (!ld) return ERR_PTR(-ENOMEM); @@ -1352,7 +1352,7 @@ ltc2983_diode_new(const struct fwnode_handle *child, const struct ltc2983_data * u32 temp = 0, excitation_current = 0; int ret; - diode = devm_kzalloc(dev, sizeof(*diode), GFP_KERNEL); + diode = devm_kzalloc_obj(dev, *diode); if (!diode) return ERR_PTR(-ENOMEM); @@ -1425,7 +1425,7 @@ static struct ltc2983_sensor *ltc2983_r_sense_new(struct fwnode_handle *child, int ret; u32 temp; - rsense = devm_kzalloc(dev, sizeof(*rsense), GFP_KERNEL); + rsense = devm_kzalloc_obj(dev, *rsense); if (!rsense) return ERR_PTR(-ENOMEM); @@ -1460,7 +1460,7 @@ static struct ltc2983_sensor *ltc2983_adc_new(struct fwnode_handle *child, struct device *dev = &st->spi->dev; struct ltc2983_adc *adc; - adc = devm_kzalloc(dev, sizeof(*adc), GFP_KERNEL); + adc = devm_kzalloc_obj(dev, *adc); if (!adc) return ERR_PTR(-ENOMEM); @@ -1486,7 +1486,7 @@ static struct ltc2983_sensor *ltc2983_temp_new(struct fwnode_handle *child, struct device *dev = &st->spi->dev; struct ltc2983_temp *temp; - temp = devm_kzalloc(dev, sizeof(*temp), GFP_KERNEL); + temp = devm_kzalloc_obj(dev, *temp); if (!temp) return ERR_PTR(-ENOMEM); @@ -1677,8 +1677,7 @@ static int ltc2983_parse_fw(struct ltc2983_data *st) return dev_err_probe(dev, -EINVAL, "At least one channel must be given!\n"); - st->sensors = devm_kcalloc(dev, st->num_channels, sizeof(*st->sensors), - GFP_KERNEL); + st->sensors = devm_kzalloc_objs(dev, *st->sensors, st->num_channels); if (!st->sensors) return -ENOMEM; diff --git a/drivers/iio/trigger/stm32-lptimer-trigger.c b/drivers/iio/trigger/stm32-lptimer-trigger.c index 828890fe353c..82b4122c1ac1 100644 --- a/drivers/iio/trigger/stm32-lptimer-trigger.c +++ b/drivers/iio/trigger/stm32-lptimer-trigger.c @@ -112,7 +112,7 @@ static int stm32_lptim_trigger_probe(struct platform_device *pdev) struct stm32_lptim_cfg const *lptim_cfg; u32 index; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c index 4f6ff1e72f2e..721166d476eb 100644 --- a/drivers/iio/trigger/stm32-timer-trigger.c +++ b/drivers/iio/trigger/stm32-timer-trigger.c @@ -797,7 +797,7 @@ static int stm32_timer_trigger_probe(struct platform_device *pdev) if (cfg->valids_table && *cfg->valids_table[index]) priv = stm32_setup_counter_device(dev); else - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/infiniband/hw/erdma/erdma_cmdq.c b/drivers/infiniband/hw/erdma/erdma_cmdq.c index b867aefe83b2..731f73f30b4e 100644 --- a/drivers/infiniband/hw/erdma/erdma_cmdq.c +++ b/drivers/infiniband/hw/erdma/erdma_cmdq.c @@ -66,8 +66,8 @@ static int erdma_cmdq_wait_res_init(struct erdma_dev *dev, int i; cmdq->wait_pool = - devm_kcalloc(&dev->pdev->dev, cmdq->max_outstandings, - sizeof(struct erdma_comp_wait), GFP_KERNEL); + devm_kzalloc_objs(&dev->pdev->dev, struct erdma_comp_wait, + cmdq->max_outstandings); if (!cmdq->wait_pool) return -ENOMEM; diff --git a/drivers/input/joystick/adafruit-seesaw.c b/drivers/input/joystick/adafruit-seesaw.c index 5835ed1e29e1..897e14bb61f7 100644 --- a/drivers/input/joystick/adafruit-seesaw.c +++ b/drivers/input/joystick/adafruit-seesaw.c @@ -233,7 +233,7 @@ static int seesaw_probe(struct i2c_client *client) /* Wait for the registers to reset before proceeding */ usleep_range(10000, 15000); - seesaw = devm_kzalloc(&client->dev, sizeof(*seesaw), GFP_KERNEL); + seesaw = devm_kzalloc_obj(&client->dev, *seesaw); if (!seesaw) return -ENOMEM; diff --git a/drivers/input/joystick/adc-joystick.c b/drivers/input/joystick/adc-joystick.c index 4fa42f88bcfa..71aa1f07bc44 100644 --- a/drivers/input/joystick/adc-joystick.c +++ b/drivers/input/joystick/adc-joystick.c @@ -257,7 +257,7 @@ static int adc_joystick_probe(struct platform_device *pdev) if (error) return error; - joy = devm_kzalloc(dev, struct_size(joy, axes, num_chans), GFP_KERNEL); + joy = devm_kzalloc_flex(dev, *joy, axes, num_chans); if (!joy) return -ENOMEM; diff --git a/drivers/input/joystick/psxpad-spi.c b/drivers/input/joystick/psxpad-spi.c index aac77a2cfe46..a2b00e420e38 100644 --- a/drivers/input/joystick/psxpad-spi.c +++ b/drivers/input/joystick/psxpad-spi.c @@ -288,7 +288,7 @@ static int psxpad_spi_probe(struct spi_device *spi) struct input_dev *idev; int err; - pad = devm_kzalloc(&spi->dev, sizeof(struct psxpad), GFP_KERNEL); + pad = devm_kzalloc_obj(&spi->dev, struct psxpad); if (!pad) return -ENOMEM; diff --git a/drivers/input/joystick/pxrc.c b/drivers/input/joystick/pxrc.c index 52d9eab667b7..693d15347257 100644 --- a/drivers/input/joystick/pxrc.c +++ b/drivers/input/joystick/pxrc.c @@ -135,7 +135,7 @@ static int pxrc_probe(struct usb_interface *intf, return error; } - pxrc = devm_kzalloc(&intf->dev, sizeof(*pxrc), GFP_KERNEL); + pxrc = devm_kzalloc_obj(&intf->dev, *pxrc); if (!pxrc) return -ENOMEM; diff --git a/drivers/input/joystick/qwiic-joystick.c b/drivers/input/joystick/qwiic-joystick.c index c471afc7862b..f808519c50fd 100644 --- a/drivers/input/joystick/qwiic-joystick.c +++ b/drivers/input/joystick/qwiic-joystick.c @@ -75,7 +75,7 @@ static int qwiic_probe(struct i2c_client *client) dev_dbg(&client->dev, "SparkFun Qwiic Joystick, FW: %u.%u\n", vers.major, vers.minor); - priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&client->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/input/joystick/sensehat-joystick.c b/drivers/input/joystick/sensehat-joystick.c index a84df39d3b2f..b2a654193650 100644 --- a/drivers/input/joystick/sensehat-joystick.c +++ b/drivers/input/joystick/sensehat-joystick.c @@ -63,8 +63,7 @@ static int sensehat_joystick_probe(struct platform_device *pdev) struct sensehat_joystick *sensehat_joystick; int error, i, irq; - sensehat_joystick = devm_kzalloc(&pdev->dev, sizeof(*sensehat_joystick), - GFP_KERNEL); + sensehat_joystick = devm_kzalloc_obj(&pdev->dev, *sensehat_joystick); if (!sensehat_joystick) return -ENOMEM; diff --git a/drivers/input/keyboard/adc-keys.c b/drivers/input/keyboard/adc-keys.c index d687459a0c80..89d6faa17507 100644 --- a/drivers/input/keyboard/adc-keys.c +++ b/drivers/input/keyboard/adc-keys.c @@ -74,7 +74,7 @@ static int adc_keys_load_keymap(struct device *dev, struct adc_keys_state *st) return -EINVAL; } - map = devm_kmalloc_array(dev, st->num_keys, sizeof(*map), GFP_KERNEL); + map = devm_kmalloc_objs(dev, *map, st->num_keys); if (!map) return -ENOMEM; @@ -109,7 +109,7 @@ static int adc_keys_probe(struct platform_device *pdev) int i, value; int error; - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/input/keyboard/adp5520-keys.c b/drivers/input/keyboard/adp5520-keys.c index d778af2750ea..81cd335ce3b5 100644 --- a/drivers/input/keyboard/adp5520-keys.c +++ b/drivers/input/keyboard/adp5520-keys.c @@ -89,7 +89,7 @@ static int adp5520_keys_probe(struct platform_device *pdev) if (!(pdata->rows_en_mask && pdata->cols_en_mask)) return -EINVAL; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) { dev_err(&pdev->dev, "failed to alloc memory\n"); return -ENOMEM; diff --git a/drivers/input/keyboard/adp5585-keys.c b/drivers/input/keyboard/adp5585-keys.c index f2c1ba017d20..ee2c3cb0445f 100644 --- a/drivers/input/keyboard/adp5585-keys.c +++ b/drivers/input/keyboard/adp5585-keys.c @@ -273,7 +273,7 @@ static int adp5585_keys_probe(struct platform_device *pdev) const char *phys; int error; - kpad = devm_kzalloc(dev, sizeof(*kpad), GFP_KERNEL); + kpad = devm_kzalloc_obj(dev, *kpad); if (!kpad) return -ENOMEM; diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index 4f0ddff5baba..dde95f662934 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c @@ -733,7 +733,7 @@ static int adp5588_probe(struct i2c_client *client) return -EIO; } - kpad = devm_kzalloc(&client->dev, sizeof(*kpad), GFP_KERNEL); + kpad = devm_kzalloc_obj(&client->dev, *kpad); if (!kpad) return -ENOMEM; diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c index 7d5ed45845bc..96c504f28495 100644 --- a/drivers/input/keyboard/applespi.c +++ b/drivers/input/keyboard/applespi.c @@ -1621,7 +1621,7 @@ static int applespi_probe(struct spi_device *spi) } /* allocate driver data */ - applespi = devm_kzalloc(&spi->dev, sizeof(*applespi), GFP_KERNEL); + applespi = devm_kzalloc_obj(&spi->dev, *applespi); if (!applespi) return -ENOMEM; diff --git a/drivers/input/keyboard/bcm-keypad.c b/drivers/input/keyboard/bcm-keypad.c index f76cc6e7b787..b22221a6b77c 100644 --- a/drivers/input/keyboard/bcm-keypad.c +++ b/drivers/input/keyboard/bcm-keypad.c @@ -309,7 +309,7 @@ static int bcm_kp_probe(struct platform_device *pdev) struct input_dev *input_dev; int error; - kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL); + kp = devm_kzalloc_obj(&pdev->dev, *kp); if (!kp) return -ENOMEM; diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c index 25b6f7bd97ee..6ef70bc52640 100644 --- a/drivers/input/keyboard/cap11xx.c +++ b/drivers/input/keyboard/cap11xx.c @@ -438,7 +438,7 @@ static int cap11xx_init_leds(struct device *dev, if (cnt > num_leds) return -EINVAL; - led = devm_kcalloc(dev, cnt, sizeof(struct cap11xx_led), GFP_KERNEL); + led = devm_kzalloc_objs(dev, struct cap11xx_led, cnt); if (!led) return -ENOMEM; @@ -520,9 +520,7 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client) return -EINVAL; } - priv = devm_kzalloc(dev, - struct_size(priv, keycodes, cap->num_channels), - GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, keycodes, cap->num_channels); if (!priv) return -ENOMEM; diff --git a/drivers/input/keyboard/charlieplex_keypad.c b/drivers/input/keyboard/charlieplex_keypad.c index d46a2298e6da..58249066bf52 100644 --- a/drivers/input/keyboard/charlieplex_keypad.c +++ b/drivers/input/keyboard/charlieplex_keypad.c @@ -156,7 +156,7 @@ static int charlieplex_keypad_probe(struct platform_device *pdev) unsigned int poll_interval_ms; int err; - keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad), GFP_KERNEL); + keypad = devm_kzalloc_obj(&pdev->dev, *keypad); if (!keypad) return -ENOMEM; diff --git a/drivers/input/keyboard/clps711x-keypad.c b/drivers/input/keyboard/clps711x-keypad.c index 6a21ee17e164..1303dedf9c26 100644 --- a/drivers/input/keyboard/clps711x-keypad.c +++ b/drivers/input/keyboard/clps711x-keypad.c @@ -91,7 +91,7 @@ static int clps711x_keypad_probe(struct platform_device *pdev) u32 poll_interval; int i, err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -103,9 +103,8 @@ static int clps711x_keypad_probe(struct platform_device *pdev) if (priv->row_count < 1) return -EINVAL; - priv->gpio_data = devm_kcalloc(dev, - priv->row_count, sizeof(*priv->gpio_data), - GFP_KERNEL); + priv->gpio_data = devm_kzalloc_objs(dev, *priv->gpio_data, + priv->row_count); if (!priv->gpio_data) return -ENOMEM; diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c index 0a817680171c..cd937ce05398 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -864,7 +864,7 @@ static int cros_ec_keyb_probe(struct platform_device *pdev) if (!cros_ec_device_registered(ec)) return -EPROBE_DEFER; - ckdev = devm_kzalloc(dev, sizeof(*ckdev), GFP_KERNEL); + ckdev = devm_kzalloc_obj(dev, *ckdev); if (!ckdev) return -ENOMEM; diff --git a/drivers/input/keyboard/cypress-sf.c b/drivers/input/keyboard/cypress-sf.c index 4b2ae07f315c..b75e9321b4e4 100644 --- a/drivers/input/keyboard/cypress-sf.c +++ b/drivers/input/keyboard/cypress-sf.c @@ -74,7 +74,7 @@ static int cypress_sf_probe(struct i2c_client *client) struct cypress_sf_data *touchkey; int key, error; - touchkey = devm_kzalloc(&client->dev, sizeof(*touchkey), GFP_KERNEL); + touchkey = devm_kzalloc_obj(&client->dev, *touchkey); if (!touchkey) return -ENOMEM; @@ -100,10 +100,9 @@ static int cypress_sf_probe(struct i2c_client *client) touchkey->num_keys = 2; } - touchkey->keycodes = devm_kcalloc(&client->dev, - touchkey->num_keys, - sizeof(*touchkey->keycodes), - GFP_KERNEL); + touchkey->keycodes = devm_kzalloc_objs(&client->dev, + *touchkey->keycodes, + touchkey->num_keys); if (!touchkey->keycodes) return -ENOMEM; diff --git a/drivers/input/keyboard/dlink-dir685-touchkeys.c b/drivers/input/keyboard/dlink-dir685-touchkeys.c index bf94367f6b64..33117e996cd7 100644 --- a/drivers/input/keyboard/dlink-dir685-touchkeys.c +++ b/drivers/input/keyboard/dlink-dir685-touchkeys.c @@ -68,7 +68,7 @@ static int dir685_tk_probe(struct i2c_client *client) int err; int i; - tk = devm_kzalloc(&client->dev, sizeof(*tk), GFP_KERNEL); + tk = devm_kzalloc_obj(&client->dev, *tk); if (!tk) return -ENOMEM; diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c index 9ea926a4c95b..43d8df53ad4a 100644 --- a/drivers/input/keyboard/ep93xx_keypad.c +++ b/drivers/input/keyboard/ep93xx_keypad.c @@ -206,7 +206,7 @@ static int ep93xx_keypad_probe(struct platform_device *pdev) struct input_dev *input_dev; int err; - keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad), GFP_KERNEL); + keypad = devm_kzalloc_obj(&pdev->dev, *keypad); if (!keypad) return -ENOMEM; diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index fbc31c5db3db..661f2da6054b 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -858,16 +858,14 @@ static int gpio_keys_probe(struct platform_device *pdev) return PTR_ERR(pdata); } - ddata = devm_kzalloc(dev, struct_size(ddata, data, pdata->nbuttons), - GFP_KERNEL); + ddata = devm_kzalloc_flex(dev, *ddata, data, pdata->nbuttons); if (!ddata) { dev_err(dev, "failed to allocate state\n"); return -ENOMEM; } - ddata->keymap = devm_kcalloc(dev, - pdata->nbuttons, sizeof(ddata->keymap[0]), - GFP_KERNEL); + ddata->keymap = devm_kzalloc_objs(dev, ddata->keymap[0], + pdata->nbuttons); if (!ddata->keymap) return -ENOMEM; diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index 4e7a366ff05b..4f00f31bc557 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c @@ -244,8 +244,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) return -EINVAL; } - bdev = devm_kzalloc(dev, struct_size(bdev, data, pdata->nbuttons), - GFP_KERNEL); + bdev = devm_kzalloc_flex(dev, *bdev, data, pdata->nbuttons); if (!bdev) { dev_err(dev, "no memory for private data\n"); return -ENOMEM; diff --git a/drivers/input/keyboard/imx-sm-bbm-key.c b/drivers/input/keyboard/imx-sm-bbm-key.c index 96486bd23d60..ffe496c022a7 100644 --- a/drivers/input/keyboard/imx-sm-bbm-key.c +++ b/drivers/input/keyboard/imx-sm-bbm-key.c @@ -166,7 +166,7 @@ static int scmi_imx_bbm_key_probe(struct scmi_device *sdev) if (!handle) return -ENODEV; - bbnsm = devm_kzalloc(dev, sizeof(*bbnsm), GFP_KERNEL); + bbnsm = devm_kzalloc_obj(dev, *bbnsm); if (!bbnsm) return -ENOMEM; diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c index 6f6f99b28a2c..0284ee600727 100644 --- a/drivers/input/keyboard/imx_keypad.c +++ b/drivers/input/keyboard/imx_keypad.c @@ -432,7 +432,7 @@ static int imx_keypad_probe(struct platform_device *pdev) return -ENOMEM; } - keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad), GFP_KERNEL); + keypad = devm_kzalloc_obj(&pdev->dev, *keypad); if (!keypad) { dev_err(&pdev->dev, "not enough memory for driver data\n"); return -ENOMEM; diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c index b620cd310cdb..a575e4d787b0 100644 --- a/drivers/input/keyboard/imx_sc_key.c +++ b/drivers/input/keyboard/imx_sc_key.c @@ -114,7 +114,7 @@ static int imx_sc_key_probe(struct platform_device *pdev) struct input_dev *input; int error; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/input/keyboard/ipaq-micro-keys.c b/drivers/input/keyboard/ipaq-micro-keys.c index ebd991de70f8..ec43f7524119 100644 --- a/drivers/input/keyboard/ipaq-micro-keys.c +++ b/drivers/input/keyboard/ipaq-micro-keys.c @@ -93,7 +93,7 @@ static int micro_key_probe(struct platform_device *pdev) int error; int i; - keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL); + keys = devm_kzalloc_obj(&pdev->dev, *keys); if (!keys) return -ENOMEM; diff --git a/drivers/input/keyboard/iqs62x-keys.c b/drivers/input/keyboard/iqs62x-keys.c index b086c7b28d5c..4219bb021c45 100644 --- a/drivers/input/keyboard/iqs62x-keys.c +++ b/drivers/input/keyboard/iqs62x-keys.c @@ -251,8 +251,7 @@ static int iqs62x_keys_probe(struct platform_device *pdev) struct input_dev *input; int ret, i; - iqs62x_keys = devm_kzalloc(&pdev->dev, sizeof(*iqs62x_keys), - GFP_KERNEL); + iqs62x_keys = devm_kzalloc_obj(&pdev->dev, *iqs62x_keys); if (!iqs62x_keys) return -ENOMEM; diff --git a/drivers/input/keyboard/jornada680_kbd.c b/drivers/input/keyboard/jornada680_kbd.c index 7e35081393be..40bc06fb9096 100644 --- a/drivers/input/keyboard/jornada680_kbd.c +++ b/drivers/input/keyboard/jornada680_kbd.c @@ -181,8 +181,7 @@ static int jornada680kbd_probe(struct platform_device *pdev) struct input_dev *input_dev; int i, error; - jornadakbd = devm_kzalloc(&pdev->dev, sizeof(struct jornadakbd), - GFP_KERNEL); + jornadakbd = devm_kzalloc_obj(&pdev->dev, struct jornadakbd); if (!jornadakbd) return -ENOMEM; diff --git a/drivers/input/keyboard/jornada720_kbd.c b/drivers/input/keyboard/jornada720_kbd.c index 26b579f0280f..38d657e72ecf 100644 --- a/drivers/input/keyboard/jornada720_kbd.c +++ b/drivers/input/keyboard/jornada720_kbd.c @@ -95,7 +95,7 @@ static int jornada720_kbd_probe(struct platform_device *pdev) if (irq <= 0) return irq < 0 ? irq : -EINVAL; - jornadakbd = devm_kzalloc(&pdev->dev, sizeof(*jornadakbd), GFP_KERNEL); + jornadakbd = devm_kzalloc_obj(&pdev->dev, *jornadakbd); input_dev = devm_input_allocate_device(&pdev->dev); if (!jornadakbd || !input_dev) return -ENOMEM; diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm8323.c index 8eac63b2d304..4b87d3912910 100644 --- a/drivers/input/keyboard/lm8323.c +++ b/drivers/input/keyboard/lm8323.c @@ -645,7 +645,7 @@ static int lm8323_probe(struct i2c_client *client) return -EINVAL; } - lm = devm_kzalloc(&client->dev, sizeof(*lm), GFP_KERNEL); + lm = devm_kzalloc_obj(&client->dev, *lm); if (!lm) return -ENOMEM; diff --git a/drivers/input/keyboard/lm8333.c b/drivers/input/keyboard/lm8333.c index 34be5b2e476d..c35b9db5d92b 100644 --- a/drivers/input/keyboard/lm8333.c +++ b/drivers/input/keyboard/lm8333.c @@ -142,7 +142,7 @@ static int lm8333_probe(struct i2c_client *client) return -EINVAL; } - lm8333 = devm_kzalloc(&client->dev, sizeof(*lm8333), GFP_KERNEL); + lm8333 = devm_kzalloc_obj(&client->dev, *lm8333); if (!lm8333) return -ENOMEM; diff --git a/drivers/input/keyboard/lpc32xx-keys.c b/drivers/input/keyboard/lpc32xx-keys.c index 285d5c32fe70..6abc11b1049e 100644 --- a/drivers/input/keyboard/lpc32xx-keys.c +++ b/drivers/input/keyboard/lpc32xx-keys.c @@ -167,8 +167,7 @@ static int lpc32xx_kscan_probe(struct platform_device *pdev) if (irq < 0) return -EINVAL; - kscandat = devm_kzalloc(&pdev->dev, sizeof(*kscandat), - GFP_KERNEL); + kscandat = devm_kzalloc_obj(&pdev->dev, *kscandat); if (!kscandat) return -ENOMEM; diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index d14d1d727487..11018382e84e 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c @@ -397,7 +397,7 @@ static int matrix_keypad_probe(struct platform_device *pdev) bool wakeup; int err; - keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad), GFP_KERNEL); + keypad = devm_kzalloc_obj(&pdev->dev, *keypad); if (!keypad) return -ENOMEM; diff --git a/drivers/input/keyboard/max7359_keypad.c b/drivers/input/keyboard/max7359_keypad.c index 94ebb875df1f..d2b8adcfc9e5 100644 --- a/drivers/input/keyboard/max7359_keypad.c +++ b/drivers/input/keyboard/max7359_keypad.c @@ -178,8 +178,7 @@ static int max7359_probe(struct i2c_client *client) dev_dbg(&client->dev, "keys FIFO is 0x%02x\n", ret); - keypad = devm_kzalloc(&client->dev, sizeof(struct max7359_keypad), - GFP_KERNEL); + keypad = devm_kzalloc_obj(&client->dev, struct max7359_keypad); if (!keypad) { dev_err(&client->dev, "failed to allocate memory\n"); return -ENOMEM; diff --git a/drivers/input/keyboard/max7360-keypad.c b/drivers/input/keyboard/max7360-keypad.c index 1e5251f87f6f..11a78f937039 100644 --- a/drivers/input/keyboard/max7360-keypad.c +++ b/drivers/input/keyboard/max7360-keypad.c @@ -234,7 +234,7 @@ static int max7360_keypad_probe(struct platform_device *pdev) if (irq < 0) return dev_err_probe(dev, irq, "Failed to get IRQ\n"); - max7360_keypad = devm_kzalloc(dev, sizeof(*max7360_keypad), GFP_KERNEL); + max7360_keypad = devm_kzalloc_obj(dev, *max7360_keypad); if (!max7360_keypad) return -ENOMEM; diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c index 204426834371..06329cf5c749 100644 --- a/drivers/input/keyboard/mpr121_touchkey.c +++ b/drivers/input/keyboard/mpr121_touchkey.c @@ -208,7 +208,7 @@ static int mpr_touchkey_probe(struct i2c_client *client) if (vdd_uv < 0) return dev_err_probe(dev, vdd_uv, "failed to get vdd voltage\n"); - mpr121 = devm_kzalloc(dev, sizeof(*mpr121), GFP_KERNEL); + mpr121 = devm_kzalloc_obj(dev, *mpr121); if (!mpr121) return -ENOMEM; diff --git a/drivers/input/keyboard/mt6779-keypad.c b/drivers/input/keyboard/mt6779-keypad.c index e5eb025c5e99..60e6ad97cf59 100644 --- a/drivers/input/keyboard/mt6779-keypad.c +++ b/drivers/input/keyboard/mt6779-keypad.c @@ -118,7 +118,7 @@ static int mt6779_keypad_pdrv_probe(struct platform_device *pdev) bool wakeup; int error; - keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad), GFP_KERNEL); + keypad = devm_kzalloc_obj(&pdev->dev, *keypad); if (!keypad) return -ENOMEM; diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index c78d9f6d97c4..6f14318f3b87 100644 --- a/drivers/input/keyboard/mtk-pmic-keys.c +++ b/drivers/input/keyboard/mtk-pmic-keys.c @@ -336,7 +336,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) const struct of_device_id *of_id = of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev); - keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL); + keys = devm_kzalloc_obj(&pdev->dev, *keys); if (!keys) return -ENOMEM; diff --git a/drivers/input/keyboard/nspire-keypad.c b/drivers/input/keyboard/nspire-keypad.c index 096c18d7bca1..6d9016af5c6b 100644 --- a/drivers/input/keyboard/nspire-keypad.c +++ b/drivers/input/keyboard/nspire-keypad.c @@ -155,8 +155,7 @@ static int nspire_keypad_probe(struct platform_device *pdev) if (irq < 0) return -EINVAL; - keypad = devm_kzalloc(&pdev->dev, sizeof(struct nspire_keypad), - GFP_KERNEL); + keypad = devm_kzalloc_obj(&pdev->dev, struct nspire_keypad); if (!keypad) { dev_err(&pdev->dev, "failed to allocate keypad memory\n"); return -ENOMEM; diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index e783244d0c91..bf652b0f479d 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c @@ -352,7 +352,7 @@ static int omap4_keypad_probe(struct platform_device *pdev) if (irq < 0) return irq; - keypad_data = devm_kzalloc(dev, sizeof(*keypad_data), GFP_KERNEL); + keypad_data = devm_kzalloc_obj(dev, *keypad_data); if (!keypad_data) { dev_err(dev, "keypad_data memory allocation failed\n"); return -ENOMEM; @@ -427,10 +427,8 @@ static int omap4_keypad_probe(struct platform_device *pdev) keypad_data->row_shift = get_count_order(keypad_data->cols); max_keys = keypad_data->rows << keypad_data->row_shift; - keypad_data->keymap = devm_kcalloc(dev, - max_keys, - sizeof(keypad_data->keymap[0]), - GFP_KERNEL); + keypad_data->keymap = devm_kzalloc_objs(dev, keypad_data->keymap[0], + max_keys); if (!keypad_data->keymap) { dev_err(dev, "Not enough memory for keymap\n"); return -ENOMEM; diff --git a/drivers/input/keyboard/opencores-kbd.c b/drivers/input/keyboard/opencores-kbd.c index 7ffe1a70c856..374997f35f01 100644 --- a/drivers/input/keyboard/opencores-kbd.c +++ b/drivers/input/keyboard/opencores-kbd.c @@ -45,8 +45,7 @@ static int opencores_kbd_probe(struct platform_device *pdev) if (irq < 0) return -EINVAL; - opencores_kbd = devm_kzalloc(&pdev->dev, sizeof(*opencores_kbd), - GFP_KERNEL); + opencores_kbd = devm_kzalloc_obj(&pdev->dev, *opencores_kbd); if (!opencores_kbd) return -ENOMEM; diff --git a/drivers/input/keyboard/pinephone-keyboard.c b/drivers/input/keyboard/pinephone-keyboard.c index 86f21045c69b..b4a02ade3a80 100644 --- a/drivers/input/keyboard/pinephone-keyboard.c +++ b/drivers/input/keyboard/pinephone-keyboard.c @@ -365,7 +365,7 @@ static int ppkb_probe(struct i2c_client *client) if (error) return error; - ppkb = devm_kzalloc(dev, sizeof(*ppkb), GFP_KERNEL); + ppkb = devm_kzalloc_obj(dev, *ppkb); if (!ppkb) return -ENOMEM; diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c index c916e80e2f58..a929f2c75854 100644 --- a/drivers/input/keyboard/pmic8xxx-keypad.c +++ b/drivers/input/keyboard/pmic8xxx-keypad.c @@ -517,7 +517,7 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev) /* legacy name */ of_property_read_bool(np, "linux,keypad-wakeup"); - kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL); + kp = devm_kzalloc_obj(&pdev->dev, *kp); if (!kp) return -ENOMEM; diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 059bce760401..0a5b6a97bac3 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c @@ -619,8 +619,7 @@ static int pxa27x_keypad_probe(struct platform_device *pdev) if (irq < 0) return -ENXIO; - keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad), - GFP_KERNEL); + keypad = devm_kzalloc_obj(&pdev->dev, *keypad); if (!keypad) return -ENOMEM; diff --git a/drivers/input/keyboard/qt1050.c b/drivers/input/keyboard/qt1050.c index c6ab8e501f83..98611d126d4b 100644 --- a/drivers/input/keyboard/qt1050.c +++ b/drivers/input/keyboard/qt1050.c @@ -446,7 +446,7 @@ static int qt1050_probe(struct i2c_client *client) return -EINVAL; } - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/keyboard/qt1070.c b/drivers/input/keyboard/qt1070.c index e31cb115a954..b21b6d36fcc0 100644 --- a/drivers/input/keyboard/qt1070.c +++ b/drivers/input/keyboard/qt1070.c @@ -148,8 +148,7 @@ static int qt1070_probe(struct i2c_client *client) if (!qt1070_identify(client)) return -ENODEV; - data = devm_kzalloc(&client->dev, sizeof(struct qt1070_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct qt1070_data); if (!data) return -ENOMEM; diff --git a/drivers/input/keyboard/qt2160.c b/drivers/input/keyboard/qt2160.c index e64adaca10ff..e045475dbc5f 100644 --- a/drivers/input/keyboard/qt2160.c +++ b/drivers/input/keyboard/qt2160.c @@ -322,7 +322,7 @@ static int qt2160_probe(struct i2c_client *client) return -ENODEV; /* Chip is valid and active. Allocate structure */ - qt2160 = devm_kzalloc(&client->dev, sizeof(*qt2160), GFP_KERNEL); + qt2160 = devm_kzalloc_obj(&client->dev, *qt2160); if (!qt2160) return -ENOMEM; diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index f56c5249401d..021d6cb6863f 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c @@ -299,10 +299,8 @@ static int samsung_keypad_probe(struct platform_device *pdev) row_shift = get_count_order(num_cols); - keypad = devm_kzalloc(&pdev->dev, - struct_size(keypad, keycodes, - num_rows << row_shift), - GFP_KERNEL); + keypad = devm_kzalloc_flex(&pdev->dev, *keypad, keycodes, + num_rows << row_shift); if (!keypad) return -ENOMEM; diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c index 72d43d8deb78..33bc3bd0b222 100644 --- a/drivers/input/keyboard/snvs_pwrkey.c +++ b/drivers/input/keyboard/snvs_pwrkey.c @@ -163,7 +163,7 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) if (!np) return dev_err_probe(dev, -ENODEV, "Device tree node not found\n"); - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index 53f3ac64c980..6e2b35349dc4 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c @@ -153,7 +153,7 @@ static int spear_kbd_probe(struct platform_device *pdev) if (irq < 0) return irq; - kbd = devm_kzalloc(&pdev->dev, sizeof(*kbd), GFP_KERNEL); + kbd = devm_kzalloc_obj(&pdev->dev, *kbd); if (!kbd) { dev_err(&pdev->dev, "not enough memory for driver data\n"); return -ENOMEM; diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c index 2fbdf373fe99..977685e62625 100644 --- a/drivers/input/keyboard/st-keyscan.c +++ b/drivers/input/keyboard/st-keyscan.c @@ -136,8 +136,7 @@ static int keyscan_probe(struct platform_device *pdev) return -EINVAL; } - keypad_data = devm_kzalloc(&pdev->dev, sizeof(*keypad_data), - GFP_KERNEL); + keypad_data = devm_kzalloc_obj(&pdev->dev, *keypad_data); if (!keypad_data) return -ENOMEM; diff --git a/drivers/input/keyboard/stmpe-keypad.c b/drivers/input/keyboard/stmpe-keypad.c index bc5d0217be5c..c295caeecfe0 100644 --- a/drivers/input/keyboard/stmpe-keypad.c +++ b/drivers/input/keyboard/stmpe-keypad.c @@ -343,8 +343,7 @@ static int stmpe_keypad_probe(struct platform_device *pdev) if (irq < 0) return irq; - keypad = devm_kzalloc(&pdev->dev, sizeof(struct stmpe_keypad), - GFP_KERNEL); + keypad = devm_kzalloc_obj(&pdev->dev, struct stmpe_keypad); if (!keypad) return -ENOMEM; diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c index 5730f08f82d7..05983db3f0d3 100644 --- a/drivers/input/keyboard/sun4i-lradc-keys.c +++ b/drivers/input/keyboard/sun4i-lradc-keys.c @@ -215,9 +215,8 @@ static int sun4i_lradc_load_dt_keymap(struct device *dev, return -EINVAL; } - lradc->chan0_map = devm_kmalloc_array(dev, lradc->chan0_map_count, - sizeof(struct sun4i_lradc_keymap), - GFP_KERNEL); + lradc->chan0_map = devm_kmalloc_objs(dev, struct sun4i_lradc_keymap, + lradc->chan0_map_count); if (!lradc->chan0_map) return -ENOMEM; @@ -256,7 +255,7 @@ static int sun4i_lradc_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int error, i, irq; - lradc = devm_kzalloc(dev, sizeof(struct sun4i_lradc_data), GFP_KERNEL); + lradc = devm_kzalloc_obj(dev, struct sun4i_lradc_data); if (!lradc) return -ENOMEM; diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c index 137f9fa554f0..b9232969310c 100644 --- a/drivers/input/keyboard/tc3589x-keypad.c +++ b/drivers/input/keyboard/tc3589x-keypad.c @@ -329,7 +329,7 @@ tc3589x_keypad_of_probe(struct device *dev) if (!np) return ERR_PTR(-ENODEV); - plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL); + plat = devm_kzalloc_obj(dev, *plat); if (!plat) return ERR_PTR(-ENOMEM); @@ -388,8 +388,7 @@ static int tc3589x_keypad_probe(struct platform_device *pdev) if (irq < 0) return irq; - keypad = devm_kzalloc(&pdev->dev, sizeof(struct tc_keypad), - GFP_KERNEL); + keypad = devm_kzalloc_obj(&pdev->dev, struct tc_keypad); if (!keypad) return -ENOMEM; diff --git a/drivers/input/keyboard/tca8418_keypad.c b/drivers/input/keyboard/tca8418_keypad.c index 4616afa0286c..363a48098dfb 100644 --- a/drivers/input/keyboard/tca8418_keypad.c +++ b/drivers/input/keyboard/tca8418_keypad.c @@ -293,7 +293,7 @@ static int tca8418_keypad_probe(struct i2c_client *client) row_shift = get_count_order(cols); /* Allocate memory for keypad_data and input device */ - keypad_data = devm_kzalloc(dev, sizeof(*keypad_data), GFP_KERNEL); + keypad_data = devm_kzalloc_obj(dev, *keypad_data); if (!keypad_data) return -ENOMEM; diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index e6177f2bdf8d..d0ca6b747b6d 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c @@ -578,7 +578,7 @@ static int tegra_kbc_probe(struct platform_device *pdev) unsigned int scan_time_rows; unsigned int keymap_rows; - kbc = devm_kzalloc(&pdev->dev, sizeof(*kbc), GFP_KERNEL); + kbc = devm_kzalloc_obj(&pdev->dev, *kbc); if (!kbc) { dev_err(&pdev->dev, "failed to alloc memory for kbc\n"); return -ENOMEM; diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c index 967bbe553c06..2f5ea04a4602 100644 --- a/drivers/input/keyboard/tm2-touchkey.c +++ b/drivers/input/keyboard/tm2-touchkey.c @@ -193,7 +193,7 @@ static int tm2_touchkey_probe(struct i2c_client *client) return -EIO; } - touchkey = devm_kzalloc(&client->dev, sizeof(*touchkey), GFP_KERNEL); + touchkey = devm_kzalloc_obj(&client->dev, *touchkey); if (!touchkey) return -ENOMEM; diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c index 5e3d17c5dc9b..4bb34e337d8e 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c @@ -322,7 +322,7 @@ static int twl4030_kp_probe(struct platform_device *pdev) u8 reg; int error; - kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL); + kp = devm_kzalloc_obj(&pdev->dev, *kp); if (!kp) return -ENOMEM; diff --git a/drivers/input/matrix-keymap.c b/drivers/input/matrix-keymap.c index e4227e96aa4e..0724c445ab59 100644 --- a/drivers/input/matrix-keymap.c +++ b/drivers/input/matrix-keymap.c @@ -162,9 +162,8 @@ int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data, return -EINVAL; if (!keymap) { - keymap = devm_kcalloc(input_dev->dev.parent, - max_keys, sizeof(*keymap), - GFP_KERNEL); + keymap = devm_kzalloc_objs(input_dev->dev.parent, *keymap, + max_keys); if (!keymap) { dev_err(input_dev->dev.parent, "Unable to allocate memory for keymap"); diff --git a/drivers/input/misc/88pm860x_onkey.c b/drivers/input/misc/88pm860x_onkey.c index 2d398119a620..813bfb840ac6 100644 --- a/drivers/input/misc/88pm860x_onkey.c +++ b/drivers/input/misc/88pm860x_onkey.c @@ -67,8 +67,7 @@ static int pm860x_onkey_probe(struct platform_device *pdev) if (irq < 0) return -EINVAL; - info = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_onkey_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct pm860x_onkey_info); if (!info) return -ENOMEM; info->chip = chip; diff --git a/drivers/input/misc/88pm886-onkey.c b/drivers/input/misc/88pm886-onkey.c index 284ff5190b6e..01668ee33b16 100644 --- a/drivers/input/misc/88pm886-onkey.c +++ b/drivers/input/misc/88pm886-onkey.c @@ -42,7 +42,7 @@ static int pm886_onkey_probe(struct platform_device *pdev) struct input_dev *idev; int irq, err; - onkey = devm_kzalloc(dev, sizeof(*onkey), GFP_KERNEL); + onkey = devm_kzalloc_obj(dev, *onkey); if (!onkey) return -ENOMEM; diff --git a/drivers/input/misc/ab8500-ponkey.c b/drivers/input/misc/ab8500-ponkey.c index 4ace4739eee2..b631f18ef8cf 100644 --- a/drivers/input/misc/ab8500-ponkey.c +++ b/drivers/input/misc/ab8500-ponkey.c @@ -62,8 +62,7 @@ static int ab8500_ponkey_probe(struct platform_device *pdev) if (irq_dbr < 0) return irq_dbr; - ponkey = devm_kzalloc(&pdev->dev, sizeof(struct ab8500_ponkey), - GFP_KERNEL); + ponkey = devm_kzalloc_obj(&pdev->dev, struct ab8500_ponkey); if (!ponkey) return -ENOMEM; diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c index ac7674647c09..2dc9fd1b5c6a 100644 --- a/drivers/input/misc/adxl34x.c +++ b/drivers/input/misc/adxl34x.c @@ -695,7 +695,7 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq, return ERR_PTR(-ENODEV); } - ac = devm_kzalloc(dev, sizeof(*ac), GFP_KERNEL); + ac = devm_kzalloc_obj(dev, *ac); if (!ac) return ERR_PTR(-ENOMEM); diff --git a/drivers/input/misc/apanel.c b/drivers/input/misc/apanel.c index 3eb02a64acfb..0edc8a2cd2dc 100644 --- a/drivers/input/misc/apanel.c +++ b/drivers/input/misc/apanel.c @@ -127,7 +127,7 @@ static int apanel_probe(struct i2c_client *client) u8 cmd = device_chip[APANEL_DEV_APPBTN] == CHIP_OZ992C ? 0 : 8; int i, err; - ap = devm_kzalloc(&client->dev, sizeof(*ap), GFP_KERNEL); + ap = devm_kzalloc_obj(&client->dev, *ap); if (!ap) return -ENOMEM; diff --git a/drivers/input/misc/ariel-pwrbutton.c b/drivers/input/misc/ariel-pwrbutton.c index e22f8985e7eb..986e8a38196d 100644 --- a/drivers/input/misc/ariel-pwrbutton.c +++ b/drivers/input/misc/ariel-pwrbutton.c @@ -102,7 +102,7 @@ static int ariel_pwrbutton_probe(struct spi_device *spi) return -EINVAL; } - priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&spi->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/input/misc/arizona-haptics.c b/drivers/input/misc/arizona-haptics.c index bb1544d63c51..cae4c3f0da9b 100644 --- a/drivers/input/misc/arizona-haptics.c +++ b/drivers/input/misc/arizona-haptics.c @@ -151,7 +151,7 @@ static int arizona_haptics_probe(struct platform_device *pdev) struct arizona_haptics *haptics; int ret; - haptics = devm_kzalloc(&pdev->dev, sizeof(*haptics), GFP_KERNEL); + haptics = devm_kzalloc_obj(&pdev->dev, *haptics); if (!haptics) return -ENOMEM; diff --git a/drivers/input/misc/atc260x-onkey.c b/drivers/input/misc/atc260x-onkey.c index 999aabf9dcbd..587c797d3ae4 100644 --- a/drivers/input/misc/atc260x-onkey.c +++ b/drivers/input/misc/atc260x-onkey.c @@ -196,7 +196,7 @@ static int atc260x_onkey_probe(struct platform_device *pdev) u32 press_time = KEY_PRESS_TIME_SEC, reset_time = 0; int val, error; - onkey = devm_kzalloc(&pdev->dev, sizeof(*onkey), GFP_KERNEL); + onkey = devm_kzalloc_obj(&pdev->dev, *onkey); if (!onkey) return -ENOMEM; diff --git a/drivers/input/misc/atlas_btns.c b/drivers/input/misc/atlas_btns.c index e77e53ee9d41..1fa7ee6343eb 100644 --- a/drivers/input/misc/atlas_btns.c +++ b/drivers/input/misc/atlas_btns.c @@ -74,7 +74,7 @@ static int atlas_acpi_button_probe(struct platform_device *pdev) if (!device) return -ENODEV; - atlas = devm_kzalloc(&pdev->dev, sizeof(*atlas), GFP_KERNEL); + atlas = devm_kzalloc_obj(&pdev->dev, *atlas); if (!atlas) return -ENOMEM; diff --git a/drivers/input/misc/atmel_captouch.c b/drivers/input/misc/atmel_captouch.c index fc4abea68479..45a9eb7561f2 100644 --- a/drivers/input/misc/atmel_captouch.c +++ b/drivers/input/misc/atmel_captouch.c @@ -177,7 +177,7 @@ static int atmel_captouch_probe(struct i2c_client *client) return -EINVAL; } - capdev = devm_kzalloc(dev, sizeof(*capdev), GFP_KERNEL); + capdev = devm_kzalloc_obj(dev, *capdev); if (!capdev) return -ENOMEM; diff --git a/drivers/input/misc/aw86927.c b/drivers/input/misc/aw86927.c index f53b8f004cb3..0657c52b4c79 100644 --- a/drivers/input/misc/aw86927.c +++ b/drivers/input/misc/aw86927.c @@ -766,7 +766,7 @@ static int aw86927_probe(struct i2c_client *client) struct aw86927_data *haptics; int err; - haptics = devm_kzalloc(&client->dev, sizeof(struct aw86927_data), GFP_KERNEL); + haptics = devm_kzalloc_obj(&client->dev, struct aw86927_data); if (!haptics) return -ENOMEM; diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c index c34e002258ee..cbbc9db33ad2 100644 --- a/drivers/input/misc/axp20x-pek.c +++ b/drivers/input/misc/axp20x-pek.c @@ -306,8 +306,7 @@ static int axp20x_pek_probe(struct platform_device *pdev) return -EINVAL; } - axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek), - GFP_KERNEL); + axp20x_pek = devm_kzalloc_obj(&pdev->dev, struct axp20x_pek); if (!axp20x_pek) return -ENOMEM; diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c index 0ef282932095..16aecc9b5ef4 100644 --- a/drivers/input/misc/bma150.c +++ b/drivers/input/misc/bma150.c @@ -435,7 +435,7 @@ static int bma150_probe(struct i2c_client *client) return -EINVAL; } - bma150 = devm_kzalloc(&client->dev, sizeof(*bma150), GFP_KERNEL); + bma150 = devm_kzalloc_obj(&client->dev, *bma150); if (!bma150) return -ENOMEM; diff --git a/drivers/input/misc/cobalt_btns.c b/drivers/input/misc/cobalt_btns.c index b1624f5414ee..aebfec8f8618 100644 --- a/drivers/input/misc/cobalt_btns.c +++ b/drivers/input/misc/cobalt_btns.c @@ -65,7 +65,7 @@ static int cobalt_buttons_probe(struct platform_device *pdev) struct resource *res; int error, i; - bdev = devm_kzalloc(&pdev->dev, sizeof(*bdev), GFP_KERNEL); + bdev = devm_kzalloc_obj(&pdev->dev, *bdev); if (!bdev) return -ENOMEM; diff --git a/drivers/input/misc/cpcap-pwrbutton.c b/drivers/input/misc/cpcap-pwrbutton.c index 85cddb84717a..89b92612ddd8 100644 --- a/drivers/input/misc/cpcap-pwrbutton.c +++ b/drivers/input/misc/cpcap-pwrbutton.c @@ -53,7 +53,7 @@ static int cpcap_power_button_probe(struct platform_device *pdev) if (irq < 0) return irq; - button = devm_kmalloc(&pdev->dev, sizeof(*button), GFP_KERNEL); + button = devm_kmalloc_obj(&pdev->dev, *button); if (!button) return -ENOMEM; diff --git a/drivers/input/misc/cs40l50-vibra.c b/drivers/input/misc/cs40l50-vibra.c index 7ef4534fea2f..f95092eccd92 100644 --- a/drivers/input/misc/cs40l50-vibra.c +++ b/drivers/input/misc/cs40l50-vibra.c @@ -493,7 +493,7 @@ static int cs40l50_vibra_probe(struct platform_device *pdev) struct cs40l50_vibra *vib; int error; - vib = devm_kzalloc(pdev->dev.parent, sizeof(*vib), GFP_KERNEL); + vib = devm_kzalloc_obj(pdev->dev.parent, *vib); if (!vib) return -ENOMEM; diff --git a/drivers/input/misc/da7280.c b/drivers/input/misc/da7280.c index e607836efb50..995d3f7af41a 100644 --- a/drivers/input/misc/da7280.c +++ b/drivers/input/misc/da7280.c @@ -1153,7 +1153,7 @@ static int da7280_probe(struct i2c_client *client) return -EINVAL; } - haptics = devm_kzalloc(dev, sizeof(*haptics), GFP_KERNEL); + haptics = devm_kzalloc_obj(dev, *haptics); if (!haptics) return -ENOMEM; diff --git a/drivers/input/misc/da9055_onkey.c b/drivers/input/misc/da9055_onkey.c index 3e4fc2f01011..e2cc101e4c12 100644 --- a/drivers/input/misc/da9055_onkey.c +++ b/drivers/input/misc/da9055_onkey.c @@ -79,7 +79,7 @@ static int da9055_onkey_probe(struct platform_device *pdev) if (irq < 0) return -EINVAL; - onkey = devm_kzalloc(&pdev->dev, sizeof(*onkey), GFP_KERNEL); + onkey = devm_kzalloc_obj(&pdev->dev, *onkey); if (!onkey) { dev_err(&pdev->dev, "Failed to allocate memory\n"); return -ENOMEM; diff --git a/drivers/input/misc/da9063_onkey.c b/drivers/input/misc/da9063_onkey.c index 830714241788..98297ca1dc12 100644 --- a/drivers/input/misc/da9063_onkey.c +++ b/drivers/input/misc/da9063_onkey.c @@ -183,8 +183,7 @@ static int da9063_onkey_probe(struct platform_device *pdev) int error; int irq; - onkey = devm_kzalloc(&pdev->dev, sizeof(struct da9063_onkey), - GFP_KERNEL); + onkey = devm_kzalloc_obj(&pdev->dev, struct da9063_onkey); if (!onkey) return -ENOMEM; diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c index 8a3d74d65d63..ecc47d90eff3 100644 --- a/drivers/input/misc/drv260x.c +++ b/drivers/input/misc/drv260x.c @@ -448,7 +448,7 @@ static int drv260x_probe(struct i2c_client *client) u32 voltage; int error; - haptics = devm_kzalloc(dev, sizeof(*haptics), GFP_KERNEL); + haptics = devm_kzalloc_obj(dev, *haptics); if (!haptics) return -ENOMEM; diff --git a/drivers/input/misc/drv2665.c b/drivers/input/misc/drv2665.c index 134d65fdcf2d..90407f8797c7 100644 --- a/drivers/input/misc/drv2665.c +++ b/drivers/input/misc/drv2665.c @@ -161,7 +161,7 @@ static int drv2665_probe(struct i2c_client *client) struct drv2665_data *haptics; int error; - haptics = devm_kzalloc(&client->dev, sizeof(*haptics), GFP_KERNEL); + haptics = devm_kzalloc_obj(&client->dev, *haptics); if (!haptics) return -ENOMEM; diff --git a/drivers/input/misc/drv2667.c b/drivers/input/misc/drv2667.c index bbda7b4cbdcb..18cf689d7ef7 100644 --- a/drivers/input/misc/drv2667.c +++ b/drivers/input/misc/drv2667.c @@ -338,7 +338,7 @@ static int drv2667_probe(struct i2c_client *client) struct drv2667_data *haptics; int error; - haptics = devm_kzalloc(&client->dev, sizeof(*haptics), GFP_KERNEL); + haptics = devm_kzalloc_obj(&client->dev, *haptics); if (!haptics) return -ENOMEM; diff --git a/drivers/input/misc/gpio-beeper.c b/drivers/input/misc/gpio-beeper.c index 3d65cb4f4ef3..cdfa454b5d37 100644 --- a/drivers/input/misc/gpio-beeper.c +++ b/drivers/input/misc/gpio-beeper.c @@ -63,7 +63,7 @@ static int gpio_beeper_probe(struct platform_device *pdev) struct gpio_beeper *beep; struct input_dev *input; - beep = devm_kzalloc(&pdev->dev, sizeof(*beep), GFP_KERNEL); + beep = devm_kzalloc_obj(&pdev->dev, *beep); if (!beep) return -ENOMEM; diff --git a/drivers/input/misc/gpio-vibra.c b/drivers/input/misc/gpio-vibra.c index ad44b4d18a2a..5e83d246dbc1 100644 --- a/drivers/input/misc/gpio-vibra.c +++ b/drivers/input/misc/gpio-vibra.c @@ -104,7 +104,7 @@ static int gpio_vibrator_probe(struct platform_device *pdev) struct gpio_vibrator *vibrator; int err; - vibrator = devm_kzalloc(&pdev->dev, sizeof(*vibrator), GFP_KERNEL); + vibrator = devm_kzalloc_obj(&pdev->dev, *vibrator); if (!vibrator) return -ENOMEM; diff --git a/drivers/input/misc/gpio_decoder.c b/drivers/input/misc/gpio_decoder.c index 0e4a49845afa..f4e620ac16a3 100644 --- a/drivers/input/misc/gpio_decoder.c +++ b/drivers/input/misc/gpio_decoder.c @@ -63,7 +63,7 @@ static int gpio_decoder_probe(struct platform_device *pdev) u32 max; int err; - decoder = devm_kzalloc(dev, sizeof(*decoder), GFP_KERNEL); + decoder = devm_kzalloc_obj(dev, *decoder); if (!decoder) return -ENOMEM; diff --git a/drivers/input/misc/ibm-panel.c b/drivers/input/misc/ibm-panel.c index aa48f62d7ea0..fb5721286a82 100644 --- a/drivers/input/misc/ibm-panel.c +++ b/drivers/input/misc/ibm-panel.c @@ -122,7 +122,7 @@ static int ibm_panel_probe(struct i2c_client *client) int i; int error; - panel = devm_kzalloc(&client->dev, sizeof(*panel), GFP_KERNEL); + panel = devm_kzalloc_obj(&client->dev, *panel); if (!panel) return -ENOMEM; diff --git a/drivers/input/misc/iqs269a.c b/drivers/input/misc/iqs269a.c index 7a576f65bfca..fdac1ad441d9 100644 --- a/drivers/input/misc/iqs269a.c +++ b/drivers/input/misc/iqs269a.c @@ -1813,7 +1813,7 @@ static int iqs269_probe(struct i2c_client *client) struct iqs269_private *iqs269; int error; - iqs269 = devm_kzalloc(&client->dev, sizeof(*iqs269), GFP_KERNEL); + iqs269 = devm_kzalloc_obj(&client->dev, *iqs269); if (!iqs269) return -ENOMEM; diff --git a/drivers/input/misc/iqs626a.c b/drivers/input/misc/iqs626a.c index bc50dfba9e6c..ad7d4d01cfcb 100644 --- a/drivers/input/misc/iqs626a.c +++ b/drivers/input/misc/iqs626a.c @@ -1630,7 +1630,7 @@ static int iqs626_probe(struct i2c_client *client) struct iqs626_private *iqs626; int error; - iqs626 = devm_kzalloc(&client->dev, sizeof(*iqs626), GFP_KERNEL); + iqs626 = devm_kzalloc_obj(&client->dev, *iqs626); if (!iqs626) return -ENOMEM; diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c index 5fc11986462a..0671542ef8de 100644 --- a/drivers/input/misc/iqs7222.c +++ b/drivers/input/misc/iqs7222.c @@ -3056,7 +3056,7 @@ static int iqs7222_probe(struct i2c_client *client) unsigned long irq_flags; int error, irq; - iqs7222 = devm_kzalloc(&client->dev, sizeof(*iqs7222), GFP_KERNEL); + iqs7222 = devm_kzalloc_obj(&client->dev, *iqs7222); if (!iqs7222) return -ENOMEM; diff --git a/drivers/input/misc/isa1200.c b/drivers/input/misc/isa1200.c index 926cffcd38d6..8885c13c57d5 100644 --- a/drivers/input/misc/isa1200.c +++ b/drivers/input/misc/isa1200.c @@ -435,7 +435,7 @@ static int isa1200_probe(struct i2c_client *client) struct device *dev = &client->dev; int err; - isa = devm_kzalloc(dev, sizeof(*isa), GFP_KERNEL); + isa = devm_kzalloc_obj(dev, *isa); if (!isa) return -ENOMEM; diff --git a/drivers/input/misc/kxtj9.c b/drivers/input/misc/kxtj9.c index 6b3495ba5763..64f8b9fad2fa 100644 --- a/drivers/input/misc/kxtj9.c +++ b/drivers/input/misc/kxtj9.c @@ -411,7 +411,7 @@ static int kxtj9_probe(struct i2c_client *client) return -EINVAL; } - tj9 = devm_kzalloc(&client->dev, sizeof(*tj9), GFP_KERNEL); + tj9 = devm_kzalloc_obj(&client->dev, *tj9); if (!tj9) { dev_err(&client->dev, "failed to allocate memory for module data\n"); diff --git a/drivers/input/misc/max7360-rotary.c b/drivers/input/misc/max7360-rotary.c index 385831ef34b6..d262931be963 100644 --- a/drivers/input/misc/max7360-rotary.c +++ b/drivers/input/misc/max7360-rotary.c @@ -113,7 +113,7 @@ static int max7360_rotary_probe(struct platform_device *pdev) if (irq < 0) return dev_err_probe(dev, irq, "Failed to get IRQ\n"); - max7360_rotary = devm_kzalloc(dev, sizeof(*max7360_rotary), GFP_KERNEL); + max7360_rotary = devm_kzalloc_obj(dev, *max7360_rotary); if (!max7360_rotary) return -ENOMEM; diff --git a/drivers/input/misc/max77650-onkey.c b/drivers/input/misc/max77650-onkey.c index ee55f22dbca5..b0fd04076779 100644 --- a/drivers/input/misc/max77650-onkey.c +++ b/drivers/input/misc/max77650-onkey.c @@ -57,7 +57,7 @@ static int max77650_onkey_probe(struct platform_device *pdev) if (!map) return -ENODEV; - onkey = devm_kzalloc(dev, sizeof(*onkey), GFP_KERNEL); + onkey = devm_kzalloc_obj(dev, *onkey); if (!onkey) return -ENOMEM; diff --git a/drivers/input/misc/max77693-haptic.c b/drivers/input/misc/max77693-haptic.c index 10325c1296da..96d6d4620eb4 100644 --- a/drivers/input/misc/max77693-haptic.c +++ b/drivers/input/misc/max77693-haptic.c @@ -306,7 +306,7 @@ static int max77693_haptic_probe(struct platform_device *pdev) struct max77693_haptic *haptic; int error; - haptic = devm_kzalloc(&pdev->dev, sizeof(*haptic), GFP_KERNEL); + haptic = devm_kzalloc_obj(&pdev->dev, *haptic); if (!haptic) return -ENOMEM; diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c index d185b3ca353d..7f9c3ebf44b4 100644 --- a/drivers/input/misc/max8925_onkey.c +++ b/drivers/input/misc/max8925_onkey.c @@ -78,8 +78,7 @@ static int max8925_onkey_probe(struct platform_device *pdev) if (irq[1] < 0) return -EINVAL; - info = devm_kzalloc(&pdev->dev, sizeof(struct max8925_onkey_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct max8925_onkey_info); if (!info) return -ENOMEM; diff --git a/drivers/input/misc/nxp-bbnsm-pwrkey.c b/drivers/input/misc/nxp-bbnsm-pwrkey.c index 0c7b8f8ef4a5..ef823efb2da0 100644 --- a/drivers/input/misc/nxp-bbnsm-pwrkey.c +++ b/drivers/input/misc/nxp-bbnsm-pwrkey.c @@ -115,7 +115,7 @@ static int bbnsm_pwrkey_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; int error; - bbnsm = devm_kzalloc(&pdev->dev, sizeof(*bbnsm), GFP_KERNEL); + bbnsm = devm_kzalloc_obj(&pdev->dev, *bbnsm); if (!bbnsm) return -ENOMEM; diff --git a/drivers/input/misc/pf1550-onkey.c b/drivers/input/misc/pf1550-onkey.c index 0d1b570bbe47..72aac83e9054 100644 --- a/drivers/input/misc/pf1550-onkey.c +++ b/drivers/input/misc/pf1550-onkey.c @@ -64,7 +64,7 @@ static int pf1550_onkey_probe(struct platform_device *pdev) bool key_power = false; int i, irq, error; - onkey = devm_kzalloc(&pdev->dev, sizeof(*onkey), GFP_KERNEL); + onkey = devm_kzalloc_obj(&pdev->dev, *onkey); if (!onkey) return -ENOMEM; diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c index 53249d2c081f..34b4afbb1984 100644 --- a/drivers/input/misc/pm8941-pwrkey.c +++ b/drivers/input/misc/pm8941-pwrkey.c @@ -263,7 +263,7 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev) pull_up = of_property_read_bool(pdev->dev.of_node, "bias-pull-up"); - pwrkey = devm_kzalloc(&pdev->dev, sizeof(*pwrkey), GFP_KERNEL); + pwrkey = devm_kzalloc_obj(&pdev->dev, *pwrkey); if (!pwrkey) return -ENOMEM; diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c index 381b06473279..03a77443e0be 100644 --- a/drivers/input/misc/pm8xxx-vibrator.c +++ b/drivers/input/misc/pm8xxx-vibrator.c @@ -207,7 +207,7 @@ static int pm8xxx_vib_probe(struct platform_device *pdev) unsigned int val, reg_base = 0; const struct pm8xxx_regs *regs; - vib = devm_kzalloc(&pdev->dev, sizeof(*vib), GFP_KERNEL); + vib = devm_kzalloc_obj(&pdev->dev, *vib); if (!vib) return -ENOMEM; diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c b/drivers/input/misc/pmic8xxx-pwrkey.c index c406a1cca5c4..933b28b8b81e 100644 --- a/drivers/input/misc/pmic8xxx-pwrkey.c +++ b/drivers/input/misc/pmic8xxx-pwrkey.c @@ -358,7 +358,7 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) return -ENODEV; } - pwrkey = devm_kzalloc(&pdev->dev, sizeof(*pwrkey), GFP_KERNEL); + pwrkey = devm_kzalloc_obj(&pdev->dev, *pwrkey); if (!pwrkey) return -ENOMEM; diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c index 0e19e97d98ec..1287d1d557a7 100644 --- a/drivers/input/misc/pwm-beeper.c +++ b/drivers/input/misc/pwm-beeper.c @@ -127,7 +127,7 @@ static int pwm_beeper_probe(struct platform_device *pdev) u32 bell_frequency; int error; - beeper = devm_kzalloc(dev, sizeof(*beeper), GFP_KERNEL); + beeper = devm_kzalloc_obj(dev, *beeper); if (!beeper) return -ENOMEM; diff --git a/drivers/input/misc/pwm-vibra.c b/drivers/input/misc/pwm-vibra.c index 53ca3b1d7360..1e7cc8bd9f6b 100644 --- a/drivers/input/misc/pwm-vibra.c +++ b/drivers/input/misc/pwm-vibra.c @@ -131,7 +131,7 @@ static int pwm_vibrator_probe(struct platform_device *pdev) struct pwm_state state; int err; - vibrator = devm_kzalloc(&pdev->dev, sizeof(*vibrator), GFP_KERNEL); + vibrator = devm_kzalloc_obj(&pdev->dev, *vibrator); if (!vibrator) return -ENOMEM; diff --git a/drivers/input/misc/qnap-mcu-input.c b/drivers/input/misc/qnap-mcu-input.c index 3be899bfc114..fa7ad9b9a134 100644 --- a/drivers/input/misc/qnap-mcu-input.c +++ b/drivers/input/misc/qnap-mcu-input.c @@ -97,7 +97,7 @@ static int qnap_mcu_input_probe(struct platform_device *pdev) struct input_dev *input; int ret; - idev = devm_kzalloc(dev, sizeof(*idev), GFP_KERNEL); + idev = devm_kzalloc_obj(dev, *idev); if (!idev) return -ENOMEM; diff --git a/drivers/input/misc/rave-sp-pwrbutton.c b/drivers/input/misc/rave-sp-pwrbutton.c index bcab3cdb7ebd..ebe3d1f7dfb2 100644 --- a/drivers/input/misc/rave-sp-pwrbutton.c +++ b/drivers/input/misc/rave-sp-pwrbutton.c @@ -45,7 +45,7 @@ static int rave_sp_pwrbutton_probe(struct platform_device *pdev) struct input_dev *idev; int error; - pb = devm_kzalloc(dev, sizeof(*pb), GFP_KERNEL); + pb = devm_kzalloc_obj(dev, *pb); if (!pb) return -ENOMEM; diff --git a/drivers/input/misc/rb532_button.c b/drivers/input/misc/rb532_button.c index 40173bf7a235..63aa1190b806 100644 --- a/drivers/input/misc/rb532_button.c +++ b/drivers/input/misc/rb532_button.c @@ -68,7 +68,7 @@ static int rb532_button_probe(struct platform_device *pdev) struct input_dev *input; int error; - button = devm_kzalloc(&pdev->dev, sizeof(*button), GFP_KERNEL); + button = devm_kzalloc_obj(&pdev->dev, *button); if (!button) return -ENOMEM; diff --git a/drivers/input/misc/regulator-haptic.c b/drivers/input/misc/regulator-haptic.c index bd26c8e1b338..b1aa3488ed6c 100644 --- a/drivers/input/misc/regulator-haptic.c +++ b/drivers/input/misc/regulator-haptic.c @@ -146,7 +146,7 @@ static int regulator_haptic_probe(struct platform_device *pdev) struct input_dev *input_dev; int error; - haptic = devm_kzalloc(&pdev->dev, sizeof(*haptic), GFP_KERNEL); + haptic = devm_kzalloc_obj(&pdev->dev, *haptic); if (!haptic) return -ENOMEM; diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c index f706e1997417..6c932e46edb3 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c @@ -185,7 +185,7 @@ static int rotary_encoder_probe(struct platform_device *pdev) unsigned int i; int err; - encoder = devm_kzalloc(dev, sizeof(struct rotary_encoder), GFP_KERNEL); + encoder = devm_kzalloc_obj(dev, struct rotary_encoder); if (!encoder) return -ENOMEM; @@ -270,9 +270,7 @@ static int rotary_encoder_probe(struct platform_device *pdev) } encoder->irq = - devm_kcalloc(dev, - encoder->gpios->ndescs, sizeof(*encoder->irq), - GFP_KERNEL); + devm_kzalloc_objs(dev, *encoder->irq, encoder->gpios->ndescs); if (!encoder->irq) return -ENOMEM; diff --git a/drivers/input/misc/rt5120-pwrkey.c b/drivers/input/misc/rt5120-pwrkey.c index 2262f5057d9f..dce93078d4cc 100644 --- a/drivers/input/misc/rt5120-pwrkey.c +++ b/drivers/input/misc/rt5120-pwrkey.c @@ -44,7 +44,7 @@ static int rt5120_pwrkey_probe(struct platform_device *pdev) int press_irq, release_irq; int error; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/input/misc/sc27xx-vibra.c b/drivers/input/misc/sc27xx-vibra.c index 7590f3a91db8..56d0a825e244 100644 --- a/drivers/input/misc/sc27xx-vibra.c +++ b/drivers/input/misc/sc27xx-vibra.c @@ -123,7 +123,7 @@ static int sc27xx_vibra_probe(struct platform_device *pdev) return -EINVAL; } - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/input/misc/sgi_btns.c b/drivers/input/misc/sgi_btns.c index 39c2882b8e1a..e8602623f203 100644 --- a/drivers/input/misc/sgi_btns.c +++ b/drivers/input/misc/sgi_btns.c @@ -81,7 +81,7 @@ static int sgi_buttons_probe(struct platform_device *pdev) struct input_dev *input; int error, i; - bdev = devm_kzalloc(&pdev->dev, sizeof(*bdev), GFP_KERNEL); + bdev = devm_kzalloc_obj(&pdev->dev, *bdev); if (!bdev) return -ENOMEM; diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c index dbf86ea778e6..863e9d8c23ec 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c @@ -400,8 +400,8 @@ static struct soc_button_info *soc_button_get_button_info(struct device *dev) } /* There are package.count - 1 buttons + 1 terminating empty entry */ - button_info = devm_kcalloc(dev, btns_desc->package.count, - sizeof(*button_info), GFP_KERNEL); + button_info = devm_kzalloc_objs(dev, *button_info, + btns_desc->package.count); if (!button_info) { button_info = ERR_PTR(-ENOMEM); goto out; @@ -465,7 +465,7 @@ static int soc_button_probe(struct platform_device *pdev) return -ENODEV; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c index 1cfadd73829f..c7225e3733b8 100644 --- a/drivers/input/misc/sparcspkr.c +++ b/drivers/input/misc/sparcspkr.c @@ -194,7 +194,7 @@ static int bbc_beep_probe(struct platform_device *op) struct bbc_beep_info *info; int err; - state = devm_kzalloc(&op->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&op->dev, *state); if (!state) return -ENOMEM; @@ -265,7 +265,7 @@ static int grover_beep_probe(struct platform_device *op) struct grover_beep_info *info; int err = -ENOMEM; - state = devm_kzalloc(&op->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&op->dev, *state); if (!state) return err; diff --git a/drivers/input/misc/stpmic1_onkey.c b/drivers/input/misc/stpmic1_onkey.c index d5ebca7b90a5..a02261cf467d 100644 --- a/drivers/input/misc/stpmic1_onkey.c +++ b/drivers/input/misc/stpmic1_onkey.c @@ -56,7 +56,7 @@ static int stpmic1_onkey_probe(struct platform_device *pdev) unsigned int val, reg = 0; int error; - onkey = devm_kzalloc(dev, sizeof(*onkey), GFP_KERNEL); + onkey = devm_kzalloc_obj(dev, *onkey); if (!onkey) return -ENOMEM; diff --git a/drivers/input/misc/tps65218-pwrbutton.c b/drivers/input/misc/tps65218-pwrbutton.c index 5c4de3a285d5..f13427485820 100644 --- a/drivers/input/misc/tps65218-pwrbutton.c +++ b/drivers/input/misc/tps65218-pwrbutton.c @@ -91,7 +91,7 @@ static int tps6521x_pb_probe(struct platform_device *pdev) if (!match) return -ENXIO; - pwr = devm_kzalloc(dev, sizeof(*pwr), GFP_KERNEL); + pwr = devm_kzalloc_obj(dev, *pwr); if (!pwr) return -ENOMEM; diff --git a/drivers/input/misc/tps65219-pwrbutton.c b/drivers/input/misc/tps65219-pwrbutton.c index 7a58bae4f1a0..3d89be97aec6 100644 --- a/drivers/input/misc/tps65219-pwrbutton.c +++ b/drivers/input/misc/tps65219-pwrbutton.c @@ -52,7 +52,7 @@ static int tps65219_pb_probe(struct platform_device *pdev) int push_irq; int release_irq; - pwr = devm_kzalloc(dev, sizeof(*pwr), GFP_KERNEL); + pwr = devm_kzalloc_obj(dev, *pwr); if (!pwr) return -ENOMEM; diff --git a/drivers/input/misc/tps6594-pwrbutton.c b/drivers/input/misc/tps6594-pwrbutton.c index cd039b3866dc..2a3be1bcb62b 100644 --- a/drivers/input/misc/tps6594-pwrbutton.c +++ b/drivers/input/misc/tps6594-pwrbutton.c @@ -50,7 +50,7 @@ static int tps6594_pb_probe(struct platform_device *pdev) int push_irq; int release_irq; - pwr = devm_kzalloc(dev, sizeof(*pwr), GFP_KERNEL); + pwr = devm_kzalloc_obj(dev, *pwr); if (!pwr) return -ENOMEM; diff --git a/drivers/input/misc/twl4030-vibra.c b/drivers/input/misc/twl4030-vibra.c index 5fa7d4a7da36..40b55b414d48 100644 --- a/drivers/input/misc/twl4030-vibra.c +++ b/drivers/input/misc/twl4030-vibra.c @@ -182,7 +182,7 @@ static int twl4030_vibra_probe(struct platform_device *pdev) return -EINVAL; } - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c index afed9af65bf9..e5e648fc0099 100644 --- a/drivers/input/misc/twl6040-vibra.c +++ b/drivers/input/misc/twl6040-vibra.c @@ -241,7 +241,7 @@ static int twl6040_vibra_probe(struct platform_device *pdev) return -EINVAL; } - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) { dev_err(&pdev->dev, "couldn't allocate memory\n"); return -ENOMEM; diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c index a885873bcbd8..891f498eab6f 100644 --- a/drivers/input/misc/wm831x-on.c +++ b/drivers/input/misc/wm831x-on.c @@ -75,8 +75,7 @@ static int wm831x_on_probe(struct platform_device *pdev) int irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0)); int ret; - wm831x_on = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_on), - GFP_KERNEL); + wm831x_on = devm_kzalloc_obj(&pdev->dev, struct wm831x_on); if (!wm831x_on) { dev_err(&pdev->dev, "Can't allocate data\n"); return -ENOMEM; diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c index a8e9b9ab9f84..c086d28f1412 100644 --- a/drivers/input/mouse/cyapa.c +++ b/drivers/input/mouse/cyapa.c @@ -1256,7 +1256,7 @@ static int cyapa_probe(struct i2c_client *client) I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE, &dummy) < 0) return -ENODEV; - cyapa = devm_kzalloc(dev, sizeof(struct cyapa), GFP_KERNEL); + cyapa = devm_kzalloc_obj(dev, struct cyapa); if (!cyapa) return -ENOMEM; diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index f5e505edbc33..8661f5fb1762 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -1245,7 +1245,7 @@ static int elan_probe(struct i2c_client *client) return -EIO; } - data = devm_kzalloc(dev, sizeof(struct elan_tp_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct elan_tp_data); if (!data) return -ENOMEM; diff --git a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c index 18ccbd45004a..59ea85ca3568 100644 --- a/drivers/input/mouse/gpio_mouse.c +++ b/drivers/input/mouse/gpio_mouse.c @@ -73,7 +73,7 @@ static int gpio_mouse_probe(struct platform_device *pdev) struct input_dev *input; int error; - gmouse = devm_kzalloc(dev, sizeof(*gmouse), GFP_KERNEL); + gmouse = devm_kzalloc_obj(dev, *gmouse); if (!gmouse) return -ENOMEM; diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c index 66e833974c6d..1a675b96f9b9 100644 --- a/drivers/input/mouse/synaptics_i2c.c +++ b/drivers/input/mouse/synaptics_i2c.c @@ -519,7 +519,7 @@ static int synaptics_i2c_probe(struct i2c_client *client) struct synaptics_i2c *touch; int error; - touch = devm_kzalloc(dev, sizeof(*touch), GFP_KERNEL); + touch = devm_kzalloc_obj(dev, *touch); if (!touch) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index a349dfd17519..7bbe9e801c35 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -671,10 +671,9 @@ int rmi_read_register_desc(struct rmi_device *d, u16 addr, rdesc->num_registers = bitmap_weight(presence_map, RMI_REG_DESC_PRESENCE_BITS); - rdesc->registers = devm_kcalloc(&d->dev, - rdesc->num_registers, - sizeof(struct rmi_register_desc_item), - GFP_KERNEL); + rdesc->registers = devm_kzalloc_objs(&d->dev, + struct rmi_register_desc_item, + rdesc->num_registers); if (!rdesc->registers) return -ENOMEM; @@ -1185,7 +1184,7 @@ static int rmi_driver_probe(struct device *dev) return retval; } - data = devm_kzalloc(dev, sizeof(struct rmi_driver_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct rmi_driver_data); if (!data) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c index 47be64284b25..7d7ed463f74e 100644 --- a/drivers/input/rmi4/rmi_f01.c +++ b/drivers/input/rmi4/rmi_f01.c @@ -397,7 +397,7 @@ static int rmi_f01_probe(struct rmi_function *fn) return error; } - f01 = devm_kzalloc(&fn->dev, sizeof(struct f01_data), GFP_KERNEL); + f01 = devm_kzalloc_obj(&fn->dev, struct f01_data); if (!f01) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c index 04f0e5578861..000650914334 100644 --- a/drivers/input/rmi4/rmi_f03.c +++ b/drivers/input/rmi4/rmi_f03.c @@ -201,7 +201,7 @@ static int rmi_f03_probe(struct rmi_function *fn) struct f03_data *f03; int error; - f03 = devm_kzalloc(dev, sizeof(struct f03_data), GFP_KERNEL); + f03 = devm_kzalloc_obj(dev, struct f03_data); if (!f03) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c index 9ade74b36edb..280e293fd642 100644 --- a/drivers/input/rmi4/rmi_f11.c +++ b/drivers/input/rmi4/rmi_f11.c @@ -1200,15 +1200,13 @@ static int rmi_f11_initialize(struct rmi_function *fn) f11->sensor.attn_size += f11->sensor.nbr_fingers * 2; /* allocate the in-kernel tracking buffers */ - sensor->tracking_pos = devm_kcalloc(&fn->dev, - sensor->nbr_fingers, sizeof(struct input_mt_pos), - GFP_KERNEL); - sensor->tracking_slots = devm_kcalloc(&fn->dev, - sensor->nbr_fingers, sizeof(int), GFP_KERNEL); - sensor->objs = devm_kcalloc(&fn->dev, - sensor->nbr_fingers, - sizeof(struct rmi_2d_sensor_abs_object), - GFP_KERNEL); + sensor->tracking_pos = devm_kzalloc_objs(&fn->dev, struct input_mt_pos, + sensor->nbr_fingers); + sensor->tracking_slots = devm_kzalloc_objs(&fn->dev, int, + sensor->nbr_fingers); + sensor->objs = devm_kzalloc_objs(&fn->dev, + struct rmi_2d_sensor_abs_object, + sensor->nbr_fingers); if (!sensor->tracking_pos || !sensor->tracking_slots || !sensor->objs) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c index 841884d967a3..501c016c88c4 100644 --- a/drivers/input/rmi4/rmi_f12.c +++ b/drivers/input/rmi4/rmi_f12.c @@ -411,8 +411,7 @@ static int rmi_f12_probe(struct rmi_function *fn) return -ENODEV; } - f12 = devm_kzalloc(&fn->dev, struct_size(f12, irq_mask, irq_mask_size * 2), - GFP_KERNEL); + f12 = devm_kzalloc_flex(&fn->dev, *f12, irq_mask, irq_mask_size * 2); if (!f12) return -ENOMEM; @@ -530,20 +529,20 @@ static int rmi_f12_probe(struct rmi_function *fn) } /* allocate the in-kernel tracking buffers */ - sensor->tracking_pos = devm_kcalloc(&fn->dev, sensor->nbr_fingers, - sizeof(*sensor->tracking_pos), - GFP_KERNEL); + sensor->tracking_pos = devm_kzalloc_objs(&fn->dev, + *sensor->tracking_pos, + sensor->nbr_fingers); if (!sensor->tracking_pos) return -ENOMEM; - sensor->tracking_slots = devm_kcalloc(&fn->dev, sensor->nbr_fingers, - sizeof(*sensor->tracking_slots), - GFP_KERNEL); + sensor->tracking_slots = devm_kzalloc_objs(&fn->dev, + *sensor->tracking_slots, + sensor->nbr_fingers); if (!sensor->tracking_slots) return -ENOMEM; - sensor->objs = devm_kcalloc(&fn->dev, sensor->nbr_fingers, - sizeof(*sensor->objs), GFP_KERNEL); + sensor->objs = devm_kzalloc_objs(&fn->dev, *sensor->objs, + sensor->nbr_fingers); if (!sensor->objs) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_f1a.c b/drivers/input/rmi4/rmi_f1a.c index 765e9eae4cdc..b2b206c32d8d 100644 --- a/drivers/input/rmi4/rmi_f1a.c +++ b/drivers/input/rmi4/rmi_f1a.c @@ -33,8 +33,7 @@ static int rmi_f1a_parse_device_properties(struct rmi_function *fn, struct f1a_d return error; } - buttonmap = devm_kmalloc_array(dev, n_keys, sizeof(*buttonmap), - GFP_KERNEL); + buttonmap = devm_kmalloc_objs(dev, *buttonmap, n_keys); if (!buttonmap) return -ENOMEM; @@ -117,7 +116,7 @@ static int rmi_f1a_probe(struct rmi_function *fn) return -ENXIO; } - f1a = devm_kzalloc(&fn->dev, sizeof(*f1a), GFP_KERNEL); + f1a = devm_kzalloc_obj(&fn->dev, *f1a); if (!f1a) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_f21.c b/drivers/input/rmi4/rmi_f21.c index e3a9dfc3f0ec..c731b242c91f 100644 --- a/drivers/input/rmi4/rmi_f21.c +++ b/drivers/input/rmi4/rmi_f21.c @@ -116,7 +116,7 @@ static int rmi_f21_probe(struct rmi_function *fn) return -ENXIO; } - f21 = devm_kzalloc(&fn->dev, sizeof(*f21), GFP_KERNEL); + f21 = devm_kzalloc_obj(&fn->dev, *f21); if (!f21) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_f30.c b/drivers/input/rmi4/rmi_f30.c index b2155c8e20e7..2fd009be774c 100644 --- a/drivers/input/rmi4/rmi_f30.c +++ b/drivers/input/rmi4/rmi_f30.c @@ -232,10 +232,9 @@ static int rmi_f30_map_gpios(struct rmi_function *fn, int i; int button_count = min_t(u8, f30->gpioled_count, TRACKSTICK_RANGE_END); - f30->gpioled_key_map = devm_kcalloc(&fn->dev, - f30->gpioled_count, - sizeof(f30->gpioled_key_map[0]), - GFP_KERNEL); + f30->gpioled_key_map = devm_kzalloc_objs(&fn->dev, + f30->gpioled_key_map[0], + f30->gpioled_count); if (!f30->gpioled_key_map) { dev_err(&fn->dev, "Failed to allocate gpioled map memory.\n"); return -ENOMEM; @@ -380,7 +379,7 @@ static int rmi_f30_probe(struct rmi_function *fn) return -ENXIO; } - f30 = devm_kzalloc(&fn->dev, sizeof(*f30), GFP_KERNEL); + f30 = devm_kzalloc_obj(&fn->dev, *f30); if (!f30) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_f34.c b/drivers/input/rmi4/rmi_f34.c index f1947f03b06a..d71211b0cfd2 100644 --- a/drivers/input/rmi4/rmi_f34.c +++ b/drivers/input/rmi4/rmi_f34.c @@ -580,7 +580,7 @@ static int rmi_f34_probe(struct rmi_function *fn) u8 version = fn->fd.function_version; int error; - f34 = devm_kzalloc(&fn->dev, sizeof(struct f34_data), GFP_KERNEL); + f34 = devm_kzalloc_obj(&fn->dev, struct f34_data); if (!f34) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_f3a.c b/drivers/input/rmi4/rmi_f3a.c index a0777644eef0..07f25633e557 100644 --- a/drivers/input/rmi4/rmi_f3a.c +++ b/drivers/input/rmi4/rmi_f3a.c @@ -131,10 +131,8 @@ static int rmi_f3a_map_gpios(struct rmi_function *fn, struct f3a_data *f3a, int i; int button_count = min_t(u8, f3a->gpio_count, TRACKSTICK_RANGE_END); - f3a->gpio_key_map = devm_kcalloc(&fn->dev, - f3a->gpio_count, - sizeof(f3a->gpio_key_map[0]), - GFP_KERNEL); + f3a->gpio_key_map = devm_kzalloc_objs(&fn->dev, f3a->gpio_key_map[0], + f3a->gpio_count); if (!f3a->gpio_key_map) { dev_err(&fn->dev, "Failed to allocate gpio map memory.\n"); return -ENOMEM; @@ -216,7 +214,7 @@ static int rmi_f3a_probe(struct rmi_function *fn) return -ENXIO; } - f3a = devm_kzalloc(&fn->dev, sizeof(*f3a), GFP_KERNEL); + f3a = devm_kzalloc_obj(&fn->dev, *f3a); if (!f3a) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c index 6c6cdec7da9e..448091d0209a 100644 --- a/drivers/input/rmi4/rmi_f54.c +++ b/drivers/input/rmi4/rmi_f54.c @@ -683,7 +683,7 @@ static int rmi_f54_probe(struct rmi_function *fn) int ret; u8 rx, tx; - f54 = devm_kzalloc(&fn->dev, sizeof(struct f54_data), GFP_KERNEL); + f54 = devm_kzalloc_obj(&fn->dev, struct f54_data); if (!f54) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_f55.c b/drivers/input/rmi4/rmi_f55.c index a0877d32a914..84858fbf64cd 100644 --- a/drivers/input/rmi4/rmi_f55.c +++ b/drivers/input/rmi4/rmi_f55.c @@ -109,7 +109,7 @@ static int rmi_f55_probe(struct rmi_function *fn) { struct f55_data *f55; - f55 = devm_kzalloc(&fn->dev, sizeof(struct f55_data), GFP_KERNEL); + f55 = devm_kzalloc_obj(&fn->dev, struct f55_data); if (!f55) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c index e11d0acb9b96..b0b36ddb2760 100644 --- a/drivers/input/rmi4/rmi_i2c.c +++ b/drivers/input/rmi4/rmi_i2c.c @@ -206,8 +206,7 @@ static int rmi_i2c_probe(struct i2c_client *client) struct rmi_i2c_xport *rmi_i2c; int error; - rmi_i2c = devm_kzalloc(&client->dev, sizeof(struct rmi_i2c_xport), - GFP_KERNEL); + rmi_i2c = devm_kzalloc_obj(&client->dev, struct rmi_i2c_xport); if (!rmi_i2c) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c index 8b61c2382297..7f0fc5491efe 100644 --- a/drivers/input/rmi4/rmi_smbus.c +++ b/drivers/input/rmi4/rmi_smbus.c @@ -303,8 +303,7 @@ static int rmi_smb_probe(struct i2c_client *client) return client->irq ? client->irq : -ENODEV; } - rmi_smb = devm_kzalloc(&client->dev, sizeof(struct rmi_smb_xport), - GFP_KERNEL); + rmi_smb = devm_kzalloc_obj(&client->dev, struct rmi_smb_xport); if (!rmi_smb) return -ENOMEM; diff --git a/drivers/input/rmi4/rmi_spi.c b/drivers/input/rmi4/rmi_spi.c index 9d92129aa432..145f3960b78c 100644 --- a/drivers/input/rmi4/rmi_spi.c +++ b/drivers/input/rmi4/rmi_spi.c @@ -93,10 +93,8 @@ static int rmi_spi_manage_pools(struct rmi_spi_xport *rmi_spi, int len) * per byte delays. */ tmp = rmi_spi->rx_xfers; - xfer_buf = devm_kcalloc(&spi->dev, - rmi_spi->rx_xfer_count + rmi_spi->tx_xfer_count, - sizeof(struct spi_transfer), - GFP_KERNEL); + xfer_buf = devm_kzalloc_objs(&spi->dev, struct spi_transfer, + rmi_spi->rx_xfer_count + rmi_spi->tx_xfer_count); if (!xfer_buf) return -ENOMEM; @@ -378,8 +376,7 @@ static int rmi_spi_probe(struct spi_device *spi) if (spi->controller->flags & SPI_CONTROLLER_HALF_DUPLEX) return -EINVAL; - rmi_spi = devm_kzalloc(&spi->dev, sizeof(struct rmi_spi_xport), - GFP_KERNEL); + rmi_spi = devm_kzalloc_obj(&spi->dev, struct rmi_spi_xport); if (!rmi_spi) return -ENOMEM; diff --git a/drivers/input/serio/altera_ps2.c b/drivers/input/serio/altera_ps2.c index 4bf37db65b76..63eee11c5965 100644 --- a/drivers/input/serio/altera_ps2.c +++ b/drivers/input/serio/altera_ps2.c @@ -81,7 +81,7 @@ static int altera_ps2_probe(struct platform_device *pdev) struct serio *serio; int error, irq; - ps2if = devm_kzalloc(&pdev->dev, sizeof(*ps2if), GFP_KERNEL); + ps2if = devm_kzalloc_obj(&pdev->dev, *ps2if); if (!ps2if) return -ENOMEM; diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c index e346bf53eb16..28ea6639b855 100644 --- a/drivers/input/serio/ams_delta_serio.c +++ b/drivers/input/serio/ams_delta_serio.c @@ -111,7 +111,7 @@ static int ams_delta_serio_init(struct platform_device *pdev) struct serio *serio; int irq, err; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/input/serio/apbps2.c b/drivers/input/serio/apbps2.c index 5f21acdd4113..83d1931f5c33 100644 --- a/drivers/input/serio/apbps2.c +++ b/drivers/input/serio/apbps2.c @@ -133,7 +133,7 @@ static int apbps2_of_probe(struct platform_device *ofdev) int irq, err; u32 freq_hz; - priv = devm_kzalloc(&ofdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&ofdev->dev, *priv); if (!priv) { dev_err(&ofdev->dev, "memory allocation failed\n"); return -ENOMEM; diff --git a/drivers/input/serio/arc_ps2.c b/drivers/input/serio/arc_ps2.c index 2eb069a0f054..a19a4ab723bd 100644 --- a/drivers/input/serio/arc_ps2.c +++ b/drivers/input/serio/arc_ps2.c @@ -189,7 +189,7 @@ static int arc_ps2_probe(struct platform_device *pdev) if (irq < 0) return -EINVAL; - arc_ps2 = devm_kzalloc(&pdev->dev, sizeof(*arc_ps2), GFP_KERNEL); + arc_ps2 = devm_kzalloc_obj(&pdev->dev, *arc_ps2); if (!arc_ps2) { dev_err(&pdev->dev, "out of memory\n"); return -ENOMEM; diff --git a/drivers/input/serio/ioc3kbd.c b/drivers/input/serio/ioc3kbd.c index 4ef60c24e788..db14fa849c6a 100644 --- a/drivers/input/serio/ioc3kbd.c +++ b/drivers/input/serio/ioc3kbd.c @@ -135,7 +135,7 @@ static int ioc3kbd_probe(struct platform_device *pdev) if (irq < 0) return -ENXIO; - d = devm_kzalloc(dev, sizeof(*d), GFP_KERNEL); + d = devm_kzalloc_obj(dev, *d); if (!d) return -ENOMEM; diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c index ccc40634f582..6e4fb647d0c6 100644 --- a/drivers/input/serio/olpc_apsp.c +++ b/drivers/input/serio/olpc_apsp.c @@ -171,7 +171,7 @@ static int olpc_apsp_probe(struct platform_device *pdev) struct olpc_apsp *priv; int error; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/input/serio/ps2-gpio.c b/drivers/input/serio/ps2-gpio.c index 6cde0d88c6f4..eae491dda5b0 100644 --- a/drivers/input/serio/ps2-gpio.c +++ b/drivers/input/serio/ps2-gpio.c @@ -404,7 +404,7 @@ static int ps2_gpio_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int error; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); serio = kzalloc_obj(*serio); if (!drvdata || !serio) { error = -ENOMEM; diff --git a/drivers/input/touch-overlay.c b/drivers/input/touch-overlay.c index b9fd82c4829d..693a77bee37c 100644 --- a/drivers/input/touch-overlay.c +++ b/drivers/input/touch-overlay.c @@ -83,7 +83,7 @@ int touch_overlay_map(struct list_head *list, struct input_dev *input) return 0; fwnode_for_each_available_child_node(overlay, fw_segment) { - segment = devm_kzalloc(dev, sizeof(*segment), GFP_KERNEL); + segment = devm_kzalloc_obj(dev, *segment); if (!segment) { fwnode_handle_put(fw_segment); return -ENOMEM; diff --git a/drivers/input/touchscreen/88pm860x-ts.c b/drivers/input/touchscreen/88pm860x-ts.c index dd545a719019..c1979acf5471 100644 --- a/drivers/input/touchscreen/88pm860x-ts.c +++ b/drivers/input/touchscreen/88pm860x-ts.c @@ -232,8 +232,7 @@ static int pm860x_touch_probe(struct platform_device *pdev) if (ret) return ret; - touch = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_touch), - GFP_KERNEL); + touch = devm_kzalloc_obj(&pdev->dev, struct pm860x_touch); if (!touch) return -ENOMEM; diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c index 90311df47e4f..1e3e4d3aa996 100644 --- a/drivers/input/touchscreen/ad7877.c +++ b/drivers/input/touchscreen/ad7877.c @@ -690,7 +690,7 @@ static int ad7877_probe(struct spi_device *spi) return err; } - ts = devm_kzalloc(&spi->dev, sizeof(struct ad7877), GFP_KERNEL); + ts = devm_kzalloc_obj(&spi->dev, struct ad7877); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index 0789d8e19eab..ac700789f0e7 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c @@ -521,7 +521,7 @@ int ad7879_probe(struct device *dev, struct regmap *regmap, return -EINVAL; } - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 8d6416ac283e..403a918fbf64 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -1296,7 +1296,7 @@ static const struct ads7846_platform_data *ads7846_get_props(struct device *dev) struct ads7846_platform_data *pdata; u32 value; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); @@ -1385,7 +1385,7 @@ static int ads7846_probe(struct spi_device *spi) if (err < 0) return err; - ts = devm_kzalloc(dev, sizeof(struct ads7846), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, struct ads7846); if (!ts) return -ENOMEM; @@ -1397,7 +1397,7 @@ static int ads7846_probe(struct spi_device *spi) ts->read_state = ads7846_read_state; } - packet = devm_kzalloc(dev, sizeof(struct ads7846_packet), GFP_KERNEL); + packet = devm_kzalloc_obj(dev, struct ads7846_packet); if (!packet) return -ENOMEM; diff --git a/drivers/input/touchscreen/apple_z2.c b/drivers/input/touchscreen/apple_z2.c index 271ababf0ad5..7b2fa59e365b 100644 --- a/drivers/input/touchscreen/apple_z2.c +++ b/drivers/input/touchscreen/apple_z2.c @@ -355,7 +355,7 @@ static int apple_z2_probe(struct spi_device *spi) struct apple_z2 *z2; int error; - z2 = devm_kzalloc(dev, sizeof(*z2), GFP_KERNEL); + z2 = devm_kzalloc_obj(dev, *z2); if (!z2) return -ENOMEM; diff --git a/drivers/input/touchscreen/ar1021_i2c.c b/drivers/input/touchscreen/ar1021_i2c.c index a56b114bcb36..b32ef90b63f4 100644 --- a/drivers/input/touchscreen/ar1021_i2c.c +++ b/drivers/input/touchscreen/ar1021_i2c.c @@ -98,7 +98,7 @@ static int ar1021_i2c_probe(struct i2c_client *client) return -ENXIO; } - ar1021 = devm_kzalloc(&client->dev, sizeof(*ar1021), GFP_KERNEL); + ar1021 = devm_kzalloc_obj(&client->dev, *ar1021); if (!ar1021) return -ENOMEM; diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 522e1ea405a6..35b7eaf12ae8 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -2717,8 +2717,8 @@ static void mxt_debug_init(struct mxt_data *data) sizeof(u16), sizeof(dbg->t37_buf->data)); - dbg->t37_buf = devm_kmalloc_array(&data->client->dev, dbg->t37_pages, - sizeof(struct t37_debug), GFP_KERNEL); + dbg->t37_buf = devm_kmalloc_objs(&data->client->dev, struct t37_debug, + dbg->t37_pages); if (!dbg->t37_buf) goto error; @@ -3139,8 +3139,7 @@ static int mxt_parse_device_properties(struct mxt_data *data) return error; } - keymap = devm_kmalloc_array(dev, n_keys, sizeof(*keymap), - GFP_KERNEL); + keymap = devm_kmalloc_objs(dev, *keymap, n_keys); if (!keymap) return -ENOMEM; @@ -3165,8 +3164,7 @@ static int mxt_parse_device_properties(struct mxt_data *data) return error; } - buttonmap = devm_kmalloc_array(dev, n_keys, sizeof(*buttonmap), - GFP_KERNEL); + buttonmap = devm_kmalloc_objs(dev, *buttonmap, n_keys); if (!buttonmap) return -ENOMEM; @@ -3230,7 +3228,7 @@ static int mxt_probe(struct i2c_client *client) if (ACPI_COMPANION(&client->dev) && client->addr < 0x40) return -ENXIO; - data = devm_kzalloc(&client->dev, sizeof(struct mxt_data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct mxt_data); if (!data) return -ENOMEM; diff --git a/drivers/input/touchscreen/auo-pixcir-ts.c b/drivers/input/touchscreen/auo-pixcir-ts.c index 6c6ebebacba9..3d435197fad5 100644 --- a/drivers/input/touchscreen/auo-pixcir-ts.c +++ b/drivers/input/touchscreen/auo-pixcir-ts.c @@ -490,7 +490,7 @@ static int auo_pixcir_probe(struct i2c_client *client) int version; int error; - ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&client->dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c b/drivers/input/touchscreen/bcm_iproc_tsc.c index 42c27b2ef949..637d8ba01f62 100644 --- a/drivers/input/touchscreen/bcm_iproc_tsc.c +++ b/drivers/input/touchscreen/bcm_iproc_tsc.c @@ -420,7 +420,7 @@ static int iproc_ts_probe(struct platform_device *pdev) int irq; int error; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index d1bdccc56fc8..05abc67f9e42 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c @@ -424,7 +424,7 @@ static int bu21013_probe(struct i2c_client *client) return -EINVAL; } - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/bu21029_ts.c b/drivers/input/touchscreen/bu21029_ts.c index 339fee1622fb..7a5379cfecdf 100644 --- a/drivers/input/touchscreen/bu21029_ts.c +++ b/drivers/input/touchscreen/bu21029_ts.c @@ -347,7 +347,7 @@ static int bu21029_probe(struct i2c_client *client) return -EIO; } - bu21029 = devm_kzalloc(dev, sizeof(*bu21029), GFP_KERNEL); + bu21029 = devm_kzalloc_obj(dev, *bu21029); if (!bu21029) return -ENOMEM; diff --git a/drivers/input/touchscreen/chipone_icn8318.c b/drivers/input/touchscreen/chipone_icn8318.c index 03b62706e39f..cd0471a03fc2 100644 --- a/drivers/input/touchscreen/chipone_icn8318.c +++ b/drivers/input/touchscreen/chipone_icn8318.c @@ -186,7 +186,7 @@ static int icn8318_probe(struct i2c_client *client) return -EINVAL; } - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/input/touchscreen/chipone_icn8505.c b/drivers/input/touchscreen/chipone_icn8505.c index 7d0a488166bb..7e7552c9e29d 100644 --- a/drivers/input/touchscreen/chipone_icn8505.c +++ b/drivers/input/touchscreen/chipone_icn8505.c @@ -393,7 +393,7 @@ static int icn8505_probe(struct i2c_client *client) return -EINVAL; } - icn8505 = devm_kzalloc(dev, sizeof(*icn8505), GFP_KERNEL); + icn8505 = devm_kzalloc_obj(dev, *icn8505); if (!icn8505) return -ENOMEM; diff --git a/drivers/input/touchscreen/colibri-vf50-ts.c b/drivers/input/touchscreen/colibri-vf50-ts.c index 6067bf061125..51eaafba909b 100644 --- a/drivers/input/touchscreen/colibri-vf50-ts.c +++ b/drivers/input/touchscreen/colibri-vf50-ts.c @@ -283,7 +283,7 @@ static int vf50_ts_probe(struct platform_device *pdev) return -EINVAL; } - touchdev = devm_kzalloc(dev, sizeof(*touchdev), GFP_KERNEL); + touchdev = devm_kzalloc_obj(dev, *touchdev); if (!touchdev) return -ENOMEM; diff --git a/drivers/input/touchscreen/cy8ctma140.c b/drivers/input/touchscreen/cy8ctma140.c index 0ac48eff3376..6aa6505b1985 100644 --- a/drivers/input/touchscreen/cy8ctma140.c +++ b/drivers/input/touchscreen/cy8ctma140.c @@ -205,7 +205,7 @@ static int cy8ctma140_probe(struct i2c_client *client) struct device *dev = &client->dev; int error; - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c index 33ad4f0512a0..fa19e37a3685 100644 --- a/drivers/input/touchscreen/cy8ctmg110_ts.c +++ b/drivers/input/touchscreen/cy8ctmg110_ts.c @@ -178,7 +178,7 @@ static int cy8ctmg110_probe(struct i2c_client *client) I2C_FUNC_SMBUS_READ_WORD_DATA)) return -EIO; - ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&client->dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c index c6f7c0b041a1..d4a78facfa81 100644 --- a/drivers/input/touchscreen/cyttsp5.c +++ b/drivers/input/touchscreen/cyttsp5.c @@ -827,7 +827,7 @@ static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq, struct cyttsp5_sysinfo *si; int error, i; - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/da9034-ts.c b/drivers/input/touchscreen/da9034-ts.c index 2c46079e47d0..9ebbd486b189 100644 --- a/drivers/input/touchscreen/da9034-ts.c +++ b/drivers/input/touchscreen/da9034-ts.c @@ -300,8 +300,7 @@ static int da9034_touch_probe(struct platform_device *pdev) struct input_dev *input_dev; int error; - touch = devm_kzalloc(&pdev->dev, sizeof(struct da9034_touch), - GFP_KERNEL); + touch = devm_kzalloc_obj(&pdev->dev, struct da9034_touch); if (!touch) { dev_err(&pdev->dev, "failed to allocate driver data\n"); return -ENOMEM; diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index e69d64c3db2d..32eed64e2c49 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -1126,7 +1126,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client) dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n"); - tsdata = devm_kzalloc(&client->dev, sizeof(*tsdata), GFP_KERNEL); + tsdata = devm_kzalloc_obj(&client->dev, *tsdata); if (!tsdata) { dev_err(&client->dev, "failed to allocate driver data.\n"); return -ENOMEM; diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c index b870a939508b..623086f562ce 100644 --- a/drivers/input/touchscreen/eeti_ts.c +++ b/drivers/input/touchscreen/eeti_ts.c @@ -169,7 +169,7 @@ static int eeti_ts_probe(struct i2c_client *client) * for interrupts to occur. */ - eeti = devm_kzalloc(dev, sizeof(*eeti), GFP_KERNEL); + eeti = devm_kzalloc_obj(dev, *eeti); if (!eeti) { dev_err(dev, "failed to allocate driver data\n"); return -ENOMEM; diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c index 76cf8085553f..262860d99e3c 100644 --- a/drivers/input/touchscreen/egalax_ts.c +++ b/drivers/input/touchscreen/egalax_ts.c @@ -162,7 +162,7 @@ static int egalax_ts_probe(struct i2c_client *client) struct input_dev *input_dev; int error; - ts = devm_kzalloc(&client->dev, sizeof(struct egalax_ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&client->dev, struct egalax_ts); if (!ts) { dev_err(&client->dev, "Failed to allocate memory\n"); return -ENOMEM; diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c index 572a37d4e0aa..2da2d279b5d8 100644 --- a/drivers/input/touchscreen/ektf2127.c +++ b/drivers/input/touchscreen/ektf2127.c @@ -265,7 +265,7 @@ static int ektf2127_probe(struct i2c_client *client) return -EINVAL; } - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index 7a651899feb1..fd76a8189bf9 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -1410,7 +1410,7 @@ static int elants_i2c_probe(struct i2c_client *client) return -ENXIO; } - ts = devm_kzalloc(&client->dev, sizeof(struct elants_data), GFP_KERNEL); + ts = devm_kzalloc_obj(&client->dev, struct elants_data); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/exc3000.c b/drivers/input/touchscreen/exc3000.c index d1f9b44d9d76..d6e0c5183a48 100644 --- a/drivers/input/touchscreen/exc3000.c +++ b/drivers/input/touchscreen/exc3000.c @@ -333,7 +333,7 @@ static int exc3000_probe(struct i2c_client *client) struct input_dev *input; int error, max_xy, retry; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/input/touchscreen/fsl-imx25-tcq.c b/drivers/input/touchscreen/fsl-imx25-tcq.c index ff270b3b8572..04d7d2677001 100644 --- a/drivers/input/touchscreen/fsl-imx25-tcq.c +++ b/drivers/input/touchscreen/fsl-imx25-tcq.c @@ -505,7 +505,7 @@ static int mx25_tcq_probe(struct platform_device *pdev) void __iomem *mem; int error; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; priv->dev = dev; diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 7609366f0b78..1c9e88e3c7aa 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -1319,7 +1319,7 @@ static int goodix_ts_probe(struct i2c_client *client) return -ENXIO; } - ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&client->dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/goodix_berlin_core.c b/drivers/input/touchscreen/goodix_berlin_core.c index b0938a4f3fec..c2d5b892958d 100644 --- a/drivers/input/touchscreen/goodix_berlin_core.c +++ b/drivers/input/touchscreen/goodix_berlin_core.c @@ -737,7 +737,7 @@ int goodix_berlin_probe(struct device *dev, int irq, const struct input_id *id, return -EINVAL; } - cd = devm_kzalloc(dev, sizeof(*cd), GFP_KERNEL); + cd = devm_kzalloc_obj(dev, *cd); if (!cd) return -ENOMEM; diff --git a/drivers/input/touchscreen/hideep.c b/drivers/input/touchscreen/hideep.c index 68ee61c71df6..9384657ece7e 100644 --- a/drivers/input/touchscreen/hideep.c +++ b/drivers/input/touchscreen/hideep.c @@ -1017,7 +1017,7 @@ static int hideep_probe(struct i2c_client *client) return -EINVAL; } - ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&client->dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/himax_hx83112b.c b/drivers/input/touchscreen/himax_hx83112b.c index 0aa67dfacbad..345ece27fe74 100644 --- a/drivers/input/touchscreen/himax_hx83112b.c +++ b/drivers/input/touchscreen/himax_hx83112b.c @@ -334,7 +334,7 @@ static int himax_probe(struct i2c_client *client) return -ENXIO; } - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/himax_hx852x.c b/drivers/input/touchscreen/himax_hx852x.c index 1c488a63e53b..6252278d2b44 100644 --- a/drivers/input/touchscreen/himax_hx852x.c +++ b/drivers/input/touchscreen/himax_hx852x.c @@ -388,7 +388,7 @@ static int hx852x_probe(struct i2c_client *client) return -ENXIO; } - hx = devm_kzalloc(dev, sizeof(*hx), GFP_KERNEL); + hx = devm_kzalloc_obj(dev, *hx); if (!hx) return -ENOMEM; diff --git a/drivers/input/touchscreen/hycon-hy46xx.c b/drivers/input/touchscreen/hycon-hy46xx.c index 8ca408d66caf..b3c69cf53973 100644 --- a/drivers/input/touchscreen/hycon-hy46xx.c +++ b/drivers/input/touchscreen/hycon-hy46xx.c @@ -435,7 +435,7 @@ static int hycon_hy46xx_probe(struct i2c_client *client) dev_dbg(&client->dev, "probing for HYCON HY46XX I2C\n"); - tsdata = devm_kzalloc(&client->dev, sizeof(*tsdata), GFP_KERNEL); + tsdata = devm_kzalloc_obj(&client->dev, *tsdata); if (!tsdata) return -ENOMEM; diff --git a/drivers/input/touchscreen/hynitron-cst816x.c b/drivers/input/touchscreen/hynitron-cst816x.c index 47d9cd7412d1..5721e3dbc8e7 100644 --- a/drivers/input/touchscreen/hynitron-cst816x.c +++ b/drivers/input/touchscreen/hynitron-cst816x.c @@ -194,7 +194,7 @@ static int cst816x_probe(struct i2c_client *client) struct cst816x_priv *priv; int error; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/input/touchscreen/hynitron_cstxxx.c b/drivers/input/touchscreen/hynitron_cstxxx.c index 49fb35c830dc..7094ebc66f46 100644 --- a/drivers/input/touchscreen/hynitron_cstxxx.c +++ b/drivers/input/touchscreen/hynitron_cstxxx.c @@ -421,7 +421,7 @@ static int hyn_probe(struct i2c_client *client) struct hynitron_ts_data *ts_data; int err; - ts_data = devm_kzalloc(&client->dev, sizeof(*ts_data), GFP_KERNEL); + ts_data = devm_kzalloc_obj(&client->dev, *ts_data); if (!ts_data) return -ENOMEM; diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c index 3479698f55e3..03e4451d6393 100644 --- a/drivers/input/touchscreen/ili210x.c +++ b/drivers/input/touchscreen/ili210x.c @@ -985,7 +985,7 @@ static int ili210x_i2c_probe(struct i2c_client *client) ili210x_hardware_reset(reset_gpio); } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/input/touchscreen/ilitek_ts_i2c.c b/drivers/input/touchscreen/ilitek_ts_i2c.c index cdd02b7b6f67..74ffed981342 100644 --- a/drivers/input/touchscreen/ilitek_ts_i2c.c +++ b/drivers/input/touchscreen/ilitek_ts_i2c.c @@ -555,7 +555,7 @@ static int ilitek_ts_i2c_probe(struct i2c_client *client) return -ENXIO; } - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c index 7bbb00beec3b..b97a5df7759a 100644 --- a/drivers/input/touchscreen/imagis.c +++ b/drivers/input/touchscreen/imagis.c @@ -304,7 +304,7 @@ static int imagis_probe(struct i2c_client *i2c) struct imagis_ts *ts; int chip_id, error; - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c index 43d6c69e3088..aefbd52664fd 100644 --- a/drivers/input/touchscreen/imx6ul_tsc.c +++ b/drivers/input/touchscreen/imx6ul_tsc.c @@ -394,7 +394,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) u32 average_samples; u32 de_glitch; - tsc = devm_kzalloc(&pdev->dev, sizeof(*tsc), GFP_KERNEL); + tsc = devm_kzalloc_obj(&pdev->dev, *tsc); if (!tsc) return -ENOMEM; diff --git a/drivers/input/touchscreen/ipaq-micro-ts.c b/drivers/input/touchscreen/ipaq-micro-ts.c index 243e6465d9bd..f0ece8f8b5b8 100644 --- a/drivers/input/touchscreen/ipaq-micro-ts.c +++ b/drivers/input/touchscreen/ipaq-micro-ts.c @@ -80,7 +80,7 @@ static int micro_ts_probe(struct platform_device *pdev) struct touchscreen_data *ts; int error; - ts = devm_kzalloc(&pdev->dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&pdev->dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/iqs5xx.c b/drivers/input/touchscreen/iqs5xx.c index 88dcf72618df..d1b906872aba 100644 --- a/drivers/input/touchscreen/iqs5xx.c +++ b/drivers/input/touchscreen/iqs5xx.c @@ -1008,7 +1008,7 @@ static int iqs5xx_probe(struct i2c_client *client) struct iqs5xx_private *iqs5xx; int error; - iqs5xx = devm_kzalloc(&client->dev, sizeof(*iqs5xx), GFP_KERNEL); + iqs5xx = devm_kzalloc_obj(&client->dev, *iqs5xx); if (!iqs5xx) return -ENOMEM; diff --git a/drivers/input/touchscreen/iqs7211.c b/drivers/input/touchscreen/iqs7211.c index 26e0b501c5fc..69996864cd59 100644 --- a/drivers/input/touchscreen/iqs7211.c +++ b/drivers/input/touchscreen/iqs7211.c @@ -1622,7 +1622,7 @@ static int iqs7211_add_field(struct iqs7211_private *iqs7211, return 0; } - reg_field = devm_kzalloc(&client->dev, sizeof(*reg_field), GFP_KERNEL); + reg_field = devm_kzalloc_obj(&client->dev, *reg_field); if (!reg_field) return -ENOMEM; @@ -2438,7 +2438,7 @@ static int iqs7211_probe(struct i2c_client *client) bool shared_irq; int error, irq; - iqs7211 = devm_kzalloc(&client->dev, sizeof(*iqs7211), GFP_KERNEL); + iqs7211 = devm_kzalloc_obj(&client->dev, *iqs7211); if (!iqs7211) return -ENOMEM; diff --git a/drivers/input/touchscreen/jornada720_ts.c b/drivers/input/touchscreen/jornada720_ts.c index ba4e3c6e5c91..17f6e0ca342e 100644 --- a/drivers/input/touchscreen/jornada720_ts.c +++ b/drivers/input/touchscreen/jornada720_ts.c @@ -100,7 +100,7 @@ static int jornada720_ts_probe(struct platform_device *pdev) struct input_dev *input_dev; int error, irq; - jornada_ts = devm_kzalloc(&pdev->dev, sizeof(*jornada_ts), GFP_KERNEL); + jornada_ts = devm_kzalloc_obj(&pdev->dev, *jornada_ts); if (!jornada_ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/lpc32xx_ts.c b/drivers/input/touchscreen/lpc32xx_ts.c index 5de752a06b26..b5918a07307c 100644 --- a/drivers/input/touchscreen/lpc32xx_ts.c +++ b/drivers/input/touchscreen/lpc32xx_ts.c @@ -208,7 +208,7 @@ static int lpc32xx_ts_probe(struct platform_device *pdev) if (irq < 0) return irq; - tsc = devm_kzalloc(dev, sizeof(*tsc), GFP_KERNEL); + tsc = devm_kzalloc_obj(dev, *tsc); if (!tsc) return -ENOMEM; diff --git a/drivers/input/touchscreen/max11801_ts.c b/drivers/input/touchscreen/max11801_ts.c index 2191b4f8a00b..ce250e52fa14 100644 --- a/drivers/input/touchscreen/max11801_ts.c +++ b/drivers/input/touchscreen/max11801_ts.c @@ -174,7 +174,7 @@ static int max11801_ts_probe(struct i2c_client *client) struct input_dev *input_dev; int error; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); input_dev = devm_input_allocate_device(&client->dev); if (!data || !input_dev) { dev_err(&client->dev, "Failed to allocate memory\n"); diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c index 0c8a922e2f2e..9136bdc1aff8 100644 --- a/drivers/input/touchscreen/melfas_mip4.c +++ b/drivers/input/touchscreen/melfas_mip4.c @@ -1403,7 +1403,7 @@ static int mip4_probe(struct i2c_client *client) return -ENXIO; } - ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&client->dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c index f6039a47f7e9..60dbf7295ac5 100644 --- a/drivers/input/touchscreen/mms114.c +++ b/drivers/input/touchscreen/mms114.c @@ -534,8 +534,7 @@ static int mms114_probe(struct i2c_client *client) return -ENODEV; } - data = devm_kzalloc(&client->dev, sizeof(struct mms114_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct mms114_data); input_dev = devm_input_allocate_device(&client->dev); if (!data || !input_dev) { dev_err(&client->dev, "Failed to allocate memory\n"); diff --git a/drivers/input/touchscreen/msg2638.c b/drivers/input/touchscreen/msg2638.c index cd40c284d6f4..fd929fe42ea2 100644 --- a/drivers/input/touchscreen/msg2638.c +++ b/drivers/input/touchscreen/msg2638.c @@ -366,7 +366,7 @@ static int msg2638_ts_probe(struct i2c_client *client) return -ENXIO; } - msg2638 = devm_kzalloc(dev, sizeof(*msg2638), GFP_KERNEL); + msg2638 = devm_kzalloc_obj(dev, *msg2638); if (!msg2638) return -ENOMEM; diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c index 137ab3b60f2d..2970d9eb9c2b 100644 --- a/drivers/input/touchscreen/mxs-lradc-ts.c +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -608,7 +608,7 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev) int ret, irq, virq, i; u32 ts_wires = 0, adapt; - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/novatek-nvt-ts.c b/drivers/input/touchscreen/novatek-nvt-ts.c index 0f771f681952..fa718a99e2ba 100644 --- a/drivers/input/touchscreen/novatek-nvt-ts.c +++ b/drivers/input/touchscreen/novatek-nvt-ts.c @@ -205,7 +205,7 @@ static int nvt_ts_probe(struct i2c_client *client) return -EINVAL; } - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c index 1ca5920846df..bc349442f9ef 100644 --- a/drivers/input/touchscreen/pixcir_i2c_ts.c +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c @@ -468,7 +468,7 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client) struct input_dev *input; int error; - tsdata = devm_kzalloc(dev, sizeof(*tsdata), GFP_KERNEL); + tsdata = devm_kzalloc_obj(dev, *tsdata); if (!tsdata) return -ENOMEM; diff --git a/drivers/input/touchscreen/raspberrypi-ts.c b/drivers/input/touchscreen/raspberrypi-ts.c index 841d39a449b3..91c105bdcc21 100644 --- a/drivers/input/touchscreen/raspberrypi-ts.c +++ b/drivers/input/touchscreen/raspberrypi-ts.c @@ -137,7 +137,7 @@ static int rpi_ts_probe(struct platform_device *pdev) if (!fw) return -EPROBE_DEFER; - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; ts->pdev = pdev; diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c index d046eba4b12d..6d6db1395bad 100644 --- a/drivers/input/touchscreen/raydium_i2c_ts.c +++ b/drivers/input/touchscreen/raydium_i2c_ts.c @@ -1066,7 +1066,7 @@ static int raydium_i2c_probe(struct i2c_client *client) return -ENXIO; } - ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&client->dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/resistive-adc-touch.c b/drivers/input/touchscreen/resistive-adc-touch.c index c89edc1280fe..4af2102cb1df 100644 --- a/drivers/input/touchscreen/resistive-adc-touch.c +++ b/drivers/input/touchscreen/resistive-adc-touch.c @@ -203,7 +203,7 @@ static int grts_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int error; - st = devm_kzalloc(dev, sizeof(struct grts_state), GFP_KERNEL); + st = devm_kzalloc_obj(dev, struct grts_state); if (!st) return -ENOMEM; diff --git a/drivers/input/touchscreen/rohm_bu21023.c b/drivers/input/touchscreen/rohm_bu21023.c index a5c06b7423c0..f40f14dc351b 100644 --- a/drivers/input/touchscreen/rohm_bu21023.c +++ b/drivers/input/touchscreen/rohm_bu21023.c @@ -1093,7 +1093,7 @@ static int rohm_bu21023_i2c_probe(struct i2c_client *client) if (error) return error; - ts = devm_kzalloc(dev, sizeof(struct rohm_ts_data), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, struct rohm_ts_data); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/s6sy761.c b/drivers/input/touchscreen/s6sy761.c index 1bd4ddffe4e1..7ea86780cd37 100644 --- a/drivers/input/touchscreen/s6sy761.c +++ b/drivers/input/touchscreen/s6sy761.c @@ -397,7 +397,7 @@ static int s6sy761_probe(struct i2c_client *client) I2C_FUNC_SMBUS_I2C_BLOCK)) return -ENODEV; - sdata = devm_kzalloc(&client->dev, sizeof(*sdata), GFP_KERNEL); + sdata = devm_kzalloc_obj(&client->dev, *sdata); if (!sdata) return -ENOMEM; diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c index 6014c4e049a6..bf3e42be49e7 100644 --- a/drivers/input/touchscreen/silead.c +++ b/drivers/input/touchscreen/silead.c @@ -658,7 +658,7 @@ static int silead_ts_probe(struct i2c_client *client) return -ENXIO; } - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/input/touchscreen/sis_i2c.c b/drivers/input/touchscreen/sis_i2c.c index 4fa93cd31ee4..6280f0feee71 100644 --- a/drivers/input/touchscreen/sis_i2c.c +++ b/drivers/input/touchscreen/sis_i2c.c @@ -302,7 +302,7 @@ static int sis_ts_probe(struct i2c_client *client) struct input_dev *input; int error; - ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&client->dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c index c2dcfce5003d..32c43397080e 100644 --- a/drivers/input/touchscreen/st1232.c +++ b/drivers/input/touchscreen/st1232.c @@ -308,7 +308,7 @@ static int st1232_ts_probe(struct i2c_client *client) return -EINVAL; } - ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&client->dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c index 972687797f82..8617e75fa826 100644 --- a/drivers/input/touchscreen/stmfts.c +++ b/drivers/input/touchscreen/stmfts.c @@ -675,7 +675,7 @@ static int stmfts_probe(struct i2c_client *client) I2C_FUNC_SMBUS_I2C_BLOCK)) return -ENODEV; - sdata = devm_kzalloc(dev, sizeof(*sdata), GFP_KERNEL); + sdata = devm_kzalloc_obj(dev, *sdata); if (!sdata) return -ENOMEM; diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index af0fb38bcfdc..84a4ff25223c 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c @@ -296,7 +296,7 @@ static int stmpe_input_probe(struct platform_device *pdev) if (ts_irq < 0) return ts_irq; - ts = devm_kzalloc(&pdev->dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&pdev->dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c index e8286060043a..5196b38bc7f3 100644 --- a/drivers/input/touchscreen/sun4i-ts.c +++ b/drivers/input/touchscreen/sun4i-ts.c @@ -244,7 +244,7 @@ static int sun4i_ts_probe(struct platform_device *pdev) u32 tp_sensitive_adjust = 15; u32 filter_type = 1; - ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, struct sun4i_ts_data); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/surface3_spi.c b/drivers/input/touchscreen/surface3_spi.c index 9d74efc8d986..e7972d66ea2e 100644 --- a/drivers/input/touchscreen/surface3_spi.c +++ b/drivers/input/touchscreen/surface3_spi.c @@ -329,7 +329,7 @@ static int surface3_spi_probe(struct spi_device *spi) if (error) return error; - data = devm_kzalloc(&spi->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&spi->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c index 7311b5cd573f..23fb0c683592 100644 --- a/drivers/input/touchscreen/sx8654.c +++ b/drivers/input/touchscreen/sx8654.c @@ -314,7 +314,7 @@ static int sx8654_probe(struct i2c_client *client) I2C_FUNC_SMBUS_READ_WORD_DATA)) return -ENXIO; - sx8654 = devm_kzalloc(&client->dev, sizeof(*sx8654), GFP_KERNEL); + sx8654 = devm_kzalloc_obj(&client->dev, *sx8654); if (!sx8654) return -ENOMEM; diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index e84dc3ea1fcb..4e3eb7e66b2f 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c @@ -221,7 +221,7 @@ static int tps6507x_ts_probe(struct platform_device *pdev) */ init_data = tps_board->tps6507x_ts_init_data; - tsc = devm_kzalloc(&pdev->dev, sizeof(struct tps6507x_ts), GFP_KERNEL); + tsc = devm_kzalloc_obj(&pdev->dev, struct tps6507x_ts); if (!tsc) { dev_err(tps6507x_dev->dev, "failed to allocate driver data\n"); return -ENOMEM; diff --git a/drivers/input/touchscreen/ts4800-ts.c b/drivers/input/touchscreen/ts4800-ts.c index 98422d1e80d6..db8c3b12a2b1 100644 --- a/drivers/input/touchscreen/ts4800-ts.c +++ b/drivers/input/touchscreen/ts4800-ts.c @@ -151,7 +151,7 @@ static int ts4800_ts_probe(struct platform_device *pdev) struct ts4800_ts *ts; int error; - ts = devm_kzalloc(&pdev->dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&pdev->dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c index e2f49b37e18c..e8d87cf00f8e 100644 --- a/drivers/input/touchscreen/tsc2007_core.c +++ b/drivers/input/touchscreen/tsc2007_core.c @@ -303,7 +303,7 @@ static int tsc2007_probe(struct i2c_client *client) I2C_FUNC_SMBUS_READ_WORD_DATA)) return -EIO; - ts = devm_kzalloc(&client->dev, sizeof(struct tsc2007), GFP_KERNEL); + ts = devm_kzalloc_obj(&client->dev, struct tsc2007); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c index eba53613b005..4a756892ff66 100644 --- a/drivers/input/touchscreen/tsc200x-core.c +++ b/drivers/input/touchscreen/tsc200x-core.c @@ -452,7 +452,7 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id, return -ENODEV; } - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index dd7c2a8a831b..47238b37e7dc 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -179,7 +179,7 @@ static int wacom_i2c_probe(struct i2c_client *client) if (error) return error; - wac_i2c = devm_kzalloc(dev, sizeof(*wac_i2c), GFP_KERNEL); + wac_i2c = devm_kzalloc_obj(dev, *wac_i2c); if (!wac_i2c) return -ENOMEM; diff --git a/drivers/input/touchscreen/wacom_w9000.c b/drivers/input/touchscreen/wacom_w9000.c index 4a2629a54167..b5da3c877ff6 100644 --- a/drivers/input/touchscreen/wacom_w9000.c +++ b/drivers/input/touchscreen/wacom_w9000.c @@ -256,7 +256,7 @@ static int wacom_w9000_probe(struct i2c_client *client) return -EIO; } - wacom_data = devm_kzalloc(dev, sizeof(*wacom_data), GFP_KERNEL); + wacom_data = devm_kzalloc_obj(dev, *wacom_data); if (!wacom_data) return -ENOMEM; diff --git a/drivers/input/touchscreen/wdt87xx_i2c.c b/drivers/input/touchscreen/wdt87xx_i2c.c index 858c7efd0c29..48ca32d63d91 100644 --- a/drivers/input/touchscreen/wdt87xx_i2c.c +++ b/drivers/input/touchscreen/wdt87xx_i2c.c @@ -1067,7 +1067,7 @@ static int wdt87xx_ts_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -ENXIO; - wdt = devm_kzalloc(&client->dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(&client->dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/input/touchscreen/wm831x-ts.c b/drivers/input/touchscreen/wm831x-ts.c index 17c58b6fa123..32b03889acea 100644 --- a/drivers/input/touchscreen/wm831x-ts.c +++ b/drivers/input/touchscreen/wm831x-ts.c @@ -240,8 +240,7 @@ static int wm831x_ts_probe(struct platform_device *pdev) if (core_pdata) pdata = core_pdata->touch; - wm831x_ts = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ts), - GFP_KERNEL); + wm831x_ts = devm_kzalloc_obj(&pdev->dev, struct wm831x_ts); input_dev = devm_input_allocate_device(&pdev->dev); if (!wm831x_ts || !input_dev) { error = -ENOMEM; diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index f6b7c03f654f..ff12666f53db 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c @@ -686,7 +686,7 @@ static int wm97xx_probe(struct device *dev) int ret; struct wm97xx_pdata *pdata = dev_get_platdata(dev); - wm = devm_kzalloc(dev, sizeof(struct wm97xx), GFP_KERNEL); + wm = devm_kzalloc_obj(dev, struct wm97xx); if (!wm) return -ENOMEM; @@ -724,7 +724,7 @@ static int wm97xx_mfd_probe(struct platform_device *pdev) struct wm97xx_platform_data *mfd_pdata = dev_get_platdata(&pdev->dev); int ret; - wm = devm_kzalloc(&pdev->dev, sizeof(struct wm97xx), GFP_KERNEL); + wm = devm_kzalloc_obj(&pdev->dev, struct wm97xx); if (!wm) return -ENOMEM; diff --git a/drivers/input/touchscreen/zet6223.c b/drivers/input/touchscreen/zet6223.c index a341142f3708..177bc827fde0 100644 --- a/drivers/input/touchscreen/zet6223.c +++ b/drivers/input/touchscreen/zet6223.c @@ -177,7 +177,7 @@ static int zet6223_probe(struct i2c_client *client) return -EINVAL; } - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 4bfc9560bd6c..5eca54fdae85 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -684,7 +684,7 @@ static int zforce_probe(struct i2c_client *client) struct input_dev *input_dev; int error; - ts = devm_kzalloc(&client->dev, sizeof(struct zforce_ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&client->dev, struct zforce_ts); if (!ts) return -ENOMEM; diff --git a/drivers/input/touchscreen/zinitix.c b/drivers/input/touchscreen/zinitix.c index 0c36765bd79f..7bb2d1f4ddd0 100644 --- a/drivers/input/touchscreen/zinitix.c +++ b/drivers/input/touchscreen/zinitix.c @@ -622,7 +622,7 @@ static int zinitix_ts_probe(struct i2c_client *client) return -ENXIO; } - bt541 = devm_kzalloc(&client->dev, sizeof(*bt541), GFP_KERNEL); + bt541 = devm_kzalloc_obj(&client->dev, *bt541); if (!bt541) return -ENOMEM; diff --git a/drivers/interconnect/icc-clk.c b/drivers/interconnect/icc-clk.c index 93c030608d3e..306aedc4339c 100644 --- a/drivers/interconnect/icc-clk.c +++ b/drivers/interconnect/icc-clk.c @@ -84,12 +84,12 @@ struct icc_provider *icc_clk_register(struct device *dev, struct icc_node *node; int ret, i, j; - onecell = devm_kzalloc(dev, struct_size(onecell, nodes, 2 * num_clocks), GFP_KERNEL); + onecell = devm_kzalloc_flex(dev, *onecell, nodes, 2 * num_clocks); if (!onecell) return ERR_PTR(-ENOMEM); onecell->num_nodes = 2 * num_clocks; - qp = devm_kzalloc(dev, struct_size(qp, clocks, num_clocks), GFP_KERNEL); + qp = devm_kzalloc_flex(dev, *qp, clocks, num_clocks); if (!qp) return ERR_PTR(-ENOMEM); diff --git a/drivers/interconnect/imx/imx.c b/drivers/interconnect/imx/imx.c index 9511f80cf041..c6b8f07bd698 100644 --- a/drivers/interconnect/imx/imx.c +++ b/drivers/interconnect/imx/imx.c @@ -181,7 +181,7 @@ static struct icc_node *imx_icc_node_add(struct imx_icc_provider *imx_provider, return ERR_PTR(-EEXIST); } - node_data = devm_kzalloc(dev, sizeof(*node_data), GFP_KERNEL); + node_data = devm_kzalloc_obj(dev, *node_data); if (!node_data) { icc_node_destroy(node->id); return ERR_PTR(-ENOMEM); @@ -279,13 +279,12 @@ int imx_icc_register(struct platform_device *pdev, /* icc_onecell_data is indexed by node_id, unlike nodes param */ num_nodes = get_max_node_id(nodes, nodes_count) + 1; - data = devm_kzalloc(dev, struct_size(data, nodes, num_nodes), - GFP_KERNEL); + data = devm_kzalloc_flex(dev, *data, nodes, num_nodes); if (!data) return -ENOMEM; data->num_nodes = num_nodes; - imx_provider = devm_kzalloc(dev, sizeof(*imx_provider), GFP_KERNEL); + imx_provider = devm_kzalloc_obj(dev, *imx_provider); if (!imx_provider) return -ENOMEM; provider = &imx_provider->provider; diff --git a/drivers/interconnect/mediatek/icc-emi.c b/drivers/interconnect/mediatek/icc-emi.c index dfa3a9cd9399..62fe8d770146 100644 --- a/drivers/interconnect/mediatek/icc-emi.c +++ b/drivers/interconnect/mediatek/icc-emi.c @@ -92,11 +92,11 @@ int mtk_emi_icc_probe(struct platform_device *pdev) mnodes = desc->nodes; - provider = devm_kzalloc(dev, sizeof(*provider), GFP_KERNEL); + provider = devm_kzalloc_obj(dev, *provider); if (!provider) return -ENOMEM; - data = devm_kzalloc(dev, struct_size(data, nodes, desc->num_nodes), GFP_KERNEL); + data = devm_kzalloc_flex(dev, *data, nodes, desc->num_nodes); if (!data) return -ENOMEM; diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c index 0880a287b0c0..c835195b1095 100644 --- a/drivers/interconnect/qcom/bcm-voter.c +++ b/drivers/interconnect/qcom/bcm-voter.c @@ -395,7 +395,7 @@ static int qcom_icc_bcm_voter_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct bcm_voter *voter; - voter = devm_kzalloc(&pdev->dev, sizeof(*voter), GFP_KERNEL); + voter = devm_kzalloc_obj(&pdev->dev, *voter); if (!voter) return -ENOMEM; diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 6f325789a96e..603797b9e92b 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -539,15 +539,14 @@ int qnoc_probe(struct platform_device *pdev) cd_num = 0; } - qp = devm_kzalloc(dev, struct_size(qp, intf_clks, cd_num), GFP_KERNEL); + qp = devm_kzalloc_flex(dev, *qp, intf_clks, cd_num); if (!qp) return -ENOMEM; qp->num_intf_clks = cd_num; if (desc->bus_clk_desc) { - qp->bus_clk_desc = devm_kzalloc(dev, sizeof(*qp->bus_clk_desc), - GFP_KERNEL); + qp->bus_clk_desc = devm_kzalloc_obj(dev, *qp->bus_clk_desc); if (!qp->bus_clk_desc) return -ENOMEM; @@ -559,8 +558,7 @@ int qnoc_probe(struct platform_device *pdev) return PTR_ERR(qp->bus_clk); } - data = devm_kzalloc(dev, struct_size(data, nodes, num_nodes), - GFP_KERNEL); + data = devm_kzalloc_flex(dev, *data, nodes, num_nodes); if (!data) return -ENOMEM; data->num_nodes = num_nodes; diff --git a/drivers/interconnect/qcom/icc-rpmh.c b/drivers/interconnect/qcom/icc-rpmh.c index 4a2a746a4e59..73977f4f8372 100644 --- a/drivers/interconnect/qcom/icc-rpmh.c +++ b/drivers/interconnect/qcom/icc-rpmh.c @@ -295,11 +295,11 @@ int qcom_icc_rpmh_probe(struct platform_device *pdev) qnodes = desc->nodes; num_nodes = desc->num_nodes; - qp = devm_kzalloc(dev, sizeof(*qp), GFP_KERNEL); + qp = devm_kzalloc_obj(dev, *qp); if (!qp) return -ENOMEM; - data = devm_kzalloc(dev, struct_size(data, nodes, num_nodes), GFP_KERNEL); + data = devm_kzalloc_flex(dev, *data, nodes, num_nodes); if (!data) return -ENOMEM; data->num_nodes = num_nodes; diff --git a/drivers/interconnect/qcom/osm-l3.c b/drivers/interconnect/qcom/osm-l3.c index ecad636b53e0..e1aa600be975 100644 --- a/drivers/interconnect/qcom/osm-l3.c +++ b/drivers/interconnect/qcom/osm-l3.c @@ -182,7 +182,7 @@ static int qcom_osm_l3_probe(struct platform_device *pdev) hw_rate = clk_get_rate(clk) / CLK_HW_DIV; clk_put(clk); - qp = devm_kzalloc(&pdev->dev, sizeof(*qp), GFP_KERNEL); + qp = devm_kzalloc_obj(&pdev->dev, *qp); if (!qp) return -ENOMEM; @@ -226,7 +226,7 @@ static int qcom_osm_l3_probe(struct platform_device *pdev) qnodes = desc->nodes; num_nodes = desc->num_nodes; - data = devm_kzalloc(&pdev->dev, struct_size(data, nodes, num_nodes), GFP_KERNEL); + data = devm_kzalloc_flex(&pdev->dev, *data, nodes, num_nodes); if (!data) return -ENOMEM; data->num_nodes = num_nodes; diff --git a/drivers/interconnect/samsung/exynos.c b/drivers/interconnect/samsung/exynos.c index 9a4789fadac2..00c81b7979e6 100644 --- a/drivers/interconnect/samsung/exynos.c +++ b/drivers/interconnect/samsung/exynos.c @@ -110,7 +110,7 @@ static int exynos_generic_icc_probe(struct platform_device *pdev) struct icc_node *icc_node, *icc_parent_node; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index ebf4547d32b4..d8302128b465 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -1166,7 +1166,7 @@ static int apple_dart_probe(struct platform_device *pdev) struct apple_dart *dart; struct device *dev = &pdev->dev; - dart = devm_kzalloc(dev, sizeof(*dart), GFP_KERNEL); + dart = devm_kzalloc_obj(dev, *dart); if (!dart) return -ENOMEM; diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index 6d4520c47308..100b34f07032 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -4809,8 +4809,8 @@ static int arm_smmu_init_strtab_2lvl(struct arm_smmu_device *smmu) return -ENOMEM; } - cfg->l2.l2ptrs = devm_kcalloc(smmu->dev, cfg->l2.num_l1_ents, - sizeof(*cfg->l2.l2ptrs), GFP_KERNEL); + cfg->l2.l2ptrs = devm_kzalloc_objs(smmu->dev, *cfg->l2.l2ptrs, + cfg->l2.num_l1_ents); if (!cfg->l2.l2ptrs) return -ENOMEM; @@ -5787,7 +5787,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev) struct arm_smmu_device *smmu; struct device *dev = &pdev->dev; - smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL); + smmu = devm_kzalloc_obj(dev, *smmu); if (!smmu) return -ENOMEM; smmu->dev = dev; diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c index 531b29fbf492..2225fc9c8c05 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c @@ -479,7 +479,7 @@ int qcom_tbu_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct qcom_tbu *tbu; - tbu = devm_kzalloc(dev, sizeof(*tbu), GFP_KERNEL); + tbu = devm_kzalloc_obj(dev, *tbu); if (!tbu) return -ENOMEM; diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index 182b5f13e1bb..8d50a4ad221d 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -1815,8 +1815,7 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) } /* Zero-initialised to mark as invalid */ - smmu->smrs = devm_kcalloc(smmu->dev, size, sizeof(*smmu->smrs), - GFP_KERNEL); + smmu->smrs = devm_kzalloc_objs(smmu->dev, *smmu->smrs, size); if (!smmu->smrs) return -ENOMEM; @@ -1824,8 +1823,7 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) "\tstream matching with %u register groups", size); } /* s2cr->type == 0 means translation, so initialise explicitly */ - smmu->s2crs = devm_kmalloc_array(smmu->dev, size, sizeof(*smmu->s2crs), - GFP_KERNEL); + smmu->s2crs = devm_kmalloc_objs(smmu->dev, *smmu->s2crs, size); if (!smmu->s2crs) return -ENOMEM; for (i = 0; i < size; i++) @@ -1863,8 +1861,8 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) } dev_notice(smmu->dev, "\t%u context banks (%u stage-2 only)\n", smmu->num_context_banks, smmu->num_s2_context_banks); - smmu->cbs = devm_kcalloc(smmu->dev, smmu->num_context_banks, - sizeof(*smmu->cbs), GFP_KERNEL); + smmu->cbs = devm_kzalloc_objs(smmu->dev, *smmu->cbs, + smmu->num_context_banks); if (!smmu->cbs) return -ENOMEM; @@ -2124,7 +2122,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev) u32 global_irqs, pmu_irqs; irqreturn_t (*global_fault)(int irq, void *dev); - smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL); + smmu = devm_kzalloc_obj(dev, *smmu); if (!smmu) { dev_err(dev, "failed to allocate arm_smmu_device\n"); return -ENOMEM; @@ -2161,8 +2159,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev) "found %d interrupts but expected at least %d\n", num_irqs, global_irqs + pmu_irqs + 1); - smmu->irqs = devm_kcalloc(dev, smmu->num_context_irqs, - sizeof(*smmu->irqs), GFP_KERNEL); + smmu->irqs = devm_kzalloc_objs(dev, *smmu->irqs, smmu->num_context_irqs); if (!smmu->irqs) return dev_err_probe(dev, -ENOMEM, "failed to allocate %d irqs\n", smmu->num_context_irqs); diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c index 21d18ce67b98..96903cd9cfc2 100644 --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c @@ -683,7 +683,7 @@ static int qcom_iommu_ctx_probe(struct platform_device *pdev) struct qcom_iommu_dev *qcom_iommu = dev_get_drvdata(dev->parent); int ret, irq; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; @@ -788,8 +788,7 @@ static int qcom_iommu_device_probe(struct platform_device *pdev) for_each_child_of_node(dev->of_node, child) max_asid = max(max_asid, get_asid(child)); - qcom_iommu = devm_kzalloc(dev, struct_size(qcom_iommu, ctxs, max_asid + 1), - GFP_KERNEL); + qcom_iommu = devm_kzalloc_flex(dev, *qcom_iommu, ctxs, max_asid + 1); if (!qcom_iommu) return -ENOMEM; qcom_iommu->max_asid = max_asid; diff --git a/drivers/iommu/bcm2712-iommu-cache.c b/drivers/iommu/bcm2712-iommu-cache.c index 8ed436943b83..afaeec75284b 100644 --- a/drivers/iommu/bcm2712-iommu-cache.c +++ b/drivers/iommu/bcm2712-iommu-cache.c @@ -53,7 +53,7 @@ static int bcm2712_iommu_cache_probe(struct platform_device *pdev) { struct bcm2712_iommu_cache *cache; - cache = devm_kzalloc(&pdev->dev, sizeof(*cache), GFP_KERNEL); + cache = devm_kzalloc_obj(&pdev->dev, *cache); if (!cache) return -ENOMEM; diff --git a/drivers/iommu/bcm2712-iommu.c b/drivers/iommu/bcm2712-iommu.c index 301855475c88..1bbb14fa1027 100644 --- a/drivers/iommu/bcm2712-iommu.c +++ b/drivers/iommu/bcm2712-iommu.c @@ -503,7 +503,7 @@ static int bcm2712_iommu_probe(struct platform_device *pdev) struct bcm2712_iommu *mmu; int ret; - mmu = devm_kzalloc(dev, sizeof(*mmu), GFP_KERNEL); + mmu = devm_kzalloc_obj(dev, *mmu); if (!mmu) return -ENOMEM; diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 0bca3662fdc2..7c337ba96a01 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -760,7 +760,7 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) struct sysmmu_drvdata *data; struct resource *res; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index 9386b752dea2..f32dceb32237 100644 --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ipmmu-vmsa.c @@ -1009,7 +1009,7 @@ static int ipmmu_probe(struct platform_device *pdev) int irq; int ret; - mmu = devm_kzalloc(&pdev->dev, sizeof(*mmu), GFP_KERNEL); + mmu = devm_kzalloc_obj(&pdev->dev, *mmu); if (!mmu) { dev_err(&pdev->dev, "cannot allocate device data\n"); return -ENOMEM; diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c index 4ef1e8c8244b..d79d5ff2a551 100644 --- a/drivers/iommu/msm_iommu.c +++ b/drivers/iommu/msm_iommu.c @@ -721,7 +721,7 @@ static int msm_iommu_probe(struct platform_device *pdev) struct msm_iommu_dev *iommu; int ret, par, val; - iommu = devm_kzalloc(&pdev->dev, sizeof(*iommu), GFP_KERNEL); + iommu = devm_kzalloc_obj(&pdev->dev, *iommu); if (!iommu) return -ENOMEM; diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index b52e16b06760..e3d471701c2f 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1304,7 +1304,7 @@ static int mtk_iommu_probe(struct platform_device *pdev) struct mtk_iommu_bank_data *bank; void __iomem *base; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; data->dev = dev; diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index e907c9953142..66df5bb67a47 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -615,7 +615,7 @@ static int mtk_iommu_v1_probe(struct platform_device *pdev) void *protect; int larb_nr, ret, i; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/iommu/riscv/iommu-pci.c b/drivers/iommu/riscv/iommu-pci.c index 8abf52dfb4c9..3bc3972c0aa1 100644 --- a/drivers/iommu/riscv/iommu-pci.c +++ b/drivers/iommu/riscv/iommu-pci.c @@ -50,7 +50,7 @@ static int riscv_iommu_pci_probe(struct pci_dev *pdev, const struct pci_device_i if (rc) return dev_err_probe(dev, rc, "pcim_iomap_regions failed\n"); - iommu = devm_kzalloc(dev, sizeof(*iommu), GFP_KERNEL); + iommu = devm_kzalloc_obj(dev, *iommu); if (!iommu) return -ENOMEM; diff --git a/drivers/iommu/riscv/iommu-platform.c b/drivers/iommu/riscv/iommu-platform.c index 399ba8fe1b3e..9cb8bb1e8013 100644 --- a/drivers/iommu/riscv/iommu-platform.c +++ b/drivers/iommu/riscv/iommu-platform.c @@ -52,7 +52,7 @@ static int riscv_iommu_platform_probe(struct platform_device *pdev) struct resource *res = NULL; int vec, ret; - iommu = devm_kzalloc(dev, sizeof(*iommu), GFP_KERNEL); + iommu = devm_kzalloc_obj(dev, *iommu); if (!iommu) return -ENOMEM; diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index 21af2f621c76..1fa3110b142a 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -1186,7 +1186,7 @@ static int rk_iommu_of_xlate(struct device *dev, iommu_dev = of_find_device_by_node(args->np); - data = devm_kzalloc(&iommu_dev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&iommu_dev->dev, *data); if (!data) return -ENOMEM; @@ -1222,7 +1222,7 @@ static int rk_iommu_probe(struct platform_device *pdev) int num_res = pdev->num_resources; int err, i; - iommu = devm_kzalloc(dev, sizeof(*iommu), GFP_KERNEL); + iommu = devm_kzalloc_obj(dev, *iommu); if (!iommu) return -ENOMEM; @@ -1236,8 +1236,7 @@ static int rk_iommu_probe(struct platform_device *pdev) if (!iommu->rk_ops) return -ENOENT; - iommu->bases = devm_kcalloc(dev, num_res, sizeof(*iommu->bases), - GFP_KERNEL); + iommu->bases = devm_kzalloc_objs(dev, *iommu->bases, num_res); if (!iommu->bases) return -ENOMEM; diff --git a/drivers/iommu/sprd-iommu.c b/drivers/iommu/sprd-iommu.c index c1a34445d244..39af62f960aa 100644 --- a/drivers/iommu/sprd-iommu.c +++ b/drivers/iommu/sprd-iommu.c @@ -464,7 +464,7 @@ static int sprd_iommu_probe(struct platform_device *pdev) void __iomem *base; int ret; - sdev = devm_kzalloc(dev, sizeof(*sdev), GFP_KERNEL); + sdev = devm_kzalloc_obj(dev, *sdev); if (!sdev) return -ENOMEM; diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c index be3f1ce696ba..acdccb7c9eef 100644 --- a/drivers/iommu/sun50i-iommu.c +++ b/drivers/iommu/sun50i-iommu.c @@ -1001,7 +1001,7 @@ static int sun50i_iommu_probe(struct platform_device *pdev) struct sun50i_iommu *iommu; int ret, irq; - iommu = devm_kzalloc(&pdev->dev, sizeof(*iommu), GFP_KERNEL); + iommu = devm_kzalloc_obj(&pdev->dev, *iommu); if (!iommu) return -ENOMEM; spin_lock_init(&iommu->iommu_lock); diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index d1d7442caeb3..c7e407d74157 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -934,7 +934,7 @@ static struct iommu_group *tegra_smmu_device_group(struct device *dev) return grp; } - group = devm_kzalloc(smmu->dev, sizeof(*group), GFP_KERNEL); + group = devm_kzalloc_obj(smmu->dev, *group); if (!group) { mutex_unlock(&smmu->lock); return NULL; @@ -1110,7 +1110,7 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev, u32 value; int err; - smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL); + smmu = devm_kzalloc_obj(dev, *smmu); if (!smmu) return ERR_PTR(-ENOMEM); diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 587fc13197f1..32da2ab42be1 100644 --- a/drivers/iommu/virtio-iommu.c +++ b/drivers/iommu/virtio-iommu.c @@ -1130,8 +1130,7 @@ static int viommu_fill_evtq(struct viommu_dev *viommu) struct virtqueue *vq = viommu->vqs[VIOMMU_EVENT_VQ]; size_t nr_evts = vq->num_free; - viommu->evts = evts = devm_kmalloc_array(viommu->dev, nr_evts, - sizeof(*evts), GFP_KERNEL); + viommu->evts = evts = devm_kmalloc_objs(viommu->dev, *evts, nr_evts); if (!evts) return -ENOMEM; @@ -1158,7 +1157,7 @@ static int viommu_probe(struct virtio_device *vdev) !virtio_has_feature(vdev, VIRTIO_IOMMU_F_MAP_UNMAP)) return -ENODEV; - viommu = devm_kzalloc(dev, sizeof(*viommu), GFP_KERNEL); + viommu = devm_kzalloc_obj(dev, *viommu); if (!viommu) return -ENOMEM; diff --git a/drivers/iommu/vsi-iommu.c b/drivers/iommu/vsi-iommu.c index 5dac20b143a5..0633fe82d443 100644 --- a/drivers/iommu/vsi-iommu.c +++ b/drivers/iommu/vsi-iommu.c @@ -672,7 +672,7 @@ static int vsi_iommu_probe(struct platform_device *pdev) struct vsi_iommu *iommu; int err; - iommu = devm_kzalloc(dev, sizeof(*iommu), GFP_KERNEL); + iommu = devm_kzalloc_obj(dev, *iommu); if (!iommu) return -ENOMEM; diff --git a/drivers/irqchip/irq-ast2700-intc0.c b/drivers/irqchip/irq-ast2700-intc0.c index 1e375e9dffae..0a0c34cd1e83 100644 --- a/drivers/irqchip/irq-ast2700-intc0.c +++ b/drivers/irqchip/irq-ast2700-intc0.c @@ -536,7 +536,7 @@ static int aspeed_intc0_probe(struct platform_device *pdev, return -ENODEV; } - intc0 = devm_kzalloc(&pdev->dev, sizeof(*intc0), GFP_KERNEL); + intc0 = devm_kzalloc_obj(&pdev->dev, *intc0); if (!intc0) return -ENOMEM; diff --git a/drivers/irqchip/irq-ast2700-intc1.c b/drivers/irqchip/irq-ast2700-intc1.c index df6acbafce2d..aa5240ce1c57 100644 --- a/drivers/irqchip/irq-ast2700-intc1.c +++ b/drivers/irqchip/irq-ast2700-intc1.c @@ -245,7 +245,7 @@ static int aspeed_intc1_probe(struct platform_device *pdev, if (!host) return -ENODEV; - intc1 = devm_kzalloc(&pdev->dev, sizeof(*intc1), GFP_KERNEL); + intc1 = devm_kzalloc_obj(&pdev->dev, *intc1); if (!intc1) return -ENOMEM; diff --git a/drivers/irqchip/irq-ast2700.c b/drivers/irqchip/irq-ast2700.c index 1e4c4a624dbf..035e2f43b8cf 100644 --- a/drivers/irqchip/irq-ast2700.c +++ b/drivers/irqchip/irq-ast2700.c @@ -39,10 +39,8 @@ int aspeed_intc_populate_ranges(struct device *dev, return -EINVAL; /* Over-estimate the range entry count for now */ - ranges->ranges = devm_kmalloc_array(dev, - len / (ASPEED_INTC_RANGE_FIXED_CELLS * sizeof(__be32)), - sizeof(*ranges->ranges), - GFP_KERNEL); + ranges->ranges = devm_kmalloc_objs(dev, *ranges->ranges, + len / (ASPEED_INTC_RANGE_FIXED_CELLS * sizeof(__be32))); if (!ranges->ranges) return -ENOMEM; diff --git a/drivers/irqchip/irq-gic-pm.c b/drivers/irqchip/irq-gic-pm.c index a275a8071a25..a17efdaad14c 100644 --- a/drivers/irqchip/irq-gic-pm.c +++ b/drivers/irqchip/irq-gic-pm.c @@ -75,7 +75,7 @@ static int gic_probe(struct platform_device *pdev) return -ENODEV; } - chip_pm = devm_kzalloc(dev, sizeof(*chip_pm), GFP_KERNEL); + chip_pm = devm_kzalloc_obj(dev, *chip_pm); if (!chip_pm) return -ENOMEM; @@ -85,8 +85,7 @@ static int gic_probe(struct platform_device *pdev) return -EINVAL; } - chip_pm->clks = devm_kcalloc(dev, data->num_clocks, - sizeof(*chip_pm->clks), GFP_KERNEL); + chip_pm->clks = devm_kzalloc_objs(dev, *chip_pm->clks, data->num_clocks); if (!chip_pm->clks) return -ENOMEM; diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index a5ca04e9be64..420261208cd0 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c @@ -1419,7 +1419,7 @@ int gic_of_init_child(struct device *dev, struct gic_chip_data **gic, int irq) if (!dev || !dev->of_node || !gic || !irq) return -EINVAL; - *gic = devm_kzalloc(dev, sizeof(**gic), GFP_KERNEL); + *gic = devm_kzalloc_obj(dev, **gic); if (!*gic) return -ENOMEM; diff --git a/drivers/irqchip/irq-imx-intmux.c b/drivers/irqchip/irq-imx-intmux.c index de2a8f98f625..c7914fea3d1f 100644 --- a/drivers/irqchip/irq-imx-intmux.c +++ b/drivers/irqchip/irq-imx-intmux.c @@ -215,7 +215,7 @@ static int imx_intmux_probe(struct platform_device *pdev) return -EINVAL; } - data = devm_kzalloc(&pdev->dev, struct_size(data, irqchip_data, channum), GFP_KERNEL); + data = devm_kzalloc_flex(&pdev->dev, *data, irqchip_data, channum); if (!data) return -ENOMEM; diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c index 87b07f517be3..8b58da82c367 100644 --- a/drivers/irqchip/irq-imx-irqsteer.c +++ b/drivers/irqchip/irq-imx-irqsteer.c @@ -182,7 +182,7 @@ static int imx_irqsteer_probe(struct platform_device *pdev) u32 irqs_num; int i, ret; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/irqchip/irq-imx-mu-msi.c b/drivers/irqchip/irq-imx-mu-msi.c index c598f2f52fc6..6d7baeeb2bc8 100644 --- a/drivers/irqchip/irq-imx-mu-msi.c +++ b/drivers/irqchip/irq-imx-mu-msi.c @@ -311,7 +311,7 @@ static int imx_mu_probe(struct platform_device *pdev, struct device_node *parent dev = &pdev->dev; - msi_data = devm_kzalloc(&pdev->dev, sizeof(*msi_data), GFP_KERNEL); + msi_data = devm_kzalloc_obj(&pdev->dev, *msi_data); if (!msi_data) return -ENOMEM; diff --git a/drivers/irqchip/irq-keystone.c b/drivers/irqchip/irq-keystone.c index 922fff09354f..889cd48a7192 100644 --- a/drivers/irqchip/irq-keystone.c +++ b/drivers/irqchip/irq-keystone.c @@ -137,7 +137,7 @@ static int keystone_irq_probe(struct platform_device *pdev) if (np == NULL) return -EINVAL; - kirq = devm_kzalloc(dev, sizeof(*kirq), GFP_KERNEL); + kirq = devm_kzalloc_obj(dev, *kirq); if (!kirq) return -ENOMEM; diff --git a/drivers/irqchip/irq-lan966x-oic.c b/drivers/irqchip/irq-lan966x-oic.c index 5122f3f1b353..40e1f26201da 100644 --- a/drivers/irqchip/irq-lan966x-oic.c +++ b/drivers/irqchip/irq-lan966x-oic.c @@ -231,7 +231,7 @@ static int lan966x_oic_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct irq_domain *domain; - lan966x_oic = devm_kmalloc(dev, sizeof(*lan966x_oic), GFP_KERNEL); + lan966x_oic = devm_kmalloc_obj(dev, *lan966x_oic); if (!lan966x_oic) return -ENOMEM; diff --git a/drivers/irqchip/irq-ls-extirq.c b/drivers/irqchip/irq-ls-extirq.c index d724fe843980..b791cb03a44a 100644 --- a/drivers/irqchip/irq-ls-extirq.c +++ b/drivers/irqchip/irq-ls-extirq.c @@ -185,7 +185,7 @@ static int ls_extirq_probe(struct platform_device *pdev) if (!parent_domain) return dev_err_probe(dev, -EPROBE_DEFER, "Cannot find parent domain\n"); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return dev_err_probe(dev, -ENOMEM, "Failed to allocate memory\n"); diff --git a/drivers/irqchip/irq-ls-scfg-msi.c b/drivers/irqchip/irq-ls-scfg-msi.c index 4910f364e568..50ce01c9cd2d 100644 --- a/drivers/irqchip/irq-ls-scfg-msi.c +++ b/drivers/irqchip/irq-ls-scfg-msi.c @@ -333,7 +333,7 @@ static int ls_scfg_msi_probe(struct platform_device *pdev) struct resource *res; int i, ret; - msi_data = devm_kzalloc(&pdev->dev, sizeof(*msi_data), GFP_KERNEL); + msi_data = devm_kzalloc_obj(&pdev->dev, *msi_data); if (!msi_data) return -ENOMEM; @@ -374,9 +374,8 @@ static int ls_scfg_msi_probe(struct platform_device *pdev) msi_affinity_flag = 0; } - msi_data->msir = devm_kcalloc(&pdev->dev, msi_data->msir_num, - sizeof(*msi_data->msir), - GFP_KERNEL); + msi_data->msir = devm_kzalloc_objs(&pdev->dev, *msi_data->msir, + msi_data->msir_num); if (!msi_data->msir) return -ENOMEM; diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c index 0b4d78a0bbde..ee0d426e6fc4 100644 --- a/drivers/irqchip/irq-mbigen.c +++ b/drivers/irqchip/irq-mbigen.c @@ -304,7 +304,7 @@ static int mbigen_device_probe(struct platform_device *pdev) struct resource *res; int err; - mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL); + mgn_chip = devm_kzalloc_obj(&pdev->dev, *mgn_chip); if (!mgn_chip) return -ENOMEM; diff --git a/drivers/irqchip/irq-mvebu-gicp.c b/drivers/irqchip/irq-mvebu-gicp.c index 667bde3c651f..10ff1f49425e 100644 --- a/drivers/irqchip/irq-mvebu-gicp.c +++ b/drivers/irqchip/irq-mvebu-gicp.c @@ -180,7 +180,7 @@ static int mvebu_gicp_probe(struct platform_device *pdev) void __iomem *base; int ret, i; - gicp = devm_kzalloc(&pdev->dev, sizeof(*gicp), GFP_KERNEL); + gicp = devm_kzalloc_obj(&pdev->dev, *gicp); if (!gicp) return -ENOMEM; @@ -198,10 +198,8 @@ static int mvebu_gicp_probe(struct platform_device *pdev) gicp->spi_ranges_cnt = ret / 2; gicp->spi_ranges = - devm_kcalloc(&pdev->dev, - gicp->spi_ranges_cnt, - sizeof(struct mvebu_gicp_spi_range), - GFP_KERNEL); + devm_kzalloc_objs(&pdev->dev, struct mvebu_gicp_spi_range, + gicp->spi_ranges_cnt); if (!gicp->spi_ranges) return -ENOMEM; diff --git a/drivers/irqchip/irq-mvebu-icu.c b/drivers/irqchip/irq-mvebu-icu.c index db5dbc6e88b0..74ccf72497e0 100644 --- a/drivers/irqchip/irq-mvebu-icu.c +++ b/drivers/irqchip/irq-mvebu-icu.c @@ -264,7 +264,7 @@ static int mvebu_icu_subset_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; bool sei; - msi_data = devm_kzalloc(dev, sizeof(*msi_data), GFP_KERNEL); + msi_data = devm_kzalloc_obj(dev, *msi_data); if (!msi_data) return -ENOMEM; @@ -309,8 +309,7 @@ static int mvebu_icu_probe(struct platform_device *pdev) struct mvebu_icu *icu; int i; - icu = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_icu), - GFP_KERNEL); + icu = devm_kzalloc_obj(&pdev->dev, struct mvebu_icu); if (!icu) return -ENOMEM; diff --git a/drivers/irqchip/irq-mvebu-pic.c b/drivers/irqchip/irq-mvebu-pic.c index 10b85128183a..81ea0e79402d 100644 --- a/drivers/irqchip/irq-mvebu-pic.c +++ b/drivers/irqchip/irq-mvebu-pic.c @@ -135,7 +135,7 @@ static int mvebu_pic_probe(struct platform_device *pdev) struct device_node *node = pdev->dev.of_node; struct mvebu_pic *pic; - pic = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pic), GFP_KERNEL); + pic = devm_kzalloc_obj(&pdev->dev, struct mvebu_pic); if (!pic) return -ENOMEM; diff --git a/drivers/irqchip/irq-mvebu-sei.c b/drivers/irqchip/irq-mvebu-sei.c index 5822ea864765..5a6b61b2fb1a 100644 --- a/drivers/irqchip/irq-mvebu-sei.c +++ b/drivers/irqchip/irq-mvebu-sei.c @@ -374,7 +374,7 @@ static int mvebu_sei_probe(struct platform_device *pdev) u32 parent_irq; int ret; - sei = devm_kzalloc(&pdev->dev, sizeof(*sei), GFP_KERNEL); + sei = devm_kzalloc_obj(&pdev->dev, *sei); if (!sei) return -ENOMEM; diff --git a/drivers/irqchip/irq-pruss-intc.c b/drivers/irqchip/irq-pruss-intc.c index 5a3e9e5bccbe..9a3efd40790c 100644 --- a/drivers/irqchip/irq-pruss-intc.c +++ b/drivers/irqchip/irq-pruss-intc.c @@ -513,7 +513,7 @@ static int pruss_intc_probe(struct platform_device *pdev) int i, irq, ret; u8 max_system_events, irqs_reserved = 0; - intc = devm_kzalloc(dev, sizeof(*intc), GFP_KERNEL); + intc = devm_kzalloc_obj(dev, *intc); if (!intc) return -ENOMEM; @@ -562,7 +562,7 @@ static int pruss_intc_probe(struct platform_device *pdev) intc->irqs[i] = irq; - host_data = devm_kzalloc(dev, sizeof(*host_data), GFP_KERNEL); + host_data = devm_kzalloc_obj(dev, *host_data); if (!host_data) { ret = -ENOMEM; goto fail_irq; diff --git a/drivers/irqchip/irq-qcom-mpm.c b/drivers/irqchip/irq-qcom-mpm.c index 8c575d7ce8a1..86cc3589cdf1 100644 --- a/drivers/irqchip/irq-qcom-mpm.c +++ b/drivers/irqchip/irq-qcom-mpm.c @@ -335,7 +335,7 @@ static int qcom_mpm_probe(struct platform_device *pdev, struct device_node *pare int i, irq; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -359,8 +359,7 @@ static int qcom_mpm_probe(struct platform_device *pdev, struct device_node *pare } priv->map_cnt = ret / 2; - priv->maps = devm_kcalloc(dev, priv->map_cnt, sizeof(*priv->maps), - GFP_KERNEL); + priv->maps = devm_kzalloc_objs(dev, *priv->maps, priv->map_cnt); if (!priv->maps) return -ENOMEM; diff --git a/drivers/irqchip/irq-renesas-intc-irqpin.c b/drivers/irqchip/irq-renesas-intc-irqpin.c index 7951292d2d9b..738d21d4844e 100644 --- a/drivers/irqchip/irq-renesas-intc-irqpin.c +++ b/drivers/irqchip/irq-renesas-intc-irqpin.c @@ -384,7 +384,7 @@ static int intc_irqpin_probe(struct platform_device *pdev) int ret; int k; - p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(dev, *p); if (!p) return -ENOMEM; diff --git a/drivers/irqchip/irq-renesas-irqc.c b/drivers/irqchip/irq-renesas-irqc.c index 1ff3535a4617..70a27b978e2a 100644 --- a/drivers/irqchip/irq-renesas-irqc.c +++ b/drivers/irqchip/irq-renesas-irqc.c @@ -129,7 +129,7 @@ static int irqc_probe(struct platform_device *pdev) int ret; int k; - p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(dev, *p); if (!p) return -ENOMEM; diff --git a/drivers/irqchip/irq-renesas-rza1.c b/drivers/irqchip/irq-renesas-rza1.c index 370d968b2398..f99645c4b7de 100644 --- a/drivers/irqchip/irq-renesas-rza1.c +++ b/drivers/irqchip/irq-renesas-rza1.c @@ -186,7 +186,7 @@ static int rza1_irqc_probe(struct platform_device *pdev) struct rza1_irqc_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c index b3774f82855a..32e5c0a8d5db 100644 --- a/drivers/irqchip/irq-renesas-rzg2l.c +++ b/drivers/irqchip/irq-renesas-rzg2l.c @@ -838,7 +838,7 @@ static int rzg2l_irqc_common_probe(struct platform_device *pdev, struct device_n if (!parent_domain) return dev_err_probe(dev, -ENODEV, "cannot find parent domain\n"); - rzg2l_irqc_data = devm_kzalloc(dev, sizeof(*rzg2l_irqc_data), GFP_KERNEL); + rzg2l_irqc_data = devm_kzalloc_obj(dev, *rzg2l_irqc_data); if (!rzg2l_irqc_data) return -ENOMEM; @@ -851,8 +851,9 @@ static int rzg2l_irqc_common_probe(struct platform_device *pdev, struct device_n rzg2l_irqc_data->info = info; - rzg2l_irqc_data->fwspec = devm_kcalloc(&pdev->dev, info.num_irq, - sizeof(*rzg2l_irqc_data->fwspec), GFP_KERNEL); + rzg2l_irqc_data->fwspec = devm_kzalloc_objs(&pdev->dev, + *rzg2l_irqc_data->fwspec, + info.num_irq); if (!rzg2l_irqc_data->fwspec) return -ENOMEM; diff --git a/drivers/irqchip/irq-renesas-rzt2h.c b/drivers/irqchip/irq-renesas-rzt2h.c index 9086fc3a2043..f0f89a36cdd0 100644 --- a/drivers/irqchip/irq-renesas-rzt2h.c +++ b/drivers/irqchip/irq-renesas-rzt2h.c @@ -485,7 +485,7 @@ static int rzt2h_icu_init(struct platform_device *pdev, struct device_node *pare if (!parent_domain) return dev_err_probe(dev, -ENODEV, "cannot find parent domain\n"); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/irqchip/irq-renesas-rzv2h.c b/drivers/irqchip/irq-renesas-rzv2h.c index 485c3eea7632..806be528b6d4 100644 --- a/drivers/irqchip/irq-renesas-rzv2h.c +++ b/drivers/irqchip/irq-renesas-rzv2h.c @@ -864,7 +864,7 @@ static int rzv2h_icu_probe_common(struct platform_device *pdev, struct device_no if (!parent_domain) return dev_err_probe(dev, -ENODEV, "cannot find parent domain\n"); - rzv2h_icu_data = devm_kzalloc(dev, sizeof(*rzv2h_icu_data), GFP_KERNEL); + rzv2h_icu_data = devm_kzalloc_obj(dev, *rzv2h_icu_data); if (!rzv2h_icu_data) return -ENOMEM; diff --git a/drivers/irqchip/irq-riscv-aplic-direct.c b/drivers/irqchip/irq-riscv-aplic-direct.c index 5a9650225dd8..bfd11a884316 100644 --- a/drivers/irqchip/irq-riscv-aplic-direct.c +++ b/drivers/irqchip/irq-riscv-aplic-direct.c @@ -239,7 +239,7 @@ int aplic_direct_setup(struct device *dev, void __iomem *regs) unsigned long hartid; u32 v, hwirq; - direct = devm_kzalloc(dev, sizeof(*direct), GFP_KERNEL); + direct = devm_kzalloc_obj(dev, *direct); if (!direct) return -ENOMEM; priv = &direct->priv; diff --git a/drivers/irqchip/irq-riscv-aplic-msi.c b/drivers/irqchip/irq-riscv-aplic-msi.c index fb8d1838609f..d0ca3c17def0 100644 --- a/drivers/irqchip/irq-riscv-aplic-msi.c +++ b/drivers/irqchip/irq-riscv-aplic-msi.c @@ -181,7 +181,7 @@ int aplic_msi_setup(struct device *dev, void __iomem *regs) phys_addr_t pa; int rc; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/irqchip/irq-riscv-rpmi-sysmsi.c b/drivers/irqchip/irq-riscv-rpmi-sysmsi.c index bc80c38bb864..7461d5339ddf 100644 --- a/drivers/irqchip/irq-riscv-rpmi-sysmsi.c +++ b/drivers/irqchip/irq-riscv-rpmi-sysmsi.c @@ -215,7 +215,7 @@ static int rpmi_sysmsi_probe(struct platform_device *pdev) u32 id; int rc; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; priv->dev = dev; diff --git a/drivers/irqchip/irq-sg2042-msi.c b/drivers/irqchip/irq-sg2042-msi.c index f7cf0dc72eab..9ef29bd4d60b 100644 --- a/drivers/irqchip/irq-sg2042-msi.c +++ b/drivers/irqchip/irq-sg2042-msi.c @@ -254,7 +254,7 @@ static int sg2042_msi_probe(struct platform_device *pdev) struct resource *res; int ret; - data = devm_kzalloc(dev, sizeof(struct sg204x_msi_chipdata), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct sg204x_msi_chipdata); if (!data) return -ENOMEM; diff --git a/drivers/irqchip/irq-sl28cpld.c b/drivers/irqchip/irq-sl28cpld.c index 9892c020e0be..51067e83763d 100644 --- a/drivers/irqchip/irq-sl28cpld.c +++ b/drivers/irqchip/irq-sl28cpld.c @@ -43,7 +43,7 @@ static int sl28cpld_intc_probe(struct platform_device *pdev) if (!dev->parent) return -ENODEV; - irqchip = devm_kzalloc(dev, sizeof(*irqchip), GFP_KERNEL); + irqchip = devm_kzalloc_obj(dev, *irqchip); if (!irqchip) return -ENOMEM; diff --git a/drivers/irqchip/irq-st.c b/drivers/irqchip/irq-st.c index fef0521831aa..b6fccf80e31f 100644 --- a/drivers/irqchip/irq-st.c +++ b/drivers/irqchip/irq-st.c @@ -140,7 +140,7 @@ static int st_irq_syscfg_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct st_irq_syscfg *ddata; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/irqchip/irq-stm32mp-exti.c b/drivers/irqchip/irq-stm32mp-exti.c index a19e91fbd010..ac29d7edfa36 100644 --- a/drivers/irqchip/irq-stm32mp-exti.c +++ b/drivers/irqchip/irq-stm32mp-exti.c @@ -627,7 +627,7 @@ static int stm32mp_exti_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; int ret, i; - host_data = devm_kzalloc(dev, sizeof(*host_data), GFP_KERNEL); + host_data = devm_kzalloc_obj(dev, *host_data); if (!host_data) return -ENOMEM; @@ -660,9 +660,8 @@ static int stm32mp_exti_probe(struct platform_device *pdev) } host_data->drv_data = drv_data; - host_data->chips_data = devm_kcalloc(dev, drv_data->bank_nr, - sizeof(*host_data->chips_data), - GFP_KERNEL); + host_data->chips_data = devm_kzalloc_objs(dev, *host_data->chips_data, + drv_data->bank_nr); if (!host_data->chips_data) return -ENOMEM; diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c index f1eb2f92f0ca..0039d0a44154 100644 --- a/drivers/irqchip/irq-ti-sci-inta.c +++ b/drivers/irqchip/irq-ti-sci-inta.c @@ -620,9 +620,8 @@ static int ti_sci_inta_get_unmapped_sources(struct ti_sci_inta_irq_domain *inta) if (count <= 0) return 0; - inta->unmapped_dev_ids = devm_kcalloc(dev, count, - sizeof(*inta->unmapped_dev_ids), - GFP_KERNEL); + inta->unmapped_dev_ids = devm_kzalloc_objs(dev, *inta->unmapped_dev_ids, + count); if (!inta->unmapped_dev_ids) return -ENOMEM; @@ -663,7 +662,7 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) if (!parent_domain) return -EPROBE_DEFER; - inta = devm_kzalloc(dev, sizeof(*inta), GFP_KERNEL); + inta = devm_kzalloc_obj(dev, *inta); if (!inta) return -ENOMEM; diff --git a/drivers/irqchip/irq-ti-sci-intr.c b/drivers/irqchip/irq-ti-sci-intr.c index 0ea17040e934..1d2e5af3ac4f 100644 --- a/drivers/irqchip/irq-ti-sci-intr.c +++ b/drivers/irqchip/irq-ti-sci-intr.c @@ -263,7 +263,7 @@ static int ti_sci_intr_irq_domain_probe(struct platform_device *pdev) return -ENODEV; } - intr = devm_kzalloc(dev, sizeof(*intr), GFP_KERNEL); + intr = devm_kzalloc_obj(dev, *intr); if (!intr) return -ENOMEM; diff --git a/drivers/irqchip/irq-ts4800.c b/drivers/irqchip/irq-ts4800.c index c7c0b155e353..6fc57d664df8 100644 --- a/drivers/irqchip/irq-ts4800.c +++ b/drivers/irqchip/irq-ts4800.c @@ -109,7 +109,7 @@ static int ts4800_ic_probe(struct platform_device *pdev) struct ts4800_irq_data *data; int parent_irq; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/irqchip/irq-uniphier-aidet.c b/drivers/irqchip/irq-uniphier-aidet.c index 6005c2d28dd9..dca3c6003539 100644 --- a/drivers/irqchip/irq-uniphier-aidet.c +++ b/drivers/irqchip/irq-uniphier-aidet.c @@ -175,7 +175,7 @@ static int uniphier_aidet_probe(struct platform_device *pdev) if (!parent_domain) return -EPROBE_DEFER; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/irqchip/qcom-irq-combiner.c b/drivers/irqchip/qcom-irq-combiner.c index 6d83e1e4a7ea..57ff4177edb9 100644 --- a/drivers/irqchip/qcom-irq-combiner.c +++ b/drivers/irqchip/qcom-irq-combiner.c @@ -234,8 +234,7 @@ static int combiner_probe(struct platform_device *pdev) return -EINVAL; } - combiner = devm_kzalloc(&pdev->dev, struct_size(combiner, regs, nregs), - GFP_KERNEL); + combiner = devm_kzalloc_flex(&pdev->dev, *combiner, regs, nregs); if (!combiner) return -ENOMEM; diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c index 29025a212ece..82f146d7c1bc 100644 --- a/drivers/irqchip/qcom-pdc.c +++ b/drivers/irqchip/qcom-pdc.c @@ -620,7 +620,7 @@ static int pdc_setup_pin_mapping(struct device *dev) return -EINVAL; pdc->region_cnt = n / 3; - pdc->region = devm_kcalloc(dev, pdc->region_cnt, sizeof(*pdc->region), GFP_KERNEL); + pdc->region = devm_kzalloc_objs(dev, *pdc->region, pdc->region_cnt); if (!pdc->region) { pdc->region_cnt = 0; return -ENOMEM; @@ -670,7 +670,7 @@ static int qcom_pdc_probe(struct platform_device *pdev, struct device_node *pare if (res_size > resource_size(&res)) pr_warn("%pOF: invalid reg size, please fix DT\n", node); - pdc = devm_kzalloc(dev, sizeof(*pdc), GFP_KERNEL); + pdc = devm_kzalloc_obj(dev, *pdc); if (!pdc) return -ENOMEM; diff --git a/drivers/leds/blink/leds-bcm63138.c b/drivers/leds/blink/leds-bcm63138.c index 12b70ee31b9a..2293ec50681f 100644 --- a/drivers/leds/blink/leds-bcm63138.c +++ b/drivers/leds/blink/leds-bcm63138.c @@ -204,7 +204,7 @@ static void bcm63138_leds_create_led(struct bcm63138_leds *leds, u32 bit; int err; - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) { dev_err(dev, "Failed to alloc LED\n"); return; @@ -260,7 +260,7 @@ static int bcm63138_leds_probe(struct platform_device *pdev) struct bcm63138_leds *leds; u32 shift_bits; - leds = devm_kzalloc(dev, sizeof(*leds), GFP_KERNEL); + leds = devm_kzalloc_obj(dev, *leds); if (!leds) return -ENOMEM; diff --git a/drivers/leds/blink/leds-lgm-sso.c b/drivers/leds/blink/leds-lgm-sso.c index 0f27c68e2741..71d0bc55ba57 100644 --- a/drivers/leds/blink/leds-lgm-sso.c +++ b/drivers/leds/blink/leds-lgm-sso.c @@ -627,7 +627,7 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled) int ret; fwnode_for_each_child_node(fw_ssoled, fwnode_child) { - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) { ret = -ENOMEM; goto __dt_err; @@ -777,7 +777,7 @@ static int intel_sso_led_probe(struct platform_device *pdev) struct sso_led_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/leds/flash/leds-aat1290.c b/drivers/leds/flash/leds-aat1290.c index 4bde0b07fe78..ac68e90f1ba2 100644 --- a/drivers/leds/flash/leds-aat1290.c +++ b/drivers/leds/flash/leds-aat1290.c @@ -311,10 +311,9 @@ static int init_mm_current_scale(struct aat1290_led *led, int i, max_mm_current = AAT1290_MAX_MM_CURRENT(cfg->max_flash_current); - led->mm_current_scale = devm_kcalloc(&led->pdev->dev, - ARRAY_SIZE(max_mm_current_percent), - sizeof(*led->mm_current_scale), - GFP_KERNEL); + led->mm_current_scale = devm_kzalloc_objs(&led->pdev->dev, + *led->mm_current_scale, + ARRAY_SIZE(max_mm_current_percent)); if (!led->mm_current_scale) return -ENOMEM; @@ -465,7 +464,7 @@ static int aat1290_led_probe(struct platform_device *pdev) struct v4l2_flash_config v4l2_sd_cfg = {}; int ret; - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/leds/flash/leds-as3645a.c b/drivers/leds/flash/leds-as3645a.c index 5fefcaef3714..2a3107143178 100644 --- a/drivers/leds/flash/leds-as3645a.c +++ b/drivers/leds/flash/leds-as3645a.c @@ -678,7 +678,7 @@ static int as3645a_probe(struct i2c_client *client) if (!dev_fwnode(&client->dev)) return -ENODEV; - flash = devm_kzalloc(&client->dev, sizeof(*flash), GFP_KERNEL); + flash = devm_kzalloc_obj(&client->dev, *flash); if (flash == NULL) return -ENOMEM; diff --git a/drivers/leds/flash/leds-ktd2692.c b/drivers/leds/flash/leds-ktd2692.c index 43d4d55503ab..40f8997f1dab 100644 --- a/drivers/leds/flash/leds-ktd2692.c +++ b/drivers/leds/flash/leds-ktd2692.c @@ -287,7 +287,7 @@ static int ktd2692_probe(struct platform_device *pdev) struct ktd2692_led_config_data led_cfg; int ret; - led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(&pdev->dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/leds/flash/leds-lm3601x.c b/drivers/leds/flash/leds-lm3601x.c index 8d00510c8967..c65a8a50b2c3 100644 --- a/drivers/leds/flash/leds-lm3601x.c +++ b/drivers/leds/flash/leds-lm3601x.c @@ -424,7 +424,7 @@ static int lm3601x_probe(struct i2c_client *client) struct fwnode_handle *fwnode; int ret; - led = devm_kzalloc(&client->dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(&client->dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/leds/flash/leds-max77693.c b/drivers/leds/flash/leds-max77693.c index daee10986108..0cb2d13ee3c0 100644 --- a/drivers/leds/flash/leds-max77693.c +++ b/drivers/leds/flash/leds-max77693.c @@ -947,7 +947,7 @@ static int max77693_led_probe(struct platform_device *pdev) struct max77693_led_config_data led_cfg = {}; int init_fled_cdev[2], i, ret; - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/leds/flash/leds-mt6360.c b/drivers/leds/flash/leds-mt6360.c index 462a902f54e0..52cafe6c0e7f 100644 --- a/drivers/leds/flash/leds-mt6360.c +++ b/drivers/leds/flash/leds-mt6360.c @@ -795,8 +795,7 @@ static int mt6360_led_probe(struct platform_device *pdev) return -EINVAL; } - priv = devm_kzalloc(&pdev->dev, - struct_size(priv, leds, count), GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, leds, count); if (!priv) return -ENOMEM; diff --git a/drivers/leds/flash/leds-mt6370-flash.c b/drivers/leds/flash/leds-mt6370-flash.c index dbdbe92309db..bf56c3dae703 100644 --- a/drivers/leds/flash/leds-mt6370-flash.c +++ b/drivers/leds/flash/leds-mt6370-flash.c @@ -517,7 +517,7 @@ static int mt6370_led_probe(struct platform_device *pdev) return dev_err_probe(dev, -EINVAL, "No child node or node count over max led number %zu\n", count); - priv = devm_kzalloc(dev, struct_size(priv, leds, count), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, leds, count); if (!priv) return -ENOMEM; diff --git a/drivers/leds/flash/leds-qcom-flash.c b/drivers/leds/flash/leds-qcom-flash.c index b03a6833e3e3..4e62a210cf98 100644 --- a/drivers/leds/flash/leds-qcom-flash.c +++ b/drivers/leds/flash/leds-qcom-flash.c @@ -845,7 +845,7 @@ static int qcom_flash_led_probe(struct platform_device *pdev) int count, i, rc; u32 val, reg_base; - flash_data = devm_kzalloc(dev, sizeof(*flash_data), GFP_KERNEL); + flash_data = devm_kzalloc_obj(dev, *flash_data); if (!flash_data) return -ENOMEM; @@ -931,13 +931,13 @@ static int qcom_flash_led_probe(struct platform_device *pdev) return -EINVAL; } - flash_data->v4l2_flash = devm_kcalloc(dev, count, - sizeof(*flash_data->v4l2_flash), GFP_KERNEL); + flash_data->v4l2_flash = devm_kzalloc_objs(dev, *flash_data->v4l2_flash, + count); if (!flash_data->v4l2_flash) return -ENOMEM; device_for_each_child_node_scoped(dev, child) { - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) { rc = -ENOMEM; goto release; diff --git a/drivers/leds/flash/leds-rt4505.c b/drivers/leds/flash/leds-rt4505.c index 18fd5b7e528f..6a47760645f1 100644 --- a/drivers/leds/flash/leds-rt4505.c +++ b/drivers/leds/flash/leds-rt4505.c @@ -346,7 +346,7 @@ static int rt4505_probe(struct i2c_client *client) struct v4l2_flash_config v4l2_config = {}; int ret; - priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&client->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/leds/flash/leds-rt8515.c b/drivers/leds/flash/leds-rt8515.c index 00904cc90ed6..8570db842aff 100644 --- a/drivers/leds/flash/leds-rt8515.c +++ b/drivers/leds/flash/leds-rt8515.c @@ -283,7 +283,7 @@ static int rt8515_probe(struct platform_device *pdev) struct v4l2_flash_config v4l2_sd_cfg = {}; int ret; - rt = devm_kzalloc(dev, sizeof(*rt), GFP_KERNEL); + rt = devm_kzalloc_obj(dev, *rt); if (!rt) return -ENOMEM; diff --git a/drivers/leds/flash/leds-sgm3140.c b/drivers/leds/flash/leds-sgm3140.c index dc6840357370..107d02c3137f 100644 --- a/drivers/leds/flash/leds-sgm3140.c +++ b/drivers/leds/flash/leds-sgm3140.c @@ -192,7 +192,7 @@ static int sgm3140_probe(struct platform_device *pdev) struct v4l2_flash_config v4l2_sd_cfg = {}; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/leds/flash/leds-sy7802.c b/drivers/leds/flash/leds-sy7802.c index ddac836762af..2190f55b7559 100644 --- a/drivers/leds/flash/leds-sy7802.c +++ b/drivers/leds/flash/leds-sy7802.c @@ -462,7 +462,7 @@ static int sy7802_probe(struct i2c_client *client) if (!count || count > SY7802_MAX_LEDS) return dev_err_probe(dev, -EINVAL, "Invalid amount of LED nodes %zu\n", count); - chip = devm_kzalloc(dev, struct_size(chip, leds, count), GFP_KERNEL); + chip = devm_kzalloc_flex(dev, *chip, leds, count); if (!chip) return -ENOMEM; diff --git a/drivers/leds/flash/leds-tps6131x.c b/drivers/leds/flash/leds-tps6131x.c index 5c9a5af5af05..7f2c3895e6e9 100644 --- a/drivers/leds/flash/leds-tps6131x.c +++ b/drivers/leds/flash/leds-tps6131x.c @@ -741,7 +741,7 @@ static int tps6131x_probe(struct i2c_client *client) struct tps6131x *tps6131x; int ret; - tps6131x = devm_kzalloc(&client->dev, sizeof(*tps6131x), GFP_KERNEL); + tps6131x = devm_kzalloc_obj(&client->dev, *tps6131x); if (!tps6131x) return -ENOMEM; diff --git a/drivers/leds/leds-88pm860x.c b/drivers/leds/leds-88pm860x.c index ef5c6c4667ab..448c3cb7cce0 100644 --- a/drivers/leds/leds-88pm860x.c +++ b/drivers/leds/leds-88pm860x.c @@ -148,7 +148,7 @@ static int pm860x_led_probe(struct platform_device *pdev) struct resource *res; int ret = 0; - data = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_led), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct pm860x_led); if (data == NULL) return -ENOMEM; res = platform_get_resource_byname(pdev, IORESOURCE_REG, "control"); diff --git a/drivers/leds/leds-acer-a500.c b/drivers/leds/leds-acer-a500.c index 8cf0b11f4390..01d5d0faeb4e 100644 --- a/drivers/leds/leds-acer-a500.c +++ b/drivers/leds/leds-acer-a500.c @@ -75,7 +75,7 @@ static int a500_ec_leds_probe(struct platform_device *pdev) /* reset and turn off LEDs */ regmap_multi_reg_write(rmap, a500_ec_leds_reset_seq, 2); - white_led = devm_kzalloc(&pdev->dev, sizeof(*white_led), GFP_KERNEL); + white_led = devm_kzalloc_obj(&pdev->dev, *white_led); if (!white_led) return -ENOMEM; @@ -86,7 +86,7 @@ static int a500_ec_leds_probe(struct platform_device *pdev) white_led->enable_seq = a500_ec_white_led_enable_seq; white_led->rmap = rmap; - orange_led = devm_kzalloc(&pdev->dev, sizeof(*orange_led), GFP_KERNEL); + orange_led = devm_kzalloc_obj(&pdev->dev, *orange_led); if (!orange_led) return -ENOMEM; diff --git a/drivers/leds/leds-adp5520.c b/drivers/leds/leds-adp5520.c index 13e5bc80e56e..39649cb913be 100644 --- a/drivers/leds/leds-adp5520.c +++ b/drivers/leds/leds-adp5520.c @@ -107,8 +107,7 @@ static int adp5520_led_probe(struct platform_device *pdev) return -EFAULT; } - led = devm_kcalloc(&pdev->dev, pdata->num_leds, sizeof(*led), - GFP_KERNEL); + led = devm_kzalloc_objs(&pdev->dev, *led, pdata->num_leds); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-an30259a.c b/drivers/leds/leds-an30259a.c index 4654a732d1b1..808fe8a5df58 100644 --- a/drivers/leds/leds-an30259a.c +++ b/drivers/leds/leds-an30259a.c @@ -275,7 +275,7 @@ static int an30259a_probe(struct i2c_client *client) struct an30259a *chip; int i, err; - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/leds/leds-apu.c b/drivers/leds/leds-apu.c index 1c116aaa9b6e..259c95fc306a 100644 --- a/drivers/leds/leds-apu.c +++ b/drivers/leds/leds-apu.c @@ -117,9 +117,8 @@ static int apu_led_config(struct device *dev, struct apu_led_pdata *apuld) int i; int err; - apu_led->pled = devm_kcalloc(dev, - ARRAY_SIZE(apu1_led_profile), sizeof(struct apu_led_priv), - GFP_KERNEL); + apu_led->pled = devm_kzalloc_objs(dev, struct apu_led_priv, + ARRAY_SIZE(apu1_led_profile)); if (!apu_led->pled) return -ENOMEM; @@ -159,7 +158,7 @@ error: static int __init apu_led_probe(struct platform_device *pdev) { - apu_led = devm_kzalloc(&pdev->dev, sizeof(*apu_led), GFP_KERNEL); + apu_led = devm_kzalloc_obj(&pdev->dev, *apu_led); if (!apu_led) return -ENOMEM; diff --git a/drivers/leds/leds-ariel.c b/drivers/leds/leds-ariel.c index dd319c7e385f..fc5664e04646 100644 --- a/drivers/leds/leds-ariel.c +++ b/drivers/leds/leds-ariel.c @@ -91,7 +91,7 @@ static int ariel_led_probe(struct platform_device *pdev) if (!ec_ram) return -ENODEV; - leds = devm_kcalloc(dev, NLEDS, sizeof(*leds), GFP_KERNEL); + leds = devm_kzalloc_objs(dev, *leds, NLEDS); if (!leds) return -ENOMEM; diff --git a/drivers/leds/leds-as3668.c b/drivers/leds/leds-as3668.c index 46427fe752a8..004a570224f1 100644 --- a/drivers/leds/leds-as3668.c +++ b/drivers/leds/leds-as3668.c @@ -140,7 +140,7 @@ static int as3668_probe(struct i2c_client *client) "expected chip ID 0x%02x, got 0x%02x\n", AS3668_CHIP_ID, chip_id); - as3668 = devm_kzalloc(&client->dev, sizeof(*as3668), GFP_KERNEL); + as3668 = devm_kzalloc_obj(&client->dev, *as3668); if (!as3668) return -ENOMEM; diff --git a/drivers/leds/leds-aw200xx.c b/drivers/leds/leds-aw200xx.c index b92158ac9ce3..7eebd361991c 100644 --- a/drivers/leds/leds-aw200xx.c +++ b/drivers/leds/leds-aw200xx.c @@ -552,8 +552,7 @@ static int aw200xx_probe(struct i2c_client *client) return dev_err_probe(&client->dev, -EINVAL, "Incorrect number of leds (%d)", count); - chip = devm_kzalloc(&client->dev, struct_size(chip, leds, count), - GFP_KERNEL); + chip = devm_kzalloc_flex(&client->dev, *chip, leds, count); if (!chip) return -ENOMEM; diff --git a/drivers/leds/leds-aw2013.c b/drivers/leds/leds-aw2013.c index 216755d6010f..457f1cb178c7 100644 --- a/drivers/leds/leds-aw2013.c +++ b/drivers/leds/leds-aw2013.c @@ -335,7 +335,7 @@ static int aw2013_probe(struct i2c_client *client) int ret; unsigned int chipid; - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/leds/leds-bcm6328.c b/drivers/leds/leds-bcm6328.c index 592bbf4b7e35..667ff31eb8fa 100644 --- a/drivers/leds/leds-bcm6328.c +++ b/drivers/leds/leds-bcm6328.c @@ -335,7 +335,7 @@ static int bcm6328_led(struct device *dev, struct device_node *nc, u32 reg, void __iomem *mode; int rc; - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) return -ENOMEM; @@ -400,17 +400,17 @@ static int bcm6328_leds_probe(struct platform_device *pdev) if (IS_ERR(mem)) return PTR_ERR(mem); - lock = devm_kzalloc(dev, sizeof(*lock), GFP_KERNEL); + lock = devm_kzalloc_obj(dev, *lock); if (!lock) return -ENOMEM; - blink_leds = devm_kcalloc(dev, BCM6328_LED_BLINK_DELAYS, - sizeof(*blink_leds), GFP_KERNEL); + blink_leds = devm_kzalloc_objs(dev, *blink_leds, + BCM6328_LED_BLINK_DELAYS); if (!blink_leds) return -ENOMEM; - blink_delay = devm_kcalloc(dev, BCM6328_LED_BLINK_DELAYS, - sizeof(*blink_delay), GFP_KERNEL); + blink_delay = devm_kzalloc_objs(dev, *blink_delay, + BCM6328_LED_BLINK_DELAYS); if (!blink_delay) return -ENOMEM; diff --git a/drivers/leds/leds-bcm6358.c b/drivers/leds/leds-bcm6358.c index 51fcff2a64fd..ab15c591386c 100644 --- a/drivers/leds/leds-bcm6358.c +++ b/drivers/leds/leds-bcm6358.c @@ -100,7 +100,7 @@ static int bcm6358_led(struct device *dev, struct device_node *nc, u32 reg, unsigned long val; int rc; - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) return -ENOMEM; @@ -156,7 +156,7 @@ static int bcm6358_leds_probe(struct platform_device *pdev) if (IS_ERR(mem)) return PTR_ERR(mem); - lock = devm_kzalloc(dev, sizeof(*lock), GFP_KERNEL); + lock = devm_kzalloc_obj(dev, *lock); if (!lock) return -ENOMEM; diff --git a/drivers/leds/leds-bd2606mvv.c b/drivers/leds/leds-bd2606mvv.c index 4c696abfd23d..d43fd363db8c 100644 --- a/drivers/leds/leds-bd2606mvv.c +++ b/drivers/leds/leds-bd2606mvv.c @@ -78,7 +78,7 @@ static int bd2606mvv_probe(struct i2c_client *client) if (!dev_fwnode(dev)) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/leds/leds-bd2802.c b/drivers/leds/leds-bd2802.c index 9732f41a1143..37efe0633956 100644 --- a/drivers/leds/leds-bd2802.c +++ b/drivers/leds/leds-bd2802.c @@ -661,7 +661,7 @@ static int bd2802_probe(struct i2c_client *client) struct bd2802_led *led; int ret, i; - led = devm_kzalloc(&client->dev, sizeof(struct bd2802_led), GFP_KERNEL); + led = devm_kzalloc_obj(&client->dev, struct bd2802_led); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-blinkm.c b/drivers/leds/leds-blinkm.c index ee1589015826..3ac4c53b2491 100644 --- a/drivers/leds/leds-blinkm.c +++ b/drivers/leds/leds-blinkm.c @@ -689,8 +689,7 @@ static int register_multicolor(struct i2c_client *client, struct blinkm_data *da mc_led = &data->blinkm_leds[RED]; mc_led->i2c_client = client; - mc_led_info = devm_kcalloc(&client->dev, NUM_LEDS, sizeof(*mc_led_info), - GFP_KERNEL); + mc_led_info = devm_kzalloc_objs(&client->dev, *mc_led_info, NUM_LEDS); if (!mc_led_info) return -ENOMEM; @@ -725,8 +724,7 @@ static int blinkm_probe(struct i2c_client *client) struct blinkm_data *data; int err; - data = devm_kzalloc(&client->dev, - sizeof(struct blinkm_data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct blinkm_data); if (!data) return -ENOMEM; diff --git a/drivers/leds/leds-cht-wcove.c b/drivers/leds/leds-cht-wcove.c index da05ff94898d..c4188a5abca2 100644 --- a/drivers/leds/leds-cht-wcove.c +++ b/drivers/leds/leds-cht-wcove.c @@ -348,7 +348,7 @@ static int cht_wc_leds_probe(struct platform_device *pdev) if (pmic->cht_wc_model == INTEL_CHT_WC_LENOVO_YT3_X90) return -ENODEV; - leds = devm_kzalloc(&pdev->dev, sizeof(*leds), GFP_KERNEL); + leds = devm_kzalloc_obj(&pdev->dev, *leds); if (!leds) return -ENOMEM; diff --git a/drivers/leds/leds-cpcap.c b/drivers/leds/leds-cpcap.c index 87354f17644b..0bc613e45453 100644 --- a/drivers/leds/leds-cpcap.c +++ b/drivers/leds/leds-cpcap.c @@ -161,7 +161,7 @@ static int cpcap_led_probe(struct platform_device *pdev) struct cpcap_led *led; int err; - led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(&pdev->dev, *led); if (!led) return -ENOMEM; platform_set_drvdata(pdev, led); diff --git a/drivers/leds/leds-cr0014114.c b/drivers/leds/leds-cr0014114.c index 3f6931ae0bcc..8140e21c021d 100644 --- a/drivers/leds/leds-cr0014114.c +++ b/drivers/leds/leds-cr0014114.c @@ -220,8 +220,7 @@ static int cr0014114_probe(struct spi_device *spi) return -ENODEV; } - priv = devm_kzalloc(&spi->dev, struct_size(priv, leds, count), - GFP_KERNEL); + priv = devm_kzalloc_flex(&spi->dev, *priv, leds, count); if (!priv) return -ENOMEM; diff --git a/drivers/leds/leds-cros_ec.c b/drivers/leds/leds-cros_ec.c index 0e93aa28a8b1..60b385843154 100644 --- a/drivers/leds/leds-cros_ec.c +++ b/drivers/leds/leds-cros_ec.c @@ -183,7 +183,7 @@ static int cros_ec_led_probe_one(struct device *dev, struct cros_ec_device *cros if (ret < 0) return ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -197,7 +197,7 @@ static int cros_ec_led_probe_one(struct device *dev, struct cros_ec_device *cros priv->cros_ec = cros_ec; priv->led_id = id; - subleds = devm_kcalloc(dev, num_subleds, sizeof(*subleds), GFP_KERNEL); + subleds = devm_kzalloc_objs(dev, *subleds, num_subleds); if (!subleds) return -ENOMEM; diff --git a/drivers/leds/leds-da903x.c b/drivers/leds/leds-da903x.c index 71209b3c8f1e..ecc876965260 100644 --- a/drivers/leds/leds-da903x.c +++ b/drivers/leds/leds-da903x.c @@ -97,7 +97,7 @@ static int da903x_led_probe(struct platform_device *pdev) return -EINVAL; } - led = devm_kzalloc(&pdev->dev, sizeof(struct da903x_led), GFP_KERNEL); + led = devm_kzalloc_obj(&pdev->dev, struct da903x_led); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-da9052.c b/drivers/leds/leds-da9052.c index 7c9051184a59..37ca65602739 100644 --- a/drivers/leds/leds-da9052.c +++ b/drivers/leds/leds-da9052.c @@ -108,9 +108,7 @@ static int da9052_led_probe(struct platform_device *pdev) goto err; } - led = devm_kcalloc(&pdev->dev, - pled->num_leds, sizeof(struct da9052_led), - GFP_KERNEL); + led = devm_kzalloc_objs(&pdev->dev, struct da9052_led, pled->num_leds); if (!led) { error = -ENOMEM; goto err; diff --git a/drivers/leds/leds-dac124s085.c b/drivers/leds/leds-dac124s085.c index 192b43333aee..a1330cb0182a 100644 --- a/drivers/leds/leds-dac124s085.c +++ b/drivers/leds/leds-dac124s085.c @@ -53,7 +53,7 @@ static int dac124s085_probe(struct spi_device *spi) struct dac124s085_led *led; int i, ret; - dac = devm_kzalloc(&spi->dev, sizeof(*dac), GFP_KERNEL); + dac = devm_kzalloc_obj(&spi->dev, *dac); if (!dac) return -ENOMEM; diff --git a/drivers/leds/leds-el15203000.c b/drivers/leds/leds-el15203000.c index 8e8ddd7c514d..1dc143f68e04 100644 --- a/drivers/leds/leds-el15203000.c +++ b/drivers/leds/leds-el15203000.c @@ -291,8 +291,7 @@ static int el15203000_probe(struct spi_device *spi) return -ENODEV; } - priv = devm_kzalloc(&spi->dev, struct_size(priv, leds, count), - GFP_KERNEL); + priv = devm_kzalloc_flex(&spi->dev, *priv, leds, count); if (!priv) return -ENOMEM; diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index dbb84949c3c2..d73f40cebc1e 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -152,7 +152,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct device *dev) if (!count) return ERR_PTR(-ENODEV); - priv = devm_kzalloc(dev, struct_size(priv, leds, count), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, leds, count); if (!priv) return ERR_PTR(-ENOMEM); priv->num_leds = count; @@ -279,7 +279,7 @@ static int gpio_led_probe(struct platform_device *pdev) int i, ret; if (pdata && pdata->num_leds) { - priv = devm_kzalloc(dev, struct_size(priv, leds, pdata->num_leds), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, leds, pdata->num_leds); if (!priv) return -ENOMEM; diff --git a/drivers/leds/leds-ip30.c b/drivers/leds/leds-ip30.c index 2df24c303366..36e7e89a1e4a 100644 --- a/drivers/leds/leds-ip30.c +++ b/drivers/leds/leds-ip30.c @@ -29,7 +29,7 @@ static int ip30led_create(struct platform_device *pdev, int num) { struct ip30_led *data; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c index 50ebbc271107..e40ea3cb4f26 100644 --- a/drivers/leds/leds-is31fl319x.c +++ b/drivers/leds/leds-is31fl319x.c @@ -491,7 +491,7 @@ static int is31fl319x_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -EIO; - is31 = devm_kzalloc(&client->dev, sizeof(*is31), GFP_KERNEL); + is31 = devm_kzalloc_obj(&client->dev, *is31); if (!is31) return -ENOMEM; diff --git a/drivers/leds/leds-is31fl32xx.c b/drivers/leds/leds-is31fl32xx.c index 285085d27453..c9a0cba65170 100644 --- a/drivers/leds/leds-is31fl32xx.c +++ b/drivers/leds/leds-is31fl32xx.c @@ -580,8 +580,7 @@ static int is31fl32xx_probe(struct i2c_client *client) if (!count) return -EINVAL; - priv = devm_kzalloc(dev, struct_size(priv, leds, count), - GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, leds, count); if (!priv) return -ENOMEM; diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c index 481e9c0a41e7..e3f25f3b626a 100644 --- a/drivers/leds/leds-lm3530.c +++ b/drivers/leds/leds-lm3530.c @@ -427,8 +427,7 @@ static int lm3530_probe(struct i2c_client *client) return -EIO; } - drvdata = devm_kzalloc(&client->dev, sizeof(struct lm3530_data), - GFP_KERNEL); + drvdata = devm_kzalloc_obj(&client->dev, struct lm3530_data); if (drvdata == NULL) return -ENOMEM; diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c index b51496910b08..7b0d655cc2f7 100644 --- a/drivers/leds/leds-lm3532.c +++ b/drivers/leds/leds-lm3532.c @@ -487,7 +487,7 @@ static int lm3532_parse_als(struct lm3532_data *priv) int als_impedance; int ret; - als = devm_kzalloc(priv->dev, sizeof(*als), GFP_KERNEL); + als = devm_kzalloc_obj(priv->dev, *als); if (als == NULL) return -ENOMEM; @@ -684,8 +684,7 @@ static int lm3532_probe(struct i2c_client *client) return -ENODEV; } - drvdata = devm_kzalloc(&client->dev, struct_size(drvdata, leds, count), - GFP_KERNEL); + drvdata = devm_kzalloc_flex(&client->dev, *drvdata, leds, count); if (drvdata == NULL) return -ENOMEM; diff --git a/drivers/leds/leds-lm3533.c b/drivers/leds/leds-lm3533.c index 7259097bd6a7..d5997cbd88df 100644 --- a/drivers/leds/leds-lm3533.c +++ b/drivers/leds/leds-lm3533.c @@ -648,7 +648,7 @@ static int lm3533_led_probe(struct platform_device *pdev) return -EINVAL; } - led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(&pdev->dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-lm355x.c b/drivers/leds/leds-lm355x.c index 2b7cf42141e4..66c0cf475759 100644 --- a/drivers/leds/leds-lm355x.c +++ b/drivers/leds/leds-lm355x.c @@ -414,8 +414,7 @@ static int lm355x_probe(struct i2c_client *client) return -ENODATA; } - chip = devm_kzalloc(&client->dev, - sizeof(struct lm355x_chip_data), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, struct lm355x_chip_data); if (!chip) return -ENOMEM; diff --git a/drivers/leds/leds-lm36274.c b/drivers/leds/leds-lm36274.c index 7fd8365c2f7b..7f6463f0611e 100644 --- a/drivers/leds/leds-lm36274.c +++ b/drivers/leds/leds-lm36274.c @@ -110,7 +110,7 @@ static int lm36274_probe(struct platform_device *pdev) struct lm36274 *chip; int ret; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/leds/leds-lm3642.c b/drivers/leds/leds-lm3642.c index 2a893399e05f..9af8b8e47e42 100644 --- a/drivers/leds/leds-lm3642.c +++ b/drivers/leds/leds-lm3642.c @@ -304,8 +304,7 @@ static int lm3642_probe(struct i2c_client *client) return -ENODATA; } - chip = devm_kzalloc(&client->dev, - sizeof(struct lm3642_chip_data), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, struct lm3642_chip_data); if (!chip) return -ENOMEM; diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c index 9c58d54c5783..0d730869b95b 100644 --- a/drivers/leds/leds-lm3692x.c +++ b/drivers/leds/leds-lm3692x.c @@ -466,7 +466,7 @@ static int lm3692x_probe(struct i2c_client *client) struct lm3692x_led *led; int ret; - led = devm_kzalloc(&client->dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(&client->dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-lm3697.c b/drivers/leds/leds-lm3697.c index 83dc607a6987..53410d638681 100644 --- a/drivers/leds/leds-lm3697.c +++ b/drivers/leds/leds-lm3697.c @@ -305,7 +305,7 @@ static int lm3697_probe(struct i2c_client *client) return -ENODEV; } - led = devm_kzalloc(dev, struct_size(led, leds, count), GFP_KERNEL); + led = devm_kzalloc_flex(dev, *led, leds, count); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-lp3944.c b/drivers/leds/leds-lp3944.c index 8e95dcedce40..b0b33cc64914 100644 --- a/drivers/leds/leds-lp3944.c +++ b/drivers/leds/leds-lp3944.c @@ -378,8 +378,7 @@ static int lp3944_probe(struct i2c_client *client) return -ENODEV; } - data = devm_kzalloc(&client->dev, sizeof(struct lp3944_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct lp3944_data); if (!data) return -ENOMEM; diff --git a/drivers/leds/leds-lp3952.c b/drivers/leds/leds-lp3952.c index 0a1af284f52b..391866b0d321 100644 --- a/drivers/leds/leds-lp3952.c +++ b/drivers/leds/leds-lp3952.c @@ -219,7 +219,7 @@ static int lp3952_probe(struct i2c_client *client) int status; struct lp3952_led_array *priv; - priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&client->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c index 20bfb315bda1..583659d82e84 100644 --- a/drivers/leds/leds-lp50xx.c +++ b/drivers/leds/leds-lp50xx.c @@ -500,8 +500,8 @@ static int lp50xx_probe_dt(struct lp50xx *priv) * There are only 3 LEDs per module otherwise they should be * banked which also is presented as 3 LEDs. */ - mc_led_info = devm_kcalloc(priv->dev, LP50XX_LEDS_PER_MODULE, - sizeof(*mc_led_info), GFP_KERNEL); + mc_led_info = devm_kzalloc_objs(priv->dev, *mc_led_info, + LP50XX_LEDS_PER_MODULE); if (!mc_led_info) return -ENOMEM; @@ -559,8 +559,7 @@ static int lp50xx_probe(struct i2c_client *client) return -ENODEV; } - led = devm_kzalloc(&client->dev, struct_size(led, leds, count), - GFP_KERNEL); + led = devm_kzalloc_flex(&client->dev, *led, leds, count); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c index ea131177de96..8fbd7a846cbf 100644 --- a/drivers/leds/leds-lp55xx-common.c +++ b/drivers/leds/leds-lp55xx-common.c @@ -484,9 +484,8 @@ static int lp55xx_init_led(struct lp55xx_led *led, } if (pdata->led_config[chan].num_colors > 1) { - mc_led_info = devm_kcalloc(dev, - pdata->led_config[chan].num_colors, - sizeof(*mc_led_info), GFP_KERNEL); + mc_led_info = devm_kzalloc_objs(dev, *mc_led_info, + pdata->led_config[chan].num_colors); if (!mc_led_info) return -ENOMEM; @@ -1210,7 +1209,7 @@ static struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev, int i = 0; int ret; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); @@ -1220,7 +1219,7 @@ static struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev, return ERR_PTR(-EINVAL); } - cfg = devm_kcalloc(dev, num_channels, sizeof(*cfg), GFP_KERNEL); + cfg = devm_kzalloc_objs(dev, *cfg, num_channels); if (!cfg) return ERR_PTR(-ENOMEM); @@ -1266,7 +1265,7 @@ int lp55xx_probe(struct i2c_client *client) struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev); struct device_node *np = dev_of_node(&client->dev); - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; @@ -1295,8 +1294,7 @@ int lp55xx_probe(struct i2c_client *client) return -EINVAL; } - led = devm_kcalloc(&client->dev, - pdata->num_channels, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_objs(&client->dev, *led, pdata->num_channels); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-lp8788.c b/drivers/leds/leds-lp8788.c index 9b9525ccca15..35c5f4341eb6 100644 --- a/drivers/leds/leds-lp8788.c +++ b/drivers/leds/leds-lp8788.c @@ -125,7 +125,7 @@ static int lp8788_led_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - led = devm_kzalloc(dev, sizeof(struct lp8788_led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, struct lp8788_led); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c index f6e4227de903..89071841b1c7 100644 --- a/drivers/leds/leds-lp8860.c +++ b/drivers/leds/leds-lp8860.c @@ -278,7 +278,7 @@ static int lp8860_probe(struct i2c_client *client) struct led_init_data init_data = {}; struct gpio_desc *enable_gpio; - led = devm_kzalloc(&client->dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(&client->dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-lp8864.c b/drivers/leds/leds-lp8864.c index 204727f2f350..db81fe3b19a3 100644 --- a/drivers/leds/leds-lp8864.c +++ b/drivers/leds/leds-lp8864.c @@ -214,7 +214,7 @@ static int lp8864_probe(struct i2c_client *client) struct led_init_data init_data = {}; struct gpio_desc *enable_gpio; - led = devm_kzalloc(&client->dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(&client->dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c index 6fca14e76ca6..63e596aebc02 100644 --- a/drivers/leds/leds-lt3593.c +++ b/drivers/leds/leds-lt3593.c @@ -68,7 +68,7 @@ static int lt3593_led_probe(struct platform_device *pdev) struct led_init_data init_data = {}; const char *tmp; - led_data = devm_kzalloc(dev, sizeof(*led_data), GFP_KERNEL); + led_data = devm_kzalloc_obj(dev, *led_data); if (!led_data) return -ENOMEM; diff --git a/drivers/leds/leds-ltc3208.c b/drivers/leds/leds-ltc3208.c index 64091f29f18a..3f70ba227a7e 100644 --- a/drivers/leds/leds-ltc3208.c +++ b/drivers/leds/leds-ltc3208.c @@ -189,7 +189,7 @@ static int ltc3208_probe(struct i2c_client *client) return dev_err_probe(&client->dev, -EINVAL, "%u is already registered", chan); - led = devm_kzalloc(&client->dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(&client->dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-ltc3220.c b/drivers/leds/leds-ltc3220.c index 5060d5042fe1..33e9b4ef6452 100644 --- a/drivers/leds/leds-ltc3220.c +++ b/drivers/leds/leds-ltc3220.c @@ -422,7 +422,7 @@ static int ltc3220_probe(struct i2c_client *client) u8 led_index = 0; int ret; - ltc3220 = devm_kzalloc(&client->dev, sizeof(*ltc3220), GFP_KERNEL); + ltc3220 = devm_kzalloc_obj(&client->dev, *ltc3220); if (!ltc3220) return -ENOMEM; diff --git a/drivers/leds/leds-max5970.c b/drivers/leds/leds-max5970.c index cb4dd0a9166c..659c0d437b70 100644 --- a/drivers/leds/leds-max5970.c +++ b/drivers/leds/leds-max5970.c @@ -70,7 +70,7 @@ static int max5970_led_probe(struct platform_device *pdev) continue; } - ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(dev, *ddata); if (!ddata) { fwnode_handle_put(child); return -ENOMEM; diff --git a/drivers/leds/leds-max77650.c b/drivers/leds/leds-max77650.c index f8c47078a3bb..b68afbbbf22d 100644 --- a/drivers/leds/leds-max77650.c +++ b/drivers/leds/leds-max77650.c @@ -70,8 +70,7 @@ static int max77650_led_probe(struct platform_device *pdev) dev = &pdev->dev; - leds = devm_kcalloc(dev, sizeof(*leds), - MAX77650_LED_NUM_LEDS, GFP_KERNEL); + leds = devm_kzalloc_objs(dev, *leds, MAX77650_LED_NUM_LEDS); if (!leds) return -ENOMEM; diff --git a/drivers/leds/leds-max77705.c b/drivers/leds/leds-max77705.c index 4fd803c95989..c5c0ce749277 100644 --- a/drivers/leds/leds-max77705.c +++ b/drivers/leds/leds-max77705.c @@ -162,7 +162,7 @@ static int max77705_add_led(struct device *dev, struct regmap *regmap, struct fw struct mc_subled *info; struct led_init_data init_data = {}; - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) return -ENOMEM; @@ -181,7 +181,7 @@ static int max77705_add_led(struct device *dev, struct regmap *regmap, struct fw if (ret || reg >= MAX77705_LED_NUM_LEDS) return -EINVAL; - info = devm_kcalloc(dev, num_channels, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_objs(dev, *info, num_channels); if (!info) return -ENOMEM; @@ -211,7 +211,7 @@ static int max77705_add_led(struct device *dev, struct regmap *regmap, struct fw if (ret) return ret; } else { - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/leds/leds-max8997.c b/drivers/leds/leds-max8997.c index c8d7f55c9dec..678c9e1eaaaa 100644 --- a/drivers/leds/leds-max8997.c +++ b/drivers/leds/leds-max8997.c @@ -238,7 +238,7 @@ static int max8997_led_probe(struct platform_device *pdev) char name[20]; int ret = 0; - led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(&pdev->dev, *led); if (led == NULL) return -ENOMEM; diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c index e22f09d13798..19c1b51475db 100644 --- a/drivers/leds/leds-mc13783.c +++ b/drivers/leds/leds-mc13783.c @@ -118,7 +118,7 @@ static struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt( struct device *dev = &pdev->dev; int i = 0, ret = -ENODATA; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); @@ -135,8 +135,7 @@ static struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt( pdata->num_leds = of_get_available_child_count(parent); - pdata->led = devm_kcalloc(dev, pdata->num_leds, sizeof(*pdata->led), - GFP_KERNEL); + pdata->led = devm_kzalloc_objs(dev, *pdata->led, pdata->num_leds); if (!pdata->led) return ERR_PTR(-ENOMEM); @@ -182,7 +181,7 @@ static int __init mc13xxx_led_probe(struct platform_device *pdev) int i, id, ret = -ENODATA; u32 init_led = 0; - leds = devm_kzalloc(dev, sizeof(*leds), GFP_KERNEL); + leds = devm_kzalloc_obj(dev, *leds); if (!leds) return -ENOMEM; @@ -205,8 +204,7 @@ static int __init mc13xxx_led_probe(struct platform_device *pdev) return -EINVAL; } - leds->led = devm_kcalloc(dev, leds->num_leds, sizeof(*leds->led), - GFP_KERNEL); + leds->led = devm_kzalloc_objs(dev, *leds->led, leds->num_leds); if (!leds->led) return -ENOMEM; diff --git a/drivers/leds/leds-mlxcpld.c b/drivers/leds/leds-mlxcpld.c index 1f5ab8fbdaf9..abb416364c0e 100644 --- a/drivers/leds/leds-mlxcpld.c +++ b/drivers/leds/leds-mlxcpld.c @@ -327,10 +327,8 @@ static int mlxcpld_led_config(struct device *dev, int i; int err; - cpld->pled = devm_kcalloc(dev, - cpld->num_led_instances, - sizeof(struct mlxcpld_led_priv), - GFP_KERNEL); + cpld->pled = devm_kzalloc_objs(dev, struct mlxcpld_led_priv, + cpld->num_led_instances); if (!cpld->pled) return -ENOMEM; @@ -363,8 +361,7 @@ static int __init mlxcpld_led_probe(struct platform_device *pdev) enum mlxcpld_led_platform_types mlxcpld_led_plat = mlxcpld_led_platform_check_sys_type(); - mlxcpld_led = devm_kzalloc(&pdev->dev, sizeof(*mlxcpld_led), - GFP_KERNEL); + mlxcpld_led = devm_kzalloc_obj(&pdev->dev, *mlxcpld_led); if (!mlxcpld_led) return -ENOMEM; diff --git a/drivers/leds/leds-mlxreg.c b/drivers/leds/leds-mlxreg.c index 1b70de72376c..ab67026d1b8d 100644 --- a/drivers/leds/leds-mlxreg.c +++ b/drivers/leds/leds-mlxreg.c @@ -192,8 +192,7 @@ static int mlxreg_led_config(struct mlxreg_led_priv_data *priv) int err; for (i = 0; i < led_pdata->counter; i++, data++) { - led_data = devm_kzalloc(&priv->pdev->dev, sizeof(*led_data), - GFP_KERNEL); + led_data = devm_kzalloc_obj(&priv->pdev->dev, *led_data); if (!led_data) return -ENOMEM; @@ -264,7 +263,7 @@ static int mlxreg_led_probe(struct platform_device *pdev) return -EINVAL; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/leds/leds-mt6323.c b/drivers/leds/leds-mt6323.c index dbdc221c3828..bac5c40985a2 100644 --- a/drivers/leds/leds-mt6323.c +++ b/drivers/leds/leds-mt6323.c @@ -537,7 +537,7 @@ static int mt6323_led_probe(struct platform_device *pdev) u32 reg; u8 max_leds; - leds = devm_kzalloc(dev, sizeof(*leds), GFP_KERNEL); + leds = devm_kzalloc_obj(dev, *leds); if (!leds) return -ENOMEM; @@ -580,7 +580,7 @@ static int mt6323_led_probe(struct platform_device *pdev) return -EINVAL; } - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c index 99df46f2d9f5..6f59f91fac6c 100644 --- a/drivers/leds/leds-netxbig.c +++ b/drivers/leds/leds-netxbig.c @@ -360,7 +360,7 @@ static int netxbig_gpio_ext_get(struct device *dev, return ret; } num_addr = ret; - addr = devm_kcalloc(dev, num_addr, sizeof(*addr), GFP_KERNEL); + addr = devm_kzalloc_objs(dev, *addr, num_addr); if (!addr) return -ENOMEM; @@ -391,7 +391,7 @@ static int netxbig_gpio_ext_get(struct device *dev, goto err_free_addr; } num_data = ret; - data = devm_kcalloc(dev, num_data, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_objs(dev, *data, num_data); if (!data) { ret = -ENOMEM; goto err_free_addr; @@ -461,7 +461,7 @@ static int netxbig_leds_get_of_pdata(struct device *dev, } gpio_ext_dev = &gpio_ext_pdev->dev; - gpio_ext = devm_kzalloc(dev, sizeof(*gpio_ext), GFP_KERNEL); + gpio_ext = devm_kzalloc_obj(dev, *gpio_ext); if (!gpio_ext) { of_node_put(gpio_ext_np); ret = -ENOMEM; @@ -482,8 +482,7 @@ static int netxbig_leds_get_of_pdata(struct device *dev, } num_timers = ret / 3; - timers = devm_kcalloc(dev, num_timers, sizeof(*timers), - GFP_KERNEL); + timers = devm_kzalloc_objs(dev, *timers, num_timers); if (!timers) { ret = -ENOMEM; goto put_device; @@ -516,7 +515,7 @@ static int netxbig_leds_get_of_pdata(struct device *dev, goto put_device; } - leds = devm_kcalloc(dev, num_leds, sizeof(*leds), GFP_KERNEL); + leds = devm_kzalloc_objs(dev, *leds, num_leds); if (!leds) { ret = -ENOMEM; goto put_device; @@ -544,9 +543,7 @@ static int netxbig_leds_get_of_pdata(struct device *dev, goto put_device; mode_val = - devm_kcalloc(dev, - NETXBIG_LED_MODE_NUM, sizeof(*mode_val), - GFP_KERNEL); + devm_kzalloc_objs(dev, *mode_val, NETXBIG_LED_MODE_NUM); if (!mode_val) { ret = -ENOMEM; goto put_device; @@ -617,16 +614,14 @@ static int netxbig_led_probe(struct platform_device *pdev) int i; int ret; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; ret = netxbig_leds_get_of_pdata(&pdev->dev, pdata); if (ret) return ret; - leds_data = devm_kcalloc(&pdev->dev, - pdata->num_leds, sizeof(*leds_data), - GFP_KERNEL); + leds_data = devm_kzalloc_objs(&pdev->dev, *leds_data, pdata->num_leds); if (!leds_data) return -ENOMEM; diff --git a/drivers/leds/leds-nic78bx.c b/drivers/leds/leds-nic78bx.c index 5e3098e1e1ad..4fa472dbe3d1 100644 --- a/drivers/leds/leds-nic78bx.c +++ b/drivers/leds/leds-nic78bx.c @@ -141,7 +141,7 @@ static int nic78bx_probe(struct platform_device *pdev) struct resource *io_rc; int ret, i; - led_data = devm_kzalloc(dev, sizeof(*led_data), GFP_KERNEL); + led_data = devm_kzalloc_obj(dev, *led_data); if (!led_data) return -ENOMEM; diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c index 4c6f04a5bd87..c62a269114e8 100644 --- a/drivers/leds/leds-ns2.c +++ b/drivers/leds/leds-ns2.c @@ -198,7 +198,7 @@ static int ns2_led_register(struct device *dev, struct fwnode_handle *node, } nmodes = ret / 3; - modval = devm_kcalloc(dev, nmodes, sizeof(*modval), GFP_KERNEL); + modval = devm_kzalloc_objs(dev, *modval, nmodes); if (!modval) return -ENOMEM; @@ -246,7 +246,7 @@ static int ns2_led_probe(struct platform_device *pdev) if (!count) return -ENODEV; - leds = devm_kcalloc(dev, count, sizeof(*leds), GFP_KERNEL); + leds = devm_kzalloc_objs(dev, *leds, count); if (!leds) return -ENOMEM; diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c index 1133fa348e24..c8085427696f 100644 --- a/drivers/leds/leds-pca9532.c +++ b/drivers/leds/leds-pca9532.c @@ -522,7 +522,7 @@ pca9532_of_populate_pdata(struct device *dev, struct device_node *np) devid = (int)(uintptr_t)of_device_get_match_data(dev); maxleds = pca9532_chip_info_tbl[devid].num_leds; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); @@ -581,7 +581,7 @@ static int pca9532_probe(struct i2c_client *client) I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c index e4af7a3b639f..b6bf4adcc8ea 100644 --- a/drivers/leds/leds-pca955x.c +++ b/drivers/leds/leds-pca955x.c @@ -592,8 +592,7 @@ static int pca955x_probe(struct i2c_client *client) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - pca955x = devm_kzalloc(&client->dev, - struct_size(pca955x, leds, chip->bits), GFP_KERNEL); + pca955x = devm_kzalloc_flex(&client->dev, *pca955x, leds, chip->bits); if (!pca955x) return -ENOMEM; diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c index 5363afbe93ea..fa1721916963 100644 --- a/drivers/leds/leds-pca963x.c +++ b/drivers/leds/leds-pca963x.c @@ -530,7 +530,7 @@ static int pca963x_probe(struct i2c_client *client) return -EINVAL; } - chip = devm_kzalloc(dev, struct_size(chip, leds, count), GFP_KERNEL); + chip = devm_kzalloc_flex(dev, *chip, leds, count); if (!chip) return -ENOMEM; diff --git a/drivers/leds/leds-pca995x.c b/drivers/leds/leds-pca995x.c index fee6216cd1bd..3b6903c991fc 100644 --- a/drivers/leds/leds-pca995x.c +++ b/drivers/leds/leds-pca995x.c @@ -130,7 +130,7 @@ static int pca995x_probe(struct i2c_client *client) if (!dev_fwnode(dev)) return -ENODEV; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/leds/leds-pm8058.c b/drivers/leds/leds-pm8058.c index 3f49a5181892..22f1ee40f097 100644 --- a/drivers/leds/leds-pm8058.c +++ b/drivers/leds/leds-pm8058.c @@ -95,7 +95,7 @@ static int pm8058_led_probe(struct platform_device *pdev) enum led_brightness maxbright; enum led_default_state state; - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-powernv.c b/drivers/leds/leds-powernv.c index 3a38578ce8e4..2b2cde35cc50 100644 --- a/drivers/leds/leds-powernv.c +++ b/drivers/leds/leds-powernv.c @@ -253,8 +253,7 @@ static int powernv_led_classdev(struct platform_device *pdev, p = of_find_property(np, "led-types", NULL); while ((cur = of_prop_next_string(p, cur)) != NULL) { - powernv_led = devm_kzalloc(dev, sizeof(*powernv_led), - GFP_KERNEL); + powernv_led = devm_kzalloc_obj(dev, *powernv_led); if (!powernv_led) return -ENOMEM; @@ -285,8 +284,7 @@ static int powernv_led_probe(struct platform_device *pdev) return -EINVAL; } - powernv_led_common = devm_kzalloc(dev, sizeof(*powernv_led_common), - GFP_KERNEL); + powernv_led_common = devm_kzalloc_obj(dev, *powernv_led_common); if (!powernv_led_common) return -ENOMEM; diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c index 6c1f2f50ff85..3e5eda8590bb 100644 --- a/drivers/leds/leds-pwm.c +++ b/drivers/leds/leds-pwm.c @@ -212,8 +212,7 @@ static int led_pwm_probe(struct platform_device *pdev) if (!count) return -EINVAL; - priv = devm_kzalloc(&pdev->dev, struct_size(priv, leds, count), - GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, leds, count); if (!priv) return -ENOMEM; diff --git a/drivers/leds/leds-qnap-mcu.c b/drivers/leds/leds-qnap-mcu.c index 6df110e33ac9..a0c19eac84b6 100644 --- a/drivers/leds/leds-qnap-mcu.c +++ b/drivers/leds/leds-qnap-mcu.c @@ -80,7 +80,7 @@ static int qnap_mcu_register_err_led(struct device *dev, struct qnap_mcu *mcu, i struct qnap_mcu_err_led *err_led; int ret; - err_led = devm_kzalloc(dev, sizeof(*err_led), GFP_KERNEL); + err_led = devm_kzalloc_obj(dev, *err_led); if (!err_led) return -ENOMEM; @@ -171,7 +171,7 @@ static int qnap_mcu_register_usb_led(struct device *dev, struct qnap_mcu *mcu) struct qnap_mcu_usb_led *usb_led; int ret; - usb_led = devm_kzalloc(dev, sizeof(*usb_led), GFP_KERNEL); + usb_led = devm_kzalloc_obj(dev, *usb_led); if (!usb_led) return -ENOMEM; @@ -312,7 +312,7 @@ static int qnap_mcu_register_status_leds(struct device *dev, struct qnap_mcu *mc struct qnap_mcu_status *status; int ret; - status = devm_kzalloc(dev, sizeof(*status), GFP_KERNEL); + status = devm_kzalloc_obj(dev, *status); if (!status) return -ENOMEM; diff --git a/drivers/leds/leds-regulator.c b/drivers/leds/leds-regulator.c index 5ba0f36b2d81..200e25733701 100644 --- a/drivers/leds/leds-regulator.c +++ b/drivers/leds/leds-regulator.c @@ -135,7 +135,7 @@ static int regulator_led_probe(struct platform_device *pdev) return PTR_ERR(vcc); } - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (led == NULL) return -ENOMEM; diff --git a/drivers/leds/leds-sc27xx-bltc.c b/drivers/leds/leds-sc27xx-bltc.c index 0c5169773949..9a5977b62ca3 100644 --- a/drivers/leds/leds-sc27xx-bltc.c +++ b/drivers/leds/leds-sc27xx-bltc.c @@ -291,7 +291,7 @@ static int sc27xx_led_probe(struct platform_device *pdev) return err; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/leds/leds-spi-byte.c b/drivers/leds/leds-spi-byte.c index 0217557aad57..c438a5c59358 100644 --- a/drivers/leds/leds-spi-byte.c +++ b/drivers/leds/leds-spi-byte.c @@ -85,7 +85,7 @@ static int spi_byte_probe(struct spi_device *spi) return -EINVAL; } - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-st1202.c b/drivers/leds/leds-st1202.c index 8c2e1d58ba0c..163d6386993a 100644 --- a/drivers/leds/leds-st1202.c +++ b/drivers/leds/leds-st1202.c @@ -506,7 +506,7 @@ static int st1202_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return dev_err_probe(&client->dev, -EIO, "SMBUS Byte Data not Supported\n"); - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/leds/leds-sun50i-a100.c b/drivers/leds/leds-sun50i-a100.c index 7cfb4c7390bf..a806638c9211 100644 --- a/drivers/leds/leds-sun50i-a100.c +++ b/drivers/leds/leds-sun50i-a100.c @@ -419,7 +419,7 @@ static int sun50i_a100_ledc_probe(struct platform_device *pdev) if (!num_leds) return -ENODEV; - priv = devm_kzalloc(dev, struct_size(priv, leds, num_leds), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, leds, num_leds); if (!priv) return -ENOMEM; diff --git a/drivers/leds/leds-sunfire.c b/drivers/leds/leds-sunfire.c index bd24e7f5947a..c858b7bb6d17 100644 --- a/drivers/leds/leds-sunfire.c +++ b/drivers/leds/leds-sunfire.c @@ -135,7 +135,7 @@ static int sunfire_led_generic_probe(struct platform_device *pdev, return -EINVAL; } - p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(&pdev->dev, *p); if (!p) return -ENOMEM; diff --git a/drivers/leds/leds-syscon.c b/drivers/leds/leds-syscon.c index 741850f35f19..50603bb70b70 100644 --- a/drivers/leds/leds-syscon.c +++ b/drivers/leds/leds-syscon.c @@ -74,7 +74,7 @@ static int syscon_led_probe(struct platform_device *pdev) return PTR_ERR(map); } - sled = devm_kzalloc(dev, sizeof(*sled), GFP_KERNEL); + sled = devm_kzalloc_obj(dev, *sled); if (!sled) return -ENOMEM; diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c index 9afe2722986c..07c8f8deeed8 100644 --- a/drivers/leds/leds-tca6507.c +++ b/drivers/leds/leds-tca6507.c @@ -666,8 +666,7 @@ tca6507_led_dt_init(struct device *dev) if (!count || count > NUM_LEDS) return ERR_PTR(-ENODEV); - tca_leds = devm_kcalloc(dev, NUM_LEDS, sizeof(struct led_info), - GFP_KERNEL); + tca_leds = devm_kzalloc_objs(dev, struct led_info, NUM_LEDS); if (!tca_leds) return ERR_PTR(-ENOMEM); @@ -694,8 +693,7 @@ tca6507_led_dt_init(struct device *dev) tca_leds[reg] = led; } - pdata = devm_kzalloc(dev, sizeof(struct tca6507_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, struct tca6507_platform_data); if (!pdata) return ERR_PTR(-ENOMEM); @@ -730,7 +728,7 @@ static int tca6507_probe(struct i2c_client *client) dev_err(dev, "Need %d entries in platform-data list\n", NUM_LEDS); return PTR_ERR(pdata); } - tca = devm_kzalloc(dev, sizeof(*tca), GFP_KERNEL); + tca = devm_kzalloc_obj(dev, *tca); if (!tca) return -ENOMEM; diff --git a/drivers/leds/leds-tlc591xx.c b/drivers/leds/leds-tlc591xx.c index 2f272cfd2e91..0c2801c4d7d3 100644 --- a/drivers/leds/leds-tlc591xx.c +++ b/drivers/leds/leds-tlc591xx.c @@ -164,7 +164,7 @@ tlc591xx_probe(struct i2c_client *client) if (!count || count > tlc591xx->max_leds) return -EINVAL; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/leds/leds-tps6105x.c b/drivers/leds/leds-tps6105x.c index 09fd88a6c8f0..71418fc28cd6 100644 --- a/drivers/leds/leds-tps6105x.c +++ b/drivers/leds/leds-tps6105x.c @@ -48,7 +48,7 @@ static int tps6105x_led_probe(struct platform_device *pdev) return -EINVAL; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; /* fwnode/devicetree is optional. NULL is allowed for priv->fwnode */ diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c index 57128ae7e8fd..9a8db86bf562 100644 --- a/drivers/leds/leds-turris-omnia.c +++ b/drivers/leds/leds-turris-omnia.c @@ -486,7 +486,7 @@ static int omnia_leds_probe(struct i2c_client *client) if (count > OMNIA_BOARD_LEDS) return dev_err_probe(dev, -EINVAL, "Too many LEDs defined in device tree!\n"); - leds = devm_kzalloc(dev, struct_size(leds, leds, count), GFP_KERNEL); + leds = devm_kzalloc_flex(dev, *leds, leds, count); if (!leds) return -ENOMEM; diff --git a/drivers/leds/leds-upboard.c b/drivers/leds/leds-upboard.c index 12989b2f1953..eeb78595b1ce 100644 --- a/drivers/leds/leds-upboard.c +++ b/drivers/leds/leds-upboard.c @@ -88,7 +88,7 @@ static int upboard_led_probe(struct platform_device *pdev) .msb = led_profile[i].bit, }; - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/leds/leds-wm831x-status.c b/drivers/leds/leds-wm831x-status.c index 05930e9e8887..c261f4df398a 100644 --- a/drivers/leds/leds-wm831x-status.c +++ b/drivers/leds/leds-wm831x-status.c @@ -221,8 +221,7 @@ static int wm831x_status_probe(struct platform_device *pdev) return -EINVAL; } - drvdata = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_status), - GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, struct wm831x_status); if (!drvdata) return -ENOMEM; diff --git a/drivers/leds/leds-wm8350.c b/drivers/leds/leds-wm8350.c index 87e60ea927b9..05a6795e4734 100644 --- a/drivers/leds/leds-wm8350.c +++ b/drivers/leds/leds-wm8350.c @@ -213,7 +213,7 @@ static int wm8350_led_probe(struct platform_device *pdev) return PTR_ERR(dcdc); } - led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(&pdev->dev, *led); if (led == NULL) return -ENOMEM; diff --git a/drivers/leds/rgb/leds-group-multicolor.c b/drivers/leds/rgb/leds-group-multicolor.c index a707d51c6a4b..34c5ec2ea91f 100644 --- a/drivers/leds/rgb/leds-group-multicolor.c +++ b/drivers/leds/rgb/leds-group-multicolor.c @@ -70,7 +70,7 @@ static int leds_gmc_probe(struct platform_device *pdev) unsigned int max_brightness = 0; int i, ret, count = 0, common_flags = 0; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -98,7 +98,7 @@ static int leds_gmc_probe(struct platform_device *pdev) count++; } - subled = devm_kcalloc(dev, count, sizeof(*subled), GFP_KERNEL); + subled = devm_kzalloc_objs(dev, *subled, count); if (!subled) return -ENOMEM; priv->mc_cdev.subled_info = subled; diff --git a/drivers/leds/rgb/leds-ktd202x.c b/drivers/leds/rgb/leds-ktd202x.c index 143020945e23..f1822281c3e6 100644 --- a/drivers/leds/rgb/leds-ktd202x.c +++ b/drivers/leds/rgb/leds-ktd202x.c @@ -397,7 +397,7 @@ static int ktd202x_setup_led_rgb(struct ktd202x *chip, struct fwnode_handle *fwn if (!num_channels || num_channels > chip->num_leds) return -EINVAL; - info = devm_kcalloc(chip->dev, num_channels, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_objs(chip->dev, *info, num_channels); if (!info) return -ENOMEM; @@ -540,7 +540,7 @@ static int ktd202x_probe(struct i2c_client *client) if (!count || count > KTD202X_MAX_LEDS) return dev_err_probe(dev, -EINVAL, "Incorrect number of leds (%d)", count); - chip = devm_kzalloc(dev, struct_size(chip, leds, count), GFP_KERNEL); + chip = devm_kzalloc_flex(dev, *chip, leds, count); if (!chip) return -ENOMEM; diff --git a/drivers/leds/rgb/leds-lp5812.c b/drivers/leds/rgb/leds-lp5812.c index ce6d703641e8..3d38d45043dd 100644 --- a/drivers/leds/rgb/leds-lp5812.c +++ b/drivers/leds/rgb/leds-lp5812.c @@ -340,8 +340,8 @@ static int lp5812_init_led(struct lp5812_led *led, struct lp5812_chip *chip, int } if (!chip->led_config[chan].is_sc_led) { - mc_led_info = devm_kcalloc(dev, chip->led_config[chan].num_colors, - sizeof(*mc_led_info), GFP_KERNEL); + mc_led_info = devm_kzalloc_objs(dev, *mc_led_info, + chip->led_config[chan].num_colors); if (!mc_led_info) return -ENOMEM; @@ -550,7 +550,7 @@ static int lp5812_of_probe(struct device *dev, return -EINVAL; } - cfg = devm_kcalloc(dev, num_channels, sizeof(*cfg), GFP_KERNEL); + cfg = devm_kzalloc_objs(dev, *cfg, num_channels); if (!cfg) return -ENOMEM; @@ -583,7 +583,7 @@ static int lp5812_probe(struct i2c_client *client) if (!np) return -EINVAL; - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; @@ -591,7 +591,7 @@ static int lp5812_probe(struct i2c_client *client) if (ret) return ret; - leds = devm_kcalloc(&client->dev, chip->num_channels, sizeof(*leds), GFP_KERNEL); + leds = devm_kzalloc_objs(&client->dev, *leds, chip->num_channels); if (!leds) return -ENOMEM; diff --git a/drivers/leds/rgb/leds-lp5860-core.c b/drivers/leds/rgb/leds-lp5860-core.c index e21d5f2302be..fe6da432fb3b 100644 --- a/drivers/leds/rgb/leds-lp5860-core.c +++ b/drivers/leds/rgb/leds-lp5860-core.c @@ -159,7 +159,7 @@ static int lp5860_init_dt(struct lp5860 *lp) led->mc_cdev.num_colors = chan; - mc_led_info = devm_kcalloc(lp->dev, chan, sizeof(*mc_led_info), GFP_KERNEL); + mc_led_info = devm_kzalloc_objs(lp->dev, *mc_led_info, chan); if (!mc_led_info) return -ENOMEM; diff --git a/drivers/leds/rgb/leds-lp5860-spi.c b/drivers/leds/rgb/leds-lp5860-spi.c index 6bf6a625c28a..f035f876e4d3 100644 --- a/drivers/leds/rgb/leds-lp5860-spi.c +++ b/drivers/leds/rgb/leds-lp5860-spi.c @@ -51,8 +51,7 @@ static int lp5860_probe(struct spi_device *spi) return -EINVAL; } - lp5860 = devm_kzalloc(dev, struct_size(lp5860, leds, multi_leds), - GFP_KERNEL); + lp5860 = devm_kzalloc_flex(dev, *lp5860, leds, multi_leds); if (!lp5860) return -ENOMEM; diff --git a/drivers/leds/rgb/leds-mt6370-rgb.c b/drivers/leds/rgb/leds-mt6370-rgb.c index 2c0ccd1ba7fb..b8b94b83f137 100644 --- a/drivers/leds/rgb/leds-mt6370-rgb.c +++ b/drivers/leds/rgb/leds-mt6370-rgb.c @@ -718,7 +718,7 @@ static int mt6370_assign_multicolor_info(struct device *dev, struct mt6370_led * u32 num_color = 0; int ret; - sub_led = devm_kcalloc(dev, MC_CHANNEL_NUM, sizeof(*sub_led), GFP_KERNEL); + sub_led = devm_kzalloc_objs(dev, *sub_led, MC_CHANNEL_NUM); if (!sub_led) return -ENOMEM; @@ -914,7 +914,7 @@ static int mt6370_leds_probe(struct platform_device *pdev) "No child node or node count over max LED number %zu\n", count); - priv = devm_kzalloc(dev, struct_size(priv, leds, count), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, leds, count); if (!priv) return -ENOMEM; diff --git a/drivers/leds/rgb/leds-ncp5623.c b/drivers/leds/rgb/leds-ncp5623.c index f2528f06507d..70282ea3d900 100644 --- a/drivers/leds/rgb/leds-ncp5623.c +++ b/drivers/leds/rgb/leds-ncp5623.c @@ -161,7 +161,7 @@ static int ncp5623_probe(struct i2c_client *client) u32 reg; int ret; - ncp = devm_kzalloc(dev, sizeof(*ncp), GFP_KERNEL); + ncp = devm_kzalloc_obj(dev, *ncp); if (!ncp) return -ENOMEM; @@ -173,7 +173,7 @@ static int ncp5623_probe(struct i2c_client *client) num_subleds = fwnode_get_child_node_count(mc_node); - subled_info = devm_kcalloc(dev, num_subleds, sizeof(*subled_info), GFP_KERNEL); + subled_info = devm_kzalloc_objs(dev, *subled_info, num_subleds); if (!subled_info) { ret = -ENOMEM; goto release_mc_node; diff --git a/drivers/leds/rgb/leds-pwm-multicolor.c b/drivers/leds/rgb/leds-pwm-multicolor.c index 6365459ec27f..c8395fdbcbdb 100644 --- a/drivers/leds/rgb/leds-pwm-multicolor.c +++ b/drivers/leds/rgb/leds-pwm-multicolor.c @@ -124,15 +124,14 @@ static int led_pwm_mc_probe(struct platform_device *pdev) /* count the nodes inside the multi-led node */ count = fwnode_get_child_node_count(mcnode); - priv = devm_kzalloc(&pdev->dev, struct_size(priv, leds, count), - GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, leds, count); if (!priv) { ret = -ENOMEM; goto release_mcnode; } mutex_init(&priv->lock); - subled = devm_kcalloc(&pdev->dev, count, sizeof(*subled), GFP_KERNEL); + subled = devm_kzalloc_objs(&pdev->dev, *subled, count); if (!subled) { ret = -ENOMEM; goto release_mcnode; diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c index 24ffe079f221..98e39e03b9a1 100644 --- a/drivers/leds/rgb/leds-qcom-lpg.c +++ b/drivers/leds/rgb/leds-qcom-lpg.c @@ -1394,7 +1394,7 @@ static int lpg_add_led(struct lpg *lpg, struct fwnode_handle *fw) else num_channels = 1; - led = devm_kzalloc(lpg->dev, struct_size(led, channels, num_channels), GFP_KERNEL); + led = devm_kzalloc_flex(lpg->dev, *led, channels, num_channels); if (!led) return -ENOMEM; @@ -1402,7 +1402,7 @@ static int lpg_add_led(struct lpg *lpg, struct fwnode_handle *fw) led->num_channels = num_channels; if (color == LED_COLOR_ID_RGB || color == LED_COLOR_ID_MULTI) { - info = devm_kcalloc(lpg->dev, num_channels, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_objs(lpg->dev, *info, num_channels); if (!info) return -ENOMEM; i = 0; @@ -1609,7 +1609,7 @@ static int lpg_probe(struct platform_device *pdev) if (!data) return -EINVAL; - lpg = devm_kzalloc(&pdev->dev, struct_size(lpg, channels, data->num_channels), GFP_KERNEL); + lpg = devm_kzalloc_flex(&pdev->dev, *lpg, channels, data->num_channels); if (!lpg) return -ENOMEM; diff --git a/drivers/leds/rgb/leds-s2m-rgb.c b/drivers/leds/rgb/leds-s2m-rgb.c index d239f54eee90..902307d7567f 100644 --- a/drivers/leds/rgb/leds-s2m-rgb.c +++ b/drivers/leds/rgb/leds-s2m-rgb.c @@ -368,7 +368,7 @@ static int s2m_rgb_probe(struct platform_device *pdev) struct led_init_data init_data = {}; int ret; - rgb = devm_kzalloc(dev, sizeof(*rgb), GFP_KERNEL); + rgb = devm_kzalloc_obj(dev, *rgb); if (!rgb) return -ENOMEM; diff --git a/drivers/leds/simatic/simatic-ipc-leds-gpio-f7188x.c b/drivers/leds/simatic/simatic-ipc-leds-gpio-f7188x.c index bc23d701bcb7..656c5f5bec74 100644 --- a/drivers/leds/simatic/simatic-ipc-leds-gpio-f7188x.c +++ b/drivers/leds/simatic/simatic-ipc-leds-gpio-f7188x.c @@ -62,7 +62,7 @@ static int simatic_ipc_leds_gpio_f7188x_probe(struct platform_device *pdev) const struct simatic_ipc_platform *plat = dev_get_platdata(&pdev->dev); struct simatic_ipc_led_tables *led_tables; - led_tables = devm_kzalloc(&pdev->dev, sizeof(*led_tables), GFP_KERNEL); + led_tables = devm_kzalloc_obj(&pdev->dev, *led_tables); if (!led_tables) return -ENOMEM; diff --git a/drivers/mailbox/arm_mhu.c b/drivers/mailbox/arm_mhu.c index 0950b7bce184..8d335afbc36a 100644 --- a/drivers/mailbox/arm_mhu.c +++ b/drivers/mailbox/arm_mhu.c @@ -118,7 +118,7 @@ static int mhu_probe(struct amba_device *adev, const struct amba_id *id) return -ENODEV; /* Allocate memory for device */ - mhu = devm_kzalloc(dev, sizeof(*mhu), GFP_KERNEL); + mhu = devm_kzalloc_obj(dev, *mhu); if (!mhu) return -ENOMEM; diff --git a/drivers/mailbox/arm_mhu_db.c b/drivers/mailbox/arm_mhu_db.c index 9f1c7bcfdcb4..70eae842fadb 100644 --- a/drivers/mailbox/arm_mhu_db.c +++ b/drivers/mailbox/arm_mhu_db.c @@ -221,7 +221,7 @@ static struct mbox_chan *mhu_db_mbox_xlate(struct mbox_controller *mbox, chan = &mbox->chans[i]; - chan_info = devm_kzalloc(mbox->dev, sizeof(*chan_info), GFP_KERNEL); + chan_info = devm_kzalloc_obj(mbox->dev, *chan_info); if (!chan_info) return ERR_PTR(-ENOMEM); @@ -272,7 +272,7 @@ static int mhu_db_probe(struct amba_device *adev, const struct amba_id *id) return -EINVAL; } - mhu = devm_kzalloc(dev, sizeof(*mhu), GFP_KERNEL); + mhu = devm_kzalloc_obj(dev, *mhu); if (!mhu) return -ENOMEM; @@ -280,7 +280,7 @@ static int mhu_db_probe(struct amba_device *adev, const struct amba_id *id) if (IS_ERR(mhu->base)) return PTR_ERR(mhu->base); - chans = devm_kcalloc(dev, max_chans, sizeof(*chans), GFP_KERNEL); + chans = devm_kzalloc_objs(dev, *chans, max_chans); if (!chans) return -ENOMEM; diff --git a/drivers/mailbox/arm_mhuv2.c b/drivers/mailbox/arm_mhuv2.c index 0520d4996634..995a3a9a8836 100644 --- a/drivers/mailbox/arm_mhuv2.c +++ b/drivers/mailbox/arm_mhuv2.c @@ -878,7 +878,7 @@ static int mhuv2_allocate_channels(struct mhuv2 *mhu) struct mbox_chan *chans; int protocol, windows = 0, next_window = 0, i, j, k; - chans = devm_kcalloc(dev, mbox->num_chans, sizeof(*chans), GFP_KERNEL); + chans = devm_kzalloc_objs(dev, *chans, mbox->num_chans); if (!chans) return -ENOMEM; @@ -891,7 +891,7 @@ static int mhuv2_allocate_channels(struct mhuv2 *mhu) windows = mhu->protocols[i + 1]; if (protocol == DATA_TRANSFER) { - priv = devm_kmalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kmalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -904,7 +904,7 @@ static int mhuv2_allocate_channels(struct mhuv2 *mhu) for (j = 0; j < windows; j++) { for (k = 0; k < MHUV2_STAT_BITS; k++) { - priv = devm_kmalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kmalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -942,7 +942,7 @@ static int mhuv2_parse_channels(struct mhuv2 *mhu) return -EINVAL; } - protocols = devm_kmalloc_array(dev, count, sizeof(*protocols), GFP_KERNEL); + protocols = devm_kmalloc_objs(dev, *protocols, count); if (!protocols) return -ENOMEM; @@ -1065,7 +1065,7 @@ static int mhuv2_probe(struct amba_device *adev, const struct amba_id *id) if (IS_ERR(reg)) return PTR_ERR(reg); - mhu = devm_kzalloc(dev, sizeof(*mhu), GFP_KERNEL); + mhu = devm_kzalloc_obj(dev, *mhu); if (!mhu) return -ENOMEM; diff --git a/drivers/mailbox/arm_mhuv3.c b/drivers/mailbox/arm_mhuv3.c index b9addd9e2c41..e4140005a662 100644 --- a/drivers/mailbox/arm_mhuv3.c +++ b/drivers/mailbox/arm_mhuv3.c @@ -606,7 +606,7 @@ static int mhuv3_dbe_channels_init(struct mhuv3 *mhu) int k; for (k = 0; k < MHUV3_FLAG_BITS; k++) { - priv = devm_kmalloc(mbox->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kmalloc_obj(mbox->dev, *priv); if (!priv) return -ENOMEM; @@ -713,7 +713,7 @@ static int mhuv3_dbe_init(struct mhuv3 *mhu) dev_dbg(dev, "%s: Initializing DBE Extension.\n", mhuv3_str[mhu->frame]); - e = devm_kzalloc(dev, sizeof(*e), GFP_KERNEL); + e = devm_kzalloc_obj(dev, *e); if (!e) return -ENOMEM; @@ -772,8 +772,7 @@ static int mhuv3_initialize_channels(struct device *dev, struct mhuv3 *mhu) struct mbox_controller *mbox = &mhu->mbox; int i, ret = 0; - mbox->chans = devm_kcalloc(dev, mhu->num_chans, - sizeof(*mbox->chans), GFP_KERNEL); + mbox->chans = devm_kzalloc_objs(dev, *mbox->chans, mhu->num_chans); if (!mbox->chans) return dev_err_probe(dev, -ENOMEM, "Failed to initialize channels\n"); @@ -1054,7 +1053,7 @@ static int mhuv3_probe(struct platform_device *pdev) struct mhuv3 *mhu; int ret; - mhu = devm_kzalloc(dev, sizeof(*mhu), GFP_KERNEL); + mhu = devm_kzalloc_obj(dev, *mhu); if (!mhu) return -ENOMEM; diff --git a/drivers/mailbox/armada-37xx-rwtm-mailbox.c b/drivers/mailbox/armada-37xx-rwtm-mailbox.c index 047926711e96..62fc037a3bec 100644 --- a/drivers/mailbox/armada-37xx-rwtm-mailbox.c +++ b/drivers/mailbox/armada-37xx-rwtm-mailbox.c @@ -144,12 +144,12 @@ static int armada_37xx_mbox_probe(struct platform_device *pdev) struct mbox_chan *chans; int ret; - mbox = devm_kzalloc(&pdev->dev, sizeof(*mbox), GFP_KERNEL); + mbox = devm_kzalloc_obj(&pdev->dev, *mbox); if (!mbox) return -ENOMEM; /* Allocated one channel */ - chans = devm_kzalloc(&pdev->dev, sizeof(*chans), GFP_KERNEL); + chans = devm_kzalloc_obj(&pdev->dev, *chans); if (!chans) return -ENOMEM; diff --git a/drivers/mailbox/ast2700-mailbox.c b/drivers/mailbox/ast2700-mailbox.c index 83c6afe5411f..ac77e43f1f92 100644 --- a/drivers/mailbox/ast2700-mailbox.c +++ b/drivers/mailbox/ast2700-mailbox.c @@ -163,12 +163,12 @@ static int ast2700_mbox_probe(struct platform_device *pdev) dev_data = device_get_match_data(&pdev->dev); - mb = devm_kzalloc(dev, sizeof(*mb), GFP_KERNEL); + mb = devm_kzalloc_obj(dev, *mb); if (!mb) return -ENOMEM; - mb->mbox.chans = devm_kcalloc(&pdev->dev, dev_data->num_chans, - sizeof(*mb->mbox.chans), GFP_KERNEL); + mb->mbox.chans = devm_kzalloc_objs(&pdev->dev, *mb->mbox.chans, + dev_data->num_chans); if (!mb->mbox.chans) return -ENOMEM; diff --git a/drivers/mailbox/axiado-mailbox.c b/drivers/mailbox/axiado-mailbox.c index a87693c639dc..9951196f528f 100644 --- a/drivers/mailbox/axiado-mailbox.c +++ b/drivers/mailbox/axiado-mailbox.c @@ -343,17 +343,15 @@ static int axiado_mbox_probe(struct platform_device *pdev) if (!drv_data) return -ENODEV; - mb = devm_kzalloc(dev, sizeof(*mb), GFP_KERNEL); + mb = devm_kzalloc_obj(dev, *mb); if (!mb) return -ENOMEM; mb->mbox.dev = dev; mb->mbox.num_chans = drv_data->num_chans; - mb->mbox.chans = devm_kcalloc(&pdev->dev, - drv_data->num_chans, - sizeof(*mb->mbox.chans), - GFP_KERNEL); + mb->mbox.chans = devm_kzalloc_objs(&pdev->dev, *mb->mbox.chans, + drv_data->num_chans); if (!mb->mbox.chans) return -ENOMEM; @@ -365,10 +363,7 @@ static int axiado_mbox_probe(struct platform_device *pdev) if (IS_ERR(mb->rx_base)) return PTR_ERR(mb->rx_base); - ch_data = devm_kcalloc(&pdev->dev, - drv_data->num_chans, - sizeof(*ch_data), - GFP_KERNEL); + ch_data = devm_kzalloc_objs(&pdev->dev, *ch_data, drv_data->num_chans); if (!ch_data) return -ENOMEM; diff --git a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c index 04c47eadf950..d5cec5ae3f4e 100644 --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c @@ -1482,7 +1482,7 @@ static int flexrm_mbox_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; /* Allocate driver mailbox struct */ - mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); + mbox = devm_kzalloc_obj(dev, *mbox); if (!mbox) { ret = -ENOMEM; goto fail; @@ -1513,7 +1513,7 @@ static int flexrm_mbox_probe(struct platform_device *pdev) } /* Allocate driver ring structs */ - ring = devm_kcalloc(dev, mbox->num_rings, sizeof(*ring), GFP_KERNEL); + ring = devm_kzalloc_objs(dev, *ring, mbox->num_rings); if (!ring) { ret = -ENOMEM; goto fail; @@ -1609,8 +1609,8 @@ skip_debugfs: mbox->controller.dev = dev; mbox->controller.num_chans = mbox->num_rings; mbox->controller.of_xlate = flexrm_mbox_of_xlate; - mbox->controller.chans = devm_kcalloc(dev, mbox->num_rings, - sizeof(*mbox->controller.chans), GFP_KERNEL); + mbox->controller.chans = devm_kzalloc_objs(dev, *mbox->controller.chans, + mbox->num_rings); if (!mbox->controller.chans) { ret = -ENOMEM; goto fail_free_debugfs_root; diff --git a/drivers/mailbox/bcm-pdc-mailbox.c b/drivers/mailbox/bcm-pdc-mailbox.c index 6fcc4002ad4f..88f0d1a81385 100644 --- a/drivers/mailbox/bcm-pdc-mailbox.c +++ b/drivers/mailbox/bcm-pdc-mailbox.c @@ -1438,8 +1438,7 @@ static int pdc_mb_init(struct pdc_state *pdcs) mbc->dev = dev; mbc->ops = &pdc_mbox_chan_ops; mbc->num_chans = 1; - mbc->chans = devm_kcalloc(dev, mbc->num_chans, sizeof(*mbc->chans), - GFP_KERNEL); + mbc->chans = devm_kzalloc_objs(dev, *mbc->chans, mbc->num_chans); if (!mbc->chans) return -ENOMEM; @@ -1527,7 +1526,7 @@ static int pdc_probe(struct platform_device *pdev) struct pdc_state *pdcs; /* PDC state for one SPU */ - pdcs = devm_kzalloc(dev, sizeof(*pdcs), GFP_KERNEL); + pdcs = devm_kzalloc_obj(dev, *pdcs); if (!pdcs) { err = -ENOMEM; goto cleanup; diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c index 0ca75c378a60..ea9d1b90c017 100644 --- a/drivers/mailbox/bcm2835-mailbox.c +++ b/drivers/mailbox/bcm2835-mailbox.c @@ -149,7 +149,7 @@ static int bcm2835_mbox_probe(struct platform_device *pdev) if (IS_ERR(regs)) return PTR_ERR(regs); - mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); + mbox = devm_kzalloc_obj(dev, *mbox); if (mbox == NULL) return -ENOMEM; @@ -167,8 +167,7 @@ static int bcm2835_mbox_probe(struct platform_device *pdev) mbox->controller.of_xlate = &bcm2835_mbox_index_xlate; mbox->controller.dev = dev; mbox->controller.num_chans = 1; - mbox->controller.chans = devm_kzalloc(dev, - sizeof(*mbox->controller.chans), GFP_KERNEL); + mbox->controller.chans = devm_kzalloc_obj(dev, *mbox->controller.chans); if (!mbox->controller.chans) return -ENOMEM; diff --git a/drivers/mailbox/bcm74110-mailbox.c b/drivers/mailbox/bcm74110-mailbox.c index bec138d76914..5c503311efe5 100644 --- a/drivers/mailbox/bcm74110-mailbox.c +++ b/drivers/mailbox/bcm74110-mailbox.c @@ -584,7 +584,7 @@ static int bcm74110_mbox_probe(struct platform_device *pdev) struct bcm74110_mbox *mbox; int i, ret; - mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); + mbox = devm_kzalloc_obj(dev, *mbox); if (!mbox) return -ENOMEM; @@ -620,15 +620,13 @@ static int bcm74110_mbox_probe(struct platform_device *pdev) mbox->controller.dev = dev; mbox->controller.num_chans = BCM_MSG_SVC_MAX; mbox->controller.of_xlate = &bcm74110_mbox_of_xlate; - mbox->controller.chans = devm_kcalloc(dev, BCM_MSG_SVC_MAX, - sizeof(*mbox->controller.chans), - GFP_KERNEL); + mbox->controller.chans = devm_kzalloc_objs(dev, *mbox->controller.chans, + BCM_MSG_SVC_MAX); if (!mbox->controller.chans) return -ENOMEM; - mbox->mbox_chan = devm_kcalloc(dev, BCM_MSG_SVC_MAX, - sizeof(*mbox->mbox_chan), - GFP_KERNEL); + mbox->mbox_chan = devm_kzalloc_objs(dev, *mbox->mbox_chan, + BCM_MSG_SVC_MAX); if (!mbox->mbox_chan) return -ENOMEM; diff --git a/drivers/mailbox/cix-mailbox.c b/drivers/mailbox/cix-mailbox.c index 7fa979c1b8f0..8b2b0a34e1eb 100644 --- a/drivers/mailbox/cix-mailbox.c +++ b/drivers/mailbox/cix-mailbox.c @@ -562,7 +562,7 @@ static int cix_mbox_probe(struct platform_device *pdev) const char *dir_str; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/mailbox/cv1800-mailbox.c b/drivers/mailbox/cv1800-mailbox.c index b062c2c4fc61..abe035f750d2 100644 --- a/drivers/mailbox/cv1800-mailbox.c +++ b/drivers/mailbox/cv1800-mailbox.c @@ -165,7 +165,7 @@ static int cv1800_mbox_probe(struct platform_device *pdev) struct cv1800_mbox *mb; int irq, idx, err; - mb = devm_kzalloc(dev, sizeof(*mb), GFP_KERNEL); + mb = devm_kzalloc_obj(dev, *mb); if (!mb) return -ENOMEM; diff --git a/drivers/mailbox/exynos-mailbox.c b/drivers/mailbox/exynos-mailbox.c index ff75c1c7633c..bad1182431b1 100644 --- a/drivers/mailbox/exynos-mailbox.c +++ b/drivers/mailbox/exynos-mailbox.c @@ -153,15 +153,15 @@ static int exynos_mbox_probe(struct platform_device *pdev) if (!data) return -ENODEV; - exynos_mbox = devm_kzalloc(dev, sizeof(*exynos_mbox), GFP_KERNEL); + exynos_mbox = devm_kzalloc_obj(dev, *exynos_mbox); if (!exynos_mbox) return -ENOMEM; - mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); + mbox = devm_kzalloc_obj(dev, *mbox); if (!mbox) return -ENOMEM; - chans = devm_kcalloc(dev, data->num_chans, sizeof(*chans), GFP_KERNEL); + chans = devm_kzalloc_objs(dev, *chans, data->num_chans); if (!chans) return -ENOMEM; diff --git a/drivers/mailbox/hi3660-mailbox.c b/drivers/mailbox/hi3660-mailbox.c index 9b727a2b54a5..ededa645d38e 100644 --- a/drivers/mailbox/hi3660-mailbox.c +++ b/drivers/mailbox/hi3660-mailbox.c @@ -240,7 +240,7 @@ static int hi3660_mbox_probe(struct platform_device *pdev) unsigned long ch; int err; - mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); + mbox = devm_kzalloc_obj(dev, *mbox); if (!mbox) return -ENOMEM; diff --git a/drivers/mailbox/hi6220-mailbox.c b/drivers/mailbox/hi6220-mailbox.c index 8eb8242209be..06072904ed25 100644 --- a/drivers/mailbox/hi6220-mailbox.c +++ b/drivers/mailbox/hi6220-mailbox.c @@ -267,15 +267,14 @@ static int hi6220_mbox_probe(struct platform_device *pdev) struct hi6220_mbox *mbox; int i, err; - mbox = devm_kzalloc(dev, struct_size(mbox, mchan, MBOX_CHAN_MAX), GFP_KERNEL); + mbox = devm_kzalloc_flex(dev, *mbox, mchan, MBOX_CHAN_MAX); if (!mbox) return -ENOMEM; mbox->chan_num = MBOX_CHAN_MAX; mbox->dev = dev; - mbox->chan = devm_kcalloc(dev, - mbox->chan_num, sizeof(*mbox->chan), GFP_KERNEL); + mbox->chan = devm_kzalloc_objs(dev, *mbox->chan, mbox->chan_num); if (!mbox->chan) return -ENOMEM; diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c index 40bad2b3e4d1..683ccea6f2ba 100644 --- a/drivers/mailbox/imx-mailbox.c +++ b/drivers/mailbox/imx-mailbox.c @@ -920,7 +920,7 @@ static int imx_mu_probe(struct platform_device *pdev) int i, ret; u32 size; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/mailbox/mailbox-altera.c b/drivers/mailbox/mailbox-altera.c index 7cb91413ef7f..7301e0fc3f5d 100644 --- a/drivers/mailbox/mailbox-altera.c +++ b/drivers/mailbox/mailbox-altera.c @@ -288,13 +288,12 @@ static int altera_mbox_probe(struct platform_device *pdev) struct mbox_chan *chans; int ret; - mbox = devm_kzalloc(&pdev->dev, sizeof(*mbox), - GFP_KERNEL); + mbox = devm_kzalloc_obj(&pdev->dev, *mbox); if (!mbox) return -ENOMEM; /* Allocated one channel */ - chans = devm_kzalloc(&pdev->dev, sizeof(*chans), GFP_KERNEL); + chans = devm_kzalloc_obj(&pdev->dev, *chans); if (!chans) return -ENOMEM; diff --git a/drivers/mailbox/mailbox-mchp-ipc-sbi.c b/drivers/mailbox/mailbox-mchp-ipc-sbi.c index f081f8a9bcf8..dc485be8498b 100644 --- a/drivers/mailbox/mailbox-mchp-ipc-sbi.c +++ b/drivers/mailbox/mailbox-mchp-ipc-sbi.c @@ -391,9 +391,8 @@ static int mchp_ipc_get_cluster_aggr_irq(struct mchp_ipc_sbi_mbox *ipc) if (ret) return ret; - ipc->cluster_cfg[cpuid].buf_base = devm_kmalloc(ipc->dev, - sizeof(struct mchp_ipc_status), - GFP_KERNEL); + ipc->cluster_cfg[cpuid].buf_base = devm_kmalloc_obj(ipc->dev, + struct mchp_ipc_status); if (!ipc->cluster_cfg[cpuid].buf_base) return -ENOMEM; @@ -420,13 +419,13 @@ static int mchp_ipc_probe(struct platform_device *pdev) if (ret <= 0) return dev_err_probe(dev, -ENODEV, "Microchip SBI extension not detected\n"); - ipc = devm_kzalloc(dev, sizeof(*ipc), GFP_KERNEL); + ipc = devm_kzalloc_obj(dev, *ipc); if (!ipc) return -ENOMEM; platform_set_drvdata(pdev, ipc); - ipc->buf_base = devm_kmalloc(dev, sizeof(struct mchp_ipc_mbox_info), GFP_KERNEL); + ipc->buf_base = devm_kmalloc_obj(dev, struct mchp_ipc_mbox_info); if (!ipc->buf_base) return -ENOMEM; @@ -440,7 +439,8 @@ static int mchp_ipc_probe(struct platform_device *pdev) ipc->controller.num_chans = ipc_info.num_channels; ipc->hw_type = ipc_info.hw_type; - ipc->chans = devm_kcalloc(dev, ipc->controller.num_chans, sizeof(*ipc->chans), GFP_KERNEL); + ipc->chans = devm_kzalloc_objs(dev, *ipc->chans, + ipc->controller.num_chans); if (!ipc->chans) return -ENOMEM; @@ -452,7 +452,7 @@ static int mchp_ipc_probe(struct platform_device *pdev) ipc->controller.of_xlate = mchp_ipc_mbox_xlate; for (chan_id = 0; chan_id < ipc->controller.num_chans; chan_id++) { - priv = devm_kmalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kmalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -461,9 +461,9 @@ static int mchp_ipc_probe(struct platform_device *pdev) } if (ipc->hw_type == MIV_IHC) { - ipc->cluster_cfg = devm_kcalloc(dev, num_online_cpus(), - sizeof(struct mchp_ipc_cluster_cfg), - GFP_KERNEL); + ipc->cluster_cfg = devm_kzalloc_objs(dev, + struct mchp_ipc_cluster_cfg, + num_online_cpus()); if (!ipc->cluster_cfg) return -ENOMEM; diff --git a/drivers/mailbox/mailbox-mpfs.c b/drivers/mailbox/mailbox-mpfs.c index 704a259bbca8..8298d82b936c 100644 --- a/drivers/mailbox/mailbox-mpfs.c +++ b/drivers/mailbox/mailbox-mpfs.c @@ -278,7 +278,7 @@ static int mpfs_mbox_probe(struct platform_device *pdev) struct mpfs_mbox *mbox; int ret; - mbox = devm_kzalloc(&pdev->dev, sizeof(*mbox), GFP_KERNEL); + mbox = devm_kzalloc_obj(&pdev->dev, *mbox); if (!mbox) return -ENOMEM; diff --git a/drivers/mailbox/mailbox-sti.c b/drivers/mailbox/mailbox-sti.c index 4fb5d1b5504a..b0fa04f15236 100644 --- a/drivers/mailbox/mailbox-sti.c +++ b/drivers/mailbox/mailbox-sti.c @@ -361,7 +361,7 @@ static struct mbox_chan *sti_mbox_xlate(struct mbox_controller *mbox, return ERR_PTR(-EBUSY); } - chan_info = devm_kzalloc(mbox->dev, sizeof(*chan_info), GFP_KERNEL); + chan_info = devm_kzalloc_obj(mbox->dev, *chan_info); if (!chan_info) return ERR_PTR(-ENOMEM); @@ -414,7 +414,7 @@ static int sti_mbox_probe(struct platform_device *pdev) return -ENODEV; } - mdev = devm_kzalloc(&pdev->dev, sizeof(*mdev), GFP_KERNEL); + mdev = devm_kzalloc_obj(&pdev->dev, *mdev); if (!mdev) return -ENOMEM; @@ -428,12 +428,11 @@ static int sti_mbox_probe(struct platform_device *pdev) if (ret) mdev->name = np->full_name; - mbox = devm_kzalloc(&pdev->dev, sizeof(*mbox), GFP_KERNEL); + mbox = devm_kzalloc_obj(&pdev->dev, *mbox); if (!mbox) return -ENOMEM; - chans = devm_kcalloc(&pdev->dev, - STI_MBOX_CHAN_MAX, sizeof(*chans), GFP_KERNEL); + chans = devm_kzalloc_objs(&pdev->dev, *chans, STI_MBOX_CHAN_MAX); if (!chans) return -ENOMEM; diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c index 7b6ef033e77a..54684e901969 100644 --- a/drivers/mailbox/mailbox-test.c +++ b/drivers/mailbox/mailbox-test.c @@ -333,7 +333,7 @@ mbox_test_request_channel(struct platform_device *pdev, const char *name) struct mbox_client *client; struct mbox_chan *channel; - client = devm_kzalloc(&pdev->dev, sizeof(*client), GFP_KERNEL); + client = devm_kzalloc_obj(&pdev->dev, *client); if (!client) return NULL; @@ -377,7 +377,7 @@ static int mbox_test_probe(struct platform_device *pdev) struct mbox_test_device *tdev; int ret; - tdev = devm_kzalloc(&pdev->dev, sizeof(*tdev), GFP_KERNEL); + tdev = devm_kzalloc_obj(&pdev->dev, *tdev); if (!tdev) return -ENOMEM; diff --git a/drivers/mailbox/mailbox-th1520.c b/drivers/mailbox/mailbox-th1520.c index 626957c2e435..f908b2c0a54b 100644 --- a/drivers/mailbox/mailbox-th1520.c +++ b/drivers/mailbox/mailbox-th1520.c @@ -336,7 +336,7 @@ static const struct mbox_chan_ops th1520_mbox_ops = { static int th1520_mbox_init_generic(struct th1520_mbox_priv *priv) { #ifdef CONFIG_PM_SLEEP - priv->ctx = devm_kzalloc(priv->dev, sizeof(*priv->ctx), GFP_KERNEL); + priv->ctx = devm_kzalloc_obj(priv->dev, *priv->ctx); if (!priv->ctx) return -ENOMEM; #endif @@ -410,7 +410,7 @@ static int th1520_mbox_probe(struct platform_device *pdev) unsigned int i; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/mailbox/mailbox-xgene-slimpro.c b/drivers/mailbox/mailbox-xgene-slimpro.c index 1f87a84e5995..6857e043eaf5 100644 --- a/drivers/mailbox/mailbox-xgene-slimpro.c +++ b/drivers/mailbox/mailbox-xgene-slimpro.c @@ -174,7 +174,7 @@ static int slimpro_mbox_probe(struct platform_device *pdev) int rc; int i; - ctx = devm_kzalloc(&pdev->dev, sizeof(struct slimpro_mbox), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, struct slimpro_mbox); if (!ctx) return -ENOMEM; diff --git a/drivers/mailbox/mtk-adsp-mailbox.c b/drivers/mailbox/mtk-adsp-mailbox.c index 8bcecddee0eb..08f78c435915 100644 --- a/drivers/mailbox/mtk-adsp-mailbox.c +++ b/drivers/mailbox/mtk-adsp-mailbox.c @@ -116,7 +116,7 @@ static int mtk_adsp_mbox_probe(struct platform_device *pdev) struct mbox_controller *mbox; int ret, irq; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -127,7 +127,7 @@ static int mtk_adsp_mbox_probe(struct platform_device *pdev) mbox->txdone_poll = true; mbox->of_xlate = mtk_adsp_mbox_xlate; mbox->num_chans = 1; - mbox->chans = devm_kzalloc(dev, sizeof(*mbox->chans), GFP_KERNEL); + mbox->chans = devm_kzalloc_obj(dev, *mbox->chans); if (!mbox->chans) return -ENOMEM; diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c index e8244519da8b..405d2918d6cd 100644 --- a/drivers/mailbox/mtk-cmdq-mailbox.c +++ b/drivers/mailbox/mtk-cmdq-mailbox.c @@ -644,8 +644,8 @@ static int cmdq_get_clocks(struct device *dev, struct cmdq *cmdq) struct device_node *parent = dev->of_node->parent; struct clk_bulk_data *clks; - cmdq->clocks = devm_kcalloc(dev, cmdq->pdata->gce_num, - sizeof(*cmdq->clocks), GFP_KERNEL); + cmdq->clocks = devm_kzalloc_objs(dev, *cmdq->clocks, + cmdq->pdata->gce_num); if (!cmdq->clocks) return -ENOMEM; @@ -693,7 +693,7 @@ static int cmdq_probe(struct platform_device *pdev) struct cmdq *cmdq; int err, i; - cmdq = devm_kzalloc(dev, sizeof(*cmdq), GFP_KERNEL); + cmdq = devm_kzalloc_obj(dev, *cmdq); if (!cmdq) return -ENOMEM; @@ -724,8 +724,8 @@ static int cmdq_probe(struct platform_device *pdev) DMA_BIT_MASK(sizeof(u32) * BITS_PER_BYTE + cmdq->pdata->shift)); cmdq->mbox.dev = dev; - cmdq->mbox.chans = devm_kcalloc(dev, cmdq->pdata->thread_nr, - sizeof(*cmdq->mbox.chans), GFP_KERNEL); + cmdq->mbox.chans = devm_kzalloc_objs(dev, *cmdq->mbox.chans, + cmdq->pdata->thread_nr); if (!cmdq->mbox.chans) return -ENOMEM; @@ -737,8 +737,8 @@ static int cmdq_probe(struct platform_device *pdev) cmdq->mbox.txdone_irq = false; cmdq->mbox.txdone_poll = false; - cmdq->thread = devm_kcalloc(dev, cmdq->pdata->thread_nr, - sizeof(*cmdq->thread), GFP_KERNEL); + cmdq->thread = devm_kzalloc_objs(dev, *cmdq->thread, + cmdq->pdata->thread_nr); if (!cmdq->thread) return -ENOMEM; diff --git a/drivers/mailbox/mtk-gpueb-mailbox.c b/drivers/mailbox/mtk-gpueb-mailbox.c index f6d2beccd91b..cb5d830f760a 100644 --- a/drivers/mailbox/mtk-gpueb-mailbox.c +++ b/drivers/mailbox/mtk-gpueb-mailbox.c @@ -213,7 +213,7 @@ static int mtk_gpueb_mbox_probe(struct platform_device *pdev) struct mtk_gpueb_mbox *ebm; unsigned int i; - ebm = devm_kzalloc(&pdev->dev, sizeof(*ebm), GFP_KERNEL); + ebm = devm_kzalloc_obj(&pdev->dev, *ebm); if (!ebm) return -ENOMEM; @@ -240,13 +240,12 @@ static int mtk_gpueb_mbox_probe(struct platform_device *pdev) ebm->dev, PTR_ERR(ebm->mbox_ctl), "Couldn't map mailbox control registers\n"); - ebm->ch = devm_kmalloc_array(ebm->dev, ebm->v->num_channels, - sizeof(*ebm->ch), GFP_KERNEL); + ebm->ch = devm_kmalloc_objs(ebm->dev, *ebm->ch, ebm->v->num_channels); if (!ebm->ch) return -ENOMEM; - ebm->mbox.chans = devm_kcalloc(ebm->dev, ebm->v->num_channels, - sizeof(struct mbox_chan), GFP_KERNEL); + ebm->mbox.chans = devm_kzalloc_objs(ebm->dev, struct mbox_chan, + ebm->v->num_channels); if (!ebm->mbox.chans) return -ENOMEM; diff --git a/drivers/mailbox/mtk-vcp-mailbox.c b/drivers/mailbox/mtk-vcp-mailbox.c index 1b291b8ea15a..fa1f7117393b 100644 --- a/drivers/mailbox/mtk-vcp-mailbox.c +++ b/drivers/mailbox/mtk-vcp-mailbox.c @@ -102,7 +102,7 @@ static int mtk_vcp_mbox_probe(struct platform_device *pdev) struct mbox_controller *mbox; int ret, irq; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/mailbox/omap-mailbox.c b/drivers/mailbox/omap-mailbox.c index 535ca8020877..7a8e19f7e104 100644 --- a/drivers/mailbox/omap-mailbox.c +++ b/drivers/mailbox/omap-mailbox.c @@ -475,7 +475,7 @@ static int omap_mbox_probe(struct platform_device *pdev) return -ENODEV; } - mdev = devm_kzalloc(&pdev->dev, sizeof(*mdev), GFP_KERNEL); + mdev = devm_kzalloc_obj(&pdev->dev, *mdev); if (!mdev) return -ENOMEM; @@ -489,13 +489,11 @@ static int omap_mbox_probe(struct platform_device *pdev) if (IS_ERR(mdev->mbox_base)) return PTR_ERR(mdev->mbox_base); - mdev->irq_ctx = devm_kcalloc(&pdev->dev, num_users, sizeof(u32), - GFP_KERNEL); + mdev->irq_ctx = devm_kzalloc_objs(&pdev->dev, u32, num_users); if (!mdev->irq_ctx) return -ENOMEM; - chnls = devm_kcalloc(&pdev->dev, info_count + 1, sizeof(*chnls), - GFP_KERNEL); + chnls = devm_kzalloc_objs(&pdev->dev, *chnls, info_count + 1); if (!chnls) return -ENOMEM; @@ -504,7 +502,7 @@ static int omap_mbox_probe(struct platform_device *pdev) int tx_id, tx_irq, tx_usr; int rx_id, rx_usr; - mbox = devm_kzalloc(&pdev->dev, sizeof(*mbox), GFP_KERNEL); + mbox = devm_kzalloc_obj(&pdev->dev, *mbox); if (!mbox) return -ENOMEM; @@ -563,7 +561,7 @@ static int omap_mbox_probe(struct platform_device *pdev) mdev->num_fifos = num_fifos; mdev->intr_type = intr_type; - controller = devm_kzalloc(&pdev->dev, sizeof(*controller), GFP_KERNEL); + controller = devm_kzalloc_obj(&pdev->dev, *controller); if (!controller) return -ENOMEM; /* diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 14dc4a187bfc..cd51d8e9c665 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -828,20 +828,19 @@ static int pcc_mbox_probe(struct platform_device *pdev) if (ACPI_FAILURE(status) || !pcct_tbl) return -ENODEV; - pcc_mbox_channels = devm_kcalloc(dev, count, sizeof(*pcc_mbox_channels), - GFP_KERNEL); + pcc_mbox_channels = devm_kzalloc_objs(dev, *pcc_mbox_channels, count); if (!pcc_mbox_channels) { rc = -ENOMEM; goto err; } - chan_info = devm_kcalloc(dev, count, sizeof(*chan_info), GFP_KERNEL); + chan_info = devm_kzalloc_objs(dev, *chan_info, count); if (!chan_info) { rc = -ENOMEM; goto err; } - pcc_mbox_ctrl = devm_kzalloc(dev, sizeof(*pcc_mbox_ctrl), GFP_KERNEL); + pcc_mbox_ctrl = devm_kzalloc_obj(dev, *pcc_mbox_ctrl); if (!pcc_mbox_ctrl) { rc = -ENOMEM; goto err; diff --git a/drivers/mailbox/platform_mhu.c b/drivers/mailbox/platform_mhu.c index 176ce290b8a8..792d47a6186e 100644 --- a/drivers/mailbox/platform_mhu.c +++ b/drivers/mailbox/platform_mhu.c @@ -122,7 +122,7 @@ static int platform_mhu_probe(struct platform_device *pdev) }; /* Allocate memory for device */ - mhu = devm_kzalloc(dev, sizeof(*mhu), GFP_KERNEL); + mhu = devm_kzalloc_obj(dev, *mhu); if (!mhu) return -ENOMEM; diff --git a/drivers/mailbox/qcom-apcs-ipc-mailbox.c b/drivers/mailbox/qcom-apcs-ipc-mailbox.c index d3a8f6b4a03b..1a42b4712ba5 100644 --- a/drivers/mailbox/qcom-apcs-ipc-mailbox.c +++ b/drivers/mailbox/qcom-apcs-ipc-mailbox.c @@ -82,7 +82,7 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev) unsigned long i; int ret; - apcs = devm_kzalloc(&pdev->dev, sizeof(*apcs), GFP_KERNEL); + apcs = devm_kzalloc_obj(&pdev->dev, *apcs); if (!apcs) return -ENOMEM; diff --git a/drivers/mailbox/qcom-cpucp-mbox.c b/drivers/mailbox/qcom-cpucp-mbox.c index b88ea2527265..37228a57af53 100644 --- a/drivers/mailbox/qcom-cpucp-mbox.c +++ b/drivers/mailbox/qcom-cpucp-mbox.c @@ -148,11 +148,11 @@ static int qcom_cpucp_mbox_probe(struct platform_device *pdev) if (!data) return dev_err_probe(dev, -EINVAL, "No match data found\n"); - cpucp = devm_kzalloc(dev, sizeof(*cpucp), GFP_KERNEL); + cpucp = devm_kzalloc_obj(dev, *cpucp); if (!cpucp) return -ENOMEM; - cpucp->chans = devm_kcalloc(dev, data->num_chans, sizeof(*cpucp->chans), GFP_KERNEL); + cpucp->chans = devm_kzalloc_objs(dev, *cpucp->chans, data->num_chans); if (!cpucp->chans) return -ENOMEM; diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c index bb54295e03ce..d986d4500026 100644 --- a/drivers/mailbox/qcom-ipcc.c +++ b/drivers/mailbox/qcom-ipcc.c @@ -201,7 +201,7 @@ static struct mbox_chan *qcom_ipcc_mbox_xlate(struct mbox_controller *mbox, chan = free_chan; - mchan = devm_kzalloc(dev, sizeof(*mchan), GFP_KERNEL); + mchan = devm_kzalloc_obj(dev, *mchan); if (!mchan) return ERR_PTR(-ENOMEM); @@ -249,8 +249,7 @@ static int qcom_ipcc_setup_mbox(struct qcom_ipcc *ipcc, if (!ipcc->num_chans) return 0; - ipcc->chans = devm_kcalloc(dev, ipcc->num_chans, - sizeof(struct mbox_chan), GFP_KERNEL); + ipcc->chans = devm_kzalloc_objs(dev, struct mbox_chan, ipcc->num_chans); if (!ipcc->chans) return -ENOMEM; @@ -290,7 +289,7 @@ static int qcom_ipcc_probe(struct platform_device *pdev) u32 config_value; int ret; - ipcc = devm_kzalloc(&pdev->dev, sizeof(*ipcc), GFP_KERNEL); + ipcc = devm_kzalloc_obj(&pdev->dev, *ipcc); if (!ipcc) return -ENOMEM; diff --git a/drivers/mailbox/riscv-sbi-mpxy-mbox.c b/drivers/mailbox/riscv-sbi-mpxy-mbox.c index 4ebce35a8b6c..2134ceea1044 100644 --- a/drivers/mailbox/riscv-sbi-mpxy-mbox.c +++ b/drivers/mailbox/riscv-sbi-mpxy-mbox.c @@ -791,8 +791,8 @@ static int mpxy_mbox_populate_channels(struct mpxy_mbox *mbox) return dev_err_probe(mbox->dev, rc, "failed to get MPXY channel IDs\n"); /* Populate all channels */ - mbox->channels = devm_kcalloc(mbox->dev, mbox->channel_count, - sizeof(*mbox->channels), GFP_KERNEL); + mbox->channels = devm_kzalloc_objs(mbox->dev, *mbox->channels, + mbox->channel_count); if (!mbox->channels) return -ENOMEM; for (i = 0; i < mbox->channel_count; i++) { @@ -882,7 +882,7 @@ static int mpxy_mbox_probe(struct platform_device *pdev) mpxy_shmem_init_done = true; /* Allocate mailbox instance */ - mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); + mbox = devm_kzalloc_obj(dev, *mbox); if (!mbox) return -ENOMEM; mbox->dev = dev; @@ -900,9 +900,8 @@ static int mpxy_mbox_probe(struct platform_device *pdev) mbox->controller.dev = dev; mbox->controller.num_chans = mbox->channel_count; mbox->controller.fw_xlate = mpxy_mbox_fw_xlate; - mbox->controller.chans = devm_kcalloc(dev, mbox->channel_count, - sizeof(*mbox->controller.chans), - GFP_KERNEL); + mbox->controller.chans = devm_kzalloc_objs(dev, *mbox->controller.chans, + mbox->channel_count); if (!mbox->controller.chans) return -ENOMEM; for (i = 0; i < mbox->channel_count; i++) @@ -939,9 +938,9 @@ static int mpxy_mbox_probe(struct platform_device *pdev) return -EPROBE_DEFER; } - mbox->msi_index_to_channel = devm_kcalloc(dev, mbox->msi_count, - sizeof(*mbox->msi_index_to_channel), - GFP_KERNEL); + mbox->msi_index_to_channel = devm_kzalloc_objs(dev, + *mbox->msi_index_to_channel, + mbox->msi_count); if (!mbox->msi_index_to_channel) return -ENOMEM; diff --git a/drivers/mailbox/rockchip-mailbox.c b/drivers/mailbox/rockchip-mailbox.c index 790c34a22ec5..986f9dde5307 100644 --- a/drivers/mailbox/rockchip-mailbox.c +++ b/drivers/mailbox/rockchip-mailbox.c @@ -165,14 +165,13 @@ static int rockchip_mbox_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - mb = devm_kzalloc(&pdev->dev, - struct_size(mb, chans, ROCKCHIP_MAILBOX_NUM_CHANS), - GFP_KERNEL); + mb = devm_kzalloc_flex(&pdev->dev, *mb, chans, + ROCKCHIP_MAILBOX_NUM_CHANS); if (!mb) return -ENOMEM; - mb->mbox.chans = devm_kcalloc(&pdev->dev, ROCKCHIP_MAILBOX_NUM_CHANS, - sizeof(*mb->mbox.chans), GFP_KERNEL); + mb->mbox.chans = devm_kzalloc_objs(&pdev->dev, *mb->mbox.chans, + ROCKCHIP_MAILBOX_NUM_CHANS); if (!mb->mbox.chans) return -ENOMEM; diff --git a/drivers/mailbox/sprd-mailbox.c b/drivers/mailbox/sprd-mailbox.c index 9013d2ece55f..95028472ae88 100644 --- a/drivers/mailbox/sprd-mailbox.c +++ b/drivers/mailbox/sprd-mailbox.c @@ -335,7 +335,7 @@ static int sprd_mbox_probe(struct platform_device *pdev) unsigned long id; struct clk *clk; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c index c6134de1a93b..e88e198436a6 100644 --- a/drivers/mailbox/stm32-ipcc.c +++ b/drivers/mailbox/stm32-ipcc.c @@ -217,7 +217,7 @@ static int stm32_ipcc_probe(struct platform_device *pdev) return -ENODEV; } - ipcc = devm_kzalloc(dev, sizeof(*ipcc), GFP_KERNEL); + ipcc = devm_kzalloc_obj(dev, *ipcc); if (!ipcc) return -ENOMEM; @@ -292,9 +292,8 @@ static int stm32_ipcc_probe(struct platform_device *pdev) ipcc->controller.txdone_irq = true; ipcc->controller.ops = &stm32_ipcc_ops; ipcc->controller.num_chans = ipcc->n_chans; - ipcc->controller.chans = devm_kcalloc(dev, ipcc->controller.num_chans, - sizeof(*ipcc->controller.chans), - GFP_KERNEL); + ipcc->controller.chans = devm_kzalloc_objs(dev, *ipcc->controller.chans, + ipcc->controller.num_chans); if (!ipcc->controller.chans) { ret = -ENOMEM; goto err_irq_wkp; diff --git a/drivers/mailbox/sun6i-msgbox.c b/drivers/mailbox/sun6i-msgbox.c index 1cbc4d478beb..15d9efea11e7 100644 --- a/drivers/mailbox/sun6i-msgbox.c +++ b/drivers/mailbox/sun6i-msgbox.c @@ -200,11 +200,11 @@ static int sun6i_msgbox_probe(struct platform_device *pdev) struct sun6i_msgbox *mbox; int i, ret; - mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); + mbox = devm_kzalloc_obj(dev, *mbox); if (!mbox) return -ENOMEM; - chans = devm_kcalloc(dev, NUM_CHANS, sizeof(*chans), GFP_KERNEL); + chans = devm_kzalloc_objs(dev, *chans, NUM_CHANS); if (!chans) return -ENOMEM; diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c index 03ee73aad488..1f6215c7e498 100644 --- a/drivers/mailbox/tegra-hsp.c +++ b/drivers/mailbox/tegra-hsp.c @@ -280,7 +280,7 @@ tegra_hsp_doorbell_create(struct tegra_hsp *hsp, const char *name, unsigned int offset; unsigned long flags; - db = devm_kzalloc(hsp->dev, sizeof(*db), GFP_KERNEL); + db = devm_kzalloc_obj(hsp->dev, *db); if (!db) return ERR_PTR(-ENOMEM); @@ -677,8 +677,7 @@ static int tegra_hsp_add_mailboxes(struct tegra_hsp *hsp, struct device *dev) { int i; - hsp->mailboxes = devm_kcalloc(dev, hsp->num_sm, sizeof(*hsp->mailboxes), - GFP_KERNEL); + hsp->mailboxes = devm_kzalloc_objs(dev, *hsp->mailboxes, hsp->num_sm); if (!hsp->mailboxes) return -ENOMEM; @@ -736,7 +735,7 @@ static int tegra_hsp_probe(struct platform_device *pdev) u32 value; int err; - hsp = devm_kzalloc(&pdev->dev, sizeof(*hsp), GFP_KERNEL); + hsp = devm_kzalloc_obj(&pdev->dev, *hsp); if (!hsp) return -ENOMEM; @@ -763,9 +762,9 @@ static int tegra_hsp_probe(struct platform_device *pdev) if (hsp->num_si > 0) { unsigned int count = 0; - hsp->shared_irqs = devm_kcalloc(&pdev->dev, hsp->num_si, - sizeof(*hsp->shared_irqs), - GFP_KERNEL); + hsp->shared_irqs = devm_kzalloc_objs(&pdev->dev, + *hsp->shared_irqs, + hsp->num_si); if (!hsp->shared_irqs) return -ENOMEM; @@ -797,9 +796,8 @@ static int tegra_hsp_probe(struct platform_device *pdev) hsp->mbox_db.dev = &pdev->dev; hsp->mbox_db.ops = &tegra_hsp_db_ops; - hsp->mbox_db.chans = devm_kcalloc(&pdev->dev, hsp->mbox_db.num_chans, - sizeof(*hsp->mbox_db.chans), - GFP_KERNEL); + hsp->mbox_db.chans = devm_kzalloc_objs(&pdev->dev, *hsp->mbox_db.chans, + hsp->mbox_db.num_chans); if (!hsp->mbox_db.chans) return -ENOMEM; @@ -825,9 +823,8 @@ static int tegra_hsp_probe(struct platform_device *pdev) hsp->mbox_sm.dev = &pdev->dev; hsp->mbox_sm.ops = &tegra_hsp_sm_ops; - hsp->mbox_sm.chans = devm_kcalloc(&pdev->dev, hsp->mbox_sm.num_chans, - sizeof(*hsp->mbox_sm.chans), - GFP_KERNEL); + hsp->mbox_sm.chans = devm_kzalloc_objs(&pdev->dev, *hsp->mbox_sm.chans, + hsp->mbox_sm.num_chans); if (!hsp->mbox_sm.chans) return -ENOMEM; diff --git a/drivers/mailbox/ti-msgmgr.c b/drivers/mailbox/ti-msgmgr.c index 2079996092f5..7bca2aa049b1 100644 --- a/drivers/mailbox/ti-msgmgr.c +++ b/drivers/mailbox/ti-msgmgr.c @@ -864,7 +864,7 @@ static int ti_msgmgr_probe(struct platform_device *pdev) } np = dev->of_node; - inst = devm_kzalloc(dev, sizeof(*inst), GFP_KERNEL); + inst = devm_kzalloc_obj(dev, *inst); if (!inst) return -ENOMEM; @@ -899,12 +899,12 @@ static int ti_msgmgr_probe(struct platform_device *pdev) } inst->num_valid_queues = queue_count; - qinst = devm_kcalloc(dev, queue_count, sizeof(*qinst), GFP_KERNEL); + qinst = devm_kzalloc_objs(dev, *qinst, queue_count); if (!qinst) return -ENOMEM; inst->qinsts = qinst; - chans = devm_kcalloc(dev, queue_count, sizeof(*chans), GFP_KERNEL); + chans = devm_kzalloc_objs(dev, *chans, queue_count); if (!chans) return -ENOMEM; inst->chans = chans; diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c index 42d2583e44ca..2b81bedf0653 100644 --- a/drivers/mailbox/zynqmp-ipi-mailbox.c +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c @@ -917,8 +917,7 @@ static int zynqmp_ipi_probe(struct platform_device *pdev) return -EINVAL; } - pdata = devm_kzalloc(dev, struct_size(pdata, ipi_mboxes, num_mboxes), - GFP_KERNEL); + pdata = devm_kzalloc_flex(dev, *pdata, ipi_mboxes, num_mboxes); if (!pdata) return -ENOMEM; pdata->dev = dev; diff --git a/drivers/mcb/mcb-lpc.c b/drivers/mcb/mcb-lpc.c index 070aa787abc6..cf9a31e7d215 100644 --- a/drivers/mcb/mcb-lpc.c +++ b/drivers/mcb/mcb-lpc.c @@ -25,7 +25,7 @@ static int mcb_lpc_probe(struct platform_device *pdev) struct priv *priv; int ret = 0, table_size; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/mcb/mcb-pci.c b/drivers/mcb/mcb-pci.c index f1353da6ef4f..adb91878e434 100644 --- a/drivers/mcb/mcb-pci.c +++ b/drivers/mcb/mcb-pci.c @@ -34,7 +34,7 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) int ret, table_size; unsigned long flags; - priv = devm_kzalloc(&pdev->dev, sizeof(struct priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/cec/i2c/ch7322.c b/drivers/media/cec/i2c/ch7322.c index b8755337b394..172f2060e1f6 100644 --- a/drivers/media/cec/i2c/ch7322.c +++ b/drivers/media/cec/i2c/ch7322.c @@ -461,7 +461,7 @@ static int ch7322_probe(struct i2c_client *client) if (hdmi_dev) caps |= CEC_CAP_CONNECTOR_INFO; - ch7322 = devm_kzalloc(&client->dev, sizeof(*ch7322), GFP_KERNEL); + ch7322 = devm_kzalloc_obj(&client->dev, *ch7322); if (!ch7322) return -ENOMEM; diff --git a/drivers/media/cec/i2c/tda9950.c b/drivers/media/cec/i2c/tda9950.c index 2bece4e63687..572f7eea818c 100644 --- a/drivers/media/cec/i2c/tda9950.c +++ b/drivers/media/cec/i2c/tda9950.c @@ -400,7 +400,7 @@ static int tda9950_probe(struct i2c_client *client) return -ENXIO; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/cec/platform/cec-gpio/cec-gpio.c b/drivers/media/cec/platform/cec-gpio/cec-gpio.c index 842555ed42c7..f603cec4a386 100644 --- a/drivers/media/cec/platform/cec-gpio/cec-gpio.c +++ b/drivers/media/cec/platform/cec-gpio/cec-gpio.c @@ -187,7 +187,7 @@ static int cec_gpio_probe(struct platform_device *pdev) if (IS_ERR(hdmi_dev)) caps |= CEC_CAP_PHYS_ADDR; - cec = devm_kzalloc(dev, sizeof(*cec), GFP_KERNEL); + cec = devm_kzalloc_obj(dev, *cec); if (!cec) return -ENOMEM; diff --git a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c index 1fe9c537671d..aa517950c014 100644 --- a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c +++ b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c @@ -452,7 +452,7 @@ static int cros_ec_cec_init_port(struct device *dev, struct cros_ec_cec_port *port; int ret; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; @@ -507,8 +507,7 @@ static int cros_ec_cec_probe(struct platform_device *pdev) if (IS_ERR(hdmi_dev)) return PTR_ERR(hdmi_dev); - cros_ec_cec = devm_kzalloc(&pdev->dev, sizeof(*cros_ec_cec), - GFP_KERNEL); + cros_ec_cec = devm_kzalloc_obj(&pdev->dev, *cros_ec_cec); if (!cros_ec_cec) return -ENOMEM; diff --git a/drivers/media/cec/platform/meson/ao-cec-g12a.c b/drivers/media/cec/platform/meson/ao-cec-g12a.c index 55bd0d416460..e5e1b00a0409 100644 --- a/drivers/media/cec/platform/meson/ao-cec-g12a.c +++ b/drivers/media/cec/platform/meson/ao-cec-g12a.c @@ -339,7 +339,7 @@ static int meson_ao_cec_g12a_setup_clk(struct meson_ao_cec_g12a_device *ao_cec) struct clk *clk; char *name; - dualdiv_clk = devm_kzalloc(dev, sizeof(*dualdiv_clk), GFP_KERNEL); + dualdiv_clk = devm_kzalloc_obj(dev, *dualdiv_clk); if (!dualdiv_clk) return -ENOMEM; @@ -641,7 +641,7 @@ static int meson_ao_cec_g12a_probe(struct platform_device *pdev) if (IS_ERR(hdmi_dev)) return PTR_ERR(hdmi_dev); - ao_cec = devm_kzalloc(&pdev->dev, sizeof(*ao_cec), GFP_KERNEL); + ao_cec = devm_kzalloc_obj(&pdev->dev, *ao_cec); if (!ao_cec) return -ENOMEM; diff --git a/drivers/media/cec/platform/meson/ao-cec.c b/drivers/media/cec/platform/meson/ao-cec.c index 2df0d3743077..f5203b2a4976 100644 --- a/drivers/media/cec/platform/meson/ao-cec.c +++ b/drivers/media/cec/platform/meson/ao-cec.c @@ -609,7 +609,7 @@ static int meson_ao_cec_probe(struct platform_device *pdev) if (IS_ERR(hdmi_dev)) return PTR_ERR(hdmi_dev); - ao_cec = devm_kzalloc(&pdev->dev, sizeof(*ao_cec), GFP_KERNEL); + ao_cec = devm_kzalloc_obj(&pdev->dev, *ao_cec); if (!ao_cec) return -ENOMEM; diff --git a/drivers/media/cec/platform/s5p/s5p_cec.c b/drivers/media/cec/platform/s5p/s5p_cec.c index 4a92d3230f66..65e2d9a90434 100644 --- a/drivers/media/cec/platform/s5p/s5p_cec.c +++ b/drivers/media/cec/platform/s5p/s5p_cec.c @@ -189,7 +189,7 @@ static int s5p_cec_probe(struct platform_device *pdev) if (IS_ERR(hdmi_dev)) return PTR_ERR(hdmi_dev); - cec = devm_kzalloc(&pdev->dev, sizeof(*cec), GFP_KERNEL); + cec = devm_kzalloc_obj(&pdev->dev, *cec); if (!cec) return -ENOMEM; diff --git a/drivers/media/cec/platform/seco/seco-cec.c b/drivers/media/cec/platform/seco/seco-cec.c index 12db6dca602b..48823626ae75 100644 --- a/drivers/media/cec/platform/seco/seco-cec.c +++ b/drivers/media/cec/platform/seco/seco-cec.c @@ -570,7 +570,7 @@ static int secocec_probe(struct platform_device *pdev) if (IS_ERR(hdmi_dev)) return PTR_ERR(hdmi_dev); - secocec = devm_kzalloc(dev, sizeof(*secocec), GFP_KERNEL); + secocec = devm_kzalloc_obj(dev, *secocec); if (!secocec) return -ENOMEM; diff --git a/drivers/media/cec/platform/sti/stih-cec.c b/drivers/media/cec/platform/sti/stih-cec.c index 49843d576c7c..6303ed34b303 100644 --- a/drivers/media/cec/platform/sti/stih-cec.c +++ b/drivers/media/cec/platform/sti/stih-cec.c @@ -309,7 +309,7 @@ static int stih_cec_probe(struct platform_device *pdev) if (IS_ERR(hdmi_dev)) return PTR_ERR(hdmi_dev); - cec = devm_kzalloc(dev, sizeof(*cec), GFP_KERNEL); + cec = devm_kzalloc_obj(dev, *cec); if (!cec) return -ENOMEM; diff --git a/drivers/media/cec/platform/stm32/stm32-cec.c b/drivers/media/cec/platform/stm32/stm32-cec.c index 29418966a98e..b20d0aca3d86 100644 --- a/drivers/media/cec/platform/stm32/stm32-cec.c +++ b/drivers/media/cec/platform/stm32/stm32-cec.c @@ -264,7 +264,7 @@ static int stm32_cec_probe(struct platform_device *pdev) void __iomem *mmio; int ret; - cec = devm_kzalloc(&pdev->dev, sizeof(*cec), GFP_KERNEL); + cec = devm_kzalloc_obj(&pdev->dev, *cec); if (!cec) return -ENOMEM; diff --git a/drivers/media/cec/platform/tegra/tegra_cec.c b/drivers/media/cec/platform/tegra/tegra_cec.c index d64e1662249e..cd0f38c88cb4 100644 --- a/drivers/media/cec/platform/tegra/tegra_cec.c +++ b/drivers/media/cec/platform/tegra/tegra_cec.c @@ -356,7 +356,7 @@ static int tegra_cec_probe(struct platform_device *pdev) if (IS_ERR(hdmi_dev)) return PTR_ERR(hdmi_dev); - cec = devm_kzalloc(&pdev->dev, sizeof(struct tegra_cec), GFP_KERNEL); + cec = devm_kzalloc_obj(&pdev->dev, struct tegra_cec); if (!cec) return -ENOMEM; diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/helene.c index 5fbb466cc8af..6aa04ba5c988 100644 --- a/drivers/media/dvb-frontends/helene.c +++ b/drivers/media/dvb-frontends/helene.c @@ -1070,7 +1070,7 @@ static int helene_probe(struct i2c_client *client) struct device *dev = &client->dev; struct helene_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/dvb-frontends/mn88443x.c b/drivers/media/dvb-frontends/mn88443x.c index cc6bd17daf73..b8fa4b9cc889 100644 --- a/drivers/media/dvb-frontends/mn88443x.c +++ b/drivers/media/dvb-frontends/mn88443x.c @@ -681,7 +681,7 @@ static int mn88443x_probe(struct i2c_client *client) struct device *dev = &client->dev; int ret; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c index fcce2857b69e..e5a5b3d33dfd 100644 --- a/drivers/media/i2c/ad5820.c +++ b/drivers/media/i2c/ad5820.c @@ -295,7 +295,7 @@ static int ad5820_probe(struct i2c_client *client) struct ad5820_device *coil; int ret; - coil = devm_kzalloc(&client->dev, sizeof(*coil), GFP_KERNEL); + coil = devm_kzalloc_obj(&client->dev, *coil); if (!coil) return -ENOMEM; diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c index 177a6e8d7fb8..91e119e0c48f 100644 --- a/drivers/media/i2c/adp1653.c +++ b/drivers/media/i2c/adp1653.c @@ -414,7 +414,7 @@ static int adp1653_of_init(struct i2c_client *client, struct device_node *node_indicator = NULL; struct device_node *node_flash; - pd = devm_kzalloc(&client->dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(&client->dev, *pd); if (!pd) return -ENOMEM; flash->platform_data = pd; @@ -470,7 +470,7 @@ static int adp1653_probe(struct i2c_client *client) struct adp1653_flash *flash; int ret; - flash = devm_kzalloc(&client->dev, sizeof(*flash), GFP_KERNEL); + flash = devm_kzalloc_obj(&client->dev, *flash); if (flash == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/adv7170.c b/drivers/media/i2c/adv7170.c index 9a7edd6583c1..9cd9c2d8ca2d 100644 --- a/drivers/media/i2c/adv7170.c +++ b/drivers/media/i2c/adv7170.c @@ -348,7 +348,7 @@ static int adv7170_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - encoder = devm_kzalloc(&client->dev, sizeof(*encoder), GFP_KERNEL); + encoder = devm_kzalloc_obj(&client->dev, *encoder); if (encoder == NULL) return -ENOMEM; sd = &encoder->sd; diff --git a/drivers/media/i2c/adv7175.c b/drivers/media/i2c/adv7175.c index b77737e23a47..bd52602e1190 100644 --- a/drivers/media/i2c/adv7175.c +++ b/drivers/media/i2c/adv7175.c @@ -403,7 +403,7 @@ static int adv7175_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - encoder = devm_kzalloc(&client->dev, sizeof(*encoder), GFP_KERNEL); + encoder = devm_kzalloc_obj(&client->dev, *encoder); if (encoder == NULL) return -ENOMEM; sd = &encoder->sd; diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index 02197f813758..9f460d41211c 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -1451,7 +1451,7 @@ static int adv7180_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (state == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/adv7183.c b/drivers/media/i2c/adv7183.c index 9e4cbebe6e5a..d5acc5125726 100644 --- a/drivers/media/i2c/adv7183.c +++ b/drivers/media/i2c/adv7183.c @@ -537,7 +537,7 @@ static int adv7183_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%02x (%s)\n", client->addr << 1, client->adapter->name); - decoder = devm_kzalloc(&client->dev, sizeof(*decoder), GFP_KERNEL); + decoder = devm_kzalloc_obj(&client->dev, *decoder); if (decoder == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c index 2bf17cd633c7..8511505d0fba 100644 --- a/drivers/media/i2c/adv7343.c +++ b/drivers/media/i2c/adv7343.c @@ -399,7 +399,7 @@ adv7343_get_pdata(struct i2c_client *client) if (!np) return NULL; - pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&client->dev, *pdata); if (!pdata) goto done; @@ -431,8 +431,7 @@ static int adv7343_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - state = devm_kzalloc(&client->dev, sizeof(struct adv7343_state), - GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, struct adv7343_state); if (state == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/adv7393.c b/drivers/media/i2c/adv7393.c index b00783c141a9..38defbb0d210 100644 --- a/drivers/media/i2c/adv7393.c +++ b/drivers/media/i2c/adv7393.c @@ -384,7 +384,7 @@ static int adv7393_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (state == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c index 70594d001804..a21abfb9ffc1 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c @@ -715,7 +715,7 @@ static int adv748x_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/media/i2c/adv7511-v4l2.c b/drivers/media/i2c/adv7511-v4l2.c index 27e0e2c31dbd..3333c861e87b 100644 --- a/drivers/media/i2c/adv7511-v4l2.c +++ b/drivers/media/i2c/adv7511-v4l2.c @@ -1837,7 +1837,7 @@ static int adv7511_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - state = devm_kzalloc(&client->dev, sizeof(struct adv7511_state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, struct adv7511_state); if (!state) return -ENOMEM; diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 2de743d8ca21..6002967d8ab0 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -3491,7 +3491,7 @@ static int adv76xx_probe(struct i2c_client *client) v4l_dbg(1, debug, client, "detecting adv76xx client on address 0x%x\n", client->addr << 1); - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c index df6601d6d2b6..7d1bb6a6918a 100644 --- a/drivers/media/i2c/adv7842.c +++ b/drivers/media/i2c/adv7842.c @@ -3538,7 +3538,7 @@ static int adv7842_probe(struct i2c_client *client) return -ENODEV; } - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/media/i2c/ak7375.c b/drivers/media/i2c/ak7375.c index 9a2432cea3ff..1ece5708b4b2 100644 --- a/drivers/media/i2c/ak7375.c +++ b/drivers/media/i2c/ak7375.c @@ -181,8 +181,7 @@ static int ak7375_probe(struct i2c_client *client) int ret; unsigned int i; - ak7375_dev = devm_kzalloc(&client->dev, sizeof(*ak7375_dev), - GFP_KERNEL); + ak7375_dev = devm_kzalloc_obj(&client->dev, *ak7375_dev); if (!ak7375_dev) return -ENOMEM; diff --git a/drivers/media/i2c/ak881x.c b/drivers/media/i2c/ak881x.c index 3449d95ee8a0..47cf2e2e7b12 100644 --- a/drivers/media/i2c/ak881x.c +++ b/drivers/media/i2c/ak881x.c @@ -238,7 +238,7 @@ static int ak881x_probe(struct i2c_client *client) return -EIO; } - ak881x = devm_kzalloc(&client->dev, sizeof(*ak881x), GFP_KERNEL); + ak881x = devm_kzalloc_obj(&client->dev, *ak881x); if (!ak881x) return -ENOMEM; diff --git a/drivers/media/i2c/alvium-csi2.c b/drivers/media/i2c/alvium-csi2.c index d9a73565457f..1fc8c5e8c86b 100644 --- a/drivers/media/i2c/alvium-csi2.c +++ b/drivers/media/i2c/alvium-csi2.c @@ -2428,7 +2428,7 @@ static int alvium_probe(struct i2c_client *client) struct alvium_dev *alvium; int ret; - alvium = devm_kzalloc(dev, sizeof(*alvium), GFP_KERNEL); + alvium = devm_kzalloc_obj(dev, *alvium); if (!alvium) return -ENOMEM; diff --git a/drivers/media/i2c/ar0521.c b/drivers/media/i2c/ar0521.c index 3ddbf10ef8a4..732a9a2589fe 100644 --- a/drivers/media/i2c/ar0521.c +++ b/drivers/media/i2c/ar0521.c @@ -1039,7 +1039,7 @@ static int ar0521_probe(struct i2c_client *client) unsigned int cnt; int ret; - sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/bt819.c b/drivers/media/i2c/bt819.c index da44100062fa..faccae316639 100644 --- a/drivers/media/i2c/bt819.c +++ b/drivers/media/i2c/bt819.c @@ -391,7 +391,7 @@ static int bt819_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; - decoder = devm_kzalloc(&client->dev, sizeof(*decoder), GFP_KERNEL); + decoder = devm_kzalloc_obj(&client->dev, *decoder); if (decoder == NULL) return -ENOMEM; sd = &decoder->sd; diff --git a/drivers/media/i2c/bt856.c b/drivers/media/i2c/bt856.c index 656719158bb4..81c801065a29 100644 --- a/drivers/media/i2c/bt856.c +++ b/drivers/media/i2c/bt856.c @@ -193,7 +193,7 @@ static int bt856_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - encoder = devm_kzalloc(&client->dev, sizeof(*encoder), GFP_KERNEL); + encoder = devm_kzalloc_obj(&client->dev, *encoder); if (encoder == NULL) return -ENOMEM; sd = &encoder->sd; diff --git a/drivers/media/i2c/bt866.c b/drivers/media/i2c/bt866.c index f5104c7d9f90..3bc2c2989115 100644 --- a/drivers/media/i2c/bt866.c +++ b/drivers/media/i2c/bt866.c @@ -181,7 +181,7 @@ static int bt866_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - encoder = devm_kzalloc(&client->dev, sizeof(*encoder), GFP_KERNEL); + encoder = devm_kzalloc_obj(&client->dev, *encoder); if (encoder == NULL) return -ENOMEM; sd = &encoder->sd; diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c index 1cc4350856fd..c3592317ee57 100644 --- a/drivers/media/i2c/ccs/ccs-core.c +++ b/drivers/media/i2c/ccs/ccs-core.c @@ -1228,10 +1228,9 @@ static int ccs_get_mbus_formats(struct ccs_sensor *sensor) compressed_max_bpp); } - sensor->valid_link_freqs = devm_kcalloc( - &client->dev, - compressed_max_bpp - sensor->compressed_min_bpp + 1, - sizeof(*sensor->valid_link_freqs), GFP_KERNEL); + sensor->valid_link_freqs = devm_kzalloc_objs(&client->dev, + *sensor->valid_link_freqs, + compressed_max_bpp - sensor->compressed_min_bpp + 1); if (!sensor->valid_link_freqs) return -ENOMEM; @@ -3203,9 +3202,8 @@ static int ccs_get_hwconfig(struct ccs_sensor *sensor, struct device *dev) } hwcfg->op_sys_clock = - devm_kcalloc(dev, - bus_cfg.nr_of_link_frequencies + 1 /* guardian */, - sizeof(*hwcfg->op_sys_clock), GFP_KERNEL); + devm_kzalloc_objs(dev, *hwcfg->op_sys_clock, + bus_cfg.nr_of_link_frequencies + 1)/* guardian */; if (!hwcfg->op_sys_clock) { rval = -ENOMEM; goto out_err; @@ -3275,7 +3273,7 @@ static int ccs_probe(struct i2c_client *client) unsigned int i; int rval; - sensor = devm_kzalloc(&client->dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(&client->dev, *sensor); if (sensor == NULL) return -ENOMEM; @@ -3288,10 +3286,9 @@ static int ccs_probe(struct i2c_client *client) v4l2_i2c_subdev_init(&sensor->src->sd, client, &ccs_ops); sensor->src->sd.internal_ops = &ccs_internal_src_ops; - sensor->regulators = devm_kcalloc(&client->dev, - ARRAY_SIZE(ccs_regulators), - sizeof(*sensor->regulators), - GFP_KERNEL); + sensor->regulators = devm_kzalloc_objs(&client->dev, + *sensor->regulators, + ARRAY_SIZE(ccs_regulators)); if (!sensor->regulators) return -ENOMEM; diff --git a/drivers/media/i2c/cs5345.c b/drivers/media/i2c/cs5345.c index 49b8020fbea2..a9ce12f11c33 100644 --- a/drivers/media/i2c/cs5345.c +++ b/drivers/media/i2c/cs5345.c @@ -148,7 +148,7 @@ static int cs5345_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (state == NULL) return -ENOMEM; sd = &state->sd; diff --git a/drivers/media/i2c/cs53l32a.c b/drivers/media/i2c/cs53l32a.c index a894dcf6b5a9..01ea9dda6988 100644 --- a/drivers/media/i2c/cs53l32a.c +++ b/drivers/media/i2c/cs53l32a.c @@ -145,7 +145,7 @@ static int cs53l32a_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (state == NULL) return -ENOMEM; sd = &state->sd; diff --git a/drivers/media/i2c/cvs/core.c b/drivers/media/i2c/cvs/core.c index d9c51e1c0fb5..f909a3c03316 100644 --- a/drivers/media/i2c/cvs/core.c +++ b/drivers/media/i2c/cvs/core.c @@ -683,7 +683,7 @@ static int cvs_core_probe(struct device *dev, struct i2c_client *i2c) goto err_put_ipu; } - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) { ret = -ENOMEM; goto err_put_ipu; diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c index e90d71fe9959..7066b2252afd 100644 --- a/drivers/media/i2c/cx25840/cx25840-core.c +++ b/drivers/media/i2c/cx25840/cx25840-core.c @@ -3825,7 +3825,7 @@ static int cx25840_probe(struct i2c_client *client) return -ENODEV; } - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/media/i2c/cx25840/cx25840-ir.c b/drivers/media/i2c/cx25840/cx25840-ir.c index 8cef9656c612..ed629989495b 100644 --- a/drivers/media/i2c/cx25840/cx25840-ir.c +++ b/drivers/media/i2c/cx25840/cx25840-ir.c @@ -1193,7 +1193,7 @@ int cx25840_ir_probe(struct v4l2_subdev *sd) if (!(is_cx23885(state) || is_cx23887(state))) return 0; - ir_state = devm_kzalloc(&state->c->dev, sizeof(*ir_state), GFP_KERNEL); + ir_state = devm_kzalloc_obj(&state->c->dev, *ir_state); if (ir_state == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/ds90ub913.c b/drivers/media/i2c/ds90ub913.c index ca0b07d7109b..e1db008e2977 100644 --- a/drivers/media/i2c/ds90ub913.c +++ b/drivers/media/i2c/ds90ub913.c @@ -798,7 +798,7 @@ static int ub913_probe(struct i2c_client *client) struct ub913_data *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c index e6ae9cadefa2..d207f916375f 100644 --- a/drivers/media/i2c/ds90ub953.c +++ b/drivers/media/i2c/ds90ub953.c @@ -1249,7 +1249,7 @@ static int ub953_probe(struct i2c_client *client) struct ub953_data *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index 7d7ba6d349fc..16234f30da22 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -5135,7 +5135,7 @@ static int ub960_probe(struct i2c_client *client) struct ub960_data *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c index 1d686b1d2fd7..ee99835e45e9 100644 --- a/drivers/media/i2c/dw9714.c +++ b/drivers/media/i2c/dw9714.c @@ -166,8 +166,7 @@ static int dw9714_probe(struct i2c_client *client) struct dw9714_device *dw9714_dev; int rval; - dw9714_dev = devm_kzalloc(&client->dev, sizeof(*dw9714_dev), - GFP_KERNEL); + dw9714_dev = devm_kzalloc_obj(&client->dev, *dw9714_dev); if (!dw9714_dev) return -ENOMEM; diff --git a/drivers/media/i2c/dw9719.c b/drivers/media/i2c/dw9719.c index 3b7ba88fd67c..5d5da0439dba 100644 --- a/drivers/media/i2c/dw9719.c +++ b/drivers/media/i2c/dw9719.c @@ -355,7 +355,7 @@ static int dw9719_probe(struct i2c_client *client) struct dw9719_device *dw9719; int ret; - dw9719 = devm_kzalloc(&client->dev, sizeof(*dw9719), GFP_KERNEL); + dw9719 = devm_kzalloc_obj(&client->dev, *dw9719); if (!dw9719) return -ENOMEM; diff --git a/drivers/media/i2c/dw9768.c b/drivers/media/i2c/dw9768.c index d037d3009c9a..f31e0e832269 100644 --- a/drivers/media/i2c/dw9768.c +++ b/drivers/media/i2c/dw9768.c @@ -413,7 +413,7 @@ static int dw9768_probe(struct i2c_client *client) unsigned int i; int ret; - dw9768 = devm_kzalloc(dev, sizeof(*dw9768), GFP_KERNEL); + dw9768 = devm_kzalloc_obj(dev, *dw9768); if (!dw9768) return -ENOMEM; diff --git a/drivers/media/i2c/dw9807-vcm.c b/drivers/media/i2c/dw9807-vcm.c index 4148009e0e01..d119d7100e2e 100644 --- a/drivers/media/i2c/dw9807-vcm.c +++ b/drivers/media/i2c/dw9807-vcm.c @@ -180,8 +180,7 @@ static int dw9807_probe(struct i2c_client *client) struct dw9807_device *dw9807_dev; int rval; - dw9807_dev = devm_kzalloc(&client->dev, sizeof(*dw9807_dev), - GFP_KERNEL); + dw9807_dev = devm_kzalloc_obj(&client->dev, *dw9807_dev); if (dw9807_dev == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/et8ek8/et8ek8_driver.c b/drivers/media/i2c/et8ek8/et8ek8_driver.c index e8a7b7d87bb1..0c734144b85b 100644 --- a/drivers/media/i2c/et8ek8/et8ek8_driver.c +++ b/drivers/media/i2c/et8ek8/et8ek8_driver.c @@ -1407,7 +1407,7 @@ static int et8ek8_probe(struct i2c_client *client) struct device *dev = &client->dev; int ret; - sensor = devm_kzalloc(&client->dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(&client->dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/gc0308.c b/drivers/media/i2c/gc0308.c index 893dfe2e1c3e..ff384031a5d0 100644 --- a/drivers/media/i2c/gc0308.c +++ b/drivers/media/i2c/gc0308.c @@ -1288,7 +1288,7 @@ static int gc0308_probe(struct i2c_client *client) u64 regval; int ret; - gc0308 = devm_kzalloc(dev, sizeof(*gc0308), GFP_KERNEL); + gc0308 = devm_kzalloc_obj(dev, *gc0308); if (!gc0308) return -ENOMEM; diff --git a/drivers/media/i2c/gc0310.c b/drivers/media/i2c/gc0310.c index 5e941291dbf7..ca15d3375442 100644 --- a/drivers/media/i2c/gc0310.c +++ b/drivers/media/i2c/gc0310.c @@ -679,7 +679,7 @@ static int gc0310_probe(struct i2c_client *client) if (ret) return ret; - sensor = devm_kzalloc(&client->dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(&client->dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/gc05a2.c b/drivers/media/i2c/gc05a2.c index 5b95d8881649..1da46273e1cb 100644 --- a/drivers/media/i2c/gc05a2.c +++ b/drivers/media/i2c/gc05a2.c @@ -1221,7 +1221,7 @@ static int gc05a2_probe(struct i2c_client *client) struct gc05a2 *gc05a2; int ret; - gc05a2 = devm_kzalloc(dev, sizeof(*gc05a2), GFP_KERNEL); + gc05a2 = devm_kzalloc_obj(dev, *gc05a2); if (!gc05a2) return -ENOMEM; diff --git a/drivers/media/i2c/gc08a3.c b/drivers/media/i2c/gc08a3.c index c1ae05ed1f2a..9275ced8d6a8 100644 --- a/drivers/media/i2c/gc08a3.c +++ b/drivers/media/i2c/gc08a3.c @@ -1185,7 +1185,7 @@ static int gc08a3_probe(struct i2c_client *client) struct gc08a3 *gc08a3; int ret; - gc08a3 = devm_kzalloc(dev, sizeof(*gc08a3), GFP_KERNEL); + gc08a3 = devm_kzalloc_obj(dev, *gc08a3); if (!gc08a3) return -ENOMEM; diff --git a/drivers/media/i2c/gc2145.c b/drivers/media/i2c/gc2145.c index 661a59641f19..afb46e8971d6 100644 --- a/drivers/media/i2c/gc2145.c +++ b/drivers/media/i2c/gc2145.c @@ -1321,7 +1321,7 @@ static int gc2145_probe(struct i2c_client *client) struct gc2145 *gc2145; int ret; - gc2145 = devm_kzalloc(&client->dev, sizeof(*gc2145), GFP_KERNEL); + gc2145 = devm_kzalloc_obj(&client->dev, *gc2145); if (!gc2145) return -ENOMEM; diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c index 4c13adf4a900..3b725bc59057 100644 --- a/drivers/media/i2c/hi556.c +++ b/drivers/media/i2c/hi556.c @@ -1329,7 +1329,7 @@ static int hi556_probe(struct i2c_client *client) if (ret) return ret; - hi556 = devm_kzalloc(&client->dev, sizeof(*hi556), GFP_KERNEL); + hi556 = devm_kzalloc_obj(&client->dev, *hi556); if (!hi556) return -ENOMEM; diff --git a/drivers/media/i2c/hi846.c b/drivers/media/i2c/hi846.c index 025f8bcd17bc..7ca899c80bfc 100644 --- a/drivers/media/i2c/hi846.c +++ b/drivers/media/i2c/hi846.c @@ -2043,7 +2043,7 @@ static int hi846_probe(struct i2c_client *client) int i; u32 mclk_freq; - hi846 = devm_kzalloc(&client->dev, sizeof(*hi846), GFP_KERNEL); + hi846 = devm_kzalloc_obj(&client->dev, *hi846); if (!hi846) return -ENOMEM; diff --git a/drivers/media/i2c/hi847.c b/drivers/media/i2c/hi847.c index 41b8cac6a5e3..98f041bc37c0 100644 --- a/drivers/media/i2c/hi847.c +++ b/drivers/media/i2c/hi847.c @@ -2859,7 +2859,7 @@ static int hi847_probe(struct i2c_client *client) unsigned long freq; int ret; - hi847 = devm_kzalloc(&client->dev, sizeof(*hi847), GFP_KERNEL); + hi847 = devm_kzalloc_obj(&client->dev, *hi847); if (!hi847) return -ENOMEM; diff --git a/drivers/media/i2c/hm1246.c b/drivers/media/i2c/hm1246.c index be1c3d75657e..65ed8e64adf3 100644 --- a/drivers/media/i2c/hm1246.c +++ b/drivers/media/i2c/hm1246.c @@ -1145,7 +1145,7 @@ static int hm1246_probe(struct i2c_client *client) struct hm1246 *hm1246; int ret; - hm1246 = devm_kzalloc(&client->dev, sizeof(*hm1246), GFP_KERNEL); + hm1246 = devm_kzalloc_obj(&client->dev, *hm1246); if (!hm1246) return -ENOMEM; diff --git a/drivers/media/i2c/imx111.c b/drivers/media/i2c/imx111.c index 5b860fa052b1..50c22608840d 100644 --- a/drivers/media/i2c/imx111.c +++ b/drivers/media/i2c/imx111.c @@ -1472,7 +1472,7 @@ static int imx111_probe(struct i2c_client *client) struct imx111 *sensor; int ret; - sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/imx208.c b/drivers/media/i2c/imx208.c index 3a899b41a9d2..9e12f26c9d45 100644 --- a/drivers/media/i2c/imx208.c +++ b/drivers/media/i2c/imx208.c @@ -941,7 +941,7 @@ static int imx208_probe(struct i2c_client *client) int ret; bool full_power; - imx208 = devm_kzalloc(&client->dev, sizeof(*imx208), GFP_KERNEL); + imx208 = devm_kzalloc_obj(&client->dev, *imx208); if (!imx208) return -ENOMEM; diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c index 96833f2bf287..4f4fdfb30984 100644 --- a/drivers/media/i2c/imx214.c +++ b/drivers/media/i2c/imx214.c @@ -1392,7 +1392,7 @@ static int imx214_probe(struct i2c_client *client) struct imx214 *imx214; int ret; - imx214 = devm_kzalloc(dev, sizeof(*imx214), GFP_KERNEL); + imx214 = devm_kzalloc_obj(dev, *imx214); if (!imx214) return -ENOMEM; diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 1580562093e8..0c43a8b1c509 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -1195,7 +1195,7 @@ static int imx219_probe(struct i2c_client *client) struct imx219 *imx219; int ret; - imx219 = devm_kzalloc(&client->dev, sizeof(*imx219), GFP_KERNEL); + imx219 = devm_kzalloc_obj(&client->dev, *imx219); if (!imx219) return -ENOMEM; diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c index 065c33380f60..4f8ac2072660 100644 --- a/drivers/media/i2c/imx258.c +++ b/drivers/media/i2c/imx258.c @@ -1371,7 +1371,7 @@ static int imx258_probe(struct i2c_client *client) int ret; u32 val = 0; - imx258 = devm_kzalloc(&client->dev, sizeof(*imx258), GFP_KERNEL); + imx258 = devm_kzalloc_obj(&client->dev, *imx258); if (!imx258) return -ENOMEM; diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c index 3245afc8ae5b..b677cfc9a548 100644 --- a/drivers/media/i2c/imx274.c +++ b/drivers/media/i2c/imx274.c @@ -1958,7 +1958,7 @@ static int imx274_probe(struct i2c_client *client) struct device *dev = &client->dev; int ret; - imx274 = devm_kzalloc(dev, sizeof(*imx274), GFP_KERNEL); + imx274 = devm_kzalloc_obj(dev, *imx274); if (!imx274) return -ENOMEM; diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index e3cd27ca238e..01c42f2de920 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -1463,7 +1463,7 @@ static int imx283_probe(struct i2c_client *client) unsigned int xclk_freq; int ret; - imx283 = devm_kzalloc(&client->dev, sizeof(*imx283), GFP_KERNEL); + imx283 = devm_kzalloc_obj(&client->dev, *imx283); if (!imx283) return -ENOMEM; diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c index d562a9aa455c..6375f87dee97 100644 --- a/drivers/media/i2c/imx290.c +++ b/drivers/media/i2c/imx290.c @@ -1576,7 +1576,7 @@ static int imx290_probe(struct i2c_client *client) struct imx290 *imx290; int ret; - imx290 = devm_kzalloc(dev, sizeof(*imx290), GFP_KERNEL); + imx290 = devm_kzalloc_obj(dev, *imx290); if (!imx290) return -ENOMEM; diff --git a/drivers/media/i2c/imx296.c b/drivers/media/i2c/imx296.c index 74bb295799fd..7179dc001e95 100644 --- a/drivers/media/i2c/imx296.c +++ b/drivers/media/i2c/imx296.c @@ -1023,7 +1023,7 @@ static int imx296_probe(struct i2c_client *client) return -EIO; } - sensor = devm_kzalloc(&client->dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(&client->dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/imx319.c b/drivers/media/i2c/imx319.c index 281d39ed4194..e9348b0d6ee8 100644 --- a/drivers/media/i2c/imx319.c +++ b/drivers/media/i2c/imx319.c @@ -2344,7 +2344,7 @@ static struct imx319_hwcfg *imx319_get_hwcfg(struct device *dev) if (ret) goto out_err; - cfg = devm_kzalloc(dev, sizeof(*cfg), GFP_KERNEL); + cfg = devm_kzalloc_obj(dev, *cfg); if (!cfg) goto out_err; @@ -2374,7 +2374,7 @@ static int imx319_probe(struct i2c_client *client) bool full_power; int ret; - imx319 = devm_kzalloc(&client->dev, sizeof(*imx319), GFP_KERNEL); + imx319 = devm_kzalloc_obj(&client->dev, *imx319); if (!imx319) return -ENOMEM; diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c index da19d5fc19f5..043f8131c3ba 100644 --- a/drivers/media/i2c/imx334.c +++ b/drivers/media/i2c/imx334.c @@ -1223,7 +1223,7 @@ static int imx334_probe(struct i2c_client *client) struct imx334 *imx334; int ret; - imx334 = devm_kzalloc(&client->dev, sizeof(*imx334), GFP_KERNEL); + imx334 = devm_kzalloc_obj(&client->dev, *imx334); if (!imx334) return -ENOMEM; diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c index 8f29d9f2da83..aa26c58ffa76 100644 --- a/drivers/media/i2c/imx335.c +++ b/drivers/media/i2c/imx335.c @@ -1362,7 +1362,7 @@ static int imx335_probe(struct i2c_client *client) struct imx335 *imx335; int ret; - imx335 = devm_kzalloc(&client->dev, sizeof(*imx335), GFP_KERNEL); + imx335 = devm_kzalloc_obj(&client->dev, *imx335); if (!imx335) return -ENOMEM; diff --git a/drivers/media/i2c/imx355.c b/drivers/media/i2c/imx355.c index 45e3002bd93c..c0dafabf5dc9 100644 --- a/drivers/media/i2c/imx355.c +++ b/drivers/media/i2c/imx355.c @@ -1149,7 +1149,7 @@ static struct imx355_hwcfg *imx355_get_hwcfg(struct imx355 *imx355) if (ret) goto out_err; - cfg = devm_kzalloc(dev, sizeof(*cfg), GFP_KERNEL); + cfg = devm_kzalloc_obj(dev, *cfg); if (!cfg) goto out_err; @@ -1185,7 +1185,7 @@ static int imx355_probe(struct i2c_client *client) unsigned long freq; int ret; - imx355 = devm_kzalloc(&client->dev, sizeof(*imx355), GFP_KERNEL); + imx355 = devm_kzalloc_obj(&client->dev, *imx355); if (!imx355) return -ENOMEM; diff --git a/drivers/media/i2c/imx412.c b/drivers/media/i2c/imx412.c index 4628e2eda231..0e50c297af09 100644 --- a/drivers/media/i2c/imx412.c +++ b/drivers/media/i2c/imx412.c @@ -983,7 +983,7 @@ static int imx412_probe(struct i2c_client *client) const char *name; int ret; - imx412 = devm_kzalloc(&client->dev, sizeof(*imx412), GFP_KERNEL); + imx412 = devm_kzalloc_obj(&client->dev, *imx412); if (!imx412) return -ENOMEM; diff --git a/drivers/media/i2c/imx415.c b/drivers/media/i2c/imx415.c index 2571718cffff..7bb27bdf1446 100644 --- a/drivers/media/i2c/imx415.c +++ b/drivers/media/i2c/imx415.c @@ -1354,7 +1354,7 @@ static int imx415_probe(struct i2c_client *client) struct imx415 *sensor; int ret; - sensor = devm_kzalloc(&client->dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(&client->dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/imx471.c b/drivers/media/i2c/imx471.c index 0f3a2812b9ea..3eacd456320d 100644 --- a/drivers/media/i2c/imx471.c +++ b/drivers/media/i2c/imx471.c @@ -812,7 +812,7 @@ static int imx471_probe(struct i2c_client *client) struct imx471 *sensor; int ret; - sensor = devm_kzalloc(&client->dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(&client->dev, *sensor); if (!sensor) return dev_err_probe(&client->dev, -ENOMEM, "failed to allocate memory\n"); diff --git a/drivers/media/i2c/imx576.c b/drivers/media/i2c/imx576.c index 6243683302c7..6285d6ed0bcb 100644 --- a/drivers/media/i2c/imx576.c +++ b/drivers/media/i2c/imx576.c @@ -951,7 +951,7 @@ static int imx576_probe(struct i2c_client *client) struct imx576 *imx576; int ret; - imx576 = devm_kzalloc(&client->dev, sizeof(*imx576), GFP_KERNEL); + imx576 = devm_kzalloc_obj(&client->dev, *imx576); if (!imx576) return -ENOMEM; diff --git a/drivers/media/i2c/imx678.c b/drivers/media/i2c/imx678.c index 8413fd44d657..7d518643e633 100644 --- a/drivers/media/i2c/imx678.c +++ b/drivers/media/i2c/imx678.c @@ -1286,7 +1286,7 @@ static int imx678_probe(struct i2c_client *client) struct imx678 *imx678; int ret, i; - imx678 = devm_kzalloc(&client->dev, sizeof(*imx678), GFP_KERNEL); + imx678 = devm_kzalloc_obj(&client->dev, *imx678); if (!imx678) return -ENOMEM; diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c index f2bf2b354000..ab7dee57cda3 100644 --- a/drivers/media/i2c/ir-kbd-i2c.c +++ b/drivers/media/i2c/ir-kbd-i2c.c @@ -776,7 +776,7 @@ static int ir_probe(struct i2c_client *client) return -ENODEV; } - ir = devm_kzalloc(&client->dev, sizeof(*ir), GFP_KERNEL); + ir = devm_kzalloc_obj(&client->dev, *ir); if (!ir) return -ENOMEM; diff --git a/drivers/media/i2c/isl7998x.c b/drivers/media/i2c/isl7998x.c index adb49eb62642..e36fb355133e 100644 --- a/drivers/media/i2c/isl7998x.c +++ b/drivers/media/i2c/isl7998x.c @@ -1467,7 +1467,7 @@ static int isl7998x_probe(struct i2c_client *client) return -EIO; } - isl7998x = devm_kzalloc(dev, sizeof(*isl7998x), GFP_KERNEL); + isl7998x = devm_kzalloc_obj(dev, *isl7998x); if (!isl7998x) return -ENOMEM; diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index b74df9dbf8c2..6550f22b1692 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -2246,7 +2246,7 @@ static int it6625_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - it6625 = devm_kzalloc(&client->dev, sizeof(struct it6625), GFP_KERNEL); + it6625 = devm_kzalloc_obj(&client->dev, struct it6625); if (!it6625) return -ENOMEM; diff --git a/drivers/media/i2c/ks0127.c b/drivers/media/i2c/ks0127.c index 8c66be38adc3..18d8430516b6 100644 --- a/drivers/media/i2c/ks0127.c +++ b/drivers/media/i2c/ks0127.c @@ -651,7 +651,7 @@ static int ks0127_probe(struct i2c_client *client) client->addr == (I2C_KS0127_ADDON >> 1) ? "addon" : "on-board", client->addr << 1, client->adapter->name); - ks = devm_kzalloc(&client->dev, sizeof(*ks), GFP_KERNEL); + ks = devm_kzalloc_obj(&client->dev, *ks); if (ks == NULL) return -ENOMEM; sd = &ks->sd; diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c index 6b28a5fcd2da..8b42fb02ef5e 100644 --- a/drivers/media/i2c/lm3560.c +++ b/drivers/media/i2c/lm3560.c @@ -522,7 +522,7 @@ static int lm3560_probe(struct i2c_client *client) u32 peak_ua; int rval; - flash = devm_kzalloc(&client->dev, sizeof(*flash), GFP_KERNEL); + flash = devm_kzalloc_obj(&client->dev, *flash); if (flash == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/lm3646.c b/drivers/media/i2c/lm3646.c index 9030cbe32afc..f3257d7b8966 100644 --- a/drivers/media/i2c/lm3646.c +++ b/drivers/media/i2c/lm3646.c @@ -340,7 +340,7 @@ static int lm3646_probe(struct i2c_client *client) struct lm3646_platform_data *pdata = dev_get_platdata(&client->dev); int rval; - flash = devm_kzalloc(&client->dev, sizeof(*flash), GFP_KERNEL); + flash = devm_kzalloc_obj(&client->dev, *flash); if (flash == NULL) return -ENOMEM; @@ -350,9 +350,8 @@ static int lm3646_probe(struct i2c_client *client) /* check device tree if there is no platform data */ if (pdata == NULL) { - pdata = devm_kzalloc(&client->dev, - sizeof(struct lm3646_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc_obj(&client->dev, + struct lm3646_platform_data); if (pdata == NULL) return -ENOMEM; /* use default data in case of no platform data */ diff --git a/drivers/media/i2c/lt6911uxe.c b/drivers/media/i2c/lt6911uxe.c index c9da174dbfa6..e6abfec8a706 100644 --- a/drivers/media/i2c/lt6911uxe.c +++ b/drivers/media/i2c/lt6911uxe.c @@ -589,7 +589,7 @@ static int lt6911uxe_probe(struct i2c_client *client) struct device *dev = &client->dev; int ret; - lt6911uxe = devm_kzalloc(dev, sizeof(*lt6911uxe), GFP_KERNEL); + lt6911uxe = devm_kzalloc_obj(dev, *lt6911uxe); if (!lt6911uxe) return -ENOMEM; diff --git a/drivers/media/i2c/m52790.c b/drivers/media/i2c/m52790.c index f3adf8c2b27f..b1bb5a7a370b 100644 --- a/drivers/media/i2c/m52790.c +++ b/drivers/media/i2c/m52790.c @@ -141,7 +141,7 @@ static int m52790_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (state == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/max2175.c b/drivers/media/i2c/max2175.c index 1cc388b52902..292d766520c7 100644 --- a/drivers/media/i2c/max2175.c +++ b/drivers/media/i2c/max2175.c @@ -1320,7 +1320,7 @@ static int max2175_probe(struct i2c_client *client) } /* Alloc tuner context */ - ctx = devm_kzalloc(&client->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&client->dev, *ctx); if (ctx == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index 050ad9405c5f..9dae1d8559aa 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -1586,7 +1586,7 @@ static int max9286_probe(struct i2c_client *client) struct max9286_priv *priv; int ret; - priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&client->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/i2c/maxim-serdes/max9296a.c b/drivers/media/i2c/maxim-serdes/max9296a.c index 7b25b54e63de..abc2a0f03a8c 100644 --- a/drivers/media/i2c/maxim-serdes/max9296a.c +++ b/drivers/media/i2c/maxim-serdes/max9296a.c @@ -1173,7 +1173,7 @@ static int max9296a_probe(struct i2c_client *client) struct max9296a_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/i2c/maxim-serdes/max96717.c b/drivers/media/i2c/maxim-serdes/max96717.c index e004e71cb768..c76d092a3019 100644 --- a/drivers/media/i2c/maxim-serdes/max96717.c +++ b/drivers/media/i2c/maxim-serdes/max96717.c @@ -1602,11 +1602,11 @@ static int max96717_probe(struct i2c_client *client) struct max_ser_ops *ops; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; - ops = devm_kzalloc(dev, sizeof(*ops), GFP_KERNEL); + ops = devm_kzalloc_obj(dev, *ops); if (!ops) return -ENOMEM; diff --git a/drivers/media/i2c/maxim-serdes/max96724.c b/drivers/media/i2c/maxim-serdes/max96724.c index 3889d955f84b..685e82a1ada2 100644 --- a/drivers/media/i2c/maxim-serdes/max96724.c +++ b/drivers/media/i2c/maxim-serdes/max96724.c @@ -1227,15 +1227,15 @@ static int max96724_probe(struct i2c_client *client) u32 cc_port; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; - ops = devm_kzalloc(dev, sizeof(*ops), GFP_KERNEL); + ops = devm_kzalloc_obj(dev, *ops); if (!ops) return -ENOMEM; diff --git a/drivers/media/i2c/maxim-serdes/max_des.c b/drivers/media/i2c/maxim-serdes/max_des.c index 6b4ffd0e2415..37f438608616 100644 --- a/drivers/media/i2c/maxim-serdes/max_des.c +++ b/drivers/media/i2c/maxim-serdes/max_des.c @@ -1243,8 +1243,8 @@ static int max_des_update_pipe_vc_remaps(struct max_des_priv *priv, if (!des->ops->set_pipe_vc_remap) return 0; - vc_remaps = devm_kcalloc(priv->dev, MAX_SERDES_VC_ID_NUM, - sizeof(*vc_remaps), GFP_KERNEL); + vc_remaps = devm_kzalloc_objs(priv->dev, *vc_remaps, + MAX_SERDES_VC_ID_NUM); if (!vc_remaps) return -ENOMEM; @@ -1285,8 +1285,8 @@ static int max_des_update_pipe_remaps(struct max_des_priv *priv, if (!des->ops->set_pipe_remap) return 0; - remaps = devm_kcalloc(priv->dev, des->info->num_remaps_per_pipe, - sizeof(*remaps), GFP_KERNEL); + remaps = devm_kzalloc_objs(priv->dev, *remaps, + des->info->num_remaps_per_pipe); if (!remaps) return -ENOMEM; @@ -3210,39 +3210,37 @@ static int max_des_allocate(struct max_des_priv *priv) struct max_des *des = priv->des; unsigned int num_pads = max_des_num_pads(des); - des->phys = devm_kcalloc(priv->dev, des->info->num_phys, - sizeof(*des->phys), GFP_KERNEL); + des->phys = devm_kzalloc_objs(priv->dev, *des->phys, + des->info->num_phys); if (!des->phys) return -ENOMEM; - des->pipes = devm_kcalloc(priv->dev, des->info->num_pipes, - sizeof(*des->pipes), GFP_KERNEL); + des->pipes = devm_kzalloc_objs(priv->dev, *des->pipes, + des->info->num_pipes); if (!des->pipes) return -ENOMEM; - des->links = devm_kcalloc(priv->dev, des->info->num_links, - sizeof(*des->links), GFP_KERNEL); + des->links = devm_kzalloc_objs(priv->dev, *des->links, + des->info->num_links); if (!des->links) return -ENOMEM; - priv->sources = devm_kcalloc(priv->dev, des->info->num_links, - sizeof(*priv->sources), GFP_KERNEL); + priv->sources = devm_kzalloc_objs(priv->dev, *priv->sources, + des->info->num_links); if (!priv->sources) return -ENOMEM; - priv->pocs = devm_kcalloc(priv->dev, des->info->num_links, - sizeof(*priv->pocs), GFP_KERNEL); + priv->pocs = devm_kzalloc_objs(priv->dev, *priv->pocs, + des->info->num_links); if (!priv->pocs) return -ENOMEM; - priv->pads = devm_kcalloc(priv->dev, num_pads, - sizeof(*priv->pads), GFP_KERNEL); + priv->pads = devm_kzalloc_objs(priv->dev, *priv->pads, num_pads); if (!priv->pads) return -ENOMEM; - priv->streams_masks = devm_kcalloc(priv->dev, num_pads, - sizeof(*priv->streams_masks), - GFP_KERNEL); + priv->streams_masks = devm_kzalloc_objs(priv->dev, *priv->streams_masks, + num_pads); if (!priv->streams_masks) return -ENOMEM; @@ -3267,7 +3265,7 @@ int max_des_probe(struct i2c_client *client, struct max_des *des) if (des->info->num_links > des->info->num_pipes) return -E2BIG; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/i2c/maxim-serdes/max_ser.c b/drivers/media/i2c/maxim-serdes/max_ser.c index d6a17f987e46..1c4cec2efb95 100644 --- a/drivers/media/i2c/maxim-serdes/max_ser.c +++ b/drivers/media/i2c/maxim-serdes/max_ser.c @@ -1079,8 +1079,7 @@ static int max_ser_update_pipe(struct max_ser_priv *priv, if (!ser->ops->num_dts_per_pipe) return 0; - dts = devm_kcalloc(priv->dev, ser->ops->num_dts_per_pipe, sizeof(*dts), - GFP_KERNEL); + dts = devm_kzalloc_objs(priv->dev, *dts, ser->ops->num_dts_per_pipe); if (!dts) return -ENOMEM; @@ -1662,7 +1661,7 @@ static int max_ser_v4l2_register(struct max_ser_priv *priv) sd->entity.ops = &max_ser_media_ops; sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_STREAMS; - priv->pads = devm_kcalloc(priv->dev, num_pads, sizeof(*priv->pads), GFP_KERNEL); + priv->pads = devm_kzalloc_objs(priv->dev, *priv->pads, num_pads); if (!priv->pads) return -ENOMEM; @@ -1873,34 +1872,32 @@ static int max_ser_allocate(struct max_ser_priv *priv) struct max_ser *ser = priv->ser; unsigned int num_pads = max_ser_num_pads(ser); - ser->phys = devm_kcalloc(priv->dev, ser->ops->num_phys, - sizeof(*ser->phys), GFP_KERNEL); + ser->phys = devm_kzalloc_objs(priv->dev, *ser->phys, ser->ops->num_phys); if (!ser->phys) return -ENOMEM; - ser->pipes = devm_kcalloc(priv->dev, ser->ops->num_pipes, - sizeof(*ser->pipes), GFP_KERNEL); + ser->pipes = devm_kzalloc_objs(priv->dev, *ser->pipes, + ser->ops->num_pipes); if (!ser->pipes) return -ENOMEM; - ser->vc_remaps = devm_kcalloc(priv->dev, ser->ops->num_vc_remaps, - sizeof(*ser->vc_remaps), GFP_KERNEL); + ser->vc_remaps = devm_kzalloc_objs(priv->dev, *ser->vc_remaps, + ser->ops->num_vc_remaps); if (!ser->vc_remaps) return -ENOMEM; - ser->i2c_xlates = devm_kcalloc(priv->dev, ser->ops->num_i2c_xlates, - sizeof(*ser->i2c_xlates), GFP_KERNEL); + ser->i2c_xlates = devm_kzalloc_objs(priv->dev, *ser->i2c_xlates, + ser->ops->num_i2c_xlates); if (!ser->i2c_xlates) return -ENOMEM; - priv->sources = devm_kcalloc(priv->dev, ser->ops->num_phys, - sizeof(*priv->sources), GFP_KERNEL); + priv->sources = devm_kzalloc_objs(priv->dev, *priv->sources, + ser->ops->num_phys); if (!priv->sources) return -ENOMEM; - priv->streams_masks = devm_kcalloc(priv->dev, num_pads, - sizeof(*priv->streams_masks), - GFP_KERNEL); + priv->streams_masks = devm_kzalloc_objs(priv->dev, *priv->streams_masks, + num_pads); if (!priv->streams_masks) return -ENOMEM; @@ -1916,7 +1913,7 @@ int max_ser_probe(struct i2c_client *client, struct max_ser *ser) if (ser->ops->num_phys > MAX_SER_NUM_PHYS) return -E2BIG; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/i2c/maxim-serdes/max_serdes.c b/drivers/media/i2c/maxim-serdes/max_serdes.c index 7d013c4739d1..6246bc55c551 100644 --- a/drivers/media/i2c/maxim-serdes/max_serdes.c +++ b/drivers/media/i2c/maxim-serdes/max_serdes.c @@ -256,7 +256,7 @@ int max_serdes_get_streams_masks(struct device *dev, u64 *streams_masks; unsigned int i; - streams_masks = devm_kcalloc(dev, num_pads, sizeof(*streams_masks), GFP_KERNEL); + streams_masks = devm_kzalloc_objs(dev, *streams_masks, num_pads); if (!streams_masks) return -ENOMEM; diff --git a/drivers/media/i2c/ml86v7667.c b/drivers/media/i2c/ml86v7667.c index eda41a80d20c..355899bd02e3 100644 --- a/drivers/media/i2c/ml86v7667.c +++ b/drivers/media/i2c/ml86v7667.c @@ -366,7 +366,7 @@ static int ml86v7667_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&client->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/i2c/msp3400-driver.c b/drivers/media/i2c/msp3400-driver.c index a540b211f7d7..8c2edd4620ef 100644 --- a/drivers/media/i2c/msp3400-driver.c +++ b/drivers/media/i2c/msp3400-driver.c @@ -679,7 +679,7 @@ static int msp_probe(struct i2c_client *client) return -ENODEV; } - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/media/i2c/mt9m001.c b/drivers/media/i2c/mt9m001.c index fe46ea65550a..41fb745e516d 100644 --- a/drivers/media/i2c/mt9m001.c +++ b/drivers/media/i2c/mt9m001.c @@ -744,7 +744,7 @@ static int mt9m001_probe(struct i2c_client *client) return -EIO; } - mt9m001 = devm_kzalloc(&client->dev, sizeof(*mt9m001), GFP_KERNEL); + mt9m001 = devm_kzalloc_obj(&client->dev, *mt9m001); if (!mt9m001) return -ENOMEM; diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c index f911c1cb43e1..098e9c01acf2 100644 --- a/drivers/media/i2c/mt9m111.c +++ b/drivers/media/i2c/mt9m111.c @@ -1272,7 +1272,7 @@ static int mt9m111_probe(struct i2c_client *client) return -EIO; } - mt9m111 = devm_kzalloc(&client->dev, sizeof(struct mt9m111), GFP_KERNEL); + mt9m111 = devm_kzalloc_obj(&client->dev, struct mt9m111); if (!mt9m111) return -ENOMEM; diff --git a/drivers/media/i2c/mt9m114.c b/drivers/media/i2c/mt9m114.c index c6c950d5c8f3..b545b3da8359 100644 --- a/drivers/media/i2c/mt9m114.c +++ b/drivers/media/i2c/mt9m114.c @@ -2529,7 +2529,7 @@ static int mt9m114_probe(struct i2c_client *client) struct mt9m114 *sensor; int ret; - sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c index 5b0a84c66043..40e44cf048dc 100644 --- a/drivers/media/i2c/mt9p031.c +++ b/drivers/media/i2c/mt9p031.c @@ -1103,7 +1103,7 @@ static int mt9p031_probe(struct i2c_client *client) return -EIO; } - mt9p031 = devm_kzalloc(&client->dev, sizeof(*mt9p031), GFP_KERNEL); + mt9p031 = devm_kzalloc_obj(&client->dev, *mt9p031); if (mt9p031 == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/mt9t112.c b/drivers/media/i2c/mt9t112.c index 7a47756b9356..3774dbcf5bda 100644 --- a/drivers/media/i2c/mt9t112.c +++ b/drivers/media/i2c/mt9t112.c @@ -1072,7 +1072,7 @@ static int mt9t112_probe(struct i2c_client *client) return -EINVAL; } - priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&client->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/i2c/mt9v011.c b/drivers/media/i2c/mt9v011.c index 6ea31a4a6463..3ccc0e60b64e 100644 --- a/drivers/media/i2c/mt9v011.c +++ b/drivers/media/i2c/mt9v011.c @@ -501,7 +501,7 @@ static int mt9v011_probe(struct i2c_client *c) I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) return -EIO; - core = devm_kzalloc(&c->dev, sizeof(struct mt9v011), GFP_KERNEL); + core = devm_kzalloc_obj(&c->dev, struct mt9v011); if (!core) return -ENOMEM; diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c index 29823378f0c7..3dfd0b2c96f1 100644 --- a/drivers/media/i2c/mt9v032.c +++ b/drivers/media/i2c/mt9v032.c @@ -1023,8 +1023,7 @@ static int mt9v032_get_pdata(struct mt9v032 *mt9v032) u64 *link_freqs; size_t size = prop->length / sizeof(*link_freqs); - link_freqs = devm_kcalloc(mt9v032->dev, size, - sizeof(*link_freqs), GFP_KERNEL); + link_freqs = devm_kzalloc_objs(mt9v032->dev, *link_freqs, size); if (!link_freqs) return -EINVAL; @@ -1048,7 +1047,7 @@ static int mt9v032_probe(struct i2c_client *client) unsigned int i; int ret; - mt9v032 = devm_kzalloc(&client->dev, sizeof(*mt9v032), GFP_KERNEL); + mt9v032 = devm_kzalloc_obj(&client->dev, *mt9v032); if (!mt9v032) return -ENOMEM; diff --git a/drivers/media/i2c/mt9v111.c b/drivers/media/i2c/mt9v111.c index 6e9b3e190bca..185f93b7656f 100644 --- a/drivers/media/i2c/mt9v111.c +++ b/drivers/media/i2c/mt9v111.c @@ -1121,7 +1121,7 @@ static int mt9v111_probe(struct i2c_client *client) struct v4l2_fract tpf; int ret; - mt9v111 = devm_kzalloc(&client->dev, sizeof(*mt9v111), GFP_KERNEL); + mt9v111 = devm_kzalloc_obj(&client->dev, *mt9v111); if (!mt9v111) return -ENOMEM; diff --git a/drivers/media/i2c/og01a1b.c b/drivers/media/i2c/og01a1b.c index b207b1d853a4..25e9b8bc9f39 100644 --- a/drivers/media/i2c/og01a1b.c +++ b/drivers/media/i2c/og01a1b.c @@ -970,7 +970,7 @@ static int og01a1b_probe(struct i2c_client *client) unsigned long freq; int ret; - og01a1b = devm_kzalloc(&client->dev, sizeof(*og01a1b), GFP_KERNEL); + og01a1b = devm_kzalloc_obj(&client->dev, *og01a1b); if (!og01a1b) return -ENOMEM; diff --git a/drivers/media/i2c/og0ve1b.c b/drivers/media/i2c/og0ve1b.c index e7cd0f72f3e5..cc283b3b586c 100644 --- a/drivers/media/i2c/og0ve1b.c +++ b/drivers/media/i2c/og0ve1b.c @@ -974,7 +974,7 @@ static int og0ve1b_probe(struct i2c_client *client) unsigned int i; int ret; - og0ve1b = devm_kzalloc(&client->dev, sizeof(*og0ve1b), GFP_KERNEL); + og0ve1b = devm_kzalloc_obj(&client->dev, *og0ve1b); if (!og0ve1b) return -ENOMEM; diff --git a/drivers/media/i2c/os02g10.c b/drivers/media/i2c/os02g10.c index 141b7cb11fc5..0983214d41b9 100644 --- a/drivers/media/i2c/os02g10.c +++ b/drivers/media/i2c/os02g10.c @@ -778,7 +778,7 @@ static int os02g10_probe(struct i2c_client *client) unsigned int xclk_freq; int ret; - os02g10 = devm_kzalloc(&client->dev, sizeof(*os02g10), GFP_KERNEL); + os02g10 = devm_kzalloc_obj(&client->dev, *os02g10); if (!os02g10) return -ENOMEM; diff --git a/drivers/media/i2c/os05b10.c b/drivers/media/i2c/os05b10.c index a46cfa513e98..a281c61afcf0 100644 --- a/drivers/media/i2c/os05b10.c +++ b/drivers/media/i2c/os05b10.c @@ -977,7 +977,7 @@ static int os05b10_probe(struct i2c_client *client) unsigned int xclk_freq; int ret; - os05b10 = devm_kzalloc(&client->dev, sizeof(*os05b10), GFP_KERNEL); + os05b10 = devm_kzalloc_obj(&client->dev, *os05b10); if (!os05b10) return -ENOMEM; diff --git a/drivers/media/i2c/ov01a10.c b/drivers/media/i2c/ov01a10.c index b9a7dacd603e..46503e2f5a26 100644 --- a/drivers/media/i2c/ov01a10.c +++ b/drivers/media/i2c/ov01a10.c @@ -1003,7 +1003,7 @@ static int ov01a10_probe(struct i2c_client *client) if (!cfg) return -EINVAL; - ov01a10 = devm_kzalloc(&client->dev, sizeof(*ov01a10), GFP_KERNEL); + ov01a10 = devm_kzalloc_obj(&client->dev, *ov01a10); if (!ov01a10) return -ENOMEM; diff --git a/drivers/media/i2c/ov02a10.c b/drivers/media/i2c/ov02a10.c index 375cd52d61b9..5a61787adf3a 100644 --- a/drivers/media/i2c/ov02a10.c +++ b/drivers/media/i2c/ov02a10.c @@ -859,7 +859,7 @@ static int ov02a10_probe(struct i2c_client *client) unsigned int rotation; int ret; - ov02a10 = devm_kzalloc(dev, sizeof(*ov02a10), GFP_KERNEL); + ov02a10 = devm_kzalloc_obj(dev, *ov02a10); if (!ov02a10) return -ENOMEM; diff --git a/drivers/media/i2c/ov02c10.c b/drivers/media/i2c/ov02c10.c index 8ffe0a07ef85..296f09860dc5 100644 --- a/drivers/media/i2c/ov02c10.c +++ b/drivers/media/i2c/ov02c10.c @@ -881,7 +881,7 @@ static int ov02c10_probe(struct i2c_client *client) unsigned long freq; int ret; - ov02c10 = devm_kzalloc(&client->dev, sizeof(*ov02c10), GFP_KERNEL); + ov02c10 = devm_kzalloc_obj(&client->dev, *ov02c10); if (!ov02c10) return -ENOMEM; diff --git a/drivers/media/i2c/ov02e10.c b/drivers/media/i2c/ov02e10.c index 5c1e7013f559..42dd818bb7af 100644 --- a/drivers/media/i2c/ov02e10.c +++ b/drivers/media/i2c/ov02e10.c @@ -816,7 +816,7 @@ static int ov02e10_probe(struct i2c_client *client) unsigned long freq; int ret; - ov02e10 = devm_kzalloc(&client->dev, sizeof(*ov02e10), GFP_KERNEL); + ov02e10 = devm_kzalloc_obj(&client->dev, *ov02e10); if (!ov02e10) return -ENOMEM; diff --git a/drivers/media/i2c/ov05c10.c b/drivers/media/i2c/ov05c10.c index 8fe4dc0d9405..eecc65c4cef5 100644 --- a/drivers/media/i2c/ov05c10.c +++ b/drivers/media/i2c/ov05c10.c @@ -840,7 +840,7 @@ static int ov05c10_probe(struct i2c_client *client) bool full_power; int ret; - ov05c10 = devm_kzalloc(&client->dev, sizeof(*ov05c10), GFP_KERNEL); + ov05c10 = devm_kzalloc_obj(&client->dev, *ov05c10); if (!ov05c10) return -ENOMEM; diff --git a/drivers/media/i2c/ov08d10.c b/drivers/media/i2c/ov08d10.c index 0710d2243cc0..ea4219d4c992 100644 --- a/drivers/media/i2c/ov08d10.c +++ b/drivers/media/i2c/ov08d10.c @@ -1487,7 +1487,7 @@ static int ov08d10_probe(struct i2c_client *client) unsigned int i; int ret; - ov08d10 = devm_kzalloc(&client->dev, sizeof(*ov08d10), GFP_KERNEL); + ov08d10 = devm_kzalloc_obj(&client->dev, *ov08d10); if (!ov08d10) return -ENOMEM; diff --git a/drivers/media/i2c/ov08x40.c b/drivers/media/i2c/ov08x40.c index 6de0c17e633d..69eedafe0dde 100644 --- a/drivers/media/i2c/ov08x40.c +++ b/drivers/media/i2c/ov08x40.c @@ -2280,7 +2280,7 @@ static int ov08x40_probe(struct i2c_client *client) int ret; bool full_power; - ov08x = devm_kzalloc(&client->dev, sizeof(*ov08x), GFP_KERNEL); + ov08x = devm_kzalloc_obj(&client->dev, *ov08x); if (!ov08x) return -ENOMEM; diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c index 5a49fa0ec026..f3f12e8f00de 100644 --- a/drivers/media/i2c/ov13858.c +++ b/drivers/media/i2c/ov13858.c @@ -1712,7 +1712,7 @@ static int ov13858_probe(struct i2c_client *client) unsigned long freq; int ret; - ov13858 = devm_kzalloc(&client->dev, sizeof(*ov13858), GFP_KERNEL); + ov13858 = devm_kzalloc_obj(&client->dev, *ov13858); if (!ov13858) return -ENOMEM; diff --git a/drivers/media/i2c/ov13b10.c b/drivers/media/i2c/ov13b10.c index 242a95834126..f639a70f60dc 100644 --- a/drivers/media/i2c/ov13b10.c +++ b/drivers/media/i2c/ov13b10.c @@ -1592,7 +1592,7 @@ static int ov13b10_probe(struct i2c_client *client) bool full_power; int ret; - ov13b = devm_kzalloc(&client->dev, sizeof(*ov13b), GFP_KERNEL); + ov13b = devm_kzalloc_obj(&client->dev, *ov13b); if (!ov13b) return -ENOMEM; diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c index 3dbefac6d305..4018222f10f8 100644 --- a/drivers/media/i2c/ov2640.c +++ b/drivers/media/i2c/ov2640.c @@ -1198,7 +1198,7 @@ static int ov2640_probe(struct i2c_client *client) return -EIO; } - priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&client->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c index 5bc30e7b8325..64fb4d91414c 100644 --- a/drivers/media/i2c/ov2659.c +++ b/drivers/media/i2c/ov2659.c @@ -1400,7 +1400,7 @@ ov2659_get_pdata(struct i2c_client *client) goto done; } - pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&client->dev, *pdata); if (!pdata) goto done; @@ -1431,7 +1431,7 @@ static int ov2659_probe(struct i2c_client *client) return -EINVAL; } - ov2659 = devm_kzalloc(&client->dev, sizeof(*ov2659), GFP_KERNEL); + ov2659 = devm_kzalloc_obj(&client->dev, *ov2659); if (!ov2659) return -ENOMEM; diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 147862a813c5..49466b88120e 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -1174,7 +1174,7 @@ static int ov2680_probe(struct i2c_client *client) struct ov2680_dev *sensor; int ret; - sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/ov2685.c b/drivers/media/i2c/ov2685.c index 162859a140eb..c59a923c3935 100644 --- a/drivers/media/i2c/ov2685.c +++ b/drivers/media/i2c/ov2685.c @@ -778,7 +778,7 @@ static int ov2685_probe(struct i2c_client *client) struct ov2685 *ov2685; int ret; - ov2685 = devm_kzalloc(dev, sizeof(*ov2685), GFP_KERNEL); + ov2685 = devm_kzalloc_obj(dev, *ov2685); if (!ov2685) return -ENOMEM; diff --git a/drivers/media/i2c/ov2732.c b/drivers/media/i2c/ov2732.c index 57dd0dd3fd85..999c618d0789 100644 --- a/drivers/media/i2c/ov2732.c +++ b/drivers/media/i2c/ov2732.c @@ -643,7 +643,7 @@ static int ov2732_probe(struct i2c_client *client) struct ov2732 *ov2732; int ret; - ov2732 = devm_kzalloc(&client->dev, sizeof(*ov2732), GFP_KERNEL); + ov2732 = devm_kzalloc_obj(&client->dev, *ov2732); if (!ov2732) return -ENOMEM; diff --git a/drivers/media/i2c/ov2735.c b/drivers/media/i2c/ov2735.c index 0361904c4841..42d48994ac13 100644 --- a/drivers/media/i2c/ov2735.c +++ b/drivers/media/i2c/ov2735.c @@ -950,7 +950,7 @@ static int ov2735_probe(struct i2c_client *client) unsigned int xclk_freq; int ret; - ov2735 = devm_kzalloc(&client->dev, sizeof(*ov2735), GFP_KERNEL); + ov2735 = devm_kzalloc_obj(&client->dev, *ov2735); if (!ov2735) return -ENOMEM; diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c index 536325bb7b92..31513d1524a3 100644 --- a/drivers/media/i2c/ov2740.c +++ b/drivers/media/i2c/ov2740.c @@ -1268,7 +1268,7 @@ static int ov2740_register_nvmem(struct i2c_client *client, .size = CUSTOMER_USE_OTP_SIZE, }; - nvm = devm_kzalloc(dev, sizeof(*nvm), GFP_KERNEL); + nvm = devm_kzalloc_obj(dev, *nvm); if (!nvm) return -ENOMEM; @@ -1334,7 +1334,7 @@ static int ov2740_probe(struct i2c_client *client) unsigned int i; int ret; - ov2740 = devm_kzalloc(&client->dev, sizeof(*ov2740), GFP_KERNEL); + ov2740 = devm_kzalloc_obj(&client->dev, *ov2740); if (!ov2740) return -ENOMEM; diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c index 466b6f74d982..cec7dc67b2ed 100644 --- a/drivers/media/i2c/ov4689.c +++ b/drivers/media/i2c/ov4689.c @@ -901,7 +901,7 @@ static int ov4689_probe(struct i2c_client *client) if (ret) return ret; - ov4689 = devm_kzalloc(dev, sizeof(*ov4689), GFP_KERNEL); + ov4689 = devm_kzalloc_obj(dev, *ov4689); if (!ov4689) return -ENOMEM; diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 22d08d0a90cf..f11c904c3bb5 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -3850,7 +3850,7 @@ static int ov5640_probe(struct i2c_client *client) struct ov5640_dev *sensor; int ret; - sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index a8d740ed4dc9..47da5cefb7f9 100644 --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -1018,7 +1018,7 @@ static int ov5645_probe(struct i2c_client *client) u32 xclk_freq; int ret; - ov5645 = devm_kzalloc(dev, sizeof(struct ov5645), GFP_KERNEL); + ov5645 = devm_kzalloc_obj(dev, struct ov5645); if (!ov5645) return -ENOMEM; diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c index e1120ca68828..b9d69ee50a0e 100644 --- a/drivers/media/i2c/ov5647.c +++ b/drivers/media/i2c/ov5647.c @@ -1163,7 +1163,7 @@ static int ov5647_probe(struct i2c_client *client) u32 xclk_freq; int ret; - sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/ov5648.c b/drivers/media/i2c/ov5648.c index 6a1efa12c38d..bb06e66d28e0 100644 --- a/drivers/media/i2c/ov5648.c +++ b/drivers/media/i2c/ov5648.c @@ -2456,7 +2456,7 @@ static int ov5648_probe(struct i2c_client *client) unsigned long rate; int ret; - sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c index 940f21fe0dd3..90352140e5fe 100644 --- a/drivers/media/i2c/ov5670.c +++ b/drivers/media/i2c/ov5670.c @@ -2650,7 +2650,7 @@ static int ov5670_probe(struct i2c_client *client) bool full_power; int ret; - ov5670 = devm_kzalloc(&client->dev, sizeof(*ov5670), GFP_KERNEL); + ov5670 = devm_kzalloc_obj(&client->dev, *ov5670); if (!ov5670) return -ENOMEM; diff --git a/drivers/media/i2c/ov5675.c b/drivers/media/i2c/ov5675.c index c5eb07576129..a86f7af7798d 100644 --- a/drivers/media/i2c/ov5675.c +++ b/drivers/media/i2c/ov5675.c @@ -1276,7 +1276,7 @@ static int ov5675_probe(struct i2c_client *client) bool full_power; int ret; - ov5675 = devm_kzalloc(&client->dev, sizeof(*ov5675), GFP_KERNEL); + ov5675 = devm_kzalloc_obj(&client->dev, *ov5675); if (!ov5675) return -ENOMEM; diff --git a/drivers/media/i2c/ov5693.c b/drivers/media/i2c/ov5693.c index 56599f9ca74b..496c3cb58701 100644 --- a/drivers/media/i2c/ov5693.c +++ b/drivers/media/i2c/ov5693.c @@ -1298,7 +1298,7 @@ static int ov5693_probe(struct i2c_client *client) u32 xvclk_rate; int ret = 0; - ov5693 = devm_kzalloc(&client->dev, sizeof(*ov5693), GFP_KERNEL); + ov5693 = devm_kzalloc_obj(&client->dev, *ov5693); if (!ov5693) return -ENOMEM; diff --git a/drivers/media/i2c/ov5695.c b/drivers/media/i2c/ov5695.c index 5b23f04ab9f8..66cb56fbc367 100644 --- a/drivers/media/i2c/ov5695.c +++ b/drivers/media/i2c/ov5695.c @@ -1258,7 +1258,7 @@ static int ov5695_probe(struct i2c_client *client) struct v4l2_subdev *sd; int ret; - ov5695 = devm_kzalloc(dev, sizeof(*ov5695), GFP_KERNEL); + ov5695 = devm_kzalloc_obj(dev, *ov5695); if (!ov5695) return -ENOMEM; diff --git a/drivers/media/i2c/ov6211.c b/drivers/media/i2c/ov6211.c index 2ad31b2c5249..34d991eff347 100644 --- a/drivers/media/i2c/ov6211.c +++ b/drivers/media/i2c/ov6211.c @@ -659,7 +659,7 @@ static int ov6211_probe(struct i2c_client *client) unsigned int i; int ret; - ov6211 = devm_kzalloc(&client->dev, sizeof(*ov6211), GFP_KERNEL); + ov6211 = devm_kzalloc_obj(&client->dev, *ov6211); if (!ov6211) return -ENOMEM; diff --git a/drivers/media/i2c/ov64a40.c b/drivers/media/i2c/ov64a40.c index b369c002a25a..6fa7070a969d 100644 --- a/drivers/media/i2c/ov64a40.c +++ b/drivers/media/i2c/ov64a40.c @@ -3534,7 +3534,7 @@ static int ov64a40_probe(struct i2c_client *client) u32 xclk_freq; int ret; - ov64a40 = devm_kzalloc(&client->dev, sizeof(*ov64a40), GFP_KERNEL); + ov64a40 = devm_kzalloc_obj(&client->dev, *ov64a40); if (!ov64a40) return -ENOMEM; diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c index fce6344b5120..bd3927e3076a 100644 --- a/drivers/media/i2c/ov7251.c +++ b/drivers/media/i2c/ov7251.c @@ -1634,7 +1634,7 @@ static int ov7251_probe(struct i2c_client *client) int ret; int i; - ov7251 = devm_kzalloc(dev, sizeof(struct ov7251), GFP_KERNEL); + ov7251 = devm_kzalloc_obj(dev, struct ov7251); if (!ov7251) return -ENOMEM; diff --git a/drivers/media/i2c/ov7640.c b/drivers/media/i2c/ov7640.c index 0fd90bc67e29..648fa145dc10 100644 --- a/drivers/media/i2c/ov7640.c +++ b/drivers/media/i2c/ov7640.c @@ -50,7 +50,7 @@ static int ov7640_probe(struct i2c_client *client) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; - sd = devm_kzalloc(&client->dev, sizeof(*sd), GFP_KERNEL); + sd = devm_kzalloc_obj(&client->dev, *sd); if (sd == NULL) return -ENOMEM; v4l2_i2c_subdev_init(sd, client, &ov7640_ops); diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c index 5a553d50f3a3..1ba53c1bea93 100644 --- a/drivers/media/i2c/ov7670.c +++ b/drivers/media/i2c/ov7670.c @@ -1828,7 +1828,7 @@ static int ov7670_probe(struct i2c_client *client) struct ov7670_info *info; int ret; - info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&client->dev, *info); if (info == NULL) return -ENOMEM; sd = &info->sd; diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c index cb3f3f813837..83e6d20c52f8 100644 --- a/drivers/media/i2c/ov772x.c +++ b/drivers/media/i2c/ov772x.c @@ -1445,7 +1445,7 @@ static int ov772x_probe(struct i2c_client *client) return -EINVAL; } - priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&client->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c index c8a74ce39841..d1700d8109ea 100644 --- a/drivers/media/i2c/ov7740.c +++ b/drivers/media/i2c/ov7740.c @@ -1033,7 +1033,7 @@ static int ov7740_probe(struct i2c_client *client) struct v4l2_subdev *sd; int ret; - ov7740 = devm_kzalloc(&client->dev, sizeof(*ov7740), GFP_KERNEL); + ov7740 = devm_kzalloc_obj(&client->dev, *ov7740); if (!ov7740) return -ENOMEM; diff --git a/drivers/media/i2c/ov8856.c b/drivers/media/i2c/ov8856.c index 42c4b9c4e380..1c879e461fa5 100644 --- a/drivers/media/i2c/ov8856.c +++ b/drivers/media/i2c/ov8856.c @@ -2376,7 +2376,7 @@ static int ov8856_probe(struct i2c_client *client) int ret; bool full_power; - ov8856 = devm_kzalloc(&client->dev, sizeof(*ov8856), GFP_KERNEL); + ov8856 = devm_kzalloc_obj(&client->dev, *ov8856); if (!ov8856) return -ENOMEM; diff --git a/drivers/media/i2c/ov8858.c b/drivers/media/i2c/ov8858.c index 97448fa75a26..72e63c9a1d14 100644 --- a/drivers/media/i2c/ov8858.c +++ b/drivers/media/i2c/ov8858.c @@ -1874,7 +1874,7 @@ static int ov8858_probe(struct i2c_client *client) struct ov8858 *ov8858; int ret; - ov8858 = devm_kzalloc(dev, sizeof(*ov8858), GFP_KERNEL); + ov8858 = devm_kzalloc_obj(dev, *ov8858); if (!ov8858) return -ENOMEM; diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 5a59cca8eeae..c7dc97bf75f6 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2966,7 +2966,7 @@ static int ov8865_probe(struct i2c_client *client) unsigned int i; int ret; - sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index 3204e8d60809..039a47c1918c 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -1285,7 +1285,7 @@ static int ov9282_probe(struct i2c_client *client) struct ov9282 *ov9282; int ret; - ov9282 = devm_kzalloc(&client->dev, sizeof(*ov9282), GFP_KERNEL); + ov9282 = devm_kzalloc_obj(&client->dev, *ov9282); if (!ov9282) return -ENOMEM; diff --git a/drivers/media/i2c/ov9640.c b/drivers/media/i2c/ov9640.c index d24b3be1e0b6..5584cff75396 100644 --- a/drivers/media/i2c/ov9640.c +++ b/drivers/media/i2c/ov9640.c @@ -687,7 +687,7 @@ static int ov9640_probe(struct i2c_client *client) struct ov9640_priv *priv; int ret; - priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&client->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c index b596cfb2d7f3..34630a1555d7 100644 --- a/drivers/media/i2c/ov9650.c +++ b/drivers/media/i2c/ov9650.c @@ -1484,7 +1484,7 @@ static int ov965x_probe(struct i2c_client *client) .max_register = 0xab, }; - ov965x = devm_kzalloc(&client->dev, sizeof(*ov965x), GFP_KERNEL); + ov965x = devm_kzalloc_obj(&client->dev, *ov965x); if (!ov965x) return -ENOMEM; diff --git a/drivers/media/i2c/ov9734.c b/drivers/media/i2c/ov9734.c index 8f39609ad1b6..ea6248cf3f90 100644 --- a/drivers/media/i2c/ov9734.c +++ b/drivers/media/i2c/ov9734.c @@ -899,7 +899,7 @@ static int ov9734_probe(struct i2c_client *client) return ret; } - ov9734 = devm_kzalloc(&client->dev, sizeof(*ov9734), GFP_KERNEL); + ov9734 = devm_kzalloc_obj(&client->dev, *ov9734); if (!ov9734) return -ENOMEM; diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c index 0179508626b5..f8fbb83bd8eb 100644 --- a/drivers/media/i2c/rdacm20.c +++ b/drivers/media/i2c/rdacm20.c @@ -568,7 +568,7 @@ static int rdacm20_probe(struct i2c_client *client) struct rdacm20_device *dev; int ret; - dev = devm_kzalloc(&client->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&client->dev, *dev); if (!dev) return -ENOMEM; dev->dev = &client->dev; diff --git a/drivers/media/i2c/rdacm21.c b/drivers/media/i2c/rdacm21.c index 68d2b9d83c3c..a365604f1e64 100644 --- a/drivers/media/i2c/rdacm21.c +++ b/drivers/media/i2c/rdacm21.c @@ -544,7 +544,7 @@ static int rdacm21_probe(struct i2c_client *client) struct rdacm21_device *dev; int ret; - dev = devm_kzalloc(&client->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&client->dev, *dev); if (!dev) return -ENOMEM; dev->dev = &client->dev; diff --git a/drivers/media/i2c/rj54n1cb0c.c b/drivers/media/i2c/rj54n1cb0c.c index 211f890a9cbd..f33d4ee548fc 100644 --- a/drivers/media/i2c/rj54n1cb0c.c +++ b/drivers/media/i2c/rj54n1cb0c.c @@ -1318,7 +1318,7 @@ static int rj54n1_probe(struct i2c_client *client) return -EIO; } - rj54n1 = devm_kzalloc(&client->dev, sizeof(struct rj54n1), GFP_KERNEL); + rj54n1 = devm_kzalloc_obj(&client->dev, struct rj54n1); if (!rj54n1) return -ENOMEM; diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c index 680add1da244..fdbea5cff123 100644 --- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c +++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c @@ -1607,7 +1607,7 @@ static int s5c73m3_probe(struct i2c_client *client) struct s5c73m3 *state; int ret, i; - state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/media/i2c/s5k3m5.c b/drivers/media/i2c/s5k3m5.c index bdf5bea78685..eb08a386c0e1 100644 --- a/drivers/media/i2c/s5k3m5.c +++ b/drivers/media/i2c/s5k3m5.c @@ -1220,7 +1220,7 @@ static int s5k3m5_probe(struct i2c_client *client) unsigned int i; int ret; - s5k3m5 = devm_kzalloc(&client->dev, sizeof(*s5k3m5), GFP_KERNEL); + s5k3m5 = devm_kzalloc_obj(&client->dev, *s5k3m5); if (!s5k3m5) return -ENOMEM; diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c index b13c4754ec3c..9173590c5f4a 100644 --- a/drivers/media/i2c/s5k5baf.c +++ b/drivers/media/i2c/s5k5baf.c @@ -362,7 +362,7 @@ static int s5k5baf_fw_parse(struct device *dev, struct s5k5baf_fw **fw, data += S5K5BAG_FW_TAG_LEN; count -= S5K5BAG_FW_TAG_LEN; - d = devm_kcalloc(dev, count, sizeof(u16), GFP_KERNEL); + d = devm_kzalloc_objs(dev, u16, count); if (!d) return -ENOMEM; @@ -1932,7 +1932,7 @@ static int s5k5baf_probe(struct i2c_client *c) struct s5k5baf *state; int ret; - state = devm_kzalloc(&c->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&c->dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/media/i2c/s5k6a3.c b/drivers/media/i2c/s5k6a3.c index 071b31728a00..1f83e26fc75e 100644 --- a/drivers/media/i2c/s5k6a3.c +++ b/drivers/media/i2c/s5k6a3.c @@ -280,7 +280,7 @@ static int s5k6a3_probe(struct i2c_client *client) struct v4l2_subdev *sd; int i, ret; - sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/s5kjn1.c b/drivers/media/i2c/s5kjn1.c index 80d713ba3a1e..3b4d052572ca 100644 --- a/drivers/media/i2c/s5kjn1.c +++ b/drivers/media/i2c/s5kjn1.c @@ -1295,7 +1295,7 @@ static int s5kjn1_probe(struct i2c_client *client) unsigned long freq; int ret; - s5kjn1 = devm_kzalloc(&client->dev, sizeof(*s5kjn1), GFP_KERNEL); + s5kjn1 = devm_kzalloc_obj(&client->dev, *s5kjn1); if (!s5kjn1) return -ENOMEM; diff --git a/drivers/media/i2c/s5kjn5.c b/drivers/media/i2c/s5kjn5.c index 4709326a4017..f4bdbf27e0e6 100644 --- a/drivers/media/i2c/s5kjn5.c +++ b/drivers/media/i2c/s5kjn5.c @@ -2749,7 +2749,7 @@ static int s5kjn5_probe(struct i2c_client *client) unsigned int i; int ret; - s5kjn5 = devm_kzalloc(dev, sizeof(*s5kjn5), GFP_KERNEL); + s5kjn5 = devm_kzalloc_obj(dev, *s5kjn5); if (!s5kjn5) return -ENOMEM; diff --git a/drivers/media/i2c/saa6588.c b/drivers/media/i2c/saa6588.c index 56bfa3d2604b..0480dd3afd30 100644 --- a/drivers/media/i2c/saa6588.c +++ b/drivers/media/i2c/saa6588.c @@ -455,7 +455,7 @@ static int saa6588_probe(struct i2c_client *client) v4l_info(client, "saa6588 found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - s = devm_kzalloc(&client->dev, sizeof(*s), GFP_KERNEL); + s = devm_kzalloc_obj(&client->dev, *s); if (s == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/saa6752hs.c b/drivers/media/i2c/saa6752hs.c index 6e2a3e4a63f7..151d52757019 100644 --- a/drivers/media/i2c/saa6752hs.c +++ b/drivers/media/i2c/saa6752hs.c @@ -669,7 +669,7 @@ static int saa6752hs_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - h = devm_kzalloc(&client->dev, sizeof(*h), GFP_KERNEL); + h = devm_kzalloc_obj(&client->dev, *h); if (h == NULL) return -ENOMEM; sd = &h->sd; diff --git a/drivers/media/i2c/saa7110.c b/drivers/media/i2c/saa7110.c index 652058b8f766..419698d34bea 100644 --- a/drivers/media/i2c/saa7110.c +++ b/drivers/media/i2c/saa7110.c @@ -372,7 +372,7 @@ static int saa7110_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - decoder = devm_kzalloc(&client->dev, sizeof(*decoder), GFP_KERNEL); + decoder = devm_kzalloc_obj(&client->dev, *decoder); if (!decoder) return -ENOMEM; sd = &decoder->sd; diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c index 88b159418c7c..f4015f11367b 100644 --- a/drivers/media/i2c/saa7115.c +++ b/drivers/media/i2c/saa7115.c @@ -1826,7 +1826,7 @@ static int saa711x_probe(struct i2c_client *client) strscpy(client->name, name, sizeof(client->name)); - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (state == NULL) return -ENOMEM; sd = &state->sd; diff --git a/drivers/media/i2c/saa7127.c b/drivers/media/i2c/saa7127.c index fdf17f6fae67..625f2e353d2d 100644 --- a/drivers/media/i2c/saa7127.c +++ b/drivers/media/i2c/saa7127.c @@ -722,7 +722,7 @@ static int saa7127_probe(struct i2c_client *client) v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n", client->addr << 1); - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (state == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/saa717x.c b/drivers/media/i2c/saa717x.c index 367539667948..09f153a97fe5 100644 --- a/drivers/media/i2c/saa717x.c +++ b/drivers/media/i2c/saa717x.c @@ -1241,7 +1241,7 @@ static int saa717x_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - decoder = devm_kzalloc(&client->dev, sizeof(*decoder), GFP_KERNEL); + decoder = devm_kzalloc_obj(&client->dev, *decoder); if (decoder == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/saa7185.c b/drivers/media/i2c/saa7185.c index 8e5c0eab907d..a3884494df05 100644 --- a/drivers/media/i2c/saa7185.c +++ b/drivers/media/i2c/saa7185.c @@ -303,7 +303,7 @@ static int saa7185_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - encoder = devm_kzalloc(&client->dev, sizeof(*encoder), GFP_KERNEL); + encoder = devm_kzalloc_obj(&client->dev, *encoder); if (encoder == NULL) return -ENOMEM; encoder->norm = V4L2_STD_NTSC; diff --git a/drivers/media/i2c/sony-btf-mpx.c b/drivers/media/i2c/sony-btf-mpx.c index 4c87de0fe1f0..2384ff2ccb76 100644 --- a/drivers/media/i2c/sony-btf-mpx.c +++ b/drivers/media/i2c/sony-btf-mpx.c @@ -342,7 +342,7 @@ static int sony_btf_mpx_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - t = devm_kzalloc(&client->dev, sizeof(*t), GFP_KERNEL); + t = devm_kzalloc_obj(&client->dev, *t); if (t == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c index f9eabd9632d3..3dad80410bf9 100644 --- a/drivers/media/i2c/st-mipid02.c +++ b/drivers/media/i2c/st-mipid02.c @@ -808,7 +808,7 @@ static int mipid02_probe(struct i2c_client *client) u32 clk_freq; int ret; - bridge = devm_kzalloc(dev, sizeof(*bridge), GFP_KERNEL); + bridge = devm_kzalloc_obj(dev, *bridge); if (!bridge) return -ENOMEM; diff --git a/drivers/media/i2c/t4ka3.c b/drivers/media/i2c/t4ka3.c index 6506225683bb..a42ccb398480 100644 --- a/drivers/media/i2c/t4ka3.c +++ b/drivers/media/i2c/t4ka3.c @@ -961,7 +961,7 @@ static int t4ka3_probe(struct i2c_client *client) int ret; /* allocate sensor device & init sub device */ - sensor = devm_kzalloc(&client->dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(&client->dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index d9cd0563d50b..8590e024c859 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -2185,8 +2185,7 @@ static int tc358743_probe(struct i2c_client *client) v4l_dbg(1, debug, client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - state = devm_kzalloc(&client->dev, sizeof(struct tc358743_state), - GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, struct tc358743_state); if (!state) return -ENOMEM; diff --git a/drivers/media/i2c/tc358746.c b/drivers/media/i2c/tc358746.c index d55539c35a26..91d26a634023 100644 --- a/drivers/media/i2c/tc358746.c +++ b/drivers/media/i2c/tc358746.c @@ -1514,7 +1514,7 @@ static int tc358746_probe(struct i2c_client *client) unsigned int i; int err; - tc358746 = devm_kzalloc(&client->dev, sizeof(*tc358746), GFP_KERNEL); + tc358746 = devm_kzalloc_obj(&client->dev, *tc358746); if (!tc358746) return -ENOMEM; diff --git a/drivers/media/i2c/tda7432.c b/drivers/media/i2c/tda7432.c index a0b65a595ba8..9a0bdfd65f8e 100644 --- a/drivers/media/i2c/tda7432.c +++ b/drivers/media/i2c/tda7432.c @@ -351,7 +351,7 @@ static int tda7432_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%02x (%s)\n", client->addr << 1, client->adapter->name); - t = devm_kzalloc(&client->dev, sizeof(*t), GFP_KERNEL); + t = devm_kzalloc_obj(&client->dev, *t); if (!t) return -ENOMEM; sd = &t->sd; diff --git a/drivers/media/i2c/tda9840.c b/drivers/media/i2c/tda9840.c index b34d992777fb..866182b3ce77 100644 --- a/drivers/media/i2c/tda9840.c +++ b/drivers/media/i2c/tda9840.c @@ -162,7 +162,7 @@ static int tda9840_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - sd = devm_kzalloc(&client->dev, sizeof(*sd), GFP_KERNEL); + sd = devm_kzalloc_obj(&client->dev, *sd); if (sd == NULL) return -ENOMEM; v4l2_i2c_subdev_init(sd, client, &tda9840_ops); diff --git a/drivers/media/i2c/tea6415c.c b/drivers/media/i2c/tea6415c.c index ea7730a7ee2c..1a0ddc6f47b2 100644 --- a/drivers/media/i2c/tea6415c.c +++ b/drivers/media/i2c/tea6415c.c @@ -126,7 +126,7 @@ static int tea6415c_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - sd = devm_kzalloc(&client->dev, sizeof(*sd), GFP_KERNEL); + sd = devm_kzalloc_obj(&client->dev, *sd); if (sd == NULL) return -ENOMEM; v4l2_i2c_subdev_init(sd, client, &tea6415c_ops); diff --git a/drivers/media/i2c/tea6420.c b/drivers/media/i2c/tea6420.c index bebb9a8095db..149b382c264a 100644 --- a/drivers/media/i2c/tea6420.c +++ b/drivers/media/i2c/tea6420.c @@ -99,7 +99,7 @@ static int tea6420_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - sd = devm_kzalloc(&client->dev, sizeof(*sd), GFP_KERNEL); + sd = devm_kzalloc_obj(&client->dev, *sd); if (sd == NULL) return -ENOMEM; v4l2_i2c_subdev_init(sd, client, &tea6420_ops); diff --git a/drivers/media/i2c/thp7312.c b/drivers/media/i2c/thp7312.c index f1c7f149c06c..afe69058870f 100644 --- a/drivers/media/i2c/thp7312.c +++ b/drivers/media/i2c/thp7312.c @@ -2088,7 +2088,7 @@ static int thp7312_probe(struct i2c_client *client) struct thp7312_device *thp7312; int ret; - thp7312 = devm_kzalloc(dev, sizeof(*thp7312), GFP_KERNEL); + thp7312 = devm_kzalloc_obj(dev, *thp7312); if (!thp7312) return -ENOMEM; diff --git a/drivers/media/i2c/ths7303.c b/drivers/media/i2c/ths7303.c index e04da5519a39..b730db0c576d 100644 --- a/drivers/media/i2c/ths7303.c +++ b/drivers/media/i2c/ths7303.c @@ -335,8 +335,7 @@ static int ths7303_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - state = devm_kzalloc(&client->dev, sizeof(struct ths7303_state), - GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, struct ths7303_state); if (!state) return -ENOMEM; diff --git a/drivers/media/i2c/ths8200.c b/drivers/media/i2c/ths8200.c index 00535958faf1..9181c01c5968 100644 --- a/drivers/media/i2c/ths8200.c +++ b/drivers/media/i2c/ths8200.c @@ -440,7 +440,7 @@ static int ths8200_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/media/i2c/tlv320aic23b.c b/drivers/media/i2c/tlv320aic23b.c index 7deeef317714..2406173c69a3 100644 --- a/drivers/media/i2c/tlv320aic23b.c +++ b/drivers/media/i2c/tlv320aic23b.c @@ -141,7 +141,7 @@ static int tlv320aic23b_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (state == NULL) return -ENOMEM; sd = &state->sd; diff --git a/drivers/media/i2c/tvaudio.c b/drivers/media/i2c/tvaudio.c index f136310b899d..e0e2e2718c5f 100644 --- a/drivers/media/i2c/tvaudio.c +++ b/drivers/media/i2c/tvaudio.c @@ -1950,7 +1950,7 @@ static int tvaudio_probe(struct i2c_client *client) printk(KERN_CONT "\n"); } - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; sd = &chip->sd; diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c index 1e927896a4b3..4ac3c6e4bfcb 100644 --- a/drivers/media/i2c/tvp514x.c +++ b/drivers/media/i2c/tvp514x.c @@ -956,7 +956,7 @@ tvp514x_get_pdata(struct i2c_client *client) if (v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), &bus_cfg)) goto done; - pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&client->dev, *pdata); if (!pdata) goto done; @@ -992,7 +992,7 @@ static int tvp514x_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - decoder = devm_kzalloc(&client->dev, sizeof(*decoder), GFP_KERNEL); + decoder = devm_kzalloc_obj(&client->dev, *decoder); if (!decoder) return -ENOMEM; diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c index 91064f06f8c1..c8896247e7bd 100644 --- a/drivers/media/i2c/tvp5150.c +++ b/drivers/media/i2c/tvp5150.c @@ -2131,7 +2131,7 @@ static int tvp5150_probe(struct i2c_client *c) if (res) return res; - core = devm_kzalloc(&c->dev, sizeof(*core), GFP_KERNEL); + core = devm_kzalloc_obj(&c->dev, *core); if (!core) return -ENOMEM; diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c index ada28cb8af7c..e7fe17409058 100644 --- a/drivers/media/i2c/tvp7002.c +++ b/drivers/media/i2c/tvp7002.c @@ -911,7 +911,7 @@ tvp7002_get_pdata(struct i2c_client *client) if (v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), &bus_cfg)) goto done; - pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&client->dev, *pdata); if (!pdata) goto done; @@ -967,7 +967,7 @@ static int tvp7002_probe(struct i2c_client *c) I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) return -EIO; - device = devm_kzalloc(&c->dev, sizeof(struct tvp7002), GFP_KERNEL); + device = devm_kzalloc_obj(&c->dev, struct tvp7002); if (!device) return -ENOMEM; diff --git a/drivers/media/i2c/tw2804.c b/drivers/media/i2c/tw2804.c index 713e078ff3da..a1b3887592d0 100644 --- a/drivers/media/i2c/tw2804.c +++ b/drivers/media/i2c/tw2804.c @@ -354,7 +354,7 @@ static int tw2804_probe(struct i2c_client *client) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (state == NULL) return -ENOMEM; sd = &state->sd; diff --git a/drivers/media/i2c/tw9900.c b/drivers/media/i2c/tw9900.c index 60c102aba750..51db5d5ddbde 100644 --- a/drivers/media/i2c/tw9900.c +++ b/drivers/media/i2c/tw9900.c @@ -658,7 +658,7 @@ static int tw9900_probe(struct i2c_client *client) struct tw9900 *tw9900; int ret = 0; - tw9900 = devm_kzalloc(dev, sizeof(*tw9900), GFP_KERNEL); + tw9900 = devm_kzalloc_obj(dev, *tw9900); if (!tw9900) return -ENOMEM; diff --git a/drivers/media/i2c/tw9903.c b/drivers/media/i2c/tw9903.c index db063b885b09..d18ee453659f 100644 --- a/drivers/media/i2c/tw9903.c +++ b/drivers/media/i2c/tw9903.c @@ -202,7 +202,7 @@ static int tw9903_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%02x (%s)\n", client->addr << 1, client->adapter->name); - dec = devm_kzalloc(&client->dev, sizeof(*dec), GFP_KERNEL); + dec = devm_kzalloc_obj(&client->dev, *dec); if (dec == NULL) return -ENOMEM; sd = &dec->sd; diff --git a/drivers/media/i2c/tw9906.c b/drivers/media/i2c/tw9906.c index 079e2f49f38f..e717a2ed7998 100644 --- a/drivers/media/i2c/tw9906.c +++ b/drivers/media/i2c/tw9906.c @@ -170,7 +170,7 @@ static int tw9906_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%02x (%s)\n", client->addr << 1, client->adapter->name); - dec = devm_kzalloc(&client->dev, sizeof(*dec), GFP_KERNEL); + dec = devm_kzalloc_obj(&client->dev, *dec); if (dec == NULL) return -ENOMEM; sd = &dec->sd; diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c index 731c97a40c82..34f82b4bf755 100644 --- a/drivers/media/i2c/tw9910.c +++ b/drivers/media/i2c/tw9910.c @@ -944,7 +944,7 @@ static int tw9910_probe(struct i2c_client *client) return -EIO; } - priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&client->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/i2c/uda1342.c b/drivers/media/i2c/uda1342.c index 437726788ba0..9604d096cc63 100644 --- a/drivers/media/i2c/uda1342.c +++ b/drivers/media/i2c/uda1342.c @@ -56,7 +56,7 @@ static int uda1342_probe(struct i2c_client *client) dev_dbg(&client->dev, "initializing UDA1342 at address %d on %s\n", client->addr, adapter->name); - sd = devm_kzalloc(&client->dev, sizeof(*sd), GFP_KERNEL); + sd = devm_kzalloc_obj(&client->dev, *sd); if (sd == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/upd64031a.c b/drivers/media/i2c/upd64031a.c index 670118c16872..68b2694e1632 100644 --- a/drivers/media/i2c/upd64031a.c +++ b/drivers/media/i2c/upd64031a.c @@ -195,7 +195,7 @@ static int upd64031a_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (state == NULL) return -ENOMEM; sd = &state->sd; diff --git a/drivers/media/i2c/upd64083.c b/drivers/media/i2c/upd64083.c index e610dffa9e10..d378479698b6 100644 --- a/drivers/media/i2c/upd64083.c +++ b/drivers/media/i2c/upd64083.c @@ -166,7 +166,7 @@ static int upd64083_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (state == NULL) return -ENOMEM; sd = &state->sd; diff --git a/drivers/media/i2c/vd55g1.c b/drivers/media/i2c/vd55g1.c index e3939bb9bd44..3a3ce32b0610 100644 --- a/drivers/media/i2c/vd55g1.c +++ b/drivers/media/i2c/vd55g1.c @@ -1984,7 +1984,7 @@ static int vd55g1_probe(struct i2c_client *client) struct vd55g1 *sensor; int ret; - sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(dev, *sensor); if (!sensor) return -ENOMEM; sensor->dev = &client->dev; diff --git a/drivers/media/i2c/vd56g3.c b/drivers/media/i2c/vd56g3.c index ca0dd1b24072..a42210d0ab8d 100644 --- a/drivers/media/i2c/vd56g3.c +++ b/drivers/media/i2c/vd56g3.c @@ -1457,7 +1457,7 @@ static int vd56g3_probe(struct i2c_client *client) struct vd56g3 *sensor; int ret; - sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/vgxy61.c b/drivers/media/i2c/vgxy61.c index e7819691723d..c1eefc0827b9 100644 --- a/drivers/media/i2c/vgxy61.c +++ b/drivers/media/i2c/vgxy61.c @@ -1746,7 +1746,7 @@ static int vgxy61_probe(struct i2c_client *client) struct vgxy61_dev *sensor; int ret; - sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/media/i2c/vp27smpx.c b/drivers/media/i2c/vp27smpx.c index 21fcfdd4c163..a1991caead03 100644 --- a/drivers/media/i2c/vp27smpx.c +++ b/drivers/media/i2c/vp27smpx.c @@ -150,7 +150,7 @@ static int vp27smpx_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (state == NULL) return -ENOMEM; sd = &state->sd; diff --git a/drivers/media/i2c/vpx3220.c b/drivers/media/i2c/vpx3220.c index 29bcbb5a5fbb..5434c9bfd4b9 100644 --- a/drivers/media/i2c/vpx3220.c +++ b/drivers/media/i2c/vpx3220.c @@ -469,7 +469,7 @@ static int vpx3220_probe(struct i2c_client *client) I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) return -ENODEV; - decoder = devm_kzalloc(&client->dev, sizeof(*decoder), GFP_KERNEL); + decoder = devm_kzalloc_obj(&client->dev, *decoder); if (decoder == NULL) return -ENOMEM; sd = &decoder->sd; diff --git a/drivers/media/i2c/wm8739.c b/drivers/media/i2c/wm8739.c index 9eaf48f1c3a2..b864048f89f5 100644 --- a/drivers/media/i2c/wm8739.c +++ b/drivers/media/i2c/wm8739.c @@ -190,7 +190,7 @@ static int wm8739_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (state == NULL) return -ENOMEM; sd = &state->sd; diff --git a/drivers/media/i2c/wm8775.c b/drivers/media/i2c/wm8775.c index 5db197bb6fda..6179e7275bb1 100644 --- a/drivers/media/i2c/wm8775.c +++ b/drivers/media/i2c/wm8775.c @@ -209,7 +209,7 @@ static int wm8775_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%02x (%s)\n", client->addr << 1, client->adapter->name); - state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&client->dev, *state); if (state == NULL) return -ENOMEM; sd = &state->sd; diff --git a/drivers/media/pci/dt3155/dt3155.c b/drivers/media/pci/dt3155/dt3155.c index 660aab6b62e0..b6ff0a60861c 100644 --- a/drivers/media/pci/dt3155/dt3155.c +++ b/drivers/media/pci/dt3155/dt3155.c @@ -491,7 +491,7 @@ static int dt3155_probe(struct pci_dev *pdev, const struct pci_device_id *id) err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); if (err) return -ENODEV; - pd = devm_kzalloc(&pdev->dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(&pdev->dev, *pd); if (!pd) return -ENOMEM; diff --git a/drivers/media/pci/hws/hws_pci.c b/drivers/media/pci/hws/hws_pci.c index f06e60dc2ee6..89fb7ed85504 100644 --- a/drivers/media/pci/hws/hws_pci.c +++ b/drivers/media/pci/hws/hws_pci.c @@ -394,7 +394,7 @@ static int hws_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) bool v4l2_registered = false; /* devres-backed device object */ - hws = devm_kzalloc(&pdev->dev, sizeof(*hws), GFP_KERNEL); + hws = devm_kzalloc_obj(&pdev->dev, *hws); if (!hws) return -ENOMEM; diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c index 4d2b231291f5..ce8e22a2ef6d 100644 --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c @@ -1671,7 +1671,7 @@ static int cio2_pci_probe(struct pci_dev *pci_dev, if (r) return r; - cio2 = devm_kzalloc(dev, sizeof(*cio2), GFP_KERNEL); + cio2 = devm_kzalloc_obj(dev, *cio2); if (!cio2) return -ENOMEM; cio2->pci_dev = pci_dev; diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-subdev.c b/drivers/media/pci/intel/ipu6/ipu6-isys-subdev.c index 60070842ee68..6065e2c82794 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-isys-subdev.c +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-subdev.c @@ -350,8 +350,8 @@ int ipu6_isys_subdev_init(struct ipu6_isys_subdev *asd, asd->sd.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE; asd->sd.internal_ops = &ipu6_isys_subdev_internal_ops; - asd->pad = devm_kcalloc(&asd->isys->adev->auxdev.dev, num_pads, - sizeof(*asd->pad), GFP_KERNEL); + asd->pad = devm_kzalloc_objs(&asd->isys->adev->auxdev.dev, *asd->pad, + num_pads); if (!asd->pad) return -ENOMEM; diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys.c b/drivers/media/pci/intel/ipu6/ipu6-isys.c index 094a98e31c06..ff8c7f5b6077 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-isys.c +++ b/drivers/media/pci/intel/ipu6/ipu6-isys.c @@ -987,7 +987,7 @@ static int isys_probe(struct auxiliary_device *auxdev, if (!isp->bus_ready_to_probe) return -EPROBE_DEFER; - isys = devm_kzalloc(&auxdev->dev, sizeof(*isys), GFP_KERNEL); + isys = devm_kzalloc_obj(&auxdev->dev, *isys); if (!isys) return -ENOMEM; @@ -998,8 +998,8 @@ static int isys_probe(struct auxiliary_device *auxdev, isys->pdata = adev->pdata; csi2_pdata = &isys->pdata->ipdata->csi2; - isys->csi2 = devm_kcalloc(&auxdev->dev, csi2_pdata->nports, - sizeof(*isys->csi2), GFP_KERNEL); + isys->csi2 = devm_kzalloc_objs(&auxdev->dev, *isys->csi2, + csi2_pdata->nports); if (!isys->csi2) return -ENOMEM; diff --git a/drivers/media/pci/intel/ipu6/ipu6-mmu-hw.c b/drivers/media/pci/intel/ipu6/ipu6-mmu-hw.c index 2b395fbd5969..5a44c67ad7a0 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-mmu-hw.c +++ b/drivers/media/pci/intel/ipu6/ipu6-mmu-hw.c @@ -270,7 +270,7 @@ static int __ipu6_mmu_init_hw_data(struct ipu6_mmu *mmu, struct device *dev, src = lookup->hwdata; nr_mmus = lookup->nr_mmus; - mmu_hw = devm_kcalloc(dev, nr_mmus, sizeof(*mmu_hw), GFP_KERNEL); + mmu_hw = devm_kzalloc_objs(dev, *mmu_hw, nr_mmus); if (!mmu_hw) return -ENOMEM; diff --git a/drivers/media/pci/intel/ipu6/ipu6-mmu.c b/drivers/media/pci/intel/ipu6/ipu6-mmu.c index 1a564ceb7478..b9bc794759c5 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-mmu.c +++ b/drivers/media/pci/intel/ipu6/ipu6-mmu.c @@ -680,7 +680,7 @@ struct ipu6_mmu *ipu6_mmu_init(struct device *dev, struct ipu6_mmu *mmu; int ret; - mmu = devm_kzalloc(dev, sizeof(*mmu), GFP_KERNEL); + mmu = devm_kzalloc_obj(dev, *mmu); if (!mmu) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/pci/intel/ipu6/ipu6.c b/drivers/media/pci/intel/ipu6/ipu6.c index cdf812c02960..09e6d2a4e2a0 100644 --- a/drivers/media/pci/intel/ipu6/ipu6.c +++ b/drivers/media/pci/intel/ipu6/ipu6.c @@ -649,7 +649,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) id->device == PCI_DEVICE_ID_INTEL_IPU7P5) && force_no_probe_ipu7) return -ENODEV; - isp = devm_kzalloc(dev, sizeof(*isp), GFP_KERNEL); + isp = devm_kzalloc_obj(dev, *isp); if (!isp) return -ENOMEM; diff --git a/drivers/media/pci/intel/ipu6/ipu7-mmu-hw.c b/drivers/media/pci/intel/ipu6/ipu7-mmu-hw.c index d991f4d29e36..6e7939840e94 100644 --- a/drivers/media/pci/intel/ipu6/ipu7-mmu-hw.c +++ b/drivers/media/pci/intel/ipu6/ipu7-mmu-hw.c @@ -1088,7 +1088,7 @@ static int __ipu7_mmu_init_hw_data(struct ipu6_mmu *mmu, struct device *dev, src = lookup[mmu->mmid].hwdata; nr_mmus = lookup[mmu->mmid].nr_mmus; - mmu_hw = devm_kcalloc(dev, nr_mmus, sizeof(*mmu_hw), GFP_KERNEL); + mmu_hw = devm_kzalloc_objs(dev, *mmu_hw, nr_mmus); if (!mmu_hw) return -ENOMEM; diff --git a/drivers/media/pci/intel/ivsc/mei_ace.c b/drivers/media/pci/intel/ivsc/mei_ace.c index bb57656fc85a..45baa593f73f 100644 --- a/drivers/media/pci/intel/ivsc/mei_ace.c +++ b/drivers/media/pci/intel/ivsc/mei_ace.c @@ -463,7 +463,7 @@ static int mei_ace_probe(struct mei_cl_device *cldev, struct mei_ace *ace; int ret; - ace = devm_kzalloc(dev, sizeof(struct mei_ace), GFP_KERNEL); + ace = devm_kzalloc_obj(dev, struct mei_ace); if (!ace) return -ENOMEM; diff --git a/drivers/media/pci/intel/ivsc/mei_csi.c b/drivers/media/pci/intel/ivsc/mei_csi.c index 005b1414a252..4d509c08723d 100644 --- a/drivers/media/pci/intel/ivsc/mei_csi.c +++ b/drivers/media/pci/intel/ivsc/mei_csi.c @@ -659,7 +659,7 @@ static int mei_csi_probe(struct mei_cl_device *cldev, return -ENXIO; } - csi = devm_kzalloc(dev, sizeof(struct mei_csi), GFP_KERNEL); + csi = devm_kzalloc_obj(dev, struct mei_csi); if (!csi) return -ENOMEM; diff --git a/drivers/media/pci/pt3/pt3.c b/drivers/media/pci/pt3/pt3.c index 753161889092..838370d453b8 100644 --- a/drivers/media/pci/pt3/pt3.c +++ b/drivers/media/pci/pt3/pt3.c @@ -710,7 +710,7 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return ret; } - pt3 = devm_kzalloc(&pdev->dev, sizeof(*pt3), GFP_KERNEL); + pt3 = devm_kzalloc_obj(&pdev->dev, *pt3); if (!pt3) return -ENOMEM; pci_set_drvdata(pdev, pt3); @@ -736,7 +736,7 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pt3->num_bufs = clamp_val(num_bufs, MIN_DATA_BUFS, MAX_DATA_BUFS); - pt3->i2c_buf = devm_kmalloc(&pdev->dev, sizeof(*pt3->i2c_buf), GFP_KERNEL); + pt3->i2c_buf = devm_kmalloc_obj(&pdev->dev, *pt3->i2c_buf); if (!pt3->i2c_buf) return -ENOMEM; i2c = &pt3->i2c_adap; diff --git a/drivers/media/pci/tw5864/tw5864-core.c b/drivers/media/pci/tw5864/tw5864-core.c index 6ec8bce4ac4f..7e38900f71c3 100644 --- a/drivers/media/pci/tw5864/tw5864-core.c +++ b/drivers/media/pci/tw5864/tw5864-core.c @@ -244,7 +244,7 @@ static int tw5864_initdev(struct pci_dev *pci_dev, struct tw5864_dev *dev; int err; - dev = devm_kzalloc(&pci_dev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pci_dev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/media/pci/tw68/tw68-core.c b/drivers/media/pci/tw68/tw68-core.c index 0909b2d9fcdd..1263e26eced0 100644 --- a/drivers/media/pci/tw68/tw68-core.c +++ b/drivers/media/pci/tw68/tw68-core.c @@ -215,7 +215,7 @@ static int tw68_initdev(struct pci_dev *pci_dev, int vidnr = -1; int err; - dev = devm_kzalloc(&pci_dev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pci_dev->dev, *dev); if (NULL == dev) return -ENOMEM; diff --git a/drivers/media/pci/zoran/zoran_card.c b/drivers/media/pci/zoran/zoran_card.c index e5ff407318df..51a2de288107 100644 --- a/drivers/media/pci/zoran/zoran_card.c +++ b/drivers/media/pci/zoran/zoran_card.c @@ -1111,7 +1111,7 @@ static struct videocodec_master *zoran_setup_videocodec(struct zoran *zr, { struct videocodec_master *m = NULL; - m = devm_kmalloc(&zr->pci_dev->dev, sizeof(*m), GFP_KERNEL); + m = devm_kmalloc_obj(&zr->pci_dev->dev, *m); if (!m) return m; @@ -1249,7 +1249,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return -ENOENT; } - zr = devm_kzalloc(&pdev->dev, sizeof(*zr), GFP_KERNEL); + zr = devm_kzalloc_obj(&pdev->dev, *zr); if (!zr) return -ENOMEM; diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/media/platform/allegro-dvt/allegro-core.c index 4f3299a66b37..dc76986ce48d 100644 --- a/drivers/media/platform/allegro-dvt/allegro-core.c +++ b/drivers/media/platform/allegro-dvt/allegro-core.c @@ -802,7 +802,7 @@ static struct allegro_mbox *allegro_mbox_init(struct allegro_dev *dev, { struct allegro_mbox *mbox; - mbox = devm_kmalloc(&dev->plat_dev->dev, sizeof(*mbox), GFP_KERNEL); + mbox = devm_kmalloc_obj(&dev->plat_dev->dev, *mbox); if (!mbox) return ERR_PTR(-ENOMEM); @@ -3895,7 +3895,7 @@ static int allegro_probe(struct platform_device *pdev) int irq; void __iomem *regs, *sram_regs; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; dev->plat_dev = pdev; diff --git a/drivers/media/platform/amd/isp4/isp4.c b/drivers/media/platform/amd/isp4/isp4.c index bf6b8e26c2c0..e423861a0669 100644 --- a/drivers/media/platform/amd/isp4/isp4.c +++ b/drivers/media/platform/amd/isp4/isp4.c @@ -123,7 +123,7 @@ static int isp4_capture_probe(struct platform_device *pdev) struct isp4_device *isp_dev; int ret; - isp_dev = devm_kzalloc(dev, sizeof(*isp_dev), GFP_KERNEL); + isp_dev = devm_kzalloc_obj(dev, *isp_dev); if (!isp_dev) return -ENOMEM; diff --git a/drivers/media/platform/amlogic/c3/isp/c3-isp-dev.c b/drivers/media/platform/amlogic/c3/isp/c3-isp-dev.c index c3b779f63088..750dc43e5efc 100644 --- a/drivers/media/platform/amlogic/c3/isp/c3-isp-dev.c +++ b/drivers/media/platform/amlogic/c3/isp/c3-isp-dev.c @@ -315,7 +315,7 @@ static int c3_isp_probe(struct platform_device *pdev) int irq; int ret; - isp = devm_kzalloc(dev, sizeof(*isp), GFP_KERNEL); + isp = devm_kzalloc_obj(dev, *isp); if (!isp) return -ENOMEM; diff --git a/drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c b/drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c index 6f75112723b5..1ffb54221b5a 100644 --- a/drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c +++ b/drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c @@ -766,7 +766,7 @@ static int c3_mipi_adap_probe(struct platform_device *pdev) struct c3_adap_device *adap; int ret; - adap = devm_kzalloc(dev, sizeof(*adap), GFP_KERNEL); + adap = devm_kzalloc_obj(dev, *adap); if (!adap) return -ENOMEM; diff --git a/drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c b/drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c index 0c399665f7fa..b5e59e810e13 100644 --- a/drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c +++ b/drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c @@ -751,7 +751,7 @@ static int c3_mipi_csi_probe(struct platform_device *pdev) struct c3_csi_device *csi; int ret; - csi = devm_kzalloc(dev, sizeof(*csi), GFP_KERNEL); + csi = devm_kzalloc_obj(dev, *csi); if (!csi) return -ENOMEM; diff --git a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c b/drivers/media/platform/amlogic/meson-ge2d/ge2d.c index c5dc03905ce0..53fc70385b57 100644 --- a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c +++ b/drivers/media/platform/amlogic/meson-ge2d/ge2d.c @@ -925,7 +925,7 @@ static int ge2d_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - ge2d = devm_kzalloc(&pdev->dev, sizeof(*ge2d), GFP_KERNEL); + ge2d = devm_kzalloc_obj(&pdev->dev, *ge2d); if (!ge2d) return -ENOMEM; diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c index ad54f014d8f6..fc66569426d1 100644 --- a/drivers/media/platform/amphion/vpu_core.c +++ b/drivers/media/platform/amphion/vpu_core.c @@ -601,7 +601,7 @@ static int vpu_core_probe(struct platform_device *pdev) dev_dbg(dev, "probe\n"); if (!vpu) return -EINVAL; - core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); + core = devm_kzalloc_obj(dev, *core); if (!core) return -ENOMEM; @@ -644,7 +644,7 @@ static int vpu_core_probe(struct platform_device *pdev) if (ret) return ret; - iface = devm_kzalloc(dev, sizeof(*iface), GFP_KERNEL); + iface = devm_kzalloc_obj(dev, *iface); if (!iface) return -ENOMEM; diff --git a/drivers/media/platform/amphion/vpu_drv.c b/drivers/media/platform/amphion/vpu_drv.c index 9c6f32c5eae9..e3de5e9d503e 100644 --- a/drivers/media/platform/amphion/vpu_drv.c +++ b/drivers/media/platform/amphion/vpu_drv.c @@ -90,7 +90,7 @@ static int vpu_probe(struct platform_device *pdev) int ret; dev_dbg(dev, "probe\n"); - vpu = devm_kzalloc(dev, sizeof(*vpu), GFP_KERNEL); + vpu = devm_kzalloc_obj(dev, *vpu); if (!vpu) return -ENOMEM; diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-core.c b/drivers/media/platform/arm/mali-c55/mali-c55-core.c index 241a625f7284..b9bc41d863fa 100644 --- a/drivers/media/platform/arm/mali-c55/mali-c55-core.c +++ b/drivers/media/platform/arm/mali-c55/mali-c55-core.c @@ -785,7 +785,7 @@ static int mali_c55_probe(struct platform_device *pdev) struct resource *res; int ret; - mali_c55 = devm_kzalloc(dev, sizeof(*mali_c55), GFP_KERNEL); + mali_c55 = devm_kzalloc_obj(dev, *mali_c55); if (!mali_c55) return -ENOMEM; diff --git a/drivers/media/platform/aspeed/aspeed-video.c b/drivers/media/platform/aspeed/aspeed-video.c index 7ba9314fdbd2..95bb3b75d2f2 100644 --- a/drivers/media/platform/aspeed/aspeed-video.c +++ b/drivers/media/platform/aspeed/aspeed-video.c @@ -2310,7 +2310,7 @@ static int aspeed_video_probe(struct platform_device *pdev) struct aspeed_video *video; int rc; - video = devm_kzalloc(&pdev->dev, sizeof(*video), GFP_KERNEL); + video = devm_kzalloc_obj(&pdev->dev, *video); if (!video) return -ENOMEM; diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c index fa33d11f736f..08c65f68cd1e 100644 --- a/drivers/media/platform/atmel/atmel-isi.c +++ b/drivers/media/platform/atmel/atmel-isi.c @@ -1189,7 +1189,7 @@ static int atmel_isi_probe(struct platform_device *pdev) struct vb2_queue *q; int ret, i; - isi = devm_kzalloc(&pdev->dev, sizeof(struct atmel_isi), GFP_KERNEL); + isi = devm_kzalloc_obj(&pdev->dev, struct atmel_isi); if (!isi) return -ENOMEM; diff --git a/drivers/media/platform/chips-media/coda/coda-common.c b/drivers/media/platform/chips-media/coda/coda-common.c index be37ea568bfe..3fe33c4dc6ea 100644 --- a/drivers/media/platform/chips-media/coda/coda-common.c +++ b/drivers/media/platform/chips-media/coda/coda-common.c @@ -3149,7 +3149,7 @@ static int coda_probe(struct platform_device *pdev) struct coda_dev *dev; int ret, irq; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/media/platform/chips-media/coda/imx-vdoa.c b/drivers/media/platform/chips-media/coda/imx-vdoa.c index cd085c1c73f4..2113995e9680 100644 --- a/drivers/media/platform/chips-media/coda/imx-vdoa.c +++ b/drivers/media/platform/chips-media/coda/imx-vdoa.c @@ -291,7 +291,7 @@ static int vdoa_probe(struct platform_device *pdev) return ret; } - vdoa = devm_kzalloc(&pdev->dev, sizeof(*vdoa), GFP_KERNEL); + vdoa = devm_kzalloc_obj(&pdev->dev, *vdoa); if (!vdoa) return -ENOMEM; diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c index 86bc36ee17fd..180aac74884e 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c @@ -2028,7 +2028,7 @@ int wave5_vpu_dec_register_device(struct vpu_device *dev) if (dev->product_code == WAVE515_CODE) wave5_vdi_allocate_sram(dev); - vdev_dec = devm_kzalloc(dev->v4l2_dev.dev, sizeof(*vdev_dec), GFP_KERNEL); + vdev_dec = devm_kzalloc_obj(dev->v4l2_dev.dev, *vdev_dec); if (!vdev_dec) return -ENOMEM; diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c index f9fcdf4c224b..34ec681feb16 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c @@ -1831,7 +1831,7 @@ int wave5_vpu_enc_register_device(struct vpu_device *dev) struct video_device *vdev_enc; int ret; - vdev_enc = devm_kzalloc(dev->v4l2_dev.dev, sizeof(*vdev_enc), GFP_KERNEL); + vdev_enc = devm_kzalloc_obj(dev->v4l2_dev.dev, *vdev_enc); if (!vdev_enc) return -ENOMEM; diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu.c b/drivers/media/platform/chips-media/wave5/wave5-vpu.c index 37df270b5f99..c1757452efb5 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu.c @@ -278,7 +278,7 @@ static int wave5_vpu_probe(struct platform_device *pdev) return ret; } - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/media/platform/imagination/e5010-jpeg-enc.c b/drivers/media/platform/imagination/e5010-jpeg-enc.c index 420cb8bfdb12..09fc94797aaa 100644 --- a/drivers/media/platform/imagination/e5010-jpeg-enc.c +++ b/drivers/media/platform/imagination/e5010-jpeg-enc.c @@ -1024,7 +1024,7 @@ static int e5010_probe(struct platform_device *pdev) if (ret) return dev_err_probe(dev, ret, "32-bit consistent DMA enable failed\n"); - e5010 = devm_kzalloc(dev, sizeof(*e5010), GFP_KERNEL); + e5010 = devm_kzalloc_obj(dev, *e5010); if (!e5010) return -ENOMEM; diff --git a/drivers/media/platform/intel/pxa_camera.c b/drivers/media/platform/intel/pxa_camera.c index 9e1fdd963b55..982fc696bf8d 100644 --- a/drivers/media/platform/intel/pxa_camera.c +++ b/drivers/media/platform/intel/pxa_camera.c @@ -2277,7 +2277,7 @@ static int pxa_camera_probe(struct platform_device *pdev) if (irq < 0) return -ENODEV; - pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev), GFP_KERNEL); + pcdev = devm_kzalloc_obj(&pdev->dev, *pcdev); if (!pcdev) { dev_err(&pdev->dev, "Could not allocate pcdev\n"); return -ENOMEM; diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c index 6b0701861489..878733a9e3b2 100644 --- a/drivers/media/platform/m2m-deinterlace.c +++ b/drivers/media/platform/m2m-deinterlace.c @@ -913,7 +913,7 @@ static int deinterlace_probe(struct platform_device *pdev) dma_cap_mask_t mask; int ret = 0; - pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev), GFP_KERNEL); + pcdev = devm_kzalloc_obj(&pdev->dev, *pcdev); if (!pcdev) return -ENOMEM; diff --git a/drivers/media/platform/marvell/mmp-driver.c b/drivers/media/platform/marvell/mmp-driver.c index 4c31b62751a1..9ac393fd1875 100644 --- a/drivers/media/platform/marvell/mmp-driver.c +++ b/drivers/media/platform/marvell/mmp-driver.c @@ -185,7 +185,7 @@ static int mmpcam_probe(struct platform_device *pdev) struct v4l2_async_connection *asd; int ret; - cam = devm_kzalloc(&pdev->dev, sizeof(*cam), GFP_KERNEL); + cam = devm_kzalloc_obj(&pdev->dev, *cam); if (cam == NULL) return -ENOMEM; platform_set_drvdata(pdev, cam); diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c index deb515641521..e01dd4d80722 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -1296,7 +1296,7 @@ static int mtk_jpeg_probe(struct platform_device *pdev) int num_child = 0; int ret; - jpeg = devm_kzalloc(&pdev->dev, sizeof(*jpeg), GFP_KERNEL); + jpeg = devm_kzalloc_obj(&pdev->dev, *jpeg); if (!jpeg) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c index 32372781daf5..74df7fbad257 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c @@ -629,7 +629,7 @@ static int mtk_jpegdec_hw_probe(struct platform_device *pdev) if (!master_dev) return -EPROBE_DEFER; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c index b312a15d707b..cbea791e6326 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c @@ -352,7 +352,7 @@ static int mtk_jpegenc_hw_probe(struct platform_device *pdev) if (!master_dev) return -EPROBE_DEFER; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/mdp/mtk_mdp_core.c b/drivers/media/platform/mediatek/mdp/mtk_mdp_core.c index 8432833814f3..c065cdede7b0 100644 --- a/drivers/media/platform/mediatek/mdp/mtk_mdp_core.c +++ b/drivers/media/platform/mediatek/mdp/mtk_mdp_core.c @@ -110,7 +110,7 @@ static int mtk_mdp_probe(struct platform_device *pdev) struct mtk_mdp_comp *comp, *comp_temp; int ret = 0; - mdp = devm_kzalloc(dev, sizeof(*mdp), GFP_KERNEL); + mdp = devm_kzalloc_obj(dev, *mdp); if (!mdp) return -ENOMEM; @@ -149,7 +149,7 @@ static int mtk_mdp_probe(struct platform_device *pdev) comp_type = (uintptr_t)of_id->data; - comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL); + comp = devm_kzalloc_obj(dev, *comp); if (!comp) { ret = -ENOMEM; of_node_put(node); diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c index acb2758a7b42..5b0d71ee64e8 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c @@ -1826,7 +1826,7 @@ static struct mdp_comp *mdp_comp_create(struct mdp_dev *mdp, if (mdp->comp[id]) return ERR_PTR(-EEXIST); - comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL); + comp = devm_kzalloc_obj(dev, *comp); if (!comp) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c index 1b0bc47355c0..0e7d832d4071 100644 --- a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c @@ -78,7 +78,7 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use return ERR_PTR(-EPROBE_DEFER); } - fw = devm_kzalloc(&plat_dev->dev, sizeof(*fw), GFP_KERNEL); + fw = devm_kzalloc_obj(&plat_dev->dev, *fw); if (!fw) { scp_put(scp); return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c index 3632037f78f5..281dba2ed928 100644 --- a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c @@ -118,7 +118,7 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_use else vpu_wdt_reg_handler(fw_pdev, mtk_vcodec_vpu_reset_enc_handler, priv, rst_id); - fw = devm_kzalloc(&plat_dev->dev, sizeof(*fw), GFP_KERNEL); + fw = devm_kzalloc_obj(&plat_dev->dev, *fw); if (!fw) { put_device(&fw_pdev->dev); return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c index 426d060d937c..b4648ff6d818 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c @@ -359,7 +359,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) enum mtk_vcodec_fw_type fw_type; int i, ret; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c index 881d5de41e05..fa0e13145252 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c @@ -137,7 +137,7 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev) return -EINVAL; } - subdev_dev = devm_kzalloc(dev, sizeof(*subdev_dev), GFP_KERNEL); + subdev_dev = devm_kzalloc_obj(dev, *subdev_dev); if (!subdev_dev) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_pm.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_pm.c index f6f03c61c643..081a66efb814 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_pm.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_pm.c @@ -24,9 +24,8 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm * dec_clk->clk_num = of_property_count_strings(pdev->dev.of_node, "clock-names"); if (dec_clk->clk_num > 0) { - dec_clk->clk_info = devm_kcalloc(&pdev->dev, - dec_clk->clk_num, sizeof(*clk_info), - GFP_KERNEL); + dec_clk->clk_info = devm_kzalloc_objs(&pdev->dev, *clk_info, + dec_clk->clk_num); if (!dec_clk->clk_info) return -ENOMEM; } else { diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c index 4e4541b2fc8e..3b8bb1f2118d 100644 --- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c @@ -249,7 +249,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) enum mtk_vcodec_fw_type fw_type; int ret; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c index edf9133c0673..ad498d44a763 100644 --- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c @@ -28,9 +28,8 @@ int mtk_vcodec_init_enc_clk(struct mtk_vcodec_enc_dev *mtkdev) enc_clk->clk_num = of_property_count_strings(pdev->dev.of_node, "clock-names"); if (enc_clk->clk_num > 0) { - enc_clk->clk_info = devm_kcalloc(&pdev->dev, - enc_clk->clk_num, sizeof(*clk_info), - GFP_KERNEL); + enc_clk->clk_info = devm_kzalloc_objs(&pdev->dev, *clk_info, + enc_clk->clk_num); if (!enc_clk->clk_info) return -ENOMEM; } else { diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.c b/drivers/media/platform/mediatek/vpu/mtk_vpu.c index 437ad492374f..5db903c28878 100644 --- a/drivers/media/platform/mediatek/vpu/mtk_vpu.c +++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.c @@ -817,7 +817,7 @@ static int mtk_vpu_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "initialization\n"); dev = &pdev->dev; - vpu = devm_kzalloc(dev, sizeof(*vpu), GFP_KERNEL); + vpu = devm_kzalloc_obj(dev, *vpu); if (!vpu) return -ENOMEM; diff --git a/drivers/media/platform/microchip/microchip-csi2dc.c b/drivers/media/platform/microchip/microchip-csi2dc.c index 0368f3e80c0c..31c06b63902a 100644 --- a/drivers/media/platform/microchip/microchip-csi2dc.c +++ b/drivers/media/platform/microchip/microchip-csi2dc.c @@ -653,7 +653,7 @@ static int csi2dc_probe(struct platform_device *pdev) int ret = 0; u32 ver; - csi2dc = devm_kzalloc(dev, sizeof(*csi2dc), GFP_KERNEL); + csi2dc = devm_kzalloc_obj(dev, *csi2dc); if (!csi2dc) return -ENOMEM; diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/drivers/media/platform/microchip/microchip-sama5d2-isc.c index 5e41eee45dbd..1d029b2dbe06 100644 --- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c +++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c @@ -373,8 +373,7 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc) goto err_cleanup; } - subdev_entity = devm_kzalloc(dev, sizeof(*subdev_entity), - GFP_KERNEL); + subdev_entity = devm_kzalloc_obj(dev, *subdev_entity); if (!subdev_entity) { of_node_put(epn); ret = -ENOMEM; @@ -418,7 +417,7 @@ static int microchip_isc_probe(struct platform_device *pdev) int ret; u32 ver; - isc = devm_kzalloc(dev, sizeof(*isc), GFP_KERNEL); + isc = devm_kzalloc_obj(dev, *isc); if (!isc) return -ENOMEM; diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c index 9e78ea07b013..43f718303a68 100644 --- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c +++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c @@ -359,8 +359,7 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc) goto err_cleanup; } - subdev_entity = devm_kzalloc(dev, sizeof(*subdev_entity), - GFP_KERNEL); + subdev_entity = devm_kzalloc_obj(dev, *subdev_entity); if (!subdev_entity) { of_node_put(epn); ret = -ENOMEM; @@ -407,7 +406,7 @@ static int microchip_xisc_probe(struct platform_device *pdev) int ret; u32 ver; - isc = devm_kzalloc(dev, sizeof(*isc), GFP_KERNEL); + isc = devm_kzalloc_obj(dev, *isc); if (!isc) return -ENOMEM; diff --git a/drivers/media/platform/nvidia/tegra-vde/vde.c b/drivers/media/platform/nvidia/tegra-vde/vde.c index c3097085ad9d..878a5b37846c 100644 --- a/drivers/media/platform/nvidia/tegra-vde/vde.c +++ b/drivers/media/platform/nvidia/tegra-vde/vde.c @@ -229,7 +229,7 @@ static int tegra_vde_probe(struct platform_device *pdev) struct tegra_vde *vde; int irq, err; - vde = devm_kzalloc(dev, sizeof(*vde), GFP_KERNEL); + vde = devm_kzalloc_obj(dev, *vde); if (!vde) return -ENOMEM; diff --git a/drivers/media/platform/nxp/dw100/dw100.c b/drivers/media/platform/nxp/dw100/dw100.c index 7787fdcdc67c..847a538003d2 100644 --- a/drivers/media/platform/nxp/dw100/dw100.c +++ b/drivers/media/platform/nxp/dw100/dw100.c @@ -1566,7 +1566,7 @@ static int dw100_probe(struct platform_device *pdev) struct video_device *vfd; int ret, irq; - dw_dev = devm_kzalloc(&pdev->dev, sizeof(*dw_dev), GFP_KERNEL); + dw_dev = devm_kzalloc_obj(&pdev->dev, *dw_dev); if (!dw_dev) return -ENOMEM; dw_dev->pdev = pdev; diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index e17085935435..6054cd595f09 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -2874,13 +2874,12 @@ static int mxc_jpeg_attach_pm_domains(struct mxc_jpeg_dev *jpeg) return 0; } - jpeg->pd_dev = devm_kmalloc_array(dev, jpeg->num_domains, - sizeof(*jpeg->pd_dev), GFP_KERNEL); + jpeg->pd_dev = devm_kmalloc_objs(dev, *jpeg->pd_dev, jpeg->num_domains); if (!jpeg->pd_dev) return -ENOMEM; - jpeg->pd_link = devm_kmalloc_array(dev, jpeg->num_domains, - sizeof(*jpeg->pd_link), GFP_KERNEL); + jpeg->pd_link = devm_kmalloc_objs(dev, *jpeg->pd_link, + jpeg->num_domains); if (!jpeg->pd_link) return -ENOMEM; @@ -2928,7 +2927,7 @@ static int mxc_jpeg_probe(struct platform_device *pdev) return -ENODEV; mode = *(const int *)of_id->data; - jpeg = devm_kzalloc(dev, sizeof(struct mxc_jpeg_dev), GFP_KERNEL); + jpeg = devm_kzalloc_obj(dev, struct mxc_jpeg_dev); if (!jpeg) return -ENOMEM; diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c index 1b9012dbae39..080e65808d74 100644 --- a/drivers/media/platform/nxp/imx-mipi-csis.c +++ b/drivers/media/platform/nxp/imx-mipi-csis.c @@ -730,8 +730,8 @@ static int mipi_csis_clk_get(struct mipi_csis_device *csis) unsigned int i; int ret; - csis->clks = devm_kcalloc(csis->dev, csis->info->num_clocks, - sizeof(*csis->clks), GFP_KERNEL); + csis->clks = devm_kzalloc_objs(csis->dev, *csis->clks, + csis->info->num_clocks); if (!csis->clks) return -ENOMEM; @@ -1507,7 +1507,7 @@ static int mipi_csis_probe(struct platform_device *pdev) int irq; int ret; - csis = devm_kzalloc(dev, sizeof(*csis), GFP_KERNEL); + csis = devm_kzalloc_obj(dev, *csis); if (!csis) return -ENOMEM; diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/nxp/imx-pxp.c index 740fcd8fb952..abad39d74808 100644 --- a/drivers/media/platform/nxp/imx-pxp.c +++ b/drivers/media/platform/nxp/imx-pxp.c @@ -1777,7 +1777,7 @@ static int pxp_probe(struct platform_device *pdev) int ret; void __iomem *mmio; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c index f06b03967aef..c6eb4cd5b0b5 100644 --- a/drivers/media/platform/nxp/imx7-media-csi.c +++ b/drivers/media/platform/nxp/imx7-media-csi.c @@ -2208,7 +2208,7 @@ static int imx7_csi_probe(struct platform_device *pdev) struct imx7_csi *csi; int ret; - csi = devm_kzalloc(&pdev->dev, sizeof(*csi), GFP_KERNEL); + csi = devm_kzalloc_obj(&pdev->dev, *csi); if (!csi) return -ENOMEM; diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c index 0ae5f35e017c..2005584a1215 100644 --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c @@ -479,7 +479,7 @@ static int mxc_isi_probe(struct platform_device *pdev) unsigned int i; int ret = 0; - isi = devm_kzalloc(dev, sizeof(*isi), GFP_KERNEL); + isi = devm_kzalloc_obj(dev, *isi); if (!isi) return -ENOMEM; diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c index 17756b7fe1dd..2ad8a5512709 100644 --- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c +++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c @@ -979,7 +979,7 @@ static int imx8mq_mipi_csi_probe(struct platform_device *pdev) struct csi_state *state; int ret; - state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/media/platform/nxp/imx95-csi-formatter.c b/drivers/media/platform/nxp/imx95-csi-formatter.c index 37dfcefbf0d1..19995a809909 100644 --- a/drivers/media/platform/nxp/imx95-csi-formatter.c +++ b/drivers/media/platform/nxp/imx95-csi-formatter.c @@ -671,7 +671,7 @@ static int csi_formatter_probe(struct platform_device *pdev) struct csi_formatter *formatter; int ret; - formatter = devm_kzalloc(dev, sizeof(*formatter), GFP_KERNEL); + formatter = devm_kzalloc_obj(dev, *formatter); if (!formatter) return -ENOMEM; diff --git a/drivers/media/platform/nxp/mx2_emmaprp.c b/drivers/media/platform/nxp/mx2_emmaprp.c index d51a62100778..f31c19f9733e 100644 --- a/drivers/media/platform/nxp/mx2_emmaprp.c +++ b/drivers/media/platform/nxp/mx2_emmaprp.c @@ -801,7 +801,7 @@ static int emmaprp_probe(struct platform_device *pdev) struct video_device *vfd; int irq, ret; - pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev), GFP_KERNEL); + pcdev = devm_kzalloc_obj(&pdev->dev, *pcdev); if (!pcdev) return -ENOMEM; diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c index a00791b00feb..51f20907ffde 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -1154,8 +1154,7 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid, while (res->clock[csid->nclocks]) csid->nclocks++; - csid->clock = devm_kcalloc(dev, csid->nclocks, sizeof(*csid->clock), - GFP_KERNEL); + csid->clock = devm_kzalloc_objs(dev, *csid->clock, csid->nclocks); if (!csid->clock) return -ENOMEM; @@ -1177,10 +1176,8 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid, continue; } - clock->freq = devm_kcalloc(dev, - clock->nfreqs, - sizeof(*clock->freq), - GFP_KERNEL); + clock->freq = devm_kzalloc_objs(dev, *clock->freq, + clock->nfreqs); if (!clock->freq) return -ENOMEM; diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c index dac8d2ecf799..638f77263d76 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c @@ -1208,7 +1208,7 @@ static int csiphy_init(struct csiphy_device *csiphy) struct device *dev = csiphy->camss->dev; struct csiphy_device_regs *regs; - regs = devm_kmalloc(dev, sizeof(*regs), GFP_KERNEL); + regs = devm_kmalloc_obj(dev, *regs); if (!regs) return -ENOMEM; diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c index f99eea2ef228..cdb803843792 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -729,16 +729,12 @@ int msm_csiphy_subdev_init_legacy(struct camss *camss, while (res->clock[csiphy->nclocks]) csiphy->nclocks++; - csiphy->clock = devm_kcalloc(dev, - csiphy->nclocks, sizeof(*csiphy->clock), - GFP_KERNEL); + csiphy->clock = devm_kzalloc_objs(dev, *csiphy->clock, csiphy->nclocks); if (!csiphy->clock) return -ENOMEM; - csiphy->rate_set = devm_kcalloc(dev, - csiphy->nclocks, - sizeof(*csiphy->rate_set), - GFP_KERNEL); + csiphy->rate_set = devm_kzalloc_objs(dev, *csiphy->rate_set, + csiphy->nclocks); if (!csiphy->rate_set) return -ENOMEM; @@ -760,10 +756,8 @@ int msm_csiphy_subdev_init_legacy(struct camss *camss, continue; } - clock->freq = devm_kcalloc(dev, - clock->nfreqs, - sizeof(*clock->freq), - GFP_KERNEL); + clock->freq = devm_kzalloc_objs(dev, *clock->freq, + clock->nfreqs); if (!clock->freq) return -ENOMEM; diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/media/platform/qcom/camss/camss-ispif.c index f266f8532ecc..4f08c6de43c6 100644 --- a/drivers/media/platform/qcom/camss/camss-ispif.c +++ b/drivers/media/platform/qcom/camss/camss-ispif.c @@ -1122,8 +1122,7 @@ int msm_ispif_subdev_init(struct camss *camss, else return -EINVAL; - ispif->line = devm_kcalloc(dev, ispif->line_num, - sizeof(*ispif->line), GFP_KERNEL); + ispif->line = devm_kzalloc_objs(dev, *ispif->line, ispif->line_num); if (!ispif->line) return -ENOMEM; @@ -1189,9 +1188,7 @@ int msm_ispif_subdev_init(struct camss *camss, while (res->clock[ispif->nclocks]) ispif->nclocks++; - ispif->clock = devm_kcalloc(dev, - ispif->nclocks, sizeof(*ispif->clock), - GFP_KERNEL); + ispif->clock = devm_kzalloc_objs(dev, *ispif->clock, ispif->nclocks); if (!ispif->clock) return -ENOMEM; @@ -1210,10 +1207,8 @@ int msm_ispif_subdev_init(struct camss *camss, while (res->clock_for_reset[ispif->nclocks_for_reset]) ispif->nclocks_for_reset++; - ispif->clock_for_reset = devm_kcalloc(dev, - ispif->nclocks_for_reset, - sizeof(*ispif->clock_for_reset), - GFP_KERNEL); + ispif->clock_for_reset = devm_kzalloc_objs(dev, *ispif->clock_for_reset, + ispif->nclocks_for_reset); if (!ispif->clock_for_reset) return -ENOMEM; diff --git a/drivers/media/platform/qcom/camss/camss-tpg.c b/drivers/media/platform/qcom/camss/camss-tpg.c index 5764a60fa34c..3caa95819b39 100644 --- a/drivers/media/platform/qcom/camss/camss-tpg.c +++ b/drivers/media/platform/qcom/camss/camss-tpg.c @@ -372,8 +372,7 @@ int msm_tpg_subdev_init(struct camss *camss, if (!tpg->nclocks) return 0; - tpg->clock = devm_kcalloc(dev, tpg->nclocks, - sizeof(*tpg->clock), GFP_KERNEL); + tpg->clock = devm_kzalloc_objs(dev, *tpg->clock, tpg->nclocks); if (!tpg->clock) return -ENOMEM; @@ -395,8 +394,8 @@ int msm_tpg_subdev_init(struct camss *camss, continue; } - clock->freq = devm_kcalloc(dev, clock->nfreqs, - sizeof(*clock->freq), GFP_KERNEL); + clock->freq = devm_kzalloc_objs(dev, *clock->freq, + clock->nfreqs); if (!clock->freq) return -ENOMEM; diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index 2680a9914765..ad09593f5802 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -1863,8 +1863,7 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, while (res->clock[vfe->nclocks]) vfe->nclocks++; - vfe->clock = devm_kcalloc(dev, vfe->nclocks, sizeof(*vfe->clock), - GFP_KERNEL); + vfe->clock = devm_kzalloc_objs(dev, *vfe->clock, vfe->nclocks); if (!vfe->clock) return -ENOMEM; @@ -1886,10 +1885,8 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, continue; } - clock->freq = devm_kcalloc(dev, - clock->nfreqs, - sizeof(*clock->freq), - GFP_KERNEL); + clock->freq = devm_kzalloc_objs(dev, *clock->freq, + clock->nfreqs); if (!clock->freq) return -ENOMEM; diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index c54185c93a8a..f8e5cf9f3ff0 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -4710,9 +4710,7 @@ static int camss_parse_endpoint_node(struct device *dev, lncfg->clk.pol = mipi_csi2->lane_polarities[0]; lncfg->num_data = mipi_csi2->num_data_lanes; - lncfg->data = devm_kcalloc(dev, - lncfg->num_data, sizeof(*lncfg->data), - GFP_KERNEL); + lncfg->data = devm_kzalloc_objs(dev, *lncfg->data, lncfg->num_data); if (!lncfg->data) return -ENOMEM; @@ -5419,7 +5417,7 @@ static int camss_probe(struct platform_device *pdev) struct camss *camss; int ret; - camss = devm_kzalloc(dev, sizeof(*camss), GFP_KERNEL); + camss = devm_kzalloc_obj(dev, *camss); if (!camss) return -ENOMEM; @@ -5429,20 +5427,19 @@ static int camss_probe(struct platform_device *pdev) camss->dev = dev; platform_set_drvdata(pdev, camss); - camss->csiphy = devm_kcalloc(dev, camss->res->csiphy_num, - sizeof(*camss->csiphy), GFP_KERNEL); + camss->csiphy = devm_kzalloc_objs(dev, *camss->csiphy, + camss->res->csiphy_num); if (!camss->csiphy) return -ENOMEM; if (camss->res->tpg_num > 0) { - camss->tpg = devm_kcalloc(dev, camss->res->tpg_num, - sizeof(*camss->tpg), GFP_KERNEL); + camss->tpg = devm_kzalloc_objs(dev, *camss->tpg, + camss->res->tpg_num); if (!camss->tpg) return -ENOMEM; } - camss->csid = devm_kcalloc(dev, camss->res->csid_num, sizeof(*camss->csid), - GFP_KERNEL); + camss->csid = devm_kzalloc_objs(dev, *camss->csid, camss->res->csid_num); if (!camss->csid) return -ENOMEM; @@ -5450,13 +5447,12 @@ static int camss_probe(struct platform_device *pdev) camss->res->version == CAMSS_8x39 || camss->res->version == CAMSS_8x53 || camss->res->version == CAMSS_8x96) { - camss->ispif = devm_kcalloc(dev, 1, sizeof(*camss->ispif), GFP_KERNEL); + camss->ispif = devm_kzalloc_objs(dev, *camss->ispif, 1); if (!camss->ispif) return -ENOMEM; } - camss->vfe = devm_kcalloc(dev, camss->res->vfe_num, - sizeof(*camss->vfe), GFP_KERNEL); + camss->vfe = devm_kzalloc_objs(dev, *camss->vfe, camss->res->vfe_num); if (!camss->vfe) return -ENOMEM; diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c index 41dec90f3e2b..343e44c6b9c4 100644 --- a/drivers/media/platform/qcom/iris/iris_probe.c +++ b/drivers/media/platform/qcom/iris/iris_probe.c @@ -167,7 +167,7 @@ static int iris_reserve_iova_region(struct device *dev, struct dma_iova_state ** unsigned int count = 0; int ret = -ENOMEM; - state = devm_kcalloc(dev, BITS_PER_TYPE(dma_addr_t) + 1, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_objs(dev, *state, BITS_PER_TYPE(dma_addr_t) + 1); if (!state) return ret; @@ -281,7 +281,7 @@ static int iris_probe(struct platform_device *pdev) u64 dma_mask; int ret; - core = devm_kzalloc(&pdev->dev, sizeof(*core), GFP_KERNEL); + core = devm_kzalloc_obj(&pdev->dev, *core); if (!core) return -ENOMEM; core->dev = dev; diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 7087af32060f..ad10d9746d1d 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -394,7 +394,7 @@ static int venus_reserve_iova_region(struct device *dev, struct dma_iova_state * unsigned int count = 0; int ret = -ENOMEM; - state = devm_kcalloc(dev, BITS_PER_TYPE(dma_addr_t) + 1, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_objs(dev, *state, BITS_PER_TYPE(dma_addr_t) + 1); if (!state) return ret; @@ -434,7 +434,7 @@ static int venus_probe(struct platform_device *pdev) struct venus_core *core; int ret; - core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); + core = devm_kzalloc_obj(dev, *core); if (!core) return -ENOMEM; diff --git a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c index c4a187a928d3..8fb723029977 100644 --- a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c +++ b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c @@ -1686,7 +1686,7 @@ static int pispbe_probe(struct platform_device *pdev) struct pispbe_dev *pispbe; int ret; - pispbe = devm_kzalloc(&pdev->dev, sizeof(*pispbe), GFP_KERNEL); + pispbe = devm_kzalloc_obj(&pdev->dev, *pispbe); if (!pispbe) return -ENOMEM; diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c index 4851fe649d8a..12238b3313ba 100644 --- a/drivers/media/platform/renesas/rcar-csi2.c +++ b/drivers/media/platform/renesas/rcar-csi2.c @@ -2767,7 +2767,7 @@ static int rcsi2_probe(struct platform_device *pdev) unsigned int i, num_pads; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/platform/renesas/rcar-fcp.c b/drivers/media/platform/renesas/rcar-fcp.c index dfb0ca93e854..213b8802a454 100644 --- a/drivers/media/platform/renesas/rcar-fcp.c +++ b/drivers/media/platform/renesas/rcar-fcp.c @@ -156,7 +156,7 @@ static int rcar_fcp_probe(struct platform_device *pdev) { struct rcar_fcp_device *fcp; - fcp = devm_kzalloc(&pdev->dev, sizeof(*fcp), GFP_KERNEL); + fcp = devm_kzalloc_obj(&pdev->dev, *fcp); if (fcp == NULL) return -ENOMEM; diff --git a/drivers/media/platform/renesas/rcar-isp/csisp.c b/drivers/media/platform/renesas/rcar-isp/csisp.c index 635eeacb3b19..5d19391bbf25 100644 --- a/drivers/media/platform/renesas/rcar-isp/csisp.c +++ b/drivers/media/platform/renesas/rcar-isp/csisp.c @@ -645,7 +645,7 @@ static int risp_probe(struct platform_device *pdev) unsigned int i; int ret; - isp = devm_kzalloc(&pdev->dev, sizeof(*isp), GFP_KERNEL); + isp = devm_kzalloc_obj(&pdev->dev, *isp); if (!isp) return -ENOMEM; diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c index 2fcea715101c..1cc1f6d266b8 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c @@ -1180,7 +1180,7 @@ static int rcar_vin_probe(struct platform_device *pdev) struct rvin_dev *vin; int irq, ret; - vin = devm_kzalloc(&pdev->dev, sizeof(*vin), GFP_KERNEL); + vin = devm_kzalloc_obj(&pdev->dev, *vin); if (!vin) return -ENOMEM; diff --git a/drivers/media/platform/renesas/rcar_drif.c b/drivers/media/platform/renesas/rcar_drif.c index bd67e8e16f53..9c8129f340e3 100644 --- a/drivers/media/platform/renesas/rcar_drif.c +++ b/drivers/media/platform/renesas/rcar_drif.c @@ -1375,7 +1375,7 @@ static int rcar_drif_probe(struct platform_device *pdev) int ret; /* Reserve memory for enabled channel */ - ch = devm_kzalloc(&pdev->dev, sizeof(*ch), GFP_KERNEL); + ch = devm_kzalloc_obj(&pdev->dev, *ch); if (!ch) return -ENOMEM; @@ -1409,7 +1409,7 @@ static int rcar_drif_probe(struct platform_device *pdev) } /* Reserve memory for SDR structure */ - sdr = devm_kzalloc(&pdev->dev, sizeof(*sdr), GFP_KERNEL); + sdr = devm_kzalloc_obj(&pdev->dev, *sdr); if (!sdr) { of_node_put(np); return -ENOMEM; diff --git a/drivers/media/platform/renesas/rcar_fdp1.c b/drivers/media/platform/renesas/rcar_fdp1.c index 013e0666170a..460fa99582da 100644 --- a/drivers/media/platform/renesas/rcar_fdp1.c +++ b/drivers/media/platform/renesas/rcar_fdp1.c @@ -2256,7 +2256,7 @@ static int fdp1_probe(struct platform_device *pdev) int ret; int hw_version; - fdp1 = devm_kzalloc(&pdev->dev, sizeof(*fdp1), GFP_KERNEL); + fdp1 = devm_kzalloc_obj(&pdev->dev, *fdp1); if (!fdp1) return -ENOMEM; diff --git a/drivers/media/platform/renesas/rcar_jpu.c b/drivers/media/platform/renesas/rcar_jpu.c index 93d54325e420..48b7bdaf15b5 100644 --- a/drivers/media/platform/renesas/rcar_jpu.c +++ b/drivers/media/platform/renesas/rcar_jpu.c @@ -1574,7 +1574,7 @@ static int jpu_probe(struct platform_device *pdev) int ret; unsigned int i; - jpu = devm_kzalloc(&pdev->dev, sizeof(*jpu), GFP_KERNEL); + jpu = devm_kzalloc_obj(&pdev->dev, *jpu); if (!jpu) return -ENOMEM; diff --git a/drivers/media/platform/renesas/renesas-ceu.c b/drivers/media/platform/renesas/renesas-ceu.c index 47b9e4753301..28c2e6a01f0c 100644 --- a/drivers/media/platform/renesas/renesas-ceu.c +++ b/drivers/media/platform/renesas/renesas-ceu.c @@ -1463,8 +1463,7 @@ static const struct v4l2_async_notifier_operations ceu_notify_ops = { static int ceu_init_async_subdevs(struct ceu_device *ceudev, unsigned int n_sd) { /* Reserve memory for 'n_sd' ceu_subdev descriptors. */ - ceudev->subdevs = devm_kcalloc(ceudev->dev, n_sd, - sizeof(*ceudev->subdevs), GFP_KERNEL); + ceudev->subdevs = devm_kzalloc_objs(ceudev->dev, *ceudev->subdevs, n_sd); if (!ceudev->subdevs) return -ENOMEM; diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c index 8c7f46ccce5f..4083ce189b6d 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c @@ -244,7 +244,7 @@ static int rzg2l_cru_probe(struct platform_device *pdev) struct rzg2l_cru_dev *cru; int irq, ret; - cru = devm_kzalloc(dev, sizeof(*cru), GFP_KERNEL); + cru = devm_kzalloc_obj(dev, *cru); if (!cru) return -ENOMEM; diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c index c17283cba3a6..64650dafb22a 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c @@ -903,7 +903,7 @@ static int rzg2l_csi2_probe(struct platform_device *pdev) struct rzg2l_csi2 *csi2; int ret; - csi2 = devm_kzalloc(dev, sizeof(*csi2), GFP_KERNEL); + csi2 = devm_kzalloc_obj(dev, *csi2); if (!csi2) return -ENOMEM; diff --git a/drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-dev.c b/drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-dev.c index 48f9fd818bff..e2a14ebeb114 100644 --- a/drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-dev.c +++ b/drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-dev.c @@ -183,7 +183,7 @@ static int rzv2h_ivc_probe(struct platform_device *pdev) struct rzv2h_ivc *ivc; int ret; - ivc = devm_kzalloc(dev, sizeof(*ivc), GFP_KERNEL); + ivc = devm_kzalloc_obj(dev, *ivc); if (!ivc) return -ENOMEM; diff --git a/drivers/media/platform/renesas/sh_vou.c b/drivers/media/platform/renesas/sh_vou.c index 6d4ec80edd8f..4396837d11c6 100644 --- a/drivers/media/platform/renesas/sh_vou.c +++ b/drivers/media/platform/renesas/sh_vou.c @@ -1234,7 +1234,7 @@ static int sh_vou_probe(struct platform_device *pdev) if (irq < 0) return irq; - vou_dev = devm_kzalloc(&pdev->dev, sizeof(*vou_dev), GFP_KERNEL); + vou_dev = devm_kzalloc_obj(&pdev->dev, *vou_dev); if (!vou_dev) return -ENOMEM; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_brx.c b/drivers/media/platform/renesas/vsp1/vsp1_brx.c index a70b82e22e69..4d929aa474ac 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_brx.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_brx.c @@ -393,7 +393,7 @@ struct vsp1_brx *vsp1_brx_create(struct vsp1_device *vsp1, const char *name; int ret; - brx = devm_kzalloc(vsp1->dev, sizeof(*brx), GFP_KERNEL); + brx = devm_kzalloc_obj(vsp1->dev, *brx); if (brx == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_clu.c b/drivers/media/platform/renesas/vsp1/vsp1_clu.c index 4b7d07d730da..49ec862829a8 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_clu.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_clu.c @@ -206,7 +206,7 @@ struct vsp1_clu *vsp1_clu_create(struct vsp1_device *vsp1) struct vsp1_clu *clu; int ret; - clu = devm_kzalloc(vsp1->dev, sizeof(*clu), GFP_KERNEL); + clu = devm_kzalloc_obj(vsp1->dev, *clu); if (clu == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_dl.c b/drivers/media/platform/renesas/vsp1/vsp1_dl.c index 8257759421f3..ad0e6a44fef9 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_dl.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_dl.c @@ -1090,7 +1090,7 @@ struct vsp1_dl_manager *vsp1_dlm_create(struct vsp1_device *vsp1, struct vsp1_dl_manager *dlm; size_t header_size; - dlm = devm_kzalloc(vsp1->dev, sizeof(*dlm), GFP_KERNEL); + dlm = devm_kzalloc_obj(vsp1->dev, *dlm); if (!dlm) return NULL; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drm.c b/drivers/media/platform/renesas/vsp1/vsp1_drm.c index adb89e699389..7aa0fe141c59 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_drm.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_drm.c @@ -966,7 +966,7 @@ EXPORT_SYMBOL_GPL(vsp1_du_unmap_sg); int vsp1_drm_init(struct vsp1_device *vsp1) { - vsp1->drm = devm_kzalloc(vsp1->dev, sizeof(*vsp1->drm), GFP_KERNEL); + vsp1->drm = devm_kzalloc_obj(vsp1->dev, *vsp1->drm); if (!vsp1->drm) return -ENOMEM; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drv.c b/drivers/media/platform/renesas/vsp1/vsp1_drv.c index 762a9e776a94..e962da56bac6 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_drv.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_drv.c @@ -920,7 +920,7 @@ static int vsp1_probe(struct platform_device *pdev) int ret; int irq; - vsp1 = devm_kzalloc(&pdev->dev, sizeof(*vsp1), GFP_KERNEL); + vsp1 = devm_kzalloc_obj(&pdev->dev, *vsp1); if (vsp1 == NULL) return -ENOMEM; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_entity.c b/drivers/media/platform/renesas/vsp1/vsp1_entity.c index f7359d347947..032d8ff4b2af 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_entity.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_entity.c @@ -607,17 +607,15 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity, entity->source_pad = num_pads - 1; /* Allocate and initialize pads. */ - entity->pads = devm_kcalloc(vsp1->dev, - num_pads, sizeof(*entity->pads), - GFP_KERNEL); + entity->pads = devm_kzalloc_objs(vsp1->dev, *entity->pads, num_pads); if (entity->pads == NULL) return -ENOMEM; for (i = 0; i < num_pads - 1; ++i) entity->pads[i].flags = MEDIA_PAD_FL_SINK; - entity->sources = devm_kcalloc(vsp1->dev, max(num_pads - 1, 1U), - sizeof(*entity->sources), GFP_KERNEL); + entity->sources = devm_kzalloc_objs(vsp1->dev, *entity->sources, + max(num_pads - 1, 1U)); if (entity->sources == NULL) return -ENOMEM; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_hgo.c b/drivers/media/platform/renesas/vsp1/vsp1_hgo.c index d3eaa7c2d595..e5f27637acb7 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_hgo.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_hgo.c @@ -187,7 +187,7 @@ struct vsp1_hgo *vsp1_hgo_create(struct vsp1_device *vsp1) struct vsp1_hgo *hgo; int ret; - hgo = devm_kzalloc(vsp1->dev, sizeof(*hgo), GFP_KERNEL); + hgo = devm_kzalloc_obj(vsp1->dev, *hgo); if (hgo == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_hgt.c b/drivers/media/platform/renesas/vsp1/vsp1_hgt.c index 8c04bdec8510..57b5be8ce615 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_hgt.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_hgt.c @@ -184,7 +184,7 @@ struct vsp1_hgt *vsp1_hgt_create(struct vsp1_device *vsp1) struct vsp1_hgt *hgt; int ret; - hgt = devm_kzalloc(vsp1->dev, sizeof(*hgt), GFP_KERNEL); + hgt = devm_kzalloc_obj(vsp1->dev, *hgt); if (hgt == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_hsit.c b/drivers/media/platform/renesas/vsp1/vsp1_hsit.c index d734b5775af6..5987b13969cd 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_hsit.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_hsit.c @@ -204,7 +204,7 @@ struct vsp1_hsit *vsp1_hsit_create(struct vsp1_device *vsp1, bool inverse) struct vsp1_hsit *hsit; int ret; - hsit = devm_kzalloc(vsp1->dev, sizeof(*hsit), GFP_KERNEL); + hsit = devm_kzalloc_obj(vsp1->dev, *hsit); if (hsit == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_iif.c b/drivers/media/platform/renesas/vsp1/vsp1_iif.c index d44c04e140bc..36898752eb3b 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_iif.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_iif.c @@ -73,7 +73,7 @@ struct vsp1_iif *vsp1_iif_create(struct vsp1_device *vsp1) struct vsp1_iif *iif; int ret; - iif = devm_kzalloc(vsp1->dev, sizeof(*iif), GFP_KERNEL); + iif = devm_kzalloc_obj(vsp1->dev, *iif); if (!iif) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_lif.c b/drivers/media/platform/renesas/vsp1/vsp1_lif.c index 1ebb88b3e4c9..74aa1cb795ad 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_lif.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_lif.c @@ -127,7 +127,7 @@ struct vsp1_lif *vsp1_lif_create(struct vsp1_device *vsp1, unsigned int index) struct vsp1_lif *lif; int ret; - lif = devm_kzalloc(vsp1->dev, sizeof(*lif), GFP_KERNEL); + lif = devm_kzalloc_obj(vsp1->dev, *lif); if (lif == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_lut.c b/drivers/media/platform/renesas/vsp1/vsp1_lut.c index 6433b5515ef9..70a4b00bd823 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_lut.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_lut.c @@ -167,7 +167,7 @@ struct vsp1_lut *vsp1_lut_create(struct vsp1_device *vsp1) struct vsp1_lut *lut; int ret; - lut = devm_kzalloc(vsp1->dev, sizeof(*lut), GFP_KERNEL); + lut = devm_kzalloc_obj(vsp1->dev, *lut); if (lut == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c index 34b9095c9011..6a350523d606 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c @@ -421,7 +421,7 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index) char name[6]; int ret; - rpf = devm_kzalloc(vsp1->dev, sizeof(*rpf), GFP_KERNEL); + rpf = devm_kzalloc_obj(vsp1->dev, *rpf); if (rpf == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_sru.c b/drivers/media/platform/renesas/vsp1/vsp1_sru.c index 5e1cf60be311..dcec35c94e44 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_sru.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_sru.c @@ -349,7 +349,7 @@ struct vsp1_sru *vsp1_sru_create(struct vsp1_device *vsp1) struct vsp1_sru *sru; int ret; - sru = devm_kzalloc(vsp1->dev, sizeof(*sru), GFP_KERNEL); + sru = devm_kzalloc_obj(vsp1->dev, *sru); if (sru == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_uds.c b/drivers/media/platform/renesas/vsp1/vsp1_uds.c index d129964ec14d..9a1d6ec238b4 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_uds.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_uds.c @@ -387,7 +387,7 @@ struct vsp1_uds *vsp1_uds_create(struct vsp1_device *vsp1, unsigned int index) char name[6]; int ret; - uds = devm_kzalloc(vsp1->dev, sizeof(*uds), GFP_KERNEL); + uds = devm_kzalloc_obj(vsp1->dev, *uds); if (uds == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_uif.c b/drivers/media/platform/renesas/vsp1/vsp1_uif.c index 16ddcd594134..df3909184189 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_uif.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_uif.c @@ -203,7 +203,7 @@ struct vsp1_uif *vsp1_uif_create(struct vsp1_device *vsp1, unsigned int index) char name[6]; int ret; - uif = devm_kzalloc(vsp1->dev, sizeof(*uif), GFP_KERNEL); + uif = devm_kzalloc_obj(vsp1->dev, *uif); if (!uif) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_video.c b/drivers/media/platform/renesas/vsp1/vsp1_video.c index b85351986fae..ace719756de4 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_video.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_video.c @@ -1190,7 +1190,7 @@ struct vsp1_video *vsp1_video_create(struct vsp1_device *vsp1, const char *direction; int ret; - video = devm_kzalloc(vsp1->dev, sizeof(*video), GFP_KERNEL); + video = devm_kzalloc_obj(vsp1->dev, *video); if (!video) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_vspx.c b/drivers/media/platform/renesas/vsp1/vsp1_vspx.c index 5c39bacfb13f..ed1877f5c6c1 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_vspx.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_vspx.c @@ -584,7 +584,7 @@ int vsp1_vspx_init(struct vsp1_device *vsp1) struct vsp1_vspx_pipeline *vspx_pipe; struct vsp1_pipeline *pipe; - vsp1->vspx = devm_kzalloc(vsp1->dev, sizeof(*vsp1->vspx), GFP_KERNEL); + vsp1->vspx = devm_kzalloc_obj(vsp1->dev, *vsp1->vspx); if (!vsp1->vspx) return -ENOMEM; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c index 821887815eb2..f5abd42b94e9 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c @@ -553,7 +553,7 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index) char name[6]; int ret; - wpf = devm_kzalloc(vsp1->dev, sizeof(*wpf), GFP_KERNEL); + wpf = devm_kzalloc_obj(vsp1->dev, *wpf); if (wpf == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c index 543a0da75572..24ce13b4bbda 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -768,7 +768,7 @@ static int rga_probe(struct platform_device *pdev) if (ret) return ret; - rga = devm_kzalloc(&pdev->dev, sizeof(*rga), GFP_KERNEL); + rga = devm_kzalloc_obj(&pdev->dev, *rga); if (!rga) return -ENOMEM; diff --git a/drivers/media/platform/rockchip/rkcif/rkcif-dev.c b/drivers/media/platform/rockchip/rkcif/rkcif-dev.c index 2a5758776b3e..f9ad8c23ae2b 100644 --- a/drivers/media/platform/rockchip/rkcif/rkcif-dev.c +++ b/drivers/media/platform/rockchip/rkcif/rkcif-dev.c @@ -188,7 +188,7 @@ static int rkcif_probe(struct platform_device *pdev) struct rkcif_device *rkcif; int ret, irq; - rkcif = devm_kzalloc(dev, sizeof(*rkcif), GFP_KERNEL); + rkcif = devm_kzalloc_obj(dev, *rkcif); if (!rkcif) return -ENOMEM; diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c index f90e01301943..a4f0c181fc02 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c @@ -655,7 +655,7 @@ static int rkisp1_probe(struct platform_device *pdev) int ret, irq; u32 cif_id; - rkisp1 = devm_kzalloc(dev, sizeof(*rkisp1), GFP_KERNEL); + rkisp1 = devm_kzalloc_obj(dev, *rkisp1); if (!rkisp1) return -ENOMEM; diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec-rcb.c b/drivers/media/platform/rockchip/rkvdec/rkvdec-rcb.c index fdcf1f177379..3828e2a5c665 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec-rcb.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-rcb.c @@ -93,7 +93,7 @@ int rkvdec_allocate_rcb(struct rkvdec_ctx *ctx, return 0; } - ctx->rcb_config = devm_kzalloc(rkvdec->dev, sizeof(*ctx->rcb_config), GFP_KERNEL); + ctx->rcb_config = devm_kzalloc_obj(rkvdec->dev, *ctx->rcb_config); if (!ctx->rcb_config) return -ENOMEM; diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c b/drivers/media/platform/rockchip/rkvdec/rkvdec.c index fbcd0f175ad3..5250dd59df2e 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c @@ -1774,7 +1774,7 @@ static int rkvdec_probe(struct platform_device *pdev) if (!variant) return -EINVAL; - rkvdec = devm_kzalloc(&pdev->dev, sizeof(*rkvdec), GFP_KERNEL); + rkvdec = devm_kzalloc_obj(&pdev->dev, *rkvdec); if (!rkvdec) return -ENOMEM; diff --git a/drivers/media/platform/samsung/exynos-gsc/gsc-core.c b/drivers/media/platform/samsung/exynos-gsc/gsc-core.c index a06d7cace92f..084db7654392 100644 --- a/drivers/media/platform/samsung/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/samsung/exynos-gsc/gsc-core.c @@ -1110,7 +1110,7 @@ static int gsc_probe(struct platform_device *pdev) int ret; int i; - gsc = devm_kzalloc(dev, sizeof(struct gsc_dev), GFP_KERNEL); + gsc = devm_kzalloc_obj(dev, struct gsc_dev); if (!gsc) return -ENOMEM; diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-core.c b/drivers/media/platform/samsung/exynos4-is/fimc-core.c index 57e573949e54..4b460d8f73d2 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-core.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-core.c @@ -927,7 +927,7 @@ static int fimc_probe(struct platform_device *pdev) int ret = 0; int irq; - fimc = devm_kzalloc(dev, sizeof(*fimc), GFP_KERNEL); + fimc = devm_kzalloc_obj(dev, *fimc); if (!fimc) return -ENOMEM; diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-is-i2c.c b/drivers/media/platform/samsung/exynos4-is/fimc-is-i2c.c index b5b37b6f8fa8..1e7a8700d509 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-is-i2c.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-is-i2c.c @@ -41,7 +41,7 @@ static int fimc_is_i2c_probe(struct platform_device *pdev) struct i2c_adapter *i2c_adap; int ret; - isp_i2c = devm_kzalloc(&pdev->dev, sizeof(*isp_i2c), GFP_KERNEL); + isp_i2c = devm_kzalloc_obj(&pdev->dev, *isp_i2c); if (!isp_i2c) return -ENOMEM; diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-is.c b/drivers/media/platform/samsung/exynos4-is/fimc-is.c index b7d9bfedd590..fbbd3deedd13 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-is.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-is.c @@ -792,7 +792,7 @@ static int fimc_is_probe(struct platform_device *pdev) struct resource res; int ret; - is = devm_kzalloc(&pdev->dev, sizeof(*is), GFP_KERNEL); + is = devm_kzalloc_obj(&pdev->dev, *is); if (!is) return -ENOMEM; diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-lite.c b/drivers/media/platform/samsung/exynos4-is/fimc-lite.c index 90599c82fd35..15ab72de4c50 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-lite.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-lite.c @@ -1454,7 +1454,7 @@ static int fimc_lite_probe(struct platform_device *pdev) if (!dev->of_node) return -ENODEV; - fimc = devm_kzalloc(dev, sizeof(*fimc), GFP_KERNEL); + fimc = devm_kzalloc_obj(dev, *fimc); if (!fimc) return -ENOMEM; diff --git a/drivers/media/platform/samsung/exynos4-is/media-dev.c b/drivers/media/platform/samsung/exynos4-is/media-dev.c index 2e08c4435859..e6b327d3cd78 100644 --- a/drivers/media/platform/samsung/exynos4-is/media-dev.c +++ b/drivers/media/platform/samsung/exynos4-is/media-dev.c @@ -1426,7 +1426,7 @@ static int fimc_md_probe(struct platform_device *pdev) struct fimc_md *fmd; int ret; - fmd = devm_kzalloc(dev, sizeof(*fmd), GFP_KERNEL); + fmd = devm_kzalloc_obj(dev, *fmd); if (!fmd) return -ENOMEM; diff --git a/drivers/media/platform/samsung/exynos4-is/mipi-csis.c b/drivers/media/platform/samsung/exynos4-is/mipi-csis.c index da6e67a79c09..4661867b3580 100644 --- a/drivers/media/platform/samsung/exynos4-is/mipi-csis.c +++ b/drivers/media/platform/samsung/exynos4-is/mipi-csis.c @@ -771,7 +771,7 @@ static int s5pcsis_probe(struct platform_device *pdev) int ret = -ENOMEM; int i; - state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/media/platform/samsung/s3c-camif/camif-core.c b/drivers/media/platform/samsung/s3c-camif/camif-core.c index 2ff71e375efe..0b54bc8ac6bd 100644 --- a/drivers/media/platform/samsung/s3c-camif/camif-core.c +++ b/drivers/media/platform/samsung/s3c-camif/camif-core.c @@ -397,7 +397,7 @@ static int s3c_camif_probe(struct platform_device *pdev) struct camif_dev *camif; int ret = 0; - camif = devm_kzalloc(dev, sizeof(*camif), GFP_KERNEL); + camif = devm_kzalloc_obj(dev, *camif); if (!camif) return -ENOMEM; diff --git a/drivers/media/platform/samsung/s5p-g2d/g2d.c b/drivers/media/platform/samsung/s5p-g2d/g2d.c index a18b13db19d5..6f8e26110523 100644 --- a/drivers/media/platform/samsung/s5p-g2d/g2d.c +++ b/drivers/media/platform/samsung/s5p-g2d/g2d.c @@ -622,7 +622,7 @@ static int g2d_probe(struct platform_device *pdev) const struct of_device_id *of_id; int ret = 0; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c index fdc9d7e0be66..7670cc705e40 100644 --- a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c @@ -2846,7 +2846,7 @@ static int s5p_jpeg_probe(struct platform_device *pdev) int i, ret; /* JPEG IP abstraction struct */ - jpeg = devm_kzalloc(&pdev->dev, sizeof(struct s5p_jpeg), GFP_KERNEL); + jpeg = devm_kzalloc_obj(&pdev->dev, struct s5p_jpeg); if (!jpeg) return -ENOMEM; diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c index 03e7eac8d1f7..03ef65c1dd68 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c @@ -1114,7 +1114,7 @@ static struct device *s5p_mfc_alloc_memdev(struct device *dev, struct device *child; int ret; - child = devm_kzalloc(dev, sizeof(*child), GFP_KERNEL); + child = devm_kzalloc_obj(dev, *child); if (!child) return NULL; @@ -1124,8 +1124,7 @@ static struct device *s5p_mfc_alloc_memdev(struct device *dev, child->coherent_dma_mask = dev->coherent_dma_mask; child->dma_mask = dev->dma_mask; child->release = s5p_mfc_memdev_release; - child->dma_parms = devm_kzalloc(dev, sizeof(*child->dma_parms), - GFP_KERNEL); + child->dma_parms = devm_kzalloc_obj(dev, *child->dma_parms); if (!child->dma_parms) goto err; @@ -1305,7 +1304,7 @@ static int s5p_mfc_probe(struct platform_device *pdev) int ret; pr_debug("%s++\n", __func__); - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/media/platform/st/sti/bdisp/bdisp-hw.c b/drivers/media/platform/st/sti/bdisp/bdisp-hw.c index a74e9fd65238..de3c9bc62422 100644 --- a/drivers/media/platform/st/sti/bdisp/bdisp-hw.c +++ b/drivers/media/platform/st/sti/bdisp/bdisp-hw.c @@ -1062,9 +1062,9 @@ static void bdisp_hw_save_request(struct bdisp_ctx *ctx) for (i = 0; i < MAX_NB_NODE; i++) { /* Allocate memory if not done yet */ if (!copy_node[i]) { - copy_node[i] = devm_kzalloc(ctx->bdisp_dev->dev, - sizeof(*copy_node[i]), - GFP_ATOMIC); + copy_node[i] = devm_kzalloc_obj(ctx->bdisp_dev->dev, + *copy_node[i], + GFP_ATOMIC); if (!copy_node[i]) return; } diff --git a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c index ee6d686cba49..f8dfa32990d8 100644 --- a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c +++ b/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c @@ -1287,7 +1287,7 @@ static int bdisp_probe(struct platform_device *pdev) dev_dbg(dev, "%s\n", __func__); - bdisp = devm_kzalloc(dev, sizeof(struct bdisp_dev), GFP_KERNEL); + bdisp = devm_kzalloc_obj(dev, struct bdisp_dev); if (!bdisp) return -ENOMEM; diff --git a/drivers/media/platform/st/sti/delta/delta-v4l2.c b/drivers/media/platform/st/sti/delta/delta-v4l2.c index 7dd27de37b78..f1aeed6fb3da 100644 --- a/drivers/media/platform/st/sti/delta/delta-v4l2.c +++ b/drivers/media/platform/st/sti/delta/delta-v4l2.c @@ -1811,7 +1811,7 @@ static int delta_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - delta = devm_kzalloc(dev, sizeof(*delta), GFP_KERNEL); + delta = devm_kzalloc_obj(dev, *delta); if (!delta) { ret = -ENOMEM; goto err; diff --git a/drivers/media/platform/st/sti/hva/hva-h264.c b/drivers/media/platform/st/sti/hva/hva-h264.c index 196e631fa4b8..b1c241f8d64e 100644 --- a/drivers/media/platform/st/sti/hva/hva-h264.c +++ b/drivers/media/platform/st/sti/hva/hva-h264.c @@ -910,7 +910,7 @@ static int hva_h264_open(struct hva_ctx *pctx) } /* allocate context for codec */ - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) { ret = -ENOMEM; goto err; diff --git a/drivers/media/platform/st/sti/hva/hva-mem.c b/drivers/media/platform/st/sti/hva/hva-mem.c index 68047b60b66c..8d8ac6ac5c69 100644 --- a/drivers/media/platform/st/sti/hva/hva-mem.c +++ b/drivers/media/platform/st/sti/hva/hva-mem.c @@ -16,7 +16,7 @@ int hva_mem_alloc(struct hva_ctx *ctx, u32 size, const char *name, dma_addr_t paddr; void *base; - b = devm_kzalloc(dev, sizeof(*b), GFP_KERNEL); + b = devm_kzalloc_obj(dev, *b); if (!b) { ctx->sys_errors++; return -ENOMEM; diff --git a/drivers/media/platform/st/sti/hva/hva-v4l2.c b/drivers/media/platform/st/sti/hva/hva-v4l2.c index 33b768774e20..47d84b0dd5fa 100644 --- a/drivers/media/platform/st/sti/hva/hva-v4l2.c +++ b/drivers/media/platform/st/sti/hva/hva-v4l2.c @@ -1348,7 +1348,7 @@ static int hva_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - hva = devm_kzalloc(dev, sizeof(*hva), GFP_KERNEL); + hva = devm_kzalloc_obj(dev, *hva); if (!hva) { ret = -ENOMEM; goto err; diff --git a/drivers/media/platform/st/stm32/dma2d/dma2d.c b/drivers/media/platform/st/stm32/dma2d/dma2d.c index a3ad19256859..84913a393e3b 100644 --- a/drivers/media/platform/st/stm32/dma2d/dma2d.c +++ b/drivers/media/platform/st/stm32/dma2d/dma2d.c @@ -601,7 +601,7 @@ static int dma2d_probe(struct platform_device *pdev) struct video_device *vfd; int ret = 0; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c index e71142634a17..c2b506e46f16 100644 --- a/drivers/media/platform/st/stm32/stm32-csi.c +++ b/drivers/media/platform/st/stm32/stm32-csi.c @@ -984,7 +984,7 @@ static int stm32_csi_probe(struct platform_device *pdev) struct reset_control *rstc; int ret; - csidev = devm_kzalloc(&pdev->dev, sizeof(*csidev), GFP_KERNEL); + csidev = devm_kzalloc_obj(&pdev->dev, *csidev); if (!csidev) return -ENOMEM; diff --git a/drivers/media/platform/st/stm32/stm32-dcmi.c b/drivers/media/platform/st/stm32/stm32-dcmi.c index 3d774cb4907b..53857f1aaf03 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmi.c +++ b/drivers/media/platform/st/stm32/stm32-dcmi.c @@ -1806,9 +1806,9 @@ static int dcmi_framesizes_init(struct stm32_dcmi *dcmi) return 0; dcmi->num_of_sd_framesizes = num_fsize; - dcmi->sd_framesizes = devm_kcalloc(dcmi->dev, num_fsize, - sizeof(struct dcmi_framesize), - GFP_KERNEL); + dcmi->sd_framesizes = devm_kzalloc_objs(dcmi->dev, + struct dcmi_framesize, + num_fsize); if (!dcmi->sd_framesizes) { dev_err(dcmi->dev, "Could not allocate memory\n"); return -ENOMEM; @@ -1984,7 +1984,7 @@ static int dcmi_probe(struct platform_device *pdev) struct clk *mclk; int ret = 0; - dcmi = devm_kzalloc(&pdev->dev, sizeof(struct stm32_dcmi), GFP_KERNEL); + dcmi = devm_kzalloc_obj(&pdev->dev, struct stm32_dcmi); if (!dcmi) return -ENOMEM; diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c index 54e28b4a5b2c..59481be9aa82 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c @@ -454,7 +454,7 @@ static int dcmipp_probe(struct platform_device *pdev) int irq; int ret; - dcmipp = devm_kzalloc(&pdev->dev, sizeof(*dcmipp), GFP_KERNEL); + dcmipp = devm_kzalloc_obj(&pdev->dev, *dcmipp); if (!dcmipp) return -ENOMEM; @@ -527,8 +527,8 @@ static int dcmipp_probe(struct platform_device *pdev) dcmipp->mclk = mclk; } - dcmipp->entity = devm_kcalloc(&pdev->dev, dcmipp->pipe_cfg->num_ents, - sizeof(*dcmipp->entity), GFP_KERNEL); + dcmipp->entity = devm_kzalloc_objs(&pdev->dev, *dcmipp->entity, + dcmipp->pipe_cfg->num_ents); if (!dcmipp->entity) return -ENOMEM; diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c index e53a07b770b7..cf34574c5c15 100644 --- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c +++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c @@ -167,7 +167,7 @@ static int sun4i_csi_probe(struct platform_device *pdev) int ret; int irq; - csi = devm_kzalloc(&pdev->dev, sizeof(*csi), GFP_KERNEL); + csi = devm_kzalloc_obj(&pdev->dev, *csi); if (!csi) return -ENOMEM; platform_set_drvdata(pdev, csi); diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c index af2a32c226a5..66fdc57cfe95 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c @@ -322,7 +322,7 @@ static int sun6i_csi_probe(struct platform_device *platform_dev) struct device *dev = &platform_dev->dev; int ret; - csi_dev = devm_kzalloc(dev, sizeof(*csi_dev), GFP_KERNEL); + csi_dev = devm_kzalloc_obj(dev, *csi_dev); if (!csi_dev) return -ENOMEM; diff --git a/drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c b/drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c index dcc8c7eadf9a..04c02fecce8e 100644 --- a/drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c +++ b/drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c @@ -717,7 +717,7 @@ static int sun6i_mipi_csi2_probe(struct platform_device *platform_dev) struct device *dev = &platform_dev->dev; int ret; - csi2_dev = devm_kzalloc(dev, sizeof(*csi2_dev), GFP_KERNEL); + csi2_dev = devm_kzalloc_obj(dev, *csi2_dev); if (!csi2_dev) return -ENOMEM; diff --git a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c index 46604dcc8dcc..a5e3815a8976 100644 --- a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c +++ b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c @@ -783,7 +783,7 @@ static int sun8i_a83t_mipi_csi2_probe(struct platform_device *platform_dev) struct device *dev = &platform_dev->dev; int ret; - csi2_dev = devm_kzalloc(dev, sizeof(*csi2_dev), GFP_KERNEL); + csi2_dev = devm_kzalloc_obj(dev, *csi2_dev); if (!csi2_dev) return -ENOMEM; diff --git a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c b/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c index 65bc426e5aac..e00be61ba324 100644 --- a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +++ b/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c @@ -800,7 +800,7 @@ static int deinterlace_probe(struct platform_device *pdev) struct video_device *vfd; int irq, ret; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c index 7bff23d1ea98..b603f70dc6cf 100644 --- a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c +++ b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c @@ -734,7 +734,7 @@ static int rotate_probe(struct platform_device *pdev) struct video_device *vfd; int irq, ret; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/media/platform/synopsys/dw-mipi-csi2rx.c b/drivers/media/platform/synopsys/dw-mipi-csi2rx.c index b7247d597c9c..2e961bfadbcf 100644 --- a/drivers/media/platform/synopsys/dw-mipi-csi2rx.c +++ b/drivers/media/platform/synopsys/dw-mipi-csi2rx.c @@ -956,7 +956,7 @@ static int dw_mipi_csi2rx_probe(struct platform_device *pdev) struct dw_mipi_csi2rx_device *csi2; int ret; - csi2 = devm_kzalloc(dev, sizeof(*csi2), GFP_KERNEL); + csi2 = devm_kzalloc_obj(dev, *csi2); if (!csi2) return -ENOMEM; csi2->dev = dev; diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c index c62614077d97..713aa95be817 100644 --- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c @@ -2950,7 +2950,7 @@ static int hdmirx_probe(struct platform_device *pdev) struct v4l2_device *v4l2_dev; int ret; - hdmirx_dev = devm_kzalloc(dev, sizeof(*hdmirx_dev), GFP_KERNEL); + hdmirx_dev = devm_kzalloc_obj(dev, *hdmirx_dev); if (!hdmirx_dev) return -ENOMEM; diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c index 8e470c0376d6..7305e4c42c34 100644 --- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c +++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c @@ -202,7 +202,7 @@ struct hdmirx_cec *snps_hdmirx_cec_register(struct hdmirx_cec_data *data) * hardware device here, so that userspace can see the association * between the HDMI hardware and its associated CEC chardev. */ - cec = devm_kzalloc(data->dev, sizeof(*cec), GFP_KERNEL); + cec = devm_kzalloc_obj(data->dev, *cec); if (!cec) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c b/drivers/media/platform/ti/am437x/am437x-vpfe.c index 3cd5ee69d3c4..83450f1588b7 100644 --- a/drivers/media/platform/ti/am437x/am437x-vpfe.c +++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c @@ -2300,7 +2300,7 @@ vpfe_get_pdata(struct vpfe_device *vpfe) if (!IS_ENABLED(CONFIG_OF) || !dev->of_node) return dev->platform_data; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return NULL; @@ -2390,7 +2390,7 @@ static int vpfe_probe(struct platform_device *pdev) struct vpfe_ccdc *ccdc; int ret; - vpfe = devm_kzalloc(&pdev->dev, sizeof(*vpfe), GFP_KERNEL); + vpfe = devm_kzalloc_obj(&pdev->dev, *vpfe); if (!vpfe) return -ENOMEM; @@ -2447,10 +2447,8 @@ static int vpfe_probe(struct platform_device *pdev) pm_runtime_put_sync(&pdev->dev); - vpfe->sd = devm_kcalloc(&pdev->dev, - ARRAY_SIZE(vpfe->cfg->asd), - sizeof(struct v4l2_subdev *), - GFP_KERNEL); + vpfe->sd = devm_kzalloc_objs(&pdev->dev, struct v4l2_subdev *, + ARRAY_SIZE(vpfe->cfg->asd)); if (!vpfe->sd) { ret = -ENOMEM; goto probe_out_cleanup; diff --git a/drivers/media/platform/ti/cal/cal-camerarx.c b/drivers/media/platform/ti/cal/cal-camerarx.c index a978d27fe029..6bbe600499b9 100644 --- a/drivers/media/platform/ti/cal/cal-camerarx.c +++ b/drivers/media/platform/ti/cal/cal-camerarx.c @@ -966,7 +966,7 @@ struct cal_camerarx *cal_camerarx_create(struct cal_dev *cal, unsigned int i; int ret; - phy = devm_kzalloc(cal->dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(cal->dev, *phy); if (!phy) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/ti/cal/cal-video.c b/drivers/media/platform/ti/cal/cal-video.c index 1990cab77344..ed8d67cf00bc 100644 --- a/drivers/media/platform/ti/cal/cal-video.c +++ b/drivers/media/platform/ti/cal/cal-video.c @@ -862,8 +862,8 @@ static int cal_ctx_v4l2_init_formats(struct cal_ctx *ctx) int ret = 0; /* Enumerate sub device formats and enable all matching local formats */ - ctx->active_fmt = devm_kcalloc(ctx->cal->dev, cal_num_formats, - sizeof(*ctx->active_fmt), GFP_KERNEL); + ctx->active_fmt = devm_kzalloc_objs(ctx->cal->dev, *ctx->active_fmt, + cal_num_formats); if (!ctx->active_fmt) return -ENOMEM; diff --git a/drivers/media/platform/ti/cal/cal.c b/drivers/media/platform/ti/cal/cal.c index 5c82378d1eee..c3c1073739a5 100644 --- a/drivers/media/platform/ti/cal/cal.c +++ b/drivers/media/platform/ti/cal/cal.c @@ -1147,7 +1147,7 @@ static int cal_probe(struct platform_device *pdev) int ret; int irq; - cal = devm_kzalloc(&pdev->dev, sizeof(*cal), GFP_KERNEL); + cal = devm_kzalloc_obj(&pdev->dev, *cal); if (!cal) return -ENOMEM; diff --git a/drivers/media/platform/ti/davinci/vpif_capture.c b/drivers/media/platform/ti/davinci/vpif_capture.c index 397f3115af5b..e7836bc6ad3e 100644 --- a/drivers/media/platform/ti/davinci/vpif_capture.c +++ b/drivers/media/platform/ti/davinci/vpif_capture.c @@ -1502,14 +1502,12 @@ vpif_capture_get_pdata(struct platform_device *pdev, if (!IS_ENABLED(CONFIG_OF) || !pdev->dev.of_node) return pdev->dev.platform_data; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return NULL; pdata->subdev_info = - devm_kcalloc(&pdev->dev, - VPIF_CAPTURE_NUM_CHANNELS, - sizeof(*pdata->subdev_info), - GFP_KERNEL); + devm_kzalloc_objs(&pdev->dev, *pdata->subdev_info, + VPIF_CAPTURE_NUM_CHANNELS); if (!pdata->subdev_info) return NULL; @@ -1529,10 +1527,8 @@ vpif_capture_get_pdata(struct platform_device *pdev, sdinfo = &pdata->subdev_info[i]; chan = &pdata->chan_config[i]; - chan->inputs = devm_kcalloc(&pdev->dev, - VPIF_CAPTURE_NUM_CHANNELS, - sizeof(*chan->inputs), - GFP_KERNEL); + chan->inputs = devm_kzalloc_objs(&pdev->dev, *chan->inputs, + VPIF_CAPTURE_NUM_CHANNELS); if (!chan->inputs) goto err_cleanup; diff --git a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c index 022ea3d616c9..ba7abb723da6 100644 --- a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c +++ b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c @@ -1698,7 +1698,7 @@ static int ti_csi2rx_probe(struct platform_device *pdev) struct ti_csi2rx_dev *csi; int ret = 0, i, count; - csi = devm_kzalloc(&pdev->dev, sizeof(*csi), GFP_KERNEL); + csi = devm_kzalloc_obj(&pdev->dev, *csi); if (!csi) return -ENOMEM; diff --git a/drivers/media/platform/ti/vpe/csc.c b/drivers/media/platform/ti/vpe/csc.c index ff15bc589f1b..328557b1a1da 100644 --- a/drivers/media/platform/ti/vpe/csc.c +++ b/drivers/media/platform/ti/vpe/csc.c @@ -250,7 +250,7 @@ struct csc_data *csc_create(struct platform_device *pdev, const char *res_name) dev_dbg(&pdev->dev, "csc_create\n"); - csc = devm_kzalloc(&pdev->dev, sizeof(*csc), GFP_KERNEL); + csc = devm_kzalloc_obj(&pdev->dev, *csc); if (!csc) { dev_err(&pdev->dev, "couldn't alloc csc_data\n"); return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/ti/vpe/sc.c b/drivers/media/platform/ti/vpe/sc.c index 0202d278523f..f01a155add39 100644 --- a/drivers/media/platform/ti/vpe/sc.c +++ b/drivers/media/platform/ti/vpe/sc.c @@ -278,7 +278,7 @@ struct sc_data *sc_create(struct platform_device *pdev, const char *res_name) dev_dbg(&pdev->dev, "sc_create\n"); - sc = devm_kzalloc(&pdev->dev, sizeof(*sc), GFP_KERNEL); + sc = devm_kzalloc_obj(&pdev->dev, *sc); if (!sc) { dev_err(&pdev->dev, "couldn't alloc sc_data\n"); return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/ti/vpe/vip.c b/drivers/media/platform/ti/vpe/vip.c index 2bbe8eb31555..9f71cf0ffa6a 100644 --- a/drivers/media/platform/ti/vpe/vip.c +++ b/drivers/media/platform/ti/vpe/vip.c @@ -3248,7 +3248,7 @@ static int alloc_port(struct vip_dev *dev, int id) if (dev->ports[id]) return -EINVAL; - port = devm_kzalloc(&dev->pdev->dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(&dev->pdev->dev, *port); if (!port) return -ENOMEM; @@ -3424,7 +3424,7 @@ static int vip_probe_complete(struct platform_device *pdev) int ret, i, slice_id, port_id, p; /* Allocate ctrl before using it */ - ctrl = devm_kzalloc(&pdev->dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(&pdev->dev, *ctrl); if (!ctrl) return -ENOMEM; @@ -3491,7 +3491,7 @@ static int vip_probe_slice(struct platform_device *pdev, int slice) struct csc_data *csc; int ret; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; @@ -3518,7 +3518,7 @@ static int vip_probe_slice(struct platform_device *pdev, int slice) vip_top_reset(dev); vip_set_slice_path(dev, VIP_MULTI_CHANNEL_DATA_SELECT, 1); - parser = devm_kzalloc(&pdev->dev, sizeof(*dev->parser), GFP_KERNEL); + parser = devm_kzalloc_obj(&pdev->dev, *dev->parser); if (!parser) return -ENOMEM; @@ -3530,7 +3530,7 @@ static int vip_probe_slice(struct platform_device *pdev, int slice) dev->parser = parser; dev->sc_assigned = VIP_NOT_ASSIGNED; - sc = devm_kzalloc(&pdev->dev, sizeof(*dev->sc), GFP_KERNEL); + sc = devm_kzalloc_obj(&pdev->dev, *dev->sc); if (!sc) return -ENOMEM; @@ -3542,7 +3542,7 @@ static int vip_probe_slice(struct platform_device *pdev, int slice) dev->sc = sc; dev->csc_assigned = VIP_NOT_ASSIGNED; - csc = devm_kzalloc(&pdev->dev, sizeof(*dev->csc), GFP_KERNEL); + csc = devm_kzalloc_obj(&pdev->dev, *dev->csc); if (!csc) return -ENOMEM; @@ -3575,7 +3575,7 @@ static int vip_probe(struct platform_device *pdev) return ret; } - shared = devm_kzalloc(&pdev->dev, sizeof(*shared), GFP_KERNEL); + shared = devm_kzalloc_obj(&pdev->dev, *shared); if (!shared) return -ENOMEM; diff --git a/drivers/media/platform/ti/vpe/vpe.c b/drivers/media/platform/ti/vpe/vpe.c index 81bd1f9cee30..9eca5edc4920 100644 --- a/drivers/media/platform/ti/vpe/vpe.c +++ b/drivers/media/platform/ti/vpe/vpe.c @@ -2522,7 +2522,7 @@ static int vpe_probe(struct platform_device *pdev) return ret; } - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c index 26e5d5547466..3734ea701145 100644 --- a/drivers/media/platform/verisilicon/hantro_drv.c +++ b/drivers/media/platform/verisilicon/hantro_drv.c @@ -886,7 +886,7 @@ static int hantro_add_func(struct hantro_dev *vpu, unsigned int funcid) int ret; match = of_match_node(of_hantro_match, vpu->dev->of_node); - func = devm_kzalloc(vpu->dev, sizeof(*func), GFP_KERNEL); + func = devm_kzalloc_obj(vpu->dev, *func); if (!func) { v4l2_err(&vpu->v4l2_dev, "Failed to allocate video device\n"); return -ENOMEM; @@ -1076,7 +1076,7 @@ static int hantro_probe(struct platform_device *pdev) int num_bases; int i, ret; - vpu = devm_kzalloc(&pdev->dev, sizeof(*vpu), GFP_KERNEL); + vpu = devm_kzalloc_obj(&pdev->dev, *vpu); if (!vpu) return -ENOMEM; @@ -1103,8 +1103,8 @@ static int hantro_probe(struct platform_device *pdev) INIT_DELAYED_WORK(&vpu->watchdog_work, hantro_watchdog); - vpu->clocks = devm_kcalloc(&pdev->dev, vpu->variant->num_clocks, - sizeof(*vpu->clocks), GFP_KERNEL); + vpu->clocks = devm_kzalloc_objs(&pdev->dev, *vpu->clocks, + vpu->variant->num_clocks); if (!vpu->clocks) return -ENOMEM; @@ -1131,8 +1131,8 @@ static int hantro_probe(struct platform_device *pdev) return PTR_ERR(vpu->resets); num_bases = vpu->variant->num_regs ?: 1; - vpu->reg_bases = devm_kcalloc(&pdev->dev, num_bases, - sizeof(*vpu->reg_bases), GFP_KERNEL); + vpu->reg_bases = devm_kzalloc_objs(&pdev->dev, *vpu->reg_bases, + num_bases); if (!vpu->reg_bases) return -ENOMEM; diff --git a/drivers/media/platform/video-mux.c b/drivers/media/platform/video-mux.c index b253b260b605..c4b28a64c6f2 100644 --- a/drivers/media/platform/video-mux.c +++ b/drivers/media/platform/video-mux.c @@ -397,7 +397,7 @@ static int video_mux_probe(struct platform_device *pdev) unsigned int i; int ret; - vmux = devm_kzalloc(dev, sizeof(*vmux), GFP_KERNEL); + vmux = devm_kzalloc_obj(dev, *vmux); if (!vmux) return -ENOMEM; @@ -433,8 +433,7 @@ static int video_mux_probe(struct platform_device *pdev) mutex_init(&vmux->lock); vmux->active = -1; - vmux->pads = devm_kcalloc(dev, num_pads, sizeof(*vmux->pads), - GFP_KERNEL); + vmux->pads = devm_kzalloc_objs(dev, *vmux->pads, num_pads); if (!vmux->pads) return -ENOMEM; diff --git a/drivers/media/platform/xilinx/xilinx-csi2rxss.c b/drivers/media/platform/xilinx/xilinx-csi2rxss.c index 2f6f3af4e492..55e86e2a5ce9 100644 --- a/drivers/media/platform/xilinx/xilinx-csi2rxss.c +++ b/drivers/media/platform/xilinx/xilinx-csi2rxss.c @@ -906,7 +906,7 @@ static int xcsi2rxss_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int irq, ret; - xcsi2rxss = devm_kzalloc(dev, sizeof(*xcsi2rxss), GFP_KERNEL); + xcsi2rxss = devm_kzalloc_obj(dev, *xcsi2rxss); if (!xcsi2rxss) return -ENOMEM; diff --git a/drivers/media/platform/xilinx/xilinx-tpg.c b/drivers/media/platform/xilinx/xilinx-tpg.c index bf39ddb9c296..d37c22d6eafd 100644 --- a/drivers/media/platform/xilinx/xilinx-tpg.c +++ b/drivers/media/platform/xilinx/xilinx-tpg.c @@ -764,7 +764,7 @@ static int xtpg_probe(struct platform_device *pdev) u32 i, bayer_phase; int ret; - xtpg = devm_kzalloc(&pdev->dev, sizeof(*xtpg), GFP_KERNEL); + xtpg = devm_kzalloc_obj(&pdev->dev, *xtpg); if (!xtpg) return -ENOMEM; diff --git a/drivers/media/platform/xilinx/xilinx-vipp.c b/drivers/media/platform/xilinx/xilinx-vipp.c index 30675f681410..786e4f2e666e 100644 --- a/drivers/media/platform/xilinx/xilinx-vipp.c +++ b/drivers/media/platform/xilinx/xilinx-vipp.c @@ -429,7 +429,7 @@ static int xvip_graph_dma_init_one(struct xvip_composite_device *xdev, of_property_read_u32(node, "reg", &index); - dma = devm_kzalloc(xdev->dev, sizeof(*dma), GFP_KERNEL); + dma = devm_kzalloc_obj(xdev->dev, *dma); if (dma == NULL) return -ENOMEM; @@ -569,7 +569,7 @@ static int xvip_composite_probe(struct platform_device *pdev) struct xvip_composite_device *xdev; int ret; - xdev = devm_kzalloc(&pdev->dev, sizeof(*xdev), GFP_KERNEL); + xdev = devm_kzalloc_obj(&pdev->dev, *xdev); if (!xdev) return -ENOMEM; diff --git a/drivers/media/platform/xilinx/xilinx-vtc.c b/drivers/media/platform/xilinx/xilinx-vtc.c index 92fec7bb47da..a344cab2b7a9 100644 --- a/drivers/media/platform/xilinx/xilinx-vtc.c +++ b/drivers/media/platform/xilinx/xilinx-vtc.c @@ -321,7 +321,7 @@ static int xvtc_probe(struct platform_device *pdev) struct xvtc_device *xvtc; int ret; - xvtc = devm_kzalloc(&pdev->dev, sizeof(*xvtc), GFP_KERNEL); + xvtc = devm_kzalloc_obj(&pdev->dev, *xvtc); if (!xvtc) return -ENOMEM; diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c index bfe89782dce4..32fc128d9d25 100644 --- a/drivers/media/radio/radio-si476x.c +++ b/drivers/media/radio/radio-si476x.c @@ -1381,7 +1381,7 @@ static int si476x_radio_probe(struct platform_device *pdev) static atomic_t instance = ATOMIC_INIT(0); - radio = devm_kzalloc(&pdev->dev, sizeof(*radio), GFP_KERNEL); + radio = devm_kzalloc_obj(&pdev->dev, *radio); if (!radio) return -ENOMEM; diff --git a/drivers/media/radio/radio-timb.c b/drivers/media/radio/radio-timb.c index a6069b106fd3..534bb40bbe41 100644 --- a/drivers/media/radio/radio-timb.c +++ b/drivers/media/radio/radio-timb.c @@ -96,7 +96,7 @@ static int timbradio_probe(struct platform_device *pdev) goto err; } - tr = devm_kzalloc(&pdev->dev, sizeof(*tr), GFP_KERNEL); + tr = devm_kzalloc_obj(&pdev->dev, *tr); if (!tr) { err = -ENOMEM; goto err; diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c index a1e570af9c59..3139912d7ca8 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -336,7 +336,7 @@ static int si470x_i2c_probe(struct i2c_client *client) int retval = 0; /* private data allocation and initialization */ - radio = devm_kzalloc(&client->dev, sizeof(*radio), GFP_KERNEL); + radio = devm_kzalloc_obj(&client->dev, *radio); if (!radio) { retval = -ENOMEM; goto err_initial; diff --git a/drivers/media/radio/si4713/radio-platform-si4713.c b/drivers/media/radio/si4713/radio-platform-si4713.c index 4132968110e3..b2bcd0ae970e 100644 --- a/drivers/media/radio/si4713/radio-platform-si4713.c +++ b/drivers/media/radio/si4713/radio-platform-si4713.c @@ -146,7 +146,7 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev) goto exit; } - rsdev = devm_kzalloc(&pdev->dev, sizeof(*rsdev), GFP_KERNEL); + rsdev = devm_kzalloc_obj(&pdev->dev, *rsdev); if (!rsdev) { dev_err(&pdev->dev, "Failed to alloc video device.\n"); rval = -ENOMEM; diff --git a/drivers/media/radio/si4713/si4713.c b/drivers/media/radio/si4713/si4713.c index 150d07f6b319..2320d9dee684 100644 --- a/drivers/media/radio/si4713/si4713.c +++ b/drivers/media/radio/si4713/si4713.c @@ -1437,7 +1437,7 @@ static int si4713_probe(struct i2c_client *client) struct platform_device *si4713_pdev; int rval; - sdev = devm_kzalloc(&client->dev, sizeof(*sdev), GFP_KERNEL); + sdev = devm_kzalloc_obj(&client->dev, *sdev); if (!sdev) { dev_err(&client->dev, "Failed to alloc video device.\n"); rval = -ENOMEM; diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c index a6418ef782bc..eaa117304563 100644 --- a/drivers/media/rc/gpio-ir-recv.c +++ b/drivers/media/rc/gpio-ir-recv.c @@ -66,7 +66,7 @@ static int gpio_ir_recv_probe(struct platform_device *pdev) if (!np) return -ENODEV; - gpio_dev = devm_kzalloc(dev, sizeof(*gpio_dev), GFP_KERNEL); + gpio_dev = devm_kzalloc_obj(dev, *gpio_dev); if (!gpio_dev) return -ENOMEM; diff --git a/drivers/media/rc/gpio-ir-tx.c b/drivers/media/rc/gpio-ir-tx.c index d15fb17fa0fa..bbc27f24c6e2 100644 --- a/drivers/media/rc/gpio-ir-tx.c +++ b/drivers/media/rc/gpio-ir-tx.c @@ -161,7 +161,7 @@ static int gpio_ir_tx_probe(struct platform_device *pdev) struct rc_dev *rcdev; int rc; - gpio_ir = devm_kmalloc(&pdev->dev, sizeof(*gpio_ir), GFP_KERNEL); + gpio_ir = devm_kmalloc_obj(&pdev->dev, *gpio_ir); if (!gpio_ir) return -ENOMEM; diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c index 7758487da3d3..37339f80c7e7 100644 --- a/drivers/media/rc/igorplugusb.c +++ b/drivers/media/rc/igorplugusb.c @@ -160,7 +160,7 @@ static int igorplugusb_probe(struct usb_interface *intf, return -ENODEV; } - ir = devm_kzalloc(&intf->dev, sizeof(*ir), GFP_KERNEL); + ir = devm_kzalloc_obj(&intf->dev, *ir); if (!ir) return -ENOMEM; diff --git a/drivers/media/rc/img-ir/img-ir-core.c b/drivers/media/rc/img-ir/img-ir-core.c index 067f4bc7fcc3..1eb8fd664041 100644 --- a/drivers/media/rc/img-ir/img-ir-core.c +++ b/drivers/media/rc/img-ir/img-ir-core.c @@ -84,7 +84,7 @@ static int img_ir_probe(struct platform_device *pdev) return irq; /* Private driver data */ - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/rc/imon_raw.c b/drivers/media/rc/imon_raw.c index a7cabdf055c7..0b7b35846651 100644 --- a/drivers/media/rc/imon_raw.c +++ b/drivers/media/rc/imon_raw.c @@ -119,7 +119,7 @@ static int imon_probe(struct usb_interface *intf, return -ENODEV; } - imon = devm_kmalloc(&intf->dev, sizeof(*imon), GFP_KERNEL); + imon = devm_kmalloc_obj(&intf->dev, *imon); if (!imon) return -ENOMEM; diff --git a/drivers/media/rc/ir-hix5hd2.c b/drivers/media/rc/ir-hix5hd2.c index aa3de4d57a58..f74deb408218 100644 --- a/drivers/media/rc/ir-hix5hd2.c +++ b/drivers/media/rc/ir-hix5hd2.c @@ -256,7 +256,7 @@ static int hix5hd2_ir_probe(struct platform_device *pdev) const char *map_name; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/media/rc/ir-spi.c b/drivers/media/rc/ir-spi.c index 8e11487510af..56afae360e73 100644 --- a/drivers/media/rc/ir-spi.c +++ b/drivers/media/rc/ir-spi.c @@ -131,7 +131,7 @@ static int ir_spi_probe(struct spi_device *spi) u8 dc; struct ir_spi_data *idata; - idata = devm_kzalloc(dev, sizeof(*idata), GFP_KERNEL); + idata = devm_kzalloc_obj(dev, *idata); if (!idata) return -ENOMEM; diff --git a/drivers/media/rc/meson-ir-tx.c b/drivers/media/rc/meson-ir-tx.c index e07d2a8dcbbe..8b6c16f28896 100644 --- a/drivers/media/rc/meson-ir-tx.c +++ b/drivers/media/rc/meson-ir-tx.c @@ -318,7 +318,7 @@ static int meson_irtx_probe(struct platform_device *pdev) unsigned int clk_nr; int ret; - ir = devm_kzalloc(dev, sizeof(*ir), GFP_KERNEL); + ir = devm_kzalloc_obj(dev, *ir); if (!ir) return -ENOMEM; diff --git a/drivers/media/rc/meson-ir.c b/drivers/media/rc/meson-ir.c index 272ebb0d97c8..1db7ff0f60f0 100644 --- a/drivers/media/rc/meson-ir.c +++ b/drivers/media/rc/meson-ir.c @@ -451,7 +451,7 @@ static int meson_ir_probe(struct platform_device *pdev) struct meson_ir *ir; int irq, ret; - ir = devm_kzalloc(dev, sizeof(struct meson_ir), GFP_KERNEL); + ir = devm_kzalloc_obj(dev, struct meson_ir); if (!ir) return -ENOMEM; diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c index 85c9436b0a20..9192ec160a35 100644 --- a/drivers/media/rc/mtk-cir.c +++ b/drivers/media/rc/mtk-cir.c @@ -300,7 +300,7 @@ static int mtk_ir_probe(struct platform_device *pdev) int ret = 0; const char *map_name; - ir = devm_kzalloc(dev, sizeof(struct mtk_ir), GFP_KERNEL); + ir = devm_kzalloc_obj(dev, struct mtk_ir); if (!ir) return -ENOMEM; diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 918258dadd69..548c8bbc1467 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -918,7 +918,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) struct rc_dev *rdev; int ret; - nvt = devm_kzalloc(&pdev->dev, sizeof(struct nvt_dev), GFP_KERNEL); + nvt = devm_kzalloc_obj(&pdev->dev, struct nvt_dev); if (!nvt) return -ENOMEM; diff --git a/drivers/media/rc/pwm-ir-tx.c b/drivers/media/rc/pwm-ir-tx.c index 047472dc9244..1eb840ed0232 100644 --- a/drivers/media/rc/pwm-ir-tx.c +++ b/drivers/media/rc/pwm-ir-tx.c @@ -149,7 +149,7 @@ static int pwm_ir_probe(struct platform_device *pdev) struct rc_dev *rcdev; int rc; - pwm_ir = devm_kmalloc(&pdev->dev, sizeof(*pwm_ir), GFP_KERNEL); + pwm_ir = devm_kmalloc_obj(&pdev->dev, *pwm_ir); if (!pwm_ir) return -ENOMEM; diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c index 0ba06bfc9e14..211e06e74413 100644 --- a/drivers/media/rc/st_rc.c +++ b/drivers/media/rc/st_rc.c @@ -236,7 +236,7 @@ static int st_rc_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; const char *rx_mode; - rc_dev = devm_kzalloc(dev, sizeof(struct st_rc_device), GFP_KERNEL); + rc_dev = devm_kzalloc_obj(dev, struct st_rc_device); if (!rc_dev) return -ENOMEM; diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c index af1ee08ffdbe..e97bd9e03c1f 100644 --- a/drivers/media/rc/sunxi-cir.c +++ b/drivers/media/rc/sunxi-cir.c @@ -260,7 +260,7 @@ static int sunxi_ir_probe(struct platform_device *pdev) struct sunxi_ir *ir; u32 b_clk_freq = SUNXI_IR_BASE_CLK; - ir = devm_kzalloc(dev, sizeof(struct sunxi_ir), GFP_KERNEL); + ir = devm_kzalloc_obj(dev, struct sunxi_ir); if (!ir) return -ENOMEM; diff --git a/drivers/media/spi/gs1662.c b/drivers/media/spi/gs1662.c index 7adf55fd0707..06159b880c7c 100644 --- a/drivers/media/spi/gs1662.c +++ b/drivers/media/spi/gs1662.c @@ -436,7 +436,7 @@ static int gs_probe(struct spi_device *spi) struct gs *gs; struct v4l2_subdev *sd; - gs = devm_kzalloc(&spi->dev, sizeof(struct gs), GFP_KERNEL); + gs = devm_kzalloc_obj(&spi->dev, struct gs); if (!gs) return -ENOMEM; diff --git a/drivers/media/tuners/mt2060.c b/drivers/media/tuners/mt2060.c index c57233c7441a..f1853bf6905b 100644 --- a/drivers/media/tuners/mt2060.c +++ b/drivers/media/tuners/mt2060.c @@ -458,7 +458,7 @@ static int mt2060_probe(struct i2c_client *client) goto err; } - dev = devm_kzalloc(&client->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&client->dev, *dev); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index b0941cd2a2d8..e4119a3bf2e3 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -1724,7 +1724,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface, udev = interface_to_usbdev(interface); /* allocate memory for our device state and initialize it */ - dev = devm_kzalloc(&interface->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&interface->dev, *dev); if (dev == NULL) { retval = -ENOMEM; goto err_if; diff --git a/drivers/media/v4l2-core/v4l2-flash-led-class.c b/drivers/media/v4l2-core/v4l2-flash-led-class.c index 163badeef76f..2587544c6a2e 100644 --- a/drivers/media/v4l2-core/v4l2-flash-led-class.c +++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c @@ -435,10 +435,9 @@ static int v4l2_flash_init_controls(struct v4l2_flash *v4l2_flash, struct v4l2_ctrl_config *ctrl_cfg; int i, ret, num_ctrls = 0; - v4l2_flash->ctrls = devm_kcalloc(v4l2_flash->sd.dev, - STROBE_SOURCE + 1, - sizeof(*v4l2_flash->ctrls), - GFP_KERNEL); + v4l2_flash->ctrls = devm_kzalloc_objs(v4l2_flash->sd.dev, + *v4l2_flash->ctrls, + STROBE_SOURCE + 1); if (!v4l2_flash->ctrls) return -ENOMEM; @@ -661,7 +660,7 @@ static struct v4l2_flash *__v4l2_flash_init( if (!config) return ERR_PTR(-EINVAL); - v4l2_flash = devm_kzalloc(dev, sizeof(*v4l2_flash), GFP_KERNEL); + v4l2_flash = devm_kzalloc_obj(dev, *v4l2_flash); if (!v4l2_flash) return ERR_PTR(-ENOMEM); diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c index 1e8e8aba2542..cf6b404afaf1 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -332,8 +332,7 @@ static int atmel_ebi_dev_setup(struct atmel_ebi *ebi, struct device_node *np, return -EINVAL; } - ebid = devm_kzalloc(ebi->dev, struct_size(ebid, configs, numcs), - GFP_KERNEL); + ebid = devm_kzalloc_flex(ebi->dev, *ebid, configs, numcs); if (!ebid) return -ENOMEM; @@ -498,7 +497,7 @@ static int atmel_ebi_dev_disable(struct atmel_ebi *ebi, struct device_node *np) struct device *dev = ebi->dev; struct property *newprop; - newprop = devm_kzalloc(dev, sizeof(*newprop), GFP_KERNEL); + newprop = devm_kzalloc_obj(dev, *newprop); if (!newprop) return -ENOMEM; @@ -524,7 +523,7 @@ static int atmel_ebi_probe(struct platform_device *pdev) struct clk *clk; u32 val; - ebi = devm_kzalloc(dev, sizeof(*ebi), GFP_KERNEL); + ebi = devm_kzalloc_obj(dev, *ebi); if (!ebi) return -ENOMEM; diff --git a/drivers/memory/brcmstb_dpfe.c b/drivers/memory/brcmstb_dpfe.c index 04ae3cfb449e..aeae9874652c 100644 --- a/drivers/memory/brcmstb_dpfe.c +++ b/drivers/memory/brcmstb_dpfe.c @@ -877,7 +877,7 @@ static int brcmstb_dpfe_probe(struct platform_device *pdev) struct resource *res; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/memory/brcmstb_memc.c b/drivers/memory/brcmstb_memc.c index c28fe9093616..946736e3cb74 100644 --- a/drivers/memory/brcmstb_memc.c +++ b/drivers/memory/brcmstb_memc.c @@ -131,7 +131,7 @@ static int brcmstb_memc_probe(struct platform_device *pdev) struct brcmstb_memc *memc; int ret; - memc = devm_kzalloc(dev, sizeof(*memc), GFP_KERNEL); + memc = devm_kzalloc_obj(dev, *memc); if (!memc) return -ENOMEM; diff --git a/drivers/memory/dfl-emif.c b/drivers/memory/dfl-emif.c index da06cd30a016..e2de20b4ba80 100644 --- a/drivers/memory/dfl-emif.c +++ b/drivers/memory/dfl-emif.c @@ -223,7 +223,7 @@ static int dfl_emif_probe(struct dfl_device *ddev) struct device *dev = &ddev->dev; struct dfl_emif *de; - de = devm_kzalloc(dev, sizeof(*de), GFP_KERNEL); + de = devm_kzalloc_obj(dev, *de); if (!de) return -ENOMEM; diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index 886c2ca0dc19..b5d41ebb19f3 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c @@ -836,8 +836,7 @@ static void of_get_custom_configs(struct device_node *np_emif, poll_intvl = of_get_property(np_emif, "temp-alert-poll-interval", &len); if (lpmode || poll_intvl) - cust_cfgs = devm_kzalloc(emif->dev, sizeof(*cust_cfgs), - GFP_KERNEL); + cust_cfgs = devm_kzalloc_obj(emif->dev, *cust_cfgs); if (!cust_cfgs) return; @@ -915,9 +914,9 @@ static struct emif_data *of_get_memory_device_details( np_ddr = of_parse_phandle(np_emif, "device-handle", 0); if (!np_ddr) goto error; - emif = devm_kzalloc(dev, sizeof(struct emif_data), GFP_KERNEL); - pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); - dev_info = devm_kzalloc(dev, sizeof(*dev_info), GFP_KERNEL); + emif = devm_kzalloc_obj(dev, struct emif_data); + pd = devm_kzalloc_obj(dev, *pd); + dev_info = devm_kzalloc_obj(dev, *dev_info); if (!emif || !pd || !dev_info) { dev_err(dev, "%s: Out of memory!!\n", @@ -999,9 +998,9 @@ static struct emif_data *get_device_details( goto error; } - emif = devm_kzalloc(dev, sizeof(*emif), GFP_KERNEL); - temp = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); - dev_info = devm_kzalloc(dev, sizeof(*dev_info), GFP_KERNEL); + emif = devm_kzalloc_obj(dev, *emif); + temp = devm_kzalloc_obj(dev, *pd); + dev_info = devm_kzalloc_obj(dev, *dev_info); if (!emif || !temp || !dev_info) goto error; @@ -1040,7 +1039,7 @@ static struct emif_data *get_device_details( */ cust_cfgs = pd->custom_configs; if (cust_cfgs && is_custom_config_valid(cust_cfgs, dev)) { - temp = devm_kzalloc(dev, sizeof(*cust_cfgs), GFP_KERNEL); + temp = devm_kzalloc_obj(dev, *cust_cfgs); if (temp) memcpy(temp, cust_cfgs, sizeof(*cust_cfgs)); pd->custom_configs = temp; @@ -1064,8 +1063,7 @@ static struct emif_data *get_device_details( } if (pd->min_tck) { - temp = devm_kzalloc(dev, sizeof(struct lpddr2_min_tck), - GFP_KERNEL); + temp = devm_kzalloc_obj(dev, struct lpddr2_min_tck); if (temp) { memcpy(temp, pd->min_tck, sizeof(*pd->min_tck)); pd->min_tck = temp; diff --git a/drivers/memory/fsl-corenet-cf.c b/drivers/memory/fsl-corenet-cf.c index ecd6c1955153..4fa5cd20df94 100644 --- a/drivers/memory/fsl-corenet-cf.c +++ b/drivers/memory/fsl-corenet-cf.c @@ -173,7 +173,7 @@ static int ccf_probe(struct platform_device *pdev) u32 errinten; int ret, irq; - ccf = devm_kzalloc(&pdev->dev, sizeof(*ccf), GFP_KERNEL); + ccf = devm_kzalloc_obj(&pdev->dev, *ccf); if (!ccf) return -ENOMEM; diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c index e89e0c6cc4bc..db2d239aeba8 100644 --- a/drivers/memory/fsl_ifc.c +++ b/drivers/memory/fsl_ifc.c @@ -207,8 +207,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev) dev_info(&dev->dev, "Freescale Integrated Flash Controller\n"); - fsl_ifc_ctrl_dev = devm_kzalloc(&dev->dev, sizeof(*fsl_ifc_ctrl_dev), - GFP_KERNEL); + fsl_ifc_ctrl_dev = devm_kzalloc_obj(&dev->dev, *fsl_ifc_ctrl_dev); if (!fsl_ifc_ctrl_dev) return -ENOMEM; diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c index 1bf17057cbf5..36fc05609ff8 100644 --- a/drivers/memory/jz4780-nemc.c +++ b/drivers/memory/jz4780-nemc.c @@ -278,7 +278,7 @@ static int jz4780_nemc_probe(struct platform_device *pdev) unsigned long referenced; int i, ret; - nemc = devm_kzalloc(dev, sizeof(*nemc), GFP_KERNEL); + nemc = devm_kzalloc_obj(dev, *nemc); if (!nemc) return -ENOMEM; diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 8c4606cbd73d..66bc2289f635 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -679,7 +679,7 @@ static int mtk_smi_larb_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - larb = devm_kzalloc(dev, sizeof(*larb), GFP_KERNEL); + larb = devm_kzalloc_obj(dev, *larb); if (!larb) return -ENOMEM; @@ -912,7 +912,7 @@ static int mtk_smi_common_probe(struct platform_device *pdev) struct mtk_smi *common; int ret, clk_required = MTK_SMI_COM_REQ_CLK_NR; - common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); + common = devm_kzalloc_obj(dev, *common); if (!common) return -ENOMEM; common->dev = dev; diff --git a/drivers/memory/mvebu-devbus.c b/drivers/memory/mvebu-devbus.c index 406fddcdba02..3050f718919c 100644 --- a/drivers/memory/mvebu-devbus.c +++ b/drivers/memory/mvebu-devbus.c @@ -271,7 +271,7 @@ static int mvebu_devbus_probe(struct platform_device *pdev) unsigned long rate; int err; - devbus = devm_kzalloc(&pdev->dev, sizeof(struct devbus), GFP_KERNEL); + devbus = devm_kzalloc_obj(&pdev->dev, struct devbus); if (!devbus) return -ENOMEM; diff --git a/drivers/memory/of_memory.c b/drivers/memory/of_memory.c index fcd20d85d385..c834b2a94744 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -31,7 +31,7 @@ const struct lpddr2_min_tck *of_get_min_tck(struct device_node *np, int ret = 0; struct lpddr2_min_tck *min; - min = devm_kzalloc(dev, sizeof(*min), GFP_KERNEL); + min = devm_kzalloc_obj(dev, *min); if (!min) goto default_min_tck; @@ -125,8 +125,7 @@ const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr, arr_sz++; if (arr_sz) - timings = devm_kcalloc(dev, arr_sz, sizeof(*timings), - GFP_KERNEL); + timings = devm_kzalloc_objs(dev, *timings, arr_sz); if (!timings) goto default_timings; @@ -168,7 +167,7 @@ const struct lpddr3_min_tck *of_lpddr3_get_min_tck(struct device_node *np, int ret = 0; struct lpddr3_min_tck *min; - min = devm_kzalloc(dev, sizeof(*min), GFP_KERNEL); + min = devm_kzalloc_obj(dev, *min); if (!min) goto default_min_tck; @@ -275,8 +274,7 @@ const struct lpddr3_timings arr_sz++; if (arr_sz) - timings = devm_kcalloc(dev, arr_sz, sizeof(*timings), - GFP_KERNEL); + timings = devm_kzalloc_objs(dev, *timings, arr_sz); if (!timings) goto default_timings; @@ -389,7 +387,7 @@ const struct lpddr2_info if (!info.manufacturer_id) info.manufacturer_id = -ENOENT; - ret_info = devm_kzalloc(dev, sizeof(*ret_info), GFP_KERNEL); + ret_info = devm_kzalloc_obj(dev, *ret_info); if (ret_info) *ret_info = info; diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index 48af31a54b55..e1d3388f48db 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c @@ -2526,7 +2526,7 @@ static int gpmc_probe(struct platform_device *pdev) struct resource *res; struct gpmc_device *gpmc; - gpmc = devm_kzalloc(&pdev->dev, sizeof(*gpmc), GFP_KERNEL); + gpmc = devm_kzalloc_obj(&pdev->dev, *gpmc); if (!gpmc) return -ENOMEM; diff --git a/drivers/memory/pl172.c b/drivers/memory/pl172.c index be7ba599cccf..e7490480e640 100644 --- a/drivers/memory/pl172.c +++ b/drivers/memory/pl172.c @@ -219,7 +219,7 @@ static int pl172_probe(struct amba_device *adev, const struct amba_id *id) dev_info(dev, "ARM PL%x revision %s\n", amba_part(adev), rev); - pl172 = devm_kzalloc(dev, sizeof(*pl172), GFP_KERNEL); + pl172 = devm_kzalloc_obj(dev, *pl172); if (!pl172) return -ENOMEM; diff --git a/drivers/memory/pl353-smc.c b/drivers/memory/pl353-smc.c index 28a8cc56003c..5afd04c88dc4 100644 --- a/drivers/memory/pl353-smc.c +++ b/drivers/memory/pl353-smc.c @@ -75,7 +75,7 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id) const struct of_device_id *match = NULL; struct pl353_smc_data *pl353_smc; - pl353_smc = devm_kzalloc(&adev->dev, sizeof(*pl353_smc), GFP_KERNEL); + pl353_smc = devm_kzalloc_obj(&adev->dev, *pl353_smc); if (!pl353_smc) return -ENOMEM; diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c index ec901a5a99aa..2058a4af1313 100644 --- a/drivers/memory/renesas-rpc-if.c +++ b/drivers/memory/renesas-rpc-if.c @@ -981,7 +981,7 @@ static int rpcif_probe(struct platform_device *pdev) } of_node_put(flash); - rpc = devm_kzalloc(dev, sizeof(*rpc), GFP_KERNEL); + rpc = devm_kzalloc_obj(dev, *rpc); if (!rpc) return -ENOMEM; diff --git a/drivers/memory/samsung/exynos-srom.c b/drivers/memory/samsung/exynos-srom.c index fcef4aed0292..d57221f51742 100644 --- a/drivers/memory/samsung/exynos-srom.c +++ b/drivers/memory/samsung/exynos-srom.c @@ -115,8 +115,7 @@ static int exynos_srom_probe(struct platform_device *pdev) return -EINVAL; } - srom = devm_kzalloc(&pdev->dev, - sizeof(struct exynos_srom), GFP_KERNEL); + srom = devm_kzalloc_obj(&pdev->dev, struct exynos_srom); if (!srom) return -ENOMEM; diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c index 98c319552583..076dc1c3e5f7 100644 --- a/drivers/memory/samsung/exynos5422-dmc.c +++ b/drivers/memory/samsung/exynos5422-dmc.c @@ -353,8 +353,7 @@ static int exynos5_init_freq_table(struct exynos5_dmc *dmc, dmc->opp_count = dev_pm_opp_get_opp_count(dev); - dmc->opp = devm_kmalloc_array(dev, dmc->opp_count, - sizeof(struct dmc_opp_table), GFP_KERNEL); + dmc->opp = devm_kmalloc_objs(dev, struct dmc_opp_table, dmc->opp_count); if (!dmc->opp) return -ENOMEM; @@ -1188,18 +1187,15 @@ static int of_get_dram_timings(struct exynos5_dmc *dmc) return -EINVAL; } - dmc->timing_row = devm_kmalloc_array(dev, TIMING_COUNT, - sizeof(u32), GFP_KERNEL); + dmc->timing_row = devm_kmalloc_objs(dev, u32, TIMING_COUNT); if (!dmc->timing_row) return -ENOMEM; - dmc->timing_data = devm_kmalloc_array(dev, TIMING_COUNT, - sizeof(u32), GFP_KERNEL); + dmc->timing_data = devm_kmalloc_objs(dev, u32, TIMING_COUNT); if (!dmc->timing_data) return -ENOMEM; - dmc->timing_power = devm_kmalloc_array(dev, TIMING_COUNT, - sizeof(u32), GFP_KERNEL); + dmc->timing_power = devm_kmalloc_objs(dev, u32, TIMING_COUNT); if (!dmc->timing_power) return -ENOMEM; @@ -1338,8 +1334,7 @@ static int exynos5_performance_counters_init(struct exynos5_dmc *dmc) return dmc->num_counters; } - dmc->counter = devm_kcalloc(dev, dmc->num_counters, - sizeof(*dmc->counter), GFP_KERNEL); + dmc->counter = devm_kzalloc_objs(dev, *dmc->counter, dmc->num_counters); if (!dmc->counter) return -ENOMEM; @@ -1424,7 +1419,7 @@ static int exynos5_dmc_probe(struct platform_device *pdev) struct exynos5_dmc *dmc; int irq[2]; - dmc = devm_kzalloc(dev, sizeof(*dmc), GFP_KERNEL); + dmc = devm_kzalloc_obj(dev, *dmc); if (!dmc) return -ENOMEM; diff --git a/drivers/memory/stm32-fmc2-ebi.c b/drivers/memory/stm32-fmc2-ebi.c index 6e386ab54091..7296014c3bd7 100644 --- a/drivers/memory/stm32-fmc2-ebi.c +++ b/drivers/memory/stm32-fmc2-ebi.c @@ -1634,7 +1634,7 @@ static int stm32_fmc2_ebi_probe(struct platform_device *pdev) struct reset_control *rstc; int ret; - ebi = devm_kzalloc(&pdev->dev, sizeof(*ebi), GFP_KERNEL); + ebi = devm_kzalloc_obj(&pdev->dev, *ebi); if (!ebi) return -ENOMEM; diff --git a/drivers/memory/stm32_omm.c b/drivers/memory/stm32_omm.c index 3599683ab04a..e5d646e0a13c 100644 --- a/drivers/memory/stm32_omm.c +++ b/drivers/memory/stm32_omm.c @@ -303,7 +303,7 @@ static int stm32_omm_probe(struct platform_device *pdev) struct stm32_omm *omm; int i, ret; - omm = devm_kzalloc(dev, sizeof(*omm), GFP_KERNEL); + omm = devm_kzalloc_obj(dev, *omm); if (!omm) return -ENOMEM; diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c index 458ce99916ad..de5e8bbc4ca0 100644 --- a/drivers/memory/tegra/mc.c +++ b/drivers/memory/tegra/mc.c @@ -485,8 +485,7 @@ static int load_timings(struct tegra_mc *mc, struct device_node *node) int child_count = of_get_child_count(node); int i = 0, err; - mc->timings = devm_kcalloc(mc->dev, child_count, sizeof(*timing), - GFP_KERNEL); + mc->timings = devm_kzalloc_objs(mc->dev, *timing, child_count); if (!mc->timings) return -ENOMEM; @@ -956,7 +955,7 @@ static int tegra_mc_probe(struct platform_device *pdev) u64 mask; int err; - mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL); + mc = devm_kzalloc_obj(&pdev->dev, *mc); if (!mc) return -ENOMEM; diff --git a/drivers/memory/tegra/tegra114-emc.c b/drivers/memory/tegra/tegra114-emc.c index e50d71842d3a..866341f475e0 100644 --- a/drivers/memory/tegra/tegra114-emc.c +++ b/drivers/memory/tegra/tegra114-emc.c @@ -922,8 +922,7 @@ static int tegra114_emc_load_timings_from_dt(struct tegra_emc *emc, unsigned int i = 0; int err; - emc->timings = devm_kcalloc(emc->dev, child_count, sizeof(*timing), - GFP_KERNEL); + emc->timings = devm_kzalloc_objs(emc->dev, *timing, child_count); if (!emc->timings) return -ENOMEM; @@ -1251,7 +1250,7 @@ static int tegra114_emc_probe(struct platform_device *pdev) u32 ram_code; int err; - emc = devm_kzalloc(dev, sizeof(*emc), GFP_KERNEL); + emc = devm_kzalloc_obj(dev, *emc); if (!emc) return -ENOMEM; diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c index 555a6c753be7..44ac48644f3c 100644 --- a/drivers/memory/tegra/tegra124-emc.c +++ b/drivers/memory/tegra/tegra124-emc.c @@ -977,8 +977,7 @@ static int tegra124_emc_load_timings_from_dt(struct tegra_emc *emc, unsigned int i = 0; int err; - emc->timings = devm_kcalloc(emc->dev, child_count, sizeof(*timing), - GFP_KERNEL); + emc->timings = devm_kzalloc_objs(emc->dev, *timing, child_count); if (!emc->timings) return -ENOMEM; @@ -1343,7 +1342,7 @@ static int tegra124_emc_probe(struct platform_device *pdev) u32 ram_code; int err; - emc = devm_kzalloc(&pdev->dev, sizeof(*emc), GFP_KERNEL); + emc = devm_kzalloc_obj(&pdev->dev, *emc); if (!emc) return -ENOMEM; diff --git a/drivers/memory/tegra/tegra186-emc.c b/drivers/memory/tegra/tegra186-emc.c index c9583b66f18d..9dd1f0a95295 100644 --- a/drivers/memory/tegra/tegra186-emc.c +++ b/drivers/memory/tegra/tegra186-emc.c @@ -185,7 +185,7 @@ static int tegra186_emc_get_emc_dvfs_latency(struct tegra186_emc *emc) emc->num_dvfs = response.num_pairs; - emc->dvfs = devm_kmalloc_array(emc->dev, emc->num_dvfs, sizeof(*emc->dvfs), GFP_KERNEL); + emc->dvfs = devm_kmalloc_objs(emc->dev, *emc->dvfs, emc->num_dvfs); if (!emc->dvfs) return -ENOMEM; @@ -337,7 +337,7 @@ static int tegra186_emc_probe(struct platform_device *pdev) struct tegra186_emc *emc; int err; - emc = devm_kzalloc(&pdev->dev, sizeof(*emc), GFP_KERNEL); + emc = devm_kzalloc_obj(&pdev->dev, *emc); if (!emc) return -ENOMEM; diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c index 442edb2b033e..103f327b6365 100644 --- a/drivers/memory/tegra/tegra186.c +++ b/drivers/memory/tegra/tegra186.c @@ -54,8 +54,8 @@ static int tegra186_mc_probe(struct tegra_mc *mc) return PTR_ERR(mc->bcast_ch_regs); } - mc->ch_regs = devm_kcalloc(mc->dev, mc->soc->num_channels, sizeof(*mc->ch_regs), - GFP_KERNEL); + mc->ch_regs = devm_kzalloc_objs(mc->dev, *mc->ch_regs, + mc->soc->num_channels); if (!mc->ch_regs) return -ENOMEM; diff --git a/drivers/memory/tegra/tegra20-emc.c b/drivers/memory/tegra/tegra20-emc.c index 1d564b80e2bb..5a6af74d5384 100644 --- a/drivers/memory/tegra/tegra20-emc.c +++ b/drivers/memory/tegra/tegra20-emc.c @@ -402,8 +402,7 @@ static int tegra20_emc_load_timings_from_dt(struct tegra_emc *emc, return -EINVAL; } - emc->timings = devm_kcalloc(emc->dev, child_count, sizeof(*timing), - GFP_KERNEL); + emc->timings = devm_kzalloc_objs(emc->dev, *timing, child_count); if (!emc->timings) return -ENOMEM; @@ -1091,7 +1090,7 @@ static int tegra20_emc_probe(struct platform_device *pdev) if (irq < 0) return irq; - emc = devm_kzalloc(&pdev->dev, sizeof(*emc), GFP_KERNEL); + emc = devm_kzalloc_obj(&pdev->dev, *emc); if (!emc) return -ENOMEM; diff --git a/drivers/memory/tegra/tegra210-emc-core.c b/drivers/memory/tegra/tegra210-emc-core.c index e8d4cd8fdec2..2ee8249b2005 100644 --- a/drivers/memory/tegra/tegra210-emc-core.c +++ b/drivers/memory/tegra/tegra210-emc-core.c @@ -1816,7 +1816,7 @@ static int tegra210_emc_probe(struct platform_device *pdev) unsigned int i; int err; - emc = devm_kzalloc(&pdev->dev, sizeof(*emc), GFP_KERNEL); + emc = devm_kzalloc_obj(&pdev->dev, *emc); if (!emc) return -ENOMEM; @@ -1919,9 +1919,9 @@ static int tegra210_emc_probe(struct platform_device *pdev) emc->provider.dev = &pdev->dev; emc->provider.set_rate = tegra210_emc_set_rate; - emc->provider.configs = devm_kcalloc(&pdev->dev, emc->num_timings, - sizeof(*emc->provider.configs), - GFP_KERNEL); + emc->provider.configs = devm_kzalloc_objs(&pdev->dev, + *emc->provider.configs, + emc->num_timings); if (!emc->provider.configs) { err = -ENOMEM; goto release; diff --git a/drivers/memory/tegra/tegra30-emc.c b/drivers/memory/tegra/tegra30-emc.c index c1eacd66ce49..cfedaf96d1d8 100644 --- a/drivers/memory/tegra/tegra30-emc.c +++ b/drivers/memory/tegra/tegra30-emc.c @@ -972,8 +972,7 @@ static int emc_load_timings_from_dt(struct tegra_emc *emc, return -EINVAL; } - emc->timings = devm_kcalloc(emc->dev, child_count, sizeof(*timing), - GFP_KERNEL); + emc->timings = devm_kzalloc_objs(emc->dev, *timing, child_count); if (!emc->timings) return -ENOMEM; @@ -1520,7 +1519,7 @@ static int tegra30_emc_probe(struct platform_device *pdev) struct tegra_emc *emc; int err; - emc = devm_kzalloc(&pdev->dev, sizeof(*emc), GFP_KERNEL); + emc = devm_kzalloc_obj(&pdev->dev, *emc); if (!emc) return -ENOMEM; diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c index c8b83c9edbd5..f9c901611430 100644 --- a/drivers/memory/ti-aemif.c +++ b/drivers/memory/ti-aemif.c @@ -370,7 +370,7 @@ static int aemif_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; struct aemif_device *aemif; - aemif = devm_kzalloc(dev, sizeof(*aemif), GFP_KERNEL); + aemif = devm_kzalloc_obj(dev, *aemif); if (!aemif) return -ENOMEM; diff --git a/drivers/memory/ti-emif-pm.c b/drivers/memory/ti-emif-pm.c index df362ecc59e9..f46ed36e2922 100644 --- a/drivers/memory/ti-emif-pm.c +++ b/drivers/memory/ti-emif-pm.c @@ -279,7 +279,7 @@ static int ti_emif_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct ti_emif_data *emif_data; - emif_data = devm_kzalloc(dev, sizeof(*emif_data), GFP_KERNEL); + emif_data = devm_kzalloc_obj(dev, *emif_data); if (!emif_data) return -ENOMEM; diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 7f3e312b8f73..98f1ebe38f71 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -544,8 +544,7 @@ static int pm800_probe(struct i2c_client *client) /* init subchip for PM800 */ subchip = - devm_kzalloc(&client->dev, sizeof(struct pm80x_subchip), - GFP_KERNEL); + devm_kzalloc_obj(&client->dev, struct pm80x_subchip); if (!subchip) { ret = -ENOMEM; goto err_subchip_alloc; diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index bbc1a87f0c8f..51039677223a 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -56,7 +56,7 @@ int pm80x_init(struct i2c_client *client) int i, ret = 0; chip = - devm_kzalloc(&client->dev, sizeof(struct pm80x_chip), GFP_KERNEL); + devm_kzalloc_obj(&client->dev, struct pm80x_chip); if (!chip) return -ENOMEM; diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c index 77230fbe07be..c64a13e677a7 100644 --- a/drivers/mfd/88pm860x-core.c +++ b/drivers/mfd/88pm860x-core.c @@ -1136,9 +1136,8 @@ static int pm860x_probe(struct i2c_client *client) if (node && !pdata) { /* parse DT to get platform data */ - pdata = devm_kzalloc(&client->dev, - sizeof(struct pm860x_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc_obj(&client->dev, + struct pm860x_platform_data); if (!pdata) return -ENOMEM; ret = pm860x_dt_init(node, &client->dev, pdata); @@ -1149,8 +1148,7 @@ static int pm860x_probe(struct i2c_client *client) return -EINVAL; } - chip = devm_kzalloc(&client->dev, - sizeof(struct pm860x_chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, struct pm860x_chip); if (chip == NULL) return -ENOMEM; diff --git a/drivers/mfd/88pm886.c b/drivers/mfd/88pm886.c index f8401d5e6dbe..7589d6309259 100644 --- a/drivers/mfd/88pm886.c +++ b/drivers/mfd/88pm886.c @@ -99,7 +99,7 @@ static int pm886_probe(struct i2c_client *client) unsigned int chip_id; int err; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c index 0d56cd6fbc6a..5d43fd1da96e 100644 --- a/drivers/mfd/aat2870-core.c +++ b/drivers/mfd/aat2870-core.c @@ -337,8 +337,7 @@ static int aat2870_i2c_probe(struct i2c_client *client) int i, j; int ret = 0; - aat2870 = devm_kzalloc(&client->dev, sizeof(struct aat2870_data), - GFP_KERNEL); + aat2870 = devm_kzalloc_obj(&client->dev, struct aat2870_data); if (!aat2870) return -ENOMEM; diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index d5602b2f4a0e..1dc41bb9286d 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -1025,7 +1025,7 @@ static int ab8500_probe(struct platform_device *pdev) int irq; u8 value; - ab8500 = devm_kzalloc(&pdev->dev, sizeof(*ab8500), GFP_KERNEL); + ab8500 = devm_kzalloc_obj(&pdev->dev, *ab8500); if (!ab8500) return -ENOMEM; diff --git a/drivers/mfd/abx500-core.c b/drivers/mfd/abx500-core.c index e896531d0354..5de59ef4f8db 100644 --- a/drivers/mfd/abx500-core.c +++ b/drivers/mfd/abx500-core.c @@ -37,7 +37,7 @@ int abx500_register_ops(struct device *dev, struct abx500_ops *ops) { struct abx500_device_entry *dev_entry; - dev_entry = devm_kzalloc(dev, sizeof(*dev_entry), GFP_KERNEL); + dev_entry = devm_kzalloc_obj(dev, *dev_entry); if (!dev_entry) return -ENOMEM; diff --git a/drivers/mfd/ac100.c b/drivers/mfd/ac100.c index 8f47c392cbd1..c088d715d7df 100644 --- a/drivers/mfd/ac100.c +++ b/drivers/mfd/ac100.c @@ -90,7 +90,7 @@ static int ac100_rsb_probe(struct sunxi_rsb_device *rdev) struct ac100_dev *ac100; int ret; - ac100 = devm_kzalloc(&rdev->dev, sizeof(*ac100), GFP_KERNEL); + ac100 = devm_kzalloc_obj(&rdev->dev, *ac100); if (!ac100) return -ENOMEM; diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c index bd6f4965ebc8..38fbdeef51cc 100644 --- a/drivers/mfd/adp5520.c +++ b/drivers/mfd/adp5520.c @@ -223,7 +223,7 @@ static int adp5520_probe(struct i2c_client *client) return -ENODEV; } - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/mfd/adp5585.c b/drivers/mfd/adp5585.c index aad1d734baeb..babd97ad6c20 100644 --- a/drivers/mfd/adp5585.c +++ b/drivers/mfd/adp5585.c @@ -693,7 +693,7 @@ static int adp5585_i2c_probe(struct i2c_client *i2c) unsigned int id; int ret; - adp5585 = devm_kzalloc(&i2c->dev, sizeof(*adp5585), GFP_KERNEL); + adp5585 = devm_kzalloc_obj(&i2c->dev, *adp5585); if (!adp5585) return -ENOMEM; diff --git a/drivers/mfd/altera-a10sr.c b/drivers/mfd/altera-a10sr.c index 9c0262228655..b4abb37dcd19 100644 --- a/drivers/mfd/altera-a10sr.c +++ b/drivers/mfd/altera-a10sr.c @@ -115,8 +115,7 @@ static int altr_a10sr_spi_probe(struct spi_device *spi) int ret; struct altr_a10sr *a10sr; - a10sr = devm_kzalloc(&spi->dev, sizeof(*a10sr), - GFP_KERNEL); + a10sr = devm_kzalloc_obj(&spi->dev, *a10sr); if (!a10sr) return -ENOMEM; diff --git a/drivers/mfd/altera-sysmgr.c b/drivers/mfd/altera-sysmgr.c index 90c6902d537d..1ad46dbcbab7 100644 --- a/drivers/mfd/altera-sysmgr.c +++ b/drivers/mfd/altera-sysmgr.c @@ -133,7 +133,7 @@ static int sysmgr_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; void __iomem *base; - sysmgr = devm_kzalloc(dev, sizeof(*sysmgr), GFP_KERNEL); + sysmgr = devm_kzalloc_obj(dev, *sysmgr); if (!sysmgr) return -ENOMEM; diff --git a/drivers/mfd/arizona-i2c.c b/drivers/mfd/arizona-i2c.c index 10e76fc8f12e..767c5dfd4db6 100644 --- a/drivers/mfd/arizona-i2c.c +++ b/drivers/mfd/arizona-i2c.c @@ -58,7 +58,7 @@ static int arizona_i2c_probe(struct i2c_client *i2c) return -EINVAL; } - arizona = devm_kzalloc(&i2c->dev, sizeof(*arizona), GFP_KERNEL); + arizona = devm_kzalloc_obj(&i2c->dev, *arizona); if (arizona == NULL) return -ENOMEM; diff --git a/drivers/mfd/arizona-spi.c b/drivers/mfd/arizona-spi.c index 04baf5a1c652..57e97f1b9f1d 100644 --- a/drivers/mfd/arizona-spi.c +++ b/drivers/mfd/arizona-spi.c @@ -59,9 +59,8 @@ static int arizona_spi_acpi_windows_probe(struct arizona *arizona) devm_acpi_dev_add_driver_gpios(arizona->dev, arizona_acpi_gpios); /* Add lookups for the SoCs own GPIOs used for micdet-polarity and spkVDD-enable */ - lookup = devm_kzalloc(arizona->dev, - struct_size(lookup, table, ARRAY_SIZE(arizona_soc_gpios) + 1), - GFP_KERNEL); + lookup = devm_kzalloc_flex(arizona->dev, *lookup, table, + ARRAY_SIZE(arizona_soc_gpios) + 1); if (!lookup) return -ENOMEM; @@ -222,7 +221,7 @@ static int arizona_spi_probe(struct spi_device *spi) return -EINVAL; } - arizona = devm_kzalloc(&spi->dev, sizeof(*arizona), GFP_KERNEL); + arizona = devm_kzalloc_obj(&spi->dev, *arizona); if (arizona == NULL) return -ENOMEM; diff --git a/drivers/mfd/as3711.c b/drivers/mfd/as3711.c index 9741977031df..b123195d911c 100644 --- a/drivers/mfd/as3711.c +++ b/drivers/mfd/as3711.c @@ -128,13 +128,12 @@ static int as3711_i2c_probe(struct i2c_client *client) if (!pdata) dev_dbg(&client->dev, "Platform data not found\n"); } else { - pdata = devm_kzalloc(&client->dev, - sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&client->dev, *pdata); if (!pdata) return -ENOMEM; } - as3711 = devm_kzalloc(&client->dev, sizeof(struct as3711), GFP_KERNEL); + as3711 = devm_kzalloc_obj(&client->dev, struct as3711); if (!as3711) return -ENOMEM; diff --git a/drivers/mfd/as3722.c b/drivers/mfd/as3722.c index 7ab6fcc9c27c..0a7f8e7d7619 100644 --- a/drivers/mfd/as3722.c +++ b/drivers/mfd/as3722.c @@ -340,7 +340,7 @@ static int as3722_i2c_probe(struct i2c_client *i2c) int ret; u8 val = 0; - as3722 = devm_kzalloc(&i2c->dev, sizeof(struct as3722), GFP_KERNEL); + as3722 = devm_kzalloc_obj(&i2c->dev, struct as3722); if (!as3722) return -ENOMEM; diff --git a/drivers/mfd/atc260x-core.c b/drivers/mfd/atc260x-core.c index 6b6d5f1b9d76..d4433e76ae01 100644 --- a/drivers/mfd/atc260x-core.c +++ b/drivers/mfd/atc260x-core.c @@ -228,8 +228,7 @@ int atc260x_match_device(struct atc260x *atc260x, struct regmap_config *regmap_c return -EINVAL; } - atc260x->regmap_mutex = devm_kzalloc(dev, sizeof(*atc260x->regmap_mutex), - GFP_KERNEL); + atc260x->regmap_mutex = devm_kzalloc_obj(dev, *atc260x->regmap_mutex); if (!atc260x->regmap_mutex) return -ENOMEM; diff --git a/drivers/mfd/atc260x-i2c.c b/drivers/mfd/atc260x-i2c.c index fb53b0432a31..0b2cff716448 100644 --- a/drivers/mfd/atc260x-i2c.c +++ b/drivers/mfd/atc260x-i2c.c @@ -18,7 +18,7 @@ static int atc260x_i2c_probe(struct i2c_client *client) struct regmap_config regmap_cfg; int ret; - atc260x = devm_kzalloc(&client->dev, sizeof(*atc260x), GFP_KERNEL); + atc260x = devm_kzalloc_obj(&client->dev, *atc260x); if (!atc260x) return -ENOMEM; diff --git a/drivers/mfd/atmel-flexcom.c b/drivers/mfd/atmel-flexcom.c index d5df5466eaf5..e1458b026a0c 100644 --- a/drivers/mfd/atmel-flexcom.c +++ b/drivers/mfd/atmel-flexcom.c @@ -40,7 +40,7 @@ static int atmel_flexcom_probe(struct platform_device *pdev) struct atmel_flexcom *ddata; int err; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/mfd/atmel-hlcdc.c b/drivers/mfd/atmel-hlcdc.c index 2a3a05122176..4a10dac519ee 100644 --- a/drivers/mfd/atmel-hlcdc.c +++ b/drivers/mfd/atmel-hlcdc.c @@ -83,11 +83,11 @@ static int atmel_hlcdc_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct atmel_hlcdc *hlcdc; - hregmap = devm_kzalloc(dev, sizeof(*hregmap), GFP_KERNEL); + hregmap = devm_kzalloc_obj(dev, *hregmap); if (!hregmap) return -ENOMEM; - hlcdc = devm_kzalloc(dev, sizeof(*hlcdc), GFP_KERNEL); + hlcdc = devm_kzalloc_obj(dev, *hlcdc); if (!hlcdc) return -ENOMEM; diff --git a/drivers/mfd/axp20x-i2c.c b/drivers/mfd/axp20x-i2c.c index 5c93136f977e..9ddc73b8af43 100644 --- a/drivers/mfd/axp20x-i2c.c +++ b/drivers/mfd/axp20x-i2c.c @@ -27,7 +27,7 @@ static int axp20x_i2c_probe(struct i2c_client *i2c) struct axp20x_dev *axp20x; int ret; - axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL); + axp20x = devm_kzalloc_obj(&i2c->dev, *axp20x); if (!axp20x) return -ENOMEM; diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c index 059656f2a1bd..dfc665f696bd 100644 --- a/drivers/mfd/axp20x-rsb.c +++ b/drivers/mfd/axp20x-rsb.c @@ -27,7 +27,7 @@ static int axp20x_rsb_probe(struct sunxi_rsb_device *rdev) struct axp20x_dev *axp20x; int ret; - axp20x = devm_kzalloc(&rdev->dev, sizeof(*axp20x), GFP_KERNEL); + axp20x = devm_kzalloc_obj(&rdev->dev, *axp20x); if (!axp20x) return -ENOMEM; diff --git a/drivers/mfd/bcm2835-pm.c b/drivers/mfd/bcm2835-pm.c index 9e8e3dcf4bce..14b18dc38058 100644 --- a/drivers/mfd/bcm2835-pm.c +++ b/drivers/mfd/bcm2835-pm.c @@ -75,7 +75,7 @@ static int bcm2835_pm_probe(struct platform_device *pdev) struct bcm2835_pm *pm; int ret; - pm = devm_kzalloc(dev, sizeof(*pm), GFP_KERNEL); + pm = devm_kzalloc_obj(dev, *pm); if (!pm) return -ENOMEM; platform_set_drvdata(pdev, pm); diff --git a/drivers/mfd/bcm590xx.c b/drivers/mfd/bcm590xx.c index 5a8456bbd63f..f553937c4075 100644 --- a/drivers/mfd/bcm590xx.c +++ b/drivers/mfd/bcm590xx.c @@ -92,7 +92,7 @@ static int bcm590xx_i2c_probe(struct i2c_client *i2c_pri) struct bcm590xx *bcm590xx; int ret; - bcm590xx = devm_kzalloc(&i2c_pri->dev, sizeof(*bcm590xx), GFP_KERNEL); + bcm590xx = devm_kzalloc_obj(&i2c_pri->dev, *bcm590xx); if (!bcm590xx) return -ENOMEM; diff --git a/drivers/mfd/bq257xx.c b/drivers/mfd/bq257xx.c index 01f5fc97f538..7c00d7e21dc7 100644 --- a/drivers/mfd/bq257xx.c +++ b/drivers/mfd/bq257xx.c @@ -93,7 +93,7 @@ static int bq257xx_probe(struct i2c_client *client) struct bq257xx_device *ddata; int ret; - ddata = devm_kzalloc(&client->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&client->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/mfd/cgbc-core.c b/drivers/mfd/cgbc-core.c index 2becaf797646..8a2020cdf3b3 100644 --- a/drivers/mfd/cgbc-core.c +++ b/drivers/mfd/cgbc-core.c @@ -343,7 +343,7 @@ static int cgbc_probe(struct platform_device *pdev) struct cgbc_device_data *cgbc; int ret; - cgbc = devm_kzalloc(dev, sizeof(*cgbc), GFP_KERNEL); + cgbc = devm_kzalloc_obj(dev, *cgbc); if (!cgbc) return -ENOMEM; diff --git a/drivers/mfd/cs40l50-i2c.c b/drivers/mfd/cs40l50-i2c.c index 639be743d956..13afbb73b223 100644 --- a/drivers/mfd/cs40l50-i2c.c +++ b/drivers/mfd/cs40l50-i2c.c @@ -15,7 +15,7 @@ static int cs40l50_i2c_probe(struct i2c_client *i2c) { struct cs40l50 *cs40l50; - cs40l50 = devm_kzalloc(&i2c->dev, sizeof(*cs40l50), GFP_KERNEL); + cs40l50 = devm_kzalloc_obj(&i2c->dev, *cs40l50); if (!cs40l50) return -ENOMEM; diff --git a/drivers/mfd/cs40l50-spi.c b/drivers/mfd/cs40l50-spi.c index a635951ca6b7..a213ef9a30d4 100644 --- a/drivers/mfd/cs40l50-spi.c +++ b/drivers/mfd/cs40l50-spi.c @@ -15,7 +15,7 @@ static int cs40l50_spi_probe(struct spi_device *spi) { struct cs40l50 *cs40l50; - cs40l50 = devm_kzalloc(&spi->dev, sizeof(*cs40l50), GFP_KERNEL); + cs40l50 = devm_kzalloc_obj(&spi->dev, *cs40l50); if (!cs40l50) return -ENOMEM; diff --git a/drivers/mfd/cs42l43-i2c.c b/drivers/mfd/cs42l43-i2c.c index 2f1862199618..c2eb9fd63a5d 100644 --- a/drivers/mfd/cs42l43-i2c.c +++ b/drivers/mfd/cs42l43-i2c.c @@ -38,7 +38,7 @@ static int cs42l43_i2c_probe(struct i2c_client *i2c) { struct cs42l43 *cs42l43; - cs42l43 = devm_kzalloc(&i2c->dev, sizeof(*cs42l43), GFP_KERNEL); + cs42l43 = devm_kzalloc_obj(&i2c->dev, *cs42l43); if (!cs42l43) return -ENOMEM; diff --git a/drivers/mfd/cs42l43-sdw.c b/drivers/mfd/cs42l43-sdw.c index 22e4c1fe9298..cd0132e3632b 100644 --- a/drivers/mfd/cs42l43-sdw.c +++ b/drivers/mfd/cs42l43-sdw.c @@ -164,7 +164,7 @@ static int cs42l43_sdw_probe(struct sdw_slave *sdw, const struct sdw_device_id * struct cs42l43 *cs42l43; struct device *dev = &sdw->dev; - cs42l43 = devm_kzalloc(dev, sizeof(*cs42l43), GFP_KERNEL); + cs42l43 = devm_kzalloc_obj(dev, *cs42l43); if (!cs42l43) return -ENOMEM; diff --git a/drivers/mfd/da903x.c b/drivers/mfd/da903x.c index e4ad48e1f139..43c85d8ebee3 100644 --- a/drivers/mfd/da903x.c +++ b/drivers/mfd/da903x.c @@ -510,8 +510,7 @@ static int da903x_probe(struct i2c_client *client) unsigned int tmp; int ret; - chip = devm_kzalloc(&client->dev, sizeof(struct da903x_chip), - GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, struct da903x_chip); if (chip == NULL) return -ENOMEM; diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c index fd000a21bcba..612f202ce02a 100644 --- a/drivers/mfd/da9052-i2c.c +++ b/drivers/mfd/da9052-i2c.c @@ -129,7 +129,7 @@ static int da9052_i2c_probe(struct i2c_client *client) struct da9052 *da9052; int ret; - da9052 = devm_kzalloc(&client->dev, sizeof(struct da9052), GFP_KERNEL); + da9052 = devm_kzalloc_obj(&client->dev, struct da9052); if (!da9052) return -ENOMEM; diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c index 29cf2c17fde1..d9f2d21c4d4d 100644 --- a/drivers/mfd/da9052-spi.c +++ b/drivers/mfd/da9052-spi.c @@ -23,7 +23,7 @@ static int da9052_spi_probe(struct spi_device *spi) const struct spi_device_id *id = spi_get_device_id(spi); struct da9052 *da9052; - da9052 = devm_kzalloc(&spi->dev, sizeof(struct da9052), GFP_KERNEL); + da9052 = devm_kzalloc_obj(&spi->dev, struct da9052); if (!da9052) return -ENOMEM; diff --git a/drivers/mfd/da9055-i2c.c b/drivers/mfd/da9055-i2c.c index 6c1981832aaf..b9fde5e5a102 100644 --- a/drivers/mfd/da9055-i2c.c +++ b/drivers/mfd/da9055-i2c.c @@ -19,7 +19,7 @@ static int da9055_i2c_probe(struct i2c_client *i2c) struct da9055 *da9055; int ret; - da9055 = devm_kzalloc(&i2c->dev, sizeof(struct da9055), GFP_KERNEL); + da9055 = devm_kzalloc_obj(&i2c->dev, struct da9055); if (!da9055) return -ENOMEM; diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c index ad198183aff7..9ee23abd61c7 100644 --- a/drivers/mfd/da9062-core.c +++ b/drivers/mfd/da9062-core.c @@ -599,7 +599,7 @@ static int da9062_i2c_probe(struct i2c_client *i2c) u32 trigger_type = 0; int ret; - chip = devm_kzalloc(&i2c->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&i2c->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c index a803b7440f09..fb13427b1b59 100644 --- a/drivers/mfd/da9063-i2c.c +++ b/drivers/mfd/da9063-i2c.c @@ -372,7 +372,7 @@ static int da9063_i2c_probe(struct i2c_client *i2c) struct da9063 *da9063; int ret; - da9063 = devm_kzalloc(&i2c->dev, sizeof(struct da9063), GFP_KERNEL); + da9063 = devm_kzalloc_obj(&i2c->dev, struct da9063); if (da9063 == NULL) return -ENOMEM; diff --git a/drivers/mfd/da9150-core.c b/drivers/mfd/da9150-core.c index 19325d72a27e..9af0af93cdee 100644 --- a/drivers/mfd/da9150-core.c +++ b/drivers/mfd/da9150-core.c @@ -399,7 +399,7 @@ static int da9150_probe(struct i2c_client *client) int qif_addr; int ret; - da9150 = devm_kzalloc(&client->dev, sizeof(*da9150), GFP_KERNEL); + da9150 = devm_kzalloc_obj(&client->dev, *da9150); if (!da9150) return -ENOMEM; diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c index 0b1e7fd7f5d7..70b75632a8d4 100644 --- a/drivers/mfd/dln2.c +++ b/drivers/mfd/dln2.c @@ -775,7 +775,7 @@ static int dln2_probe(struct usb_interface *interface, if (ret) return ret; - dln2 = devm_kzalloc(dev, sizeof(*dln2), GFP_KERNEL); + dln2 = devm_kzalloc_obj(dev, *dln2); if (!dln2) return -ENOMEM; diff --git a/drivers/mfd/ene-kb3930.c b/drivers/mfd/ene-kb3930.c index 086e0758d4cc..0a39ae66d2eb 100644 --- a/drivers/mfd/ene-kb3930.c +++ b/drivers/mfd/ene-kb3930.c @@ -127,7 +127,7 @@ static int kb3930_probe(struct i2c_client *client) unsigned int model; int ret; - ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/mfd/exynos-lpass.c b/drivers/mfd/exynos-lpass.c index 9bb2687c2835..646bdb888915 100644 --- a/drivers/mfd/exynos-lpass.c +++ b/drivers/mfd/exynos-lpass.c @@ -120,7 +120,7 @@ static int exynos_lpass_probe(struct platform_device *pdev) void __iomem *base_top; int ret; - lpass = devm_kzalloc(dev, sizeof(*lpass), GFP_KERNEL); + lpass = devm_kzalloc_obj(dev, *lpass); if (!lpass) return -ENOMEM; diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c index 467b1a23faeb..f2c204cc24fa 100644 --- a/drivers/mfd/fsl-imx25-tsadc.c +++ b/drivers/mfd/fsl-imx25-tsadc.c @@ -138,7 +138,7 @@ static int mx25_tsadc_probe(struct platform_device *pdev) int ret; void __iomem *iomem; - tsadc = devm_kzalloc(dev, sizeof(*tsadc), GFP_KERNEL); + tsadc = devm_kzalloc_obj(dev, *tsadc); if (!tsadc) return -ENOMEM; diff --git a/drivers/mfd/gateworks-gsc.c b/drivers/mfd/gateworks-gsc.c index a3301502ce6a..c034d54354f4 100644 --- a/drivers/mfd/gateworks-gsc.c +++ b/drivers/mfd/gateworks-gsc.c @@ -202,7 +202,7 @@ static int gsc_probe(struct i2c_client *client) int ret; unsigned int reg; - gsc = devm_kzalloc(dev, sizeof(*gsc), GFP_KERNEL); + gsc = devm_kzalloc_obj(dev, *gsc); if (!gsc) return -ENOMEM; diff --git a/drivers/mfd/hi6421-pmic-core.c b/drivers/mfd/hi6421-pmic-core.c index 5af24a438329..44099fffa465 100644 --- a/drivers/mfd/hi6421-pmic-core.c +++ b/drivers/mfd/hi6421-pmic-core.c @@ -58,7 +58,7 @@ static int hi6421_pmic_probe(struct platform_device *pdev) type = (uintptr_t)device_get_match_data(&pdev->dev); - pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); + pmic = devm_kzalloc_obj(&pdev->dev, *pmic); if (!pmic) return -ENOMEM; diff --git a/drivers/mfd/hi655x-pmic.c b/drivers/mfd/hi655x-pmic.c index 5cb392892c19..32c9c2bcd922 100644 --- a/drivers/mfd/hi655x-pmic.c +++ b/drivers/mfd/hi655x-pmic.c @@ -94,7 +94,7 @@ static int hi655x_pmic_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; void __iomem *base; - pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); + pmic = devm_kzalloc_obj(dev, *pmic); if (!pmic) return -ENOMEM; pmic->dev = dev; diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c index 29f30ef0da99..504ab271f7bb 100644 --- a/drivers/mfd/intel-lpss.c +++ b/drivers/mfd/intel-lpss.c @@ -392,7 +392,7 @@ int intel_lpss_probe(struct device *dev, if (info->irq < 0) return info->irq; - lpss = devm_kzalloc(dev, sizeof(*lpss), GFP_KERNEL); + lpss = devm_kzalloc_obj(dev, *lpss); if (!lpss) return -ENOMEM; diff --git a/drivers/mfd/intel-m10-bmc-pmci.c b/drivers/mfd/intel-m10-bmc-pmci.c index d213c6ec04ba..825a4cfd5d98 100644 --- a/drivers/mfd/intel-m10-bmc-pmci.c +++ b/drivers/mfd/intel-m10-bmc-pmci.c @@ -386,7 +386,7 @@ static int m10bmc_pmci_probe(struct dfl_device *ddev) struct indirect_ctx *ctx; int ret; - pmci = devm_kzalloc(dev, sizeof(*pmci), GFP_KERNEL); + pmci = devm_kzalloc_obj(dev, *pmci); if (!pmci) return -ENOMEM; @@ -397,7 +397,7 @@ static int m10bmc_pmci_probe(struct dfl_device *ddev) if (IS_ERR(pmci->base)) return PTR_ERR(pmci->base); - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/mfd/intel-m10-bmc-spi.c b/drivers/mfd/intel-m10-bmc-spi.c index 94b9c99bb4f8..20a46eba0230 100644 --- a/drivers/mfd/intel-m10-bmc-spi.c +++ b/drivers/mfd/intel-m10-bmc-spi.c @@ -66,7 +66,7 @@ static int intel_m10_bmc_spi_probe(struct spi_device *spi) struct intel_m10bmc *ddata; int ret; - ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/mfd/intel_pmc_bxt.c b/drivers/mfd/intel_pmc_bxt.c index e405d7513ca1..2819ff94f686 100644 --- a/drivers/mfd/intel_pmc_bxt.c +++ b/drivers/mfd/intel_pmc_bxt.c @@ -425,7 +425,7 @@ static int intel_pmc_probe(struct platform_device *pdev) struct intel_pmc_dev *pmc; int ret; - pmc = devm_kzalloc(&pdev->dev, sizeof(*pmc), GFP_KERNEL); + pmc = devm_kzalloc_obj(&pdev->dev, *pmc); if (!pmc) return -ENOMEM; diff --git a/drivers/mfd/intel_soc_pmic_bxtwc.c b/drivers/mfd/intel_soc_pmic_bxtwc.c index 117517c171b5..34e99e75460f 100644 --- a/drivers/mfd/intel_soc_pmic_bxtwc.c +++ b/drivers/mfd/intel_soc_pmic_bxtwc.c @@ -482,7 +482,7 @@ static int bxtwc_probe(struct platform_device *pdev) if (hrv != BROXTON_PMIC_WC_HRV) return dev_err_probe(dev, -ENODEV, "Invalid PMIC hardware revision: %llu\n", hrv); - pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); + pmic = devm_kzalloc_obj(dev, *pmic); if (!pmic) return -ENOMEM; diff --git a/drivers/mfd/intel_soc_pmic_chtdc_ti.c b/drivers/mfd/intel_soc_pmic_chtdc_ti.c index 6daf33e07ea0..7500b262e099 100644 --- a/drivers/mfd/intel_soc_pmic_chtdc_ti.c +++ b/drivers/mfd/intel_soc_pmic_chtdc_ti.c @@ -111,7 +111,7 @@ static int chtdc_ti_probe(struct i2c_client *i2c) struct intel_soc_pmic *pmic; int ret; - pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); + pmic = devm_kzalloc_obj(dev, *pmic); if (!pmic) return -ENOMEM; diff --git a/drivers/mfd/intel_soc_pmic_chtwc.c b/drivers/mfd/intel_soc_pmic_chtwc.c index aa71a7d83fcd..f288d830fbdb 100644 --- a/drivers/mfd/intel_soc_pmic_chtwc.c +++ b/drivers/mfd/intel_soc_pmic_chtwc.c @@ -202,7 +202,7 @@ static int cht_wc_probe(struct i2c_client *client) if (client->irq < 0) return dev_err_probe(dev, -EINVAL, "Invalid IRQ\n"); - pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); + pmic = devm_kzalloc_obj(dev, *pmic); if (!pmic) return -ENOMEM; diff --git a/drivers/mfd/intel_soc_pmic_crc.c b/drivers/mfd/intel_soc_pmic_crc.c index 627a89334908..4982e71f608f 100644 --- a/drivers/mfd/intel_soc_pmic_crc.c +++ b/drivers/mfd/intel_soc_pmic_crc.c @@ -176,7 +176,7 @@ static int crystal_cove_i2c_probe(struct i2c_client *i2c) else config = &crystal_cove_config_cht_crc; - pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); + pmic = devm_kzalloc_obj(dev, *pmic); if (!pmic) return -ENOMEM; diff --git a/drivers/mfd/intel_soc_pmic_mrfld.c b/drivers/mfd/intel_soc_pmic_mrfld.c index 77121775c1a3..c1206f48bda3 100644 --- a/drivers/mfd/intel_soc_pmic_mrfld.c +++ b/drivers/mfd/intel_soc_pmic_mrfld.c @@ -109,7 +109,7 @@ static int bcove_probe(struct platform_device *pdev) unsigned int i; int ret; - pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); + pmic = devm_kzalloc_obj(dev, *pmic); if (!pmic) return -ENOMEM; diff --git a/drivers/mfd/ioc3.c b/drivers/mfd/ioc3.c index 5f8ac364b610..d143c49e96c0 100644 --- a/drivers/mfd/ioc3.c +++ b/drivers/mfd/ioc3.c @@ -584,8 +584,7 @@ static int ioc3_mfd_probe(struct pci_dev *pdev, } /* Set up per-IOC3 data */ - ipd = devm_kzalloc(&pdev->dev, sizeof(struct ioc3_priv_data), - GFP_KERNEL); + ipd = devm_kzalloc_obj(&pdev->dev, struct ioc3_priv_data); if (!ipd) { ret = -ENOMEM; goto out_disable_device; diff --git a/drivers/mfd/ipaq-micro.c b/drivers/mfd/ipaq-micro.c index 5146a6eb0e5a..5ba40b4f6b00 100644 --- a/drivers/mfd/ipaq-micro.c +++ b/drivers/mfd/ipaq-micro.c @@ -381,7 +381,7 @@ static int __init micro_probe(struct platform_device *pdev) int ret; int irq; - micro = devm_kzalloc(&pdev->dev, sizeof(*micro), GFP_KERNEL); + micro = devm_kzalloc_obj(&pdev->dev, *micro); if (!micro) return -ENOMEM; diff --git a/drivers/mfd/iqs62x.c b/drivers/mfd/iqs62x.c index ef747a7b3845..f12a45a3f3c0 100644 --- a/drivers/mfd/iqs62x.c +++ b/drivers/mfd/iqs62x.c @@ -316,9 +316,7 @@ static int iqs62x_firmware_parse(struct iqs62x_core *iqs62x, if (ret) break; - fw_blk = devm_kzalloc(&client->dev, - struct_size(fw_blk, data, len), - GFP_KERNEL); + fw_blk = devm_kzalloc_flex(&client->dev, *fw_blk, data, len); if (!fw_blk) { ret = -ENOMEM; break; @@ -900,7 +898,7 @@ static int iqs62x_probe(struct i2c_client *client) int ret, i, j; const char *fw_name = NULL; - iqs62x = devm_kzalloc(&client->dev, sizeof(*iqs62x), GFP_KERNEL); + iqs62x = devm_kzalloc_obj(&client->dev, *iqs62x); if (!iqs62x) return -ENOMEM; diff --git a/drivers/mfd/janz-cmodio.c b/drivers/mfd/janz-cmodio.c index add3bc04185b..036773b3c4ee 100644 --- a/drivers/mfd/janz-cmodio.c +++ b/drivers/mfd/janz-cmodio.c @@ -178,7 +178,7 @@ static int cmodio_pci_probe(struct pci_dev *dev, struct cmodio_device *priv; int ret; - priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&dev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c index 47062f876e5d..2e8e92dfef8c 100644 --- a/drivers/mfd/kempld-core.c +++ b/drivers/mfd/kempld-core.c @@ -436,7 +436,7 @@ static int kempld_probe(struct platform_device *pdev) return -ENODEV; } - pld = devm_kzalloc(dev, sizeof(*pld), GFP_KERNEL); + pld = devm_kzalloc_obj(dev, *pld); if (!pld) return -ENOMEM; diff --git a/drivers/mfd/khadas-mcu.c b/drivers/mfd/khadas-mcu.c index 4b37e74e2b04..1279a123f138 100644 --- a/drivers/mfd/khadas-mcu.c +++ b/drivers/mfd/khadas-mcu.c @@ -135,7 +135,7 @@ static int khadas_mcu_probe(struct i2c_client *client) struct khadas_mcu *ddata; const void *mcu_variant; - ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c index 9233da7ce099..4ab83be8beba 100644 --- a/drivers/mfd/lm3533-core.c +++ b/drivers/mfd/lm3533-core.c @@ -294,8 +294,7 @@ static int lm3533_device_init(struct lm3533 *lm3533) return dev_err_probe(dev, -ENODEV, "num of child nodes is not supported\n"); - lm3533_devices = devm_kcalloc(dev, nchilds, sizeof(*lm3533_devices), - GFP_KERNEL); + lm3533_devices = devm_kzalloc_objs(dev, *lm3533_devices, nchilds); if (!lm3533_devices) return -ENOMEM; @@ -442,7 +441,7 @@ static int lm3533_i2c_probe(struct i2c_client *i2c) dev_dbg(&i2c->dev, "%s\n", __func__); - lm3533 = devm_kzalloc(&i2c->dev, sizeof(*lm3533), GFP_KERNEL); + lm3533 = devm_kzalloc_obj(&i2c->dev, *lm3533); if (!lm3533) return -ENOMEM; diff --git a/drivers/mfd/lochnagar-i2c.c b/drivers/mfd/lochnagar-i2c.c index 9d60a42745fc..33551c82414d 100644 --- a/drivers/mfd/lochnagar-i2c.c +++ b/drivers/mfd/lochnagar-i2c.c @@ -276,7 +276,7 @@ static int lochnagar_i2c_probe(struct i2c_client *i2c) unsigned int devid, rev; int ret; - lochnagar = devm_kzalloc(dev, sizeof(*lochnagar), GFP_KERNEL); + lochnagar = devm_kzalloc_obj(dev, *lochnagar); if (!lochnagar) return -ENOMEM; diff --git a/drivers/mfd/loongson-se.c b/drivers/mfd/loongson-se.c index 3902ba377d69..b87098010c17 100644 --- a/drivers/mfd/loongson-se.c +++ b/drivers/mfd/loongson-se.c @@ -190,7 +190,7 @@ static int loongson_se_probe(struct platform_device *pdev) int nr_irq, irq, err, i; dma_addr_t paddr; - se = devm_kmalloc(dev, sizeof(*se), GFP_KERNEL); + se = devm_kmalloc_obj(dev, *se); if (!se) return -ENOMEM; diff --git a/drivers/mfd/lp3943.c b/drivers/mfd/lp3943.c index 1918b5c7a5e7..1726f3dd9153 100644 --- a/drivers/mfd/lp3943.c +++ b/drivers/mfd/lp3943.c @@ -107,7 +107,7 @@ static int lp3943_probe(struct i2c_client *cl) struct lp3943 *lp3943; struct device *dev = &cl->dev; - lp3943 = devm_kzalloc(dev, sizeof(*lp3943), GFP_KERNEL); + lp3943 = devm_kzalloc_obj(dev, *lp3943); if (!lp3943) return -ENOMEM; diff --git a/drivers/mfd/lp873x.c b/drivers/mfd/lp873x.c index d2c90302bf59..ab7bd46d9ff7 100644 --- a/drivers/mfd/lp873x.c +++ b/drivers/mfd/lp873x.c @@ -29,7 +29,7 @@ static int lp873x_probe(struct i2c_client *client) int ret; unsigned int otpid; - lp873 = devm_kzalloc(&client->dev, sizeof(*lp873), GFP_KERNEL); + lp873 = devm_kzalloc_obj(&client->dev, *lp873); if (!lp873) return -ENOMEM; diff --git a/drivers/mfd/lp87565.c b/drivers/mfd/lp87565.c index b78ae79df5fa..9e5059636225 100644 --- a/drivers/mfd/lp87565.c +++ b/drivers/mfd/lp87565.c @@ -49,7 +49,7 @@ static int lp87565_probe(struct i2c_client *client) int ret; unsigned int otpid; - lp87565 = devm_kzalloc(&client->dev, sizeof(*lp87565), GFP_KERNEL); + lp87565 = devm_kzalloc_obj(&client->dev, *lp87565); if (!lp87565) return -ENOMEM; diff --git a/drivers/mfd/lp8788-irq.c b/drivers/mfd/lp8788-irq.c index f62fa2d7f010..476bda247ec5 100644 --- a/drivers/mfd/lp8788-irq.c +++ b/drivers/mfd/lp8788-irq.c @@ -156,7 +156,7 @@ int lp8788_irq_init(struct lp8788 *lp, int irq) return 0; } - irqd = devm_kzalloc(lp->dev, sizeof(*irqd), GFP_KERNEL); + irqd = devm_kzalloc_obj(lp->dev, *irqd); if (!irqd) return -ENOMEM; diff --git a/drivers/mfd/lp8788.c b/drivers/mfd/lp8788.c index 32f255378f5a..79028e06a665 100644 --- a/drivers/mfd/lp8788.c +++ b/drivers/mfd/lp8788.c @@ -172,7 +172,7 @@ static int lp8788_probe(struct i2c_client *cl) struct lp8788_platform_data *pdata = dev_get_platdata(&cl->dev); int ret; - lp = devm_kzalloc(&cl->dev, sizeof(struct lp8788), GFP_KERNEL); + lp = devm_kzalloc_obj(&cl->dev, struct lp8788); if (!lp) return -ENOMEM; diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c index d2efcc92bb59..783d44355bc3 100644 --- a/drivers/mfd/lpc_ich.c +++ b/drivers/mfd/lpc_ich.c @@ -1038,7 +1038,7 @@ static int lpc_ich_finalize_wdt_cell(struct pci_dev *dev) struct lpc_ich_info *info; struct mfd_cell *cell = &lpc_ich_wdt_cell; - pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&dev->dev, *pdata); if (!pdata) return -ENOMEM; @@ -1320,7 +1320,7 @@ static int lpc_ich_init_spi(struct pci_dev *dev) u32 spi_base, rcba; int ret; - info = devm_kzalloc(&dev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&dev->dev, *info); if (!info) return -ENOMEM; @@ -1384,8 +1384,7 @@ static int lpc_ich_probe(struct pci_dev *dev, int ret; bool cell_added = false; - priv = devm_kzalloc(&dev->dev, - sizeof(struct lpc_ich_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&dev->dev, struct lpc_ich_priv); if (!priv) return -ENOMEM; diff --git a/drivers/mfd/lpc_sch.c b/drivers/mfd/lpc_sch.c index d069165f9b86..75936b0b2276 100644 --- a/drivers/mfd/lpc_sch.c +++ b/drivers/mfd/lpc_sch.c @@ -111,7 +111,7 @@ static int lpc_sch_populate_cell(struct pci_dev *pdev, int where, struct resource *res; int ret; - res = devm_kzalloc(&pdev->dev, sizeof(*res), GFP_KERNEL); + res = devm_kzalloc_obj(&pdev->dev, *res); if (!res) return -ENOMEM; diff --git a/drivers/mfd/ls2k-bmc-core.c b/drivers/mfd/ls2k-bmc-core.c index 408056bfb2fe..abc948d8a817 100644 --- a/drivers/mfd/ls2k-bmc-core.c +++ b/drivers/mfd/ls2k-bmc-core.c @@ -468,7 +468,7 @@ static int ls2k_bmc_probe(struct pci_dev *dev, const struct pci_device_id *id) if (ret) return ret; - ddata = devm_kzalloc(&dev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&dev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/mfd/macsmc.c b/drivers/mfd/macsmc.c index 514cba7dc897..e03c7e9bf0f7 100644 --- a/drivers/mfd/macsmc.c +++ b/drivers/mfd/macsmc.c @@ -413,7 +413,7 @@ static int apple_smc_probe(struct platform_device *pdev) __be32 count; int ret; - smc = devm_kzalloc(dev, sizeof(*smc), GFP_KERNEL); + smc = devm_kzalloc_obj(dev, *smc); if (!smc) return -ENOMEM; diff --git a/drivers/mfd/madera-i2c.c b/drivers/mfd/madera-i2c.c index 0986e4a99f4a..a8feb7192ec2 100644 --- a/drivers/mfd/madera-i2c.c +++ b/drivers/mfd/madera-i2c.c @@ -76,7 +76,7 @@ static int madera_i2c_probe(struct i2c_client *i2c) return -EINVAL; } - madera = devm_kzalloc(&i2c->dev, sizeof(*madera), GFP_KERNEL); + madera = devm_kzalloc_obj(&i2c->dev, *madera); if (!madera) return -ENOMEM; diff --git a/drivers/mfd/madera-spi.c b/drivers/mfd/madera-spi.c index 3fffa21ceadc..5e1aa40ebe3c 100644 --- a/drivers/mfd/madera-spi.c +++ b/drivers/mfd/madera-spi.c @@ -76,7 +76,7 @@ static int madera_spi_probe(struct spi_device *spi) return -EINVAL; } - madera = devm_kzalloc(&spi->dev, sizeof(*madera), GFP_KERNEL); + madera = devm_kzalloc_obj(&spi->dev, *madera); if (!madera) return -ENOMEM; diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c index da275a04a1ef..1bef531a8df1 100644 --- a/drivers/mfd/max14577.c +++ b/drivers/mfd/max14577.c @@ -368,7 +368,7 @@ static int max14577_i2c_probe(struct i2c_client *i2c) int irq_flags; if (np) { - pdata = devm_kzalloc(&i2c->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&i2c->dev, *pdata); if (!pdata) return -ENOMEM; i2c->dev.platform_data = pdata; @@ -379,7 +379,7 @@ static int max14577_i2c_probe(struct i2c_client *i2c) return -EINVAL; } - max14577 = devm_kzalloc(&i2c->dev, sizeof(*max14577), GFP_KERNEL); + max14577 = devm_kzalloc_obj(&i2c->dev, *max14577); if (!max14577) return -ENOMEM; diff --git a/drivers/mfd/max77541.c b/drivers/mfd/max77541.c index f91b4f5373ce..510fa42e48eb 100644 --- a/drivers/mfd/max77541.c +++ b/drivers/mfd/max77541.c @@ -165,7 +165,7 @@ static int max77541_probe(struct i2c_client *client) struct device *dev = &client->dev; struct max77541 *max77541; - max77541 = devm_kzalloc(dev, sizeof(*max77541), GFP_KERNEL); + max77541 = devm_kzalloc_obj(dev, *max77541); if (!max77541) return -ENOMEM; diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c index c4f89a9681f3..56b5718d01f2 100644 --- a/drivers/mfd/max77620.c +++ b/drivers/mfd/max77620.c @@ -504,7 +504,7 @@ static int max77620_probe(struct i2c_client *client) int n_mfd_cells; int ret; - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c index 0118a444a68b..3e3404ebf689 100644 --- a/drivers/mfd/max77686.c +++ b/drivers/mfd/max77686.c @@ -167,8 +167,7 @@ static int max77686_i2c_probe(struct i2c_client *i2c) const struct mfd_cell *cells; int n_devs; - max77686 = devm_kzalloc(&i2c->dev, - sizeof(struct max77686_dev), GFP_KERNEL); + max77686 = devm_kzalloc_obj(&i2c->dev, struct max77686_dev); if (!max77686) return -ENOMEM; diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c index 1c485a4c3dcf..5b553924d3cc 100644 --- a/drivers/mfd/max77693.c +++ b/drivers/mfd/max77693.c @@ -152,8 +152,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c) unsigned int reg_data; int ret = 0; - max77693 = devm_kzalloc(&i2c->dev, - sizeof(struct max77693_dev), GFP_KERNEL); + max77693 = devm_kzalloc_obj(&i2c->dev, struct max77693_dev); if (max77693 == NULL) return -ENOMEM; diff --git a/drivers/mfd/max77705.c b/drivers/mfd/max77705.c index 2e9b81f26414..2113ce5c6259 100644 --- a/drivers/mfd/max77705.c +++ b/drivers/mfd/max77705.c @@ -88,7 +88,7 @@ static int max77705_i2c_probe(struct i2c_client *i2c) unsigned int pmic_rev_value; int ret; - max77705 = devm_kzalloc(dev, sizeof(*max77705), GFP_KERNEL); + max77705 = devm_kzalloc_obj(dev, *max77705); if (!max77705) return -ENOMEM; diff --git a/drivers/mfd/max77759.c b/drivers/mfd/max77759.c index 72b608a1ab3f..5818ee2811d1 100644 --- a/drivers/mfd/max77759.c +++ b/drivers/mfd/max77759.c @@ -649,7 +649,7 @@ static int max77759_probe(struct i2c_client *client) unsigned int pmic_id; int ret; - max77759 = devm_kzalloc(&client->dev, sizeof(*max77759), GFP_KERNEL); + max77759 = devm_kzalloc_obj(&client->dev, *max77759); if (!max77759) return -ENOMEM; diff --git a/drivers/mfd/max77843.c b/drivers/mfd/max77843.c index 9ae6715642ae..d38f1da5e080 100644 --- a/drivers/mfd/max77843.c +++ b/drivers/mfd/max77843.c @@ -98,7 +98,7 @@ static int max77843_probe(struct i2c_client *i2c) unsigned int reg_data; int ret; - max77843 = devm_kzalloc(&i2c->dev, sizeof(*max77843), GFP_KERNEL); + max77843 = devm_kzalloc_obj(&i2c->dev, *max77843); if (!max77843) return -ENOMEM; diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c index 7bac1d651771..ba06a49c9c60 100644 --- a/drivers/mfd/max8907.c +++ b/drivers/mfd/max8907.c @@ -193,7 +193,7 @@ static int max8907_i2c_probe(struct i2c_client *i2c) pm_off = of_property_read_bool(i2c->dev.of_node, "maxim,system-power-controller"); - max8907 = devm_kzalloc(&i2c->dev, sizeof(struct max8907), GFP_KERNEL); + max8907 = devm_kzalloc_obj(&i2c->dev, struct max8907); if (!max8907) { ret = -ENOMEM; goto err_alloc_drvdata; diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c index ab19ff0c7867..00aff8949cad 100644 --- a/drivers/mfd/max8925-i2c.c +++ b/drivers/mfd/max8925-i2c.c @@ -152,9 +152,8 @@ static int max8925_probe(struct i2c_client *client) if (node && !pdata) { /* parse DT to get platform data */ - pdata = devm_kzalloc(&client->dev, - sizeof(struct max8925_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc_obj(&client->dev, + struct max8925_platform_data); if (!pdata) return -ENOMEM; @@ -165,8 +164,7 @@ static int max8925_probe(struct i2c_client *client) return -EINVAL; } - chip = devm_kzalloc(&client->dev, - sizeof(struct max8925_chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, struct max8925_chip); if (chip == NULL) return -ENOMEM; chip->i2c = client; diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index 7ba8ed1dfde3..3a1216ea20a7 100644 --- a/drivers/mfd/max8997.c +++ b/drivers/mfd/max8997.c @@ -133,7 +133,7 @@ static struct max8997_platform_data *max8997_i2c_parse_dt_pdata( { struct max8997_platform_data *pd; - pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(dev, *pd); if (!pd) return ERR_PTR(-ENOMEM); @@ -148,8 +148,7 @@ static int max8997_i2c_probe(struct i2c_client *i2c) struct max8997_platform_data *pdata = dev_get_platdata(&i2c->dev); int ret = 0; - max8997 = devm_kzalloc(&i2c->dev, sizeof(struct max8997_dev), - GFP_KERNEL); + max8997 = devm_kzalloc_obj(&i2c->dev, struct max8997_dev); if (max8997 == NULL) return -ENOMEM; diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c index 5032eab05bb4..ec9fa4487f01 100644 --- a/drivers/mfd/max8998.c +++ b/drivers/mfd/max8998.c @@ -138,7 +138,7 @@ static struct max8998_platform_data *max8998_i2c_parse_dt_pdata( { struct max8998_platform_data *pd; - pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(dev, *pd); if (!pd) return ERR_PTR(-ENOMEM); @@ -158,8 +158,7 @@ static int max8998_i2c_probe(struct i2c_client *i2c) struct max8998_dev *max8998; int ret = 0; - max8998 = devm_kzalloc(&i2c->dev, sizeof(struct max8998_dev), - GFP_KERNEL); + max8998 = devm_kzalloc_obj(&i2c->dev, struct max8998_dev); if (max8998 == NULL) return -ENOMEM; diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c index 6bc0e755ba34..b5e0aa6f3ec7 100644 --- a/drivers/mfd/mc13xxx-i2c.c +++ b/drivers/mfd/mc13xxx-i2c.c @@ -56,7 +56,7 @@ static int mc13xxx_i2c_probe(struct i2c_client *client) struct mc13xxx *mc13xxx; int ret; - mc13xxx = devm_kzalloc(&client->dev, sizeof(*mc13xxx), GFP_KERNEL); + mc13xxx = devm_kzalloc_obj(&client->dev, *mc13xxx); if (!mc13xxx) return -ENOMEM; diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c index 56d2e57b7d73..807b7e8503b2 100644 --- a/drivers/mfd/mc13xxx-spi.c +++ b/drivers/mfd/mc13xxx-spi.c @@ -125,7 +125,7 @@ static int mc13xxx_spi_probe(struct spi_device *spi) struct mc13xxx *mc13xxx; int ret; - mc13xxx = devm_kzalloc(&spi->dev, sizeof(*mc13xxx), GFP_KERNEL); + mc13xxx = devm_kzalloc_obj(&spi->dev, *mc13xxx); if (!mc13xxx) return -ENOMEM; diff --git a/drivers/mfd/menelaus.c b/drivers/mfd/menelaus.c index a125d40fa121..58434ec20966 100644 --- a/drivers/mfd/menelaus.c +++ b/drivers/mfd/menelaus.c @@ -1155,7 +1155,7 @@ static int menelaus_probe(struct i2c_client *client) return -ENODEV; } - menelaus = devm_kzalloc(&client->dev, sizeof(*menelaus), GFP_KERNEL); + menelaus = devm_kzalloc_obj(&client->dev, *menelaus); if (!menelaus) return -ENOMEM; diff --git a/drivers/mfd/motorola-cpcap.c b/drivers/mfd/motorola-cpcap.c index 65d5eb18aa00..fb25ca8e7a31 100644 --- a/drivers/mfd/motorola-cpcap.c +++ b/drivers/mfd/motorola-cpcap.c @@ -272,7 +272,7 @@ static int cpcap_probe(struct spi_device *spi) unsigned int num_cells; int ret; - cpcap = devm_kzalloc(&spi->dev, sizeof(*cpcap), GFP_KERNEL); + cpcap = devm_kzalloc_obj(&spi->dev, *cpcap); if (!cpcap) return -ENOMEM; diff --git a/drivers/mfd/mp2629.c b/drivers/mfd/mp2629.c index 717b704c3c6b..e4959322985e 100644 --- a/drivers/mfd/mp2629.c +++ b/drivers/mfd/mp2629.c @@ -38,7 +38,7 @@ static int mp2629_probe(struct i2c_client *client) struct mp2629_data *ddata; int ret; - ddata = devm_kzalloc(&client->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&client->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/mfd/mt6358-irq.c b/drivers/mfd/mt6358-irq.c index 74cf20843044..2321d88428c3 100644 --- a/drivers/mfd/mt6358-irq.c +++ b/drivers/mfd/mt6358-irq.c @@ -250,17 +250,13 @@ int mt6358_irq_init(struct mt6397_chip *chip) mutex_init(&chip->irqlock); irqd = chip->irq_data; - irqd->enable_hwirq = devm_kcalloc(chip->dev, - irqd->num_pmic_irqs, - sizeof(*irqd->enable_hwirq), - GFP_KERNEL); + irqd->enable_hwirq = devm_kzalloc_objs(chip->dev, *irqd->enable_hwirq, + irqd->num_pmic_irqs); if (!irqd->enable_hwirq) return -ENOMEM; - irqd->cache_hwirq = devm_kcalloc(chip->dev, - irqd->num_pmic_irqs, - sizeof(*irqd->cache_hwirq), - GFP_KERNEL); + irqd->cache_hwirq = devm_kzalloc_objs(chip->dev, *irqd->cache_hwirq, + irqd->num_pmic_irqs); if (!irqd->cache_hwirq) return -ENOMEM; diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c index 8a97c30cad3f..8c46e74be6fb 100644 --- a/drivers/mfd/mt6360-core.c +++ b/drivers/mfd/mt6360-core.c @@ -531,7 +531,7 @@ static int mt6360_probe(struct i2c_client *client) struct mt6360_ddata *ddata; int i, ret; - ddata = devm_kzalloc(&client->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&client->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/mfd/mt6370.c b/drivers/mfd/mt6370.c index c7c2efe3598c..e97858dce95f 100644 --- a/drivers/mfd/mt6370.c +++ b/drivers/mfd/mt6370.c @@ -235,7 +235,7 @@ static int mt6370_probe(struct i2c_client *i2c) struct device *dev = &i2c->dev; int ret, vid; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c index 5d5f816492aa..16dbcc783b83 100644 --- a/drivers/mfd/mt6397-core.c +++ b/drivers/mfd/mt6397-core.c @@ -359,7 +359,7 @@ static int mt6397_probe(struct platform_device *pdev) struct mt6397_chip *pmic; const struct chip_data *pmic_core; - pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); + pmic = devm_kzalloc_obj(&pdev->dev, *pmic); if (!pmic) return -ENOMEM; diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c index 64afc7631790..30a66e268169 100644 --- a/drivers/mfd/mxs-lradc.c +++ b/drivers/mfd/mxs-lradc.c @@ -133,7 +133,7 @@ static int mxs_lradc_probe(struct platform_device *pdev) int ret = 0; u32 ts_wires = 0; - lradc = devm_kzalloc(&pdev->dev, sizeof(*lradc), GFP_KERNEL); + lradc = devm_kzalloc_obj(&pdev->dev, *lradc); if (!lradc) return -ENOMEM; diff --git a/drivers/mfd/nct6694.c b/drivers/mfd/nct6694.c index 308b2fda3055..dabd83b9d455 100644 --- a/drivers/mfd/nct6694.c +++ b/drivers/mfd/nct6694.c @@ -280,15 +280,15 @@ static int nct6694_usb_probe(struct usb_interface *iface, struct nct6694 *nct6694; int ret; - nct6694 = devm_kzalloc(dev, sizeof(*nct6694), GFP_KERNEL); + nct6694 = devm_kzalloc_obj(dev, *nct6694); if (!nct6694) return -ENOMEM; - nct6694->usb_msg = devm_kzalloc(dev, sizeof(union nct6694_usb_msg), GFP_KERNEL); + nct6694->usb_msg = devm_kzalloc_obj(dev, union nct6694_usb_msg); if (!nct6694->usb_msg) return -ENOMEM; - nct6694->int_buffer = devm_kzalloc(dev, sizeof(*nct6694->int_buffer), GFP_KERNEL); + nct6694->int_buffer = devm_kzalloc_obj(dev, *nct6694->int_buffer); if (!nct6694->int_buffer) return -ENOMEM; diff --git a/drivers/mfd/ntxec.c b/drivers/mfd/ntxec.c index 08c68de0f01b..4521f38ec256 100644 --- a/drivers/mfd/ntxec.c +++ b/drivers/mfd/ntxec.c @@ -153,7 +153,7 @@ static int ntxec_probe(struct i2c_client *client) const struct mfd_cell *subdevs; size_t n_subdevs; - ec = devm_kmalloc(&client->dev, sizeof(*ec), GFP_KERNEL); + ec = devm_kmalloc_obj(&client->dev, *ec); if (!ec) return -ENOMEM; diff --git a/drivers/mfd/ocelot-spi.c b/drivers/mfd/ocelot-spi.c index d3ab4868a523..52bde8d4daf3 100644 --- a/drivers/mfd/ocelot-spi.c +++ b/drivers/mfd/ocelot-spi.c @@ -201,7 +201,7 @@ static int ocelot_spi_probe(struct spi_device *spi) struct regmap *r; int err; - ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 4d29a6e2ed87..a5426257776f 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c @@ -539,7 +539,7 @@ static int usbhs_omap_probe(struct platform_device *pdev) if (dev->of_node) { /* For DT boot we populate platform data from OF node */ - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; @@ -561,7 +561,7 @@ static int usbhs_omap_probe(struct platform_device *pdev) return -ENODEV; } - omap = devm_kzalloc(dev, sizeof(*omap), GFP_KERNEL); + omap = devm_kzalloc_obj(dev, *omap); if (!omap) { dev_err(dev, "Memory allocation failed\n"); return -ENOMEM; diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c index 0f7fdb99c809..fcf17bed5ffc 100644 --- a/drivers/mfd/omap-usb-tll.c +++ b/drivers/mfd/omap-usb-tll.c @@ -230,7 +230,7 @@ static int usbtll_omap_probe(struct platform_device *pdev) break; } - tll = devm_kzalloc(dev, struct_size(tll, ch_clk, nch), GFP_KERNEL); + tll = devm_kzalloc_flex(dev, *tll, ch_clk, nch); if (!tll) { pm_runtime_put_sync(dev); pm_runtime_disable(dev); diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index 7fc886f4f80e..00332bd4f1c6 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c @@ -494,7 +494,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c) pdata = dev_get_platdata(&i2c->dev); if (node && !pdata) { - pdata = devm_kzalloc(&i2c->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&i2c->dev, *pdata); if (!pdata) return -ENOMEM; @@ -505,7 +505,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c) if (!pdata) return -EINVAL; - palmas = devm_kzalloc(&i2c->dev, sizeof(struct palmas), GFP_KERNEL); + palmas = devm_kzalloc_obj(&i2c->dev, struct palmas); if (palmas == NULL) return -ENOMEM; diff --git a/drivers/mfd/pf1550.c b/drivers/mfd/pf1550.c index c4f567c05564..f4daaa20cb84 100644 --- a/drivers/mfd/pf1550.c +++ b/drivers/mfd/pf1550.c @@ -204,7 +204,7 @@ static int pf1550_i2c_probe(struct i2c_client *i2c) struct irq_domain *domain; int irq, ret = 0; - pf1550 = devm_kzalloc(&i2c->dev, sizeof(*pf1550), GFP_KERNEL); + pf1550 = devm_kzalloc_obj(&i2c->dev, *pf1550); if (!pf1550) return -ENOMEM; diff --git a/drivers/mfd/qcom-pm8xxx.c b/drivers/mfd/qcom-pm8xxx.c index 0cf374c015ce..0c3634f46cf3 100644 --- a/drivers/mfd/qcom-pm8xxx.c +++ b/drivers/mfd/qcom-pm8xxx.c @@ -546,9 +546,7 @@ static int pm8xxx_probe(struct platform_device *pdev) } pr_info("PMIC revision 2: %02X\n", val); - chip = devm_kzalloc(&pdev->dev, - struct_size(chip, config, data->num_irqs), - GFP_KERNEL); + chip = devm_kzalloc_flex(&pdev->dev, *chip, config, data->num_irqs); if (!chip) return -ENOMEM; diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c index b4b178caf754..5ac75acc3c77 100644 --- a/drivers/mfd/qcom-spmi-pmic.c +++ b/drivers/mfd/qcom-spmi-pmic.c @@ -260,7 +260,7 @@ static int pmic_spmi_probe(struct spmi_device *sdev) if (IS_ERR(regmap)) return PTR_ERR(regmap); - ctx = devm_kzalloc(&sdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&sdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c index 0defb3279af1..b38cd097444d 100644 --- a/drivers/mfd/qcom_rpm.c +++ b/drivers/mfd/qcom_rpm.c @@ -539,7 +539,7 @@ static int qcom_rpm_probe(struct platform_device *pdev) int irq_err; int ret; - rpm = devm_kzalloc(&pdev->dev, sizeof(*rpm), GFP_KERNEL); + rpm = devm_kzalloc_obj(&pdev->dev, *rpm); if (!rpm) return -ENOMEM; diff --git a/drivers/mfd/qnap-mcu.c b/drivers/mfd/qnap-mcu.c index 93a3dd93404d..f77f010796f5 100644 --- a/drivers/mfd/qnap-mcu.c +++ b/drivers/mfd/qnap-mcu.c @@ -354,7 +354,7 @@ static int qnap_mcu_probe(struct serdev_device *serdev) struct qnap_mcu *mcu; int ret; - mcu = devm_kzalloc(dev, sizeof(*mcu), GFP_KERNEL); + mcu = devm_kzalloc_obj(dev, *mcu); if (!mcu) return -ENOMEM; diff --git a/drivers/mfd/rave-sp.c b/drivers/mfd/rave-sp.c index 53c57bafea8f..e06614769458 100644 --- a/drivers/mfd/rave-sp.c +++ b/drivers/mfd/rave-sp.c @@ -803,7 +803,7 @@ static int rave_sp_probe(struct serdev_device *serdev) return -EINVAL; } - sp = devm_kzalloc(dev, sizeof(*sp), GFP_KERNEL); + sp = devm_kzalloc_obj(dev, *sp); if (!sp) return -ENOMEM; diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c index 2c0e8e9630f7..431ee5deec00 100644 --- a/drivers/mfd/rc5t583.c +++ b/drivers/mfd/rc5t583.c @@ -244,7 +244,7 @@ static int rc5t583_i2c_probe(struct i2c_client *i2c) return -EINVAL; } - rc5t583 = devm_kzalloc(&i2c->dev, sizeof(*rc5t583), GFP_KERNEL); + rc5t583 = devm_kzalloc_obj(&i2c->dev, *rc5t583); if (!rc5t583) return -ENOMEM; diff --git a/drivers/mfd/retu-mfd.c b/drivers/mfd/retu-mfd.c index 1d43458b4938..c64690074169 100644 --- a/drivers/mfd/retu-mfd.c +++ b/drivers/mfd/retu-mfd.c @@ -237,7 +237,7 @@ static int retu_probe(struct i2c_client *i2c) return -ENODEV; rdat = &retu_data[i2c->addr - 1]; - rdev = devm_kzalloc(&i2c->dev, sizeof(*rdev), GFP_KERNEL); + rdev = devm_kzalloc_obj(&i2c->dev, *rdev); if (rdev == NULL) return -ENOMEM; diff --git a/drivers/mfd/rk8xx-core.c b/drivers/mfd/rk8xx-core.c index 21182df45d1b..058cd4ed671a 100644 --- a/drivers/mfd/rk8xx-core.c +++ b/drivers/mfd/rk8xx-core.c @@ -773,7 +773,7 @@ int rk8xx_probe(struct device *dev, int variant, unsigned int irq, struct regmap int ret; int i; - rk808 = devm_kzalloc(dev, sizeof(*rk808), GFP_KERNEL); + rk808 = devm_kzalloc_obj(dev, *rk808); if (!rk808) return -ENOMEM; rk808->dev = dev; diff --git a/drivers/mfd/rn5t618.c b/drivers/mfd/rn5t618.c index 8c68dd16bb9e..d2f368b8c5bb 100644 --- a/drivers/mfd/rn5t618.c +++ b/drivers/mfd/rn5t618.c @@ -182,7 +182,7 @@ static int rn5t618_i2c_probe(struct i2c_client *i2c) struct rn5t618 *priv; int ret; - priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&i2c->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/mfd/rohm-bd71828.c b/drivers/mfd/rohm-bd71828.c index 46faef7058f8..537f9753c5bf 100644 --- a/drivers/mfd/rohm-bd71828.c +++ b/drivers/mfd/rohm-bd71828.c @@ -1023,7 +1023,7 @@ static struct regmap *bd72720_do_regmaps(struct i2c_client *i2c) return ERR_CAST(secondary_i2c); } - maps = devm_kzalloc(&i2c->dev, sizeof(*maps), GFP_KERNEL); + maps = devm_kzalloc_obj(&i2c->dev, *maps); if (!maps) return ERR_PTR(-ENOMEM); diff --git a/drivers/mfd/rohm-bd96801.c b/drivers/mfd/rohm-bd96801.c index 66fa017ad568..b6469cb68dce 100644 --- a/drivers/mfd/rohm-bd96801.c +++ b/drivers/mfd/rohm-bd96801.c @@ -687,8 +687,8 @@ static int bd96801_i2c_probe(struct i2c_client *i2c) num_regu_irqs = ddata->num_intb_irqs + num_errb; - regulator_res = devm_kcalloc(&i2c->dev, num_regu_irqs, - sizeof(*regulator_res), GFP_KERNEL); + regulator_res = devm_kzalloc_objs(&i2c->dev, *regulator_res, + num_regu_irqs); if (!regulator_res) return -ENOMEM; diff --git a/drivers/mfd/rohm-pwrbutton.c b/drivers/mfd/rohm-pwrbutton.c index 96a6d1f01db5..34cdd6a4040a 100644 --- a/drivers/mfd/rohm-pwrbutton.c +++ b/drivers/mfd/rohm-pwrbutton.c @@ -58,7 +58,7 @@ int rohm_register_pwrbutton(struct device *dev, int irq, const char *name, if (irq <= 0) return -EINVAL; - nodes = devm_kcalloc(dev, 2, sizeof(*nodes), GFP_KERNEL); + nodes = devm_kzalloc_objs(dev, *nodes, 2); if (!nodes) return -ENOMEM; @@ -66,7 +66,7 @@ int rohm_register_pwrbutton(struct device *dev, int irq, const char *name, if (!nodes[GPIO_KEYS].name) return -ENOMEM; - parent_props = devm_kcalloc(dev, 2, sizeof(*parent_props), GFP_KERNEL); + parent_props = devm_kzalloc_objs(dev, *parent_props, 2); if (!parent_props) return -ENOMEM; @@ -77,7 +77,7 @@ int rohm_register_pwrbutton(struct device *dev, int irq, const char *name, if (wakeup) n_props++; - child_props = devm_kcalloc(dev, n_props, sizeof(*child_props), GFP_KERNEL); + child_props = devm_kzalloc_objs(dev, *child_props, n_props); if (!child_props) return -ENOMEM; diff --git a/drivers/mfd/rsmu_i2c.c b/drivers/mfd/rsmu_i2c.c index c57795ed20f4..771631fdb350 100644 --- a/drivers/mfd/rsmu_i2c.c +++ b/drivers/mfd/rsmu_i2c.c @@ -274,7 +274,7 @@ static int rsmu_i2c_probe(struct i2c_client *client) struct rsmu_ddata *rsmu; int ret; - rsmu = devm_kzalloc(&client->dev, sizeof(*rsmu), GFP_KERNEL); + rsmu = devm_kzalloc_obj(&client->dev, *rsmu); if (!rsmu) return -ENOMEM; diff --git a/drivers/mfd/rsmu_spi.c b/drivers/mfd/rsmu_spi.c index cdb0f9797ec6..66ed3175008d 100644 --- a/drivers/mfd/rsmu_spi.c +++ b/drivers/mfd/rsmu_spi.c @@ -199,7 +199,7 @@ static int rsmu_spi_probe(struct spi_device *client) struct rsmu_ddata *rsmu; int ret; - rsmu = devm_kzalloc(&client->dev, sizeof(*rsmu), GFP_KERNEL); + rsmu = devm_kzalloc_obj(&client->dev, *rsmu); if (!rsmu) return -ENOMEM; diff --git a/drivers/mfd/rt5033.c b/drivers/mfd/rt5033.c index 072fd4447245..a1c4d02e2e72 100644 --- a/drivers/mfd/rt5033.c +++ b/drivers/mfd/rt5033.c @@ -57,7 +57,7 @@ static int rt5033_i2c_probe(struct i2c_client *i2c) unsigned int dev_id, chip_rev; int ret; - rt5033 = devm_kzalloc(&i2c->dev, sizeof(*rt5033), GFP_KERNEL); + rt5033 = devm_kzalloc_obj(&i2c->dev, *rt5033); if (!rt5033) return -ENOMEM; diff --git a/drivers/mfd/rz-mtu3.c b/drivers/mfd/rz-mtu3.c index 0a254e61ec0a..7e1313a57abc 100644 --- a/drivers/mfd/rz-mtu3.c +++ b/drivers/mfd/rz-mtu3.c @@ -316,11 +316,11 @@ static int rz_mtu3_probe(struct platform_device *pdev) struct reset_control *rstc; unsigned int i; - ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(dev, *ddata); if (!ddata) return -ENOMEM; - ddata->priv_data = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + ddata->priv_data = devm_kzalloc_obj(dev, *priv); if (!ddata->priv_data) return -ENOMEM; diff --git a/drivers/mfd/sec-acpm.c b/drivers/mfd/sec-acpm.c index d11fbf5b94b7..f5e5990f5e81 100644 --- a/drivers/mfd/sec-acpm.c +++ b/drivers/mfd/sec-acpm.c @@ -451,7 +451,7 @@ static struct regmap *sec_pmic_acpm_regmap_init(struct device *dev, struct sec_pmic_acpm_bus_context *ctx; struct regmap *regmap; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return ERR_PTR(-ENOMEM); @@ -495,7 +495,7 @@ static int sec_pmic_acpm_probe(struct platform_device *pdev) if (irq < 0) return irq; - shared_ctx = devm_kzalloc(dev, sizeof(*shared_ctx), GFP_KERNEL); + shared_ctx = devm_kzalloc_obj(dev, *shared_ctx); if (!shared_ctx) return -ENOMEM; diff --git a/drivers/mfd/sec-common.c b/drivers/mfd/sec-common.c index fe92bc4a3dd2..f8525645c730 100644 --- a/drivers/mfd/sec-common.c +++ b/drivers/mfd/sec-common.c @@ -178,7 +178,7 @@ sec_pmic_parse_dt_pdata(struct device *dev) { struct sec_platform_data *pd; - pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(dev, *pd); if (!pd) return ERR_PTR(-ENOMEM); @@ -198,7 +198,7 @@ int sec_pmic_probe(struct device *dev, int device_type, unsigned int irq, struct sec_pmic_dev *sec_pmic; int ret, num_sec_devs; - sec_pmic = devm_kzalloc(dev, sizeof(*sec_pmic), GFP_KERNEL); + sec_pmic = devm_kzalloc_obj(dev, *sec_pmic); if (!sec_pmic) return -ENOMEM; diff --git a/drivers/mfd/si476x-i2c.c b/drivers/mfd/si476x-i2c.c index 6351aef2d3bb..6fc96df823b1 100644 --- a/drivers/mfd/si476x-i2c.c +++ b/drivers/mfd/si476x-i2c.c @@ -689,7 +689,7 @@ static int si476x_core_probe(struct i2c_client *client) struct mfd_cell *cell; int cell_num; - core = devm_kzalloc(&client->dev, sizeof(*core), GFP_KERNEL); + core = devm_kzalloc_obj(&client->dev, *core); if (!core) return -ENOMEM; diff --git a/drivers/mfd/sky81452.c b/drivers/mfd/sky81452.c index 771b62a5c70f..f533409736d9 100644 --- a/drivers/mfd/sky81452.c +++ b/drivers/mfd/sky81452.c @@ -30,7 +30,7 @@ static int sky81452_probe(struct i2c_client *client) int ret; if (!pdata) { - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; } diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 009c200c1d5d..2e2ee6d3b889 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1101,8 +1101,7 @@ static int sm501_register_gpio_i2c_instance(struct sm501_devdata *sm, return -ENOMEM; /* Create a gpiod lookup using gpiochip-local offsets */ - lookup = devm_kzalloc(&pdev->dev, struct_size(lookup, table, 3), - GFP_KERNEL); + lookup = devm_kzalloc_flex(&pdev->dev, *lookup, table, 3); if (!lookup) return -ENOMEM; diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c index 9a8e6add8fca..b8e574ccff32 100644 --- a/drivers/mfd/sprd-sc27xx-spi.c +++ b/drivers/mfd/sprd-sc27xx-spi.c @@ -204,7 +204,7 @@ static int sprd_pmic_probe(struct spi_device *spi) return -EINVAL; } - ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&spi->dev, *ddata); if (!ddata) return -ENOMEM; @@ -229,9 +229,8 @@ static int sprd_pmic_probe(struct spi_device *spi) ddata->irq_chip.num_regs = 1; ddata->irq_chip.num_irqs = pdata->num_irqs; - ddata->irqs = devm_kcalloc(&spi->dev, - pdata->num_irqs, sizeof(struct regmap_irq), - GFP_KERNEL); + ddata->irqs = devm_kzalloc_objs(&spi->dev, struct regmap_irq, + pdata->num_irqs); if (!ddata->irqs) return -ENOMEM; diff --git a/drivers/mfd/ssbi.c b/drivers/mfd/ssbi.c index 6e7aff6e2746..551a18fcaa85 100644 --- a/drivers/mfd/ssbi.c +++ b/drivers/mfd/ssbi.c @@ -264,7 +264,7 @@ static int ssbi_probe(struct platform_device *pdev) struct ssbi *ssbi; const char *type; - ssbi = devm_kzalloc(&pdev->dev, sizeof(*ssbi), GFP_KERNEL); + ssbi = devm_kzalloc_obj(&pdev->dev, *ssbi); if (!ssbi) return -ENOMEM; diff --git a/drivers/mfd/stm32-lptimer.c b/drivers/mfd/stm32-lptimer.c index 123659178cc2..a3d266fc199e 100644 --- a/drivers/mfd/stm32-lptimer.c +++ b/drivers/mfd/stm32-lptimer.c @@ -86,7 +86,7 @@ static int stm32_lptimer_probe(struct platform_device *pdev) void __iomem *mmio; int ret; - ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c index b3dbc02aaf79..15e8a62c2881 100644 --- a/drivers/mfd/stm32-timers.c +++ b/drivers/mfd/stm32-timers.c @@ -292,7 +292,7 @@ static int stm32_timers_probe(struct platform_device *pdev) void __iomem *mmio; int ret; - ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c index f683fdb6ece6..9d58adf9be15 100644 --- a/drivers/mfd/stmfx.c +++ b/drivers/mfd/stmfx.c @@ -414,7 +414,7 @@ static int stmfx_probe(struct i2c_client *client) struct stmfx *stmfx; int ret; - stmfx = devm_kzalloc(dev, sizeof(*stmfx), GFP_KERNEL); + stmfx = devm_kzalloc_obj(dev, *stmfx); if (!stmfx) return -ENOMEM; diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index 3c5c2f157f52..fd51ba74275c 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -1372,7 +1372,7 @@ int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum) int ret; u32 val; - pdata = devm_kzalloc(ci->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(ci->dev, *pdata); if (!pdata) return -ENOMEM; @@ -1381,7 +1381,7 @@ int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum) if (!of_property_present(np, "interrupts")) ci->irq = -1; - stmpe = devm_kzalloc(ci->dev, sizeof(struct stmpe), GFP_KERNEL); + stmpe = devm_kzalloc_obj(ci->dev, struct stmpe); if (!stmpe) return -ENOMEM; diff --git a/drivers/mfd/stpmic1.c b/drivers/mfd/stpmic1.c index 7c677b0344c6..7904f4d5b2b4 100644 --- a/drivers/mfd/stpmic1.c +++ b/drivers/mfd/stpmic1.c @@ -152,7 +152,7 @@ static int stpmic1_probe(struct i2c_client *i2c) struct device_node *np = dev->of_node; u32 reg; - ddata = devm_kzalloc(dev, sizeof(struct stpmic1), GFP_KERNEL); + ddata = devm_kzalloc_obj(dev, struct stpmic1); if (!ddata) return -ENOMEM; diff --git a/drivers/mfd/stw481x.c b/drivers/mfd/stw481x.c index 5ed64d53c23d..082fb1f5cf3f 100644 --- a/drivers/mfd/stw481x.c +++ b/drivers/mfd/stw481x.c @@ -179,7 +179,7 @@ static int stw481x_probe(struct i2c_client *client) int ret; int i; - stw481x = devm_kzalloc(&client->dev, sizeof(*stw481x), GFP_KERNEL); + stw481x = devm_kzalloc_obj(&client->dev, *stw481x); if (!stw481x) return -ENOMEM; diff --git a/drivers/mfd/sun4i-gpadc.c b/drivers/mfd/sun4i-gpadc.c index bf2f6fdaf8bf..02e3ec49266d 100644 --- a/drivers/mfd/sun4i-gpadc.c +++ b/drivers/mfd/sun4i-gpadc.c @@ -118,7 +118,7 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) return -EINVAL; } - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c index 2d4eb771e230..ca506c157bde 100644 --- a/drivers/mfd/tc3589x.c +++ b/drivers/mfd/tc3589x.c @@ -331,7 +331,7 @@ tc3589x_of_probe(struct device *dev, enum tc3589x_version *version) struct device_node *child; const struct of_device_id *of_id; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); @@ -374,8 +374,7 @@ static int tc3589x_probe(struct i2c_client *i2c) | I2C_FUNC_SMBUS_I2C_BLOCK)) return -EIO; - tc3589x = devm_kzalloc(&i2c->dev, sizeof(struct tc3589x), - GFP_KERNEL); + tc3589x = devm_kzalloc_obj(&i2c->dev, struct tc3589x); if (!tc3589x) return -ENOMEM; diff --git a/drivers/mfd/ti-lmu.c b/drivers/mfd/ti-lmu.c index cfc9f88b9842..198a9b94fb79 100644 --- a/drivers/mfd/ti-lmu.c +++ b/drivers/mfd/ti-lmu.c @@ -149,7 +149,7 @@ static int ti_lmu_probe(struct i2c_client *cl) if (!data) return -ENODEV; - lmu = devm_kzalloc(dev, sizeof(*lmu), GFP_KERNEL); + lmu = devm_kzalloc_obj(dev, *lmu); if (!lmu) return -ENOMEM; diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c index 81f07a1d780c..d648201f4c00 100644 --- a/drivers/mfd/ti_am335x_tscadc.c +++ b/drivers/mfd/ti_am335x_tscadc.c @@ -126,7 +126,7 @@ static int ti_tscadc_probe(struct platform_device *pdev) int readouts = 0, mag_tracks = 0; /* Allocate memory for device */ - tscadc = devm_kzalloc(&pdev->dev, sizeof(*tscadc), GFP_KERNEL); + tscadc = devm_kzalloc_obj(&pdev->dev, *tscadc); if (!tscadc) return -ENOMEM; diff --git a/drivers/mfd/tps6105x.c b/drivers/mfd/tps6105x.c index b11cd2c03311..d87d5216d2c6 100644 --- a/drivers/mfd/tps6105x.c +++ b/drivers/mfd/tps6105x.c @@ -103,7 +103,7 @@ static struct tps6105x_platform_data *tps6105x_parse_dt(struct device *dev) dev_err(dev, "cannot support multiple operational modes"); return ERR_PTR(-EINVAL); } - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); pdata->mode = TPS6105X_MODE_SHUTDOWN; @@ -131,7 +131,7 @@ static int tps6105x_probe(struct i2c_client *client) return PTR_ERR(pdata); } - tps6105x = devm_kmalloc(&client->dev, sizeof(*tps6105x), GFP_KERNEL); + tps6105x = devm_kmalloc_obj(&client->dev, *tps6105x); if (!tps6105x) return -ENOMEM; diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c index 8a144ec52201..17137697158a 100644 --- a/drivers/mfd/tps65010.c +++ b/drivers/mfd/tps65010.c @@ -532,7 +532,7 @@ static int tps65010_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EINVAL; - tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); + tps = devm_kzalloc_obj(&client->dev, *tps); if (!tps) return -ENOMEM; diff --git a/drivers/mfd/tps6507x.c b/drivers/mfd/tps6507x.c index 9865512dc7cc..f75d088257fd 100644 --- a/drivers/mfd/tps6507x.c +++ b/drivers/mfd/tps6507x.c @@ -87,8 +87,7 @@ static int tps6507x_i2c_probe(struct i2c_client *i2c) { struct tps6507x_dev *tps6507x; - tps6507x = devm_kzalloc(&i2c->dev, sizeof(struct tps6507x_dev), - GFP_KERNEL); + tps6507x = devm_kzalloc_obj(&i2c->dev, struct tps6507x_dev); if (tps6507x == NULL) return -ENOMEM; diff --git a/drivers/mfd/tps65086.c b/drivers/mfd/tps65086.c index 54832e9321b9..897ccd7ec852 100644 --- a/drivers/mfd/tps65086.c +++ b/drivers/mfd/tps65086.c @@ -68,7 +68,7 @@ static int tps65086_probe(struct i2c_client *client) unsigned int version; int ret; - tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); + tps = devm_kzalloc_obj(&client->dev, *tps); if (!tps) return -ENOMEM; diff --git a/drivers/mfd/tps65090.c b/drivers/mfd/tps65090.c index 24f42175a9b4..8bc5f4acc7a3 100644 --- a/drivers/mfd/tps65090.c +++ b/drivers/mfd/tps65090.c @@ -178,7 +178,7 @@ static int tps65090_i2c_probe(struct i2c_client *client) if (pdata) irq_base = pdata->irq_base; - tps65090 = devm_kzalloc(&client->dev, sizeof(*tps65090), GFP_KERNEL); + tps65090 = devm_kzalloc_obj(&client->dev, *tps65090); if (!tps65090) return -ENOMEM; diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index 569c28c8b20f..f087883dd5c8 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c @@ -359,7 +359,7 @@ static int tps65217_probe(struct i2c_client *client) status_off = of_property_read_bool(client->dev.of_node, "ti,pmic-shutdown-controller"); - tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); + tps = devm_kzalloc_obj(&client->dev, *tps); if (!tps) return -ENOMEM; diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c index 4f3e632f726f..491c379a1a0f 100644 --- a/drivers/mfd/tps65218.c +++ b/drivers/mfd/tps65218.c @@ -285,7 +285,7 @@ static int tps65218_probe(struct i2c_client *client) int ret; unsigned int chipid; - tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); + tps = devm_kzalloc_obj(&client->dev, *tps); if (!tps) return -ENOMEM; diff --git a/drivers/mfd/tps65219.c b/drivers/mfd/tps65219.c index e52fbf1481fe..fc33cf09a473 100644 --- a/drivers/mfd/tps65219.c +++ b/drivers/mfd/tps65219.c @@ -481,7 +481,7 @@ static int tps65219_probe(struct i2c_client *client) bool pwr_button; int ret; - tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); + tps = devm_kzalloc_obj(&client->dev, *tps); if (!tps) return -ENOMEM; diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index 600186b1e8cb..f524bbdc8f3b 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c @@ -418,7 +418,7 @@ static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *clien struct device_node *np = client->dev.of_node; struct tps6586x_platform_data *pdata; - pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&client->dev, *pdata); if (!pdata) return NULL; @@ -539,7 +539,7 @@ static int tps6586x_i2c_probe(struct i2c_client *client) return -EIO; } - tps6586x = devm_kzalloc(&client->dev, sizeof(*tps6586x), GFP_KERNEL); + tps6586x = devm_kzalloc_obj(&client->dev, *tps6586x); if (!tps6586x) return -ENOMEM; diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index 6243b66b1b6f..67824eadac58 100644 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c @@ -381,8 +381,7 @@ static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client, *chip_id = (unsigned long)device_get_match_data(&client->dev); - board_info = devm_kzalloc(&client->dev, sizeof(*board_info), - GFP_KERNEL); + board_info = devm_kzalloc_obj(&client->dev, *board_info); if (!board_info) return NULL; @@ -457,11 +456,11 @@ static int tps65910_i2c_probe(struct i2c_client *i2c) if (!pmic_plat_data) return -EINVAL; - init_data = devm_kzalloc(&i2c->dev, sizeof(*init_data), GFP_KERNEL); + init_data = devm_kzalloc_obj(&i2c->dev, *init_data); if (init_data == NULL) return -ENOMEM; - tps65910 = devm_kzalloc(&i2c->dev, sizeof(*tps65910), GFP_KERNEL); + tps65910 = devm_kzalloc_obj(&i2c->dev, *tps65910); if (tps65910 == NULL) return -ENOMEM; diff --git a/drivers/mfd/tps65912-i2c.c b/drivers/mfd/tps65912-i2c.c index 138e50497b51..e3b18490b9e0 100644 --- a/drivers/mfd/tps65912-i2c.c +++ b/drivers/mfd/tps65912-i2c.c @@ -25,7 +25,7 @@ static int tps65912_i2c_probe(struct i2c_client *client) { struct tps65912 *tps; - tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); + tps = devm_kzalloc_obj(&client->dev, *tps); if (!tps) return -ENOMEM; diff --git a/drivers/mfd/tps65912-spi.c b/drivers/mfd/tps65912-spi.c index 2442a2e67d67..96d07631f210 100644 --- a/drivers/mfd/tps65912-spi.c +++ b/drivers/mfd/tps65912-spi.c @@ -25,7 +25,7 @@ static int tps65912_spi_probe(struct spi_device *spi) { struct tps65912 *tps; - tps = devm_kzalloc(&spi->dev, sizeof(*tps), GFP_KERNEL); + tps = devm_kzalloc_obj(&spi->dev, *tps); if (!tps) return -ENOMEM; diff --git a/drivers/mfd/tps6594-i2c.c b/drivers/mfd/tps6594-i2c.c index d2269f14f068..f9ae0b494d44 100644 --- a/drivers/mfd/tps6594-i2c.c +++ b/drivers/mfd/tps6594-i2c.c @@ -212,7 +212,7 @@ static int tps6594_i2c_probe(struct i2c_client *client) struct tps6594 *tps; const struct of_device_id *match; - tps = devm_kzalloc(dev, sizeof(*tps), GFP_KERNEL); + tps = devm_kzalloc_obj(dev, *tps); if (!tps) return -ENOMEM; diff --git a/drivers/mfd/tps6594-spi.c b/drivers/mfd/tps6594-spi.c index bb95d6b64cb4..d8b3da5f14e8 100644 --- a/drivers/mfd/tps6594-spi.c +++ b/drivers/mfd/tps6594-spi.c @@ -97,7 +97,7 @@ static int tps6594_spi_probe(struct spi_device *spi) struct tps6594 *tps; const struct of_device_id *match; - tps = devm_kzalloc(dev, sizeof(*tps), GFP_KERNEL); + tps = devm_kzalloc_obj(dev, *tps); if (!tps) return -ENOMEM; diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 7fbce76efd30..88296178f77e 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c @@ -770,8 +770,7 @@ twl_probe(struct i2c_client *client) goto out; } - twl_priv = devm_kzalloc(&client->dev, sizeof(struct twl_private), - GFP_KERNEL); + twl_priv = devm_kzalloc_obj(&client->dev, struct twl_private); if (!twl_priv) { status = -ENOMEM; goto out; @@ -788,10 +787,8 @@ twl_probe(struct i2c_client *client) } num_slaves = twl_get_num_slaves(); - twl_priv->twl_modules = devm_kcalloc(&client->dev, - num_slaves, - sizeof(struct twl_client), - GFP_KERNEL); + twl_priv->twl_modules = devm_kzalloc_objs(&client->dev, + struct twl_client, num_slaves); if (!twl_priv->twl_modules) { status = -ENOMEM; goto out; diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c index a4a550bafb3c..17ac1c598f16 100644 --- a/drivers/mfd/twl4030-audio.c +++ b/drivers/mfd/twl4030-audio.c @@ -189,8 +189,7 @@ static int twl4030_audio_probe(struct platform_device *pdev) return -EINVAL; } - audio = devm_kzalloc(&pdev->dev, sizeof(struct twl4030_audio), - GFP_KERNEL); + audio = devm_kzalloc_obj(&pdev->dev, struct twl4030_audio); if (!audio) return -ENOMEM; diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c index 0ca00f618d4d..502b1542186b 100644 --- a/drivers/mfd/twl6030-irq.c +++ b/drivers/mfd/twl6030-irq.c @@ -303,7 +303,7 @@ int twl6030_init_irq(struct device *dev, int irq_num) nr_irqs = TWL6030_NR_IRQS; - twl6030_irq = devm_kzalloc(dev, sizeof(*twl6030_irq), GFP_KERNEL); + twl6030_irq = devm_kzalloc_obj(dev, *twl6030_irq); if (!twl6030_irq) return -ENOMEM; diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c index 562a0f939f6e..2b0ed6819c95 100644 --- a/drivers/mfd/twl6040.c +++ b/drivers/mfd/twl6040.c @@ -648,8 +648,7 @@ static int twl6040_probe(struct i2c_client *client) return -EINVAL; } - twl6040 = devm_kzalloc(&client->dev, sizeof(struct twl6040), - GFP_KERNEL); + twl6040 = devm_kzalloc_obj(&client->dev, struct twl6040); if (!twl6040) return -ENOMEM; diff --git a/drivers/mfd/upboard-fpga.c b/drivers/mfd/upboard-fpga.c index 9a9599dcb0a1..ab3d43b6a750 100644 --- a/drivers/mfd/upboard-fpga.c +++ b/drivers/mfd/upboard-fpga.c @@ -273,7 +273,7 @@ static int upboard_fpga_probe(struct platform_device *pdev) struct upboard_fpga *fpga; int ret; - fpga = devm_kzalloc(dev, sizeof(*fpga), GFP_KERNEL); + fpga = devm_kzalloc_obj(dev, *fpga); if (!fpga) return -ENOMEM; diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c index f49cee91f71c..de6c89c940e8 100644 --- a/drivers/mfd/vexpress-sysreg.c +++ b/drivers/mfd/vexpress-sysreg.c @@ -115,8 +115,7 @@ static int vexpress_sysreg_probe(struct platform_device *pdev) * Duplicated SYS_MCI pseudo-GPIO controller for compatibility with * older trees using sysreg node for MMC control lines. */ - mmc_gpio_chip = devm_kzalloc(&pdev->dev, sizeof(*mmc_gpio_chip), - GFP_KERNEL); + mmc_gpio_chip = devm_kzalloc_obj(&pdev->dev, *mmc_gpio_chip); if (!mmc_gpio_chip) return -ENOMEM; diff --git a/drivers/mfd/wcd934x.c b/drivers/mfd/wcd934x.c index d57796933d87..67d15c849aba 100644 --- a/drivers/mfd/wcd934x.c +++ b/drivers/mfd/wcd934x.c @@ -223,7 +223,7 @@ static int wcd934x_slim_probe(struct slim_device *sdev) return dev_err_probe(dev, ret, "Failed to set DMA mask\n"); - ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/mfd/wm831x-i2c.c b/drivers/mfd/wm831x-i2c.c index 9bee007f9c99..7fbeae088b24 100644 --- a/drivers/mfd/wm831x-i2c.c +++ b/drivers/mfd/wm831x-i2c.c @@ -33,7 +33,7 @@ static int wm831x_i2c_probe(struct i2c_client *i2c) return -ENODEV; } - wm831x = devm_kzalloc(&i2c->dev, sizeof(struct wm831x), GFP_KERNEL); + wm831x = devm_kzalloc_obj(&i2c->dev, struct wm831x); if (wm831x == NULL) return -ENOMEM; diff --git a/drivers/mfd/wm831x-spi.c b/drivers/mfd/wm831x-spi.c index 1e519fd9a9e1..ddea5b9fd565 100644 --- a/drivers/mfd/wm831x-spi.c +++ b/drivers/mfd/wm831x-spi.c @@ -30,7 +30,7 @@ static int wm831x_spi_probe(struct spi_device *spi) return -ENODEV; } - wm831x = devm_kzalloc(&spi->dev, sizeof(struct wm831x), GFP_KERNEL); + wm831x = devm_kzalloc_obj(&spi->dev, struct wm831x); if (wm831x == NULL) return -ENOMEM; diff --git a/drivers/mfd/wm8350-i2c.c b/drivers/mfd/wm8350-i2c.c index 767c176b12a7..35d2a8c7817e 100644 --- a/drivers/mfd/wm8350-i2c.c +++ b/drivers/mfd/wm8350-i2c.c @@ -22,7 +22,7 @@ static int wm8350_i2c_probe(struct i2c_client *i2c) struct wm8350_platform_data *pdata = dev_get_platdata(&i2c->dev); int ret = 0; - wm8350 = devm_kzalloc(&i2c->dev, sizeof(struct wm8350), GFP_KERNEL); + wm8350 = devm_kzalloc_obj(&i2c->dev, struct wm8350); if (wm8350 == NULL) return -ENOMEM; diff --git a/drivers/mfd/wm8400-core.c b/drivers/mfd/wm8400-core.c index 8ecfe878a5ba..4ef57b70172a 100644 --- a/drivers/mfd/wm8400-core.c +++ b/drivers/mfd/wm8400-core.c @@ -120,7 +120,7 @@ static int wm8400_i2c_probe(struct i2c_client *i2c) { struct wm8400 *wm8400; - wm8400 = devm_kzalloc(&i2c->dev, sizeof(struct wm8400), GFP_KERNEL); + wm8400 = devm_kzalloc_obj(&i2c->dev, struct wm8400); if (!wm8400) return -ENOMEM; diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 094c0b3dbd97..2c43b8ae1ba2 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c @@ -344,10 +344,9 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) goto err; } - wm8994->supplies = devm_kcalloc(wm8994->dev, - wm8994->num_supplies, - sizeof(struct regulator_bulk_data), - GFP_KERNEL); + wm8994->supplies = devm_kzalloc_objs(wm8994->dev, + struct regulator_bulk_data, + wm8994->num_supplies); if (!wm8994->supplies) { ret = -ENOMEM; goto err; @@ -614,7 +613,7 @@ static int wm8994_i2c_probe(struct i2c_client *i2c) struct wm8994 *wm8994; int ret; - wm8994 = devm_kzalloc(&i2c->dev, sizeof(struct wm8994), GFP_KERNEL); + wm8994 = devm_kzalloc_obj(&i2c->dev, struct wm8994); if (wm8994 == NULL) return -ENOMEM; diff --git a/drivers/mfd/wm97xx-core.c b/drivers/mfd/wm97xx-core.c index 1566a9b04b6a..a4055626c680 100644 --- a/drivers/mfd/wm97xx-core.c +++ b/drivers/mfd/wm97xx-core.c @@ -257,8 +257,7 @@ static int wm97xx_ac97_probe(struct ac97_codec_device *adev) int ret = -ENODEV, nb_cells, i; struct wm97xx_pdata *pdata = snd_ac97_codec_get_platdata(adev); - wm97xx = devm_kzalloc(ac97_codec_dev2dev(adev), - sizeof(*wm97xx), GFP_KERNEL); + wm97xx = devm_kzalloc_obj(ac97_codec_dev2dev(adev), *wm97xx); if (!wm97xx) return -ENOMEM; diff --git a/drivers/misc/amd-sbi/rmi-i2c.c b/drivers/misc/amd-sbi/rmi-i2c.c index 463a9a757464..f594775e9f5d 100644 --- a/drivers/misc/amd-sbi/rmi-i2c.c +++ b/drivers/misc/amd-sbi/rmi-i2c.c @@ -59,7 +59,7 @@ static int sbrmi_common_probe(struct device *dev, struct regmap *regmap, uint8_t struct sbrmi_data *data; int ret; - data = devm_kzalloc(dev, sizeof(struct sbrmi_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct sbrmi_data); if (!data) return -ENOMEM; diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c index 35a196341534..223f02adfd6c 100644 --- a/drivers/misc/atmel-ssc.c +++ b/drivers/misc/atmel-ssc.c @@ -193,7 +193,7 @@ static int ssc_probe(struct platform_device *pdev) struct ssc_device *ssc; const struct atmel_ssc_platform_data *plat_dat; - ssc = devm_kzalloc(&pdev->dev, sizeof(struct ssc_device), GFP_KERNEL); + ssc = devm_kzalloc_obj(&pdev->dev, struct ssc_device); if (!ssc) { dev_dbg(&pdev->dev, "out of memory\n"); return -ENOMEM; diff --git a/drivers/misc/bh1770glc.c b/drivers/misc/bh1770glc.c index 98fc5970b2bb..26bae1aec423 100644 --- a/drivers/misc/bh1770glc.c +++ b/drivers/misc/bh1770glc.c @@ -1169,7 +1169,7 @@ static int bh1770_probe(struct i2c_client *client) struct bh1770_chip *chip; int err; - chip = devm_kzalloc(&client->dev, sizeof *chip, GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/misc/cardreader/alcor_pci.c b/drivers/misc/cardreader/alcor_pci.c index e76fd4b5d6cc..f2885833395e 100644 --- a/drivers/misc/cardreader/alcor_pci.c +++ b/drivers/misc/cardreader/alcor_pci.c @@ -106,7 +106,7 @@ static int alcor_pci_probe(struct pci_dev *pdev, if (ret) return ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/misc/cardreader/rtsx_usb.c b/drivers/misc/cardreader/rtsx_usb.c index 42b4b0b7ea69..c53a5543444f 100644 --- a/drivers/misc/cardreader/rtsx_usb.c +++ b/drivers/misc/cardreader/rtsx_usb.c @@ -633,7 +633,7 @@ static int rtsx_usb_probe(struct usb_interface *intf, ": Realtek USB Card Reader found at bus %03d address %03d\n", usb_dev->bus->busnum, usb_dev->devnum); - ucr = devm_kzalloc(&intf->dev, sizeof(*ucr), GFP_KERNEL); + ucr = devm_kzalloc_obj(&intf->dev, *ucr); if (!ucr) return -ENOMEM; diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c index 2ab6f6884766..027af039ac09 100644 --- a/drivers/misc/cb710/core.c +++ b/drivers/misc/cb710/core.c @@ -214,8 +214,7 @@ static int cb710_probe(struct pci_dev *pdev, if (val & CB710_SLOT_SM) ++n; - chip = devm_kzalloc(&pdev->dev, struct_size(chip, slot, n), - GFP_KERNEL); + chip = devm_kzalloc_flex(&pdev->dev, *chip, slot, n); if (!chip) return -ENOMEM; diff --git a/drivers/misc/dw-xdata-pcie.c b/drivers/misc/dw-xdata-pcie.c index a604c0e9c038..dc097445588c 100644 --- a/drivers/misc/dw-xdata-pcie.c +++ b/drivers/misc/dw-xdata-pcie.c @@ -313,7 +313,7 @@ static int dw_xdata_pcie_probe(struct pci_dev *pdev, pci_set_master(pdev); /* Allocate memory */ - dw = devm_kzalloc(dev, sizeof(*dw), GFP_KERNEL); + dw = devm_kzalloc_obj(dev, *dw); if (!dw) return -ENOMEM; diff --git a/drivers/misc/eeprom/idt_89hpesx.c b/drivers/misc/eeprom/idt_89hpesx.c index ea7478cfdd27..59911d8c2e5b 100644 --- a/drivers/misc/eeprom/idt_89hpesx.c +++ b/drivers/misc/eeprom/idt_89hpesx.c @@ -1130,8 +1130,7 @@ static struct idt_89hpesx_dev *idt_create_pdev(struct i2c_client *client) struct idt_89hpesx_dev *pdev; /* Allocate memory for driver data */ - pdev = devm_kmalloc(&client->dev, sizeof(struct idt_89hpesx_dev), - GFP_KERNEL); + pdev = devm_kmalloc_obj(&client->dev, struct idt_89hpesx_dev); if (pdev == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index af18ff1992ee..cdc2627bdaf2 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -2427,7 +2427,7 @@ static int fastrpc_device_register(struct device *dev, struct fastrpc_channel_ct struct fastrpc_device *fdev; int err; - fdev = devm_kzalloc(dev, sizeof(*fdev), GFP_KERNEL); + fdev = devm_kzalloc_obj(dev, *fdev); if (!fdev) return -ENOMEM; diff --git a/drivers/misc/gehc-achc.c b/drivers/misc/gehc-achc.c index 2c1222edb5dc..17697da64afe 100644 --- a/drivers/misc/gehc-achc.c +++ b/drivers/misc/gehc-achc.c @@ -510,7 +510,7 @@ static int gehc_achc_probe(struct spi_device *spi) spi->bits_per_word = 8; spi->mode = SPI_MODE_0; - achc = devm_kzalloc(&spi->dev, sizeof(*achc), GFP_KERNEL); + achc = devm_kzalloc_obj(&spi->dev, *achc); if (!achc) return -ENOMEM; spi_set_drvdata(spi, achc); diff --git a/drivers/misc/hi6421v600-irq.c b/drivers/misc/hi6421v600-irq.c index 033f30014aa6..7d2eb7ed7698 100644 --- a/drivers/misc/hi6421v600-irq.c +++ b/drivers/misc/hi6421v600-irq.c @@ -230,7 +230,7 @@ static int hi6421v600_irq_probe(struct platform_device *pdev) if (WARN_ON(!regmap)) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/misc/keba/cp500.c b/drivers/misc/keba/cp500.c index c2ca63e40814..3cc42744c8fb 100644 --- a/drivers/misc/keba/cp500.c +++ b/drivers/misc/keba/cp500.c @@ -869,7 +869,7 @@ static int cp500_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) char buf[64]; int ret; - cp500 = devm_kzalloc(dev, sizeof(*cp500), GFP_KERNEL); + cp500 = devm_kzalloc_obj(dev, *cp500); if (!cp500) return -ENOMEM; cp500->pci_dev = pci_dev; diff --git a/drivers/misc/lan966x_pci.c b/drivers/misc/lan966x_pci.c index b0949c653e5b..0f3a8bab328a 100644 --- a/drivers/misc/lan966x_pci.c +++ b/drivers/misc/lan966x_pci.c @@ -163,7 +163,7 @@ static int lan966x_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i if (ret) return ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c index 740b5cf53842..0ef59138b1be 100644 --- a/drivers/misc/lattice-ecp3-config.c +++ b/drivers/misc/lattice-ecp3-config.c @@ -190,7 +190,7 @@ static int lattice_ecp3_probe(struct spi_device *spi) struct fpga_data *data; int err; - data = devm_kzalloc(&spi->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&spi->dev, *data); if (!data) { dev_err(&spi->dev, "Memory allocation for fpga_data failed\n"); return -ENOMEM; diff --git a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c index b0b678e6b28d..61842b11d501 100644 --- a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c +++ b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c @@ -38,7 +38,7 @@ static int gp_aux_bus_probe(struct pci_dev *pdev, const struct pci_device_id *id if (retval) return retval; - aux_bus = devm_kzalloc(&pdev->dev, sizeof(*aux_bus), GFP_KERNEL); + aux_bus = devm_kzalloc_obj(&pdev->dev, *aux_bus); if (!aux_bus) return -ENOMEM; diff --git a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c index 82635db04dc5..258d6770b72d 100644 --- a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c +++ b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c @@ -480,7 +480,7 @@ static int pci1xxxx_gpio_probe(struct auxiliary_device *aux_dev, if (!pdata) return -EINVAL; - priv = devm_kzalloc(&aux_dev->dev, sizeof(struct pci1xxxx_gpio), GFP_KERNEL); + priv = devm_kzalloc_obj(&aux_dev->dev, struct pci1xxxx_gpio); if (!priv) return -ENOMEM; diff --git a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c index 09841c4f1a06..281a40d6ef8a 100644 --- a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c +++ b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c @@ -332,7 +332,7 @@ static int pci1xxxx_otp_eeprom_probe(struct auxiliary_device *aux_dev, if (!pdata) return -EINVAL; - priv = devm_kzalloc(&aux_dev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&aux_dev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/misc/mei/vsc-tp.c b/drivers/misc/mei/vsc-tp.c index 5410ec1c9328..0d0fe8dc69be 100644 --- a/drivers/misc/mei/vsc-tp.c +++ b/drivers/misc/mei/vsc-tp.c @@ -464,15 +464,15 @@ static int vsc_tp_probe(struct spi_device *spi) struct acpi_device *adev; int ret; - tp = devm_kzalloc(dev, sizeof(*tp), GFP_KERNEL); + tp = devm_kzalloc_obj(dev, *tp); if (!tp) return -ENOMEM; - tp->tx_buf = devm_kzalloc(dev, sizeof(*tp->tx_buf), GFP_KERNEL); + tp->tx_buf = devm_kzalloc_obj(dev, *tp->tx_buf); if (!tp->tx_buf) return -ENOMEM; - tp->rx_buf = devm_kzalloc(dev, sizeof(*tp->rx_buf), GFP_KERNEL); + tp->rx_buf = devm_kzalloc_obj(dev, *tp->rx_buf); if (!tp->rx_buf) return -ENOMEM; diff --git a/drivers/misc/mrvl_cn10k_dpi.c b/drivers/misc/mrvl_cn10k_dpi.c index 73ff0f198ec3..5c6806c64e18 100644 --- a/drivers/misc/mrvl_cn10k_dpi.c +++ b/drivers/misc/mrvl_cn10k_dpi.c @@ -358,7 +358,8 @@ static int dpi_pfvf_mbox_setup(struct dpipf *dpi) int vf; for (vf = 0; vf < DPI_MAX_VFS; vf++) { - dpi->mbox[vf] = devm_kzalloc(&dpi->pdev->dev, sizeof(*dpi->mbox[vf]), GFP_KERNEL); + dpi->mbox[vf] = devm_kzalloc_obj(&dpi->pdev->dev, + *dpi->mbox[vf]); if (!dpi->mbox[vf]) return -ENOMEM; @@ -584,7 +585,7 @@ static int dpi_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct dpipf *dpi; int ret; - dpi = devm_kzalloc(dev, sizeof(*dpi), GFP_KERNEL); + dpi = devm_kzalloc_obj(dev, *dpi); if (!dpi) return -ENOMEM; diff --git a/drivers/misc/nsm.c b/drivers/misc/nsm.c index b6d3fa79a5e8..94434e3fbe5a 100644 --- a/drivers/misc/nsm.c +++ b/drivers/misc/nsm.c @@ -426,7 +426,7 @@ static int nsm_device_probe(struct virtio_device *vdev) struct nsm *nsm; int rc; - nsm = devm_kzalloc(&vdev->dev, sizeof(*nsm), GFP_KERNEL); + nsm = devm_kzalloc_obj(&vdev->dev, *nsm); if (!nsm) return -ENOMEM; diff --git a/drivers/misc/open-dice.c b/drivers/misc/open-dice.c index b3cf59954111..bae64e884a45 100644 --- a/drivers/misc/open-dice.c +++ b/drivers/misc/open-dice.c @@ -159,7 +159,7 @@ static int __init open_dice_probe(struct platform_device *pdev) return -EINVAL; } - drvdata = devm_kmalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kmalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 6b18ea914689..dd49ca7f45c6 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -1246,7 +1246,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, if (pci_is_bridge(pdev)) return -ENODEV; - test = devm_kzalloc(dev, sizeof(*test), GFP_KERNEL); + test = devm_kzalloc_obj(dev, *test); if (!test) return -ENOMEM; diff --git a/drivers/misc/pvpanic/pvpanic.c b/drivers/misc/pvpanic/pvpanic.c index b57d773f6876..3d43045bf697 100644 --- a/drivers/misc/pvpanic/pvpanic.c +++ b/drivers/misc/pvpanic/pvpanic.c @@ -188,7 +188,7 @@ int devm_pvpanic_probe(struct device *dev, void __iomem *base) if (!base) return -EINVAL; - pi = devm_kmalloc(dev, sizeof(*pi), GFP_KERNEL); + pi = devm_kmalloc_obj(dev, *pi); if (!pi) return -ENOMEM; diff --git a/drivers/misc/rp1/rp1_pci.c b/drivers/misc/rp1/rp1_pci.c index 207a676913a2..196393730038 100644 --- a/drivers/misc/rp1/rp1_pci.c +++ b/drivers/misc/rp1/rp1_pci.c @@ -197,7 +197,7 @@ static int rp1_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto err_out; } - rp1 = devm_kzalloc(&pdev->dev, sizeof(*rp1), GFP_KERNEL); + rp1 = devm_kzalloc_obj(&pdev->dev, *rp1); if (!rp1) { err = -ENOMEM; goto err_out; diff --git a/drivers/misc/smpro-errmon.c b/drivers/misc/smpro-errmon.c index 56952fd96cb8..a4b4a4cd5d75 100644 --- a/drivers/misc/smpro-errmon.c +++ b/drivers/misc/smpro-errmon.c @@ -577,7 +577,7 @@ static int smpro_errmon_probe(struct platform_device *pdev) { struct smpro_errmon *errmon; - errmon = devm_kzalloc(&pdev->dev, sizeof(struct smpro_errmon), GFP_KERNEL); + errmon = devm_kzalloc_obj(&pdev->dev, struct smpro_errmon); if (!errmon) return -ENOMEM; diff --git a/drivers/misc/smpro-misc.c b/drivers/misc/smpro-misc.c index 2ca5e3bcc215..dc5d583d0353 100644 --- a/drivers/misc/smpro-misc.c +++ b/drivers/misc/smpro-misc.c @@ -115,7 +115,7 @@ static int smpro_misc_probe(struct platform_device *pdev) { struct smpro_misc *misc; - misc = devm_kzalloc(&pdev->dev, sizeof(struct smpro_misc), GFP_KERNEL); + misc = devm_kzalloc_obj(&pdev->dev, struct smpro_misc); if (!misc) return -ENOMEM; diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c index c8990e83a65a..c5110c32f661 100644 --- a/drivers/misc/sram.c +++ b/drivers/misc/sram.c @@ -267,9 +267,8 @@ static int sram_reserve_regions(struct sram_dev *sram, struct resource *res) list_sort(NULL, &reserve_list, sram_reserve_cmp); if (exports) { - sram->partition = devm_kcalloc(sram->dev, - exports, sizeof(*sram->partition), - GFP_KERNEL); + sram->partition = devm_kzalloc_objs(sram->dev, *sram->partition, + exports); if (!sram->partition) { ret = -ENOMEM; goto err_chunks; @@ -383,7 +382,7 @@ static int sram_probe(struct platform_device *pdev) config = of_device_get_match_data(&pdev->dev); - sram = devm_kzalloc(&pdev->dev, sizeof(*sram), GFP_KERNEL); + sram = devm_kzalloc_obj(&pdev->dev, *sram); if (!sram) return -ENOMEM; diff --git a/drivers/misc/ti_fpc202.c b/drivers/misc/ti_fpc202.c index 9e2d24f89457..c3c52e6a6682 100644 --- a/drivers/misc/ti_fpc202.c +++ b/drivers/misc/ti_fpc202.c @@ -598,7 +598,7 @@ static int fpc202_probe(struct i2c_client *client) struct fpc202_priv *priv; int ret, port_id, led_id; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/misc/tps6594-pfsm.c b/drivers/misc/tps6594-pfsm.c index c3a0d6367f2c..823ed5e4126a 100644 --- a/drivers/misc/tps6594-pfsm.c +++ b/drivers/misc/tps6594-pfsm.c @@ -283,7 +283,7 @@ static int tps6594_pfsm_probe(struct platform_device *pdev) int ret; int i; - pfsm = devm_kzalloc(dev, sizeof(struct tps6594_pfsm), GFP_KERNEL); + pfsm = devm_kzalloc_obj(dev, struct tps6594_pfsm); if (!pfsm) return -ENOMEM; diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c index 83355c0ec1d2..ad447be6086c 100644 --- a/drivers/misc/vmw_vmci/vmci_guest.c +++ b/drivers/misc/vmw_vmci/vmci_guest.c @@ -621,7 +621,7 @@ static int vmci_guest_probe_device(struct pci_dev *pdev, iobase = pcim_iomap_table(pdev)[0]; } - vmci_dev = devm_kzalloc(&pdev->dev, sizeof(*vmci_dev), GFP_KERNEL); + vmci_dev = devm_kzalloc_obj(&pdev->dev, *vmci_dev); if (!vmci_dev) { dev_err(&pdev->dev, "Can't allocate memory for VMCI device\n"); diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c index a19eed39c516..3660e6b47a82 100644 --- a/drivers/misc/xilinx_sdfec.c +++ b/drivers/misc/xilinx_sdfec.c @@ -1345,7 +1345,7 @@ static int xsdfec_probe(struct platform_device *pdev) int err; bool irq_enabled = true; - xsdfec = devm_kzalloc(&pdev->dev, sizeof(*xsdfec), GFP_KERNEL); + xsdfec = devm_kzalloc_obj(&pdev->dev, *xsdfec); if (!xsdfec) return -ENOMEM; diff --git a/drivers/misc/xilinx_tmr_inject.c b/drivers/misc/xilinx_tmr_inject.c index 6284606ffb9f..cf2604de8d3e 100644 --- a/drivers/misc/xilinx_tmr_inject.c +++ b/drivers/misc/xilinx_tmr_inject.c @@ -113,8 +113,7 @@ static int xtmr_inject_probe(struct platform_device *pdev) struct xtmr_inject_dev *xtmr_inject; int err; - xtmr_inject = devm_kzalloc(&pdev->dev, sizeof(*xtmr_inject), - GFP_KERNEL); + xtmr_inject = devm_kzalloc_obj(&pdev->dev, *xtmr_inject); if (!xtmr_inject) return -ENOMEM; diff --git a/drivers/misc/xilinx_tmr_manager.c b/drivers/misc/xilinx_tmr_manager.c index 03912a90fd95..598584d76fa5 100644 --- a/drivers/misc/xilinx_tmr_manager.c +++ b/drivers/misc/xilinx_tmr_manager.c @@ -166,8 +166,7 @@ static int xtmr_manager_probe(struct platform_device *pdev) struct resource *res; int err; - xtmr_manager = devm_kzalloc(&pdev->dev, sizeof(*xtmr_manager), - GFP_KERNEL); + xtmr_manager = devm_kzalloc_obj(&pdev->dev, *xtmr_manager); if (!xtmr_manager) return -ENOMEM; diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c index 35af67e26945..95165951202a 100644 --- a/drivers/mmc/core/pwrseq_emmc.c +++ b/drivers/mmc/core/pwrseq_emmc.c @@ -61,7 +61,7 @@ static int mmc_pwrseq_emmc_probe(struct platform_device *pdev) struct mmc_pwrseq_emmc *pwrseq; struct device *dev = &pdev->dev; - pwrseq = devm_kzalloc(dev, sizeof(*pwrseq), GFP_KERNEL); + pwrseq = devm_kzalloc_obj(dev, *pwrseq); if (!pwrseq) return -ENOMEM; diff --git a/drivers/mmc/core/pwrseq_sd8787.c b/drivers/mmc/core/pwrseq_sd8787.c index 30282155a0e1..b221aa535aac 100644 --- a/drivers/mmc/core/pwrseq_sd8787.c +++ b/drivers/mmc/core/pwrseq_sd8787.c @@ -91,7 +91,7 @@ static int mmc_pwrseq_sd8787_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; const struct of_device_id *match; - pwrseq = devm_kzalloc(dev, sizeof(*pwrseq), GFP_KERNEL); + pwrseq = devm_kzalloc_obj(dev, *pwrseq); if (!pwrseq) return -ENOMEM; diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c index 4b47e6c3b04b..c95cf16628ac 100644 --- a/drivers/mmc/core/pwrseq_simple.c +++ b/drivers/mmc/core/pwrseq_simple.c @@ -126,7 +126,7 @@ static int mmc_pwrseq_simple_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ngpio; - pwrseq = devm_kzalloc(dev, sizeof(*pwrseq), GFP_KERNEL); + pwrseq = devm_kzalloc_obj(dev, *pwrseq); if (!pwrseq) return -ENOMEM; diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c index c5bc6268803e..df8fc1793228 100644 --- a/drivers/mmc/core/slot-gpio.c +++ b/drivers/mmc/core/slot-gpio.c @@ -43,7 +43,7 @@ int mmc_gpio_alloc(struct mmc_host *host) const char *devname = dev_name(host->parent); struct mmc_gpio *ctx; - ctx = devm_kzalloc(host->parent, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(host->parent, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 98933be5f174..379b90c6f5aa 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -2448,7 +2448,7 @@ static int atmci_probe(struct platform_device *pdev) if (irq < 0) return irq; - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/mmc/host/cavium-octeon.c b/drivers/mmc/host/cavium-octeon.c index 671dd1a36a74..dd62b96712c8 100644 --- a/drivers/mmc/host/cavium-octeon.c +++ b/drivers/mmc/host/cavium-octeon.c @@ -155,7 +155,7 @@ static int octeon_mmc_probe(struct platform_device *pdev) int i, ret = 0; u64 val; - host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(&pdev->dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/mmc/host/cavium-thunderx.c b/drivers/mmc/host/cavium-thunderx.c index ee19ea52b27d..526ae9019b2f 100644 --- a/drivers/mmc/host/cavium-thunderx.c +++ b/drivers/mmc/host/cavium-thunderx.c @@ -63,7 +63,7 @@ static int thunder_mmc_probe(struct pci_dev *pdev, struct cvm_mmc_host *host; int ret, i = 0; - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c index a466cd88b043..0b2e2a0cf764 100644 --- a/drivers/mmc/host/cqhci-core.c +++ b/drivers/mmc/host/cqhci-core.c @@ -1147,7 +1147,7 @@ struct cqhci_host *cqhci_pltfm_init(struct platform_device *pdev) return ERR_PTR(-EINVAL); } - cq_host = devm_kzalloc(&pdev->dev, sizeof(*cq_host), GFP_KERNEL); + cq_host = devm_kzalloc_obj(&pdev->dev, *cq_host); if (!cq_host) return ERR_PTR(-ENOMEM); cq_host->mmio = devm_ioremap(&pdev->dev, @@ -1193,8 +1193,8 @@ int cqhci_init(struct cqhci_host *cq_host, struct mmc_host *mmc, if (mmc->caps2 & MMC_CAP2_CQE_DCMD) mmc->cqe_qdepth -= 1; - cq_host->slot = devm_kcalloc(mmc_dev(mmc), cq_host->num_slots, - sizeof(*cq_host->slot), GFP_KERNEL); + cq_host->slot = devm_kzalloc_objs(mmc_dev(mmc), *cq_host->slot, + cq_host->num_slots); if (!cq_host->slot) { err = -ENOMEM; goto out_err; diff --git a/drivers/mmc/host/cqhci-crypto.c b/drivers/mmc/host/cqhci-crypto.c index 5a467098a0d6..6e869b7e109a 100644 --- a/drivers/mmc/host/cqhci-crypto.c +++ b/drivers/mmc/host/cqhci-crypto.c @@ -182,8 +182,8 @@ int cqhci_crypto_init(struct cqhci_host *cq_host) (u32)cq_host->crypto_capabilities.config_array_ptr * 0x100; cq_host->crypto_cap_array = - devm_kcalloc(dev, cq_host->crypto_capabilities.num_crypto_cap, - sizeof(cq_host->crypto_cap_array[0]), GFP_KERNEL); + devm_kzalloc_objs(dev, cq_host->crypto_cap_array[0], + cq_host->crypto_capabilities.num_crypto_cap); if (!cq_host->crypto_cap_array) { err = -ENOMEM; goto out; diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c index 4b76b997ddc1..6616f0cf9638 100644 --- a/drivers/mmc/host/dw_mmc-exynos.c +++ b/drivers/mmc/host/dw_mmc-exynos.c @@ -380,7 +380,7 @@ static int dw_mci_exynos_parse_dt(struct dw_mci *host) int idx; int ret; - priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(host->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/mmc/host/dw_mmc-hi3798cv200.c b/drivers/mmc/host/dw_mmc-hi3798cv200.c index 4b723ed3259c..b5bcd58fe2d3 100644 --- a/drivers/mmc/host/dw_mmc-hi3798cv200.c +++ b/drivers/mmc/host/dw_mmc-hi3798cv200.c @@ -120,7 +120,7 @@ static int dw_mci_hi3798cv200_init(struct dw_mci *host) struct hi3798cv200_priv *priv; int ret; - priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(host->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/mmc/host/dw_mmc-hi3798mv200.c b/drivers/mmc/host/dw_mmc-hi3798mv200.c index fda417888be9..9597e0954959 100644 --- a/drivers/mmc/host/dw_mmc-hi3798mv200.c +++ b/drivers/mmc/host/dw_mmc-hi3798mv200.c @@ -180,7 +180,7 @@ static int dw_mci_hi3798mv200_init(struct dw_mci *host) struct dw_mci_hi3798mv200_priv *priv; struct device_node *np = host->dev->of_node; - priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(host->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/mmc/host/dw_mmc-k3.c b/drivers/mmc/host/dw_mmc-k3.c index 59b802c9f2b8..ed217b0619e1 100644 --- a/drivers/mmc/host/dw_mmc-k3.c +++ b/drivers/mmc/host/dw_mmc-k3.c @@ -117,7 +117,7 @@ static int dw_mci_hi6220_parse_dt(struct dw_mci *host) { struct k3_priv *priv; - priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(host->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c index a07707a99a78..ffb9387bb8df 100644 --- a/drivers/mmc/host/dw_mmc-rockchip.c +++ b/drivers/mmc/host/dw_mmc-rockchip.c @@ -424,7 +424,7 @@ static int dw_mci_common_parse_dt(struct dw_mci *host) struct device_node *np = host->dev->of_node; struct dw_mci_rockchip_priv_data *priv; - priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(host->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 7ef16d7c03cb..ceda79a9a59d 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -453,7 +453,7 @@ static int meson_mmc_clk_init(struct meson_host *host) } /* create the mux */ - mux = devm_kzalloc(host->dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(host->dev, *mux); if (!mux) return -ENOMEM; @@ -474,7 +474,7 @@ static int meson_mmc_clk_init(struct meson_host *host) return PTR_ERR(host->mux_clk); /* create the divider */ - div = devm_kzalloc(host->dev, sizeof(*div), GFP_KERNEL); + div = devm_kzalloc_obj(host->dev, *div); if (!div) return -ENOMEM; diff --git a/drivers/mmc/host/meson-mx-sdhc-clkc.c b/drivers/mmc/host/meson-mx-sdhc-clkc.c index 6d619bd0a8dc..b303e6f12e28 100644 --- a/drivers/mmc/host/meson-mx-sdhc-clkc.c +++ b/drivers/mmc/host/meson-mx-sdhc-clkc.c @@ -95,7 +95,7 @@ int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base, struct meson_mx_sdhc_clkc *clkc_data; int ret; - clkc_data = devm_kzalloc(dev, sizeof(*clkc_data), GFP_KERNEL); + clkc_data = devm_kzalloc_obj(dev, *clkc_data); if (!clkc_data) return -ENOMEM; diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-sdio.c index bef5e843f449..5d48c8e7fbf9 100644 --- a/drivers/mmc/host/meson-mx-sdio.c +++ b/drivers/mmc/host/meson-mx-sdio.c @@ -580,7 +580,7 @@ static struct clk *meson_mx_mmc_register_clk(struct device *dev, * prevent use-after-free as meson_mx_mmc_host is free'd before * dev (controller dev, not mmc_host->dev) is free'd. */ - host_clkc = devm_kzalloc(dev, sizeof(*host_clkc), GFP_KERNEL); + host_clkc = devm_kzalloc_obj(dev, *host_clkc); if (!host_clkc) return ERR_PTR(-ENOMEM); diff --git a/drivers/mmc/host/mmc_hsq.c b/drivers/mmc/host/mmc_hsq.c index 57e172bd3487..438798176c4f 100644 --- a/drivers/mmc/host/mmc_hsq.c +++ b/drivers/mmc/host/mmc_hsq.c @@ -352,8 +352,8 @@ int mmc_hsq_init(struct mmc_hsq *hsq, struct mmc_host *mmc) hsq->next_tag = HSQ_INVALID_TAG; hsq->tail_tag = HSQ_INVALID_TAG; - hsq->slot = devm_kcalloc(mmc_dev(mmc), hsq->num_slots, - sizeof(struct hsq_slot), GFP_KERNEL); + hsq->slot = devm_kzalloc_objs(mmc_dev(mmc), struct hsq_slot, + hsq->num_slots); if (!hsq->slot) return -ENOMEM; diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 416bdb184ed4..9f99b85f176e 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -846,7 +846,7 @@ int mmci_dmae_setup(struct mmci_host *host) const char *rxname, *txname; struct mmci_dmae_priv *dmae; - dmae = devm_kzalloc(mmc_dev(host->mmc), sizeof(*dmae), GFP_KERNEL); + dmae = devm_kzalloc_obj(mmc_dev(host->mmc), *dmae); if (!dmae) return -ENOMEM; @@ -2217,7 +2217,7 @@ static int mmci_probe(struct amba_device *dev, } if (!plat) { - plat = devm_kzalloc(&dev->dev, sizeof(*plat), GFP_KERNEL); + plat = devm_kzalloc_obj(&dev->dev, *plat); if (!plat) return -ENOMEM; } diff --git a/drivers/mmc/host/mmci_stm32_sdmmc.c b/drivers/mmc/host/mmci_stm32_sdmmc.c index 9dc51859c2e5..a14986491b71 100644 --- a/drivers/mmc/host/mmci_stm32_sdmmc.c +++ b/drivers/mmc/host/mmci_stm32_sdmmc.c @@ -190,7 +190,7 @@ static int sdmmc_idma_setup(struct mmci_host *host) struct sdmmc_idma *idma; struct device *dev = mmc_dev(host->mmc); - idma = devm_kzalloc(dev, sizeof(*idma), GFP_KERNEL); + idma = devm_kzalloc_obj(dev, *idma); if (!idma) return -ENOMEM; @@ -734,7 +734,7 @@ void sdmmc_variant_init(struct mmci_host *host) if (IS_ERR(base_dlyb)) return; - dlyb = devm_kzalloc(mmc_dev(host->mmc), sizeof(*dlyb), GFP_KERNEL); + dlyb = devm_kzalloc_obj(mmc_dev(host->mmc), *dlyb); if (!dlyb) return; diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 5b160fdad3f0..c9c636755388 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -3135,9 +3135,7 @@ static int msdc_drv_probe(struct platform_device *pdev) msdc_init_hw(host); if (mmc->caps2 & MMC_CAP2_CQE) { - host->cq_host = devm_kzalloc(mmc->parent, - sizeof(*host->cq_host), - GFP_KERNEL); + host->cq_host = devm_kzalloc_obj(mmc->parent, *host->cq_host); if (!host->cq_host) { ret = -ENOMEM; goto release; @@ -3156,7 +3154,7 @@ static int msdc_drv_probe(struct platform_device *pdev) msdc_cqe_cit_cal(host, 2350); } else if (mmc->caps2 & MMC_CAP2_NO_SDIO) { /* Use HSQ on eMMC/SD (but not on SDIO) if HW CQE not supported */ - struct mmc_hsq *hsq = devm_kzalloc(&pdev->dev, sizeof(*hsq), GFP_KERNEL); + struct mmc_hsq *hsq = devm_kzalloc_obj(&pdev->dev, *hsq); if (!hsq) { ret = -ENOMEM; goto release; diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index 527b89a5ed70..77ff91825815 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c @@ -1383,8 +1383,7 @@ static int mmc_omap_probe(struct platform_device *pdev) return -EPROBE_DEFER; } - host = devm_kzalloc(&pdev->dev, sizeof(struct mmc_omap_host), - GFP_KERNEL); + host = devm_kzalloc_obj(&pdev->dev, struct mmc_omap_host); if (host == NULL) return -ENOMEM; diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index de5a3b70107d..020d49628c4a 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -1726,7 +1726,7 @@ static struct omap_hsmmc_platform_data *of_get_hsmmc_pdata(struct device *dev) struct omap_hsmmc_platform_data *pdata, *legacy; struct device_node *np = dev->of_node; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); /* out of memory */ diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index f9ec78d699f4..cb35360239bf 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -1074,8 +1074,7 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (!res) return -EINVAL; - priv = devm_kzalloc(&pdev->dev, sizeof(struct renesas_sdhi), - GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct renesas_sdhi); if (!priv) return -ENOMEM; diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c index 1de2f05fd958..78198e99c3d3 100644 --- a/drivers/mmc/host/sdhci-brcmstb.c +++ b/drivers/mmc/host/sdhci-brcmstb.c @@ -451,8 +451,7 @@ static int sdhci_brcmstb_add_host(struct sdhci_host *host, if (ret) return ret; - cq_host = devm_kzalloc(mmc_dev(host->mmc), - sizeof(*cq_host), GFP_KERNEL); + cq_host = devm_kzalloc_obj(mmc_dev(host->mmc), *cq_host); if (!cq_host) { ret = -ENOMEM; goto cleanup; diff --git a/drivers/mmc/host/sdhci-cadence-core.c b/drivers/mmc/host/sdhci-cadence-core.c index 745455743b01..16dc64a21dbb 100644 --- a/drivers/mmc/host/sdhci-cadence-core.c +++ b/drivers/mmc/host/sdhci-cadence-core.c @@ -650,7 +650,7 @@ static int sdhci_cdns4_phy_probe(struct platform_device *pdev, struct sdhci_cdns unsigned int nr_phy_params; nr_phy_params = sdhci_cdns4_phy_param_count(dev->of_node); - phy = devm_kzalloc(dev, struct_size(phy, phy_params, nr_phy_params), GFP_KERNEL); + phy = devm_kzalloc_flex(dev, *phy, phy_params, nr_phy_params); if (!phy) return -ENOMEM; diff --git a/drivers/mmc/host/sdhci-cadence-phy-v6.c b/drivers/mmc/host/sdhci-cadence-phy-v6.c index 22d56bb46d75..8a27d16ac1d4 100644 --- a/drivers/mmc/host/sdhci-cadence-phy-v6.c +++ b/drivers/mmc/host/sdhci-cadence-phy-v6.c @@ -865,7 +865,7 @@ int sdhci_cdns6_phy_probe(struct platform_device *pdev, struct sdhci_cdns_priv * unsigned long val; int ret; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 6ab59d3e346f..dc138d34035b 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1973,7 +1973,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) if (imx_data->socdata->flags & ESDHC_FLAG_CQHCI) { host->mmc->caps2 |= MMC_CAP2_CQE | MMC_CAP2_CQE_DCMD; - cq_host = devm_kzalloc(&pdev->dev, sizeof(*cq_host), GFP_KERNEL); + cq_host = devm_kzalloc_obj(&pdev->dev, *cq_host); if (!cq_host) { err = -ENOMEM; goto disable_ahb_clk; diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c index 0ee22923ad56..a0e62d034adb 100644 --- a/drivers/mmc/host/sdhci-of-arasan.c +++ b/drivers/mmc/host/sdhci-of-arasan.c @@ -1811,8 +1811,7 @@ static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan) if (ret) return ret; - cq_host = devm_kzalloc(host->mmc->parent, - sizeof(*cq_host), GFP_KERNEL); + cq_host = devm_kzalloc_obj(host->mmc->parent, *cq_host); if (!cq_host) { ret = -ENOMEM; goto cleanup; diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c index d317626feb4a..ad03469eeba4 100644 --- a/drivers/mmc/host/sdhci-of-aspeed.c +++ b/drivers/mmc/host/sdhci-of-aspeed.c @@ -525,7 +525,7 @@ static int aspeed_sdc_probe(struct platform_device *pdev) struct aspeed_sdc *sdc; int ret; - sdc = devm_kzalloc(&pdev->dev, sizeof(*sdc), GFP_KERNEL); + sdc = devm_kzalloc_obj(&pdev->dev, *sdc); if (!sdc) return -ENOMEM; diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c index 09702022e708..636f6af793e4 100644 --- a/drivers/mmc/host/sdhci-of-dwcmshc.c +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c @@ -926,7 +926,7 @@ static int dwcmshc_rk35xx_init(struct device *dev, struct sdhci_host *host, struct rk35xx_priv *priv; int err; - priv = devm_kzalloc(dev, sizeof(struct rk35xx_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct rk35xx_priv); if (!priv) return -ENOMEM; @@ -1783,7 +1783,7 @@ static int eic7700_init(struct device *dev, struct sdhci_host *host, struct dwcm struct regmap *hsp_regmap; int ret; - priv = devm_kzalloc(dev, sizeof(struct eic7700_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct eic7700_priv); if (!priv) return -ENOMEM; @@ -1967,7 +1967,7 @@ static int dwcmshc_k230_init(struct device *dev, struct sdhci_host *host, u32 data; int ret; - k230_priv = devm_kzalloc(dev, sizeof(struct k230_priv), GFP_KERNEL); + k230_priv = devm_kzalloc_obj(dev, struct k230_priv); if (!k230_priv) return -ENOMEM; @@ -2288,7 +2288,7 @@ static void dwcmshc_cqhci_init(struct sdhci_host *host, struct platform_device * int err; host->mmc->caps2 |= MMC_CAP2_CQE | MMC_CAP2_CQE_DCMD; - cq_host = devm_kzalloc(&pdev->dev, sizeof(*cq_host), GFP_KERNEL); + cq_host = devm_kzalloc_obj(&pdev->dev, *cq_host); if (!cq_host) { dev_err(mmc_dev(host->mmc), "Unable to setup CQE: not enough memory\n"); goto dsbl_cqe_caps; diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c index 7a198fb26628..cc0c9d3998bd 100644 --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c @@ -1122,10 +1122,8 @@ static int sdhci_omap_config_iodelay_pinctrl_state(struct sdhci_omap_host if (!(omap_host->flags & SDHCI_OMAP_REQUIRE_IODELAY)) return 0; - pinctrl_state = devm_kcalloc(dev, - MMC_TIMING_MMC_HS200 + 1, - sizeof(*pinctrl_state), - GFP_KERNEL); + pinctrl_state = devm_kzalloc_objs(dev, *pinctrl_state, + MMC_TIMING_MMC_HS200 + 1); if (!pinctrl_state) return -ENOMEM; diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c index a9000f3bd419..920f5a158f1d 100644 --- a/drivers/mmc/host/sdhci-pci-core.c +++ b/drivers/mmc/host/sdhci-pci-core.c @@ -959,7 +959,7 @@ static int glk_emmc_add_host(struct sdhci_pci_slot *slot) if (ret) return ret; - cq_host = devm_kzalloc(dev, sizeof(*cq_host), GFP_KERNEL); + cq_host = devm_kzalloc_obj(dev, *cq_host); if (!cq_host) { ret = -ENOMEM; goto cleanup; @@ -2327,7 +2327,7 @@ static int sdhci_pci_probe(struct pci_dev *pdev, if (ret) return ret; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/mmc/host/sdhci-pci-gli.c b/drivers/mmc/host/sdhci-pci-gli.c index b55618566d65..6542b3225c76 100644 --- a/drivers/mmc/host/sdhci-pci-gli.c +++ b/drivers/mmc/host/sdhci-pci-gli.c @@ -1797,7 +1797,7 @@ static int gl9763e_add_host(struct sdhci_pci_slot *slot) if (ret) return ret; - cq_host = devm_kzalloc(dev, sizeof(*cq_host), GFP_KERNEL); + cq_host = devm_kzalloc_obj(dev, *cq_host); if (!cq_host) { ret = -ENOMEM; goto cleanup; diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c index 76346353dc55..d7696c44530e 100644 --- a/drivers/mmc/host/sdhci-pxav2.c +++ b/drivers/mmc/host/sdhci-pxav2.c @@ -223,7 +223,7 @@ static struct sdhci_pxa_platdata *pxav2_get_mmc_pdata(struct device *dev) u32 bus_width; u32 clk_delay_cycles; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return NULL; diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c index f39764ffd4a0..d60f23ac2807 100644 --- a/drivers/mmc/host/sdhci-pxav3.c +++ b/drivers/mmc/host/sdhci-pxav3.c @@ -366,7 +366,7 @@ static struct sdhci_pxa_platdata *pxav3_get_mmc_pdata(struct device *dev) struct sdhci_pxa_platdata *pdata; u32 clk_delay_cycles; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return NULL; diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 6bf66aaa86a6..ca6120adb21e 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c @@ -506,7 +506,7 @@ static int sdhci_s3c_probe(struct platform_device *pdev) } sc = sdhci_priv(host); - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c index 0c8f389fe584..049859195872 100644 --- a/drivers/mmc/host/sdhci-sprd.c +++ b/drivers/mmc/host/sdhci-sprd.c @@ -849,7 +849,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev) sprd_host->flags = host->flags; - hsq = devm_kzalloc(&pdev->dev, sizeof(*hsq), GFP_KERNEL); + hsq = devm_kzalloc_obj(&pdev->dev, *hsq); if (!hsq) { ret = -ENOMEM; goto err_cleanup_host; diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 5c5efb62d7ec..ae498247ac66 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -1634,8 +1634,7 @@ static int sdhci_tegra_add_host(struct sdhci_host *host) host->mmc->caps2 |= MMC_CAP2_CQE | MMC_CAP2_CQE_DCMD; - cq_host = devm_kzalloc(mmc_dev(host->mmc), - sizeof(*cq_host), GFP_KERNEL); + cq_host = devm_kzalloc_obj(mmc_dev(host->mmc), *cq_host); if (!cq_host) { ret = -ENOMEM; goto cleanup; diff --git a/drivers/mmc/host/sdhci-xenon-phy.c b/drivers/mmc/host/sdhci-xenon-phy.c index cc9d28b75eb9..624ea8d668de 100644 --- a/drivers/mmc/host/sdhci-xenon-phy.c +++ b/drivers/mmc/host/sdhci-xenon-phy.c @@ -206,7 +206,7 @@ static int xenon_alloc_emmc_phy(struct sdhci_host *host) struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host); struct xenon_emmc_phy_params *params; - params = devm_kzalloc(mmc_dev(host->mmc), sizeof(*params), GFP_KERNEL); + params = devm_kzalloc_obj(mmc_dev(host->mmc), *params); if (!params) return -ENOMEM; diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c index 2e332f52c301..abe6ff7d1e5a 100644 --- a/drivers/mmc/host/sdhci_am654.c +++ b/drivers/mmc/host/sdhci_am654.c @@ -718,8 +718,7 @@ static int sdhci_am654_cqe_add_host(struct sdhci_host *host) { struct cqhci_host *cq_host; - cq_host = devm_kzalloc(mmc_dev(host->mmc), sizeof(struct cqhci_host), - GFP_KERNEL); + cq_host = devm_kzalloc_obj(mmc_dev(host->mmc), struct cqhci_host); if (!cq_host) return -ENOMEM; diff --git a/drivers/mmc/host/uniphier-sd.c b/drivers/mmc/host/uniphier-sd.c index 1eae2f4b6c1f..0d25c6e2f9d2 100644 --- a/drivers/mmc/host/uniphier-sd.c +++ b/drivers/mmc/host/uniphier-sd.c @@ -624,7 +624,7 @@ static int uniphier_sd_probe(struct platform_device *pdev) if (irq < 0) return irq; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/mtd/devices/bcm47xxsflash.c b/drivers/mtd/devices/bcm47xxsflash.c index 2edc46741774..090587be90fd 100644 --- a/drivers/mtd/devices/bcm47xxsflash.c +++ b/drivers/mtd/devices/bcm47xxsflash.c @@ -290,7 +290,7 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev) struct resource *res; int err; - b47s = devm_kzalloc(dev, sizeof(*b47s), GFP_KERNEL); + b47s = devm_kzalloc_obj(dev, *b47s); if (!b47s) return -ENOMEM; diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c index 3d89f810e2db..a8a77de1c6f0 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -1980,8 +1980,7 @@ static int __init docg3_probe(struct platform_device *pdev) return PTR_ERR(base); ret = -ENOMEM; - cascade = devm_kcalloc(dev, DOC_MAX_NBFLOORS, sizeof(*cascade), - GFP_KERNEL); + cascade = devm_kzalloc_objs(dev, *cascade, DOC_MAX_NBFLOORS); if (!cascade) return ret; cascade->base = base; diff --git a/drivers/mtd/devices/mchp23k256.c b/drivers/mtd/devices/mchp23k256.c index 66e058df4c32..05a4ebe21e4b 100644 --- a/drivers/mtd/devices/mchp23k256.c +++ b/drivers/mtd/devices/mchp23k256.c @@ -174,7 +174,7 @@ static int mchp23k256_probe(struct spi_device *spi) struct flash_platform_data *data; int err; - flash = devm_kzalloc(&spi->dev, sizeof(*flash), GFP_KERNEL); + flash = devm_kzalloc_obj(&spi->dev, *flash); if (!flash) return -ENOMEM; diff --git a/drivers/mtd/devices/mchp48l640.c b/drivers/mtd/devices/mchp48l640.c index 4af9208f9690..c6e83775638d 100644 --- a/drivers/mtd/devices/mchp48l640.c +++ b/drivers/mtd/devices/mchp48l640.c @@ -317,7 +317,7 @@ static int mchp48l640_probe(struct spi_device *spi) int err; int status; - flash = devm_kzalloc(&spi->dev, sizeof(*flash), GFP_KERNEL); + flash = devm_kzalloc_obj(&spi->dev, *flash); if (!flash) return -ENOMEM; diff --git a/drivers/mtd/devices/powernv_flash.c b/drivers/mtd/devices/powernv_flash.c index fe1d6684d0bd..4bd7b41a03b7 100644 --- a/drivers/mtd/devices/powernv_flash.c +++ b/drivers/mtd/devices/powernv_flash.c @@ -236,7 +236,7 @@ static int powernv_flash_probe(struct platform_device *pdev) struct powernv_flash *data; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c index f02f96bff450..dc66ed852d80 100644 --- a/drivers/mtd/devices/spear_smi.c +++ b/drivers/mtd/devices/spear_smi.c @@ -805,9 +805,8 @@ static int spear_smi_probe_config_dt(struct platform_device *pdev, of_property_read_u32(np, "clock-rate", &val); pdata->clk_rate = val; - pdata->board_flash_info = devm_kzalloc(&pdev->dev, - sizeof(*pdata->board_flash_info), - GFP_KERNEL); + pdata->board_flash_info = devm_kzalloc_obj(&pdev->dev, + *pdata->board_flash_info); if (!pdata->board_flash_info) return -ENOMEM; @@ -858,7 +857,7 @@ static int spear_smi_setup_banks(struct platform_device *pdev, if (!flash_info) return -ENODEV; - flash = devm_kzalloc(&pdev->dev, sizeof(*flash), GFP_ATOMIC); + flash = devm_kzalloc_obj(&pdev->dev, *flash, GFP_ATOMIC); if (!flash) return -ENOMEM; flash->bank = bank; @@ -941,7 +940,7 @@ static int spear_smi_probe(struct platform_device *pdev) int i; if (np) { - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) { ret = -ENOMEM; goto err; @@ -968,7 +967,7 @@ static int spear_smi_probe(struct platform_device *pdev) goto err; } - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c index 8813994ce9f4..b4ba92e1979d 100644 --- a/drivers/mtd/devices/sst25l.c +++ b/drivers/mtd/devices/sst25l.c @@ -356,7 +356,7 @@ static int sst25l_probe(struct spi_device *spi) if (!flash_info) return -ENODEV; - flash = devm_kzalloc(&spi->dev, sizeof(*flash), GFP_KERNEL); + flash = devm_kzalloc_obj(&spi->dev, *flash); if (!flash) return -ENOMEM; diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index f2266145b821..94872e03a04d 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -2024,7 +2024,7 @@ static int stfsm_probe(struct platform_device *pdev) return -EINVAL; } - fsm = devm_kzalloc(&pdev->dev, sizeof(*fsm), GFP_KERNEL); + fsm = devm_kzalloc_obj(&pdev->dev, *fsm); if (!fsm) return -ENOMEM; diff --git a/drivers/mtd/hyperbus/hbmc-am654.c b/drivers/mtd/hyperbus/hbmc-am654.c index 8a14e908d0b5..acbcc3b55d86 100644 --- a/drivers/mtd/hyperbus/hbmc-am654.c +++ b/drivers/mtd/hyperbus/hbmc-am654.c @@ -166,7 +166,7 @@ static int am654_hbmc_probe(struct platform_device *pdev) struct resource res; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -204,7 +204,7 @@ static int am654_hbmc_probe(struct platform_device *pdev) priv->ctlr.ops = &am654_hbmc_ops; priv->hbdev.ctlr = &priv->ctlr; - dev_priv = devm_kzalloc(dev, sizeof(*dev_priv), GFP_KERNEL); + dev_priv = devm_kzalloc_obj(dev, *dev_priv); if (!dev_priv) { ret = -ENOMEM; goto disable_mux; diff --git a/drivers/mtd/hyperbus/rpc-if.c b/drivers/mtd/hyperbus/rpc-if.c index f448e23f9260..9eacc9ec7382 100644 --- a/drivers/mtd/hyperbus/rpc-if.c +++ b/drivers/mtd/hyperbus/rpc-if.c @@ -120,7 +120,7 @@ static int rpcif_hb_probe(struct platform_device *pdev) struct rpcif_hyperbus *hyperbus; int error; - hyperbus = devm_kzalloc(dev, sizeof(*hyperbus), GFP_KERNEL); + hyperbus = devm_kzalloc_obj(dev, *hyperbus); if (!hyperbus) return -ENOMEM; diff --git a/drivers/mtd/lpddr/lpddr2_nvm.c b/drivers/mtd/lpddr/lpddr2_nvm.c index 565b71f7fdd5..7aac62b633ad 100644 --- a/drivers/mtd/lpddr/lpddr2_nvm.c +++ b/drivers/mtd/lpddr/lpddr2_nvm.c @@ -415,18 +415,18 @@ static int lpddr2_nvm_probe(struct platform_device *pdev) struct pcm_int_data *pcm_data; /* Allocate memory control_regs data structures */ - pcm_data = devm_kzalloc(&pdev->dev, sizeof(*pcm_data), GFP_KERNEL); + pcm_data = devm_kzalloc_obj(&pdev->dev, *pcm_data); if (!pcm_data) return -ENOMEM; pcm_data->bus_width = BUS_WIDTH; /* Allocate memory for map_info & mtd_info data structures */ - map = devm_kzalloc(&pdev->dev, sizeof(*map), GFP_KERNEL); + map = devm_kzalloc_obj(&pdev->dev, *map); if (!map) return -ENOMEM; - mtd = devm_kzalloc(&pdev->dev, sizeof(*mtd), GFP_KERNEL); + mtd = devm_kzalloc_obj(&pdev->dev, *mtd); if (!mtd) return -ENOMEM; diff --git a/drivers/mtd/maps/int0800.c b/drivers/mtd/maps/int0800.c index c5f108aa3479..1f5a7c4936dd 100644 --- a/drivers/mtd/maps/int0800.c +++ b/drivers/mtd/maps/int0800.c @@ -37,7 +37,7 @@ static int int0800_probe(struct platform_device *pdev) resource_size_t end; int ret; - fw = devm_kzalloc(&pdev->dev, sizeof(*fw), GFP_KERNEL); + fw = devm_kzalloc_obj(&pdev->dev, *fw); if (!fw) return -ENOMEM; diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c index 80d467eba92a..519126abb9a5 100644 --- a/drivers/mtd/maps/lantiq-flash.c +++ b/drivers/mtd/maps/lantiq-flash.c @@ -112,7 +112,7 @@ ltq_mtd_probe(struct platform_device *pdev) struct cfi_private *cfi; int err; - ltq_mtd = devm_kzalloc(&pdev->dev, sizeof(struct ltq_mtd), GFP_KERNEL); + ltq_mtd = devm_kzalloc_obj(&pdev->dev, struct ltq_mtd); if (!ltq_mtd) return -ENOMEM; @@ -122,8 +122,7 @@ ltq_mtd_probe(struct platform_device *pdev) if (IS_ERR(ltq_mtd->map->virt)) return PTR_ERR(ltq_mtd->map->virt); - ltq_mtd->map = devm_kzalloc(&pdev->dev, sizeof(struct map_info), - GFP_KERNEL); + ltq_mtd->map = devm_kzalloc_obj(&pdev->dev, struct map_info); if (!ltq_mtd->map) return -ENOMEM; diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c index dcda7685fc99..4c57b7b75022 100644 --- a/drivers/mtd/maps/physmap-core.c +++ b/drivers/mtd/maps/physmap-core.c @@ -280,7 +280,7 @@ static const char * const *of_get_part_probes(struct platform_device *dev) if (count < 0) return of_default_part_probes; - res = devm_kcalloc(&dev->dev, count + 1, sizeof(*res), GFP_KERNEL); + res = devm_kzalloc_objs(&dev->dev, *res, count + 1); if (!res) return NULL; @@ -447,7 +447,7 @@ static int physmap_flash_probe(struct platform_device *dev) if (!dev->dev.of_node && !dev_get_platdata(&dev->dev)) return -EINVAL; - info = devm_kzalloc(&dev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&dev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/mtd/maps/physmap-gemini.c b/drivers/mtd/maps/physmap-gemini.c index 1c34b4ef77ea..ae9e24eb3db0 100644 --- a/drivers/mtd/maps/physmap-gemini.c +++ b/drivers/mtd/maps/physmap-gemini.c @@ -130,7 +130,7 @@ int of_flash_probe_gemini(struct platform_device *pdev, if (!of_device_is_compatible(np, "cortina,gemini-flash")) return 0; - gf = devm_kzalloc(dev, sizeof(*gf), GFP_KERNEL); + gf = devm_kzalloc_obj(dev, *gf); if (!gf) return -ENOMEM; gf->dev = dev; diff --git a/drivers/mtd/nand/ecc-mtk.c b/drivers/mtd/nand/ecc-mtk.c index 66f0985ef7cd..a3a285170fcd 100644 --- a/drivers/mtd/nand/ecc-mtk.c +++ b/drivers/mtd/nand/ecc-mtk.c @@ -540,7 +540,7 @@ static int mtk_ecc_probe(struct platform_device *pdev) u32 max_eccdata_size; int irq, ret; - ecc = devm_kzalloc(dev, sizeof(*ecc), GFP_KERNEL); + ecc = devm_kzalloc_obj(dev, *ecc); if (!ecc) return -ENOMEM; diff --git a/drivers/mtd/nand/ecc-mxic.c b/drivers/mtd/nand/ecc-mxic.c index 60cdcb4175ef..41ee49419798 100644 --- a/drivers/mtd/nand/ecc-mxic.c +++ b/drivers/mtd/nand/ecc-mxic.c @@ -230,7 +230,7 @@ static int mxic_ecc_init_ctx(struct nand_device *nand, struct device *dev) u32 spare_reg; int ret; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; @@ -799,7 +799,7 @@ static int mxic_ecc_probe(struct platform_device *pdev) struct mxic_ecc_engine *mxic; int ret; - mxic = devm_kzalloc(&pdev->dev, sizeof(*mxic), GFP_KERNEL); + mxic = devm_kzalloc_obj(&pdev->dev, *mxic); if (!mxic) return -ENOMEM; diff --git a/drivers/mtd/nand/ecc-realtek.c b/drivers/mtd/nand/ecc-realtek.c index 76d75e2107df..fb573c7f2280 100644 --- a/drivers/mtd/nand/ecc-realtek.c +++ b/drivers/mtd/nand/ecc-realtek.c @@ -345,7 +345,7 @@ static int rtl_ecc_init_ctx(struct nand_device *nand) if (ret) return ret; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; @@ -396,7 +396,7 @@ static int rtl_ecc_probe(struct platform_device *pdev) void __iomem *base; int ret; - rtlc = devm_kzalloc(dev, sizeof(*rtlc), GFP_KERNEL); + rtlc = devm_kzalloc_obj(dev, *rtlc); if (!rtlc) return -ENOMEM; diff --git a/drivers/mtd/nand/onenand/onenand_omap2.c b/drivers/mtd/nand/onenand/onenand_omap2.c index 644498187d8f..4c1379343fbd 100644 --- a/drivers/mtd/nand/onenand/onenand_omap2.c +++ b/drivers/mtd/nand/onenand/onenand_omap2.c @@ -473,7 +473,7 @@ static int omap2_onenand_probe(struct platform_device *pdev) return r; } - c = devm_kzalloc(dev, sizeof(struct omap2_onenand), GFP_KERNEL); + c = devm_kzalloc_obj(dev, struct omap2_onenand); if (!c) return -ENOMEM; diff --git a/drivers/mtd/nand/onenand/onenand_samsung.c b/drivers/mtd/nand/onenand/onenand_samsung.c index b7b7758ce4d8..8c2d3866a6d6 100644 --- a/drivers/mtd/nand/onenand/onenand_samsung.c +++ b/drivers/mtd/nand/onenand/onenand_samsung.c @@ -852,8 +852,7 @@ static int s3c_onenand_probe(struct platform_device *pdev) if (!mtd) return -ENOMEM; - onenand = devm_kzalloc(&pdev->dev, sizeof(struct s3c_onenand), - GFP_KERNEL); + onenand = devm_kzalloc_obj(&pdev->dev, struct s3c_onenand); if (!onenand) return -ENOMEM; diff --git a/drivers/mtd/nand/qpic_common.c b/drivers/mtd/nand/qpic_common.c index 91ae970734f8..e97043b866d2 100644 --- a/drivers/mtd/nand/qpic_common.c +++ b/drivers/mtd/nand/qpic_common.c @@ -692,13 +692,13 @@ int qcom_nandc_alloc(struct qcom_nand_controller *nandc) if (!nandc->data_buffer) return -ENOMEM; - nandc->regs = devm_kzalloc(nandc->dev, sizeof(*nandc->regs), GFP_KERNEL); + nandc->regs = devm_kzalloc_obj(nandc->dev, *nandc->regs); if (!nandc->regs) return -ENOMEM; - nandc->reg_read_buf = devm_kcalloc(nandc->dev, MAX_REG_RD, - sizeof(*nandc->reg_read_buf), - GFP_KERNEL); + nandc->reg_read_buf = devm_kzalloc_objs(nandc->dev, + *nandc->reg_read_buf, + MAX_REG_RD); if (!nandc->reg_read_buf) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c index fb2b7db70297..d6c3ed0f858c 100644 --- a/drivers/mtd/nand/raw/ams-delta.c +++ b/drivers/mtd/nand/raw/ams-delta.c @@ -250,8 +250,7 @@ static int gpio_nand_probe(struct platform_device *pdev) } /* Allocate memory for MTD device structure and private data */ - priv = devm_kzalloc(&pdev->dev, sizeof(struct gpio_nand), - GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct gpio_nand); if (!priv) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/arasan-nand-controller.c b/drivers/mtd/nand/raw/arasan-nand-controller.c index 865754737f5f..7ff57abf61f7 100644 --- a/drivers/mtd/nand/raw/arasan-nand-controller.c +++ b/drivers/mtd/nand/raw/arasan-nand-controller.c @@ -1173,8 +1173,8 @@ static int anfc_init_hw_ecc_controller(struct arasan_nfc *nfc, ECC_CONF_LEN(anand->ecc_total) | ECC_CONF_BCH_EN; - anand->errloc = devm_kmalloc_array(nfc->dev, ecc->strength, - sizeof(*anand->errloc), GFP_KERNEL); + anand->errloc = devm_kmalloc_objs(nfc->dev, *anand->errloc, + ecc->strength); if (!anand->errloc) return -ENOMEM; @@ -1276,7 +1276,7 @@ static int anfc_chip_init(struct arasan_nfc *nfc, struct device_node *np) struct mtd_info *mtd; int rb, ret, i; - anand = devm_kzalloc(nfc->dev, sizeof(*anand), GFP_KERNEL); + anand = devm_kzalloc_obj(nfc->dev, *anand); if (!anand) return -ENOMEM; @@ -1287,8 +1287,8 @@ static int anfc_chip_init(struct arasan_nfc *nfc, struct device_node *np) return -EINVAL; } - anand->cs_idx = devm_kcalloc(nfc->dev, anand->ncs_idx, - sizeof(*anand->cs_idx), GFP_KERNEL); + anand->cs_idx = devm_kzalloc_objs(nfc->dev, *anand->cs_idx, + anand->ncs_idx); if (!anand->cs_idx) return -ENOMEM; @@ -1436,7 +1436,7 @@ static int anfc_probe(struct platform_device *pdev) struct arasan_nfc *nfc; int ret; - nfc = devm_kzalloc(&pdev->dev, sizeof(*nfc), GFP_KERNEL); + nfc = devm_kzalloc_obj(&pdev->dev, *nfc); if (!nfc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c index 0bdbcbb50d94..24bf93409364 100644 --- a/drivers/mtd/nand/raw/atmel/nand-controller.c +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c @@ -1649,7 +1649,7 @@ static struct atmel_nand *atmel_nand_create(struct atmel_nand_controller *nc, return ERR_PTR(-EINVAL); } - nand = devm_kzalloc(nc->dev, struct_size(nand, cs, numcs), GFP_KERNEL); + nand = devm_kzalloc_flex(nc->dev, *nand, cs, numcs); if (!nand) return ERR_PTR(-ENOMEM); @@ -1799,7 +1799,7 @@ atmel_nand_controller_legacy_add_nands(struct atmel_nand_controller *nc) * Legacy bindings only allow connecting a single NAND with a unique CS * line to the controller. */ - nand = devm_kzalloc(nc->dev, struct_size(nand, cs, 1), GFP_KERNEL); + nand = devm_kzalloc_flex(nc->dev, *nand, cs, 1); if (!nand) return -ENOMEM; @@ -2356,7 +2356,7 @@ static int atmel_hsmc_nand_controller_probe(struct platform_device *pdev, struct atmel_hsmc_nand_controller *nc; int ret; - nc = devm_kzalloc(dev, sizeof(*nc), GFP_KERNEL); + nc = devm_kzalloc_obj(dev, *nc); if (!nc) return -ENOMEM; @@ -2433,7 +2433,7 @@ static int atmel_smc_nand_controller_probe(struct platform_device *pdev, struct atmel_smc_nand_controller *nc; int ret; - nc = devm_kzalloc(dev, sizeof(*nc), GFP_KERNEL); + nc = devm_kzalloc_obj(dev, *nc); if (!nc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/atmel/pmecc.c b/drivers/mtd/nand/raw/atmel/pmecc.c index 1d0e93e4edb1..37ce23d526b3 100644 --- a/drivers/mtd/nand/raw/atmel/pmecc.c +++ b/drivers/mtd/nand/raw/atmel/pmecc.c @@ -828,7 +828,7 @@ static struct atmel_pmecc *atmel_pmecc_create(struct platform_device *pdev, struct device *dev = &pdev->dev; struct atmel_pmecc *pmecc; - pmecc = devm_kzalloc(dev, sizeof(*pmecc), GFP_KERNEL); + pmecc = devm_kzalloc_obj(dev, *pmecc); if (!pmecc) return ERR_PTR(-ENOMEM); diff --git a/drivers/mtd/nand/raw/bcm47xxnflash/main.c b/drivers/mtd/nand/raw/bcm47xxnflash/main.c index 4d4e185c22e5..93c011b8093b 100644 --- a/drivers/mtd/nand/raw/bcm47xxnflash/main.c +++ b/drivers/mtd/nand/raw/bcm47xxnflash/main.c @@ -26,7 +26,7 @@ static int bcm47xxnflash_probe(struct platform_device *pdev) struct mtd_info *mtd; int err = 0; - b47n = devm_kzalloc(&pdev->dev, sizeof(*b47n), GFP_KERNEL); + b47n = devm_kzalloc_obj(&pdev->dev, *b47n); if (!b47n) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c index a06cd87f839a..51b1125d036b 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c @@ -89,7 +89,7 @@ static int bcm6368_nand_probe(struct platform_device *pdev) struct bcm6368_nand_soc *priv; struct brcmnand_soc *soc; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; soc = &priv->soc; diff --git a/drivers/mtd/nand/raw/brcmnand/bcma_nand.c b/drivers/mtd/nand/raw/brcmnand/bcma_nand.c index dd27977919fb..3b5de87ec47e 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcma_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcma_nand.c @@ -101,7 +101,7 @@ static int brcmnand_bcma_nand_probe(struct platform_device *pdev) struct bcma_nflash *nflash = dev_get_platdata(&pdev->dev); struct brcmnand_bcma_soc *soc; - soc = devm_kzalloc(&pdev->dev, sizeof(*soc), GFP_KERNEL); + soc = devm_kzalloc_obj(&pdev->dev, *soc); if (!soc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c b/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c index c31d7f37dc52..674fcda05bb1 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c @@ -88,7 +88,7 @@ static int bcmbca_nand_probe(struct platform_device *pdev) struct bcmbca_nand_soc *priv; struct brcmnand_soc *soc; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; soc = &priv->soc; diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 4a1f5e736a1c..78937498cc02 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -3307,7 +3307,7 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc) if (dn && !of_match_node(brcmnand_of_match, dn)) return -ENODEV; - ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(dev, *ctrl); if (!ctrl) return -ENOMEM; @@ -3489,7 +3489,7 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc) for_each_available_child_of_node_scoped(dn, child) { if (of_device_is_compatible(child, "brcm,nandcs")) { - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) { ret = -ENOMEM; goto err; @@ -3528,7 +3528,7 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc) } /* If we got there we must have been probing via platform data */ - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) { ret = -ENOMEM; goto err; diff --git a/drivers/mtd/nand/raw/brcmnand/iproc_nand.c b/drivers/mtd/nand/raw/brcmnand/iproc_nand.c index 089c70fc6edf..f2ef3b7a0943 100644 --- a/drivers/mtd/nand/raw/brcmnand/iproc_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/iproc_nand.c @@ -104,7 +104,7 @@ static int iproc_nand_probe(struct platform_device *pdev) struct iproc_nand_soc *priv; struct brcmnand_soc *soc; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; soc = &priv->soc; diff --git a/drivers/mtd/nand/raw/cadence-nand-controller.c b/drivers/mtd/nand/raw/cadence-nand-controller.c index 4f5e6d2b128c..e19ceb2d5dfc 100644 --- a/drivers/mtd/nand/raw/cadence-nand-controller.c +++ b/drivers/mtd/nand/raw/cadence-nand-controller.c @@ -3275,7 +3275,7 @@ static int cadence_nand_dt_probe(struct platform_device *ofdev) return -ENOMEM; } - dt = devm_kzalloc(&ofdev->dev, sizeof(*dt), GFP_KERNEL); + dt = devm_kzalloc_obj(&ofdev->dev, *dt); if (!dt) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c index 3986553881d0..20aebe101e8d 100644 --- a/drivers/mtd/nand/raw/davinci_nand.c +++ b/drivers/mtd/nand/raw/davinci_nand.c @@ -542,9 +542,7 @@ nand_davinci_get_pdata(struct platform_device *pdev) const char *mode; u32 prop; - pdata = devm_kzalloc(&pdev->dev, - sizeof(struct davinci_nand_pdata), - GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, struct davinci_nand_pdata); pdev->dev.platform_data = pdata; if (!pdata) return ERR_PTR(-ENOMEM); @@ -919,7 +917,7 @@ static int nand_davinci_probe(struct platform_device *pdev) if (pdata->core_chipsel > 3) return -ENODEV; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c index 8c822eae72e7..01733238dac9 100644 --- a/drivers/mtd/nand/raw/denali_dt.c +++ b/drivers/mtd/nand/raw/denali_dt.c @@ -89,8 +89,7 @@ static int denali_dt_chip_init(struct denali_controller *denali, if (nsels < 0) return nsels; - dchip = devm_kzalloc(denali->dev, struct_size(dchip, sels, nsels), - GFP_KERNEL); + dchip = devm_kzalloc_flex(denali->dev, *dchip, sels, nsels); if (!dchip) return -ENOMEM; @@ -117,7 +116,7 @@ static int denali_dt_probe(struct platform_device *pdev) struct denali_controller *denali; int ret; - dt = devm_kzalloc(dev, sizeof(*dt), GFP_KERNEL); + dt = devm_kzalloc_obj(dev, *dt); if (!dt) return -ENOMEM; denali = &dt->controller; diff --git a/drivers/mtd/nand/raw/denali_pci.c b/drivers/mtd/nand/raw/denali_pci.c index f53df1b32dda..0e4c7e4a4b32 100644 --- a/drivers/mtd/nand/raw/denali_pci.c +++ b/drivers/mtd/nand/raw/denali_pci.c @@ -35,7 +35,7 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) struct denali_chip *dchip; int nsels, ret, i; - denali = devm_kzalloc(&dev->dev, sizeof(*denali), GFP_KERNEL); + denali = devm_kzalloc_obj(&dev->dev, *denali); if (!denali) return -ENOMEM; @@ -92,8 +92,7 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) nsels = denali->nbanks; - dchip = devm_kzalloc(denali->dev, struct_size(dchip, sels, nsels), - GFP_KERNEL); + dchip = devm_kzalloc_flex(denali->dev, *dchip, sels, nsels); if (!dchip) { ret = -ENOMEM; goto out_remove_denali; diff --git a/drivers/mtd/nand/raw/fsl_ifc_nand.c b/drivers/mtd/nand/raw/fsl_ifc_nand.c index cc75b6a67e07..d5d0c7c7bfba 100644 --- a/drivers/mtd/nand/raw/fsl_ifc_nand.c +++ b/drivers/mtd/nand/raw/fsl_ifc_nand.c @@ -1016,14 +1016,14 @@ static int fsl_ifc_nand_probe(struct platform_device *dev) return -ENODEV; } - priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&dev->dev, *priv); if (!priv) return -ENOMEM; mutex_lock(&fsl_ifc_nand_mutex); if (!fsl_ifc_ctrl_dev->nand) { - ifc_nand_ctrl = devm_kzalloc(fsl_ifc_ctrl_dev->dev, sizeof(*ifc_nand_ctrl), - GFP_KERNEL); + ifc_nand_ctrl = devm_kzalloc_obj(fsl_ifc_ctrl_dev->dev, + *ifc_nand_ctrl); if (!ifc_nand_ctrl) { mutex_unlock(&fsl_ifc_nand_mutex); return -ENOMEM; diff --git a/drivers/mtd/nand/raw/fsl_upm.c b/drivers/mtd/nand/raw/fsl_upm.c index f4dc990a8da1..8896720be505 100644 --- a/drivers/mtd/nand/raw/fsl_upm.c +++ b/drivers/mtd/nand/raw/fsl_upm.c @@ -169,7 +169,7 @@ static int fun_probe(struct platform_device *ofdev) int size; int i; - fun = devm_kzalloc(&ofdev->dev, sizeof(*fun), GFP_KERNEL); + fun = devm_kzalloc_obj(&ofdev->dev, *fun); if (!fun) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c index 837c23c63aeb..eee00c6f43e0 100644 --- a/drivers/mtd/nand/raw/fsmc_nand.c +++ b/drivers/mtd/nand/raw/fsmc_nand.c @@ -889,9 +889,7 @@ static int fsmc_nand_probe_config_dt(struct platform_device *pdev, if (of_property_read_bool(np, "nand-skip-bbtscan")) nand->options |= NAND_SKIP_BBTSCAN; - host->dev_timings = devm_kzalloc(&pdev->dev, - sizeof(*host->dev_timings), - GFP_KERNEL); + host->dev_timings = devm_kzalloc_obj(&pdev->dev, *host->dev_timings); if (!host->dev_timings) return -ENOMEM; @@ -1037,7 +1035,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) int i; /* Allocate memory for the device structure (and zero it) */ - host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(&pdev->dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/gpio.c b/drivers/mtd/nand/raw/gpio.c index 69e5e43532a4..63853d7a8104 100644 --- a/drivers/mtd/nand/raw/gpio.c +++ b/drivers/mtd/nand/raw/gpio.c @@ -214,7 +214,7 @@ static struct resource *gpio_nand_get_io_sync_of(struct platform_device *pdev) "gpio-control-nand,io-sync-reg", &addr)) return NULL; - r = devm_kzalloc(&pdev->dev, sizeof(*r), GFP_KERNEL); + r = devm_kzalloc_obj(&pdev->dev, *r); if (!r) return NULL; @@ -294,7 +294,7 @@ static int gpio_nand_probe(struct platform_device *pdev) if (!dev->of_node && !dev_get_platdata(dev)) return -EINVAL; - gpiomtd = devm_kzalloc(dev, sizeof(*gpiomtd), GFP_KERNEL); + gpiomtd = devm_kzalloc_obj(dev, *gpiomtd); if (!gpiomtd) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c index 0f1528710a6a..019df54c4bb0 100644 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c @@ -2787,7 +2787,7 @@ static int gpmi_nand_probe(struct platform_device *pdev) struct gpmi_nand_data *this; int ret; - this = devm_kzalloc(&pdev->dev, sizeof(*this), GFP_KERNEL); + this = devm_kzalloc_obj(&pdev->dev, *this); if (!this) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/hisi504_nand.c b/drivers/mtd/nand/raw/hisi504_nand.c index d97270ec1185..c5063d681476 100644 --- a/drivers/mtd/nand/raw/hisi504_nand.c +++ b/drivers/mtd/nand/raw/hisi504_nand.c @@ -740,7 +740,7 @@ static int hisi_nfc_probe(struct platform_device *pdev) struct mtd_info *mtd; struct device_node *np = dev->of_node; - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) return -ENOMEM; host->dev = dev; diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c b/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c index beb033705cf3..88e5861a7b1f 100644 --- a/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c +++ b/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c @@ -134,7 +134,7 @@ int ingenic_ecc_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct ingenic_ecc *ecc; - ecc = devm_kzalloc(dev, sizeof(*ecc), GFP_KERNEL); + ecc = devm_kzalloc_obj(dev, *ecc); if (!ecc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c index f1e2c82936b3..631db0e93a36 100644 --- a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c +++ b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c @@ -368,7 +368,7 @@ static int ingenic_nand_init_chip(struct platform_device *pdev, if (IS_ERR(cs->base)) return PTR_ERR(cs->base); - nand = devm_kzalloc(dev, sizeof(*nand), GFP_KERNEL); + nand = devm_kzalloc_obj(dev, *nand); if (!nand) return -ENOMEM; @@ -474,7 +474,7 @@ static int ingenic_nand_probe(struct platform_device *pdev) return -ENODEV; } - nfc = devm_kzalloc(dev, struct_size(nfc, cs, num_banks), GFP_KERNEL); + nfc = devm_kzalloc_flex(dev, *nfc, cs, num_banks); if (!nfc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nand/raw/intel-nand-controller.c index 94d2161bf5a1..cfb4b231e067 100644 --- a/drivers/mtd/nand/raw/intel-nand-controller.c +++ b/drivers/mtd/nand/raw/intel-nand-controller.c @@ -587,7 +587,7 @@ static int ebu_nand_probe(struct platform_device *pdev) int ret; u32 cs; - ebu_host = devm_kzalloc(dev, sizeof(*ebu_host), GFP_KERNEL); + ebu_host = devm_kzalloc_obj(dev, *ebu_host); if (!ebu_host) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/loongson-nand-controller.c b/drivers/mtd/nand/raw/loongson-nand-controller.c index 935f66602de9..320d009ebf8c 100644 --- a/drivers/mtd/nand/raw/loongson-nand-controller.c +++ b/drivers/mtd/nand/raw/loongson-nand-controller.c @@ -890,7 +890,7 @@ static int loongson_nand_probe(struct platform_device *pdev) if (!data) return -ENODEV; - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/lpc32xx_mlc.c b/drivers/mtd/nand/raw/lpc32xx_mlc.c index d03486dc4115..a54c14134f75 100644 --- a/drivers/mtd/nand/raw/lpc32xx_mlc.c +++ b/drivers/mtd/nand/raw/lpc32xx_mlc.c @@ -613,7 +613,7 @@ static struct lpc32xx_nand_cfg_mlc *lpc32xx_parse_dt(struct device *dev) struct lpc32xx_nand_cfg_mlc *ncfg; struct device_node *np = dev->of_node; - ncfg = devm_kzalloc(dev, sizeof(*ncfg), GFP_KERNEL); + ncfg = devm_kzalloc_obj(dev, *ncfg); if (!ncfg) return NULL; @@ -685,7 +685,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) int res; /* Allocate memory for the device structure (and zero it) */ - host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(&pdev->dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/lpc32xx_slc.c b/drivers/mtd/nand/raw/lpc32xx_slc.c index 638267d44360..9c5412dd3891 100644 --- a/drivers/mtd/nand/raw/lpc32xx_slc.c +++ b/drivers/mtd/nand/raw/lpc32xx_slc.c @@ -738,7 +738,7 @@ static struct lpc32xx_nand_cfg_slc *lpc32xx_parse_dt(struct device *dev) struct lpc32xx_nand_cfg_slc *ncfg; struct device_node *np = dev->of_node; - ncfg = devm_kzalloc(dev, sizeof(*ncfg), GFP_KERNEL); + ncfg = devm_kzalloc_obj(dev, *ncfg); if (!ncfg) return NULL; @@ -827,7 +827,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) int res; /* Allocate memory for the device structure (and zero it) */ - host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(&pdev->dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c index e5fa5540e80a..32035c8d43b8 100644 --- a/drivers/mtd/nand/raw/marvell_nand.c +++ b/drivers/mtd/nand/raw/marvell_nand.c @@ -2631,9 +2631,7 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc, } /* Alloc the nand chip structure */ - marvell_nand = devm_kzalloc(dev, - struct_size(marvell_nand, sels, nsels), - GFP_KERNEL); + marvell_nand = devm_kzalloc_flex(dev, *marvell_nand, sels, nsels); if (!marvell_nand) { dev_err(dev, "could not allocate chip structure\n"); return -ENOMEM; @@ -2940,8 +2938,7 @@ static int marvell_nfc_probe(struct platform_device *pdev) int ret; int irq; - nfc = devm_kzalloc(&pdev->dev, sizeof(struct marvell_nfc), - GFP_KERNEL); + nfc = devm_kzalloc_obj(&pdev->dev, struct marvell_nfc); if (!nfc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index b8834aa96e81..b2a9d4043019 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -1398,8 +1398,7 @@ meson_nfc_nand_chip_init(struct device *dev, return -EINVAL; } - meson_chip = devm_kzalloc(dev, struct_size(meson_chip, sels, nsels), - GFP_KERNEL); + meson_chip = devm_kzalloc_flex(dev, *meson_chip, sels, nsels); if (!meson_chip) return -ENOMEM; @@ -1550,7 +1549,7 @@ static int meson_nfc_probe(struct platform_device *pdev) struct meson_nfc *nfc; int ret, irq; - nfc = devm_kzalloc(dev, sizeof(*nfc), GFP_KERNEL); + nfc = devm_kzalloc_obj(dev, *nfc); if (!nfc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/mpc5121_nfc.c b/drivers/mtd/nand/raw/mpc5121_nfc.c index e6594548b7e0..75a97f735ee3 100644 --- a/drivers/mtd/nand/raw/mpc5121_nfc.c +++ b/drivers/mtd/nand/raw/mpc5121_nfc.c @@ -644,7 +644,7 @@ static int mpc5121_nfc_probe(struct platform_device *op) if (irq < 0) return irq; - prv = devm_kzalloc(dev, sizeof(*prv), GFP_KERNEL); + prv = devm_kzalloc_obj(dev, *prv); if (!prv) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c index c439b7814ebb..8f943b53b016 100644 --- a/drivers/mtd/nand/raw/mtk_nand.c +++ b/drivers/mtd/nand/raw/mtk_nand.c @@ -1356,8 +1356,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc, return -EINVAL; } - chip = devm_kzalloc(dev, struct_size(chip, sels, nsels), - GFP_KERNEL); + chip = devm_kzalloc_flex(dev, *chip, sels, nsels); if (!chip) return -ENOMEM; @@ -1511,7 +1510,7 @@ static int mtk_nfc_probe(struct platform_device *pdev) struct mtk_nfc *nfc; int ret, irq; - nfc = devm_kzalloc(dev, sizeof(*nfc), GFP_KERNEL); + nfc = devm_kzalloc_obj(dev, *nfc); if (!nfc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c index 4d8b92e7e672..52fe64f4355a 100644 --- a/drivers/mtd/nand/raw/mxc_nand.c +++ b/drivers/mtd/nand/raw/mxc_nand.c @@ -1694,8 +1694,7 @@ static int mxcnd_probe(struct platform_device *pdev) int err = 0; /* Allocate memory for MTD device structure and private data */ - host = devm_kzalloc(&pdev->dev, sizeof(struct mxc_nand_host), - GFP_KERNEL); + host = devm_kzalloc_obj(&pdev->dev, struct mxc_nand_host); if (!host) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/mxic_nand.c b/drivers/mtd/nand/raw/mxic_nand.c index 92de26697359..f07770f9a424 100644 --- a/drivers/mtd/nand/raw/mxic_nand.c +++ b/drivers/mtd/nand/raw/mxic_nand.c @@ -492,8 +492,7 @@ static int mxic_nfc_probe(struct platform_device *pdev) int err; int irq; - nfc = devm_kzalloc(&pdev->dev, sizeof(struct mxic_nand_ctlr), - GFP_KERNEL); + nfc = devm_kzalloc_obj(&pdev->dev, struct mxic_nand_ctlr); if (!nfc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index a225b10f8145..fe8c6dcc9c07 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -5474,7 +5474,7 @@ int rawnand_dt_parse_gpio_cs(struct device *dev, struct gpio_desc ***cs_array, return 0; } - descs = devm_kcalloc(dev, ndescs, sizeof(*descs), GFP_KERNEL); + descs = devm_kzalloc_objs(dev, *descs, ndescs); if (!descs) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c b/drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c index f659d3a6b9ef..1a36b227ddeb 100644 --- a/drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c +++ b/drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c @@ -866,8 +866,7 @@ static int ma35_nand_chip_init(struct device *dev, struct ma35_nand_info *nand, return -EINVAL; } - nvtnand = devm_kzalloc(dev, struct_size(nvtnand, sels, nsels), - GFP_KERNEL); + nvtnand = devm_kzalloc_flex(dev, *nvtnand, sels, nsels); if (!nvtnand) return -ENOMEM; @@ -953,7 +952,7 @@ static int ma35_nand_probe(struct platform_device *pdev) struct ma35_nand_info *nand; int ret = 0; - nand = devm_kzalloc(&pdev->dev, sizeof(*nand), GFP_KERNEL); + nand = devm_kzalloc_obj(&pdev->dev, *nand); if (!nand) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/omap2.c b/drivers/mtd/nand/raw/omap2.c index 4fa89aee934e..cf98185f9fe1 100644 --- a/drivers/mtd/nand/raw/omap2.c +++ b/drivers/mtd/nand/raw/omap2.c @@ -2218,8 +2218,7 @@ static int omap_nand_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; void __iomem *vaddr; - info = devm_kzalloc(&pdev->dev, sizeof(struct omap_nand_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct omap_nand_info); if (!info) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/omap_elm.c b/drivers/mtd/nand/raw/omap_elm.c index c1d19b8e6715..6736dac26b2d 100644 --- a/drivers/mtd/nand/raw/omap_elm.c +++ b/drivers/mtd/nand/raw/omap_elm.c @@ -385,7 +385,7 @@ static int elm_probe(struct platform_device *pdev) struct elm_info *info; int irq; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/orion_nand.c b/drivers/mtd/nand/raw/orion_nand.c index 47e80d5e58c5..dfa49ad1f55e 100644 --- a/drivers/mtd/nand/raw/orion_nand.c +++ b/drivers/mtd/nand/raw/orion_nand.c @@ -106,9 +106,7 @@ static int __init orion_nand_probe(struct platform_device *pdev) int ret = 0; u32 val = 0; - info = devm_kzalloc(&pdev->dev, - sizeof(struct orion_nand_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct orion_nand_info); if (!info) return -ENOMEM; nc = &info->chip; @@ -124,8 +122,7 @@ static int __init orion_nand_probe(struct platform_device *pdev) return PTR_ERR(io_base); if (pdev->dev.of_node) { - board = devm_kzalloc(&pdev->dev, sizeof(struct orion_nand_data), - GFP_KERNEL); + board = devm_kzalloc_obj(&pdev->dev, struct orion_nand_data); if (!board) return -ENOMEM; if (!of_property_read_u32(pdev->dev.of_node, "cle", &val)) diff --git a/drivers/mtd/nand/raw/pl35x-nand-controller.c b/drivers/mtd/nand/raw/pl35x-nand-controller.c index 26b61d856143..cb7eb29a182a 100644 --- a/drivers/mtd/nand/raw/pl35x-nand-controller.c +++ b/drivers/mtd/nand/raw/pl35x-nand-controller.c @@ -1057,7 +1057,7 @@ static int pl35x_nand_chip_init(struct pl35x_nandc *nfc, struct mtd_info *mtd; int cs, ret; - plnand = devm_kzalloc(nfc->dev, sizeof(*plnand), GFP_KERNEL); + plnand = devm_kzalloc_obj(nfc->dev, *plnand); if (!plnand) return -ENOMEM; @@ -1153,7 +1153,7 @@ static int pl35x_nand_probe(struct platform_device *pdev) struct pl35x_nandc *nfc; int ret; - nfc = devm_kzalloc(&pdev->dev, sizeof(*nfc), GFP_KERNEL); + nfc = devm_kzalloc_obj(&pdev->dev, *nfc); if (!nfc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/plat_nand.c b/drivers/mtd/nand/raw/plat_nand.c index fe31551bcf5f..915ea5361592 100644 --- a/drivers/mtd/nand/raw/plat_nand.c +++ b/drivers/mtd/nand/raw/plat_nand.c @@ -65,8 +65,7 @@ static int plat_nand_probe(struct platform_device *pdev) } /* Allocate memory for the device structure (and zero it) */ - data = devm_kzalloc(&pdev->dev, sizeof(struct plat_nand_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct plat_nand_data); if (!data) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c index 2d98f79b492d..abca02f54d74 100644 --- a/drivers/mtd/nand/raw/qcom_nandc.c +++ b/drivers/mtd/nand/raw/qcom_nandc.c @@ -1959,8 +1959,8 @@ static int qcom_nand_host_parse_boot_partitions(struct qcom_nand_controller *nan } host->nr_boot_partitions = partitions_count / 2; - host->boot_partitions = devm_kcalloc(dev, host->nr_boot_partitions, - sizeof(*host->boot_partitions), GFP_KERNEL); + host->boot_partitions = devm_kzalloc_objs(dev, *host->boot_partitions, + host->nr_boot_partitions); if (!host->boot_partitions) { host->nr_boot_partitions = 0; return -ENOMEM; @@ -2077,7 +2077,7 @@ static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc) int ret = -ENODEV; for_each_available_child_of_node_scoped(dn, child) { - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) return -ENOMEM; @@ -2127,7 +2127,7 @@ static int qcom_nandc_probe(struct platform_device *pdev) struct resource *res; int ret; - nandc = devm_kzalloc(&pdev->dev, sizeof(*nandc), GFP_KERNEL); + nandc = devm_kzalloc_obj(&pdev->dev, *nandc); if (!nandc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/renesas-nand-controller.c b/drivers/mtd/nand/raw/renesas-nand-controller.c index 201dd62b9990..ea7e74b1c0eb 100644 --- a/drivers/mtd/nand/raw/renesas-nand-controller.c +++ b/drivers/mtd/nand/raw/renesas-nand-controller.c @@ -1217,8 +1217,7 @@ static int rnandc_chip_init(struct rnandc *rnandc, struct device_node *np) } /* Alloc the driver's NAND chip structure */ - rnand = devm_kzalloc(rnandc->dev, struct_size(rnand, sels, nsels), - GFP_KERNEL); + rnand = devm_kzalloc_flex(rnandc->dev, *rnand, sels, nsels); if (!rnand) return -ENOMEM; @@ -1322,7 +1321,7 @@ static int rnandc_probe(struct platform_device *pdev) struct clk *eclk; int irq, ret; - rnandc = devm_kzalloc(&pdev->dev, sizeof(*rnandc), GFP_KERNEL); + rnandc = devm_kzalloc_obj(&pdev->dev, *rnandc); if (!rnandc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/rockchip-nand-controller.c b/drivers/mtd/nand/raw/rockchip-nand-controller.c index 9444ba02696d..dbc195db9ef0 100644 --- a/drivers/mtd/nand/raw/rockchip-nand-controller.c +++ b/drivers/mtd/nand/raw/rockchip-nand-controller.c @@ -1134,8 +1134,7 @@ static int rk_nfc_nand_chip_init(struct device *dev, struct rk_nfc *nfc, return -EINVAL; } - rknand = devm_kzalloc(dev, struct_size(rknand, sels, nsels), - GFP_KERNEL); + rknand = devm_kzalloc_flex(dev, *rknand, sels, nsels); if (!rknand) return -ENOMEM; @@ -1381,7 +1380,7 @@ static int rk_nfc_probe(struct platform_device *pdev) struct rk_nfc *nfc; int ret, irq; - nfc = devm_kzalloc(dev, sizeof(*nfc), GFP_KERNEL); + nfc = devm_kzalloc_obj(dev, *nfc); if (!nfc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/sh_flctl.c b/drivers/mtd/nand/raw/sh_flctl.c index 0497801d7059..7d7bbf764555 100644 --- a/drivers/mtd/nand/raw/sh_flctl.c +++ b/drivers/mtd/nand/raw/sh_flctl.c @@ -1098,8 +1098,7 @@ static struct sh_flctl_platform_data *flctl_parse_dt(struct device *dev) return NULL; } - pdata = devm_kzalloc(dev, sizeof(struct sh_flctl_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, struct sh_flctl_platform_data); if (!pdata) return NULL; @@ -1121,7 +1120,7 @@ static int flctl_probe(struct platform_device *pdev) int ret; int irq; - flctl = devm_kzalloc(&pdev->dev, sizeof(struct sh_flctl), GFP_KERNEL); + flctl = devm_kzalloc_obj(&pdev->dev, struct sh_flctl); if (!flctl) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/socrates_nand.c b/drivers/mtd/nand/raw/socrates_nand.c index 668584683ce5..a5125e0c8cdb 100644 --- a/drivers/mtd/nand/raw/socrates_nand.c +++ b/drivers/mtd/nand/raw/socrates_nand.c @@ -142,7 +142,7 @@ static int socrates_nand_probe(struct platform_device *ofdev) int res; /* Allocate memory for the device structure (and zero it) */ - host = devm_kzalloc(&ofdev->dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(&ofdev->dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c index 9f42f8ab3212..56c34328ce24 100644 --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c @@ -1915,7 +1915,7 @@ static int stm32_fmc2_nfc_probe(struct platform_device *pdev) int chip_cs, mem_region, ret, irq; int start_region = 0; - nfc = devm_kzalloc(dev, sizeof(*nfc), GFP_KERNEL); + nfc = devm_kzalloc_obj(dev, *nfc); if (!nfc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c index f41feebe4257..38e67d350300 100644 --- a/drivers/mtd/nand/raw/sunxi_nand.c +++ b/drivers/mtd/nand/raw/sunxi_nand.c @@ -2465,8 +2465,7 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc, return -EINVAL; } - sunxi_nand = devm_kzalloc(dev, struct_size(sunxi_nand, sels, nsels), - GFP_KERNEL); + sunxi_nand = devm_kzalloc_flex(dev, *sunxi_nand, sels, nsels); if (!sunxi_nand) return -ENOMEM; @@ -2610,7 +2609,7 @@ static int sunxi_nfc_probe(struct platform_device *pdev) int irq; int ret; - nfc = devm_kzalloc(dev, sizeof(*nfc), GFP_KERNEL); + nfc = devm_kzalloc_obj(dev, *nfc); if (!nfc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/technologic-nand-controller.c b/drivers/mtd/nand/raw/technologic-nand-controller.c index a3294aaf43bd..56d257fc2c2a 100644 --- a/drivers/mtd/nand/raw/technologic-nand-controller.c +++ b/drivers/mtd/nand/raw/technologic-nand-controller.c @@ -139,7 +139,7 @@ static int ts72xx_nand_probe(struct platform_device *pdev) struct mtd_info *mtd; int err; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/tegra_nand.c b/drivers/mtd/nand/raw/tegra_nand.c index 7f9eb5f042a7..199b3a8e552a 100644 --- a/drivers/mtd/nand/raw/tegra_nand.c +++ b/drivers/mtd/nand/raw/tegra_nand.c @@ -1096,7 +1096,7 @@ static int tegra_nand_chips_init(struct device *dev, return ret; } - nand = devm_kzalloc(dev, sizeof(*nand), GFP_KERNEL); + nand = devm_kzalloc_obj(dev, *nand); if (!nand) return -ENOMEM; @@ -1149,7 +1149,7 @@ static int tegra_nand_probe(struct platform_device *pdev) struct tegra_nand_controller *ctrl; int err = 0; - ctrl = devm_kzalloc(&pdev->dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(&pdev->dev, *ctrl); if (!ctrl) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/txx9ndfmc.c b/drivers/mtd/nand/raw/txx9ndfmc.c index 4cc6e91dbc23..87e61daf1436 100644 --- a/drivers/mtd/nand/raw/txx9ndfmc.c +++ b/drivers/mtd/nand/raw/txx9ndfmc.c @@ -284,7 +284,7 @@ static int txx9ndfmc_probe(struct platform_device *dev) struct txx9ndfmc_drvdata *drvdata; unsigned long gbusclk = plat->gbus_clock; - drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&dev->dev, *drvdata); if (!drvdata) return -ENOMEM; drvdata->base = devm_platform_ioremap_resource(dev, 0); diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c index 1b9b370adfab..6ab3c440eac7 100644 --- a/drivers/mtd/nand/raw/vf610_nfc.c +++ b/drivers/mtd/nand/raw/vf610_nfc.c @@ -868,7 +868,7 @@ static int vf610_nfc_probe(struct platform_device *pdev) int err; int irq; - nfc = devm_kzalloc(&pdev->dev, sizeof(*nfc), GFP_KERNEL); + nfc = devm_kzalloc_obj(&pdev->dev, *nfc); if (!nfc) return -ENOMEM; diff --git a/drivers/mtd/nand/raw/xway_nand.c b/drivers/mtd/nand/raw/xway_nand.c index af84395dc66e..a946d4d2cff4 100644 --- a/drivers/mtd/nand/raw/xway_nand.c +++ b/drivers/mtd/nand/raw/xway_nand.c @@ -171,8 +171,7 @@ static int xway_nand_probe(struct platform_device *pdev) u32 cs_flag = 0; /* Allocate memory for the device structure (and zero it) */ - data = devm_kzalloc(&pdev->dev, sizeof(struct xway_nand_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct xway_nand_data); if (!data) return -ENOMEM; diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 133776ba53da..22756832eacf 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -2057,8 +2057,7 @@ static int spinand_probe(struct spi_mem *mem) struct mtd_info *mtd; int ret; - spinand = devm_kzalloc(&mem->spi->dev, sizeof(*spinand), - GFP_KERNEL); + spinand = devm_kzalloc_obj(&mem->spi->dev, *spinand); if (!spinand) return -ENOMEM; diff --git a/drivers/mtd/spi-nor/controllers/hisi-sfc.c b/drivers/mtd/spi-nor/controllers/hisi-sfc.c index 6897ced2d57b..4f6631950a5b 100644 --- a/drivers/mtd/spi-nor/controllers/hisi-sfc.c +++ b/drivers/mtd/spi-nor/controllers/hisi-sfc.c @@ -339,14 +339,14 @@ static int hisi_spi_nor_register(struct device_node *np, struct mtd_info *mtd; int ret; - nor = devm_kzalloc(dev, sizeof(*nor), GFP_KERNEL); + nor = devm_kzalloc_obj(dev, *nor); if (!nor) return -ENOMEM; nor->dev = dev; spi_nor_set_flash_node(nor, np); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -420,7 +420,7 @@ static int hisi_spi_nor_probe(struct platform_device *pdev) struct hifmc_host *host; int ret; - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/mtd/spi-nor/controllers/nxp-spifi.c b/drivers/mtd/spi-nor/controllers/nxp-spifi.c index 1a92d71755db..30fe2d414f07 100644 --- a/drivers/mtd/spi-nor/controllers/nxp-spifi.c +++ b/drivers/mtd/spi-nor/controllers/nxp-spifi.c @@ -382,7 +382,7 @@ static int nxp_spifi_probe(struct platform_device *pdev) struct nxp_spifi *spifi; int ret; - spifi = devm_kzalloc(&pdev->dev, sizeof(*spifi), GFP_KERNEL); + spifi = devm_kzalloc_obj(&pdev->dev, *spifi); if (!spifi) return -ENOMEM; diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 90524c58602e..a04d22d2e2e1 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2965,7 +2965,7 @@ static int spi_nor_init_params(struct spi_nor *nor) { int ret; - nor->params = devm_kzalloc(nor->dev, sizeof(*nor->params), GFP_KERNEL); + nor->params = devm_kzalloc_obj(nor->dev, *nor->params); if (!nor->params) return -ENOMEM; @@ -3327,8 +3327,7 @@ static int spi_nor_set_mtd_eraseregions(struct spi_nor *nor) struct mtd_info *mtd = &nor->mtd; u32 erasesize, i; - mtd_region = devm_kcalloc(nor->dev, map->n_regions, sizeof(*mtd_region), - GFP_KERNEL); + mtd_region = devm_kzalloc_objs(nor->dev, *mtd_region, map->n_regions); if (!mtd_region) return -ENOMEM; @@ -3567,7 +3566,7 @@ static int spi_nor_probe(struct spi_mem *spimem) if (ret) return ret; - nor = devm_kzalloc(dev, sizeof(*nor), GFP_KERNEL); + nor = devm_kzalloc_obj(dev, *nor); if (!nor) return -ENOMEM; diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c index 4a3f82e97cef..4d77354ee1b2 100644 --- a/drivers/mtd/spi-nor/sfdp.c +++ b/drivers/mtd/spi-nor/sfdp.c @@ -951,8 +951,7 @@ static int spi_nor_init_non_uniform_erase_map(struct spi_nor *nor, * The regions will be freed when the driver detaches from the * device. */ - region = devm_kcalloc(nor->dev, region_count, sizeof(*region), - GFP_KERNEL); + region = devm_kzalloc_objs(nor->dev, *region, region_count); if (!region) return -ENOMEM; map->regions = region; @@ -1386,8 +1385,7 @@ static int spi_nor_parse_sccr(struct spi_nor *nor, /* Address offset for volatile registers (die 0) */ if (!params->vreg_offset) { - params->vreg_offset = devm_kmalloc(nor->dev, sizeof(*dwords), - GFP_KERNEL); + params->vreg_offset = devm_kmalloc_obj(nor->dev, *dwords); if (!params->vreg_offset) { ret = -ENOMEM; goto out; @@ -1628,7 +1626,7 @@ int spi_nor_parse_sfdp(struct spi_nor *nor) sfdp_size = SFDP_MAX_SIZE; } - sfdp = devm_kzalloc(dev, sizeof(*sfdp), GFP_KERNEL); + sfdp = devm_kzalloc_obj(dev, *sfdp); if (!sfdp) { err = -ENOMEM; goto free_param_headers; @@ -1641,8 +1639,7 @@ int spi_nor_parse_sfdp(struct spi_nor *nor) * the complete SFDP data. */ sfdp->num_dwords = DIV_ROUND_UP(sfdp_size, sizeof(*sfdp->dwords)); - sfdp->dwords = devm_kcalloc(dev, sfdp->num_dwords, - sizeof(*sfdp->dwords), GFP_KERNEL); + sfdp->dwords = devm_kzalloc_objs(dev, *sfdp->dwords, sfdp->num_dwords); if (!sfdp->dwords) { err = -ENOMEM; goto free_sfdp; diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c index bc50881d5648..b1b14ed0fd46 100644 --- a/drivers/mtd/spi-nor/spansion.c +++ b/drivers/mtd/spi-nor/spansion.c @@ -567,7 +567,7 @@ static int s25fs256t_post_sfdp_fixup(struct spi_nor *nor) * same code base for both single and multi chip package devices, thus * set the vreg_offset and n_dice to be able to do so. */ - params->vreg_offset = devm_kmalloc(nor->dev, sizeof(u32), GFP_KERNEL); + params->vreg_offset = devm_kmalloc_obj(nor->dev, u32); if (!params->vreg_offset) return -ENOMEM; @@ -1124,8 +1124,7 @@ static int spansion_nor_late_init(struct spi_nor *nor) } if (mfr_flags & (USE_CLSR | USE_CLPEF)) { - priv_params = devm_kmalloc(nor->dev, sizeof(*priv_params), - GFP_KERNEL); + priv_params = devm_kmalloc_obj(nor->dev, *priv_params); if (!priv_params) return -ENOMEM; diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c index b61e590f2ac9..7033402986a8 100644 --- a/drivers/mux/mmio.c +++ b/drivers/mux/mmio.c @@ -100,14 +100,13 @@ static int mux_mmio_probe(struct platform_device *pdev) mux_mmio = mux_chip_priv(mux_chip); - mux_mmio->fields = devm_kcalloc(dev, num_fields, sizeof(*mux_mmio->fields), - GFP_KERNEL); + mux_mmio->fields = devm_kzalloc_objs(dev, *mux_mmio->fields, num_fields); if (!mux_mmio->fields) return -ENOMEM; - mux_mmio->hardware_states = devm_kcalloc(dev, num_fields, - sizeof(*mux_mmio->hardware_states), - GFP_KERNEL); + mux_mmio->hardware_states = devm_kzalloc_objs(dev, + *mux_mmio->hardware_states, + num_fields); if (!mux_mmio->hardware_states) return -ENOMEM; diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index 19cd36cba64d..3bdb20ffba14 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -136,8 +136,7 @@ static int com20020pci_probe(struct pci_dev *pdev, if (pci_enable_device(pdev)) return -EIO; - priv = devm_kzalloc(&pdev->dev, sizeof(struct com20020_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct com20020_priv); if (!priv) return -ENOMEM; @@ -239,8 +238,7 @@ static int com20020pci_probe(struct pci_dev *pdev, if (ret) goto err_free_arcdev; - card = devm_kzalloc(&pdev->dev, sizeof(struct com20020_dev), - GFP_KERNEL); + card = devm_kzalloc_obj(&pdev->dev, struct com20020_dev); if (!card) { ret = -ENOMEM; goto err_free_arcdev; diff --git a/drivers/net/can/esd/esd_402_pci-core.c b/drivers/net/can/esd/esd_402_pci-core.c index c826f00c551b..1fb3a503b160 100644 --- a/drivers/net/can/esd/esd_402_pci-core.c +++ b/drivers/net/can/esd/esd_402_pci-core.c @@ -192,8 +192,8 @@ static int pci402_init_card(struct pci_dev *pdev) card->ov.active_cores); return -EINVAL; } - card->cores = devm_kcalloc(&pdev->dev, card->ov.active_cores, - sizeof(struct acc_core), GFP_KERNEL); + card->cores = devm_kzalloc_objs(&pdev->dev, struct acc_core, + card->ov.active_cores); if (!card->cores) return -ENOMEM; @@ -424,7 +424,7 @@ static int pci402_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) return err; - card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(&pdev->dev, *card); if (!card) { err = -ENOMEM; goto failure_disable_pci; diff --git a/drivers/net/can/peak_canfd/peak_pciefd_main.c b/drivers/net/can/peak_canfd/peak_pciefd_main.c index 7c749301ea84..4eb51b6a701f 100644 --- a/drivers/net/can/peak_canfd/peak_pciefd_main.c +++ b/drivers/net/can/peak_canfd/peak_pciefd_main.c @@ -744,8 +744,7 @@ static int peak_pciefd_probe(struct pci_dev *pdev, can_count = 1; /* allocate board structure object */ - pciefd = devm_kzalloc(&pdev->dev, struct_size(pciefd, can, can_count), - GFP_KERNEL); + pciefd = devm_kzalloc_flex(&pdev->dev, *pciefd, can, can_count); if (!pciefd) { err = -ENOMEM; goto err_release_regions; diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c index fcc37b73ed43..000a6433f46d 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -2157,7 +2157,7 @@ static int rcar_canfd_probe(struct platform_device *pdev) } /* Global controller context */ - gpriv = devm_kzalloc(dev, sizeof(*gpriv), GFP_KERNEL); + gpriv = devm_kzalloc_obj(dev, *gpriv); if (!gpriv) return -ENOMEM; diff --git a/drivers/net/can/sja1000/f81601.c b/drivers/net/can/sja1000/f81601.c index 18cf170db457..6fa0cb9b06ce 100644 --- a/drivers/net/can/sja1000/f81601.c +++ b/drivers/net/can/sja1000/f81601.c @@ -108,7 +108,7 @@ static int f81601_pci_probe(struct pci_dev *pdev, dev_info(&pdev->dev, "Detected card at slot #%i\n", PCI_SLOT(pdev->devfn)); - card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(&pdev->dev, *card); if (!card) return -ENOMEM; diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c index 70d5ff0ae7ac..bb071b40d61d 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c @@ -570,19 +570,15 @@ mcp251xfd_regmap_init_nocrc(struct mcp251xfd_priv *priv) } if (!priv->map_buf_nocrc_rx) { - priv->map_buf_nocrc_rx = - devm_kzalloc(&priv->spi->dev, - sizeof(*priv->map_buf_nocrc_rx), - GFP_KERNEL); + priv->map_buf_nocrc_rx = devm_kzalloc_obj(&priv->spi->dev, + *priv->map_buf_nocrc_rx); if (!priv->map_buf_nocrc_rx) return -ENOMEM; } if (!priv->map_buf_nocrc_tx) { - priv->map_buf_nocrc_tx = - devm_kzalloc(&priv->spi->dev, - sizeof(*priv->map_buf_nocrc_tx), - GFP_KERNEL); + priv->map_buf_nocrc_tx = devm_kzalloc_obj(&priv->spi->dev, + *priv->map_buf_nocrc_tx); if (!priv->map_buf_nocrc_tx) return -ENOMEM; } @@ -623,19 +619,15 @@ mcp251xfd_regmap_init_crc(struct mcp251xfd_priv *priv) } if (!priv->map_buf_crc_rx) { - priv->map_buf_crc_rx = - devm_kzalloc(&priv->spi->dev, - sizeof(*priv->map_buf_crc_rx), - GFP_KERNEL); + priv->map_buf_crc_rx = devm_kzalloc_obj(&priv->spi->dev, + *priv->map_buf_crc_rx); if (!priv->map_buf_crc_rx) return -ENOMEM; } if (!priv->map_buf_crc_tx) { - priv->map_buf_crc_tx = - devm_kzalloc(&priv->spi->dev, - sizeof(*priv->map_buf_crc_tx), - GFP_KERNEL); + priv->map_buf_crc_tx = devm_kzalloc_obj(&priv->spi->dev, + *priv->map_buf_crc_tx); if (!priv->map_buf_crc_tx) return -ENOMEM; } diff --git a/drivers/net/can/usb/f81604.c b/drivers/net/can/usb/f81604.c index 4c147b9d6d69..22a6cfa5de9a 100644 --- a/drivers/net/can/usb/f81604.c +++ b/drivers/net/can/usb/f81604.c @@ -1149,7 +1149,7 @@ static int f81604_probe(struct usb_interface *intf, struct f81604_priv *priv; int i, ret; - priv = devm_kzalloc(&intf->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&intf->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c index efbb7bed34c9..687911d764de 100644 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c @@ -1804,7 +1804,7 @@ static int kvaser_usb_hydra_init_channel(struct kvaser_usb_net_priv *priv) { struct kvaser_usb_net_hydra_priv *hydra; - hydra = devm_kzalloc(&priv->dev->intf->dev, sizeof(*hydra), GFP_KERNEL); + hydra = devm_kzalloc_obj(&priv->dev->intf->dev, *hydra); if (!hydra) return -ENOMEM; diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c index a876c7819b81..909d0e919653 100644 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -1861,7 +1861,7 @@ static int kvaser_usb_leaf_init_channel(struct kvaser_usb_net_priv *priv) { struct kvaser_usb_net_leaf_priv *leaf; - leaf = devm_kzalloc(&priv->dev->intf->dev, sizeof(*leaf), GFP_KERNEL); + leaf = devm_kzalloc_obj(&priv->dev->intf->dev, *leaf); if (!leaf) return -ENOMEM; diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c index f72e0644c5fd..a50e2e7e48a9 100644 --- a/drivers/net/can/usb/ucan.c +++ b/drivers/net/can/usb/ucan.c @@ -1379,9 +1379,7 @@ static int ucan_probe(struct usb_interface *intf, */ /* Prepare Memory for control transfers */ - ctl_msg_buffer = devm_kzalloc(&intf->dev, - sizeof(union ucan_ctl_payload), - GFP_KERNEL); + ctl_msg_buffer = devm_kzalloc_obj(&intf->dev, union ucan_ctl_payload); if (!ctl_msg_buffer) { dev_err(&udev->dev, "%s: failed to allocate control pipe memory\n", diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index 0880310c9ce3..cb00655b14f5 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -3160,15 +3160,13 @@ static int b53_switch_init(struct b53_device *dev) } } - dev->ports = devm_kcalloc(dev->dev, - dev->num_ports, sizeof(struct b53_port), - GFP_KERNEL); + dev->ports = devm_kzalloc_objs(dev->dev, struct b53_port, + dev->num_ports); if (!dev->ports) return -ENOMEM; - dev->vlans = devm_kcalloc(dev->dev, - dev->num_vlans, sizeof(struct b53_vlan), - GFP_KERNEL); + dev->vlans = devm_kzalloc_objs(dev->dev, struct b53_vlan, + dev->num_vlans); if (!dev->vlans) return -ENOMEM; @@ -3187,13 +3185,13 @@ struct b53_device *b53_switch_alloc(struct device *base, struct dsa_switch *ds; struct b53_device *dev; - ds = devm_kzalloc(base, sizeof(*ds), GFP_KERNEL); + ds = devm_kzalloc_obj(base, *ds); if (!ds) return NULL; ds->dev = base; - dev = devm_kzalloc(base, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(base, *dev); if (!dev) return NULL; diff --git a/drivers/net/dsa/b53/b53_mmap.c b/drivers/net/dsa/b53/b53_mmap.c index f4a59d8fbdd6..0f6402286333 100644 --- a/drivers/net/dsa/b53/b53_mmap.c +++ b/drivers/net/dsa/b53/b53_mmap.c @@ -371,8 +371,7 @@ static int b53_mmap_probe_of(struct platform_device *pdev, if (IS_ERR(mem)) return PTR_ERR(mem); - pdata = devm_kzalloc(dev, sizeof(struct b53_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, struct b53_platform_data); if (!pdata) return -ENOMEM; @@ -421,7 +420,7 @@ static int b53_mmap_probe(struct platform_device *pdev) if (!pdata) return -EINVAL; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/dsa/b53/b53_srab.c b/drivers/net/dsa/b53/b53_srab.c index 83a03fca142a..e6d14fdc56fd 100644 --- a/drivers/net/dsa/b53/b53_srab.c +++ b/drivers/net/dsa/b53/b53_srab.c @@ -627,14 +627,14 @@ static int b53_srab_probe(struct platform_device *pdev) of_id = of_match_node(b53_srab_of_match, dn); if (of_id) { - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; pdata->chip_id = (u32)(unsigned long)of_id->data; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 9e5713015187..42db2061b254 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -1379,11 +1379,11 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev) u32 reg, rev; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; - ops = devm_kzalloc(&pdev->dev, sizeof(*ops), GFP_KERNEL); + ops = devm_kzalloc_obj(&pdev->dev, *ops); if (!ops) return -ENOMEM; @@ -1391,7 +1391,7 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev) if (!dev) return -ENOMEM; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c index 0e35e9841b9b..f10a4951ea8e 100644 --- a/drivers/net/dsa/dsa_loop.c +++ b/drivers/net/dsa/dsa_loop.c @@ -362,14 +362,14 @@ static int dsa_loop_drv_probe(struct mdio_device *mdiodev) if (!pdata) return -ENODEV; - ds = devm_kzalloc(&mdiodev->dev, sizeof(*ds), GFP_KERNEL); + ds = devm_kzalloc_obj(&mdiodev->dev, *ds); if (!ds) return -ENOMEM; ds->dev = &mdiodev->dev; ds->num_ports = DSA_LOOP_NUM_PORTS; - ps = devm_kzalloc(&mdiodev->dev, sizeof(*ps), GFP_KERNEL); + ps = devm_kzalloc_obj(&mdiodev->dev, *ps); if (!ps) return -ENOMEM; diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c index aec50414986e..3d4bd075eb98 100644 --- a/drivers/net/dsa/hirschmann/hellcreek.c +++ b/drivers/net/dsa/hirschmann/hellcreek.c @@ -1939,7 +1939,7 @@ static int hellcreek_probe(struct platform_device *pdev) int ret, i; data = of_device_get_match_data(dev); - hellcreek = devm_kzalloc(dev, struct_size(hellcreek, ports, data->num_ports), GFP_KERNEL); + hellcreek = devm_kzalloc_flex(dev, *hellcreek, ports, data->num_ports); if (!hellcreek) return -ENOMEM; @@ -1955,10 +1955,8 @@ static int hellcreek_probe(struct platform_device *pdev) struct hellcreek_port *port = &hellcreek->ports[i]; port->counter_values = - devm_kcalloc(dev, - ARRAY_SIZE(hellcreek_counter), - sizeof(*port->counter_values), - GFP_KERNEL); + devm_kzalloc_objs(dev, *port->counter_values, + ARRAY_SIZE(hellcreek_counter)); if (!port->counter_values) return -ENOMEM; @@ -2014,7 +2012,7 @@ static int hellcreek_probe(struct platform_device *pdev) hellcreek_feature_detect(hellcreek); - hellcreek->ds = devm_kzalloc(dev, sizeof(*hellcreek->ds), GFP_KERNEL); + hellcreek->ds = devm_kzalloc_obj(dev, *hellcreek->ds); if (!hellcreek->ds) return -ENOMEM; diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index d246f95d57ec..8eeb8953ff24 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -1403,7 +1403,7 @@ static const struct dsa_switch_ops lan9303_switch_ops = { static int lan9303_register_switch(struct lan9303 *chip) { - chip->ds = devm_kzalloc(chip->dev, sizeof(*chip->ds), GFP_KERNEL); + chip->ds = devm_kzalloc_obj(chip->dev, *chip->ds); if (!chip->ds) return -ENOMEM; diff --git a/drivers/net/dsa/lan9303_i2c.c b/drivers/net/dsa/lan9303_i2c.c index 7b70e22371fc..ba789a044c52 100644 --- a/drivers/net/dsa/lan9303_i2c.c +++ b/drivers/net/dsa/lan9303_i2c.c @@ -34,8 +34,7 @@ static int lan9303_i2c_probe(struct i2c_client *client) struct lan9303_i2c *sw_dev; int ret; - sw_dev = devm_kzalloc(&client->dev, sizeof(struct lan9303_i2c), - GFP_KERNEL); + sw_dev = devm_kzalloc_obj(&client->dev, struct lan9303_i2c); if (!sw_dev) return -ENOMEM; diff --git a/drivers/net/dsa/lan9303_mdio.c b/drivers/net/dsa/lan9303_mdio.c index d3b5062905b1..9f79e6b8f603 100644 --- a/drivers/net/dsa/lan9303_mdio.c +++ b/drivers/net/dsa/lan9303_mdio.c @@ -101,8 +101,7 @@ static int lan9303_mdio_probe(struct mdio_device *mdiodev) struct lan9303_mdio *sw_dev; int ret; - sw_dev = devm_kzalloc(&mdiodev->dev, sizeof(struct lan9303_mdio), - GFP_KERNEL); + sw_dev = devm_kzalloc_obj(&mdiodev->dev, struct lan9303_mdio); if (!sw_dev) return -ENOMEM; diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq/lantiq_gswip.c index 4d699d8c16f9..3d52beae0147 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c @@ -277,9 +277,9 @@ static int gswip_gphy_fw_list(struct gswip_priv *priv, if (IS_ERR(priv->rcu_regmap)) return PTR_ERR(priv->rcu_regmap); - priv->gphy_fw = devm_kmalloc_array(dev, priv->num_gphy_fw, - sizeof(*priv->gphy_fw), - GFP_KERNEL | __GFP_ZERO); + priv->gphy_fw = devm_kmalloc_objs(dev, *priv->gphy_fw, + priv->num_gphy_fw, + GFP_KERNEL | __GFP_ZERO); if (!priv->gphy_fw) return -ENOMEM; @@ -348,7 +348,7 @@ static int gswip_probe(struct platform_device *pdev) int i; u32 version; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -380,7 +380,7 @@ static int gswip_probe(struct platform_device *pdev) if (!priv->hw_info) return -EINVAL; - priv->ds = devm_kzalloc(dev, sizeof(*priv->ds), GFP_KERNEL); + priv->ds = devm_kzalloc_obj(dev, *priv->ds); if (!priv->ds) return -ENOMEM; diff --git a/drivers/net/dsa/lantiq/lantiq_gswip_common.c b/drivers/net/dsa/lantiq/lantiq_gswip_common.c index 5bb5f4ab4cbf..861d9df4ff80 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip_common.c +++ b/drivers/net/dsa/lantiq/lantiq_gswip_common.c @@ -1688,7 +1688,7 @@ int gswip_probe_common(struct gswip_priv *priv, u32 version) mutex_init(&priv->pce_table_lock); - priv->ds = devm_kzalloc(priv->dev, sizeof(*priv->ds), GFP_KERNEL); + priv->ds = devm_kzalloc_obj(priv->dev, *priv->ds); if (!priv->ds) return -ENOMEM; diff --git a/drivers/net/dsa/lantiq/mxl-gsw1xx.c b/drivers/net/dsa/lantiq/mxl-gsw1xx.c index a26f78e1a44c..0c7ea242a62c 100644 --- a/drivers/net/dsa/lantiq/mxl-gsw1xx.c +++ b/drivers/net/dsa/lantiq/mxl-gsw1xx.c @@ -725,7 +725,7 @@ static int gsw1xx_probe(struct mdio_device *mdiodev) u16 pnum; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/dsa/microchip/ksz8.c b/drivers/net/dsa/microchip/ksz8.c index 3c96dd4581cf..3abaafb9a074 100644 --- a/drivers/net/dsa/microchip/ksz8.c +++ b/drivers/net/dsa/microchip/ksz8.c @@ -2503,8 +2503,8 @@ static int ksz8463_setup(struct dsa_switch *ds) regs = dev->info->regs; - dev->vlan_cache = devm_kcalloc(dev->dev, sizeof(struct vlan_table), - dev->info->num_vlans, GFP_KERNEL); + dev->vlan_cache = devm_kzalloc_objs(dev->dev, struct vlan_table, + dev->info->num_vlans); if (!dev->vlan_cache) return -ENOMEM; @@ -2768,8 +2768,8 @@ static int ksz8_setup(struct dsa_switch *ds) /* KSZ8995XA has no SW controlled VLAN handling */ if (!ksz_is_ksz8995xa(dev)) { - dev->vlan_cache = devm_kcalloc(dev->dev, sizeof(struct vlan_table), - dev->info->num_vlans, GFP_KERNEL); + dev->vlan_cache = devm_kzalloc_objs(dev->dev, struct vlan_table, + dev->info->num_vlans); if (!dev->vlan_cache) return -ENOMEM; } diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c index 72528a53b67d..8d4647e23cda 100644 --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -1678,8 +1678,8 @@ static int ksz9477_setup(struct dsa_switch *ds) regs = dev->info->regs; - dev->vlan_cache = devm_kcalloc(dev->dev, sizeof(struct vlan_table), - dev->info->num_vlans, GFP_KERNEL); + dev->vlan_cache = devm_kzalloc_objs(dev->dev, struct vlan_table, + dev->info->num_vlans); if (!dev->vlan_cache) return -ENOMEM; diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 767c8fe8e819..86f1cc30805b 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -3762,7 +3762,7 @@ struct ksz_device *ksz_switch_alloc(struct device *base, struct dsa_switch *ds; struct ksz_device *swdev; - ds = devm_kzalloc(base, sizeof(*ds), GFP_KERNEL); + ds = devm_kzalloc_obj(base, *ds); if (!ds) return NULL; @@ -3770,7 +3770,7 @@ struct ksz_device *ksz_switch_alloc(struct device *base, ds->num_ports = DSA_MAX_PORTS; ds->ops = chip->switch_ops; - swdev = devm_kzalloc(base, sizeof(*swdev), GFP_KERNEL); + swdev = devm_kzalloc_obj(base, *swdev); if (!swdev) return NULL; diff --git a/drivers/net/dsa/microchip/lan937x_main.c b/drivers/net/dsa/microchip/lan937x_main.c index 3a209122fc7d..f0fb94980261 100644 --- a/drivers/net/dsa/microchip/lan937x_main.c +++ b/drivers/net/dsa/microchip/lan937x_main.c @@ -776,8 +776,8 @@ static int lan937x_setup(struct dsa_switch *ds) regs = dev->info->regs; - dev->vlan_cache = devm_kcalloc(dev->dev, sizeof(struct vlan_table), - dev->info->num_vlans, GFP_KERNEL); + dev->vlan_cache = devm_kzalloc_objs(dev->dev, struct vlan_table, + dev->info->num_vlans); if (!dev->vlan_cache) return -ENOMEM; diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c index 33e5fc127244..b9f130ca7481 100644 --- a/drivers/net/dsa/motorcomm/chip.c +++ b/drivers/net/dsa/motorcomm/chip.c @@ -2011,7 +2011,7 @@ static int yt921x_dsa_port_setup(struct dsa_switch *ds, int port) int res; if (!pm && (BIT(port) & yt921x_info_ports_mask(info))) { - pm = devm_kzalloc(dev, sizeof(*pm), GFP_KERNEL); + pm = devm_kzalloc_obj(dev, *pm); if (!pm) return -ENOMEM; pp->mib = pm; @@ -2617,11 +2617,11 @@ static int yt921x_mdio_probe(struct mdio_device *mdiodev) struct yt921x_priv *priv; struct dsa_switch *ds; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; - mdio = devm_kzalloc(dev, sizeof(*mdio), GFP_KERNEL); + mdio = devm_kzalloc_obj(dev, *mdio); if (!mdio) return -ENOMEM; diff --git a/drivers/net/dsa/motorcomm/leds.c b/drivers/net/dsa/motorcomm/leds.c index 08fbe86c3334..aa68a8793aa2 100644 --- a/drivers/net/dsa/motorcomm/leds.c +++ b/drivers/net/dsa/motorcomm/leds.c @@ -455,7 +455,7 @@ yt921x_led_setup(struct yt921x_priv *priv, int port, } polarity = force_high ? 1 : force_low ? -1 : 0; - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) { res = -ENOMEM; goto err; diff --git a/drivers/net/dsa/mt7530-mdio.c b/drivers/net/dsa/mt7530-mdio.c index 0be107dc6759..e85ef2aceee5 100644 --- a/drivers/net/dsa/mt7530-mdio.c +++ b/drivers/net/dsa/mt7530-mdio.c @@ -99,9 +99,8 @@ mt7531_create_sgmii(struct mt7530_priv *priv) int i, ret = 0; for (i = priv->p5_sgmii ? 0 : 1; i < 2; i++) { - mt7531_pcs_config[i] = devm_kzalloc(priv->dev, - sizeof(struct regmap_config), - GFP_KERNEL); + mt7531_pcs_config[i] = devm_kzalloc_obj(priv->dev, + struct regmap_config); if (!mt7531_pcs_config[i]) { ret = -ENOMEM; break; @@ -165,7 +164,7 @@ mt7530_probe(struct mdio_device *mdiodev) dn = mdiodev->dev.of_node; - priv = devm_kzalloc(&mdiodev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&mdiodev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/dsa/mt7530-mmio.c b/drivers/net/dsa/mt7530-mmio.c index cf3bdb23a2d5..5d467be2a32c 100644 --- a/drivers/net/dsa/mt7530-mmio.c +++ b/drivers/net/dsa/mt7530-mmio.c @@ -33,7 +33,7 @@ mt7988_probe(struct platform_device *pdev) void __iomem *base_addr; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index d4714bc102ee..d5a199293f78 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2201,7 +2201,7 @@ mt7530_setup_gpio(struct mt7530_priv *priv) struct device *dev = priv->dev; struct gpio_chip *gc; - gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL); + gc = devm_kzalloc_obj(dev, *gc); if (!gc) return -ENOMEM; @@ -3532,7 +3532,7 @@ mt7530_probe_common(struct mt7530_priv *priv) { struct device *dev = priv->dev; - priv->ds = devm_kzalloc(dev, sizeof(*priv->ds), GFP_KERNEL); + priv->ds = devm_kzalloc_obj(dev, *priv->ds); if (!priv->ds) return -ENOMEM; diff --git a/drivers/net/dsa/mt7628.c b/drivers/net/dsa/mt7628.c index fb63f6f644b9..756658793097 100644 --- a/drivers/net/dsa/mt7628.c +++ b/drivers/net/dsa/mt7628.c @@ -569,11 +569,11 @@ static int mt7628_probe(struct platform_device *pdev) struct dsa_switch *ds; void __iomem *base; - ds = devm_kzalloc(&pdev->dev, sizeof(*ds), GFP_KERNEL); + ds = devm_kzalloc_obj(&pdev->dev, *ds); if (!ds) return -ENOMEM; - esw = devm_kzalloc(&pdev->dev, sizeof(*esw), GFP_KERNEL); + esw = devm_kzalloc_obj(&pdev->dev, *esw); if (!esw) return -ENOMEM; diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c index 3bb485a90429..7939d5291e8b 100644 --- a/drivers/net/dsa/mv88e6060.c +++ b/drivers/net/dsa/mv88e6060.c @@ -308,7 +308,7 @@ static int mv88e6060_probe(struct mdio_device *mdiodev) struct dsa_switch *ds; const char *name; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -321,7 +321,7 @@ static int mv88e6060_probe(struct mdio_device *mdiodev) dev_info(dev, "switch %s detected\n", name); - ds = devm_kzalloc(dev, sizeof(*ds), GFP_KERNEL); + ds = devm_kzalloc_obj(dev, *ds); if (!ds) return -ENOMEM; diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 46aef6dfe77e..425fd2d22c28 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -2403,7 +2403,7 @@ static int mv88e6xxx_policy_insert(struct mv88e6xxx_chip *chip, int port, return -EEXIST; } - policy = devm_kzalloc(chip->dev, sizeof(*policy), GFP_KERNEL); + policy = devm_kzalloc_obj(chip->dev, *policy); if (!policy) return -ENOMEM; @@ -6697,7 +6697,7 @@ static struct mv88e6xxx_chip *mv88e6xxx_alloc_chip(struct device *dev) { struct mv88e6xxx_chip *chip; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return NULL; @@ -7322,7 +7322,7 @@ static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip) struct device *dev = chip->dev; struct dsa_switch *ds; - ds = devm_kzalloc(dev, sizeof(*ds), GFP_KERNEL); + ds = devm_kzalloc_obj(dev, *ds); if (!ds) return -ENOMEM; diff --git a/drivers/net/dsa/mxl862xx/mxl862xx.c b/drivers/net/dsa/mxl862xx/mxl862xx.c index e05ad52cd297..da6185963a0d 100644 --- a/drivers/net/dsa/mxl862xx/mxl862xx.c +++ b/drivers/net/dsa/mxl862xx/mxl862xx.c @@ -2106,13 +2106,13 @@ static int mxl862xx_probe(struct mdio_device *mdiodev) struct dsa_switch *ds; int err, i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; priv->mdiodev = mdiodev; - ds = devm_kzalloc(dev, sizeof(*ds), GFP_KERNEL); + ds = devm_kzalloc_obj(dev, *ds); if (!ds) return -ENOMEM; diff --git a/drivers/net/dsa/netc/netc_main.c b/drivers/net/dsa/netc/netc_main.c index 77077352c1a5..1225ff8153d4 100644 --- a/drivers/net/dsa/netc/netc_main.c +++ b/drivers/net/dsa/netc/netc_main.c @@ -246,9 +246,8 @@ static int netc_init_all_ports(struct netc_switch *priv) int ett_offset = 0; int err; - priv->ports = devm_kcalloc(dev, priv->info->num_ports, - sizeof(struct netc_port *), - GFP_KERNEL); + priv->ports = devm_kzalloc_objs(dev, struct netc_port *, + priv->info->num_ports); if (!priv->ports) return -ENOMEM; @@ -260,7 +259,7 @@ static int netc_init_all_ports(struct netc_switch *priv) * difficult for us to cover. */ for (int i = 0; i < priv->info->num_ports; i++) { - np = devm_kzalloc(dev, sizeof(*np), GFP_KERNEL); + np = devm_kzalloc_obj(dev, *np); if (!np) return -ENOMEM; @@ -308,9 +307,8 @@ static int netc_init_all_cbdrs(struct netc_switch *priv) ntmp->cbdr_num = NETC_CBDR_NUM; ntmp->dev = priv->dev; - ntmp->ring = devm_kcalloc(ntmp->dev, ntmp->cbdr_num, - sizeof(struct netc_cbdr), - GFP_KERNEL); + ntmp->ring = devm_kzalloc_objs(ntmp->dev, struct netc_cbdr, + ntmp->cbdr_num); if (!ntmp->ring) return -ENOMEM; @@ -847,9 +845,8 @@ static int netc_switch_bpt_default_config(struct netc_switch *priv) if (priv->num_bp < priv->info->num_ports) return -EINVAL; - priv->bpt_list = devm_kcalloc(priv->dev, priv->num_bp, - sizeof(struct bpt_cfge_data), - GFP_KERNEL); + priv->bpt_list = devm_kzalloc_objs(priv->dev, struct bpt_cfge_data, + priv->num_bp); if (!priv->bpt_list) return -ENOMEM; @@ -1071,7 +1068,7 @@ static int netc_switch_pci_init(struct pci_dev *pdev) pci_set_master(pdev); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -2460,7 +2457,7 @@ static int netc_switch_probe(struct pci_dev *pdev, if (err) return err; - ds = devm_kzalloc(dev, sizeof(*ds), GFP_KERNEL); + ds = devm_kzalloc_obj(dev, *ds); if (!ds) return -ENOMEM; diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 84a95007825f..c99fd3d23bb3 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1522,8 +1522,8 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) int port, i, err; ocelot->num_phys_ports = num_phys_ports; - ocelot->ports = devm_kcalloc(ocelot->dev, num_phys_ports, - sizeof(struct ocelot_port *), GFP_KERNEL); + ocelot->ports = devm_kzalloc_objs(ocelot->dev, struct ocelot_port *, + num_phys_ports); if (!ocelot->ports) return -ENOMEM; @@ -1572,9 +1572,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) for (port = 0; port < num_phys_ports; port++) { struct ocelot_port *ocelot_port; - ocelot_port = devm_kzalloc(ocelot->dev, - sizeof(struct ocelot_port), - GFP_KERNEL); + ocelot_port = devm_kzalloc_obj(ocelot->dev, struct ocelot_port); if (!ocelot_port) { dev_err(ocelot->dev, "failed to allocate port memory\n"); @@ -2398,11 +2396,11 @@ int felix_register_switch(struct device *dev, resource_size_t switch_base, struct felix *felix; int err; - felix = devm_kzalloc(dev, sizeof(*felix), GFP_KERNEL); + felix = devm_kzalloc_obj(dev, *felix); if (!felix) return -ENOMEM; - ds = devm_kzalloc(dev, sizeof(*ds), GFP_KERNEL); + ds = devm_kzalloc_obj(dev, *ds); if (!ds) return -ENOMEM; diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 8387dd208adb..21f3c75b2e7b 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -968,9 +968,8 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) int port; int rc; - felix->pcs = devm_kcalloc(dev, felix->info->num_ports, - sizeof(struct phylink_pcs *), - GFP_KERNEL); + felix->pcs = devm_kzalloc_objs(dev, struct phylink_pcs *, + felix->info->num_ports); if (!felix->pcs) { dev_err(dev, "failed to allocate array for PCS PHYs\n"); return -ENOMEM; diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index 962cf4653c36..708ddf759f62 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -883,9 +883,8 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot) int port; int rc; - felix->pcs = devm_kcalloc(dev, felix->info->num_ports, - sizeof(struct phylink_pcs *), - GFP_KERNEL); + felix->pcs = devm_kzalloc_objs(dev, struct phylink_pcs *, + felix->info->num_ports); if (!felix->pcs) { dev_err(dev, "failed to allocate array for PCS PHYs\n"); return -ENOMEM; diff --git a/drivers/net/dsa/qca/ar9331.c b/drivers/net/dsa/qca/ar9331.c index 0526aa96146e..0222cba5b367 100644 --- a/drivers/net/dsa/qca/ar9331.c +++ b/drivers/net/dsa/qca/ar9331.c @@ -1034,7 +1034,7 @@ static int ar9331_sw_probe(struct mdio_device *mdiodev) struct dsa_switch *ds; int ret, i; - priv = devm_kzalloc(&mdiodev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&mdiodev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 07227ae8bc04..382753bcc466 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -2076,7 +2076,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev) /* allocate the private data struct so that we can probe the switches * ID register */ - priv = devm_kzalloc(&mdiodev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&mdiodev->dev, *priv); if (!priv) return -ENOMEM; @@ -2112,7 +2112,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev) if (ret) return ret; - priv->ds = devm_kzalloc(&mdiodev->dev, sizeof(*priv->ds), GFP_KERNEL); + priv->ds = devm_kzalloc_obj(&mdiodev->dev, *priv->ds); if (!priv->ds) return -ENOMEM; diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c index 85ff1fd2bbfb..13c46cf2c420 100644 --- a/drivers/net/dsa/rzn1_a5psw.c +++ b/drivers/net/dsa/rzn1_a5psw.c @@ -1212,7 +1212,7 @@ static int a5psw_probe(struct platform_device *pdev) struct a5psw *a5psw; int ret; - a5psw = devm_kzalloc(dev, sizeof(*a5psw), GFP_KERNEL); + a5psw = devm_kzalloc_obj(dev, *a5psw); if (!a5psw) return -ENOMEM; diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index 8984ed55ad59..06be555b0835 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -3251,7 +3251,7 @@ static int sja1105_probe(struct spi_device *spi) if (rc) return rc; - priv = devm_kzalloc(dev, sizeof(struct sja1105_private), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct sja1105_private); if (!priv) return -ENOMEM; @@ -3307,7 +3307,7 @@ static int sja1105_probe(struct spi_device *spi) dev_info(dev, "Probed switch chip: %s\n", priv->info->name); - ds = devm_kzalloc(dev, sizeof(*ds), GFP_KERNEL); + ds = devm_kzalloc_obj(dev, *ds); if (!ds) return -ENOMEM; @@ -3331,9 +3331,8 @@ static int sja1105_probe(struct spi_device *spi) } if (IS_ENABLED(CONFIG_NET_SCH_CBS)) { - priv->cbs = devm_kcalloc(dev, priv->info->num_cbs_shapers, - sizeof(struct sja1105_cbs_entry), - GFP_KERNEL); + priv->cbs = devm_kzalloc_objs(dev, struct sja1105_cbs_entry, + priv->info->num_cbs_shapers); if (!priv->cbs) return -ENOMEM; } diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c index 6f586d3da9d4..35943787f37d 100644 --- a/drivers/net/dsa/vitesse-vsc73xx-core.c +++ b/drivers/net/dsa/vitesse-vsc73xx-core.c @@ -2372,7 +2372,7 @@ int vsc73xx_probe(struct vsc73xx *vsc) vsc->addr[0], vsc->addr[1], vsc->addr[2], vsc->addr[3], vsc->addr[4], vsc->addr[5]); - vsc->ds = devm_kzalloc(dev, sizeof(*vsc->ds), GFP_KERNEL); + vsc->ds = devm_kzalloc_obj(dev, *vsc->ds); if (!vsc->ds) return -ENOMEM; diff --git a/drivers/net/dsa/vitesse-vsc73xx-platform.c b/drivers/net/dsa/vitesse-vsc73xx-platform.c index 7a2e0a619b85..96e00a499248 100644 --- a/drivers/net/dsa/vitesse-vsc73xx-platform.c +++ b/drivers/net/dsa/vitesse-vsc73xx-platform.c @@ -91,7 +91,7 @@ static int vsc73xx_platform_probe(struct platform_device *pdev) struct vsc73xx_platform *vsc_platform; int ret; - vsc_platform = devm_kzalloc(dev, sizeof(*vsc_platform), GFP_KERNEL); + vsc_platform = devm_kzalloc_obj(dev, *vsc_platform); if (!vsc_platform) return -ENOMEM; diff --git a/drivers/net/dsa/vitesse-vsc73xx-spi.c b/drivers/net/dsa/vitesse-vsc73xx-spi.c index 7b784320c41e..534a67fa4e5b 100644 --- a/drivers/net/dsa/vitesse-vsc73xx-spi.c +++ b/drivers/net/dsa/vitesse-vsc73xx-spi.c @@ -137,7 +137,7 @@ static int vsc73xx_spi_probe(struct spi_device *spi) struct vsc73xx_spi *vsc_spi; int ret; - vsc_spi = devm_kzalloc(dev, sizeof(*vsc_spi), GFP_KERNEL); + vsc_spi = devm_kzalloc_obj(dev, *vsc_spi); if (!vsc_spi) return -ENOMEM; diff --git a/drivers/net/dsa/xrs700x/xrs700x.c b/drivers/net/dsa/xrs700x/xrs700x.c index 0a05f4156ef4..90f1cd2b5ab5 100644 --- a/drivers/net/dsa/xrs700x/xrs700x.c +++ b/drivers/net/dsa/xrs700x/xrs700x.c @@ -776,13 +776,13 @@ struct xrs700x *xrs700x_switch_alloc(struct device *base, void *devpriv) struct dsa_switch *ds; struct xrs700x *priv; - ds = devm_kzalloc(base, sizeof(*ds), GFP_KERNEL); + ds = devm_kzalloc_obj(base, *ds); if (!ds) return NULL; ds->dev = base; - priv = devm_kzalloc(base, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(base, *priv); if (!priv) return NULL; @@ -804,8 +804,8 @@ static int xrs700x_alloc_port_mib(struct xrs700x *priv, int port) { struct xrs700x_port *p = &priv->ports[port]; - p->mib_data = devm_kcalloc(priv->dev, ARRAY_SIZE(xrs700x_mibs), - sizeof(*p->mib_data), GFP_KERNEL); + p->mib_data = devm_kzalloc_objs(priv->dev, *p->mib_data, + ARRAY_SIZE(xrs700x_mibs)); if (!p->mib_data) return -ENOMEM; @@ -828,8 +828,8 @@ int xrs700x_switch_register(struct xrs700x *priv) if (ret) return ret; - priv->ports = devm_kcalloc(priv->dev, priv->ds->num_ports, - sizeof(*priv->ports), GFP_KERNEL); + priv->ports = devm_kzalloc_objs(priv->dev, *priv->ports, + priv->ds->num_ports); if (!priv->ports) return -ENOMEM; diff --git a/drivers/net/ethernet/actions/owl-emac.c b/drivers/net/ethernet/actions/owl-emac.c index 2538275a1e57..b8f3040b9b41 100644 --- a/drivers/net/ethernet/actions/owl-emac.c +++ b/drivers/net/ethernet/actions/owl-emac.c @@ -285,13 +285,11 @@ static int owl_emac_ring_alloc(struct device *dev, struct owl_emac_ring *ring, if (!ring->descs) return -ENOMEM; - ring->skbs = devm_kcalloc(dev, size, sizeof(struct sk_buff *), - GFP_KERNEL); + ring->skbs = devm_kzalloc_objs(dev, struct sk_buff *, size); if (!ring->skbs) return -ENOMEM; - ring->skbs_dma = devm_kcalloc(dev, size, sizeof(dma_addr_t), - GFP_KERNEL); + ring->skbs_dma = devm_kzalloc_objs(dev, dma_addr_t, size); if (!ring->skbs_dma) return -ENOMEM; diff --git a/drivers/net/ethernet/adi/adin1110.c b/drivers/net/ethernet/adi/adin1110.c index 53fac3dc8be6..f4540477d527 100644 --- a/drivers/net/ethernet/adi/adin1110.c +++ b/drivers/net/ethernet/adi/adin1110.c @@ -1651,7 +1651,7 @@ static int adin1110_probe(struct spi_device *spi) struct adin1110_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(struct adin1110_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct adin1110_priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c index b164a78ddac9..044ad0302ef3 100644 --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c @@ -3845,7 +3845,7 @@ static int airoha_alloc_gdm_port(struct airoha_eth *eth, return -EINVAL; } - port = devm_kzalloc(eth->dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(eth->dev, *port); if (!port) return -ENOMEM; @@ -3934,7 +3934,7 @@ static int airoha_probe(struct platform_device *pdev) struct airoha_eth *eth; int i, err; - eth = devm_kzalloc(&pdev->dev, sizeof(*eth), GFP_KERNEL); + eth = devm_kzalloc_obj(&pdev->dev, *eth); if (!eth) return -ENOMEM; @@ -3966,9 +3966,8 @@ static int airoha_probe(struct platform_device *pdev) return err; } - xsi_rsts = devm_kcalloc(eth->dev, - eth->soc->num_xsi_rsts, sizeof(*xsi_rsts), - GFP_KERNEL); + xsi_rsts = devm_kzalloc_objs(eth->dev, *xsi_rsts, + eth->soc->num_xsi_rsts); if (!xsi_rsts) return -ENOMEM; diff --git a/drivers/net/ethernet/airoha/airoha_npu.c b/drivers/net/ethernet/airoha/airoha_npu.c index 4d3195eb00f7..edec6b111895 100644 --- a/drivers/net/ethernet/airoha/airoha_npu.c +++ b/drivers/net/ethernet/airoha/airoha_npu.c @@ -706,7 +706,7 @@ static int airoha_npu_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - npu = devm_kzalloc(dev, sizeof(*npu), GFP_KERNEL); + npu = devm_kzalloc_obj(dev, *npu); if (!npu) return -ENOMEM; diff --git a/drivers/net/ethernet/airoha/airoha_ppe.c b/drivers/net/ethernet/airoha/airoha_ppe.c index 92611802801e..f5369c45766d 100644 --- a/drivers/net/ethernet/airoha/airoha_ppe.c +++ b/drivers/net/ethernet/airoha/airoha_ppe.c @@ -1599,7 +1599,7 @@ int airoha_ppe_init(struct airoha_eth *eth) u32 ppe_num_entries; struct airoha_ppe *ppe; - ppe = devm_kzalloc(eth->dev, sizeof(*ppe), GFP_KERNEL); + ppe = devm_kzalloc_obj(eth->dev, *ppe); if (!ppe) return -ENOMEM; diff --git a/drivers/net/ethernet/amd/pds_core/debugfs.c b/drivers/net/ethernet/amd/pds_core/debugfs.c index ef0a1b7d159b..a27c44aa8f2c 100644 --- a/drivers/net/ethernet/amd/pds_core/debugfs.c +++ b/drivers/net/ethernet/amd/pds_core/debugfs.c @@ -159,9 +159,8 @@ void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq) debugfs_create_u32("index", 0400, intr_dentry, &intr->index); debugfs_create_u32("vector", 0400, intr_dentry, &intr->vector); - intr_ctrl_regset = devm_kzalloc(pdsc->dev, - sizeof(*intr_ctrl_regset), - GFP_KERNEL); + intr_ctrl_regset = devm_kzalloc_obj(pdsc->dev, + *intr_ctrl_regset); if (!intr_ctrl_regset) return; intr_ctrl_regset->regs = intr_ctrl_regs; diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dcb.c b/drivers/net/ethernet/amd/xgbe/xgbe-dcb.c index 1474df5544fa..dc2ef2e0ae15 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-dcb.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-dcb.c @@ -84,8 +84,7 @@ static int xgbe_dcb_ieee_setets(struct net_device *netdev, } if (!pdata->ets) { - pdata->ets = devm_kzalloc(pdata->dev, sizeof(*pdata->ets), - GFP_KERNEL); + pdata->ets = devm_kzalloc_obj(pdata->dev, *pdata->ets); if (!pdata->ets) return -ENOMEM; } @@ -132,8 +131,7 @@ static int xgbe_dcb_ieee_setpfc(struct net_device *netdev, } if (!pdata->pfc) { - pdata->pfc = devm_kzalloc(pdata->dev, sizeof(*pdata->pfc), - GFP_KERNEL); + pdata->pfc = devm_kzalloc_obj(pdata->dev, *pdata->pfc); if (!pdata->pfc) return -ENOMEM; } diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c index 2e6b8ffe785c..ee18f30948a8 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v1.c @@ -572,7 +572,7 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata) struct xgbe_phy_data *phy_data; int ret; - phy_data = devm_kzalloc(pdata->dev, sizeof(*phy_data), GFP_KERNEL); + phy_data = devm_kzalloc_obj(pdata->dev, *phy_data); if (!phy_data) return -ENOMEM; diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c index 59a074ed312a..0a3cd65d1430 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c @@ -3443,7 +3443,7 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata) if (ret) return ret; - phy_data = devm_kzalloc(pdata->dev, sizeof(*phy_data), GFP_KERNEL); + phy_data = devm_kzalloc_obj(pdata->dev, *phy_data); if (!phy_data) return -ENOMEM; pdata->phy_data = phy_data; diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c b/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c index ada70425b48c..0e9763d1b893 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c @@ -249,8 +249,8 @@ static void xgene_get_extd_stats(struct xgene_enet_pdata *pdata) int xgene_extd_stats_init(struct xgene_enet_pdata *pdata) { - pdata->extd_stats = devm_kmalloc_array(&pdata->pdev->dev, - XGENE_EXTD_STATS_LEN, sizeof(u64), GFP_KERNEL); + pdata->extd_stats = devm_kmalloc_objs(&pdata->pdev->dev, u64, + XGENE_EXTD_STATS_LEN); if (!pdata->extd_stats) return -ENOMEM; diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 2ddcbf27014e..35ea9a024736 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -1225,8 +1225,7 @@ static struct xgene_enet_desc_ring *xgene_enet_create_desc_ring( if (size < 0) return NULL; - ring = devm_kzalloc(dev, sizeof(struct xgene_enet_desc_ring), - GFP_KERNEL); + ring = devm_kzalloc_obj(dev, struct xgene_enet_desc_ring); if (!ring) return NULL; @@ -1347,9 +1346,8 @@ static int xgene_enet_create_desc_rings(struct net_device *ndev) rx_ring->nbufpool = NUM_BUFPOOL; rx_ring->npagepool = NUM_NXTBUFPOOL; rx_ring->irq = pdata->irqs[i]; - buf_pool->rx_skb = devm_kcalloc(dev, buf_pool->slots, - sizeof(struct sk_buff *), - GFP_KERNEL); + buf_pool->rx_skb = devm_kzalloc_objs(dev, struct sk_buff *, + buf_pool->slots); if (!buf_pool->rx_skb) { ret = -ENOMEM; goto err; @@ -1376,17 +1374,15 @@ static int xgene_enet_create_desc_rings(struct net_device *ndev) } slots = page_pool->slots; - page_pool->frag_page = devm_kcalloc(dev, slots, - sizeof(struct page *), - GFP_KERNEL); + page_pool->frag_page = devm_kzalloc_objs(dev, struct page *, + slots); if (!page_pool->frag_page) { ret = -ENOMEM; goto err; } - page_pool->frag_dma_addr = devm_kcalloc(dev, slots, - sizeof(dma_addr_t), - GFP_KERNEL); + page_pool->frag_dma_addr = devm_kzalloc_objs(dev, dma_addr_t, + slots); if (!page_pool->frag_dma_addr) { ret = -ENOMEM; goto err; @@ -1437,9 +1433,8 @@ static int xgene_enet_create_desc_rings(struct net_device *ndev) cp_ring->index = i; } - cp_ring->cp_skb = devm_kcalloc(dev, tx_ring->slots, - sizeof(struct sk_buff *), - GFP_KERNEL); + cp_ring->cp_skb = devm_kzalloc_objs(dev, struct sk_buff *, + tx_ring->slots); if (!cp_ring->cp_skb) { ret = -ENOMEM; goto err; diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c index 1da0b04f59d7..a59a006cea3a 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c @@ -1260,7 +1260,7 @@ static int bcmasp_probe(struct platform_device *pdev) int ret = 0, count = 0; unsigned int i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -1324,15 +1324,15 @@ static int bcmasp_probe(struct platform_device *pdev) */ bcmasp_core_init(priv); - priv->mda_filters = devm_kcalloc(dev, priv->num_mda_filters, - sizeof(*priv->mda_filters), GFP_KERNEL); + priv->mda_filters = devm_kzalloc_objs(dev, *priv->mda_filters, + priv->num_mda_filters); if (!priv->mda_filters) { ret = -ENOMEM; goto err_clock_disable; } - priv->net_filters = devm_kcalloc(dev, priv->num_net_filters, - sizeof(*priv->net_filters), GFP_KERNEL); + priv->net_filters = devm_kzalloc_objs(dev, *priv->net_filters, + priv->num_net_filters); if (!priv->net_filters) { ret = -ENOMEM; goto err_clock_disable; diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 2b2e8a7e8061..bc88a27da16b 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -2490,9 +2490,8 @@ static int bcm_sysport_probe(struct platform_device *pdev) } /* Allocate number of TX rings */ - priv->tx_rings = devm_kcalloc(&pdev->dev, txq, - sizeof(struct bcm_sysport_tx_ring), - GFP_KERNEL); + priv->tx_rings = devm_kzalloc_objs(&pdev->dev, + struct bcm_sysport_tx_ring, txq); if (!priv->tx_rings) { ret = -ENOMEM; goto err_free_netdev; diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index f087f278f9e5..5ad0e32e2b40 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -5854,7 +5854,7 @@ static int fu540_c000_clk_init(struct platform_device *pdev, struct clk **pclk, if (err) return err; - mgmt = devm_kzalloc(&pdev->dev, sizeof(*mgmt), GFP_KERNEL); + mgmt = devm_kzalloc_obj(&pdev->dev, *mgmt); if (!mgmt) { err = -ENOMEM; goto err_disable_clks; diff --git a/drivers/net/ethernet/cavium/common/cavium_ptp.c b/drivers/net/ethernet/cavium/common/cavium_ptp.c index 61e261657073..ab0a6432f19f 100644 --- a/drivers/net/ethernet/cavium/common/cavium_ptp.c +++ b/drivers/net/ethernet/cavium/common/cavium_ptp.c @@ -227,7 +227,7 @@ static int cavium_ptp_probe(struct pci_dev *pdev, u64 clock_comp; int err; - clock = devm_kzalloc(dev, sizeof(*clock), GFP_KERNEL); + clock = devm_kzalloc_obj(dev, *clock); if (!clock) { err = -ENOMEM; goto error; diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c index 086f32b61580..c128b9948b4d 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c @@ -1297,11 +1297,11 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) BUILD_BUG_ON(sizeof(union nic_mbx) > 16); - nic = devm_kzalloc(dev, sizeof(*nic), GFP_KERNEL); + nic = devm_kzalloc_obj(dev, *nic); if (!nic) return -ENOMEM; - nic->hw = devm_kzalloc(dev, sizeof(struct hw_info), GFP_KERNEL); + nic->hw = devm_kzalloc_obj(dev, struct hw_info); if (!nic->hw) return -ENOMEM; diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c index 6d4e93de2021..3ffa672ca29f 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c @@ -1037,7 +1037,7 @@ int nicvf_set_qset_resources(struct nicvf *nic) { struct queue_set *qs; - qs = devm_kzalloc(&nic->pdev->dev, sizeof(*qs), GFP_KERNEL); + qs = devm_kzalloc_obj(&nic->pdev->dev, *qs); if (!qs) return -ENOMEM; nic->qs = qs; diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index b6303999902f..ebba423564e0 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c @@ -1595,7 +1595,7 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) u8 lmac; u16 sdevid; - bgx = devm_kzalloc(dev, sizeof(*bgx), GFP_KERNEL); + bgx = devm_kzalloc_obj(dev, *bgx); if (!bgx) return -ENOMEM; bgx->pdev = pdev; diff --git a/drivers/net/ethernet/cavium/thunder/thunder_xcv.c b/drivers/net/ethernet/cavium/thunder/thunder_xcv.c index 3ebb93792831..57c736dc239a 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_xcv.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_xcv.c @@ -156,7 +156,7 @@ static int xcv_probe(struct pci_dev *pdev, const struct pci_device_id *ent) int err; struct device *dev = &pdev->dev; - xcv = devm_kzalloc(dev, sizeof(struct xcv), GFP_KERNEL); + xcv = devm_kzalloc_obj(dev, struct xcv); if (!xcv) return -ENOMEM; xcv->pdev = pdev; diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 2fe7fd0202d2..3ed8b1ae0bbc 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -2648,7 +2648,7 @@ static int gemini_ethernet_probe(struct platform_device *pdev) u32 val; /* Global registers */ - geth = devm_kzalloc(dev, sizeof(*geth), GFP_KERNEL); + geth = devm_kzalloc_obj(dev, *geth); if (!geth) return -ENOMEM; geth->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index e294b365eb06..082bb560334d 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c @@ -1389,7 +1389,7 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev) if (!IS_ENABLED(CONFIG_OF) || !np) return ERR_PTR(-ENXIO); - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/ethernet/dec/tulip/eeprom.c b/drivers/net/ethernet/dec/tulip/eeprom.c index 71ff9e6db209..727f40a6d8d3 100644 --- a/drivers/net/ethernet/dec/tulip/eeprom.c +++ b/drivers/net/ethernet/dec/tulip/eeprom.c @@ -224,8 +224,8 @@ subsequent_board: return; } - mtable = devm_kmalloc(&tp->pdev->dev, struct_size(mtable, mleaf, count), - GFP_KERNEL); + mtable = devm_kmalloc_flex(&tp->pdev->dev, *mtable, mleaf, + count); if (mtable == NULL) return; /* Horrible, impossible failure. */ last_mediatable = tp->mtable = mtable; diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index b928c89077da..9da505271bde 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -701,8 +701,7 @@ static struct dpaa_fq *dpaa_fq_alloc(struct device *dev, struct dpaa_fq *dpaa_fq; int i; - dpaa_fq = devm_kcalloc(dev, count, sizeof(*dpaa_fq), - GFP_KERNEL); + dpaa_fq = devm_kzalloc_objs(dev, *dpaa_fq, count); if (!dpaa_fq) return NULL; @@ -3205,7 +3204,7 @@ static struct dpaa_bp *dpaa_bp_alloc(struct device *dev) { struct dpaa_bp *dpaa_bp; - dpaa_bp = devm_kzalloc(dev, sizeof(*dpaa_bp), GFP_KERNEL); + dpaa_bp = devm_kzalloc_obj(dev, *dpaa_bp); if (!dpaa_bp) return ERR_PTR(-ENOMEM); @@ -3363,17 +3362,15 @@ static int dpaa_eth_probe(struct platform_device *pdev) priv->msg_enable = netif_msg_init(debug, DPAA_MSG_DEFAULT); - priv->egress_fqs = devm_kcalloc(dev, dpaa_max_num_txqs(), - sizeof(*priv->egress_fqs), - GFP_KERNEL); + priv->egress_fqs = devm_kzalloc_objs(dev, *priv->egress_fqs, + dpaa_max_num_txqs()); if (!priv->egress_fqs) { err = -ENOMEM; goto free_netdev; } - priv->conf_fqs = devm_kcalloc(dev, dpaa_max_num_txqs(), - sizeof(*priv->conf_fqs), - GFP_KERNEL); + priv->conf_fqs = devm_kzalloc_objs(dev, *priv->conf_fqs, + dpaa_max_num_txqs()); if (!priv->conf_fqs) { err = -ENOMEM; goto free_netdev; diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 7227a35dfaf2..9003cff88024 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -3866,9 +3866,8 @@ static int dpaa2_eth_setup_dpni(struct fsl_mc_device *ls_dev) if (err && err != -EOPNOTSUPP) goto close; - priv->cls_rules = devm_kcalloc(dev, dpaa2_eth_fs_count(priv), - sizeof(struct dpaa2_eth_cls_rule), - GFP_KERNEL); + priv->cls_rules = devm_kzalloc_objs(dev, struct dpaa2_eth_cls_rule, + dpaa2_eth_fs_count(priv)); if (!priv->cls_rules) { err = -ENOMEM; goto close; diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c index a28ddc0542bf..5506cc9fc027 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c @@ -134,7 +134,7 @@ static int dpaa2_ptp_probe(struct fsl_mc_device *mc_dev) void __iomem *base; int err; - ptp_qoriq = devm_kzalloc(dev, sizeof(*ptp_qoriq), GFP_KERNEL); + ptp_qoriq = devm_kzalloc_obj(dev, *ptp_qoriq); if (!ptp_qoriq) return -ENOMEM; diff --git a/drivers/net/ethernet/freescale/enetc/enetc_cbdr.c b/drivers/net/ethernet/freescale/enetc/enetc_cbdr.c index e4a393a8a58e..e99936bd6dba 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_cbdr.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_cbdr.c @@ -73,8 +73,7 @@ int enetc4_setup_cbdr(struct enetc_si *si) user->cbdr_num = 1; user->dev = dev; - user->ring = devm_kcalloc(dev, user->cbdr_num, - sizeof(struct netc_cbdr), GFP_KERNEL); + user->ring = devm_kzalloc_objs(dev, struct netc_cbdr, user->cbdr_num); if (!user->ring) return -ENOMEM; diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ierb.c b/drivers/net/ethernet/freescale/enetc/enetc_ierb.c index f0600b97a3d6..0f1d4764fb54 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ierb.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ierb.c @@ -100,7 +100,7 @@ static int enetc_ierb_probe(struct platform_device *pdev) struct enetc_ierb *ierb; void __iomem *regs; - ierb = devm_kzalloc(&pdev->dev, sizeof(*ierb), GFP_KERNEL); + ierb = devm_kzalloc_obj(&pdev->dev, *ierb); if (!ierb) return -ENOMEM; diff --git a/drivers/net/ethernet/freescale/enetc/enetc_mdio.c b/drivers/net/ethernet/freescale/enetc/enetc_mdio.c index 998aaa394e9c..9268e2de1fd1 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_mdio.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_mdio.c @@ -221,7 +221,7 @@ struct enetc_hw *enetc_hw_alloc(struct device *dev, void __iomem *port_regs) { struct enetc_hw *hw; - hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL); + hw = devm_kzalloc_obj(dev, *hw); if (!hw) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c index 8206884294a4..8facc8bf8693 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -585,15 +585,12 @@ int enetc_init_sriov_resources(struct enetc_pf *pf) if (!pf->total_vfs) return 0; - pf->rxmsg = devm_kcalloc(dev, pf->total_vfs, - sizeof(struct enetc_msg_swbd), - GFP_KERNEL); + pf->rxmsg = devm_kzalloc_objs(dev, struct enetc_msg_swbd, pf->total_vfs); if (!pf->rxmsg) return -ENOMEM; - pf->vf_state = devm_kcalloc(dev, pf->total_vfs, - sizeof(struct enetc_vf_state), - GFP_KERNEL); + pf->vf_state = devm_kzalloc_objs(dev, struct enetc_vf_state, + pf->total_vfs); if (!pf->vf_state) return -ENOMEM; diff --git a/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c b/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c index c7eb0234c785..658fab31e9ed 100644 --- a/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c +++ b/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c @@ -900,7 +900,7 @@ static int netc_blk_ctrl_probe(struct platform_device *pdev) void __iomem *regs; int err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index f27ff625fe29..29c2fa2be837 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -127,10 +127,10 @@ static int mac_probe(struct platform_device *_of_dev) mac_node = dev->of_node; init = of_device_get_match_data(dev); - mac_dev = devm_kzalloc(dev, sizeof(*mac_dev), GFP_KERNEL); + mac_dev = devm_kzalloc_obj(dev, *mac_dev); if (!mac_dev) return -ENOMEM; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; platform_set_drvdata(_of_dev, mac_dev); diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c b/drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c index a518dc66d9ef..4c8bd32166b4 100644 --- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c +++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c @@ -339,8 +339,8 @@ static int hbg_mac_filter_init(struct hbg_priv *priv) struct hbg_mac_filter *filter = &priv->filter; struct hbg_mac_table_entry *tmp_table; - tmp_table = devm_kcalloc(&priv->pdev->dev, dev_specs->uc_mac_num, - sizeof(*tmp_table), GFP_KERNEL); + tmp_table = devm_kzalloc_objs(&priv->pdev->dev, *tmp_table, + dev_specs->uc_mac_num); if (!tmp_table) return -ENOMEM; diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethernet/hisilicon/hisi_femac.c index a44ea0a2b1ee..95de861b7ae3 100644 --- a/drivers/net/ethernet/hisilicon/hisi_femac.c +++ b/drivers/net/ethernet/hisilicon/hisi_femac.c @@ -348,13 +348,11 @@ static int hisi_femac_init_queue(struct device *dev, struct hisi_femac_queue *queue, unsigned int num) { - queue->skb = devm_kcalloc(dev, num, sizeof(struct sk_buff *), - GFP_KERNEL); + queue->skb = devm_kzalloc_objs(dev, struct sk_buff *, num); if (!queue->skb) return -ENOMEM; - queue->dma_phys = devm_kcalloc(dev, num, sizeof(dma_addr_t), - GFP_KERNEL); + queue->dma_phys = devm_kzalloc_objs(dev, dma_addr_t, num); if (!queue->dma_phys) return -ENOMEM; diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c index 400933ca1a29..1469cd4c0b61 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c @@ -697,7 +697,7 @@ void *hns_gmac_config(struct hns_mac_cb *mac_cb, struct mac_params *mac_param) { struct mac_driver *mac_drv; - mac_drv = devm_kzalloc(mac_cb->dev, sizeof(*mac_drv), GFP_KERNEL); + mac_drv = devm_kzalloc_obj(mac_cb->dev, *mac_drv); if (!mac_drv) return NULL; diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c index f1cb6d56e4b9..02afdef0211a 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c @@ -1106,8 +1106,7 @@ int hns_mac_init(struct dsaf_device *dsaf_dev) "reg(%u) out of range!\n", port_id); return -EINVAL; } - mac_cb = devm_kzalloc(dsaf_dev->dev, sizeof(*mac_cb), - GFP_KERNEL); + mac_cb = devm_kzalloc_obj(dsaf_dev->dev, *mac_cb); if (!mac_cb) return -ENOMEM; @@ -1122,8 +1121,7 @@ int hns_mac_init(struct dsaf_device *dsaf_dev) */ if (!found) { for (port_id = 0; port_id < max_port_num; port_id++) { - mac_cb = devm_kzalloc(dsaf_dev->dev, sizeof(*mac_cb), - GFP_KERNEL); + mac_cb = devm_kzalloc_obj(dsaf_dev->dev, *mac_cb); if (!mac_cb) return -ENOMEM; diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c index a59fd280a045..b5f11f7a7f92 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c @@ -652,7 +652,7 @@ struct dsaf_misc_op *hns_misc_op_get(struct dsaf_device *dsaf_dev) { struct dsaf_misc_op *misc_op; - misc_op = devm_kzalloc(dsaf_dev->dev, sizeof(*misc_op), GFP_KERNEL); + misc_op = devm_kzalloc_obj(dsaf_dev->dev, *misc_op); if (!misc_op) return NULL; diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c index 408d36d85fb1..076a36aefdd1 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c @@ -76,9 +76,8 @@ static int hns_ppe_common_get_cfg(struct dsaf_device *dsaf_dev, int comm_index) else ppe_num = HNS_PPE_DEBUG_NW_ENGINE_NUM; - ppe_common = devm_kzalloc(dsaf_dev->dev, - struct_size(ppe_common, ppe_cb, ppe_num), - GFP_KERNEL); + ppe_common = devm_kzalloc_flex(dsaf_dev->dev, *ppe_common, ppe_cb, + ppe_num); if (!ppe_common) return -ENOMEM; diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c index 3c4e4e8ca140..520e5cb2fbe0 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c @@ -776,9 +776,8 @@ int hns_rcb_common_get_cfg(struct dsaf_device *dsaf_dev, int ring_num = hns_rcb_get_ring_num(dsaf_dev); rcb_common = - devm_kzalloc(dsaf_dev->dev, - struct_size(rcb_common, ring_pair_cb, ring_num), - GFP_KERNEL); + devm_kzalloc_flex(dsaf_dev->dev, *rcb_common, ring_pair_cb, + ring_num); if (!rcb_common) { dev_err(dsaf_dev->dev, "rcb common devm_kzalloc fail!\n"); return -ENOMEM; diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c index dbc44c2c26c2..2eb489bbbf79 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c @@ -780,7 +780,7 @@ void *hns_xgmac_config(struct hns_mac_cb *mac_cb, struct mac_params *mac_param) { struct mac_driver *mac_drv; - mac_drv = devm_kzalloc(mac_cb->dev, sizeof(*mac_drv), GFP_KERNEL); + mac_drv = devm_kzalloc_obj(mac_cb->dev, *mac_drv); if (!mac_drv) return NULL; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_rss.c b/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_rss.c index 1eca53aaf598..d0d904be9509 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_rss.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_rss.c @@ -49,8 +49,8 @@ int hclge_comm_rss_init_cfg(struct hnae3_handle *nic, rss_cfg->rss_algo = rss_algo; - rss_ind_tbl = devm_kcalloc(&ae_dev->pdev->dev, rss_ind_tbl_size, - sizeof(*rss_ind_tbl), GFP_KERNEL); + rss_ind_tbl = devm_kzalloc_objs(&ae_dev->pdev->dev, *rss_ind_tbl, + rss_ind_tbl_size); if (!rss_ind_tbl) return -ENOMEM; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c index 1347edac7699..39648d92b976 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c @@ -849,8 +849,7 @@ static int hns3_dbg_bd_file_init(struct hnae3_handle *handle, u32 cmd) entry_dir = hns3_dbg_dentry[hns3_dbg_cmd[cmd].dentry].dentry; max_queue_num = hns3_get_max_available_channels(handle); - data = devm_kcalloc(&handle->pdev->dev, max_queue_num, sizeof(*data), - GFP_KERNEL); + data = devm_kzalloc_objs(&handle->pdev->dev, *data, max_queue_num); if (!data) return -ENOMEM; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 47788be64be6..db4f584c4ce1 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1072,8 +1072,7 @@ static void hns3_init_tx_spare_buffer(struct hns3_enet_ring *ring) goto not_init; } - tx_spare = devm_kzalloc(ring_to_dev(ring), sizeof(*tx_spare), - GFP_KERNEL); + tx_spare = devm_kzalloc_obj(ring_to_dev(ring), *tx_spare); if (!tx_spare) { /* The driver still work without the tx spare buffer */ dev_warn(ring_to_dev(ring), "failed to allocate hns3_tx_spare\n"); @@ -3153,7 +3152,7 @@ static int hns3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) struct hnae3_ae_dev *ae_dev; int ret; - ae_dev = devm_kzalloc(&pdev->dev, sizeof(*ae_dev), GFP_KERNEL); + ae_dev = devm_kzalloc_obj(&pdev->dev, *ae_dev); if (!ae_dev) return -ENOMEM; @@ -4592,7 +4591,7 @@ static int hns3_create_ring_chain(struct hns3_enet_tqp_vector *tqp_vector, } while (ring) { - chain = devm_kzalloc(&pdev->dev, sizeof(*chain), GFP_KERNEL); + chain = devm_kzalloc_obj(&pdev->dev, *chain); if (!chain) return -ENOMEM; if (cur_chain) @@ -4840,8 +4839,7 @@ static int hns3_nic_alloc_vector_data(struct hns3_nic_priv *priv) /* Should consider 2p/4p later */ vector_num = min_t(u16, num_online_cpus(), tqp_num); - vector = devm_kcalloc(&pdev->dev, vector_num, sizeof(*vector), - GFP_KERNEL); + vector = devm_kzalloc_objs(&pdev->dev, *vector, vector_num); if (!vector) return -ENOMEM; @@ -4850,8 +4848,7 @@ static int hns3_nic_alloc_vector_data(struct hns3_nic_priv *priv) priv->vector_num = vector_num; priv->tqp_vector = (struct hns3_enet_tqp_vector *) - devm_kcalloc(&pdev->dev, vector_num, sizeof(*priv->tqp_vector), - GFP_KERNEL); + devm_kzalloc_objs(&pdev->dev, *priv->tqp_vector, vector_num); if (!priv->tqp_vector) { ret = -ENOMEM; goto out; @@ -5047,8 +5044,8 @@ static int hns3_alloc_ring_memory(struct hns3_enet_ring *ring) if (ring->desc_num <= 0 || ring->buf_size <= 0) return -EINVAL; - ring->desc_cb = devm_kcalloc(ring_to_dev(ring), ring->desc_num, - sizeof(ring->desc_cb[0]), GFP_KERNEL); + ring->desc_cb = devm_kzalloc_objs(ring_to_dev(ring), ring->desc_cb[0], + ring->desc_num); if (!ring->desc_cb) { ret = -ENOMEM; goto out; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 26aeeba3fcf2..67327ae6cd3c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -1562,8 +1562,8 @@ static int hclge_alloc_tqps(struct hclge_dev *hdev) struct hclge_comm_tqp *tqp; int i; - hdev->htqp = devm_kcalloc(&hdev->pdev->dev, hdev->num_tqps, - sizeof(struct hclge_comm_tqp), GFP_KERNEL); + hdev->htqp = devm_kzalloc_objs(&hdev->pdev->dev, struct hclge_comm_tqp, + hdev->num_tqps); if (!hdev->htqp) return -ENOMEM; @@ -1674,8 +1674,8 @@ static int hclge_knic_setup(struct hclge_vport *vport, u16 num_tqps, kinfo->rx_buf_len = hdev->rx_buf_len; kinfo->tx_spare_buf_size = hdev->tx_spare_buf_size; - kinfo->tqp = devm_kcalloc(&hdev->pdev->dev, num_tqps, - sizeof(struct hnae3_queue *), GFP_KERNEL); + kinfo->tqp = devm_kzalloc_objs(&hdev->pdev->dev, struct hnae3_queue *, + num_tqps); if (!kinfo->tqp) return -ENOMEM; @@ -1771,8 +1771,7 @@ static int hclge_alloc_vport(struct hclge_dev *hdev) tqp_per_vport = hdev->num_tqps / num_vport; tqp_main_vport = tqp_per_vport + hdev->num_tqps % num_vport; - vport = devm_kcalloc(&pdev->dev, num_vport, sizeof(struct hclge_vport), - GFP_KERNEL); + vport = devm_kzalloc_objs(&pdev->dev, struct hclge_vport, num_vport); if (!vport) return -ENOMEM; @@ -2459,8 +2458,7 @@ static int hclge_init_msi(struct hclge_dev *hdev) hdev->num_msi = vectors; hdev->num_msi_left = vectors; - hdev->vector_status = devm_kcalloc(&pdev->dev, hdev->num_msi, - sizeof(u16), GFP_KERNEL); + hdev->vector_status = devm_kzalloc_objs(&pdev->dev, u16, hdev->num_msi); if (!hdev->vector_status) { pci_free_irq_vectors(pdev); return -ENOMEM; @@ -2469,8 +2467,7 @@ static int hclge_init_msi(struct hclge_dev *hdev) for (i = 0; i < hdev->num_msi; i++) hdev->vector_status[i] = HCLGE_INVALID_VPORT; - hdev->vector_irq = devm_kcalloc(&pdev->dev, hdev->num_msi, - sizeof(int), GFP_KERNEL); + hdev->vector_irq = devm_kzalloc_objs(&pdev->dev, int, hdev->num_msi); if (!hdev->vector_irq) { pci_free_irq_vectors(pdev); return -ENOMEM; @@ -9500,7 +9497,7 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) struct hclge_dev *hdev; int ret; - hdev = devm_kzalloc(&pdev->dev, sizeof(*hdev), GFP_KERNEL); + hdev = devm_kzalloc_obj(&pdev->dev, *hdev); if (!hdev) return -ENOMEM; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c index 0081c5281455..d9b3641f55e6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c @@ -427,7 +427,7 @@ static int hclge_ptp_create_clock(struct hclge_dev *hdev) { struct hclge_ptp *ptp; - ptp = devm_kzalloc(&hdev->pdev->dev, sizeof(*ptp), GFP_KERNEL); + ptp = devm_kzalloc_obj(&hdev->pdev->dev, *ptp); if (!ptp) return -ENOMEM; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 4750e439a6b4..6dbb368b0faf 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -306,8 +306,8 @@ static int hclgevf_alloc_tqps(struct hclgevf_dev *hdev) struct hclge_comm_tqp *tqp; int i; - hdev->htqp = devm_kcalloc(&hdev->pdev->dev, hdev->num_tqps, - sizeof(struct hclge_comm_tqp), GFP_KERNEL); + hdev->htqp = devm_kzalloc_objs(&hdev->pdev->dev, struct hclge_comm_tqp, + hdev->num_tqps); if (!hdev->htqp) return -ENOMEM; @@ -372,8 +372,8 @@ static int hclgevf_knic_setup(struct hclgevf_dev *hdev) new_tqps = kinfo->rss_size * num_tc; kinfo->num_tqps = min(new_tqps, hdev->num_tqps); - kinfo->tqp = devm_kcalloc(&hdev->pdev->dev, hdev->num_tqps, - sizeof(struct hnae3_queue *), GFP_KERNEL); + kinfo->tqp = devm_kzalloc_objs(&hdev->pdev->dev, struct hnae3_queue *, + hdev->num_tqps); if (!kinfo->tqp) return -ENOMEM; @@ -2130,7 +2130,7 @@ static int hclgevf_alloc_hdev(struct hnae3_ae_dev *ae_dev) struct pci_dev *pdev = ae_dev->pdev; struct hclgevf_dev *hdev; - hdev = devm_kzalloc(&pdev->dev, sizeof(*hdev), GFP_KERNEL); + hdev = devm_kzalloc_obj(&pdev->dev, *hdev); if (!hdev) return -ENOMEM; @@ -2385,8 +2385,7 @@ static int hclgevf_init_msi(struct hclgevf_dev *hdev) hdev->num_msi = vectors; hdev->num_msi_left = vectors; - hdev->vector_status = devm_kcalloc(&pdev->dev, hdev->num_msi, - sizeof(u16), GFP_KERNEL); + hdev->vector_status = devm_kzalloc_objs(&pdev->dev, u16, hdev->num_msi); if (!hdev->vector_status) { pci_free_irq_vectors(pdev); return -ENOMEM; @@ -2395,8 +2394,7 @@ static int hclgevf_init_msi(struct hclgevf_dev *hdev) for (i = 0; i < hdev->num_msi; i++) hdev->vector_status[i] = HCLGEVF_INVALID_VPORT; - hdev->vector_irq = devm_kcalloc(&pdev->dev, hdev->num_msi, - sizeof(int), GFP_KERNEL); + hdev->vector_irq = devm_kzalloc_objs(&pdev->dev, int, hdev->num_msi); if (!hdev->vector_irq) { devm_kfree(&pdev->dev, hdev->vector_status); pci_free_irq_vectors(pdev); diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c index 6812be8dc64f..2725e5bc19e0 100644 --- a/drivers/net/ethernet/hisilicon/hns_mdio.c +++ b/drivers/net/ethernet/hisilicon/hns_mdio.c @@ -503,7 +503,7 @@ static int hns_mdio_probe(struct platform_device *pdev) return -ENODEV; } - mdio_dev = devm_kzalloc(&pdev->dev, sizeof(*mdio_dev), GFP_KERNEL); + mdio_dev = devm_kzalloc_obj(&pdev->dev, *mdio_dev); if (!mdio_dev) return -ENOMEM; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_api_cmd.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_api_cmd.c index 998717f02136..9f12afb23065 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw_api_cmd.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_api_cmd.c @@ -825,8 +825,8 @@ static int api_chain_init(struct hinic_api_cmd_chain *chain, sema_init(&chain->sem, 1); - chain->cell_ctxt = devm_kcalloc(&pdev->dev, chain->num_cells, - sizeof(*chain->cell_ctxt), GFP_KERNEL); + chain->cell_ctxt = devm_kzalloc_objs(&pdev->dev, *chain->cell_ctxt, + chain->num_cells); if (!chain->cell_ctxt) return -ENOMEM; @@ -874,7 +874,7 @@ static struct hinic_api_cmd_chain * return ERR_PTR(-EINVAL); } - chain = devm_kzalloc(&pdev->dev, sizeof(*chain), GFP_KERNEL); + chain = devm_kzalloc_obj(&pdev->dev, *chain); if (!chain) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c index d39eec9c62bf..0c92fa2f82ce 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c @@ -793,8 +793,8 @@ static int init_cmdqs_ctxt(struct hinic_hwdev *hwdev, struct hinic_pfhwdev *pfhwdev; int err; - cmdq_ctxts = devm_kcalloc(&pdev->dev, HINIC_MAX_CMDQ_TYPES, - sizeof(*cmdq_ctxts), GFP_KERNEL); + cmdq_ctxts = devm_kzalloc_objs(&pdev->dev, *cmdq_ctxts, + HINIC_MAX_CMDQ_TYPES); if (!cmdq_ctxts) return -ENOMEM; @@ -888,8 +888,8 @@ int hinic_init_cmdqs(struct hinic_cmdqs *cmdqs, struct hinic_hwif *hwif, if (!cmdqs->cmdq_buf_pool) return -ENOMEM; - cmdqs->saved_wqs = devm_kcalloc(&pdev->dev, HINIC_MAX_CMDQ_TYPES, - sizeof(*cmdqs->saved_wqs), GFP_KERNEL); + cmdqs->saved_wqs = devm_kzalloc_objs(&pdev->dev, *cmdqs->saved_wqs, + HINIC_MAX_CMDQ_TYPES); if (!cmdqs->saved_wqs) { err = -ENOMEM; goto err_saved_wqs; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c index 27795288c586..cb443eb0c4b8 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c @@ -164,9 +164,8 @@ static int init_msix(struct hinic_hwdev *hwdev) if (nr_irqs > HINIC_HWIF_NUM_IRQS(hwif)) nr_irqs = HINIC_HWIF_NUM_IRQS(hwif); - hwdev->msix_entries = devm_kcalloc(&pdev->dev, nr_irqs, - sizeof(*hwdev->msix_entries), - GFP_KERNEL); + hwdev->msix_entries = devm_kzalloc_objs(&pdev->dev, + *hwdev->msix_entries, nr_irqs); if (!hwdev->msix_entries) return -ENOMEM; @@ -909,7 +908,7 @@ struct hinic_hwdev *hinic_init_hwdev(struct pci_dev *pdev, struct devlink *devli struct hinic_hwif *hwif; int err, num_aeqs; - hwif = devm_kzalloc(&pdev->dev, sizeof(*hwif), GFP_KERNEL); + hwif = devm_kzalloc_obj(&pdev->dev, *hwif); if (!hwif) return ERR_PTR(-ENOMEM); @@ -919,7 +918,7 @@ struct hinic_hwdev *hinic_init_hwdev(struct pci_dev *pdev, struct devlink *devli return ERR_PTR(err); } - pfhwdev = devm_kzalloc(&pdev->dev, sizeof(*pfhwdev), GFP_KERNEL); + pfhwdev = devm_kzalloc_obj(&pdev->dev, *pfhwdev); if (!pfhwdev) { err = -ENOMEM; goto err_pfhwdev_alloc; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.c index 28114a59347e..ca113cd53f56 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.c @@ -633,13 +633,13 @@ static int alloc_eq_pages(struct hinic_eq *eq) u32 init_val, addr, val; int err, pg; - eq->dma_addr = devm_kcalloc(&pdev->dev, eq->num_pages, - sizeof(*eq->dma_addr), GFP_KERNEL); + eq->dma_addr = devm_kzalloc_objs(&pdev->dev, *eq->dma_addr, + eq->num_pages); if (!eq->dma_addr) return -ENOMEM; - eq->virt_addr = devm_kcalloc(&pdev->dev, eq->num_pages, - sizeof(*eq->virt_addr), GFP_KERNEL); + eq->virt_addr = devm_kzalloc_objs(&pdev->dev, *eq->virt_addr, + eq->num_pages); if (!eq->virt_addr) { err = -ENOMEM; goto err_virt_addr_alloc; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_io.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_io.c index c4a0ba6e183a..a52d9b6d7828 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw_io.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_io.c @@ -378,27 +378,27 @@ int hinic_io_create_qps(struct hinic_func_to_io *func_to_io, void *ci_addr_base; int i, j, err; - func_to_io->qps = devm_kcalloc(&pdev->dev, num_qps, - sizeof(*func_to_io->qps), GFP_KERNEL); + func_to_io->qps = devm_kzalloc_objs(&pdev->dev, *func_to_io->qps, + num_qps); if (!func_to_io->qps) return -ENOMEM; - func_to_io->sq_wq = devm_kcalloc(&pdev->dev, num_qps, - sizeof(*func_to_io->sq_wq), GFP_KERNEL); + func_to_io->sq_wq = devm_kzalloc_objs(&pdev->dev, *func_to_io->sq_wq, + num_qps); if (!func_to_io->sq_wq) { err = -ENOMEM; goto err_sq_wq; } - func_to_io->rq_wq = devm_kcalloc(&pdev->dev, num_qps, - sizeof(*func_to_io->rq_wq), GFP_KERNEL); + func_to_io->rq_wq = devm_kzalloc_objs(&pdev->dev, *func_to_io->rq_wq, + num_qps); if (!func_to_io->rq_wq) { err = -ENOMEM; goto err_rq_wq; } - func_to_io->sq_db = devm_kcalloc(&pdev->dev, num_qps, - sizeof(*func_to_io->sq_db), GFP_KERNEL); + func_to_io->sq_db = devm_kzalloc_objs(&pdev->dev, *func_to_io->sq_db, + num_qps); if (!func_to_io->sq_db) { err = -ENOMEM; goto err_sq_db; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c index e1a1735c00c1..c54c71f5075b 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c @@ -192,19 +192,19 @@ static int alloc_page_arrays(struct hinic_wqs *wqs) struct hinic_hwif *hwif = wqs->hwif; struct pci_dev *pdev = hwif->pdev; - wqs->page_paddr = devm_kcalloc(&pdev->dev, wqs->num_pages, - sizeof(*wqs->page_paddr), GFP_KERNEL); + wqs->page_paddr = devm_kzalloc_objs(&pdev->dev, *wqs->page_paddr, + wqs->num_pages); if (!wqs->page_paddr) return -ENOMEM; - wqs->page_vaddr = devm_kcalloc(&pdev->dev, wqs->num_pages, - sizeof(*wqs->page_vaddr), GFP_KERNEL); + wqs->page_vaddr = devm_kzalloc_objs(&pdev->dev, *wqs->page_vaddr, + wqs->num_pages); if (!wqs->page_vaddr) goto err_page_vaddr; - wqs->shadow_page_vaddr = devm_kcalloc(&pdev->dev, wqs->num_pages, - sizeof(*wqs->shadow_page_vaddr), - GFP_KERNEL); + wqs->shadow_page_vaddr = devm_kzalloc_objs(&pdev->dev, + *wqs->shadow_page_vaddr, + wqs->num_pages); if (!wqs->shadow_page_vaddr) goto err_page_shadow_vaddr; @@ -383,8 +383,8 @@ static int alloc_wqes_shadow(struct hinic_wq *wq) if (!wq->shadow_wqe) return -ENOMEM; - wq->shadow_idx = devm_kcalloc(&pdev->dev, wq->num_q_pages, - sizeof(*wq->shadow_idx), GFP_KERNEL); + wq->shadow_idx = devm_kzalloc_objs(&pdev->dev, *wq->shadow_idx, + wq->num_q_pages); if (!wq->shadow_idx) goto err_shadow_idx; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c index 319279c3309c..34ed5ea9e46e 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -134,8 +134,8 @@ static int create_txqs(struct hinic_dev *nic_dev) if (nic_dev->txqs) return -EINVAL; - nic_dev->txqs = devm_kcalloc(&netdev->dev, num_txqs, - sizeof(*nic_dev->txqs), GFP_KERNEL); + nic_dev->txqs = devm_kzalloc_objs(&netdev->dev, *nic_dev->txqs, + num_txqs); if (!nic_dev->txqs) return -ENOMEM; @@ -231,8 +231,8 @@ static int create_rxqs(struct hinic_dev *nic_dev) if (nic_dev->rxqs) return -EINVAL; - nic_dev->rxqs = devm_kcalloc(&netdev->dev, num_rxqs, - sizeof(*nic_dev->rxqs), GFP_KERNEL); + nic_dev->rxqs = devm_kzalloc_objs(&netdev->dev, *nic_dev->rxqs, + num_rxqs); if (!nic_dev->rxqs) return -ENOMEM; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_tx.c b/drivers/net/ethernet/huawei/hinic/hinic_tx.c index 899d103f2480..410a96c28ea3 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_tx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_tx.c @@ -864,13 +864,12 @@ int hinic_init_txq(struct hinic_txq *txq, struct hinic_sq *sq, txq->max_sges = HINIC_MAX_SQ_BUFDESCS; - txq->sges = devm_kcalloc(&netdev->dev, txq->max_sges, - sizeof(*txq->sges), GFP_KERNEL); + txq->sges = devm_kzalloc_objs(&netdev->dev, *txq->sges, txq->max_sges); if (!txq->sges) return -ENOMEM; - txq->free_sges = devm_kcalloc(&netdev->dev, txq->max_sges, - sizeof(*txq->free_sges), GFP_KERNEL); + txq->free_sges = devm_kzalloc_objs(&netdev->dev, *txq->free_sges, + txq->max_sges); if (!txq->free_sges) { err = -ENOMEM; goto err_alloc_free_sges; diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 640618c0a09e..1b95b4d5deff 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -2601,8 +2601,7 @@ static int emac_dt_phy_connect(struct emac_instance *dev, { struct phy_device *phy_dev; - dev->phy.def = devm_kzalloc(&dev->ofdev->dev, sizeof(*dev->phy.def), - GFP_KERNEL); + dev->phy.def = devm_kzalloc_obj(&dev->ofdev->dev, *dev->phy.def); if (!dev->phy.def) return -ENOMEM; diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c index 236603a381bc..dc2154a8077b 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -531,8 +531,7 @@ static int mal_probe(struct platform_device *ofdev) unsigned long irqflags; irq_handler_t hdlr_serr, hdlr_txde, hdlr_rxde; - mal = devm_kzalloc(&ofdev->dev, sizeof(struct mal_instance), - GFP_KERNEL); + mal = devm_kzalloc_obj(&ofdev->dev, struct mal_instance); if (!mal) return -ENOMEM; diff --git a/drivers/net/ethernet/ibm/emac/rgmii.c b/drivers/net/ethernet/ibm/emac/rgmii.c index b544dd8633b7..2ca97e45f277 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.c +++ b/drivers/net/ethernet/ibm/emac/rgmii.c @@ -219,8 +219,7 @@ static int rgmii_probe(struct platform_device *ofdev) struct rgmii_instance *dev; int err; - dev = devm_kzalloc(&ofdev->dev, sizeof(struct rgmii_instance), - GFP_KERNEL); + dev = devm_kzalloc_obj(&ofdev->dev, struct rgmii_instance); if (!dev) return -ENOMEM; diff --git a/drivers/net/ethernet/ibm/emac/tah.c b/drivers/net/ethernet/ibm/emac/tah.c index ed07532aaf85..31d8a0ac3928 100644 --- a/drivers/net/ethernet/ibm/emac/tah.c +++ b/drivers/net/ethernet/ibm/emac/tah.c @@ -89,8 +89,7 @@ static int tah_probe(struct platform_device *ofdev) struct tah_instance *dev; int err; - dev = devm_kzalloc(&ofdev->dev, sizeof(struct tah_instance), - GFP_KERNEL); + dev = devm_kzalloc_obj(&ofdev->dev, struct tah_instance); if (!dev) return -ENOMEM; diff --git a/drivers/net/ethernet/ibm/emac/zmii.c b/drivers/net/ethernet/ibm/emac/zmii.c index a3839cf02ec4..b6a6afaee908 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.c +++ b/drivers/net/ethernet/ibm/emac/zmii.c @@ -234,8 +234,7 @@ static int zmii_probe(struct platform_device *ofdev) struct zmii_instance *dev; int err; - dev = devm_kzalloc(&ofdev->dev, sizeof(struct zmii_instance), - GFP_KERNEL); + dev = devm_kzalloc_obj(&ofdev->dev, struct zmii_instance); if (!dev) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c b/drivers/net/ethernet/intel/ice/devlink/devlink.c index 8c2b63eef82b..a87a3e0a900c 100644 --- a/drivers/net/ethernet/intel/ice/devlink/devlink.c +++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c @@ -984,7 +984,7 @@ static int ice_devlink_rate_node_new(struct devlink_rate *rate_node, void **priv return -EBUSY; /* preallocate memory for ice_sched_node */ - node = devm_kzalloc(ice_hw_to_dev(pi->hw), sizeof(*node), GFP_KERNEL); + node = devm_kzalloc_obj(ice_hw_to_dev(pi->hw), *node); if (!node) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/ice/ice_arfs.c b/drivers/net/ethernet/intel/ice/ice_arfs.c index e0335f5e18fe..46f4b2940b41 100644 --- a/drivers/net/ethernet/intel/ice/ice_arfs.c +++ b/drivers/net/ethernet/intel/ice/ice_arfs.c @@ -227,8 +227,9 @@ ice_arfs_update_flow_rules(struct ice_vsi *vsi, u16 idx, /* check if filter needs to be added to HW */ if (e->fltr_state == ICE_ARFS_INACTIVE) { enum ice_fltr_ptype flow_type = e->fltr_info.flow_type; - struct ice_arfs_entry_ptr *ep = - devm_kzalloc(dev, sizeof(*ep), GFP_ATOMIC); + struct ice_arfs_entry_ptr *ep = devm_kzalloc_obj(dev, + *ep, + GFP_ATOMIC); if (!ep) continue; @@ -305,9 +306,8 @@ ice_arfs_build_entry(struct ice_vsi *vsi, const struct flow_keys *fk, struct ice_ntuple_fltr *fltr_info; u8 ip_proto; - arfs_entry = devm_kzalloc(ice_pf_to_dev(vsi->back), - sizeof(*arfs_entry), - GFP_ATOMIC | __GFP_NOWARN); + arfs_entry = devm_kzalloc_obj(ice_pf_to_dev(vsi->back), *arfs_entry, + GFP_ATOMIC | __GFP_NOWARN); if (!arfs_entry) return NULL; diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index 04633103e3e6..90e01eb49ea2 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c @@ -824,8 +824,7 @@ static int ice_init_fltr_mgmt_struct(struct ice_hw *hw) struct ice_switch_info *sw; int status; - hw->switch_info = devm_kzalloc(ice_hw_to_dev(hw), - sizeof(*hw->switch_info), GFP_KERNEL); + hw->switch_info = devm_kzalloc_obj(ice_hw_to_dev(hw), *hw->switch_info); sw = hw->switch_info; if (!sw) @@ -1032,9 +1031,8 @@ int ice_init_hw(struct ice_hw *hw) goto err_unroll_cqinit; if (!hw->port_info) - hw->port_info = devm_kzalloc(ice_hw_to_dev(hw), - sizeof(*hw->port_info), - GFP_KERNEL); + hw->port_info = devm_kzalloc_obj(ice_hw_to_dev(hw), + *hw->port_info); if (!hw->port_info) { status = -ENOMEM; goto err_unroll_cqinit; diff --git a/drivers/net/ethernet/intel/ice/ice_controlq.c b/drivers/net/ethernet/intel/ice/ice_controlq.c index dcb837cadd18..3e19aae6d5e9 100644 --- a/drivers/net/ethernet/intel/ice/ice_controlq.c +++ b/drivers/net/ethernet/intel/ice/ice_controlq.c @@ -151,8 +151,8 @@ ice_alloc_rq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq) /* We'll be allocating the buffer info memory first, then we can * allocate the mapped buffers for the event processing */ - cq->rq.dma_head = devm_kcalloc(ice_hw_to_dev(hw), cq->num_rq_entries, - sizeof(cq->rq.desc_buf), GFP_KERNEL); + cq->rq.dma_head = devm_kzalloc_objs(ice_hw_to_dev(hw), cq->rq.desc_buf, + cq->num_rq_entries); if (!cq->rq.dma_head) return -ENOMEM; cq->rq.r.rq_bi = (struct ice_dma_mem *)cq->rq.dma_head; @@ -221,8 +221,8 @@ ice_alloc_sq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq) int i; /* No mapped memory needed yet, just the buffer info structures */ - cq->sq.dma_head = devm_kcalloc(ice_hw_to_dev(hw), cq->num_sq_entries, - sizeof(cq->sq.desc_buf), GFP_KERNEL); + cq->sq.dma_head = devm_kzalloc_objs(ice_hw_to_dev(hw), cq->sq.desc_buf, + cq->num_sq_entries); if (!cq->sq.dma_head) return -ENOMEM; cq->sq.r.sq_bi = (struct ice_dma_mem *)cq->sq.dma_head; diff --git a/drivers/net/ethernet/intel/ice/ice_ddp.c b/drivers/net/ethernet/intel/ice/ice_ddp.c index 3b2d9c436979..d50c555851fb 100644 --- a/drivers/net/ethernet/intel/ice/ice_ddp.c +++ b/drivers/net/ethernet/intel/ice/ice_ddp.c @@ -692,7 +692,7 @@ struct ice_buf_build *ice_pkg_buf_alloc(struct ice_hw *hw) struct ice_buf_build *bld; struct ice_buf_hdr *buf; - bld = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*bld), GFP_KERNEL); + bld = devm_kzalloc_obj(ice_hw_to_dev(hw), *bld); if (!bld) return NULL; @@ -857,8 +857,7 @@ int ice_get_sw_fv_list(struct ice_hw *hw, struct ice_prot_lkup_ext *lkups, if (j >= hw->blk[ICE_BLK_SW].es.fvw) break; if (i + 1 == lkups->n_val_words) { - fvl = devm_kzalloc(ice_hw_to_dev(hw), - sizeof(*fvl), GFP_KERNEL); + fvl = devm_kzalloc_obj(ice_hw_to_dev(hw), *fvl); if (!fvl) goto err; fvl->fv_ptr = fv; diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c b/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c index ad519a8513db..8805f0efe977 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c @@ -567,18 +567,16 @@ ice_fdir_alloc_flow_prof(struct ice_hw *hw, enum ice_fltr_ptype flow) return -EINVAL; if (!hw->fdir_prof) { - hw->fdir_prof = devm_kcalloc(ice_hw_to_dev(hw), - ICE_FLTR_PTYPE_MAX, - sizeof(*hw->fdir_prof), - GFP_KERNEL); + hw->fdir_prof = devm_kzalloc_objs(ice_hw_to_dev(hw), + *hw->fdir_prof, + ICE_FLTR_PTYPE_MAX); if (!hw->fdir_prof) return -ENOMEM; } if (!hw->fdir_prof[flow]) { - hw->fdir_prof[flow] = devm_kzalloc(ice_hw_to_dev(hw), - sizeof(**hw->fdir_prof), - GFP_KERNEL); + hw->fdir_prof[flow] = devm_kzalloc_obj(ice_hw_to_dev(hw), + **hw->fdir_prof); if (!hw->fdir_prof[flow]) return -ENOMEM; } @@ -845,12 +843,11 @@ ice_create_init_fdir_rule(struct ice_pf *pf, enum ice_fltr_ptype flow) hw->fdir_prof[flow]->fdir_seg[0]) return -EINVAL; - seg = devm_kzalloc(dev, sizeof(*seg), GFP_KERNEL); + seg = devm_kzalloc_obj(dev, *seg); if (!seg) return -ENOMEM; - tun_seg = devm_kcalloc(dev, ICE_FD_HW_SEG_MAX, sizeof(*tun_seg), - GFP_KERNEL); + tun_seg = devm_kzalloc_objs(dev, *tun_seg, ICE_FD_HW_SEG_MAX); if (!tun_seg) { devm_kfree(dev, seg); return -ENOMEM; @@ -1311,12 +1308,11 @@ ice_cfg_fdir_xtrct_seq(struct ice_pf *pf, struct ethtool_rx_flow_spec *fsp, bool perfect_filter = false; int ret; - seg = devm_kzalloc(dev, sizeof(*seg), GFP_KERNEL); + seg = devm_kzalloc_obj(dev, *seg); if (!seg) return -ENOMEM; - tun_seg = devm_kcalloc(dev, ICE_FD_HW_SEG_MAX, sizeof(*tun_seg), - GFP_KERNEL); + tun_seg = devm_kzalloc_objs(dev, *tun_seg, ICE_FD_HW_SEG_MAX); if (!tun_seg) { devm_kfree(dev, seg); return -ENOMEM; @@ -2023,7 +2019,7 @@ int ice_add_ntuple_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd) return -ENOSPC; } - input = devm_kzalloc(dev, sizeof(*input), GFP_KERNEL); + input = devm_kzalloc_obj(dev, *input); if (!input) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c index bb1d12f952cf..2a054d3abd46 100644 --- a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c +++ b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c @@ -2228,44 +2228,42 @@ int ice_init_hw_tbls(struct ice_hw *hw) xlt1->sid = ice_blk_sids[i][ICE_SID_XLT1_OFF]; xlt1->count = blk_sizes[i].xlt1; - xlt1->ptypes = devm_kcalloc(ice_hw_to_dev(hw), xlt1->count, - sizeof(*xlt1->ptypes), GFP_KERNEL); + xlt1->ptypes = devm_kzalloc_objs(ice_hw_to_dev(hw), + *xlt1->ptypes, xlt1->count); if (!xlt1->ptypes) goto err; - xlt1->ptg_tbl = devm_kcalloc(ice_hw_to_dev(hw), ICE_MAX_PTGS, - sizeof(*xlt1->ptg_tbl), - GFP_KERNEL); + xlt1->ptg_tbl = devm_kzalloc_objs(ice_hw_to_dev(hw), + *xlt1->ptg_tbl, ICE_MAX_PTGS); if (!xlt1->ptg_tbl) goto err; - xlt1->t = devm_kcalloc(ice_hw_to_dev(hw), xlt1->count, - sizeof(*xlt1->t), GFP_KERNEL); + xlt1->t = devm_kzalloc_objs(ice_hw_to_dev(hw), *xlt1->t, + xlt1->count); if (!xlt1->t) goto err; xlt2->sid = ice_blk_sids[i][ICE_SID_XLT2_OFF]; xlt2->count = blk_sizes[i].xlt2; - xlt2->vsis = devm_kcalloc(ice_hw_to_dev(hw), xlt2->count, - sizeof(*xlt2->vsis), GFP_KERNEL); + xlt2->vsis = devm_kzalloc_objs(ice_hw_to_dev(hw), *xlt2->vsis, + xlt2->count); if (!xlt2->vsis) goto err; - xlt2->vsig_tbl = devm_kcalloc(ice_hw_to_dev(hw), xlt2->count, - sizeof(*xlt2->vsig_tbl), - GFP_KERNEL); + xlt2->vsig_tbl = devm_kzalloc_objs(ice_hw_to_dev(hw), + *xlt2->vsig_tbl, xlt2->count); if (!xlt2->vsig_tbl) goto err; for (j = 0; j < xlt2->count; j++) INIT_LIST_HEAD(&xlt2->vsig_tbl[j].prop_lst); - xlt2->t = devm_kcalloc(ice_hw_to_dev(hw), xlt2->count, - sizeof(*xlt2->t), GFP_KERNEL); + xlt2->t = devm_kzalloc_objs(ice_hw_to_dev(hw), *xlt2->t, + xlt2->count); if (!xlt2->t) goto err; @@ -2273,18 +2271,17 @@ int ice_init_hw_tbls(struct ice_hw *hw) prof->count = blk_sizes[i].prof_tcam; prof->max_prof_id = blk_sizes[i].prof_id; prof->cdid_bits = blk_sizes[i].prof_cdid_bits; - prof->t = devm_kcalloc(ice_hw_to_dev(hw), prof->count, - sizeof(*prof->t), GFP_KERNEL); + prof->t = devm_kzalloc_objs(ice_hw_to_dev(hw), *prof->t, + prof->count); if (!prof->t) goto err; prof_redir->sid = ice_blk_sids[i][ICE_SID_PR_REDIR_OFF]; prof_redir->count = blk_sizes[i].prof_redir; - prof_redir->t = devm_kcalloc(ice_hw_to_dev(hw), - prof_redir->count, - sizeof(*prof_redir->t), - GFP_KERNEL); + prof_redir->t = devm_kzalloc_objs(ice_hw_to_dev(hw), + *prof_redir->t, + prof_redir->count); if (!prof_redir->t) goto err; @@ -2292,36 +2289,34 @@ int ice_init_hw_tbls(struct ice_hw *hw) es->sid = ice_blk_sids[i][ICE_SID_ES_OFF]; es->count = blk_sizes[i].es; es->fvw = blk_sizes[i].fvw; - es->t = devm_kcalloc(ice_hw_to_dev(hw), - (u32)(es->count * es->fvw), - sizeof(*es->t), GFP_KERNEL); + es->t = devm_kzalloc_objs(ice_hw_to_dev(hw), *es->t, + (u32)(es->count * es->fvw)); if (!es->t) goto err; - es->ref_count = devm_kcalloc(ice_hw_to_dev(hw), es->count, - sizeof(*es->ref_count), - GFP_KERNEL); + es->ref_count = devm_kzalloc_objs(ice_hw_to_dev(hw), + *es->ref_count, es->count); if (!es->ref_count) goto err; - es->symm = devm_kcalloc(ice_hw_to_dev(hw), es->count, - sizeof(*es->symm), GFP_KERNEL); + es->symm = devm_kzalloc_objs(ice_hw_to_dev(hw), *es->symm, + es->count); if (!es->symm) goto err; - es->written = devm_kcalloc(ice_hw_to_dev(hw), es->count, - sizeof(*es->written), GFP_KERNEL); + es->written = devm_kzalloc_objs(ice_hw_to_dev(hw), *es->written, + es->count); if (!es->written) goto err; - es->mask_ena = devm_kcalloc(ice_hw_to_dev(hw), es->count, - sizeof(*es->mask_ena), GFP_KERNEL); + es->mask_ena = devm_kzalloc_objs(ice_hw_to_dev(hw), + *es->mask_ena, es->count); if (!es->mask_ena) goto err; prof_id->count = blk_sizes[i].prof_id; - prof_id->id = devm_kcalloc(ice_hw_to_dev(hw), prof_id->count, - sizeof(*prof_id->id), GFP_KERNEL); + prof_id->id = devm_kzalloc_objs(ice_hw_to_dev(hw), *prof_id->id, + prof_id->count); if (!prof_id->id) goto err; } @@ -3086,7 +3081,7 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, ice_prof_inc_ref(hw, blk, prof_id); /* add profile info */ - prof = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*prof), GFP_KERNEL); + prof = devm_kzalloc_obj(ice_hw_to_dev(hw), *prof); if (!prof) { status = -ENOMEM; goto err_ice_add_prof; @@ -3270,8 +3265,7 @@ ice_rem_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, struct ice_vsig_vsi *tmp = vsi_cur->next_vsi; struct ice_chs_chg *p; - p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*p), - GFP_KERNEL); + p = devm_kzalloc_obj(ice_hw_to_dev(hw), *p); if (!p) return -ENOMEM; @@ -3426,8 +3420,7 @@ ice_get_prof(struct ice_hw *hw, enum ice_block blk, u64 hdl, for (i = 0; i < map->ptg_cnt; i++) if (!hw->blk[blk].es.written[map->prof_id]) { /* add ES to change list */ - p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*p), - GFP_KERNEL); + p = devm_kzalloc_obj(ice_hw_to_dev(hw), *p); if (!p) { status = -ENOMEM; goto err_ice_get_prof; @@ -3515,7 +3508,7 @@ ice_add_prof_to_lst(struct ice_hw *hw, enum ice_block blk, goto err_ice_add_prof_to_lst; } - p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(ice_hw_to_dev(hw), *p); if (!p) { status = -ENOMEM; goto err_ice_add_prof_to_lst; @@ -3554,7 +3547,7 @@ ice_move_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 vsig, u16 orig_vsig; int status; - p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(ice_hw_to_dev(hw), *p); if (!p) return -ENOMEM; @@ -3656,7 +3649,7 @@ ice_prof_tcam_ena_dis(struct ice_hw *hw, enum ice_block blk, bool enable, return status; /* add TCAM to change list */ - p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(ice_hw_to_dev(hw), *p); if (!p) return -ENOMEM; @@ -3828,7 +3821,7 @@ ice_add_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl, return -EEXIST; /* new VSIG profile structure */ - t = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*t), GFP_KERNEL); + t = devm_kzalloc_obj(ice_hw_to_dev(hw), *t); if (!t) return -ENOMEM; @@ -3849,7 +3842,7 @@ ice_add_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl, u16 tcam_idx; /* add TCAM to change list */ - p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(ice_hw_to_dev(hw), *p); if (!p) { status = -ENOMEM; goto err_ice_add_prof_id_vsig; @@ -3933,7 +3926,7 @@ ice_create_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl, u16 new_vsig; int status; - p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(ice_hw_to_dev(hw), *p); if (!p) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/ice/ice_flow.c b/drivers/net/ethernet/intel/ice/ice_flow.c index 121552c644cd..837716e3da44 100644 --- a/drivers/net/ethernet/intel/ice/ice_flow.c +++ b/drivers/net/ethernet/intel/ice/ice_flow.c @@ -1472,8 +1472,7 @@ ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk, if (!params) return -ENOMEM; - params->prof = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*params->prof), - GFP_KERNEL); + params->prof = devm_kzalloc_obj(ice_hw_to_dev(hw), *params->prof); if (!params->prof) { status = -ENOMEM; goto free_params; @@ -1819,7 +1818,7 @@ ice_flow_add_entry(struct ice_hw *hw, enum ice_block blk, u64 prof_id, /* Allocate memory for the entry being added and associate * the VSI to the found flow profile */ - e = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*e), GFP_KERNEL); + e = devm_kzalloc_obj(ice_hw_to_dev(hw), *e); if (!e) status = -ENOMEM; else @@ -2258,8 +2257,7 @@ ice_add_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof) return 0; } - rss_cfg = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*rss_cfg), - GFP_KERNEL); + rss_cfg = devm_kzalloc_obj(ice_hw_to_dev(hw), *rss_cfg); if (!rss_cfg) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/ice/ice_fltr.c b/drivers/net/ethernet/intel/ice/ice_fltr.c index aff7a141c30d..9bcd5d398a26 100644 --- a/drivers/net/ethernet/intel/ice/ice_fltr.c +++ b/drivers/net/ethernet/intel/ice/ice_fltr.c @@ -34,7 +34,7 @@ ice_fltr_add_entry_to_list(struct device *dev, struct ice_fltr_info *info, { struct ice_fltr_list_entry *entry; - entry = devm_kzalloc(dev, sizeof(*entry), GFP_ATOMIC); + entry = devm_kzalloc_obj(dev, *entry, GFP_ATOMIC); if (!entry) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index 7cd2dd066ef5..977cd8dd6e31 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -80,13 +80,11 @@ static int ice_vsi_alloc_arrays(struct ice_vsi *vsi) return 0; /* allocate memory for both Tx and Rx ring pointers */ - vsi->tx_rings = devm_kcalloc(dev, vsi->alloc_txq, - sizeof(*vsi->tx_rings), GFP_KERNEL); + vsi->tx_rings = devm_kzalloc_objs(dev, *vsi->tx_rings, vsi->alloc_txq); if (!vsi->tx_rings) return -ENOMEM; - vsi->rx_rings = devm_kcalloc(dev, vsi->alloc_rxq, - sizeof(*vsi->rx_rings), GFP_KERNEL); + vsi->rx_rings = devm_kzalloc_objs(dev, *vsi->rx_rings, vsi->alloc_rxq); if (!vsi->rx_rings) goto err_rings; @@ -96,20 +94,19 @@ static int ice_vsi_alloc_arrays(struct ice_vsi *vsi) * per CPU, regardless of queue count settings from user that might * have come from ethtool's set_channels() callback; */ - vsi->txq_map = devm_kcalloc(dev, (vsi->alloc_txq + num_possible_cpus()), - sizeof(*vsi->txq_map), GFP_KERNEL); + vsi->txq_map = devm_kzalloc_objs(dev, *vsi->txq_map, + (vsi->alloc_txq + num_possible_cpus())); if (!vsi->txq_map) goto err_txq_map; - vsi->rxq_map = devm_kcalloc(dev, vsi->alloc_rxq, - sizeof(*vsi->rxq_map), GFP_KERNEL); + vsi->rxq_map = devm_kzalloc_objs(dev, *vsi->rxq_map, vsi->alloc_rxq); if (!vsi->rxq_map) goto err_rxq_map; /* allocate memory for q_vector pointers */ - vsi->q_vectors = devm_kcalloc(dev, vsi->num_q_vectors, - sizeof(*vsi->q_vectors), GFP_KERNEL); + vsi->q_vectors = devm_kzalloc_objs(dev, *vsi->q_vectors, + vsi->num_q_vectors); if (!vsi->q_vectors) goto err_vectors; @@ -731,7 +728,7 @@ struct ice_vsi *ice_vsi_alloc(struct ice_pf *pf) goto unlock_pf; } - vsi = devm_kzalloc(dev, sizeof(*vsi), GFP_KERNEL); + vsi = devm_kzalloc_obj(dev, *vsi); if (!vsi) goto unlock_pf; diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 454fba07d4ec..47c6798c97e8 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -2697,8 +2697,8 @@ int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog, int status, i; dev = ice_pf_to_dev(pf); - vsi->xdp_rings = devm_kcalloc(dev, vsi->num_xdp_txq, - sizeof(*vsi->xdp_rings), GFP_KERNEL); + vsi->xdp_rings = devm_kzalloc_objs(dev, *vsi->xdp_rings, + vsi->num_xdp_txq); if (!vsi->xdp_rings) return -ENOMEM; @@ -4912,13 +4912,12 @@ static int ice_alloc_vsis(struct ice_pf *pf) pf->num_alloc_vsi = UDP_TUNNEL_NIC_MAX_SHARING_DEVICES; } - pf->vsi = devm_kcalloc(dev, pf->num_alloc_vsi, sizeof(*pf->vsi), - GFP_KERNEL); + pf->vsi = devm_kzalloc_objs(dev, *pf->vsi, pf->num_alloc_vsi); if (!pf->vsi) return -ENOMEM; - pf->vsi_stats = devm_kcalloc(dev, pf->num_alloc_vsi, - sizeof(*pf->vsi_stats), GFP_KERNEL); + pf->vsi_stats = devm_kzalloc_objs(dev, *pf->vsi_stats, + pf->num_alloc_vsi); if (!pf->vsi_stats) { devm_kfree(dev, pf->vsi); return -ENOMEM; diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index 7980eaf9ce25..20561ba99e72 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -2549,9 +2549,9 @@ static void ice_ptp_set_funcs_e810(struct ice_pf *pf) } err = 0; } else { - desc = devm_kcalloc(ice_pf_to_dev(pf), ICE_N_PINS_MAX, - sizeof(struct ice_ptp_pin_desc), - GFP_KERNEL); + desc = devm_kzalloc_objs(ice_pf_to_dev(pf), + struct ice_ptp_pin_desc, + ICE_N_PINS_MAX); if (!desc) goto err; diff --git a/drivers/net/ethernet/intel/ice/ice_sched.c b/drivers/net/ethernet/intel/ice/ice_sched.c index ffa18d86729a..a5c7a4e1ceba 100644 --- a/drivers/net/ethernet/intel/ice/ice_sched.c +++ b/drivers/net/ethernet/intel/ice/ice_sched.c @@ -24,12 +24,12 @@ ice_sched_add_root_node(struct ice_port_info *pi, hw = pi->hw; - root = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*root), GFP_KERNEL); + root = devm_kzalloc_obj(ice_hw_to_dev(hw), *root); if (!root) return -ENOMEM; - root->children = devm_kcalloc(ice_hw_to_dev(hw), hw->max_children[0], - sizeof(*root->children), GFP_KERNEL); + root->children = devm_kzalloc_objs(ice_hw_to_dev(hw), *root->children, + hw->max_children[0]); if (!root->children) { devm_kfree(ice_hw_to_dev(hw), root); return -ENOMEM; @@ -202,13 +202,13 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer, if (prealloc_node) node = prealloc_node; else - node = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*node), GFP_KERNEL); + node = devm_kzalloc_obj(ice_hw_to_dev(hw), *node); if (!node) return -ENOMEM; if (hw->max_children[layer]) { - node->children = devm_kcalloc(ice_hw_to_dev(hw), - hw->max_children[layer], - sizeof(*node->children), GFP_KERNEL); + node->children = devm_kzalloc_objs(ice_hw_to_dev(hw), + *node->children, + hw->max_children[layer]); if (!node->children) { devm_kfree(ice_hw_to_dev(hw), node); return -ENOMEM; @@ -583,8 +583,7 @@ ice_alloc_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs) return -EINVAL; /* allocate LAN queue contexts */ if (!vsi_ctx->lan_q_ctx[tc]) { - q_ctx = devm_kcalloc(ice_hw_to_dev(hw), new_numqs, - sizeof(*q_ctx), GFP_KERNEL); + q_ctx = devm_kzalloc_objs(ice_hw_to_dev(hw), *q_ctx, new_numqs); if (!q_ctx) return -ENOMEM; @@ -601,8 +600,7 @@ ice_alloc_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs) if (new_numqs > vsi_ctx->num_lan_q_entries[tc]) { u16 prev_num = vsi_ctx->num_lan_q_entries[tc]; - q_ctx = devm_kcalloc(ice_hw_to_dev(hw), new_numqs, - sizeof(*q_ctx), GFP_KERNEL); + q_ctx = devm_kzalloc_objs(ice_hw_to_dev(hw), *q_ctx, new_numqs); if (!q_ctx) return -ENOMEM; @@ -639,10 +637,8 @@ ice_alloc_rdma_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs) return -EINVAL; /* allocate RDMA queue contexts */ if (!vsi_ctx->rdma_q_ctx[tc]) { - vsi_ctx->rdma_q_ctx[tc] = devm_kcalloc(ice_hw_to_dev(hw), - new_numqs, - sizeof(*q_ctx), - GFP_KERNEL); + vsi_ctx->rdma_q_ctx[tc] = devm_kzalloc_objs(ice_hw_to_dev(hw), + *q_ctx, new_numqs); if (!vsi_ctx->rdma_q_ctx[tc]) return -ENOMEM; vsi_ctx->num_rdma_q_entries[tc] = new_numqs; @@ -652,8 +648,7 @@ ice_alloc_rdma_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs) if (new_numqs > vsi_ctx->num_rdma_q_entries[tc]) { u16 prev_num = vsi_ctx->num_rdma_q_entries[tc]; - q_ctx = devm_kcalloc(ice_hw_to_dev(hw), new_numqs, - sizeof(*q_ctx), GFP_KERNEL); + q_ctx = devm_kzalloc_objs(ice_hw_to_dev(hw), *q_ctx, new_numqs); if (!q_ctx) return -ENOMEM; memcpy(q_ctx, vsi_ctx->rdma_q_ctx[tc], @@ -1353,7 +1348,7 @@ int ice_sched_query_res_alloc(struct ice_hw *hw) if (hw->layer_info) return status; - buf = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*buf), GFP_KERNEL); + buf = devm_kzalloc_obj(ice_hw_to_dev(hw), *buf); if (!buf) return -ENOMEM; @@ -2738,8 +2733,7 @@ ice_sched_cfg_agg(struct ice_port_info *pi, u32 agg_id, agg_info = ice_get_agg_info(hw, agg_id); if (!agg_info) { /* Create new entry for new aggregator ID */ - agg_info = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*agg_info), - GFP_KERNEL); + agg_info = devm_kzalloc_obj(ice_hw_to_dev(hw), *agg_info); if (!agg_info) return -ENOMEM; @@ -2922,8 +2916,8 @@ ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id, agg_vsi_info = ice_get_agg_vsi_info(agg_info, vsi_handle); if (!agg_vsi_info) { /* Create new entry for VSI under aggregator list */ - agg_vsi_info = devm_kzalloc(ice_hw_to_dev(hw), - sizeof(*agg_vsi_info), GFP_KERNEL); + agg_vsi_info = devm_kzalloc_obj(ice_hw_to_dev(hw), + *agg_vsi_info); if (!agg_vsi_info) return -EINVAL; @@ -3340,8 +3334,7 @@ ice_sched_add_rl_profile(struct ice_port_info *pi, return rl_prof_elem; /* Create new profile ID */ - rl_prof_elem = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*rl_prof_elem), - GFP_KERNEL); + rl_prof_elem = devm_kzalloc_obj(ice_hw_to_dev(hw), *rl_prof_elem); if (!rl_prof_elem) return NULL; diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c index 4daee252e2a6..d873eda9af82 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -1463,8 +1463,8 @@ int ice_init_def_sw_recp(struct ice_hw *hw) struct ice_sw_recipe *recps; u8 i; - recps = devm_kcalloc(ice_hw_to_dev(hw), ICE_MAX_NUM_RECIPES, - sizeof(*recps), GFP_KERNEL); + recps = devm_kzalloc_objs(ice_hw_to_dev(hw), *recps, + ICE_MAX_NUM_RECIPES); if (!recps) return -ENOMEM; @@ -1771,8 +1771,7 @@ ice_add_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, tmp_vsi_ctx = ice_get_vsi_ctx(hw, vsi_handle); if (!tmp_vsi_ctx) { /* Create a new VSI context */ - tmp_vsi_ctx = devm_kzalloc(ice_hw_to_dev(hw), - sizeof(*tmp_vsi_ctx), GFP_KERNEL); + tmp_vsi_ctx = devm_kzalloc_obj(ice_hw_to_dev(hw), *tmp_vsi_ctx); if (!tmp_vsi_ctx) { ice_aq_free_vsi(hw, vsi_ctx, false, cd); return -ENOMEM; @@ -2851,7 +2850,7 @@ ice_create_vsi_list_map(struct ice_hw *hw, u16 *vsi_handle_arr, u16 num_vsi, struct ice_vsi_list_map_info *v_map; int i; - v_map = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*v_map), GFP_KERNEL); + v_map = devm_kzalloc_obj(ice_hw_to_dev(hw), *v_map); if (!v_map) return NULL; @@ -2981,8 +2980,7 @@ ice_create_pkt_fwd_rule(struct ice_hw *hw, GFP_KERNEL); if (!s_rule) return -ENOMEM; - fm_entry = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*fm_entry), - GFP_KERNEL); + fm_entry = devm_kzalloc_obj(ice_hw_to_dev(hw), *fm_entry); if (!fm_entry) { status = -ENOMEM; goto ice_create_pkt_fwd_rule_exit; @@ -4121,7 +4119,7 @@ ice_add_entry_to_vsi_fltr_list(struct ice_hw *hw, u16 vsi_handle, /* this memory is freed up in the caller function * once filters for this VSI are removed */ - tmp = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*tmp), GFP_KERNEL); + tmp = devm_kzalloc_obj(ice_hw_to_dev(hw), *tmp); if (!tmp) return -ENOMEM; @@ -6231,9 +6229,8 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, NULL); if (status) goto err_ice_add_adv_rule; - adv_fltr = devm_kzalloc(ice_hw_to_dev(hw), - sizeof(struct ice_adv_fltr_mgmt_list_entry), - GFP_KERNEL); + adv_fltr = devm_kzalloc_obj(ice_hw_to_dev(hw), + struct ice_adv_fltr_mgmt_list_entry); if (!adv_fltr) { status = -ENOMEM; goto err_ice_add_adv_rule; diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c index a2c7c4962882..35a480a1e172 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c @@ -482,8 +482,7 @@ int ice_setup_tx_ring(struct ice_tx_ring *tx_ring) /* warn if we are about to overwrite the pointer */ WARN_ON(tx_ring->tx_buf); tx_ring->tx_buf = - devm_kcalloc(dev, sizeof(*tx_ring->tx_buf), tx_ring->count, - GFP_KERNEL); + devm_kzalloc_objs(dev, *tx_ring->tx_buf, tx_ring->count); if (!tx_ring->tx_buf) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/ice/ice_vlan_mode.c b/drivers/net/ethernet/intel/ice/ice_vlan_mode.c index fb526cb84776..92c6f83a7efe 100644 --- a/drivers/net/ethernet/intel/ice/ice_vlan_mode.c +++ b/drivers/net/ethernet/intel/ice/ice_vlan_mode.c @@ -360,8 +360,7 @@ static int ice_set_svm(struct ice_hw *hw) return status; } - set_params = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*set_params), - GFP_KERNEL); + set_params = devm_kzalloc_obj(ice_hw_to_dev(hw), *set_params); if (!set_params) return -ENOMEM; diff --git a/drivers/net/ethernet/intel/ice/virt/fdir.c b/drivers/net/ethernet/intel/ice/virt/fdir.c index eca9eda04f31..aeddb9152822 100644 --- a/drivers/net/ethernet/intel/ice/virt/fdir.c +++ b/drivers/net/ethernet/intel/ice/virt/fdir.c @@ -174,18 +174,16 @@ ice_vc_fdir_alloc_prof(struct ice_vf *vf, enum ice_fltr_ptype flow) struct ice_vf_fdir *fdir = &vf->fdir; if (!fdir->fdir_prof) { - fdir->fdir_prof = devm_kcalloc(ice_pf_to_dev(vf->pf), - ICE_FLTR_PTYPE_MAX, - sizeof(*fdir->fdir_prof), - GFP_KERNEL); + fdir->fdir_prof = devm_kzalloc_objs(ice_pf_to_dev(vf->pf), + *fdir->fdir_prof, + ICE_FLTR_PTYPE_MAX); if (!fdir->fdir_prof) return -ENOMEM; } if (!fdir->fdir_prof[flow]) { - fdir->fdir_prof[flow] = devm_kzalloc(ice_pf_to_dev(vf->pf), - sizeof(**fdir->fdir_prof), - GFP_KERNEL); + fdir->fdir_prof[flow] = devm_kzalloc_obj(ice_pf_to_dev(vf->pf), + **fdir->fdir_prof); if (!fdir->fdir_prof[flow]) return -ENOMEM; } @@ -768,7 +766,7 @@ ice_vc_fdir_config_input_set(struct ice_vf *vf, struct virtchnl_fdir_add *fltr, return ret; } - seg = devm_kzalloc(dev, sizeof(*seg), GFP_KERNEL); + seg = devm_kzalloc_obj(dev, *seg); if (!seg) return -ENOMEM; @@ -2135,7 +2133,7 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg) goto err_exit; } - conf = devm_kzalloc(dev, sizeof(*conf), GFP_KERNEL); + conf = devm_kzalloc_obj(dev, *conf); if (!conf) { v_ret = VIRTCHNL_STATUS_ERR_NO_MEMORY; dev_dbg(dev, "Alloc conf for VF %d failed\n", vf->vf_id); diff --git a/drivers/net/ethernet/intel/igb/igb_hwmon.c b/drivers/net/ethernet/intel/igb/igb_hwmon.c index 21a29a0ca7f4..3d257f509c36 100644 --- a/drivers/net/ethernet/intel/igb/igb_hwmon.c +++ b/drivers/net/ethernet/intel/igb/igb_hwmon.c @@ -166,8 +166,7 @@ int igb_sysfs_init(struct igb_adapter *adapter) if (rc) goto exit; - igb_hwmon = devm_kzalloc(&adapter->pdev->dev, sizeof(*igb_hwmon), - GFP_KERNEL); + igb_hwmon = devm_kzalloc_obj(&adapter->pdev->dev, *igb_hwmon); if (!igb_hwmon) { rc = -ENOMEM; goto exit; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c index 204844288c16..5aefb77e346d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c @@ -159,8 +159,7 @@ int ixgbe_sysfs_init(struct ixgbe_adapter *adapter) if (adapter->hw.mac.ops.init_thermal_sensor_thresh(&adapter->hw)) goto exit; - ixgbe_hwmon = devm_kzalloc(&adapter->pdev->dev, sizeof(*ixgbe_hwmon), - GFP_KERNEL); + ixgbe_hwmon = devm_kzalloc_obj(&adapter->pdev->dev, *ixgbe_hwmon); if (ixgbe_hwmon == NULL) { rc = -ENOMEM; goto exit; diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index f95c4eda86b0..ff6d0a086ca9 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -2815,7 +2815,7 @@ static int mv643xx_eth_shared_of_probe(struct platform_device *pdev) if (!np) return 0; - pd = devm_kzalloc(&pdev->dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(&pdev->dev, *pd); if (!pd) return -ENOMEM; pdev->dev.platform_data = pd; @@ -2855,7 +2855,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev) pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n", mv643xx_eth_driver_version); - msp = devm_kzalloc(&pdev->dev, sizeof(*msp), GFP_KERNEL); + msp = devm_kzalloc_obj(&pdev->dev, *msp); if (msp == NULL) return -ENOMEM; platform_set_drvdata(pdev, msp); diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index ea755cf05b9e..915c4c35364a 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -5371,7 +5371,7 @@ static int mvneta_init(struct device *dev, struct mvneta_port *pp) /* Set port default values */ mvneta_defaults_set(pp); - pp->txqs = devm_kcalloc(dev, txq_number, sizeof(*pp->txqs), GFP_KERNEL); + pp->txqs = devm_kzalloc_objs(dev, *pp->txqs, txq_number); if (!pp->txqs) return -ENOMEM; @@ -5383,7 +5383,7 @@ static int mvneta_init(struct device *dev, struct mvneta_port *pp) txq->done_pkts_coal = MVNETA_TXDONE_COAL_PKTS; } - pp->rxqs = devm_kcalloc(dev, rxq_number, sizeof(*pp->rxqs), GFP_KERNEL); + pp->rxqs = devm_kzalloc_objs(dev, *pp->rxqs, rxq_number); if (!pp->rxqs) return -ENOMEM; @@ -5395,10 +5395,8 @@ static int mvneta_init(struct device *dev, struct mvneta_port *pp) rxq->pkts_coal = MVNETA_RX_COAL_PKTS; rxq->time_coal = MVNETA_RX_COAL_USEC; rxq->buf_virt_addr - = devm_kmalloc_array(pp->dev->dev.parent, - rxq->size, - sizeof(*rxq->buf_virt_addr), - GFP_KERNEL); + = devm_kmalloc_objs(pp->dev->dev.parent, + *rxq->buf_virt_addr, rxq->size); if (!rxq->buf_virt_addr) return -ENOMEM; } diff --git a/drivers/net/ethernet/marvell/mvneta_bm.c b/drivers/net/ethernet/marvell/mvneta_bm.c index d6d76fbf27b6..41d654041939 100644 --- a/drivers/net/ethernet/marvell/mvneta_bm.c +++ b/drivers/net/ethernet/marvell/mvneta_bm.c @@ -362,9 +362,9 @@ static int mvneta_bm_init(struct mvneta_bm *priv) mvneta_bm_default_set(priv); /* Allocate and initialize BM pools structures */ - priv->bm_pools = devm_kcalloc(&priv->pdev->dev, MVNETA_BM_POOLS_NUM, - sizeof(struct mvneta_bm_pool), - GFP_KERNEL); + priv->bm_pools = devm_kzalloc_objs(&priv->pdev->dev, + struct mvneta_bm_pool, + MVNETA_BM_POOLS_NUM); if (!priv->bm_pools) return -ENOMEM; @@ -426,7 +426,7 @@ static int mvneta_bm_probe(struct platform_device *pdev) struct mvneta_bm *priv; int err; - priv = devm_kzalloc(&pdev->dev, sizeof(struct mvneta_bm), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct mvneta_bm); if (!priv) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 317af54369cf..35adcee9aa24 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -687,8 +687,7 @@ static int mvpp2_bm_init(struct device *dev, struct mvpp2 *priv) } /* Allocate and initialize BM pools */ - priv->bm_pools = devm_kcalloc(dev, poolnum, - sizeof(*priv->bm_pools), GFP_KERNEL); + priv->bm_pools = devm_kzalloc_objs(dev, *priv->bm_pools, poolnum); if (!priv->bm_pools) return -ENOMEM; @@ -6030,8 +6029,7 @@ static int mvpp2_port_init(struct mvpp2_port *port) port->tx_time_coal = MVPP2_TXDONE_COAL_USEC; - port->txqs = devm_kcalloc(dev, port->ntxqs, sizeof(*port->txqs), - GFP_KERNEL); + port->txqs = devm_kzalloc_objs(dev, *port->txqs, port->ntxqs); if (!port->txqs) return -ENOMEM; @@ -6042,7 +6040,7 @@ static int mvpp2_port_init(struct mvpp2_port *port) int queue_phy_id = mvpp2_txq_phys(port->id, queue); struct mvpp2_tx_queue *txq; - txq = devm_kzalloc(dev, sizeof(*txq), GFP_KERNEL); + txq = devm_kzalloc_obj(dev, *txq); if (!txq) { err = -ENOMEM; goto err_free_percpu; @@ -6065,8 +6063,7 @@ static int mvpp2_port_init(struct mvpp2_port *port) port->txqs[queue] = txq; } - port->rxqs = devm_kcalloc(dev, port->nrxqs, sizeof(*port->rxqs), - GFP_KERNEL); + port->rxqs = devm_kzalloc_objs(dev, *port->rxqs, port->nrxqs); if (!port->rxqs) { err = -ENOMEM; goto err_free_percpu; @@ -6077,7 +6074,7 @@ static int mvpp2_port_init(struct mvpp2_port *port) struct mvpp2_rx_queue *rxq; /* Map physical Rx queue to port's logical Rx queue */ - rxq = devm_kzalloc(dev, sizeof(*rxq), GFP_KERNEL); + rxq = devm_kzalloc_obj(dev, *rxq); if (!rxq) { err = -ENOMEM; goto err_free_percpu; @@ -6984,9 +6981,8 @@ static int mvpp2_port_probe(struct platform_device *pdev, goto err_free_irq; } - port->ethtool_stats = devm_kcalloc(&pdev->dev, - MVPP2_N_ETHTOOL_STATS(ntxqs, nrxqs), - sizeof(u64), GFP_KERNEL); + port->ethtool_stats = devm_kzalloc_objs(&pdev->dev, u64, + MVPP2_N_ETHTOOL_STATS(ntxqs, nrxqs)); if (!port->ethtool_stats) { err = -ENOMEM; goto err_free_stats; @@ -7506,9 +7502,8 @@ static int mvpp2_init(struct platform_device *pdev, struct mvpp2 *priv) } /* Allocate and initialize aggregated TXQs */ - priv->aggr_txqs = devm_kcalloc(&pdev->dev, MVPP2_MAX_THREADS, - sizeof(*priv->aggr_txqs), - GFP_KERNEL); + priv->aggr_txqs = devm_kzalloc_objs(&pdev->dev, *priv->aggr_txqs, + MVPP2_MAX_THREADS); if (!priv->aggr_txqs) return -ENOMEM; @@ -7584,7 +7579,7 @@ static int mvpp2_probe(struct platform_device *pdev) int i, shared; int err; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c index ad677cfddb4d..930800941816 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c @@ -2157,15 +2157,13 @@ int mvpp2_prs_default_init(struct platform_device *pdev, struct mvpp2 *priv) { int err, index, i; - priv->prs_shadow = devm_kcalloc(&pdev->dev, MVPP2_PRS_TCAM_SRAM_SIZE, - sizeof(*priv->prs_shadow), - GFP_KERNEL); + priv->prs_shadow = devm_kzalloc_objs(&pdev->dev, *priv->prs_shadow, + MVPP2_PRS_TCAM_SRAM_SIZE); if (!priv->prs_shadow) return -ENOMEM; - priv->prs_double_vlans = devm_kcalloc(&pdev->dev, sizeof(bool), - MVPP2_PRS_DBL_VLANS_MAX, - GFP_KERNEL); + priv->prs_double_vlans = devm_kzalloc_objs(&pdev->dev, bool, + MVPP2_PRS_DBL_VLANS_MAX); if (!priv->prs_double_vlans) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c index 95862aff49f1..fca0d1354fcf 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c @@ -395,7 +395,7 @@ int mvpp22_tai_probe(struct device *dev, struct mvpp2 *priv) struct mvpp2_tai *tai; int ret; - tai = devm_kzalloc(dev, sizeof(*tai), GFP_KERNEL); + tai = devm_kzalloc_obj(dev, *tai); if (!tai) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c index ade394c2beba..f6f629423837 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c @@ -1959,7 +1959,7 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct cgx *cgx; int err, nvec; - cgx = devm_kzalloc(dev, sizeof(*cgx), GFP_KERNEL); + cgx = devm_kzalloc_obj(dev, *cgx); if (!cgx) return -ENOMEM; cgx->pdev = pdev; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c index b6fda42e44c7..16b0ba6e1d41 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c @@ -398,7 +398,7 @@ int npc_cn20k_debugfs_init(struct rvu *rvu) debugfs_create_file("vidx2idx", 0444, rvu->rvu_dbg.npc, npc_priv, &npc_vidx2idx_map_fops); - dstats = devm_kzalloc(rvu->dev, sizeof(*dstats), GFP_KERNEL); + dstats = devm_kzalloc_obj(rvu->dev, *dstats); if (!dstats) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c index 01f32adac599..10ff6e113a17 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c @@ -42,8 +42,7 @@ int cn20k_register_afvf_mbox_intr(struct rvu *rvu, int pf_vec_start) int err; /* irq data for 4 VFPF intr vectors */ - irq_data = devm_kcalloc(rvu->dev, 4, - sizeof(struct rvu_irq_data), GFP_KERNEL); + irq_data = devm_kzalloc_objs(rvu->dev, struct rvu_irq_data, 4); if (!irq_data) return -ENOMEM; @@ -174,8 +173,7 @@ int cn20k_register_afpf_mbox_intr(struct rvu *rvu) int intr_vec, ret, vec = 0; /* irq data for 4 PF intr vectors */ - irq_data = devm_kcalloc(rvu->dev, 4, - sizeof(struct rvu_irq_data), GFP_KERNEL); + irq_data = devm_kzalloc_objs(rvu->dev, struct rvu_irq_data, 4); if (!irq_data) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/common.h b/drivers/net/ethernet/marvell/octeontx2/af/common.h index 78e42549d990..1a378d78463d 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/common.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/common.h @@ -84,7 +84,7 @@ static inline int qmem_alloc(struct device *dev, struct qmem **q, if (!qsize) return -EINVAL; - *q = devm_kzalloc(dev, sizeof(*qmem), GFP_KERNEL); + *q = devm_kzalloc_obj(dev, *qmem); if (!*q) return -ENOMEM; qmem = *q; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c index 30c672d526a0..6784c0a6be54 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c @@ -1520,11 +1520,11 @@ static int mcs_probe(struct pci_dev *pdev, const struct pci_device_id *id) int lmac, err = 0; struct mcs *mcs; - mcs = devm_kzalloc(dev, sizeof(*mcs), GFP_KERNEL); + mcs = devm_kzalloc_obj(dev, *mcs); if (!mcs) return -ENOMEM; - mcs->hw = devm_kzalloc(dev, sizeof(struct hwinfo), GFP_KERNEL); + mcs->hw = devm_kzalloc_obj(dev, struct hwinfo); if (!mcs->hw) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c b/drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c index fce22e314cac..cd9cca5a9cf5 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c @@ -899,13 +899,13 @@ int rvu_mcs_init(struct rvu *rvu) mcs->rvu = rvu; /* Allocated memory for PFVF data */ - mcs->pf = devm_kcalloc(mcs->dev, hw->total_pfs, - sizeof(struct mcs_pfvf), GFP_KERNEL); + mcs->pf = devm_kzalloc_objs(mcs->dev, struct mcs_pfvf, + hw->total_pfs); if (!mcs->pf) return -ENOMEM; - mcs->vf = devm_kcalloc(mcs->dev, hw->total_vfs, - sizeof(struct mcs_pfvf), GFP_KERNEL); + mcs->vf = devm_kzalloc_objs(mcs->dev, struct mcs_pfvf, + hw->total_vfs); if (!mcs->vf) return -ENOMEM; } diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c index 30e148291581..777111caa8e3 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c @@ -628,8 +628,8 @@ static int rvu_setup_msix_resources(struct rvu *rvu) return err; /* Allocate memory for MSIX vector to RVU block LF mapping */ - pfvf->msix_lfmap = devm_kcalloc(rvu->dev, pfvf->msix.max, - sizeof(u16), GFP_KERNEL); + pfvf->msix_lfmap = devm_kzalloc_objs(rvu->dev, u16, + pfvf->msix.max); if (!pfvf->msix_lfmap) return -ENOMEM; @@ -665,8 +665,7 @@ setup_vfmsix: return err; pfvf->msix_lfmap = - devm_kcalloc(rvu->dev, pfvf->msix.max, - sizeof(u16), GFP_KERNEL); + devm_kzalloc_objs(rvu->dev, u16, pfvf->msix.max); if (!pfvf->msix_lfmap) return -ENOMEM; @@ -1095,16 +1094,14 @@ cpt: } /* Allocate memory for PFVF data */ - rvu->pf = devm_kcalloc(rvu->dev, hw->total_pfs, - sizeof(struct rvu_pfvf), GFP_KERNEL); + rvu->pf = devm_kzalloc_objs(rvu->dev, struct rvu_pfvf, hw->total_pfs); if (!rvu->pf) { dev_err(rvu->dev, "%s: Failed to allocate memory for PF's rvu_pfvf struct\n", __func__); return -ENOMEM; } - rvu->hwvf = devm_kcalloc(rvu->dev, hw->total_vfs, - sizeof(struct rvu_pfvf), GFP_KERNEL); + rvu->hwvf = devm_kzalloc_objs(rvu->dev, struct rvu_pfvf, hw->total_vfs); if (!rvu->hwvf) { dev_err(rvu->dev, "%s: Failed to allocate memory for VF's rvu_pfvf struct\n", __func__); @@ -1128,8 +1125,7 @@ cpt: continue; /* Allocate memory for block LF/slot to pcifunc mapping info */ - block->fn_map = devm_kcalloc(rvu->dev, block->lf.max, - sizeof(u16), GFP_KERNEL); + block->fn_map = devm_kzalloc_objs(rvu->dev, u16, block->lf.max); if (!block->fn_map) { err = -ENOMEM; goto msix_err; @@ -1239,7 +1235,7 @@ int rvu_aq_alloc(struct rvu *rvu, struct admin_queue **ad_queue, struct admin_queue *aq; int err; - *ad_queue = devm_kzalloc(rvu->dev, sizeof(*aq), GFP_KERNEL); + *ad_queue = devm_kzalloc_obj(rvu->dev, *aq); if (!*ad_queue) return -ENOMEM; aq = *ad_queue; @@ -2599,7 +2595,7 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, } if (!rvu->ng_rvu) { - ng_rvu_mbox = devm_kzalloc(rvu->dev, sizeof(*ng_rvu_mbox), GFP_KERNEL); + ng_rvu_mbox = devm_kzalloc_obj(rvu->dev, *ng_rvu_mbox); if (!ng_rvu_mbox) { err = -ENOMEM; goto free_bitmap; @@ -2653,15 +2649,13 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, goto unmap_regions; } - mw->mbox_wrk = devm_kcalloc(rvu->dev, num, - sizeof(struct rvu_work), GFP_KERNEL); + mw->mbox_wrk = devm_kzalloc_objs(rvu->dev, struct rvu_work, num); if (!mw->mbox_wrk) { err = -ENOMEM; goto exit; } - mw->mbox_wrk_up = devm_kcalloc(rvu->dev, num, - sizeof(struct rvu_work), GFP_KERNEL); + mw->mbox_wrk_up = devm_kzalloc_objs(rvu->dev, struct rvu_work, num); if (!mw->mbox_wrk_up) { err = -ENOMEM; goto exit; @@ -3153,8 +3147,7 @@ static int rvu_register_interrupts(struct rvu *rvu) if (!rvu->irq_name) return -ENOMEM; - rvu->irq_allocated = devm_kcalloc(rvu->dev, rvu->num_vec, - sizeof(bool), GFP_KERNEL); + rvu->irq_allocated = devm_kzalloc_objs(rvu->dev, bool, rvu->num_vec); if (!rvu->irq_allocated) return -ENOMEM; @@ -3376,8 +3369,7 @@ static int rvu_flr_init(struct rvu *rvu) return -ENOMEM; num_devs = rvu->hw->total_pfs + pci_sriov_get_totalvfs(rvu->pdev); - rvu->flr_wrk = devm_kcalloc(rvu->dev, num_devs, - sizeof(struct rvu_work), GFP_KERNEL); + rvu->flr_wrk = devm_kzalloc_objs(rvu->dev, struct rvu_work, num_devs); if (!rvu->flr_wrk) { destroy_workqueue(rvu->flr_wq); return -ENOMEM; @@ -3564,13 +3556,13 @@ static int rvu_probe(struct pci_dev *pdev, const struct pci_device_id *id) return -EBUSY; } - rvu = devm_kzalloc(dev, sizeof(*rvu), GFP_KERNEL); + rvu = devm_kzalloc_obj(dev, *rvu); if (!rvu) { atomic_set(&device_bound, 0); return -ENOMEM; } - rvu->hw = devm_kzalloc(dev, sizeof(struct rvu_hwinfo), GFP_KERNEL); + rvu->hw = devm_kzalloc_obj(dev, struct rvu_hwinfo); if (!rvu->hw) { devm_kfree(dev, rvu); atomic_set(&device_bound, 0); diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c index 33e3a627c359..b07e4068887f 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c @@ -3106,7 +3106,7 @@ static void rvu_dbg_cgx_init(struct rvu *rvu) rvu->rvu_dbg.cgx = debugfs_create_dir(dname, rvu->rvu_dbg.cgx_root); - ctx = devm_kzalloc(rvu->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(rvu->dev, *ctx); if (!ctx) continue; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c index 97a3db66a50c..199723d5ec94 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c @@ -541,8 +541,7 @@ static int nix_setup_bpids(struct rvu *rvu, struct nix_hw *hw, int blkaddr) if (err) return err; - bp->fn_map = devm_kcalloc(rvu->dev, bp->bpids.max, - sizeof(u16), GFP_KERNEL); + bp->fn_map = devm_kzalloc_objs(rvu->dev, u16, bp->bpids.max); if (!bp->fn_map) goto free_bpids; @@ -3796,8 +3795,7 @@ static int nix_setup_txvlan(struct rvu *rvu, struct nix_hw *nix_hw) return -ENOMEM; /* Alloc memory for saving entry to RVU PFFUNC allocation mapping */ - vlan->entry2pfvf_map = devm_kcalloc(rvu->dev, vlan->rsrc.max, - sizeof(u16), GFP_KERNEL); + vlan->entry2pfvf_map = devm_kzalloc_objs(rvu->dev, u16, vlan->rsrc.max); if (!vlan->entry2pfvf_map) goto free_mem; @@ -3847,8 +3845,8 @@ static int nix_setup_txschq(struct rvu *rvu, struct nix_hw *nix_hw, int blkaddr) /* Allocate memory for scheduler queues to * PF/VF pcifunc mapping info. */ - txsch->pfvf_map = devm_kcalloc(rvu->dev, txsch->schq.max, - sizeof(u32), GFP_KERNEL); + txsch->pfvf_map = devm_kzalloc_objs(rvu->dev, u32, + txsch->schq.max); if (!txsch->pfvf_map) return -ENOMEM; for (schq = 0; schq < txsch->schq.max; schq++) @@ -3909,8 +3907,7 @@ static int nix_af_mark_format_setup(struct rvu *rvu, struct nix_hw *nix_hw, total = (rvu_read64(rvu, blkaddr, NIX_AF_PSE_CONST) & 0xFF00) >> 8; nix_hw->mark_format.total = (u8)total; - nix_hw->mark_format.cfg = devm_kcalloc(rvu->dev, total, sizeof(u32), - GFP_KERNEL); + nix_hw->mark_format.cfg = devm_kzalloc_objs(rvu->dev, u32, total); if (!nix_hw->mark_format.cfg) return -ENOMEM; for (i = 0; i < NIX_MARK_CFG_MAX; i++) { @@ -5184,8 +5181,7 @@ int rvu_nix_init(struct rvu *rvu) int blkaddr = 0, err; int i = 0; - hw->nix = devm_kcalloc(rvu->dev, MAX_NIX_BLKS, sizeof(struct nix_hw), - GFP_KERNEL); + hw->nix = devm_kzalloc_objs(rvu->dev, struct nix_hw, MAX_NIX_BLKS); if (!hw->nix) return -ENOMEM; @@ -5805,8 +5801,8 @@ static int nix_setup_ipolicers(struct rvu *rvu, } hw->cap.ipolicer = true; - nix_hw->ipolicer = devm_kcalloc(rvu->dev, BAND_PROF_NUM_LAYERS, - sizeof(*ipolicer), GFP_KERNEL); + nix_hw->ipolicer = devm_kzalloc_objs(rvu->dev, *ipolicer, + BAND_PROF_NUM_LAYERS); if (!nix_hw->ipolicer) return -ENOMEM; @@ -5833,15 +5829,13 @@ static int nix_setup_ipolicers(struct rvu *rvu, if (err) return err; - ipolicer->pfvf_map = devm_kcalloc(rvu->dev, - ipolicer->band_prof.max, - sizeof(u16), GFP_KERNEL); + ipolicer->pfvf_map = devm_kzalloc_objs(rvu->dev, u16, + ipolicer->band_prof.max); if (!ipolicer->pfvf_map) return -ENOMEM; - ipolicer->match_id = devm_kcalloc(rvu->dev, - ipolicer->band_prof.max, - sizeof(u16), GFP_KERNEL); + ipolicer->match_id = devm_kzalloc_objs(rvu->dev, u16, + ipolicer->band_prof.max); if (!ipolicer->match_id) return -ENOMEM; @@ -5868,9 +5862,8 @@ static int nix_setup_ipolicers(struct rvu *rvu, if (layer != BAND_PROF_MID_LAYER) continue; - ipolicer->ref_count = devm_kcalloc(rvu->dev, - ipolicer->band_prof.max, - sizeof(u16), GFP_KERNEL); + ipolicer->ref_count = devm_kzalloc_objs(rvu->dev, u16, + ipolicer->band_prof.max); if (!ipolicer->ref_count) return -ENOMEM; } diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c index f8de72fb5a41..7fadd0e1329c 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c @@ -1881,13 +1881,11 @@ static int npc_alloc_kpu_cam2_n_action2(struct rvu *rvu, int kpu_num, kpu = &adapter->kpu[kpu_num]; - kpu->cam2 = devm_kcalloc(rvu->dev, num_entries, - sizeof(*kpu->cam2), GFP_KERNEL); + kpu->cam2 = devm_kzalloc_objs(rvu->dev, *kpu->cam2, num_entries); if (!kpu->cam2) return -ENOMEM; - kpu->action2 = devm_kcalloc(rvu->dev, num_entries, - sizeof(*kpu->action2), GFP_KERNEL); + kpu->action2 = devm_kzalloc_objs(rvu->dev, *kpu->action2, num_entries); if (!kpu->action2) return -ENOMEM; @@ -1959,10 +1957,8 @@ static int npc_apply_custom_kpu_from_fs(struct rvu *rvu, fw = rvu->kpu_fwdata; /* Binary blob contains ikpu actions entries at start of data[0] */ - profile->ikpu2 = devm_kcalloc(rvu->dev, - ARRAY_SIZE(ikpu_action_entries), - sizeof(*profile->ikpu2), - GFP_KERNEL); + profile->ikpu2 = devm_kzalloc_objs(rvu->dev, *profile->ikpu2, + ARRAY_SIZE(ikpu_action_entries)); if (!profile->ikpu2) return -ENOMEM; @@ -2088,7 +2084,7 @@ static int npc_apply_custom_kpu(struct rvu *rvu, *fw_kpus = fw->kpus; - sfw = devm_kcalloc(rvu->dev, 1, sizeof(*sfw), GFP_KERNEL); + sfw = devm_kzalloc_objs(rvu->dev, *sfw, 1); if (!sfw) return -ENOMEM; @@ -2699,8 +2695,7 @@ int rvu_npc_init(struct rvu *rvu) rvu_alloc_rsrc(&pkind->rsrc); /* Allocate mem for pkind to PF and channel mapping info */ - pkind->pfchan_map = devm_kcalloc(rvu->dev, pkind->rsrc.max, - sizeof(u32), GFP_KERNEL); + pkind->pfchan_map = devm_kzalloc_objs(rvu->dev, u32, pkind->rsrc.max); if (!pkind->pfchan_map) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_sdp.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_sdp.c index bbfd8231aed5..b760ce095826 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_sdp.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_sdp.c @@ -71,9 +71,8 @@ int rvu_sdp_init(struct rvu *rvu) sdp_pf_num[i] = pdev->bus->number - 1; pfvf = &rvu->pf[sdp_pf_num[i]]; - pfvf->sdp_info = devm_kzalloc(rvu->dev, - sizeof(struct sdp_node_info), - GFP_KERNEL); + pfvf->sdp_info = devm_kzalloc_obj(rvu->dev, + struct sdp_node_info); if (!pfvf->sdp_info) { pci_dev_put(pdev); return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c index e92b77789f08..6698e0ee3f15 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c @@ -176,8 +176,7 @@ int cn20k_register_pfvf_mbox_intr(struct otx2_nic *pf, int numvfs) char *irq_name; /* irq data for 4 PF intr vectors */ - irq_data = devm_kcalloc(pf->dev, 4, - sizeof(struct pf_irq_data), GFP_KERNEL); + irq_data = devm_kzalloc_objs(pf->dev, struct pf_irq_data, 4); if (!irq_data) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c index c85436457286..6bc42e7a3547 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c @@ -1198,8 +1198,8 @@ int otx2_config_nix_queues(struct otx2_nic *pfvf) NIX_LF_CQ_OP_STATUS); /* Initialize work queue for receive buffer refill */ - pfvf->refill_wrk = devm_kcalloc(pfvf->dev, pfvf->qset.cq_cnt, - sizeof(struct refill_work), GFP_KERNEL); + pfvf->refill_wrk = devm_kzalloc_objs(pfvf->dev, struct refill_work, + pfvf->qset.cq_cnt); if (!pfvf->refill_wrk) return -ENOMEM; @@ -1525,8 +1525,8 @@ int otx2_pool_aq_init(struct otx2_nic *pfvf, u16 pool_id, if (xsk_pool) { pool->xsk_pool = xsk_pool; pool->xdp_cnt = numptrs; - pool->xdp = devm_kcalloc(pfvf->dev, - numptrs, sizeof(struct xdp_buff *), GFP_KERNEL); + pool->xdp = devm_kzalloc_objs(pfvf->dev, struct xdp_buff *, + numptrs); if (!pool->xdp) return -ENOMEM; } @@ -1687,8 +1687,8 @@ int otx2_config_npa(struct otx2_nic *pfvf) if (!hw->pool_cnt) return -EINVAL; - qset->pool = devm_kcalloc(pfvf->dev, hw->pool_cnt, - sizeof(struct otx2_pool), GFP_KERNEL); + qset->pool = devm_kzalloc_objs(pfvf->dev, struct otx2_pool, + hw->pool_cnt); if (!qset->pool) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c index 6d095023d17b..74d83498af6a 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c @@ -172,8 +172,7 @@ int otx2_alloc_mcam_entries(struct otx2_nic *pfvf, u16 count) if (!count) return 0; - flow_cfg->flow_ent = devm_kmalloc_array(pfvf->dev, count, - sizeof(u16), GFP_KERNEL); + flow_cfg->flow_ent = devm_kmalloc_objs(pfvf->dev, u16, count); if (!flow_cfg->flow_ent) { netdev_err(pfvf->netdev, "%s: Unable to allocate memory for flow entries\n", @@ -314,8 +313,7 @@ int otx2_mcam_entry_init(struct otx2_nic *pfvf) count = flow_cfg->ucast_flt_cnt + OTX2_MAX_VLAN_FLOWS + vf_vlan_max_flows; - flow_cfg->def_ent = devm_kmalloc_array(pfvf->dev, count, - sizeof(u16), GFP_KERNEL); + flow_cfg->def_ent = devm_kmalloc_objs(pfvf->dev, u16, count); if (!flow_cfg->def_ent) return -ENOMEM; @@ -427,9 +425,7 @@ int otx2vf_mcam_flow_init(struct otx2_nic *pfvf) { struct otx2_flow_config *flow_cfg; - pfvf->flow_cfg = devm_kzalloc(pfvf->dev, - sizeof(struct otx2_flow_config), - GFP_KERNEL); + pfvf->flow_cfg = devm_kzalloc_obj(pfvf->dev, struct otx2_flow_config); if (!pfvf->flow_cfg) return -ENOMEM; @@ -452,8 +448,7 @@ int otx2_mcam_flow_init(struct otx2_nic *pf) { int err; - pf->flow_cfg = devm_kzalloc(pf->dev, sizeof(struct otx2_flow_config), - GFP_KERNEL); + pf->flow_cfg = devm_kzalloc_obj(pf->dev, struct otx2_flow_config); if (!pf->flow_cfg) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c index 7dc0ce669d0b..cb602a4adcfb 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c @@ -281,8 +281,7 @@ static int otx2_pf_flr_init(struct otx2_nic *pf, int num_vfs) if (!pf->flr_wq) return -ENOMEM; - pf->flr_wrk = devm_kcalloc(pf->dev, num_vfs, - sizeof(struct flr_work), GFP_KERNEL); + pf->flr_wrk = devm_kzalloc_objs(pf->dev, struct flr_work, num_vfs); if (!pf->flr_wrk) { destroy_workqueue(pf->flr_wq); return -ENOMEM; @@ -603,8 +602,7 @@ static int otx2_pfvf_mbox_init(struct otx2_nic *pf, int numvfs) if (!numvfs) return -EINVAL; - pf->mbox_pfvf = devm_kcalloc(&pf->pdev->dev, numvfs, - sizeof(struct mbox), GFP_KERNEL); + pf->mbox_pfvf = devm_kzalloc_objs(&pf->pdev->dev, struct mbox, numvfs); if (!pf->mbox_pfvf) return -ENOMEM; @@ -3108,9 +3106,8 @@ static int otx2_sriov_vfcfg_init(struct otx2_nic *pf) { int i; - pf->vf_configs = devm_kcalloc(pf->dev, pf->total_vfs, - sizeof(struct otx2_vf_config), - GFP_KERNEL); + pf->vf_configs = devm_kzalloc_objs(pf->dev, struct otx2_vf_config, + pf->total_vfs); if (!pf->vf_configs) return -ENOMEM; @@ -3150,8 +3147,8 @@ int otx2_init_rsrc(struct pci_dev *pdev, struct otx2_nic *pf) if (!hw->irq_name) return -ENOMEM; - hw->affinity_mask = devm_kcalloc(&hw->pdev->dev, num_vec, - sizeof(cpumask_var_t), GFP_KERNEL); + hw->affinity_mask = devm_kzalloc_objs(&hw->pdev->dev, cpumask_var_t, + num_vec); if (!hw->affinity_mask) return -ENOMEM; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c index f7765e19d78a..abc1a3974930 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c @@ -628,8 +628,8 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto err_free_netdev; } - hw->affinity_mask = devm_kcalloc(&hw->pdev->dev, num_vec, - sizeof(cpumask_var_t), GFP_KERNEL); + hw->affinity_mask = devm_kzalloc_objs(&hw->pdev->dev, cpumask_var_t, + num_vec); if (!hw->affinity_mask) { err = -ENOMEM; goto err_free_netdev; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c index 12272a5baf0a..b3beb2eb5173 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c @@ -792,7 +792,7 @@ static int rvu_rep_probe(struct pci_dev *pdev, const struct pci_device_id *id) pci_set_master(pdev); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) { err = -ENOMEM; goto err_set_drv_data; diff --git a/drivers/net/ethernet/marvell/prestera/prestera_pci.c b/drivers/net/ethernet/marvell/prestera/prestera_pci.c index 1ad0e62a8433..604718fcd5c0 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_pci.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_pci.c @@ -882,7 +882,7 @@ static int prestera_pci_probe(struct pci_dev *pdev, pci_set_master(pdev); - fw = devm_kzalloc(&pdev->dev, sizeof(*fw), GFP_KERNEL); + fw = devm_kzalloc_obj(&pdev->dev, *fw); if (!fw) { err = -ENOMEM; goto err_pci_dev_alloc; diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 38b08425b3a0..21abeccfe094 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -4879,9 +4879,7 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) memset(mac->hwlro_ip, 0, sizeof(mac->hwlro_ip)); mac->hwlro_ip_cnt = 0; - mac->hw_stats = devm_kzalloc(eth->dev, - sizeof(*mac->hw_stats), - GFP_KERNEL); + mac->hw_stats = devm_kzalloc_obj(eth->dev, *mac->hw_stats); if (!mac->hw_stats) { dev_err(eth->dev, "failed to allocate counter memory\n"); err = -ENOMEM; @@ -5119,7 +5117,7 @@ static int mtk_probe(struct platform_device *pdev) struct mtk_eth *eth; int err, i; - eth = devm_kzalloc(&pdev->dev, sizeof(*eth), GFP_KERNEL); + eth = devm_kzalloc_obj(&pdev->dev, *eth); if (!eth) return -ENOMEM; diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c index 8451dc3fd00a..a21ac8226020 100644 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c @@ -885,7 +885,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, int index) u32 foe_flow_size; void *foe; - ppe = devm_kzalloc(dev, sizeof(*ppe), GFP_KERNEL); + ppe = devm_kzalloc_obj(dev, *ppe); if (!ppe) return NULL; diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c index 53d3b7e00e1c..582eb143b300 100644 --- a/drivers/net/ethernet/mediatek/mtk_wed.c +++ b/drivers/net/ethernet/mediatek/mtk_wed.c @@ -535,8 +535,7 @@ mtk_wed_amsdu_buffer_alloc(struct mtk_wed_device *dev) if (!mtk_wed_is_v3_or_greater(hw)) return 0; - wed_amsdu = devm_kcalloc(hw->dev, MTK_WED_AMSDU_NPAGES, - sizeof(*wed_amsdu), GFP_KERNEL); + wed_amsdu = devm_kzalloc_objs(hw->dev, *wed_amsdu, MTK_WED_AMSDU_NPAGES); if (!wed_amsdu) return -ENOMEM; diff --git a/drivers/net/ethernet/mediatek/mtk_wed_wo.c b/drivers/net/ethernet/mediatek/mtk_wed_wo.c index 4f720ec53e20..07d302cc4ea5 100644 --- a/drivers/net/ethernet/mediatek/mtk_wed_wo.c +++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.c @@ -464,7 +464,7 @@ int mtk_wed_wo_init(struct mtk_wed_hw *hw) struct mtk_wed_wo *wo; int ret; - wo = devm_kzalloc(hw->dev, sizeof(*wo), GFP_KERNEL); + wo = devm_kzalloc_obj(hw->dev, *wo); if (!wo) return -ENOMEM; diff --git a/drivers/net/ethernet/mellanox/mlxsw/i2c.c b/drivers/net/ethernet/mellanox/mlxsw/i2c.c index 60a50222f33a..bf42606d3207 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/i2c.c +++ b/drivers/net/ethernet/mellanox/mlxsw/i2c.c @@ -638,7 +638,7 @@ static int mlxsw_i2c_probe(struct i2c_client *client) u8 status; int err; - mlxsw_i2c = devm_kzalloc(&client->dev, sizeof(*mlxsw_i2c), GFP_KERNEL); + mlxsw_i2c = devm_kzalloc_obj(&client->dev, *mlxsw_i2c); if (!mlxsw_i2c) return -ENOMEM; diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_ethtool.c b/drivers/net/ethernet/microchip/lan966x/lan966x_ethtool.c index fe4e61405284..790d89ed9370 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_ethtool.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_ethtool.c @@ -694,9 +694,8 @@ int lan966x_stats_init(struct lan966x *lan966x) lan966x->stats_layout = lan966x_stats_layout; lan966x->num_stats = ARRAY_SIZE(lan966x_stats_layout); - lan966x->stats = devm_kcalloc(lan966x->dev, lan966x->num_phys_ports * - lan966x->num_stats, - sizeof(u64), GFP_KERNEL); + lan966x->stats = devm_kzalloc_objs(lan966x->dev, u64, + lan966x->num_phys_ports * lan966x->num_stats); if (!lan966x->stats) return -ENOMEM; diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c index c276fec2f9d6..b8696fc7e9b9 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c @@ -1138,7 +1138,7 @@ static int lan966x_probe(struct platform_device *pdev) u8 mac_addr[ETH_ALEN]; int err; - lan966x = devm_kzalloc(&pdev->dev, sizeof(*lan966x), GFP_KERNEL); + lan966x = devm_kzalloc_obj(&pdev->dev, *lan966x); if (!lan966x) return -ENOMEM; @@ -1167,9 +1167,8 @@ static int lan966x_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, err, "Reset failed"); lan966x->num_phys_ports = NUM_PHYS_PORTS; - lan966x->ports = devm_kcalloc(&pdev->dev, lan966x->num_phys_ports, - sizeof(struct lan966x_port *), - GFP_KERNEL); + lan966x->ports = devm_kzalloc_objs(&pdev->dev, struct lan966x_port *, + lan966x->num_phys_ports); if (!lan966x->ports) return -ENOMEM; diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c b/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c index d42c57bead89..02aed761d211 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c @@ -1253,10 +1253,8 @@ int sparx5_stats_init(struct sparx5 *sparx5) sparx5->stats_layout = sparx5_stats_layout; sparx5->num_stats = spx5_stats_count; sparx5->num_ethtool_stats = ARRAY_SIZE(sparx5_stats_layout); - sparx5->stats = devm_kcalloc(sparx5->dev, - consts->n_ports_all * - sparx5->num_stats, - sizeof(u64), GFP_KERNEL); + sparx5->stats = devm_kzalloc_objs(sparx5->dev, u64, + consts->n_ports_all * sparx5->num_stats); if (!sparx5->stats) return -ENOMEM; diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_mactable.c b/drivers/net/ethernet/microchip/sparx5/sparx5_mactable.c index 2bf9c5f64151..57c58a354471 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_mactable.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_mactable.c @@ -244,8 +244,7 @@ static struct sparx5_mact_entry *alloc_mact_entry(struct sparx5 *sparx5, { struct sparx5_mact_entry *mact_entry; - mact_entry = devm_kzalloc(sparx5->dev, - sizeof(*mact_entry), GFP_ATOMIC); + mact_entry = devm_kzalloc_obj(sparx5->dev, *mact_entry, GFP_ATOMIC); if (!mact_entry) return NULL; diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c index e039f5369b95..08a398adf121 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c @@ -794,7 +794,7 @@ static int mchp_sparx5_probe(struct platform_device *pdev) if (!np && !pdev->dev.platform_data) return -ENODEV; - sparx5 = devm_kzalloc(&pdev->dev, sizeof(*sparx5), GFP_KERNEL); + sparx5 = devm_kzalloc_obj(&pdev->dev, *sparx5); if (!sparx5) return -ENOMEM; diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c b/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c index 476f7496a9d4..16bd63f653bf 100644 --- a/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c +++ b/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c @@ -389,7 +389,7 @@ void vcap_port_debugfs(struct device *dev, struct dentry *parent, { struct vcap_port_debugfs_info *info; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return; @@ -409,7 +409,7 @@ void vcap_port_debugfs_portno(struct device *dev, struct vcap_port_debugfs_info *info; char name[16]; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return; @@ -469,7 +469,7 @@ struct dentry *vcap_debugfs(struct device *dev, struct dentry *parent, list_for_each_entry(admin, &vctrl->list, list) { sprintf(name, "raw_%s_%d", vctrl->vcaps[admin->vtype].name, admin->vinst); - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return NULL; info->vctrl = vctrl; diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 67ecd0e91002..9dfddad1aaea 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -2140,7 +2140,7 @@ int ocelot_port_mdb_add(struct ocelot *ocelot, int port, mc = ocelot_multicast_get(ocelot, mdb->addr, vid); if (!mc) { /* New entry */ - mc = devm_kzalloc(ocelot->dev, sizeof(*mc), GFP_KERNEL); + mc = devm_kzalloc_obj(ocelot->dev, *mc); if (!mc) return -ENOMEM; diff --git a/drivers/net/ethernet/mscc/ocelot_fdma.c b/drivers/net/ethernet/mscc/ocelot_fdma.c index 00326ae8c708..d84fed2cb787 100644 --- a/drivers/net/ethernet/mscc/ocelot_fdma.c +++ b/drivers/net/ethernet/mscc/ocelot_fdma.c @@ -817,7 +817,7 @@ void ocelot_fdma_init(struct platform_device *pdev, struct ocelot *ocelot) struct ocelot_fdma *fdma; int ret; - fdma = devm_kzalloc(dev, sizeof(*fdma), GFP_KERNEL); + fdma = devm_kzalloc_obj(dev, *fdma); if (!fdma) return; diff --git a/drivers/net/ethernet/mscc/ocelot_mm.c b/drivers/net/ethernet/mscc/ocelot_mm.c index c815ae64e39d..d1c3209c33d6 100644 --- a/drivers/net/ethernet/mscc/ocelot_mm.c +++ b/drivers/net/ethernet/mscc/ocelot_mm.c @@ -278,8 +278,8 @@ int ocelot_mm_init(struct ocelot *ocelot) if (!ocelot->mm_supported) return 0; - ocelot->mm = devm_kcalloc(ocelot->dev, ocelot->num_phys_ports, - sizeof(*ocelot->mm), GFP_KERNEL); + ocelot->mm = devm_kzalloc_objs(ocelot->dev, *ocelot->mm, + ocelot->num_phys_ports); if (!ocelot->mm) return -ENOMEM; diff --git a/drivers/net/ethernet/mscc/ocelot_stats.c b/drivers/net/ethernet/mscc/ocelot_stats.c index d2be1be37716..82d27412dea7 100644 --- a/drivers/net/ethernet/mscc/ocelot_stats.c +++ b/drivers/net/ethernet/mscc/ocelot_stats.c @@ -936,8 +936,7 @@ static int ocelot_prepare_stats_regions(struct ocelot *ocelot) ocelot->map[SYS][last & REG_MASK] + 4) { region->count++; } else { - region = devm_kzalloc(ocelot->dev, sizeof(*region), - GFP_KERNEL); + region = devm_kzalloc_obj(ocelot->dev, *region); if (!region) return -ENOMEM; @@ -960,8 +959,8 @@ static int ocelot_prepare_stats_regions(struct ocelot *ocelot) dev_dbg(ocelot->dev, "region of %d contiguous counters starting with SYS:STAT:CNT[0x%03x]\n", region->count, addr / 4); - region->buf = devm_kcalloc(ocelot->dev, region->count, - sizeof(*region->buf), GFP_KERNEL); + region->buf = devm_kzalloc_objs(ocelot->dev, *region->buf, + region->count); if (!region->buf) return -ENOMEM; } @@ -987,9 +986,8 @@ int ocelot_stats_init(struct ocelot *ocelot) if (!ocelot_port) continue; - ocelot_port->ts_stats = devm_kzalloc(ocelot->dev, - sizeof(*ocelot_port->ts_stats), - GFP_KERNEL); + ocelot_port->ts_stats = devm_kzalloc_obj(ocelot->dev, + *ocelot_port->ts_stats); if (!ocelot_port->ts_stats) return -ENOMEM; diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 498eec8ae61d..25d040f35410 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -152,15 +152,14 @@ static int mscc_ocelot_init_ports(struct platform_device *pdev, int port, err; u32 reg; - ocelot->ports = devm_kcalloc(ocelot->dev, ocelot->num_phys_ports, - sizeof(struct ocelot_port *), GFP_KERNEL); + ocelot->ports = devm_kzalloc_objs(ocelot->dev, struct ocelot_port *, + ocelot->num_phys_ports); if (!ocelot->ports) return -ENOMEM; - ocelot->devlink_ports = devm_kcalloc(ocelot->dev, - ocelot->num_phys_ports, - sizeof(*ocelot->devlink_ports), - GFP_KERNEL); + ocelot->devlink_ports = devm_kzalloc_objs(ocelot->dev, + *ocelot->devlink_ports, + ocelot->num_phys_ports); if (!ocelot->devlink_ports) return -ENOMEM; diff --git a/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c b/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c index cf40ddc45192..e890cafdd65a 100644 --- a/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c +++ b/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c @@ -14,7 +14,7 @@ static struct nbl_hw_mgt *nbl_hw_setup_hw_mgt(struct nbl_common_info *common) struct device *dev = common->dev; struct nbl_hw_mgt *hw_mgt; - hw_mgt = devm_kzalloc(dev, sizeof(*hw_mgt), GFP_KERNEL); + hw_mgt = devm_kzalloc_obj(dev, *hw_mgt); if (!hw_mgt) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c b/drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c index f2552bc73293..442da73835b0 100644 --- a/drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c +++ b/drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c @@ -19,7 +19,7 @@ struct nbl_adapter *nbl_core_init(struct pci_dev *pdev, struct nbl_adapter *adapter; int ret; - adapter = devm_kzalloc(&pdev->dev, sizeof(*adapter), GFP_KERNEL); + adapter = devm_kzalloc_obj(&pdev->dev, *adapter); if (!adapter) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c index 230d5ff99dd7..d59a5ab7efcd 100644 --- a/drivers/net/ethernet/ni/nixge.c +++ b/drivers/net/ethernet/ni/nixge.c @@ -299,9 +299,8 @@ static int nixge_hw_dma_bd_init(struct net_device *ndev) if (!priv->tx_bd_v) goto out; - priv->tx_skb = devm_kcalloc(ndev->dev.parent, - TX_BD_NUM, sizeof(*priv->tx_skb), - GFP_KERNEL); + priv->tx_skb = devm_kzalloc_objs(ndev->dev.parent, *priv->tx_skb, + TX_BD_NUM); if (!priv->tx_skb) goto out; diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c index 364027c39fa4..8e86cfde6d1c 100644 --- a/drivers/net/ethernet/oa_tc6.c +++ b/drivers/net/ethernet/oa_tc6.c @@ -1464,7 +1464,7 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev, struct oa_tc6 *tc6; int ret; - tc6 = devm_kzalloc(&spi->dev, sizeof(*tc6), GFP_KERNEL); + tc6 = devm_kzalloc_obj(&spi->dev, *tc6); if (!tc6) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index ba3d10f9aec6..13f00a80f6da 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c @@ -556,13 +556,13 @@ static void pch_gbe_mac_set_pause_packet(struct pch_gbe_hw *hw) */ static int pch_gbe_alloc_queues(struct pch_gbe_adapter *adapter) { - adapter->tx_ring = devm_kzalloc(&adapter->pdev->dev, - sizeof(*adapter->tx_ring), GFP_KERNEL); + adapter->tx_ring = devm_kzalloc_obj(&adapter->pdev->dev, + *adapter->tx_ring); if (!adapter->tx_ring) return -ENOMEM; - adapter->rx_ring = devm_kzalloc(&adapter->pdev->dev, - sizeof(*adapter->rx_ring), GFP_KERNEL); + adapter->rx_ring = devm_kzalloc_obj(&adapter->pdev->dev, + *adapter->rx_ring); if (!adapter->rx_ring) return -ENOMEM; return 0; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c b/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c index c98b4e75e288..071bd1ba78f9 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c @@ -147,7 +147,7 @@ void ionic_debugfs_add_qcq(struct ionic_lif *lif, struct ionic_qcq *qcq) debugfs_create_file("tail", 0400, q_dentry, q, &q_tail_fops); debugfs_create_file("head", 0400, q_dentry, q, &q_head_fops); - desc_blob = devm_kzalloc(dev, sizeof(*desc_blob), GFP_KERNEL); + desc_blob = devm_kzalloc_obj(dev, *desc_blob); if (!desc_blob) return; desc_blob->data = q->base; @@ -155,7 +155,7 @@ void ionic_debugfs_add_qcq(struct ionic_lif *lif, struct ionic_qcq *qcq) debugfs_create_blob("desc_blob", 0400, q_dentry, desc_blob); if (qcq->flags & IONIC_QCQ_F_SG) { - desc_blob = devm_kzalloc(dev, sizeof(*desc_blob), GFP_KERNEL); + desc_blob = devm_kzalloc_obj(dev, *desc_blob); if (!desc_blob) return; desc_blob->data = q->sg_base; @@ -173,7 +173,7 @@ void ionic_debugfs_add_qcq(struct ionic_lif *lif, struct ionic_qcq *qcq) debugfs_create_file("tail", 0400, cq_dentry, cq, &cq_tail_fops); - desc_blob = devm_kzalloc(dev, sizeof(*desc_blob), GFP_KERNEL); + desc_blob = devm_kzalloc_obj(dev, *desc_blob); if (!desc_blob) return; desc_blob->data = cq->base; @@ -190,8 +190,7 @@ void ionic_debugfs_add_qcq(struct ionic_lif *lif, struct ionic_qcq *qcq) debugfs_create_u32("dim_coal_hw", 0400, intr_dentry, &intr->dim_coal_hw); - intr_ctrl_regset = devm_kzalloc(dev, sizeof(*intr_ctrl_regset), - GFP_KERNEL); + intr_ctrl_regset = devm_kzalloc_obj(dev, *intr_ctrl_regset); if (!intr_ctrl_regset) return; intr_ctrl_regset->regs = intr_ctrl_regs; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 7f0da2b0defd..22d1e4b6d61b 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -570,7 +570,7 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type, *qcq = NULL; - new = devm_kzalloc(dev, sizeof(*new), GFP_KERNEL); + new = devm_kzalloc_obj(dev, *new); if (!new) { netdev_err(lif->netdev, "Cannot allocate queue structure\n"); err = -ENOMEM; @@ -792,21 +792,21 @@ static int ionic_qcqs_alloc(struct ionic_lif *lif) } err = -ENOMEM; - lif->txqcqs = devm_kcalloc(dev, lif->ionic->ntxqs_per_lif, - sizeof(*lif->txqcqs), GFP_KERNEL); + lif->txqcqs = devm_kzalloc_objs(dev, *lif->txqcqs, + lif->ionic->ntxqs_per_lif); if (!lif->txqcqs) goto err_out; - lif->rxqcqs = devm_kcalloc(dev, lif->ionic->nrxqs_per_lif, - sizeof(*lif->rxqcqs), GFP_KERNEL); + lif->rxqcqs = devm_kzalloc_objs(dev, *lif->rxqcqs, + lif->ionic->nrxqs_per_lif); if (!lif->rxqcqs) goto err_out; - lif->txqstats = devm_kcalloc(dev, lif->ionic->ntxqs_per_lif + 1, - sizeof(*lif->txqstats), GFP_KERNEL); + lif->txqstats = devm_kzalloc_objs(dev, *lif->txqstats, + lif->ionic->ntxqs_per_lif + 1); if (!lif->txqstats) goto err_out; - lif->rxqstats = devm_kcalloc(dev, lif->ionic->nrxqs_per_lif + 1, - sizeof(*lif->rxqstats), GFP_KERNEL); + lif->rxqstats = devm_kzalloc_objs(dev, *lif->rxqstats, + lif->ionic->nrxqs_per_lif + 1); if (!lif->rxqstats) goto err_out; @@ -2959,8 +2959,8 @@ int ionic_reconfigure_queues(struct ionic_lif *lif, /* allocate temporary qcq arrays to hold new queue structs */ if (qparam->nxqs != lif->nxqs || qparam->ntxq_descs != lif->ntxq_descs) { - tx_qcqs = devm_kcalloc(lif->ionic->dev, lif->ionic->ntxqs_per_lif, - sizeof(struct ionic_qcq *), GFP_KERNEL); + tx_qcqs = devm_kzalloc_objs(lif->ionic->dev, struct ionic_qcq *, + lif->ionic->ntxqs_per_lif); if (!tx_qcqs) { err = -ENOMEM; goto err_out; @@ -2970,8 +2970,8 @@ int ionic_reconfigure_queues(struct ionic_lif *lif, qparam->nrxq_descs != lif->nrxq_descs || qparam->rxq_features != lif->rxq_features || qparam->xdp_prog != lif->xdp_prog) { - rx_qcqs = devm_kcalloc(lif->ionic->dev, lif->ionic->nrxqs_per_lif, - sizeof(struct ionic_qcq *), GFP_KERNEL); + rx_qcqs = devm_kzalloc_objs(lif->ionic->dev, struct ionic_qcq *, + lif->ionic->nrxqs_per_lif); if (!rx_qcqs) { err = -ENOMEM; goto err_out; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_phc.c b/drivers/net/ethernet/pensando/ionic/ionic_phc.c index 4b8d80a55b72..388150cbf7e4 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_phc.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_phc.c @@ -583,7 +583,7 @@ void ionic_lif_alloc_phc(struct ionic_lif *lif) if (!(features & (IONIC_ETH_HW_TIMESTAMP | IONIC_ETH_HW_RDMA_TIMESTAMP))) return; - phc = devm_kzalloc(ionic->dev, sizeof(*phc), GFP_KERNEL); + phc = devm_kzalloc_obj(ionic->dev, *phc); if (!phc) return; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c index c999754afb5f..c8f97d122177 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c @@ -156,7 +156,7 @@ int ionic_rx_filter_save(struct ionic_lif *lif, u32 flow_id, u16 rxq_index, hlist_del(&f->by_id); hlist_del(&f->by_hash); } else { - f = devm_kzalloc(dev, sizeof(*f), GFP_ATOMIC); + f = devm_kzalloc_obj(dev, *f, GFP_ATOMIC); if (!f) return -ENOMEM; } @@ -578,8 +578,8 @@ void ionic_rx_filter_sync(struct ionic_lif *lif) hlist_for_each_entry_safe(f, tmp, head, by_id) { if (f->state == IONIC_FILTER_STATE_NEW || f->state == IONIC_FILTER_STATE_OLD) { - sync_item = devm_kzalloc(dev, sizeof(*sync_item), - GFP_ATOMIC); + sync_item = devm_kzalloc_obj(dev, *sync_item, + GFP_ATOMIC); if (!sync_item) goto loop_out; diff --git a/drivers/net/ethernet/qualcomm/ppe/ppe.c b/drivers/net/ethernet/qualcomm/ppe/ppe.c index b144fd818998..a374bf014e79 100644 --- a/drivers/net/ethernet/qualcomm/ppe/ppe.c +++ b/drivers/net/ethernet/qualcomm/ppe/ppe.c @@ -262,9 +262,8 @@ static int qcom_ppe_probe(struct platform_device *pdev) if (!data) return dev_err_probe(dev, -EINVAL, "PPE no match data provided\n"); - ppe_dev = devm_kzalloc(dev, - struct_size(ppe_dev, icc_paths, data->num_icc_paths), - GFP_KERNEL); + ppe_dev = devm_kzalloc_flex(dev, *ppe_dev, icc_paths, + data->num_icc_paths); if (!ppe_dev) return -ENOMEM; diff --git a/drivers/net/ethernet/qualcomm/ppe/ppe_debugfs.c b/drivers/net/ethernet/qualcomm/ppe/ppe_debugfs.c index 8d5a6fad8337..a8dcfd80dd92 100644 --- a/drivers/net/ethernet/qualcomm/ppe/ppe_debugfs.c +++ b/drivers/net/ethernet/qualcomm/ppe/ppe_debugfs.c @@ -827,7 +827,7 @@ void ppe_debugfs_setup(struct ppe_device *ppe_dev) return; for (i = 0; i < ARRAY_SIZE(debugfs_files); i++) { - entry = devm_kzalloc(ppe_dev->dev, sizeof(*entry), GFP_KERNEL); + entry = devm_kzalloc_obj(ppe_dev->dev, *entry); if (!entry) return; diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 32aad159fddf..f151ab681393 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -6880,8 +6880,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) tp->dash_enabled = rtl_dash_is_enabled(tp); if (rtl_hw_support_rss(tp)) { - tp->rss_data = devm_kzalloc(&pdev->dev, sizeof(*tp->rss_data), - GFP_KERNEL); + tp->rss_data = devm_kzalloc_obj(&pdev->dev, *tp->rss_data); if (!tp->rss_data) return -ENOMEM; } diff --git a/drivers/net/ethernet/renesas/rcar_gen4_ptp.c b/drivers/net/ethernet/renesas/rcar_gen4_ptp.c index 27a6f0492097..da5de448003a 100644 --- a/drivers/net/ethernet/renesas/rcar_gen4_ptp.c +++ b/drivers/net/ethernet/renesas/rcar_gen4_ptp.c @@ -183,7 +183,7 @@ struct rcar_gen4_ptp_private *rcar_gen4_ptp_alloc(struct platform_device *pdev, { struct rcar_gen4_ptp_private *ptp; - ptp = devm_kzalloc(&pdev->dev, sizeof(*ptp), GFP_KERNEL); + ptp = devm_kzalloc_obj(&pdev->dev, *ptp); if (!ptp) return NULL; diff --git a/drivers/net/ethernet/renesas/rswitch_main.c b/drivers/net/ethernet/renesas/rswitch_main.c index 64b821ca02f8..571f4ccdda52 100644 --- a/drivers/net/ethernet/renesas/rswitch_main.c +++ b/drivers/net/ethernet/renesas/rswitch_main.c @@ -2136,7 +2136,7 @@ static int renesas_eth_sw_probe(struct platform_device *pdev) return -EINVAL; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; @@ -2168,8 +2168,8 @@ static int renesas_eth_sw_probe(struct platform_device *pdev) priv->gwca.index = AGENT_INDEX_GWCA; priv->gwca.num_queues = min(RSWITCH_NUM_PORTS * NUM_QUEUES_PER_NDEV, RSWITCH_MAX_NUM_QUEUES); - priv->gwca.queues = devm_kcalloc(&pdev->dev, priv->gwca.num_queues, - sizeof(*priv->gwca.queues), GFP_KERNEL); + priv->gwca.queues = devm_kzalloc_objs(&pdev->dev, *priv->gwca.queues, + priv->gwca.num_queues); if (!priv->gwca.queues) return -ENOMEM; diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index bfaa9aa63fa1..762591b62b91 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -3099,7 +3099,7 @@ static int sh_mdio_init(struct sh_eth_private *mdp, struct device_node *pn; /* create bit control struct for PHY */ - bitbang = devm_kzalloc(dev, sizeof(struct bb_info), GFP_KERNEL); + bitbang = devm_kzalloc_obj(dev, struct bb_info); if (!bitbang) return -ENOMEM; @@ -3208,7 +3208,7 @@ static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev) phy_interface_t interface; int ret; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return NULL; diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c index 70cf3619555f..f2fecc3bcea1 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c @@ -408,13 +408,11 @@ static int init_tx_ring(struct device *dev, u8 queue_no, return -ENOMEM; /* allocate memory for TX skbuff array */ - tx_ring->tx_skbuff_dma = devm_kcalloc(dev, tx_rsize, - sizeof(dma_addr_t), GFP_KERNEL); + tx_ring->tx_skbuff_dma = devm_kzalloc_objs(dev, dma_addr_t, tx_rsize); if (!tx_ring->tx_skbuff_dma) goto dmamem_err; - tx_ring->tx_skbuff = devm_kcalloc(dev, tx_rsize, - sizeof(struct sk_buff *), GFP_KERNEL); + tx_ring->tx_skbuff = devm_kzalloc_objs(dev, struct sk_buff *, tx_rsize); if (!tx_ring->tx_skbuff) goto dmamem_err; @@ -664,8 +662,8 @@ static int txring_mem_alloc(struct sxgbe_priv_data *priv) int queue_num; SXGBE_FOR_EACH_QUEUE(SXGBE_TX_QUEUES, queue_num) { - priv->txq[queue_num] = devm_kmalloc(priv->device, - sizeof(struct sxgbe_tx_queue), GFP_KERNEL); + priv->txq[queue_num] = devm_kmalloc_obj(priv->device, + struct sxgbe_tx_queue); if (!priv->txq[queue_num]) return -ENOMEM; } @@ -678,8 +676,8 @@ static int rxring_mem_alloc(struct sxgbe_priv_data *priv) int queue_num; SXGBE_FOR_EACH_QUEUE(SXGBE_RX_QUEUES, queue_num) { - priv->rxq[queue_num] = devm_kmalloc(priv->device, - sizeof(struct sxgbe_rx_queue), GFP_KERNEL); + priv->rxq[queue_num] = devm_kmalloc_obj(priv->device, + struct sxgbe_rx_queue); if (!priv->rxq[queue_num]) return -ENOMEM; } diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c index e4701b29e1a0..1c473591b644 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c @@ -42,13 +42,11 @@ static int sxgbe_probe_config_dt(struct platform_device *pdev, if (plat->bus_id < 0) plat->bus_id = 0; - plat->mdio_bus_data = devm_kzalloc(&pdev->dev, - sizeof(*plat->mdio_bus_data), - GFP_KERNEL); + plat->mdio_bus_data = devm_kzalloc_obj(&pdev->dev, *plat->mdio_bus_data); if (!plat->mdio_bus_data) return -ENOMEM; - dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg), GFP_KERNEL); + dma_cfg = devm_kzalloc_obj(&pdev->dev, *dma_cfg); if (!dma_cfg) return -ENOMEM; @@ -90,9 +88,7 @@ static int sxgbe_platform_probe(struct platform_device *pdev) return PTR_ERR(addr); if (pdev->dev.of_node) { - plat_dat = devm_kzalloc(&pdev->dev, - sizeof(struct sxgbe_plat_data), - GFP_KERNEL); + plat_dat = devm_kzalloc_obj(&pdev->dev, struct sxgbe_plat_data); if (!plat_dat) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c index 5e0fc31762d9..97f94aee6c00 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c @@ -73,7 +73,7 @@ anarion_config_dt(struct platform_device *pdev, return ERR_CAST(ctl_block); } - gmac = devm_kzalloc(&pdev->dev, sizeof(*gmac), GFP_KERNEL); + gmac = devm_kzalloc_obj(&pdev->dev, *gmac); if (!gmac) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c index b0c5d1ecabce..12d97c0c7726 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c @@ -40,9 +40,7 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev, u32 burst_map = 0; if (!plat_dat->axi) { - plat_dat->axi = devm_kzalloc(&pdev->dev, - sizeof(struct stmmac_axi), - GFP_KERNEL); + plat_dat->axi = devm_kzalloc_obj(&pdev->dev, struct stmmac_axi); if (!plat_dat->axi) return -ENOMEM; @@ -191,7 +189,7 @@ static int tegra_eqos_probe(struct platform_device *pdev, struct tegra_eqos *eqos; int err; - eqos = devm_kzalloc(&pdev->dev, sizeof(*eqos), GFP_KERNEL); + eqos = devm_kzalloc_obj(&pdev->dev, *eqos); if (!eqos) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c index 0d654ec07f33..c229275b11b3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c @@ -183,7 +183,7 @@ static int eic7700_dwmac_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(plat_dat), "dt configuration failed\n"); - dwc_priv = devm_kzalloc(&pdev->dev, sizeof(*dwc_priv), GFP_KERNEL); + dwc_priv = devm_kzalloc_obj(&pdev->dev, *dwc_priv); if (!dwc_priv) return -ENOMEM; @@ -295,10 +295,8 @@ static int eic7700_dwmac_probe(struct platform_device *pdev) dwc_priv->has_rxd_offset = true; plat_dat->num_clks = ARRAY_SIZE(eic7700_clk_names); - plat_dat->clks = devm_kcalloc(&pdev->dev, - plat_dat->num_clks, - sizeof(*plat_dat->clks), - GFP_KERNEL); + plat_dat->clks = devm_kzalloc_objs(&pdev->dev, *plat_dat->clks, + plat_dat->num_clks); if (!plat_dat->clks) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c index 01260dbbb698..f4555f46e83f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c @@ -302,7 +302,7 @@ static int imx_dwmac_probe(struct platform_device *pdev) if (ret) return ret; - dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + dwmac = devm_kzalloc_obj(&pdev->dev, *dwmac); if (!dwmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c index 8e4a30c11db0..2d777959d6df 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c @@ -168,7 +168,7 @@ static int ingenic_mac_probe(struct platform_device *pdev) if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); - mac = devm_kzalloc(&pdev->dev, sizeof(*mac), GFP_KERNEL); + mac = devm_kzalloc_obj(&pdev->dev, *mac); if (!mac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c index 4ea7b0a803d7..6755dddd601d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c @@ -57,7 +57,7 @@ static int intel_eth_plat_probe(struct platform_device *pdev) return PTR_ERR(plat_dat); } - dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + dwmac = devm_kzalloc_obj(&pdev->dev, *dwmac); if (!dwmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index 4308dccbf257..fcd8008545c2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -705,8 +705,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, plat->dma_cfg->aal = 0; plat->dma_cfg->dche = true; - plat->axi = devm_kzalloc(&pdev->dev, sizeof(*plat->axi), - GFP_KERNEL); + plat->axi = devm_kzalloc_obj(&pdev->dev, *plat->axi); if (!plat->axi) return -ENOMEM; @@ -1305,7 +1304,7 @@ static int intel_eth_pci_probe(struct pci_dev *pdev, struct stmmac_resources res; int ret; - intel_priv = devm_kzalloc(&pdev->dev, sizeof(*intel_priv), GFP_KERNEL); + intel_priv = devm_kzalloc_obj(&pdev->dev, *intel_priv); if (!intel_priv) return -ENOMEM; @@ -1313,15 +1312,12 @@ static int intel_eth_pci_probe(struct pci_dev *pdev, if (!plat) return -ENOMEM; - plat->mdio_bus_data = devm_kzalloc(&pdev->dev, - sizeof(*plat->mdio_bus_data), - GFP_KERNEL); + plat->mdio_bus_data = devm_kzalloc_obj(&pdev->dev, *plat->mdio_bus_data); if (!plat->mdio_bus_data) return -ENOMEM; - plat->safety_feat_cfg = devm_kzalloc(&pdev->dev, - sizeof(*plat->safety_feat_cfg), - GFP_KERNEL); + plat->safety_feat_cfg = devm_kzalloc_obj(&pdev->dev, + *plat->safety_feat_cfg); if (!plat->safety_feat_cfg) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c index c05f85534f0c..ad380c092274 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c @@ -388,7 +388,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); - gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL); + gmac = devm_kzalloc_obj(dev, *gmac); if (!gmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c index eb14c197d6ae..a42d80ead9d4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c @@ -313,7 +313,7 @@ static int loongson_dwmac_setup(void *apriv, struct mac_device_info *mac) ld = priv->plat->bsp_priv; pdev = to_pci_dev(priv->device); - dma = devm_kzalloc(priv->device, sizeof(*dma), GFP_KERNEL); + dma = devm_kzalloc_obj(priv->device, *dma); if (!dma) return -ENOMEM; @@ -507,13 +507,11 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id if (!plat) return -ENOMEM; - plat->mdio_bus_data = devm_kzalloc(&pdev->dev, - sizeof(*plat->mdio_bus_data), - GFP_KERNEL); + plat->mdio_bus_data = devm_kzalloc_obj(&pdev->dev, *plat->mdio_bus_data); if (!plat->mdio_bus_data) return -ENOMEM; - ld = devm_kzalloc(&pdev->dev, sizeof(*ld), GFP_KERNEL); + ld = devm_kzalloc_obj(&pdev->dev, *ld); if (!ld) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c index de9aba756aac..f7fef8436c87 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c @@ -181,7 +181,7 @@ static int ls1x_dwmac_probe(struct platform_device *pdev) return -EINVAL; } - dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + dwmac = devm_kzalloc_obj(&pdev->dev, *dwmac); if (!dwmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c index 30ae0dba7fff..f5835e2d3ea5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c @@ -466,7 +466,8 @@ static int mediatek_dwmac_clk_init(struct mediatek_dwmac_plat_data *plat) const struct mediatek_dwmac_variant *variant = plat->variant; int i, ret; - plat->clks = devm_kcalloc(plat->dev, variant->num_clks, sizeof(*plat->clks), GFP_KERNEL); + plat->clks = devm_kzalloc_objs(plat->dev, *plat->clks, + variant->num_clks); if (!plat->clks) return -ENOMEM; @@ -571,9 +572,8 @@ static int mediatek_dwmac_common_data(struct platform_device *pdev, plat->resume = mediatek_dwmac_init; plat->clks_config = mediatek_dwmac_clks_config; - plat->safety_feat_cfg = devm_kzalloc(&pdev->dev, - sizeof(*plat->safety_feat_cfg), - GFP_KERNEL); + plat->safety_feat_cfg = devm_kzalloc_obj(&pdev->dev, + *plat->safety_feat_cfg); if (!plat->safety_feat_cfg) return -ENOMEM; @@ -603,7 +603,7 @@ static int mediatek_dwmac_probe(struct platform_device *pdev) struct stmmac_resources stmmac_res; int ret; - priv_plat = devm_kzalloc(&pdev->dev, sizeof(*priv_plat), GFP_KERNEL); + priv_plat = devm_kzalloc_obj(&pdev->dev, *priv_plat); if (!priv_plat) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c index 07c504d07604..455594d8c031 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c @@ -59,7 +59,7 @@ static int meson6_dwmac_probe(struct platform_device *pdev) if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); - dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + dwmac = devm_kzalloc_obj(&pdev->dev, *dwmac); if (!dwmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c index e4d5c41294f4..2ad70f0dc4a3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c @@ -158,7 +158,7 @@ static int meson8b_init_rgmii_tx_clk(struct meson8b_dwmac *dwmac) struct meson8b_dwmac_clk_configs *clk_configs; struct clk_parent_data parent_data = { }; - clk_configs = devm_kzalloc(dev, sizeof(*clk_configs), GFP_KERNEL); + clk_configs = devm_kzalloc_obj(dev, *clk_configs); if (!clk_configs) return -ENOMEM; @@ -394,7 +394,7 @@ static int meson8b_dwmac_probe(struct platform_device *pdev) if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); - dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + dwmac = devm_kzalloc_obj(&pdev->dev, *dwmac); if (!dwmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c index 124fcd55a429..42f0b11a7b60 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c @@ -214,12 +214,11 @@ motorcomm_default_plat_data(struct pci_dev *pdev) if (!plat) return NULL; - plat->mdio_bus_data = devm_kzalloc(dev, sizeof(*plat->mdio_bus_data), - GFP_KERNEL); + plat->mdio_bus_data = devm_kzalloc_obj(dev, *plat->mdio_bus_data); if (!plat->mdio_bus_data) return NULL; - plat->axi = devm_kzalloc(dev, sizeof(*plat->axi), GFP_KERNEL); + plat->axi = devm_kzalloc_obj(dev, *plat->axi); if (!plat->axi) return NULL; @@ -297,7 +296,7 @@ static int motorcomm_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct stmmac_resources res = {}; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-nuvoton.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-nuvoton.c index b027cdf6afc2..065e8f07cec2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-nuvoton.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-nuvoton.c @@ -95,7 +95,7 @@ static int nvt_gmac_probe(struct platform_device *pdev) if (IS_ERR(plat_dat)) return dev_err_probe(dev, PTR_ERR(plat_dat), "Failed to get platform data\n"); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return dev_err_probe(dev, -ENOMEM, "Failed to allocate private data\n"); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index d59be76a2091..d24509a4b4d7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -890,7 +890,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) "dt configuration failed\n"); } - ethqos = devm_kzalloc(dev, sizeof(*ethqos), GFP_KERNEL); + ethqos = devm_kzalloc_obj(dev, *ethqos); if (!ethqos) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c index 9af32c26f9c1..41842f6bfa19 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c @@ -151,7 +151,7 @@ static int renesas_gbeth_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(plat_dat), "dt configuration failed\n"); - gbeth = devm_kzalloc(dev, sizeof(*gbeth), GFP_KERNEL); + gbeth = devm_kzalloc_obj(dev, *gbeth); if (!gbeth) return -ENOMEM; @@ -159,8 +159,8 @@ static int renesas_gbeth_probe(struct platform_device *pdev) gbeth->of_data = of_data; plat_dat->num_clks = of_data->num_clks; - plat_dat->clks = devm_kcalloc(dev, plat_dat->num_clks, - sizeof(*plat_dat->clks), GFP_KERNEL); + plat_dat->clks = devm_kzalloc_objs(dev, *plat_dat->clks, + plat_dat->num_clks); if (!plat_dat->clks) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index c4db919ec164..a37df5767d84 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c @@ -1143,8 +1143,8 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat) if (phy_iface == PHY_INTERFACE_MODE_RMII) bsp_priv->num_clks += ARRAY_SIZE(rk_rmii_clocks); - bsp_priv->clks = devm_kcalloc(dev, bsp_priv->num_clks, - sizeof(*bsp_priv->clks), GFP_KERNEL); + bsp_priv->clks = devm_kzalloc_objs(dev, *bsp_priv->clks, + bsp_priv->num_clks); if (!bsp_priv->clks) return -ENOMEM; @@ -1288,7 +1288,7 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, const char *strings = NULL; int value; - bsp_priv = devm_kzalloc(dev, sizeof(*bsp_priv), GFP_KERNEL); + bsp_priv = devm_kzalloc_obj(dev, *bsp_priv); if (!bsp_priv) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c index 024d8e10e918..1f51df491370 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c @@ -149,7 +149,7 @@ static int s32_dwmac_probe(struct platform_device *pdev) struct s32_priv_data *gmac; int ret; - gmac = devm_kzalloc(&pdev->dev, sizeof(*gmac), GFP_KERNEL); + gmac = devm_kzalloc_obj(&pdev->dev, *gmac); if (!gmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 6d4bc1fe8f75..3a89c4da2af5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -619,7 +619,7 @@ static int socfpga_dwmac_probe(struct platform_device *pdev) if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); - dwmac = devm_kzalloc(dev, sizeof(*dwmac), GFP_KERNEL); + dwmac = devm_kzalloc_obj(dev, *dwmac); if (!dwmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-spacemit.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-spacemit.c index 62d8ac538679..1c16aecb2d83 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-spacemit.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-spacemit.c @@ -162,7 +162,7 @@ static int spacemit_dwmac_probe(struct platform_device *pdev) return dev_err_probe(dev, ret, "failed to get platform resources\n"); - dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + dwmac = devm_kzalloc_obj(&pdev->dev, *dwmac); if (!dwmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c index 4ee5b5fe1fa7..b21a58bc1b15 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c @@ -105,7 +105,7 @@ static int starfive_dwmac_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(plat_dat), "dt configuration failed\n"); - dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + dwmac = devm_kzalloc_obj(&pdev->dev, *dwmac); if (!dwmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c index 6ebbf95d158f..33c31e37e5ab 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c @@ -268,7 +268,7 @@ static int sti_dwmac_probe(struct platform_device *pdev) if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); - dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + dwmac = devm_kzalloc_obj(&pdev->dev, *dwmac); if (!dwmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c index e1b260ed4790..4b8a177046cc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c @@ -538,7 +538,7 @@ static int stm32_dwmac_probe(struct platform_device *pdev) if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); - dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + dwmac = devm_kzalloc_obj(&pdev->dev, *dwmac); if (!dwmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c index 47954537b29e..2ece7ba9dd73 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -1138,7 +1138,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) if (ret) return ret; - gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL); + gmac = devm_kzalloc_obj(dev, *gmac); if (!gmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c index 74bd996d93c9..79446601c998 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c @@ -112,7 +112,7 @@ static int sun7i_gmac_probe(struct platform_device *pdev) if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); - gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL); + gmac = devm_kzalloc_obj(dev, *gmac); if (!gmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c index 4ede4420c93b..f786b6ce4480 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c @@ -220,7 +220,7 @@ static int tegra_mgbe_probe(struct platform_device *pdev) int irq, err, i; u32 value; - mgbe = devm_kzalloc(&pdev->dev, sizeof(*mgbe), GFP_KERNEL); + mgbe = devm_kzalloc_obj(&pdev->dev, *mgbe); if (!mgbe) return -ENOMEM; @@ -253,8 +253,8 @@ static int tegra_mgbe_probe(struct platform_device *pdev) res.addr = mgbe->regs; res.irq = irq; - mgbe->clks = devm_kcalloc(&pdev->dev, ARRAY_SIZE(mgbe_clks), - sizeof(*mgbe->clks), GFP_KERNEL); + mgbe->clks = devm_kzalloc_objs(&pdev->dev, *mgbe->clks, + ARRAY_SIZE(mgbe_clks)); if (!mgbe->clks) return -ENOMEM; @@ -332,8 +332,8 @@ static int tegra_mgbe_probe(struct platform_device *pdev) plat->mdio_node = of_get_child_by_name(pdev->dev.of_node, "mdio"); if (!plat->mdio_bus_data) { - plat->mdio_bus_data = devm_kzalloc(&pdev->dev, sizeof(*plat->mdio_bus_data), - GFP_KERNEL); + plat->mdio_bus_data = devm_kzalloc_obj(&pdev->dev, + *plat->mdio_bus_data); if (!plat->mdio_bus_data) { err = -ENOMEM; goto disable_clks; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c index 0d46a6c3f077..b9c9b666e53c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c @@ -245,7 +245,7 @@ static int thead_dwmac_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(apb_clk), "failed to get apb clock\n"); - dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + dwmac = devm_kzalloc_obj(&pdev->dev, *dwmac); if (!dwmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c index 9497b13a5753..1826e732c55b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c @@ -217,7 +217,7 @@ static int visconti_eth_dwmac_probe(struct platform_device *pdev) if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); - dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + dwmac = devm_kzalloc_obj(&pdev->dev, *dwmac); if (!dwmac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c index 265671170bf6..8d26b43ab2a6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c @@ -328,7 +328,7 @@ int stmmac_hwif_init(struct stmmac_priv *priv) /* Save ID for later use */ priv->synopsys_id = version.snpsver; - mac = devm_kzalloc(priv->device, sizeof(*mac), GFP_KERNEL); + mac = devm_kzalloc_obj(priv->device, *mac); if (!mac) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 9ded31150fbe..29f00f16a6bc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3850,7 +3850,7 @@ static int stmmac_msi_init(struct stmmac_priv *priv, { int i; - priv->msi = devm_kmalloc(priv->device, sizeof(*priv->msi), GFP_KERNEL); + priv->msi = devm_kmalloc_obj(priv->device, *priv->msi); if (!priv->msi) return -ENOMEM; @@ -7934,7 +7934,7 @@ struct plat_stmmacenet_data *stmmac_plat_dat_alloc(struct device *dev) struct plat_stmmacenet_data *plat_dat; int i; - plat_dat = devm_kzalloc(dev, sizeof(*plat_dat), GFP_KERNEL); + plat_dat = devm_kzalloc_obj(dev, *plat_dat); if (!plat_dat) return NULL; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index d584fd2daa6f..d804cb9a8813 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c @@ -85,7 +85,7 @@ static int snps_gmac5_default_data(struct pci_dev *pdev, plat->dma_cfg->pblx8 = true; /* Axi Configuration */ - plat->axi = devm_kzalloc(&pdev->dev, sizeof(*plat->axi), GFP_KERNEL); + plat->axi = devm_kzalloc_obj(&pdev->dev, *plat->axi); if (!plat->axi) return -ENOMEM; @@ -128,15 +128,12 @@ static int stmmac_pci_probe(struct pci_dev *pdev, if (!plat) return -ENOMEM; - plat->mdio_bus_data = devm_kzalloc(&pdev->dev, - sizeof(*plat->mdio_bus_data), - GFP_KERNEL); + plat->mdio_bus_data = devm_kzalloc_obj(&pdev->dev, *plat->mdio_bus_data); if (!plat->mdio_bus_data) return -ENOMEM; - plat->safety_feat_cfg = devm_kzalloc(&pdev->dev, - sizeof(*plat->safety_feat_cfg), - GFP_KERNEL); + plat->safety_feat_cfg = devm_kzalloc_obj(&pdev->dev, + *plat->safety_feat_cfg); if (!plat->safety_feat_cfg) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c index df37af5ab837..dba3601607e9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c @@ -222,7 +222,7 @@ int stmmac_integrated_pcs_init(struct stmmac_priv *priv, { struct stmmac_pcs *spcs; - spcs = devm_kzalloc(priv->device, sizeof(*spcs), GFP_KERNEL); + spcs = devm_kzalloc_obj(priv->device, *spcs); if (!spcs) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 3ea16d618215..b3e06aa58fe5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -102,7 +102,7 @@ static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev) if (!np) return NULL; - axi = devm_kzalloc(&pdev->dev, sizeof(*axi), GFP_KERNEL); + axi = devm_kzalloc_obj(&pdev->dev, *axi); if (!axi) { of_node_put(np); return ERR_PTR(-ENOMEM); @@ -352,9 +352,8 @@ static int stmmac_mdio_setup(struct plat_stmmacenet_data *plat, dev_info(dev, "Deprecated MDIO bus assumption used\n"); if (plat->mdio_node || legacy_mdio) { - plat->mdio_bus_data = devm_kzalloc(dev, - sizeof(*plat->mdio_bus_data), - GFP_KERNEL); + plat->mdio_bus_data = devm_kzalloc_obj(dev, + *plat->mdio_bus_data); if (!plat->mdio_bus_data) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index e137fb9012d4..e948e3c8c8ac 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -243,10 +243,8 @@ static int tc_rfs_init(struct stmmac_priv *priv) for (i = 0; i < STMMAC_RFS_T_MAX; i++) priv->rfs_entries_total += priv->rfs_entries_max[i]; - priv->rfs_entries = devm_kcalloc(priv->device, - priv->rfs_entries_total, - sizeof(*priv->rfs_entries), - GFP_KERNEL); + priv->rfs_entries = devm_kzalloc_objs(priv->device, *priv->rfs_entries, + priv->rfs_entries_total); if (!priv->rfs_entries) return -ENOMEM; @@ -264,10 +262,9 @@ static int tc_init(struct stmmac_priv *priv) priv->flow_entries_max = dma_cap->l3l4fnum; if (priv->flow_entries_max) { - priv->flow_entries = devm_kcalloc(priv->device, - priv->flow_entries_max, - sizeof(*priv->flow_entries), - GFP_KERNEL); + priv->flow_entries = devm_kzalloc_objs(priv->device, + *priv->flow_entries, + priv->flow_entries_max); if (!priv->flow_entries) return -ENOMEM; @@ -316,8 +313,8 @@ static int tc_init(struct stmmac_priv *priv) /* Reserve one last filter which lets all pass */ priv->tc_entries_max = count; - priv->tc_entries = devm_kcalloc(priv->device, - count, sizeof(*priv->tc_entries), GFP_KERNEL); + priv->tc_entries = devm_kzalloc_objs(priv->device, *priv->tc_entries, + count); if (!priv->tc_entries) return -ENOMEM; @@ -1024,8 +1021,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv, return -ERANGE; if (!priv->est) { - priv->est = devm_kzalloc(priv->device, sizeof(*priv->est), - GFP_KERNEL); + priv->est = devm_kzalloc_obj(priv->device, *priv->est); if (!priv->est) return -ENOMEM; diff --git a/drivers/net/ethernet/sunplus/spl2sw_driver.c b/drivers/net/ethernet/sunplus/spl2sw_driver.c index 5e0e4c9ecbb0..9ccaf928ed66 100644 --- a/drivers/net/ethernet/sunplus/spl2sw_driver.c +++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c @@ -333,7 +333,7 @@ static int spl2sw_probe(struct platform_device *pdev) return -ENODEV; /* Allocate memory for 'spl2sw_common' area. */ - comm = devm_kzalloc(&pdev->dev, sizeof(*comm), GFP_KERNEL); + comm = devm_kzalloc_obj(&pdev->dev, *comm); if (!comm) return -ENOMEM; diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 2551554add17..f8e8b3d1b474 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -3540,7 +3540,7 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev) "TX SW_DATA size exceeds AM65_CPSW_NAV_SW_DATA_SIZE"); BUILD_BUG_ON_MSG(sizeof(struct am65_cpsw_swdata) > AM65_CPSW_NAV_SW_DATA_SIZE, "SW_DATA size exceeds AM65_CPSW_NAV_SW_DATA_SIZE"); - common = devm_kzalloc(dev, sizeof(struct am65_cpsw_common), GFP_KERNEL); + common = devm_kzalloc_obj(dev, struct am65_cpsw_common); if (!common) return -ENOMEM; common->dev = dev; @@ -3576,9 +3576,7 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev) common->pf_p0_rx_ptype_rrobin = true; common->default_vlan = 1; - common->ports = devm_kcalloc(dev, common->port_num, - sizeof(*common->ports), - GFP_KERNEL); + common->ports = devm_kzalloc_objs(dev, *common->ports, common->port_num); if (!common->ports) return -ENOMEM; diff --git a/drivers/net/ethernet/ti/am65-cpsw-qos.c b/drivers/net/ethernet/ti/am65-cpsw-qos.c index 66e8b224827b..d2523d61a394 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-qos.c +++ b/drivers/net/ethernet/ti/am65-cpsw-qos.c @@ -884,9 +884,8 @@ static int am65_cpsw_taprio_replace(struct net_device *ndev, return -EOPNOTSUPP; } - est_new = devm_kzalloc(&ndev->dev, - struct_size(est_new, taprio.entries, taprio->num_entries), - GFP_KERNEL); + est_new = devm_kzalloc_flex(&ndev->dev, *est_new, taprio.entries, + taprio->num_entries); if (!est_new) return -ENOMEM; diff --git a/drivers/net/ethernet/ti/am65-cpts.c b/drivers/net/ethernet/ti/am65-cpts.c index df5659ead72f..ddad200f5877 100644 --- a/drivers/net/ethernet/ti/am65-cpts.c +++ b/drivers/net/ethernet/ti/am65-cpts.c @@ -1154,7 +1154,7 @@ struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs, struct am65_cpts *cpts; int ret, i; - cpts = devm_kzalloc(dev, sizeof(*cpts), GFP_KERNEL); + cpts = devm_kzalloc_obj(dev, *cpts); if (!cpts) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c index 4edb7963f856..525aae87fd72 100644 --- a/drivers/net/ethernet/ti/cpsw-phy-sel.c +++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c @@ -212,7 +212,7 @@ static int cpsw_phy_sel_probe(struct platform_device *pdev) if (!of_id) return -EINVAL; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) { dev_err(&pdev->dev, "unable to alloc memory for cpsw phy sel\n"); return -ENOMEM; diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 8d36124520ad..14350ec5b7d0 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -1301,10 +1301,8 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, } data->active_slave = prop; - data->slave_data = devm_kcalloc(&pdev->dev, - data->slaves, - sizeof(struct cpsw_slave_data), - GFP_KERNEL); + data->slave_data = devm_kzalloc_objs(&pdev->dev, struct cpsw_slave_data, + data->slaves); if (!data->slave_data) return -ENOMEM; @@ -1570,7 +1568,7 @@ static int cpsw_probe(struct platform_device *pdev) int ret = 0, ch; int irq; - cpsw = devm_kzalloc(dev, sizeof(struct cpsw_common), GFP_KERNEL); + cpsw = devm_kzalloc_obj(dev, struct cpsw_common); if (!cpsw) return -ENOMEM; @@ -1642,9 +1640,7 @@ static int cpsw_probe(struct platform_device *pdev) cpsw->quirk_irq = true; data = &cpsw->data; - cpsw->slaves = devm_kcalloc(dev, - data->slaves, sizeof(struct cpsw_slave), - GFP_KERNEL); + cpsw->slaves = devm_kzalloc_objs(dev, struct cpsw_slave, data->slaves); if (!cpsw->slaves) { ret = -ENOMEM; goto clean_dt_ret; diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c index e202bba49480..9304405c9581 100644 --- a/drivers/net/ethernet/ti/cpsw_ale.c +++ b/drivers/net/ethernet/ti/cpsw_ale.c @@ -1537,7 +1537,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params) params->reg_fields = ale_dev_id->reg_fields; params->num_fields = ale_dev_id->num_fields; - ale = devm_kzalloc(params->dev, sizeof(*ale), GFP_KERNEL); + ale = devm_kzalloc_obj(params->dev, *ale); if (!ale) return ERR_PTR(-ENOMEM); ale->regmap = devm_regmap_init_mmio(params->dev, params->ale_regs, diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c index 07832cad5e3c..9ea7b6ffc992 100644 --- a/drivers/net/ethernet/ti/cpsw_new.c +++ b/drivers/net/ethernet/ti/cpsw_new.c @@ -1266,9 +1266,8 @@ static int cpsw_probe_dt(struct cpsw_common *cpsw) data->bd_ram_size = CPSW_BD_RAM_SIZE; data->mac_control = 0; - data->slave_data = devm_kcalloc(dev, CPSW_SLAVE_PORTS_NUM, - sizeof(struct cpsw_slave_data), - GFP_KERNEL); + data->slave_data = devm_kzalloc_objs(dev, struct cpsw_slave_data, + CPSW_SLAVE_PORTS_NUM); if (!data->slave_data) { of_node_put(tmp_node); return -ENOMEM; @@ -1896,7 +1895,7 @@ static int cpsw_probe(struct platform_device *pdev) struct clk *clk; int irq; - cpsw = devm_kzalloc(dev, sizeof(struct cpsw_common), GFP_KERNEL); + cpsw = devm_kzalloc_obj(dev, struct cpsw_common); if (!cpsw) return -ENOMEM; @@ -1904,10 +1903,8 @@ static int cpsw_probe(struct platform_device *pdev) cpsw->dev = dev; - cpsw->slaves = devm_kcalloc(dev, - CPSW_SLAVE_PORTS_NUM, - sizeof(struct cpsw_slave), - GFP_KERNEL); + cpsw->slaves = devm_kzalloc_objs(dev, struct cpsw_slave, + CPSW_SLAVE_PORTS_NUM); if (!cpsw->slaves) return -ENOMEM; diff --git a/drivers/net/ethernet/ti/cpsw_sl.c b/drivers/net/ethernet/ti/cpsw_sl.c index 761719a348fa..f06ff76e3eb2 100644 --- a/drivers/net/ethernet/ti/cpsw_sl.c +++ b/drivers/net/ethernet/ti/cpsw_sl.c @@ -236,7 +236,7 @@ struct cpsw_sl *cpsw_sl_get(const char *device_id, struct device *dev, const struct cpsw_sl_dev_id *sl_dev_id; struct cpsw_sl *sl; - sl = devm_kzalloc(dev, sizeof(struct cpsw_sl), GFP_KERNEL); + sl = devm_kzalloc_obj(dev, struct cpsw_sl); if (!sl) return ERR_PTR(-ENOMEM); sl->dev = dev; diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c index 2ba4c8795d60..bf4d6654daa1 100644 --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c @@ -669,11 +669,9 @@ static int cpts_of_mux_clk_setup(struct cpts *cpts, struct device_node *node) goto mux_fail; } - parent_names = devm_kcalloc(cpts->dev, num_parents, - sizeof(*parent_names), GFP_KERNEL); + parent_names = devm_kzalloc_objs(cpts->dev, *parent_names, num_parents); - mux_table = devm_kcalloc(cpts->dev, num_parents, sizeof(*mux_table), - GFP_KERNEL); + mux_table = devm_kzalloc_objs(cpts->dev, *mux_table, num_parents); if (!mux_table || !parent_names) { ret = -ENOMEM; goto mux_fail; @@ -749,7 +747,7 @@ struct cpts *cpts_create(struct device *dev, void __iomem *regs, struct cpts *cpts; int ret; - cpts = devm_kzalloc(dev, sizeof(*cpts), GFP_KERNEL); + cpts = devm_kzalloc_obj(dev, *cpts); if (!cpts) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c index 41e89a19be53..a8aa1291c281 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.c +++ b/drivers/net/ethernet/ti/davinci_cpdma.c @@ -215,7 +215,7 @@ static int cpdma_desc_pool_create(struct cpdma_ctlr *ctlr) struct cpdma_desc_pool *pool; int ret = -ENOMEM; - pool = devm_kzalloc(ctlr->dev, sizeof(*pool), GFP_KERNEL); + pool = devm_kzalloc_obj(ctlr->dev, *pool); if (!pool) goto gen_pool_create_fail; ctlr->pool = pool; @@ -511,7 +511,7 @@ struct cpdma_ctlr *cpdma_ctlr_create(struct cpdma_params *params) { struct cpdma_ctlr *ctlr; - ctlr = devm_kzalloc(params->dev, sizeof(*ctlr), GFP_KERNEL); + ctlr = devm_kzalloc_obj(params->dev, *ctlr); if (!ctlr) return NULL; @@ -897,7 +897,7 @@ struct cpdma_chan *cpdma_chan_create(struct cpdma_ctlr *ctlr, int chan_num, if (__chan_linear(chan_num) >= ctlr->num_chan) return ERR_PTR(-EINVAL); - chan = devm_kzalloc(ctlr->dev, sizeof(*chan), GFP_KERNEL); + chan = devm_kzalloc_obj(ctlr->dev, *chan); if (!chan) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 3802122d0f1b..e14a08091eb3 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c @@ -1725,7 +1725,7 @@ davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv) if (!IS_ENABLED(CONFIG_OF) || !pdev->dev.of_node) return dev_get_platdata(&pdev->dev); - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return NULL; diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c index 5bec72f2f51d..c413887657e9 100644 --- a/drivers/net/ethernet/ti/davinci_mdio.c +++ b/drivers/net/ethernet/ti/davinci_mdio.c @@ -544,7 +544,7 @@ static int davinci_mdio_probe(struct platform_device *pdev) int autosuspend_delay_ms = -1; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/net/ethernet/ti/icssg/icss_iep.c b/drivers/net/ethernet/ti/icssg/icss_iep.c index ec085897edf0..8b05db259933 100644 --- a/drivers/net/ethernet/ti/icssg/icss_iep.c +++ b/drivers/net/ethernet/ti/icssg/icss_iep.c @@ -844,7 +844,7 @@ static int icss_iep_probe(struct platform_device *pdev) struct clk *iep_clk; int ret, irq; - iep = devm_kzalloc(dev, sizeof(*iep), GFP_KERNEL); + iep = devm_kzalloc_obj(dev, *iep); if (!iep) return -ENOMEM; diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c index 591be5c8056b..c9659a3d40dc 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c @@ -2195,7 +2195,7 @@ static int prueth_probe(struct platform_device *pdev) BUILD_BUG_ON_MSG((sizeof(struct prueth_swdata) > PRUETH_NAV_SW_DATA_SIZE), "insufficient SW_DATA size"); - prueth = devm_kzalloc(dev, sizeof(*prueth), GFP_KERNEL); + prueth = devm_kzalloc_obj(dev, *prueth); if (!prueth) return -ENOMEM; diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c b/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c index b8115ca47082..7aab221fead0 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c @@ -900,7 +900,7 @@ static int prueth_probe(struct platform_device *pdev) np = dev->of_node; - prueth = devm_kzalloc(dev, sizeof(*prueth), GFP_KERNEL); + prueth = devm_kzalloc_obj(dev, *prueth); if (!prueth) return -ENOMEM; diff --git a/drivers/net/ethernet/ti/icssm/icssm_prueth.c b/drivers/net/ethernet/ti/icssm/icssm_prueth.c index b42c98e861e0..1aadef061e92 100644 --- a/drivers/net/ethernet/ti/icssm/icssm_prueth.c +++ b/drivers/net/ethernet/ti/icssm/icssm_prueth.c @@ -1804,7 +1804,7 @@ static int icssm_prueth_probe(struct platform_device *pdev) if (!np) return -ENODEV; /* we don't support non DT */ - prueth = devm_kzalloc(dev, sizeof(*prueth), GFP_KERNEL); + prueth = devm_kzalloc_obj(dev, *prueth); if (!prueth) return -ENOMEM; diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c index 4f9e20468bbb..f5e093dc983b 100644 --- a/drivers/net/ethernet/ti/netcp_core.c +++ b/drivers/net/ethernet/ti/netcp_core.c @@ -265,7 +265,7 @@ static int netcp_module_probe(struct netcp_device *netcp_device, return NETCP_MOD_PROBE_SKIPPED; } - inst_modpriv = devm_kzalloc(dev, sizeof(*inst_modpriv), GFP_KERNEL); + inst_modpriv = devm_kzalloc_obj(dev, *inst_modpriv); if (!inst_modpriv) { of_node_put(child); return -ENOMEM; @@ -300,8 +300,7 @@ static int netcp_module_probe(struct netcp_device *netcp_device, interface_list) { struct netcp_intf_modpriv *intf_modpriv; - intf_modpriv = devm_kzalloc(dev, sizeof(*intf_modpriv), - GFP_KERNEL); + intf_modpriv = devm_kzalloc_obj(dev, *intf_modpriv); if (!intf_modpriv) return -ENOMEM; @@ -474,7 +473,7 @@ int netcp_register_txhook(struct netcp_intf *netcp_priv, int order, struct netcp_hook_list *next; unsigned long flags; - entry = devm_kzalloc(netcp_priv->dev, sizeof(*entry), GFP_KERNEL); + entry = devm_kzalloc_obj(netcp_priv->dev, *entry); if (!entry) return -ENOMEM; @@ -523,7 +522,7 @@ int netcp_register_rxhook(struct netcp_intf *netcp_priv, int order, struct netcp_hook_list *next; unsigned long flags; - entry = devm_kzalloc(netcp_priv->dev, sizeof(*entry), GFP_KERNEL); + entry = devm_kzalloc_obj(netcp_priv->dev, *entry); if (!entry) return -ENOMEM; @@ -1401,7 +1400,7 @@ static struct netcp_addr *netcp_addr_add(struct netcp_intf *netcp, { struct netcp_addr *naddr; - naddr = devm_kmalloc(netcp->dev, sizeof(*naddr), GFP_ATOMIC); + naddr = devm_kmalloc_obj(netcp->dev, *naddr, GFP_ATOMIC); if (!naddr) return NULL; @@ -2220,7 +2219,7 @@ static int netcp_probe(struct platform_device *pdev) } /* Allocate a new NETCP device instance */ - netcp_device = devm_kzalloc(dev, sizeof(*netcp_device), GFP_KERNEL); + netcp_device = devm_kzalloc_obj(dev, *netcp_device); if (!netcp_device) return -ENOMEM; diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index 8f46e9be76b1..ff1fa0a21312 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -3120,7 +3120,7 @@ static void init_secondary_ports(struct gbe_priv *gbe_dev, bool mac_phy_link = false; for_each_child_of_node(node, port) { - slave = devm_kzalloc(dev, sizeof(*slave), GFP_KERNEL); + slave = devm_kzalloc_obj(dev, *slave); if (!slave) { dev_err(dev, "memory alloc failed for secondary port(%pOFn), skipping...\n", port); @@ -3270,18 +3270,15 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev, gbe_dev->et_stats = xgbe10_et_stats; gbe_dev->num_et_stats = ARRAY_SIZE(xgbe10_et_stats); - gbe_dev->hw_stats = devm_kcalloc(gbe_dev->dev, - gbe_dev->num_et_stats, sizeof(u64), - GFP_KERNEL); + gbe_dev->hw_stats = devm_kzalloc_objs(gbe_dev->dev, u64, + gbe_dev->num_et_stats); if (!gbe_dev->hw_stats) { dev_err(gbe_dev->dev, "hw_stats memory allocation failed\n"); return -ENOMEM; } gbe_dev->hw_stats_prev = - devm_kcalloc(gbe_dev->dev, - gbe_dev->num_et_stats, sizeof(u32), - GFP_KERNEL); + devm_kzalloc_objs(gbe_dev->dev, u32, gbe_dev->num_et_stats); if (!gbe_dev->hw_stats_prev) { dev_err(gbe_dev->dev, "hw_stats_prev memory allocation failed\n"); @@ -3389,18 +3386,15 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev, gbe_dev->et_stats = gbe13_et_stats; gbe_dev->num_et_stats = ARRAY_SIZE(gbe13_et_stats); - gbe_dev->hw_stats = devm_kcalloc(gbe_dev->dev, - gbe_dev->num_et_stats, sizeof(u64), - GFP_KERNEL); + gbe_dev->hw_stats = devm_kzalloc_objs(gbe_dev->dev, u64, + gbe_dev->num_et_stats); if (!gbe_dev->hw_stats) { dev_err(gbe_dev->dev, "hw_stats memory allocation failed\n"); return -ENOMEM; } gbe_dev->hw_stats_prev = - devm_kcalloc(gbe_dev->dev, - gbe_dev->num_et_stats, sizeof(u32), - GFP_KERNEL); + devm_kzalloc_objs(gbe_dev->dev, u32, gbe_dev->num_et_stats); if (!gbe_dev->hw_stats_prev) { dev_err(gbe_dev->dev, "hw_stats_prev memory allocation failed\n"); @@ -3460,18 +3454,15 @@ static int set_gbenu_ethss_priv(struct gbe_priv *gbe_dev, gbe_dev->num_et_stats = GBENU_ET_STATS_HOST_SIZE + GBENU_ET_STATS_PORT_SIZE; - gbe_dev->hw_stats = devm_kcalloc(gbe_dev->dev, - gbe_dev->num_et_stats, sizeof(u64), - GFP_KERNEL); + gbe_dev->hw_stats = devm_kzalloc_objs(gbe_dev->dev, u64, + gbe_dev->num_et_stats); if (!gbe_dev->hw_stats) { dev_err(gbe_dev->dev, "hw_stats memory allocation failed\n"); return -ENOMEM; } gbe_dev->hw_stats_prev = - devm_kcalloc(gbe_dev->dev, - gbe_dev->num_et_stats, sizeof(u32), - GFP_KERNEL); + devm_kzalloc_objs(gbe_dev->dev, u32, gbe_dev->num_et_stats); if (!gbe_dev->hw_stats_prev) { dev_err(gbe_dev->dev, "hw_stats_prev memory allocation failed\n"); @@ -3555,7 +3546,7 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev, return -ENODEV; } - gbe_dev = devm_kzalloc(dev, sizeof(struct gbe_priv), GFP_KERNEL); + gbe_dev = devm_kzalloc_obj(dev, struct gbe_priv); if (!gbe_dev) return -ENOMEM; @@ -3750,7 +3741,7 @@ static int gbe_attach(void *inst_priv, struct net_device *ndev, return -ENODEV; } - gbe_intf = devm_kzalloc(gbe_dev->dev, sizeof(*gbe_intf), GFP_KERNEL); + gbe_intf = devm_kzalloc_obj(gbe_dev->dev, *gbe_intf); if (!gbe_intf) return -ENOMEM; @@ -3758,9 +3749,7 @@ static int gbe_attach(void *inst_priv, struct net_device *ndev, gbe_intf->dev = gbe_dev->dev; gbe_intf->gbe_dev = gbe_dev; - gbe_intf->slave = devm_kzalloc(gbe_dev->dev, - sizeof(*gbe_intf->slave), - GFP_KERNEL); + gbe_intf->slave = devm_kzalloc_obj(gbe_dev->dev, *gbe_intf->slave); if (!gbe_intf->slave) { ret = -ENOMEM; goto fail; diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c index eb91c4f28ecd..184194200917 100644 --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c @@ -918,7 +918,7 @@ static int txgbe_probe(struct pci_dev *pdev, goto err_release_hw; } - txgbe = devm_kzalloc(&pdev->dev, sizeof(*txgbe), GFP_KERNEL); + txgbe = devm_kzalloc_obj(&pdev->dev, *txgbe); if (!txgbe) { err = -ENOMEM; goto err_release_hw; diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c index c81d485221d5..f40ee2935e6b 100644 --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c @@ -390,7 +390,7 @@ static int txgbe_gpio_init(struct txgbe *txgbe) raw_spin_lock_init(&wx->gpio_lock); - gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL); + gc = devm_kzalloc_obj(dev, *gc); if (!gc) return -ENOMEM; diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c index 303b4da66399..45d16464c2e8 100644 --- a/drivers/net/ethernet/xilinx/ll_temac_main.c +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c @@ -329,8 +329,7 @@ static int temac_dma_bd_init(struct net_device *ndev) dma_addr_t skb_dma_addr; int i; - lp->rx_skb = devm_kcalloc(&ndev->dev, lp->rx_bd_num, - sizeof(*lp->rx_skb), GFP_KERNEL); + lp->rx_skb = devm_kzalloc_objs(&ndev->dev, *lp->rx_skb, lp->rx_bd_num); if (!lp->rx_skb) goto out; @@ -1434,9 +1433,8 @@ static int temac_probe(struct platform_device *pdev) } lp->indirect_lock = pdata->indirect_lock; } else { - lp->indirect_lock = devm_kmalloc(&pdev->dev, - sizeof(*lp->indirect_lock), - GFP_KERNEL); + lp->indirect_lock = devm_kmalloc_obj(&pdev->dev, + *lp->indirect_lock); if (!lp->indirect_lock) return -ENOMEM; spin_lock_init(lp->indirect_lock); diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index b0faa0f1780d..9313c74ec130 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -1442,7 +1442,7 @@ static struct eth_plat_info *ixp4xx_of_get_platdata(struct device *dev) u8 mac[ETH_ALEN]; int ret; - plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL); + plat = devm_kzalloc_obj(dev, *plat); if (!plat) return NULL; diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c index abfcfe07246a..5b6ab84fad8a 100644 --- a/drivers/net/ieee802154/cc2520.c +++ b/drivers/net/ieee802154/cc2520.c @@ -1039,7 +1039,7 @@ static int cc2520_probe(struct spi_device *spi) struct gpio_desc *vreg; int ret; - priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&spi->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/mdio/mdio-bcm-iproc.c b/drivers/net/mdio/mdio-bcm-iproc.c index 22473c988e3b..db289de77ec8 100644 --- a/drivers/net/mdio/mdio-bcm-iproc.c +++ b/drivers/net/mdio/mdio-bcm-iproc.c @@ -125,7 +125,7 @@ static int iproc_mdio_probe(struct platform_device *pdev) struct mii_bus *bus; int rc; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/mdio/mdio-bcm-unimac.c b/drivers/net/mdio/mdio-bcm-unimac.c index 31e396cc9fbf..80fb3b5b52ab 100644 --- a/drivers/net/mdio/mdio-bcm-unimac.c +++ b/drivers/net/mdio/mdio-bcm-unimac.c @@ -245,7 +245,7 @@ static int unimac_mdio_probe(struct platform_device *pdev) np = pdev->dev.of_node; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/mdio/mdio-gpio.c b/drivers/net/mdio/mdio-gpio.c index 958d1c6608ab..96e962f412b6 100644 --- a/drivers/net/mdio/mdio-gpio.c +++ b/drivers/net/mdio/mdio-gpio.c @@ -160,7 +160,7 @@ static int mdio_gpio_probe(struct platform_device *pdev) struct mii_bus *new_bus; int ret, bus_id; - bitbang = devm_kzalloc(&pdev->dev, sizeof(*bitbang), GFP_KERNEL); + bitbang = devm_kzalloc_obj(&pdev->dev, *bitbang); if (!bitbang) return -ENOMEM; diff --git a/drivers/net/mdio/mdio-mux-bcm-iproc.c b/drivers/net/mdio/mdio-mux-bcm-iproc.c index 8ba0917a930a..bbbfdecf1f38 100644 --- a/drivers/net/mdio/mdio-mux-bcm-iproc.c +++ b/drivers/net/mdio/mdio-mux-bcm-iproc.c @@ -214,7 +214,7 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev) struct resource *res; int rc; - md = devm_kzalloc(&pdev->dev, sizeof(*md), GFP_KERNEL); + md = devm_kzalloc_obj(&pdev->dev, *md); if (!md) return -ENOMEM; md->dev = &pdev->dev; diff --git a/drivers/net/mdio/mdio-mux-bcm6368.c b/drivers/net/mdio/mdio-mux-bcm6368.c index 476f8b72d020..d8f4aae0a8eb 100644 --- a/drivers/net/mdio/mdio-mux-bcm6368.c +++ b/drivers/net/mdio/mdio-mux-bcm6368.c @@ -93,7 +93,7 @@ static int bcm6368_mdiomux_probe(struct platform_device *pdev) struct resource *res; int rc; - md = devm_kzalloc(&pdev->dev, sizeof(*md), GFP_KERNEL); + md = devm_kzalloc_obj(&pdev->dev, *md); if (!md) return -ENOMEM; md->dev = &pdev->dev; diff --git a/drivers/net/mdio/mdio-mux-gpio.c b/drivers/net/mdio/mdio-mux-gpio.c index fefa40ea5227..4eaed599aaac 100644 --- a/drivers/net/mdio/mdio-mux-gpio.c +++ b/drivers/net/mdio/mdio-mux-gpio.c @@ -45,7 +45,7 @@ static int mdio_mux_gpio_probe(struct platform_device *pdev) if (IS_ERR(gpios)) return PTR_ERR(gpios); - s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL); + s = devm_kzalloc_obj(&pdev->dev, *s); if (!s) return -ENOMEM; diff --git a/drivers/net/mdio/mdio-mux-meson-g12a.c b/drivers/net/mdio/mdio-mux-meson-g12a.c index e6c9ef3641af..71c44385489d 100644 --- a/drivers/net/mdio/mdio-mux-meson-g12a.c +++ b/drivers/net/mdio/mdio-mux-meson-g12a.c @@ -244,7 +244,7 @@ static int g12a_ephy_glue_clk_register(struct device *dev) } /* create the input mux */ - mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(dev, *mux); if (!mux) return -ENOMEM; @@ -271,7 +271,7 @@ static int g12a_ephy_glue_clk_register(struct device *dev) } /* create the pll */ - pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); + pll = devm_kzalloc_obj(dev, *pll); if (!pll) return -ENOMEM; @@ -308,7 +308,7 @@ static int g12a_mdio_mux_probe(struct platform_device *pdev) struct clk *pclk; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/mdio/mdio-mux-meson-gxl.c b/drivers/net/mdio/mdio-mux-meson-gxl.c index 3dd12a8c8b03..f79355fdb0ce 100644 --- a/drivers/net/mdio/mdio-mux-meson-gxl.c +++ b/drivers/net/mdio/mdio-mux-meson-gxl.c @@ -119,7 +119,7 @@ static int gxl_mdio_mux_probe(struct platform_device *pdev) struct clk *rclk; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; platform_set_drvdata(pdev, priv); diff --git a/drivers/net/mdio/mdio-mux-mmioreg.c b/drivers/net/mdio/mdio-mux-mmioreg.c index 9c4b1efd0d53..4fbe628415bc 100644 --- a/drivers/net/mdio/mdio-mux-mmioreg.c +++ b/drivers/net/mdio/mdio-mux-mmioreg.c @@ -104,7 +104,7 @@ static int mdio_mux_mmioreg_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "probing node %pOF\n", np); - s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL); + s = devm_kzalloc_obj(&pdev->dev, *s); if (!s) return -ENOMEM; diff --git a/drivers/net/mdio/mdio-mux-multiplexer.c b/drivers/net/mdio/mdio-mux-multiplexer.c index 8e11960fc539..7414bc99ccaa 100644 --- a/drivers/net/mdio/mdio-mux-multiplexer.c +++ b/drivers/net/mdio/mdio-mux-multiplexer.c @@ -67,7 +67,7 @@ static int mdio_mux_multiplexer_probe(struct platform_device *pdev) struct mdio_mux_multiplexer_state *s; int ret = 0; - s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL); + s = devm_kzalloc_obj(&pdev->dev, *s); if (!s) return -ENOMEM; diff --git a/drivers/net/mdio/mdio-mux.c b/drivers/net/mdio/mdio-mux.c index fe0e46bd7964..c0260d00fdc3 100644 --- a/drivers/net/mdio/mdio-mux.c +++ b/drivers/net/mdio/mdio-mux.c @@ -171,7 +171,7 @@ int mdio_mux_init(struct device *dev, get_device(&parent_bus->dev); } - pb = devm_kzalloc(dev, sizeof(*pb), GFP_KERNEL); + pb = devm_kzalloc_obj(dev, *pb); if (!pb) { ret_val = -ENOMEM; goto err_pb_kz; @@ -195,7 +195,7 @@ int mdio_mux_init(struct device *dev, continue; } - cb = devm_kzalloc(dev, sizeof(*cb), GFP_KERNEL); + cb = devm_kzalloc_obj(dev, *cb); if (!cb) { ret_val = -ENOMEM; goto err_loop; diff --git a/drivers/net/mdio/mdio-realtek-rtl9300.c b/drivers/net/mdio/mdio-realtek-rtl9300.c index eb7a6238dbd1..fcffc4931643 100644 --- a/drivers/net/mdio/mdio-realtek-rtl9300.c +++ b/drivers/net/mdio/mdio-realtek-rtl9300.c @@ -1098,7 +1098,7 @@ static int otto_emdio_probe(struct platform_device *pdev) struct otto_emdio_priv *priv; int err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/mdio/mdio-thunder.c b/drivers/net/mdio/mdio-thunder.c index a3047f7258a7..aea067658de2 100644 --- a/drivers/net/mdio/mdio-thunder.c +++ b/drivers/net/mdio/mdio-thunder.c @@ -27,7 +27,7 @@ static int thunder_mdiobus_pci_probe(struct pci_dev *pdev, int err; int i; - nexus = devm_kzalloc(&pdev->dev, sizeof(*nexus), GFP_KERNEL); + nexus = devm_kzalloc_obj(&pdev->dev, *nexus); if (!nexus) return -ENOMEM; diff --git a/drivers/net/mdio/mdio-xgene.c b/drivers/net/mdio/mdio-xgene.c index ede6b9ddc426..78475749a625 100644 --- a/drivers/net/mdio/mdio-xgene.c +++ b/drivers/net/mdio/mdio-xgene.c @@ -336,7 +336,7 @@ static int xgene_mdio_probe(struct platform_device *pdev) if (!mdio_id) return -ENODEV; - pdata = devm_kzalloc(dev, sizeof(struct xgene_mdio_pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, struct xgene_mdio_pdata); if (!pdata) return -ENOMEM; pdata->mdio_id = mdio_id; diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c index f8bafce26bf1..682a73cf5a87 100644 --- a/drivers/net/pcs/pcs-rzn1-miic.c +++ b/drivers/net/pcs/pcs-rzn1-miic.c @@ -790,7 +790,7 @@ static int miic_probe(struct platform_device *pdev) u32 mode_cfg; int ret; - miic = devm_kzalloc(dev, sizeof(*miic), GFP_KERNEL); + miic = devm_kzalloc_obj(dev, *miic); if (!miic) return -ENOMEM; diff --git a/drivers/net/pcs/pcs-xpcs-plat.c b/drivers/net/pcs/pcs-xpcs-plat.c index c4404500bac6..2a6a9a7712c3 100644 --- a/drivers/net/pcs/pcs-xpcs-plat.c +++ b/drivers/net/pcs/pcs-xpcs-plat.c @@ -219,7 +219,7 @@ static struct dw_xpcs_plat *xpcs_plat_create_data(struct platform_device *pdev) { struct dw_xpcs_plat *pxpcs; - pxpcs = devm_kzalloc(&pdev->dev, sizeof(*pxpcs), GFP_KERNEL); + pxpcs = devm_kzalloc_obj(&pdev->dev, *pxpcs); if (!pxpcs) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/pcs/pcs-xpcs-rk.c b/drivers/net/pcs/pcs-xpcs-rk.c index 6f0a110e32d2..ad187fba4e9d 100644 --- a/drivers/net/pcs/pcs-xpcs-rk.c +++ b/drivers/net/pcs/pcs-xpcs-rk.c @@ -225,7 +225,7 @@ static struct dw_xpcs_rk *xpcs_rk_create_data(struct platform_device *pdev) { struct dw_xpcs_rk *pxpcs; - pxpcs = devm_kzalloc(&pdev->dev, sizeof(*pxpcs), GFP_KERNEL); + pxpcs = devm_kzalloc_obj(&pdev->dev, *pxpcs); if (!pxpcs) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c index 3a934051b574..b0cb93be3adb 100644 --- a/drivers/net/phy/adin.c +++ b/drivers/net/phy/adin.c @@ -892,7 +892,7 @@ static int adin_probe(struct phy_device *phydev) struct device *dev = &phydev->mdio.dev; struct adin_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/adin1100.c b/drivers/net/phy/adin1100.c index 8f9753d4318c..f845b440aaef 100644 --- a/drivers/net/phy/adin1100.c +++ b/drivers/net/phy/adin1100.c @@ -311,7 +311,7 @@ static int adin_probe(struct phy_device *phydev) struct device *dev = &phydev->mdio.dev; struct adin_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/air_an8801.c b/drivers/net/phy/air_an8801.c index f97c78e43023..98b3ff6c24eb 100644 --- a/drivers/net/phy/air_an8801.c +++ b/drivers/net/phy/air_an8801.c @@ -1036,7 +1036,7 @@ static int an8801r_probe(struct phy_device *phydev) struct device *dev = &phydev->mdio.dev; struct an8801r_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/air_en8811h.c b/drivers/net/phy/air_en8811h.c index a03d63dd4ac9..81aa9df08dee 100644 --- a/drivers/net/phy/air_en8811h.c +++ b/drivers/net/phy/air_en8811h.c @@ -1135,8 +1135,7 @@ static int an8811hb_probe(struct phy_device *phydev) u32 reg_val; int ret; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(struct en8811h_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, struct en8811h_priv); if (!priv) return -ENOMEM; phydev->priv = priv; @@ -1204,8 +1203,7 @@ static int en8811h_probe(struct phy_device *phydev) struct en8811h_priv *priv; int ret; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(struct en8811h_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, struct en8811h_priv); if (!priv) return -ENOMEM; phydev->priv = priv; diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c index 096407bebd52..66e4e98c7aed 100644 --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -1168,8 +1168,7 @@ static int aqr107_probe(struct phy_device *phydev) { int ret; - phydev->priv = devm_kzalloc(&phydev->mdio.dev, - sizeof(struct aqr107_priv), GFP_KERNEL); + phydev->priv = devm_kzalloc_obj(&phydev->mdio.dev, struct aqr107_priv); if (!phydev->priv) return -ENOMEM; diff --git a/drivers/net/phy/as21xxx.c b/drivers/net/phy/as21xxx.c index d5738117eca6..dbe6be963389 100644 --- a/drivers/net/phy/as21xxx.c +++ b/drivers/net/phy/as21xxx.c @@ -605,8 +605,7 @@ static int as21xxx_probe(struct phy_device *phydev) struct as21xxx_priv *priv; int ret; - priv = devm_kzalloc(&phydev->mdio.dev, - sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; phydev->priv = priv; diff --git a/drivers/net/phy/bcm-cygnus.c b/drivers/net/phy/bcm-cygnus.c index 15cbef8202bc..c7367f78309d 100644 --- a/drivers/net/phy/bcm-cygnus.c +++ b/drivers/net/phy/bcm-cygnus.c @@ -234,15 +234,14 @@ static int bcm_omega_probe(struct phy_device *phydev) { struct bcm_omega_phy_priv *priv; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; phydev->priv = priv; - priv->stats = devm_kcalloc(&phydev->mdio.dev, - bcm_phy_get_sset_count(phydev), sizeof(u64), - GFP_KERNEL); + priv->stats = devm_kzalloc_objs(&phydev->mdio.dev, u64, + bcm_phy_get_sset_count(phydev)); if (!priv->stats) return -ENOMEM; diff --git a/drivers/net/phy/bcm-phy-ptp.c b/drivers/net/phy/bcm-phy-ptp.c index 65d609ed69fb..443917c9d1bc 100644 --- a/drivers/net/phy/bcm-phy-ptp.c +++ b/drivers/net/phy/bcm-phy-ptp.c @@ -929,7 +929,7 @@ struct bcm_ptp_private *bcm_ptp_probe(struct phy_device *phydev) return NULL; } - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/phy/bcm54140.c b/drivers/net/phy/bcm54140.c index a8edf45fd733..2831ca7f6f26 100644 --- a/drivers/net/phy/bcm54140.c +++ b/drivers/net/phy/bcm54140.c @@ -582,7 +582,7 @@ static int bcm54140_probe(struct phy_device *phydev) struct bcm54140_priv *priv; int ret; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c index 71a163f62c0e..44147e4ab294 100644 --- a/drivers/net/phy/bcm7xxx.c +++ b/drivers/net/phy/bcm7xxx.c @@ -824,15 +824,14 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) struct clk *clk; int ret = 0; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; phydev->priv = priv; - priv->stats = devm_kcalloc(&phydev->mdio.dev, - bcm_phy_get_sset_count(phydev), sizeof(u64), - GFP_KERNEL); + priv->stats = devm_kzalloc_objs(&phydev->mdio.dev, u64, + bcm_phy_get_sset_count(phydev)); if (!priv->stats) return -ENOMEM; diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index b515e3875504..9085b72e322f 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -815,7 +815,7 @@ static int bcm54616s_probe(struct phy_device *phydev) struct bcm54616s_phy_priv *priv; int val; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; @@ -1180,7 +1180,7 @@ static int bcm54xx_phy_probe(struct phy_device *phydev) struct gpio_desc *wakeup_gpio; int ret = 0; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; @@ -1188,9 +1188,8 @@ static int bcm54xx_phy_probe(struct phy_device *phydev) phydev->priv = priv; - priv->stats = devm_kcalloc(&phydev->mdio.dev, - bcm_phy_get_sset_count(phydev), sizeof(u64), - GFP_KERNEL); + priv->stats = devm_kzalloc_objs(&phydev->mdio.dev, u64, + bcm_phy_get_sset_count(phydev)); if (!priv->stats) return -ENOMEM; diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c index 6fc86be9d593..d67ca7e4a7e7 100644 --- a/drivers/net/phy/dp83822.c +++ b/drivers/net/phy/dp83822.c @@ -989,7 +989,7 @@ static int dp8382x_probe(struct phy_device *phydev) struct dp83822_private *dp83822; struct clk *clk; - dp83822 = devm_kzalloc(dev, sizeof(*dp83822), GFP_KERNEL); + dp83822 = devm_kzalloc_obj(dev, *dp83822); if (!dp83822) return -ENOMEM; diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index a3cd5cb11ea0..b4b4931c6f8c 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -735,8 +735,7 @@ static int dp83867_probe(struct phy_device *phydev) struct dp83867_private *dp83867; int ret; - dp83867 = devm_kzalloc(&phydev->mdio.dev, sizeof(*dp83867), - GFP_KERNEL); + dp83867 = devm_kzalloc_obj(&phydev->mdio.dev, *dp83867); if (!dp83867) return -ENOMEM; diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c index 96a7d255f50f..00ee7428f618 100644 --- a/drivers/net/phy/dp83869.c +++ b/drivers/net/phy/dp83869.c @@ -877,8 +877,7 @@ static int dp83869_probe(struct phy_device *phydev) struct dp83869_private *dp83869; int ret; - dp83869 = devm_kzalloc(&phydev->mdio.dev, sizeof(*dp83869), - GFP_KERNEL); + dp83869 = devm_kzalloc_obj(&phydev->mdio.dev, *dp83869); if (!dp83869) return -ENOMEM; diff --git a/drivers/net/phy/dp83td510.c b/drivers/net/phy/dp83td510.c index 31c139bef076..84b1ea5015c9 100644 --- a/drivers/net/phy/dp83td510.c +++ b/drivers/net/phy/dp83td510.c @@ -998,7 +998,7 @@ static int dp83td510_probe(struct phy_device *phydev) struct device *dev = &phydev->mdio.dev; struct dp83td510_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/dp83tg720.c b/drivers/net/phy/dp83tg720.c index 391c1d868808..807ff5525ecd 100644 --- a/drivers/net/phy/dp83tg720.c +++ b/drivers/net/phy/dp83tg720.c @@ -589,7 +589,7 @@ static int dp83tg720_probe(struct phy_device *phydev) struct device *dev = &phydev->mdio.dev; struct dp83tg720_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index c0c4f19cfb6a..f50ae62c1f14 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c @@ -206,7 +206,7 @@ static int ip101a_g_probe(struct phy_device *phydev) struct device *dev = &phydev->mdio.dev; struct ip101a_g_phy_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/intel-xway.c b/drivers/net/phy/intel-xway.c index 3cee31bb931f..49f72632554a 100644 --- a/drivers/net/phy/intel-xway.c +++ b/drivers/net/phy/intel-xway.c @@ -323,7 +323,7 @@ static int xway_gphy_probe(struct phy_device *phydev) struct device *dev = &phydev->mdio.dev; struct xway_gphy_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; phydev->priv = priv; diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index 201dee1a1698..b2896ee16203 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -799,7 +799,7 @@ static int mv88q2xxx_probe(struct phy_device *phydev) struct mv88q2xxx_priv *priv; int ret; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/marvell-88x2222.c b/drivers/net/phy/marvell-88x2222.c index ba1bbb6c63d6..92014e200c6f 100644 --- a/drivers/net/phy/marvell-88x2222.c +++ b/drivers/net/phy/marvell-88x2222.c @@ -565,7 +565,7 @@ static int mv2222_probe(struct phy_device *phydev) linkmode_copy(phydev->supported, supported); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 2c688d661297..87f66dfa92dd 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -3642,7 +3642,7 @@ static int marvell_probe(struct phy_device *phydev) { struct marvell_priv *priv; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index b40df82152cd..0956cb579ccd 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -507,7 +507,7 @@ static int mv3310_probe(struct phy_device *phydev) return -ENODEV; } - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/mediatek/mtk-2p5ge.c b/drivers/net/phy/mediatek/mtk-2p5ge.c index de8a41a1841d..d1fb94406857 100644 --- a/drivers/net/phy/mediatek/mtk-2p5ge.c +++ b/drivers/net/phy/mediatek/mtk-2p5ge.c @@ -365,8 +365,7 @@ static int mt798x_2p5ge_phy_probe(struct phy_device *phydev) if (IS_ERR(pinctrl)) dev_err(&phydev->mdio.dev, "Fail to set LED pins!\n"); - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(struct mtk_socphy_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, struct mtk_socphy_priv); if (!priv) return -ENOMEM; phydev->priv = priv; diff --git a/drivers/net/phy/mediatek/mtk-ge-soc.c b/drivers/net/phy/mediatek/mtk-ge-soc.c index 0041300d4f10..9ba2a812c52e 100644 --- a/drivers/net/phy/mediatek/mtk-ge-soc.c +++ b/drivers/net/phy/mediatek/mtk-ge-soc.c @@ -1415,8 +1415,7 @@ static int mt7981_phy_probe(struct phy_device *phydev) { struct mtk_socphy_priv *priv; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(struct mtk_socphy_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, struct mtk_socphy_priv); if (!priv) return -ENOMEM; @@ -1438,7 +1437,7 @@ static int an7581_phy_probe(struct phy_device *phydev) dev_err(&phydev->mdio.bus->dev, "Failed to setup PHY LED pinctrl\n"); - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index d0b1ad21667b..ac3a12d0e088 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -2763,7 +2763,7 @@ static int kszphy_probe(struct phy_device *phydev) struct kszphy_priv *priv; struct clk *clk; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; @@ -4569,10 +4569,8 @@ static int __lan8814_ptp_probe_once(struct phy_device *phydev, char *pin_name, /* Initialise shared lock for clock*/ mutex_init(&shared->shared_lock); - shared->pin_config = devm_kmalloc_array(&phydev->mdio.dev, - gpios, - sizeof(*shared->pin_config), - GFP_KERNEL); + shared->pin_config = devm_kmalloc_objs(&phydev->mdio.dev, + *shared->pin_config, gpios); if (!shared->pin_config) return -ENOMEM; @@ -4751,7 +4749,7 @@ static int lan8814_probe(struct phy_device *phydev) u16 addr; int err; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; @@ -6059,10 +6057,9 @@ static int lan8841_probe(struct phy_device *phydev) priv = phydev->priv; ptp_priv = &priv->ptp_priv; - ptp_priv->pin_config = devm_kcalloc(&phydev->mdio.dev, - LAN8841_PTP_GPIO_NUM, - sizeof(*ptp_priv->pin_config), - GFP_KERNEL); + ptp_priv->pin_config = devm_kzalloc_objs(&phydev->mdio.dev, + *ptp_priv->pin_config, + LAN8841_PTP_GPIO_NUM); if (!ptp_priv->pin_config) return -ENOMEM; @@ -6162,7 +6159,7 @@ static int lan8842_probe(struct phy_device *phydev) int addr; int ret; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/microchip.c b/drivers/net/phy/microchip.c index 33bc633bdba0..10fcee11d748 100644 --- a/drivers/net/phy/microchip.c +++ b/drivers/net/phy/microchip.c @@ -269,7 +269,7 @@ static int lan88xx_probe(struct phy_device *phydev) u32 led_modes[4]; int len; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/microchip_rds_ptp.c b/drivers/net/phy/microchip_rds_ptp.c index 2ad95d5c9d86..e1bd879c4799 100644 --- a/drivers/net/phy/microchip_rds_ptp.c +++ b/drivers/net/phy/microchip_rds_ptp.c @@ -1246,7 +1246,7 @@ struct mchp_rds_ptp_clock *mchp_rds_ptp_probe(struct phy_device *phydev, u8 mmd, struct mchp_rds_ptp_clock *clock; int rc; - clock = devm_kzalloc(&phydev->mdio.dev, sizeof(*clock), GFP_KERNEL); + clock = devm_kzalloc_obj(&phydev->mdio.dev, *clock); if (!clock) return ERR_PTR(-ENOMEM); @@ -1255,10 +1255,9 @@ struct mchp_rds_ptp_clock *mchp_rds_ptp_probe(struct phy_device *phydev, u8 mmd, clock->mmd = mmd; mutex_init(&clock->ptp_lock); - clock->pin_config = devm_kmalloc_array(&phydev->mdio.dev, - MCHP_RDS_PTP_N_PIN, - sizeof(*clock->pin_config), - GFP_KERNEL); + clock->pin_config = devm_kmalloc_objs(&phydev->mdio.dev, + *clock->pin_config, + MCHP_RDS_PTP_N_PIN); if (!clock->pin_config) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c index e38d20bf6aa4..c423db53730d 100644 --- a/drivers/net/phy/microchip_t1.c +++ b/drivers/net/phy/microchip_t1.c @@ -1494,7 +1494,7 @@ static int lan887x_probe(struct phy_device *phydev) { struct lan887x_priv *priv; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c index 463e1ea3efc9..a87e83fdf590 100644 --- a/drivers/net/phy/motorcomm.c +++ b/drivers/net/phy/motorcomm.c @@ -1092,7 +1092,7 @@ static int yt8521_probe(struct phy_device *phydev) u32 freq; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c index 2b9fb8a675a6..e8b0f6437795 100644 --- a/drivers/net/phy/mscc/mscc_main.c +++ b/drivers/net/phy/mscc/mscc_main.c @@ -2246,7 +2246,7 @@ static int vsc85xx_probe_common(struct phy_device *phydev, struct device_node *np; int ret; - vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL); + vsc8531 = devm_kzalloc_obj(&phydev->mdio.dev, *vsc8531); if (!vsc8531) return -ENOMEM; @@ -2278,8 +2278,8 @@ static int vsc85xx_probe_common(struct phy_device *phydev, /* Configure hardware stats */ vsc8531->hw_stats = cfg->hw_stats; vsc8531->nstats = cfg->nstats; - vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, - sizeof(u64), GFP_KERNEL); + vsc8531->stats = devm_kzalloc_objs(&phydev->mdio.dev, u64, + vsc8531->nstats); if (!vsc8531->stats) return -ENOMEM; diff --git a/drivers/net/phy/mscc/mscc_ptp.c b/drivers/net/phy/mscc/mscc_ptp.c index 4865eac74b0e..8a737f9ba411 100644 --- a/drivers/net/phy/mscc/mscc_ptp.c +++ b/drivers/net/phy/mscc/mscc_ptp.c @@ -1592,8 +1592,7 @@ int vsc8584_ptp_probe(struct phy_device *phydev) { struct vsc8531_private *vsc8531 = phydev->priv; - vsc8531->ptp = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531->ptp), - GFP_KERNEL); + vsc8531->ptp = devm_kzalloc_obj(&phydev->mdio.dev, *vsc8531->ptp); if (!vsc8531->ptp) return -ENOMEM; diff --git a/drivers/net/phy/mxl-gpy.c b/drivers/net/phy/mxl-gpy.c index 089a1a9e5bc6..64a276cb01d8 100644 --- a/drivers/net/phy/mxl-gpy.c +++ b/drivers/net/phy/mxl-gpy.c @@ -363,7 +363,7 @@ static int gpy_probe(struct phy_device *phydev) return ret; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; phydev->priv = priv; diff --git a/drivers/net/phy/nxp-c45-tja11xx-macsec.c b/drivers/net/phy/nxp-c45-tja11xx-macsec.c index 63e3934be653..d4963d31998e 100644 --- a/drivers/net/phy/nxp-c45-tja11xx-macsec.c +++ b/drivers/net/phy/nxp-c45-tja11xx-macsec.c @@ -1651,7 +1651,7 @@ int nxp_c45_macsec_probe(struct phy_device *phydev) struct nxp_c45_phy *priv = phydev->priv; struct device *dev = &phydev->mdio.dev; - priv->macsec = devm_kzalloc(dev, sizeof(*priv->macsec), GFP_KERNEL); + priv->macsec = devm_kzalloc_obj(dev, *priv->macsec); if (!priv->macsec) return -ENOMEM; diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c index 8df152f6671f..a264616bb4e6 100644 --- a/drivers/net/phy/nxp-c45-tja11xx.c +++ b/drivers/net/phy/nxp-c45-tja11xx.c @@ -1735,7 +1735,7 @@ static int nxp_c45_probe(struct phy_device *phydev) bool ptp_ability; int ret = 0; - priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&phydev->mdio.dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c index 079d912a1357..53ba118fb62e 100644 --- a/drivers/net/phy/nxp-tja11xx.c +++ b/drivers/net/phy/nxp-tja11xx.c @@ -534,7 +534,7 @@ static int tja11xx_probe(struct phy_device *phydev) struct tja11xx_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -615,7 +615,7 @@ static int tja1102_p0_probe(struct phy_device *phydev) struct tja11xx_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 5d4508bcfbe9..48ac95c74a8a 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3429,7 +3429,7 @@ static int of_phy_led(struct phy_device *phydev, u32 index; int err; - phyled = devm_kzalloc(dev, sizeof(*phyled), GFP_KERNEL); + phyled = devm_kzalloc_obj(dev, *phyled); if (!phyled) return -ENOMEM; diff --git a/drivers/net/phy/qcom/at803x.c b/drivers/net/phy/qcom/at803x.c index 09105f1e3737..5cc6d7b3b9e0 100644 --- a/drivers/net/phy/qcom/at803x.c +++ b/drivers/net/phy/qcom/at803x.c @@ -366,7 +366,7 @@ static int at803x_probe(struct phy_device *phydev) struct at803x_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -1110,7 +1110,7 @@ static int ipq5018_probe(struct phy_device *phydev) struct ipq5018_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/qcom/qca807x.c b/drivers/net/phy/qcom/qca807x.c index 6004da5741af..81b54057b8ba 100644 --- a/drivers/net/phy/qcom/qca807x.c +++ b/drivers/net/phy/qcom/qca807x.c @@ -408,13 +408,13 @@ static int qca807x_gpio(struct phy_device *phydev) struct qca807x_gpio_priv *priv; struct gpio_chip *gc; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; priv->phy = phydev; - gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL); + gc = devm_kzalloc_obj(dev, *gc); if (!gc) return -ENOMEM; @@ -711,7 +711,7 @@ static int qca807x_probe(struct phy_device *phydev) shared_priv = phy_package_get_priv(phydev); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/qcom/qca808x.c b/drivers/net/phy/qcom/qca808x.c index bab26e4c6140..59084c03e7a9 100644 --- a/drivers/net/phy/qcom/qca808x.c +++ b/drivers/net/phy/qcom/qca808x.c @@ -186,7 +186,7 @@ static int qca808x_probe(struct phy_device *phydev) struct device *dev = &phydev->mdio.dev; struct qca808x_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/qcom/qca83xx.c b/drivers/net/phy/qcom/qca83xx.c index 2c4d085bacdb..1528378b478f 100644 --- a/drivers/net/phy/qcom/qca83xx.c +++ b/drivers/net/phy/qcom/qca83xx.c @@ -83,7 +83,7 @@ static int qca83xx_probe(struct phy_device *phydev) struct device *dev = &phydev->mdio.dev; struct qca83xx_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c index 4927ee838de2..ca2d515b77b3 100644 --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c @@ -407,7 +407,7 @@ static int rtl8261x_probe(struct phy_device *phydev) struct rtl8261x_priv *priv; int sub_phy_id, ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -737,7 +737,7 @@ static int rtl821x_probe(struct phy_device *phydev) struct device *dev = &phydev->mdio.dev; struct rtl821x_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 48487149c225..c7c9b2eed20c 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -661,7 +661,7 @@ int smsc_phy_probe(struct phy_device *phydev) struct smsc_phy_priv *priv; struct clk *refclk; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c index 2024d8ef36d9..21a99acd21c8 100644 --- a/drivers/net/phy/xilinx_gmii2rgmii.c +++ b/drivers/net/phy/xilinx_gmii2rgmii.c @@ -89,7 +89,7 @@ static int xgmiitorgmii_probe(struct mdio_device *mdiodev) struct gmii2rgmii *priv; struct clk *clkin; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/phy/xpowers/ac200.c b/drivers/net/phy/xpowers/ac200.c index afdd2a3dfbe4..3718878e3994 100644 --- a/drivers/net/phy/xpowers/ac200.c +++ b/drivers/net/phy/xpowers/ac200.c @@ -221,7 +221,7 @@ ac200_ephy_ctl_create(struct phy_device *phydev, struct clk *clk; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return ERR_PTR(-ENOMEM); priv->dev = dev; diff --git a/drivers/net/phy/xpowers/ac300.c b/drivers/net/phy/xpowers/ac300.c index aa560432a14c..37e40c16cece 100644 --- a/drivers/net/phy/xpowers/ac300.c +++ b/drivers/net/phy/xpowers/ac300.c @@ -325,7 +325,7 @@ ac300_ephy_ctl_create(struct phy_device *phydev, u8 bgs_effuse_code; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return ERR_PTR(-ENOMEM); if (phydev->mdio.addr > FIELD_MAX(AC300_PACKAGE_PHY_ADDR_MASK)) diff --git a/drivers/net/phy/xpowers/acx00.c b/drivers/net/phy/xpowers/acx00.c index d19ba6d8069a..cee6c7ff0278 100644 --- a/drivers/net/phy/xpowers/acx00.c +++ b/drivers/net/phy/xpowers/acx00.c @@ -318,7 +318,7 @@ static int acx00_ephy_probe(struct phy_device *phydev) if (!dev->of_node) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/pse-pd/pd692x0.c b/drivers/net/pse-pd/pd692x0.c index 209de9cec849..7958f5741463 100644 --- a/drivers/net/pse-pd/pd692x0.c +++ b/drivers/net/pse-pd/pd692x0.c @@ -944,12 +944,11 @@ pd692x0_register_manager_regulator(struct device *dev, char *reg_name, struct regulator_desc *rdesc; struct regulator_dev *rdev; - rinit_data = devm_kzalloc(dev, sizeof(*rinit_data), - GFP_KERNEL); + rinit_data = devm_kzalloc_obj(dev, *rinit_data); if (!rinit_data) return ERR_PTR(-ENOMEM); - rdesc = devm_kzalloc(dev, sizeof(*rdesc), GFP_KERNEL); + rdesc = devm_kzalloc_obj(dev, *rdesc); if (!rdesc) return ERR_PTR(-ENOMEM); @@ -1263,8 +1262,8 @@ static int pd692x0_setup_pi_matrix(struct pse_controller_dev *pcdev) if (!manager) return -ENOMEM; - port_matrix = devm_kcalloc(&priv->client->dev, PD692X0_MAX_PIS, - sizeof(*port_matrix), GFP_KERNEL); + port_matrix = devm_kzalloc_objs(&priv->client->dev, *port_matrix, + PD692X0_MAX_PIS); if (!port_matrix) { ret = -ENOMEM; goto err_free_manager; @@ -1775,7 +1774,7 @@ static int pd692x0_i2c_probe(struct i2c_client *client) return -ENXIO; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/pse-pd/pse_core.c b/drivers/net/pse-pd/pse_core.c index a5e6d7b26b9f..a3d4a3d7e525 100644 --- a/drivers/net/pse-pd/pse_core.c +++ b/drivers/net/pse-pd/pse_core.c @@ -835,12 +835,11 @@ devm_pse_pi_regulator_register(struct pse_controller_dev *pcdev, struct regulator_desc *rdesc; struct regulator_dev *rdev; - rinit_data = devm_kzalloc(pcdev->dev, sizeof(*rinit_data), - GFP_KERNEL); + rinit_data = devm_kzalloc_obj(pcdev->dev, *rinit_data); if (!rinit_data) return -ENOMEM; - rdesc = devm_kzalloc(pcdev->dev, sizeof(*rdesc), GFP_KERNEL); + rdesc = devm_kzalloc_obj(pcdev->dev, *rdesc); if (!rdesc) return -ENOMEM; @@ -922,7 +921,7 @@ static struct pse_power_domain *devm_pse_alloc_pw_d(struct device *dev) struct pse_power_domain *pw_d; int index, ret; - pw_d = devm_kzalloc(dev, sizeof(*pw_d), GFP_KERNEL); + pw_d = devm_kzalloc_obj(dev, *pw_d); if (!pw_d) return ERR_PTR(-ENOMEM); @@ -1320,7 +1319,7 @@ int devm_pse_irq_helper(struct pse_controller_dev *pcdev, int irq, if (!d || !d->map_event || !d->name) return -EINVAL; - h = devm_kzalloc(dev, sizeof(*h), GFP_KERNEL); + h = devm_kzalloc_obj(dev, *h); if (!h) return -ENOMEM; @@ -1336,8 +1335,7 @@ int devm_pse_irq_helper(struct pse_controller_dev *pcdev, int irq, snprintf(irq_name, irq_name_len, "pse-%s:%s", dev_name(pcdev->dev), d->name); - h->notifs = devm_kcalloc(dev, pcdev->nr_lines, - sizeof(*h->notifs), GFP_KERNEL); + h->notifs = devm_kzalloc_objs(dev, *h->notifs, pcdev->nr_lines); if (!h->notifs) return -ENOMEM; diff --git a/drivers/net/pse-pd/pse_regulator.c b/drivers/net/pse-pd/pse_regulator.c index 6ce6773fff31..87628044738c 100644 --- a/drivers/net/pse-pd/pse_regulator.c +++ b/drivers/net/pse-pd/pse_regulator.c @@ -97,7 +97,7 @@ pse_reg_probe(struct platform_device *pdev) struct pse_reg_priv *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/pse-pd/realtek-pse-mcu-i2c.c b/drivers/net/pse-pd/realtek-pse-mcu-i2c.c index bbded772eddf..16df566eb335 100644 --- a/drivers/net/pse-pd/realtek-pse-mcu-i2c.c +++ b/drivers/net/pse-pd/realtek-pse-mcu-i2c.c @@ -115,7 +115,7 @@ static int rtpse_mcu_i2c_probe(struct i2c_client *client) "SMBus MCU protocol requires SMBus I2C-block support\n"); } - pse = devm_kzalloc(dev, sizeof(*pse), GFP_KERNEL); + pse = devm_kzalloc_obj(dev, *pse); if (!pse) return -ENOMEM; diff --git a/drivers/net/pse-pd/realtek-pse-mcu-uart.c b/drivers/net/pse-pd/realtek-pse-mcu-uart.c index 9baa17d8d31f..439d9ca6744c 100644 --- a/drivers/net/pse-pd/realtek-pse-mcu-uart.c +++ b/drivers/net/pse-pd/realtek-pse-mcu-uart.c @@ -109,7 +109,7 @@ static int rtpse_mcu_uart_probe(struct serdev_device *serdev) unsigned int baud; int ret; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/net/pse-pd/si3474.c b/drivers/net/pse-pd/si3474.c index 35152d462e82..c18df3c2ceb6 100644 --- a/drivers/net/pse-pd/si3474.c +++ b/drivers/net/pse-pd/si3474.c @@ -497,7 +497,7 @@ static int si3474_i2c_probe(struct i2c_client *client) return -ENXIO; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c index 8a3bbd623412..244ce596d845 100644 --- a/drivers/net/pse-pd/tps23881.c +++ b/drivers/net/pse-pd/tps23881.c @@ -1445,7 +1445,7 @@ static int tps23881_i2c_probe(struct i2c_client *client) if (!info) return -EINVAL; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index 293ef80c4e30..2729b8def9d4 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c @@ -832,7 +832,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) u8 buf[ETH_ALEN] = {0}; int ret, i; - priv = devm_kzalloc(&dev->udev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&dev->udev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/net/wan/framer/pef2256/pef2256.c b/drivers/net/wan/framer/pef2256/pef2256.c index 6938316bf82b..9980544a1c5b 100644 --- a/drivers/net/wan/framer/pef2256/pef2256.c +++ b/drivers/net/wan/framer/pef2256/pef2256.c @@ -713,7 +713,7 @@ static int pef2256_probe(struct platform_device *pdev) int ret; int irq; - pef2256 = devm_kzalloc(&pdev->dev, sizeof(*pef2256), GFP_KERNEL); + pef2256 = devm_kzalloc_obj(&pdev->dev, *pef2256); if (!pef2256) return -ENOMEM; diff --git a/drivers/net/wan/fsl_qmc_hdlc.c b/drivers/net/wan/fsl_qmc_hdlc.c index e74f87940c4f..43982c7e6f68 100644 --- a/drivers/net/wan/fsl_qmc_hdlc.c +++ b/drivers/net/wan/fsl_qmc_hdlc.c @@ -712,7 +712,7 @@ static int qmc_hdlc_probe(struct platform_device *pdev) hdlc_device *hdlc; int ret; - qmc_hdlc = devm_kzalloc(dev, sizeof(*qmc_hdlc), GFP_KERNEL); + qmc_hdlc = devm_kzalloc_obj(dev, *qmc_hdlc); if (!qmc_hdlc) return -ENOMEM; diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c index 7f4645ff90aa..47bc6f5788c1 100644 --- a/drivers/net/wan/ixp4xx_hss.c +++ b/drivers/net/wan/ixp4xx_hss.c @@ -1416,7 +1416,7 @@ static int ixp4xx_hss_probe(struct platform_device *pdev) np = dev->of_node; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index 65e941b52751..3d866dd54551 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -2549,8 +2549,7 @@ static int ath10k_sdio_probe(struct sdio_func *func, ar_sdio = ath10k_sdio_priv(ar); ar_sdio->irq_data.irq_proc_reg = - devm_kzalloc(ar->dev, sizeof(struct ath10k_sdio_irq_proc_regs), - GFP_KERNEL); + devm_kzalloc_obj(ar->dev, struct ath10k_sdio_irq_proc_regs); if (!ar_sdio->irq_data.irq_proc_reg) { ret = -ENOMEM; goto err_core_destroy; @@ -2563,8 +2562,7 @@ static int ath10k_sdio_probe(struct sdio_func *func, } ar_sdio->irq_data.irq_en_reg = - devm_kzalloc(ar->dev, sizeof(struct ath10k_sdio_irq_enable_regs), - GFP_KERNEL); + devm_kzalloc_obj(ar->dev, struct ath10k_sdio_irq_enable_regs); if (!ar_sdio->irq_data.irq_en_reg) { ret = -ENOMEM; goto err_core_destroy; diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index 8f171ab6f4de..356d9c61d5a7 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -1816,8 +1816,8 @@ static int ath10k_snoc_probe(struct platform_device *pdev) ar_snoc->num_vregs = 1; } - ar_snoc->vregs = devm_kcalloc(&pdev->dev, ar_snoc->num_vregs, - sizeof(*ar_snoc->vregs), GFP_KERNEL); + ar_snoc->vregs = devm_kzalloc_objs(&pdev->dev, *ar_snoc->vregs, + ar_snoc->num_vregs); if (!ar_snoc->vregs) { ret = -ENOMEM; goto err_free_irq; @@ -1831,8 +1831,8 @@ static int ath10k_snoc_probe(struct platform_device *pdev) goto err_free_irq; ar_snoc->num_clks = ARRAY_SIZE(ath10k_clocks); - ar_snoc->clks = devm_kcalloc(&pdev->dev, ar_snoc->num_clks, - sizeof(*ar_snoc->clks), GFP_KERNEL); + ar_snoc->clks = devm_kzalloc_objs(&pdev->dev, *ar_snoc->clks, + ar_snoc->num_clks); if (!ar_snoc->clks) { ret = -ENOMEM; goto err_free_irq; diff --git a/drivers/net/wireless/ath/ath10k/swap.c b/drivers/net/wireless/ath/ath10k/swap.c index 7198a386f2fb..03a771c6da9e 100644 --- a/drivers/net/wireless/ath/ath10k/swap.c +++ b/drivers/net/wireless/ath/ath10k/swap.c @@ -100,7 +100,7 @@ ath10k_swap_code_seg_alloc(struct ath10k *ar, size_t swap_bin_len) return NULL; } - seg_info = devm_kzalloc(ar->dev, sizeof(*seg_info), GFP_KERNEL); + seg_info = devm_kzalloc_obj(ar->dev, *seg_info); if (!seg_info) return NULL; diff --git a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c index b9ef34709202..e0578b101c6e 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c +++ b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c @@ -185,7 +185,7 @@ static int owl_probe(struct pci_dev *pdev, if (pci_enable_device(pdev)) return -EIO; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 2f0c4ef86b7e..b996b7c30da1 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c @@ -339,7 +339,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, if (is_tx) { struct ath_buf *bf; - bf = devm_kcalloc(sc->dev, sizeof(*bf), nbuf, GFP_KERNEL); + bf = devm_kzalloc_objs(sc->dev, *bf, nbuf); if (!bf) return -ENOMEM; @@ -369,7 +369,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, } else { struct ath_rxbuf *bf; - bf = devm_kcalloc(sc->dev, sizeof(struct ath_rxbuf), nbuf, GFP_KERNEL); + bf = devm_kzalloc_objs(sc->dev, struct ath_rxbuf, nbuf); if (!bf) return -ENOMEM; @@ -662,7 +662,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, int ret = 0, i; int csz = 0; - ah = devm_kzalloc(sc->dev, sizeof(struct ath_hw), GFP_KERNEL); + ah = devm_kzalloc_obj(sc->dev, struct ath_hw); if (!ah) return -ENOMEM; diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 93b41a1bb2af..1d1114444ba3 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c @@ -211,7 +211,7 @@ static int ath_rx_edma_init(struct ath_softc *sc, int nbufs) ath_rx_edma_init_queue(&sc->rx.rx_edma[ATH9K_RX_QUEUE_HP], ah->caps.rx_hp_qdepth); - bf = devm_kcalloc(sc->dev, sizeof(struct ath_rxbuf), nbufs, GFP_KERNEL); + bf = devm_kzalloc_objs(sc->dev, struct ath_rxbuf, nbufs); if (!bf) return -ENOMEM; diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index 61c7a1288743..27c4f69382a4 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c @@ -1927,8 +1927,8 @@ static int carl9170_parse_eeprom(struct ar9170 *ar) if (!bands) return -EINVAL; - ar->survey = devm_kcalloc(&ar->udev->dev, chans, - sizeof(struct survey_info), GFP_KERNEL); + ar->survey = devm_kzalloc_objs(&ar->udev->dev, struct survey_info, + chans); if (!ar->survey) return -ENOMEM; ar->num_channels = chans; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c index 03efae36a0b2..0ebf54ed5e29 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c @@ -37,7 +37,7 @@ static int brcmf_of_get_country_codes(struct device *dev, return (count == -EINVAL) ? 0 : count; } - cc = devm_kzalloc(dev, struct_size(cc, table, count), GFP_KERNEL); + cc = devm_kzalloc_flex(dev, *cc, table, count); if (!cc) return -ENOMEM; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/debug.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/debug.c index 81df41c7fbb5..a1888ff02d08 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/debug.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/debug.c @@ -189,7 +189,7 @@ brcms_debugfs_add_entry(struct brcms_pub *drvr, const char *fn, struct dentry *dentry = drvr->dbgfs_dir; struct brcms_debugfs_entry *entry; - entry = devm_kzalloc(dev, sizeof(*entry), GFP_KERNEL); + entry = devm_kzalloc_obj(dev, *entry); if (!entry) return; diff --git a/drivers/net/wireless/intel/iwlwifi/mei/main.c b/drivers/net/wireless/intel/iwlwifi/mei/main.c index ce92e26c42d7..b69ebdc5060f 100644 --- a/drivers/net/wireless/intel/iwlwifi/mei/main.c +++ b/drivers/net/wireless/intel/iwlwifi/mei/main.c @@ -1982,7 +1982,7 @@ static int iwl_mei_probe(struct mei_cl_device *cldev, struct iwl_mei *mei; int ret; - mei = devm_kzalloc(&cldev->dev, sizeof(*mei), GFP_KERNEL); + mei = devm_kzalloc_obj(&cldev->dev, *mei); if (!mei) return -ENOMEM; diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index a9425e9a94f4..ecbe864b0797 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -382,7 +382,7 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev, pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n", pdev->vendor, pdev->device, pdev->revision); - card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(&pdev->dev, *card); if (!card) return -ENOMEM; diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index 8f2e932c5484..417dc2649b99 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -556,7 +556,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) pr_debug("info: vendor=0x%4.04X device=0x%4.04X class=%d function=%d\n", func->vendor, func->device, func->class, func->num); - card = devm_kzalloc(&func->dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(&func->dev, *card); if (!card) return -ENOMEM; diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c index f4b94a1054f6..28e5b84a13c7 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -392,7 +392,7 @@ static int mwifiex_usb_probe(struct usb_interface *intf, struct usb_card_rec *card; u16 id_vendor, id_product, bcd_device; - card = devm_kzalloc(&intf->dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(&intf->dev, *card); if (!card) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index c9762082f473..92e29c089b99 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -319,8 +319,7 @@ mt76_init_sband(struct mt76_phy *phy, struct mt76_sband *msband, if (!chanlist) return -ENOMEM; - msband->chan = devm_kcalloc(dev->dev, n_chan, sizeof(*msband->chan), - GFP_KERNEL); + msband->chan = devm_kzalloc_objs(dev->dev, *msband->chan, n_chan); if (!msband->chan) return -ENOMEM; @@ -459,9 +458,8 @@ mt76_phy_init(struct mt76_phy *phy, struct ieee80211_hw *hw) wiphy->available_antennas_rx = phy->antenna_mask; wiphy->sar_capa = &mt76_sar_capa; - phy->frp = devm_kcalloc(dev->dev, wiphy->sar_capa->num_freq_ranges, - sizeof(struct mt76_freq_range_power), - GFP_KERNEL); + phy->frp = devm_kzalloc_objs(dev->dev, struct mt76_freq_range_power, + wiphy->sar_capa->num_freq_ranges); if (!phy->frp) return -ENOMEM; @@ -2027,7 +2025,7 @@ mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc, struct mt76_queue *hwq; int err; - hwq = devm_kzalloc(dev->dev, sizeof(*hwq), GFP_KERNEL); + hwq = devm_kzalloc_obj(dev->dev, *hwq); if (!hwq) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/sdio.c b/drivers/net/wireless/mediatek/mt76/mt7615/sdio.c index 46188951ad19..f6dee0fb8f2e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/sdio.c @@ -133,9 +133,7 @@ static int mt7663s_probe(struct sdio_func *func, dev_dbg(mdev->dev, "ASIC revision: %04x\n", mdev->rev); mdev->sdio.parse_irq = mt7663s_parse_intr; - mdev->sdio.intr_data = devm_kmalloc(mdev->dev, - sizeof(struct mt7663s_intr), - GFP_KERNEL); + mdev->sdio.intr_data = devm_kmalloc_obj(mdev->dev, struct mt7663s_intr); if (!mdev->sdio.intr_data) { ret = -ENOMEM; goto error; diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 9bdfff24b702..dd0b1871d207 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -2224,7 +2224,7 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy, struct mt76_power_limits *limits; const u8 *ch_list; - limits = devm_kmalloc(dev->dev, sizeof(*limits), GFP_KERNEL); + limits = devm_kmalloc_obj(dev->dev, *limits); if (!limits) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c b/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c index 21c99ad7ef59..dc9d727a18b0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c @@ -166,7 +166,7 @@ mt76x02_dfs_seq_pool_get(struct mt76x02_dev *dev) struct mt76x02_dfs_sequence *seq; if (list_empty(&dfs_pd->seq_pool)) { - seq = devm_kzalloc(dev->mt76.dev, sizeof(*seq), GFP_ATOMIC); + seq = devm_kzalloc_obj(dev->mt76.dev, *seq, GFP_ATOMIC); } else { seq = list_first_entry(&dfs_pd->seq_pool, struct mt76x02_dfs_sequence, diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/pci.c b/drivers/net/wireless/mediatek/mt76/mt7915/pci.c index 8007e620048b..6e8ec0a8a9cb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/pci.c @@ -85,7 +85,7 @@ static int mt7915_pci_hif2_probe(struct pci_dev *pdev) { struct mt7915_hif *hif; - hif = devm_kzalloc(&pdev->dev, sizeof(*hif), GFP_KERNEL); + hif = devm_kzalloc_obj(&pdev->dev, *hif); if (!hif) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c b/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c index 9150f185716c..754b33485f6e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c @@ -159,9 +159,8 @@ static int mt7921s_probe(struct sdio_func *func, dev_dbg(mdev->dev, "ASIC revision: %04x\n", mdev->rev); mdev->sdio.parse_irq = mt7921s_parse_intr; - mdev->sdio.intr_data = devm_kmalloc(mdev->dev, - sizeof(struct mt7921_sdio_intr), - GFP_KERNEL); + mdev->sdio.intr_data = devm_kmalloc_obj(mdev->dev, + struct mt7921_sdio_intr); if (!mdev->sdio.intr_data) { ret = -ENOMEM; goto error; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7925/debugfs.c index d01ff49de47a..6dd93eb0ff2c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/debugfs.c @@ -122,7 +122,7 @@ mt7925_txpwr(struct seq_file *s, void *data) u8 band_idx = dev->mphy.band_idx; int ret = 0; - txpwr = devm_kmalloc(dev->mt76.dev, sizeof(*txpwr), GFP_KERNEL); + txpwr = devm_kmalloc_obj(dev->mt76.dev, *txpwr); if (!txpwr) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 15d95ad32636..8d591f265260 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -2285,10 +2285,8 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mconf = &mvif->bss_conf; mlink = &mvif->sta.deflink; } else { - mconf = devm_kzalloc(dev->mt76.dev, sizeof(*mconf), - GFP_KERNEL); - mlink = devm_kzalloc(dev->mt76.dev, sizeof(*mlink), - GFP_KERNEL); + mconf = devm_kzalloc_obj(dev->mt76.dev, *mconf); + mlink = devm_kzalloc_obj(dev->mt76.dev, *mlink); if (!mconf || !mlink) { mt792x_mutex_release(dev); return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 26cdb3f0a98a..153bdec383cf 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -4004,7 +4004,7 @@ mt7925_mcu_rate_txpower_band(struct mt76_phy *phy, } batch_size = DIV_ROUND_UP(n_chan, batch_len); - limits = devm_kmalloc(dev->dev, sizeof(*limits), GFP_KERNEL); + limits = devm_kmalloc_obj(dev->dev, *limits); if (!limits) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c b/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c index e87dfb0f1b3a..2d7a967fd399 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c @@ -225,7 +225,7 @@ int mt792x_init_acpi_sar(struct mt792x_dev *dev) struct mt792x_acpi_sar *asar; int ret; - asar = devm_kzalloc(dev->mt76.dev, sizeof(*asar), GFP_KERNEL); + asar = devm_kzalloc_obj(dev->mt76.dev, *asar); if (!asar) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index 3ce6c6ceac81..d6f3a242b579 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -152,8 +152,7 @@ static int mt792x_setup_iface_combinations(struct mt792x_dev *dev, } /* CNM + NAN: dynamically build base + nan list */ - comb = devm_kcalloc(&wiphy->dev, n_base + n_nan, sizeof(*comb), - GFP_KERNEL); + comb = devm_kzalloc_objs(&wiphy->dev, *comb, n_base + n_nan); if (!comb) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/pci.c b/drivers/net/wireless/mediatek/mt76/mt7996/pci.c index a7c23b33dde0..32f82dbb0973 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/pci.c @@ -86,7 +86,7 @@ static int mt7996_pci_hif2_probe(struct pci_dev *pdev) { struct mt7996_hif *hif; - hif = devm_kzalloc(&pdev->dev, sizeof(*hif), GFP_KERNEL); + hif = devm_kzalloc_obj(&pdev->dev, *hif); if (!hif) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c index ba5f123f7e39..91e5fad0479d 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -306,9 +306,7 @@ int mt76s_alloc_rx_queue(struct mt76_dev *dev, enum mt76_rxq_id qid) struct mt76_queue *q = &dev->q_rx[qid]; spin_lock_init(&q->lock); - q->entry = devm_kcalloc(dev->dev, - MT76S_NUM_RX_ENTRIES, sizeof(*q->entry), - GFP_KERNEL); + q->entry = devm_kzalloc_objs(dev->dev, *q->entry, MT76S_NUM_RX_ENTRIES); if (!q->entry) return -ENOMEM; @@ -324,14 +322,12 @@ static struct mt76_queue *mt76s_alloc_tx_queue(struct mt76_dev *dev) { struct mt76_queue *q; - q = devm_kzalloc(dev->dev, sizeof(*q), GFP_KERNEL); + q = devm_kzalloc_obj(dev->dev, *q); if (!q) return ERR_PTR(-ENOMEM); spin_lock_init(&q->lock); - q->entry = devm_kcalloc(dev->dev, - MT76S_NUM_TX_ENTRIES, sizeof(*q->entry), - GFP_KERNEL); + q->entry = devm_kzalloc_objs(dev->dev, *q->entry, MT76S_NUM_TX_ENTRIES); if (!q->entry) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c index be48a88a3ad0..f6464315e374 100644 --- a/drivers/net/wireless/mediatek/mt76/usb.c +++ b/drivers/net/wireless/mediatek/mt76/usb.c @@ -706,9 +706,7 @@ mt76u_alloc_rx_queue(struct mt76_dev *dev, enum mt76_rxq_id qid) return err; spin_lock_init(&q->lock); - q->entry = devm_kcalloc(dev->dev, - MT_NUM_RX_ENTRIES, sizeof(*q->entry), - GFP_KERNEL); + q->entry = devm_kzalloc_objs(dev->dev, *q->entry, MT_NUM_RX_ENTRIES); if (!q->entry) return -ENOMEM; @@ -1013,7 +1011,7 @@ static int mt76u_alloc_tx(struct mt76_dev *dev) struct mt76_queue *q; int j, err; - q = devm_kzalloc(dev->dev, sizeof(*q), GFP_KERNEL); + q = devm_kzalloc_obj(dev->dev, *q); if (!q) return -ENOMEM; @@ -1021,9 +1019,8 @@ static int mt76u_alloc_tx(struct mt76_dev *dev) mt76u_ac_to_hwq(dev, q, i); dev->phy.q_tx[i] = q; - q->entry = devm_kcalloc(dev->dev, - MT_NUM_TX_ENTRIES, sizeof(*q->entry), - GFP_KERNEL); + q->entry = devm_kzalloc_objs(dev->dev, *q->entry, + MT_NUM_TX_ENTRIES); if (!q->entry) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt7601u/dma.c b/drivers/net/wireless/mediatek/mt7601u/dma.c index 773a1cc2f852..9a2e8b0511c7 100644 --- a/drivers/net/wireless/mediatek/mt7601u/dma.c +++ b/drivers/net/wireless/mediatek/mt7601u/dma.c @@ -502,8 +502,7 @@ static int mt7601u_alloc_tx(struct mt7601u_dev *dev) { int i; - dev->tx_q = devm_kcalloc(dev->dev, __MT_EP_OUT_MAX, - sizeof(*dev->tx_q), GFP_KERNEL); + dev->tx_q = devm_kzalloc_objs(dev->dev, *dev->tx_q, __MT_EP_OUT_MAX); if (!dev->tx_q) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt7601u/eeprom.c b/drivers/net/wireless/mediatek/mt7601u/eeprom.c index d4d31a546556..5dea3a3cffb0 100644 --- a/drivers/net/wireless/mediatek/mt7601u/eeprom.c +++ b/drivers/net/wireless/mediatek/mt7601u/eeprom.c @@ -351,7 +351,7 @@ mt7601u_eeprom_init(struct mt7601u_dev *dev) if (ret) return ret; - dev->ee = devm_kzalloc(dev->dev, sizeof(*dev->ee), GFP_KERNEL); + dev->ee = devm_kzalloc_obj(dev->dev, *dev->ee); if (!dev->ee) return -ENOMEM; diff --git a/drivers/net/wireless/mediatek/mt7601u/init.c b/drivers/net/wireless/mediatek/mt7601u/init.c index 5d9e952b2966..ebc45ed4effa 100644 --- a/drivers/net/wireless/mediatek/mt7601u/init.c +++ b/drivers/net/wireless/mediatek/mt7601u/init.c @@ -555,8 +555,7 @@ mt76_init_sband(struct mt7601u_dev *dev, struct ieee80211_supported_band *sband, static int mt76_init_sband_2g(struct mt7601u_dev *dev) { - dev->sband_2g = devm_kzalloc(dev->dev, sizeof(*dev->sband_2g), - GFP_KERNEL); + dev->sband_2g = devm_kzalloc_obj(dev->dev, *dev->sband_2g); if (!dev->sband_2g) return -ENOMEM; @@ -583,8 +582,7 @@ int mt7601u_register_device(struct mt7601u_dev *dev) dev->wcid_mask[0] |= 1; /* init fake wcid for monitor interfaces */ - dev->mon_wcid = devm_kmalloc(dev->dev, sizeof(*dev->mon_wcid), - GFP_KERNEL); + dev->mon_wcid = devm_kmalloc_obj(dev->dev, *dev->mon_wcid); if (!dev->mon_wcid) return -ENOMEM; dev->mon_wcid->idx = 0xff; diff --git a/drivers/net/wireless/nxp/nxpwifi/sdio.c b/drivers/net/wireless/nxp/nxpwifi/sdio.c index 010f78270580..bdc8834fe428 100644 --- a/drivers/net/wireless/nxp/nxpwifi/sdio.c +++ b/drivers/net/wireless/nxp/nxpwifi/sdio.c @@ -138,7 +138,7 @@ nxpwifi_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) int ret; struct sdio_mmc_card *card = NULL; - card = devm_kzalloc(&func->dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(&func->dev, *card); if (!card) return -ENOMEM; @@ -1744,8 +1744,8 @@ static int nxpwifi_init_sdio(struct nxpwifi_adapter *adapter) return -ENOMEM; card->mpa_rx.len_arr = - devm_kcalloc(&card->func->dev, card->mp_agg_pkt_limit, - sizeof(*card->mpa_rx.len_arr), GFP_KERNEL); + devm_kzalloc_objs(&card->func->dev, *card->mpa_rx.len_arr, + card->mp_agg_pkt_limit); if (!card->mpa_rx.len_arr) return -ENOMEM; diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c index 58ee5efc3b5e..5220f74d15d2 100644 --- a/drivers/net/wireless/realtek/rtw89/core.c +++ b/drivers/net/wireless/realtek/rtw89/core.c @@ -6355,8 +6355,8 @@ static int rtw89_init_he_eht_cap(struct rtw89_dev *rtwdev, enum nl80211_iftype iftype; int idx = 0; - iftype_data = devm_kcalloc(rtwdev->dev, RTW89_SBAND_IFTYPES_NR, - sizeof(*iftype_data), GFP_KERNEL); + iftype_data = devm_kzalloc_objs(rtwdev->dev, *iftype_data, + RTW89_SBAND_IFTYPES_NR); if (!iftype_data) return -ENOMEM; diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c index ea7dba077f5d..21b548c63c78 100644 --- a/drivers/net/wireless/realtek/rtw89/fw.c +++ b/drivers/net/wireless/realtek/rtw89/fw.c @@ -1495,7 +1495,7 @@ int rtw89_recognize_regd_from_elm(struct rtw89_dev *rtwdev, elm_info->regd = NULL; } - p = devm_kzalloc(rtwdev->dev, struct_size(p, map, num_ents), GFP_KERNEL); + p = devm_kzalloc_flex(rtwdev->dev, *p, map, num_ents); if (!p) return -ENOMEM; @@ -13573,7 +13573,7 @@ rtw89_fw_cmd_ofld_alloc_and_get_io_ops(struct rtw89_dev *rtwdev) if (!(rtwdev->hci.type == RTW89_HCI_TYPE_USB && chip->support_fw_cmd_ofld)) return &rtw89_raw_io; - info = devm_kzalloc(rtwdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(rtwdev->dev, *info); if (!info) return &rtw89_raw_io; diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c index 795920b899d9..e01af08494f9 100644 --- a/drivers/net/wireless/realtek/rtw89/phy.c +++ b/drivers/net/wireless/realtek/rtw89/phy.c @@ -8304,8 +8304,8 @@ static void __rtw89_phy_dm_init_data(struct rtw89_dev *rtwdev, struct rtw89_bb_c hw_band = rtw89_nl80211_to_hw_band(band); env->nhm_his[hw_band] = - devm_kcalloc(rtwdev->dev, sband->n_channels, - sizeof(*env->nhm_his[0]), GFP_KERNEL); + devm_kzalloc_objs(rtwdev->dev, *env->nhm_his[0], + sband->n_channels); for (idx = 0; idx < sband->n_channels; idx++) INIT_LIST_HEAD(&env->nhm_his[hw_band][idx].list); diff --git a/drivers/net/wireless/silabs/wfx/bus_sdio.c b/drivers/net/wireless/silabs/wfx/bus_sdio.c index 1ca2cc262feb..603a5529830f 100644 --- a/drivers/net/wireless/silabs/wfx/bus_sdio.c +++ b/drivers/net/wireless/silabs/wfx/bus_sdio.c @@ -257,7 +257,7 @@ static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *i return -ENODEV; } - bus = devm_kzalloc(&func->dev, sizeof(*bus), GFP_KERNEL); + bus = devm_kzalloc_obj(&func->dev, *bus); if (!bus) return -ENOMEM; diff --git a/drivers/net/wireless/silabs/wfx/bus_spi.c b/drivers/net/wireless/silabs/wfx/bus_spi.c index 45ee19e1ecbf..71decbe6c88f 100644 --- a/drivers/net/wireless/silabs/wfx/bus_spi.c +++ b/drivers/net/wireless/silabs/wfx/bus_spi.c @@ -243,7 +243,7 @@ static int wfx_spi_probe(struct spi_device *func) if (func->max_speed_hz > 50000000) dev_warn(&func->dev, "%dHz is a very high speed\n", func->max_speed_hz); - bus = devm_kzalloc(&func->dev, sizeof(*bus), GFP_KERNEL); + bus = devm_kzalloc_obj(&func->dev, *bus); if (!bus) return -ENOMEM; bus->func = func; diff --git a/drivers/net/wireless/st/cw1200/cw1200_spi.c b/drivers/net/wireless/st/cw1200/cw1200_spi.c index 52386dfb5f4a..f71e71e06359 100644 --- a/drivers/net/wireless/st/cw1200/cw1200_spi.c +++ b/drivers/net/wireless/st/cw1200/cw1200_spi.c @@ -377,7 +377,7 @@ static int cw1200_spi_probe(struct spi_device *func) spi_get_chipselect(func, 0), func->mode, func->bits_per_word, func->max_speed_hz); - self = devm_kzalloc(&func->dev, sizeof(*self), GFP_KERNEL); + self = devm_kzalloc_obj(&func->dev, *self); if (!self) { pr_err("Can't allocate SPI hwbus_priv."); return -ENOMEM; diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c index 1936bb3af54a..cfdc25210e66 100644 --- a/drivers/net/wireless/ti/wl1251/spi.c +++ b/drivers/net/wireless/ti/wl1251/spi.c @@ -240,7 +240,7 @@ static int wl1251_spi_probe(struct spi_device *spi) if (!np) return -ENODEV; - wl_spi = devm_kzalloc(&spi->dev, sizeof(*wl_spi), GFP_KERNEL); + wl_spi = devm_kzalloc_obj(&spi->dev, *wl_spi); if (!wl_spi) return -ENOMEM; diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 421d688ae58b..6dde1fa7bcd0 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -267,13 +267,13 @@ static int wl1271_probe(struct sdio_func *func, if (func->num != 0x02) return -ENODEV; - pdev_data = devm_kzalloc(&func->dev, sizeof(*pdev_data), GFP_KERNEL); + pdev_data = devm_kzalloc_obj(&func->dev, *pdev_data); if (!pdev_data) return -ENOMEM; pdev_data->if_ops = &sdio_ops; - glue = devm_kzalloc(&func->dev, sizeof(*glue), GFP_KERNEL); + glue = devm_kzalloc_obj(&func->dev, *glue); if (!glue) return -ENOMEM; diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index 0aa2b2f3c5c9..3767ce6578be 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -465,13 +465,13 @@ static int wl1271_probe(struct spi_device *spi) struct resource res[1]; int ret; - pdev_data = devm_kzalloc(&spi->dev, sizeof(*pdev_data), GFP_KERNEL); + pdev_data = devm_kzalloc_obj(&spi->dev, *pdev_data); if (!pdev_data) return -ENOMEM; pdev_data->if_ops = &spi_ops; - glue = devm_kzalloc(&spi->dev, sizeof(*glue), GFP_KERNEL); + glue = devm_kzalloc_obj(&spi->dev, *glue); if (!glue) { dev_err(&spi->dev, "can't allocate glue\n"); return -ENOMEM; diff --git a/drivers/net/wwan/mhi_wwan_mbim.c b/drivers/net/wwan/mhi_wwan_mbim.c index 336f89756f10..b13c30debf9f 100644 --- a/drivers/net/wwan/mhi_wwan_mbim.c +++ b/drivers/net/wwan/mhi_wwan_mbim.c @@ -621,7 +621,7 @@ static int mhi_mbim_probe(struct mhi_device *mhi_dev, const struct mhi_device_id struct mhi_mbim_context *mbim; int err; - mbim = devm_kzalloc(&mhi_dev->dev, sizeof(*mbim), GFP_KERNEL); + mbim = devm_kzalloc_obj(&mhi_dev->dev, *mbim); if (!mbim) return -ENOMEM; diff --git a/drivers/net/wwan/qcom_bam_dmux.c b/drivers/net/wwan/qcom_bam_dmux.c index cc6ace8d6437..90801c001fa1 100644 --- a/drivers/net/wwan/qcom_bam_dmux.c +++ b/drivers/net/wwan/qcom_bam_dmux.c @@ -769,7 +769,7 @@ static int bam_dmux_probe(struct platform_device *pdev) int ret, pc_ack_irq, i; unsigned int bit; - dmux = devm_kzalloc(dev, sizeof(*dmux), GFP_KERNEL); + dmux = devm_kzalloc_obj(dev, *dmux); if (!dmux) return -ENOMEM; diff --git a/drivers/net/wwan/rpmsg_wwan_ctrl.c b/drivers/net/wwan/rpmsg_wwan_ctrl.c index ba17b5ae6bdb..cadc02fd13a4 100644 --- a/drivers/net/wwan/rpmsg_wwan_ctrl.c +++ b/drivers/net/wwan/rpmsg_wwan_ctrl.c @@ -119,7 +119,7 @@ static int rpmsg_wwan_ctrl_probe(struct rpmsg_device *rpdev) if (!parent) return -ENODEV; - rpwwan = devm_kzalloc(&rpdev->dev, sizeof(*rpwwan), GFP_KERNEL); + rpwwan = devm_kzalloc_obj(&rpdev->dev, *rpwwan); if (!rpwwan) return -ENOMEM; diff --git a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c index 2917cee9b802..e1b37deb6d9b 100644 --- a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c +++ b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c @@ -1110,7 +1110,7 @@ int t7xx_cldma_alloc(enum cldma_id hif_id, struct t7xx_pci_dev *t7xx_dev) struct cldma_ctrl *md_ctrl; int qno; - md_ctrl = devm_kzalloc(dev, sizeof(*md_ctrl), GFP_KERNEL); + md_ctrl = devm_kzalloc_obj(dev, *md_ctrl); if (!md_ctrl) return -ENOMEM; diff --git a/drivers/net/wwan/t7xx/t7xx_hif_dpmaif.c b/drivers/net/wwan/t7xx/t7xx_hif_dpmaif.c index 7ff33c1d6ac7..48e6230d5287 100644 --- a/drivers/net/wwan/t7xx/t7xx_hif_dpmaif.c +++ b/drivers/net/wwan/t7xx/t7xx_hif_dpmaif.c @@ -542,7 +542,7 @@ struct dpmaif_ctrl *t7xx_dpmaif_hif_init(struct t7xx_pci_dev *t7xx_dev, if (!callbacks) return NULL; - dpmaif_ctrl = devm_kzalloc(dev, sizeof(*dpmaif_ctrl), GFP_KERNEL); + dpmaif_ctrl = devm_kzalloc_obj(dev, *dpmaif_ctrl); if (!dpmaif_ctrl) return NULL; diff --git a/drivers/net/wwan/t7xx/t7xx_modem_ops.c b/drivers/net/wwan/t7xx/t7xx_modem_ops.c index adb29d30c63f..2202bf734a72 100644 --- a/drivers/net/wwan/t7xx/t7xx_modem_ops.c +++ b/drivers/net/wwan/t7xx/t7xx_modem_ops.c @@ -694,7 +694,7 @@ static struct t7xx_modem *t7xx_md_alloc(struct t7xx_pci_dev *t7xx_dev) struct device *dev = &t7xx_dev->pdev->dev; struct t7xx_modem *md; - md = devm_kzalloc(dev, sizeof(*md), GFP_KERNEL); + md = devm_kzalloc_obj(dev, *md); if (!md) return NULL; diff --git a/drivers/net/wwan/t7xx/t7xx_netdev.c b/drivers/net/wwan/t7xx/t7xx_netdev.c index 8f32c2d26931..ddafc1111a52 100644 --- a/drivers/net/wwan/t7xx/t7xx_netdev.c +++ b/drivers/net/wwan/t7xx/t7xx_netdev.c @@ -493,7 +493,7 @@ int t7xx_ccmni_init(struct t7xx_pci_dev *t7xx_dev) struct t7xx_ccmni_ctrl *ctlb; int ret; - ctlb = devm_kzalloc(dev, sizeof(*ctlb), GFP_KERNEL); + ctlb = devm_kzalloc_obj(dev, *ctlb); if (!ctlb) return -ENOMEM; diff --git a/drivers/net/wwan/t7xx/t7xx_pci.c b/drivers/net/wwan/t7xx/t7xx_pci.c index 46613bba1f41..c51c3b267186 100644 --- a/drivers/net/wwan/t7xx/t7xx_pci.c +++ b/drivers/net/wwan/t7xx/t7xx_pci.c @@ -840,7 +840,7 @@ static int t7xx_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) void __iomem *iomem; int ret; - t7xx_dev = devm_kzalloc(&pdev->dev, sizeof(*t7xx_dev), GFP_KERNEL); + t7xx_dev = devm_kzalloc_obj(&pdev->dev, *t7xx_dev); if (!t7xx_dev) return -ENOMEM; diff --git a/drivers/net/wwan/t7xx/t7xx_port_proxy.c b/drivers/net/wwan/t7xx/t7xx_port_proxy.c index 4fc131f9632f..977c25ea20f7 100644 --- a/drivers/net/wwan/t7xx/t7xx_port_proxy.c +++ b/drivers/net/wwan/t7xx/t7xx_port_proxy.c @@ -584,11 +584,8 @@ static int t7xx_proxy_alloc(struct t7xx_modem *md) struct device *dev = &md->t7xx_dev->pdev->dev; struct port_proxy *port_prox; - port_prox = devm_kzalloc(dev, - struct_size(port_prox, - ports, - T7XX_MAX_POSSIBLE_PORTS_NUM), - GFP_KERNEL); + port_prox = devm_kzalloc_flex(dev, *port_prox, ports, + T7XX_MAX_POSSIBLE_PORTS_NUM); if (!port_prox) return -ENOMEM; diff --git a/drivers/net/wwan/t7xx/t7xx_state_monitor.c b/drivers/net/wwan/t7xx/t7xx_state_monitor.c index 091d7cabd630..52c8f337aa8a 100644 --- a/drivers/net/wwan/t7xx/t7xx_state_monitor.c +++ b/drivers/net/wwan/t7xx/t7xx_state_monitor.c @@ -613,7 +613,7 @@ int t7xx_fsm_init(struct t7xx_modem *md) struct device *dev = &md->t7xx_dev->pdev->dev; struct t7xx_fsm_ctl *ctl; - ctl = devm_kzalloc(dev, sizeof(*ctl), GFP_KERNEL); + ctl = devm_kzalloc_obj(dev, *ctl); if (!ctl) return -ENOMEM; diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c index da3e2dce8e70..22a91628a948 100644 --- a/drivers/nfc/fdp/fdp.c +++ b/drivers/nfc/fdp/fdp.c @@ -707,7 +707,7 @@ int fdp_nci_probe(struct fdp_i2c_phy *phy, const struct nfc_phy_ops *phy_ops, u32 protocols; int r; - info = devm_kzalloc(dev, sizeof(struct fdp_nci_info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, struct fdp_nci_info); if (!info) return -ENOMEM; diff --git a/drivers/nfc/fdp/i2c.c b/drivers/nfc/fdp/i2c.c index e131f9933a5a..5a4718635fdf 100644 --- a/drivers/nfc/fdp/i2c.c +++ b/drivers/nfc/fdp/i2c.c @@ -322,7 +322,7 @@ static int fdp_nci_i2c_probe(struct i2c_client *client) return -ENODEV; } - phy = devm_kzalloc(dev, sizeof(struct fdp_i2c_phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, struct fdp_i2c_phy); if (!phy) return -ENOMEM; diff --git a/drivers/nfc/microread/i2c.c b/drivers/nfc/microread/i2c.c index f45e883b8730..307e9512427d 100644 --- a/drivers/nfc/microread/i2c.c +++ b/drivers/nfc/microread/i2c.c @@ -235,8 +235,7 @@ static int microread_i2c_probe(struct i2c_client *client) struct microread_i2c_phy *phy; int r; - phy = devm_kzalloc(&client->dev, sizeof(struct microread_i2c_phy), - GFP_KERNEL); + phy = devm_kzalloc_obj(&client->dev, struct microread_i2c_phy); if (!phy) return -ENOMEM; diff --git a/drivers/nfc/nfcmrvl/i2c.c b/drivers/nfc/nfcmrvl/i2c.c index 068c5d278a35..66451ad3354f 100644 --- a/drivers/nfc/nfcmrvl/i2c.c +++ b/drivers/nfc/nfcmrvl/i2c.c @@ -195,7 +195,7 @@ static int nfcmrvl_i2c_probe(struct i2c_client *client) return -ENODEV; } - drv_data = devm_kzalloc(&client->dev, sizeof(*drv_data), GFP_KERNEL); + drv_data = devm_kzalloc_obj(&client->dev, *drv_data); if (!drv_data) return -ENOMEM; diff --git a/drivers/nfc/nfcmrvl/spi.c b/drivers/nfc/nfcmrvl/spi.c index 8b8f00dac0f8..cbfcf54ecc60 100644 --- a/drivers/nfc/nfcmrvl/spi.c +++ b/drivers/nfc/nfcmrvl/spi.c @@ -131,7 +131,7 @@ static int nfcmrvl_spi_probe(struct spi_device *spi) struct nfcmrvl_spi_drv_data *drv_data; int ret = 0; - drv_data = devm_kzalloc(&spi->dev, sizeof(*drv_data), GFP_KERNEL); + drv_data = devm_kzalloc_obj(&spi->dev, *drv_data); if (!drv_data) return -ENOMEM; diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c index c7f2afe00b93..c9a6b59606cf 100644 --- a/drivers/nfc/nfcmrvl/usb.c +++ b/drivers/nfc/nfcmrvl/usb.c @@ -297,7 +297,7 @@ static int nfcmrvl_probe(struct usb_interface *intf, nfc_info(&udev->dev, "intf %p id %p\n", intf, id); - drv_data = devm_kzalloc(&intf->dev, sizeof(*drv_data), GFP_KERNEL); + drv_data = devm_kzalloc_obj(&intf->dev, *drv_data); if (!drv_data) return -ENOMEM; diff --git a/drivers/nfc/nxp-nci/core.c b/drivers/nfc/nxp-nci/core.c index 448e5a4e7338..7e5b90e56735 100644 --- a/drivers/nfc/nxp-nci/core.c +++ b/drivers/nfc/nxp-nci/core.c @@ -140,7 +140,7 @@ int nxp_nci_probe(void *phy_id, struct device *pdev, struct nxp_nci_info *info; int r; - info = devm_kzalloc(pdev, sizeof(struct nxp_nci_info), GFP_KERNEL); + info = devm_kzalloc_obj(pdev, struct nxp_nci_info); if (!info) return -ENOMEM; diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c index 92ce096e9b18..9eec67c10934 100644 --- a/drivers/nfc/nxp-nci/i2c.c +++ b/drivers/nfc/nxp-nci/i2c.c @@ -284,8 +284,7 @@ static int nxp_nci_i2c_probe(struct i2c_client *client) return -ENODEV; } - phy = devm_kzalloc(&client->dev, sizeof(struct nxp_nci_i2c_phy), - GFP_KERNEL); + phy = devm_kzalloc_obj(&client->dev, struct nxp_nci_i2c_phy); if (!phy) return -ENOMEM; diff --git a/drivers/nfc/pn533/i2c.c b/drivers/nfc/pn533/i2c.c index 66d201c14a40..3c83cdda912e 100644 --- a/drivers/nfc/pn533/i2c.c +++ b/drivers/nfc/pn533/i2c.c @@ -174,8 +174,7 @@ static int pn533_i2c_probe(struct i2c_client *client) return -ENODEV; } - phy = devm_kzalloc(&client->dev, sizeof(struct pn533_i2c_phy), - GFP_KERNEL); + phy = devm_kzalloc_obj(&client->dev, struct pn533_i2c_phy); if (!phy) return -ENOMEM; diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c index 972eaac09e59..a04f10785b3f 100644 --- a/drivers/nfc/pn533/usb.c +++ b/drivers/nfc/pn533/usb.c @@ -490,7 +490,7 @@ static int pn533_usb_probe(struct usb_interface *interface, PN533_STD_FRAME_TAIL_LEN; int rc; - phy = devm_kzalloc(&interface->dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(&interface->dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c index 7fde3aefae70..ee8cc2496136 100644 --- a/drivers/nfc/pn544/i2c.c +++ b/drivers/nfc/pn544/i2c.c @@ -873,8 +873,7 @@ static int pn544_hci_i2c_probe(struct i2c_client *client) return -ENODEV; } - phy = devm_kzalloc(&client->dev, sizeof(struct pn544_i2c_phy), - GFP_KERNEL); + phy = devm_kzalloc_obj(&client->dev, struct pn544_i2c_phy); if (!phy) return -ENOMEM; diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c index e769a30b8b5c..d1873d7af3a8 100644 --- a/drivers/nfc/port100.c +++ b/drivers/nfc/port100.c @@ -1502,7 +1502,7 @@ static int port100_probe(struct usb_interface *interface, u16 fw_version; u64 cmd_type_mask; - dev = devm_kzalloc(&interface->dev, sizeof(struct port100), GFP_KERNEL); + dev = devm_kzalloc_obj(&interface->dev, struct port100); if (!dev) return -ENOMEM; diff --git a/drivers/nfc/s3fwrn5/core.c b/drivers/nfc/s3fwrn5/core.c index af0fa8bd970b..b46cfdd226e4 100644 --- a/drivers/nfc/s3fwrn5/core.c +++ b/drivers/nfc/s3fwrn5/core.c @@ -163,7 +163,7 @@ int s3fwrn5_probe(struct nci_dev **ndev, void *phy_id, struct device *pdev, struct s3fwrn5_info *info; int ret; - info = devm_kzalloc(pdev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(pdev, *info); if (!info) return -ENOMEM; diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c index 4ba762611711..783c874254e9 100644 --- a/drivers/nfc/s3fwrn5/i2c.c +++ b/drivers/nfc/s3fwrn5/i2c.c @@ -149,7 +149,7 @@ static int s3fwrn5_i2c_probe(struct i2c_client *client) struct s3fwrn5_i2c_phy *phy; int ret; - phy = devm_kzalloc(&client->dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(&client->dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/nfc/s3fwrn5/uart.c b/drivers/nfc/s3fwrn5/uart.c index 8f142a255101..56704416880e 100644 --- a/drivers/nfc/s3fwrn5/uart.c +++ b/drivers/nfc/s3fwrn5/uart.c @@ -95,7 +95,7 @@ static int s3fwrn82_uart_probe(struct serdev_device *serdev) struct s3fwrn82_uart_phy *phy; int ret = -ENOMEM; - phy = devm_kzalloc(&serdev->dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(&serdev->dev, *phy); if (!phy) goto err_exit; diff --git a/drivers/nfc/st-nci/core.c b/drivers/nfc/st-nci/core.c index a367136d4330..1ad3275e6c14 100644 --- a/drivers/nfc/st-nci/core.c +++ b/drivers/nfc/st-nci/core.c @@ -116,8 +116,7 @@ int st_nci_probe(struct llt_ndlc *ndlc, int phy_headroom, int r; u32 protocols; - info = devm_kzalloc(ndlc->dev, - sizeof(struct st_nci_info), GFP_KERNEL); + info = devm_kzalloc_obj(ndlc->dev, struct st_nci_info); if (!info) return -ENOMEM; diff --git a/drivers/nfc/st-nci/i2c.c b/drivers/nfc/st-nci/i2c.c index 152c20b6bb01..b80e64862530 100644 --- a/drivers/nfc/st-nci/i2c.c +++ b/drivers/nfc/st-nci/i2c.c @@ -206,7 +206,7 @@ static int st_nci_i2c_probe(struct i2c_client *client) return -ENODEV; } - phy = devm_kzalloc(dev, sizeof(struct st_nci_i2c_phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, struct st_nci_i2c_phy); if (!phy) return -ENOMEM; diff --git a/drivers/nfc/st-nci/ndlc.c b/drivers/nfc/st-nci/ndlc.c index be4808859cfa..9c5f7a6043ce 100644 --- a/drivers/nfc/st-nci/ndlc.c +++ b/drivers/nfc/st-nci/ndlc.c @@ -255,7 +255,7 @@ int ndlc_probe(void *phy_id, const struct nfc_phy_ops *phy_ops, { struct llt_ndlc *ndlc; - ndlc = devm_kzalloc(dev, sizeof(struct llt_ndlc), GFP_KERNEL); + ndlc = devm_kzalloc_obj(dev, struct llt_ndlc); if (!ndlc) return -ENOMEM; diff --git a/drivers/nfc/st-nci/spi.c b/drivers/nfc/st-nci/spi.c index 7948c7e0c88c..95ef01ab2b6c 100644 --- a/drivers/nfc/st-nci/spi.c +++ b/drivers/nfc/st-nci/spi.c @@ -219,8 +219,7 @@ static int st_nci_spi_probe(struct spi_device *dev) return -ENODEV; } - phy = devm_kzalloc(&dev->dev, sizeof(struct st_nci_spi_phy), - GFP_KERNEL); + phy = devm_kzalloc_obj(&dev->dev, struct st_nci_spi_phy); if (!phy) return -ENOMEM; diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c index 0f44c783bd04..3031a19ac12a 100644 --- a/drivers/nfc/st21nfca/i2c.c +++ b/drivers/nfc/st21nfca/i2c.c @@ -506,8 +506,7 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client) return -ENODEV; } - phy = devm_kzalloc(&client->dev, sizeof(struct st21nfca_i2c_phy), - GFP_KERNEL); + phy = devm_kzalloc_obj(&client->dev, struct st21nfca_i2c_phy); if (!phy) return -ENOMEM; diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c index 4d772a308bff..dcc9e53815ca 100644 --- a/drivers/nfc/st95hf/core.c +++ b/drivers/nfc/st95hf/core.c @@ -1070,9 +1070,7 @@ static int st95hf_probe(struct spi_device *nfc_spi_dev) nfc_info(&nfc_spi_dev->dev, "ST95HF driver probe called.\n"); - st95context = devm_kzalloc(&nfc_spi_dev->dev, - sizeof(struct st95hf_context), - GFP_KERNEL); + st95context = devm_kzalloc_obj(&nfc_spi_dev->dev, struct st95hf_context); if (!st95context) return -ENOMEM; diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c index ddfc58c29964..001748d91ec1 100644 --- a/drivers/nfc/trf7970a.c +++ b/drivers/nfc/trf7970a.c @@ -2057,7 +2057,7 @@ static int trf7970a_probe(struct spi_device *spi) return -EINVAL; } - trf = devm_kzalloc(&spi->dev, sizeof(*trf), GFP_KERNEL); + trf = devm_kzalloc_obj(&spi->dev, *trf); if (!trf) return -ENOMEM; diff --git a/drivers/ntb/hw/epf/ntb_hw_epf.c b/drivers/ntb/hw/epf/ntb_hw_epf.c index c47607d4f8a7..95bd344ab37f 100644 --- a/drivers/ntb/hw/epf/ntb_hw_epf.c +++ b/drivers/ntb/hw/epf/ntb_hw_epf.c @@ -760,7 +760,7 @@ static int ntb_epf_pci_probe(struct pci_dev *pdev, if (pci_is_bridge(pdev)) return -ENODEV; - ndev = devm_kzalloc(dev, sizeof(*ndev), GFP_KERNEL); + ndev = devm_kzalloc_obj(dev, *ndev); if (!ndev) return -ENOMEM; diff --git a/drivers/ntb/hw/idt/ntb_hw_idt.c b/drivers/ntb/hw/idt/ntb_hw_idt.c index f27df8d7f3b9..2bf58d0eca36 100644 --- a/drivers/ntb/hw/idt/ntb_hw_idt.c +++ b/drivers/ntb/hw/idt/ntb_hw_idt.c @@ -1049,8 +1049,7 @@ static struct idt_mw_cfg *idt_scan_mws(struct idt_ntb_dev *ndev, int port, int aprt_size; u32 data; - mws = devm_kcalloc(&ndev->ntb.pdev->dev, IDT_MAX_NR_MWS, - sizeof(*mws), GFP_KERNEL); + mws = devm_kzalloc_objs(&ndev->ntb.pdev->dev, *mws, IDT_MAX_NR_MWS); if (!mws) return ERR_PTR(-ENOMEM); @@ -2598,7 +2597,7 @@ static struct idt_ntb_dev *idt_create_dev(struct pci_dev *pdev, struct idt_ntb_dev *ndev; /* Allocate memory for the IDT PCIe-device descriptor */ - ndev = devm_kzalloc(&pdev->dev, sizeof(*ndev), GFP_KERNEL); + ndev = devm_kzalloc_obj(&pdev->dev, *ndev); if (!ndev) { dev_err(&pdev->dev, "Memory allocation failed for descriptor"); return ERR_PTR(-ENOMEM); diff --git a/drivers/ntb/msi.c b/drivers/ntb/msi.c index 6817d504c12a..94205ab4612f 100644 --- a/drivers/ntb/msi.c +++ b/drivers/ntb/msi.c @@ -42,8 +42,7 @@ int ntb_msi_init(struct ntb_dev *ntb, if (peers <= 0) return -EINVAL; - ntb->msi = devm_kzalloc(&ntb->dev, struct_size(ntb->msi, peer_mws, peers), - GFP_KERNEL); + ntb->msi = devm_kzalloc_flex(&ntb->dev, *ntb->msi, peer_mws, peers); if (!ntb->msi) return -ENOMEM; diff --git a/drivers/ntb/test/ntb_msi_test.c b/drivers/ntb/test/ntb_msi_test.c index f52d409ba6d2..e8bcd54638bb 100644 --- a/drivers/ntb/test/ntb_msi_test.c +++ b/drivers/ntb/test/ntb_msi_test.c @@ -351,12 +351,11 @@ static int ntb_msit_probe(struct ntb_client *client, struct ntb_dev *ntb) return ret; } - nm = devm_kzalloc(&ntb->dev, struct_size(nm, peers, peers), GFP_KERNEL); + nm = devm_kzalloc_flex(&ntb->dev, *nm, peers, peers); if (!nm) return -ENOMEM; - nm->isr_ctx = devm_kcalloc(&ntb->dev, num_irqs, sizeof(*nm->isr_ctx), - GFP_KERNEL); + nm->isr_ctx = devm_kzalloc_objs(&ntb->dev, *nm->isr_ctx, num_irqs); if (!nm->isr_ctx) return -ENOMEM; diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c index dfd175f79e8f..d8dfb8233c7b 100644 --- a/drivers/ntb/test/ntb_perf.c +++ b/drivers/ntb/test/ntb_perf.c @@ -1389,13 +1389,12 @@ static struct perf_ctx *perf_create_data(struct ntb_dev *ntb) { struct perf_ctx *perf; - perf = devm_kzalloc(&ntb->dev, sizeof(*perf), GFP_KERNEL); + perf = devm_kzalloc_obj(&ntb->dev, *perf); if (!perf) return ERR_PTR(-ENOMEM); perf->pcnt = ntb_peer_port_count(ntb); - perf->peers = devm_kcalloc(&ntb->dev, perf->pcnt, sizeof(*perf->peers), - GFP_KERNEL); + perf->peers = devm_kzalloc_objs(&ntb->dev, *perf->peers, perf->pcnt); if (!perf->peers) return ERR_PTR(-ENOMEM); diff --git a/drivers/ntb/test/ntb_pingpong.c b/drivers/ntb/test/ntb_pingpong.c index 1c1c74f4ff2d..1bd5ef2c7e85 100644 --- a/drivers/ntb/test/ntb_pingpong.c +++ b/drivers/ntb/test/ntb_pingpong.c @@ -277,7 +277,7 @@ static struct pp_ctx *pp_create_data(struct ntb_dev *ntb) { struct pp_ctx *pp; - pp = devm_kzalloc(&ntb->dev, sizeof(*pp), GFP_KERNEL); + pp = devm_kzalloc_obj(&ntb->dev, *pp); if (!pp) return ERR_PTR(-ENOMEM); diff --git a/drivers/ntb/test/ntb_tool.c b/drivers/ntb/test/ntb_tool.c index 06881047f5bc..7a880147737e 100644 --- a/drivers/ntb/test/ntb_tool.c +++ b/drivers/ntb/test/ntb_tool.c @@ -441,8 +441,7 @@ static int tool_init_peers(struct tool_ctx *tc) int pidx; tc->peer_cnt = ntb_peer_port_count(tc->ntb); - tc->peers = devm_kcalloc(&tc->ntb->dev, tc->peer_cnt, - sizeof(*tc->peers), GFP_KERNEL); + tc->peers = devm_kzalloc_objs(&tc->ntb->dev, *tc->peers, tc->peer_cnt); if (tc->peers == NULL) return -ENOMEM; @@ -961,8 +960,8 @@ static int tool_init_mws(struct tool_ctx *tc) /* Initialize outbound memory windows */ tc->outmw_cnt = ntb_peer_mw_count(tc->ntb); - tc->outmws = devm_kcalloc(&tc->ntb->dev, tc->outmw_cnt, - sizeof(*tc->outmws), GFP_KERNEL); + tc->outmws = devm_kzalloc_objs(&tc->ntb->dev, *tc->outmws, + tc->outmw_cnt); if (tc->outmws == NULL) return -ENOMEM; @@ -976,8 +975,8 @@ static int tool_init_mws(struct tool_ctx *tc) for (pidx = 0; pidx < tc->peer_cnt; pidx++) { tc->peers[pidx].inmw_cnt = ntb_mw_count(tc->ntb, pidx); tc->peers[pidx].inmws = - devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].inmw_cnt, - sizeof(*tc->peers[pidx].inmws), GFP_KERNEL); + devm_kzalloc_objs(&tc->ntb->dev, *tc->peers[pidx].inmws, + tc->peers[pidx].inmw_cnt); if (tc->peers[pidx].inmws == NULL) return -ENOMEM; @@ -989,8 +988,9 @@ static int tool_init_mws(struct tool_ctx *tc) tc->peers[pidx].outmw_cnt = ntb_peer_mw_count(tc->ntb); tc->peers[pidx].outmws = - devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].outmw_cnt, - sizeof(*tc->peers[pidx].outmws), GFP_KERNEL); + devm_kzalloc_objs(&tc->ntb->dev, + *tc->peers[pidx].outmws, + tc->peers[pidx].outmw_cnt); if (tc->peers[pidx].outmws == NULL) return -ENOMEM; @@ -1236,8 +1236,8 @@ static int tool_init_spads(struct tool_ctx *tc) /* Initialize inbound scratchpad structures */ tc->inspad_cnt = ntb_spad_count(tc->ntb); - tc->inspads = devm_kcalloc(&tc->ntb->dev, tc->inspad_cnt, - sizeof(*tc->inspads), GFP_KERNEL); + tc->inspads = devm_kzalloc_objs(&tc->ntb->dev, *tc->inspads, + tc->inspad_cnt); if (tc->inspads == NULL) return -ENOMEM; @@ -1251,8 +1251,9 @@ static int tool_init_spads(struct tool_ctx *tc) for (pidx = 0; pidx < tc->peer_cnt; pidx++) { tc->peers[pidx].outspad_cnt = ntb_spad_count(tc->ntb); tc->peers[pidx].outspads = - devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].outspad_cnt, - sizeof(*tc->peers[pidx].outspads), GFP_KERNEL); + devm_kzalloc_objs(&tc->ntb->dev, + *tc->peers[pidx].outspads, + tc->peers[pidx].outspad_cnt); if (tc->peers[pidx].outspads == NULL) return -ENOMEM; @@ -1400,8 +1401,8 @@ static int tool_init_msgs(struct tool_ctx *tc) /* Initialize inbound message structures */ tc->inmsg_cnt = ntb_msg_count(tc->ntb); - tc->inmsgs = devm_kcalloc(&tc->ntb->dev, tc->inmsg_cnt, - sizeof(*tc->inmsgs), GFP_KERNEL); + tc->inmsgs = devm_kzalloc_objs(&tc->ntb->dev, *tc->inmsgs, + tc->inmsg_cnt); if (tc->inmsgs == NULL) return -ENOMEM; @@ -1415,8 +1416,9 @@ static int tool_init_msgs(struct tool_ctx *tc) for (pidx = 0; pidx < tc->peer_cnt; pidx++) { tc->peers[pidx].outmsg_cnt = ntb_msg_count(tc->ntb); tc->peers[pidx].outmsgs = - devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].outmsg_cnt, - sizeof(*tc->peers[pidx].outmsgs), GFP_KERNEL); + devm_kzalloc_objs(&tc->ntb->dev, + *tc->peers[pidx].outmsgs, + tc->peers[pidx].outmsg_cnt); if (tc->peers[pidx].outmsgs == NULL) return -ENOMEM; @@ -1439,7 +1441,7 @@ static struct tool_ctx *tool_create_data(struct ntb_dev *ntb) { struct tool_ctx *tc; - tc = devm_kzalloc(&ntb->dev, sizeof(*tc), GFP_KERNEL); + tc = devm_kzalloc_obj(&ntb->dev, *tc); if (tc == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c index 727cce176a0c..d7d22689bb62 100644 --- a/drivers/nvdimm/btt.c +++ b/drivers/nvdimm/btt.c @@ -1577,7 +1577,7 @@ static struct btt *btt_init(struct nd_btt *nd_btt, unsigned long long rawsize, struct nd_namespace_io *nsio; struct device *dev = &nd_btt->dev; - btt = devm_kzalloc(dev, sizeof(struct btt), GFP_KERNEL); + btt = devm_kzalloc_obj(dev, struct btt); if (!btt) return NULL; @@ -1666,7 +1666,7 @@ int nvdimm_namespace_attach_btt(struct nd_namespace_common *ndns) return -ENODEV; } - btt_sb = devm_kzalloc(&nd_btt->dev, sizeof(*btt_sb), GFP_KERNEL); + btt_sb = devm_kzalloc_obj(&nd_btt->dev, *btt_sb); if (!btt_sb) return -ENOMEM; diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c index d6b2f157368f..4d269c13d4a4 100644 --- a/drivers/nvdimm/btt_devs.c +++ b/drivers/nvdimm/btt_devs.c @@ -348,7 +348,7 @@ int nd_btt_probe(struct device *dev, struct nd_namespace_common *ndns) btt_dev = __nd_btt_create(nd_region, 0, NULL, ndns); if (!btt_dev) return -ENOMEM; - btt_sb = devm_kzalloc(dev, sizeof(*btt_sb), GFP_KERNEL); + btt_sb = devm_kzalloc_obj(dev, *btt_sb); rc = __nd_btt_probe(to_nd_btt(btt_dev), ndns, btt_sb); dev_dbg(dev, "btt: %s\n", rc == 0 ? dev_name(btt_dev) : ""); if (rc < 0) { diff --git a/drivers/nvdimm/dax_devs.c b/drivers/nvdimm/dax_devs.c index decc70f2fe3f..edc9d239c2e3 100644 --- a/drivers/nvdimm/dax_devs.c +++ b/drivers/nvdimm/dax_devs.c @@ -110,7 +110,7 @@ int nd_dax_probe(struct device *dev, struct nd_namespace_common *ndns) if (!dax_dev) return -ENOMEM; } - pfn_sb = devm_kmalloc(dev, sizeof(*pfn_sb), GFP_KERNEL); + pfn_sb = devm_kmalloc_obj(dev, *pfn_sb); nd_pfn = &nd_dax->nd_pfn; nd_pfn->pfn_sb = pfn_sb; rc = nd_pfn_validate(nd_pfn, DAX_SIG); diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c index 8fa9c16aba7e..625a35d7e055 100644 --- a/drivers/nvdimm/pfn_devs.c +++ b/drivers/nvdimm/pfn_devs.c @@ -634,7 +634,7 @@ int nd_pfn_probe(struct device *dev, struct nd_namespace_common *ndns) } if (!pfn_dev) return -ENOMEM; - pfn_sb = devm_kmalloc(dev, sizeof(*pfn_sb), GFP_KERNEL); + pfn_sb = devm_kmalloc_obj(dev, *pfn_sb); nd_pfn = to_nd_pfn(pfn_dev); nd_pfn->pfn_sb = pfn_sb; rc = nd_pfn_validate(nd_pfn, PFN_SIG); @@ -728,7 +728,7 @@ static int nd_pfn_init(struct nd_pfn *nd_pfn) u64 checksum; int rc; - pfn_sb = devm_kmalloc(&nd_pfn->dev, sizeof(*pfn_sb), GFP_KERNEL); + pfn_sb = devm_kmalloc_obj(&nd_pfn->dev, *pfn_sb); if (!pfn_sb) return -ENOMEM; diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 0766a6949b28..852a5937b2ca 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -483,7 +483,7 @@ static int pmem_attach_disk(struct device *dev, void *addr; int rc; - pmem = devm_kzalloc(dev, sizeof(*pmem), GFP_KERNEL); + pmem = devm_kzalloc_obj(dev, *pmem); if (!pmem) return -ENOMEM; diff --git a/drivers/nvdimm/virtio_pmem.c b/drivers/nvdimm/virtio_pmem.c index 7ee3fb1779f7..3e06ff34c4af 100644 --- a/drivers/nvdimm/virtio_pmem.c +++ b/drivers/nvdimm/virtio_pmem.c @@ -74,7 +74,7 @@ static int virtio_pmem_probe(struct virtio_device *vdev) return -EINVAL; } - vpmem = devm_kzalloc(&vdev->dev, sizeof(*vpmem), GFP_KERNEL); + vpmem = devm_kzalloc_obj(&vdev->dev, *vpmem); if (!vpmem) { err = -ENOMEM; goto out_err; diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c index 4621584b1b6f..7e104f43ecc9 100644 --- a/drivers/nvme/host/apple.c +++ b/drivers/nvme/host/apple.c @@ -1437,13 +1437,11 @@ static int apple_nvme_attach_genpd(struct apple_nvme *anv) if (anv->pd_count <= 1) return 0; - anv->pd_dev = devm_kcalloc(dev, anv->pd_count, sizeof(*anv->pd_dev), - GFP_KERNEL); + anv->pd_dev = devm_kzalloc_objs(dev, *anv->pd_dev, anv->pd_count); if (!anv->pd_dev) return -ENOMEM; - anv->pd_link = devm_kcalloc(dev, anv->pd_count, sizeof(*anv->pd_link), - GFP_KERNEL); + anv->pd_link = devm_kzalloc_objs(dev, *anv->pd_link, anv->pd_count); if (!anv->pd_link) return -ENOMEM; @@ -1478,7 +1476,7 @@ static struct apple_nvme *apple_nvme_alloc(struct platform_device *pdev) struct apple_nvme *anv; int ret; - anv = devm_kzalloc(dev, sizeof(*anv), GFP_KERNEL); + anv = devm_kzalloc_obj(dev, *anv); if (!anv) return ERR_PTR(-ENOMEM); diff --git a/drivers/nvme/target/pci-epf.c b/drivers/nvme/target/pci-epf.c index a8df176c1a57..c9796a719582 100644 --- a/drivers/nvme/target/pci-epf.c +++ b/drivers/nvme/target/pci-epf.c @@ -2464,7 +2464,7 @@ static int nvmet_pci_epf_probe(struct pci_epf *epf, struct nvmet_pci_epf *nvme_epf; int ret; - nvme_epf = devm_kzalloc(&epf->dev, sizeof(*nvme_epf), GFP_KERNEL); + nvme_epf = devm_kzalloc_obj(&epf->dev, *nvme_epf); if (!nvme_epf) return -ENOMEM; diff --git a/drivers/nvmem/airoha-smc-efuses.c b/drivers/nvmem/airoha-smc-efuses.c index e56a99f4aa1f..f43c8c4c30ce 100644 --- a/drivers/nvmem/airoha-smc-efuses.c +++ b/drivers/nvmem/airoha-smc-efuses.c @@ -75,7 +75,7 @@ static int airoha_efuse_probe(struct platform_device *pdev) if (ret) return ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/apple-efuses.c b/drivers/nvmem/apple-efuses.c index 9913e77b8ff0..96efd8c6aff8 100644 --- a/drivers/nvmem/apple-efuses.c +++ b/drivers/nvmem/apple-efuses.c @@ -45,7 +45,7 @@ static int apple_efuses_probe(struct platform_device *pdev) .root_only = true, }; - priv = devm_kzalloc(config.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(config.dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/at24.c b/drivers/nvmem/at24.c index 772c4d9fa651..b9db13cc3e33 100644 --- a/drivers/nvmem/at24.c +++ b/drivers/nvmem/at24.c @@ -683,8 +683,7 @@ static int at24_probe(struct i2c_client *client) if (IS_ERR(regmap)) return PTR_ERR(regmap); - at24 = devm_kzalloc(dev, struct_size(at24, client_regmaps, num_addresses), - GFP_KERNEL); + at24 = devm_kzalloc_flex(dev, *at24, client_regmaps, num_addresses); if (!at24) return -ENOMEM; diff --git a/drivers/nvmem/at25.c b/drivers/nvmem/at25.c index bc2cfb75d9bb..72240dabdc3b 100644 --- a/drivers/nvmem/at25.c +++ b/drivers/nvmem/at25.c @@ -487,7 +487,7 @@ static int at25_probe(struct spi_mem *mem) bool is_fram; int err; - at25 = devm_kzalloc(&spi->dev, sizeof(*at25), GFP_KERNEL); + at25 = devm_kzalloc_obj(&spi->dev, *at25); if (!at25) return -ENOMEM; diff --git a/drivers/nvmem/bcm-ocotp.c b/drivers/nvmem/bcm-ocotp.c index 2490f44caa40..6c06c6ed03e3 100644 --- a/drivers/nvmem/bcm-ocotp.c +++ b/drivers/nvmem/bcm-ocotp.c @@ -248,7 +248,7 @@ static int bcm_otpc_probe(struct platform_device *pdev) int err; u32 num_words; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/brcm_nvram.c b/drivers/nvmem/brcm_nvram.c index 9f77aee37121..1935fe64e7ae 100644 --- a/drivers/nvmem/brcm_nvram.c +++ b/drivers/nvmem/brcm_nvram.c @@ -138,7 +138,7 @@ static int brcm_nvram_add_cells(struct brcm_nvram *priv, uint8_t *data, priv->ncells++; } - priv->cells = devm_kcalloc(dev, priv->ncells, sizeof(*priv->cells), GFP_KERNEL); + priv->cells = devm_kzalloc_objs(dev, *priv->cells, priv->ncells); if (!priv->cells) { err = -ENOMEM; goto out; @@ -219,7 +219,7 @@ static int brcm_nvram_probe(struct platform_device *pdev) struct brcm_nvram *priv; int err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; priv->dev = dev; diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 7d4cce8e2742..d976c0d6603b 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -494,12 +494,11 @@ static int nvmem_populate_sysfs_cells(struct nvmem_device *nvmem) /* Allocate an array of attributes with a sentinel */ ncells = list_count_nodes(&nvmem->cells); - pattrs = devm_kcalloc(&nvmem->dev, ncells + 1, - sizeof(*pattrs), GFP_KERNEL); + pattrs = devm_kzalloc_objs(&nvmem->dev, *pattrs, ncells + 1); if (!pattrs) return -ENOMEM; - attrs = devm_kcalloc(&nvmem->dev, ncells, sizeof(struct bin_attribute), GFP_KERNEL); + attrs = devm_kzalloc_objs(&nvmem->dev, struct bin_attribute, ncells); if (!attrs) return -ENOMEM; diff --git a/drivers/nvmem/eeprom_93xx46.c b/drivers/nvmem/eeprom_93xx46.c index f9c3ab52c2f9..fe50956a3e67 100644 --- a/drivers/nvmem/eeprom_93xx46.c +++ b/drivers/nvmem/eeprom_93xx46.c @@ -417,7 +417,7 @@ static int eeprom_93xx46_probe_fw(struct device *dev) u32 tmp; int ret; - pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(dev, *pd); if (!pd) return -ENOMEM; @@ -472,7 +472,7 @@ static int eeprom_93xx46_probe(struct spi_device *spi) return -ENODEV; } - edev = devm_kzalloc(&spi->dev, sizeof(*edev), GFP_KERNEL); + edev = devm_kzalloc_obj(&spi->dev, *edev); if (!edev) return -ENOMEM; diff --git a/drivers/nvmem/imx-iim.c b/drivers/nvmem/imx-iim.c index 8cfbe55a56cb..2e8995040ee7 100644 --- a/drivers/nvmem/imx-iim.c +++ b/drivers/nvmem/imx-iim.c @@ -101,7 +101,7 @@ static int imx_iim_probe(struct platform_device *pdev) struct nvmem_config cfg = {}; const struct imx_iim_drvdata *drvdata = NULL; - iim = devm_kzalloc(dev, sizeof(*iim), GFP_KERNEL); + iim = devm_kzalloc_obj(dev, *iim); if (!iim) return -ENOMEM; diff --git a/drivers/nvmem/imx-ocotp-ele.c b/drivers/nvmem/imx-ocotp-ele.c index a0d2985c6d03..0a122984d667 100644 --- a/drivers/nvmem/imx-ocotp-ele.c +++ b/drivers/nvmem/imx-ocotp-ele.c @@ -141,7 +141,7 @@ static int imx_ele_ocotp_probe(struct platform_device *pdev) struct imx_ocotp_priv *priv; struct nvmem_device *nvmem; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/imx-ocotp-scu.c b/drivers/nvmem/imx-ocotp-scu.c index 517d83e11af2..20312fba22d2 100644 --- a/drivers/nvmem/imx-ocotp-scu.c +++ b/drivers/nvmem/imx-ocotp-scu.c @@ -243,7 +243,7 @@ static int imx_scu_ocotp_probe(struct platform_device *pdev) struct nvmem_device *nvmem; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index 108d78d7f6cb..55e07fd919a2 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c @@ -599,7 +599,7 @@ static int imx_ocotp_probe(struct platform_device *pdev) struct ocotp_priv *priv; struct nvmem_device *nvmem; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/jz4780-efuse.c b/drivers/nvmem/jz4780-efuse.c index 0b01b840edd9..43fa780daf63 100644 --- a/drivers/nvmem/jz4780-efuse.c +++ b/drivers/nvmem/jz4780-efuse.c @@ -148,7 +148,7 @@ static int jz4780_efuse_probe(struct platform_device *pdev) void __iomem *regs; int ret; - efuse = devm_kzalloc(dev, sizeof(*efuse), GFP_KERNEL); + efuse = devm_kzalloc_obj(dev, *efuse); if (!efuse) return -ENOMEM; diff --git a/drivers/nvmem/lan9662-otpc.c b/drivers/nvmem/lan9662-otpc.c index 62d1d6381bf8..a83c6679b8a1 100644 --- a/drivers/nvmem/lan9662-otpc.c +++ b/drivers/nvmem/lan9662-otpc.c @@ -183,7 +183,7 @@ static int lan9662_otp_probe(struct platform_device *pdev) struct nvmem_device *nvmem; struct lan9662_otp *otp; - otp = devm_kzalloc(&pdev->dev, sizeof(*otp), GFP_KERNEL); + otp = devm_kzalloc_obj(&pdev->dev, *otp); if (!otp) return -ENOMEM; diff --git a/drivers/nvmem/layerscape-sfp.c b/drivers/nvmem/layerscape-sfp.c index c1521afd5b43..5a4692b42520 100644 --- a/drivers/nvmem/layerscape-sfp.c +++ b/drivers/nvmem/layerscape-sfp.c @@ -50,7 +50,7 @@ static int layerscape_sfp_probe(struct platform_device *pdev) struct regmap_config config = { 0 }; void __iomem *base; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/lpc18xx_eeprom.c b/drivers/nvmem/lpc18xx_eeprom.c index 504155e30bab..e393dacb4bf4 100644 --- a/drivers/nvmem/lpc18xx_eeprom.c +++ b/drivers/nvmem/lpc18xx_eeprom.c @@ -167,7 +167,7 @@ static int lpc18xx_eeprom_probe(struct platform_device *pdev) struct resource *res; int ret; - eeprom = devm_kzalloc(dev, sizeof(*eeprom), GFP_KERNEL); + eeprom = devm_kzalloc_obj(dev, *eeprom); if (!eeprom) return -ENOMEM; diff --git a/drivers/nvmem/lpc18xx_otp.c b/drivers/nvmem/lpc18xx_otp.c index c41a0c58bec7..a6cb46e20511 100644 --- a/drivers/nvmem/lpc18xx_otp.c +++ b/drivers/nvmem/lpc18xx_otp.c @@ -68,7 +68,7 @@ static int lpc18xx_otp_probe(struct platform_device *pdev) struct nvmem_device *nvmem; struct lpc18xx_otp *otp; - otp = devm_kzalloc(&pdev->dev, sizeof(*otp), GFP_KERNEL); + otp = devm_kzalloc_obj(&pdev->dev, *otp); if (!otp) return -ENOMEM; diff --git a/drivers/nvmem/m24lr.c b/drivers/nvmem/m24lr.c index 7a9fd45a8e46..04bec3a5b138 100644 --- a/drivers/nvmem/m24lr.c +++ b/drivers/nvmem/m24lr.c @@ -506,7 +506,7 @@ static int m24lr_probe(struct i2c_client *client) if (!chip) return -ENODEV; - m24lr = devm_kzalloc(dev, sizeof(struct m24lr), GFP_KERNEL); + m24lr = devm_kzalloc_obj(dev, struct m24lr); if (!m24lr) return -ENOMEM; diff --git a/drivers/nvmem/max77759-nvmem.c b/drivers/nvmem/max77759-nvmem.c index 283000ec3a2c..fdab306fd149 100644 --- a/drivers/nvmem/max77759-nvmem.c +++ b/drivers/nvmem/max77759-nvmem.c @@ -103,7 +103,7 @@ static int max77759_nvmem_probe(struct platform_device *pdev) }; struct max77759_nvmem *nvmem; - nvmem = devm_kzalloc(&pdev->dev, sizeof(*nvmem), GFP_KERNEL); + nvmem = devm_kzalloc_obj(&pdev->dev, *nvmem); if (!nvmem) return -ENOMEM; diff --git a/drivers/nvmem/meson-efuse.c b/drivers/nvmem/meson-efuse.c index d7f9ac99a212..2b2a2c515ce0 100644 --- a/drivers/nvmem/meson-efuse.c +++ b/drivers/nvmem/meson-efuse.c @@ -73,7 +73,7 @@ static int meson_efuse_probe(struct platform_device *pdev) return -EINVAL; } - econfig = devm_kzalloc(dev, sizeof(*econfig), GFP_KERNEL); + econfig = devm_kzalloc_obj(dev, *econfig); if (!econfig) return -ENOMEM; diff --git a/drivers/nvmem/meson-mx-efuse.c b/drivers/nvmem/meson-mx-efuse.c index 8a16f5f02657..ec27ce932f19 100644 --- a/drivers/nvmem/meson-mx-efuse.c +++ b/drivers/nvmem/meson-mx-efuse.c @@ -198,7 +198,7 @@ static int meson_mx_efuse_probe(struct platform_device *pdev) if (!drvdata) return -EINVAL; - efuse = devm_kzalloc(&pdev->dev, sizeof(*efuse), GFP_KERNEL); + efuse = devm_kzalloc_obj(&pdev->dev, *efuse); if (!efuse) return -ENOMEM; diff --git a/drivers/nvmem/microchip-otpc.c b/drivers/nvmem/microchip-otpc.c index df979e8549fd..92524016a8fb 100644 --- a/drivers/nvmem/microchip-otpc.c +++ b/drivers/nvmem/microchip-otpc.c @@ -209,7 +209,7 @@ static int mchp_otpc_init_packets_list(struct mchp_otpc *otpc, u32 *size) if (!payload_size) break; - packet = devm_kzalloc(otpc->dev, sizeof(*packet), GFP_KERNEL); + packet = devm_kzalloc_obj(otpc->dev, *packet); if (!packet) return -ENOMEM; @@ -247,7 +247,7 @@ static int mchp_otpc_probe(struct platform_device *pdev) u32 size; int ret; - otpc = devm_kzalloc(&pdev->dev, sizeof(*otpc), GFP_KERNEL); + otpc = devm_kzalloc_obj(&pdev->dev, *otpc); if (!otpc) return -ENOMEM; diff --git a/drivers/nvmem/mtk-efuse.c b/drivers/nvmem/mtk-efuse.c index 00a84ea963a8..25669619de17 100644 --- a/drivers/nvmem/mtk-efuse.c +++ b/drivers/nvmem/mtk-efuse.c @@ -69,7 +69,7 @@ static int mtk_efuse_probe(struct platform_device *pdev) const struct mtk_efuse_pdata *pdata; struct platform_device *socinfo; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/mxs-ocotp.c b/drivers/nvmem/mxs-ocotp.c index 7b78f18f9545..fa62c11f779a 100644 --- a/drivers/nvmem/mxs-ocotp.c +++ b/drivers/nvmem/mxs-ocotp.c @@ -147,7 +147,7 @@ static int mxs_ocotp_probe(struct platform_device *pdev) if (!data) return -EINVAL; - otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL); + otp = devm_kzalloc_obj(dev, *otp); if (!otp) return -ENOMEM; diff --git a/drivers/nvmem/nintendo-otp.c b/drivers/nvmem/nintendo-otp.c index a4d986e4588e..4035a77522d0 100644 --- a/drivers/nvmem/nintendo-otp.c +++ b/drivers/nvmem/nintendo-otp.c @@ -85,7 +85,7 @@ static int nintendo_otp_probe(struct platform_device *pdev) .root_only = true, }; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/qcom-spmi-sdam.c b/drivers/nvmem/qcom-spmi-sdam.c index 2aec95dff05d..1199ce2474eb 100644 --- a/drivers/nvmem/qcom-spmi-sdam.c +++ b/drivers/nvmem/qcom-spmi-sdam.c @@ -124,7 +124,7 @@ static int sdam_probe(struct platform_device *pdev) unsigned int val; int rc; - sdam = devm_kzalloc(&pdev->dev, sizeof(*sdam), GFP_KERNEL); + sdam = devm_kzalloc_obj(&pdev->dev, *sdam); if (!sdam) return -ENOMEM; diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c index 1de3435df116..bc66cbf0eaa0 100644 --- a/drivers/nvmem/qfprom.c +++ b/drivers/nvmem/qfprom.c @@ -383,7 +383,7 @@ static int qfprom_probe(struct platform_device *pdev) struct qfprom_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/qoriq-efuse.c b/drivers/nvmem/qoriq-efuse.c index 80f514939ae6..a8411d868fc2 100644 --- a/drivers/nvmem/qoriq-efuse.c +++ b/drivers/nvmem/qoriq-efuse.c @@ -42,7 +42,7 @@ static int qoriq_efuse_probe(struct platform_device *pdev) struct nvmem_device *nvmem; struct resource *res; - priv = devm_kzalloc(config.dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(config.dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/rave-sp-eeprom.c b/drivers/nvmem/rave-sp-eeprom.c index 9ecf3873cbb7..980af01db709 100644 --- a/drivers/nvmem/rave-sp-eeprom.c +++ b/drivers/nvmem/rave-sp-eeprom.c @@ -309,7 +309,7 @@ static int rave_sp_eeprom_probe(struct platform_device *pdev) return -EINVAL; } - eeprom = devm_kzalloc(dev, sizeof(*eeprom), GFP_KERNEL); + eeprom = devm_kzalloc_obj(dev, *eeprom); if (!eeprom) return -ENOMEM; diff --git a/drivers/nvmem/rcar-efuse.c b/drivers/nvmem/rcar-efuse.c index b94ff83b7df3..844c859b8466 100644 --- a/drivers/nvmem/rcar-efuse.c +++ b/drivers/nvmem/rcar-efuse.c @@ -67,7 +67,7 @@ static int rcar_fuse_probe(struct platform_device *pdev) if (ret < 0) return ret; - fuse = devm_kzalloc(dev, sizeof(*fuse), GFP_KERNEL); + fuse = devm_kzalloc_obj(dev, *fuse); if (!fuse) return -ENOMEM; diff --git a/drivers/nvmem/rmem.c b/drivers/nvmem/rmem.c index b39d628cb60a..16ee0351c47c 100644 --- a/drivers/nvmem/rmem.c +++ b/drivers/nvmem/rmem.c @@ -124,7 +124,7 @@ static int rmem_probe(struct platform_device *pdev) struct reserved_mem *mem; struct rmem *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; priv->dev = dev; diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c index 013e67136f3b..1b53c25680d5 100644 --- a/drivers/nvmem/rockchip-efuse.c +++ b/drivers/nvmem/rockchip-efuse.c @@ -264,8 +264,7 @@ static int rockchip_efuse_probe(struct platform_device *pdev) return -EINVAL; } - efuse = devm_kzalloc(dev, sizeof(struct rockchip_efuse_chip), - GFP_KERNEL); + efuse = devm_kzalloc_obj(dev, struct rockchip_efuse_chip); if (!efuse) return -ENOMEM; diff --git a/drivers/nvmem/rockchip-otp.c b/drivers/nvmem/rockchip-otp.c index f8a8c7cece98..7eb834516ab4 100644 --- a/drivers/nvmem/rockchip-otp.c +++ b/drivers/nvmem/rockchip-otp.c @@ -432,8 +432,7 @@ static int rockchip_otp_probe(struct platform_device *pdev) if (!data) return dev_err_probe(dev, -EINVAL, "failed to get match data\n"); - otp = devm_kzalloc(&pdev->dev, struct_size(otp, clks, data->num_clks), - GFP_KERNEL); + otp = devm_kzalloc_flex(&pdev->dev, *otp, clks, data->num_clks); if (!otp) return -ENOMEM; diff --git a/drivers/nvmem/s32g-ocotp-nvmem.c b/drivers/nvmem/s32g-ocotp-nvmem.c index 119871ab3a94..1167f275585f 100644 --- a/drivers/nvmem/s32g-ocotp-nvmem.c +++ b/drivers/nvmem/s32g-ocotp-nvmem.c @@ -68,7 +68,7 @@ static int s32g_ocotp_probe(struct platform_device *pdev) struct nvmem_device *nvmem; struct resource *res; - s32g_data = devm_kzalloc(dev, sizeof(*s32g_data), GFP_KERNEL); + s32g_data = devm_kzalloc_obj(dev, *s32g_data); if (!s32g_data) return -ENOMEM; diff --git a/drivers/nvmem/sc27xx-efuse.c b/drivers/nvmem/sc27xx-efuse.c index 4e2ffefac96c..3e1712122130 100644 --- a/drivers/nvmem/sc27xx-efuse.c +++ b/drivers/nvmem/sc27xx-efuse.c @@ -207,7 +207,7 @@ static int sc27xx_efuse_probe(struct platform_device *pdev) struct sc27xx_efuse *efuse; int ret; - efuse = devm_kzalloc(&pdev->dev, sizeof(*efuse), GFP_KERNEL); + efuse = devm_kzalloc_obj(&pdev->dev, *efuse); if (!efuse) return -ENOMEM; diff --git a/drivers/nvmem/sec-qfprom.c b/drivers/nvmem/sec-qfprom.c index 51d21e65a543..f64ca891a6cd 100644 --- a/drivers/nvmem/sec-qfprom.c +++ b/drivers/nvmem/sec-qfprom.c @@ -57,7 +57,7 @@ static int sec_qfprom_probe(struct platform_device *pdev) struct sec_qfprom *priv; struct resource *res; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/snvs_lpgpr.c b/drivers/nvmem/snvs_lpgpr.c index 89c27112320f..fa5f53cdde4d 100644 --- a/drivers/nvmem/snvs_lpgpr.c +++ b/drivers/nvmem/snvs_lpgpr.c @@ -99,7 +99,7 @@ static int snvs_lpgpr_probe(struct platform_device *pdev) if (!node) return -ENOENT; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/sprd-efuse.c b/drivers/nvmem/sprd-efuse.c index 1a7e4e5d8b86..5395eb460d34 100644 --- a/drivers/nvmem/sprd-efuse.c +++ b/drivers/nvmem/sprd-efuse.c @@ -373,7 +373,7 @@ static int sprd_efuse_probe(struct platform_device *pdev) return -EINVAL; } - efuse = devm_kzalloc(&pdev->dev, sizeof(*efuse), GFP_KERNEL); + efuse = devm_kzalloc_obj(&pdev->dev, *efuse); if (!efuse) return -ENOMEM; diff --git a/drivers/nvmem/stm32-romem.c b/drivers/nvmem/stm32-romem.c index 82879b1c9eb9..bc00988ff3c0 100644 --- a/drivers/nvmem/stm32-romem.c +++ b/drivers/nvmem/stm32-romem.c @@ -194,7 +194,7 @@ static int stm32_romem_probe(struct platform_device *pdev) struct resource *res; int rc; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/sunplus-ocotp.c b/drivers/nvmem/sunplus-ocotp.c index 6884def3ba5f..c7df9baf2c6d 100644 --- a/drivers/nvmem/sunplus-ocotp.c +++ b/drivers/nvmem/sunplus-ocotp.c @@ -160,7 +160,7 @@ static int sp_ocotp_probe(struct platform_device *pdev) struct sp_ocotp_priv *otp; int ret; - otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL); + otp = devm_kzalloc_obj(dev, *otp); if (!otp) return -ENOMEM; diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c index ba14a76208ab..51fb10285110 100644 --- a/drivers/nvmem/sunxi_sid.c +++ b/drivers/nvmem/sunxi_sid.c @@ -131,7 +131,7 @@ static int sunxi_sid_probe(struct platform_device *pdev) char *randomness; const struct sunxi_sid_cfg *cfg; - sid = devm_kzalloc(dev, sizeof(*sid), GFP_KERNEL); + sid = devm_kzalloc_obj(dev, *sid); if (!sid) return -ENOMEM; @@ -146,7 +146,7 @@ static int sunxi_sid_probe(struct platform_device *pdev) size = cfg->size; - nvmem_cfg = devm_kzalloc(dev, sizeof(*nvmem_cfg), GFP_KERNEL); + nvmem_cfg = devm_kzalloc_obj(dev, *nvmem_cfg); if (!nvmem_cfg) return -ENOMEM; diff --git a/drivers/nvmem/u-boot-env.c b/drivers/nvmem/u-boot-env.c index 467b288918db..a9cb1bc5b779 100644 --- a/drivers/nvmem/u-boot-env.c +++ b/drivers/nvmem/u-boot-env.c @@ -52,7 +52,7 @@ static int u_boot_env_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; struct u_boot_env *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; priv->dev = dev; diff --git a/drivers/nvmem/uniphier-efuse.c b/drivers/nvmem/uniphier-efuse.c index 85f9372fb97c..bf2f298a0f6f 100644 --- a/drivers/nvmem/uniphier-efuse.c +++ b/drivers/nvmem/uniphier-efuse.c @@ -36,7 +36,7 @@ static int uniphier_efuse_probe(struct platform_device *pdev) struct nvmem_config econfig = {}; struct uniphier_efuse_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/nvmem/vf610-ocotp.c b/drivers/nvmem/vf610-ocotp.c index ee9c61ae727d..6e5170f39602 100644 --- a/drivers/nvmem/vf610-ocotp.c +++ b/drivers/nvmem/vf610-ocotp.c @@ -215,7 +215,7 @@ static int vf610_ocotp_probe(struct platform_device *pdev) struct resource *res; struct vf610_ocotp *ocotp_dev; - ocotp_dev = devm_kzalloc(dev, sizeof(struct vf610_ocotp), GFP_KERNEL); + ocotp_dev = devm_kzalloc_obj(dev, struct vf610_ocotp); if (!ocotp_dev) return -ENOMEM; diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index e255f54f4d76..4161327bee48 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -3123,7 +3123,7 @@ static int unittest_i2c_bus_probe(struct platform_device *pdev) dev_dbg(dev, "%s for node @%pOF\n", __func__, np); - std = devm_kzalloc(dev, sizeof(*std), GFP_KERNEL); + std = devm_kzalloc_obj(dev, *std); if (!std) return -ENOMEM; diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index 016c9d5a60a8..f15bf69906cc 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c @@ -280,7 +280,7 @@ static int hppa_led_generic_probe(struct platform_device *pdev, struct hppa_drvdata *p; int i, err; - p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(&pdev->dev, *p); if (!p) return -ENOMEM; diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c index 4d4140c8584d..e0f9c44e9015 100644 --- a/drivers/parport/parport_serial.c +++ b/drivers/parport/parport_serial.c @@ -726,7 +726,7 @@ static int parport_serial_pci_probe(struct pci_dev *dev, struct parport_serial_private *priv; int err; - priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&dev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c index 822602836b12..ae29ab4194d4 100644 --- a/drivers/pci/controller/cadence/pci-j721e.c +++ b/drivers/pci/controller/cadence/pci-j721e.c @@ -491,7 +491,7 @@ static int j721e_pcie_probe(struct platform_device *pdev) mode = (u32)data->mode; - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; @@ -519,7 +519,7 @@ static int j721e_pcie_probe(struct platform_device *pdev) if (!IS_ENABLED(CONFIG_PCI_J721E_EP)) return -ENODEV; - ep = devm_kzalloc(dev, sizeof(*ep), GFP_KERNEL); + ep = devm_kzalloc_obj(dev, *ep); if (!ep) return -ENOMEM; diff --git a/drivers/pci/controller/cadence/pci-sky1.c b/drivers/pci/controller/cadence/pci-sky1.c index b8632f1d3156..82f4ae5c04a8 100644 --- a/drivers/pci/controller/cadence/pci-sky1.c +++ b/drivers/pci/controller/cadence/pci-sky1.c @@ -141,7 +141,7 @@ static int sky1_pcie_probe(struct platform_device *pdev) struct sky1_pcie *pcie; int ret; - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; @@ -176,7 +176,7 @@ static int sky1_pcie_probe(struct platform_device *pdev) cdns_pcie->is_rc = true; cdns_pcie->is_hpa = true; - reg_off = devm_kzalloc(dev, sizeof(*reg_off), GFP_KERNEL); + reg_off = devm_kzalloc_obj(dev, *reg_off); if (!reg_off) { pci_ecam_free(pcie->cfg); return -ENOMEM; diff --git a/drivers/pci/controller/cadence/pcie-cadence-ep.c b/drivers/pci/controller/cadence/pcie-cadence-ep.c index 370b19f4d38f..a967f7762283 100644 --- a/drivers/pci/controller/cadence/pcie-cadence-ep.c +++ b/drivers/pci/controller/cadence/pcie-cadence-ep.c @@ -693,9 +693,7 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep) ep->max_regions = CDNS_PCIE_MAX_OB; of_property_read_u32(np, "cdns,max-outbound-regions", &ep->max_regions); - ep->ob_addr = devm_kcalloc(dev, - ep->max_regions, sizeof(*ep->ob_addr), - GFP_KERNEL); + ep->ob_addr = devm_kzalloc_objs(dev, *ep->ob_addr, ep->max_regions); if (!ep->ob_addr) return -ENOMEM; @@ -713,8 +711,7 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep) if (of_property_read_u8(np, "max-functions", &epc->max_functions) < 0) epc->max_functions = 1; - ep->epf = devm_kcalloc(dev, epc->max_functions, sizeof(*ep->epf), - GFP_KERNEL); + ep->epf = devm_kzalloc_objs(dev, *ep->epf, epc->max_functions); if (!ep->epf) return -ENOMEM; @@ -730,8 +727,8 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep) epf = &ep->epf[i]; if (epc->max_vfs[i] == 0) continue; - epf->epf = devm_kcalloc(dev, epc->max_vfs[i], - sizeof(*ep->epf), GFP_KERNEL); + epf->epf = devm_kzalloc_objs(dev, *ep->epf, + epc->max_vfs[i]); if (!epf->epf) return -ENOMEM; } diff --git a/drivers/pci/controller/cadence/pcie-cadence-plat.c b/drivers/pci/controller/cadence/pcie-cadence-plat.c index 4a24302cc5b2..7e3b835914b1 100644 --- a/drivers/pci/controller/cadence/pcie-cadence-plat.c +++ b/drivers/pci/controller/cadence/pcie-cadence-plat.c @@ -75,7 +75,7 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev) if (!IS_ENABLED(CONFIG_PCIE_CADENCE_PLAT_EP)) return -ENODEV; - ep = devm_kzalloc(dev, sizeof(*ep), GFP_KERNEL); + ep = devm_kzalloc_obj(dev, *ep); if (!ep) return -ENOMEM; diff --git a/drivers/pci/controller/cadence/pcie-cadence.c b/drivers/pci/controller/cadence/pcie-cadence.c index 0ac980249941..46e9324440ce 100644 --- a/drivers/pci/controller/cadence/pcie-cadence.c +++ b/drivers/pci/controller/cadence/pcie-cadence.c @@ -233,7 +233,7 @@ int cdns_pcie_init_phy(struct device *dev, struct cdns_pcie *pcie) return 0; } - phy = devm_kcalloc(dev, phy_count, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_objs(dev, *phy, phy_count); if (!phy) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c index 0d56fd5a19ea..1d8eeb013769 100644 --- a/drivers/pci/controller/dwc/pci-dra7xx.c +++ b/drivers/pci/controller/dwc/pci-dra7xx.c @@ -697,11 +697,11 @@ static int dra7xx_pcie_probe(struct platform_device *pdev) mode = (enum dw_pcie_device_mode)data->mode; b1co_mode_sel_mask = data->b1co_mode_sel_mask; - dra7xx = devm_kzalloc(dev, sizeof(*dra7xx), GFP_KERNEL); + dra7xx = devm_kzalloc_obj(dev, *dra7xx); if (!dra7xx) return -ENOMEM; - pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(dev, *pci); if (!pci) return -ENOMEM; @@ -722,7 +722,7 @@ static int dra7xx_pcie_probe(struct platform_device *pdev) return phy_count; } - phy = devm_kcalloc(dev, phy_count, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_objs(dev, *phy, phy_count); if (!phy) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c index e3c05ade381b..a37c7464d272 100644 --- a/drivers/pci/controller/dwc/pci-exynos.c +++ b/drivers/pci/controller/dwc/pci-exynos.c @@ -288,7 +288,7 @@ static int exynos_pcie_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; int ret; - ep = devm_kzalloc(dev, sizeof(*ep), GFP_KERNEL); + ep = devm_kzalloc_obj(dev, *ep); if (!ep) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 83fbd998551d..3917e11dc632 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1320,11 +1320,11 @@ static int imx_pcie_parse_legacy_binding(struct imx_pcie *pcie) if (!reset) return 0; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; - perst = devm_kzalloc(dev, sizeof(*perst), GFP_KERNEL); + perst = devm_kzalloc_obj(dev, *perst); if (!perst) return -ENOMEM; @@ -1843,11 +1843,11 @@ static int imx_pcie_probe(struct platform_device *pdev) int i, ret, domain; u16 val; - imx_pcie = devm_kzalloc(dev, sizeof(*imx_pcie), GFP_KERNEL); + imx_pcie = devm_kzalloc_obj(dev, *imx_pcie); if (!imx_pcie) return -ENOMEM; - pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(dev, *pci); if (!pci) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index edfbc32904cd..ebf341b45cd6 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -1152,11 +1152,11 @@ static int ks_pcie_probe(struct platform_device *pdev) ep_ops = data->ep_ops; mode = data->mode; - ks_pcie = devm_kzalloc(dev, sizeof(*ks_pcie), GFP_KERNEL); + ks_pcie = devm_kzalloc_obj(dev, *ks_pcie); if (!ks_pcie) return -ENOMEM; - pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(dev, *pci); if (!pci) return -ENOMEM; @@ -1197,7 +1197,7 @@ static int ks_pcie_probe(struct platform_device *pdev) if (ret) num_lanes = 1; - phy = devm_kcalloc(dev, num_lanes, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_objs(dev, *phy, num_lanes); if (!phy) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pci-layerscape-ep.c b/drivers/pci/controller/dwc/pci-layerscape-ep.c index 527c57114dcf..b69621a6513e 100644 --- a/drivers/pci/controller/dwc/pci-layerscape-ep.c +++ b/drivers/pci/controller/dwc/pci-layerscape-ep.c @@ -231,15 +231,15 @@ static int __init ls_pcie_ep_probe(struct platform_device *pdev) u8 offset; int ret; - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; - pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(dev, *pci); if (!pci) return -ENOMEM; - ls_epc = devm_kzalloc(dev, sizeof(*ls_epc), GFP_KERNEL); + ls_epc = devm_kzalloc_obj(dev, *ls_epc); if (!ls_epc) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pci-layerscape.c b/drivers/pci/controller/dwc/pci-layerscape.c index 7f37a0537159..7a77607981cd 100644 --- a/drivers/pci/controller/dwc/pci-layerscape.c +++ b/drivers/pci/controller/dwc/pci-layerscape.c @@ -331,11 +331,11 @@ static int ls_pcie_probe(struct platform_device *pdev) struct resource *dbi_base; u32 index[2]; - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; - pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(dev, *pci); if (!pci) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c index 8559d132dcde..fbc3485e070e 100644 --- a/drivers/pci/controller/dwc/pci-meson.c +++ b/drivers/pci/controller/dwc/pci-meson.c @@ -385,7 +385,7 @@ static int meson_pcie_probe(struct platform_device *pdev) struct meson_pcie *mp; int ret; - mp = devm_kzalloc(dev, sizeof(*mp), GFP_KERNEL); + mp = devm_kzalloc_obj(dev, *mp); if (!mp) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-al.c b/drivers/pci/controller/dwc/pcie-al.c index ef8c8ce7c78c..718c47d53848 100644 --- a/drivers/pci/controller/dwc/pcie-al.c +++ b/drivers/pci/controller/dwc/pcie-al.c @@ -49,11 +49,11 @@ static int al_pcie_init(struct pci_config_window *cfg) struct resource *res; int ret; - al_pcie = devm_kzalloc(dev, sizeof(*al_pcie), GFP_KERNEL); + al_pcie = devm_kzalloc_obj(dev, *al_pcie); if (!al_pcie) return -ENOMEM; - res = devm_kzalloc(dev, sizeof(*res), GFP_KERNEL); + res = devm_kzalloc_obj(dev, *res); if (!res) return -ENOMEM; @@ -326,11 +326,11 @@ static int al_pcie_probe(struct platform_device *pdev) struct al_pcie *al_pcie; struct dw_pcie *pci; - al_pcie = devm_kzalloc(dev, sizeof(*al_pcie), GFP_KERNEL); + al_pcie = devm_kzalloc_obj(dev, *al_pcie); if (!al_pcie) return -ENOMEM; - pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(dev, *pci); if (!pci) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-amd-mdb.c b/drivers/pci/controller/dwc/pcie-amd-mdb.c index dee295f281a3..0ac431d3e006 100644 --- a/drivers/pci/controller/dwc/pcie-amd-mdb.c +++ b/drivers/pci/controller/dwc/pcie-amd-mdb.c @@ -477,7 +477,7 @@ static int amd_mdb_pcie_probe(struct platform_device *pdev) struct dw_pcie *pci; int ret; - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-andes-qilai.c b/drivers/pci/controller/dwc/pcie-andes-qilai.c index bd1588be44e0..e8f4605d80c9 100644 --- a/drivers/pci/controller/dwc/pcie-andes-qilai.c +++ b/drivers/pci/controller/dwc/pcie-andes-qilai.c @@ -146,7 +146,7 @@ static int qilai_pcie_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - pcie = devm_kzalloc(&pdev->dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(&pdev->dev, *pcie); if (!pcie) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-armada8k.c b/drivers/pci/controller/dwc/pcie-armada8k.c index c2650fd0d458..a75e6ec06bb5 100644 --- a/drivers/pci/controller/dwc/pcie-armada8k.c +++ b/drivers/pci/controller/dwc/pcie-armada8k.c @@ -271,11 +271,11 @@ static int armada8k_pcie_probe(struct platform_device *pdev) struct resource *base; int ret; - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; - pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(dev, *pci); if (!pci) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-artpec6.c b/drivers/pci/controller/dwc/pcie-artpec6.c index 7f0ba506dd1c..8ee199d6893a 100644 --- a/drivers/pci/controller/dwc/pcie-artpec6.c +++ b/drivers/pci/controller/dwc/pcie-artpec6.c @@ -401,11 +401,11 @@ static int artpec6_pcie_probe(struct platform_device *pdev) variant = (enum artpec_pcie_variants)data->variant; mode = (enum dw_pcie_device_mode)data->mode; - artpec6_pcie = devm_kzalloc(dev, sizeof(*artpec6_pcie), GFP_KERNEL); + artpec6_pcie = devm_kzalloc_obj(dev, *artpec6_pcie); if (!artpec6_pcie) return -ENOMEM; - pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(dev, *pci); if (!pci) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-designware-debugfs.c b/drivers/pci/controller/dwc/pcie-designware-debugfs.c index be0b84665c9e..7c3509342184 100644 --- a/drivers/pci/controller/dwc/pcie-designware-debugfs.c +++ b/drivers/pci/controller/dwc/pcie-designware-debugfs.c @@ -569,7 +569,7 @@ static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir) return 0; } - rasdes_info = devm_kzalloc(dev, sizeof(*rasdes_info), GFP_KERNEL); + rasdes_info = devm_kzalloc_obj(dev, *rasdes_info); if (!rasdes_info) return -ENOMEM; @@ -588,7 +588,7 @@ static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir) /* Create debugfs files for Error Injection subdirectory. */ for (i = 0; i < ARRAY_SIZE(err_inj_list); i++) { - priv_tmp = devm_kzalloc(dev, sizeof(*priv_tmp), GFP_KERNEL); + priv_tmp = devm_kzalloc_obj(dev, *priv_tmp); if (!priv_tmp) { ret = -ENOMEM; goto err_deinit; @@ -602,7 +602,7 @@ static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir) /* Create debugfs files for Statistical Counter subdirectory. */ for (i = 0; i < ARRAY_SIZE(event_list); i++) { - priv_tmp = devm_kzalloc(dev, sizeof(*priv_tmp), GFP_KERNEL); + priv_tmp = devm_kzalloc_obj(dev, *priv_tmp); if (!priv_tmp) { ret = -ENOMEM; goto err_deinit; @@ -900,7 +900,7 @@ void dwc_pcie_debugfs_init(struct dw_pcie *pci, enum dw_pcie_device_mode mode) /* Create main directory for each platform driver. */ snprintf(dirname, DWC_DEBUGFS_BUF_MAX, "dwc_pcie_%s", dev_name(dev)); dir = debugfs_create_dir(dirname, NULL); - debugfs = devm_kzalloc(dev, sizeof(*debugfs), GFP_KERNEL); + debugfs = devm_kzalloc_obj(dev, *debugfs); if (!debugfs) return; diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 630ba172280c..e6060bb0bbbd 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -285,8 +285,7 @@ static int dw_pcie_ep_ib_atu_addr(struct dw_pcie_ep *ep, u8 func_no, int type, return -EINVAL; } - indexes = devm_kcalloc(dev, epf_bar->num_submap, sizeof(*indexes), - GFP_KERNEL); + indexes = devm_kzalloc_objs(dev, *indexes, epf_bar->num_submap); if (!indexes) return -ENOMEM; @@ -1363,8 +1362,7 @@ int dw_pcie_ep_init_registers(struct dw_pcie_ep *ep) } if (!ep->outbound_addr) { - addr = devm_kcalloc(dev, pci->num_ob_windows, sizeof(phys_addr_t), - GFP_KERNEL); + addr = devm_kzalloc_objs(dev, phys_addr_t, pci->num_ob_windows); if (!addr) goto err_remove_edma; ep->outbound_addr = addr; @@ -1376,7 +1374,7 @@ int dw_pcie_ep_init_registers(struct dw_pcie_ep *ep) if (ep_func) continue; - ep_func = devm_kzalloc(dev, sizeof(*ep_func), GFP_KERNEL); + ep_func = devm_kzalloc_obj(dev, *ep_func); if (!ep_func) goto err_remove_edma; diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 869a39107a81..bbb02458af58 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -401,7 +401,7 @@ static void dw_pcie_host_request_msg_tlp_res(struct dw_pcie_rp *pp) win = resource_list_first_type(&pp->bridge->windows, IORESOURCE_MEM); if (win) { - res = devm_kzalloc(pci->dev, sizeof(*res), GFP_KERNEL); + res = devm_kzalloc_obj(pci->dev, *res); if (!res) return; diff --git a/drivers/pci/controller/dwc/pcie-designware-plat.c b/drivers/pci/controller/dwc/pcie-designware-plat.c index 14d94e761229..4fad530d136a 100644 --- a/drivers/pci/controller/dwc/pcie-designware-plat.c +++ b/drivers/pci/controller/dwc/pcie-designware-plat.c @@ -105,11 +105,11 @@ static int dw_plat_pcie_probe(struct platform_device *pdev) mode = (enum dw_pcie_device_mode)data->mode; - dw_plat_pcie = devm_kzalloc(dev, sizeof(*dw_plat_pcie), GFP_KERNEL); + dw_plat_pcie = devm_kzalloc_obj(dev, *dw_plat_pcie); if (!dw_plat_pcie) return -ENOMEM; - pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(dev, *pci); if (!pci) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c index bd86e32cc2b1..ab2e26699409 100644 --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c @@ -819,7 +819,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev) if (!data) return -EINVAL; - rockchip = devm_kzalloc(dev, sizeof(*rockchip), GFP_KERNEL); + rockchip = devm_kzalloc_obj(dev, *rockchip); if (!rockchip) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-eswin.c b/drivers/pci/controller/dwc/pcie-eswin.c index 1bb44696057e..b9c1e90ce827 100644 --- a/drivers/pci/controller/dwc/pcie-eswin.c +++ b/drivers/pci/controller/dwc/pcie-eswin.c @@ -128,7 +128,7 @@ static int eswin_pcie_parse_port(struct eswin_pcie *pcie, struct device *dev = pcie->pci.dev; struct eswin_pcie_port *port; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; @@ -307,7 +307,7 @@ static int eswin_pcie_probe(struct platform_device *pdev) if (!data) return dev_err_probe(dev, -ENODATA, "No platform data\n"); - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-fu740.c b/drivers/pci/controller/dwc/pcie-fu740.c index 6c7ce1603170..80436eae69b6 100644 --- a/drivers/pci/controller/dwc/pcie-fu740.c +++ b/drivers/pci/controller/dwc/pcie-fu740.c @@ -291,7 +291,7 @@ static int fu740_pcie_probe(struct platform_device *pdev) struct dw_pcie *pci; struct fu740_pcie *afp; - afp = devm_kzalloc(dev, sizeof(*afp), GFP_KERNEL); + afp = devm_kzalloc_obj(dev, *afp); if (!afp) return -ENOMEM; pci = &afp->pci; diff --git a/drivers/pci/controller/dwc/pcie-hisi.c b/drivers/pci/controller/dwc/pcie-hisi.c index 3c17897e56fc..a9d54aa99aee 100644 --- a/drivers/pci/controller/dwc/pcie-hisi.c +++ b/drivers/pci/controller/dwc/pcie-hisi.c @@ -82,7 +82,7 @@ static int hisi_pcie_init(struct pci_config_window *cfg) struct resource *res; int ret; - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; @@ -90,7 +90,7 @@ static int hisi_pcie_init(struct pci_config_window *cfg) * Retrieve RC base and size from a HISI0081 device with _UID * matching our segment. */ - res = devm_kzalloc(dev, sizeof(*res), GFP_KERNEL); + res = devm_kzalloc_obj(dev, *res); if (!res) return -ENOMEM; @@ -128,7 +128,7 @@ static int hisi_pcie_platform_init(struct pci_config_window *cfg) struct platform_device *pdev = to_platform_device(dev); struct resource *res; - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-histb.c b/drivers/pci/controller/dwc/pcie-histb.c index 432a54c5bfce..f122c124ab39 100644 --- a/drivers/pci/controller/dwc/pcie-histb.c +++ b/drivers/pci/controller/dwc/pcie-histb.c @@ -299,11 +299,11 @@ static int histb_pcie_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - hipcie = devm_kzalloc(dev, sizeof(*hipcie), GFP_KERNEL); + hipcie = devm_kzalloc_obj(dev, *hipcie); if (!hipcie) return -ENOMEM; - pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(dev, *pci); if (!pci) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-intel-gw.c b/drivers/pci/controller/dwc/pcie-intel-gw.c index 348e579e683f..bc4bb105abda 100644 --- a/drivers/pci/controller/dwc/pcie-intel-gw.c +++ b/drivers/pci/controller/dwc/pcie-intel-gw.c @@ -396,7 +396,7 @@ static int intel_pcie_probe(struct platform_device *pdev) struct dw_pcie *pci; int ret; - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-keembay.c b/drivers/pci/controller/dwc/pcie-keembay.c index b11e66c10fff..7cb149803ae2 100644 --- a/drivers/pci/controller/dwc/pcie-keembay.c +++ b/drivers/pci/controller/dwc/pcie-keembay.c @@ -401,7 +401,7 @@ static int keembay_pcie_probe(struct platform_device *pdev) mode = (enum dw_pcie_device_mode)data->mode; - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c index 91559c8b1866..6950d89e55ba 100644 --- a/drivers/pci/controller/dwc/pcie-kirin.c +++ b/drivers/pci/controller/dwc/pcie-kirin.c @@ -322,7 +322,7 @@ static int hi3660_pcie_phy_init(struct platform_device *pdev, struct hi3660_pcie_phy *phy; int ret; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; @@ -723,11 +723,11 @@ static int kirin_pcie_probe(struct platform_device *pdev) if (!data) return dev_err_probe(dev, -EINVAL, "OF data missing\n"); - kirin_pcie = devm_kzalloc(dev, sizeof(struct kirin_pcie), GFP_KERNEL); + kirin_pcie = devm_kzalloc_obj(dev, struct kirin_pcie); if (!kirin_pcie) return -ENOMEM; - pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(dev, *pci); if (!pci) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-nxp-s32g.c b/drivers/pci/controller/dwc/pcie-nxp-s32g.c index 386e44dd0477..a600e6302368 100644 --- a/drivers/pci/controller/dwc/pcie-nxp-s32g.c +++ b/drivers/pci/controller/dwc/pcie-nxp-s32g.c @@ -246,7 +246,7 @@ static int s32g_pcie_parse_port(struct s32g_pcie *s32g_pp, struct device_node *n struct s32g_pcie_port *port; int num_lanes; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; @@ -324,7 +324,7 @@ static int s32g_pcie_probe(struct platform_device *pdev) struct dw_pcie_rp *pp; int ret; - s32g_pp = devm_kzalloc(dev, sizeof(*s32g_pp), GFP_KERNEL); + s32g_pp = devm_kzalloc_obj(dev, *s32g_pp); if (!s32g_pp) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c index e6afdc6198ac..2d7ddf8d173f 100644 --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c @@ -870,7 +870,7 @@ static int qcom_pcie_ep_probe(struct platform_device *pdev) char *name; int ret; - pcie_ep = devm_kzalloc(dev, sizeof(*pcie_ep), GFP_KERNEL); + pcie_ep = devm_kzalloc_obj(dev, *pcie_ep); if (!pcie_ep) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index d903f10211c2..efad7c8d1579 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -2007,7 +2007,7 @@ static int qcom_pcie_ecam_host_init(struct pci_config_window *cfg) struct dw_pcie *pci; int ret; - pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(dev, *pci); if (!pci) return -ENOMEM; @@ -2116,7 +2116,7 @@ static int qcom_pcie_parse_perst(struct qcom_pcie *pcie, } skip_perst_parsing: - perst = devm_kzalloc(dev, sizeof(*perst), GFP_KERNEL); + perst = devm_kzalloc_obj(dev, *perst); if (!perst) return -ENOMEM; @@ -2148,7 +2148,7 @@ static int qcom_pcie_parse_port(struct qcom_pcie *pcie, struct device_node *node if (IS_ERR(phy)) return PTR_ERR(phy); - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; @@ -2223,11 +2223,11 @@ static int qcom_pcie_parse_legacy_binding(struct qcom_pcie *pcie) if (ret) return ret; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; - perst = devm_kzalloc(dev, sizeof(*perst), GFP_KERNEL); + perst = devm_kzalloc_obj(dev, *perst); if (!perst) return -ENOMEM; @@ -2300,13 +2300,13 @@ static int qcom_pcie_probe(struct platform_device *pdev) return 0; } - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) { ret = -ENOMEM; goto err_pm_runtime_put; } - pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(dev, *pci); if (!pci) { ret = -ENOMEM; goto err_pm_runtime_put; diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c index fceecbd16355..05556a3dc725 100644 --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c @@ -438,7 +438,7 @@ static struct rcar_gen4_pcie *rcar_gen4_pcie_alloc(struct platform_device *pdev) struct device *dev = &pdev->dev; struct rcar_gen4_pcie *rcar; - rcar = devm_kzalloc(dev, sizeof(*rcar), GFP_KERNEL); + rcar = devm_kzalloc_obj(dev, *rcar); if (!rcar) return ERR_PTR(-ENOMEM); diff --git a/drivers/pci/controller/dwc/pcie-sophgo.c b/drivers/pci/controller/dwc/pcie-sophgo.c index 044088898819..b8f59f734f38 100644 --- a/drivers/pci/controller/dwc/pcie-sophgo.c +++ b/drivers/pci/controller/dwc/pcie-sophgo.c @@ -239,7 +239,7 @@ static int sophgo_pcie_probe(struct platform_device *pdev) struct sophgo_pcie *sophgo; int ret; - sophgo = devm_kzalloc(dev, sizeof(*sophgo), GFP_KERNEL); + sophgo = devm_kzalloc_obj(dev, *sophgo); if (!sophgo) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-spacemit-k1.c b/drivers/pci/controller/dwc/pcie-spacemit-k1.c index 92a71ea90ac3..d960fdfe2d69 100644 --- a/drivers/pci/controller/dwc/pcie-spacemit-k1.c +++ b/drivers/pci/controller/dwc/pcie-spacemit-k1.c @@ -281,7 +281,7 @@ static int k1_pcie_probe(struct platform_device *pdev) struct k1_pcie *k1; int ret; - k1 = devm_kzalloc(dev, sizeof(*k1), GFP_KERNEL); + k1 = devm_kzalloc_obj(dev, *k1); if (!k1) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-spear13xx.c b/drivers/pci/controller/dwc/pcie-spear13xx.c index 01794a9d3ad2..d44669f09385 100644 --- a/drivers/pci/controller/dwc/pcie-spear13xx.c +++ b/drivers/pci/controller/dwc/pcie-spear13xx.c @@ -193,11 +193,11 @@ static int spear13xx_pcie_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; int ret; - spear13xx_pcie = devm_kzalloc(dev, sizeof(*spear13xx_pcie), GFP_KERNEL); + spear13xx_pcie = devm_kzalloc_obj(dev, *spear13xx_pcie); if (!spear13xx_pcie) return -ENOMEM; - pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(dev, *pci); if (!pci) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-stm32-ep.c b/drivers/pci/controller/dwc/pcie-stm32-ep.c index a7988dff1045..f6163e981ab8 100644 --- a/drivers/pci/controller/dwc/pcie-stm32-ep.c +++ b/drivers/pci/controller/dwc/pcie-stm32-ep.c @@ -229,7 +229,7 @@ static int stm32_pcie_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - stm32_pcie = devm_kzalloc(dev, sizeof(*stm32_pcie), GFP_KERNEL); + stm32_pcie = devm_kzalloc_obj(dev, *stm32_pcie); if (!stm32_pcie) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-stm32.c b/drivers/pci/controller/dwc/pcie-stm32.c index 349618ea5b9c..ee6a65d92ae1 100644 --- a/drivers/pci/controller/dwc/pcie-stm32.c +++ b/drivers/pci/controller/dwc/pcie-stm32.c @@ -254,7 +254,7 @@ static int stm32_pcie_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - stm32_pcie = devm_kzalloc(dev, sizeof(*stm32_pcie), GFP_KERNEL); + stm32_pcie = devm_kzalloc_obj(dev, *stm32_pcie); if (!stm32_pcie) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-tegra194-acpi.c b/drivers/pci/controller/dwc/pcie-tegra194-acpi.c index 352591dcef83..d3d6ca921cb7 100644 --- a/drivers/pci/controller/dwc/pcie-tegra194-acpi.c +++ b/drivers/pci/controller/dwc/pcie-tegra194-acpi.c @@ -24,7 +24,7 @@ static int tegra194_acpi_init(struct pci_config_window *cfg) struct device *dev = cfg->parent; struct tegra194_pcie_ecam *pcie_ecam; - pcie_ecam = devm_kzalloc(dev, sizeof(*pcie_ecam), GFP_KERNEL); + pcie_ecam = devm_kzalloc_obj(dev, *pcie_ecam); if (!pcie_ecam) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c index 26e2ac5c5869..1108e76759d4 100644 --- a/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c @@ -2150,7 +2150,7 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev) data = of_device_get_match_data(dev); - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; @@ -2232,7 +2232,7 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev) return PTR_ERR(pcie->core_apb_rst); } - phys = devm_kcalloc(dev, pcie->phy_count, sizeof(*phys), GFP_KERNEL); + phys = devm_kzalloc_objs(dev, *phys, pcie->phy_count); if (!phys) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-ultrarisc.c b/drivers/pci/controller/dwc/pcie-ultrarisc.c index 523f454c6c52..cea9f2061257 100644 --- a/drivers/pci/controller/dwc/pcie-ultrarisc.c +++ b/drivers/pci/controller/dwc/pcie-ultrarisc.c @@ -141,7 +141,7 @@ static int ultrarisc_pcie_probe(struct platform_device *pdev) struct dw_pcie *pci; int ret; - ultra = devm_kzalloc(dev, sizeof(*ultra), GFP_KERNEL); + ultra = devm_kzalloc_obj(dev, *ultra); if (!ultra) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-uniphier-ep.c b/drivers/pci/controller/dwc/pcie-uniphier-ep.c index 89fb78200222..e9abad999cf2 100644 --- a/drivers/pci/controller/dwc/pcie-uniphier-ep.c +++ b/drivers/pci/controller/dwc/pcie-uniphier-ep.c @@ -342,7 +342,7 @@ static int uniphier_pcie_ep_probe(struct platform_device *pdev) struct uniphier_pcie_ep_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c index 297e7a3d9b36..1c8d7694543f 100644 --- a/drivers/pci/controller/dwc/pcie-uniphier.c +++ b/drivers/pci/controller/dwc/pcie-uniphier.c @@ -360,7 +360,7 @@ static int uniphier_pcie_probe(struct platform_device *pdev) struct uniphier_pcie *pcie; int ret; - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-visconti.c b/drivers/pci/controller/dwc/pcie-visconti.c index f21775c3b3a1..b8e1e89b19b6 100644 --- a/drivers/pci/controller/dwc/pcie-visconti.c +++ b/drivers/pci/controller/dwc/pcie-visconti.c @@ -295,7 +295,7 @@ static int visconti_pcie_probe(struct platform_device *pdev) struct dw_pcie *pci; int ret; - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c index a23907a875e5..35ee51cf9d06 100644 --- a/drivers/pci/controller/pci-host-common.c +++ b/drivers/pci/controller/pci-host-common.c @@ -75,7 +75,7 @@ static int pci_host_common_parse_perst(struct device *dev, return PTR_ERR(reset); } - perst = devm_kzalloc(dev, sizeof(*perst), GFP_KERNEL); + perst = devm_kzalloc_obj(dev, *perst); if (!perst) return -ENOMEM; @@ -119,7 +119,7 @@ static int pci_host_common_parse_port(struct device *dev, struct pci_host_port *port; int ret; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; diff --git a/drivers/pci/controller/pci-loongson.c b/drivers/pci/controller/pci-loongson.c index d0c643996476..6c0b7a3f4ba0 100644 --- a/drivers/pci/controller/pci-loongson.c +++ b/drivers/pci/controller/pci-loongson.c @@ -418,11 +418,11 @@ static int loongson_pci_ecam_init(struct pci_config_window *cfg) struct loongson_pci *priv; struct loongson_pci_data *data; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index cce1c1c0da58..66b50528d167 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -1472,7 +1472,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev) num = of_get_available_child_count(np); - pcie->ports = devm_kcalloc(dev, num, sizeof(*pcie->ports), GFP_KERNEL); + pcie->ports = devm_kzalloc_objs(dev, *pcie->ports, num); if (!pcie->ports) return -ENOMEM; diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c index 96bd522fa67b..05a04ed12da2 100644 --- a/drivers/pci/controller/pci-tegra.c +++ b/drivers/pci/controller/pci-tegra.c @@ -1350,7 +1350,7 @@ static int tegra_pcie_port_get_phys(struct tegra_pcie_port *port) unsigned int i; int err; - port->phys = devm_kcalloc(dev, port->lanes, sizeof(phy), GFP_KERNEL); + port->phys = devm_kzalloc_objs(dev, phy, port->lanes); if (!port->phys) return -ENOMEM; @@ -1950,9 +1950,8 @@ static int tegra_pcie_get_legacy_regulators(struct tegra_pcie *pcie) return -ENODEV; } - pcie->supplies = devm_kcalloc(dev, pcie->num_supplies, - sizeof(*pcie->supplies), - GFP_KERNEL); + pcie->supplies = devm_kzalloc_objs(dev, *pcie->supplies, + pcie->num_supplies); if (!pcie->supplies) return -ENOMEM; @@ -1983,9 +1982,8 @@ static int tegra_pcie_get_regulators(struct tegra_pcie *pcie, u32 lane_mask) if (of_device_is_compatible(np, "nvidia,tegra186-pcie")) { pcie->num_supplies = 4; - pcie->supplies = devm_kcalloc(pcie->dev, pcie->num_supplies, - sizeof(*pcie->supplies), - GFP_KERNEL); + pcie->supplies = devm_kzalloc_objs(pcie->dev, *pcie->supplies, + pcie->num_supplies); if (!pcie->supplies) return -ENOMEM; @@ -1996,9 +1994,8 @@ static int tegra_pcie_get_regulators(struct tegra_pcie *pcie, u32 lane_mask) } else if (of_device_is_compatible(np, "nvidia,tegra210-pcie")) { pcie->num_supplies = 3; - pcie->supplies = devm_kcalloc(pcie->dev, pcie->num_supplies, - sizeof(*pcie->supplies), - GFP_KERNEL); + pcie->supplies = devm_kzalloc_objs(pcie->dev, *pcie->supplies, + pcie->num_supplies); if (!pcie->supplies) return -ENOMEM; @@ -2008,9 +2005,8 @@ static int tegra_pcie_get_regulators(struct tegra_pcie *pcie, u32 lane_mask) } else if (of_device_is_compatible(np, "nvidia,tegra124-pcie")) { pcie->num_supplies = 4; - pcie->supplies = devm_kcalloc(dev, pcie->num_supplies, - sizeof(*pcie->supplies), - GFP_KERNEL); + pcie->supplies = devm_kzalloc_objs(dev, *pcie->supplies, + pcie->num_supplies); if (!pcie->supplies) return -ENOMEM; @@ -2032,9 +2028,8 @@ static int tegra_pcie_get_regulators(struct tegra_pcie *pcie, u32 lane_mask) pcie->num_supplies = 4 + (need_pexa ? 2 : 0) + (need_pexb ? 2 : 0); - pcie->supplies = devm_kcalloc(dev, pcie->num_supplies, - sizeof(*pcie->supplies), - GFP_KERNEL); + pcie->supplies = devm_kzalloc_objs(dev, *pcie->supplies, + pcie->num_supplies); if (!pcie->supplies) return -ENOMEM; @@ -2055,9 +2050,8 @@ static int tegra_pcie_get_regulators(struct tegra_pcie *pcie, u32 lane_mask) } else if (of_device_is_compatible(np, "nvidia,tegra20-pcie")) { pcie->num_supplies = 5; - pcie->supplies = devm_kcalloc(dev, pcie->num_supplies, - sizeof(*pcie->supplies), - GFP_KERNEL); + pcie->supplies = devm_kzalloc_objs(dev, *pcie->supplies, + pcie->num_supplies); if (!pcie->supplies) return -ENOMEM; @@ -2133,7 +2127,7 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) mask |= ((1 << value) - 1) << lane; lane += value; - rp = devm_kzalloc(dev, sizeof(*rp), GFP_KERNEL); + rp = devm_kzalloc_obj(dev, *rp); if (!rp) return -ENOMEM; diff --git a/drivers/pci/controller/pci-thunder-pem.c b/drivers/pci/controller/pci-thunder-pem.c index 5fa037fb61dc..c891cc87fc88 100644 --- a/drivers/pci/controller/pci-thunder-pem.c +++ b/drivers/pci/controller/pci-thunder-pem.c @@ -309,7 +309,7 @@ static int thunder_pem_init(struct device *dev, struct pci_config_window *cfg, struct thunder_pem_pci *pem_pci; resource_size_t bar4_start; - pem_pci = devm_kzalloc(dev, sizeof(*pem_pci), GFP_KERNEL); + pem_pci = devm_kzalloc_obj(dev, *pem_pci); if (!pem_pci) return -ENOMEM; @@ -385,7 +385,7 @@ static int thunder_pem_acpi_init(struct pci_config_window *cfg) struct resource *res_pem; int ret; - res_pem = devm_kzalloc(&adev->dev, sizeof(*res_pem), GFP_KERNEL); + res_pem = devm_kzalloc_obj(&adev->dev, *res_pem); if (!res_pem) return -ENOMEM; diff --git a/drivers/pci/controller/pci-xgene-msi.c b/drivers/pci/controller/pci-xgene-msi.c index 654639bccd10..62ecbf01d8c7 100644 --- a/drivers/pci/controller/pci-xgene-msi.c +++ b/drivers/pci/controller/pci-xgene-msi.c @@ -350,8 +350,7 @@ static int xgene_msi_probe(struct platform_device *pdev) struct xgene_msi *xgene_msi; int rc; - xgene_msi_ctrl = devm_kzalloc(&pdev->dev, sizeof(*xgene_msi_ctrl), - GFP_KERNEL); + xgene_msi_ctrl = devm_kzalloc_obj(&pdev->dev, *xgene_msi_ctrl); if (!xgene_msi_ctrl) return -ENOMEM; diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c index a5b8bbc04a22..6694a9438947 100644 --- a/drivers/pci/controller/pci-xgene.c +++ b/drivers/pci/controller/pci-xgene.c @@ -227,7 +227,7 @@ static int xgene_pcie_ecam_init(struct pci_config_window *cfg, u32 ipversion) struct resource csr; int ret; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; diff --git a/drivers/pci/controller/pcie-altera-msi.c b/drivers/pci/controller/pcie-altera-msi.c index ea2ca2e70f20..afad6aa7cf70 100644 --- a/drivers/pci/controller/pcie-altera-msi.c +++ b/drivers/pci/controller/pcie-altera-msi.c @@ -206,8 +206,7 @@ static int altera_msi_probe(struct platform_device *pdev) struct resource *res; int ret; - msi = devm_kzalloc(&pdev->dev, sizeof(struct altera_msi), - GFP_KERNEL); + msi = devm_kzalloc_obj(&pdev->dev, struct altera_msi); if (!msi) return -ENOMEM; diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c index c2cffc0659f4..dfd0e345bc56 100644 --- a/drivers/pci/controller/pcie-apple.c +++ b/drivers/pci/controller/pcie-apple.c @@ -566,7 +566,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie, if (IS_ERR(reset)) return PTR_ERR(reset); - port = devm_kzalloc(pcie->dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(pcie->dev, *port); if (!port) return -ENOMEM; diff --git a/drivers/pci/controller/pcie-aspeed.c b/drivers/pci/controller/pcie-aspeed.c index ecb7562f84c0..b7027e2d44d5 100644 --- a/drivers/pci/controller/pcie-aspeed.c +++ b/drivers/pci/controller/pcie-aspeed.c @@ -926,7 +926,7 @@ static int aspeed_pcie_parse_port(struct aspeed_pcie *pcie, struct device *dev = pcie->dev; int ret; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 26d1305f5e70..1c142f52f227 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -732,7 +732,7 @@ static int brcm_pcie_enable_msi(struct brcm_pcie *pcie) return -ENODEV; } - msi = devm_kzalloc(dev, sizeof(struct brcm_msi), GFP_KERNEL); + msi = devm_kzalloc_obj(dev, struct brcm_msi); if (!msi) return -ENOMEM; diff --git a/drivers/pci/controller/pcie-hisi-error.c b/drivers/pci/controller/pcie-hisi-error.c index 36be86d827a8..b4859a30fb23 100644 --- a/drivers/pci/controller/pcie-hisi-error.c +++ b/drivers/pci/controller/pcie-hisi-error.c @@ -281,7 +281,7 @@ static int hisi_pcie_error_handler_probe(struct platform_device *pdev) struct hisi_pcie_error_private *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/controller/pcie-iproc-msi.c index 9ba242ab9596..3751a3f7d946 100644 --- a/drivers/pci/controller/pcie-iproc-msi.c +++ b/drivers/pci/controller/pcie-iproc-msi.c @@ -527,7 +527,7 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node) if (pcie->msi) return -EBUSY; - msi = devm_kzalloc(pcie->dev, sizeof(*msi), GFP_KERNEL); + msi = devm_kzalloc_obj(pcie->dev, *msi); if (!msi) return -ENOMEM; @@ -589,8 +589,7 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node) if (!msi->bitmap) return -ENOMEM; - msi->grps = devm_kcalloc(pcie->dev, msi->nr_irqs, sizeof(*msi->grps), - GFP_KERNEL); + msi->grps = devm_kzalloc_objs(pcie->dev, *msi->grps, msi->nr_irqs); if (!msi->grps) return -ENOMEM; diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c index afb3aa38ac6b..c6cc87b6023c 100644 --- a/drivers/pci/controller/pcie-iproc.c +++ b/drivers/pci/controller/pcie-iproc.c @@ -1426,9 +1426,8 @@ static int iproc_pcie_rev_init(struct iproc_pcie *pcie) return -EINVAL; } - pcie->reg_offsets = devm_kcalloc(dev, IPROC_PCIE_MAX_NUM_REG, - sizeof(*pcie->reg_offsets), - GFP_KERNEL); + pcie->reg_offsets = devm_kzalloc_objs(dev, *pcie->reg_offsets, + IPROC_PCIE_MAX_NUM_REG); if (!pcie->reg_offsets) return -ENOMEM; diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c index 3a3e91cd0c21..da59daa3ae30 100644 --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -1103,7 +1103,7 @@ static int mtk_pcie_parse_port(struct mtk_pcie *pcie, char name[20]; int err; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; diff --git a/drivers/pci/controller/pcie-mt7621.c b/drivers/pci/controller/pcie-mt7621.c index 01ead2f92e87..79f973f8a605 100644 --- a/drivers/pci/controller/pcie-mt7621.c +++ b/drivers/pci/controller/pcie-mt7621.c @@ -205,7 +205,7 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie, char name[11]; int err; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; diff --git a/drivers/pci/controller/pcie-rcar-ep.c b/drivers/pci/controller/pcie-rcar-ep.c index c2da8ac1f2e8..e33c66caa1a6 100644 --- a/drivers/pci/controller/pcie-rcar-ep.c +++ b/drivers/pci/controller/pcie-rcar-ep.c @@ -141,8 +141,7 @@ static int rcar_pcie_ep_get_pdata(struct rcar_pcie_endpoint *ep, if (IS_ERR(pcie->base)) return PTR_ERR(pcie->base); - ep->ob_window = devm_kcalloc(dev, RCAR_PCI_MAX_RESOURCES, - sizeof(*window), GFP_KERNEL); + ep->ob_window = devm_kzalloc_objs(dev, *window, RCAR_PCI_MAX_RESOURCES); if (!ep->ob_window) return -ENOMEM; @@ -480,7 +479,7 @@ static int rcar_pcie_ep_probe(struct platform_device *pdev) struct pci_epc *epc; int err; - ep = devm_kzalloc(dev, sizeof(*ep), GFP_KERNEL); + ep = devm_kzalloc_obj(dev, *ep); if (!ep) return -ENOMEM; @@ -510,9 +509,8 @@ static int rcar_pcie_ep_probe(struct platform_device *pdev) goto err_pm_put; } - ep->ob_mapped_addr = devm_kcalloc(dev, ep->num_ob_windows, - sizeof(*ep->ob_mapped_addr), - GFP_KERNEL); + ep->ob_mapped_addr = devm_kzalloc_objs(dev, *ep->ob_mapped_addr, + ep->num_ob_windows); if (!ep->ob_mapped_addr) { err = -ENOMEM; dev_err(dev, "failed to allocate memory for outbound memory pointers\n"); diff --git a/drivers/pci/controller/pcie-rockchip-ep.c b/drivers/pci/controller/pcie-rockchip-ep.c index 9ebc227a1ef8..a20536d50c9c 100644 --- a/drivers/pci/controller/pcie-rockchip-ep.c +++ b/drivers/pci/controller/pcie-rockchip-ep.c @@ -748,14 +748,13 @@ static int rockchip_pcie_ep_init_ob_mem(struct rockchip_pcie_ep *ep) struct pci_epc_mem_window *windows = NULL; int err, i; - ep->ob_addr = devm_kcalloc(dev, ep->max_regions, sizeof(*ep->ob_addr), - GFP_KERNEL); + ep->ob_addr = devm_kzalloc_objs(dev, *ep->ob_addr, ep->max_regions); if (!ep->ob_addr) return -ENOMEM; - windows = devm_kcalloc(dev, ep->max_regions, - sizeof(struct pci_epc_mem_window), GFP_KERNEL); + windows = devm_kzalloc_objs(dev, struct pci_epc_mem_window, + ep->max_regions); if (!windows) return -ENOMEM; @@ -831,7 +830,7 @@ static int rockchip_pcie_ep_probe(struct platform_device *pdev) struct pci_epc *epc; int err; - ep = devm_kzalloc(dev, sizeof(*ep), GFP_KERNEL); + ep = devm_kzalloc_obj(dev, *ep); if (!ep) return -ENOMEM; diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c index 077cfb0834b3..2c2ee9d4d324 100644 --- a/drivers/pci/controller/pcie-rzg3s-host.c +++ b/drivers/pci/controller/pcie-rzg3s-host.c @@ -1330,20 +1330,16 @@ static int rzg3s_pcie_resets_prepare_and_get(struct rzg3s_pcie_host *host) unsigned int i; int ret; - host->power_resets = devm_kmalloc_array(host->dev, - data->num_power_resets, - sizeof(*host->power_resets), - GFP_KERNEL); + host->power_resets = devm_kmalloc_objs(host->dev, *host->power_resets, + data->num_power_resets); if (!host->power_resets) return -ENOMEM; for (i = 0; i < data->num_power_resets; i++) host->power_resets[i].id = data->power_resets[i]; - host->cfg_resets = devm_kmalloc_array(host->dev, - data->num_cfg_resets, - sizeof(*host->cfg_resets), - GFP_KERNEL); + host->cfg_resets = devm_kmalloc_objs(host->dev, *host->cfg_resets, + data->num_cfg_resets); if (!host->cfg_resets) return -ENOMEM; @@ -1837,7 +1833,7 @@ static int rzg3s_pcie_probe(struct platform_device *pdev) host->data = device_get_match_data(dev); platform_set_drvdata(pdev, host); - host->sysc = devm_kzalloc(dev, sizeof(*host->sysc), GFP_KERNEL); + host->sysc = devm_kzalloc_obj(dev, *host->sysc); if (!host->sysc) return -ENOMEM; diff --git a/drivers/pci/controller/plda/pcie-microchip-host.c b/drivers/pci/controller/plda/pcie-microchip-host.c index 24bbf93b8051..ae26afbb73dd 100644 --- a/drivers/pci/controller/plda/pcie-microchip-host.c +++ b/drivers/pci/controller/plda/pcie-microchip-host.c @@ -744,7 +744,7 @@ static int mc_host_probe(struct platform_device *pdev) int ret; u32 val; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; diff --git a/drivers/pci/controller/plda/pcie-starfive.c b/drivers/pci/controller/plda/pcie-starfive.c index b693eabdf85b..48f7d747a86c 100644 --- a/drivers/pci/controller/plda/pcie-starfive.c +++ b/drivers/pci/controller/plda/pcie-starfive.c @@ -403,7 +403,7 @@ static int starfive_pcie_probe(struct platform_device *pdev) struct plda_pcie_rp *plda; int ret; - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + pcie = devm_kzalloc_obj(dev, *pcie); if (!pcie) return -ENOMEM; diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index 9d97a832785e..f0b2a86f6279 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -825,8 +825,7 @@ static int vmd_alloc_irqs(struct vmd_dev *vmd) if (vmd->msix_count < 0) return vmd->msix_count; - vmd->irqs = devm_kcalloc(&dev->dev, vmd->msix_count, sizeof(*vmd->irqs), - GFP_KERNEL); + vmd->irqs = devm_kzalloc_objs(&dev->dev, *vmd->irqs, vmd->msix_count); if (!vmd->irqs) return -ENOMEM; @@ -1165,7 +1164,7 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id) if (resource_size(&dev->resource[VMD_CFGBAR]) < (1 << 20)) return -ENOMEM; - vmd = devm_kzalloc(&dev->dev, sizeof(*vmd), GFP_KERNEL); + vmd = devm_kzalloc_obj(&dev->dev, *vmd); if (!vmd) return -ENOMEM; diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c index 78f1fb1a6b0c..a633e47edf2f 100644 --- a/drivers/pci/endpoint/functions/pci-epf-mhi.c +++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c @@ -931,7 +931,7 @@ static int pci_epf_mhi_probe(struct pci_epf *epf, struct pci_epf_mhi *epf_mhi; struct device *dev = &epf->dev; - epf_mhi = devm_kzalloc(dev, sizeof(*epf_mhi), GFP_KERNEL); + epf_mhi = devm_kzalloc_obj(dev, *epf_mhi); if (!epf_mhi) return -ENOMEM; diff --git a/drivers/pci/endpoint/functions/pci-epf-ntb.c b/drivers/pci/endpoint/functions/pci-epf-ntb.c index 5314aca2188a..295da9b61f07 100644 --- a/drivers/pci/endpoint/functions/pci-epf-ntb.c +++ b/drivers/pci/endpoint/functions/pci-epf-ntb.c @@ -1516,7 +1516,7 @@ static int epf_ntb_epc_create_interface(struct epf_ntb *ntb, dev = &ntb->epf->dev; - ntb_epc = devm_kzalloc(dev, sizeof(*ntb_epc), GFP_KERNEL); + ntb_epc = devm_kzalloc_obj(dev, *ntb_epc); if (!ntb_epc) return -ENOMEM; @@ -2037,7 +2037,7 @@ static int epf_ntb_probe(struct pci_epf *epf, dev = &epf->dev; - ntb = devm_kzalloc(dev, sizeof(*ntb), GFP_KERNEL); + ntb = devm_kzalloc_obj(dev, *ntb); if (!ntb) return -ENOMEM; diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index d4905aa8e4c0..d9609185551b 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -1483,7 +1483,7 @@ static int pci_epf_test_probe(struct pci_epf *epf, struct device *dev = &epf->dev; enum pci_barno bar; - epf_test = devm_kzalloc(dev, sizeof(*epf_test), GFP_KERNEL); + epf_test = devm_kzalloc_obj(dev, *epf_test); if (!epf_test) return -ENOMEM; diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c index f77e28f2fe96..a0221a674a9d 100644 --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c @@ -1783,7 +1783,7 @@ static int pci_vntb_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct ntb_dev *ntb; int ret; - ntb = devm_kzalloc(dev, sizeof(*ntb), GFP_KERNEL); + ntb = devm_kzalloc_obj(dev, *ntb); if (!ntb) return -ENOMEM; @@ -1975,7 +1975,7 @@ static int epf_ntb_probe(struct pci_epf *epf, dev = &epf->dev; - ntb = devm_kzalloc(dev, sizeof(*ntb), GFP_KERNEL); + ntb = devm_kzalloc_obj(dev, *ntb); if (!ntb) return -ENOMEM; diff --git a/drivers/pci/hotplug/octep_hp.c b/drivers/pci/hotplug/octep_hp.c index a0a7f9ccb8fa..3856f1374bbd 100644 --- a/drivers/pci/hotplug/octep_hp.c +++ b/drivers/pci/hotplug/octep_hp.c @@ -371,7 +371,7 @@ static int octep_hp_pci_probe(struct pci_dev *pdev, u16 slot_number = 0; int ret; - hp_ctrl = devm_kzalloc(&pdev->dev, sizeof(*hp_ctrl), GFP_KERNEL); + hp_ctrl = devm_kzalloc_obj(&pdev->dev, *hp_ctrl); if (!hp_ctrl) return -ENOMEM; diff --git a/drivers/pci/of.c b/drivers/pci/of.c index a51dff91b196..ef4ae4b38c33 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -334,7 +334,7 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev, if (io_base) *io_base = (resource_size_t)OF_BAD_ADDR; - bus_range = devm_kzalloc(dev, sizeof(*bus_range), GFP_KERNEL); + bus_range = devm_kzalloc_obj(dev, *bus_range); if (!bus_range) return -ENOMEM; diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c index 45260423dfb0..9e6e22542a92 100644 --- a/drivers/pci/p2pdma.c +++ b/drivers/pci/p2pdma.c @@ -268,7 +268,7 @@ int pcim_p2pdma_init(struct pci_dev *pdev) if (p2p) return 0; - p2p = devm_kzalloc(&pdev->dev, sizeof(*p2p), GFP_KERNEL); + p2p = devm_kzalloc_obj(&pdev->dev, *p2p); if (!p2p) return -ENOMEM; @@ -421,7 +421,7 @@ int pci_p2pdma_add_resource(struct pci_dev *pdev, int bar, size_t size, if (WARN_ON(!mem)) return -EINVAL; - p2p_pgmap = devm_kzalloc(&pdev->dev, sizeof(*p2p_pgmap), GFP_KERNEL); + p2p_pgmap = devm_kzalloc_obj(&pdev->dev, *p2p_pgmap); if (!p2p_pgmap) return -ENOMEM; diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index db4f607f889c..8708ca3257bb 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -1812,7 +1812,7 @@ static int aer_probe(struct pcie_device *dev) (pci_pcie_type(port) != PCI_EXP_TYPE_ROOT_PORT)) return -ENODEV; - rpc = devm_kzalloc(device, sizeof(struct aer_rpc), GFP_KERNEL); + rpc = devm_kzalloc_obj(device, struct aer_rpc); if (!rpc) return -ENOMEM; diff --git a/drivers/pci/pcie/bwctrl.c b/drivers/pci/pcie/bwctrl.c index d48021bfd844..3b1122461ffd 100644 --- a/drivers/pci/pcie/bwctrl.c +++ b/drivers/pci/pcie/bwctrl.c @@ -235,8 +235,7 @@ static int pcie_bwnotif_probe(struct pcie_device *srv) if (!port->subordinate) return -ENODEV; - struct pcie_bwctrl_data *data = devm_kzalloc(&srv->device, - sizeof(*data), GFP_KERNEL); + struct pcie_bwctrl_data *data = devm_kzalloc_obj(&srv->device, *data); if (!data) return -ENOMEM; diff --git a/drivers/pci/pwrctrl/generic.c b/drivers/pci/pwrctrl/generic.c index 4b6cbbb52248..04aa52ef7fe2 100644 --- a/drivers/pci/pwrctrl/generic.c +++ b/drivers/pci/pwrctrl/generic.c @@ -72,7 +72,7 @@ static int slot_pwrctrl_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - slot = devm_kzalloc(dev, sizeof(*slot), GFP_KERNEL); + slot = devm_kzalloc_obj(dev, *slot); if (!slot) return -ENOMEM; diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c b/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c index c5ced87944b6..f034fbcdee04 100644 --- a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c +++ b/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c @@ -84,7 +84,7 @@ static int pwrseq_pwrctrl_probe(struct platform_device *pdev) return ret; } - pwrseq = devm_kzalloc(dev, sizeof(*pwrseq), GFP_KERNEL); + pwrseq = devm_kzalloc_obj(dev, *pwrseq); if (!pwrseq) return -ENOMEM; diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c b/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c index 59bc0d77d3c4..4091a2f30aa7 100644 --- a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +++ b/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c @@ -637,7 +637,7 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev) struct i2c_client *client; int ret, addr; - tc9563 = devm_kzalloc(dev, sizeof(*tc9563), GFP_KERNEL); + tc9563 = devm_kzalloc_obj(dev, *tc9563); if (!tc9563) return -ENOMEM; diff --git a/drivers/pcmcia/max1600.c b/drivers/pcmcia/max1600.c index 7be9068f6191..79c22284ea2b 100644 --- a/drivers/pcmcia/max1600.c +++ b/drivers/pcmcia/max1600.c @@ -36,7 +36,7 @@ int max1600_init(struct device *dev, struct max1600 **ptr, if (code != MAX1600_CODE_LOW && code != MAX1600_CODE_HIGH) return -EINVAL; - m = devm_kzalloc(dev, sizeof(*m), GFP_KERNEL); + m = devm_kzalloc_obj(dev, *m); if (!m) return -ENOMEM; diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index 7b5ac8fe811d..b6b737abf8f3 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c @@ -141,7 +141,7 @@ static int sa11x0_drv_pcmcia_probe(struct platform_device *pdev) if (pdev->id == -1) return sa11x0_drv_pcmcia_legacy_probe(pdev); - skt = devm_kzalloc(dev, sizeof(*skt), GFP_KERNEL); + skt = devm_kzalloc_obj(dev, *skt); if (!skt) return -ENOMEM; diff --git a/drivers/pcmcia/sa1111_jornada720.c b/drivers/pcmcia/sa1111_jornada720.c index 1083e1b4f25d..3504c44a8c02 100644 --- a/drivers/pcmcia/sa1111_jornada720.c +++ b/drivers/pcmcia/sa1111_jornada720.c @@ -38,7 +38,7 @@ static int jornada720_pcmcia_hw_init(struct soc_pcmcia_socket *skt) struct device *dev = skt->socket.dev.parent; struct jornada720_data *j; - j = devm_kzalloc(dev, sizeof(*j), GFP_KERNEL); + j = devm_kzalloc_obj(dev, *j); if (!j) return -ENOMEM; diff --git a/drivers/peci/controller/peci-aspeed.c b/drivers/peci/controller/peci-aspeed.c index 1c747ce8840b..5dd5cac1b056 100644 --- a/drivers/peci/controller/peci-aspeed.c +++ b/drivers/peci/controller/peci-aspeed.c @@ -428,7 +428,7 @@ static struct clk *devm_aspeed_peci_register_clk_div(struct device *dev, struct init.num_parents = 1; init.flags = 0; - peci_clk = devm_kzalloc(dev, sizeof(struct clk_aspeed_peci), GFP_KERNEL); + peci_clk = devm_kzalloc_obj(dev, struct clk_aspeed_peci); if (!peci_clk) return ERR_PTR(-ENOMEM); @@ -514,7 +514,7 @@ static int aspeed_peci_probe(struct platform_device *pdev) struct clk *ref_clk; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/peci/controller/peci-npcm.c b/drivers/peci/controller/peci-npcm.c index 3cc4e959aff3..59dec53f30ee 100644 --- a/drivers/peci/controller/peci-npcm.c +++ b/drivers/peci/controller/peci-npcm.c @@ -234,7 +234,7 @@ static int npcm_peci_probe(struct platform_device *pdev) void __iomem *base; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/peci/cpu.c b/drivers/peci/cpu.c index c9fc06c9ff53..aec0280e0cb0 100644 --- a/drivers/peci/cpu.c +++ b/drivers/peci/cpu.c @@ -279,7 +279,7 @@ peci_cpu_probe(struct peci_device *device, const struct peci_device_id *id) struct device *dev = &device->dev; struct peci_cpu *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/perf/alibaba_uncore_drw_pmu.c b/drivers/perf/alibaba_uncore_drw_pmu.c index 5b6d3a4736da..c47c6ac170b2 100644 --- a/drivers/perf/alibaba_uncore_drw_pmu.c +++ b/drivers/perf/alibaba_uncore_drw_pmu.c @@ -665,7 +665,7 @@ static int ali_drw_pmu_probe(struct platform_device *pdev) char *name; int ret; - drw_pmu = devm_kzalloc(&pdev->dev, sizeof(*drw_pmu), GFP_KERNEL); + drw_pmu = devm_kzalloc_obj(&pdev->dev, *drw_pmu); if (!drw_pmu) return -ENOMEM; diff --git a/drivers/perf/amlogic/meson_ddr_pmu_core.c b/drivers/perf/amlogic/meson_ddr_pmu_core.c index f614aa3434a5..76187bd8f2aa 100644 --- a/drivers/perf/amlogic/meson_ddr_pmu_core.c +++ b/drivers/perf/amlogic/meson_ddr_pmu_core.c @@ -485,7 +485,7 @@ int meson_ddr_pmu_create(struct platform_device *pdev) char *name; struct ddr_pmu *pmu; - pmu = devm_kzalloc(&pdev->dev, sizeof(struct ddr_pmu), GFP_KERNEL); + pmu = devm_kzalloc_obj(&pdev->dev, struct ddr_pmu); if (!pmu) return -ENOMEM; diff --git a/drivers/perf/arm-cci.c b/drivers/perf/arm-cci.c index 71035227f58b..713b59fe164c 100644 --- a/drivers/perf/arm-cci.c +++ b/drivers/perf/arm-cci.c @@ -1589,7 +1589,7 @@ static struct cci_pmu *cci_pmu_alloc(struct device *dev) * them explicitly on an error, as it would end up in driver * detach. */ - cci_pmu = devm_kzalloc(dev, sizeof(*cci_pmu), GFP_KERNEL); + cci_pmu = devm_kzalloc_obj(dev, *cci_pmu); if (!cci_pmu) return ERR_PTR(-ENOMEM); @@ -1607,14 +1607,13 @@ static struct cci_pmu *cci_pmu_alloc(struct device *dev) } cci_pmu->model = model; - cci_pmu->irqs = devm_kcalloc(dev, CCI_PMU_MAX_HW_CNTRS(model), - sizeof(*cci_pmu->irqs), GFP_KERNEL); + cci_pmu->irqs = devm_kzalloc_objs(dev, *cci_pmu->irqs, + CCI_PMU_MAX_HW_CNTRS(model)); if (!cci_pmu->irqs) return ERR_PTR(-ENOMEM); - cci_pmu->hw_events.events = devm_kcalloc(dev, - CCI_PMU_MAX_HW_CNTRS(model), - sizeof(*cci_pmu->hw_events.events), - GFP_KERNEL); + cci_pmu->hw_events.events = devm_kzalloc_objs(dev, + *cci_pmu->hw_events.events, + CCI_PMU_MAX_HW_CNTRS(model)); if (!cci_pmu->hw_events.events) return ERR_PTR(-ENOMEM); cci_pmu->hw_events.used_mask = devm_bitmap_zalloc(dev, diff --git a/drivers/perf/arm-ccn.c b/drivers/perf/arm-ccn.c index e3411bdf5c7c..0c69165e0041 100644 --- a/drivers/perf/arm-ccn.c +++ b/drivers/perf/arm-ccn.c @@ -1453,7 +1453,7 @@ static int arm_ccn_probe(struct platform_device *pdev) int irq; int err; - ccn = devm_kzalloc(&pdev->dev, sizeof(*ccn), GFP_KERNEL); + ccn = devm_kzalloc_obj(&pdev->dev, *ccn); if (!ccn) return -ENOMEM; ccn->dev = &pdev->dev; @@ -1491,10 +1491,8 @@ static int arm_ccn_probe(struct platform_device *pdev) if (err) return err; - ccn->node = devm_kcalloc(ccn->dev, ccn->num_nodes, sizeof(*ccn->node), - GFP_KERNEL); - ccn->xp = devm_kcalloc(ccn->dev, ccn->num_xps, sizeof(*ccn->node), - GFP_KERNEL); + ccn->node = devm_kzalloc_objs(ccn->dev, *ccn->node, ccn->num_nodes); + ccn->xp = devm_kzalloc_objs(ccn->dev, *ccn->node, ccn->num_xps); if (!ccn->node || !ccn->xp) return -ENOMEM; diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index 5378fba916cf..68a096c1fe6b 100644 --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -2408,7 +2408,7 @@ static int arm_cmn_init_dtcs(struct arm_cmn *cmn) struct arm_cmn_node *dn, *xp; int dtc_idx = 0; - cmn->dtc = devm_kcalloc(cmn->dev, cmn->num_dtcs, sizeof(cmn->dtc[0]), GFP_KERNEL); + cmn->dtc = devm_kzalloc_objs(cmn->dev, cmn->dtc[0], cmn->num_dtcs); if (!cmn->dtc) return -ENOMEM; @@ -2602,8 +2602,7 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset) * by creating one of each internally. For a (very) safe initial upper * bound, account for double the number of non-XP nodes. */ - dn = devm_kcalloc(cmn->dev, cmn->num_dns * 2 - cmn->num_xps, - sizeof(*dn), GFP_KERNEL); + dn = devm_kzalloc_objs(cmn->dev, *dn, cmn->num_dns * 2 - cmn->num_xps); if (!dn) return -ENOMEM; @@ -2611,7 +2610,7 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset) i = cmn->num_xps; if (cmn->multi_dtm) i += cmn->num_xps + 1; - dtm = devm_kcalloc(cmn->dev, i, sizeof(*dtm), GFP_KERNEL); + dtm = devm_kzalloc_objs(cmn->dev, *dtm, i); if (!dtm) return -ENOMEM; @@ -2837,7 +2836,7 @@ static int arm_cmn_probe(struct platform_device *pdev) static atomic_t id; int err, rootnode, this_id; - cmn = devm_kzalloc(&pdev->dev, sizeof(*cmn), GFP_KERNEL); + cmn = devm_kzalloc_obj(&pdev->dev, *cmn); if (!cmn) return -ENOMEM; diff --git a/drivers/perf/arm-ni.c b/drivers/perf/arm-ni.c index 03a1c6bf9223..1f8eecf8ca11 100644 --- a/drivers/perf/arm-ni.c +++ b/drivers/perf/arm-ni.c @@ -529,7 +529,7 @@ static int arm_ni_init_cd(struct arm_ni *ni, struct arm_ni_node *node, u64 res_s cd->id = node->id; cd->num_units = node->num_components; - cd->units = devm_kcalloc(ni->dev, cd->num_units, sizeof(*(cd->units)), GFP_KERNEL); + cd->units = devm_kzalloc_objs(ni->dev, *(cd->units), cd->num_units); if (!cd->units) return -ENOMEM; @@ -719,7 +719,7 @@ static int arm_ni_probe(struct platform_device *pdev) } } - ni = devm_kzalloc(&pdev->dev, struct_size(ni, cds, num_cds), GFP_KERNEL); + ni = devm_kzalloc_flex(&pdev->dev, *ni, cds, num_cds); if (!ni) return -ENOMEM; diff --git a/drivers/perf/arm_cspmu/ampere_cspmu.c b/drivers/perf/arm_cspmu/ampere_cspmu.c index b8ca69fd9d1d..23abeccc3150 100644 --- a/drivers/perf/arm_cspmu/ampere_cspmu.c +++ b/drivers/perf/arm_cspmu/ampere_cspmu.c @@ -209,7 +209,7 @@ static int ampere_cspmu_init_ops(struct arm_cspmu *cspmu) struct ampere_cspmu_ctx *ctx; struct arm_cspmu_impl_ops *impl_ops = &cspmu->impl.ops; - ctx = devm_kzalloc(dev, sizeof(struct ampere_cspmu_ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, struct ampere_cspmu_ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c index 912f03ce3ef5..d0b29213f451 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -500,7 +500,7 @@ arm_cspmu_alloc_event_attr_group(struct arm_cspmu *cspmu) const struct arm_cspmu_impl_ops *impl_ops = &cspmu->impl.ops; event_group = - devm_kzalloc(dev, sizeof(struct attribute_group), GFP_KERNEL); + devm_kzalloc_obj(dev, struct attribute_group); if (!event_group) return NULL; @@ -521,7 +521,7 @@ arm_cspmu_alloc_format_attr_group(struct arm_cspmu *cspmu) struct device *dev = cspmu->dev; format_group = - devm_kzalloc(dev, sizeof(struct attribute_group), GFP_KERNEL); + devm_kzalloc_obj(dev, struct attribute_group); if (!format_group) return NULL; @@ -982,7 +982,7 @@ static struct arm_cspmu *arm_cspmu_alloc(struct platform_device *pdev) struct arm_cspmu *cspmu; struct device *dev = &pdev->dev; - cspmu = devm_kzalloc(dev, sizeof(*cspmu), GFP_KERNEL); + cspmu = devm_kzalloc_obj(dev, *cspmu); if (!cspmu) return NULL; @@ -1074,8 +1074,8 @@ static int arm_cspmu_init_mmio(struct arm_cspmu *cspmu) ARM_CSPMU_SET_CLR_COUNTER_NUM); cspmu->hw_events.events = - devm_kcalloc(dev, cspmu->num_logical_ctrs, - sizeof(*cspmu->hw_events.events), GFP_KERNEL); + devm_kzalloc_objs(dev, *cspmu->hw_events.events, + cspmu->num_logical_ctrs); if (!cspmu->hw_events.events) return -ENOMEM; diff --git a/drivers/perf/arm_cspmu/nvidia_cspmu.c b/drivers/perf/arm_cspmu/nvidia_cspmu.c index a4c1ab886709..af256f662731 100644 --- a/drivers/perf/arm_cspmu/nvidia_cspmu.c +++ b/drivers/perf/arm_cspmu/nvidia_cspmu.c @@ -535,7 +535,7 @@ static int pcie_tgt_init_data(struct arm_cspmu *cspmu) struct nv_cspmu_ctx *ctx = to_nv_cspmu_ctx(cspmu); struct device *dev = cspmu->dev; - data = devm_kzalloc(dev, sizeof(struct pcie_tgt_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct pcie_tgt_data); if (!data) return -ENOMEM; @@ -1008,7 +1008,7 @@ static int nv_cspmu_init_ops(struct arm_cspmu *cspmu) struct arm_cspmu_impl_ops *impl_ops = &cspmu->impl.ops; const struct nv_cspmu_match *match = nv_cspmu_match; - ctx = devm_kzalloc(dev, sizeof(struct nv_cspmu_ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, struct nv_cspmu_ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c index 467147a05eec..9a7b05b48da0 100644 --- a/drivers/perf/arm_dmc620_pmu.c +++ b/drivers/perf/arm_dmc620_pmu.c @@ -667,8 +667,7 @@ static int dmc620_pmu_device_probe(struct platform_device *pdev) int irq_num; int i, ret; - dmc620_pmu = devm_kzalloc(&pdev->dev, - sizeof(struct dmc620_pmu), GFP_KERNEL); + dmc620_pmu = devm_kzalloc_obj(&pdev->dev, struct dmc620_pmu); if (!dmc620_pmu) return -ENOMEM; diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c index 8332eaca06dc..751bfed944a9 100644 --- a/drivers/perf/arm_dsu_pmu.c +++ b/drivers/perf/arm_dsu_pmu.c @@ -572,7 +572,7 @@ static struct dsu_pmu *dsu_pmu_alloc(struct platform_device *pdev) { struct dsu_pmu *dsu_pmu; - dsu_pmu = devm_kzalloc(&pdev->dev, sizeof(*dsu_pmu), GFP_KERNEL); + dsu_pmu = devm_kzalloc_obj(&pdev->dev, *dsu_pmu); if (!dsu_pmu) return ERR_PTR(-ENOMEM); diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c index 8ce34e6bb82b..97440b6233c6 100644 --- a/drivers/perf/arm_smmuv3_pmu.c +++ b/drivers/perf/arm_smmuv3_pmu.c @@ -854,7 +854,7 @@ static int smmu_pmu_probe(struct platform_device *pdev) char *name; struct device *dev = &pdev->dev; - smmu_pmu = devm_kzalloc(dev, sizeof(*smmu_pmu), GFP_KERNEL); + smmu_pmu = devm_kzalloc_obj(dev, *smmu_pmu); if (!smmu_pmu) return -ENOMEM; diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c index 604ae6ba3b07..707778c67dab 100644 --- a/drivers/perf/arm_spe_pmu.c +++ b/drivers/perf/arm_spe_pmu.c @@ -1377,7 +1377,7 @@ static int arm_spe_pmu_device_probe(struct platform_device *pdev) return -EPERM; } - spe_pmu = devm_kzalloc(dev, sizeof(*spe_pmu), GFP_KERNEL); + spe_pmu = devm_kzalloc_obj(dev, *spe_pmu); if (!spe_pmu) return -ENOMEM; diff --git a/drivers/perf/cxl_pmu.c b/drivers/perf/cxl_pmu.c index 76c7e5af7454..ce4097c4f64e 100644 --- a/drivers/perf/cxl_pmu.c +++ b/drivers/perf/cxl_pmu.c @@ -187,7 +187,7 @@ static int cxl_pmu_parse_caps(struct device *dev, struct cxl_pmu_info *info) group_idx = FIELD_GET(CXL_PMU_COUNTER_CFG_EVENT_GRP_ID_IDX_MSK, val); events_msk = FIELD_GET(CXL_PMU_COUNTER_CFG_EVENTS_MSK, val); eval = readq(base + CXL_PMU_EVENT_CAP_REG(group_idx)); - pmu_ev = devm_kzalloc(dev, sizeof(*pmu_ev), GFP_KERNEL); + pmu_ev = devm_kzalloc_obj(dev, *pmu_ev); if (!pmu_ev) return -ENOMEM; @@ -211,7 +211,7 @@ static int cxl_pmu_parse_caps(struct device *dev, struct cxl_pmu_info *info) /* Walk event capabilities unused by fixed counters */ for_each_clear_bit(j, &fixed_counter_event_cap_bm, info->num_event_capabilities) { - pmu_ev = devm_kzalloc(dev, sizeof(*pmu_ev), GFP_KERNEL); + pmu_ev = devm_kzalloc_obj(dev, *pmu_ev); if (!pmu_ev) return -ENOMEM; @@ -978,7 +978,7 @@ static int cxl_pmu_probe(struct device *dev) char *dev_name; int rc, irq; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; @@ -993,8 +993,8 @@ static int cxl_pmu_probe(struct device *dev) if (rc) return rc; - info->hw_events = devm_kcalloc(dev, info->num_counters, - sizeof(*info->hw_events), GFP_KERNEL); + info->hw_events = devm_kzalloc_objs(dev, *info->hw_events, + info->num_counters); if (!info->hw_events) return -ENOMEM; diff --git a/drivers/perf/dwc_pcie_pmu.c b/drivers/perf/dwc_pcie_pmu.c index eb86e7468c49..039730a3b80d 100644 --- a/drivers/perf/dwc_pcie_pmu.c +++ b/drivers/perf/dwc_pcie_pmu.c @@ -770,7 +770,7 @@ static int dwc_pcie_pmu_probe(struct platform_device *plat_dev) if (!name) return -ENOMEM; - pcie_pmu = devm_kzalloc(&plat_dev->dev, sizeof(*pcie_pmu), GFP_KERNEL); + pcie_pmu = devm_kzalloc_obj(&plat_dev->dev, *pcie_pmu); if (!pcie_pmu) return -ENOMEM; diff --git a/drivers/perf/fsl_imx8_ddr_perf.c b/drivers/perf/fsl_imx8_ddr_perf.c index 7553c5872600..39b25d70942d 100644 --- a/drivers/perf/fsl_imx8_ddr_perf.c +++ b/drivers/perf/fsl_imx8_ddr_perf.c @@ -794,7 +794,7 @@ static int ddr_perf_probe(struct platform_device *pdev) np = pdev->dev.of_node; - pmu = devm_kzalloc(&pdev->dev, sizeof(*pmu), GFP_KERNEL); + pmu = devm_kzalloc_obj(&pdev->dev, *pmu); if (!pmu) return -ENOMEM; diff --git a/drivers/perf/fsl_imx9_ddr_perf.c b/drivers/perf/fsl_imx9_ddr_perf.c index d59bc5ea3155..739c6567cd68 100644 --- a/drivers/perf/fsl_imx9_ddr_perf.c +++ b/drivers/perf/fsl_imx9_ddr_perf.c @@ -787,7 +787,7 @@ static int ddr_perf_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - pmu = devm_kzalloc(&pdev->dev, sizeof(*pmu), GFP_KERNEL); + pmu = devm_kzalloc_obj(&pdev->dev, *pmu); if (!pmu) return -ENOMEM; diff --git a/drivers/perf/fujitsu_uncore_pmu.c b/drivers/perf/fujitsu_uncore_pmu.c index db90e181b9a8..f6165eb44c07 100644 --- a/drivers/perf/fujitsu_uncore_pmu.c +++ b/drivers/perf/fujitsu_uncore_pmu.c @@ -458,7 +458,7 @@ static int fujitsu_uncore_pmu_probe(struct platform_device *pdev) if (ret) return dev_err_probe(dev, ret, "unable to read ACPI uid\n"); - uncorepmu = devm_kzalloc(dev, sizeof(*uncorepmu), GFP_KERNEL); + uncorepmu = devm_kzalloc_obj(dev, *uncorepmu); if (!uncorepmu) return -ENOMEM; uncorepmu->dev = dev; diff --git a/drivers/perf/hisilicon/hisi_pcie_pmu.c b/drivers/perf/hisilicon/hisi_pcie_pmu.c index 0a69d13fa453..2414f222afcd 100644 --- a/drivers/perf/hisilicon/hisi_pcie_pmu.c +++ b/drivers/perf/hisilicon/hisi_pcie_pmu.c @@ -938,7 +938,7 @@ static int hisi_pcie_pmu_probe(struct pci_dev *pdev, const struct pci_device_id struct hisi_pcie_pmu *pcie_pmu; int ret; - pcie_pmu = devm_kzalloc(&pdev->dev, sizeof(*pcie_pmu), GFP_KERNEL); + pcie_pmu = devm_kzalloc_obj(&pdev->dev, *pcie_pmu); if (!pcie_pmu) return -ENOMEM; diff --git a/drivers/perf/hisilicon/hisi_uncore_cpa_pmu.c b/drivers/perf/hisilicon/hisi_uncore_cpa_pmu.c index 83967725c51c..b2a80ce8f051 100644 --- a/drivers/perf/hisilicon/hisi_uncore_cpa_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_cpa_pmu.c @@ -278,7 +278,7 @@ static int hisi_cpa_pmu_probe(struct platform_device *pdev) char *name; int ret; - cpa_pmu = devm_kzalloc(&pdev->dev, sizeof(*cpa_pmu), GFP_KERNEL); + cpa_pmu = devm_kzalloc_obj(&pdev->dev, *cpa_pmu); if (!cpa_pmu) return -ENOMEM; diff --git a/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c b/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c index e905160523ee..5e6bba6b43a1 100644 --- a/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c @@ -378,7 +378,7 @@ static int hisi_ddrc_pmu_probe(struct platform_device *pdev) char *name; int ret; - ddrc_pmu = devm_kzalloc(&pdev->dev, sizeof(*ddrc_pmu), GFP_KERNEL); + ddrc_pmu = devm_kzalloc_obj(&pdev->dev, *ddrc_pmu); if (!ddrc_pmu) return -ENOMEM; diff --git a/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c b/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c index 93a250b7abb8..9a25fb6d6541 100644 --- a/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c @@ -475,7 +475,7 @@ static int hisi_hha_pmu_probe(struct platform_device *pdev) char *name; int ret; - hha_pmu = devm_kzalloc(&pdev->dev, sizeof(*hha_pmu), GFP_KERNEL); + hha_pmu = devm_kzalloc_obj(&pdev->dev, *hha_pmu); if (!hha_pmu) return -ENOMEM; diff --git a/drivers/perf/hisilicon/hisi_uncore_its_pmu.c b/drivers/perf/hisilicon/hisi_uncore_its_pmu.c index 66311657db89..86f8b07bf41b 100644 --- a/drivers/perf/hisilicon/hisi_uncore_its_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_its_pmu.c @@ -309,7 +309,7 @@ static int hisi_its_pmu_probe(struct platform_device *pdev) char *name; int ret; - pmu = devm_kzalloc(dev, sizeof(*pmu), GFP_KERNEL); + pmu = devm_kzalloc_obj(dev, *pmu); if (!pmu) return -ENOMEM; diff --git a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c index e40506e09702..167e369cf74c 100644 --- a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c @@ -825,7 +825,7 @@ static int hisi_l3c_pmu_probe(struct platform_device *pdev) char *name; int ret; - hisi_l3c_pmu = devm_kzalloc(&pdev->dev, sizeof(*hisi_l3c_pmu), GFP_KERNEL); + hisi_l3c_pmu = devm_kzalloc_obj(&pdev->dev, *hisi_l3c_pmu); if (!hisi_l3c_pmu) return -ENOMEM; diff --git a/drivers/perf/hisilicon/hisi_uncore_mn_pmu.c b/drivers/perf/hisilicon/hisi_uncore_mn_pmu.c index 1ded8a6b2358..fb7091dddc88 100644 --- a/drivers/perf/hisilicon/hisi_uncore_mn_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_mn_pmu.c @@ -343,7 +343,7 @@ static int hisi_mn_pmu_probe(struct platform_device *pdev) char *name; int ret; - mn_pmu = devm_kzalloc(&pdev->dev, sizeof(*mn_pmu), GFP_KERNEL); + mn_pmu = devm_kzalloc_obj(&pdev->dev, *mn_pmu); if (!mn_pmu) return -ENOMEM; diff --git a/drivers/perf/hisilicon/hisi_uncore_noc_pmu.c b/drivers/perf/hisilicon/hisi_uncore_noc_pmu.c index abf44fa46d17..29488cb2689e 100644 --- a/drivers/perf/hisilicon/hisi_uncore_noc_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_noc_pmu.c @@ -336,7 +336,7 @@ static int hisi_noc_pmu_probe(struct platform_device *pdev) char *name; int ret; - noc_pmu = devm_kzalloc(dev, sizeof(*noc_pmu), GFP_KERNEL); + noc_pmu = devm_kzalloc_obj(dev, *noc_pmu); if (!noc_pmu) return -ENOMEM; diff --git a/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c index 3d1e0af64260..91b51985c52b 100644 --- a/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c @@ -454,7 +454,7 @@ static int hisi_pa_pmu_probe(struct platform_device *pdev) char *name; int ret; - pa_pmu = devm_kzalloc(&pdev->dev, sizeof(*pa_pmu), GFP_KERNEL); + pa_pmu = devm_kzalloc_obj(&pdev->dev, *pa_pmu); if (!pa_pmu) return -ENOMEM; diff --git a/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c b/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c index d01340ff2e5c..a17756ec6765 100644 --- a/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c @@ -490,7 +490,7 @@ static int hisi_sllc_pmu_probe(struct platform_device *pdev) char *name; int ret; - sllc_pmu = devm_kzalloc(&pdev->dev, sizeof(*sllc_pmu), GFP_KERNEL); + sllc_pmu = devm_kzalloc_obj(&pdev->dev, *sllc_pmu); if (!sllc_pmu) return -ENOMEM; diff --git a/drivers/perf/hisilicon/hisi_uncore_uc_pmu.c b/drivers/perf/hisilicon/hisi_uncore_uc_pmu.c index b4d017a5d688..9c0564b9be61 100644 --- a/drivers/perf/hisilicon/hisi_uncore_uc_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_uc_pmu.c @@ -499,7 +499,7 @@ static int hisi_uc_pmu_probe(struct platform_device *pdev) char *name; int ret; - uc_pmu = devm_kzalloc(&pdev->dev, sizeof(*uc_pmu), GFP_KERNEL); + uc_pmu = devm_kzalloc_obj(&pdev->dev, *uc_pmu); if (!uc_pmu) return -ENOMEM; diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns3_pmu.c index 88a1129e9b90..3069257ca79f 100644 --- a/drivers/perf/hisilicon/hns3_pmu.c +++ b/drivers/perf/hisilicon/hns3_pmu.c @@ -1601,7 +1601,7 @@ static int hns3_pmu_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct hns3_pmu *hns3_pmu; int ret; - hns3_pmu = devm_kzalloc(&pdev->dev, sizeof(*hns3_pmu), GFP_KERNEL); + hns3_pmu = devm_kzalloc_obj(&pdev->dev, *hns3_pmu); if (!hns3_pmu) return -ENOMEM; diff --git a/drivers/perf/marvell_cn10k_ddr_pmu.c b/drivers/perf/marvell_cn10k_ddr_pmu.c index 9b68d6c1c31c..c699a4545935 100644 --- a/drivers/perf/marvell_cn10k_ddr_pmu.c +++ b/drivers/perf/marvell_cn10k_ddr_pmu.c @@ -1216,7 +1216,7 @@ static int cn10k_ddr_perf_probe(struct platform_device *pdev) char *name; int ret; - ddr_pmu = devm_kzalloc(&pdev->dev, sizeof(*ddr_pmu), GFP_KERNEL); + ddr_pmu = devm_kzalloc_obj(&pdev->dev, *ddr_pmu); if (!ddr_pmu) return -ENOMEM; diff --git a/drivers/perf/marvell_cn10k_tad_pmu.c b/drivers/perf/marvell_cn10k_tad_pmu.c index 301be4d92b1b..2d64a3351433 100644 --- a/drivers/perf/marvell_cn10k_tad_pmu.c +++ b/drivers/perf/marvell_cn10k_tad_pmu.c @@ -300,7 +300,7 @@ static int tad_pmu_probe(struct platform_device *pdev) int i, ret; char *name; - tad_pmu = devm_kzalloc(&pdev->dev, sizeof(*tad_pmu), GFP_KERNEL); + tad_pmu = devm_kzalloc_obj(&pdev->dev, *tad_pmu); if (!tad_pmu) return -ENOMEM; @@ -339,8 +339,7 @@ static int tad_pmu_probe(struct platform_device *pdev) return ret; } - regions = devm_kcalloc(&pdev->dev, tad_cnt, - sizeof(*regions), GFP_KERNEL); + regions = devm_kzalloc_objs(&pdev->dev, *regions, tad_cnt); if (!regions) return -ENOMEM; diff --git a/drivers/perf/marvell_pem_pmu.c b/drivers/perf/marvell_pem_pmu.c index cf1d8cdb1318..f72837fa02f9 100644 --- a/drivers/perf/marvell_pem_pmu.c +++ b/drivers/perf/marvell_pem_pmu.c @@ -319,7 +319,7 @@ static int pem_perf_probe(struct platform_device *pdev) char *name; int ret; - pem_pmu = devm_kzalloc(&pdev->dev, sizeof(*pem_pmu), GFP_KERNEL); + pem_pmu = devm_kzalloc_obj(&pdev->dev, *pem_pmu); if (!pem_pmu) return -ENOMEM; diff --git a/drivers/perf/nvidia_t410_c2c_pmu.c b/drivers/perf/nvidia_t410_c2c_pmu.c index a41d5712da91..1fc2adeb7195 100644 --- a/drivers/perf/nvidia_t410_c2c_pmu.c +++ b/drivers/perf/nvidia_t410_c2c_pmu.c @@ -878,7 +878,7 @@ static void *nv_c2c_pmu_init_pmu(struct platform_device *pdev) if (!acpi_dev) return ERR_PTR(-ENODEV); - c2c_pmu = devm_kzalloc(dev, sizeof(*c2c_pmu), GFP_KERNEL); + c2c_pmu = devm_kzalloc_obj(dev, *c2c_pmu); if (!c2c_pmu) return ERR_PTR(-ENOMEM); diff --git a/drivers/perf/nvidia_t410_cmem_latency_pmu.c b/drivers/perf/nvidia_t410_cmem_latency_pmu.c index da91a51fe29e..f1eff644b0ba 100644 --- a/drivers/perf/nvidia_t410_cmem_latency_pmu.c +++ b/drivers/perf/nvidia_t410_cmem_latency_pmu.c @@ -610,7 +610,7 @@ static int cmem_lat_pmu_probe(struct platform_device *pdev) if (ret) return ret; - cmem_lat_pmu = devm_kzalloc(dev, sizeof(*cmem_lat_pmu), GFP_KERNEL); + cmem_lat_pmu = devm_kzalloc_obj(dev, *cmem_lat_pmu); name = devm_kasprintf(dev, GFP_KERNEL, "nvidia_cmem_latency_pmu_%u", socket); if (!cmem_lat_pmu || !name) return -ENOMEM; diff --git a/drivers/perf/qcom_l2_pmu.c b/drivers/perf/qcom_l2_pmu.c index 29554cca22c5..644bb5484516 100644 --- a/drivers/perf/qcom_l2_pmu.c +++ b/drivers/perf/qcom_l2_pmu.c @@ -850,7 +850,7 @@ static int l2_cache_pmu_probe_cluster(struct device *dev, void *data) return err; } - cluster = devm_kzalloc(&pdev->dev, sizeof(*cluster), GFP_KERNEL); + cluster = devm_kzalloc_obj(&pdev->dev, *cluster); if (!cluster) return -ENOMEM; @@ -888,8 +888,7 @@ static int l2_cache_pmu_probe(struct platform_device *pdev) int err; struct l2cache_pmu *l2cache_pmu; - l2cache_pmu = - devm_kzalloc(&pdev->dev, sizeof(*l2cache_pmu), GFP_KERNEL); + l2cache_pmu = devm_kzalloc_obj(&pdev->dev, *l2cache_pmu); if (!l2cache_pmu) return -ENOMEM; diff --git a/drivers/perf/qcom_l3_pmu.c b/drivers/perf/qcom_l3_pmu.c index d036fa05aeab..3e0c00e3733f 100644 --- a/drivers/perf/qcom_l3_pmu.c +++ b/drivers/perf/qcom_l3_pmu.c @@ -731,7 +731,7 @@ static int qcom_l3_cache_pmu_probe(struct platform_device *pdev) if (!acpi_dev) return -ENODEV; - l3pmu = devm_kzalloc(&pdev->dev, sizeof(*l3pmu), GFP_KERNEL); + l3pmu = devm_kzalloc_obj(&pdev->dev, *l3pmu); name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "l3cache_%s_%s", acpi_device_uid(acpi_dev_parent(acpi_dev)), acpi_device_uid(acpi_dev)); diff --git a/drivers/perf/starfive_starlink_pmu.c b/drivers/perf/starfive_starlink_pmu.c index d9843645554b..7f603a95136b 100644 --- a/drivers/perf/starfive_starlink_pmu.c +++ b/drivers/perf/starfive_starlink_pmu.c @@ -510,7 +510,7 @@ static int starlink_pmu_probe(struct platform_device *pdev) struct resource *res; int cpuid, i, ret; - starlink_pmu = devm_kzalloc(&pdev->dev, sizeof(*starlink_pmu), GFP_KERNEL); + starlink_pmu = devm_kzalloc_obj(&pdev->dev, *starlink_pmu); if (!starlink_pmu) return -ENOMEM; diff --git a/drivers/perf/thunderx2_pmu.c b/drivers/perf/thunderx2_pmu.c index a69c02d2d874..3cf079c7ff41 100644 --- a/drivers/perf/thunderx2_pmu.c +++ b/drivers/perf/thunderx2_pmu.c @@ -815,7 +815,7 @@ static struct tx2_uncore_pmu *tx2_uncore_pmu_init_dev(struct device *dev, if (IS_ERR(base)) return NULL; - tx2_pmu = devm_kzalloc(dev, sizeof(*tx2_pmu), GFP_KERNEL); + tx2_pmu = devm_kzalloc_obj(dev, *tx2_pmu); if (!tx2_pmu) return NULL; diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c index aa38426352d2..9ac57f9b4413 100644 --- a/drivers/perf/xgene_pmu.c +++ b/drivers/perf/xgene_pmu.c @@ -1120,7 +1120,7 @@ xgene_pmu_dev_add(struct xgene_pmu *xgene_pmu, struct xgene_pmu_dev_ctx *ctx) struct device *dev = xgene_pmu->dev; struct xgene_pmu_dev *pmu; - pmu = devm_kzalloc(dev, sizeof(*pmu), GFP_KERNEL); + pmu = devm_kzalloc_obj(dev, *pmu); if (!pmu) return -ENOMEM; pmu->parent = xgene_pmu; @@ -1454,7 +1454,7 @@ xgene_pmu_dev_ctx *acpi_get_pmu_hw_inf(struct xgene_pmu *xgene_pmu, int enable_bit; int rc; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return NULL; @@ -1620,7 +1620,7 @@ xgene_pmu_dev_ctx *fdt_get_pmu_hw_inf(struct xgene_pmu *xgene_pmu, struct resource res; int enable_bit; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return NULL; @@ -1839,7 +1839,7 @@ static int xgene_pmu_probe(struct platform_device *pdev) if (rc) return rc; - xgene_pmu = devm_kzalloc(&pdev->dev, sizeof(*xgene_pmu), GFP_KERNEL); + xgene_pmu = devm_kzalloc_obj(&pdev->dev, *xgene_pmu); if (!xgene_pmu) return -ENOMEM; xgene_pmu->dev = &pdev->dev; diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index e2fbf8ccf99e..f26eed0db17e 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -724,7 +724,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; int i, ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/phy/allwinner/phy-sun50i-usb3.c b/drivers/phy/allwinner/phy-sun50i-usb3.c index 84055b720016..06bd74e7fe8d 100644 --- a/drivers/phy/allwinner/phy-sun50i-usb3.c +++ b/drivers/phy/allwinner/phy-sun50i-usb3.c @@ -135,7 +135,7 @@ static int sun50i_usb3_phy_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct phy_provider *phy_provider; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c b/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c index 36eab95271b2..e5a9aa3f4aac 100644 --- a/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c +++ b/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c @@ -553,7 +553,7 @@ static int sun6i_dphy_probe(struct platform_device *pdev) void __iomem *regs; int ret; - dphy = devm_kzalloc(&pdev->dev, sizeof(*dphy), GFP_KERNEL); + dphy = devm_kzalloc_obj(&pdev->dev, *dphy); if (!dphy) return -ENOMEM; diff --git a/drivers/phy/allwinner/phy-sun9i-usb.c b/drivers/phy/allwinner/phy-sun9i-usb.c index 2f9e60c188b8..8811870b63cb 100644 --- a/drivers/phy/allwinner/phy-sun9i-usb.c +++ b/drivers/phy/allwinner/phy-sun9i-usb.c @@ -118,7 +118,7 @@ static int sun9i_usb_phy_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; struct phy_provider *phy_provider; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c b/drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c index 5e2b7d93bdb1..6cf06041e254 100644 --- a/drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c +++ b/drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c @@ -339,7 +339,7 @@ static int phy_meson_axg_mipi_dphy_probe(struct platform_device *pdev) void __iomem *base; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c b/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c index c0ba2852dbb8..d5d5d13f2d41 100644 --- a/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c +++ b/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c @@ -201,7 +201,7 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev) struct device_node *np = dev->of_node, *parent_np; struct regmap *map; - priv = devm_kmalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kmalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/amlogic/phy-meson-axg-pcie.c b/drivers/phy/amlogic/phy-meson-axg-pcie.c index 13668764655c..63d2ffe2fee7 100644 --- a/drivers/phy/amlogic/phy-meson-axg-pcie.c +++ b/drivers/phy/amlogic/phy-meson-axg-pcie.c @@ -131,7 +131,7 @@ static int phy_axg_pcie_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; void __iomem *base; - priv = devm_kmalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kmalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/amlogic/phy-meson-g12a-mipi-dphy-analog.c b/drivers/phy/amlogic/phy-meson-g12a-mipi-dphy-analog.c index 46e5f7e7eb6c..5fc8d2054e0f 100644 --- a/drivers/phy/amlogic/phy-meson-g12a-mipi-dphy-analog.c +++ b/drivers/phy/amlogic/phy-meson-g12a-mipi-dphy-analog.c @@ -125,7 +125,7 @@ static int phy_g12a_mipi_dphy_analog_probe(struct platform_device *pdev) struct device_node *np = dev->of_node, *parent_np; struct regmap *map; - priv = devm_kmalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kmalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/amlogic/phy-meson-g12a-usb2.c b/drivers/phy/amlogic/phy-meson-g12a-usb2.c index 66bf0b7ef8ed..9f398856b317 100644 --- a/drivers/phy/amlogic/phy-meson-g12a-usb2.c +++ b/drivers/phy/amlogic/phy-meson-g12a-usb2.c @@ -308,7 +308,7 @@ static int phy_meson_g12a_usb2_probe(struct platform_device *pdev) void __iomem *base; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/amlogic/phy-meson-g12a-usb3-pcie.c b/drivers/phy/amlogic/phy-meson-g12a-usb3-pcie.c index 5468831d6ab9..f94c08b17267 100644 --- a/drivers/phy/amlogic/phy-meson-g12a-usb3-pcie.c +++ b/drivers/phy/amlogic/phy-meson-g12a-usb3-pcie.c @@ -389,7 +389,7 @@ static int phy_g12a_usb3_pcie_probe(struct platform_device *pdev) struct phy_provider *phy_provider; void __iomem *base; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/amlogic/phy-meson-gxl-usb2.c b/drivers/phy/amlogic/phy-meson-gxl-usb2.c index f6bc0ca248f7..58e47a31e4c9 100644 --- a/drivers/phy/amlogic/phy-meson-gxl-usb2.c +++ b/drivers/phy/amlogic/phy-meson-gxl-usb2.c @@ -237,7 +237,7 @@ static int phy_meson_gxl_usb2_probe(struct platform_device *pdev) struct phy *phy; void __iomem *base; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/amlogic/phy-meson8-hdmi-tx.c b/drivers/phy/amlogic/phy-meson8-hdmi-tx.c index 2617f7f6c2ec..f6b5df74a58f 100644 --- a/drivers/phy/amlogic/phy-meson8-hdmi-tx.c +++ b/drivers/phy/amlogic/phy-meson8-hdmi-tx.c @@ -116,7 +116,7 @@ static int phy_meson8_hdmi_tx_probe(struct platform_device *pdev) if (!res) return -EINVAL; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c index 71e5e281f188..0cecd23f0ab5 100644 --- a/drivers/phy/amlogic/phy-meson8b-usb2.c +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c @@ -235,7 +235,7 @@ static int phy_meson8b_usb2_probe(struct platform_device *pdev) struct phy_provider *phy_provider; void __iomem *base; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/apple/atc.c b/drivers/phy/apple/atc.c index 45f1280a6faa..37d7e266a015 100644 --- a/drivers/phy/apple/atc.c +++ b/drivers/phy/apple/atc.c @@ -2297,7 +2297,7 @@ static int atcphy_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - atcphy = devm_kzalloc(&pdev->dev, sizeof(*atcphy), GFP_KERNEL); + atcphy = devm_kzalloc_obj(&pdev->dev, *atcphy); if (!atcphy) return -ENOMEM; diff --git a/drivers/phy/aspeed/phy-aspeed-usb3.c b/drivers/phy/aspeed/phy-aspeed-usb3.c index 6f371cae02f3..9983644831a6 100644 --- a/drivers/phy/aspeed/phy-aspeed-usb3.c +++ b/drivers/phy/aspeed/phy-aspeed-usb3.c @@ -186,7 +186,7 @@ static int aspeed_usb3_phy_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct phy *phy; - aspeed_phy = devm_kzalloc(dev, sizeof(*aspeed_phy), GFP_KERNEL); + aspeed_phy = devm_kzalloc_obj(dev, *aspeed_phy); if (!aspeed_phy) return -ENOMEM; diff --git a/drivers/phy/axiado/phy-axiado-emmc.c b/drivers/phy/axiado/phy-axiado-emmc.c index e0e2174776ad..1b4a73161fbc 100644 --- a/drivers/phy/axiado/phy-axiado-emmc.c +++ b/drivers/phy/axiado/phy-axiado-emmc.c @@ -182,7 +182,7 @@ static int axiado_emmc_phy_probe(struct platform_device *pdev) if (!dev->of_node) return -ENODEV; - ax_phy = devm_kzalloc(dev, sizeof(*ax_phy), GFP_KERNEL); + ax_phy = devm_kzalloc_obj(dev, *ax_phy); if (!ax_phy) return -ENOMEM; diff --git a/drivers/phy/broadcom/phy-bcm-cygnus-pcie.c b/drivers/phy/broadcom/phy-bcm-cygnus-pcie.c index 462c61a24ec5..ef621bdc9035 100644 --- a/drivers/phy/broadcom/phy-bcm-cygnus-pcie.c +++ b/drivers/phy/broadcom/phy-bcm-cygnus-pcie.c @@ -123,7 +123,7 @@ static int cygnus_pcie_phy_probe(struct platform_device *pdev) return -ENODEV; } - core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); + core = devm_kzalloc_obj(dev, *core); if (!core) return -ENOMEM; diff --git a/drivers/phy/broadcom/phy-bcm-kona-usb2.c b/drivers/phy/broadcom/phy-bcm-kona-usb2.c index e9cc5f2cb89a..449748d1cf12 100644 --- a/drivers/phy/broadcom/phy-bcm-kona-usb2.c +++ b/drivers/phy/broadcom/phy-bcm-kona-usb2.c @@ -97,7 +97,7 @@ static int bcm_kona_usb2_probe(struct platform_device *pdev) struct phy *gphy; struct phy_provider *phy_provider; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb2.c b/drivers/phy/broadcom/phy-bcm-ns-usb2.c index c5d35031b398..028afac15158 100644 --- a/drivers/phy/broadcom/phy-bcm-ns-usb2.c +++ b/drivers/phy/broadcom/phy-bcm-ns-usb2.c @@ -88,7 +88,7 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev) struct bcm_ns_usb2 *usb2; struct phy_provider *phy_provider; - usb2 = devm_kzalloc(&pdev->dev, sizeof(*usb2), GFP_KERNEL); + usb2 = devm_kzalloc_obj(&pdev->dev, *usb2); if (!usb2) return -ENOMEM; usb2->dev = dev; diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb3.c b/drivers/phy/broadcom/phy-bcm-ns-usb3.c index 9240600aeef6..1cf3babfc5a2 100644 --- a/drivers/phy/broadcom/phy-bcm-ns-usb3.c +++ b/drivers/phy/broadcom/phy-bcm-ns-usb3.c @@ -197,7 +197,7 @@ static int bcm_ns_usb3_mdio_probe(struct mdio_device *mdiodev) struct resource res; int err; - usb3 = devm_kzalloc(dev, sizeof(*usb3), GFP_KERNEL); + usb3 = devm_kzalloc_obj(dev, *usb3); if (!usb3) return -ENOMEM; diff --git a/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c b/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c index 171bf097a8b8..bb4221fec01b 100644 --- a/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c +++ b/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c @@ -285,13 +285,11 @@ static int ns2_drd_phy_probe(struct platform_device *pdev) int ret; u32 val; - driver = devm_kzalloc(dev, sizeof(struct ns2_phy_driver), - GFP_KERNEL); + driver = devm_kzalloc_obj(dev, struct ns2_phy_driver); if (!driver) return -ENOMEM; - driver->data = devm_kzalloc(dev, sizeof(struct ns2_phy_data), - GFP_KERNEL); + driver->data = devm_kzalloc_obj(dev, struct ns2_phy_data); if (!driver->data) return -ENOMEM; diff --git a/drivers/phy/broadcom/phy-bcm-sr-pcie.c b/drivers/phy/broadcom/phy-bcm-sr-pcie.c index 706e1d83b4ce..1361acd64206 100644 --- a/drivers/phy/broadcom/phy-bcm-sr-pcie.c +++ b/drivers/phy/broadcom/phy-bcm-sr-pcie.c @@ -220,7 +220,7 @@ static int sr_pcie_phy_probe(struct platform_device *pdev) struct phy_provider *provider; unsigned int phy_idx = 0; - core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); + core = devm_kzalloc_obj(dev, *core); if (!core) return -ENOMEM; diff --git a/drivers/phy/broadcom/phy-bcm-sr-usb.c b/drivers/phy/broadcom/phy-bcm-sr-usb.c index 6bcfe83609c8..cca8303a66e9 100644 --- a/drivers/phy/broadcom/phy-bcm-sr-usb.c +++ b/drivers/phy/broadcom/phy-bcm-sr-usb.c @@ -260,8 +260,7 @@ static int bcm_usb_phy_create(struct device *dev, struct device_node *node, phy_set_drvdata(phy_cfg[idx].phy, &phy_cfg[idx]); } } else if (version == BCM_SR_USB_HS_PHY) { - phy_cfg = devm_kzalloc(dev, sizeof(struct bcm_usb_phy_cfg), - GFP_KERNEL); + phy_cfg = devm_kzalloc_obj(dev, struct bcm_usb_phy_cfg); if (!phy_cfg) return -ENOMEM; diff --git a/drivers/phy/broadcom/phy-bcm63xx-usbh.c b/drivers/phy/broadcom/phy-bcm63xx-usbh.c index 29fd6791bae6..43894d4dfec6 100644 --- a/drivers/phy/broadcom/phy-bcm63xx-usbh.c +++ b/drivers/phy/broadcom/phy-bcm63xx-usbh.c @@ -383,7 +383,7 @@ static int bcm63xx_usbh_phy_probe(struct platform_device *pdev) struct phy *phy; struct phy_provider *phy_provider; - usbh = devm_kzalloc(dev, sizeof(*usbh), GFP_KERNEL); + usbh = devm_kzalloc_obj(dev, *usbh); if (!usbh) return -ENOMEM; diff --git a/drivers/phy/broadcom/phy-brcm-sata.c b/drivers/phy/broadcom/phy-brcm-sata.c index 43b287a25e7a..e9829587f284 100644 --- a/drivers/phy/broadcom/phy-brcm-sata.c +++ b/drivers/phy/broadcom/phy-brcm-sata.c @@ -760,7 +760,7 @@ static int brcm_sata_phy_probe(struct platform_device *pdev) if (of_get_child_count(dn) == 0) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; dev_set_drvdata(dev, priv); diff --git a/drivers/phy/broadcom/phy-brcm-usb.c b/drivers/phy/broadcom/phy-brcm-usb.c index e606db489698..0662ff450628 100644 --- a/drivers/phy/broadcom/phy-brcm-usb.c +++ b/drivers/phy/broadcom/phy-brcm-usb.c @@ -491,7 +491,7 @@ static int brcm_usb_phy_probe(struct platform_device *pdev) struct regmap *rmap; int x; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; platform_set_drvdata(pdev, priv); diff --git a/drivers/phy/cadence/cdns-dphy-rx.c b/drivers/phy/cadence/cdns-dphy-rx.c index 469b8eaca94c..d3f7e9513dd6 100644 --- a/drivers/phy/cadence/cdns-dphy-rx.c +++ b/drivers/phy/cadence/cdns-dphy-rx.c @@ -240,7 +240,7 @@ static int cdns_dphy_rx_probe(struct platform_device *pdev) struct phy_provider *provider; struct cdns_dphy_rx *dphy; - dphy = devm_kzalloc(dev, sizeof(*dphy), GFP_KERNEL); + dphy = devm_kzalloc_obj(dev, *dphy); if (!dphy) return -ENOMEM; diff --git a/drivers/phy/cadence/cdns-dphy.c b/drivers/phy/cadence/cdns-dphy.c index d5b0e516b93c..483e35c82a11 100644 --- a/drivers/phy/cadence/cdns-dphy.c +++ b/drivers/phy/cadence/cdns-dphy.c @@ -471,7 +471,7 @@ static int cdns_dphy_probe(struct platform_device *pdev) struct cdns_dphy *dphy; int ret; - dphy = devm_kzalloc(&pdev->dev, sizeof(*dphy), GFP_KERNEL); + dphy = devm_kzalloc_obj(&pdev->dev, *dphy); if (!dphy) return -ENOMEM; dev_set_drvdata(&pdev->dev, dphy); diff --git a/drivers/phy/cadence/phy-cadence-salvo.c b/drivers/phy/cadence/phy-cadence-salvo.c index f461585c84c6..81edac6778ed 100644 --- a/drivers/phy/cadence/phy-cadence-salvo.c +++ b/drivers/phy/cadence/phy-cadence-salvo.c @@ -335,7 +335,7 @@ static int cdns_salvo_phy_probe(struct platform_device *pdev) u32 val; data = (struct cdns_salvo_data *)of_device_get_match_data(dev); - salvo_phy = devm_kzalloc(dev, sizeof(*salvo_phy), GFP_KERNEL); + salvo_phy = devm_kzalloc_obj(dev, *salvo_phy); if (!salvo_phy) return -ENOMEM; diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index dbeda7f01cbb..c90e3cd6365a 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -755,7 +755,7 @@ static int cdns_sierra_pll_mux_register(struct cdns_sierra_phy *sp, char clk_name[100]; int ret; - mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(dev, *mux); if (!mux) return -ENOMEM; @@ -856,7 +856,7 @@ static int cdns_sierra_derived_refclk_register(struct cdns_sierra_phy *sp) char clk_name[100]; int ret; - derived_refclk = devm_kzalloc(dev, sizeof(*derived_refclk), GFP_KERNEL); + derived_refclk = devm_kzalloc_obj(dev, *derived_refclk); if (!derived_refclk) return -ENOMEM; @@ -974,7 +974,7 @@ static struct regmap *cdns_regmap_init(struct device *dev, void __iomem *base, { struct cdns_regmap_cdb_context *ctx; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return ERR_PTR(-ENOMEM); @@ -1373,9 +1373,8 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) if (!data) return -EINVAL; - sp = devm_kzalloc(dev, struct_size(sp, clk_data.hws, - CDNS_SIERRA_OUTPUT_CLOCKS), - GFP_KERNEL); + sp = devm_kzalloc_flex(dev, *sp, clk_data.hws, + CDNS_SIERRA_OUTPUT_CLOCKS); if (!sp) return -ENOMEM; dev_set_drvdata(dev, sp); diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index d446a0f97688..1e178aa2ffd7 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -1863,7 +1863,7 @@ static int cdns_torrent_derived_refclk_register(struct cdns_torrent_phy *cdns_ph struct clk *clk; int ret; - derived_refclk = devm_kzalloc(dev, sizeof(*derived_refclk), GFP_KERNEL); + derived_refclk = devm_kzalloc_obj(dev, *derived_refclk); if (!derived_refclk) return -ENOMEM; @@ -1946,7 +1946,7 @@ static int cdns_torrent_received_refclk_register(struct cdns_torrent_phy *cdns_p struct clk *clk; int ret; - received_refclk = devm_kzalloc(dev, sizeof(*received_refclk), GFP_KERNEL); + received_refclk = devm_kzalloc_obj(dev, *received_refclk); if (!received_refclk) return -ENOMEM; @@ -2053,7 +2053,7 @@ static int cdns_torrent_refclk_driver_register(struct cdns_torrent_phy *cdns_phy struct clk_hw *hw; int i, ret; - refclk_driver = devm_kzalloc(dev, sizeof(*refclk_driver), GFP_KERNEL); + refclk_driver = devm_kzalloc_obj(dev, *refclk_driver); if (!refclk_driver) return -ENOMEM; @@ -2115,7 +2115,7 @@ static struct regmap *cdns_regmap_init(struct device *dev, void __iomem *base, { struct cdns_regmap_cdb_context *ctx; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return ERR_PTR(-ENOMEM); @@ -2752,7 +2752,7 @@ static int cdns_torrent_clk_register(struct cdns_torrent_phy *cdns_phy) struct clk_hw_onecell_data *data; int ret; - data = devm_kzalloc(dev, struct_size(data, hws, CDNS_TORRENT_OUTPUT_CLOCKS), GFP_KERNEL); + data = devm_kzalloc_flex(dev, *data, hws, CDNS_TORRENT_OUTPUT_CLOCKS); if (!data) return -ENOMEM; @@ -2924,7 +2924,7 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) if (!data) return -EINVAL; - cdns_phy = devm_kzalloc(dev, sizeof(*cdns_phy), GFP_KERNEL); + cdns_phy = devm_kzalloc_obj(dev, *cdns_phy); if (!cdns_phy) return -ENOMEM; diff --git a/drivers/phy/canaan/phy-k230-usb.c b/drivers/phy/canaan/phy-k230-usb.c index 52dad35fc6cf..2480eeaf0f66 100644 --- a/drivers/phy/canaan/phy-k230-usb.c +++ b/drivers/phy/canaan/phy-k230-usb.c @@ -220,7 +220,7 @@ static int k230_usb_phy_probe(struct platform_device *pdev) struct phy_provider *provider; int i; - global = devm_kzalloc(dev, sizeof(*global), GFP_KERNEL); + global = devm_kzalloc_obj(dev, *global); if (!global) return -ENOMEM; dev_set_drvdata(dev, global); diff --git a/drivers/phy/eswin/phy-eic7700-sata.c b/drivers/phy/eswin/phy-eic7700-sata.c index 76774b9e391b..2656e0b76889 100644 --- a/drivers/phy/eswin/phy-eic7700-sata.c +++ b/drivers/phy/eswin/phy-eic7700-sata.c @@ -200,7 +200,7 @@ static int eic7700_sata_phy_probe(struct platform_device *pdev) struct resource *res; void __iomem *regs; - sata_phy = devm_kzalloc(dev, sizeof(*sata_phy), GFP_KERNEL); + sata_phy = devm_kzalloc_obj(dev, *sata_phy); if (!sata_phy) return -ENOMEM; diff --git a/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c b/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c index 0928a526e2ab..24c8b0777747 100644 --- a/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c +++ b/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c @@ -670,7 +670,7 @@ static int mixel_dphy_probe(struct platform_device *pdev) if (!np) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c index 7f5600103a00..b94b9ab26367 100644 --- a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c +++ b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c @@ -215,7 +215,7 @@ static int imx8_pcie_phy_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; struct imx8_pcie_phy *imx8_phy; - imx8_phy = devm_kzalloc(dev, sizeof(*imx8_phy), GFP_KERNEL); + imx8_phy = devm_kzalloc_obj(dev, *imx8_phy); if (!imx8_phy) return -ENOMEM; diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c index 8859835541b1..3f8fe63fa7cd 100644 --- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c +++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c @@ -262,7 +262,7 @@ static struct tca_blk *imx95_usb_phy_get_tca(struct platform_device *pdev, if (!res) return NULL; - tca = devm_kzalloc(dev, sizeof(*tca), GFP_KERNEL); + tca = devm_kzalloc_obj(dev, *tca); if (!tca) return ERR_PTR(-ENOMEM); @@ -705,7 +705,7 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev) const struct imx8mq_usb_phy_drvdata *phy_data; int ret; - imx_phy = devm_kzalloc(dev, sizeof(*imx_phy), GFP_KERNEL); + imx_phy = devm_kzalloc_obj(dev, *imx_phy); if (!imx_phy) return -ENOMEM; diff --git a/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c b/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c index 4ab45c9f53df..d29dbf57db88 100644 --- a/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c +++ b/drivers/phy/freescale/phy-fsl-imx8qm-hsio.c @@ -555,7 +555,7 @@ static int imx_hsio_probe(struct platform_device *pdev) struct imx_hsio_priv *priv; struct phy_provider *provider; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; priv->dev = &pdev->dev; diff --git a/drivers/phy/freescale/phy-fsl-imx8qm-lvds-phy.c b/drivers/phy/freescale/phy-fsl-imx8qm-lvds-phy.c index 368679436d86..2ad502019995 100644 --- a/drivers/phy/freescale/phy-fsl-imx8qm-lvds-phy.c +++ b/drivers/phy/freescale/phy-fsl-imx8qm-lvds-phy.c @@ -327,7 +327,7 @@ static int mixel_lvds_phy_probe(struct platform_device *pdev) if (!dev->of_node) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -356,7 +356,7 @@ static int mixel_lvds_phy_probe(struct platform_device *pdev) } for (i = 0; i < PHY_NUM; i++) { - lvds_phy = devm_kzalloc(dev, sizeof(*lvds_phy), GFP_KERNEL); + lvds_phy = devm_kzalloc_obj(dev, *lvds_phy); if (!lvds_phy) return -ENOMEM; diff --git a/drivers/phy/freescale/phy-fsl-lynx-core.c b/drivers/phy/freescale/phy-fsl-lynx-core.c index 2cfe9236ffc5..efdd56cc1f35 100644 --- a/drivers/phy/freescale/phy-fsl-lynx-core.c +++ b/drivers/phy/freescale/phy-fsl-lynx-core.c @@ -357,7 +357,7 @@ int lynx_probe(struct platform_device *pdev, const struct lynx_info *info, if (!info) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -368,8 +368,7 @@ int lynx_probe(struct platform_device *pdev, const struct lynx_info *info, spin_lock_init(&priv->pcc_lock); INIT_DELAYED_WORK(&priv->cdr_check, lynx_cdr_lock_check); - priv->lane = devm_kcalloc(dev, priv->info->num_lanes, - sizeof(*priv->lane), GFP_KERNEL); + priv->lane = devm_kzalloc_objs(dev, *priv->lane, priv->info->num_lanes); if (!priv->lane) return -ENOMEM; diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c index 02539ad0b0fe..aaa651abcbc6 100644 --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c @@ -643,7 +643,7 @@ static int fsl_samsung_hdmi_phy_probe(struct platform_device *pdev) struct fsl_samsung_hdmi_phy *phy; int ret; - phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(&pdev->dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/hisilicon/phy-hi3660-usb3.c b/drivers/phy/hisilicon/phy-hi3660-usb3.c index e2a09d67faed..004275a1ce3f 100644 --- a/drivers/phy/hisilicon/phy-hi3660-usb3.c +++ b/drivers/phy/hisilicon/phy-hi3660-usb3.c @@ -175,7 +175,7 @@ static int hi3660_phy_probe(struct platform_device *pdev) struct phy *phy; struct hi3660_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/hisilicon/phy-hi3670-pcie.c b/drivers/phy/hisilicon/phy-hi3670-pcie.c index 148763ed2c62..78758d704315 100644 --- a/drivers/phy/hisilicon/phy-hi3670-pcie.c +++ b/drivers/phy/hisilicon/phy-hi3670-pcie.c @@ -805,7 +805,7 @@ static int hi3670_pcie_phy_probe(struct platform_device *pdev) struct phy *generic_phy; int ret; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/hisilicon/phy-hi3670-usb3.c b/drivers/phy/hisilicon/phy-hi3670-usb3.c index 40d3cf128b44..db22564dddd6 100644 --- a/drivers/phy/hisilicon/phy-hi3670-usb3.c +++ b/drivers/phy/hisilicon/phy-hi3670-usb3.c @@ -592,7 +592,7 @@ static int hi3670_phy_probe(struct platform_device *pdev) struct phy *phy; struct hi3670_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/hisilicon/phy-hi6220-usb.c b/drivers/phy/hisilicon/phy-hi6220-usb.c index 4e6ff3af381f..e94a76120113 100644 --- a/drivers/phy/hisilicon/phy-hi6220-usb.c +++ b/drivers/phy/hisilicon/phy-hi6220-usb.c @@ -121,7 +121,7 @@ static int hi6220_phy_probe(struct platform_device *pdev) struct phy *phy; struct hi6220_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c index c843923252aa..9310533d53f0 100644 --- a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c +++ b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c @@ -141,7 +141,7 @@ static int hisi_inno_phy_probe(struct platform_device *pdev) int i = 0; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/hisilicon/phy-histb-combphy.c b/drivers/phy/hisilicon/phy-histb-combphy.c index 9dd0bd00b4e4..7d2bbe6e3362 100644 --- a/drivers/phy/hisilicon/phy-histb-combphy.c +++ b/drivers/phy/hisilicon/phy-histb-combphy.c @@ -199,7 +199,7 @@ static int histb_combphy_probe(struct platform_device *pdev) u32 vals[3]; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/hisilicon/phy-hix5hd2-sata.c b/drivers/phy/hisilicon/phy-hix5hd2-sata.c index 1b26ddb4c8a7..a1a00a52a340 100644 --- a/drivers/phy/hisilicon/phy-hix5hd2-sata.c +++ b/drivers/phy/hisilicon/phy-hix5hd2-sata.c @@ -139,7 +139,7 @@ static int hix5hd2_sata_phy_probe(struct platform_device *pdev) struct phy *phy; struct hix5hd2_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/ingenic/phy-ingenic-usb.c b/drivers/phy/ingenic/phy-ingenic-usb.c index 7e62d46850fd..f21c3727ad59 100644 --- a/drivers/phy/ingenic/phy-ingenic-usb.c +++ b/drivers/phy/ingenic/phy-ingenic-usb.c @@ -320,7 +320,7 @@ static int ingenic_usb_phy_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/intel/phy-intel-keembay-emmc.c b/drivers/phy/intel/phy-intel-keembay-emmc.c index 0eb11ac7c2e2..3f53032152fe 100644 --- a/drivers/phy/intel/phy-intel-keembay-emmc.c +++ b/drivers/phy/intel/phy-intel-keembay-emmc.c @@ -265,7 +265,7 @@ static int keembay_emmc_phy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; void __iomem *base; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/intel/phy-intel-keembay-usb.c b/drivers/phy/intel/phy-intel-keembay-usb.c index 7c2192965f68..288c0e0f158b 100644 --- a/drivers/phy/intel/phy-intel-keembay-usb.c +++ b/drivers/phy/intel/phy-intel-keembay-usb.c @@ -238,7 +238,7 @@ static int keembay_usb_phy_probe(struct platform_device *pdev) void __iomem *base; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/intel/phy-intel-lgm-combo.c b/drivers/phy/intel/phy-intel-lgm-combo.c index 9ee3cf61cdd0..72f8c32ea411 100644 --- a/drivers/phy/intel/phy-intel-lgm-combo.c +++ b/drivers/phy/intel/phy-intel-lgm-combo.c @@ -573,7 +573,7 @@ static int intel_cbphy_probe(struct platform_device *pdev) struct intel_combo_phy *cbphy; int ret; - cbphy = devm_kzalloc(dev, sizeof(*cbphy), GFP_KERNEL); + cbphy = devm_kzalloc_obj(dev, *cbphy); if (!cbphy) return -ENOMEM; diff --git a/drivers/phy/intel/phy-intel-lgm-emmc.c b/drivers/phy/intel/phy-intel-lgm-emmc.c index 703aeb122541..a37d98b12b60 100644 --- a/drivers/phy/intel/phy-intel-lgm-emmc.c +++ b/drivers/phy/intel/phy-intel-lgm-emmc.c @@ -239,7 +239,7 @@ static int intel_emmc_phy_probe(struct platform_device *pdev) struct phy *generic_phy; struct phy_provider *phy_provider; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/lantiq/phy-lantiq-rcu-usb2.c b/drivers/phy/lantiq/phy-lantiq-rcu-usb2.c index 82f1ffc0b0ad..ff0cde7a33a6 100644 --- a/drivers/phy/lantiq/phy-lantiq-rcu-usb2.c +++ b/drivers/phy/lantiq/phy-lantiq-rcu-usb2.c @@ -210,7 +210,7 @@ static int ltq_rcu_usb2_phy_probe(struct platform_device *pdev) struct phy_provider *provider; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c b/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c index 406a87c8b759..e9742f80f33c 100644 --- a/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c +++ b/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c @@ -405,7 +405,7 @@ static int ltq_vrx200_pcie_phy_probe(struct platform_device *pdev) void __iomem *base; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/marvell/phy-armada375-usb2.c b/drivers/phy/marvell/phy-armada375-usb2.c index 3731f9b25655..6f4baaa5ca77 100644 --- a/drivers/phy/marvell/phy-armada375-usb2.c +++ b/drivers/phy/marvell/phy-armada375-usb2.c @@ -107,7 +107,7 @@ static int armada375_usb_phy_probe(struct platform_device *pdev) void __iomem *usb_cluster_base; struct armada375_cluster_phy *cluster_phy; - cluster_phy = devm_kzalloc(dev, sizeof(*cluster_phy), GFP_KERNEL); + cluster_phy = devm_kzalloc_obj(dev, *cluster_phy); if (!cluster_phy) return -ENOMEM; diff --git a/drivers/phy/marvell/phy-armada38x-comphy.c b/drivers/phy/marvell/phy-armada38x-comphy.c index 5063361b0120..fdbf5d4350e4 100644 --- a/drivers/phy/marvell/phy-armada38x-comphy.c +++ b/drivers/phy/marvell/phy-armada38x-comphy.c @@ -200,7 +200,7 @@ static int a38x_comphy_probe(struct platform_device *pdev) struct resource *res; void __iomem *base; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/marvell/phy-berlin-sata.c b/drivers/phy/marvell/phy-berlin-sata.c index c90e2867900c..084671ee7d56 100644 --- a/drivers/phy/marvell/phy-berlin-sata.c +++ b/drivers/phy/marvell/phy-berlin-sata.c @@ -196,7 +196,7 @@ static int phy_berlin_sata_probe(struct platform_device *pdev) int ret, i = 0; u32 phy_id; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -216,8 +216,7 @@ static int phy_berlin_sata_probe(struct platform_device *pdev) if (priv->nphys == 0) return -ENODEV; - priv->phys = devm_kcalloc(dev, priv->nphys, sizeof(*priv->phys), - GFP_KERNEL); + priv->phys = devm_kzalloc_objs(dev, *priv->phys, priv->nphys); if (!priv->phys) return -ENOMEM; @@ -245,7 +244,7 @@ static int phy_berlin_sata_probe(struct platform_device *pdev) goto put_child; } - phy_desc = devm_kzalloc(dev, sizeof(*phy_desc), GFP_KERNEL); + phy_desc = devm_kzalloc_obj(dev, *phy_desc); if (!phy_desc) { ret = -ENOMEM; goto put_child; diff --git a/drivers/phy/marvell/phy-berlin-usb.c b/drivers/phy/marvell/phy-berlin-usb.c index f26bf630da2c..8d62a8d58736 100644 --- a/drivers/phy/marvell/phy-berlin-usb.c +++ b/drivers/phy/marvell/phy-berlin-usb.c @@ -167,7 +167,7 @@ static int phy_berlin_usb_probe(struct platform_device *pdev) struct phy *phy; struct phy_provider *phy_provider; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/marvell/phy-mmp3-hsic.c b/drivers/phy/marvell/phy-mmp3-hsic.c index 41bfa542b73e..debe95bc068c 100644 --- a/drivers/phy/marvell/phy-mmp3-hsic.c +++ b/drivers/phy/marvell/phy-mmp3-hsic.c @@ -48,7 +48,7 @@ static int mmp3_hsic_phy_probe(struct platform_device *pdev) struct phy_provider *provider; struct phy *phy; - mmp3 = devm_kzalloc(dev, sizeof(*mmp3), GFP_KERNEL); + mmp3 = devm_kzalloc_obj(dev, *mmp3); if (!mmp3) return -ENOMEM; diff --git a/drivers/phy/marvell/phy-mmp3-usb.c b/drivers/phy/marvell/phy-mmp3-usb.c index 04c0bada3519..57b0d8b34425 100644 --- a/drivers/phy/marvell/phy-mmp3-usb.c +++ b/drivers/phy/marvell/phy-mmp3-usb.c @@ -249,7 +249,7 @@ static int mmp3_usb_phy_probe(struct platform_device *pdev) struct mmp3_usb_phy *mmp3_usb_phy; struct phy_provider *provider; - mmp3_usb_phy = devm_kzalloc(dev, sizeof(*mmp3_usb_phy), GFP_KERNEL); + mmp3_usb_phy = devm_kzalloc_obj(dev, *mmp3_usb_phy); if (!mmp3_usb_phy) return -ENOMEM; diff --git a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c index 1d1db1737422..dfc7cf709309 100644 --- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c +++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c @@ -1247,7 +1247,7 @@ static int mvebu_a3700_comphy_probe(struct platform_device *pdev) struct clk *clk; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; @@ -1320,7 +1320,7 @@ static int mvebu_a3700_comphy_probe(struct platform_device *pdev) continue; } - lane = devm_kzalloc(&pdev->dev, sizeof(*lane), GFP_KERNEL); + lane = devm_kzalloc_obj(&pdev->dev, *lane); if (!lane) { of_node_put(child); return -ENOMEM; diff --git a/drivers/phy/marvell/phy-mvebu-a3700-utmi.c b/drivers/phy/marvell/phy-mvebu-a3700-utmi.c index f882bc57649c..3a33e9237675 100644 --- a/drivers/phy/marvell/phy-mvebu-a3700-utmi.c +++ b/drivers/phy/marvell/phy-mvebu-a3700-utmi.c @@ -216,7 +216,7 @@ static int mvebu_a3700_utmi_phy_probe(struct platform_device *pdev) struct mvebu_a3700_utmi *utmi; struct phy_provider *provider; - utmi = devm_kzalloc(dev, sizeof(*utmi), GFP_KERNEL); + utmi = devm_kzalloc_obj(dev, *utmi); if (!utmi) return -ENOMEM; diff --git a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c index 71f9c14fb50d..601da58e563d 100644 --- a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c +++ b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c @@ -1002,7 +1002,7 @@ static int mvebu_comphy_probe(struct platform_device *pdev) struct resource *res; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; @@ -1050,7 +1050,7 @@ static int mvebu_comphy_probe(struct platform_device *pdev) continue; } - lane = devm_kzalloc(&pdev->dev, sizeof(*lane), GFP_KERNEL); + lane = devm_kzalloc_obj(&pdev->dev, *lane); if (!lane) { of_node_put(child); ret = -ENOMEM; diff --git a/drivers/phy/marvell/phy-mvebu-cp110-utmi.c b/drivers/phy/marvell/phy-mvebu-cp110-utmi.c index dd3e515a8e86..5b423282e760 100644 --- a/drivers/phy/marvell/phy-mvebu-cp110-utmi.c +++ b/drivers/phy/marvell/phy-mvebu-cp110-utmi.c @@ -299,7 +299,7 @@ static int mvebu_cp110_utmi_phy_probe(struct platform_device *pdev) u32 usb_devices = 0; u32 swap_dx = 0; - utmi = devm_kzalloc(dev, sizeof(*utmi), GFP_KERNEL); + utmi = devm_kzalloc_obj(dev, *utmi); if (!utmi) return -ENOMEM; @@ -332,7 +332,7 @@ static int mvebu_cp110_utmi_phy_probe(struct platform_device *pdev) continue; } - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) { of_node_put(child); return -ENOMEM; diff --git a/drivers/phy/marvell/phy-mvebu-sata.c b/drivers/phy/marvell/phy-mvebu-sata.c index 51a4646e2933..aaccbf173ce2 100644 --- a/drivers/phy/marvell/phy-mvebu-sata.c +++ b/drivers/phy/marvell/phy-mvebu-sata.c @@ -83,7 +83,7 @@ static int phy_mvebu_sata_probe(struct platform_device *pdev) struct priv *priv; struct phy *phy; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/marvell/phy-pxa-28nm-hsic.c b/drivers/phy/marvell/phy-pxa-28nm-hsic.c index eff6dd6b2dd0..a5d635659c7b 100644 --- a/drivers/phy/marvell/phy-pxa-28nm-hsic.c +++ b/drivers/phy/marvell/phy-pxa-28nm-hsic.c @@ -163,7 +163,7 @@ static int mv_hsic_phy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; struct mv_hsic_phy *mv_phy; - mv_phy = devm_kzalloc(&pdev->dev, sizeof(*mv_phy), GFP_KERNEL); + mv_phy = devm_kzalloc_obj(&pdev->dev, *mv_phy); if (!mv_phy) return -ENOMEM; diff --git a/drivers/phy/marvell/phy-pxa-28nm-usb2.c b/drivers/phy/marvell/phy-pxa-28nm-usb2.c index 64afb82cf70e..b676e879260e 100644 --- a/drivers/phy/marvell/phy-pxa-28nm-usb2.c +++ b/drivers/phy/marvell/phy-pxa-28nm-usb2.c @@ -294,7 +294,7 @@ static int mv_usb2_phy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; struct mv_usb2_phy *mv_phy; - mv_phy = devm_kzalloc(&pdev->dev, sizeof(*mv_phy), GFP_KERNEL); + mv_phy = devm_kzalloc_obj(&pdev->dev, *mv_phy); if (!mv_phy) return -ENOMEM; diff --git a/drivers/phy/marvell/phy-pxa-usb.c b/drivers/phy/marvell/phy-pxa-usb.c index c0bb71f80c04..51b88372ec91 100644 --- a/drivers/phy/marvell/phy-pxa-usb.c +++ b/drivers/phy/marvell/phy-pxa-usb.c @@ -290,7 +290,7 @@ static int pxa_usb_phy_probe(struct platform_device *pdev) struct phy_provider *provider; const struct of_device_id *of_id; - pxa_usb_phy = devm_kzalloc(dev, sizeof(struct pxa_usb_phy), GFP_KERNEL); + pxa_usb_phy = devm_kzalloc_obj(dev, struct pxa_usb_phy); if (!pxa_usb_phy) return -ENOMEM; diff --git a/drivers/phy/mediatek/phy-mtk-dp.c b/drivers/phy/mediatek/phy-mtk-dp.c index dbef4a4bd60a..0048e1a8c60d 100644 --- a/drivers/phy/mediatek/phy-mtk-dp.c +++ b/drivers/phy/mediatek/phy-mtk-dp.c @@ -709,7 +709,7 @@ static int mtk_dp_phy_probe(struct platform_device *pdev) struct phy *phy; int ret; - dp_phy = devm_kzalloc(dev, sizeof(*dp_phy), GFP_KERNEL); + dp_phy = devm_kzalloc_obj(dev, *dp_phy); if (!dp_phy) return -ENOMEM; diff --git a/drivers/phy/mediatek/phy-mtk-hdmi.c b/drivers/phy/mediatek/phy-mtk-hdmi.c index 52a7d525ff9b..d063fc787c28 100644 --- a/drivers/phy/mediatek/phy-mtk-hdmi.c +++ b/drivers/phy/mediatek/phy-mtk-hdmi.c @@ -112,7 +112,7 @@ static int mtk_hdmi_phy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; int ret; - hdmi_phy = devm_kzalloc(dev, sizeof(*hdmi_phy), GFP_KERNEL); + hdmi_phy = devm_kzalloc_obj(dev, *hdmi_phy); if (!hdmi_phy) return -ENOMEM; diff --git a/drivers/phy/mediatek/phy-mtk-mipi-csi-0-5.c b/drivers/phy/mediatek/phy-mtk-mipi-csi-0-5.c index 058e1d926630..506cc7c6f000 100644 --- a/drivers/phy/mediatek/phy-mtk-mipi-csi-0-5.c +++ b/drivers/phy/mediatek/phy-mtk-mipi-csi-0-5.c @@ -216,7 +216,7 @@ static int mtk_mipi_cdphy_probe(struct platform_device *pdev) int ret; u32 phy_type; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; diff --git a/drivers/phy/mediatek/phy-mtk-mipi-dsi.c b/drivers/phy/mediatek/phy-mtk-mipi-dsi.c index 46f0cb3ac096..29168a40b7a8 100644 --- a/drivers/phy/mediatek/phy-mtk-mipi-dsi.c +++ b/drivers/phy/mediatek/phy-mtk-mipi-dsi.c @@ -117,7 +117,7 @@ static int mtk_mipi_tx_probe(struct platform_device *pdev) struct phy_provider *phy_provider; int ret; - mipi_tx = devm_kzalloc(dev, sizeof(*mipi_tx), GFP_KERNEL); + mipi_tx = devm_kzalloc_obj(dev, *mipi_tx); if (!mipi_tx) return -ENOMEM; diff --git a/drivers/phy/mediatek/phy-mtk-pcie-sphy.c b/drivers/phy/mediatek/phy-mtk-pcie-sphy.c index 2bf10346ea97..253a68b19fbe 100644 --- a/drivers/phy/mediatek/phy-mtk-pcie-sphy.c +++ b/drivers/phy/mediatek/phy-mtk-pcie-sphy.c @@ -494,7 +494,7 @@ static int mtk_pcie_sphy_probe(struct platform_device *pdev) u32 num_lanes; int ret; - pcie_sphy = devm_kzalloc(dev, sizeof(*pcie_sphy), GFP_KERNEL); + pcie_sphy = devm_kzalloc_obj(dev, *pcie_sphy); if (!pcie_sphy) return -ENOMEM; diff --git a/drivers/phy/mediatek/phy-mtk-pcie.c b/drivers/phy/mediatek/phy-mtk-pcie.c index a2f69d6c72f0..a605431459c7 100644 --- a/drivers/phy/mediatek/phy-mtk-pcie.c +++ b/drivers/phy/mediatek/phy-mtk-pcie.c @@ -202,7 +202,7 @@ static int mtk_pcie_phy_probe(struct platform_device *pdev) struct mtk_pcie_phy *pcie_phy; int ret; - pcie_phy = devm_kzalloc(dev, sizeof(*pcie_phy), GFP_KERNEL); + pcie_phy = devm_kzalloc_obj(dev, *pcie_phy); if (!pcie_phy) return -ENOMEM; diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c index acf506529507..22273a4df9b2 100644 --- a/drivers/phy/mediatek/phy-mtk-tphy.c +++ b/drivers/phy/mediatek/phy-mtk-tphy.c @@ -1573,7 +1573,7 @@ static int mtk_tphy_probe(struct platform_device *pdev) struct resource res; int port, ret; - tphy = devm_kzalloc(dev, sizeof(*tphy), GFP_KERNEL); + tphy = devm_kzalloc_obj(dev, *tphy); if (!tphy) return -ENOMEM; @@ -1582,8 +1582,7 @@ static int mtk_tphy_probe(struct platform_device *pdev) return -EINVAL; tphy->nphys = of_get_child_count(np); - tphy->phys = devm_kcalloc(dev, tphy->nphys, - sizeof(*tphy->phys), GFP_KERNEL); + tphy->phys = devm_kzalloc_objs(dev, *tphy->phys, tphy->nphys); if (!tphy->phys) return -ENOMEM; @@ -1618,7 +1617,7 @@ static int mtk_tphy_probe(struct platform_device *pdev) struct phy *phy; int retval; - instance = devm_kzalloc(dev, sizeof(*instance), GFP_KERNEL); + instance = devm_kzalloc_obj(dev, *instance); if (!instance) return -ENOMEM; diff --git a/drivers/phy/mediatek/phy-mtk-ufs.c b/drivers/phy/mediatek/phy-mtk-ufs.c index fc19e0fa8ed5..8acd5bb1d916 100644 --- a/drivers/phy/mediatek/phy-mtk-ufs.c +++ b/drivers/phy/mediatek/phy-mtk-ufs.c @@ -154,7 +154,7 @@ static int ufs_mtk_phy_probe(struct platform_device *pdev) struct ufs_mtk_phy *phy; int ret; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/mediatek/phy-mtk-xfi-tphy.c b/drivers/phy/mediatek/phy-mtk-xfi-tphy.c index 100a50d0e861..3dbc52eac3cf 100644 --- a/drivers/phy/mediatek/phy-mtk-xfi-tphy.c +++ b/drivers/phy/mediatek/phy-mtk-xfi-tphy.c @@ -399,7 +399,7 @@ static int mtk_xfi_tphy_probe(struct platform_device *pdev) if (!np) return -ENODEV; - xfi_tphy = devm_kzalloc(&pdev->dev, sizeof(*xfi_tphy), GFP_KERNEL); + xfi_tphy = devm_kzalloc_obj(&pdev->dev, *xfi_tphy); if (!xfi_tphy) return -ENOMEM; diff --git a/drivers/phy/mediatek/phy-mtk-xsphy.c b/drivers/phy/mediatek/phy-mtk-xsphy.c index 597186de48c5..4c2db497a8f8 100644 --- a/drivers/phy/mediatek/phy-mtk-xsphy.c +++ b/drivers/phy/mediatek/phy-mtk-xsphy.c @@ -549,7 +549,7 @@ static int mtk_xsphy_probe(struct platform_device *pdev) int port; nphys = of_get_child_count(np); - xsphy = devm_kzalloc(dev, struct_size(xsphy, phys, nphys), GFP_KERNEL); + xsphy = devm_kzalloc_flex(dev, *xsphy, phys, nphys); if (!xsphy) return -ENOMEM; @@ -581,7 +581,7 @@ static int mtk_xsphy_probe(struct platform_device *pdev) struct phy *phy; int retval; - inst = devm_kzalloc(dev, sizeof(*inst), GFP_KERNEL); + inst = devm_kzalloc_obj(dev, *inst); if (!inst) return -ENOMEM; diff --git a/drivers/phy/microchip/lan966x_serdes.c b/drivers/phy/microchip/lan966x_serdes.c index 835e369cdfc5..caa43338d3fa 100644 --- a/drivers/phy/microchip/lan966x_serdes.c +++ b/drivers/phy/microchip/lan966x_serdes.c @@ -550,7 +550,7 @@ static int serdes_phy_create(struct serdes_ctrl *ctrl, u8 idx, struct phy **phy) if (IS_ERR(*phy)) return PTR_ERR(*phy); - macro = devm_kzalloc(ctrl->dev, sizeof(*macro), GFP_KERNEL); + macro = devm_kzalloc_obj(ctrl->dev, *macro); if (!macro) return -ENOMEM; @@ -572,7 +572,7 @@ static int serdes_probe(struct platform_device *pdev) u32 val; int ret; - ctrl = devm_kzalloc(&pdev->dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(&pdev->dev, *ctrl); if (!ctrl) return -ENOMEM; diff --git a/drivers/phy/microchip/sparx5_serdes.c b/drivers/phy/microchip/sparx5_serdes.c index 320cf5b50a8c..3e7caa8e6418 100644 --- a/drivers/phy/microchip/sparx5_serdes.c +++ b/drivers/phy/microchip/sparx5_serdes.c @@ -2441,7 +2441,7 @@ static int sparx5_phy_create(struct sparx5_serdes_private *priv, if (IS_ERR(*phy)) return PTR_ERR(*phy); - macro = devm_kzalloc(priv->dev, sizeof(*macro), GFP_KERNEL); + macro = devm_kzalloc_obj(priv->dev, *macro); if (!macro) return -ENOMEM; @@ -2662,7 +2662,7 @@ static int sparx5_serdes_probe(struct platform_device *pdev) if (!np && !pdev->dev.platform_data) return -ENODEV; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/motorola/phy-cpcap-usb.c b/drivers/phy/motorola/phy-cpcap-usb.c index 9591672b0511..bcf3e1990d08 100644 --- a/drivers/phy/motorola/phy-cpcap-usb.c +++ b/drivers/phy/motorola/phy-cpcap-usb.c @@ -613,7 +613,7 @@ static int cpcap_usb_phy_probe(struct platform_device *pdev) struct usb_otg *otg; int error; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; @@ -621,7 +621,7 @@ static int cpcap_usb_phy_probe(struct platform_device *pdev) if (!ddata->reg) return -ENODEV; - otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL); + otg = devm_kzalloc_obj(&pdev->dev, *otg); if (!otg) return -ENOMEM; diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c index fd0e0cd1c1cf..ff364a990187 100644 --- a/drivers/phy/motorola/phy-mapphone-mdm6600.c +++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c @@ -557,7 +557,7 @@ static int phy_mdm6600_probe(struct platform_device *pdev) struct phy_mdm6600 *ddata; int error; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/phy/mscc/phy-ocelot-serdes.c b/drivers/phy/mscc/phy-ocelot-serdes.c index 1cd1b5db2ad7..36bb5468158a 100644 --- a/drivers/phy/mscc/phy-ocelot-serdes.c +++ b/drivers/phy/mscc/phy-ocelot-serdes.c @@ -477,7 +477,7 @@ static int serdes_phy_create(struct serdes_ctrl *ctrl, u8 idx, struct phy **phy) if (IS_ERR(*phy)) return PTR_ERR(*phy); - macro = devm_kzalloc(ctrl->dev, sizeof(*macro), GFP_KERNEL); + macro = devm_kzalloc_obj(ctrl->dev, *macro); if (!macro) return -ENOMEM; @@ -498,7 +498,7 @@ static int serdes_probe(struct platform_device *pdev) unsigned int i; int ret; - ctrl = devm_kzalloc(&pdev->dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(&pdev->dev, *ctrl); if (!ctrl) return -ENOMEM; diff --git a/drivers/phy/nuvoton/phy-ma35d1-usb2.c b/drivers/phy/nuvoton/phy-ma35d1-usb2.c index 9a459b700ed4..205cc04cde6c 100644 --- a/drivers/phy/nuvoton/phy-ma35d1-usb2.c +++ b/drivers/phy/nuvoton/phy-ma35d1-usb2.c @@ -93,7 +93,7 @@ static int ma35_usb_phy_probe(struct platform_device *pdev) struct ma35_usb_phy *p_phy; struct phy *phy; - p_phy = devm_kzalloc(&pdev->dev, sizeof(*p_phy), GFP_KERNEL); + p_phy = devm_kzalloc_obj(&pdev->dev, *p_phy); if (!p_phy) return -ENOMEM; diff --git a/drivers/phy/phy-airoha-pcie.c b/drivers/phy/phy-airoha-pcie.c index 56e9ade8a9fd..2ad7d386e47b 100644 --- a/drivers/phy/phy-airoha-pcie.c +++ b/drivers/phy/phy-airoha-pcie.c @@ -1218,7 +1218,7 @@ static int airoha_pcie_phy_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct phy_provider *provider; - pcie_phy = devm_kzalloc(dev, sizeof(*pcie_phy), GFP_KERNEL); + pcie_phy = devm_kzalloc_obj(dev, *pcie_phy); if (!pcie_phy) return -ENOMEM; diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transceiver.c index 9aa30662105f..923aa560bbd5 100644 --- a/drivers/phy/phy-can-transceiver.c +++ b/drivers/phy/phy-can-transceiver.c @@ -140,7 +140,7 @@ static int can_transceiver_phy_probe(struct platform_device *pdev) else num_ch = 1; - priv = devm_kzalloc(dev, struct_size(priv, can_transceiver_phy, num_ch), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, can_transceiver_phy, num_ch); if (!priv) return -ENOMEM; diff --git a/drivers/phy/phy-econet-pcie.c b/drivers/phy/phy-econet-pcie.c index 96be69d1ffeb..4855e4b7ed19 100644 --- a/drivers/phy/phy-econet-pcie.c +++ b/drivers/phy/phy-econet-pcie.c @@ -129,7 +129,7 @@ static int en75_pcie_phy_probe(struct platform_device *pdev) if (!data) return -EINVAL; - ephy = devm_kzalloc(dev, sizeof(*ephy), GFP_KERNEL); + ephy = devm_kzalloc_obj(dev, *ephy); if (!ephy) return -ENOMEM; diff --git a/drivers/phy/phy-eyeq5-eth.c b/drivers/phy/phy-eyeq5-eth.c index d1107bc605c1..fae147268f5f 100644 --- a/drivers/phy/phy-eyeq5-eth.c +++ b/drivers/phy/phy-eyeq5-eth.c @@ -236,7 +236,7 @@ static int eq5_phy_probe(struct auxiliary_device *adev, void __iomem *base; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/phy-google-usb.c b/drivers/phy/phy-google-usb.c index 70d3a3833948..2acdb2b0e534 100644 --- a/drivers/phy/phy-google-usb.c +++ b/drivers/phy/phy-google-usb.c @@ -494,7 +494,7 @@ static int google_usb_phy_parse_clocks(struct google_usb_phy *gphy) struct google_usb_phy_instance *inst = &gphy->insts[id]; inst->num_clks = cfg->num_clks; - inst->clks = devm_kcalloc(dev, inst->num_clks, sizeof(*inst->clks), GFP_KERNEL); + inst->clks = devm_kzalloc_objs(dev, *inst->clks, inst->num_clks); if (!inst->clks) return -ENOMEM; @@ -519,7 +519,7 @@ static int google_usb_phy_parse_resets(struct google_usb_phy *gphy) struct google_usb_phy_instance *inst = &gphy->insts[id]; inst->num_rsts = cfg->num_rsts; - inst->rsts = devm_kcalloc(dev, inst->num_rsts, sizeof(*inst->rsts), GFP_KERNEL); + inst->rsts = devm_kzalloc_objs(dev, *inst->rsts, inst->num_rsts); if (!inst->rsts) return -ENOMEM; @@ -542,7 +542,7 @@ static int google_usb_phy_probe(struct platform_device *pdev) u32 args[1]; int ret; - gphy = devm_kzalloc(dev, sizeof(*gphy), GFP_KERNEL); + gphy = devm_kzalloc_obj(dev, *gphy); if (!gphy) return -ENOMEM; @@ -576,7 +576,7 @@ static int google_usb_phy_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(gphy->usb3_tca_base), "invalid usb3 tca\n"); - gphy->insts = devm_kcalloc(dev, GOOGLE_USB_PHY_NUM, sizeof(*gphy->insts), GFP_KERNEL); + gphy->insts = devm_kzalloc_objs(dev, *gphy->insts, GOOGLE_USB_PHY_NUM); if (!gphy->insts) return -ENOMEM; diff --git a/drivers/phy/phy-lgm-usb.c b/drivers/phy/phy-lgm-usb.c index eb7c6fed20d3..0bbbb4232864 100644 --- a/drivers/phy/phy-lgm-usb.c +++ b/drivers/phy/phy-lgm-usb.c @@ -192,7 +192,7 @@ static int phy_probe(struct platform_device *pdev) struct tca_apb *ta; int i; - ta = devm_kzalloc(dev, sizeof(*ta), GFP_KERNEL); + ta = devm_kzalloc_obj(dev, *ta); if (!ta) return -ENOMEM; diff --git a/drivers/phy/phy-lpc18xx-usb-otg.c b/drivers/phy/phy-lpc18xx-usb-otg.c index f905d3c64584..360b49ad962a 100644 --- a/drivers/phy/phy-lpc18xx-usb-otg.c +++ b/drivers/phy/phy-lpc18xx-usb-otg.c @@ -95,7 +95,7 @@ static int lpc18xx_usb_otg_phy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; struct lpc18xx_usb_otg_phy *lpc; - lpc = devm_kzalloc(&pdev->dev, sizeof(*lpc), GFP_KERNEL); + lpc = devm_kzalloc_obj(&pdev->dev, *lpc); if (!lpc) return -ENOMEM; diff --git a/drivers/phy/phy-nxp-ptn3222.c b/drivers/phy/phy-nxp-ptn3222.c index 6cb79b5c4fdb..b4ed99d957e8 100644 --- a/drivers/phy/phy-nxp-ptn3222.c +++ b/drivers/phy/phy-nxp-ptn3222.c @@ -66,7 +66,7 @@ static int ptn3222_probe(struct i2c_client *client) struct ptn3222 *ptn3222; int ret; - ptn3222 = devm_kzalloc(dev, sizeof(*ptn3222), GFP_KERNEL); + ptn3222 = devm_kzalloc_obj(dev, *ptn3222); if (!ptn3222) return -ENOMEM; diff --git a/drivers/phy/phy-pistachio-usb.c b/drivers/phy/phy-pistachio-usb.c index 231792f48ced..e0884708317e 100644 --- a/drivers/phy/phy-pistachio-usb.c +++ b/drivers/phy/phy-pistachio-usb.c @@ -136,7 +136,7 @@ static int pistachio_usb_phy_probe(struct platform_device *pdev) struct phy *phy; int ret; - p_phy = devm_kzalloc(&pdev->dev, sizeof(*p_phy), GFP_KERNEL); + p_phy = devm_kzalloc_obj(&pdev->dev, *p_phy); if (!p_phy) return -ENOMEM; p_phy->dev = &pdev->dev; diff --git a/drivers/phy/phy-snps-eusb2.c b/drivers/phy/phy-snps-eusb2.c index af4fa17ac6cb..ee473b32f116 100644 --- a/drivers/phy/phy-snps-eusb2.c +++ b/drivers/phy/phy-snps-eusb2.c @@ -533,7 +533,7 @@ static int snps_eusb2_hsphy_probe(struct platform_device *pdev) int ret, i; int num; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; @@ -549,8 +549,7 @@ static int snps_eusb2_hsphy_probe(struct platform_device *pdev) if (IS_ERR(phy->phy_reset)) return PTR_ERR(phy->phy_reset); - phy->clks = devm_kcalloc(dev, phy->data->num_clks, sizeof(*phy->clks), - GFP_KERNEL); + phy->clks = devm_kzalloc_objs(dev, *phy->clks, phy->data->num_clks); if (!phy->clks) return -ENOMEM; diff --git a/drivers/phy/phy-xgene.c b/drivers/phy/phy-xgene.c index 59f18e16bbbb..615e9fca97a2 100644 --- a/drivers/phy/phy-xgene.c +++ b/drivers/phy/phy-xgene.c @@ -1656,7 +1656,7 @@ static int xgene_phy_probe(struct platform_device *pdev) u32 default_txcp1[] = DEFAULT_SATA_TXCP1; int i; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-ath79-usb.c b/drivers/phy/qualcomm/phy-ath79-usb.c index 09a77e556ece..ec8d061d54ff 100644 --- a/drivers/phy/qualcomm/phy-ath79-usb.c +++ b/drivers/phy/qualcomm/phy-ath79-usb.c @@ -65,7 +65,7 @@ static int ath79_usb_phy_probe(struct platform_device *pdev) struct ath79_usb_phy *priv; struct phy *phy; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c b/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c index cae290a6e19f..6db7054da01b 100644 --- a/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c +++ b/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c @@ -205,7 +205,7 @@ static int qcom_apq8064_sata_phy_probe(struct platform_device *pdev) struct phy *generic_phy; int ret; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-edp.c b/drivers/phy/qualcomm/phy-qcom-edp.c index a3c893f72908..5e773843d6e6 100644 --- a/drivers/phy/qualcomm/phy-qcom-edp.c +++ b/drivers/phy/qualcomm/phy-qcom-edp.c @@ -1385,7 +1385,7 @@ static int qcom_edp_clks_register(struct qcom_edp *edp, struct device_node *np) char name[64]; int ret; - data = devm_kzalloc(edp->dev, struct_size(data, hws, 2), GFP_KERNEL); + data = devm_kzalloc_flex(edp->dev, *data, hws, 2); if (!data) return -ENOMEM; data->num = 2; @@ -1419,7 +1419,7 @@ static int qcom_edp_phy_probe(struct platform_device *pdev) struct qcom_edp *edp; int ret; - edp = devm_kzalloc(dev, sizeof(*edp), GFP_KERNEL); + edp = devm_kzalloc_obj(dev, *edp); if (!edp) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c index 89bc1c89fc85..ae0085473886 100644 --- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c +++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c @@ -128,7 +128,7 @@ static int eusb2_repeater_init_vregs(struct eusb2_repeater *rptr) struct device *dev = rptr->dev; int i; - rptr->vregs = devm_kcalloc(dev, num, sizeof(*rptr->vregs), GFP_KERNEL); + rptr->vregs = devm_kzalloc_objs(dev, *rptr->vregs, num); if (!rptr->vregs) return -ENOMEM; @@ -254,7 +254,7 @@ static int eusb2_repeater_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; int ret; - rptr = devm_kzalloc(dev, sizeof(*rptr), GFP_KERNEL); + rptr = devm_kzalloc_obj(dev, *rptr); if (!rptr) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c b/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c index da6f290af722..13ccad70e77a 100644 --- a/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c @@ -97,7 +97,7 @@ static int ipq4019_usb_phy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; struct ipq4019_usb_phy *phy; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-ipq806x-sata.c b/drivers/phy/qualcomm/phy-qcom-ipq806x-sata.c index f5eb0bdac418..2bf1c6491b14 100644 --- a/drivers/phy/qualcomm/phy-qcom-ipq806x-sata.c +++ b/drivers/phy/qualcomm/phy-qcom-ipq806x-sata.c @@ -132,7 +132,7 @@ static int qcom_ipq806x_sata_phy_probe(struct platform_device *pdev) struct phy *generic_phy; int ret; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c b/drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c index f22c0000479f..c7e726d00edc 100644 --- a/drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c @@ -487,7 +487,7 @@ static int qcom_ipq806x_usb_phy_probe(struct platform_device *pdev) const struct phy_drvdata *data; struct phy_provider *phy_provider; - phy_dwc3 = devm_kzalloc(&pdev->dev, sizeof(*phy_dwc3), GFP_KERNEL); + phy_dwc3 = devm_kzalloc_obj(&pdev->dev, *phy_dwc3); if (!phy_dwc3) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c b/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c index 275df38256de..d0cdd80ae1ad 100644 --- a/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c +++ b/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c @@ -250,7 +250,7 @@ static int m31eusb2_phy_probe(struct platform_device *pdev) struct m31eusb2_phy *phy; int ret; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-m31.c b/drivers/phy/qualcomm/phy-qcom-m31.c index 168ea980fda0..8287ce8b659e 100644 --- a/drivers/phy/qualcomm/phy-qcom-m31.c +++ b/drivers/phy/qualcomm/phy-qcom-m31.c @@ -276,7 +276,7 @@ static int m31usb_phy_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct m31usb_phy *qphy; - qphy = devm_kzalloc(dev, sizeof(*qphy), GFP_KERNEL); + qphy = devm_kzalloc_obj(dev, *qphy); if (!qphy) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c index c0a4fa20eaf0..e04bde03e278 100644 --- a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c +++ b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c @@ -350,7 +350,7 @@ static int phy_qcom_mipi_csi2_probe(struct platform_device *pdev) struct phy *generic_phy; int ret; - csi2phy = devm_kzalloc(dev, sizeof(*csi2phy), GFP_KERNEL); + csi2phy = devm_kzalloc_obj(dev, *csi2phy); if (!csi2phy) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-pcie2.c b/drivers/phy/qualcomm/phy-qcom-pcie2.c index 11a2bb958681..2fb80453d4fc 100644 --- a/drivers/phy/qualcomm/phy-qcom-pcie2.c +++ b/drivers/phy/qualcomm/phy-qcom-pcie2.c @@ -233,7 +233,7 @@ static int phy_pipe_clksrc_register(struct qcom_phy *qphy) return ret; } - fixed = devm_kzalloc(qphy->dev, sizeof(*fixed), GFP_KERNEL); + fixed = devm_kzalloc_obj(qphy->dev, *fixed); if (!fixed) return -ENOMEM; @@ -258,7 +258,7 @@ static int qcom_pcie2_phy_probe(struct platform_device *pdev) struct phy *phy; int ret; - qphy = devm_kzalloc(dev, sizeof(*qphy), GFP_KERNEL); + qphy = devm_kzalloc_obj(dev, *qphy); if (!qphy) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index 187f0cd11f6c..61d8b7a5ce8f 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -4770,8 +4770,7 @@ static int qmp_combo_reset_init(struct qmp_combo *qmp) int i; int ret; - qmp->resets = devm_kcalloc(dev, cfg->num_resets, - sizeof(*qmp->resets), GFP_KERNEL); + qmp->resets = devm_kzalloc_objs(dev, *qmp->resets, cfg->num_resets); if (!qmp->resets) return -ENOMEM; @@ -4791,7 +4790,7 @@ static int qmp_combo_clk_init(struct qmp_combo *qmp) int num = ARRAY_SIZE(qmp_combo_phy_clk_l); int i; - qmp->clks = devm_kcalloc(dev, num, sizeof(*qmp->clks), GFP_KERNEL); + qmp->clks = devm_kzalloc_objs(dev, *qmp->clks, num); if (!qmp->clks) return -ENOMEM; @@ -5507,7 +5506,7 @@ static int qmp_combo_probe(struct platform_device *pdev) struct phy_provider *phy_provider; int ret; - qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); + qmp = devm_kzalloc_obj(dev, *qmp); if (!qmp) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c index ed22b7a256ef..f07872673dcb 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c @@ -508,7 +508,7 @@ static int qmp_pcie_msm8996_vreg_init(struct device *dev, const struct qmp_phy_c int num = cfg->num_vregs; int i; - qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL); + qmp->vregs = devm_kzalloc_objs(dev, *qmp->vregs, num); if (!qmp->vregs) return -ENOMEM; @@ -524,8 +524,7 @@ static int qmp_pcie_msm8996_reset_init(struct device *dev, const struct qmp_phy_ int i; int ret; - qmp->resets = devm_kcalloc(dev, cfg->num_resets, - sizeof(*qmp->resets), GFP_KERNEL); + qmp->resets = devm_kzalloc_objs(dev, *qmp->resets, cfg->num_resets); if (!qmp->resets) return -ENOMEM; @@ -545,7 +544,7 @@ static int qmp_pcie_msm8996_clk_init(struct device *dev, const struct qmp_phy_cf int num = cfg->num_clks; int i; - qmp->clks = devm_kcalloc(dev, num, sizeof(*qmp->clks), GFP_KERNEL); + qmp->clks = devm_kzalloc_objs(dev, *qmp->clks, num); if (!qmp->clks) return -ENOMEM; @@ -590,7 +589,7 @@ static int phy_pipe_clk_register(struct qcom_qmp *qmp, struct device_node *np) return ret; } - fixed = devm_kzalloc(qmp->dev, sizeof(*fixed), GFP_KERNEL); + fixed = devm_kzalloc_obj(qmp->dev, *fixed); if (!fixed) return -ENOMEM; @@ -634,7 +633,7 @@ static int qmp_pcie_msm8996_create(struct device *dev, struct device_node *np, i struct qmp_phy *qphy; int ret; - qphy = devm_kzalloc(dev, sizeof(*qphy), GFP_KERNEL); + qphy = devm_kzalloc_obj(dev, *qphy); if (!qphy) return -ENOMEM; @@ -707,7 +706,7 @@ static int qmp_pcie_msm8996_probe(struct platform_device *pdev) int num, id, expected_phys; int ret; - qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); + qmp = devm_kzalloc_obj(dev, *qmp); if (!qmp) return -ENOMEM; @@ -743,7 +742,7 @@ static int qmp_pcie_msm8996_probe(struct platform_device *pdev) if (num > expected_phys) return -EINVAL; - qmp->phys = devm_kcalloc(dev, num, sizeof(*qmp->phys), GFP_KERNEL); + qmp->phys = devm_kzalloc_objs(dev, *qmp->phys, num); if (!qmp->phys) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie-multiphy.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie-multiphy.c index 3d225c0bb80e..ccdb7748a9e1 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie-multiphy.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie-multiphy.c @@ -1205,8 +1205,7 @@ static int qmp_pcie_pd_init(struct qmp_pcie *qmp, struct phy *phy) if (!cfg->num_pds) return 0; - qmp->pd_devs = devm_kcalloc(pd_dev, cfg->num_pds, sizeof(*qmp->pd_devs), - GFP_KERNEL); + qmp->pd_devs = devm_kzalloc_objs(pd_dev, *qmp->pd_devs, cfg->num_pds); if (!qmp->pd_devs) return -ENOMEM; @@ -1229,8 +1228,7 @@ static int qmp_pcie_vreg_init(struct qmp_pcie *qmp) struct device *dev = qmp->dev; int i; - qmp->vregs = devm_kcalloc(dev, cfg->num_vregs, sizeof(*qmp->vregs), - GFP_KERNEL); + qmp->vregs = devm_kzalloc_objs(dev, *qmp->vregs, cfg->num_vregs); if (!qmp->vregs) return -ENOMEM; @@ -1247,8 +1245,8 @@ static int qmp_pcie_reset_init(struct qmp_pcie *qmp) int i, ret; if (cfg->num_resets) { - qmp->resets = devm_kcalloc(dev, cfg->num_resets, - sizeof(*qmp->resets), GFP_KERNEL); + qmp->resets = devm_kzalloc_objs(dev, *qmp->resets, + cfg->num_resets); if (!qmp->resets) return -ENOMEM; @@ -1262,9 +1260,8 @@ static int qmp_pcie_reset_init(struct qmp_pcie *qmp) } if (cfg->num_nocsr_resets) { - qmp->nocsr_resets = devm_kcalloc(dev, cfg->num_nocsr_resets, - sizeof(*qmp->nocsr_resets), - GFP_KERNEL); + qmp->nocsr_resets = devm_kzalloc_objs(dev, *qmp->nocsr_resets, + cfg->num_nocsr_resets); if (!qmp->nocsr_resets) return -ENOMEM; @@ -1287,8 +1284,7 @@ static int qmp_pcie_clk_init(struct qmp_pcie *qmp) struct device *dev = qmp->dev; int i, ret; - qmp->clks = devm_kcalloc(dev, cfg->num_clks, sizeof(*qmp->clks), - GFP_KERNEL); + qmp->clks = devm_kzalloc_objs(dev, *qmp->clks, cfg->num_clks); if (!qmp->clks) return -ENOMEM; @@ -1299,8 +1295,8 @@ static int qmp_pcie_clk_init(struct qmp_pcie *qmp) if (ret) return ret; - qmp->pipe_clks = devm_kcalloc(dev, cfg->num_pipe_clks, - sizeof(*qmp->pipe_clks), GFP_KERNEL); + qmp->pipe_clks = devm_kzalloc_objs(dev, *qmp->pipe_clks, + cfg->num_pipe_clks); if (!qmp->pipe_clks) return -ENOMEM; @@ -1361,9 +1357,9 @@ static int qmp_pcie_multiphy_register_clocks(struct device *dev, "failed to read clock-output-names\n"); qmp_data->num_pipe_outputs = num_pipe_outputs; - qmp_data->pipe_out_clks = devm_kcalloc(dev, num_pipe_outputs, - sizeof(*qmp_data->pipe_out_clks), - GFP_KERNEL); + qmp_data->pipe_out_clks = devm_kzalloc_objs(dev, + *qmp_data->pipe_out_clks, + num_pipe_outputs); if (!qmp_data->pipe_out_clks) return -ENOMEM; @@ -1385,8 +1381,7 @@ static int qmp_pcie_get_mmio(struct qmp_pcie *qmp) void __iomem *base; int i; - qmp->base = devm_kcalloc(dev, cfg->num_regs, sizeof(*qmp->base), - GFP_KERNEL); + qmp->base = devm_kzalloc_objs(dev, *qmp->base, cfg->num_regs); if (!qmp->base) return -ENOMEM; @@ -1479,7 +1474,7 @@ static int qmp_pcie_multiphy_probe(struct platform_device *pdev) int phy_index; int ret; - qmp_data = devm_kzalloc(dev, sizeof(*qmp_data), GFP_KERNEL); + qmp_data = devm_kzalloc_obj(dev, *qmp_data); if (!qmp_data) return -ENOMEM; @@ -1497,11 +1492,11 @@ static int qmp_pcie_multiphy_probe(struct platform_device *pdev) qmp_data->mode_cfg = &match_data->mode_cfgs[link_mode]; - qmp = devm_kcalloc(dev, qmp_data->mode_cfg->num_phys, sizeof(*qmp), GFP_KERNEL); + qmp = devm_kzalloc_objs(dev, *qmp, qmp_data->mode_cfg->num_phys); if (!qmp) return -ENOMEM; - phys = devm_kcalloc(dev, qmp_data->mode_cfg->num_phys, sizeof(*phys), GFP_KERNEL); + phys = devm_kzalloc_objs(dev, *phys, qmp_data->mode_cfg->num_phys); if (!phys) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c index 9cfabf474fd6..b9fe3ce94227 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c @@ -5969,7 +5969,7 @@ static int qmp_pcie_vreg_init(struct qmp_pcie *qmp) int num = cfg->num_vregs; int i; - qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL); + qmp->vregs = devm_kzalloc_objs(dev, *qmp->vregs, num); if (!qmp->vregs) return -ENOMEM; @@ -5986,8 +5986,7 @@ static int qmp_pcie_reset_init(struct qmp_pcie *qmp) int i; int ret; - qmp->resets = devm_kcalloc(dev, cfg->num_resets, - sizeof(*qmp->resets), GFP_KERNEL); + qmp->resets = devm_kzalloc_objs(dev, *qmp->resets, cfg->num_resets); if (!qmp->resets) return -ENOMEM; @@ -6012,7 +6011,7 @@ static int qmp_pcie_clk_init(struct qmp_pcie *qmp) int num = ARRAY_SIZE(qmp_pciephy_clk_l); int i; - qmp->clks = devm_kcalloc(dev, num, sizeof(*qmp->clks), GFP_KERNEL); + qmp->clks = devm_kzalloc_objs(dev, *qmp->clks, num); if (!qmp->clks) return -ENOMEM; @@ -6332,7 +6331,7 @@ static int qmp_pcie_probe(struct platform_device *pdev) struct qmp_pcie *qmp; int ret; - qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); + qmp = devm_kzalloc_obj(dev, *qmp); if (!qmp) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c index d15db9ab9a90..969379792794 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c @@ -2192,9 +2192,8 @@ static int qmp_ufs_register_clocks(struct qmp_ufs *qmp, struct device_node *np) char name[64]; int ret; - clk_data = devm_kzalloc(qmp->dev, - struct_size(clk_data, hws, UFS_SYMBOL_CLOCKS), - GFP_KERNEL); + clk_data = devm_kzalloc_flex(qmp->dev, *clk_data, hws, + UFS_SYMBOL_CLOCKS); if (!clk_data) return -ENOMEM; @@ -2314,7 +2313,7 @@ static int qmp_ufs_probe(struct platform_device *pdev) struct qmp_ufs *qmp; int ret; - qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); + qmp = devm_kzalloc_obj(dev, *qmp); if (!qmp) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c index c5160cb89207..b2271a68ff82 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c @@ -1050,7 +1050,7 @@ static int qmp_usb_legacy_vreg_init(struct qmp_usb *qmp) int num = cfg->num_vregs; int i; - qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL); + qmp->vregs = devm_kzalloc_objs(dev, *qmp->vregs, num); if (!qmp->vregs) return -ENOMEM; @@ -1067,8 +1067,7 @@ static int qmp_usb_legacy_reset_init(struct qmp_usb *qmp) int i; int ret; - qmp->resets = devm_kcalloc(dev, cfg->num_resets, - sizeof(*qmp->resets), GFP_KERNEL); + qmp->resets = devm_kzalloc_objs(dev, *qmp->resets, cfg->num_resets); if (!qmp->resets) return -ENOMEM; @@ -1089,7 +1088,7 @@ static int qmp_usb_legacy_clk_init(struct qmp_usb *qmp) int num = cfg->num_clks; int i; - qmp->clks = devm_kcalloc(dev, num, sizeof(*qmp->clks), GFP_KERNEL); + qmp->clks = devm_kzalloc_objs(dev, *qmp->clks, num); if (!qmp->clks) return -ENOMEM; @@ -1251,7 +1250,7 @@ static int qmp_usb_legacy_probe(struct platform_device *pdev) struct qmp_usb *qmp; int ret; - qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); + qmp = devm_kzalloc_obj(dev, *qmp); if (!qmp) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index 6a9faa0ce3bb..6348bb68d822 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -2139,8 +2139,7 @@ static int qmp_usb_reset_init(struct qmp_usb *qmp, int i; int ret; - qmp->resets = devm_kcalloc(dev, num_resets, - sizeof(*qmp->resets), GFP_KERNEL); + qmp->resets = devm_kzalloc_objs(dev, *qmp->resets, num_resets); if (!qmp->resets) return -ENOMEM; @@ -2162,7 +2161,7 @@ static int qmp_usb_clk_init(struct qmp_usb *qmp) int num = ARRAY_SIZE(qmp_usb_phy_clk_l); int i; - qmp->clks = devm_kcalloc(dev, num, sizeof(*qmp->clks), GFP_KERNEL); + qmp->clks = devm_kzalloc_objs(dev, *qmp->clks, num); if (!qmp->clks) return -ENOMEM; @@ -2368,7 +2367,7 @@ static int qmp_usb_probe(struct platform_device *pdev) struct qmp_usb *qmp; int ret; - qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); + qmp = devm_kzalloc_obj(dev, *qmp); if (!qmp) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c index 548ec97373ac..509e683740ab 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c @@ -1439,8 +1439,7 @@ static int qmp_usbc_reset_init(struct qmp_usbc *qmp, int i; int ret; - qmp->resets = devm_kcalloc(dev, num_resets, - sizeof(*qmp->resets), GFP_KERNEL); + qmp->resets = devm_kzalloc_objs(dev, *qmp->resets, num_resets); if (!qmp->resets) return -ENOMEM; @@ -1462,7 +1461,7 @@ static int qmp_usbc_clk_init(struct qmp_usbc *qmp) int num = ARRAY_SIZE(qmp_usbc_phy_clk_l); int i; - qmp->clks = devm_kcalloc(dev, num, sizeof(*qmp->clks), GFP_KERNEL); + qmp->clks = devm_kzalloc_objs(dev, *qmp->clks, num); if (!qmp->clks) return -ENOMEM; @@ -1940,7 +1939,7 @@ static int qmp_usbc_probe(struct platform_device *pdev) struct qmp_usbc *qmp; int ret; - qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); + qmp = devm_kzalloc_obj(dev, *qmp); if (!qmp) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c index 2e5fdb620cb2..fa1c2f2c6053 100644 --- a/drivers/phy/qualcomm/phy-qcom-qusb2.c +++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c @@ -1009,7 +1009,7 @@ static int qusb2_phy_probe(struct platform_device *pdev) u32 value; struct override_params *or; - qphy = devm_kzalloc(dev, sizeof(*qphy), GFP_KERNEL); + qphy = devm_kzalloc_obj(dev, *qphy); if (!qphy) return -ENOMEM; or = &qphy->overrides; diff --git a/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c b/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c index 7137200c3f31..04fc3e80b496 100644 --- a/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c +++ b/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c @@ -381,7 +381,7 @@ static int qcom_dwmac_sgmii_phy_probe(struct platform_device *pdev) struct phy *phy; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c index 980ad1fb1e2e..75e21865b2c8 100644 --- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c +++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c @@ -143,7 +143,7 @@ static int qcom_snps_hsphy_clk_init(struct qcom_snps_hsphy *hsphy) struct device *dev = hsphy->dev; hsphy->num_clks = 2; - hsphy->clks = devm_kcalloc(dev, hsphy->num_clks, sizeof(*hsphy->clks), GFP_KERNEL); + hsphy->clks = devm_kzalloc_objs(dev, *hsphy->clks, hsphy->num_clks); if (!hsphy->clks) return -ENOMEM; @@ -570,7 +570,7 @@ static int qcom_snps_hsphy_probe(struct platform_device *pdev) int ret, i; int num; - hsphy = devm_kzalloc(dev, sizeof(*hsphy), GFP_KERNEL); + hsphy = devm_kzalloc_obj(dev, *hsphy); if (!hsphy) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-uniphy-pcie-28lp.c b/drivers/phy/qualcomm/phy-qcom-uniphy-pcie-28lp.c index 324c0a5d658e..ef8709ff0e16 100644 --- a/drivers/phy/qualcomm/phy-qcom-uniphy-pcie-28lp.c +++ b/drivers/phy/qualcomm/phy-qcom-uniphy-pcie-28lp.c @@ -279,7 +279,7 @@ static int qcom_uniphy_pcie_probe(struct platform_device *pdev) struct phy *generic_phy; int ret; - phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(&pdev->dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs-28nm.c b/drivers/phy/qualcomm/phy-qcom-usb-hs-28nm.c index a52a9bf13b75..febdce27226a 100644 --- a/drivers/phy/qualcomm/phy-qcom-usb-hs-28nm.c +++ b/drivers/phy/qualcomm/phy-qcom-usb-hs-28nm.c @@ -312,7 +312,7 @@ static int qcom_snps_hsphy_probe(struct platform_device *pdev) int ret; int i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -321,8 +321,7 @@ static int qcom_snps_hsphy_probe(struct platform_device *pdev) return PTR_ERR(priv->base); priv->num_clks = ARRAY_SIZE(qcom_snps_hsphy_clks); - priv->clks = devm_kcalloc(dev, priv->num_clks, sizeof(*priv->clks), - GFP_KERNEL); + priv->clks = devm_kzalloc_objs(dev, *priv->clks, priv->num_clks); if (!priv->clks) return -ENOMEM; diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs.c b/drivers/phy/qualcomm/phy-qcom-usb-hs.c index 928a982a8a76..d7f6456c0505 100644 --- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c +++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c @@ -213,7 +213,7 @@ static int qcom_usb_hs_phy_probe(struct ulpi *ulpi) if (size < 0) size = 0; - uphy = devm_kzalloc(&ulpi->dev, struct_size(uphy, init_seq, (size / 2) + 1), GFP_KERNEL); + uphy = devm_kzalloc_flex(&ulpi->dev, *uphy, init_seq, (size / 2) + 1); if (!uphy) return -ENOMEM; ulpi_set_drvdata(ulpi, uphy); diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hsic.c b/drivers/phy/qualcomm/phy-qcom-usb-hsic.c index 20f6dd37c7c1..492559c5aa01 100644 --- a/drivers/phy/qualcomm/phy-qcom-usb-hsic.c +++ b/drivers/phy/qualcomm/phy-qcom-usb-hsic.c @@ -107,7 +107,7 @@ static int qcom_usb_hsic_phy_probe(struct ulpi *ulpi) struct phy_provider *p; struct clk *clk; - uphy = devm_kzalloc(&ulpi->dev, sizeof(*uphy), GFP_KERNEL); + uphy = devm_kzalloc_obj(&ulpi->dev, *uphy); if (!uphy) return -ENOMEM; ulpi_set_drvdata(ulpi, uphy); diff --git a/drivers/phy/qualcomm/phy-qcom-usb-ss.c b/drivers/phy/qualcomm/phy-qcom-usb-ss.c index a3a6d3ce7ea1..3afb689b3d15 100644 --- a/drivers/phy/qualcomm/phy-qcom-usb-ss.c +++ b/drivers/phy/qualcomm/phy-qcom-usb-ss.c @@ -191,7 +191,7 @@ static int qcom_ssphy_probe(struct platform_device *pdev) struct phy *phy; int ret; - priv = devm_kzalloc(dev, sizeof(struct ssphy_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct ssphy_priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/ralink/phy-mt7621-pci.c b/drivers/phy/ralink/phy-mt7621-pci.c index a591ad95347c..40314742c1e6 100644 --- a/drivers/phy/ralink/phy-mt7621-pci.c +++ b/drivers/phy/ralink/phy-mt7621-pci.c @@ -297,7 +297,7 @@ static int mt7621_pci_phy_probe(struct platform_device *pdev) struct phy_provider *provider; struct mt7621_pci_phy *phy; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/ralink/phy-ralink-usb.c b/drivers/phy/ralink/phy-ralink-usb.c index 0ff07e210769..e2da6b78bc70 100644 --- a/drivers/phy/ralink/phy-ralink-usb.c +++ b/drivers/phy/ralink/phy-ralink-usb.c @@ -173,7 +173,7 @@ static int ralink_usb_phy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; struct ralink_usb_phy *phy; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/realtek/phy-rtk-usb2.c b/drivers/phy/realtek/phy-rtk-usb2.c index 1f08b151d90a..9a23a3eb8bab 100644 --- a/drivers/phy/realtek/phy-rtk-usb2.c +++ b/drivers/phy/realtek/phy-rtk-usb2.c @@ -1017,13 +1017,12 @@ static int rtk_usb2phy_probe(struct platform_device *pdev) return -EINVAL; } - rtk_phy = devm_kzalloc(dev, sizeof(*rtk_phy), GFP_KERNEL); + rtk_phy = devm_kzalloc_obj(dev, *rtk_phy); if (!rtk_phy) return -ENOMEM; rtk_phy->dev = &pdev->dev; - rtk_phy->phy_cfg = devm_kzalloc(dev, sizeof(*rtk_phy->phy_cfg), - GFP_KERNEL); + rtk_phy->phy_cfg = devm_kzalloc_obj(dev, *rtk_phy->phy_cfg); if (!rtk_phy->phy_cfg) return -ENOMEM; diff --git a/drivers/phy/realtek/phy-rtk-usb3.c b/drivers/phy/realtek/phy-rtk-usb3.c index 4231a8aa0ba5..63d42ab0b984 100644 --- a/drivers/phy/realtek/phy-rtk-usb3.c +++ b/drivers/phy/realtek/phy-rtk-usb3.c @@ -571,13 +571,12 @@ static int rtk_usb3phy_probe(struct platform_device *pdev) return -EINVAL; } - rtk_phy = devm_kzalloc(dev, sizeof(*rtk_phy), GFP_KERNEL); + rtk_phy = devm_kzalloc_obj(dev, *rtk_phy); if (!rtk_phy) return -ENOMEM; rtk_phy->dev = &pdev->dev; - rtk_phy->phy_cfg = devm_kzalloc(dev, sizeof(*rtk_phy->phy_cfg), - GFP_KERNEL); + rtk_phy->phy_cfg = devm_kzalloc_obj(dev, *rtk_phy->phy_cfg); if (!rtk_phy->phy_cfg) return -ENOMEM; diff --git a/drivers/phy/renesas/phy-rcar-gen2.c b/drivers/phy/renesas/phy-rcar-gen2.c index 5a272e25e051..414c6814ef99 100644 --- a/drivers/phy/renesas/phy-rcar-gen2.c +++ b/drivers/phy/renesas/phy-rcar-gen2.c @@ -358,7 +358,7 @@ static int rcar_gen2_phy_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(dev, *drv); if (!drv) return -ENOMEM; @@ -372,9 +372,8 @@ static int rcar_gen2_phy_probe(struct platform_device *pdev) return -EINVAL; drv->num_channels = of_get_child_count(dev->of_node); - drv->channels = devm_kcalloc(dev, drv->num_channels, - sizeof(struct rcar_gen2_channel), - GFP_KERNEL); + drv->channels = devm_kzalloc_objs(dev, struct rcar_gen2_channel, + drv->num_channels); if (!drv->channels) return -ENOMEM; diff --git a/drivers/phy/renesas/phy-rcar-gen3-pcie.c b/drivers/phy/renesas/phy-rcar-gen3-pcie.c index c0e5a4ac82de..9072174ac804 100644 --- a/drivers/phy/renesas/phy-rcar-gen3-pcie.c +++ b/drivers/phy/renesas/phy-rcar-gen3-pcie.c @@ -88,7 +88,7 @@ static int rcar_gen3_phy_pcie_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c index b5ba751805aa..ac3dc8b6e1ea 100644 --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c @@ -1184,7 +1184,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) return -EINVAL; } - channel = devm_kzalloc(dev, sizeof(*channel), GFP_KERNEL); + channel = devm_kzalloc_obj(dev, *channel); if (!channel) return -ENOMEM; diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb3.c b/drivers/phy/renesas/phy-rcar-gen3-usb3.c index 0420f5b283ce..58f1a48b9d5c 100644 --- a/drivers/phy/renesas/phy-rcar-gen3-usb3.c +++ b/drivers/phy/renesas/phy-rcar-gen3-usb3.c @@ -141,7 +141,7 @@ static int rcar_gen3_phy_usb3_probe(struct platform_device *pdev) return -EINVAL; } - r = devm_kzalloc(dev, sizeof(*r), GFP_KERNEL); + r = devm_kzalloc_obj(dev, *r); if (!r) return -ENOMEM; diff --git a/drivers/phy/renesas/phy-rzg3e-usb3.c b/drivers/phy/renesas/phy-rzg3e-usb3.c index 060309547ea5..57aa449edb8c 100644 --- a/drivers/phy/renesas/phy-rzg3e-usb3.c +++ b/drivers/phy/renesas/phy-rzg3e-usb3.c @@ -159,7 +159,7 @@ static int rzg3e_phy_usb3_probe(struct platform_device *pdev) struct phy *phy; int ret; - r = devm_kzalloc(dev, sizeof(*r), GFP_KERNEL); + r = devm_kzalloc_obj(dev, *r); if (!r) return -ENOMEM; diff --git a/drivers/phy/renesas/r8a779f0-ether-serdes.c b/drivers/phy/renesas/r8a779f0-ether-serdes.c index 8a6b6f366fe3..721d8ae527ca 100644 --- a/drivers/phy/renesas/r8a779f0-ether-serdes.c +++ b/drivers/phy/renesas/r8a779f0-ether-serdes.c @@ -429,7 +429,7 @@ static int r8a779f0_eth_serdes_probe(struct platform_device *pdev) struct phy_provider *provider; int i; - dd = devm_kzalloc(&pdev->dev, sizeof(*dd), GFP_KERNEL); + dd = devm_kzalloc_obj(&pdev->dev, *dd); if (!dd) return -ENOMEM; diff --git a/drivers/phy/rockchip/phy-rockchip-dp.c b/drivers/phy/rockchip/phy-rockchip-dp.c index 592aa956eead..07c86c2e8a07 100644 --- a/drivers/phy/rockchip/phy-rockchip-dp.c +++ b/drivers/phy/rockchip/phy-rockchip-dp.c @@ -86,7 +86,7 @@ static int rockchip_dp_phy_probe(struct platform_device *pdev) if (!dev->parent || !dev->parent->of_node) return -ENODEV; - dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL); + dp = devm_kzalloc_obj(dev, *dp); if (!dp) return -ENOMEM; diff --git a/drivers/phy/rockchip/phy-rockchip-dphy-rx0.c b/drivers/phy/rockchip/phy-rockchip-dphy-rx0.c index e6a768bbb9b3..70b145394a88 100644 --- a/drivers/phy/rockchip/phy-rockchip-dphy-rx0.c +++ b/drivers/phy/rockchip/phy-rockchip-dphy-rx0.c @@ -334,7 +334,7 @@ static int rk_dphy_probe(struct platform_device *pdev) if (!dev->parent || !dev->parent->of_node) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; priv->dev = dev; @@ -347,8 +347,8 @@ static int rk_dphy_probe(struct platform_device *pdev) drv_data = of_device_get_match_data(dev); priv->drv_data = drv_data; - priv->clks = devm_kcalloc(&pdev->dev, drv_data->num_clks, - sizeof(*priv->clks), GFP_KERNEL); + priv->clks = devm_kzalloc_objs(&pdev->dev, *priv->clks, + drv_data->num_clks); if (!priv->clks) return -ENOMEM; for (i = 0; i < drv_data->num_clks; i++) diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c index 5187983c58e5..996ec1ef1ccf 100644 --- a/drivers/phy/rockchip/phy-rockchip-emmc.c +++ b/drivers/phy/rockchip/phy-rockchip-emmc.c @@ -364,7 +364,7 @@ static int rockchip_emmc_phy_probe(struct platform_device *pdev) return PTR_ERR(grf); } - rk_phy = devm_kzalloc(dev, sizeof(*rk_phy), GFP_KERNEL); + rk_phy = devm_kzalloc_obj(dev, *rk_phy); if (!rk_phy) return -ENOMEM; diff --git a/drivers/phy/rockchip/phy-rockchip-inno-csidphy.c b/drivers/phy/rockchip/phy-rockchip-inno-csidphy.c index b4f64ebfbcf7..1d4e15750278 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-csidphy.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-csidphy.c @@ -479,7 +479,7 @@ static int rockchip_inno_csidphy_probe(struct platform_device *pdev) u32 phase; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c index 30d5e5ddff4a..6ad04b0c9f8c 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c @@ -778,7 +778,7 @@ static int inno_dsidphy_probe(struct platform_device *pdev) struct phy *phy; int ret; - inno = devm_kzalloc(dev, sizeof(*inno), GFP_KERNEL); + inno = devm_kzalloc_obj(dev, *inno); if (!inno) return -ENOMEM; diff --git a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c index d2c2b17df5f3..f5874cd674e6 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c @@ -1355,7 +1355,7 @@ static int inno_hdmi_phy_probe(struct platform_device *pdev) void __iomem *regs; int ret; - inno = devm_kzalloc(&pdev->dev, sizeof(*inno), GFP_KERNEL); + inno = devm_kzalloc_obj(&pdev->dev, *inno); if (!inno) return -ENOMEM; diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index e47b89015586..848c07ccb5e7 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1356,7 +1356,7 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) unsigned int reg; int index = 0, ret; - rphy = devm_kzalloc(dev, sizeof(*rphy), GFP_KERNEL); + rphy = devm_kzalloc_obj(dev, *rphy); if (!rphy) return -ENOMEM; diff --git a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c index 3102a99128f6..51c7c8405244 100644 --- a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c +++ b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c @@ -415,7 +415,7 @@ static int rockchip_combphy_probe(struct platform_device *pdev) return -EINVAL; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/rockchip/phy-rockchip-pcie.c b/drivers/phy/rockchip/phy-rockchip-pcie.c index 126306c01454..6861556df75b 100644 --- a/drivers/phy/rockchip/phy-rockchip-pcie.c +++ b/drivers/phy/rockchip/phy-rockchip-pcie.c @@ -277,7 +277,7 @@ static int rockchip_pcie_phy_probe(struct platform_device *pdev) return PTR_ERR(grf); } - rk_phy = devm_kzalloc(dev, sizeof(*rk_phy), GFP_KERNEL); + rk_phy = devm_kzalloc_obj(dev, *rk_phy); if (!rk_phy) return -ENOMEM; diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c b/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c index 7382043e1f31..724eff7bea2a 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c @@ -1558,7 +1558,7 @@ static int samsung_mipi_dcphy_probe(struct platform_device *pdev) void __iomem *regs; int ret; - samsung = devm_kzalloc(dev, sizeof(*samsung), GFP_KERNEL); + samsung = devm_kzalloc_obj(dev, *samsung); if (!samsung) return -ENOMEM; diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c index 6879eecc5a9f..515646f9cb64 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c @@ -2506,7 +2506,7 @@ static int rk_hdptx_phy_probe(struct platform_device *pdev) void __iomem *regs; int ret, id; - hdptx = devm_kzalloc(dev, sizeof(*hdptx), GFP_KERNEL); + hdptx = devm_kzalloc_obj(dev, *hdptx); if (!hdptx) return -ENOMEM; diff --git a/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c b/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c index 4e8ffd173096..5f517bab1aa4 100644 --- a/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c +++ b/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c @@ -249,7 +249,7 @@ static int rockchip_p3phy_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c index d9701b6106d5..d7934dfe1c5e 100644 --- a/drivers/phy/rockchip/phy-rockchip-typec.c +++ b/drivers/phy/rockchip/phy-rockchip-typec.c @@ -1106,7 +1106,7 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev) const struct rockchip_usb3phy_port_cfg *phy_cfgs; int index, ret; - tcphy = devm_kzalloc(dev, sizeof(*tcphy), GFP_KERNEL); + tcphy = devm_kzalloc_obj(dev, *tcphy); if (!tcphy) return -ENOMEM; diff --git a/drivers/phy/rockchip/phy-rockchip-usb.c b/drivers/phy/rockchip/phy-rockchip-usb.c index c5a2853a63d3..903130c3a45a 100644 --- a/drivers/phy/rockchip/phy-rockchip-usb.c +++ b/drivers/phy/rockchip/phy-rockchip-usb.c @@ -205,7 +205,7 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base, const char *clk_name; int err, i; - rk_phy = devm_kzalloc(base->dev, sizeof(*rk_phy), GFP_KERNEL); + rk_phy = devm_kzalloc_obj(base->dev, *rk_phy); if (!rk_phy) return -ENOMEM; @@ -448,7 +448,7 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; int err; - phy_base = devm_kzalloc(dev, sizeof(*phy_base), GFP_KERNEL); + phy_base = devm_kzalloc_obj(dev, *phy_base); if (!phy_base) return -ENOMEM; diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c index e748acdd2d31..79072f4664d8 100644 --- a/drivers/phy/rockchip/phy-rockchip-usbdp.c +++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c @@ -473,8 +473,7 @@ static int rk_udphy_reset_init(struct rk_udphy *udphy, struct device *dev) int idx; udphy->num_rsts = cfg->num_rsts; - udphy->rsts = devm_kcalloc(dev, udphy->num_rsts, - sizeof(*udphy->rsts), GFP_KERNEL); + udphy->rsts = devm_kzalloc_objs(dev, *udphy->rsts, udphy->num_rsts); if (!udphy->rsts) return -ENOMEM; @@ -1412,7 +1411,7 @@ static int rk_udphy_probe(struct platform_device *pdev) void __iomem *base; int id, ret; - udphy = devm_kzalloc(dev, sizeof(*udphy), GFP_KERNEL); + udphy = devm_kzalloc_obj(dev, *udphy); if (!udphy) return -ENOMEM; diff --git a/drivers/phy/samsung/phy-exynos-dp-video.c b/drivers/phy/samsung/phy-exynos-dp-video.c index a636dee07585..86acf1d27800 100644 --- a/drivers/phy/samsung/phy-exynos-dp-video.c +++ b/drivers/phy/samsung/phy-exynos-dp-video.c @@ -77,7 +77,7 @@ static int exynos_dp_video_phy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; struct phy *phy; - state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/phy/samsung/phy-exynos-mipi-video.c b/drivers/phy/samsung/phy-exynos-mipi-video.c index be925508ed97..40f5fc31b784 100644 --- a/drivers/phy/samsung/phy-exynos-mipi-video.c +++ b/drivers/phy/samsung/phy-exynos-mipi-video.c @@ -352,7 +352,7 @@ static int exynos_mipi_video_phy_probe(struct platform_device *pdev) if (!phy_dev) return -ENODEV; - state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/phy/samsung/phy-exynos-pcie.c b/drivers/phy/samsung/phy-exynos-pcie.c index 53c9230c2907..b7943aeda87e 100644 --- a/drivers/phy/samsung/phy-exynos-pcie.c +++ b/drivers/phy/samsung/phy-exynos-pcie.c @@ -147,7 +147,7 @@ static int exynos_pcie_phy_probe(struct platform_device *pdev) struct phy *generic_phy; struct phy_provider *phy_provider; - exynos_phy = devm_kzalloc(dev, sizeof(*exynos_phy), GFP_KERNEL); + exynos_phy = devm_kzalloc_obj(dev, *exynos_phy); if (!exynos_phy) return -ENOMEM; diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index 087d552eb511..5a208a584b3b 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -1805,8 +1805,8 @@ static int exynos5_usbdrd_phy_clk_handle(struct exynos5_usbdrd_phy *phy_drd) struct clk *ref_clk; unsigned long ref_rate; - phy_drd->clks = devm_kcalloc(phy_drd->dev, phy_drd->drv_data->n_clks, - sizeof(*phy_drd->clks), GFP_KERNEL); + phy_drd->clks = devm_kzalloc_objs(phy_drd->dev, *phy_drd->clks, + phy_drd->drv_data->n_clks); if (!phy_drd->clks) return -ENOMEM; @@ -1819,10 +1819,9 @@ static int exynos5_usbdrd_phy_clk_handle(struct exynos5_usbdrd_phy *phy_drd) return dev_err_probe(phy_drd->dev, ret, "failed to get phy clock(s)\n"); - phy_drd->core_clks = devm_kcalloc(phy_drd->dev, - phy_drd->drv_data->n_core_clks, - sizeof(*phy_drd->core_clks), - GFP_KERNEL); + phy_drd->core_clks = devm_kzalloc_objs(phy_drd->dev, + *phy_drd->core_clks, + phy_drd->drv_data->n_core_clks); if (!phy_drd->core_clks) return -ENOMEM; @@ -2961,7 +2960,7 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) int i, ret; int channel; - phy_drd = devm_kzalloc(dev, sizeof(*phy_drd), GFP_KERNEL); + phy_drd = devm_kzalloc_obj(dev, *phy_drd); if (!phy_drd) return -ENOMEM; @@ -3032,10 +3031,8 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) dev_dbg(dev, "Not a multi-controller usbdrd phy\n"); /* Get regulators */ - phy_drd->regulators = devm_kcalloc(dev, - drv_data->n_regulators, - sizeof(*phy_drd->regulators), - GFP_KERNEL); + phy_drd->regulators = devm_kzalloc_objs(dev, *phy_drd->regulators, + drv_data->n_regulators); if (!phy_drd->regulators) return -ENOMEM; regulator_bulk_set_supply_names(phy_drd->regulators, diff --git a/drivers/phy/samsung/phy-exynos5250-sata.c b/drivers/phy/samsung/phy-exynos5250-sata.c index 595adba5fb8f..a88534eba2be 100644 --- a/drivers/phy/samsung/phy-exynos5250-sata.c +++ b/drivers/phy/samsung/phy-exynos5250-sata.c @@ -166,7 +166,7 @@ static int exynos_sata_phy_probe(struct platform_device *pdev) struct device_node *node; int ret = 0; - sata_phy = devm_kzalloc(dev, sizeof(*sata_phy), GFP_KERNEL); + sata_phy = devm_kzalloc_obj(dev, *sata_phy); if (!sata_phy) return -ENOMEM; diff --git a/drivers/phy/samsung/phy-samsung-ufs.c b/drivers/phy/samsung/phy-samsung-ufs.c index ee665f26c236..56c2fa53bf77 100644 --- a/drivers/phy/samsung/phy-samsung-ufs.c +++ b/drivers/phy/samsung/phy-samsung-ufs.c @@ -150,8 +150,7 @@ static int samsung_ufs_phy_clks_init(struct samsung_ufs_phy *phy) const struct samsung_ufs_phy_drvdata *drvdata = phy->drvdata; int num_clks = drvdata->num_clks; - phy->clks = devm_kcalloc(phy->dev, num_clks, sizeof(*phy->clks), - GFP_KERNEL); + phy->clks = devm_kzalloc_objs(phy->dev, *phy->clks, num_clks); if (!phy->clks) return -ENOMEM; @@ -295,7 +294,7 @@ static int samsung_ufs_phy_probe(struct platform_device *pdev) goto out; } - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) { err = -ENOMEM; goto out; diff --git a/drivers/phy/samsung/phy-samsung-usb2.c b/drivers/phy/samsung/phy-samsung-usb2.c index d2749b67cf8f..307d33a24432 100644 --- a/drivers/phy/samsung/phy-samsung-usb2.c +++ b/drivers/phy/samsung/phy-samsung-usb2.c @@ -157,8 +157,7 @@ static int samsung_usb2_phy_probe(struct platform_device *pdev) if (!cfg) return -EINVAL; - drv = devm_kzalloc(dev, struct_size(drv, instances, cfg->num_phys), - GFP_KERNEL); + drv = devm_kzalloc_flex(dev, *drv, instances, cfg->num_phys); if (!drv) return -ENOMEM; diff --git a/drivers/phy/socionext/phy-uniphier-ahci.c b/drivers/phy/socionext/phy-uniphier-ahci.c index 28cf3efe0695..213eb581dad3 100644 --- a/drivers/phy/socionext/phy-uniphier-ahci.c +++ b/drivers/phy/socionext/phy-uniphier-ahci.c @@ -391,7 +391,7 @@ static int uniphier_ahciphy_probe(struct platform_device *pdev) struct phy *phy; struct phy_provider *phy_provider; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/socionext/phy-uniphier-pcie.c b/drivers/phy/socionext/phy-uniphier-pcie.c index c19173492b79..8a7f61a6a6c0 100644 --- a/drivers/phy/socionext/phy-uniphier-pcie.c +++ b/drivers/phy/socionext/phy-uniphier-pcie.c @@ -225,7 +225,7 @@ static int uniphier_pciephy_probe(struct platform_device *pdev) struct regmap *regmap; struct phy *phy; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/socionext/phy-uniphier-usb2.c b/drivers/phy/socionext/phy-uniphier-usb2.c index c49d432e526b..1bf3d4bb775a 100644 --- a/drivers/phy/socionext/phy-uniphier-usb2.c +++ b/drivers/phy/socionext/phy-uniphier-usb2.c @@ -130,7 +130,7 @@ static int uniphier_u2phy_probe(struct platform_device *pdev) } for_each_child_of_node_scoped(dev->of_node, child) { - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/socionext/phy-uniphier-usb3hs.c b/drivers/phy/socionext/phy-uniphier-usb3hs.c index c8971eee3640..b5e964407337 100644 --- a/drivers/phy/socionext/phy-uniphier-usb3hs.c +++ b/drivers/phy/socionext/phy-uniphier-usb3hs.c @@ -328,7 +328,7 @@ static int uniphier_u3hsphy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; struct phy *phy; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/socionext/phy-uniphier-usb3ss.c b/drivers/phy/socionext/phy-uniphier-usb3ss.c index f402ed8732fd..f683137e3106 100644 --- a/drivers/phy/socionext/phy-uniphier-usb3ss.c +++ b/drivers/phy/socionext/phy-uniphier-usb3ss.c @@ -219,7 +219,7 @@ static int uniphier_u3ssphy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; struct phy *phy; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/sophgo/phy-cv1800-usb2.c b/drivers/phy/sophgo/phy-cv1800-usb2.c index 6fe846534e9c..b55d62907ae2 100644 --- a/drivers/phy/sophgo/phy-cv1800-usb2.c +++ b/drivers/phy/sophgo/phy-cv1800-usb2.c @@ -107,7 +107,7 @@ static int cv1800_usb_phy_probe(struct platform_device *pdev) if (!parent) return -ENODEV; - phy = devm_kmalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kmalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/spacemit/phy-k1-pcie.c b/drivers/phy/spacemit/phy-k1-pcie.c index 75477bea7f70..35ebb1d7b5fa 100644 --- a/drivers/phy/spacemit/phy-k1-pcie.c +++ b/drivers/phy/spacemit/phy-k1-pcie.c @@ -609,7 +609,7 @@ static int k1_pcie_phy_probe(struct platform_device *pdev) if (!k1_phy_rterm_valid() && !probing_port_a) return -EPROBE_DEFER; - k1_phy = devm_kzalloc(dev, sizeof(*k1_phy), GFP_KERNEL); + k1_phy = devm_kzalloc_obj(dev, *k1_phy); if (!k1_phy) return -ENOMEM; k1_phy->dev = dev; diff --git a/drivers/phy/spacemit/phy-k1-usb2.c b/drivers/phy/spacemit/phy-k1-usb2.c index 8df12eeb20b1..fd08a3ab88f3 100644 --- a/drivers/phy/spacemit/phy-k1-usb2.c +++ b/drivers/phy/spacemit/phy-k1-usb2.c @@ -189,7 +189,7 @@ static int spacemit_usb2phy_probe(struct platform_device *pdev) const struct phy_ops *ops; void __iomem *base; - sphy = devm_kzalloc(dev, sizeof(*sphy), GFP_KERNEL); + sphy = devm_kzalloc_obj(dev, *sphy); if (!sphy) return -ENOMEM; diff --git a/drivers/phy/spacemit/phy-k3-combo.c b/drivers/phy/spacemit/phy-k3-combo.c index 0bc08bb6247a..6c24b0216484 100644 --- a/drivers/phy/spacemit/phy-k3-combo.c +++ b/drivers/phy/spacemit/phy-k3-combo.c @@ -192,7 +192,7 @@ static int k3_combo_phy_probe(struct platform_device *pdev) u32 config = 0; int ret; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/st/phy-miphy28lp.c b/drivers/phy/st/phy-miphy28lp.c index c576fc5569fe..74d34278c7e8 100644 --- a/drivers/phy/st/phy-miphy28lp.c +++ b/drivers/phy/st/phy-miphy28lp.c @@ -1171,7 +1171,7 @@ static int miphy28lp_probe(struct platform_device *pdev) size_t nphys; nphys = of_get_child_count(np); - miphy_dev = devm_kzalloc(&pdev->dev, struct_size(miphy_dev, phys, nphys), GFP_KERNEL); + miphy_dev = devm_kzalloc_flex(&pdev->dev, *miphy_dev, phys, nphys); if (!miphy_dev) return -ENOMEM; @@ -1192,8 +1192,7 @@ static int miphy28lp_probe(struct platform_device *pdev) for_each_child_of_node(np, child) { struct miphy28lp_phy *miphy_phy; - miphy_phy = devm_kzalloc(&pdev->dev, sizeof(*miphy_phy), - GFP_KERNEL); + miphy_phy = devm_kzalloc_obj(&pdev->dev, *miphy_phy); if (!miphy_phy) { ret = -ENOMEM; goto put_child; diff --git a/drivers/phy/st/phy-spear1310-miphy.c b/drivers/phy/st/phy-spear1310-miphy.c index c661ab63505f..ad7721323415 100644 --- a/drivers/phy/st/phy-spear1310-miphy.c +++ b/drivers/phy/st/phy-spear1310-miphy.c @@ -208,7 +208,7 @@ static int spear1310_miphy_probe(struct platform_device *pdev) struct spear1310_miphy_priv *priv; struct phy_provider *phy_provider; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/st/phy-spear1340-miphy.c b/drivers/phy/st/phy-spear1340-miphy.c index 85a60d64ebb7..1e16d64306f7 100644 --- a/drivers/phy/st/phy-spear1340-miphy.c +++ b/drivers/phy/st/phy-spear1340-miphy.c @@ -245,7 +245,7 @@ static int spear1340_miphy_probe(struct platform_device *pdev) struct spear1340_miphy_priv *priv; struct phy_provider *phy_provider; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/st/phy-stih407-usb.c b/drivers/phy/st/phy-stih407-usb.c index 7a3e4584895c..3f2c27c406e0 100644 --- a/drivers/phy/st/phy-stih407-usb.c +++ b/drivers/phy/st/phy-stih407-usb.c @@ -94,7 +94,7 @@ static int stih407_usb2_picophy_probe(struct platform_device *pdev) unsigned int syscon_args[2]; struct phy *phy; - phy_dev = devm_kzalloc(dev, sizeof(*phy_dev), GFP_KERNEL); + phy_dev = devm_kzalloc_obj(dev, *phy_dev); if (!phy_dev) return -ENOMEM; diff --git a/drivers/phy/st/phy-stm32-combophy.c b/drivers/phy/st/phy-stm32-combophy.c index 607b4d607eb5..d77d64f513f5 100644 --- a/drivers/phy/st/phy-stm32-combophy.c +++ b/drivers/phy/st/phy-stm32-combophy.c @@ -522,7 +522,7 @@ static int stm32_combophy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; int ret, irq; - combophy = devm_kzalloc(dev, sizeof(*combophy), GFP_KERNEL); + combophy = devm_kzalloc_obj(dev, *combophy); if (!combophy) return -ENOMEM; diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-usbphyc.c index b44afbff8616..094329f0ba08 100644 --- a/drivers/phy/st/phy-stm32-usbphyc.c +++ b/drivers/phy/st/phy-stm32-usbphyc.c @@ -623,7 +623,7 @@ static int stm32_usbphyc_probe(struct platform_device *pdev) u32 pllen, version; int ret, port = 0; - usbphyc = devm_kzalloc(dev, sizeof(*usbphyc), GFP_KERNEL); + usbphyc = devm_kzalloc_obj(dev, *usbphyc); if (!usbphyc) return -ENOMEM; usbphyc->dev = dev; @@ -669,8 +669,7 @@ static int stm32_usbphyc_probe(struct platform_device *pdev) usbphyc->switch_setup = -EINVAL; usbphyc->nphys = of_get_child_count(np); - usbphyc->phys = devm_kcalloc(dev, usbphyc->nphys, - sizeof(*usbphyc->phys), GFP_KERNEL); + usbphyc->phys = devm_kzalloc_objs(dev, *usbphyc->phys, usbphyc->nphys); if (!usbphyc->phys) { ret = -ENOMEM; goto clk_disable; @@ -704,8 +703,7 @@ static int stm32_usbphyc_probe(struct platform_device *pdev) goto put_child; } - usbphyc_phy = devm_kzalloc(dev, sizeof(*usbphyc_phy), - GFP_KERNEL); + usbphyc_phy = devm_kzalloc_obj(dev, *usbphyc_phy); if (!usbphyc_phy) { ret = -ENOMEM; goto put_child; diff --git a/drivers/phy/starfive/phy-jh7110-dphy-rx.c b/drivers/phy/starfive/phy-jh7110-dphy-rx.c index d06f21ad6332..043a7e11d187 100644 --- a/drivers/phy/starfive/phy-jh7110-dphy-rx.c +++ b/drivers/phy/starfive/phy-jh7110-dphy-rx.c @@ -152,7 +152,7 @@ static int stf_dphy_probe(struct platform_device *pdev) struct stf_dphy *dphy; int ret; - dphy = devm_kzalloc(&pdev->dev, sizeof(*dphy), GFP_KERNEL); + dphy = devm_kzalloc_obj(&pdev->dev, *dphy); if (!dphy) return -ENOMEM; diff --git a/drivers/phy/starfive/phy-jh7110-dphy-tx.c b/drivers/phy/starfive/phy-jh7110-dphy-tx.c index e9ffd0f811d2..49a9c3512030 100644 --- a/drivers/phy/starfive/phy-jh7110-dphy-tx.c +++ b/drivers/phy/starfive/phy-jh7110-dphy-tx.c @@ -402,7 +402,7 @@ static int stf_dphy_probe(struct platform_device *pdev) struct stf_dphy *dphy; int ret; - dphy = devm_kzalloc(&pdev->dev, sizeof(*dphy), GFP_KERNEL); + dphy = devm_kzalloc_obj(&pdev->dev, *dphy); if (!dphy) return -ENOMEM; diff --git a/drivers/phy/starfive/phy-jh7110-pcie.c b/drivers/phy/starfive/phy-jh7110-pcie.c index 734c8e007727..c36e89052aa3 100644 --- a/drivers/phy/starfive/phy-jh7110-pcie.c +++ b/drivers/phy/starfive/phy-jh7110-pcie.c @@ -141,7 +141,7 @@ static int jh7110_pcie_phy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; u32 args[2]; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/starfive/phy-jh7110-usb.c b/drivers/phy/starfive/phy-jh7110-usb.c index b505d89860b4..c5fc27df24a0 100644 --- a/drivers/phy/starfive/phy-jh7110-usb.c +++ b/drivers/phy/starfive/phy-jh7110-usb.c @@ -119,7 +119,7 @@ static int jh7110_usb_phy_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct phy_provider *phy_provider; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/sunplus/phy-sunplus-usb2.c b/drivers/phy/sunplus/phy-sunplus-usb2.c index 0ad4c7160d17..6fe096ff1e43 100644 --- a/drivers/phy/sunplus/phy-sunplus-usb2.c +++ b/drivers/phy/sunplus/phy-sunplus-usb2.c @@ -242,7 +242,7 @@ static int sp_usb_phy_probe(struct platform_device *pdev) struct phy *phy; int ret; - usbphy = devm_kzalloc(&pdev->dev, sizeof(*usbphy), GFP_KERNEL); + usbphy = devm_kzalloc_obj(&pdev->dev, *usbphy); if (!usbphy) return -ENOMEM; diff --git a/drivers/phy/tegra/phy-tegra-mphy.c b/drivers/phy/tegra/phy-tegra-mphy.c index 01cafe1c7477..17722aaaa361 100644 --- a/drivers/phy/tegra/phy-tegra-mphy.c +++ b/drivers/phy/tegra/phy-tegra-mphy.c @@ -396,7 +396,7 @@ static int tegra_mphy_probe(struct platform_device *pdev) struct tegra_mphy *mphy; int err; - mphy = devm_kzalloc(dev, sizeof(*mphy), GFP_KERNEL); + mphy = devm_kzalloc_obj(dev, *mphy); if (!mphy) return -ENOMEM; diff --git a/drivers/phy/tegra/phy-tegra194-p2u.c b/drivers/phy/tegra/phy-tegra194-p2u.c index f49b417c9eb6..e1cf4178a8f7 100644 --- a/drivers/phy/tegra/phy-tegra194-p2u.c +++ b/drivers/phy/tegra/phy-tegra194-p2u.c @@ -111,7 +111,7 @@ static int tegra_p2u_probe(struct platform_device *pdev) struct phy *generic_phy; struct tegra_p2u *phy; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/tegra/xusb-tegra124.c b/drivers/phy/tegra/xusb-tegra124.c index 70b6213370a8..e52de4d6fcd1 100644 --- a/drivers/phy/tegra/xusb-tegra124.c +++ b/drivers/phy/tegra/xusb-tegra124.c @@ -1693,7 +1693,7 @@ tegra124_xusb_padctl_probe(struct device *dev, struct tegra124_xusb_padctl *padctl; int err; - padctl = devm_kzalloc(dev, sizeof(*padctl), GFP_KERNEL); + padctl = devm_kzalloc_obj(dev, *padctl); if (!padctl) return ERR_PTR(-ENOMEM); diff --git a/drivers/phy/tegra/xusb-tegra186.c b/drivers/phy/tegra/xusb-tegra186.c index aa8ab94fad4c..82f5c6c8f6a8 100644 --- a/drivers/phy/tegra/xusb-tegra186.c +++ b/drivers/phy/tegra/xusb-tegra186.c @@ -1473,11 +1473,11 @@ tegra186_xusb_read_fuse_calibration(struct tegra186_xusb_padctl *padctl) count = soc->ports.usb2.count; - level = devm_kcalloc(dev, count, sizeof(u32), GFP_KERNEL); + level = devm_kzalloc_objs(dev, u32, count); if (!level) return -ENOMEM; - hs_term_range_adj = devm_kcalloc(dev, count, sizeof(u32), GFP_KERNEL); + hs_term_range_adj = devm_kzalloc_objs(dev, u32, count); if (!hs_term_range_adj) return -ENOMEM; @@ -1532,7 +1532,7 @@ tegra186_xusb_padctl_probe(struct device *dev, struct resource *res; int err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return ERR_PTR(-ENOMEM); diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c index 1abc5913ec49..42082d552d29 100644 --- a/drivers/phy/tegra/xusb-tegra210.c +++ b/drivers/phy/tegra/xusb-tegra210.c @@ -3146,7 +3146,7 @@ tegra210_xusb_padctl_probe(struct device *dev, struct device_node *np; int err; - padctl = devm_kzalloc(dev, sizeof(*padctl), GFP_KERNEL); + padctl = devm_kzalloc_obj(dev, *padctl); if (!padctl) return ERR_PTR(-ENOMEM); diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c index 89ce9ac87300..cd1cd985f36a 100644 --- a/drivers/phy/tegra/xusb.c +++ b/drivers/phy/tegra/xusb.c @@ -208,8 +208,7 @@ int tegra_xusb_pad_register(struct tegra_xusb_pad *pad, if (!children) return -ENODEV; - pad->lanes = devm_kcalloc(&pad->dev, pad->soc->num_lanes, sizeof(lane), - GFP_KERNEL); + pad->lanes = devm_kzalloc_objs(&pad->dev, lane, pad->soc->num_lanes); if (!pad->lanes) { of_node_put(children); return -ENOMEM; @@ -685,9 +684,7 @@ static int tegra_xusb_setup_usb_role_switch(struct tegra_xusb_port *port) * where an optimal solution is possible with changes to USB role * switch driver. */ - port->dev.driver = devm_kzalloc(&port->dev, - sizeof(struct device_driver), - GFP_KERNEL); + port->dev.driver = devm_kzalloc_obj(&port->dev, struct device_driver); if (!port->dev.driver) return -ENOMEM; @@ -705,8 +702,7 @@ static int tegra_xusb_setup_usb_role_switch(struct tegra_xusb_port *port) INIT_WORK(&port->usb_phy_work, tegra_xusb_usb_phy_work); usb_role_switch_set_drvdata(port->usb_role_sw, port); - port->usb_phy.otg = devm_kzalloc(&port->dev, sizeof(struct usb_otg), - GFP_KERNEL); + port->usb_phy.otg = devm_kzalloc_obj(&port->dev, struct usb_otg); if (!port->usb_phy.otg) return -ENOMEM; @@ -1226,8 +1222,8 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev) goto remove; } - padctl->supplies = devm_kcalloc(&pdev->dev, padctl->soc->num_supplies, - sizeof(*padctl->supplies), GFP_KERNEL); + padctl->supplies = devm_kzalloc_objs(&pdev->dev, *padctl->supplies, + padctl->soc->num_supplies); if (!padctl->supplies) { err = -ENOMEM; goto remove; diff --git a/drivers/phy/ti/phy-am654-serdes.c b/drivers/phy/ti/phy-am654-serdes.c index 5b6c27aa7e8b..f7b6156163d1 100644 --- a/drivers/phy/ti/phy-am654-serdes.c +++ b/drivers/phy/ti/phy-am654-serdes.c @@ -652,7 +652,7 @@ static int serdes_am654_clk_register(struct serdes_am654 *am654_phy, unsigned int reg; struct clk *clk; - mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(dev, *mux); if (!mux) return -ENOMEM; @@ -747,7 +747,7 @@ static int serdes_am654_probe(struct platform_device *pdev) int ret; int i; - am654_phy = devm_kzalloc(dev, sizeof(*am654_phy), GFP_KERNEL); + am654_phy = devm_kzalloc_obj(dev, *am654_phy); if (!am654_phy) return -ENOMEM; diff --git a/drivers/phy/ti/phy-da8xx-usb.c b/drivers/phy/ti/phy-da8xx-usb.c index 62fa6f89c0e6..32f663b42019 100644 --- a/drivers/phy/ti/phy-da8xx-usb.c +++ b/drivers/phy/ti/phy-da8xx-usb.c @@ -182,7 +182,7 @@ static int da8xx_usb_phy_probe(struct platform_device *pdev) struct da8xx_usb_phy *d_phy; int ret; - d_phy = devm_kzalloc(dev, sizeof(*d_phy), GFP_KERNEL); + d_phy = devm_kzalloc_obj(dev, *d_phy); if (!d_phy) return -ENOMEM; diff --git a/drivers/phy/ti/phy-dm816x-usb.c b/drivers/phy/ti/phy-dm816x-usb.c index d274831b731c..ec26d98703e6 100644 --- a/drivers/phy/ti/phy-dm816x-usb.c +++ b/drivers/phy/ti/phy-dm816x-usb.c @@ -177,7 +177,7 @@ static int dm816x_usb_phy_probe(struct platform_device *pdev) struct usb_otg *otg; int error; - phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(&pdev->dev, *phy); if (!phy) return -ENOMEM; @@ -200,7 +200,7 @@ static int dm816x_usb_phy_probe(struct platform_device *pdev) if (phy->usbphy_ctrl == 0x2c) phy->instance = 1; - otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL); + otg = devm_kzalloc_obj(&pdev->dev, *otg); if (!otg) return -ENOMEM; diff --git a/drivers/phy/ti/phy-ds125df111.c b/drivers/phy/ti/phy-ds125df111.c index 84ff96d7d589..a9fe6c614f26 100644 --- a/drivers/phy/ti/phy-ds125df111.c +++ b/drivers/phy/ti/phy-ds125df111.c @@ -244,7 +244,7 @@ static int ds125df111_probe(struct i2c_client *client) struct ds125df111_priv *priv; int i, err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; priv->client = client; diff --git a/drivers/phy/ti/phy-gmii-sel.c b/drivers/phy/ti/phy-gmii-sel.c index c2865a6b1d7f..3649dc75c288 100644 --- a/drivers/phy/ti/phy-gmii-sel.c +++ b/drivers/phy/ti/phy-gmii-sel.c @@ -452,8 +452,7 @@ static int phy_gmii_sel_init_ports(struct phy_gmii_sel_priv *priv) priv->reg_offset = __be32_to_cpu(*offset); } - if_phys = devm_kcalloc(dev, priv->num_ports, - sizeof(*if_phys), GFP_KERNEL); + if_phys = devm_kzalloc_objs(dev, *if_phys, priv->num_ports); if (!if_phys) return -ENOMEM; dev_dbg(dev, "%s %d\n", __func__, priv->num_ports); @@ -489,7 +488,7 @@ static int phy_gmii_sel_probe(struct platform_device *pdev) if (!of_id) return -EINVAL; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c index 1f5dba49ace4..1494b10a62e1 100644 --- a/drivers/phy/ti/phy-j721e-wiz.c +++ b/drivers/phy/ti/phy-j721e-wiz.c @@ -748,7 +748,7 @@ static int wiz_phy_en_refclk_register(struct wiz *wiz) char *clk_name; unsigned int sz; - wiz_phy_en_refclk = devm_kzalloc(dev, sizeof(*wiz_phy_en_refclk), GFP_KERNEL); + wiz_phy_en_refclk = devm_kzalloc_obj(dev, *wiz_phy_en_refclk); if (!wiz_phy_en_refclk) return -ENOMEM; @@ -819,7 +819,7 @@ static int wiz_mux_clk_register(struct wiz *wiz, struct regmap_field *field, struct clk *clk; int ret = 0, i; - mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(dev, *mux); if (!mux) return -ENOMEM; @@ -880,7 +880,7 @@ static int wiz_mux_of_clk_register(struct wiz *wiz, struct device_node *node, struct clk *clk; int ret; - mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(dev, *mux); if (!mux) return -ENOMEM; @@ -975,7 +975,7 @@ static int wiz_div_clk_register(struct wiz *wiz, struct device_node *node, struct clk *clk; int ret; - div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL); + div = devm_kzalloc_obj(dev, *div); if (!div) return -ENOMEM; @@ -1483,7 +1483,7 @@ static int wiz_probe(struct platform_device *pdev) u32 num_lanes; const struct wiz_data *data; - wiz = devm_kzalloc(dev, sizeof(*wiz), GFP_KERNEL); + wiz = devm_kzalloc_obj(dev, *wiz); if (!wiz) return -ENOMEM; diff --git a/drivers/phy/ti/phy-omap-control.c b/drivers/phy/ti/phy-omap-control.c index 4968434312f8..999899710464 100644 --- a/drivers/phy/ti/phy-omap-control.c +++ b/drivers/phy/ti/phy-omap-control.c @@ -270,8 +270,7 @@ static int omap_control_phy_probe(struct platform_device *pdev) { struct omap_control_phy *control_phy; - control_phy = devm_kzalloc(&pdev->dev, sizeof(*control_phy), - GFP_KERNEL); + control_phy = devm_kzalloc_obj(&pdev->dev, *control_phy); if (!control_phy) return -ENOMEM; diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c index 1eb252604441..a531381fec1e 100644 --- a/drivers/phy/ti/phy-omap-usb2.c +++ b/drivers/phy/ti/phy-omap-usb2.c @@ -386,11 +386,11 @@ static int omap_usb2_probe(struct platform_device *pdev) if (!phy_data) return -EINVAL; - phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(&pdev->dev, *phy); if (!phy) return -ENOMEM; - otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL); + otg = devm_kzalloc_obj(&pdev->dev, *otg); if (!otg) return -ENOMEM; diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c index b5543b5c674c..c280e696fff9 100644 --- a/drivers/phy/ti/phy-ti-pipe3.c +++ b/drivers/phy/ti/phy-ti-pipe3.c @@ -794,7 +794,7 @@ static int ti_pipe3_probe(struct platform_device *pdev) int ret; const struct pipe3_data *data; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return -ENOMEM; diff --git a/drivers/phy/ti/phy-tusb1210.c b/drivers/phy/ti/phy-tusb1210.c index 9956921c094b..864125b05bba 100644 --- a/drivers/phy/ti/phy-tusb1210.c +++ b/drivers/phy/ti/phy-tusb1210.c @@ -492,7 +492,7 @@ static int tusb1210_probe(struct ulpi *ulpi) u8 val, reg; int ret; - tusb = devm_kzalloc(dev, sizeof(*tusb), GFP_KERNEL); + tusb = devm_kzalloc_obj(dev, *tusb); if (!tusb) return -ENOMEM; diff --git a/drivers/phy/ti/phy-twl4030-usb.c b/drivers/phy/ti/phy-twl4030-usb.c index a26aec3ab29e..580e5f697b0b 100644 --- a/drivers/phy/ti/phy-twl4030-usb.c +++ b/drivers/phy/ti/phy-twl4030-usb.c @@ -690,7 +690,7 @@ static int twl4030_usb_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct phy_provider *phy_provider; - twl = devm_kzalloc(&pdev->dev, sizeof(*twl), GFP_KERNEL); + twl = devm_kzalloc_obj(&pdev->dev, *twl); if (!twl) return -ENOMEM; @@ -704,7 +704,7 @@ static int twl4030_usb_probe(struct platform_device *pdev) return -EINVAL; } - otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL); + otg = devm_kzalloc_obj(&pdev->dev, *otg); if (!otg) return -ENOMEM; diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c index 240626b55475..f29093338711 100644 --- a/drivers/phy/xilinx/phy-zynqmp.c +++ b/drivers/phy/xilinx/phy-zynqmp.c @@ -1014,7 +1014,7 @@ static int xpsgtr_probe(struct platform_device *pdev) unsigned int port; int ret; - gtr_dev = devm_kzalloc(&pdev->dev, sizeof(*gtr_dev), GFP_KERNEL); + gtr_dev = devm_kzalloc_obj(&pdev->dev, *gtr_dev); if (!gtr_dev) return -ENOMEM; diff --git a/drivers/pinctrl/actions/pinctrl-owl.c b/drivers/pinctrl/actions/pinctrl-owl.c index 9f5637756bd3..c6d99af6b8ee 100644 --- a/drivers/pinctrl/actions/pinctrl-owl.c +++ b/drivers/pinctrl/actions/pinctrl-owl.c @@ -903,8 +903,8 @@ static int owl_gpio_init(struct owl_pinctrl *pctrl) gpio_irq->num_parents = pctrl->num_irq; gpio_irq->parents = pctrl->irq; - gpio_irq->map = devm_kcalloc(pctrl->dev, chip->ngpio, - sizeof(*gpio_irq->map), GFP_KERNEL); + gpio_irq->map = devm_kzalloc_objs(pctrl->dev, *gpio_irq->map, + chip->ngpio); if (!gpio_irq->map) return -ENOMEM; @@ -932,7 +932,7 @@ int owl_pinctrl_probe(struct platform_device *pdev, struct owl_pinctrl *pctrl; int ret, i; - pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(&pdev->dev, *pctrl); if (!pctrl) return -ENOMEM; @@ -983,8 +983,7 @@ int owl_pinctrl_probe(struct platform_device *pdev, pctrl->num_irq = ret; - pctrl->irq = devm_kcalloc(&pdev->dev, pctrl->num_irq, - sizeof(*pctrl->irq), GFP_KERNEL); + pctrl->irq = devm_kzalloc_objs(&pdev->dev, *pctrl->irq, pctrl->num_irq); if (!pctrl->irq) { ret = -ENOMEM; goto err_exit; diff --git a/drivers/pinctrl/airoha/pinctrl-airoha.c b/drivers/pinctrl/airoha/pinctrl-airoha.c index 52a768c859b7..32d4af044ae1 100644 --- a/drivers/pinctrl/airoha/pinctrl-airoha.c +++ b/drivers/pinctrl/airoha/pinctrl-airoha.c @@ -805,7 +805,7 @@ int airoha_pinctrl_probe(struct platform_device *pdev) if (!data) return -EINVAL; - pinctrl = devm_kzalloc(dev, sizeof(*pinctrl), GFP_KERNEL); + pinctrl = devm_kzalloc_obj(dev, *pinctrl); if (!pinctrl) return -ENOMEM; diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g7-soc1.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g7-soc1.c index f8b4066699ce..4707e5f28c19 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g7-soc1.c +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g7-soc1.c @@ -1691,7 +1691,7 @@ static int aspeed_g7_soc1_pinctrl_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int i, ret; - pctl = devm_kzalloc(dev, sizeof(*pctl), GFP_KERNEL); + pctl = devm_kzalloc_obj(dev, *pctl); if (!pctl) return -ENOMEM; diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index 725e880ae086..c155af38ab81 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -1299,7 +1299,7 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) BUILD_BUG_ON(ARRAY_SIZE(bcm2835_gpio_pins) != BCM2711_NUM_GPIOS); BUILD_BUG_ON(ARRAY_SIZE(bcm2835_gpio_groups) != BCM2711_NUM_GPIOS); - pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); + pc = devm_kzalloc_obj(dev, *pc); if (!pc) return -ENOMEM; @@ -1362,18 +1362,15 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &bcm2835_gpio_irq_chip); girq->parent_handler = bcm2835_gpio_irq_handler; girq->num_parents = BCM2835_NUM_IRQS; - girq->parents = devm_kcalloc(dev, BCM2835_NUM_IRQS, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, BCM2835_NUM_IRQS); if (!girq->parents) { err = -ENOMEM; goto out_remove; } if (is_7211) { - pc->wake_irq = devm_kcalloc(dev, BCM2835_NUM_IRQS, - sizeof(*pc->wake_irq), - GFP_KERNEL); + pc->wake_irq = devm_kzalloc_objs(dev, *pc->wake_irq, + BCM2835_NUM_IRQS); if (!pc->wake_irq) { err = -ENOMEM; goto out_remove; diff --git a/drivers/pinctrl/bcm/pinctrl-bcm4908.c b/drivers/pinctrl/bcm/pinctrl-bcm4908.c index 709ef4add927..3ccfc45f7a8d 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm4908.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm4908.c @@ -476,7 +476,7 @@ static int bcm4908_pinctrl_probe(struct platform_device *pdev) char **pin_names; int i; - bcm4908_pinctrl = devm_kzalloc(dev, sizeof(*bcm4908_pinctrl), GFP_KERNEL); + bcm4908_pinctrl = devm_kzalloc_obj(dev, *bcm4908_pinctrl); if (!bcm4908_pinctrl) return -ENOMEM; pctldesc = &bcm4908_pinctrl->pctldesc; @@ -500,7 +500,7 @@ static int bcm4908_pinctrl_probe(struct platform_device *pdev) if (IS_ERR(pin_names)) return PTR_ERR(pin_names); - pins = devm_kcalloc(dev, BCM4908_NUM_PINS, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, BCM4908_NUM_PINS); if (!pins) return -ENOMEM; for (i = 0; i < BCM4908_NUM_PINS; i++) { @@ -524,7 +524,7 @@ static int bcm4908_pinctrl_probe(struct platform_device *pdev) int *pins; int j; - pins = devm_kcalloc(dev, group->num_pins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, group->num_pins); if (!pins) return -ENOMEM; for (j = 0; j < group->num_pins; j++) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm6358.c b/drivers/pinctrl/bcm/pinctrl-bcm6358.c index 4c8cd65fc31e..8ac46d8f47bc 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm6358.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm6358.c @@ -332,7 +332,7 @@ static int bcm6358_pinctrl_probe(struct platform_device *pdev) struct bcm6358_priv *priv; int err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/pinctrl/bcm/pinctrl-bcm6368.c b/drivers/pinctrl/bcm/pinctrl-bcm6368.c index 6208467ba6f9..344800df792e 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm6368.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm6368.c @@ -477,7 +477,7 @@ static int bcm6368_pinctrl_probe(struct platform_device *pdev) struct bcm6368_priv *priv; int err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/pinctrl/bcm/pinctrl-bcm63xx.c b/drivers/pinctrl/bcm/pinctrl-bcm63xx.c index b41a3d16aabe..892f5edac292 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm63xx.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm63xx.c @@ -69,7 +69,7 @@ int bcm63xx_pinctrl_probe(struct platform_device *pdev, struct bcm63xx_pinctrl *pc; int err; - pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); + pc = devm_kzalloc_obj(dev, *pc); if (!pc) return -ENOMEM; diff --git a/drivers/pinctrl/bcm/pinctrl-brcmstb.c b/drivers/pinctrl/bcm/pinctrl-brcmstb.c index f46b27155c3c..d4ef954ab69f 100644 --- a/drivers/pinctrl/bcm/pinctrl-brcmstb.c +++ b/drivers/pinctrl/bcm/pinctrl-brcmstb.c @@ -389,7 +389,7 @@ int brcmstb_pinctrl_probe(struct platform_device *pdev) pdata = of_device_get_match_data(dev); - pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); + pc = devm_kzalloc_obj(dev, *pc); if (!pc) return -ENOMEM; diff --git a/drivers/pinctrl/bcm/pinctrl-cygnus-mux.c b/drivers/pinctrl/bcm/pinctrl-cygnus-mux.c index e9aa99f85e05..27ac1ee307b8 100644 --- a/drivers/pinctrl/bcm/pinctrl-cygnus-mux.c +++ b/drivers/pinctrl/bcm/pinctrl-cygnus-mux.c @@ -911,9 +911,9 @@ static int cygnus_mux_log_init(struct cygnus_pinctrl *pinctrl) struct cygnus_mux_log *log; unsigned int i, j; - pinctrl->mux_log = devm_kcalloc(pinctrl->dev, CYGNUS_NUM_IOMUX, - sizeof(struct cygnus_mux_log), - GFP_KERNEL); + pinctrl->mux_log = devm_kzalloc_objs(pinctrl->dev, + struct cygnus_mux_log, + CYGNUS_NUM_IOMUX); if (!pinctrl->mux_log) return -ENOMEM; @@ -937,7 +937,7 @@ static int cygnus_pinmux_probe(struct platform_device *pdev) int i, ret; struct pinctrl_pin_desc *pins; - pinctrl = devm_kzalloc(&pdev->dev, sizeof(*pinctrl), GFP_KERNEL); + pinctrl = devm_kzalloc_obj(&pdev->dev, *pinctrl); if (!pinctrl) return -ENOMEM; @@ -963,8 +963,7 @@ static int cygnus_pinmux_probe(struct platform_device *pdev) return ret; } - pins = devm_kcalloc(&pdev->dev, ARRAY_SIZE(cygnus_pins), sizeof(*pins), - GFP_KERNEL); + pins = devm_kzalloc_objs(&pdev->dev, *pins, ARRAY_SIZE(cygnus_pins)); if (!pins) return -ENOMEM; diff --git a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c index e20f7dc79d43..a3d87c2155ea 100644 --- a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c +++ b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c @@ -457,9 +457,8 @@ static int iproc_pinconf_disable_map_create(struct iproc_gpio *chip, * Allocate an array to store PINCONF parameters that need to be * disabled */ - chip->pinconf_disable = devm_kcalloc(chip->dev, nbits, - sizeof(*chip->pinconf_disable), - GFP_KERNEL); + chip->pinconf_disable = devm_kzalloc_objs(chip->dev, + *chip->pinconf_disable, nbits); if (!chip->pinconf_disable) return -ENOMEM; @@ -764,7 +763,7 @@ static int iproc_gpio_register_pinconf(struct iproc_gpio *chip) struct gpio_chip *gc = &chip->gc; int i; - pins = devm_kcalloc(chip->dev, gc->ngpio, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(chip->dev, *pins, gc->ngpio); if (!pins) return -ENOMEM; @@ -820,7 +819,7 @@ static int iproc_gpio_probe(struct platform_device *pdev) "brcm,iproc-stingray-gpio")) no_pinconf = true; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; @@ -880,9 +879,7 @@ static int iproc_gpio_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &iproc_gpio_irq_chip); girq->parent_handler = iproc_gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; girq->parents[0] = irq; diff --git a/drivers/pinctrl/bcm/pinctrl-ns.c b/drivers/pinctrl/bcm/pinctrl-ns.c index e134c9c73450..3026beb182cf 100644 --- a/drivers/pinctrl/bcm/pinctrl-ns.c +++ b/drivers/pinctrl/bcm/pinctrl-ns.c @@ -215,7 +215,7 @@ static int ns_pinctrl_probe(struct platform_device *pdev) struct resource *res; int i; - ns_pinctrl = devm_kzalloc(dev, sizeof(*ns_pinctrl), GFP_KERNEL); + ns_pinctrl = devm_kzalloc_obj(dev, *ns_pinctrl); if (!ns_pinctrl) return -ENOMEM; pctldesc = &ns_pinctrl->pctldesc; @@ -237,9 +237,8 @@ static int ns_pinctrl_probe(struct platform_device *pdev) /* Set pinctrl properties */ - pctldesc->pins = devm_kcalloc(dev, ARRAY_SIZE(ns_pinctrl_pins), - sizeof(struct pinctrl_pin_desc), - GFP_KERNEL); + pctldesc->pins = devm_kzalloc_objs(dev, struct pinctrl_pin_desc, + ARRAY_SIZE(ns_pinctrl_pins)); if (!pctldesc->pins) return -ENOMEM; for (i = 0, pin = (struct pinctrl_pin_desc *)&pctldesc->pins[0]; diff --git a/drivers/pinctrl/bcm/pinctrl-ns2-mux.c b/drivers/pinctrl/bcm/pinctrl-ns2-mux.c index 23ab3ab064b6..da985f9502c3 100644 --- a/drivers/pinctrl/bcm/pinctrl-ns2-mux.c +++ b/drivers/pinctrl/bcm/pinctrl-ns2-mux.c @@ -979,9 +979,8 @@ static int ns2_mux_log_init(struct ns2_pinctrl *pinctrl) struct ns2_mux_log *log; unsigned int i; - pinctrl->mux_log = devm_kcalloc(pinctrl->dev, NS2_NUM_IOMUX, - sizeof(struct ns2_mux_log), - GFP_KERNEL); + pinctrl->mux_log = devm_kzalloc_objs(pinctrl->dev, struct ns2_mux_log, + NS2_NUM_IOMUX); if (!pinctrl->mux_log) return -ENOMEM; @@ -1028,7 +1027,7 @@ static int ns2_pinmux_probe(struct platform_device *pdev) int i, ret; struct pinctrl_pin_desc *pins; - pinctrl = devm_kzalloc(&pdev->dev, sizeof(*pinctrl), GFP_KERNEL); + pinctrl = devm_kzalloc_obj(&pdev->dev, *pinctrl); if (!pinctrl) return -ENOMEM; @@ -1060,8 +1059,7 @@ static int ns2_pinmux_probe(struct platform_device *pdev) return ret; } - pins = devm_kcalloc(&pdev->dev, ARRAY_SIZE(ns2_pins), sizeof(*pins), - GFP_KERNEL); + pins = devm_kzalloc_objs(&pdev->dev, *pins, ARRAY_SIZE(ns2_pins)); if (!pins) return -ENOMEM; diff --git a/drivers/pinctrl/bcm/pinctrl-nsp-gpio.c b/drivers/pinctrl/bcm/pinctrl-nsp-gpio.c index 83fcc80d5967..3aeb7643c859 100644 --- a/drivers/pinctrl/bcm/pinctrl-nsp-gpio.c +++ b/drivers/pinctrl/bcm/pinctrl-nsp-gpio.c @@ -582,7 +582,7 @@ static int nsp_gpio_register_pinconf(struct nsp_gpio *chip) struct gpio_chip *gc = &chip->gc; int i; - pins = devm_kcalloc(chip->dev, gc->ngpio, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(chip->dev, *pins, gc->ngpio); if (!pins) return -ENOMEM; for (i = 0; i < gc->ngpio; i++) { @@ -625,7 +625,7 @@ static int nsp_gpio_probe(struct platform_device *pdev) return -ENODEV; } - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/pinctrl/bcm/pinctrl-nsp-mux.c b/drivers/pinctrl/bcm/pinctrl-nsp-mux.c index 9b716c0d2b94..8c7cb1c7d9c8 100644 --- a/drivers/pinctrl/bcm/pinctrl-nsp-mux.c +++ b/drivers/pinctrl/bcm/pinctrl-nsp-mux.c @@ -534,9 +534,8 @@ static int nsp_mux_log_init(struct nsp_pinctrl *pinctrl) unsigned int i; u32 no_of_groups = ARRAY_SIZE(nsp_pin_groups); - pinctrl->mux_log = devm_kcalloc(pinctrl->dev, no_of_groups, - sizeof(struct nsp_mux_log), - GFP_KERNEL); + pinctrl->mux_log = devm_kzalloc_objs(pinctrl->dev, struct nsp_mux_log, + no_of_groups); if (!pinctrl->mux_log) return -ENOMEM; @@ -558,7 +557,7 @@ static int nsp_pinmux_probe(struct platform_device *pdev) int i, ret; struct pinctrl_pin_desc *pins; - pinctrl = devm_kzalloc(&pdev->dev, sizeof(*pinctrl), GFP_KERNEL); + pinctrl = devm_kzalloc_obj(&pdev->dev, *pinctrl); if (!pinctrl) return -ENOMEM; pinctrl->dev = &pdev->dev; @@ -589,8 +588,7 @@ static int nsp_pinmux_probe(struct platform_device *pdev) return ret; } - pins = devm_kcalloc(&pdev->dev, ARRAY_SIZE(nsp_pins), sizeof(*pins), - GFP_KERNEL); + pins = devm_kzalloc_objs(&pdev->dev, *pins, ARRAY_SIZE(nsp_pins)); if (!pins) return -ENOMEM; diff --git a/drivers/pinctrl/berlin/berlin-bg4ct.c b/drivers/pinctrl/berlin/berlin-bg4ct.c index 9bf0a54f2798..b9ec9be42a17 100644 --- a/drivers/pinctrl/berlin/berlin-bg4ct.c +++ b/drivers/pinctrl/berlin/berlin-bg4ct.c @@ -457,7 +457,7 @@ static int berlin4ct_pinctrl_probe(struct platform_device *pdev) struct resource *res; void __iomem *base; - rmconfig = devm_kzalloc(&pdev->dev, sizeof(*rmconfig), GFP_KERNEL); + rmconfig = devm_kzalloc_obj(&pdev->dev, *rmconfig); if (!rmconfig) return -ENOMEM; diff --git a/drivers/pinctrl/berlin/berlin.c b/drivers/pinctrl/berlin/berlin.c index 7971339e269f..8a612ce2d1d3 100644 --- a/drivers/pinctrl/berlin/berlin.c +++ b/drivers/pinctrl/berlin/berlin.c @@ -264,10 +264,9 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev) if (!function->groups) { function->groups = - devm_kcalloc(&pdev->dev, - function->ngroups, - sizeof(*function->groups), - GFP_KERNEL); + devm_kzalloc_objs(&pdev->dev, + *function->groups, + function->ngroups); if (!function->groups) { kfree(pctrl->functions); return -ENOMEM; @@ -302,7 +301,7 @@ int berlin_pinctrl_probe_regmap(struct platform_device *pdev, struct berlin_pinctrl *pctrl; int ret; - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/berlin/pinctrl-as370.c b/drivers/pinctrl/berlin/pinctrl-as370.c index fc0daec94e10..676194b38d76 100644 --- a/drivers/pinctrl/berlin/pinctrl-as370.c +++ b/drivers/pinctrl/berlin/pinctrl-as370.c @@ -338,7 +338,7 @@ static int as370_pinctrl_probe(struct platform_device *pdev) struct resource *res; void __iomem *base; - rmconfig = devm_kzalloc(&pdev->dev, sizeof(*rmconfig), GFP_KERNEL); + rmconfig = devm_kzalloc_obj(&pdev->dev, *rmconfig); if (!rmconfig) return -ENOMEM; diff --git a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c index 8990fab0446c..a1c839b35557 100644 --- a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c +++ b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c @@ -543,7 +543,7 @@ static int cs42l43_pin_probe(struct platform_device *pdev) struct fwnode_handle *fwnode = dev_fwnode(cs42l43->dev); int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/pinctrl/cirrus/pinctrl-lochnagar.c b/drivers/pinctrl/cirrus/pinctrl-lochnagar.c index ca6ae566082b..d0520c94cadb 100644 --- a/drivers/pinctrl/cirrus/pinctrl-lochnagar.c +++ b/drivers/pinctrl/cirrus/pinctrl-lochnagar.c @@ -1117,9 +1117,8 @@ static int lochnagar_fill_func_groups(struct lochnagar_pin_priv *priv) if (!funcs->ngroups) continue; - funcs->groups = devm_kcalloc(priv->dev, funcs->ngroups, - sizeof(*funcs->groups), - GFP_KERNEL); + funcs->groups = devm_kzalloc_objs(priv->dev, *funcs->groups, + funcs->ngroups); if (!funcs->groups) return -ENOMEM; @@ -1144,14 +1143,14 @@ static int lochnagar_pin_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; priv->dev = dev; priv->lochnagar = lochnagar; - desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL); + desc = devm_kzalloc_obj(dev, *desc); if (!desc) return -ENOMEM; diff --git a/drivers/pinctrl/cirrus/pinctrl-madera-core.c b/drivers/pinctrl/cirrus/pinctrl-madera-core.c index 1d9481b17091..61a84e9b07ed 100644 --- a/drivers/pinctrl/cirrus/pinctrl-madera-core.c +++ b/drivers/pinctrl/cirrus/pinctrl-madera-core.c @@ -1009,7 +1009,7 @@ static int madera_pin_probe(struct platform_device *pdev) device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/pinctrl/cix/pinctrl-sky1-base.c b/drivers/pinctrl/cix/pinctrl-sky1-base.c index a5b583f10441..490115ef8b64 100644 --- a/drivers/pinctrl/cix/pinctrl-sky1-base.c +++ b/drivers/pinctrl/cix/pinctrl-sky1-base.c @@ -479,14 +479,14 @@ static int sky1_pctrl_build_state(struct platform_device *pdev) int i; /* Allocate groups */ - spctl->groups = devm_kcalloc(&pdev->dev, info->npins, - sizeof(*spctl->groups), GFP_KERNEL); + spctl->groups = devm_kzalloc_objs(&pdev->dev, *spctl->groups, + info->npins); if (!spctl->groups) return -ENOMEM; /* We assume that one pin is one group, use pin name as group name. */ - spctl->grp_names = devm_kcalloc(&pdev->dev, info->npins, - sizeof(*spctl->grp_names), GFP_KERNEL); + spctl->grp_names = devm_kzalloc_objs(&pdev->dev, *spctl->grp_names, + info->npins); if (!spctl->grp_names) return -ENOMEM; @@ -517,7 +517,7 @@ int sky1_base_pinctrl_probe(struct platform_device *pdev, } /* Create state holders etc for this driver */ - spctl = devm_kzalloc(&pdev->dev, sizeof(*spctl), GFP_KERNEL); + spctl = devm_kzalloc_obj(&pdev->dev, *spctl); if (!spctl) return -ENOMEM; @@ -528,13 +528,11 @@ int sky1_base_pinctrl_probe(struct platform_device *pdev, if (IS_ERR(spctl->base)) return PTR_ERR(spctl->base); - sky1_pinctrl_desc = devm_kzalloc(&pdev->dev, sizeof(*sky1_pinctrl_desc), - GFP_KERNEL); + sky1_pinctrl_desc = devm_kzalloc_obj(&pdev->dev, *sky1_pinctrl_desc); if (!sky1_pinctrl_desc) return -ENOMEM; - pins = devm_kcalloc(&pdev->dev, info->npins, sizeof(*pins), - GFP_KERNEL); + pins = devm_kzalloc_objs(&pdev->dev, *pins, info->npins); if (!pins) return -ENOMEM; for (i = 0; i < info->npins; i++) diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index ba6c71e6fc2c..4968747a9650 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -668,7 +668,7 @@ int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name, selector = pctldev->num_groups; - group = devm_kzalloc(pctldev->dev, sizeof(*group), GFP_KERNEL); + group = devm_kzalloc_obj(pctldev->dev, *group); if (!group) return -ENOMEM; diff --git a/drivers/pinctrl/freescale/pinctrl-imx-scmi.c b/drivers/pinctrl/freescale/pinctrl-imx-scmi.c index 613552e35070..2cc3521f8df4 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx-scmi.c +++ b/drivers/pinctrl/freescale/pinctrl-imx-scmi.c @@ -279,7 +279,7 @@ scmi_pinctrl_imx_get_pins(struct scmi_pinctrl_imx *pmx, struct pinctrl_desc *des int ret, i; npins = pmx->ops->count_get(pmx->ph, PIN_TYPE); - pins = devm_kmalloc_array(pmx->dev, npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kmalloc_objs(pmx->dev, *pins, npins); if (!pins) return -ENOMEM; @@ -325,7 +325,7 @@ static int scmi_pinctrl_imx_probe(struct scmi_device *sdev) if (IS_ERR(pinctrl_ops)) return PTR_ERR(pinctrl_ops); - pmx = devm_kzalloc(dev, sizeof(*pmx), GFP_KERNEL); + pmx = devm_kzalloc_obj(dev, *pmx); if (!pmx) return -ENOMEM; diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c index 5a06be45f5c3..ebcce9aeac8c 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.c +++ b/drivers/pinctrl/freescale/pinctrl-imx.c @@ -600,11 +600,11 @@ static int imx_pinctrl_parse_groups(struct device_node *np, } grp->grp.npins = size / pin_size; - grp->data = devm_kcalloc(ipctl->dev, grp->grp.npins, sizeof(*pin), GFP_KERNEL); + grp->data = devm_kzalloc_objs(ipctl->dev, *pin, grp->grp.npins); if (!grp->data) return -ENOMEM; - pins = devm_kcalloc(ipctl->dev, grp->grp.npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(ipctl->dev, *pins, grp->grp.npins); if (!pins) return -ENOMEM; grp->grp.pins = pins; @@ -633,7 +633,7 @@ static int imx_pinctrl_parse_functions(struct device_node *np, dev_dbg(pctl->dev, "parse function(%d): %pOFn\n", index, np); - func = devm_kzalloc(ipctl->dev, sizeof(*func), GFP_KERNEL); + func = devm_kzalloc_obj(ipctl->dev, *func); if (!func) return -ENOMEM; @@ -645,8 +645,7 @@ static int imx_pinctrl_parse_functions(struct device_node *np, return -EINVAL; } - group_names = devm_kcalloc(ipctl->dev, func->ngroups, - sizeof(*group_names), GFP_KERNEL); + group_names = devm_kzalloc_objs(ipctl->dev, *group_names, func->ngroups); if (!group_names) return -ENOMEM; i = 0; @@ -660,7 +659,7 @@ static int imx_pinctrl_parse_functions(struct device_node *np, i = 0; for_each_child_of_node_scoped(np, child) { - grp = devm_kzalloc(ipctl->dev, sizeof(*grp), GFP_KERNEL); + grp = devm_kzalloc_obj(ipctl->dev, *grp); if (!grp) return -ENOMEM; @@ -766,14 +765,14 @@ int imx_pinctrl_probe(struct platform_device *pdev, } /* Create state holders etc for this driver */ - ipctl = devm_kzalloc(&pdev->dev, sizeof(*ipctl), GFP_KERNEL); + ipctl = devm_kzalloc_obj(&pdev->dev, *ipctl); if (!ipctl) return -ENOMEM; if (!(info->flags & IMX_USE_SCU)) { - ipctl->pin_regs = devm_kmalloc_array(&pdev->dev, info->npins, - sizeof(*ipctl->pin_regs), - GFP_KERNEL); + ipctl->pin_regs = devm_kmalloc_objs(&pdev->dev, + *ipctl->pin_regs, + info->npins); if (!ipctl->pin_regs) return -ENOMEM; @@ -803,8 +802,7 @@ int imx_pinctrl_probe(struct platform_device *pdev, } } - imx_pinctrl_desc = devm_kzalloc(&pdev->dev, sizeof(*imx_pinctrl_desc), - GFP_KERNEL); + imx_pinctrl_desc = devm_kzalloc_obj(&pdev->dev, *imx_pinctrl_desc); if (!imx_pinctrl_desc) return -ENOMEM; diff --git a/drivers/pinctrl/freescale/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c index 4a6bdaefa42f..0791de29b827 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c +++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c @@ -484,10 +484,8 @@ static int imx1_pinctrl_parse_groups(struct device_node *np, } grp->npins = size / 12; - grp->pins = devm_kcalloc(info->dev, - grp->npins, sizeof(struct imx1_pin), GFP_KERNEL); - grp->pin_ids = devm_kcalloc(info->dev, - grp->npins, sizeof(unsigned int), GFP_KERNEL); + grp->pins = devm_kzalloc_objs(info->dev, struct imx1_pin, grp->npins); + grp->pin_ids = devm_kzalloc_objs(info->dev, unsigned int, grp->npins); if (!grp->pins || !grp->pin_ids) return -ENOMEM; @@ -590,12 +588,12 @@ static int imx1_pinctrl_parse_dt(struct platform_device *pdev, } info->nfunctions = nfuncs; - info->functions = devm_kcalloc(&pdev->dev, - nfuncs, sizeof(struct imx1_pmx_func), GFP_KERNEL); + info->functions = devm_kzalloc_objs(&pdev->dev, struct imx1_pmx_func, + nfuncs); info->ngroups = ngroups; - info->groups = devm_kcalloc(&pdev->dev, - ngroups, sizeof(struct imx1_pin_group), GFP_KERNEL); + info->groups = devm_kzalloc_objs(&pdev->dev, struct imx1_pin_group, + ngroups); if (!info->functions || !info->groups) @@ -629,7 +627,7 @@ int imx1_pinctrl_core_probe(struct platform_device *pdev, info->dev = &pdev->dev; /* Create state holders etc for this driver */ - ipctl = devm_kzalloc(&pdev->dev, sizeof(*ipctl), GFP_KERNEL); + ipctl = devm_kzalloc_obj(&pdev->dev, *ipctl); if (!ipctl) return -ENOMEM; diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c index 6280009be3fa..e68dccc59ca5 100644 --- a/drivers/pinctrl/freescale/pinctrl-mxs.c +++ b/drivers/pinctrl/freescale/pinctrl-mxs.c @@ -373,8 +373,7 @@ static int mxs_pinctrl_parse_group(struct platform_device *pdev, return -EINVAL; g->npins = length / sizeof(u32); - g->pins = devm_kcalloc(&pdev->dev, g->npins, sizeof(*g->pins), - GFP_KERNEL); + g->pins = devm_kzalloc_objs(&pdev->dev, *g->pins, g->npins); if (!g->pins) return -ENOMEM; @@ -434,16 +433,12 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev, } } - soc->functions = devm_kcalloc(&pdev->dev, - soc->nfunctions, - sizeof(*soc->functions), - GFP_KERNEL); + soc->functions = devm_kzalloc_objs(&pdev->dev, *soc->functions, + soc->nfunctions); if (!soc->functions) return -ENOMEM; - soc->groups = devm_kcalloc(&pdev->dev, - soc->ngroups, sizeof(*soc->groups), - GFP_KERNEL); + soc->groups = devm_kzalloc_objs(&pdev->dev, *soc->groups, soc->ngroups); if (!soc->groups) return -ENOMEM; @@ -503,10 +498,8 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev, if (strcmp(fn, child->name)) { f = &soc->functions[idxf++]; - f->groups = devm_kcalloc(&pdev->dev, - f->ngroups, - sizeof(*f->groups), - GFP_KERNEL); + f->groups = devm_kzalloc_objs(&pdev->dev, *f->groups, + f->ngroups); if (!f->groups) return -ENOMEM; fn = child->name; @@ -528,7 +521,7 @@ int mxs_pinctrl_probe(struct platform_device *pdev, struct mxs_pinctrl_data *d; int ret; - d = devm_kzalloc(&pdev->dev, sizeof(*d), GFP_KERNEL); + d = devm_kzalloc_obj(&pdev->dev, *d); if (!d) return -ENOMEM; diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index b733ec31ad9d..081cef82695d 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -1525,8 +1525,8 @@ static int byt_gpio_probe(struct intel_pinctrl *vg) gc->ngpio = vg->soc->npins; #ifdef CONFIG_PM_SLEEP - vg->context.pads = devm_kcalloc(vg->dev, gc->ngpio, sizeof(*vg->context.pads), - GFP_KERNEL); + vg->context.pads = devm_kzalloc_objs(vg->dev, *vg->context.pads, + gc->ngpio); if (!vg->context.pads) return -ENOMEM; #endif @@ -1542,8 +1542,8 @@ static int byt_gpio_probe(struct intel_pinctrl *vg) girq->init_valid_mask = byt_init_irq_valid_mask; girq->parent_handler = byt_gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(vg->dev, girq->num_parents, - sizeof(*girq->parents), GFP_KERNEL); + girq->parents = devm_kzalloc_objs(vg->dev, *girq->parents, + girq->num_parents); if (!girq->parents) return -ENOMEM; girq->parents[0] = irq; @@ -1600,7 +1600,7 @@ static int byt_pinctrl_probe(struct platform_device *pdev) if (IS_ERR(soc_data)) return PTR_ERR(soc_data); - vg = devm_kzalloc(dev, sizeof(*vg), GFP_KERNEL); + vg = devm_kzalloc_obj(dev, *vg); if (!vg) return -ENOMEM; diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c index a33eca5eafc4..37bb0b07ed1a 100644 --- a/drivers/pinctrl/intel/pinctrl-cherryview.c +++ b/drivers/pinctrl/intel/pinctrl-cherryview.c @@ -1595,7 +1595,7 @@ static int chv_pinctrl_probe(struct platform_device *pdev) if (IS_ERR(soc_data)) return PTR_ERR(soc_data); - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; @@ -1616,16 +1616,15 @@ static int chv_pinctrl_probe(struct platform_device *pdev) community->pad_regs = community->regs + FAMILY_PAD_REGS_OFF; #ifdef CONFIG_PM_SLEEP - pctrl->context.pads = devm_kcalloc(dev, pctrl->soc->npins, - sizeof(*pctrl->context.pads), - GFP_KERNEL); + pctrl->context.pads = devm_kzalloc_objs(dev, *pctrl->context.pads, + pctrl->soc->npins); if (!pctrl->context.pads) return -ENOMEM; #endif - pctrl->context.communities = devm_kcalloc(dev, pctrl->soc->ncommunities, - sizeof(*pctrl->context.communities), - GFP_KERNEL); + pctrl->context.communities = devm_kzalloc_objs(dev, + *pctrl->context.communities, + pctrl->soc->ncommunities); if (!pctrl->context.communities) return -ENOMEM; diff --git a/drivers/pinctrl/intel/pinctrl-intel-platform.c b/drivers/pinctrl/intel/pinctrl-intel-platform.c index c83e3859b655..11d819f1a6f5 100644 --- a/drivers/pinctrl/intel/pinctrl-intel-platform.c +++ b/drivers/pinctrl/intel/pinctrl-intel-platform.c @@ -124,7 +124,7 @@ static int intel_platform_pinctrl_prepare_community(struct device *dev, if (!ngpps) return -ENODEV; - gpps = devm_kcalloc(dev, ngpps, sizeof(*gpps), GFP_KERNEL); + gpps = devm_kzalloc_objs(dev, *gpps, ngpps); if (!gpps) return -ENOMEM; @@ -158,7 +158,7 @@ static int intel_platform_pinctrl_prepare_soc_data(struct device *dev, /* Version 1.0 of the specification assumes only a single community per device node */ ncommunities = 1; - communities = devm_kcalloc(dev, ncommunities, sizeof(*communities), GFP_KERNEL); + communities = devm_kzalloc_objs(dev, *communities, ncommunities); if (!communities) return -ENOMEM; @@ -190,7 +190,7 @@ static int intel_platform_pinctrl_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index 1363301098d5..51a86975909c 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -1440,7 +1440,7 @@ static int intel_pinctrl_add_padgroups_by_gpps(struct intel_pinctrl *pctrl, unsigned int padown_num = 0; size_t i, ngpps = community->ngpps; - gpps = devm_kcalloc(pctrl->dev, ngpps, sizeof(*gpps), GFP_KERNEL); + gpps = devm_kzalloc_objs(pctrl->dev, *gpps, ngpps); if (!gpps) return -ENOMEM; @@ -1484,7 +1484,7 @@ static int intel_pinctrl_add_padgroups_by_size(struct intel_pinctrl *pctrl, if (community->gpp_size > INTEL_PINCTRL_MAX_GPP_SIZE) return -EINVAL; - gpps = devm_kcalloc(pctrl->dev, ngpps, sizeof(*gpps), GFP_KERNEL); + gpps = devm_kzalloc_objs(pctrl->dev, *gpps, ngpps); if (!gpps) return -ENOMEM; @@ -1516,12 +1516,12 @@ static int intel_pinctrl_pm_init(struct intel_pinctrl *pctrl) struct intel_pad_context *pads; int i; - pads = devm_kcalloc(pctrl->dev, soc->npins, sizeof(*pads), GFP_KERNEL); + pads = devm_kzalloc_objs(pctrl->dev, *pads, soc->npins); if (!pads) return -ENOMEM; - communities = devm_kcalloc(pctrl->dev, pctrl->ncommunities, - sizeof(*communities), GFP_KERNEL); + communities = devm_kzalloc_objs(pctrl->dev, *communities, + pctrl->ncommunities); if (!communities) return -ENOMEM; @@ -1530,15 +1530,15 @@ static int intel_pinctrl_pm_init(struct intel_pinctrl *pctrl) struct intel_community *community = &pctrl->communities[i]; u32 *intmask, *hostown; - intmask = devm_kcalloc(pctrl->dev, community->ngpps, - sizeof(*intmask), GFP_KERNEL); + intmask = devm_kzalloc_objs(pctrl->dev, *intmask, + community->ngpps); if (!intmask) return -ENOMEM; communities[i].intmask = intmask; - hostown = devm_kcalloc(pctrl->dev, community->ngpps, - sizeof(*hostown), GFP_KERNEL); + hostown = devm_kzalloc_objs(pctrl->dev, *hostown, + community->ngpps); if (!hostown) return -ENOMEM; @@ -1582,7 +1582,7 @@ int intel_pinctrl_probe(struct platform_device *pdev, struct intel_pinctrl *pctrl; int i, ret, irq; - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/intel/pinctrl-lynxpoint.c b/drivers/pinctrl/intel/pinctrl-lynxpoint.c index 299ee4f22bdc..c5131e100e5d 100644 --- a/drivers/pinctrl/intel/pinctrl-lynxpoint.c +++ b/drivers/pinctrl/intel/pinctrl-lynxpoint.c @@ -715,7 +715,7 @@ static int lp_gpio_probe(struct platform_device *pdev) if (!soc) return -ENODEV; - lg = devm_kzalloc(dev, sizeof(*lg), GFP_KERNEL); + lg = devm_kzalloc_obj(dev, *lg); if (!lg) return -ENOMEM; @@ -723,8 +723,8 @@ static int lp_gpio_probe(struct platform_device *pdev) lg->soc = soc; lg->ncommunities = lg->soc->ncommunities; - lg->communities = devm_kcalloc(dev, lg->ncommunities, - sizeof(*lg->communities), GFP_KERNEL); + lg->communities = devm_kzalloc_objs(dev, *lg->communities, + lg->ncommunities); if (!lg->communities) return -ENOMEM; @@ -785,9 +785,8 @@ static int lp_gpio_probe(struct platform_device *pdev) girq->init_hw = lp_gpio_irq_init_hw; girq->parent_handler = lp_gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, girq->num_parents, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, + girq->num_parents); if (!girq->parents) return -ENOMEM; girq->parents[0] = irq; diff --git a/drivers/pinctrl/mediatek/mtk-eint.c b/drivers/pinctrl/mediatek/mtk-eint.c index 827231dc0d24..389ceaffcee4 100644 --- a/drivers/pinctrl/mediatek/mtk-eint.c +++ b/drivers/pinctrl/mediatek/mtk-eint.c @@ -540,8 +540,8 @@ int mtk_eint_do_init(struct mtk_eint *eint, struct mtk_eint_pin *eint_pin) if (!eint->regs) eint->regs = &mtk_generic_eint_regs; - eint->base_pin_num = devm_kmalloc_array(eint->dev, eint->nbase, sizeof(u16), - GFP_KERNEL | __GFP_ZERO); + eint->base_pin_num = devm_kmalloc_objs(eint->dev, u16, eint->nbase, + GFP_KERNEL | __GFP_ZERO); if (!eint->base_pin_num) return -ENOMEM; @@ -567,18 +567,18 @@ int mtk_eint_do_init(struct mtk_eint *eint, struct mtk_eint_pin *eint_pin) } } - eint->pin_list = devm_kcalloc(eint->dev, eint->nbase, - sizeof(*eint->pin_list), GFP_KERNEL); + eint->pin_list = devm_kzalloc_objs(eint->dev, *eint->pin_list, + eint->nbase); if (!eint->pin_list) goto err_pin_list; - eint->wake_mask = devm_kcalloc(eint->dev, eint->nbase, - sizeof(*eint->wake_mask), GFP_KERNEL); + eint->wake_mask = devm_kzalloc_objs(eint->dev, *eint->wake_mask, + eint->nbase); if (!eint->wake_mask) goto err_wake_mask; - eint->cur_mask = devm_kcalloc(eint->dev, eint->nbase, - sizeof(*eint->cur_mask), GFP_KERNEL); + eint->cur_mask = devm_kzalloc_objs(eint->dev, *eint->cur_mask, + eint->nbase); if (!eint->cur_mask) goto err_cur_mask; diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c index fdfbe007b84f..487b146e9c05 100644 --- a/drivers/pinctrl/mediatek/pinctrl-moore.c +++ b/drivers/pinctrl/mediatek/pinctrl-moore.c @@ -661,7 +661,7 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev, struct mtk_pinctrl *hw; int err, i; - hw = devm_kzalloc(&pdev->dev, sizeof(*hw), GFP_KERNEL); + hw = devm_kzalloc_obj(&pdev->dev, *hw); if (!hw) return -ENOMEM; @@ -672,8 +672,8 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev, return dev_err_probe(dev, -EINVAL, "SoC should be assigned at least one register base\n"); - hw->base = devm_kmalloc_array(&pdev->dev, hw->soc->nbase_names, - sizeof(*hw->base), GFP_KERNEL); + hw->base = devm_kmalloc_objs(&pdev->dev, *hw->base, + hw->soc->nbase_names); if (!hw->base) return -ENOMEM; @@ -689,8 +689,7 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev, spin_lock_init(&hw->lock); /* Copy from internal struct mtk_pin_desc to register to the core */ - pins = devm_kmalloc_array(&pdev->dev, hw->soc->npins, sizeof(*pins), - GFP_KERNEL); + pins = devm_kmalloc_objs(&pdev->dev, *pins, hw->soc->npins); if (!pins) return -ENOMEM; diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c index faa6dbf0f635..e01a782bbc3d 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c @@ -377,7 +377,7 @@ int mtk_build_eint(struct mtk_pinctrl *hw, struct platform_device *pdev) if (!of_property_read_bool(np, "interrupt-controller")) return -ENODEV; - hw->eint = devm_kzalloc(hw->dev, sizeof(*hw->eint), GFP_KERNEL); + hw->eint = devm_kzalloc_obj(hw->dev, *hw->eint); if (!hw->eint) return -ENOMEM; @@ -389,8 +389,9 @@ int mtk_build_eint(struct mtk_pinctrl *hw, struct platform_device *pdev) if (hw->eint->nbase <= 0) return -EINVAL; - hw->eint->base = devm_kmalloc_array(&pdev->dev, hw->eint->nbase, - sizeof(*hw->eint->base), GFP_KERNEL | __GFP_ZERO); + hw->eint->base = devm_kmalloc_objs(&pdev->dev, *hw->eint->base, + hw->eint->nbase, + GFP_KERNEL | __GFP_ZERO); if (!hw->eint->base) { ret = -ENOMEM; goto err_free_base; diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c index 857d39f3438d..9b642d3a2be0 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c @@ -939,14 +939,14 @@ static int mtk_pctrl_build_state(struct platform_device *pdev) pctl->ngroups = pctl->devdata->npins; /* Allocate groups */ - pctl->groups = devm_kcalloc(&pdev->dev, pctl->ngroups, - sizeof(*pctl->groups), GFP_KERNEL); + pctl->groups = devm_kzalloc_objs(&pdev->dev, *pctl->groups, + pctl->ngroups); if (!pctl->groups) return -ENOMEM; /* We assume that one pin is one group, use pin name as group name. */ - pctl->grp_names = devm_kcalloc(&pdev->dev, pctl->ngroups, - sizeof(*pctl->grp_names), GFP_KERNEL); + pctl->grp_names = devm_kzalloc_objs(&pdev->dev, *pctl->grp_names, + pctl->ngroups); if (!pctl->grp_names) return -ENOMEM; @@ -1026,14 +1026,13 @@ static int mtk_eint_init(struct mtk_pinctrl *pctl, struct platform_device *pdev) if (!of_property_read_bool(np, "interrupt-controller")) return -ENODEV; - pctl->eint = devm_kzalloc(pctl->dev, sizeof(*pctl->eint), GFP_KERNEL); + pctl->eint = devm_kzalloc_obj(pctl->dev, *pctl->eint); if (!pctl->eint) return -ENOMEM; pctl->eint->nbase = 1; /* mtk-eint expects an array */ - pctl->eint->base = devm_kzalloc(pctl->dev, sizeof(*pctl->eint->base), - GFP_KERNEL); + pctl->eint->base = devm_kzalloc_obj(pctl->dev, *pctl->eint->base); if (!pctl->eint->base) return -ENOMEM; @@ -1069,7 +1068,7 @@ int mtk_pctrl_init(struct platform_device *pdev, struct device_node *np = pdev->dev.of_node, *node; int ret, i; - pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); + pctl = devm_kzalloc_obj(&pdev->dev, *pctl); if (!pctl) return -ENOMEM; @@ -1101,8 +1100,7 @@ int mtk_pctrl_init(struct platform_device *pdev, if (ret) return dev_err_probe(dev, ret, "build state failed\n"); - pins = devm_kcalloc(&pdev->dev, pctl->devdata->npins, sizeof(*pins), - GFP_KERNEL); + pins = devm_kzalloc_objs(&pdev->dev, *pins, pctl->devdata->npins); if (!pins) return -ENOMEM; @@ -1124,7 +1122,7 @@ int mtk_pctrl_init(struct platform_device *pdev, return dev_err_probe(dev, PTR_ERR(pctl->pctl_dev), "Couldn't register pinctrl driver\n"); - pctl->chip = devm_kzalloc(&pdev->dev, sizeof(*pctl->chip), GFP_KERNEL); + pctl->chip = devm_kzalloc_obj(&pdev->dev, *pctl->chip); if (!pctl->chip) return -ENOMEM; diff --git a/drivers/pinctrl/mediatek/pinctrl-mtmips.c b/drivers/pinctrl/mediatek/pinctrl-mtmips.c index b2d7a79ff9cc..efac14accce3 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtmips.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtmips.c @@ -217,10 +217,8 @@ static int mtmips_pinctrl_index(struct mtmips_priv *p) p->func_count++; /* allocate our function and group mapping index buffers */ - p->func = devm_kcalloc(p->dev, p->func_count, - sizeof(*p->func), GFP_KERNEL); - gpio_func.groups = devm_kcalloc(p->dev, p->group_count, sizeof(int), - GFP_KERNEL); + p->func = devm_kzalloc_objs(p->dev, *p->func, p->func_count); + gpio_func.groups = devm_kzalloc_objs(p->dev, int, p->group_count); if (!p->func || !gpio_func.groups) return -ENOMEM; @@ -236,8 +234,7 @@ static int mtmips_pinctrl_index(struct mtmips_priv *p) for (i = 0; i < p->group_count; i++) { for (j = 0; j < p->groups[i].func_count; j++) { p->func[c] = &p->groups[i].func[j]; - p->func[c]->groups = devm_kzalloc(p->dev, sizeof(int), - GFP_KERNEL); + p->func[c]->groups = devm_kzalloc_obj(p->dev, int); if (!p->func[c]->groups) return -ENOMEM; p->func[c]->groups[0] = i; @@ -262,10 +259,8 @@ static int mtmips_pinctrl_pins(struct mtmips_priv *p) if (!p->func[i]->pin_count) continue; - p->func[i]->pins = devm_kcalloc(p->dev, - p->func[i]->pin_count, - sizeof(int), - GFP_KERNEL); + p->func[i]->pins = devm_kzalloc_objs(p->dev, int, + p->func[i]->pin_count); if (!p->func[i]->pins) return -ENOMEM; for (j = 0; j < p->func[i]->pin_count; j++) @@ -279,8 +274,8 @@ static int mtmips_pinctrl_pins(struct mtmips_priv *p) /* the buffer that tells us which pins are gpio */ p->gpio = devm_kcalloc(p->dev, p->max_pins, sizeof(u8), GFP_KERNEL); /* the pads needed to tell pinctrl about our pins */ - p->pads = devm_kcalloc(p->dev, p->max_pins, - sizeof(struct pinctrl_pin_desc), GFP_KERNEL); + p->pads = devm_kzalloc_objs(p->dev, struct pinctrl_pin_desc, + p->max_pins); if (!p->pads || !p->gpio) return -ENOMEM; @@ -324,7 +319,7 @@ int mtmips_pinctrl_init(struct platform_device *pdev, return -ENOTSUPP; /* setup the private data */ - p = devm_kzalloc(&pdev->dev, sizeof(struct mtmips_priv), GFP_KERNEL); + p = devm_kzalloc_obj(&pdev->dev, struct mtmips_priv); if (!p) return -ENOMEM; diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c index 09098b68f725..1ae8133dd9c5 100644 --- a/drivers/pinctrl/mediatek/pinctrl-paris.c +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c @@ -970,14 +970,13 @@ static int mtk_pctrl_build_state(struct platform_device *pdev) int i; /* Allocate groups */ - hw->groups = devm_kmalloc_array(&pdev->dev, hw->soc->ngrps, - sizeof(*hw->groups), GFP_KERNEL); + hw->groups = devm_kmalloc_objs(&pdev->dev, *hw->groups, hw->soc->ngrps); if (!hw->groups) return -ENOMEM; /* We assume that one pin is one group, use pin name as group name. */ - hw->grp_names = devm_kmalloc_array(&pdev->dev, hw->soc->ngrps, - sizeof(*hw->grp_names), GFP_KERNEL); + hw->grp_names = devm_kmalloc_objs(&pdev->dev, *hw->grp_names, + hw->soc->ngrps); if (!hw->grp_names) return -ENOMEM; @@ -1001,7 +1000,7 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev) struct mtk_pinctrl *hw; int err, i; - hw = devm_kzalloc(&pdev->dev, sizeof(*hw), GFP_KERNEL); + hw = devm_kzalloc_obj(&pdev->dev, *hw); if (!hw) return -ENOMEM; @@ -1017,8 +1016,8 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev) return dev_err_probe(dev, -EINVAL, "SoC should be assigned at least one register base\n"); - hw->base = devm_kmalloc_array(&pdev->dev, hw->soc->nbase_names, - sizeof(*hw->base), GFP_KERNEL); + hw->base = devm_kmalloc_objs(&pdev->dev, *hw->base, + hw->soc->nbase_names); if (!hw->base) return -ENOMEM; @@ -1041,8 +1040,7 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev) return dev_err_probe(dev, err, "build state failed\n"); /* Copy from internal struct mtk_pin_desc to register to the core */ - pins = devm_kmalloc_array(&pdev->dev, hw->soc->npins, sizeof(*pins), - GFP_KERNEL); + pins = devm_kmalloc_objs(&pdev->dev, *pins, hw->soc->npins); if (!pins) return -ENOMEM; diff --git a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c index 39eb8cc7fc0d..b258bd88d745 100644 --- a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c +++ b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c @@ -824,7 +824,7 @@ static int aml_pctl_parse_functions(struct device_node *np, if (func->ngroups == 0) return dev_err_probe(dev, -EINVAL, "No groups defined\n"); - func->groups = devm_kcalloc(dev, func->ngroups, sizeof(*func->groups), GFP_KERNEL); + func->groups = devm_kzalloc_objs(dev, *func->groups, func->ngroups); if (!func->groups) return -ENOMEM; @@ -1122,11 +1122,12 @@ static int aml_pctl_probe_dt(struct platform_device *pdev, dev_dbg(dev, "nfunctions = %d\n", info->nfunctions); dev_dbg(dev, "ngroups = %d\n", info->ngroups); - info->functions = devm_kcalloc(dev, info->nfunctions, sizeof(*info->functions), GFP_KERNEL); + info->functions = devm_kzalloc_objs(dev, *info->functions, + info->nfunctions); - info->groups = devm_kcalloc(dev, info->ngroups, sizeof(*info->groups), GFP_KERNEL); + info->groups = devm_kzalloc_objs(dev, *info->groups, info->ngroups); - info->banks = devm_kcalloc(dev, info->nbanks, sizeof(*info->banks), GFP_KERNEL); + info->banks = devm_kzalloc_objs(dev, *info->banks, info->nbanks); if (!info->functions || !info->groups || !info->banks) return -ENOMEM; @@ -1135,7 +1136,7 @@ static int aml_pctl_probe_dt(struct platform_device *pdev, pctl_desc->npins = aml_count_pins(np); - pdesc = devm_kcalloc(dev, pctl_desc->npins, sizeof(*pdesc), GFP_KERNEL); + pdesc = devm_kzalloc_objs(dev, *pdesc, pctl_desc->npins); if (!pdesc) return -ENOMEM; @@ -1183,11 +1184,11 @@ static int aml_pctl_probe(struct platform_device *pdev) struct pinctrl_desc *pctl_desc; int ret, i; - pctl_desc = devm_kzalloc(dev, sizeof(*pctl_desc), GFP_KERNEL); + pctl_desc = devm_kzalloc_obj(dev, *pctl_desc); if (!pctl_desc) return -ENOMEM; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c index 9fc30aee96a5..6540ac59eb95 100644 --- a/drivers/pinctrl/meson/pinctrl-meson.c +++ b/drivers/pinctrl/meson/pinctrl-meson.c @@ -739,7 +739,7 @@ int meson_pinctrl_probe(struct platform_device *pdev) struct meson_pinctrl *pc; int ret; - pc = devm_kzalloc(dev, sizeof(struct meson_pinctrl), GFP_KERNEL); + pc = devm_kzalloc_obj(dev, struct meson_pinctrl); if (!pc) return -ENOMEM; diff --git a/drivers/pinctrl/microchip/pinctrl-mpfs-iomux0.c b/drivers/pinctrl/microchip/pinctrl-mpfs-iomux0.c index a390caa83181..2c3d8162dd7f 100644 --- a/drivers/pinctrl/microchip/pinctrl-mpfs-iomux0.c +++ b/drivers/pinctrl/microchip/pinctrl-mpfs-iomux0.c @@ -231,7 +231,7 @@ static int mpfs_iomux0_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct mpfs_iomux0_pinctrl *pctrl; - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/microchip/pinctrl-mpfs-mssio.c b/drivers/pinctrl/microchip/pinctrl-mpfs-mssio.c index 8da0c5312ce3..d33f4ef389bd 100644 --- a/drivers/pinctrl/microchip/pinctrl-mpfs-mssio.c +++ b/drivers/pinctrl/microchip/pinctrl-mpfs-mssio.c @@ -679,7 +679,7 @@ static int mpfs_pinctrl_probe(struct platform_device *pdev) struct mpfs_pinctrl *pctrl; int ret; - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/microchip/pinctrl-pic64gx-gpio2.c b/drivers/pinctrl/microchip/pinctrl-pic64gx-gpio2.c index 633ef40e1c27..862364e31e53 100644 --- a/drivers/pinctrl/microchip/pinctrl-pic64gx-gpio2.c +++ b/drivers/pinctrl/microchip/pinctrl-pic64gx-gpio2.c @@ -301,7 +301,7 @@ static int pic64gx_gpio2_probe(struct platform_device *pdev) struct pic64gx_gpio2_pinctrl *pctrl; void __iomem *base; - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index 81dfbd5e7f07..074b2c626f6f 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -785,7 +785,7 @@ static int armada_37xx_irqchip_register(struct platform_device *pdev, * the chained irq with all of them. */ girq->num_parents = nr_irq_parent; - girq->parents = devm_kcalloc(dev, nr_irq_parent, sizeof(*girq->parents), GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, nr_irq_parent); if (!girq->parents) return -ENOMEM; for (i = 0; i < nr_irq_parent; i++) { @@ -880,9 +880,8 @@ static int armada_37xx_fill_group(struct armada_37xx_pinctrl *info) struct armada_37xx_pin_group *grp = &info->groups[n]; int i, j, f; - grp->pins = devm_kcalloc(dev, grp->npins + grp->extra_npins, - sizeof(*grp->pins), - GFP_KERNEL); + grp->pins = devm_kzalloc_objs(dev, *grp->pins, + grp->npins + grp->extra_npins); if (!grp->pins) return -ENOMEM; @@ -932,9 +931,8 @@ static int armada_37xx_fill_func(struct armada_37xx_pinctrl *info) const char **groups; int g; - funcs[n].groups = devm_kcalloc(dev, funcs[n].ngroups, - sizeof(*(funcs[n].groups)), - GFP_KERNEL); + funcs[n].groups = devm_kzalloc_objs(dev, *(funcs[n].groups), + funcs[n].ngroups); if (!funcs[n].groups) return -ENOMEM; @@ -974,7 +972,7 @@ static int armada_37xx_pinctrl_register(struct platform_device *pdev, ctrldesc->pmxops = &armada_37xx_pmx_ops; ctrldesc->confops = &armada_37xx_pinconf_ops; - pindesc = devm_kcalloc(dev, pin_data->nr_pins, sizeof(*pindesc), GFP_KERNEL); + pindesc = devm_kzalloc_objs(dev, *pindesc, pin_data->nr_pins); if (!pindesc) return -ENOMEM; @@ -996,7 +994,7 @@ static int armada_37xx_pinctrl_register(struct platform_device *pdev, * we allocate functions for number of pins and hope there are * fewer unique functions than pins available */ - info->funcs = devm_kcalloc(dev, pin_data->nr_pins, sizeof(*info->funcs), GFP_KERNEL); + info->funcs = devm_kzalloc_objs(dev, *info->funcs, pin_data->nr_pins); if (!info->funcs) return -ENOMEM; @@ -1151,7 +1149,7 @@ static int __init armada_37xx_pinctrl_probe(struct platform_device *pdev) return PTR_ERR(regmap); } - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-cp110.c b/drivers/pinctrl/mvebu/pinctrl-armada-cp110.c index 9a250c491f33..7c51c953bfe2 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-cp110.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-cp110.c @@ -643,8 +643,7 @@ static int armada_cp110_pinctrl_probe(struct platform_device *pdev) if (!pdev->dev.parent) return -ENODEV; - soc = devm_kzalloc(&pdev->dev, - sizeof(struct mvebu_pinctrl_soc_info), GFP_KERNEL); + soc = devm_kzalloc_obj(&pdev->dev, struct mvebu_pinctrl_soc_info); if (!soc) return -ENOMEM; diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-xp.c b/drivers/pinctrl/mvebu/pinctrl-armada-xp.c index 487825bfd125..8bf51bee221b 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-xp.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-xp.c @@ -621,8 +621,7 @@ static int armada_xp_pinctrl_probe(struct platform_device *pdev) nregs = DIV_ROUND_UP(soc->nmodes, MVEBU_MPPS_PER_REG); - mpp_saved_regs = devm_kmalloc_array(&pdev->dev, nregs, sizeof(u32), - GFP_KERNEL); + mpp_saved_regs = devm_kmalloc_objs(&pdev->dev, u32, nregs); if (!mpp_saved_regs) return -ENOMEM; diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c index dce601d99372..a8359af130ef 100644 --- a/drivers/pinctrl/mvebu/pinctrl-dove.c +++ b/drivers/pinctrl/mvebu/pinctrl-dove.c @@ -788,8 +788,8 @@ static int dove_pinctrl_probe(struct platform_device *pdev) goto err_probe; } - mpp_data = devm_kcalloc(&pdev->dev, dove_pinctrl_info.ncontrols, - sizeof(*mpp_data), GFP_KERNEL); + mpp_data = devm_kzalloc_objs(&pdev->dev, *mpp_data, + dove_pinctrl_info.ncontrols); if (!mpp_data) { ret = -ENOMEM; goto err_probe; diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c index 5ce3d7fcdd34..40f6234b252b 100644 --- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c +++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c @@ -507,9 +507,8 @@ static int mvebu_pinctrl_build_functions(struct platform_device *pdev, /* we allocate functions for number of pins and hope * there are fewer unique functions than pins available */ - funcs = devm_kcalloc(&pdev->dev, - funcsize, sizeof(struct mvebu_pinctrl_function), - GFP_KERNEL); + funcs = devm_kzalloc_objs(&pdev->dev, struct mvebu_pinctrl_function, + funcsize); if (!funcs) return -ENOMEM; @@ -591,8 +590,7 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) return -EINVAL; } - pctl = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pinctrl), - GFP_KERNEL); + pctl = devm_kzalloc_obj(&pdev->dev, struct mvebu_pinctrl); if (!pctl) return -ENOMEM; @@ -630,10 +628,8 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) } } - pdesc = devm_kcalloc(&pdev->dev, - pctl->desc.npins, - sizeof(struct pinctrl_pin_desc), - GFP_KERNEL); + pdesc = devm_kzalloc_objs(&pdev->dev, struct pinctrl_pin_desc, + pctl->desc.npins); if (!pdesc) return -ENOMEM; @@ -776,8 +772,7 @@ int mvebu_pinctrl_simple_mmio_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - mpp_data = devm_kcalloc(&pdev->dev, soc->ncontrols, sizeof(*mpp_data), - GFP_KERNEL); + mpp_data = devm_kzalloc_objs(&pdev->dev, *mpp_data, soc->ncontrols); if (!mpp_data) return -ENOMEM; @@ -828,8 +823,7 @@ int mvebu_pinctrl_simple_regmap_probe(struct platform_device *pdev, if (IS_ERR(regmap)) return PTR_ERR(regmap); - mpp_data = devm_kcalloc(&pdev->dev, soc->ncontrols, sizeof(*mpp_data), - GFP_KERNEL); + mpp_data = devm_kzalloc_objs(&pdev->dev, *mpp_data, soc->ncontrols); if (!mpp_data) return -ENOMEM; diff --git a/drivers/pinctrl/nomadik/pinctrl-abx500.c b/drivers/pinctrl/nomadik/pinctrl-abx500.c index 858fbaebcf8e..881c87ddce72 100644 --- a/drivers/pinctrl/nomadik/pinctrl-abx500.c +++ b/drivers/pinctrl/nomadik/pinctrl-abx500.c @@ -995,7 +995,7 @@ static int abx500_gpio_probe(struct platform_device *pdev) return -ENODEV; } - pct = devm_kzalloc(&pdev->dev, sizeof(*pct), GFP_KERNEL); + pct = devm_kzalloc_obj(&pdev->dev, *pct); if (!pct) return -ENOMEM; diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c index db0311b14132..617ad259f62c 100644 --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c @@ -1215,7 +1215,7 @@ static int nmk_pinctrl_probe(struct platform_device *pdev) uintptr_t version = 0; int i; - npct = devm_kzalloc(&pdev->dev, sizeof(*npct), GFP_KERNEL); + npct = devm_kzalloc_obj(&pdev->dev, *npct); if (!npct) return -ENOMEM; diff --git a/drivers/pinctrl/nuvoton/pinctrl-ma35.c b/drivers/pinctrl/nuvoton/pinctrl-ma35.c index a79ebf4be2c3..564ec0aa4287 100644 --- a/drivers/pinctrl/nuvoton/pinctrl-ma35.c +++ b/drivers/pinctrl/nuvoton/pinctrl-ma35.c @@ -535,8 +535,9 @@ static int ma35_gpiolib_register(struct platform_device *pdev, struct ma35_pinct girq->parent_handler = ma35_irq_demux_intgroup; girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents, - sizeof(*girq->parents), GFP_KERNEL); + girq->parents = devm_kzalloc_objs(&pdev->dev, + *girq->parents, + girq->num_parents); if (!girq->parents) return -ENOMEM; @@ -588,8 +589,8 @@ static int ma35_pinctrl_get_soc_data(struct ma35_pinctrl *pctl, struct platform_ ctrl = pctl->ctrl; ctrl->nr_banks = MA35_GPIO_BANK_MAX; - ctrl->pin_banks = devm_kcalloc(&pdev->dev, ctrl->nr_banks, - sizeof(*ctrl->pin_banks), GFP_KERNEL); + ctrl->pin_banks = devm_kzalloc_objs(&pdev->dev, *ctrl->pin_banks, + ctrl->nr_banks); if (!ctrl->pin_banks) return -ENOMEM; @@ -998,7 +999,7 @@ static int ma35_pinctrl_parse_groups(struct fwnode_handle *fwnode, struct group_ if (!count || count % 3) return -EINVAL; - elems = devm_kmalloc_array(npctl->dev, count, sizeof(u32), GFP_KERNEL); + elems = devm_kmalloc_objs(npctl->dev, u32, count); if (!elems) return -ENOMEM; @@ -1009,12 +1010,12 @@ static int ma35_pinctrl_parse_groups(struct fwnode_handle *fwnode, struct group_ return -EINVAL; grp->grp.npins = count / 3; - pins = devm_kcalloc(npctl->dev, grp->grp.npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(npctl->dev, *pins, grp->grp.npins); if (!pins) return -ENOMEM; grp->grp.pins = pins; - pin = devm_kcalloc(npctl->dev, grp->grp.npins, sizeof(*pin), GFP_KERNEL); + pin = devm_kzalloc_objs(npctl->dev, *pin, grp->grp.npins); if (!pin) return -ENOMEM; grp->data = pin; @@ -1053,7 +1054,7 @@ static int ma35_pinctrl_parse_functions(struct fwnode_handle *fwnode, struct ma3 if (func->ngroups <= 0) return 0; - groups = devm_kcalloc(npctl->dev, func->ngroups, sizeof(*groups), GFP_KERNEL); + groups = devm_kzalloc_objs(npctl->dev, *groups, func->ngroups); if (!groups) return -ENOMEM; @@ -1091,13 +1092,13 @@ static int ma35_pinctrl_probe_dt(struct platform_device *pdev, struct ma35_pinct if (!npctl->nfunctions) return -EINVAL; - npctl->functions = devm_kcalloc(&pdev->dev, npctl->nfunctions, - sizeof(*npctl->functions), GFP_KERNEL); + npctl->functions = devm_kzalloc_objs(&pdev->dev, *npctl->functions, + npctl->nfunctions); if (!npctl->functions) return -ENOMEM; - npctl->groups = devm_kcalloc(&pdev->dev, npctl->ngroups, - sizeof(*npctl->groups), GFP_KERNEL); + npctl->groups = devm_kzalloc_objs(&pdev->dev, *npctl->groups, + npctl->ngroups); if (!npctl->groups) return -ENOMEM; @@ -1127,15 +1128,15 @@ int ma35_pinctrl_probe(struct platform_device *pdev, const struct ma35_pinctrl_s return -EINVAL; } - npctl = devm_kzalloc(&pdev->dev, sizeof(*npctl), GFP_KERNEL); + npctl = devm_kzalloc_obj(&pdev->dev, *npctl); if (!npctl) return -ENOMEM; - ma35_pinctrl_desc = devm_kzalloc(&pdev->dev, sizeof(*ma35_pinctrl_desc), GFP_KERNEL); + ma35_pinctrl_desc = devm_kzalloc_obj(&pdev->dev, *ma35_pinctrl_desc); if (!ma35_pinctrl_desc) return -ENOMEM; - npctl->ctrl = devm_kzalloc(&pdev->dev, sizeof(*npctl->ctrl), GFP_KERNEL); + npctl->ctrl = devm_kzalloc_obj(&pdev->dev, *npctl->ctrl); if (!npctl->ctrl) return -ENOMEM; diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c index e051ff141d6c..c5bdc8faa865 100644 --- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c +++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c @@ -1898,9 +1898,7 @@ static int npcm7xx_gpio_register(struct npcm7xx_pinctrl *pctrl) gpio_irq_chip_set_chip(girq, &npcmgpio_irqchip); girq->parent_handler = npcmgpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(pctrl->dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(pctrl->dev, *girq->parents, 1); if (!girq->parents) { ret = -ENOMEM; goto err_register; @@ -1942,7 +1940,7 @@ static int npcm7xx_pinctrl_probe(struct platform_device *pdev) struct npcm7xx_pinctrl *pctrl; int ret; - pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(&pdev->dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c index 6150cde7e824..b695a682b434 100644 --- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c +++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c @@ -2533,9 +2533,8 @@ static int npcm8xx_gpio_register(struct npcm8xx_pinctrl *pctrl) girq->chip = &pctrl->gpio_bank[id].irq_chip; girq->parent_handler = npcmgpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(pctrl->dev, girq->num_parents, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(pctrl->dev, *girq->parents, + girq->num_parents); if (!girq->parents) return -ENOMEM; @@ -2558,7 +2557,7 @@ static int npcm8xx_pinctrl_probe(struct platform_device *pdev) struct npcm8xx_pinctrl *pctrl; int ret; - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c index bc030abdadca..5ca3a92a66e8 100644 --- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c +++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c @@ -1084,8 +1084,8 @@ static int wpcm450_gpio_register(struct platform_device *pdev, girq = &gpio->chip.gc.irq; gpio_irq_chip_set_chip(girq, &wpcm450_gpio_irqchip); girq->parent_handler = wpcm450_gpio_irqhandler; - girq->parents = devm_kcalloc(dev, WPCM450_NUM_GPIO_IRQS, - sizeof(*girq->parents), GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, + WPCM450_NUM_GPIO_IRQS); if (!girq->parents) return -ENOMEM; girq->default_type = IRQ_TYPE_NONE; @@ -1119,7 +1119,7 @@ static int wpcm450_pinctrl_probe(struct platform_device *pdev) struct wpcm450_pinctrl *pctrl; int ret; - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c index 9c4ebae22674..e852dcde1208 100644 --- a/drivers/pinctrl/nxp/pinctrl-s32cc.c +++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c @@ -783,8 +783,8 @@ static int s32_pinctrl_parse_groups(struct device_node *np, grp->data.npins = npins; - pins = devm_kcalloc(info->dev, npins, sizeof(*pins), GFP_KERNEL); - sss = devm_kcalloc(info->dev, npins, sizeof(*sss), GFP_KERNEL); + pins = devm_kzalloc_objs(info->dev, *pins, npins); + sss = devm_kzalloc_objs(info->dev, *sss, npins); if (!pins || !sss) return -ENOMEM; @@ -824,8 +824,7 @@ static int s32_pinctrl_parse_functions(struct device_node *np, return dev_err_probe(info->dev, -EINVAL, "No groups defined in %pOF\n", np); - groups = devm_kcalloc(info->dev, func->ngroups, - sizeof(*groups), GFP_KERNEL); + groups = devm_kzalloc_objs(info->dev, *groups, func->ngroups); if (!groups) return -ENOMEM; @@ -864,8 +863,8 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, return -EINVAL; } - ipctl->regions = devm_kcalloc(&pdev->dev, mem_regions, - sizeof(*ipctl->regions), GFP_KERNEL); + ipctl->regions = devm_kzalloc_objs(&pdev->dev, *ipctl->regions, + mem_regions); if (!ipctl->regions) return -ENOMEM; @@ -898,8 +897,8 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, "No functions defined\n"); info->nfunctions = nfuncs; - info->functions = devm_kcalloc(&pdev->dev, nfuncs, - sizeof(*info->functions), GFP_KERNEL); + info->functions = devm_kzalloc_objs(&pdev->dev, *info->functions, + nfuncs); if (!info->functions) return -ENOMEM; @@ -907,8 +906,8 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, for_each_child_of_node_scoped(np, child) info->ngroups += of_get_child_count(child); - info->groups = devm_kcalloc(&pdev->dev, info->ngroups, - sizeof(*info->groups), GFP_KERNEL); + info->groups = devm_kzalloc_objs(&pdev->dev, *info->groups, + info->ngroups); if (!info->groups) return -ENOMEM; @@ -937,7 +936,7 @@ int s32_pinctrl_probe(struct platform_device *pdev, return dev_err_probe(&pdev->dev, -EINVAL, "Wrong pinctrl info\n"); - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; @@ -945,7 +944,7 @@ int s32_pinctrl_probe(struct platform_device *pdev, info->dev = &pdev->dev; /* Create state holders etc for this driver */ - ipctl = devm_kzalloc(&pdev->dev, sizeof(*ipctl), GFP_KERNEL); + ipctl = devm_kzalloc_obj(&pdev->dev, *ipctl); if (!ipctl) return -ENOMEM; @@ -956,8 +955,7 @@ int s32_pinctrl_probe(struct platform_device *pdev, INIT_LIST_HEAD(&ipctl->gpio_configs); spin_lock_init(&ipctl->gpio_configs_lock); - s32_pinctrl_desc = - devm_kzalloc(&pdev->dev, sizeof(*s32_pinctrl_desc), GFP_KERNEL); + s32_pinctrl_desc = devm_kzalloc_obj(&pdev->dev, *s32_pinctrl_desc); if (!s32_pinctrl_desc) return -ENOMEM; @@ -983,9 +981,8 @@ int s32_pinctrl_probe(struct platform_device *pdev, #ifdef CONFIG_PM_SLEEP saved_context = &ipctl->saved_context; saved_context->pads = - devm_kcalloc(&pdev->dev, info->soc_data->npins, - sizeof(*saved_context->pads), - GFP_KERNEL); + devm_kzalloc_objs(&pdev->dev, *saved_context->pads, + info->soc_data->npins); if (!saved_context->pads) return -ENOMEM; #endif diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c index 02a70a6bbbdd..7c1f08672a3c 100644 --- a/drivers/pinctrl/pinconf-generic.c +++ b/drivers/pinctrl/pinconf-generic.c @@ -336,8 +336,8 @@ int pinconf_generic_parse_dt_pinmux(struct device_node *np, struct device *dev, return -EINVAL; } - pid_t = devm_kcalloc(dev, npins_t, sizeof(*pid_t), GFP_KERNEL); - pmux_t = devm_kcalloc(dev, npins_t, sizeof(*pmux_t), GFP_KERNEL); + pid_t = devm_kzalloc_objs(dev, *pid_t, npins_t); + pmux_t = devm_kzalloc_objs(dev, *pmux_t, npins_t); if (!pid_t || !pmux_t) { dev_err(dev, "kalloc memory fail\n"); return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-ambarella.c b/drivers/pinctrl/pinctrl-ambarella.c index 5ed1010c5ce5..75d3cc2c6fdf 100644 --- a/drivers/pinctrl/pinctrl-ambarella.c +++ b/drivers/pinctrl/pinctrl-ambarella.c @@ -420,8 +420,7 @@ static int amb_pinctrl_register(struct amb_pinctrl *ipc) char **names; int ret; - pindesc = devm_kcalloc(ipc->dev, ipc->data->npins, sizeof(*pindesc), - GFP_KERNEL); + pindesc = devm_kzalloc_objs(ipc->dev, *pindesc, ipc->data->npins); if (!pindesc) return -ENOMEM; @@ -463,7 +462,7 @@ static int amb_pinctrl_probe(struct platform_device *pdev) struct amb_pinctrl *ipc; int ret; - ipc = devm_kzalloc(dev, sizeof(*ipc), GFP_KERNEL); + ipc = devm_kzalloc_obj(dev, *ipc); if (!ipc) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c index 9fa752f552d4..30da75bb93b9 100644 --- a/drivers/pinctrl/pinctrl-amd.c +++ b/drivers/pinctrl/pinctrl-amd.c @@ -1279,8 +1279,7 @@ static int amd_gpio_probe(struct platform_device *pdev) struct amd_gpio *gpio_dev; struct gpio_irq_chip *girq; - gpio_dev = devm_kzalloc(&pdev->dev, - sizeof(struct amd_gpio), GFP_KERNEL); + gpio_dev = devm_kzalloc_obj(&pdev->dev, struct amd_gpio); if (!gpio_dev) return -ENOMEM; @@ -1310,9 +1309,9 @@ static int amd_gpio_probe(struct platform_device *pdev) return gpio_dev->irq; #ifdef CONFIG_SUSPEND - gpio_dev->saved_regs = devm_kcalloc(&pdev->dev, amd_pinctrl_desc.npins, - sizeof(*gpio_dev->saved_regs), - GFP_KERNEL); + gpio_dev->saved_regs = devm_kzalloc_objs(&pdev->dev, + *gpio_dev->saved_regs, + amd_pinctrl_desc.npins); if (!gpio_dev->saved_regs) return -ENOMEM; #endif diff --git a/drivers/pinctrl/pinctrl-amdisp.c b/drivers/pinctrl/pinctrl-amdisp.c index e0874cc086a7..a1a84f46e04d 100644 --- a/drivers/pinctrl/pinctrl-amdisp.c +++ b/drivers/pinctrl/pinctrl-amdisp.c @@ -178,7 +178,7 @@ static int amdisp_pinctrl_probe(struct platform_device *pdev) struct resource *res; int ret; - pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(&pdev->dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-apple-gpio.c b/drivers/pinctrl/pinctrl-apple-gpio.c index a190e264a6d5..f903d29e8344 100644 --- a/drivers/pinctrl/pinctrl-apple-gpio.c +++ b/drivers/pinctrl/pinctrl-apple-gpio.c @@ -463,8 +463,7 @@ static int apple_gpio_pinctrl_probe(struct platform_device *pdev) nirqs = res; } - pctl = devm_kzalloc(&pdev->dev, struct_size(pctl, irqgrps, nirqs), - GFP_KERNEL); + pctl = devm_kzalloc_flex(&pdev->dev, *pctl, irqgrps, nirqs); if (!pctl) return -ENOMEM; pctl->dev = &pdev->dev; @@ -475,12 +474,9 @@ static int apple_gpio_pinctrl_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, -EINVAL, "apple,npins property not found\n"); - pins = devm_kmalloc_array(&pdev->dev, npins, sizeof(pins[0]), - GFP_KERNEL); - pin_names = devm_kmalloc_array(&pdev->dev, npins, sizeof(pin_names[0]), - GFP_KERNEL); - pin_nums = devm_kmalloc_array(&pdev->dev, npins, sizeof(pin_nums[0]), - GFP_KERNEL); + pins = devm_kmalloc_objs(&pdev->dev, pins[0], npins); + pin_names = devm_kmalloc_objs(&pdev->dev, pin_names[0], npins); + pin_nums = devm_kmalloc_objs(&pdev->dev, pin_nums[0], npins); if (!pins || !pin_names || !pin_nums) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-artpec6.c b/drivers/pinctrl/pinctrl-artpec6.c index af67057128ff..8c06dc73bd4f 100644 --- a/drivers/pinctrl/pinctrl-artpec6.c +++ b/drivers/pinctrl/pinctrl-artpec6.c @@ -937,7 +937,7 @@ static int artpec6_pmx_probe(struct platform_device *pdev) { struct artpec6_pmx *pmx; - pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL); + pmx = devm_kzalloc_obj(&pdev->dev, *pmx); if (!pmx) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-as3722.c b/drivers/pinctrl/pinctrl-as3722.c index 3d2f477aac9e..08d1b55b014b 100644 --- a/drivers/pinctrl/pinctrl-as3722.c +++ b/drivers/pinctrl/pinctrl-as3722.c @@ -544,7 +544,7 @@ static int as3722_pinctrl_probe(struct platform_device *pdev) device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); - as_pci = devm_kzalloc(&pdev->dev, sizeof(*as_pci), GFP_KERNEL); + as_pci = devm_kzalloc_obj(&pdev->dev, *as_pci); if (!as_pci) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index 41cbb46ac589..ccddbe4646c8 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -1096,7 +1096,7 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) struct atmel_pioctrl *atmel_pioctrl; const struct atmel_pioctrl_data *atmel_pioctrl_data; - atmel_pioctrl = devm_kzalloc(dev, sizeof(*atmel_pioctrl), GFP_KERNEL); + atmel_pioctrl = devm_kzalloc_obj(dev, *atmel_pioctrl); if (!atmel_pioctrl) return -ENOMEM; atmel_pioctrl->dev = dev; @@ -1124,15 +1124,12 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) if (IS_ERR(atmel_pioctrl->clk)) return dev_err_probe(dev, PTR_ERR(atmel_pioctrl->clk), "failed to get clock\n"); - atmel_pioctrl->pins = devm_kcalloc(dev, - atmel_pioctrl->npins, - sizeof(*atmel_pioctrl->pins), - GFP_KERNEL); + atmel_pioctrl->pins = devm_kzalloc_objs(dev, *atmel_pioctrl->pins, + atmel_pioctrl->npins); if (!atmel_pioctrl->pins) return -ENOMEM; - pin_desc = devm_kcalloc(dev, atmel_pioctrl->npins, sizeof(*pin_desc), - GFP_KERNEL); + pin_desc = devm_kzalloc_objs(dev, *pin_desc, atmel_pioctrl->npins); if (!pin_desc) return -ENOMEM; atmel_pinctrl_desc.pins = pin_desc; @@ -1141,16 +1138,14 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) atmel_pinctrl_desc.custom_params = atmel_custom_bindings; /* One pin is one group since a pin can achieve all functions. */ - group_names = devm_kcalloc(dev, - atmel_pioctrl->npins, sizeof(*group_names), - GFP_KERNEL); + group_names = devm_kzalloc_objs(dev, *group_names, atmel_pioctrl->npins); if (!group_names) return -ENOMEM; atmel_pioctrl->group_names = group_names; - atmel_pioctrl->groups = devm_kcalloc(&pdev->dev, - atmel_pioctrl->npins, sizeof(*atmel_pioctrl->groups), - GFP_KERNEL); + atmel_pioctrl->groups = devm_kzalloc_objs(&pdev->dev, + *atmel_pioctrl->groups, + atmel_pioctrl->npins); if (!atmel_pioctrl->groups) return -ENOMEM; for (i = 0 ; i < atmel_pioctrl->npins; i++) { @@ -1158,8 +1153,8 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) unsigned int bank = ATMEL_PIO_BANK(i); unsigned int line = ATMEL_PIO_LINE(i); - atmel_pioctrl->pins[i] = devm_kzalloc(dev, - sizeof(**atmel_pioctrl->pins), GFP_KERNEL); + atmel_pioctrl->pins[i] = devm_kzalloc_obj(dev, + **atmel_pioctrl->pins); if (!atmel_pioctrl->pins[i]) return -ENOMEM; @@ -1187,24 +1182,20 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) atmel_pioctrl->gpio_chip->names = atmel_pioctrl->group_names; atmel_pioctrl->gpio_chip->set_config = gpiochip_generic_config; - atmel_pioctrl->pm_wakeup_sources = devm_kcalloc(dev, - atmel_pioctrl->nbanks, - sizeof(*atmel_pioctrl->pm_wakeup_sources), - GFP_KERNEL); + atmel_pioctrl->pm_wakeup_sources = devm_kzalloc_objs(dev, + *atmel_pioctrl->pm_wakeup_sources, + atmel_pioctrl->nbanks); if (!atmel_pioctrl->pm_wakeup_sources) return -ENOMEM; - atmel_pioctrl->pm_suspend_backup = devm_kcalloc(dev, - atmel_pioctrl->nbanks, - sizeof(*atmel_pioctrl->pm_suspend_backup), - GFP_KERNEL); + atmel_pioctrl->pm_suspend_backup = devm_kzalloc_objs(dev, + *atmel_pioctrl->pm_suspend_backup, + atmel_pioctrl->nbanks); if (!atmel_pioctrl->pm_suspend_backup) return -ENOMEM; - atmel_pioctrl->irqs = devm_kcalloc(dev, - atmel_pioctrl->nbanks, - sizeof(*atmel_pioctrl->irqs), - GFP_KERNEL); + atmel_pioctrl->irqs = devm_kzalloc_objs(dev, *atmel_pioctrl->irqs, + atmel_pioctrl->nbanks); if (!atmel_pioctrl->irqs) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 0a57ed51d4c9..cf8fe3fa545b 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -308,8 +308,7 @@ static int at91_dt_node_to_map(struct pinctrl_dev *pctldev, } map_num += grp->npins; - new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map), - GFP_KERNEL); + new_map = devm_kzalloc_objs(pctldev->dev, *new_map, map_num); if (!new_map) return -ENOMEM; @@ -1218,12 +1217,9 @@ static int at91_pinctrl_parse_groups(struct device_node *np, } grp->npins = size / 4; - pin = grp->pins_conf = devm_kcalloc(info->dev, - grp->npins, - sizeof(struct at91_pmx_pin), - GFP_KERNEL); - grp->pins = devm_kcalloc(info->dev, grp->npins, sizeof(unsigned int), - GFP_KERNEL); + pin = grp->pins_conf = devm_kzalloc_objs(info->dev, struct at91_pmx_pin, + grp->npins); + grp->pins = devm_kzalloc_objs(info->dev, unsigned int, grp->npins); if (!grp->pins_conf || !grp->pins) return -ENOMEM; @@ -1329,13 +1325,12 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev, dev_dbg(dev, "nfunctions = %d\n", info->nfunctions); dev_dbg(dev, "ngroups = %d\n", info->ngroups); - info->functions = devm_kcalloc(dev, info->nfunctions, sizeof(*info->functions), - GFP_KERNEL); + info->functions = devm_kzalloc_objs(dev, *info->functions, + info->nfunctions); if (!info->functions) return -ENOMEM; - info->groups = devm_kcalloc(dev, info->ngroups, sizeof(*info->groups), - GFP_KERNEL); + info->groups = devm_kzalloc_objs(dev, *info->groups, info->ngroups); if (!info->groups) return -ENOMEM; @@ -1363,7 +1358,7 @@ static int at91_pinctrl_probe(struct platform_device *pdev) struct pinctrl_pin_desc *pdesc; int ret, i, j, k; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; @@ -1374,7 +1369,7 @@ static int at91_pinctrl_probe(struct platform_device *pdev) at91_pinctrl_desc.name = dev_name(dev); at91_pinctrl_desc.npins = gpio_banks * MAX_NB_GPIO_PER_BANK; at91_pinctrl_desc.pins = pdesc = - devm_kcalloc(dev, at91_pinctrl_desc.npins, sizeof(*pdesc), GFP_KERNEL); + devm_kzalloc_objs(dev, *pdesc, at91_pinctrl_desc.npins); if (!at91_pinctrl_desc.pins) return -ENOMEM; @@ -1731,7 +1726,7 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev, struct gpio_irq_chip *girq; int i; - gpio_irqchip = devm_kzalloc(dev, sizeof(*gpio_irqchip), GFP_KERNEL); + gpio_irqchip = devm_kzalloc_obj(dev, *gpio_irqchip); if (!gpio_irqchip) return -ENOMEM; @@ -1770,9 +1765,8 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev, if (!gpiochip_prev) { girq->parent_handler = gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, girq->num_parents, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, + girq->num_parents); if (!girq->parents) return -ENOMEM; girq->parents[0] = at91_gpio->pioc_virq; @@ -1840,7 +1834,7 @@ static int at91_gpio_probe(struct platform_device *pdev) if (irq < 0) return irq; - at91_chip = devm_kzalloc(dev, sizeof(*at91_chip), GFP_KERNEL); + at91_chip = devm_kzalloc_obj(dev, *at91_chip); if (!at91_chip) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-aw9523.c b/drivers/pinctrl/pinctrl-aw9523.c index a13b1cdb78ea..58292236cf46 100644 --- a/drivers/pinctrl/pinctrl-aw9523.c +++ b/drivers/pinctrl/pinctrl-aw9523.c @@ -808,7 +808,7 @@ static int aw9523_init_irq(struct aw9523 *awi, int irq) if (!device_property_read_bool(dev, "interrupt-controller")) return 0; - awi->irq = devm_kzalloc(dev, sizeof(*awi->irq), GFP_KERNEL); + awi->irq = devm_kzalloc_obj(dev, *awi->irq); if (!awi->irq) return -ENOMEM; @@ -955,7 +955,7 @@ static int aw9523_probe(struct i2c_client *client) struct aw9523 *awi; int ret; - awi = devm_kzalloc(dev, sizeof(*awi), GFP_KERNEL); + awi = devm_kzalloc_obj(dev, *awi); if (!awi) return -ENOMEM; @@ -981,7 +981,7 @@ static int aw9523_probe(struct i2c_client *client) lockdep_set_subclass(&awi->i2c_lock, i2c_adapter_depth(client->adapter)); - pdesc = devm_kzalloc(dev, sizeof(*pdesc), GFP_KERNEL); + pdesc = devm_kzalloc_obj(dev, *pdesc); if (!pdesc) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c index 5539ce642b39..825e9b50bc26 100644 --- a/drivers/pinctrl/pinctrl-axp209.c +++ b/drivers/pinctrl/pinctrl-axp209.c @@ -447,7 +447,7 @@ static int axp20x_pctl_probe(struct platform_device *pdev) return -EINVAL; } - pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); + pctl = devm_kzalloc_obj(&pdev->dev, *pctl); if (!pctl) return -ENOMEM; @@ -479,7 +479,7 @@ static int axp20x_pctl_probe(struct platform_device *pdev) return ret; } - pctrl_desc = devm_kzalloc(&pdev->dev, sizeof(*pctrl_desc), GFP_KERNEL); + pctrl_desc = devm_kzalloc_obj(&pdev->dev, *pctrl_desc); if (!pctrl_desc) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-bm1880.c b/drivers/pinctrl/pinctrl-bm1880.c index 387798fb09be..8cd7fc4b5b20 100644 --- a/drivers/pinctrl/pinctrl-bm1880.c +++ b/drivers/pinctrl/pinctrl-bm1880.c @@ -1313,7 +1313,7 @@ static int bm1880_pinctrl_probe(struct platform_device *pdev) { struct bm1880_pinctrl *pctrl; - pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(&pdev->dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-cy8c95x0.c b/drivers/pinctrl/pinctrl-cy8c95x0.c index 9a54b259ef4b..62f3360a54b7 100644 --- a/drivers/pinctrl/pinctrl-cy8c95x0.c +++ b/drivers/pinctrl/pinctrl-cy8c95x0.c @@ -1377,7 +1377,7 @@ static int cy8c95x0_probe(struct i2c_client *client) unsigned long driver_data; int ret; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-da850-pupd.c b/drivers/pinctrl/pinctrl-da850-pupd.c index c5f243d1311f..12e2e39c02bd 100644 --- a/drivers/pinctrl/pinctrl-da850-pupd.c +++ b/drivers/pinctrl/pinctrl-da850-pupd.c @@ -146,7 +146,7 @@ static int da850_pupd_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct da850_pupd_data *data; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-da9062.c b/drivers/pinctrl/pinctrl-da9062.c index 53298cbcc5cf..ab62b802bae3 100644 --- a/drivers/pinctrl/pinctrl-da9062.c +++ b/drivers/pinctrl/pinctrl-da9062.c @@ -252,7 +252,7 @@ static int da9062_pctl_probe(struct platform_device *pdev) device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); - pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); + pctl = devm_kzalloc_obj(&pdev->dev, *pctl); if (!pctl) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-digicolor.c b/drivers/pinctrl/pinctrl-digicolor.c index 58f22b4a5a6f..53dc9c82c9c7 100644 --- a/drivers/pinctrl/pinctrl-digicolor.c +++ b/drivers/pinctrl/pinctrl-digicolor.c @@ -276,7 +276,7 @@ static int dc_pinctrl_probe(struct platform_device *pdev) int name_len = strlen("GP_xx") + 1; int i, j; - pmap = devm_kzalloc(&pdev->dev, sizeof(*pmap), GFP_KERNEL); + pmap = devm_kzalloc_obj(&pdev->dev, *pmap); if (!pmap) return -ENOMEM; @@ -284,8 +284,7 @@ static int dc_pinctrl_probe(struct platform_device *pdev) if (IS_ERR(pmap->regs)) return PTR_ERR(pmap->regs); - pins = devm_kcalloc(&pdev->dev, PINS_COUNT, sizeof(*pins), - GFP_KERNEL); + pins = devm_kzalloc_objs(&pdev->dev, *pins, PINS_COUNT); if (!pins) return -ENOMEM; pin_names = devm_kcalloc(&pdev->dev, PINS_COUNT, name_len, @@ -306,7 +305,7 @@ static int dc_pinctrl_probe(struct platform_device *pdev) } } - pctl_desc = devm_kzalloc(&pdev->dev, sizeof(*pctl_desc), GFP_KERNEL); + pctl_desc = devm_kzalloc_obj(&pdev->dev, *pctl_desc); if (!pctl_desc) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-eic7700.c b/drivers/pinctrl/pinctrl-eic7700.c index 09a3b097383c..20baf5012ca5 100644 --- a/drivers/pinctrl/pinctrl-eic7700.c +++ b/drivers/pinctrl/pinctrl-eic7700.c @@ -579,7 +579,7 @@ static int eic7700_pinctrl_init_function_groups(struct device *dev, struct eic77 } } - groups = devm_kcalloc(dev, ngroups, sizeof(*groups), GFP_KERNEL); + groups = devm_kzalloc_objs(dev, *groups, ngroups); if (!groups) return -ENOMEM; @@ -627,7 +627,7 @@ static int eic7700_pinctrl_probe(struct platform_device *pdev) u32 rgmii0_mode, rgmii1_mode; int ret, voltage; - pc = devm_kzalloc(dev, struct_size(pc, functions, EIC7700_FUNCTIONS_COUNT), GFP_KERNEL); + pc = devm_kzalloc_flex(dev, *pc, functions, EIC7700_FUNCTIONS_COUNT); if (!pc) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-ep93xx.c b/drivers/pinctrl/pinctrl-ep93xx.c index abafbbb8fd6a..b357aa2c138e 100644 --- a/drivers/pinctrl/pinctrl-ep93xx.c +++ b/drivers/pinctrl/pinctrl-ep93xx.c @@ -1373,7 +1373,7 @@ static int ep93xx_pmx_probe(struct auxiliary_device *adev, struct ep93xx_pmx *pmx; /* Create state holders etc for this driver */ - pmx = devm_kzalloc(dev, sizeof(*pmx), GFP_KERNEL); + pmx = devm_kzalloc_obj(dev, *pmx); if (!pmx) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-equilibrium.c b/drivers/pinctrl/pinctrl-equilibrium.c index 8e6cd35fc80c..efeaa8733b56 100644 --- a/drivers/pinctrl/pinctrl-equilibrium.c +++ b/drivers/pinctrl/pinctrl-equilibrium.c @@ -203,7 +203,7 @@ static int gpiochip_setup(struct device *dev, struct eqbr_gpio_ctrl *gctrl) gpio_irq_chip_set_chip(girq, &eqbr_irq_chip); girq->parent_handler = eqbr_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents), GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; @@ -669,7 +669,7 @@ static int eqbr_build_functions(struct eqbr_pinctrl_drv_data *drvdata) if (ret) return ret; - funcs = devm_kcalloc(dev, nr_funcs, sizeof(*funcs), GFP_KERNEL); + funcs = devm_kzalloc_objs(dev, *funcs, nr_funcs); if (!funcs) return -ENOMEM; @@ -684,9 +684,8 @@ static int eqbr_build_functions(struct eqbr_pinctrl_drv_data *drvdata) for (i = 0; i < nr_funcs; i++) { if (!funcs[i].ngroups) continue; - funcs[i].groups = devm_kcalloc(dev, funcs[i].ngroups, - sizeof(*(funcs[i].groups)), - GFP_KERNEL); + funcs[i].groups = devm_kzalloc_objs(dev, *(funcs[i].groups), + funcs[i].ngroups); if (!funcs[i].groups) return -ENOMEM; } @@ -734,13 +733,13 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata) } grp->npins = err; grp->name = prop->value; - pins = devm_kcalloc(dev, grp->npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, grp->npins); if (!pins) return -ENOMEM; grp->pins = pins; - pinmux = devm_kcalloc(dev, grp->npins, sizeof(*pinmux), GFP_KERNEL); + pinmux = devm_kzalloc_objs(dev, *pinmux, grp->npins); if (!pinmux) return -ENOMEM; @@ -799,7 +798,7 @@ static int pinctrl_reg(struct eqbr_pinctrl_drv_data *drvdata) for (i = 0, nr_pins = 0; i < drvdata->nr_banks; i++) nr_pins += drvdata->pin_banks[i].nr_pins; - pdesc = devm_kcalloc(dev, nr_pins, sizeof(*pdesc), GFP_KERNEL); + pdesc = devm_kzalloc_objs(dev, *pdesc, nr_pins); if (!pdesc) return -ENOMEM; pin_names = devm_kcalloc(dev, nr_pins, PIN_NAME_LEN, GFP_KERNEL); @@ -887,11 +886,11 @@ static int pinbank_probe(struct eqbr_pinctrl_drv_data *drvdata) } /* Count pin bank number and gpio controller number */ - banks = devm_kcalloc(dev, nr_gpio, sizeof(*banks), GFP_KERNEL); + banks = devm_kzalloc_objs(dev, *banks, nr_gpio); if (!banks) return -ENOMEM; - gctrls = devm_kcalloc(dev, nr_gpio, sizeof(*gctrls), GFP_KERNEL); + gctrls = devm_kzalloc_objs(dev, *gctrls, nr_gpio); if (!gctrls) return -ENOMEM; @@ -924,7 +923,7 @@ static int eqbr_pinctrl_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-eyeq5.c b/drivers/pinctrl/pinctrl-eyeq5.c index 19d845b47939..852fc67bc7c2 100644 --- a/drivers/pinctrl/pinctrl-eyeq5.c +++ b/drivers/pinctrl/pinctrl-eyeq5.c @@ -705,7 +705,7 @@ static int eq5p_probe(struct auxiliary_device *adev, if (!match || !match->data) return -ENODEV; - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-gemini.c b/drivers/pinctrl/pinctrl-gemini.c index a029cab229bf..85f1b6dcec4a 100644 --- a/drivers/pinctrl/pinctrl-gemini.c +++ b/drivers/pinctrl/pinctrl-gemini.c @@ -2536,7 +2536,7 @@ static int gemini_pmx_probe(struct platform_device *pdev) int i; /* Create state holders etc for this driver */ - pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL); + pmx = devm_kzalloc_obj(&pdev->dev, *pmx); if (!pmx) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-generic-mux.c b/drivers/pinctrl/pinctrl-generic-mux.c index de85b4e75eb8..2936acb30cc3 100644 --- a/drivers/pinctrl/pinctrl-generic-mux.c +++ b/drivers/pinctrl/pinctrl-generic-mux.c @@ -72,11 +72,11 @@ static int mux_pinctrl_probe_dt(struct pinctrl_dev *pctldev, const char **group_names; int ret; - function = devm_kzalloc(dev, sizeof(*function), GFP_KERNEL); + function = devm_kzalloc_obj(dev, *function); if (!function) return -ENOMEM; - group_names = devm_kcalloc(dev, 1, sizeof(*group_names), GFP_KERNEL); + group_names = devm_kzalloc_objs(dev, *group_names, 1); if (!group_names) return -ENOMEM; @@ -163,7 +163,7 @@ static int mux_pinctrl_probe(struct platform_device *pdev) struct pinctrl_desc *pctl_desc; int ret; - mpctl = devm_kzalloc(dev, sizeof(*mpctl), GFP_KERNEL); + mpctl = devm_kzalloc_obj(dev, *mpctl); if (!mpctl) return -ENOMEM; @@ -171,7 +171,7 @@ static int mux_pinctrl_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mpctl); - pctl_desc = devm_kzalloc(dev, sizeof(*pctl_desc), GFP_KERNEL); + pctl_desc = devm_kzalloc_obj(dev, *pctl_desc); if (!pctl_desc) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-generic.c b/drivers/pinctrl/pinctrl-generic.c index 4277c8748513..7b0eaf72c7f9 100644 --- a/drivers/pinctrl/pinctrl-generic.c +++ b/drivers/pinctrl/pinctrl-generic.c @@ -107,11 +107,11 @@ static int pinctrl_generic_pins_function_dt_subnode_to_map(struct pinctrl_dev *p return npins; } - pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, npins); if (!pins) return -ENOMEM; - functions = devm_kcalloc(dev, npins, sizeof(*functions), GFP_KERNEL); + functions = devm_kzalloc_objs(dev, *functions, npins); if (!functions) return -ENOMEM; @@ -153,11 +153,11 @@ static int pinctrl_generic_pinmux_dt_subnode_to_map(struct pinctrl_dev *pctldev, return npins; } - pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, npins); if (!pins) return -ENOMEM; - muxes = devm_kcalloc(dev, npins, sizeof(*muxes), GFP_KERNEL); + muxes = devm_kzalloc_objs(dev, *muxes, npins); if (!muxes) return -ENOMEM; @@ -210,7 +210,7 @@ static int pinctrl_generic_dt_node_to_map(struct pinctrl_dev *pctldev, if (!of_property_present(np, "pins")) goto parent; - group_names = devm_kcalloc(dev, 1, sizeof(*group_names), GFP_KERNEL); + group_names = devm_kzalloc_objs(dev, *group_names, 1); if (!group_names) return -ENOMEM; @@ -233,7 +233,7 @@ parent: for_each_available_child_of_node(np, child_np) ngroups += 1; - group_names = devm_kcalloc(dev, ngroups, sizeof(*group_names), GFP_KERNEL); + group_names = devm_kzalloc_objs(dev, *group_names, ngroups); if (!group_names) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c index 1aa6a6dc1209..e2c3ac8c1242 100644 --- a/drivers/pinctrl/pinctrl-ingenic.c +++ b/drivers/pinctrl/pinctrl-ingenic.c @@ -4424,7 +4424,7 @@ static int __init ingenic_gpio_probe(struct ingenic_pinctrl *jzpc, return err; } - jzgc = devm_kzalloc(dev, sizeof(*jzgc), GFP_KERNEL); + jzgc = devm_kzalloc_obj(dev, *jzgc); if (!jzgc) return -ENOMEM; @@ -4467,8 +4467,7 @@ static int __init ingenic_gpio_probe(struct ingenic_pinctrl *jzpc, gpio_irq_chip_set_chip(girq, &ingenic_gpio_irqchip); girq->parent_handler = ingenic_gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; @@ -4501,7 +4500,7 @@ static int __init ingenic_pinctrl_probe(struct platform_device *pdev) return -EINVAL; } - jzpc = devm_kzalloc(dev, sizeof(*jzpc), GFP_KERNEL); + jzpc = devm_kzalloc_obj(dev, *jzpc); if (!jzpc) return -ENOMEM; @@ -4526,7 +4525,7 @@ static int __init ingenic_pinctrl_probe(struct platform_device *pdev) jzpc->dev = dev; jzpc->info = chip_info; - pctl_desc = devm_kzalloc(&pdev->dev, sizeof(*pctl_desc), GFP_KERNEL); + pctl_desc = devm_kzalloc_obj(&pdev->dev, *pctl_desc); if (!pctl_desc) return -ENOMEM; @@ -4537,8 +4536,9 @@ static int __init ingenic_pinctrl_probe(struct platform_device *pdev) pctl_desc->pmxops = &ingenic_pmxops; pctl_desc->confops = &ingenic_confops; pctl_desc->npins = chip_info->num_chips * PINS_PER_GPIO_CHIP; - pctl_desc->pins = jzpc->pdesc = devm_kcalloc(&pdev->dev, - pctl_desc->npins, sizeof(*jzpc->pdesc), GFP_KERNEL); + pctl_desc->pins = jzpc->pdesc = devm_kzalloc_objs(&pdev->dev, + *jzpc->pdesc, + pctl_desc->npins); if (!jzpc->pdesc) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c index ddd6d6bfd513..ab01bdbdbb97 100644 --- a/drivers/pinctrl/pinctrl-k210.c +++ b/drivers/pinctrl/pinctrl-k210.c @@ -927,7 +927,7 @@ static int k210_fpioa_probe(struct platform_device *pdev) dev_info(dev, "K210 FPIOA pin controller\n"); - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-k230.c b/drivers/pinctrl/pinctrl-k230.c index 886577abf0d0..668bb3c4dfbd 100644 --- a/drivers/pinctrl/pinctrl-k230.c +++ b/drivers/pinctrl/pinctrl-k230.c @@ -485,10 +485,8 @@ static int k230_pinctrl_parse_groups(struct device_node *np, size /= sizeof(*list); grp->num_pins = size; - grp->pins = devm_kcalloc(dev, grp->num_pins, sizeof(*grp->pins), - GFP_KERNEL); - grp->data = devm_kcalloc(dev, grp->num_pins, sizeof(*grp->data), - GFP_KERNEL); + grp->pins = devm_kzalloc_objs(dev, *grp->pins, grp->num_pins); + grp->data = devm_kzalloc_objs(dev, *grp->data, grp->num_pins); if (!grp->pins || !grp->data) return -ENOMEM; @@ -525,10 +523,9 @@ static int k230_pinctrl_parse_functions(struct device_node *np, if (func->ngroups <= 0) return 0; - func->groups = devm_kcalloc(dev, func->ngroups, - sizeof(*func->groups), GFP_KERNEL); - func->group_idx = devm_kcalloc(dev, func->ngroups, - sizeof(*func->group_idx), GFP_KERNEL); + func->groups = devm_kzalloc_objs(dev, *func->groups, func->ngroups); + func->group_idx = devm_kzalloc_objs(dev, *func->group_idx, + func->ngroups); if (!func->groups || !func->group_idx) return -ENOMEM; @@ -566,10 +563,9 @@ static int k230_pinctrl_parse_dt(struct platform_device *pdev, k230_pinctrl_child_count(info, np); - info->functions = devm_kcalloc(dev, info->nfunctions, - sizeof(*info->functions), GFP_KERNEL); - info->groups = devm_kcalloc(dev, info->ngroups, - sizeof(*info->groups), GFP_KERNEL); + info->functions = devm_kzalloc_objs(dev, *info->functions, + info->nfunctions); + info->groups = devm_kzalloc_objs(dev, *info->groups, info->ngroups); if (!info->functions || !info->groups) return -ENOMEM; @@ -593,7 +589,7 @@ static int k230_pinctrl_probe(struct platform_device *pdev) struct pinctrl_desc *pctl; int ret; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-keembay.c b/drivers/pinctrl/pinctrl-keembay.c index 3241d3ae6219..c6a00f55c0fd 100644 --- a/drivers/pinctrl/pinctrl-keembay.c +++ b/drivers/pinctrl/pinctrl-keembay.c @@ -1471,8 +1471,9 @@ static int keembay_gpiochip_probe(struct keembay_pinctrl *kpc, girq->chip = &keembay_gpio_irqchip; girq->parent_handler = keembay_gpio_irq_handler; girq->num_parents = KEEMBAY_GPIO_NUM_IRQ; - girq->parents = devm_kcalloc(kpc->dev, girq->num_parents, - sizeof(*girq->parents), GFP_KERNEL); + girq->parents = devm_kzalloc_objs(kpc->dev, + *girq->parents, + girq->num_parents); if (!girq->parents) return -ENOMEM; @@ -1527,7 +1528,7 @@ static int keembay_build_groups(struct keembay_pinctrl *kpc) unsigned int i; kpc->ngroups = kpc->npins; - grp = devm_kcalloc(kpc->dev, kpc->ngroups, sizeof(*grp), GFP_KERNEL); + grp = devm_kzalloc_objs(kpc->dev, *grp, kpc->ngroups); if (!grp) return -ENOMEM; @@ -1572,8 +1573,8 @@ static int keembay_add_functions(struct keembay_pinctrl *kpc, unsigned int grp_idx = 0; int j; - group_names = devm_kcalloc(kpc->dev, func->func.ngroups, - sizeof(*group_names), GFP_KERNEL); + group_names = devm_kzalloc_objs(kpc->dev, *group_names, + func->func.ngroups); if (!group_names) return -ENOMEM; @@ -1608,8 +1609,8 @@ static int keembay_build_functions(struct keembay_pinctrl *kpc) * being part of 8 (hw maximum) globally unique muxes. */ kpc->nfuncs = 0; - keembay_funcs = devm_kcalloc(kpc->dev, kpc->npins * 8, - sizeof(*keembay_funcs), GFP_KERNEL); + keembay_funcs = devm_kzalloc_objs(kpc->dev, *keembay_funcs, + kpc->npins * 8); if (!keembay_funcs) return -ENOMEM; @@ -1665,7 +1666,7 @@ static int keembay_pinctrl_probe(struct platform_device *pdev) struct keembay_pinctrl *kpc; int ret; - kpc = devm_kzalloc(dev, sizeof(*kpc), GFP_KERNEL); + kpc = devm_kzalloc_obj(dev, *kpc); if (!kpc) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-loongson2.c b/drivers/pinctrl/pinctrl-loongson2.c index 7d04fa81d2e5..d7da828b7497 100644 --- a/drivers/pinctrl/pinctrl-loongson2.c +++ b/drivers/pinctrl/pinctrl-loongson2.c @@ -253,7 +253,7 @@ static int loongson2_pinctrl_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct loongson2_pinctrl *pctrl; - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-lpc18xx.c b/drivers/pinctrl/pinctrl-lpc18xx.c index 9431810ffaff..b154cd22aaef 100644 --- a/drivers/pinctrl/pinctrl-lpc18xx.c +++ b/drivers/pinctrl/pinctrl-lpc18xx.c @@ -1327,7 +1327,7 @@ static int lpc18xx_scu_probe(struct platform_device *pdev) struct lpc18xx_scu_data *scu; int ret; - scu = devm_kzalloc(&pdev->dev, sizeof(*scu), GFP_KERNEL); + scu = devm_kzalloc_obj(&pdev->dev, *scu); if (!scu) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-max7360.c b/drivers/pinctrl/pinctrl-max7360.c index abfaff468bad..fdf2ac8276af 100644 --- a/drivers/pinctrl/pinctrl-max7360.c +++ b/drivers/pinctrl/pinctrl-max7360.c @@ -173,7 +173,7 @@ static int max7360_pinctrl_probe(struct platform_device *pdev) if (!regmap) return dev_err_probe(dev, -ENODEV, "Could not get parent regmap\n"); - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-max77620.c b/drivers/pinctrl/pinctrl-max77620.c index 0fa28d697e8c..b181cde6d7c5 100644 --- a/drivers/pinctrl/pinctrl-max77620.c +++ b/drivers/pinctrl/pinctrl-max77620.c @@ -556,7 +556,7 @@ static int max77620_pinctrl_probe(struct platform_device *pdev) device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); - mpci = devm_kzalloc(&pdev->dev, sizeof(*mpci), GFP_KERNEL); + mpci = devm_kzalloc_obj(&pdev->dev, *mpci); if (!mpci) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-mcp23s08_i2c.c b/drivers/pinctrl/pinctrl-mcp23s08_i2c.c index 928b66531858..21b7147ffef7 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08_i2c.c +++ b/drivers/pinctrl/pinctrl-mcp23s08_i2c.c @@ -14,7 +14,7 @@ static int mcp230xx_probe(struct i2c_client *client) struct mcp23s08 *mcp; int ret; - mcp = devm_kzalloc(dev, sizeof(*mcp), GFP_KERNEL); + mcp = devm_kzalloc_obj(dev, *mcp); if (!mcp) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-mcp23s08_spi.c b/drivers/pinctrl/pinctrl-mcp23s08_spi.c index bacebcff67ef..a2e9a3b714ef 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08_spi.c +++ b/drivers/pinctrl/pinctrl-mcp23s08_spi.c @@ -164,7 +164,7 @@ static int mcp23s08_probe(struct spi_device *spi) chips = hweight_long(spi_present_mask); - data = devm_kzalloc(dev, struct_size(data, chip, chips), GFP_KERNEL); + data = devm_kzalloc_flex(dev, *data, chip, chips); if (!data) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c index aa0f7c809978..7ffc34240dc5 100644 --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c @@ -821,7 +821,7 @@ static int microchip_sgpio_register_bank(struct device *dev, pctl_desc->confops = &sgpio_confops; pctl_desc->owner = THIS_MODULE; - pins = devm_kcalloc(dev, ngpios, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, ngpios); if (!pins) return -ENOMEM; @@ -874,9 +874,8 @@ static int microchip_sgpio_register_bank(struct device *dev, gpio_irq_chip_set_chip(girq, µchip_sgpio_irqchip); girq->parent_handler = sgpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, + 1); if (!girq->parents) return -ENOMEM; girq->parents[0] = irq; @@ -913,7 +912,7 @@ static int microchip_sgpio_probe(struct platform_device *pdev) .reg_stride = 4, }; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-mlxbf3.c b/drivers/pinctrl/pinctrl-mlxbf3.c index 1b285c9ee05a..a58827488664 100644 --- a/drivers/pinctrl/pinctrl-mlxbf3.c +++ b/drivers/pinctrl/pinctrl-mlxbf3.c @@ -247,7 +247,7 @@ static int mlxbf3_pinctrl_probe(struct platform_device *pdev) struct mlxbf3_pinctrl *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index 58d3cde9f964..4cf7b36cc0e4 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -2374,9 +2374,7 @@ static int ocelot_gpiochip_register(struct platform_device *pdev, gpio_irq_chip_set_chip(girq, &ocelot_irqchip); girq->parent_handler = ocelot_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(&pdev->dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; girq->parents[0] = irq; @@ -2442,7 +2440,7 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev) .reg_stride = 4, }; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-palmas.c b/drivers/pinctrl/pinctrl-palmas.c index d69f114e4642..d436b5baecad 100644 --- a/drivers/pinctrl/pinctrl-palmas.c +++ b/drivers/pinctrl/pinctrl-palmas.c @@ -999,7 +999,7 @@ static int palmas_pinctrl_probe(struct platform_device *pdev) "ti,palmas-enable-dvfs2"); } - pci = devm_kzalloc(&pdev->dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(&pdev->dev, *pci); if (!pci) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-pef2256.c b/drivers/pinctrl/pinctrl-pef2256.c index 868ea33bec3c..70101e3757db 100644 --- a/drivers/pinctrl/pinctrl-pef2256.c +++ b/drivers/pinctrl/pinctrl-pef2256.c @@ -323,7 +323,7 @@ static int pef2256_pinctrl_probe(struct platform_device *pdev) struct pef2256 *pef2256; int ret; - pef2256_pinctrl = devm_kzalloc(&pdev->dev, sizeof(*pef2256_pinctrl), GFP_KERNEL); + pef2256_pinctrl = devm_kzalloc_obj(&pdev->dev, *pef2256_pinctrl); if (!pef2256_pinctrl) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-pic32.c b/drivers/pinctrl/pinctrl-pic32.c index 07a24e17d35b..617008af9b58 100644 --- a/drivers/pinctrl/pinctrl-pic32.c +++ b/drivers/pinctrl/pinctrl-pic32.c @@ -2164,7 +2164,7 @@ static int pic32_pinctrl_probe(struct platform_device *pdev) struct pic32_pinctrl *pctl; int ret; - pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); + pctl = devm_kzalloc_obj(&pdev->dev, *pctl); if (!pctl) return -ENOMEM; pctl->dev = &pdev->dev; @@ -2246,8 +2246,7 @@ static int pic32_gpio_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &pic32_gpio_irq_chip); girq->parent_handler = pic32_gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, 1, sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(&pdev->dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; girq->default_type = IRQ_TYPE_NONE; diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c index cc5cd2a538c5..e2f30b48beb5 100644 --- a/drivers/pinctrl/pinctrl-pistachio.c +++ b/drivers/pinctrl/pinctrl-pistachio.c @@ -1410,9 +1410,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl) gpio_irq_chip_set_chip(girq, &pistachio_gpio_irq_chip); girq->parent_handler = pistachio_gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(pctl->dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(pctl->dev, *girq->parents, 1); if (!girq->parents) { ret = -ENOMEM; goto err; @@ -1457,7 +1455,7 @@ static int pistachio_pinctrl_probe(struct platform_device *pdev) { struct pistachio_pinctrl *pctl; - pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); + pctl = devm_kzalloc_obj(&pdev->dev, *pctl); if (!pctl) return -ENOMEM; pctl->dev = &pdev->dev; diff --git a/drivers/pinctrl/pinctrl-rk805.c b/drivers/pinctrl/pinctrl-rk805.c index 22f576337faa..24e76b4d919b 100644 --- a/drivers/pinctrl/pinctrl-rk805.c +++ b/drivers/pinctrl/pinctrl-rk805.c @@ -607,7 +607,7 @@ static int rk805_pinctrl_probe(struct platform_device *pdev) device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); - pci = devm_kzalloc(&pdev->dev, sizeof(*pci), GFP_KERNEL); + pci = devm_kzalloc_obj(&pdev->dev, *pci); if (!pci) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index ba47b6f323cc..ee03c9f064b2 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -4346,8 +4346,8 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, grp->npins = size / 4; - grp->pins = devm_kcalloc(dev, grp->npins, sizeof(*grp->pins), GFP_KERNEL); - grp->data = devm_kcalloc(dev, grp->npins, sizeof(*grp->data), GFP_KERNEL); + grp->pins = devm_kzalloc_objs(dev, *grp->pins, grp->npins); + grp->data = devm_kzalloc_objs(dev, *grp->data, grp->npins); if (!grp->pins || !grp->data) return -ENOMEM; @@ -4399,7 +4399,7 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np, if (func->ngroups <= 0) return 0; - func->groups = devm_kcalloc(dev, func->ngroups, sizeof(*func->groups), GFP_KERNEL); + func->groups = devm_kzalloc_objs(dev, *func->groups, func->ngroups); if (!func->groups) return -ENOMEM; @@ -4427,11 +4427,12 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev, dev_dbg(dev, "nfunctions = %d\n", info->nfunctions); dev_dbg(dev, "ngroups = %d\n", info->ngroups); - info->functions = devm_kcalloc(dev, info->nfunctions, sizeof(*info->functions), GFP_KERNEL); + info->functions = devm_kzalloc_objs(dev, *info->functions, + info->nfunctions); if (!info->functions) return -ENOMEM; - info->groups = devm_kcalloc(dev, info->ngroups, sizeof(*info->groups), GFP_KERNEL); + info->groups = devm_kzalloc_objs(dev, *info->groups, info->ngroups); if (!info->groups) return -ENOMEM; @@ -4468,7 +4469,7 @@ static int rockchip_pinctrl_register(struct platform_device *pdev, ctrldesc->pmxops = &rockchip_pmx_ops; ctrldesc->confops = &rockchip_pinconf_ops; - pindesc = devm_kcalloc(dev, info->ctrl->nr_pins, sizeof(*pindesc), GFP_KERNEL); + pindesc = devm_kzalloc_objs(dev, *pindesc, info->ctrl->nr_pins); if (!pindesc) return -ENOMEM; @@ -4775,7 +4776,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) if (!dev->of_node) return dev_err_probe(dev, -ENODEV, "device tree node not found\n"); - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-scmi.c b/drivers/pinctrl/pinctrl-scmi.c index fdede6f6078c..43d5f3d54a8a 100644 --- a/drivers/pinctrl/pinctrl-scmi.c +++ b/drivers/pinctrl/pinctrl-scmi.c @@ -400,8 +400,7 @@ static int pinctrl_scmi_get_functions(struct scmi_pinctrl *pmx) "Function %s contains no groups\n", fname); - gnames = devm_kmalloc_array(pmx->dev, nr_groups, - sizeof(*gnames), GFP_KERNEL); + gnames = devm_kmalloc_objs(pmx->dev, *gnames, nr_groups); if (!gnames) return -ENOMEM; @@ -477,7 +476,7 @@ static int pinctrl_scmi_get_pins(struct scmi_pinctrl *pmx, * npins will never be zero, the scmi pinctrl driver has bailed out * if npins is zero. */ - pins = devm_kmalloc_array(pmx->dev, npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kmalloc_objs(pmx->dev, *pins, npins); if (!pins) return -ENOMEM; @@ -527,7 +526,7 @@ static int scmi_pinctrl_probe(struct scmi_device *sdev) if (IS_ERR(pinctrl_ops)) return PTR_ERR(pinctrl_ops); - pmx = devm_kzalloc(dev, sizeof(*pmx), GFP_KERNEL); + pmx = devm_kzalloc_obj(dev, *pmx); if (!pmx) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index e0eb7240a985..10f52a7a52c1 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c @@ -744,9 +744,7 @@ static int pcs_allocate_pin_table(struct pcs_device *pcs) } dev_dbg(pcs->dev, "allocating %i pins\n", nr_pins); - pcs->pins.pa = devm_kcalloc(pcs->dev, - nr_pins, sizeof(*pcs->pins.pa), - GFP_KERNEL); + pcs->pins.pa = devm_kzalloc_objs(pcs->dev, *pcs->pins.pa, nr_pins); if (!pcs->pins.pa) return -ENOMEM; @@ -791,7 +789,7 @@ static int pcs_add_function(struct pcs_device *pcs, struct pcs_function *function; int selector; - function = devm_kzalloc(pcs->dev, sizeof(*function), GFP_KERNEL); + function = devm_kzalloc_obj(pcs->dev, *function); if (!function) return -ENOMEM; @@ -956,16 +954,13 @@ static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np, if (!nconfs) return -ENOTSUPP; - func->conf = devm_kcalloc(pcs->dev, - nconfs, sizeof(struct pcs_conf_vals), - GFP_KERNEL); + func->conf = devm_kzalloc_objs(pcs->dev, struct pcs_conf_vals, nconfs); if (!func->conf) return -ENOMEM; func->nconfs = nconfs; conf = &(func->conf[0]); m++; - settings = devm_kcalloc(pcs->dev, nconfs, sizeof(unsigned long), - GFP_KERNEL); + settings = devm_kzalloc_objs(pcs->dev, unsigned long, nconfs); if (!settings) return -ENOMEM; s = &settings[0]; @@ -1019,11 +1014,11 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs, return -EINVAL; } - vals = devm_kcalloc(pcs->dev, rows, sizeof(*vals), GFP_KERNEL); + vals = devm_kzalloc_objs(pcs->dev, *vals, rows); if (!vals) return -ENOMEM; - pins = devm_kcalloc(pcs->dev, rows, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(pcs->dev, *pins, rows); if (!pins) goto free_vals; @@ -1268,13 +1263,13 @@ static int pcs_dt_node_to_map(struct pinctrl_dev *pctldev, pcs = pinctrl_dev_get_drvdata(pctldev); /* create 2 maps. One is for pinmux, and the other is for pinconf. */ - *map = devm_kcalloc(pcs->dev, 2, sizeof(**map), GFP_KERNEL); + *map = devm_kzalloc_objs(pcs->dev, **map, 2); if (!*map) return -ENOMEM; *num_maps = 0; - pgnames = devm_kzalloc(pcs->dev, sizeof(*pgnames), GFP_KERNEL); + pgnames = devm_kzalloc_obj(pcs->dev, *pgnames); if (!pgnames) { ret = -ENOMEM; goto free_map; @@ -1358,7 +1353,7 @@ static int pcs_add_gpio_func(struct device_node *node, struct pcs_device *pcs) ret = 0; break; } - range = devm_kzalloc(pcs->dev, sizeof(*range), GFP_KERNEL); + range = devm_kzalloc_obj(pcs->dev, *range); if (!range) { of_node_put(gpiospec.np); ret = -ENOMEM; @@ -1547,7 +1542,7 @@ static int pcs_irqdomain_map(struct irq_domain *d, unsigned int irq, struct pcs_interrupt *pcswi; pcs = container_of(pcs_soc, struct pcs_device, socdata); - pcswi = devm_kzalloc(pcs->dev, sizeof(*pcswi), GFP_KERNEL); + pcswi = devm_kzalloc_obj(pcs->dev, *pcswi); if (!pcswi) return -ENOMEM; @@ -1755,12 +1750,12 @@ static int pcs_quirk_missing_pinctrl_cells(struct pcs_device *pcs, dev_warn(pcs->dev, "please update dts to use %s = <%i>\n", name, cells); - p = devm_kzalloc(pcs->dev, sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(pcs->dev, *p); if (!p) return -ENOMEM; p->length = sizeof(__be32); - p->value = devm_kzalloc(pcs->dev, sizeof(__be32), GFP_KERNEL); + p->value = devm_kzalloc_obj(pcs->dev, __be32); if (!p->value) return -ENOMEM; *(__be32 *)p->value = cpu_to_be32(cells); @@ -1791,7 +1786,7 @@ static int pcs_probe(struct platform_device *pdev) if (WARN_ON(!soc)) return -EINVAL; - pcs = devm_kzalloc(&pdev->dev, sizeof(*pcs), GFP_KERNEL); + pcs = devm_kzalloc_obj(&pdev->dev, *pcs); if (!pcs) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 59ecc295fb8e..dc23599764e2 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c @@ -819,7 +819,7 @@ static int st_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, } map_num = grp->npins + 1; - new_map = devm_kcalloc(dev, map_num, sizeof(*new_map), GFP_KERNEL); + new_map = devm_kzalloc_objs(dev, *new_map, map_num); if (!new_map) return -ENOMEM; @@ -1217,8 +1217,8 @@ static int st_pctl_dt_parse_groups(struct device_node *np, grp->npins = npins; grp->name = np->name; - grp->pins = devm_kcalloc(dev, npins, sizeof(*grp->pins), GFP_KERNEL); - grp->pin_conf = devm_kcalloc(dev, npins, sizeof(*grp->pin_conf), GFP_KERNEL); + grp->pins = devm_kzalloc_objs(dev, *grp->pins, npins); + grp->pin_conf = devm_kzalloc_objs(dev, *grp->pin_conf, npins); if (!grp->pins || !grp->pin_conf) return -ENOMEM; @@ -1271,7 +1271,7 @@ static int st_pctl_parse_functions(struct device_node *np, func->ngroups = of_get_child_count(np); if (func->ngroups == 0) return dev_err_probe(dev, -EINVAL, "No groups defined\n"); - func->groups = devm_kcalloc(dev, func->ngroups, sizeof(*func->groups), GFP_KERNEL); + func->groups = devm_kzalloc_objs(dev, *func->groups, func->ngroups); if (!func->groups) return -ENOMEM; @@ -1556,8 +1556,7 @@ static int st_gpiolib_register_bank(struct st_pinctrl *info, gpio_irq_chip_set_chip(girq, &st_gpio_irqchip); girq->parent_handler = st_gpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; girq->parents[0] = gpio_irq; @@ -1601,11 +1600,12 @@ static int st_pctl_probe_dt(struct platform_device *pdev, dev_info(dev, "nfunctions = %d\n", info->nfunctions); dev_info(dev, "ngroups = %d\n", info->ngroups); - info->functions = devm_kcalloc(dev, info->nfunctions, sizeof(*info->functions), GFP_KERNEL); + info->functions = devm_kzalloc_objs(dev, *info->functions, + info->nfunctions); - info->groups = devm_kcalloc(dev, info->ngroups, sizeof(*info->groups), GFP_KERNEL); + info->groups = devm_kzalloc_objs(dev, *info->groups, info->ngroups); - info->banks = devm_kcalloc(dev, info->nbanks, sizeof(*info->banks), GFP_KERNEL); + info->banks = devm_kzalloc_objs(dev, *info->banks, info->nbanks); if (!info->functions || !info->groups || !info->banks) return -ENOMEM; @@ -1627,7 +1627,7 @@ static int st_pctl_probe_dt(struct platform_device *pdev, } pctl_desc->npins = info->nbanks * ST_GPIO_PINS_PER_BANK; - pdesc = devm_kcalloc(dev, pctl_desc->npins, sizeof(*pdesc), GFP_KERNEL); + pdesc = devm_kzalloc_objs(dev, *pdesc, pctl_desc->npins); if (!pdesc) return -ENOMEM; @@ -1682,11 +1682,11 @@ static int st_pctl_probe(struct platform_device *pdev) return -EINVAL; } - pctl_desc = devm_kzalloc(dev, sizeof(*pctl_desc), GFP_KERNEL); + pctl_desc = devm_kzalloc_obj(dev, *pctl_desc); if (!pctl_desc) return -ENOMEM; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c index 935cace7f645..b85fea7489d6 100644 --- a/drivers/pinctrl/pinctrl-stmfx.c +++ b/drivers/pinctrl/pinctrl-stmfx.c @@ -648,7 +648,7 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev) struct gpio_irq_chip *girq; int irq, ret; - pctl = devm_kzalloc(stmfx->dev, sizeof(*pctl), GFP_KERNEL); + pctl = devm_kzalloc_obj(stmfx->dev, *pctl); if (!pctl) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-sx150x.c b/drivers/pinctrl/pinctrl-sx150x.c index 04a0e6269e5b..6c64a0a44faa 100644 --- a/drivers/pinctrl/pinctrl-sx150x.c +++ b/drivers/pinctrl/pinctrl-sx150x.c @@ -1132,7 +1132,7 @@ static int sx150x_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, i2c_funcs)) return -ENOSYS; - pctl = devm_kzalloc(dev, sizeof(*pctl), GFP_KERNEL); + pctl = devm_kzalloc_obj(dev, *pctl); if (!pctl) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-tb10x.c b/drivers/pinctrl/pinctrl-tb10x.c index b7cbd69dd877..a03f566a97cb 100644 --- a/drivers/pinctrl/pinctrl-tb10x.c +++ b/drivers/pinctrl/pinctrl-tb10x.c @@ -749,9 +749,8 @@ static int tb10x_pinctrl_probe(struct platform_device *pdev) return -EINVAL; } - state = devm_kzalloc(dev, struct_size(state, pinfuncs, - of_get_child_count(of_node)), - GFP_KERNEL); + state = devm_kzalloc_flex(dev, *state, pinfuncs, + of_get_child_count(of_node)); if (!state) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-th1520.c b/drivers/pinctrl/pinctrl-th1520.c index 50a5889df7c4..02332137182d 100644 --- a/drivers/pinctrl/pinctrl-th1520.c +++ b/drivers/pinctrl/pinctrl-th1520.c @@ -485,7 +485,8 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, } npins = of_property_count_strings(child, "pins"); - pgnames = devm_kcalloc(thp->pctl->dev, npins, sizeof(*pgnames), GFP_KERNEL); + pgnames = devm_kzalloc_objs(thp->pctl->dev, *pgnames, + npins); if (!pgnames) { ret = -ENOMEM; goto free_configs; @@ -855,7 +856,7 @@ static int th1520_pinctrl_probe(struct platform_device *pdev) u32 pin_group; int ret; - thp = devm_kzalloc(dev, sizeof(*thp), GFP_KERNEL); + thp = devm_kzalloc_obj(dev, *thp); if (!thp) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-tps6594.c b/drivers/pinctrl/pinctrl-tps6594.c index 937fc9cb54b7..c18a5f4a2eab 100644 --- a/drivers/pinctrl/pinctrl-tps6594.c +++ b/drivers/pinctrl/pinctrl-tps6594.c @@ -492,11 +492,11 @@ static int tps6594_pinctrl_probe(struct platform_device *pdev) struct pinctrl_desc *pctrl_desc; struct gpio_regmap_config config = {}; - pctrl_desc = devm_kzalloc(dev, sizeof(*pctrl_desc), GFP_KERNEL); + pctrl_desc = devm_kzalloc_obj(dev, *pctrl_desc); if (!pctrl_desc) return -ENOMEM; - pinctrl = devm_kzalloc(dev, sizeof(*pinctrl), GFP_KERNEL); + pinctrl = devm_kzalloc_obj(dev, *pinctrl); if (!pinctrl) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-upboard.c b/drivers/pinctrl/pinctrl-upboard.c index de1920a3387d..b9af6dd93c34 100644 --- a/drivers/pinctrl/pinctrl-upboard.c +++ b/drivers/pinctrl/pinctrl-upboard.c @@ -960,11 +960,11 @@ static int upboard_pinctrl_probe(struct platform_device *pdev) unsigned int i; int ret; - pctldesc = devm_kzalloc(dev, sizeof(*pctldesc), GFP_KERNEL); + pctldesc = devm_kzalloc_obj(dev, *pctldesc); if (!pctldesc) return -ENOMEM; - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; @@ -997,7 +997,7 @@ static int upboard_pinctrl_probe(struct platform_device *pdev) pctrl->dev = dev; - pins = devm_kcalloc(dev, pctldesc->npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, pctldesc->npins); if (!pins) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c index 3d4ad61d0da9..fb8ef9623a6c 100644 --- a/drivers/pinctrl/pinctrl-xway.c +++ b/drivers/pinctrl/pinctrl-xway.c @@ -1467,9 +1467,8 @@ static int pinmux_xway_probe(struct platform_device *pdev) xway_chip.ngpio = xway_soc->pin_count; /* load our pad descriptors */ - xway_info.pads = devm_kcalloc(&pdev->dev, - xway_chip.ngpio, sizeof(struct pinctrl_pin_desc), - GFP_KERNEL); + xway_info.pads = devm_kzalloc_objs(&pdev->dev, struct pinctrl_pin_desc, + xway_chip.ngpio); if (!xway_info.pads) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-zynq.c b/drivers/pinctrl/pinctrl-zynq.c index dcde86fed10d..d44349b4ebb5 100644 --- a/drivers/pinctrl/pinctrl-zynq.c +++ b/drivers/pinctrl/pinctrl-zynq.c @@ -1164,7 +1164,7 @@ static int zynq_pinctrl_probe(struct platform_device *pdev) struct resource *res; struct zynq_pinctrl *pctrl; - pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(&pdev->dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/pinctrl-zynqmp.c b/drivers/pinctrl/pinctrl-zynqmp.c index aba129ead04c..e3e5eda57965 100644 --- a/drivers/pinctrl/pinctrl-zynqmp.c +++ b/drivers/pinctrl/pinctrl-zynqmp.c @@ -613,8 +613,8 @@ static int zynqmp_pinctrl_prepare_func_groups(struct device *dev, u32 fid, } done: npins = bitmap_weight(used_pins, zynqmp_desc.npins); - fgroups = devm_kcalloc(dev, size_add(func->ngroups, npins), - sizeof(*fgroups), GFP_KERNEL); + fgroups = devm_kzalloc_objs(dev, *fgroups, + size_add(func->ngroups, npins)); if (!fgroups) return -ENOMEM; @@ -790,7 +790,7 @@ static int zynqmp_pinctrl_prepare_function_info(struct device *dev, if (ret) return ret; - funcs = devm_kcalloc(dev, pctrl->nfuncs, sizeof(*funcs), GFP_KERNEL); + funcs = devm_kzalloc_objs(dev, *funcs, pctrl->nfuncs); if (!funcs) return -ENOMEM; @@ -804,7 +804,7 @@ static int zynqmp_pinctrl_prepare_function_info(struct device *dev, pctrl->ngroups += funcs[i].ngroups; } - groups = devm_kcalloc(dev, pctrl->ngroups, sizeof(*groups), GFP_KERNEL); + groups = devm_kzalloc_objs(dev, *groups, pctrl->ngroups); if (!groups) return -ENOMEM; @@ -866,7 +866,7 @@ static int zynqmp_pinctrl_prepare_pin_desc(struct device *dev, if (ret) return ret; - pins = devm_kcalloc(dev, *npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, *npins); if (!pins) return -ENOMEM; @@ -918,7 +918,7 @@ static int versal_pinctrl_prepare_pin_desc(struct device *dev, if (ret) return ret; - pins = devm_kcalloc(dev, *npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, *npins); if (!pins) return -ENOMEM; @@ -953,7 +953,7 @@ static int zynqmp_pinctrl_probe(struct platform_device *pdev) struct zynqmp_pinctrl *pctrl; int ret; - pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(&pdev->dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index 574fc95b6712..3d4d39db51f8 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c @@ -944,7 +944,7 @@ int pinmux_generic_add_pinfunction(struct pinctrl_dev *pctldev, selector = pctldev->num_functions; - function = devm_kzalloc(pctldev->dev, sizeof(*function), GFP_KERNEL); + function = devm_kzalloc_obj(pctldev->dev, *function); if (!function) return -ENOMEM; diff --git a/drivers/pinctrl/pxa/pinctrl-pxa2xx.c b/drivers/pinctrl/pxa/pinctrl-pxa2xx.c index 9fd7a8fb2bc4..93f5a0e16598 100644 --- a/drivers/pinctrl/pxa/pinctrl-pxa2xx.c +++ b/drivers/pinctrl/pxa/pinctrl-pxa2xx.c @@ -272,8 +272,7 @@ static int pxa2xx_build_functions(struct pxa_pinctrl *pctl) * alternate function, 6 * npins is an absolute high limit of the number * of functions. */ - functions = devm_kcalloc(pctl->dev, pctl->npins * 6, - sizeof(*functions), GFP_KERNEL); + functions = devm_kzalloc_objs(pctl->dev, *functions, pctl->npins * 6); if (!functions) return -ENOMEM; @@ -297,8 +296,7 @@ static int pxa2xx_build_groups(struct pxa_pinctrl *pctl) struct pinfunction *func; const char **gtmp; - gtmp = devm_kmalloc_array(pctl->dev, pctl->npins, sizeof(*gtmp), - GFP_KERNEL); + gtmp = devm_kmalloc_objs(pctl->dev, *gtmp, pctl->npins); if (!gtmp) return -ENOMEM; @@ -335,7 +333,7 @@ static int pxa2xx_build_state(struct pxa_pinctrl *pctl, pctl->ngroups = npins; pctl->desc.npins = npins; - pins = devm_kcalloc(pctl->dev, npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(pctl->dev, *pins, npins); if (!pins) return -ENOMEM; @@ -343,8 +341,8 @@ static int pxa2xx_build_state(struct pxa_pinctrl *pctl, for (i = 0; i < npins; i++) pins[i] = ppins[i].pin; - pctl->groups = devm_kmalloc_array(pctl->dev, pctl->ngroups, - sizeof(*pctl->groups), GFP_KERNEL); + pctl->groups = devm_kmalloc_objs(pctl->dev, *pctl->groups, + pctl->ngroups); if (!pctl->groups) return -ENOMEM; @@ -377,15 +375,15 @@ int pxa2xx_pinctrl_init(struct platform_device *pdev, for (i = 0; i < npins; i++) maxpin = max_t(int, ppins[i].pin.number, maxpin); - pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); + pctl = devm_kzalloc_obj(&pdev->dev, *pctl); if (!pctl) return -ENOMEM; - pctl->base_gafr = devm_kcalloc(&pdev->dev, roundup(maxpin, 16), - sizeof(*pctl->base_gafr), GFP_KERNEL); - pctl->base_gpdr = devm_kcalloc(&pdev->dev, roundup(maxpin, 32), - sizeof(*pctl->base_gpdr), GFP_KERNEL); - pctl->base_pgsr = devm_kcalloc(&pdev->dev, roundup(maxpin, 32), - sizeof(*pctl->base_pgsr), GFP_KERNEL); + pctl->base_gafr = devm_kzalloc_objs(&pdev->dev, *pctl->base_gafr, + roundup(maxpin, 16)); + pctl->base_gpdr = devm_kzalloc_objs(&pdev->dev, *pctl->base_gpdr, + roundup(maxpin, 32)); + pctl->base_pgsr = devm_kzalloc_objs(&pdev->dev, *pctl->base_pgsr, + roundup(maxpin, 32)); if (!pctl->base_gafr || !pctl->base_gpdr || !pctl->base_pgsr) return -ENOMEM; diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c index 9412fd36a4aa..679a7d35de8f 100644 --- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c @@ -507,7 +507,7 @@ int lpi_pinctrl_probe(struct platform_device *pdev) struct lpi_pinctrl *pctrl; int ret; - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index 07a7961f8d3e..657ecdaec425 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -1492,8 +1492,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl) girq->parent_handler = msm_gpio_irq_handler; girq->fwnode = dev_fwnode(pctrl->dev); girq->num_parents = 1; - girq->parents = devm_kcalloc(pctrl->dev, 1, sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(pctrl->dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; girq->default_type = IRQ_TYPE_NONE; @@ -1597,7 +1596,7 @@ int msm_pinctrl_probe(struct platform_device *pdev, int ret; int i; - pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(&pdev->dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c b/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c index 3b9edcf8780b..073a0e0ca19d 100644 --- a/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c +++ b/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c @@ -74,11 +74,9 @@ static int qdf2xxx_pinctrl_probe(struct platform_device *pdev) return ret; } - pinctrl = devm_kzalloc(&pdev->dev, sizeof(*pinctrl), GFP_KERNEL); - pins = devm_kcalloc(&pdev->dev, num_gpios, - sizeof(struct pinctrl_pin_desc), GFP_KERNEL); - groups = devm_kcalloc(&pdev->dev, num_gpios, - sizeof(struct msm_pingroup), GFP_KERNEL); + pinctrl = devm_kzalloc_obj(&pdev->dev, *pinctrl); + pins = devm_kzalloc_objs(&pdev->dev, struct pinctrl_pin_desc, num_gpios); + groups = devm_kzalloc_objs(&pdev->dev, struct msm_pingroup, num_gpios); names = devm_kcalloc(&pdev->dev, avail_gpios, NAME_SIZE, GFP_KERNEL); if (!pinctrl || !pins || !groups || !names) diff --git a/drivers/pinctrl/qcom/pinctrl-sc8180x.c b/drivers/pinctrl/qcom/pinctrl-sc8180x.c index 062cb913e5ee..1c921869456d 100644 --- a/drivers/pinctrl/qcom/pinctrl-sc8180x.c +++ b/drivers/pinctrl/qcom/pinctrl-sc8180x.c @@ -1631,7 +1631,7 @@ static int sc8180x_pinctrl_add_tile_resources(struct platform_device *pdev) return 0; /* Allocate for new resources */ - nres = devm_kcalloc(&pdev->dev, nres_num, sizeof(*nres), GFP_KERNEL); + nres = devm_kzalloc_objs(&pdev->dev, *nres, nres_num); if (!nres) return -ENOMEM; diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c index 9163bb14d703..05291b7397d6 100644 --- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c @@ -1113,7 +1113,7 @@ static int pmic_gpio_probe(struct platform_device *pdev) npins = (uintptr_t) device_get_match_data(&pdev->dev); - state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(dev, *state); if (!state) return -ENOMEM; @@ -1125,15 +1125,15 @@ static int pmic_gpio_probe(struct platform_device *pdev) state->usid = parent_spmi_dev->usid; state->pid_base = reg >> 8; - pindesc = devm_kcalloc(dev, npins, sizeof(*pindesc), GFP_KERNEL); + pindesc = devm_kzalloc_objs(dev, *pindesc, npins); if (!pindesc) return -ENOMEM; - pads = devm_kcalloc(dev, npins, sizeof(*pads), GFP_KERNEL); + pads = devm_kzalloc_objs(dev, *pads, npins); if (!pads) return -ENOMEM; - pctrldesc = devm_kzalloc(dev, sizeof(*pctrldesc), GFP_KERNEL); + pctrldesc = devm_kzalloc_obj(dev, *pctrldesc); if (!pctrldesc) return -ENOMEM; diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c index 64f8024a865c..9ad07bb28eeb 100644 --- a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c +++ b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c @@ -873,7 +873,7 @@ static int pmic_mpp_probe(struct platform_device *pdev) BUG_ON(npins > ARRAY_SIZE(pmic_mpp_groups)); - state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(dev, *state); if (!state) return -ENOMEM; @@ -882,15 +882,15 @@ static int pmic_mpp_probe(struct platform_device *pdev) state->dev = &pdev->dev; state->map = dev_get_regmap(dev->parent, NULL); - pindesc = devm_kcalloc(dev, npins, sizeof(*pindesc), GFP_KERNEL); + pindesc = devm_kzalloc_objs(dev, *pindesc, npins); if (!pindesc) return -ENOMEM; - pads = devm_kcalloc(dev, npins, sizeof(*pads), GFP_KERNEL); + pads = devm_kzalloc_objs(dev, *pads, npins); if (!pads) return -ENOMEM; - pctrldesc = devm_kzalloc(dev, sizeof(*pctrldesc), GFP_KERNEL); + pctrldesc = devm_kzalloc_obj(dev, *pctrldesc); if (!pctrldesc) return -ENOMEM; diff --git a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c index c42dd7c736fe..06a735de5fa7 100644 --- a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c +++ b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c @@ -736,7 +736,7 @@ static int pm8xxx_gpio_probe(struct platform_device *pdev) struct pm8xxx_gpio *pctrl; int ret, i; - pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(&pdev->dev, *pctrl); if (!pctrl) return -ENOMEM; @@ -752,17 +752,13 @@ static int pm8xxx_gpio_probe(struct platform_device *pdev) pctrl->desc = pm8xxx_pinctrl_desc; pctrl->desc.npins = pctrl->npins; - pins = devm_kcalloc(&pdev->dev, - pctrl->desc.npins, - sizeof(struct pinctrl_pin_desc), - GFP_KERNEL); + pins = devm_kzalloc_objs(&pdev->dev, struct pinctrl_pin_desc, + pctrl->desc.npins); if (!pins) return -ENOMEM; - pin_data = devm_kcalloc(&pdev->dev, - pctrl->desc.npins, - sizeof(struct pm8xxx_pin_data), - GFP_KERNEL); + pin_data = devm_kzalloc_objs(&pdev->dev, struct pm8xxx_pin_data, + pctrl->desc.npins); if (!pin_data) return -ENOMEM; diff --git a/drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c b/drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c index 7970fa6e1557..d2117ed1bdaf 100644 --- a/drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c +++ b/drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c @@ -824,7 +824,7 @@ static int pm8xxx_mpp_probe(struct platform_device *pdev) int ret; int i; - pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(&pdev->dev, *pctrl); if (!pctrl) return -ENOMEM; @@ -840,17 +840,13 @@ static int pm8xxx_mpp_probe(struct platform_device *pdev) pctrl->desc = pm8xxx_pinctrl_desc; pctrl->desc.npins = pctrl->npins; - pins = devm_kcalloc(&pdev->dev, - pctrl->desc.npins, - sizeof(struct pinctrl_pin_desc), - GFP_KERNEL); + pins = devm_kzalloc_objs(&pdev->dev, struct pinctrl_pin_desc, + pctrl->desc.npins); if (!pins) return -ENOMEM; - pin_data = devm_kcalloc(&pdev->dev, - pctrl->desc.npins, - sizeof(struct pm8xxx_pin_data), - GFP_KERNEL); + pin_data = devm_kzalloc_objs(&pdev->dev, struct pm8xxx_pin_data, + pctrl->desc.npins); if (!pin_data) return -ENOMEM; diff --git a/drivers/pinctrl/realtek/pinctrl-rtd.c b/drivers/pinctrl/realtek/pinctrl-rtd.c index 60222339726b..df2850d73014 100644 --- a/drivers/pinctrl/realtek/pinctrl-rtd.c +++ b/drivers/pinctrl/realtek/pinctrl-rtd.c @@ -633,7 +633,7 @@ int rtd_pinctrl_probe(struct platform_device *pdev, const struct rtd_pinctrl_des { struct rtd_pinctrl *data; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/pinctrl/renesas/core.c b/drivers/pinctrl/renesas/core.c index 4b59fa1ecdeb..bc735422971e 100644 --- a/drivers/pinctrl/renesas/core.c +++ b/drivers/pinctrl/renesas/core.c @@ -51,8 +51,7 @@ static int sh_pfc_map_resources(struct sh_pfc *pfc, return num_irqs; /* Allocate memory windows and IRQs arrays. */ - windows = devm_kcalloc(pfc->dev, num_windows, sizeof(*windows), - GFP_KERNEL); + windows = devm_kzalloc_objs(pfc->dev, *windows, num_windows); if (windows == NULL) return -ENOMEM; @@ -60,8 +59,7 @@ static int sh_pfc_map_resources(struct sh_pfc *pfc, pfc->windows = windows; if (num_irqs) { - irqs = devm_kcalloc(pfc->dev, num_irqs, sizeof(*irqs), - GFP_KERNEL); + irqs = devm_kzalloc_objs(pfc->dev, *irqs, num_irqs); if (irqs == NULL) return -ENOMEM; @@ -407,8 +405,7 @@ static int sh_pfc_init_ranges(struct sh_pfc *pfc) * continuous and allocate a single range. */ pfc->nr_ranges = 1; - pfc->ranges = devm_kzalloc(pfc->dev, sizeof(*pfc->ranges), - GFP_KERNEL); + pfc->ranges = devm_kzalloc_obj(pfc->dev, *pfc->ranges); if (pfc->ranges == NULL) return -ENOMEM; @@ -429,8 +426,7 @@ static int sh_pfc_init_ranges(struct sh_pfc *pfc) } pfc->nr_ranges = nr_ranges; - pfc->ranges = devm_kcalloc(pfc->dev, nr_ranges, sizeof(*pfc->ranges), - GFP_KERNEL); + pfc->ranges = devm_kzalloc_objs(pfc->dev, *pfc->ranges, nr_ranges); if (pfc->ranges == NULL) return -ENOMEM; @@ -710,9 +706,7 @@ static int sh_pfc_suspend_init(struct sh_pfc *pfc) if (!n) return 0; - pfc->saved_regs = devm_kmalloc_array(pfc->dev, n, - sizeof(*pfc->saved_regs), - GFP_KERNEL); + pfc->saved_regs = devm_kmalloc_objs(pfc->dev, *pfc->saved_regs, n); if (!pfc->saved_regs) return -ENOMEM; @@ -1314,7 +1308,7 @@ static int sh_pfc_probe(struct platform_device *pdev) else info = (const void *)platform_get_device_id(pdev)->driver_data; - pfc = devm_kzalloc(&pdev->dev, sizeof(*pfc), GFP_KERNEL); + pfc = devm_kzalloc_obj(&pdev->dev, *pfc); if (pfc == NULL) return -ENOMEM; diff --git a/drivers/pinctrl/renesas/gpio.c b/drivers/pinctrl/renesas/gpio.c index 2293af642849..188b6907d6e7 100644 --- a/drivers/pinctrl/renesas/gpio.c +++ b/drivers/pinctrl/renesas/gpio.c @@ -103,8 +103,7 @@ static int gpio_setup_data_regs(struct sh_pfc_chip *chip) for (i = 0; pfc->info->data_regs[i].reg_width; ++i) ; - chip->regs = devm_kcalloc(pfc->dev, i, sizeof(*chip->regs), - GFP_KERNEL); + chip->regs = devm_kzalloc_objs(pfc->dev, *chip->regs, i); if (chip->regs == NULL) return -ENOMEM; @@ -219,9 +218,8 @@ static int gpio_pin_setup(struct sh_pfc_chip *chip) struct gpio_chip *gc = &chip->gpio_chip; int ret; - chip->pins = devm_kcalloc(pfc->dev, - pfc->info->nr_pins, sizeof(*chip->pins), - GFP_KERNEL); + chip->pins = devm_kzalloc_objs(pfc->dev, *chip->pins, + pfc->info->nr_pins); if (chip->pins == NULL) return -ENOMEM; @@ -298,7 +296,7 @@ sh_pfc_add_gpiochip(struct sh_pfc *pfc, int(*setup)(struct sh_pfc_chip *), struct sh_pfc_chip *chip; int ret; - chip = devm_kzalloc(pfc->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(pfc->dev, *chip); if (unlikely(!chip)) return ERR_PTR(-ENOMEM); diff --git a/drivers/pinctrl/renesas/pinctrl-rza1.c b/drivers/pinctrl/renesas/pinctrl-rza1.c index d2949e4dbaf7..07afa4b3abae 100644 --- a/drivers/pinctrl/renesas/pinctrl-rza1.c +++ b/drivers/pinctrl/renesas/pinctrl-rza1.c @@ -1007,11 +1007,9 @@ static int rza1_dt_node_to_map(struct pinctrl_dev *pctldev, * except that functions carry an array of per-pin mux configuration * settings. */ - mux_confs = devm_kcalloc(rza1_pctl->dev, npins, sizeof(*mux_confs), - GFP_KERNEL); - grpins = devm_kcalloc(rza1_pctl->dev, npins, sizeof(*grpins), - GFP_KERNEL); - fngrps = devm_kzalloc(rza1_pctl->dev, sizeof(*fngrps), GFP_KERNEL); + mux_confs = devm_kzalloc_objs(rza1_pctl->dev, *mux_confs, npins); + grpins = devm_kzalloc_objs(rza1_pctl->dev, *grpins, npins); + fngrps = devm_kzalloc_obj(rza1_pctl->dev, *fngrps); if (!mux_confs || !grpins || !fngrps) return -ENOMEM; @@ -1245,10 +1243,9 @@ static int rza1_gpio_register(struct rza1_pinctrl *rza1_pctl) return 0; } - gpio_chips = devm_kcalloc(rza1_pctl->dev, ngpiochips, - sizeof(*gpio_chips), GFP_KERNEL); - gpio_ranges = devm_kcalloc(rza1_pctl->dev, ngpiochips, - sizeof(*gpio_ranges), GFP_KERNEL); + gpio_chips = devm_kzalloc_objs(rza1_pctl->dev, *gpio_chips, ngpiochips); + gpio_ranges = devm_kzalloc_objs(rza1_pctl->dev, *gpio_ranges, + ngpiochips); if (!gpio_chips || !gpio_ranges) return -ENOMEM; @@ -1282,10 +1279,8 @@ static int rza1_pinctrl_register(struct rza1_pinctrl *rza1_pctl) unsigned int i; int ret; - pins = devm_kcalloc(rza1_pctl->dev, RZA1_NPINS, sizeof(*pins), - GFP_KERNEL); - ports = devm_kcalloc(rza1_pctl->dev, RZA1_NPORTS, sizeof(*ports), - GFP_KERNEL); + pins = devm_kzalloc_objs(rza1_pctl->dev, *pins, RZA1_NPINS); + ports = devm_kzalloc_objs(rza1_pctl->dev, *ports, RZA1_NPORTS); if (!pins || !ports) return -ENOMEM; @@ -1347,7 +1342,7 @@ static int rza1_pinctrl_probe(struct platform_device *pdev) struct rza1_pinctrl *rza1_pctl; int ret; - rza1_pctl = devm_kzalloc(&pdev->dev, sizeof(*rza1_pctl), GFP_KERNEL); + rza1_pctl = devm_kzalloc_obj(&pdev->dev, *rza1_pctl); if (!rza1_pctl) return -ENOMEM; diff --git a/drivers/pinctrl/renesas/pinctrl-rza2.c b/drivers/pinctrl/renesas/pinctrl-rza2.c index 4cab641c3350..8860900ae54b 100644 --- a/drivers/pinctrl/renesas/pinctrl-rza2.c +++ b/drivers/pinctrl/renesas/pinctrl-rza2.c @@ -346,10 +346,9 @@ static int rza2_dt_node_to_map(struct pinctrl_dev *pctldev, } npins = of_pins->length / sizeof(u32); - pins = devm_kcalloc(priv->dev, npins, sizeof(*pins), GFP_KERNEL); - psel_val = devm_kcalloc(priv->dev, npins, sizeof(*psel_val), - GFP_KERNEL); - pin_fn = devm_kzalloc(priv->dev, sizeof(*pin_fn), GFP_KERNEL); + pins = devm_kzalloc_objs(priv->dev, *pins, npins); + psel_val = devm_kzalloc_objs(priv->dev, *psel_val, npins); + pin_fn = devm_kzalloc_obj(priv->dev, *pin_fn); if (!pins || !psel_val || !pin_fn) return -ENOMEM; @@ -482,7 +481,7 @@ static int rza2_pinctrl_probe(struct platform_device *pdev) npins = (uintptr_t)of_device_get_match_data(&pdev->dev) * RZA2_PINS_PER_PORT; - priv = devm_kzalloc(&pdev->dev, struct_size(priv, pins, npins), GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, pins, npins); if (!priv) return -ENOMEM; diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index 9bf3743dc1ce..ca2f36c46c39 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -1003,10 +1003,9 @@ static int rzg2l_dt_subnode_to_map(struct pinctrl_dev *pctldev, goto done; } - pins = devm_kcalloc(pctrl->dev, num_pinmux, sizeof(*pins), GFP_KERNEL); - psel_val = devm_kcalloc(pctrl->dev, num_pinmux, sizeof(*psel_val), - GFP_KERNEL); - pin_fn = devm_kzalloc(pctrl->dev, sizeof(*pin_fn), GFP_KERNEL); + pins = devm_kzalloc_objs(pctrl->dev, *pins, num_pinmux); + psel_val = devm_kzalloc_objs(pctrl->dev, *psel_val, num_pinmux); + pin_fn = devm_kzalloc_obj(pctrl->dev, *pin_fn); if (!pins || !psel_val || !pin_fn) { ret = -ENOMEM; goto done; @@ -3212,11 +3211,11 @@ static int rzg2l_pinctrl_reg_cache_alloc(struct rzg2l_pinctrl *pctrl) u32 nports = pctrl->data->n_port_pins / RZG2L_PINS_PER_PORT; struct rzg2l_pinctrl_reg_cache *cache, *dedicated_cache; - cache = devm_kzalloc(pctrl->dev, sizeof(*cache), GFP_KERNEL); + cache = devm_kzalloc_obj(pctrl->dev, *cache); if (!cache) return -ENOMEM; - dedicated_cache = devm_kzalloc(pctrl->dev, sizeof(*dedicated_cache), GFP_KERNEL); + dedicated_cache = devm_kzalloc_obj(pctrl->dev, *dedicated_cache); if (!dedicated_cache) return -ENOMEM; @@ -3224,7 +3223,7 @@ static int rzg2l_pinctrl_reg_cache_alloc(struct rzg2l_pinctrl *pctrl) if (!cache->p) return -ENOMEM; - cache->pm = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->pm), GFP_KERNEL); + cache->pm = devm_kzalloc_objs(pctrl->dev, *cache->pm, nports); if (!cache->pm) return -ENOMEM; @@ -3232,71 +3231,71 @@ static int rzg2l_pinctrl_reg_cache_alloc(struct rzg2l_pinctrl *pctrl) if (!cache->pmc) return -ENOMEM; - cache->pfc = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->pfc), GFP_KERNEL); + cache->pfc = devm_kzalloc_objs(pctrl->dev, *cache->pfc, nports); if (!cache->pfc) return -ENOMEM; for (u8 i = 0; i < 2; i++) { u32 n_dedicated_pins = pctrl->data->n_dedicated_pins; - cache->iolh[i] = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->iolh[i]), - GFP_KERNEL); + cache->iolh[i] = devm_kzalloc_objs(pctrl->dev, *cache->iolh[i], + nports); if (!cache->iolh[i]) return -ENOMEM; - cache->ien[i] = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->ien[i]), - GFP_KERNEL); + cache->ien[i] = devm_kzalloc_objs(pctrl->dev, *cache->ien[i], + nports); if (!cache->ien[i]) return -ENOMEM; - cache->pupd[i] = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->pupd[i]), - GFP_KERNEL); + cache->pupd[i] = devm_kzalloc_objs(pctrl->dev, *cache->pupd[i], + nports); if (!cache->pupd[i]) return -ENOMEM; - cache->smt[i] = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->smt[i]), - GFP_KERNEL); + cache->smt[i] = devm_kzalloc_objs(pctrl->dev, *cache->smt[i], + nports); if (!cache->smt[i]) return -ENOMEM; - cache->sr[i] = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->sr[i]), - GFP_KERNEL); + cache->sr[i] = devm_kzalloc_objs(pctrl->dev, *cache->sr[i], + nports); if (!cache->sr[i]) return -ENOMEM; - cache->nod[i] = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->nod[i]), - GFP_KERNEL); + cache->nod[i] = devm_kzalloc_objs(pctrl->dev, *cache->nod[i], + nports); if (!cache->nod[i]) return -ENOMEM; /* Allocate dedicated cache. */ - dedicated_cache->iolh[i] = devm_kcalloc(pctrl->dev, n_dedicated_pins, - sizeof(*dedicated_cache->iolh[i]), - GFP_KERNEL); + dedicated_cache->iolh[i] = devm_kzalloc_objs(pctrl->dev, + *dedicated_cache->iolh[i], + n_dedicated_pins); if (!dedicated_cache->iolh[i]) return -ENOMEM; - dedicated_cache->ien[i] = devm_kcalloc(pctrl->dev, n_dedicated_pins, - sizeof(*dedicated_cache->ien[i]), - GFP_KERNEL); + dedicated_cache->ien[i] = devm_kzalloc_objs(pctrl->dev, + *dedicated_cache->ien[i], + n_dedicated_pins); if (!dedicated_cache->ien[i]) return -ENOMEM; - dedicated_cache->sr[i] = devm_kcalloc(pctrl->dev, n_dedicated_pins, - sizeof(*dedicated_cache->sr[i]), - GFP_KERNEL); + dedicated_cache->sr[i] = devm_kzalloc_objs(pctrl->dev, + *dedicated_cache->sr[i], + n_dedicated_pins); if (!dedicated_cache->sr[i]) return -ENOMEM; - dedicated_cache->nod[i] = devm_kcalloc(pctrl->dev, n_dedicated_pins, - sizeof(*dedicated_cache->nod[i]), - GFP_KERNEL); + dedicated_cache->nod[i] = devm_kzalloc_objs(pctrl->dev, + *dedicated_cache->nod[i], + n_dedicated_pins); if (!dedicated_cache->nod[i]) return -ENOMEM; - dedicated_cache->pupd[i] = devm_kcalloc(pctrl->dev, n_dedicated_pins, - sizeof(*dedicated_cache->pupd[i]), - GFP_KERNEL); + dedicated_cache->pupd[i] = devm_kzalloc_objs(pctrl->dev, + *dedicated_cache->pupd[i], + n_dedicated_pins); if (!dedicated_cache->pupd[i]) return -ENOMEM; } @@ -3399,12 +3398,11 @@ static int rzg2l_pinctrl_register(struct rzg2l_pinctrl *pctrl) #endif } - pins = devm_kcalloc(pctrl->dev, pctrl->desc.npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(pctrl->dev, *pins, pctrl->desc.npins); if (!pins) return -ENOMEM; - pin_data = devm_kcalloc(pctrl->dev, pctrl->desc.npins, - sizeof(*pin_data), GFP_KERNEL); + pin_data = devm_kzalloc_objs(pctrl->dev, *pin_data, pctrl->desc.npins); if (!pin_data) return -ENOMEM; @@ -3434,8 +3432,8 @@ static int rzg2l_pinctrl_register(struct rzg2l_pinctrl *pctrl) pins[index].drv_data = &pin_data[index]; } - pctrl->settings = devm_kcalloc(pctrl->dev, pctrl->desc.npins, sizeof(*pctrl->settings), - GFP_KERNEL); + pctrl->settings = devm_kzalloc_objs(pctrl->dev, *pctrl->settings, + pctrl->desc.npins); if (!pctrl->settings) return -ENOMEM; @@ -3493,7 +3491,7 @@ static int rzg2l_pinctrl_probe(struct platform_device *pdev) BUILD_BUG_ON(ARRAY_SIZE(r9a09g057_gpio_configs) * RZG2L_PINS_PER_PORT > ARRAY_SIZE(rzv2h_gpio_names)); - pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(&pdev->dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/renesas/pinctrl-rzn1.c b/drivers/pinctrl/renesas/pinctrl-rzn1.c index fb874867dbfb..6fbeff5dbc15 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzn1.c +++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c @@ -721,9 +721,7 @@ static int rzn1_pinctrl_parse_groups(struct device_node *np, grp->pin_ids = devm_kmalloc_array(ipctl->dev, grp->npins, sizeof(grp->pin_ids[0]), GFP_KERNEL); - grp->pins = devm_kmalloc_array(ipctl->dev, - grp->npins, sizeof(grp->pins[0]), - GFP_KERNEL); + grp->pins = devm_kmalloc_objs(ipctl->dev, grp->pins[0], grp->npins); if (!grp->pin_ids || !grp->pins) return -ENOMEM; @@ -821,9 +819,8 @@ static int rzn1_pinctrl_probe_dt(struct platform_device *pdev, return 0; ipctl->nfunctions = nfuncs; - ipctl->functions = devm_kmalloc_array(&pdev->dev, nfuncs, - sizeof(*ipctl->functions), - GFP_KERNEL); + ipctl->functions = devm_kmalloc_objs(&pdev->dev, *ipctl->functions, + nfuncs); if (!ipctl->functions) return -ENOMEM; @@ -831,10 +828,7 @@ static int rzn1_pinctrl_probe_dt(struct platform_device *pdev, for_each_child_of_node_scoped(np, child) maxgroups += rzn1_pinctrl_count_function_groups(child); - ipctl->groups = devm_kmalloc_array(&pdev->dev, - maxgroups, - sizeof(*ipctl->groups), - GFP_KERNEL); + ipctl->groups = devm_kmalloc_objs(&pdev->dev, *ipctl->groups, maxgroups); if (!ipctl->groups) return -ENOMEM; @@ -854,7 +848,7 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev) int ret; /* Create state holders etc for this driver */ - ipctl = devm_kzalloc(&pdev->dev, sizeof(*ipctl), GFP_KERNEL); + ipctl = devm_kzalloc_obj(&pdev->dev, *ipctl); if (!ipctl) return -ENOMEM; diff --git a/drivers/pinctrl/renesas/pinctrl-rzt2h.c b/drivers/pinctrl/renesas/pinctrl-rzt2h.c index 4872a208e0c3..a9bc543f0da0 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzt2h.c +++ b/drivers/pinctrl/renesas/pinctrl-rzt2h.c @@ -396,10 +396,10 @@ static int rzt2h_dt_subnode_to_map(struct pinctrl_dev *pctldev, goto done; } - pins = devm_kcalloc(pctrl->dev, num_pinmux, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(pctrl->dev, *pins, num_pinmux); psel_val = devm_kcalloc(pctrl->dev, num_pinmux, sizeof(*psel_val), GFP_KERNEL); - pin_fn = devm_kzalloc(pctrl->dev, sizeof(*pin_fn), GFP_KERNEL); + pin_fn = devm_kzalloc_obj(pctrl->dev, *pin_fn); if (!pins || !psel_val || !pin_fn) { ret = -ENOMEM; goto done; @@ -1209,7 +1209,7 @@ static int rzt2h_pinctrl_register(struct rzt2h_pinctrl *pctrl) desc->confops = &rzt2h_pinctrl_confops; desc->owner = THIS_MODULE; - pins = devm_kcalloc(dev, desc->npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, desc->npins); if (!pins) return -ENOMEM; @@ -1269,7 +1269,7 @@ static int rzt2h_pinctrl_probe(struct platform_device *pdev) struct rzt2h_pinctrl *pctrl; int ret; - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/renesas/pinctrl-rzv2m.c b/drivers/pinctrl/renesas/pinctrl-rzv2m.c index 9029d1947bbb..b550c9df0ba4 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzv2m.c +++ b/drivers/pinctrl/renesas/pinctrl-rzv2m.c @@ -292,10 +292,9 @@ static int rzv2m_dt_subnode_to_map(struct pinctrl_dev *pctldev, goto done; } - pins = devm_kcalloc(pctrl->dev, num_pinmux, sizeof(*pins), GFP_KERNEL); - psel_val = devm_kcalloc(pctrl->dev, num_pinmux, sizeof(*psel_val), - GFP_KERNEL); - pin_fn = devm_kzalloc(pctrl->dev, sizeof(*pin_fn), GFP_KERNEL); + pins = devm_kzalloc_objs(pctrl->dev, *pins, num_pinmux); + psel_val = devm_kzalloc_objs(pctrl->dev, *psel_val, num_pinmux); + pin_fn = devm_kzalloc_obj(pctrl->dev, *pin_fn); if (!pins || !psel_val || !pin_fn) { ret = -ENOMEM; goto done; @@ -996,12 +995,11 @@ static int rzv2m_pinctrl_register(struct rzv2m_pinctrl *pctrl) pctrl->desc.confops = &rzv2m_pinctrl_confops; pctrl->desc.owner = THIS_MODULE; - pins = devm_kcalloc(pctrl->dev, pctrl->desc.npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(pctrl->dev, *pins, pctrl->desc.npins); if (!pins) return -ENOMEM; - pin_data = devm_kcalloc(pctrl->dev, pctrl->desc.npins, - sizeof(*pin_data), GFP_KERNEL); + pin_data = devm_kzalloc_objs(pctrl->dev, *pin_data, pctrl->desc.npins); if (!pin_data) return -ENOMEM; @@ -1054,7 +1052,7 @@ static int rzv2m_pinctrl_probe(struct platform_device *pdev) struct clk *clk; int ret; - pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(&pdev->dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/renesas/pinctrl.c b/drivers/pinctrl/renesas/pinctrl.c index 8585ed4bcfe0..a1fc79162e84 100644 --- a/drivers/pinctrl/renesas/pinctrl.c +++ b/drivers/pinctrl/renesas/pinctrl.c @@ -780,15 +780,12 @@ static int sh_pfc_map_pins(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) unsigned int i; /* Allocate and initialize the pins and configs arrays. */ - pmx->pins = devm_kcalloc(pfc->dev, - pfc->info->nr_pins, sizeof(*pmx->pins), - GFP_KERNEL); + pmx->pins = devm_kzalloc_objs(pfc->dev, *pmx->pins, pfc->info->nr_pins); if (unlikely(!pmx->pins)) return -ENOMEM; - pmx->configs = devm_kcalloc(pfc->dev, - pfc->info->nr_pins, sizeof(*pmx->configs), - GFP_KERNEL); + pmx->configs = devm_kzalloc_objs(pfc->dev, *pmx->configs, + pfc->info->nr_pins); if (unlikely(!pmx->configs)) return -ENOMEM; @@ -809,7 +806,7 @@ int sh_pfc_register_pinctrl(struct sh_pfc *pfc) struct sh_pfc_pinctrl *pmx; int ret; - pmx = devm_kzalloc(pfc->dev, sizeof(*pmx), GFP_KERNEL); + pmx = devm_kzalloc_obj(pfc->dev, *pmx); if (unlikely(!pmx)) return -ENOMEM; diff --git a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c index d3d8672f74dc..94cbeefb82fd 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c @@ -72,7 +72,7 @@ s5pv210_retention_init(struct samsung_pinctrl_drv_data *drvdata, struct device_node *np; void __iomem *clk_base; - ctrl = devm_kzalloc(drvdata->dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(drvdata->dev, *ctrl); if (!ctrl) return ERR_PTR(-ENOMEM); diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c index 81fe0b08a9af..c45da9f13411 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c @@ -451,8 +451,8 @@ __init int exynos_eint_gpio_init(struct samsung_pinctrl_drv_data *d) goto err_domains; } - bank->soc_priv = devm_kzalloc(d->dev, - sizeof(struct exynos_eint_gpio_save), GFP_KERNEL); + bank->soc_priv = devm_kzalloc_obj(d->dev, + struct exynos_eint_gpio_save); if (!bank->soc_priv) { irq_domain_remove(bank->irq_domain); ret = -ENOMEM; @@ -817,9 +817,7 @@ __init int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) continue; } - weint_data = devm_kcalloc(dev, - bank->nr_pins, sizeof(*weint_data), - GFP_KERNEL); + weint_data = devm_kzalloc_objs(dev, *weint_data, bank->nr_pins); if (!weint_data) return -ENOMEM; @@ -1081,7 +1079,7 @@ exynos_retention_init(struct samsung_pinctrl_drv_data *drvdata, struct regmap *pmu_regs; int i; - ctrl = devm_kzalloc(drvdata->dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(drvdata->dev, *ctrl); if (!ctrl) return ERR_PTR(-ENOMEM); diff --git a/drivers/pinctrl/samsung/pinctrl-s3c64xx.c b/drivers/pinctrl/samsung/pinctrl-s3c64xx.c index 68715c09baa9..53c895f5d3c0 100644 --- a/drivers/pinctrl/samsung/pinctrl-s3c64xx.c +++ b/drivers/pinctrl/samsung/pinctrl-s3c64xx.c @@ -494,8 +494,7 @@ static int s3c64xx_eint_gpio_init(struct samsung_pinctrl_drv_data *d) ++nr_domains; } - data = devm_kzalloc(dev, struct_size(data, domains, nr_domains), - GFP_KERNEL); + data = devm_kzalloc_flex(dev, *data, domains, nr_domains); if (!data) return -ENOMEM; data->drvdata = d; @@ -713,7 +712,7 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d) if (!eint0_np) return -ENODEV; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) { of_node_put(eint0_np); return -ENOMEM; diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index 5ecc9ed4c44d..646d3990152f 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c @@ -747,8 +747,7 @@ static struct samsung_pin_group *samsung_pinctrl_create_groups( const struct pinctrl_pin_desc *pdesc; int i; - groups = devm_kcalloc(dev, ctrldesc->npins, sizeof(*groups), - GFP_KERNEL); + groups = devm_kzalloc_objs(dev, *groups, ctrldesc->npins); if (!groups) return ERR_PTR(-EINVAL); grp = groups; @@ -841,8 +840,7 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions( } } - functions = devm_kcalloc(dev, func_cnt, sizeof(*functions), - GFP_KERNEL); + functions = devm_kzalloc_objs(dev, *functions, func_cnt); if (!functions) return ERR_PTR(-ENOMEM); func = functions; @@ -931,9 +929,7 @@ static int samsung_pinctrl_register(struct platform_device *pdev, ctrldesc->pmxops = &samsung_pinmux_ops; ctrldesc->confops = &samsung_pinconf_ops; - pindesc = devm_kcalloc(&pdev->dev, - drvdata->nr_pins, sizeof(*pindesc), - GFP_KERNEL); + pindesc = devm_kzalloc_objs(&pdev->dev, *pindesc, drvdata->nr_pins); if (!pindesc) return -ENOMEM; ctrldesc->pins = pindesc; @@ -1200,8 +1196,7 @@ samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d, d->suspend = ctrl->suspend; d->resume = ctrl->resume; d->nr_banks = ctrl->nr_banks; - d->pin_banks = devm_kcalloc(&pdev->dev, d->nr_banks, - sizeof(*d->pin_banks), GFP_KERNEL); + d->pin_banks = devm_kzalloc_objs(&pdev->dev, *d->pin_banks, d->nr_banks); if (!d->pin_banks) return ERR_PTR(-ENOMEM); @@ -1265,7 +1260,7 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/pinctrl/sophgo/pinctrl-cv18xx.c b/drivers/pinctrl/sophgo/pinctrl-cv18xx.c index 36e3c4f9e90f..427d842ed643 100644 --- a/drivers/pinctrl/sophgo/pinctrl-cv18xx.c +++ b/drivers/pinctrl/sophgo/pinctrl-cv18xx.c @@ -412,8 +412,7 @@ static int cv1800_pinctrl_init(struct platform_device *pdev, const struct sophgo_pinctrl_data *pctrl_data = pctrl->data; struct cv1800_priv *priv; - priv = devm_kzalloc(&pdev->dev, struct_size(priv, power_cfg, pctrl_data->npds), - GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, power_cfg, pctrl_data->npds); if (!priv) return -ENOMEM; priv->num_power_cfg = pctrl_data->npds; diff --git a/drivers/pinctrl/sophgo/pinctrl-sg2042-ops.c b/drivers/pinctrl/sophgo/pinctrl-sg2042-ops.c index 0526aa3f8438..3e91e8d9dabf 100644 --- a/drivers/pinctrl/sophgo/pinctrl-sg2042-ops.c +++ b/drivers/pinctrl/sophgo/pinctrl-sg2042-ops.c @@ -274,7 +274,7 @@ static int sophgo_pinctrl_init(struct platform_device *pdev, { struct sg2042_priv *priv; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/pinctrl/sophgo/pinctrl-sophgo-common.c b/drivers/pinctrl/sophgo/pinctrl-sophgo-common.c index 4dfe16b66188..451c521f03ef 100644 --- a/drivers/pinctrl/sophgo/pinctrl-sophgo-common.c +++ b/drivers/pinctrl/sophgo/pinctrl-sophgo-common.c @@ -90,7 +90,7 @@ int sophgo_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node for_each_available_child_of_node(np, child) ngroups += 1; - grpnames = devm_kcalloc(dev, ngroups, sizeof(*grpnames), GFP_KERNEL); + grpnames = devm_kzalloc_objs(dev, *grpnames, ngroups); if (!grpnames) return -ENOMEM; @@ -123,13 +123,13 @@ int sophgo_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node grpnames[ngroups++] = grpname; - pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, npins); if (!pins) { ret = -ENOMEM; goto dt_failed; } - pinmuxs = devm_kcalloc(dev, npins, sizeof(*pinmuxs), GFP_KERNEL); + pinmuxs = devm_kzalloc_objs(dev, *pinmuxs, npins); if (!pinmuxs) { ret = -ENOMEM; goto dt_failed; @@ -414,7 +414,7 @@ int sophgo_pinctrl_probe(struct platform_device *pdev) if (pctrl_data->npins == 0) return dev_err_probe(dev, -EINVAL, "invalid pin data\n"); - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/spacemit/pinctrl-k1.c b/drivers/pinctrl/spacemit/pinctrl-k1.c index c3a7538783b8..d0706f77d120 100644 --- a/drivers/pinctrl/spacemit/pinctrl-k1.c +++ b/drivers/pinctrl/spacemit/pinctrl-k1.c @@ -776,7 +776,7 @@ static int spacemit_pinctrl_probe(struct platform_device *pdev) if (pctrl_data->npins == 0) return dev_err_probe(dev, -EINVAL, "invalid pin data\n"); - pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/spear/pinctrl-plgpio.c b/drivers/pinctrl/spear/pinctrl-plgpio.c index 5fcbea32089d..b5fc76e114be 100644 --- a/drivers/pinctrl/spear/pinctrl-plgpio.c +++ b/drivers/pinctrl/spear/pinctrl-plgpio.c @@ -532,7 +532,7 @@ static int plgpio_probe(struct platform_device *pdev) struct plgpio *plgpio; int ret, irq; - plgpio = devm_kzalloc(&pdev->dev, sizeof(*plgpio), GFP_KERNEL); + plgpio = devm_kzalloc_obj(&pdev->dev, *plgpio); if (!plgpio) return -ENOMEM; @@ -565,10 +565,8 @@ static int plgpio_probe(struct platform_device *pdev) dev_warn(&pdev->dev, "clk_get() failed, work without it\n"); #ifdef CONFIG_PM_SLEEP - plgpio->csave_regs = devm_kcalloc(&pdev->dev, - DIV_ROUND_UP(plgpio->chip.ngpio, MAX_GPIO_PER_REG), - sizeof(*plgpio->csave_regs), - GFP_KERNEL); + plgpio->csave_regs = devm_kzalloc_objs(&pdev->dev, *plgpio->csave_regs, + DIV_ROUND_UP(plgpio->chip.ngpio, MAX_GPIO_PER_REG)); if (!plgpio->csave_regs) return -ENOMEM; #endif @@ -603,9 +601,7 @@ static int plgpio_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(girq, &plgpio_irqchip); girq->parent_handler = plgpio_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); + girq->parents = devm_kzalloc_objs(&pdev->dev, *girq->parents, 1); if (!girq->parents) return -ENOMEM; girq->parents[0] = irq; diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c index f92f6efde1dc..b1c3080de75f 100644 --- a/drivers/pinctrl/spear/pinctrl-spear.c +++ b/drivers/pinctrl/spear/pinctrl-spear.c @@ -360,7 +360,7 @@ int spear_pinctrl_probe(struct platform_device *pdev, if (!machdata) return -ENODEV; - pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL); + pmx = devm_kzalloc_obj(&pdev->dev, *pmx); if (!pmx) return -ENOMEM; diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c index a565d4fd4233..fa7dab2edfd2 100644 --- a/drivers/pinctrl/sprd/pinctrl-sprd.c +++ b/drivers/pinctrl/sprd/pinctrl-sprd.c @@ -893,9 +893,7 @@ static int sprd_pinctrl_parse_groups(struct device_node *np, grp->name = np->name; grp->npins = ret; - grp->pins = devm_kcalloc(sprd_pctl->dev, - grp->npins, sizeof(unsigned int), - GFP_KERNEL); + grp->pins = devm_kzalloc_objs(sprd_pctl->dev, unsigned int, grp->npins); if (!grp->pins) return -ENOMEM; @@ -945,10 +943,8 @@ static int sprd_pinctrl_parse_dt(struct sprd_pinctrl *sprd_pctl) if (!info->ngroups) return 0; - info->groups = devm_kcalloc(sprd_pctl->dev, - info->ngroups, - sizeof(struct sprd_pin_group), - GFP_KERNEL); + info->groups = devm_kzalloc_objs(sprd_pctl->dev, struct sprd_pin_group, + info->ngroups); if (!info->groups) return -ENOMEM; @@ -995,9 +991,8 @@ static int sprd_pinctrl_add_pins(struct sprd_pinctrl *sprd_pctl, int i; info->npins = pins_cnt; - info->pins = devm_kcalloc(sprd_pctl->dev, - info->npins, sizeof(struct sprd_pin), - GFP_KERNEL); + info->pins = devm_kzalloc_objs(sprd_pctl->dev, struct sprd_pin, + info->npins); if (!info->pins) return -ENOMEM; @@ -1045,8 +1040,7 @@ int sprd_pinctrl_core_probe(struct platform_device *pdev, struct pinctrl_pin_desc *pin_desc; int ret, i; - sprd_pctl = devm_kzalloc(&pdev->dev, sizeof(struct sprd_pinctrl), - GFP_KERNEL); + sprd_pctl = devm_kzalloc_obj(&pdev->dev, struct sprd_pinctrl); if (!sprd_pctl) return -ENOMEM; @@ -1054,9 +1048,8 @@ int sprd_pinctrl_core_probe(struct platform_device *pdev, if (IS_ERR(sprd_pctl->base)) return PTR_ERR(sprd_pctl->base); - pinctrl_info = devm_kzalloc(&pdev->dev, - sizeof(struct sprd_pinctrl_soc_info), - GFP_KERNEL); + pinctrl_info = devm_kzalloc_obj(&pdev->dev, + struct sprd_pinctrl_soc_info); if (!pinctrl_info) return -ENOMEM; @@ -1076,10 +1069,8 @@ int sprd_pinctrl_core_probe(struct platform_device *pdev, return ret; } - pin_desc = devm_kcalloc(&pdev->dev, - pinctrl_info->npins, - sizeof(struct pinctrl_pin_desc), - GFP_KERNEL); + pin_desc = devm_kzalloc_objs(&pdev->dev, struct pinctrl_pin_desc, + pinctrl_info->npins); if (!pin_desc) return -ENOMEM; diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c index 37da176cad49..d89f6a47221b 100644 --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c @@ -512,7 +512,7 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, ngroups += 1; } - pgnames = devm_kcalloc(dev, ngroups, sizeof(*pgnames), GFP_KERNEL); + pgnames = devm_kzalloc_objs(dev, *pgnames, ngroups); if (!pgnames) return -ENOMEM; @@ -536,13 +536,13 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, pgnames[ngroups++] = grpname; if ((npins = of_property_count_u32_elems(child, "pinmux")) > 0) { - pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, npins); if (!pins) { ret = -ENOMEM; goto free_map; } - pinmux = devm_kcalloc(dev, npins, sizeof(*pinmux), GFP_KERNEL); + pinmux = devm_kzalloc_objs(dev, *pinmux, npins); if (!pinmux) { ret = -ENOMEM; goto free_map; @@ -563,7 +563,7 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, map[nmaps].data.mux.group = grpname; nmaps += 1; } else if ((npins = of_property_count_u32_elems(child, "pins")) > 0) { - pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, npins); if (!pins) { ret = -ENOMEM; goto free_map; @@ -1220,7 +1220,7 @@ static int starfive_probe(struct platform_device *pdev) u32 value; int ret; - sfp = devm_kzalloc(dev, sizeof(*sfp), GFP_KERNEL); + sfp = devm_kzalloc_obj(dev, *sfp); if (!sfp) return -ENOMEM; @@ -1310,8 +1310,8 @@ static int starfive_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(&sfp->gc.irq, &starfive_irq_chip); sfp->gc.irq.parent_handler = starfive_gpio_irq_handler; sfp->gc.irq.num_parents = 1; - sfp->gc.irq.parents = devm_kcalloc(dev, sfp->gc.irq.num_parents, - sizeof(*sfp->gc.irq.parents), GFP_KERNEL); + sfp->gc.irq.parents = devm_kzalloc_objs(dev, *sfp->gc.irq.parents, + sfp->gc.irq.num_parents); if (!sfp->gc.irq.parents) return -ENOMEM; sfp->gc.irq.default_type = IRQ_TYPE_NONE; diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c index 7fcb6cdc1e86..2713cd89b181 100644 --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c @@ -138,7 +138,7 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev, ngroups += 1; nmaps = 2 * ngroups; - pgnames = devm_kcalloc(dev, ngroups, sizeof(*pgnames), GFP_KERNEL); + pgnames = devm_kzalloc_objs(dev, *pgnames, ngroups); if (!pgnames) return -ENOMEM; @@ -171,13 +171,13 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev, pgnames[ngroups++] = grpname; - pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, npins); if (!pins) { ret = -ENOMEM; goto free_map; } - pinmux = devm_kcalloc(dev, npins, sizeof(*pinmux), GFP_KERNEL); + pinmux = devm_kzalloc_objs(dev, *pinmux, npins); if (!pinmux) { ret = -ENOMEM; goto free_map; @@ -858,8 +858,7 @@ int jh7110_pinctrl_probe(struct platform_device *pdev) } num_saved_regs = IS_ENABLED(CONFIG_PM_SLEEP) ? info->nsaved_regs : 0; - sfp = devm_kzalloc(dev, struct_size(sfp, saved_regs, num_saved_regs), - GFP_KERNEL); + sfp = devm_kzalloc_flex(dev, *sfp, saved_regs, num_saved_regs); if (!sfp) return -ENOMEM; sfp->num_saved_regs = num_saved_regs; @@ -895,9 +894,7 @@ int jh7110_pinctrl_probe(struct platform_device *pdev) return ret; } - jh7110_pinctrl_desc = devm_kzalloc(&pdev->dev, - sizeof(*jh7110_pinctrl_desc), - GFP_KERNEL); + jh7110_pinctrl_desc = devm_kzalloc_obj(&pdev->dev, *jh7110_pinctrl_desc); if (!jh7110_pinctrl_desc) return -ENOMEM; @@ -941,9 +938,8 @@ int jh7110_pinctrl_probe(struct platform_device *pdev) gpio_irq_chip_set_chip(&sfp->gc.irq, &jh7110_irq_chip); sfp->gc.irq.parent_handler = info->jh7110_gpio_irq_handler; sfp->gc.irq.num_parents = 1; - sfp->gc.irq.parents = devm_kcalloc(dev, sfp->gc.irq.num_parents, - sizeof(*sfp->gc.irq.parents), - GFP_KERNEL); + sfp->gc.irq.parents = devm_kzalloc_objs(dev, *sfp->gc.irq.parents, + sfp->gc.irq.num_parents); if (!sfp->gc.irq.parents) return -ENOMEM; sfp->gc.irq.default_type = IRQ_TYPE_NONE; diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jhb100.c b/drivers/pinctrl/starfive/pinctrl-starfive-jhb100.c index 462a26697b88..4147edd6fbad 100644 --- a/drivers/pinctrl/starfive/pinctrl-starfive-jhb100.c +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jhb100.c @@ -1245,7 +1245,7 @@ struct pinctrl_pin_desc *devm_create_pins_from_pld(struct device *dev, dev_dbg(dev, "Total pins to create: %d\n", npins); - pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, npins); if (!pins) return ERR_PTR(-ENOMEM); @@ -1327,7 +1327,7 @@ int jhb100_pinctrl_probe(struct platform_device *pdev) pinctrl_regs = info->regs; - sfp = devm_kzalloc(dev, sizeof(*sfp), GFP_KERNEL); + sfp = devm_kzalloc_obj(dev, *sfp); if (!sfp) return -ENOMEM; @@ -1361,9 +1361,7 @@ int jhb100_pinctrl_probe(struct platform_device *pdev) if (IS_ERR(sfp->pins)) return PTR_ERR(sfp->pins); - jhb100_pinctrl_desc = devm_kzalloc(&pdev->dev, - sizeof(*jhb100_pinctrl_desc), - GFP_KERNEL); + jhb100_pinctrl_desc = devm_kzalloc_obj(&pdev->dev, *jhb100_pinctrl_desc); if (!jhb100_pinctrl_desc) return -ENOMEM; diff --git a/drivers/pinctrl/stm32/pinctrl-stm32-hdp.c b/drivers/pinctrl/stm32/pinctrl-stm32-hdp.c index cce477e86ef9..2c193f0f26c1 100644 --- a/drivers/pinctrl/stm32/pinctrl-stm32-hdp.c +++ b/drivers/pinctrl/stm32/pinctrl-stm32-hdp.c @@ -613,7 +613,7 @@ static int stm32_hdp_probe(struct platform_device *pdev) u8 version; int err; - hdp = devm_kzalloc(dev, sizeof(*hdp), GFP_KERNEL); + hdp = devm_kzalloc_obj(dev, *hdp); if (!hdp) return -ENOMEM; hdp->dev = dev; diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c index 98cf9c6f4b59..405ebb22c9ea 100644 --- a/drivers/pinctrl/stm32/pinctrl-stm32.c +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c @@ -1804,14 +1804,14 @@ static int stm32_pctrl_build_state(struct platform_device *pdev) pctl->ngroups = pctl->npins; /* Allocate groups */ - pctl->groups = devm_kcalloc(&pdev->dev, pctl->ngroups, - sizeof(*pctl->groups), GFP_KERNEL); + pctl->groups = devm_kzalloc_objs(&pdev->dev, *pctl->groups, + pctl->ngroups); if (!pctl->groups) return -ENOMEM; /* We assume that one pin is one group, use pin name as group name. */ - pctl->grp_names = devm_kcalloc(&pdev->dev, pctl->ngroups, - sizeof(*pctl->grp_names), GFP_KERNEL); + pctl->grp_names = devm_kzalloc_objs(&pdev->dev, *pctl->grp_names, + pctl->ngroups); if (!pctl->grp_names) return -ENOMEM; @@ -1863,7 +1863,7 @@ int stm32_pctl_probe(struct platform_device *pdev) if (!match_data) return -EINVAL; - pctl = devm_kzalloc(dev, sizeof(*pctl), GFP_KERNEL); + pctl = devm_kzalloc_obj(dev, *pctl); if (!pctl) return -ENOMEM; @@ -1894,8 +1894,8 @@ int stm32_pctl_probe(struct platform_device *pdev) if (!device_property_read_u32(dev, "st,package", &pctl->pkg)) dev_dbg(pctl->dev, "package detected: %x\n", pctl->pkg); - pctl->pins = devm_kcalloc(pctl->dev, pctl->match_data->npins, - sizeof(*pctl->pins), GFP_KERNEL); + pctl->pins = devm_kzalloc_objs(pctl->dev, *pctl->pins, + pctl->match_data->npins); if (!pctl->pins) return -ENOMEM; @@ -1915,8 +1915,7 @@ int stm32_pctl_probe(struct platform_device *pdev) return ret; } - pins = devm_kcalloc(&pdev->dev, pctl->npins, sizeof(*pins), - GFP_KERNEL); + pins = devm_kzalloc_objs(&pdev->dev, *pins, pctl->npins); if (!pins) return -ENOMEM; @@ -1948,13 +1947,11 @@ int stm32_pctl_probe(struct platform_device *pdev) dev_err(dev, "at least one GPIO bank is required\n"); return -EINVAL; } - pctl->banks = devm_kcalloc(dev, banks, sizeof(*pctl->banks), - GFP_KERNEL); + pctl->banks = devm_kzalloc_objs(dev, *pctl->banks, banks); if (!pctl->banks) return -ENOMEM; - pctl->clks = devm_kcalloc(dev, banks, sizeof(*pctl->clks), - GFP_KERNEL); + pctl->clks = devm_kzalloc_objs(dev, *pctl->clks, banks); if (!pctl->clks) return -ENOMEM; diff --git a/drivers/pinctrl/sunplus/sppctl.c b/drivers/pinctrl/sunplus/sppctl.c index 8a3fb9b56597..68ff6d8451bb 100644 --- a/drivers/pinctrl/sunplus/sppctl.c +++ b/drivers/pinctrl/sunplus/sppctl.c @@ -540,7 +540,7 @@ static int sppctl_gpio_new(struct platform_device *pdev, struct sppctl_pdata *pc struct gpio_chip *gchip; int err; - spp_gchip = devm_kzalloc(&pdev->dev, sizeof(*spp_gchip), GFP_KERNEL); + spp_gchip = devm_kzalloc_obj(&pdev->dev, *spp_gchip); if (!spp_gchip) return -ENOMEM; pctl->spp_gchip = spp_gchip; @@ -1014,13 +1014,13 @@ static int sppctl_group_groups(struct platform_device *pdev) if (sppctl_list_funcs[i].type == pinmux_type_grp) sppctl->unq_grps_sz += sppctl_list_funcs[i].gnum; - sppctl->unq_grps = devm_kcalloc(&pdev->dev, sppctl->unq_grps_sz + 1, - sizeof(*sppctl->unq_grps), GFP_KERNEL); + sppctl->unq_grps = devm_kzalloc_objs(&pdev->dev, *sppctl->unq_grps, + sppctl->unq_grps_sz + 1); if (!sppctl->unq_grps) return -ENOMEM; - sppctl->g2fp_maps = devm_kcalloc(&pdev->dev, sppctl->unq_grps_sz + 1, - sizeof(*sppctl->g2fp_maps), GFP_KERNEL); + sppctl->g2fp_maps = devm_kzalloc_objs(&pdev->dev, *sppctl->g2fp_maps, + sppctl->unq_grps_sz + 1); if (!sppctl->g2fp_maps) return -ENOMEM; @@ -1100,7 +1100,7 @@ static int sppctl_probe(struct platform_device *pdev) struct sppctl_pdata *sppctl; int ret; - sppctl = devm_kzalloc(&pdev->dev, sizeof(*sppctl), GFP_KERNEL); + sppctl = devm_kzalloc_obj(&pdev->dev, *sppctl); if (!sppctl) return -ENOMEM; platform_set_drvdata(pdev, sppctl); diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c b/drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c index 8bcd566593ae..aeaf5534cf80 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c @@ -104,7 +104,7 @@ static struct sunxi_desc_pin *init_pins_table(struct device *dev, return ERR_PTR(-EINVAL); } - pins = devm_kcalloc(dev, desc->npins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, desc->npins); if (!pins) return ERR_PTR(-ENOMEM); @@ -200,7 +200,7 @@ static int prepare_function_table(struct device *dev, struct device_node *pnode, * Allocate the memory needed for the functions in one table. * We later use pointers into this table to mark each pin. */ - func = devm_kcalloc(dev, num_funcs, sizeof(*func), GFP_KERNEL); + func = devm_kzalloc_objs(dev, *func, num_funcs); if (!func) return -ENOMEM; diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index 4ce775348ff6..bf4ec4665e2b 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -1402,9 +1402,8 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev) * this means that the number of pins is the maximum group * number we will ever see. */ - pctl->groups = devm_kcalloc(&pdev->dev, - pctl->desc->npins, sizeof(*pctl->groups), - GFP_KERNEL); + pctl->groups = devm_kzalloc_objs(&pdev->dev, *pctl->groups, + pctl->desc->npins); if (!pctl->groups) return -ENOMEM; @@ -1488,10 +1487,9 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev) if (!func_item->groups) { func_item->groups = - devm_kcalloc(&pdev->dev, - func_item->ngroups, - sizeof(*func_item->groups), - GFP_KERNEL); + devm_kzalloc_objs(&pdev->dev, + *func_item->groups, + func_item->ngroups); if (!func_item->groups) { kfree(pctl->functions); return -ENOMEM; @@ -1605,7 +1603,7 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev, int i, ret, last_pin, pin_idx, nbanks; struct clk *clk; - pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); + pctl = devm_kzalloc_obj(&pdev->dev, *pctl); if (!pctl) return -ENOMEM; platform_set_drvdata(pdev, pctl); @@ -1643,10 +1641,8 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev, else pctl->pow_mod_sel_offset = PIO_POW_MOD_SEL_REG; - pctl->irq_array = devm_kcalloc(&pdev->dev, - IRQ_PER_BANK * pctl->desc->irq_banks, - sizeof(*pctl->irq_array), - GFP_KERNEL); + pctl->irq_array = devm_kzalloc_objs(&pdev->dev, *pctl->irq_array, + IRQ_PER_BANK * pctl->desc->irq_banks); if (!pctl->irq_array) return -ENOMEM; @@ -1669,8 +1665,8 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev, last_pin = pctl->desc->pins[pctl->desc->npins - 1].pin.number; nbanks = DIV_ROUND_UP(last_pin + 1 - pctl->desc->pin_base, PINS_PER_BANK); - pctl->dat_shadow = devm_kcalloc(&pdev->dev, nbanks, - sizeof(*pctl->dat_shadow), GFP_KERNEL); + pctl->dat_shadow = devm_kzalloc_objs(&pdev->dev, *pctl->dat_shadow, + nbanks); if (!pctl->dat_shadow) return -ENOMEM; @@ -1687,9 +1683,7 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev, return ret; } - pins = devm_kcalloc(&pdev->dev, - pctl->desc->npins, sizeof(*pins), - GFP_KERNEL); + pins = devm_kzalloc_objs(&pdev->dev, *pins, pctl->desc->npins); if (!pins) return -ENOMEM; @@ -1703,9 +1697,7 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev, pins[pin_idx++] = pin->pin; } - pctrl_desc = devm_kzalloc(&pdev->dev, - sizeof(*pctrl_desc), - GFP_KERNEL); + pctrl_desc = devm_kzalloc_obj(&pdev->dev, *pctrl_desc); if (!pctrl_desc) return -ENOMEM; @@ -1732,7 +1724,7 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev, return PTR_ERR(pctl->pctl_dev); } - pctl->chip = devm_kzalloc(&pdev->dev, sizeof(*pctl->chip), GFP_KERNEL); + pctl->chip = devm_kzalloc_obj(&pdev->dev, *pctl->chip); if (!pctl->chip) return -ENOMEM; @@ -1769,10 +1761,8 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev, goto gpiochip_error; } - pctl->irq = devm_kcalloc(&pdev->dev, - pctl->desc->irq_banks, - sizeof(*pctl->irq), - GFP_KERNEL); + pctl->irq = devm_kzalloc_objs(&pdev->dev, *pctl->irq, + pctl->desc->irq_banks); if (!pctl->irq) { ret = -ENOMEM; goto gpiochip_error; diff --git a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c index fb70f8aee56b..be6baf411bb9 100644 --- a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c +++ b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c @@ -876,7 +876,7 @@ int tegra_xusb_padctl_legacy_probe(struct platform_device *pdev) struct phy *phy; int err; - padctl = devm_kzalloc(&pdev->dev, sizeof(*padctl), GFP_KERNEL); + padctl = devm_kzalloc_obj(&pdev->dev, *padctl); if (!padctl) return -ENOMEM; diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c index 3f58f7db525f..51684c5dda34 100644 --- a/drivers/pinctrl/tegra/pinctrl-tegra.c +++ b/drivers/pinctrl/tegra/pinctrl-tegra.c @@ -833,8 +833,8 @@ int tegra_pinctrl_probe(struct platform_device *pdev, int fn, gn, gfn; unsigned long backup_regs_size = 0; - pmx = devm_kzalloc(&pdev->dev, - struct_size(pmx, pingroup_configs, soc_data->ngroups), GFP_KERNEL); + pmx = devm_kzalloc_flex(&pdev->dev, *pmx, pingroup_configs, + soc_data->ngroups); if (!pmx) return -ENOMEM; @@ -846,13 +846,13 @@ int tegra_pinctrl_probe(struct platform_device *pdev, * Each mux group will appear in 4 functions' list of groups. * This over-allocates slightly, since not all groups are mux groups. */ - pmx->group_pins = devm_kcalloc(&pdev->dev, pmx->soc->ngroups * 4, - sizeof(*pmx->group_pins), GFP_KERNEL); + pmx->group_pins = devm_kzalloc_objs(&pdev->dev, *pmx->group_pins, + pmx->soc->ngroups * 4); if (!pmx->group_pins) return -ENOMEM; - pmx->functions = devm_kcalloc(&pdev->dev, pmx->soc->nfunctions, - sizeof(*pmx->functions), GFP_KERNEL); + pmx->functions = devm_kzalloc_objs(&pdev->dev, *pmx->functions, + pmx->soc->nfunctions); if (!pmx->functions) return -ENOMEM; @@ -904,8 +904,7 @@ int tegra_pinctrl_probe(struct platform_device *pdev, } pmx->nbanks = i; - pmx->regs = devm_kcalloc(&pdev->dev, pmx->nbanks, sizeof(*pmx->regs), - GFP_KERNEL); + pmx->regs = devm_kzalloc_objs(&pdev->dev, *pmx->regs, pmx->nbanks); if (!pmx->regs) return -ENOMEM; diff --git a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c index 019b302db2b0..28c893bcad2b 100644 --- a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c +++ b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c @@ -508,24 +508,24 @@ static int ti_iodelay_dt_node_to_map(struct pinctrl_dev *pctldev, if (rows < 0) return rows; - *map = devm_kzalloc(iod->dev, sizeof(**map), GFP_KERNEL); + *map = devm_kzalloc_obj(iod->dev, **map); if (!*map) return -ENOMEM; *num_maps = 0; - g = devm_kzalloc(iod->dev, sizeof(*g), GFP_KERNEL); + g = devm_kzalloc_obj(iod->dev, *g); if (!g) { error = -ENOMEM; goto free_map; } - pins = devm_kcalloc(iod->dev, rows, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(iod->dev, *pins, rows); if (!pins) { error = -ENOMEM; goto free_group; } - cfg = devm_kcalloc(iod->dev, rows, sizeof(*cfg), GFP_KERNEL); + cfg = devm_kzalloc_objs(iod->dev, *cfg, rows); if (!cfg) { error = -ENOMEM; goto free_pins; @@ -759,7 +759,7 @@ static int ti_iodelay_alloc_pins(struct device *dev, nr_pins = ti_iodelay_offset_to_pin(iod, r->regmap_config->max_register); dev_dbg(dev, "Allocating %i pins\n", nr_pins); - iod->pa = devm_kcalloc(dev, nr_pins, sizeof(*iod->pa), GFP_KERNEL); + iod->pa = devm_kzalloc_objs(dev, *iod->pa, nr_pins); if (!iod->pa) return -ENOMEM; @@ -838,7 +838,7 @@ static int ti_iodelay_probe(struct platform_device *pdev) return -EINVAL; } - iod = devm_kzalloc(dev, sizeof(*iod), GFP_KERNEL); + iod = devm_kzalloc_obj(dev, *iod); if (!iod) return -ENOMEM; diff --git a/drivers/pinctrl/ultrarisc/pinctrl-ultrarisc.c b/drivers/pinctrl/ultrarisc/pinctrl-ultrarisc.c index 8fb5b0ea5b93..1d09c3ca1e7d 100644 --- a/drivers/pinctrl/ultrarisc/pinctrl-ultrarisc.c +++ b/drivers/pinctrl/ultrarisc/pinctrl-ultrarisc.c @@ -479,11 +479,11 @@ int ur_pinctrl_probe(struct platform_device *pdev, if (!data) return -ENODEV; - desc = devm_kzalloc(&pdev->dev, sizeof(*desc), GFP_KERNEL); + desc = devm_kzalloc_obj(&pdev->dev, *desc); if (!desc) return -ENOMEM; - pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); + pctrl = devm_kzalloc_obj(&pdev->dev, *pctrl); if (!pctrl) return -ENOMEM; diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c index fbd0fcdb42c8..79920a18ae1d 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c @@ -751,8 +751,7 @@ static int uniphier_pinctrl_add_reg_region(struct device *dev, nregs = DIV_ROUND_UP(count * width, 32); - region = devm_kzalloc(dev, struct_size(region, vals, nregs), - GFP_KERNEL); + region = devm_kzalloc_flex(dev, *region, vals, nregs); if (!region) return -ENOMEM; @@ -876,7 +875,7 @@ int uniphier_pinctrl_probe(struct platform_device *pdev, return -EINVAL; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/pinctrl/visconti/pinctrl-common.c b/drivers/pinctrl/visconti/pinctrl-common.c index 21c7e0d18fea..b137af1f3b01 100644 --- a/drivers/pinctrl/visconti/pinctrl-common.c +++ b/drivers/pinctrl/visconti/pinctrl-common.c @@ -284,7 +284,7 @@ int visconti_pinctrl_probe(struct platform_device *pdev, struct pinctrl_pin_desc *pins; int i, ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -298,8 +298,7 @@ int visconti_pinctrl_probe(struct platform_device *pdev, return PTR_ERR(priv->base); } - pins = devm_kcalloc(dev, devdata->nr_pins, - sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, devdata->nr_pins); if (!pins) return -ENOMEM; diff --git a/drivers/pinctrl/vt8500/pinctrl-vt8500.c b/drivers/pinctrl/vt8500/pinctrl-vt8500.c index 1cb5a75480c9..14b02c59d5bd 100644 --- a/drivers/pinctrl/vt8500/pinctrl-vt8500.c +++ b/drivers/pinctrl/vt8500/pinctrl-vt8500.c @@ -449,7 +449,7 @@ static int vt8500_pinctrl_probe(struct platform_device *pdev) { struct wmt_pinctrl_data *data; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/pinctrl/vt8500/pinctrl-wm8505.c b/drivers/pinctrl/vt8500/pinctrl-wm8505.c index 1584a198478d..e56fd690edb6 100644 --- a/drivers/pinctrl/vt8500/pinctrl-wm8505.c +++ b/drivers/pinctrl/vt8500/pinctrl-wm8505.c @@ -480,7 +480,7 @@ static int wm8505_pinctrl_probe(struct platform_device *pdev) { struct wmt_pinctrl_data *data; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/pinctrl/vt8500/pinctrl-wm8650.c b/drivers/pinctrl/vt8500/pinctrl-wm8650.c index 097fa43d69fb..37d159e95fb6 100644 --- a/drivers/pinctrl/vt8500/pinctrl-wm8650.c +++ b/drivers/pinctrl/vt8500/pinctrl-wm8650.c @@ -318,7 +318,7 @@ static int wm8650_pinctrl_probe(struct platform_device *pdev) { struct wmt_pinctrl_data *data; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/pinctrl/vt8500/pinctrl-wm8750.c b/drivers/pinctrl/vt8500/pinctrl-wm8750.c index 94d333b9aed3..8b129bf5eb18 100644 --- a/drivers/pinctrl/vt8500/pinctrl-wm8750.c +++ b/drivers/pinctrl/vt8500/pinctrl-wm8750.c @@ -357,7 +357,7 @@ static int wm8750_pinctrl_probe(struct platform_device *pdev) { struct wmt_pinctrl_data *data; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/pinctrl/vt8500/pinctrl-wm8850.c b/drivers/pinctrl/vt8500/pinctrl-wm8850.c index 869e5addb769..0ef3080eb18f 100644 --- a/drivers/pinctrl/vt8500/pinctrl-wm8850.c +++ b/drivers/pinctrl/vt8500/pinctrl-wm8850.c @@ -336,7 +336,7 @@ static int wm8850_pinctrl_probe(struct platform_device *pdev) { struct wmt_pinctrl_data *data; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/arm64/asus-glymur-ec.c b/drivers/platform/arm64/asus-glymur-ec.c index d75923fac9c4..b741afb18974 100644 --- a/drivers/platform/arm64/asus-glymur-ec.c +++ b/drivers/platform/arm64/asus-glymur-ec.c @@ -510,7 +510,7 @@ static int asus_glymur_ec_probe(struct i2c_client *client) struct asus_ec *ec; int ret; - ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL); + ec = devm_kzalloc_obj(dev, *ec); if (!ec) return -ENOMEM; diff --git a/drivers/platform/arm64/huawei-gaokun-ec.c b/drivers/platform/arm64/huawei-gaokun-ec.c index d4ce8ad6426c..ac21f732d041 100644 --- a/drivers/platform/arm64/huawei-gaokun-ec.c +++ b/drivers/platform/arm64/huawei-gaokun-ec.c @@ -746,7 +746,7 @@ static int gaokun_ec_probe(struct i2c_client *client) struct gaokun_ec *ec; int ret; - ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL); + ec = devm_kzalloc_obj(dev, *ec); if (!ec) return -ENOMEM; diff --git a/drivers/platform/arm64/lenovo-thinkpad-t14s.c b/drivers/platform/arm64/lenovo-thinkpad-t14s.c index 7a875877c8f3..873747838a4f 100644 --- a/drivers/platform/arm64/lenovo-thinkpad-t14s.c +++ b/drivers/platform/arm64/lenovo-thinkpad-t14s.c @@ -567,7 +567,7 @@ static int t14s_ec_probe(struct i2c_client *client) struct t14s_ec *ec; int ret; - ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL); + ec = devm_kzalloc_obj(dev, *ec); if (!ec) return -ENOMEM; diff --git a/drivers/platform/arm64/lenovo-yoga-c630.c b/drivers/platform/arm64/lenovo-yoga-c630.c index cad40c58c55b..5702e19dbbd4 100644 --- a/drivers/platform/arm64/lenovo-yoga-c630.c +++ b/drivers/platform/arm64/lenovo-yoga-c630.c @@ -209,7 +209,7 @@ static int yoga_c630_ec_probe(struct i2c_client *client) struct yoga_c630_ec *ec; int ret; - ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL); + ec = devm_kzalloc_obj(dev, *ec); if (!ec) return -ENOMEM; diff --git a/drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c b/drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c index 257d64eb0e56..36dcbff58755 100644 --- a/drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c +++ b/drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c @@ -410,7 +410,7 @@ static int slim7x11_ec_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) return dev_err_probe(dev, -ENODEV, "adapter lacks SMBus block transfers\n"); - ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL); + ec = devm_kzalloc_obj(dev, *ec); if (!ec) return -ENOMEM; diff --git a/drivers/platform/arm64/qcom-hamoa-ec.c b/drivers/platform/arm64/qcom-hamoa-ec.c index d34afd901324..dd35fa39188b 100644 --- a/drivers/platform/arm64/qcom-hamoa-ec.c +++ b/drivers/platform/arm64/qcom-hamoa-ec.c @@ -362,7 +362,7 @@ static int qcom_ec_probe(struct i2c_client *client) unsigned int i; int ret; - ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL); + ec = devm_kzalloc_obj(dev, *ec); if (!ec) return -ENOMEM; @@ -392,7 +392,8 @@ static int qcom_ec_probe(struct i2c_client *client) return 0; } - ec->ec_cdev = devm_kcalloc(dev, ec->thermal_cap.fan_cnt, sizeof(*ec->ec_cdev), GFP_KERNEL); + ec->ec_cdev = devm_kzalloc_objs(dev, *ec->ec_cdev, + ec->thermal_cap.fan_cnt); if (!ec->ec_cdev) return -ENOMEM; diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index 5d0f5a9187b1..81631b363402 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -43,7 +43,7 @@ struct cros_ec_device *cros_ec_device_alloc(struct device *dev) { struct cros_ec_device *ec_dev; - ec_dev = devm_kzalloc(dev, sizeof(*ec_dev), GFP_KERNEL); + ec_dev = devm_kzalloc_obj(dev, *ec_dev); if (!ec_dev) return NULL; diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c index c3e40ad7e03c..97a6c96aba13 100644 --- a/drivers/platform/chrome/cros_ec_debugfs.c +++ b/drivers/platform/chrome/cros_ec_debugfs.c @@ -480,7 +480,7 @@ static int cros_ec_debugfs_probe(struct platform_device *pd) struct cros_ec_debugfs *debug_info; int ret; - debug_info = devm_kzalloc(ec->dev, sizeof(*debug_info), GFP_KERNEL); + debug_info = devm_kzalloc_obj(ec->dev, *debug_info); if (!debug_info) return -ENOMEM; diff --git a/drivers/platform/chrome/cros_ec_ishtp.c b/drivers/platform/chrome/cros_ec_ishtp.c index b21a27ad3762..3ab3ac22e69d 100644 --- a/drivers/platform/chrome/cros_ec_ishtp.c +++ b/drivers/platform/chrome/cros_ec_ishtp.c @@ -600,9 +600,8 @@ static int cros_ec_ishtp_probe(struct ishtp_cl_device *cl_device) { int rv; struct ishtp_cl *cros_ish_cl; - struct ishtp_cl_data *client_data = - devm_kzalloc(ishtp_device(cl_device), - sizeof(*client_data), GFP_KERNEL); + struct ishtp_cl_data *client_data = devm_kzalloc_obj(ishtp_device(cl_device), + *client_data); if (!client_data) return -ENOMEM; diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c index 78cfff80cdea..1e683e90a9df 100644 --- a/drivers/platform/chrome/cros_ec_lpc.c +++ b/drivers/platform/chrome/cros_ec_lpc.c @@ -520,7 +520,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev) int irq, ret; u32 quirks; - ec_lpc = devm_kzalloc(dev, sizeof(*ec_lpc), GFP_KERNEL); + ec_lpc = devm_kzalloc_obj(dev, *ec_lpc); if (!ec_lpc) return -ENOMEM; diff --git a/drivers/platform/chrome/cros_ec_rpmsg.c b/drivers/platform/chrome/cros_ec_rpmsg.c index 7390c2c91ea5..cb6bdff55c10 100644 --- a/drivers/platform/chrome/cros_ec_rpmsg.c +++ b/drivers/platform/chrome/cros_ec_rpmsg.c @@ -220,7 +220,7 @@ static int cros_ec_rpmsg_probe(struct rpmsg_device *rpdev) if (!ec_dev) return -ENOMEM; - ec_rpmsg = devm_kzalloc(dev, sizeof(*ec_rpmsg), GFP_KERNEL); + ec_rpmsg = devm_kzalloc_obj(dev, *ec_rpmsg); if (!ec_rpmsg) return -ENOMEM; diff --git a/drivers/platform/chrome/cros_ec_sensorhub.c b/drivers/platform/chrome/cros_ec_sensorhub.c index a8395ab0a12a..d1b0e0cbc418 100644 --- a/drivers/platform/chrome/cros_ec_sensorhub.c +++ b/drivers/platform/chrome/cros_ec_sensorhub.c @@ -156,7 +156,7 @@ static int cros_ec_sensorhub_probe(struct platform_device *pdev) msg->command = EC_CMD_MOTION_SENSE_CMD + ec->cmd_offset; - data = devm_kzalloc(dev, sizeof(struct cros_ec_sensorhub), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct cros_ec_sensorhub); if (!data) return -ENOMEM; diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/platform/chrome/cros_ec_sensorhub_ring.c index d92b60213720..448f11ba5e62 100644 --- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c +++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c @@ -1022,10 +1022,9 @@ int cros_ec_sensorhub_ring_allocate(struct cros_ec_sensorhub *sensorhub) * Allocate the callback area based on the number of sensors. * Add one for the sensor ring. */ - sensorhub->push_data = devm_kcalloc(sensorhub->dev, - sensorhub->sensor_num, - sizeof(*sensorhub->push_data), - GFP_KERNEL); + sensorhub->push_data = devm_kzalloc_objs(sensorhub->dev, + *sensorhub->push_data, + sensorhub->sensor_num); if (!sensorhub->push_data) return -ENOMEM; @@ -1034,10 +1033,9 @@ int cros_ec_sensorhub_ring_allocate(struct cros_ec_sensorhub *sensorhub) EC_FEATURE_MOTION_SENSE_TIGHT_TIMESTAMPS); if (sensorhub->tight_timestamps) { - sensorhub->batch_state = devm_kcalloc(sensorhub->dev, - sensorhub->sensor_num, - sizeof(*sensorhub->batch_state), - GFP_KERNEL); + sensorhub->batch_state = devm_kzalloc_objs(sensorhub->dev, + *sensorhub->batch_state, + sensorhub->sensor_num); if (!sensorhub->batch_state) return -ENOMEM; } @@ -1076,8 +1074,8 @@ int cros_ec_sensorhub_ring_add(struct cros_ec_sensorhub *sensorhub) * timestamps properly. */ sensorhub->fifo_size = sensorhub->resp->fifo_info.size; - sensorhub->ring = devm_kcalloc(sensorhub->dev, sensorhub->fifo_size, - sizeof(*sensorhub->ring), GFP_KERNEL); + sensorhub->ring = devm_kzalloc_objs(sensorhub->dev, *sensorhub->ring, + sensorhub->fifo_size); if (!sensorhub->ring) return -ENOMEM; diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c index 28fa82f8cb07..a9c82b79297a 100644 --- a/drivers/platform/chrome/cros_ec_spi.c +++ b/drivers/platform/chrome/cros_ec_spi.c @@ -745,7 +745,7 @@ static int cros_ec_spi_probe(struct spi_device *spi) if (err < 0) return err; - ec_spi = devm_kzalloc(dev, sizeof(*ec_spi), GFP_KERNEL); + ec_spi = devm_kzalloc_obj(dev, *ec_spi); if (ec_spi == NULL) return -ENOMEM; ec_spi->spi = spi; diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 5871fe031f14..df502db6330c 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -512,7 +512,7 @@ static int cros_typec_init_ports(struct cros_typec_data *typec) dev_dbg(dev, "Registering port %d\n", port_num); - cros_port = devm_kzalloc(dev, sizeof(*cros_port), GFP_KERNEL); + cros_port = devm_kzalloc_obj(dev, *cros_port); if (!cros_port) { ret = -ENOMEM; goto unregister_ports; @@ -958,7 +958,7 @@ static int cros_typec_register_altmodes(struct cros_typec_data *typec, int port_ } /* If no memory is available we should unregister and exit. */ - node = devm_kzalloc(typec->dev, sizeof(*node), GFP_KERNEL); + node = devm_kzalloc_obj(typec->dev, *node); if (!node) { ret = -ENOMEM; typec_unregister_altmode(amode); @@ -1400,7 +1400,7 @@ static int cros_typec_probe(struct platform_device *pdev) struct ec_response_usb_pd_ports resp; int ret, i; - typec = devm_kzalloc(dev, sizeof(*typec), GFP_KERNEL); + typec = devm_kzalloc_obj(dev, *typec); if (!typec) return -ENOMEM; diff --git a/drivers/platform/chrome/cros_ec_uart.c b/drivers/platform/chrome/cros_ec_uart.c index d5b37414ff12..2c6c6b7a72df 100644 --- a/drivers/platform/chrome/cros_ec_uart.c +++ b/drivers/platform/chrome/cros_ec_uart.c @@ -255,7 +255,7 @@ static int cros_ec_uart_probe(struct serdev_device *serdev) struct cros_ec_uart *ec_uart; int ret; - ec_uart = devm_kzalloc(dev, sizeof(*ec_uart), GFP_KERNEL); + ec_uart = devm_kzalloc_obj(dev, *ec_uart); if (!ec_uart) return -ENOMEM; diff --git a/drivers/platform/chrome/cros_hps_i2c.c b/drivers/platform/chrome/cros_hps_i2c.c index 3b9485627831..c320489bfe1a 100644 --- a/drivers/platform/chrome/cros_hps_i2c.c +++ b/drivers/platform/chrome/cros_hps_i2c.c @@ -62,7 +62,7 @@ static int hps_i2c_probe(struct i2c_client *client) struct hps_drvdata *hps; int ret; - hps = devm_kzalloc(&client->dev, sizeof(*hps), GFP_KERNEL); + hps = devm_kzalloc_obj(&client->dev, *hps); if (!hps) return -ENOMEM; diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/platform/chrome/cros_kbd_led_backlight.c index 94888db1c00e..8f992a8f79d0 100644 --- a/drivers/platform/chrome/cros_kbd_led_backlight.c +++ b/drivers/platform/chrome/cros_kbd_led_backlight.c @@ -188,7 +188,7 @@ static int keyboard_led_probe(struct platform_device *pdev) if (!drvdata) return -EINVAL; - keyboard_led = devm_kzalloc(&pdev->dev, sizeof(*keyboard_led), GFP_KERNEL); + keyboard_led = devm_kzalloc_obj(&pdev->dev, *keyboard_led); if (!keyboard_led) return -ENOMEM; diff --git a/drivers/platform/chrome/cros_typec_altmode.c b/drivers/platform/chrome/cros_typec_altmode.c index 66c546bf89b5..0d06fb2a7d0b 100644 --- a/drivers/platform/chrome/cros_typec_altmode.c +++ b/drivers/platform/chrome/cros_typec_altmode.c @@ -318,7 +318,7 @@ cros_typec_register_displayport(struct cros_typec_port *port, if (IS_ERR(alt)) return alt; - dp_data = devm_kzalloc(&alt->dev, sizeof(*dp_data), GFP_KERNEL); + dp_data = devm_kzalloc_obj(&alt->dev, *dp_data); if (!dp_data) { typec_unregister_altmode(alt); return ERR_PTR(-ENOMEM); @@ -352,7 +352,7 @@ cros_typec_register_thunderbolt(struct cros_typec_port *port, if (IS_ERR(alt)) return alt; - adata = devm_kzalloc(&alt->dev, sizeof(*adata), GFP_KERNEL); + adata = devm_kzalloc_obj(&alt->dev, *adata); if (!adata) { typec_unregister_altmode(alt); return ERR_PTR(-ENOMEM); diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index fe0eddd2cf45..81e2857ab452 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -221,7 +221,7 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata) } device_for_each_child_node(dev, fwnode) { - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) { ret = -ENOMEM; goto err_switch; @@ -276,7 +276,7 @@ static int cros_typec_switch_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct cros_typec_switch_data *sdata; - sdata = devm_kzalloc(dev, sizeof(*sdata), GFP_KERNEL); + sdata = devm_kzalloc_obj(dev, *sdata); if (!sdata) return -ENOMEM; diff --git a/drivers/platform/chrome/cros_usbpd_logger.c b/drivers/platform/chrome/cros_usbpd_logger.c index 0eb714d679c8..cd9d16439da8 100644 --- a/drivers/platform/chrome/cros_usbpd_logger.c +++ b/drivers/platform/chrome/cros_usbpd_logger.c @@ -201,7 +201,7 @@ static int cros_usbpd_logger_probe(struct platform_device *pd) struct logger_data *logger; int ret; - logger = devm_kzalloc(dev, sizeof(*logger), GFP_KERNEL); + logger = devm_kzalloc_obj(dev, *logger); if (!logger) return -ENOMEM; diff --git a/drivers/platform/chrome/cros_usbpd_notify.c b/drivers/platform/chrome/cros_usbpd_notify.c index 25da31ec1996..61abe3e42f4d 100644 --- a/drivers/platform/chrome/cros_usbpd_notify.c +++ b/drivers/platform/chrome/cros_usbpd_notify.c @@ -106,7 +106,7 @@ static int cros_usbpd_notify_probe_acpi(struct platform_device *pdev) adev = ACPI_COMPANION(dev); - pdnotify = devm_kzalloc(dev, sizeof(*pdnotify), GFP_KERNEL); + pdnotify = devm_kzalloc_obj(dev, *pdnotify); if (!pdnotify) return -ENOMEM; @@ -203,7 +203,7 @@ static int cros_usbpd_notify_probe_plat(struct platform_device *pdev) struct cros_usbpd_notify_data *pdnotify; int ret; - pdnotify = devm_kzalloc(dev, sizeof(*pdnotify), GFP_KERNEL); + pdnotify = devm_kzalloc_obj(dev, *pdnotify); if (!pdnotify) return -ENOMEM; diff --git a/drivers/platform/chrome/wilco_ec/core.c b/drivers/platform/chrome/wilco_ec/core.c index 9d4521889d40..8f3fc3876735 100644 --- a/drivers/platform/chrome/wilco_ec/core.c +++ b/drivers/platform/chrome/wilco_ec/core.c @@ -40,7 +40,7 @@ static int wilco_ec_probe(struct platform_device *pdev) struct wilco_ec_device *ec; int ret; - ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL); + ec = devm_kzalloc_obj(dev, *ec); if (!ec) return -ENOMEM; diff --git a/drivers/platform/chrome/wilco_ec/debugfs.c b/drivers/platform/chrome/wilco_ec/debugfs.c index 32fb11939b9b..e52dee9360a6 100644 --- a/drivers/platform/chrome/wilco_ec/debugfs.c +++ b/drivers/platform/chrome/wilco_ec/debugfs.c @@ -245,7 +245,7 @@ static int wilco_ec_debugfs_probe(struct platform_device *pdev) { struct wilco_ec_device *ec = dev_get_drvdata(pdev->dev.parent); - debug_info = devm_kzalloc(&pdev->dev, sizeof(*debug_info), GFP_KERNEL); + debug_info = devm_kzalloc_obj(&pdev->dev, *debug_info); if (!debug_info) return 0; debug_info->ec = ec; diff --git a/drivers/platform/chrome/wilco_ec/keyboard_leds.c b/drivers/platform/chrome/wilco_ec/keyboard_leds.c index 6ce9c6782065..dabebf6bcfa3 100644 --- a/drivers/platform/chrome/wilco_ec/keyboard_leds.c +++ b/drivers/platform/chrome/wilco_ec/keyboard_leds.c @@ -185,7 +185,7 @@ int wilco_keyboard_leds_init(struct wilco_ec_device *ec) if (!leds_exist) return 0; - wkl = devm_kzalloc(ec->dev, sizeof(*wkl), GFP_KERNEL); + wkl = devm_kzalloc_obj(ec->dev, *wkl); if (!wkl) return -ENOMEM; diff --git a/drivers/platform/cznic/turris-omnia-mcu-base.c b/drivers/platform/cznic/turris-omnia-mcu-base.c index f0416302a1f3..60d8690f923d 100644 --- a/drivers/platform/cznic/turris-omnia-mcu-base.c +++ b/drivers/platform/cznic/turris-omnia-mcu-base.c @@ -361,7 +361,7 @@ static int omnia_mcu_probe(struct i2c_client *client) if (!client->irq) return dev_err_probe(dev, -EINVAL, "IRQ resource not found\n"); - mcu = devm_kzalloc(dev, sizeof(*mcu), GFP_KERNEL); + mcu = devm_kzalloc_obj(dev, *mcu); if (!mcu) return -ENOMEM; diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c index 3f34db896ece..e30128e771ca 100644 --- a/drivers/platform/goldfish/goldfish_pipe.c +++ b/drivers/platform/goldfish/goldfish_pipe.c @@ -873,7 +873,7 @@ static int goldfish_pipe_probe(struct platform_device *pdev) struct resource *r; struct goldfish_pipe_dev *dev; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/platform/mellanox/mlx-platform.c b/drivers/platform/mellanox/mlx-platform.c index efcba68d3aa5..c6f0022062fe 100644 --- a/drivers/platform/mellanox/mlx-platform.c +++ b/drivers/platform/mellanox/mlx-platform.c @@ -8545,8 +8545,7 @@ static int mlxplat_probe(struct platform_device *pdev) if (err) return err; - priv = devm_kzalloc(&mlxplat_dev->dev, sizeof(struct mlxplat_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(&mlxplat_dev->dev, struct mlxplat_priv); if (!priv) { err = -ENOMEM; goto fail_alloc; diff --git a/drivers/platform/mellanox/mlxbf-pmc.c b/drivers/platform/mellanox/mlxbf-pmc.c index 2ad9e2b0493c..f4a33b9087a0 100644 --- a/drivers/platform/mellanox/mlxbf-pmc.c +++ b/drivers/platform/mellanox/mlxbf-pmc.c @@ -2028,15 +2028,15 @@ static int mlxbf_pmc_init_perftype_counter(struct device *dev, unsigned int blk_ attr = NULL; } - pmc->block[blk_num].attr_counter = devm_kcalloc( - dev, pmc->block[blk_num].counters, - sizeof(struct mlxbf_pmc_attribute), GFP_KERNEL); + pmc->block[blk_num].attr_counter = devm_kzalloc_objs(dev, + struct mlxbf_pmc_attribute, + pmc->block[blk_num].counters); if (!pmc->block[blk_num].attr_counter) return -ENOMEM; - pmc->block[blk_num].attr_event = devm_kcalloc( - dev, pmc->block[blk_num].counters, - sizeof(struct mlxbf_pmc_attribute), GFP_KERNEL); + pmc->block[blk_num].attr_event = devm_kzalloc_objs(dev, + struct mlxbf_pmc_attribute, + pmc->block[blk_num].counters); if (!pmc->block[blk_num].attr_event) return -ENOMEM; @@ -2084,8 +2084,9 @@ static int mlxbf_pmc_init_perftype_reg(struct device *dev, unsigned int blk_num) if (!events) return -ENOENT; - pmc->block[blk_num].attr_event = devm_kcalloc( - dev, count, sizeof(struct mlxbf_pmc_attribute), GFP_KERNEL); + pmc->block[blk_num].attr_event = devm_kzalloc_objs(dev, + struct mlxbf_pmc_attribute, + count); if (!pmc->block[blk_num].attr_event) return -ENOMEM; @@ -2281,7 +2282,7 @@ static int mlxbf_pmc_probe(struct platform_device *pdev) if (!mlxbf_pmc_guid_match(&guid, &res)) return -ENODEV; - pmc = devm_kzalloc(dev, sizeof(struct mlxbf_pmc_context), GFP_KERNEL); + pmc = devm_kzalloc_obj(dev, struct mlxbf_pmc_context); if (!pmc) return -ENOMEM; diff --git a/drivers/platform/mellanox/mlxbf-tmfifo.c b/drivers/platform/mellanox/mlxbf-tmfifo.c index d67215df7371..4809caf9af0e 100644 --- a/drivers/platform/mellanox/mlxbf-tmfifo.c +++ b/drivers/platform/mellanox/mlxbf-tmfifo.c @@ -1358,7 +1358,7 @@ static int mlxbf_tmfifo_probe(struct platform_device *pdev) return rc; } - fifo = devm_kzalloc(dev, sizeof(*fifo), GFP_KERNEL); + fifo = devm_kzalloc_obj(dev, *fifo); if (!fifo) return -ENOMEM; diff --git a/drivers/platform/mellanox/mlxreg-dpu.c b/drivers/platform/mellanox/mlxreg-dpu.c index 39f89c47144a..bfb63cd487af 100644 --- a/drivers/platform/mellanox/mlxreg-dpu.c +++ b/drivers/platform/mellanox/mlxreg-dpu.c @@ -534,7 +534,7 @@ static int mlxreg_dpu_probe(struct platform_device *pdev) if (!data->hpdev.adapter) return -EPROBE_DEFER; - mlxreg_dpu = devm_kzalloc(&pdev->dev, sizeof(*mlxreg_dpu), GFP_KERNEL); + mlxreg_dpu = devm_kzalloc_obj(&pdev->dev, *mlxreg_dpu); if (!mlxreg_dpu) { err = -ENOMEM; goto alloc_fail; diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c index d6549dd21772..79a9d38440a4 100644 --- a/drivers/platform/mellanox/mlxreg-hotplug.c +++ b/drivers/platform/mellanox/mlxreg-hotplug.c @@ -325,10 +325,8 @@ static int mlxreg_hotplug_attr_init(struct mlxreg_hotplug_priv_data *priv) num_attrs += k; } - priv->group.attrs = devm_kcalloc(&priv->pdev->dev, - num_attrs, - sizeof(struct attribute *), - GFP_KERNEL); + priv->group.attrs = devm_kzalloc_objs(&priv->pdev->dev, + struct attribute *, num_attrs); if (!priv->group.attrs) return -ENOMEM; @@ -721,7 +719,7 @@ static int mlxreg_hotplug_probe(struct platform_device *pdev) return -EPROBE_DEFER; i2c_put_adapter(deferred_adap); - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/mellanox/mlxreg-io.c b/drivers/platform/mellanox/mlxreg-io.c index 97fefe6c38d1..1190861de1f6 100644 --- a/drivers/platform/mellanox/mlxreg-io.c +++ b/drivers/platform/mellanox/mlxreg-io.c @@ -181,10 +181,9 @@ static int mlxreg_io_attr_init(struct mlxreg_io_priv_data *priv) { int i; - priv->group.attrs = devm_kcalloc(&priv->pdev->dev, - priv->pdata->counter, - sizeof(struct attribute *), - GFP_KERNEL); + priv->group.attrs = devm_kzalloc_objs(&priv->pdev->dev, + struct attribute *, + priv->pdata->counter); if (!priv->group.attrs) return -ENOMEM; @@ -225,7 +224,7 @@ static int mlxreg_io_probe(struct platform_device *pdev) struct mlxreg_io_priv_data *priv; int err; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/mellanox/mlxreg-lc.c b/drivers/platform/mellanox/mlxreg-lc.c index d1518598dfed..3a538ebb4850 100644 --- a/drivers/platform/mellanox/mlxreg-lc.c +++ b/drivers/platform/mellanox/mlxreg-lc.c @@ -819,7 +819,7 @@ static int mlxreg_lc_probe(struct platform_device *pdev) if (!data) return -EINVAL; - mlxreg_lc = devm_kzalloc(&pdev->dev, sizeof(*mlxreg_lc), GFP_KERNEL); + mlxreg_lc = devm_kzalloc_obj(&pdev->dev, *mlxreg_lc); if (!mlxreg_lc) return -ENOMEM; diff --git a/drivers/platform/mellanox/nvsw-sn2201.c b/drivers/platform/mellanox/nvsw-sn2201.c index 92b58ba8f97b..d4d1970c47e4 100644 --- a/drivers/platform/mellanox/nvsw-sn2201.c +++ b/drivers/platform/mellanox/nvsw-sn2201.c @@ -1293,7 +1293,7 @@ static int nvsw_sn2201_probe(struct platform_device *pdev) const char *sku; int ret; - nvsw_sn2201 = devm_kzalloc(&pdev->dev, sizeof(*nvsw_sn2201), GFP_KERNEL); + nvsw_sn2201 = devm_kzalloc_obj(&pdev->dev, *nvsw_sn2201); if (!nvsw_sn2201) return -ENOMEM; diff --git a/drivers/platform/olpc/olpc-xo175-ec.c b/drivers/platform/olpc/olpc-xo175-ec.c index bee271a4fda1..64920c7aa75e 100644 --- a/drivers/platform/olpc/olpc-xo175-ec.c +++ b/drivers/platform/olpc/olpc-xo175-ec.c @@ -669,7 +669,7 @@ static int olpc_xo175_ec_probe(struct spi_device *spi) return -EBUSY; } - priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&spi->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c b/drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c index e78641703252..dae1fc0fea29 100644 --- a/drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c +++ b/drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c @@ -291,7 +291,7 @@ vchiq_platform_init_state(struct vchiq_state *state) { struct vchiq_arm_state *platform_state; - platform_state = devm_kzalloc(state->dev, sizeof(*platform_state), GFP_KERNEL); + platform_state = devm_kzalloc_obj(state->dev, *platform_state); if (!platform_state) return -ENOMEM; @@ -1387,7 +1387,7 @@ static int vchiq_probe(struct platform_device *pdev) return -ENOENT; } - mgmt = devm_kzalloc(&pdev->dev, sizeof(*mgmt), GFP_KERNEL); + mgmt = devm_kzalloc_obj(&pdev->dev, *mgmt); if (!mgmt) return -ENOMEM; diff --git a/drivers/platform/surface/surface3_power.c b/drivers/platform/surface/surface3_power.c index 94fdddc7f207..72a7625780ea 100644 --- a/drivers/platform/surface/surface3_power.c +++ b/drivers/platform/surface/surface3_power.c @@ -510,7 +510,7 @@ static int mshw0011_probe(struct i2c_client *client) struct mshw0011_data *data; int error, mask; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/surface/surface_acpi_notify.c b/drivers/platform/surface/surface_acpi_notify.c index 593a7aba6243..549910751069 100644 --- a/drivers/platform/surface/surface_acpi_notify.c +++ b/drivers/platform/surface/surface_acpi_notify.c @@ -795,7 +795,7 @@ static int san_probe(struct platform_device *pdev) if (status) return status; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/surface/surface_aggregator_hub.c b/drivers/platform/surface/surface_aggregator_hub.c index 541e9180f976..cad9c429e19c 100644 --- a/drivers/platform/surface/surface_aggregator_hub.c +++ b/drivers/platform/surface/surface_aggregator_hub.c @@ -164,7 +164,7 @@ static int ssam_hub_probe(struct ssam_device *sdev) return -EINVAL; } - hub = devm_kzalloc(&sdev->dev, sizeof(*hub), GFP_KERNEL); + hub = devm_kzalloc_obj(&sdev->dev, *hub); if (!hub) return -ENOMEM; diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c index 13031c329553..35f777e9d884 100644 --- a/drivers/platform/surface/surface_aggregator_tabletsw.c +++ b/drivers/platform/surface/surface_aggregator_tabletsw.c @@ -126,7 +126,7 @@ static int ssam_tablet_sw_probe(struct ssam_device *sdev) return -EINVAL; } - sw = devm_kzalloc(&sdev->dev, sizeof(*sw), GFP_KERNEL); + sw = devm_kzalloc_obj(&sdev->dev, *sw); if (!sw) return -ENOMEM; diff --git a/drivers/platform/surface/surface_gpe.c b/drivers/platform/surface/surface_gpe.c index 29b264f2a444..60c19283c79b 100644 --- a/drivers/platform/surface/surface_gpe.c +++ b/drivers/platform/surface/surface_gpe.c @@ -240,7 +240,7 @@ static int surface_gpe_probe(struct platform_device *pdev) return ret; } - lid = devm_kzalloc(&pdev->dev, sizeof(*lid), GFP_KERNEL); + lid = devm_kzalloc_obj(&pdev->dev, *lid); if (!lid) return -ENOMEM; diff --git a/drivers/platform/surface/surface_hotplug.c b/drivers/platform/surface/surface_hotplug.c index 33a8a9d41900..24d26bb65b39 100644 --- a/drivers/platform/surface/surface_hotplug.c +++ b/drivers/platform/surface/surface_hotplug.c @@ -215,7 +215,7 @@ static int surface_hotplug_probe(struct platform_device *pdev) if (status) return status; - sdev = devm_kzalloc(&pdev->dev, sizeof(*sdev), GFP_KERNEL); + sdev = devm_kzalloc_obj(&pdev->dev, *sdev); if (!sdev) return -ENOMEM; diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index 0e479e35e66e..52c57447266f 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -221,7 +221,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev) { struct ssam_platform_profile_device *tpd; - tpd = devm_kzalloc(&sdev->dev, sizeof(*tpd), GFP_KERNEL); + tpd = devm_kzalloc_obj(&sdev->dev, *tpd); if (!tpd) return -ENOMEM; diff --git a/drivers/platform/wmi/bmof.c b/drivers/platform/wmi/bmof.c index 6623cf60e4b4..cc7ac281e542 100644 --- a/drivers/platform/wmi/bmof.c +++ b/drivers/platform/wmi/bmof.c @@ -58,7 +58,7 @@ static int wmi_bmof_probe(struct wmi_device *wdev, const void *context) struct wmi_buffer *buffer; int ret; - buffer = devm_kzalloc(&wdev->dev, sizeof(*buffer), GFP_KERNEL); + buffer = devm_kzalloc_obj(&wdev->dev, *buffer); if (!buffer) return -ENOMEM; diff --git a/drivers/platform/x86/acer-wmi-battery.c b/drivers/platform/x86/acer-wmi-battery.c index 10a34d4ab058..431f1bdc669e 100644 --- a/drivers/platform/x86/acer-wmi-battery.c +++ b/drivers/platform/x86/acer-wmi-battery.c @@ -277,7 +277,7 @@ static int acer_wmi_battery_probe(struct wmi_device *wdev, const void *context) { struct acer_wmi_battery_data *data; - data = devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&wdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/adv_swbutton.c b/drivers/platform/x86/adv_swbutton.c index 8f7a26e6de81..efa42deb420b 100644 --- a/drivers/platform/x86/adv_swbutton.c +++ b/drivers/platform/x86/adv_swbutton.c @@ -56,7 +56,7 @@ static int adv_swbutton_probe(struct platform_device *device) if (!handle) return -ENODEV; - button = devm_kzalloc(&device->dev, sizeof(*button), GFP_KERNEL); + button = devm_kzalloc_obj(&device->dev, *button); if (!button) return -ENOMEM; diff --git a/drivers/platform/x86/amd/amd_halo_led.c b/drivers/platform/x86/amd/amd_halo_led.c index b21d956c7d96..b9e58644db22 100644 --- a/drivers/platform/x86/amd/amd_halo_led.c +++ b/drivers/platform/x86/amd/amd_halo_led.c @@ -254,7 +254,7 @@ static int amd_halo_probe(struct wmi_device *wdev, const void *context) u8 r, g, b; int ret; - data = devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&wdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/amd/amd_isp4.c b/drivers/platform/x86/amd/amd_isp4.c index 0d494899502c..9183611877f0 100644 --- a/drivers/platform/x86/amd/amd_isp4.c +++ b/drivers/platform/x86/amd/amd_isp4.c @@ -317,7 +317,7 @@ static struct amdisp_platform *prepare_amdisp_platform(struct device *dev, struct amdisp_platform *isp4_platform; int ret; - isp4_platform = devm_kzalloc(dev, sizeof(*isp4_platform), GFP_KERNEL); + isp4_platform = devm_kzalloc_obj(dev, *isp4_platform); if (!isp4_platform) return ERR_PTR(-ENOMEM); diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index a923345dd1cf..86a7f4332c35 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -234,13 +234,11 @@ static int amd_hfi_alloc_class_data(struct platform_device *pdev) struct amd_hfi_classes *classes; int *ipcc_scores; - classes = devm_kcalloc(dev, - nr_class_id, - sizeof(struct amd_hfi_classes), - GFP_KERNEL); + classes = devm_kzalloc_objs(dev, struct amd_hfi_classes, + nr_class_id); if (!classes) return -ENOMEM; - ipcc_scores = devm_kcalloc(dev, nr_class_id, sizeof(int), GFP_KERNEL); + ipcc_scores = devm_kzalloc_objs(dev, int, nr_class_id); if (!ipcc_scores) return -ENOMEM; hfi_cpuinfo = per_cpu_ptr(&amd_hfi_cpuinfo, idx); @@ -367,13 +365,13 @@ static int amd_hfi_metadata_parser(struct platform_device *pdev, acpi_status status; int ret; - pcc_mbox_channels = devm_kcalloc(&pdev->dev, AMD_HFI_MAILBOX_COUNT, - sizeof(*pcc_mbox_channels), GFP_KERNEL); + pcc_mbox_channels = devm_kzalloc_objs(&pdev->dev, *pcc_mbox_channels, + AMD_HFI_MAILBOX_COUNT); if (!pcc_mbox_channels) return -ENOMEM; - pcc_chan = devm_kcalloc(&pdev->dev, AMD_HFI_MAILBOX_COUNT, - sizeof(*pcc_chan), GFP_KERNEL); + pcc_chan = devm_kzalloc_objs(&pdev->dev, *pcc_chan, + AMD_HFI_MAILBOX_COUNT); if (!pcc_chan) return -ENOMEM; @@ -481,7 +479,7 @@ static int amd_hfi_probe(struct platform_device *pdev) if (!acpi_match_device(amd_hfi_platform_match, &pdev->dev)) return -ENODEV; - amd_hfi_data = devm_kzalloc(&pdev->dev, sizeof(*amd_hfi_data), GFP_KERNEL); + amd_hfi_data = devm_kzalloc_obj(&pdev->dev, *amd_hfi_data); if (!amd_hfi_data) return -ENOMEM; diff --git a/drivers/platform/x86/amd/hsmp/plat.c b/drivers/platform/x86/amd/hsmp/plat.c index e9b2b809c0f5..c3dc7c9f45ac 100644 --- a/drivers/platform/x86/amd/hsmp/plat.c +++ b/drivers/platform/x86/amd/hsmp/plat.c @@ -226,9 +226,8 @@ static int hsmp_pltdrv_probe(struct platform_device *pdev) { int ret; - hsmp_pdev->sock = devm_kcalloc(&pdev->dev, hsmp_pdev->num_sockets, - sizeof(*hsmp_pdev->sock), - GFP_KERNEL); + hsmp_pdev->sock = devm_kzalloc_objs(&pdev->dev, *hsmp_pdev->sock, + hsmp_pdev->num_sockets); if (!hsmp_pdev->sock) return -ENOMEM; diff --git a/drivers/platform/x86/amd/pmc/mp2_stb.c b/drivers/platform/x86/amd/pmc/mp2_stb.c index 9775ddc1b27a..293cb4602fef 100644 --- a/drivers/platform/x86/amd/pmc/mp2_stb.c +++ b/drivers/platform/x86/amd/pmc/mp2_stb.c @@ -228,7 +228,7 @@ void amd_mp2_stb_init(struct amd_pmc_dev *dev) struct pci_dev *pdev; int rc; - mp2 = devm_kzalloc(dev->dev, sizeof(*mp2), GFP_KERNEL); + mp2 = devm_kzalloc_obj(dev->dev, *mp2); if (!mp2) return; diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c index ba9324448586..926de4de2cdb 100644 --- a/drivers/platform/x86/amd/pmf/core.c +++ b/drivers/platform/x86/amd/pmf/core.c @@ -455,7 +455,7 @@ static int amd_pmf_probe(struct platform_device *pdev) if (id->driver_data == 0x100 && !force_load) return -ENODEV; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c index 3fe79f0f37c5..2ed2ea4abeb6 100644 --- a/drivers/platform/x86/amd/pmf/tee-if.c +++ b/drivers/platform/x86/amd/pmf/tee-if.c @@ -580,7 +580,7 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev) amd_pmf_hex_dump_pb(dev); - dev->prev_data = devm_kzalloc(dev->dev, sizeof(*dev->prev_data), GFP_KERNEL); + dev->prev_data = devm_kzalloc_obj(dev->dev, *dev->prev_data); if (!dev->prev_data) return -ENOMEM; diff --git a/drivers/platform/x86/amd/x3d_vcache.c b/drivers/platform/x86/amd/x3d_vcache.c index 0f6d3c54d879..fe8864e04709 100644 --- a/drivers/platform/x86/amd/x3d_vcache.c +++ b/drivers/platform/x86/amd/x3d_vcache.c @@ -141,7 +141,7 @@ static int amd_x3d_probe(struct platform_device *pdev) if (!acpi_check_dsm(handle, &x3d_guid, DSM_REVISION_ID, BIT(DSM_SET_X3D_MODE))) return -ENODEV; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/asus-tf103c-dock.c b/drivers/platform/x86/asus-tf103c-dock.c index 3be5b96de548..54c4b3641ce8 100644 --- a/drivers/platform/x86/asus-tf103c-dock.c +++ b/drivers/platform/x86/asus-tf103c-dock.c @@ -725,7 +725,7 @@ static int tf103c_dock_probe(struct i2c_client *client) if (!dmi_check_system(tf103c_dock_dmi_ids)) return -ENODEV; - dock = devm_kzalloc(dev, sizeof(*dock), GFP_KERNEL); + dock = devm_kzalloc_obj(dev, *dock); if (!dock) return -ENOMEM; diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c index aab45f0442c5..e825b15f6227 100644 --- a/drivers/platform/x86/asus-wireless.c +++ b/drivers/platform/x86/asus-wireless.c @@ -136,7 +136,7 @@ static int asus_wireless_probe(struct platform_device *pdev) if (!id) return -ENODEV; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/ayaneo-ec.c b/drivers/platform/x86/ayaneo-ec.c index 81dac81262e7..0be04ee148dc 100644 --- a/drivers/platform/x86/ayaneo-ec.c +++ b/drivers/platform/x86/ayaneo-ec.c @@ -478,7 +478,7 @@ static int ayaneo_ec_probe(struct platform_device *pdev) if (!dmi_entry) return -ENODEV; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/barco-p50-gpio.c b/drivers/platform/x86/barco-p50-gpio.c index e1400382465d..9a730fc3edb9 100644 --- a/drivers/platform/x86/barco-p50-gpio.c +++ b/drivers/platform/x86/barco-p50-gpio.c @@ -321,7 +321,7 @@ static int p50_gpio_probe(struct platform_device *pdev) return -EBUSY; } - p50 = devm_kzalloc(&pdev->dev, sizeof(*p50), GFP_KERNEL); + p50 = devm_kzalloc_obj(&pdev->dev, *p50); if (!p50) return -ENOMEM; diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c index dd1648b7de77..6dd901e54d9d 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -668,7 +668,7 @@ static int bitland_mifs_wmi_probe(struct wmi_device *wdev, const void *context) }; int ret; - drv_data = devm_kzalloc(&wdev->dev, sizeof(*drv_data), GFP_KERNEL); + drv_data = devm_kzalloc_obj(&wdev->dev, *drv_data); if (!drv_data) return -ENOMEM; diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c index 05890815795d..a7c7580993be 100644 --- a/drivers/platform/x86/classmate-laptop.c +++ b/drivers/platform/x86/classmate-laptop.c @@ -403,7 +403,7 @@ static int cmpc_accel_probe_v4(struct platform_device *pdev) if (!acpi) return -ENODEV; - accel = devm_kzalloc(&pdev->dev, sizeof(*accel), GFP_KERNEL); + accel = devm_kzalloc_obj(&pdev->dev, *accel); if (!accel) return -ENOMEM; @@ -664,7 +664,7 @@ static int cmpc_accel_probe(struct platform_device *pdev) if (!acpi) return -ENODEV; - accel = devm_kzalloc(&pdev->dev, sizeof(*accel), GFP_KERNEL); + accel = devm_kzalloc_obj(&pdev->dev, *accel); if (!accel) return -ENOMEM; diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c index abbebd4bfb15..a818e1493bf9 100644 --- a/drivers/platform/x86/compal-laptop.c +++ b/drivers/platform/x86/compal-laptop.c @@ -966,7 +966,7 @@ static int compal_probe(struct platform_device *pdev) return 0; /* Fan control */ - data = devm_kzalloc(&pdev->dev, sizeof(struct compal_data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct compal_data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/dasharo-acpi.c b/drivers/platform/x86/dasharo-acpi.c index f0c5136af29d..dfea00cdde18 100644 --- a/drivers/platform/x86/dasharo-acpi.c +++ b/drivers/platform/x86/dasharo-acpi.c @@ -326,7 +326,7 @@ static int dasharo_probe(struct platform_device *pdev) struct dasharo_data *data; struct device *hwmon; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; data->pdev = pdev; diff --git a/drivers/platform/x86/dell/alienware-wmi-base.c b/drivers/platform/x86/dell/alienware-wmi-base.c index 19cadf21203a..581c503aa625 100644 --- a/drivers/platform/x86/dell/alienware-wmi-base.c +++ b/drivers/platform/x86/dell/alienware-wmi-base.c @@ -394,7 +394,7 @@ static int alienfx_probe(struct platform_device *pdev) { struct alienfx_priv *priv; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platform/x86/dell/alienware-wmi-wmax.c index 2b0ffcb56a95..499e64dd79ca 100644 --- a/drivers/platform/x86/dell/alienware-wmi-wmax.c +++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c @@ -1136,7 +1136,7 @@ static int awcc_hwmon_fans_init(struct wmi_device *wdev) u8 id; for (i = 0; i < priv->fan_count; i++) { - fan_data = devm_kzalloc(&wdev->dev, sizeof(*fan_data), GFP_KERNEL); + fan_data = devm_kzalloc_obj(&wdev->dev, *fan_data); if (!fan_data) return -ENOMEM; @@ -1190,8 +1190,8 @@ static int awcc_hwmon_init(struct wmi_device *wdev) struct awcc_priv *priv = dev_get_drvdata(&wdev->dev); int ret; - priv->fan_data = devm_kcalloc(&wdev->dev, priv->fan_count, - sizeof(*priv->fan_data), GFP_KERNEL); + priv->fan_data = devm_kzalloc_objs(&wdev->dev, *priv->fan_data, + priv->fan_count); if (!priv->fan_data) return -ENOMEM; @@ -1534,7 +1534,7 @@ static int alienware_awcc_setup(struct wmi_device *wdev) struct awcc_priv *priv; int ret; - priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&wdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-dw5826e-reset.c b/drivers/platform/x86/dell/dell-dw5826e-reset.c index c72c243b460e..fb5abe425c41 100644 --- a/drivers/platform/x86/dell/dell-dw5826e-reset.c +++ b/drivers/platform/x86/dell/dell-dw5826e-reset.c @@ -78,7 +78,7 @@ static int palc_probe(struct platform_device *pdev) if (!handle) return -ENODEV; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-rbtn.c b/drivers/platform/x86/dell/dell-rbtn.c index 180b8c6720e6..c0b3877bb27d 100644 --- a/drivers/platform/x86/dell/dell-rbtn.c +++ b/drivers/platform/x86/dell/dell-rbtn.c @@ -411,7 +411,7 @@ static int rbtn_probe(struct platform_device *pdev) return -EINVAL; } - rbtn_data = devm_kzalloc(&pdev->dev, sizeof(*rbtn_data), GFP_KERNEL); + rbtn_data = devm_kzalloc_obj(&pdev->dev, *rbtn_data); if (!rbtn_data) return -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-smbios-base.c b/drivers/platform/x86/dell/dell-smbios-base.c index d8c55ec6acd4..c8e93c12c445 100644 --- a/drivers/platform/x86/dell/dell-smbios-base.c +++ b/drivers/platform/x86/dell/dell-smbios-base.c @@ -150,7 +150,7 @@ int dell_smbios_register_device(struct device *d, int priority, smbios_callback_ { struct smbios_device *priv; - priv = devm_kzalloc(d, sizeof(struct smbios_device), GFP_KERNEL); + priv = devm_kzalloc_obj(d, struct smbios_device); if (!priv) return -ENOMEM; get_device(d); diff --git a/drivers/platform/x86/dell/dell-smbios-wmi.c b/drivers/platform/x86/dell/dell-smbios-wmi.c index f9443ddfff55..7a5c6d7730ab 100644 --- a/drivers/platform/x86/dell/dell-smbios-wmi.c +++ b/drivers/platform/x86/dell/dell-smbios-wmi.c @@ -222,8 +222,7 @@ static int dell_smbios_wmi_probe(struct wmi_device *wdev, const void *context) if (ret) return ret; - priv = devm_kzalloc(&wdev->dev, sizeof(struct wmi_smbios_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(&wdev->dev, struct wmi_smbios_priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-smo8800.c b/drivers/platform/x86/dell/dell-smo8800.c index 8872f9b57fce..e056664656a7 100644 --- a/drivers/platform/x86/dell/dell-smo8800.c +++ b/drivers/platform/x86/dell/dell-smo8800.c @@ -108,7 +108,7 @@ static int smo8800_probe(struct platform_device *device) int err; struct smo8800_device *smo8800; - smo8800 = devm_kzalloc(&device->dev, sizeof(*smo8800), GFP_KERNEL); + smo8800 = devm_kzalloc_obj(&device->dev, *smo8800); if (!smo8800) { dev_err(&device->dev, "failed to allocate device data\n"); return -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-uart-backlight.c b/drivers/platform/x86/dell/dell-uart-backlight.c index f323a667dc2d..bbb270ae3697 100644 --- a/drivers/platform/x86/dell/dell-uart-backlight.c +++ b/drivers/platform/x86/dell/dell-uart-backlight.c @@ -275,7 +275,7 @@ static int dell_uart_bl_serdev_probe(struct serdev_device *serdev) struct device *dev = &serdev->dev; int ret; - dell_bl = devm_kzalloc(dev, sizeof(*dell_bl), GFP_KERNEL); + dell_bl = devm_kzalloc_obj(dev, *dell_bl); if (!dell_bl) return -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-wmi-aio.c b/drivers/platform/x86/dell/dell-wmi-aio.c index 42c0032991d2..cea50ccac7ea 100644 --- a/drivers/platform/x86/dell/dell-wmi-aio.c +++ b/drivers/platform/x86/dell/dell-wmi-aio.c @@ -106,7 +106,7 @@ static int dell_wmi_aio_probe(struct wmi_device *wdev, const void *context) struct dell_wmi_aio_data *data; int ret; - data = devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&wdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-wmi-base.c b/drivers/platform/x86/dell/dell-wmi-base.c index 38a6b3ae2f75..44857e99fdfe 100644 --- a/drivers/platform/x86/dell/dell-wmi-base.c +++ b/drivers/platform/x86/dell/dell-wmi-base.c @@ -795,8 +795,7 @@ static int dell_wmi_probe(struct wmi_device *wdev, const void *context) if (ret) return ret; - priv = devm_kzalloc( - &wdev->dev, sizeof(struct dell_wmi_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&wdev->dev, struct dell_wmi_priv); if (!priv) return -ENOMEM; dev_set_drvdata(&wdev->dev, priv); diff --git a/drivers/platform/x86/dell/dell-wmi-ddv.c b/drivers/platform/x86/dell/dell-wmi-ddv.c index f8903ced461b..00213dbd737d 100644 --- a/drivers/platform/x86/dell/dell-wmi-ddv.c +++ b/drivers/platform/x86/dell/dell-wmi-ddv.c @@ -519,7 +519,7 @@ static struct hwmon_channel_info *dell_wmi_ddv_channel_create(struct device *dev struct combined_channel_info *cinfo; int i; - cinfo = devm_kzalloc(dev, struct_size(cinfo, config, count + 1), GFP_KERNEL); + cinfo = devm_kzalloc_flex(dev, *cinfo, config, count + 1); if (!cinfo) return ERR_PTR(-ENOMEM); @@ -592,7 +592,7 @@ static int dell_wmi_ddv_hwmon_add(struct dell_wmi_ddv_data *data) if (!devres_open_group(&wdev->dev, dell_wmi_ddv_hwmon_add, GFP_KERNEL)) return -ENOMEM; - cinfo = devm_kzalloc(&wdev->dev, struct_size(cinfo, info, 4), GFP_KERNEL); + cinfo = devm_kzalloc_flex(&wdev->dev, *cinfo, info, 4); if (!cinfo) { ret = -ENOMEM; @@ -1044,7 +1044,7 @@ static int dell_wmi_ddv_probe(struct wmi_device *wdev, const void *context) version); } - data = devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&wdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-wmi-descriptor.c b/drivers/platform/x86/dell/dell-wmi-descriptor.c index 179d5678b3ad..c496535bf13c 100644 --- a/drivers/platform/x86/dell/dell-wmi-descriptor.c +++ b/drivers/platform/x86/dell/dell-wmi-descriptor.c @@ -142,7 +142,7 @@ static int dell_wmi_descriptor_probe(struct wmi_device *wdev, const void *contex dev_warn(&wdev->dev, "Dell descriptor buffer has unknown version (%u)\n", le32_to_cpu(desc->interface_version)); - priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&wdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-wmi-privacy.c b/drivers/platform/x86/dell/dell-wmi-privacy.c index 366e5b8dc868..b7f589ad7c6f 100644 --- a/drivers/platform/x86/dell/dell-wmi-privacy.c +++ b/drivers/platform/x86/dell/dell-wmi-privacy.c @@ -288,7 +288,7 @@ static int dell_privacy_wmi_probe(struct wmi_device *wdev, const void *context) struct key_entry *keymap; int ret, i, j; - priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&wdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index ea543deef68f..8e909cb726f1 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -540,7 +540,7 @@ static int acpi_fujitsu_bl_probe(struct platform_device *pdev) if (acpi_video_get_backlight_type() != acpi_backlight_vendor) return -ENODEV; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; @@ -846,7 +846,7 @@ static int acpi_fujitsu_laptop_leds_register(struct device *dev) int ret; if (call_fext_func(dev, FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) { - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) return -ENOMEM; @@ -860,7 +860,7 @@ static int acpi_fujitsu_laptop_leds_register(struct device *dev) if ((call_fext_func(dev, FUNC_LEDS, 0x0, 0x0, 0x0) & KEYBOARD_LAMPS) && (call_fext_func(dev, FUNC_BUTTONS, 0x0, 0x0, 0x0) == 0x0)) { - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) return -ENOMEM; @@ -882,7 +882,7 @@ static int acpi_fujitsu_laptop_leds_register(struct device *dev) * whether given model has a radio toggle button. */ if (priv->flags_supported & BIT(17)) { - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) return -ENOMEM; @@ -902,7 +902,7 @@ static int acpi_fujitsu_laptop_leds_register(struct device *dev) */ if ((call_fext_func(dev, FUNC_LEDS, 0x0, 0x0, 0x0) & BIT(14)) && (call_fext_func(dev, FUNC_LEDS, 0x2, ECO_LED, 0x0) != UNSUPPORTED_CMD)) { - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) return -ENOMEM; @@ -1002,7 +1002,7 @@ static int acpi_fujitsu_laptop_probe(struct platform_device *pdev) if (!device) return -ENODEV; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/gpd-pocket-fan.c b/drivers/platform/x86/gpd-pocket-fan.c index ced93795c5d4..4a26137e63e5 100644 --- a/drivers/platform/x86/gpd-pocket-fan.c +++ b/drivers/platform/x86/gpd-pocket-fan.c @@ -148,7 +148,7 @@ static int gpd_pocket_fan_probe(struct platform_device *pdev) speed_on_ac = SPEED_ON_AC_DEFAULT; } - fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL); + fan = devm_kzalloc_obj(&pdev->dev, *fan); if (!fan) return -ENOMEM; diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index 52077833ac89..0069af86800e 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -3186,7 +3186,7 @@ static int hp_wmi_hwmon_init(void) struct device *hwmon; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index e02f5a55a6c5..30f6bff57224 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -183,7 +183,7 @@ static int inspur_wmi_probe(struct wmi_device *wdev, const void *context) { struct inspur_wmi_priv *priv; - priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&wdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/intel/bxtwc_tmu.c b/drivers/platform/x86/intel/bxtwc_tmu.c index 73d7f71b2fd0..70e5c78b7587 100644 --- a/drivers/platform/x86/intel/bxtwc_tmu.c +++ b/drivers/platform/x86/intel/bxtwc_tmu.c @@ -50,7 +50,7 @@ static int bxt_wcove_tmu_probe(struct platform_device *pdev) struct wcove_tmu *wctmu; int ret; - wctmu = devm_kzalloc(&pdev->dev, sizeof(*wctmu), GFP_KERNEL); + wctmu = devm_kzalloc_obj(&pdev->dev, *wctmu); if (!wctmu) return -ENOMEM; diff --git a/drivers/platform/x86/intel/bytcrc_pwrsrc.c b/drivers/platform/x86/intel/bytcrc_pwrsrc.c index 1f39850b80fd..debe5fc9c934 100644 --- a/drivers/platform/x86/intel/bytcrc_pwrsrc.c +++ b/drivers/platform/x86/intel/bytcrc_pwrsrc.c @@ -181,7 +181,7 @@ static int crc_pwrsrc_probe(struct platform_device *pdev) struct crc_pwrsrc_data *data; int irq, ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/intel/chtwc_int33fe.c b/drivers/platform/x86/intel/chtwc_int33fe.c index d183aa53c318..9fb09e565ffc 100644 --- a/drivers/platform/x86/intel/chtwc_int33fe.c +++ b/drivers/platform/x86/intel/chtwc_int33fe.c @@ -323,7 +323,7 @@ static int cht_int33fe_typec_probe(struct platform_device *pdev) if (!dmi_check_system(cht_int33fe_typec_ids)) return -ENODEV; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/intel/crystal_cove_charger.c b/drivers/platform/x86/intel/crystal_cove_charger.c index 425c7eb32442..311992528bc6 100644 --- a/drivers/platform/x86/intel/crystal_cove_charger.c +++ b/drivers/platform/x86/intel/crystal_cove_charger.c @@ -89,7 +89,7 @@ static int crystal_cove_charger_probe(struct platform_device *pdev) struct crystal_cove_charger_data *charger; int ret; - charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); + charger = devm_kzalloc_obj(&pdev->dev, *charger); if (!charger) return -ENOMEM; diff --git a/drivers/platform/x86/intel/ehl_pse_io.c b/drivers/platform/x86/intel/ehl_pse_io.c index f75f3a8cc6b0..3837523eeece 100644 --- a/drivers/platform/x86/intel/ehl_pse_io.c +++ b/drivers/platform/x86/intel/ehl_pse_io.c @@ -29,7 +29,7 @@ static int ehl_pse_io_dev_create(struct pci_dev *pci, const char *name, int idx) resource_size_t start, offset; u32 id; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/intel/hid.c b/drivers/platform/x86/intel/hid.c index 6024bf29c4df..60e6b476500e 100644 --- a/drivers/platform/x86/intel/hid.c +++ b/drivers/platform/x86/intel/hid.c @@ -734,7 +734,7 @@ static int intel_hid_probe(struct platform_device *device) return -ENODEV; } - priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&device->dev, *priv); if (!priv) return -ENOMEM; dev_set_drvdata(&device->dev, priv); diff --git a/drivers/platform/x86/intel/int0002_vgpio.c b/drivers/platform/x86/intel/int0002_vgpio.c index 96b36cfcd9e4..909a90e060c7 100644 --- a/drivers/platform/x86/intel/int0002_vgpio.c +++ b/drivers/platform/x86/intel/int0002_vgpio.c @@ -182,7 +182,7 @@ static int int0002_probe(struct platform_device *pdev) if (irq < 0) return irq; - int0002 = devm_kzalloc(dev, sizeof(*int0002), GFP_KERNEL); + int0002 = devm_kzalloc_obj(dev, *int0002); if (!int0002) return -ENOMEM; diff --git a/drivers/platform/x86/intel/int1092/intel_sar.c b/drivers/platform/x86/intel/int1092/intel_sar.c index f506155f35d4..8764fff059d0 100644 --- a/drivers/platform/x86/intel/int1092/intel_sar.c +++ b/drivers/platform/x86/intel/int1092/intel_sar.c @@ -91,10 +91,9 @@ static acpi_status parse_package(struct wwan_sar_context *context, union acpi_ob item->package.count <= data->total_dev_mode) return AE_ERROR; - data->device_mode_info = devm_kcalloc(&context->sar_device->dev, - data->total_dev_mode, - sizeof(*data->device_mode_info), - GFP_KERNEL); + data->device_mode_info = devm_kzalloc_objs(&context->sar_device->dev, + *data->device_mode_info, + data->total_dev_mode); if (!data->device_mode_info) return AE_ERROR; @@ -255,7 +254,7 @@ static int sar_probe(struct platform_device *device) if (!handle) return -ENODEV; - context = devm_kzalloc(&device->dev, sizeof(*context), GFP_KERNEL); + context = devm_kzalloc_obj(&device->dev, *context); if (!context) return -ENOMEM; diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c index b19ea6ee3374..f14bee2b430a 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -526,8 +526,8 @@ static int skl_int3472_discrete_probe(struct platform_device *pdev) } /* Max num GPIOs we've seen plus a terminator */ - int3472 = devm_kzalloc(&pdev->dev, struct_size(int3472, gpios.table, - INT3472_MAX_SENSOR_GPIOS + 1), GFP_KERNEL); + int3472 = devm_kzalloc_flex(&pdev->dev, *int3472, gpios.table, + INT3472_MAX_SENSOR_GPIOS + 1); if (!int3472) return -ENOMEM; diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c index 14edef175b20..14f5ff9254d2 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -117,8 +117,7 @@ skl_int3472_fill_clk_pdata(struct device *dev, struct tps68470_clk_platform_data return -ENODEV; } - *clk_pdata = devm_kzalloc(dev, struct_size(*clk_pdata, consumers, n_consumers), - GFP_KERNEL); + *clk_pdata = devm_kzalloc_flex(dev, **clk_pdata, consumers, n_consumers); if (!*clk_pdata) return -ENOMEM; @@ -188,10 +187,9 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) "No board-data found for this model\n"); if (board_data->n_clk_consumers) { - clk_pdata = devm_kzalloc(&client->dev, - struct_size(clk_pdata, consumers, - board_data->n_clk_consumers), - GFP_KERNEL); + clk_pdata = devm_kzalloc_flex(&client->dev, *clk_pdata, + consumers, + board_data->n_clk_consumers); if (!clk_pdata) return -ENOMEM; clk_pdata->n_consumers = board_data->n_clk_consumers; diff --git a/drivers/platform/x86/intel/ishtp_eclite.c b/drivers/platform/x86/intel/ishtp_eclite.c index bca7e217878b..84c98c51a5e5 100644 --- a/drivers/platform/x86/intel/ishtp_eclite.c +++ b/drivers/platform/x86/intel/ishtp_eclite.c @@ -557,8 +557,7 @@ static int ecl_ishtp_cl_probe(struct ishtp_cl_device *cl_device) struct ishtp_opregion_dev *opr_dev; int rv; - opr_dev = devm_kzalloc(ishtp_device(cl_device), sizeof(*opr_dev), - GFP_KERNEL); + opr_dev = devm_kzalloc_obj(ishtp_device(cl_device), *opr_dev); if (!opr_dev) return -ENOMEM; diff --git a/drivers/platform/x86/intel/plr_tpmi.c b/drivers/platform/x86/intel/plr_tpmi.c index f98c241edee4..785c279b4540 100644 --- a/drivers/platform/x86/intel/plr_tpmi.c +++ b/drivers/platform/x86/intel/plr_tpmi.c @@ -304,7 +304,7 @@ static int intel_plr_probe(struct auxiliary_device *auxdev, const struct auxilia if (!num_resources) return -EINVAL; - plr = devm_kzalloc(&auxdev->dev, sizeof(*plr), GFP_KERNEL); + plr = devm_kzalloc_obj(&auxdev->dev, *plr); if (!plr) return -ENOMEM; @@ -314,8 +314,8 @@ static int intel_plr_probe(struct auxiliary_device *auxdev, const struct auxilia intel_plr_register_notifier(&plr->nb); - plr->die_info = devm_kcalloc(&auxdev->dev, num_resources, sizeof(*plr->die_info), - GFP_KERNEL); + plr->die_info = devm_kzalloc_objs(&auxdev->dev, *plr->die_info, + num_resources); if (!plr->die_info) { err = -ENOMEM; goto err_notify; diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index ab5f6ad74ab0..47759b2a8012 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -1628,8 +1628,8 @@ int pmc_core_pmt_get_blk_sub_req(struct pmc_dev *pmcdev, struct pmc *pmc, num_blocker = pmc->map->num_s0ix_blocker; sample_offset = pmc->map->blocker_req_offset; - pmc->lpm_req_regs = devm_kcalloc(&pmcdev->pdev->dev, num_blocker, - sizeof(u32), GFP_KERNEL); + pmc->lpm_req_regs = devm_kzalloc_objs(&pmcdev->pdev->dev, u32, + num_blocker); if (!pmc->lpm_req_regs) return -ENOMEM; @@ -1715,7 +1715,7 @@ static int pmc_core_pmc_add(struct pmc_dev *pmcdev, unsigned int pmc_idx) pmc = pmcdev->pmcs[pmc_idx]; /* Memory for primary PMC has been allocated */ if (!pmc) { - pmc = devm_kzalloc(&pmcdev->pdev->dev, sizeof(*pmc), GFP_KERNEL); + pmc = devm_kzalloc_obj(&pmcdev->pdev->dev, *pmc); if (!pmc) return -ENOMEM; } @@ -1935,7 +1935,7 @@ static int pmc_core_probe(struct platform_device *pdev) if (device_initialized) return -ENODEV; - pmcdev = devm_kzalloc(&pdev->dev, sizeof(*pmcdev), GFP_KERNEL); + pmcdev = devm_kzalloc_obj(&pdev->dev, *pmcdev); if (!pmcdev) return -ENOMEM; @@ -1951,17 +1951,16 @@ static int pmc_core_probe(struct platform_device *pdev) pmc_dev_info = (struct pmc_dev_info *)cpu_id->driver_data; /* Primary PMC */ - primary_pmc = devm_kzalloc(&pdev->dev, sizeof(*primary_pmc), GFP_KERNEL); + primary_pmc = devm_kzalloc_obj(&pdev->dev, *primary_pmc); if (!primary_pmc) return -ENOMEM; pmcdev->pmcs[PMC_IDX_MAIN] = primary_pmc; /* The last element in msr_map is empty */ pmcdev->num_of_pkgc = ARRAY_SIZE(msr_map) - 1; - pmcdev->pkgc_res_cnt = devm_kcalloc(&pdev->dev, - pmcdev->num_of_pkgc, - sizeof(*pmcdev->pkgc_res_cnt), - GFP_KERNEL); + pmcdev->pkgc_res_cnt = devm_kzalloc_objs(&pdev->dev, + *pmcdev->pkgc_res_cnt, + pmcdev->num_of_pkgc); if (!pmcdev->pkgc_res_cnt) return -ENOMEM; diff --git a/drivers/platform/x86/intel/pmc/ssram_telemetry.c b/drivers/platform/x86/intel/pmc/ssram_telemetry.c index 8e280ec525a6..3e2e62a9af8d 100644 --- a/drivers/platform/x86/intel/pmc/ssram_telemetry.c +++ b/drivers/platform/x86/intel/pmc/ssram_telemetry.c @@ -410,7 +410,7 @@ static int pmc_ssram_telemetry_probe(struct pci_dev *pcidev, const struct pci_de pmc_ssram_mark_probing(probe_cache.owned_mask); - drvdata = devm_kzalloc(&pcidev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pcidev->dev, *drvdata); if (!drvdata) { ret = -ENOMEM; goto probe_finish; diff --git a/drivers/platform/x86/intel/pmc/tgl.c b/drivers/platform/x86/intel/pmc/tgl.c index fc5b4cacc1c6..c657ed20e0b2 100644 --- a/drivers/platform/x86/intel/pmc/tgl.c +++ b/drivers/platform/x86/intel/pmc/tgl.c @@ -273,8 +273,7 @@ void pmc_core_get_tgl_lpm_reqs(struct platform_device *pdev) addr = (u32 *)out_obj->buffer.pointer; - lpm_req_regs = devm_kcalloc(&pdev->dev, lpm_size, sizeof(u32), - GFP_KERNEL); + lpm_req_regs = devm_kzalloc_objs(&pdev->dev, u32, lpm_size); if (!lpm_req_regs) goto free_acpi_obj; diff --git a/drivers/platform/x86/intel/punit_ipc.c b/drivers/platform/x86/intel/punit_ipc.c index a3d2b0b64135..8d797fc86498 100644 --- a/drivers/platform/x86/intel/punit_ipc.c +++ b/drivers/platform/x86/intel/punit_ipc.c @@ -236,8 +236,7 @@ static int intel_punit_ipc_probe(struct platform_device *pdev) { int irq, ret; - punit_ipcdev = devm_kzalloc(&pdev->dev, - sizeof(*punit_ipcdev), GFP_KERNEL); + punit_ipcdev = devm_kzalloc_obj(&pdev->dev, *punit_ipcdev); if (!punit_ipcdev) return -ENOMEM; diff --git a/drivers/platform/x86/intel/sdsi.c b/drivers/platform/x86/intel/sdsi.c index d7e37d4ace23..fccbb846b03a 100644 --- a/drivers/platform/x86/intel/sdsi.c +++ b/drivers/platform/x86/intel/sdsi.c @@ -658,7 +658,7 @@ static int sdsi_probe(struct auxiliary_device *auxdev, const struct auxiliary_de struct sdsi_priv *priv; int ret; - priv = devm_kzalloc(&auxdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&auxdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_mbox_pci.c b/drivers/platform/x86/intel/speed_select_if/isst_if_mbox_pci.c index df1fc6c719f3..c31cc60c58c4 100644 --- a/drivers/platform/x86/intel/speed_select_if/isst_if_mbox_pci.c +++ b/drivers/platform/x86/intel/speed_select_if/isst_if_mbox_pci.c @@ -172,7 +172,7 @@ static int isst_if_mbox_probe(struct pci_dev *pdev, struct isst_if_cmd_cb cb; int ret; - punit_dev = devm_kzalloc(&pdev->dev, sizeof(*punit_dev), GFP_KERNEL); + punit_dev = devm_kzalloc_obj(&pdev->dev, *punit_dev); if (!punit_dev) return -ENOMEM; diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c index 950ede5eab76..60bdb30da8f3 100644 --- a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c +++ b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c @@ -98,7 +98,7 @@ static int isst_if_probe(struct pci_dev *pdev, const struct pci_device_id *ent) u64 base_addr; int ret; - punit_dev = devm_kzalloc(&pdev->dev, sizeof(*punit_dev), GFP_KERNEL); + punit_dev = devm_kzalloc_obj(&pdev->dev, *punit_dev); if (!punit_dev) return -ENOMEM; diff --git a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c index bb0d0b8fc54a..fa71c0fe172f 100644 --- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c @@ -335,7 +335,7 @@ static int sst_add_perf_profiles(struct auxiliary_device *auxdev, u64 perf_level_offsets; int i; - pd_info->perf_levels = devm_kcalloc(dev, levels, sizeof(struct perf_level), GFP_KERNEL); + pd_info->perf_levels = devm_kzalloc_objs(dev, struct perf_level, levels); if (!pd_info->perf_levels) { pd_info->pp_header.allowed_level_mask = 0; pd_info->pp_header.level_en_mask = 0; @@ -1686,7 +1686,7 @@ int tpmi_sst_dev_add(struct auxiliary_device *auxdev) ret = 0; - pd_info = devm_kcalloc(dev, num_resources, sizeof(*pd_info), GFP_KERNEL); + pd_info = devm_kzalloc_objs(dev, *pd_info, num_resources); if (!pd_info) { ret = -ENOMEM; goto unlock_free; diff --git a/drivers/platform/x86/intel/tpmi_common.c b/drivers/platform/x86/intel/tpmi_common.c index b6b811016dfd..816606767b82 100644 --- a/drivers/platform/x86/intel/tpmi_common.c +++ b/drivers/platform/x86/intel/tpmi_common.c @@ -717,9 +717,9 @@ int intel_tpmi_init(struct intel_tpmi_info *tpmi_info, struct device *tpmi_dev, if (pci_dev) tpmi_info->plat_info.bus_number = pci_dev->bus->number; - tpmi_info->tpmi_features = devm_kcalloc(tpmi_info->tpmi_dev, tpmi_info->feature_count, - sizeof(*tpmi_info->tpmi_features), - GFP_KERNEL); + tpmi_info->tpmi_features = devm_kzalloc_objs(tpmi_info->tpmi_dev, + *tpmi_info->tpmi_features, + tpmi_info->feature_count); if (!tpmi_info->tpmi_features) return -ENOMEM; diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c index 44e2a90004df..753ddfe8c759 100644 --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c @@ -581,16 +581,16 @@ static int uncore_probe(struct auxiliary_device *auxdev, const struct auxiliary_ return ret; /* Allocate uncore instance per package */ - tpmi_uncore = devm_kzalloc(&auxdev->dev, sizeof(*tpmi_uncore), GFP_KERNEL); + tpmi_uncore = devm_kzalloc_obj(&auxdev->dev, *tpmi_uncore); if (!tpmi_uncore) { ret = -ENOMEM; goto err_rem_common; } /* Allocate memory for all power domains in a package */ - tpmi_uncore->pd_info = devm_kcalloc(&auxdev->dev, num_resources, - sizeof(*tpmi_uncore->pd_info), - GFP_KERNEL); + tpmi_uncore->pd_info = devm_kzalloc_objs(&auxdev->dev, + *tpmi_uncore->pd_info, + num_resources); if (!tpmi_uncore->pd_info) { ret = -ENOMEM; goto err_rem_common; @@ -666,9 +666,9 @@ static int uncore_probe(struct auxiliary_device *auxdev, const struct auxiliary_ /* Find out number of clusters in this resource */ pd_info->cluster_count = hweight8(cluster_mask); - pd_info->cluster_infos = devm_kcalloc(&auxdev->dev, pd_info->cluster_count, - sizeof(struct tpmi_uncore_cluster_info), - GFP_KERNEL); + pd_info->cluster_infos = devm_kzalloc_objs(&auxdev->dev, + struct tpmi_uncore_cluster_info, + pd_info->cluster_count); if (!pd_info->cluster_infos) { ret = -ENOMEM; goto remove_clusters; diff --git a/drivers/platform/x86/intel/vbtn.c b/drivers/platform/x86/intel/vbtn.c index 874023c38fd1..975d8534d4cd 100644 --- a/drivers/platform/x86/intel/vbtn.c +++ b/drivers/platform/x86/intel/vbtn.c @@ -294,7 +294,7 @@ static int intel_vbtn_probe(struct platform_device *device) return -ENODEV; } - priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&device->dev, *priv); if (!priv) return -ENOMEM; dev_set_drvdata(&device->dev, priv); diff --git a/drivers/platform/x86/intel/vsec.c b/drivers/platform/x86/intel/vsec.c index 380d8231549f..85c458aadcd4 100644 --- a/drivers/platform/x86/intel/vsec.c +++ b/drivers/platform/x86/intel/vsec.c @@ -714,7 +714,7 @@ static int intel_vsec_pci_probe(struct pci_dev *pdev, const struct pci_device_id if (!info) return -EINVAL; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/intel/vsec_tpmi.c b/drivers/platform/x86/intel/vsec_tpmi.c index 053fe0f58641..d31631a71db9 100644 --- a/drivers/platform/x86/intel/vsec_tpmi.c +++ b/drivers/platform/x86/intel/vsec_tpmi.c @@ -37,7 +37,7 @@ static int tpmi_probe(struct auxiliary_device *auxdev, struct intel_vsec_device *vsec_dev = auxdev_to_ivdev(auxdev); struct intel_tpmi_info *tpmi_info; - tpmi_info = devm_kzalloc(&auxdev->dev, sizeof(*tpmi_info), GFP_KERNEL); + tpmi_info = devm_kzalloc_obj(&auxdev->dev, *tpmi_info); if (!tpmi_info) return -ENOMEM; diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index b935be2a2fd9..636f4511127f 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c @@ -1431,7 +1431,7 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) if (dmi_check_system(ips_blacklist)) return -ENODEV; - ips = devm_kzalloc(&dev->dev, sizeof(*ips), GFP_KERNEL); + ips = devm_kzalloc_obj(&dev->dev, *ips); if (!ips) return -ENOMEM; diff --git a/drivers/platform/x86/lenovo/ideapad-laptop.c b/drivers/platform/x86/lenovo/ideapad-laptop.c index 857a449c4f8a..91a8d11c79c5 100644 --- a/drivers/platform/x86/lenovo/ideapad-laptop.c +++ b/drivers/platform/x86/lenovo/ideapad-laptop.c @@ -2278,7 +2278,7 @@ static int ideapad_wmi_probe(struct wmi_device *wdev, const void *context) { struct ideapad_wmi_private *wpriv; - wpriv = devm_kzalloc(&wdev->dev, sizeof(*wpriv), GFP_KERNEL); + wpriv = devm_kzalloc_obj(&wdev->dev, *wpriv); if (!wpriv) return -ENOMEM; @@ -2394,7 +2394,7 @@ static int ideapad_acpi_add(struct platform_device *pdev) if (!adev || eval_int(adev->handle, "_CFG", &cfg)) return -ENODEV; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/lenovo/wmi-camera.c b/drivers/platform/x86/lenovo/wmi-camera.c index 89ecbce60bf4..090b1e525357 100644 --- a/drivers/platform/x86/lenovo/wmi-camera.c +++ b/drivers/platform/x86/lenovo/wmi-camera.c @@ -101,7 +101,7 @@ static int lenovo_wmi_probe(struct wmi_device *wdev, const void *context) { struct lenovo_wmi_priv *priv; - priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&wdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/lenovo/wmi-capdata.c b/drivers/platform/x86/lenovo/wmi-capdata.c index 1d44ff83e157..cdcddf405339 100644 --- a/drivers/platform/x86/lenovo/wmi-capdata.c +++ b/drivers/platform/x86/lenovo/wmi-capdata.c @@ -417,7 +417,7 @@ static int lwmi_cd_sub_master_add(struct lwmi_cd_priv *priv, if (sub_component_type == CD_TYPE_NONE) return 0; - priv->sub_master = devm_kzalloc(&priv->wdev->dev, sizeof(*priv->sub_master), GFP_KERNEL); + priv->sub_master = devm_kzalloc_obj(&priv->wdev->dev, *priv->sub_master); if (!priv->sub_master) return -ENOMEM; @@ -856,7 +856,7 @@ static int lwmi_cd_fan_list_alloc_cache(struct lwmi_cd_priv *priv) if (!count) return 0; - list = devm_kzalloc(&priv->wdev->dev, struct_size(list, cd_fan, count), GFP_KERNEL); + list = devm_kzalloc_flex(&priv->wdev->dev, *list, cd_fan, count); if (!list) return -ENOMEM; @@ -1032,7 +1032,7 @@ static int lwmi_cd_probe(struct wmi_device *wdev, const void *context) if (!info) return -EINVAL; - priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&wdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/lenovo/wmi-events.c b/drivers/platform/x86/lenovo/wmi-events.c index fc25bba68a7c..3a82192dc9e5 100644 --- a/drivers/platform/x86/lenovo/wmi-events.c +++ b/drivers/platform/x86/lenovo/wmi-events.c @@ -161,7 +161,7 @@ static int lwmi_events_probe(struct wmi_device *wdev, const void *context) if (!context) return -EINVAL; - priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&wdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/lenovo/wmi-gamezone.c b/drivers/platform/x86/lenovo/wmi-gamezone.c index 109c0b564a9f..94a57b0160cb 100644 --- a/drivers/platform/x86/lenovo/wmi-gamezone.c +++ b/drivers/platform/x86/lenovo/wmi-gamezone.c @@ -357,7 +357,7 @@ static int lwmi_gz_probe(struct wmi_device *wdev, const void *context) struct lwmi_gz_priv *priv; int ret; - priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&wdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/lenovo/wmi-hotkey-utilities.c b/drivers/platform/x86/lenovo/wmi-hotkey-utilities.c index 7b9bad1978ff..b3a254970810 100644 --- a/drivers/platform/x86/lenovo/wmi-hotkey-utilities.c +++ b/drivers/platform/x86/lenovo/wmi-hotkey-utilities.c @@ -191,7 +191,7 @@ static int lenovo_super_hotkey_wmi_probe(struct wmi_device *wdev, const void *co { struct lenovo_super_hotkey_wmi_private *wpriv; - wpriv = devm_kzalloc(&wdev->dev, sizeof(*wpriv), GFP_KERNEL); + wpriv = devm_kzalloc_obj(&wdev->dev, *wpriv); if (!wpriv) return -ENOMEM; diff --git a/drivers/platform/x86/lenovo/wmi-other.c b/drivers/platform/x86/lenovo/wmi-other.c index cecb89bb08eb..bd64e7b44669 100644 --- a/drivers/platform/x86/lenovo/wmi-other.c +++ b/drivers/platform/x86/lenovo/wmi-other.c @@ -1694,7 +1694,7 @@ static int lwmi_other_probe(struct wmi_device *wdev, const void *context) struct component_match *master_match = NULL; struct lwmi_om_priv *priv; - priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&wdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/lenovo/yb9-kbdock.c b/drivers/platform/x86/lenovo/yb9-kbdock.c index 70d81f3af09e..2efab9d07a41 100644 --- a/drivers/platform/x86/lenovo/yb9-kbdock.c +++ b/drivers/platform/x86/lenovo/yb9-kbdock.c @@ -194,7 +194,7 @@ static int yb9_kbdock_block_probe(struct wmi_device *wdev, const void *ctx) struct input_dev *input_dev; int ret; - d = devm_kzalloc(&wdev->dev, sizeof(*d), GFP_KERNEL); + d = devm_kzalloc_obj(&wdev->dev, *d); if (!d) return -ENOMEM; diff --git a/drivers/platform/x86/lenovo/ymc.c b/drivers/platform/x86/lenovo/ymc.c index df96107d2501..91de02d989a0 100644 --- a/drivers/platform/x86/lenovo/ymc.c +++ b/drivers/platform/x86/lenovo/ymc.c @@ -133,7 +133,7 @@ static int lenovo_ymc_probe(struct wmi_device *wdev, const void *ctx) return -ENODEV; } - priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&wdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c b/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c index 8551ab4d2c7d..9e2ac80edbed 100644 --- a/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c +++ b/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c @@ -154,7 +154,7 @@ static int yt2_1380_fc_serdev_probe(struct serdev_device *serdev) struct yt2_1380_fc *fc; int ret; - fc = devm_kzalloc(dev, sizeof(*fc), GFP_KERNEL); + fc = devm_kzalloc_obj(dev, *fc); if (!fc) return -ENOMEM; diff --git a/drivers/platform/x86/lenovo/yogabook.c b/drivers/platform/x86/lenovo/yogabook.c index f35c307300c2..ea8173200ed2 100644 --- a/drivers/platform/x86/lenovo/yogabook.c +++ b/drivers/platform/x86/lenovo/yogabook.c @@ -332,7 +332,7 @@ static int yogabook_wmi_probe(struct wmi_device *wdev, const void *context) struct yogabook_data *data; int r; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; @@ -449,7 +449,7 @@ static int yogabook_pdev_probe(struct platform_device *pdev) struct yogabook_data *data; int r; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/msi-wmi-platform.c b/drivers/platform/x86/msi-wmi-platform.c index e912fcc12d12..af0797db7ec4 100644 --- a/drivers/platform/x86/msi-wmi-platform.c +++ b/drivers/platform/x86/msi-wmi-platform.c @@ -298,7 +298,7 @@ static void msi_wmi_platform_debugfs_add(struct msi_wmi_platform_data *drvdata, struct msi_wmi_platform_debugfs_data *data; struct dentry *entry; - data = devm_kzalloc(&drvdata->wdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&drvdata->wdev->dev, *data); if (!data) return; @@ -410,7 +410,7 @@ static int msi_wmi_platform_probe(struct wmi_device *wdev, const void *context) struct msi_wmi_platform_data *data; int ret; - data = devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&wdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/quickstart.c b/drivers/platform/x86/quickstart.c index 186a243a012d..2c59d6245161 100644 --- a/drivers/platform/x86/quickstart.c +++ b/drivers/platform/x86/quickstart.c @@ -164,7 +164,7 @@ static int quickstart_probe(struct platform_device *pdev) if (!handle) return -ENODEV; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/redmi-wmi.c b/drivers/platform/x86/redmi-wmi.c index cc82ef502002..a8eabd93ff3e 100644 --- a/drivers/platform/x86/redmi-wmi.c +++ b/drivers/platform/x86/redmi-wmi.c @@ -70,7 +70,7 @@ static int redmi_wmi_probe(struct wmi_device *wdev, const void *context) int err; /* Init dev */ - data = devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&wdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c index 88ef11004ad0..b150e1fc347a 100644 --- a/drivers/platform/x86/samsung-galaxybook.c +++ b/drivers/platform/x86/samsung-galaxybook.c @@ -1003,12 +1003,12 @@ static int galaxybook_fw_attr_init(struct samsung_galaxybook *galaxybook, struct galaxybook_fw_attr *fw_attr; struct attribute **attrs; - fw_attr = devm_kzalloc(&galaxybook->platform->dev, sizeof(*fw_attr), GFP_KERNEL); + fw_attr = devm_kzalloc_obj(&galaxybook->platform->dev, *fw_attr); if (!fw_attr) return -ENOMEM; - attrs = devm_kcalloc(&galaxybook->platform->dev, NUM_FW_ATTR_ENUM_ATTRS + 1, - sizeof(*attrs), GFP_KERNEL); + attrs = devm_kzalloc_objs(&galaxybook->platform->dev, *attrs, + NUM_FW_ATTR_ENUM_ATTRS + 1); if (!attrs) return -ENOMEM; @@ -1375,7 +1375,7 @@ static int galaxybook_probe(struct platform_device *pdev) if (!adev) return -ENODEV; - galaxybook = devm_kzalloc(&pdev->dev, sizeof(*galaxybook), GFP_KERNEL); + galaxybook = devm_kzalloc_obj(&pdev->dev, *galaxybook); if (!galaxybook) return -ENOMEM; diff --git a/drivers/platform/x86/sel3350-platform.c b/drivers/platform/x86/sel3350-platform.c index f3a314235632..2983f102482d 100644 --- a/drivers/platform/x86/sel3350-platform.c +++ b/drivers/platform/x86/sel3350-platform.c @@ -209,7 +209,7 @@ static int sel3350_probe(struct platform_device *pdev) struct sel3350_data *sel3350; struct power_supply_config ps_cfg = {}; - sel3350 = devm_kzalloc(&pdev->dev, sizeof(struct sel3350_data), GFP_KERNEL); + sel3350 = devm_kzalloc_obj(&pdev->dev, struct sel3350_data); if (!sel3350) return -ENOMEM; diff --git a/drivers/platform/x86/serial-multi-instantiate.c b/drivers/platform/x86/serial-multi-instantiate.c index d535025a3f73..ffec4f0a4992 100644 --- a/drivers/platform/x86/serial-multi-instantiate.c +++ b/drivers/platform/x86/serial-multi-instantiate.c @@ -125,7 +125,7 @@ static int smi_spi_probe(struct platform_device *pdev, struct smi *smi, count = ret; - smi->spi_devs = devm_kcalloc(dev, count, sizeof(*smi->spi_devs), GFP_KERNEL); + smi->spi_devs = devm_kzalloc_objs(dev, *smi->spi_devs, count); if (!smi->spi_devs) return -ENOMEM; @@ -208,7 +208,7 @@ static int smi_i2c_probe(struct platform_device *pdev, struct smi *smi, count = ret; - smi->i2c_devs = devm_kcalloc(dev, count, sizeof(*smi->i2c_devs), GFP_KERNEL); + smi->i2c_devs = devm_kzalloc_objs(dev, *smi->i2c_devs, count); if (!smi->i2c_devs) return -ENOMEM; @@ -259,7 +259,7 @@ static int smi_probe(struct platform_device *pdev) return -ENODEV; } - smi = devm_kzalloc(dev, sizeof(*smi), GFP_KERNEL); + smi = devm_kzalloc_obj(dev, *smi); if (!smi) return -ENOMEM; diff --git a/drivers/platform/x86/silicom-platform.c b/drivers/platform/x86/silicom-platform.c index 266f7bc5e416..5f8641604690 100644 --- a/drivers/platform/x86/silicom-platform.c +++ b/drivers/platform/x86/silicom-platform.c @@ -732,7 +732,7 @@ static int __init silicom_mc_leds_register(struct device *dev, for (i = 0; mc_leds[i].led_cdev.name; i++) { - led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(dev, *led); if (!led) return -ENOMEM; memcpy(led, &mc_leds[i], sizeof(*led)); diff --git a/drivers/platform/x86/system76_acpi.c b/drivers/platform/x86/system76_acpi.c index dd7b1b07c316..ce72e50e686a 100644 --- a/drivers/platform/x86/system76_acpi.c +++ b/drivers/platform/x86/system76_acpi.c @@ -682,7 +682,7 @@ static int system76_probe(struct platform_device *pdev) if (!acpi_dev) return -ENODEV; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/toshiba_haps.c b/drivers/platform/x86/toshiba_haps.c index b2eb91929d1d..403a3d94fa3e 100644 --- a/drivers/platform/x86/toshiba_haps.c +++ b/drivers/platform/x86/toshiba_haps.c @@ -196,7 +196,7 @@ static int toshiba_haps_probe(struct platform_device *pdev) pr_info("Toshiba HDD Active Protection Sensor device\n"); - haps = devm_kzalloc(&pdev->dev, sizeof(*haps), GFP_KERNEL); + haps = devm_kzalloc_obj(&pdev->dev, *haps); if (!haps) return -ENOMEM; diff --git a/drivers/platform/x86/tuxedo/nb04/wmi_ab.c b/drivers/platform/x86/tuxedo/nb04/wmi_ab.c index 3e5ba524fe58..5c56c6b1a85e 100644 --- a/drivers/platform/x86/tuxedo/nb04/wmi_ab.c +++ b/drivers/platform/x86/tuxedo/nb04/wmi_ab.c @@ -433,7 +433,7 @@ static int tux_ll_start(struct hid_device *hdev) u8 keyboard_type; int ret; - driver_data = devm_kzalloc(&hdev->dev, sizeof(*driver_data), GFP_KERNEL); + driver_data = devm_kzalloc_obj(&hdev->dev, *driver_data); if (!driver_data) return -ENOMEM; @@ -868,7 +868,7 @@ static int tux_probe(struct wmi_device *wdev, const void *context __always_unuse { struct tux_driver_data_t *driver_data; - driver_data = devm_kzalloc(&wdev->dev, sizeof(*driver_data), GFP_KERNEL); + driver_data = devm_kzalloc_obj(&wdev->dev, *driver_data); if (!driver_data) return -ENOMEM; diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform/x86/uniwill/uniwill-acpi.c index f62d59f29676..485d57045da8 100644 --- a/drivers/platform/x86/uniwill/uniwill-acpi.c +++ b/drivers/platform/x86/uniwill/uniwill-acpi.c @@ -2366,7 +2366,7 @@ static int uniwill_probe(struct platform_device *pdev) if (!handle) return -ENODEV; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c index 7532af2d72d1..0ee2531c3891 100644 --- a/drivers/platform/x86/x86-android-tablets/other.c +++ b/drivers/platform/x86/x86-android-tablets/other.c @@ -832,7 +832,7 @@ static int __init xiaomi_mipad2_init(struct device *dev) if (IS_ERR(xiaomi_mipad2_led_pwm)) return dev_err_probe(dev, PTR_ERR(xiaomi_mipad2_led_pwm), "getting pwm\n"); - led_cdev = devm_kzalloc(dev, sizeof(*led_cdev), GFP_KERNEL); + led_cdev = devm_kzalloc_obj(dev, *led_cdev); if (!led_cdev) return -ENOMEM; diff --git a/drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.c b/drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.c index 67dba9aa51f6..90d925f3543b 100644 --- a/drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.c +++ b/drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.c @@ -216,7 +216,7 @@ static int atla10_ec_probe(struct i2c_client *client) struct atla10_ec_data *data; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/platform/x86/xiaomi-wmi.c b/drivers/platform/x86/xiaomi-wmi.c index 3874f3336a0d..60226ccb3d90 100644 --- a/drivers/platform/x86/xiaomi-wmi.c +++ b/drivers/platform/x86/xiaomi-wmi.c @@ -33,7 +33,7 @@ static int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context) if (!context) return -EINVAL; - data = devm_kzalloc(&wdev->dev, sizeof(struct xiaomi_wmi), GFP_KERNEL); + data = devm_kzalloc_obj(&wdev->dev, struct xiaomi_wmi); if (data == NULL) return -ENOMEM; dev_set_drvdata(&wdev->dev, data); diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c index 4c3185e2ceec..bbc8a87d904d 100644 --- a/drivers/platform/x86/xo15-ebook.c +++ b/drivers/platform/x86/xo15-ebook.c @@ -86,7 +86,7 @@ static int ebook_switch_probe(struct platform_device *pdev) struct input_dev *input; int error; - button = devm_kzalloc(dev, sizeof(*button), GFP_KERNEL); + button = devm_kzalloc_obj(dev, *button); if (!button) return -ENOMEM; diff --git a/drivers/pmdomain/actions/owl-sps.c b/drivers/pmdomain/actions/owl-sps.c index bf5eb80cc3b4..793c63f30635 100644 --- a/drivers/pmdomain/actions/owl-sps.c +++ b/drivers/pmdomain/actions/owl-sps.c @@ -77,7 +77,7 @@ static int owl_sps_init_domain(struct owl_sps *sps, int index) { struct owl_sps_domain *pd; - pd = devm_kzalloc(sps->dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(sps->dev, *pd); if (!pd) return -ENOMEM; @@ -107,9 +107,8 @@ static int owl_sps_probe(struct platform_device *pdev) return -EINVAL; } - sps = devm_kzalloc(&pdev->dev, - struct_size(sps, domains, sps_info->num_domains), - GFP_KERNEL); + sps = devm_kzalloc_flex(&pdev->dev, *sps, domains, + sps_info->num_domains); if (!sps) return -ENOMEM; diff --git a/drivers/pmdomain/amlogic/meson-ee-pwrc.c b/drivers/pmdomain/amlogic/meson-ee-pwrc.c index 55c8c9f66a1b..338f70d77bf0 100644 --- a/drivers/pmdomain/amlogic/meson-ee-pwrc.c +++ b/drivers/pmdomain/amlogic/meson-ee-pwrc.c @@ -511,18 +511,18 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev) return -ENODEV; } - pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); + pwrc = devm_kzalloc_obj(&pdev->dev, *pwrc); if (!pwrc) return -ENOMEM; - pwrc->xlate.domains = devm_kcalloc(&pdev->dev, match->count, - sizeof(*pwrc->xlate.domains), - GFP_KERNEL); + pwrc->xlate.domains = devm_kzalloc_objs(&pdev->dev, + *pwrc->xlate.domains, + match->count); if (!pwrc->xlate.domains) return -ENOMEM; - pwrc->domains = devm_kcalloc(&pdev->dev, match->count, - sizeof(*pwrc->domains), GFP_KERNEL); + pwrc->domains = devm_kzalloc_objs(&pdev->dev, *pwrc->domains, + match->count); if (!pwrc->domains) return -ENOMEM; diff --git a/drivers/pmdomain/amlogic/meson-secure-pwrc.c b/drivers/pmdomain/amlogic/meson-secure-pwrc.c index 133549956efa..c424a1e76174 100644 --- a/drivers/pmdomain/amlogic/meson-secure-pwrc.c +++ b/drivers/pmdomain/amlogic/meson-secure-pwrc.c @@ -411,7 +411,7 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev) return -ENODEV; } - pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); + pwrc = devm_kzalloc_obj(&pdev->dev, *pwrc); if (!pwrc) { of_node_put(sm_np); return -ENOMEM; @@ -422,14 +422,14 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev) if (!pwrc->fw) return -EPROBE_DEFER; - pwrc->xlate.domains = devm_kcalloc(&pdev->dev, match->count, - sizeof(*pwrc->xlate.domains), - GFP_KERNEL); + pwrc->xlate.domains = devm_kzalloc_objs(&pdev->dev, + *pwrc->xlate.domains, + match->count); if (!pwrc->xlate.domains) return -ENOMEM; - pwrc->domains = devm_kcalloc(&pdev->dev, match->count, - sizeof(*pwrc->domains), GFP_KERNEL); + pwrc->domains = devm_kzalloc_objs(&pdev->dev, *pwrc->domains, + match->count); if (!pwrc->domains) return -ENOMEM; diff --git a/drivers/pmdomain/apple/pmgr-pwrstate.c b/drivers/pmdomain/apple/pmgr-pwrstate.c index 82c33cf727a8..1f6c88481152 100644 --- a/drivers/pmdomain/apple/pmgr-pwrstate.c +++ b/drivers/pmdomain/apple/pmgr-pwrstate.c @@ -205,7 +205,7 @@ static int apple_pmgr_ps_probe(struct platform_device *pdev) if (IS_ERR(regmap)) return PTR_ERR(regmap); - ps = devm_kzalloc(dev, sizeof(*ps), GFP_KERNEL); + ps = devm_kzalloc_obj(dev, *ps); if (!ps) return -ENOMEM; diff --git a/drivers/pmdomain/arm/scmi_perf_domain.c b/drivers/pmdomain/arm/scmi_perf_domain.c index e390f902a444..b1d20fecaf3e 100644 --- a/drivers/pmdomain/arm/scmi_perf_domain.c +++ b/drivers/pmdomain/arm/scmi_perf_domain.c @@ -105,15 +105,15 @@ static int scmi_perf_domain_probe(struct scmi_device *sdev) return 0; } - scmi_pd = devm_kcalloc(dev, num_domains, sizeof(*scmi_pd), GFP_KERNEL); + scmi_pd = devm_kzalloc_objs(dev, *scmi_pd, num_domains); if (!scmi_pd) return -ENOMEM; - scmi_pd_data = devm_kzalloc(dev, sizeof(*scmi_pd_data), GFP_KERNEL); + scmi_pd_data = devm_kzalloc_obj(dev, *scmi_pd_data); if (!scmi_pd_data) return -ENOMEM; - domains = devm_kcalloc(dev, num_domains, sizeof(*domains), GFP_KERNEL); + domains = devm_kzalloc_objs(dev, *domains, num_domains); if (!domains) return -ENOMEM; diff --git a/drivers/pmdomain/arm/scmi_pm_domain.c b/drivers/pmdomain/arm/scmi_pm_domain.c index 3d73aef21d2f..fff7b4f438ca 100644 --- a/drivers/pmdomain/arm/scmi_pm_domain.c +++ b/drivers/pmdomain/arm/scmi_pm_domain.c @@ -63,15 +63,15 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev) return num_domains; } - scmi_pd = devm_kcalloc(dev, num_domains, sizeof(*scmi_pd), GFP_KERNEL); + scmi_pd = devm_kzalloc_objs(dev, *scmi_pd, num_domains); if (!scmi_pd) return -ENOMEM; - scmi_pd_data = devm_kzalloc(dev, sizeof(*scmi_pd_data), GFP_KERNEL); + scmi_pd_data = devm_kzalloc_obj(dev, *scmi_pd_data); if (!scmi_pd_data) return -ENOMEM; - domains = devm_kcalloc(dev, num_domains, sizeof(*domains), GFP_KERNEL); + domains = devm_kzalloc_objs(dev, *domains, num_domains); if (!domains) return -ENOMEM; diff --git a/drivers/pmdomain/arm/scpi_pm_domain.c b/drivers/pmdomain/arm/scpi_pm_domain.c index 2231e6dd2070..1d55a9e548e0 100644 --- a/drivers/pmdomain/arm/scpi_pm_domain.c +++ b/drivers/pmdomain/arm/scpi_pm_domain.c @@ -93,15 +93,15 @@ static int scpi_pm_domain_probe(struct platform_device *pdev) return -EINVAL; } - scpi_pd = devm_kcalloc(dev, num_domains, sizeof(*scpi_pd), GFP_KERNEL); + scpi_pd = devm_kzalloc_objs(dev, *scpi_pd, num_domains); if (!scpi_pd) return -ENOMEM; - scpi_pd_data = devm_kzalloc(dev, sizeof(*scpi_pd_data), GFP_KERNEL); + scpi_pd_data = devm_kzalloc_obj(dev, *scpi_pd_data); if (!scpi_pd_data) return -ENOMEM; - domains = devm_kcalloc(dev, num_domains, sizeof(*domains), GFP_KERNEL); + domains = devm_kzalloc_objs(dev, *domains, num_domains); if (!domains) return -ENOMEM; diff --git a/drivers/pmdomain/bcm/bcm-pmb.c b/drivers/pmdomain/bcm/bcm-pmb.c index a72ba26ecf9d..d074c8cf2038 100644 --- a/drivers/pmdomain/bcm/bcm-pmb.c +++ b/drivers/pmdomain/bcm/bcm-pmb.c @@ -279,7 +279,7 @@ static int bcm_pmb_probe(struct platform_device *pdev) int max_id; int err; - pmb = devm_kzalloc(dev, sizeof(*pmb), GFP_KERNEL); + pmb = devm_kzalloc_obj(dev, *pmb); if (!pmb) return -ENOMEM; @@ -303,13 +303,13 @@ static int bcm_pmb_probe(struct platform_device *pdev) pmb->genpd_onecell_data.num_domains = max_id + 1; pmb->genpd_onecell_data.domains = - devm_kcalloc(dev, pmb->genpd_onecell_data.num_domains, - sizeof(struct generic_pm_domain *), GFP_KERNEL); + devm_kzalloc_objs(dev, struct generic_pm_domain *, + pmb->genpd_onecell_data.num_domains); if (!pmb->genpd_onecell_data.domains) return -ENOMEM; for (e = table; e->name; e++) { - struct bcm_pmb_pm_domain *pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); + struct bcm_pmb_pm_domain *pd = devm_kzalloc_obj(dev, *pd); if (!pd) return -ENOMEM; diff --git a/drivers/pmdomain/bcm/bcm2835-power.c b/drivers/pmdomain/bcm/bcm2835-power.c index fad3113093d5..6fd48e34a68d 100644 --- a/drivers/pmdomain/bcm/bcm2835-power.c +++ b/drivers/pmdomain/bcm/bcm2835-power.c @@ -621,7 +621,7 @@ static int bcm2835_power_probe(struct platform_device *pdev) int ret = 0, i; u32 id; - power = devm_kzalloc(dev, sizeof(*power), GFP_KERNEL); + power = devm_kzalloc_obj(dev, *power); if (!power) return -ENOMEM; platform_set_drvdata(pdev, power); @@ -648,10 +648,9 @@ static int bcm2835_power_probe(struct platform_device *pdev) } } - power->pd_xlate.domains = devm_kcalloc(dev, - ARRAY_SIZE(power_domain_names), - sizeof(*power->pd_xlate.domains), - GFP_KERNEL); + power->pd_xlate.domains = devm_kzalloc_objs(dev, + *power->pd_xlate.domains, + ARRAY_SIZE(power_domain_names)); if (!power->pd_xlate.domains) return -ENOMEM; diff --git a/drivers/pmdomain/bcm/bcm63xx-power.c b/drivers/pmdomain/bcm/bcm63xx-power.c index 98b0c2430dbc..9454f9066709 100644 --- a/drivers/pmdomain/bcm/bcm63xx-power.c +++ b/drivers/pmdomain/bcm/bcm63xx-power.c @@ -96,7 +96,7 @@ static int bcm63xx_power_probe(struct platform_device *pdev) uint8_t max_bit = 0; int ret; - power = devm_kzalloc(dev, sizeof(*power), GFP_KERNEL); + power = devm_kzalloc_obj(dev, *power); if (!power) return -ENOMEM; @@ -120,15 +120,13 @@ static int bcm63xx_power_probe(struct platform_device *pdev) power->genpd_data.num_domains = max_bit + 1; - power->dev = devm_kcalloc(dev, power->genpd_data.num_domains, - sizeof(struct bcm63xx_power_dev), - GFP_KERNEL); + power->dev = devm_kzalloc_objs(dev, struct bcm63xx_power_dev, + power->genpd_data.num_domains); if (!power->dev) return -ENOMEM; - power->genpd = devm_kcalloc(dev, power->genpd_data.num_domains, - sizeof(struct generic_pm_domain *), - GFP_KERNEL); + power->genpd = devm_kzalloc_objs(dev, struct generic_pm_domain *, + power->genpd_data.num_domains); if (!power->genpd) return -ENOMEM; diff --git a/drivers/pmdomain/bcm/raspberrypi-power.c b/drivers/pmdomain/bcm/raspberrypi-power.c index b87ea7adb7be..1304c5545f36 100644 --- a/drivers/pmdomain/bcm/raspberrypi-power.c +++ b/drivers/pmdomain/bcm/raspberrypi-power.c @@ -164,15 +164,13 @@ static int rpi_power_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct rpi_power_domains *rpi_domains; - rpi_domains = devm_kzalloc(dev, sizeof(*rpi_domains), GFP_KERNEL); + rpi_domains = devm_kzalloc_obj(dev, *rpi_domains); if (!rpi_domains) return -ENOMEM; rpi_domains->xlate.domains = - devm_kcalloc(dev, - RPI_POWER_DOMAIN_COUNT, - sizeof(*rpi_domains->xlate.domains), - GFP_KERNEL); + devm_kzalloc_objs(dev, *rpi_domains->xlate.domains, + RPI_POWER_DOMAIN_COUNT); if (!rpi_domains->xlate.domains) return -ENOMEM; diff --git a/drivers/pmdomain/imx/imx8m-blk-ctrl.c b/drivers/pmdomain/imx/imx8m-blk-ctrl.c index 14fb969bba28..9df933a7a238 100644 --- a/drivers/pmdomain/imx/imx8m-blk-ctrl.c +++ b/drivers/pmdomain/imx/imx8m-blk-ctrl.c @@ -206,7 +206,7 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev) .reg_stride = 4, }; - bc = devm_kzalloc(dev, sizeof(*bc), GFP_KERNEL); + bc = devm_kzalloc_obj(dev, *bc); if (!bc) return -ENOMEM; @@ -228,16 +228,15 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(bc->regmap), "failed to init regmap\n"); - bc->domains = devm_kcalloc(dev, bc_data->num_domains, - sizeof(struct imx8m_blk_ctrl_domain), - GFP_KERNEL); + bc->domains = devm_kzalloc_objs(dev, struct imx8m_blk_ctrl_domain, + bc_data->num_domains); if (!bc->domains) return -ENOMEM; bc->onecell_data.num_domains = bc_data->num_domains; bc->onecell_data.domains = - devm_kcalloc(dev, bc_data->num_domains, - sizeof(struct generic_pm_domain *), GFP_KERNEL); + devm_kzalloc_objs(dev, struct generic_pm_domain *, + bc_data->num_domains); if (!bc->onecell_data.domains) return -ENOMEM; diff --git a/drivers/pmdomain/imx/imx8mp-blk-ctrl.c b/drivers/pmdomain/imx/imx8mp-blk-ctrl.c index d255c20f58e2..212d491c75e4 100644 --- a/drivers/pmdomain/imx/imx8mp-blk-ctrl.c +++ b/drivers/pmdomain/imx/imx8mp-blk-ctrl.c @@ -153,7 +153,7 @@ static int imx8mp_hsio_blk_ctrl_probe(struct imx8mp_blk_ctrl *bc) struct clk_init_data init = {}; int ret; - clk_hsio_pll = devm_kzalloc(bc->dev, sizeof(*clk_hsio_pll), GFP_KERNEL); + clk_hsio_pll = devm_kzalloc_obj(bc->dev, *clk_hsio_pll); if (!clk_hsio_pll) return -ENOMEM; @@ -622,7 +622,7 @@ static int imx8mp_blk_ctrl_probe(struct platform_device *pdev) .reg_stride = 4, }; - bc = devm_kzalloc(dev, sizeof(*bc), GFP_KERNEL); + bc = devm_kzalloc_obj(dev, *bc); if (!bc) return -ENOMEM; @@ -641,16 +641,14 @@ static int imx8mp_blk_ctrl_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(bc->regmap), "failed to init regmap\n"); - bc->domains = devm_kcalloc(dev, num_domains, - sizeof(struct imx8mp_blk_ctrl_domain), - GFP_KERNEL); + bc->domains = devm_kzalloc_objs(dev, struct imx8mp_blk_ctrl_domain, + num_domains); if (!bc->domains) return -ENOMEM; bc->onecell_data.num_domains = num_domains; bc->onecell_data.domains = - devm_kcalloc(dev, num_domains, - sizeof(struct generic_pm_domain *), GFP_KERNEL); + devm_kzalloc_objs(dev, struct generic_pm_domain *, num_domains); if (!bc->onecell_data.domains) return -ENOMEM; diff --git a/drivers/pmdomain/imx/imx93-blk-ctrl.c b/drivers/pmdomain/imx/imx93-blk-ctrl.c index 6d4c55a85c64..9ff38e3d5c6c 100644 --- a/drivers/pmdomain/imx/imx93-blk-ctrl.c +++ b/drivers/pmdomain/imx/imx93-blk-ctrl.c @@ -236,7 +236,7 @@ static int imx93_blk_ctrl_probe(struct platform_device *pdev) .max_register = SZ_4K, }; - bc = devm_kzalloc(dev, sizeof(*bc), GFP_KERNEL); + bc = devm_kzalloc_obj(dev, *bc); if (!bc) return -ENOMEM; @@ -251,16 +251,15 @@ static int imx93_blk_ctrl_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(bc->regmap), "failed to init regmap\n"); - bc->domains = devm_kcalloc(dev, bc_data->num_domains, - sizeof(struct imx93_blk_ctrl_domain), - GFP_KERNEL); + bc->domains = devm_kzalloc_objs(dev, struct imx93_blk_ctrl_domain, + bc_data->num_domains); if (!bc->domains) return -ENOMEM; bc->onecell_data.num_domains = bc_data->num_domains; bc->onecell_data.domains = - devm_kcalloc(dev, bc_data->num_domains, - sizeof(struct generic_pm_domain *), GFP_KERNEL); + devm_kzalloc_objs(dev, struct generic_pm_domain *, + bc_data->num_domains); if (!bc->onecell_data.domains) return -ENOMEM; @@ -325,7 +324,7 @@ static int imx93_blk_ctrl_probe(struct platform_device *pdev) data->parent == BLK_CTRL_NO_PARENT) continue; - link = devm_kzalloc(dev, sizeof(*link), GFP_KERNEL); + link = devm_kzalloc_obj(dev, *link); if (!link) return -ENOMEM; diff --git a/drivers/pmdomain/imx/imx93-pd.c b/drivers/pmdomain/imx/imx93-pd.c index 50d1eb852f75..75c315ca3729 100644 --- a/drivers/pmdomain/imx/imx93-pd.c +++ b/drivers/pmdomain/imx/imx93-pd.c @@ -100,7 +100,7 @@ static int imx93_pd_probe(struct platform_device *pdev) bool init_off; int ret; - domain = devm_kzalloc(dev, sizeof(*domain), GFP_KERNEL); + domain = devm_kzalloc_obj(dev, *domain); if (!domain) return -ENOMEM; diff --git a/drivers/pmdomain/imx/scu-pd.c b/drivers/pmdomain/imx/scu-pd.c index 05d4364f34be..32864dd7d17d 100644 --- a/drivers/pmdomain/imx/scu-pd.c +++ b/drivers/pmdomain/imx/scu-pd.c @@ -420,7 +420,7 @@ imx_scu_add_pm_domain(struct device *dev, int idx, if (!imx_sc_rm_is_resource_owned(pm_ipc_handle, pd_ranges->rsrc + idx)) return NULL; - sc_pd = devm_kzalloc(dev, sizeof(*sc_pd), GFP_KERNEL); + sc_pd = devm_kzalloc_obj(dev, *sc_pd); if (!sc_pd) return ERR_PTR(-ENOMEM); @@ -479,11 +479,11 @@ static int imx_scu_init_pm_domains(struct device *dev, for (i = 0; i < pd_soc->num_ranges; i++) count += pd_ranges[i].num; - domains = devm_kcalloc(dev, count, sizeof(*domains), GFP_KERNEL); + domains = devm_kzalloc_objs(dev, *domains, count); if (!domains) return -ENOMEM; - pd_data = devm_kzalloc(dev, sizeof(*pd_data), GFP_KERNEL); + pd_data = devm_kzalloc_obj(dev, *pd_data); if (!pd_data) return -ENOMEM; diff --git a/drivers/pmdomain/marvell/pxa1908-power-controller.c b/drivers/pmdomain/marvell/pxa1908-power-controller.c index 4a957ab0e4f5..a156541803d8 100644 --- a/drivers/pmdomain/marvell/pxa1908-power-controller.c +++ b/drivers/pmdomain/marvell/pxa1908-power-controller.c @@ -259,7 +259,7 @@ pxa1908_pd_probe(struct auxiliary_device *auxdev, const struct auxiliary_device_ struct device *dev = &auxdev->dev; int ret; - ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(dev, *ctrl); if (!ctrl) return -ENOMEM; diff --git a/drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c b/drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c index 5efd7a38f4da..03556fb0cccf 100644 --- a/drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c +++ b/drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c @@ -70,7 +70,7 @@ static int airoha_cpu_pmdomain_probe(struct platform_device *pdev) struct generic_pm_domain *pd; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c b/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c index 1417ffc22b3e..093f8fac2a2c 100644 --- a/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c +++ b/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c @@ -537,14 +537,14 @@ static int mtk_mfg_read_opp_tables(struct mtk_mfg *mfg) return -EINVAL; } - mfg->gpu_opps = devm_kcalloc(dev, mfg->num_gpu_opps, - sizeof(struct dev_pm_opp_data), GFP_KERNEL); + mfg->gpu_opps = devm_kzalloc_objs(dev, struct dev_pm_opp_data, + mfg->num_gpu_opps); if (!mfg->gpu_opps) return -ENOMEM; if (mfg->num_stack_opps) { - mfg->stack_opps = devm_kcalloc(dev, mfg->num_stack_opps, - sizeof(struct dev_pm_opp_data), GFP_KERNEL); + mfg->stack_opps = devm_kzalloc_objs(dev, struct dev_pm_opp_data, + mfg->num_stack_opps); if (!mfg->stack_opps) return -ENOMEM; } @@ -782,7 +782,7 @@ static int mtk_mfg_init_mbox(struct mtk_mfg *mfg) struct mtk_mfg_mbox *gf; struct mtk_mfg_mbox *slp; - gf = devm_kzalloc(dev, sizeof(*gf), GFP_KERNEL); + gf = devm_kzalloc_obj(dev, *gf); if (!gf) return -ENOMEM; @@ -801,7 +801,7 @@ static int mtk_mfg_init_mbox(struct mtk_mfg *mfg) mfg->gf_mbox = gf; - slp = devm_kzalloc(dev, sizeof(*slp), GFP_KERNEL); + slp = devm_kzalloc_obj(dev, *slp); if (!slp) return -ENOMEM; @@ -827,7 +827,7 @@ static int mtk_mfg_init_clk_provider(struct mtk_mfg *mfg) struct clk_hw_onecell_data *clk_data; int ret; - clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, 2), GFP_KERNEL); + clk_data = devm_kzalloc_flex(dev, *clk_data, hws, 2); if (!clk_data) return -ENOMEM; @@ -916,7 +916,7 @@ static int mtk_mfg_probe(struct platform_device *pdev) struct resource res; int ret, i; - mfg = devm_kzalloc(dev, sizeof(*mfg), GFP_KERNEL); + mfg = devm_kzalloc_obj(dev, *mfg); if (!mfg) return -ENOMEM; @@ -940,8 +940,7 @@ static int mtk_mfg_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(mfg->clk_eb), "Couldn't get 'eb' clock\n"); - mfg->gpu_clks = devm_kcalloc(dev, data->num_clks, sizeof(*mfg->gpu_clks), - GFP_KERNEL); + mfg->gpu_clks = devm_kzalloc_objs(dev, *mfg->gpu_clks, data->num_clks); if (!mfg->gpu_clks) return -ENOMEM; @@ -952,8 +951,8 @@ static int mtk_mfg_probe(struct platform_device *pdev) if (ret) return dev_err_probe(dev, ret, "Couldn't get GPU clocks\n"); - mfg->gpu_regs = devm_kcalloc(dev, data->num_regulators, - sizeof(*mfg->gpu_regs), GFP_KERNEL); + mfg->gpu_regs = devm_kzalloc_objs(dev, *mfg->gpu_regs, + data->num_regulators); if (!mfg->gpu_regs) return -ENOMEM; diff --git a/drivers/pmdomain/mediatek/mtk-pm-domains.c b/drivers/pmdomain/mediatek/mtk-pm-domains.c index f0fa79e01f9c..5f85db3fc539 100644 --- a/drivers/pmdomain/mediatek/mtk-pm-domains.c +++ b/drivers/pmdomain/mediatek/mtk-pm-domains.c @@ -892,7 +892,7 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no return ERR_PTR(-EINVAL); } - pd = devm_kzalloc(scpsys->dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(scpsys->dev, *pd); if (!pd) return ERR_PTR(-ENOMEM); @@ -921,12 +921,14 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no pd->num_clks++; } - pd->clks = devm_kcalloc(scpsys->dev, pd->num_clks, sizeof(*pd->clks), GFP_KERNEL); + pd->clks = devm_kzalloc_objs(scpsys->dev, *pd->clks, + pd->num_clks); if (!pd->clks) return ERR_PTR(-ENOMEM); - pd->subsys_clks = devm_kcalloc(scpsys->dev, pd->num_subsys_clks, - sizeof(*pd->subsys_clks), GFP_KERNEL); + pd->subsys_clks = devm_kzalloc_objs(scpsys->dev, + *pd->subsys_clks, + pd->num_subsys_clks); if (!pd->subsys_clks) return ERR_PTR(-ENOMEM); @@ -1215,8 +1217,8 @@ static int scpsys_get_bus_protection_legacy(struct device *dev, struct scpsys *s return 0; } - scpsys->bus_prot = devm_kmalloc_array(dev, num_regmaps, - sizeof(*scpsys->bus_prot), GFP_KERNEL); + scpsys->bus_prot = devm_kmalloc_objs(dev, *scpsys->bus_prot, + num_regmaps); if (!scpsys->bus_prot) return -ENOMEM; @@ -1248,8 +1250,8 @@ static int scpsys_get_bus_protection(struct device *dev, struct scpsys *scpsys) "Cannot get access controllers: expected %u, got %d\n", soc->num_bus_prot_blocks, num_handles); - scpsys->bus_prot = devm_kmalloc_array(dev, soc->num_bus_prot_blocks, - sizeof(*scpsys->bus_prot), GFP_KERNEL); + scpsys->bus_prot = devm_kmalloc_objs(dev, *scpsys->bus_prot, + soc->num_bus_prot_blocks); if (!scpsys->bus_prot) return -ENOMEM; @@ -1371,7 +1373,7 @@ static int scpsys_probe(struct platform_device *pdev) num_domains = soc->num_domains + soc->num_hwv_domains; - scpsys = devm_kzalloc(dev, struct_size(scpsys, domains, num_domains), GFP_KERNEL); + scpsys = devm_kzalloc_flex(dev, *scpsys, domains, num_domains); if (!scpsys) return -ENOMEM; diff --git a/drivers/pmdomain/mediatek/mtk-scpsys.c b/drivers/pmdomain/mediatek/mtk-scpsys.c index efc8f276ffce..5a3ef8ba1a25 100644 --- a/drivers/pmdomain/mediatek/mtk-scpsys.c +++ b/drivers/pmdomain/mediatek/mtk-scpsys.c @@ -429,7 +429,7 @@ static struct scp *init_scp(struct platform_device *pdev, struct scp *scp; struct clk *clk[CLK_MAX]; - scp = devm_kzalloc(&pdev->dev, sizeof(*scp), GFP_KERNEL); + scp = devm_kzalloc_obj(&pdev->dev, *scp); if (!scp) return ERR_PTR(-ENOMEM); @@ -444,15 +444,13 @@ static struct scp *init_scp(struct platform_device *pdev, if (IS_ERR(scp->base)) return ERR_CAST(scp->base); - scp->domains = devm_kcalloc(&pdev->dev, - num, sizeof(*scp->domains), GFP_KERNEL); + scp->domains = devm_kzalloc_objs(&pdev->dev, *scp->domains, num); if (!scp->domains) return ERR_PTR(-ENOMEM); pd_data = &scp->pd_data; - pd_data->domains = devm_kcalloc(&pdev->dev, - num, sizeof(*pd_data->domains), GFP_KERNEL); + pd_data->domains = devm_kzalloc_objs(&pdev->dev, *pd_data->domains, num); if (!pd_data->domains) return ERR_PTR(-ENOMEM); diff --git a/drivers/pmdomain/qcom/cpr.c b/drivers/pmdomain/qcom/cpr.c index c30690ef6919..4e86ffc85a5b 100644 --- a/drivers/pmdomain/qcom/cpr.c +++ b/drivers/pmdomain/qcom/cpr.c @@ -1086,9 +1086,8 @@ static int cpr_corner_init(struct cpr_drv *drv) corner = drv->corners; end = &corner[drv->num_corners - 1]; - cdata = devm_kcalloc(drv->dev, drv->num_corners, - sizeof(struct corner_data), - GFP_KERNEL); + cdata = devm_kzalloc_objs(drv->dev, struct corner_data, + drv->num_corners); if (!cdata) return -ENOMEM; @@ -1220,9 +1219,8 @@ static const struct cpr_fuse *cpr_get_fuses(struct cpr_drv *drv) struct cpr_fuse *fuses; int i; - fuses = devm_kcalloc(drv->dev, desc->num_fuse_corners, - sizeof(struct cpr_fuse), - GFP_KERNEL); + fuses = devm_kzalloc_objs(drv->dev, struct cpr_fuse, + desc->num_fuse_corners); if (!fuses) return ERR_PTR(-ENOMEM); @@ -1489,9 +1487,8 @@ static int cpr_pd_attach_dev(struct generic_pm_domain *domain, return -EINVAL; } - drv->corners = devm_kcalloc(drv->dev, drv->num_corners, - sizeof(*drv->corners), - GFP_KERNEL); + drv->corners = devm_kzalloc_objs(drv->dev, *drv->corners, + drv->num_corners); if (!drv->corners) return -ENOMEM; @@ -1601,9 +1598,8 @@ static int cpr_probe(struct platform_device *pdev) if (!data || !data->cpr_desc || !data->acc_desc) return -EINVAL; - drv = devm_kzalloc(dev, - struct_size(drv, fuse_corners, data->cpr_desc->num_fuse_corners), - GFP_KERNEL); + drv = devm_kzalloc_flex(dev, *drv, fuse_corners, + data->cpr_desc->num_fuse_corners); if (!drv) return -ENOMEM; drv->dev = dev; diff --git a/drivers/pmdomain/qcom/rpmhpd.c b/drivers/pmdomain/qcom/rpmhpd.c index fa8fed5bd3e5..919efa34e3a3 100644 --- a/drivers/pmdomain/qcom/rpmhpd.c +++ b/drivers/pmdomain/qcom/rpmhpd.c @@ -1178,12 +1178,11 @@ static int rpmhpd_probe(struct platform_device *pdev) rpmhpds = desc->rpmhpds; num_pds = desc->num_pds; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; - data->domains = devm_kcalloc(dev, num_pds, sizeof(*data->domains), - GFP_KERNEL); + data->domains = devm_kzalloc_objs(dev, *data->domains, num_pds); if (!data->domains) return -ENOMEM; diff --git a/drivers/pmdomain/qcom/rpmpd.c b/drivers/pmdomain/qcom/rpmpd.c index 5f55fc791131..1a952cdaa3f7 100644 --- a/drivers/pmdomain/qcom/rpmpd.c +++ b/drivers/pmdomain/qcom/rpmpd.c @@ -1103,12 +1103,11 @@ static int rpmpd_probe(struct platform_device *pdev) rpmpds = desc->rpmpds; num = desc->num_pds; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; - data->domains = devm_kcalloc(&pdev->dev, num, sizeof(*data->domains), - GFP_KERNEL); + data->domains = devm_kzalloc_objs(&pdev->dev, *data->domains, num); if (!data->domains) return -ENOMEM; diff --git a/drivers/pmdomain/renesas/r8a78000-mdlc.c b/drivers/pmdomain/renesas/r8a78000-mdlc.c index 1fd71bb3da77..75de869872de 100644 --- a/drivers/pmdomain/renesas/r8a78000-mdlc.c +++ b/drivers/pmdomain/renesas/r8a78000-mdlc.c @@ -236,7 +236,7 @@ static int r8a78000_mdlc_probe(struct platform_device *pdev) if (!info) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/pmdomain/riscv/riscv-rpmi-device-power.c b/drivers/pmdomain/riscv/riscv-rpmi-device-power.c index c7c46717dd73..86b58ab29ca5 100644 --- a/drivers/pmdomain/riscv/riscv-rpmi-device-power.c +++ b/drivers/pmdomain/riscv/riscv-rpmi-device-power.c @@ -336,7 +336,7 @@ static int rpmi_pm_domain_probe(struct platform_device *pdev) int ret; u32 i; - mpxy_ctx = devm_kzalloc(&pdev->dev, sizeof(*mpxy_ctx), GFP_KERNEL); + mpxy_ctx = devm_kzalloc_obj(&pdev->dev, *mpxy_ctx); if (!mpxy_ctx) return -ENOMEM; @@ -378,15 +378,15 @@ static int rpmi_pm_domain_probe(struct platform_device *pdev) dev_info(&pdev->dev, "%u MPXY PM domains are found\n", num_domains); - mpxy_pd = devm_kcalloc(&pdev->dev, num_domains, sizeof(*mpxy_pd), GFP_KERNEL); + mpxy_pd = devm_kzalloc_objs(&pdev->dev, *mpxy_pd, num_domains); if (!mpxy_pd) return -ENOMEM; - domains = devm_kcalloc(&pdev->dev, num_domains, sizeof(*domains), GFP_KERNEL); + domains = devm_kzalloc_objs(&pdev->dev, *domains, num_domains); if (!domains) return -ENOMEM; - mpxy_pd_data = devm_kzalloc(&pdev->dev, sizeof(*mpxy_pd_data), GFP_KERNEL); + mpxy_pd_data = devm_kzalloc_obj(&pdev->dev, *mpxy_pd_data); if (!mpxy_pd_data) return -ENOMEM; diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c index db3879846db6..6eca21e0bb12 100644 --- a/drivers/pmdomain/rockchip/pm-domains.c +++ b/drivers/pmdomain/rockchip/pm-domains.c @@ -827,7 +827,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu, return -EINVAL; } - pd = devm_kzalloc(pmu->dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(pmu->dev, *pd); if (!pd) return -ENOMEM; @@ -837,8 +837,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu, pd->num_clks = of_clk_get_parent_count(node); if (pd->num_clks > 0) { - pd->clks = devm_kcalloc(pmu->dev, pd->num_clks, - sizeof(*pd->clks), GFP_KERNEL); + pd->clks = devm_kzalloc_objs(pmu->dev, *pd->clks, pd->num_clks); if (!pd->clks) return -ENOMEM; } else { @@ -866,19 +865,16 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu, NULL); if (pd->num_qos > 0) { - pd->qos_regmap = devm_kcalloc(pmu->dev, pd->num_qos, - sizeof(*pd->qos_regmap), - GFP_KERNEL); + pd->qos_regmap = devm_kzalloc_objs(pmu->dev, *pd->qos_regmap, + pd->num_qos); if (!pd->qos_regmap) { error = -ENOMEM; goto err_unprepare_clocks; } for (j = 0; j < MAX_QOS_REGS_NUM; j++) { - pd->qos_save_regs[j] = devm_kcalloc(pmu->dev, - pd->num_qos, - sizeof(u32), - GFP_KERNEL); + pd->qos_save_regs[j] = devm_kzalloc_objs(pmu->dev, u32, + pd->num_qos); if (!pd->qos_save_regs[j]) { error = -ENOMEM; goto err_unprepare_clocks; @@ -1054,9 +1050,7 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev) pmu_info = device_get_match_data(dev); - pmu = devm_kzalloc(dev, - struct_size(pmu, domains, pmu_info->num_domains), - GFP_KERNEL); + pmu = devm_kzalloc_flex(dev, *pmu, domains, pmu_info->num_domains); if (!pmu) return -ENOMEM; diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c index 5c3aa8983087..c8c2ea06e990 100644 --- a/drivers/pmdomain/samsung/exynos-pm-domains.c +++ b/drivers/pmdomain/samsung/exynos-pm-domains.c @@ -112,7 +112,7 @@ static int exynos_pd_probe(struct platform_device *pdev) int on, ret; pm_domain_cfg = of_device_get_match_data(dev); - pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(dev, *pd); if (!pd) return -ENOMEM; diff --git a/drivers/pmdomain/starfive/jh71xx-pmu.c b/drivers/pmdomain/starfive/jh71xx-pmu.c index 74720c09a6e3..c48fadfd412a 100644 --- a/drivers/pmdomain/starfive/jh71xx-pmu.c +++ b/drivers/pmdomain/starfive/jh71xx-pmu.c @@ -291,7 +291,7 @@ static int jh71xx_pmu_init_domain(struct jh71xx_pmu *pmu, int index) int ret; bool is_on = false; - pmd = devm_kzalloc(pmu->dev, sizeof(*pmd), GFP_KERNEL); + pmd = devm_kzalloc_obj(pmu->dev, *pmd); if (!pmd) return -ENOMEM; @@ -325,7 +325,7 @@ static int jh71xx_pmu_probe(struct platform_device *pdev) unsigned int i; int ret; - pmu = devm_kzalloc(dev, sizeof(*pmu), GFP_KERNEL); + pmu = devm_kzalloc_obj(dev, *pmu); if (!pmu) return -ENOMEM; @@ -347,9 +347,8 @@ static int jh71xx_pmu_probe(struct platform_device *pdev) } } - pmu->genpd = devm_kcalloc(dev, match_data->num_domains, - sizeof(struct generic_pm_domain *), - GFP_KERNEL); + pmu->genpd = devm_kzalloc_objs(dev, struct generic_pm_domain *, + match_data->num_domains); if (!pmu->genpd) return -ENOMEM; diff --git a/drivers/pmdomain/sunxi/sun20i-ppu.c b/drivers/pmdomain/sunxi/sun20i-ppu.c index b65876a68cc1..6af1dcad4a76 100644 --- a/drivers/pmdomain/sunxi/sun20i-ppu.c +++ b/drivers/pmdomain/sunxi/sun20i-ppu.c @@ -114,16 +114,15 @@ static int sun20i_ppu_probe(struct platform_device *pdev) if (!desc) return -EINVAL; - pds = devm_kcalloc(dev, desc->num_domains, sizeof(*pds), GFP_KERNEL); + pds = devm_kzalloc_objs(dev, *pds, desc->num_domains); if (!pds) return -ENOMEM; - ppu = devm_kzalloc(dev, sizeof(*ppu), GFP_KERNEL); + ppu = devm_kzalloc_obj(dev, *ppu); if (!ppu) return -ENOMEM; - ppu->domains = devm_kcalloc(dev, desc->num_domains, - sizeof(*ppu->domains), GFP_KERNEL); + ppu->domains = devm_kzalloc_objs(dev, *ppu->domains, desc->num_domains); if (!ppu->domains) return -ENOMEM; diff --git a/drivers/pmdomain/sunxi/sun50i-h6-prcm-ppu.c b/drivers/pmdomain/sunxi/sun50i-h6-prcm-ppu.c index d59644499dfe..cde5a27e0809 100644 --- a/drivers/pmdomain/sunxi/sun50i-h6-prcm-ppu.c +++ b/drivers/pmdomain/sunxi/sun50i-h6-prcm-ppu.c @@ -128,17 +128,16 @@ static int sun50i_h6_ppu_probe(struct platform_device *pdev) if (!data) return -EINVAL; - pds = devm_kcalloc(dev, data->nr_domains, sizeof(*pds), GFP_KERNEL); + pds = devm_kzalloc_objs(dev, *pds, data->nr_domains); if (!pds) return -ENOMEM; - ppu = devm_kzalloc(dev, sizeof(*ppu), GFP_KERNEL); + ppu = devm_kzalloc_obj(dev, *ppu); if (!ppu) return -ENOMEM; ppu->num_domains = data->nr_domains; - ppu->domains = devm_kcalloc(dev, data->nr_domains, - sizeof(*ppu->domains), GFP_KERNEL); + ppu->domains = devm_kzalloc_objs(dev, *ppu->domains, data->nr_domains); if (!ppu->domains) return -ENOMEM; diff --git a/drivers/pmdomain/sunxi/sun55i-pck600.c b/drivers/pmdomain/sunxi/sun55i-pck600.c index 8a37d11b65a2..81c3b18a38a4 100644 --- a/drivers/pmdomain/sunxi/sun55i-pck600.c +++ b/drivers/pmdomain/sunxi/sun55i-pck600.c @@ -139,7 +139,7 @@ static int sunxi_pck600_probe(struct platform_device *pdev) desc = of_device_get_match_data(dev); - pck = devm_kzalloc(dev, struct_size(pck, pds, desc->num_domains), GFP_KERNEL); + pck = devm_kzalloc_flex(dev, *pck, pds, desc->num_domains); if (!pck) return -ENOMEM; @@ -148,8 +148,8 @@ static int sunxi_pck600_probe(struct platform_device *pdev) genpds = &pck->genpd_data; genpds->num_domains = desc->num_domains; - genpds->domains = devm_kcalloc(dev, desc->num_domains, - sizeof(*genpds->domains), GFP_KERNEL); + genpds->domains = devm_kzalloc_objs(dev, *genpds->domains, + desc->num_domains); if (!genpds->domains) return -ENOMEM; diff --git a/drivers/pmdomain/tegra/powergate-bpmp.c b/drivers/pmdomain/tegra/powergate-bpmp.c index e6a7e025b012..92237161465a 100644 --- a/drivers/pmdomain/tegra/powergate-bpmp.c +++ b/drivers/pmdomain/tegra/powergate-bpmp.c @@ -181,7 +181,7 @@ tegra_powergate_add(struct tegra_bpmp *bpmp, off = !tegra_bpmp_powergate_is_powered(bpmp, info->id); - powergate = devm_kzalloc(bpmp->dev, sizeof(*powergate), GFP_KERNEL); + powergate = devm_kzalloc_obj(bpmp->dev, *powergate); if (!powergate) return ERR_PTR(-ENOMEM); diff --git a/drivers/pmdomain/thead/th1520-pm-domains.c b/drivers/pmdomain/thead/th1520-pm-domains.c index d7cb9633c7c8..3d1a959f59f3 100644 --- a/drivers/pmdomain/thead/th1520-pm-domains.c +++ b/drivers/pmdomain/thead/th1520-pm-domains.c @@ -91,7 +91,7 @@ th1520_add_pm_domain(struct device *dev, const struct th1520_power_info *pi) struct th1520_power_domain *pd; int ret; - pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(dev, *pd); if (!pd) return ERR_PTR(-ENOMEM); @@ -152,7 +152,7 @@ static int th1520_pd_pwrseq_gpu_init(struct device *dev) */ return 0; - adev = devm_kzalloc(dev, sizeof(*adev), GFP_KERNEL); + adev = devm_kzalloc_obj(dev, *adev); if (!adev) return -ENOMEM; @@ -198,14 +198,13 @@ static int th1520_pd_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(aon_chan), "Failed to get AON channel\n"); - domains = devm_kcalloc(dev, ARRAY_SIZE(th1520_pd_ranges), - sizeof(*domains), GFP_KERNEL); + domains = devm_kzalloc_objs(dev, *domains, ARRAY_SIZE(th1520_pd_ranges)); if (!domains) { ret = -ENOMEM; goto err_clean_aon; } - pd_data = devm_kzalloc(dev, sizeof(*pd_data), GFP_KERNEL); + pd_data = devm_kzalloc_obj(dev, *pd_data); if (!pd_data) { ret = -ENOMEM; goto err_clean_aon; diff --git a/drivers/pmdomain/ti/omap_prm.c b/drivers/pmdomain/ti/omap_prm.c index 64a187f79a1a..671b028e367e 100644 --- a/drivers/pmdomain/ti/omap_prm.c +++ b/drivers/pmdomain/ti/omap_prm.c @@ -693,7 +693,7 @@ static int omap_prm_domain_init(struct device *dev, struct omap_prm *prm) of_node_put(dev->of_node); - prmd = devm_kzalloc(dev, sizeof(*prmd), GFP_KERNEL); + prmd = devm_kzalloc_obj(dev, *prmd); if (!prmd) return -ENOMEM; @@ -900,7 +900,7 @@ static int omap_prm_reset_init(struct platform_device *pdev, if (!map) return -EINVAL; - reset = devm_kzalloc(&pdev->dev, sizeof(*reset), GFP_KERNEL); + reset = devm_kzalloc_obj(&pdev->dev, *reset); if (!reset) return -ENOMEM; @@ -953,7 +953,7 @@ static int omap_prm_probe(struct platform_device *pdev) if (!data) return -ENOTSUPP; - prm = devm_kzalloc(&pdev->dev, sizeof(*prm), GFP_KERNEL); + prm = devm_kzalloc_obj(&pdev->dev, *prm); if (!prm) return -ENOMEM; diff --git a/drivers/pmdomain/ti/ti_sci_pm_domains.c b/drivers/pmdomain/ti/ti_sci_pm_domains.c index 949e4115f930..50898dc43310 100644 --- a/drivers/pmdomain/ti/ti_sci_pm_domains.c +++ b/drivers/pmdomain/ti/ti_sci_pm_domains.c @@ -228,7 +228,7 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev) u32 max_id = 0; int index; - pd_provider = devm_kzalloc(dev, sizeof(*pd_provider), GFP_KERNEL); + pd_provider = devm_kzalloc_obj(dev, *pd_provider); if (!pd_provider) return -ENOMEM; @@ -261,7 +261,7 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev) } } - pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(dev, *pd); if (!pd) return -ENOMEM; @@ -299,9 +299,7 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev) } pd_provider->data.domains = - devm_kcalloc(dev, max_id + 1, - sizeof(*pd_provider->data.domains), - GFP_KERNEL); + devm_kzalloc_objs(dev, *pd_provider->data.domains, max_id + 1); if (!pd_provider->data.domains) return -ENOMEM; diff --git a/drivers/pmdomain/xilinx/zynqmp-pm-domains.c b/drivers/pmdomain/xilinx/zynqmp-pm-domains.c index b5aedd6e33ad..892c07093340 100644 --- a/drivers/pmdomain/xilinx/zynqmp-pm-domains.c +++ b/drivers/pmdomain/xilinx/zynqmp-pm-domains.c @@ -247,18 +247,17 @@ static int zynqmp_gpd_probe(struct platform_device *pdev) struct zynqmp_pm_domain *pd; struct device *dev = &pdev->dev; - pd = devm_kcalloc(dev, ZYNQMP_NUM_DOMAINS, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_objs(dev, *pd, ZYNQMP_NUM_DOMAINS); if (!pd) return -ENOMEM; - zynqmp_pd_data = devm_kzalloc(dev, sizeof(*zynqmp_pd_data), GFP_KERNEL); + zynqmp_pd_data = devm_kzalloc_obj(dev, *zynqmp_pd_data); if (!zynqmp_pd_data) return -ENOMEM; zynqmp_pd_data->xlate = zynqmp_gpd_xlate; - domains = devm_kcalloc(dev, ZYNQMP_NUM_DOMAINS, sizeof(*domains), - GFP_KERNEL); + domains = devm_kzalloc_objs(dev, *domains, ZYNQMP_NUM_DOMAINS); if (!domains) return -ENOMEM; diff --git a/drivers/power/reset/as3722-poweroff.c b/drivers/power/reset/as3722-poweroff.c index 8075382cbc36..fb00553796eb 100644 --- a/drivers/power/reset/as3722-poweroff.c +++ b/drivers/power/reset/as3722-poweroff.c @@ -44,8 +44,7 @@ static int as3722_poweroff_probe(struct platform_device *pdev) if (!of_property_read_bool(np, "ams,system-power-controller")) return 0; - as3722_poweroff = devm_kzalloc(&pdev->dev, sizeof(*as3722_poweroff), - GFP_KERNEL); + as3722_poweroff = devm_kzalloc_obj(&pdev->dev, *as3722_poweroff); if (!as3722_poweroff) return -ENOMEM; diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c index 511f5a8f8961..a9ad43217f48 100644 --- a/drivers/power/reset/at91-reset.c +++ b/drivers/power/reset/at91-reset.c @@ -343,7 +343,7 @@ static int at91_reset_probe(struct platform_device *pdev) struct device_node *np; int ret, idx = 0; - reset = devm_kzalloc(&pdev->dev, sizeof(*reset), GFP_KERNEL); + reset = devm_kzalloc_obj(&pdev->dev, *reset); if (!reset) return -ENOMEM; diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c index ecf15694f925..589599cca076 100644 --- a/drivers/power/reset/at91-sama5d2_shdwc.c +++ b/drivers/power/reset/at91-sama5d2_shdwc.c @@ -344,7 +344,7 @@ static int at91_shdwc_probe(struct platform_device *pdev) if (at91_shdwc) return -EBUSY; - at91_shdwc = devm_kzalloc(&pdev->dev, sizeof(*at91_shdwc), GFP_KERNEL); + at91_shdwc = devm_kzalloc_obj(&pdev->dev, *at91_shdwc); if (!at91_shdwc) return -ENOMEM; diff --git a/drivers/power/reset/atc260x-poweroff.c b/drivers/power/reset/atc260x-poweroff.c index e3e4621ccb1d..ecd0ffadc489 100644 --- a/drivers/power/reset/atc260x-poweroff.c +++ b/drivers/power/reset/atc260x-poweroff.c @@ -186,7 +186,7 @@ static int atc260x_pwrc_probe(struct platform_device *pdev) struct atc260x_pwrc *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/power/reset/ep93xx-restart.c b/drivers/power/reset/ep93xx-restart.c index 119394bb0305..46415a3071e7 100644 --- a/drivers/power/reset/ep93xx-restart.c +++ b/drivers/power/reset/ep93xx-restart.c @@ -52,7 +52,7 @@ static int ep93xx_reboot_probe(struct auxiliary_device *adev, if (!rdev->update_bits) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/power/reset/gemini-poweroff.c b/drivers/power/reset/gemini-poweroff.c index 06d6992dec89..c0099e0ab740 100644 --- a/drivers/power/reset/gemini-poweroff.c +++ b/drivers/power/reset/gemini-poweroff.c @@ -95,7 +95,7 @@ static int gemini_poweroff_probe(struct platform_device *pdev) int irq; int ret; - gpw = devm_kzalloc(dev, sizeof(*gpw), GFP_KERNEL); + gpw = devm_kzalloc_obj(dev, *gpw); if (!gpw) return -ENOMEM; diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c index 1cd5900be038..08fb7b8488c4 100644 --- a/drivers/power/reset/gpio-poweroff.c +++ b/drivers/power/reset/gpio-poweroff.c @@ -62,7 +62,7 @@ static int gpio_poweroff_probe(struct platform_device *pdev) int priority = SYS_OFF_PRIO_DEFAULT; int ret; - gpio_poweroff = devm_kzalloc(&pdev->dev, sizeof(*gpio_poweroff), GFP_KERNEL); + gpio_poweroff = devm_kzalloc_obj(&pdev->dev, *gpio_poweroff); if (!gpio_poweroff) return -ENOMEM; diff --git a/drivers/power/reset/gpio-restart.c b/drivers/power/reset/gpio-restart.c index d1e177176fa1..a08871eebeb7 100644 --- a/drivers/power/reset/gpio-restart.c +++ b/drivers/power/reset/gpio-restart.c @@ -53,8 +53,7 @@ static int gpio_restart_probe(struct platform_device *pdev) u32 property; int ret; - gpio_restart = devm_kzalloc(&pdev->dev, sizeof(*gpio_restart), - GFP_KERNEL); + gpio_restart = devm_kzalloc_obj(&pdev->dev, *gpio_restart); if (!gpio_restart) return -ENOMEM; diff --git a/drivers/power/reset/ltc2952-poweroff.c b/drivers/power/reset/ltc2952-poweroff.c index c3a0435938c8..50093cf6270d 100644 --- a/drivers/power/reset/ltc2952-poweroff.c +++ b/drivers/power/reset/ltc2952-poweroff.c @@ -262,7 +262,7 @@ static int ltc2952_poweroff_probe(struct platform_device *pdev) return -EBUSY; } - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/power/reset/macsmc-reboot.c b/drivers/power/reset/macsmc-reboot.c index 7b8460a55e9d..131ca75a97cb 100644 --- a/drivers/power/reset/macsmc-reboot.c +++ b/drivers/power/reset/macsmc-reboot.c @@ -204,7 +204,7 @@ static int macsmc_reboot_probe(struct platform_device *pdev) struct macsmc_reboot *reboot; int ret, i; - reboot = devm_kzalloc(&pdev->dev, sizeof(*reboot), GFP_KERNEL); + reboot = devm_kzalloc_obj(&pdev->dev, *reboot); if (!reboot) return -ENOMEM; diff --git a/drivers/power/reset/mcf-rcm-reset.c b/drivers/power/reset/mcf-rcm-reset.c index 18f11c05a868..fd441cfa24b6 100644 --- a/drivers/power/reset/mcf-rcm-reset.c +++ b/drivers/power/reset/mcf-rcm-reset.c @@ -83,7 +83,7 @@ static int mcf_rcm_probe(struct platform_device *pdev) void __iomem *base; u8 rsr; - rcm = devm_kzalloc(&pdev->dev, sizeof(*rcm), GFP_KERNEL); + rcm = devm_kzalloc_obj(&pdev->dev, *rcm); if (!rcm) return -ENOMEM; diff --git a/drivers/power/reset/mt6323-poweroff.c b/drivers/power/reset/mt6323-poweroff.c index c663347547f9..77653b204dc8 100644 --- a/drivers/power/reset/mt6323-poweroff.c +++ b/drivers/power/reset/mt6323-poweroff.c @@ -54,7 +54,7 @@ static int mt6323_pwrc_probe(struct platform_device *pdev) struct resource *res; int ret; - pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); + pwrc = devm_kzalloc_obj(&pdev->dev, *pwrc); if (!pwrc) return -ENOMEM; diff --git a/drivers/power/reset/nvmem-reboot-mode.c b/drivers/power/reset/nvmem-reboot-mode.c index d260715fccf6..19d12a59383f 100644 --- a/drivers/power/reset/nvmem-reboot-mode.c +++ b/drivers/power/reset/nvmem-reboot-mode.c @@ -47,7 +47,7 @@ static int nvmem_reboot_mode_probe(struct platform_device *pdev) int ret; struct nvmem_reboot_mode *nvmem_rbm; - nvmem_rbm = devm_kzalloc(&pdev->dev, sizeof(*nvmem_rbm), GFP_KERNEL); + nvmem_rbm = devm_kzalloc_obj(&pdev->dev, *nvmem_rbm); if (!nvmem_rbm) return -ENOMEM; diff --git a/drivers/power/reset/ocelot-reset.c b/drivers/power/reset/ocelot-reset.c index 9d4b8afb6cbb..0acfa63b6b5d 100644 --- a/drivers/power/reset/ocelot-reset.c +++ b/drivers/power/reset/ocelot-reset.c @@ -71,7 +71,7 @@ static int ocelot_reset_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int err; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/power/reset/odroid-go-ultra-poweroff.c b/drivers/power/reset/odroid-go-ultra-poweroff.c index 9cac7aef77f0..5e72e8319b55 100644 --- a/drivers/power/reset/odroid-go-ultra-poweroff.c +++ b/drivers/power/reset/odroid-go-ultra-poweroff.c @@ -97,7 +97,7 @@ static int odroid_go_ultra_poweroff_probe(struct platform_device *pdev) struct odroid_go_ultra_poweroff_data *poweroff_data; int ret; - poweroff_data = devm_kzalloc(&pdev->dev, sizeof(*poweroff_data), GFP_KERNEL); + poweroff_data = devm_kzalloc_obj(&pdev->dev, *poweroff_data); if (!poweroff_data) return -ENOMEM; diff --git a/drivers/power/reset/pwr-mlxbf.c b/drivers/power/reset/pwr-mlxbf.c index 459c2b7f3a21..ea810055b45b 100644 --- a/drivers/power/reset/pwr-mlxbf.c +++ b/drivers/power/reset/pwr-mlxbf.c @@ -48,7 +48,7 @@ static int pwr_mlxbf_probe(struct platform_device *pdev) const char *hid; int irq, err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c index cd7ba680b841..112d1bcefedf 100644 --- a/drivers/power/reset/qcom-pon.c +++ b/drivers/power/reset/qcom-pon.c @@ -59,7 +59,7 @@ static int qcom_pon_probe(struct platform_device *pdev) long reason_shift; int error; - pon = devm_kzalloc(&pdev->dev, sizeof(*pon), GFP_KERNEL); + pon = devm_kzalloc_obj(&pdev->dev, *pon); if (!pon) return -ENOMEM; diff --git a/drivers/power/reset/qemu-virt-ctrl.c b/drivers/power/reset/qemu-virt-ctrl.c index 97875007fda3..e0939582fd62 100644 --- a/drivers/power/reset/qemu-virt-ctrl.c +++ b/drivers/power/reset/qemu-virt-ctrl.c @@ -67,7 +67,7 @@ static int qemu_virt_ctrl_probe(struct platform_device *pdev) struct qemu_virt_ctrl *ctrl; int ret; - ctrl = devm_kzalloc(&pdev->dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(&pdev->dev, *ctrl); if (!ctrl) return -ENOMEM; diff --git a/drivers/power/reset/syscon-poweroff.c b/drivers/power/reset/syscon-poweroff.c index 203936f4c544..e085246f44dd 100644 --- a/drivers/power/reset/syscon-poweroff.c +++ b/drivers/power/reset/syscon-poweroff.c @@ -43,7 +43,7 @@ static int syscon_poweroff_probe(struct platform_device *pdev) struct syscon_poweroff_data *data; int mask_err, value_err; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/power/reset/syscon-reboot-mode.c b/drivers/power/reset/syscon-reboot-mode.c index e0772c9f70f7..946b6774d5e5 100644 --- a/drivers/power/reset/syscon-reboot-mode.c +++ b/drivers/power/reset/syscon-reboot-mode.c @@ -41,7 +41,7 @@ static int syscon_reboot_mode_probe(struct platform_device *pdev) int ret; struct syscon_reboot_mode *syscon_rbm; - syscon_rbm = devm_kzalloc(&pdev->dev, sizeof(*syscon_rbm), GFP_KERNEL); + syscon_rbm = devm_kzalloc_obj(&pdev->dev, *syscon_rbm); if (!syscon_rbm) return -ENOMEM; diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c index 60e855cae68e..3b0a20a2729f 100644 --- a/drivers/power/reset/syscon-reboot.c +++ b/drivers/power/reset/syscon-reboot.c @@ -70,7 +70,7 @@ static int syscon_reboot_probe(struct platform_device *pdev) u32 priority; int err; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/power/reset/xgene-reboot.c b/drivers/power/reset/xgene-reboot.c index b5eee19bac42..f02086e84e2a 100644 --- a/drivers/power/reset/xgene-reboot.c +++ b/drivers/power/reset/xgene-reboot.c @@ -46,7 +46,7 @@ static int xgene_reboot_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int err; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/power/sequencing/pwrseq-pcie-m2.c b/drivers/power/sequencing/pwrseq-pcie-m2.c index 56c5d51293c1..9c8066129359 100644 --- a/drivers/power/sequencing/pwrseq-pcie-m2.c +++ b/drivers/power/sequencing/pwrseq-pcie-m2.c @@ -540,7 +540,7 @@ static int pwrseq_pcie_m2_probe(struct platform_device *pdev) struct pwrseq_config config = {}; int ret; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/power/sequencing/pwrseq-qcom-wcn.c b/drivers/power/sequencing/pwrseq-qcom-wcn.c index 636dd7e63891..1145942615d6 100644 --- a/drivers/power/sequencing/pwrseq-qcom-wcn.c +++ b/drivers/power/sequencing/pwrseq-qcom-wcn.c @@ -491,7 +491,7 @@ static int pwrseq_qcom_wcn_probe(struct platform_device *pdev) struct pwrseq_config config; int i, ret; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; @@ -502,8 +502,7 @@ static int pwrseq_qcom_wcn_probe(struct platform_device *pdev) return dev_err_probe(dev, -ENODEV, "Failed to obtain platform data\n"); - ctx->regs = devm_kcalloc(dev, ctx->pdata->num_vregs, - sizeof(*ctx->regs), GFP_KERNEL); + ctx->regs = devm_kzalloc_objs(dev, *ctx->regs, ctx->pdata->num_vregs); if (!ctx->regs) return -ENOMEM; diff --git a/drivers/power/sequencing/pwrseq-thead-gpu.c b/drivers/power/sequencing/pwrseq-thead-gpu.c index a45318b4b2c1..24cdfd5d726a 100644 --- a/drivers/power/sequencing/pwrseq-thead-gpu.c +++ b/drivers/power/sequencing/pwrseq-thead-gpu.c @@ -183,7 +183,7 @@ static int pwrseq_thead_gpu_probe(struct auxiliary_device *adev, struct pwrseq_thead_gpu_ctx *ctx; struct pwrseq_config config = {}; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/power/supply/88pm860x_battery.c b/drivers/power/supply/88pm860x_battery.c index 8d93c7a6a5f0..daf14a208798 100644 --- a/drivers/power/supply/88pm860x_battery.c +++ b/drivers/power/supply/88pm860x_battery.c @@ -916,7 +916,7 @@ static int pm860x_battery_probe(struct platform_device *pdev) struct pm860x_power_pdata *pdata; int ret; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/power/supply/88pm860x_charger.c b/drivers/power/supply/88pm860x_charger.c index 47f95f31e472..7317d7d94d65 100644 --- a/drivers/power/supply/88pm860x_charger.c +++ b/drivers/power/supply/88pm860x_charger.c @@ -670,7 +670,7 @@ static int pm860x_charger_probe(struct platform_device *pdev) int i; int j; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c index d8845fd2f084..ea9dec3135fc 100644 --- a/drivers/power/supply/ab8500_btemp.c +++ b/drivers/power/supply/ab8500_btemp.c @@ -692,7 +692,7 @@ static int ab8500_btemp_probe(struct platform_device *pdev) int irq, i, ret = 0; u8 val; - di = devm_kzalloc(dev, sizeof(*di), GFP_KERNEL); + di = devm_kzalloc_obj(dev, *di); if (!di) return -ENOMEM; diff --git a/drivers/power/supply/ab8500_chargalg.c b/drivers/power/supply/ab8500_chargalg.c index 71d82c6c193e..fba6ba90eecd 100644 --- a/drivers/power/supply/ab8500_chargalg.c +++ b/drivers/power/supply/ab8500_chargalg.c @@ -1772,7 +1772,7 @@ static int ab8500_chargalg_probe(struct platform_device *pdev) struct power_supply_config psy_cfg = {}; struct ab8500_chargalg *di; - di = devm_kzalloc(dev, sizeof(*di), GFP_KERNEL); + di = devm_kzalloc_obj(dev, *di); if (!di) return -ENOMEM; diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c index 19cc56624ee4..7dbb647392e5 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -3697,7 +3697,7 @@ static int ab8500_charger_probe(struct platform_device *pdev) int i, irq; int ret; - di = devm_kzalloc(dev, sizeof(*di), GFP_KERNEL); + di = devm_kzalloc_obj(dev, *di); if (!di) return -ENOMEM; diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index 069e7fee1d16..eddd3e853106 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c @@ -3012,7 +3012,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) int i, irq; int ret = 0; - di = devm_kzalloc(dev, sizeof(*di), GFP_KERNEL); + di = devm_kzalloc_obj(dev, *di); if (!di) return -ENOMEM; diff --git a/drivers/power/supply/acer_a500_battery.c b/drivers/power/supply/acer_a500_battery.c index daf01dc8025b..2f2b3b7a66fc 100644 --- a/drivers/power/supply/acer_a500_battery.c +++ b/drivers/power/supply/acer_a500_battery.c @@ -226,7 +226,7 @@ static int a500_battery_probe(struct platform_device *pdev) struct power_supply_config psy_cfg = {}; struct a500_battery *bat; - bat = devm_kzalloc(&pdev->dev, sizeof(*bat), GFP_KERNEL); + bat = devm_kzalloc_obj(&pdev->dev, *bat); if (!bat) return -ENOMEM; diff --git a/drivers/power/supply/act8945a_charger.c b/drivers/power/supply/act8945a_charger.c index 7e4b087f7679..3ea43ec7f8a8 100644 --- a/drivers/power/supply/act8945a_charger.c +++ b/drivers/power/supply/act8945a_charger.c @@ -577,7 +577,7 @@ static int act8945a_charger_probe(struct platform_device *pdev) struct power_supply_config psy_cfg = {}; int irq, ret; - charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); + charger = devm_kzalloc_obj(&pdev->dev, *charger); if (!charger) return -ENOMEM; diff --git a/drivers/power/supply/adp5061.c b/drivers/power/supply/adp5061.c index 7478986e6b3c..06c620791298 100644 --- a/drivers/power/supply/adp5061.c +++ b/drivers/power/supply/adp5061.c @@ -698,7 +698,7 @@ static int adp5061_probe(struct i2c_client *client) struct power_supply_config psy_cfg = {}; struct adp5061_state *st; - st = devm_kzalloc(&client->dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(&client->dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/power/supply/axp20x_ac_power.c b/drivers/power/supply/axp20x_ac_power.c index 46889567bc18..0c101df8cb79 100644 --- a/drivers/power/supply/axp20x_ac_power.c +++ b/drivers/power/supply/axp20x_ac_power.c @@ -333,9 +333,8 @@ static int axp20x_ac_power_probe(struct platform_device *pdev) axp_data = of_device_get_match_data(&pdev->dev); - power = devm_kzalloc(&pdev->dev, - struct_size(power, irqs, axp_data->num_irq_names), - GFP_KERNEL); + power = devm_kzalloc_flex(&pdev->dev, *power, irqs, + axp_data->num_irq_names); if (!power) return -ENOMEM; diff --git a/drivers/power/supply/axp20x_battery.c b/drivers/power/supply/axp20x_battery.c index c119014b319a..4af1a209c9cf 100644 --- a/drivers/power/supply/axp20x_battery.c +++ b/drivers/power/supply/axp20x_battery.c @@ -1097,8 +1097,7 @@ static int axp20x_power_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - axp20x_batt = devm_kzalloc(&pdev->dev, sizeof(*axp20x_batt), - GFP_KERNEL); + axp20x_batt = devm_kzalloc_obj(&pdev->dev, *axp20x_batt); if (!axp20x_batt) return -ENOMEM; diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c index 7625366104bc..53e3e05c2c8c 100644 --- a/drivers/power/supply/axp20x_usb_power.c +++ b/drivers/power/supply/axp20x_usb_power.c @@ -930,8 +930,7 @@ static int axp20x_usb_power_probe(struct platform_device *pdev) axp_data = of_device_get_match_data(dev); - power = devm_kzalloc(dev, struct_size(power, irqs, axp_data->num_irq_names), - GFP_KERNEL); + power = devm_kzalloc_flex(dev, *power, irqs, axp_data->num_irq_names); if (!power) return -ENOMEM; diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c index 8f2090356017..cca676d614fd 100644 --- a/drivers/power/supply/axp288_charger.c +++ b/drivers/power/supply/axp288_charger.c @@ -849,7 +849,7 @@ static int axp288_charger_probe(struct platform_device *pdev) if (val == 0) return -ENODEV; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c index 68dabaf7a4f8..fcb0b4a364c1 100644 --- a/drivers/power/supply/axp288_fuel_gauge.c +++ b/drivers/power/supply/axp288_fuel_gauge.c @@ -719,7 +719,7 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev) if (quirks & AXP288_QUIRK_NO_BATTERY) return -ENODEV; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/power/supply/bd71828-power.c b/drivers/power/supply/bd71828-power.c index 3be7a75a7d6c..cb8e3f5a74ad 100644 --- a/drivers/power/supply/bd71828-power.c +++ b/drivers/power/supply/bd71828-power.c @@ -1174,7 +1174,7 @@ static int bd71828_power_probe(struct platform_device *pdev) struct power_supply_config bat_cfg = {}; int ret; - pwr = devm_kzalloc(&pdev->dev, sizeof(*pwr), GFP_KERNEL); + pwr = devm_kzalloc_obj(&pdev->dev, *pwr); if (!pwr) return -ENOMEM; diff --git a/drivers/power/supply/bd99954-charger.c b/drivers/power/supply/bd99954-charger.c index b3068c2197c7..d13b8e4316eb 100644 --- a/drivers/power/supply/bd99954-charger.c +++ b/drivers/power/supply/bd99954-charger.c @@ -973,7 +973,7 @@ static int bd9995x_probe(struct i2c_client *client) int ret; int i; - bd = devm_kzalloc(dev, sizeof(*bd), GFP_KERNEL); + bd = devm_kzalloc_obj(dev, *bd); if (!bd) return -ENOMEM; diff --git a/drivers/power/supply/bq2415x_charger.c b/drivers/power/supply/bq2415x_charger.c index 9f801717bfb0..4fa923396b0e 100644 --- a/drivers/power/supply/bq2415x_charger.c +++ b/drivers/power/supply/bq2415x_charger.c @@ -1584,7 +1584,7 @@ static int bq2415x_probe(struct i2c_client *client) goto error_1; } - bq = devm_kzalloc(&client->dev, sizeof(*bq), GFP_KERNEL); + bq = devm_kzalloc_obj(&client->dev, *bq); if (!bq) { ret = -ENOMEM; goto error_2; diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c index 7a5867dd74c2..b6e2e3160740 100644 --- a/drivers/power/supply/bq24190_charger.c +++ b/drivers/power/supply/bq24190_charger.c @@ -2128,7 +2128,7 @@ static int bq24190_probe(struct i2c_client *client) return -ENODEV; } - bdi = devm_kzalloc(dev, sizeof(*bdi), GFP_KERNEL); + bdi = devm_kzalloc_obj(dev, *bdi); if (!bdi) { dev_err(dev, "Can't alloc bdi struct\n"); return -ENOMEM; diff --git a/drivers/power/supply/bq24257_charger.c b/drivers/power/supply/bq24257_charger.c index 8eea7d0395ce..5b176679beb7 100644 --- a/drivers/power/supply/bq24257_charger.c +++ b/drivers/power/supply/bq24257_charger.c @@ -995,7 +995,7 @@ static int bq24257_probe(struct i2c_client *client) return -ENODEV; } - bq = devm_kzalloc(dev, sizeof(*bq), GFP_KERNEL); + bq = devm_kzalloc_obj(dev, *bq); if (!bq) return -ENOMEM; diff --git a/drivers/power/supply/bq24735-charger.c b/drivers/power/supply/bq24735-charger.c index 22c2b86c3b30..a4a12598294d 100644 --- a/drivers/power/supply/bq24735-charger.c +++ b/drivers/power/supply/bq24735-charger.c @@ -328,7 +328,7 @@ static struct bq24735_platform *bq24735_parse_dt_data(struct i2c_client *client) u32 val; int ret; - pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&client->dev, *pdata); if (!pdata) { dev_err(&client->dev, "Memory alloc for bq24735 pdata failed\n"); @@ -360,7 +360,7 @@ static int bq24735_charger_probe(struct i2c_client *client) struct power_supply_config psy_cfg = {}; char *name; - charger = devm_kzalloc(&client->dev, sizeof(*charger), GFP_KERNEL); + charger = devm_kzalloc_obj(&client->dev, *charger); if (!charger) return -ENOMEM; diff --git a/drivers/power/supply/bq2515x_charger.c b/drivers/power/supply/bq2515x_charger.c index c2b17562cf8b..08db58e91e08 100644 --- a/drivers/power/supply/bq2515x_charger.c +++ b/drivers/power/supply/bq2515x_charger.c @@ -1086,7 +1086,7 @@ static int bq2515x_probe(struct i2c_client *client) struct power_supply_config charger_cfg = {}; int ret; - bq2515x = devm_kzalloc(dev, sizeof(*bq2515x), GFP_KERNEL); + bq2515x = devm_kzalloc_obj(dev, *bq2515x); if (!bq2515x) return -ENOMEM; diff --git a/drivers/power/supply/bq25630_charger.c b/drivers/power/supply/bq25630_charger.c index bf54ff557a40..7155608c9ddc 100644 --- a/drivers/power/supply/bq25630_charger.c +++ b/drivers/power/supply/bq25630_charger.c @@ -1070,7 +1070,7 @@ static int bq25630_probe(struct i2c_client *client) struct bq25630_data *data; int ret; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/power/supply/bq256xx_charger.c b/drivers/power/supply/bq256xx_charger.c index 454bc497b0d8..b5dd5ce9f3fa 100644 --- a/drivers/power/supply/bq256xx_charger.c +++ b/drivers/power/supply/bq256xx_charger.c @@ -1765,7 +1765,7 @@ static int bq256xx_probe(struct i2c_client *client) int ret; - bq = devm_kzalloc(dev, sizeof(*bq), GFP_KERNEL); + bq = devm_kzalloc_obj(dev, *bq); if (!bq) return -ENOMEM; diff --git a/drivers/power/supply/bq257xx_charger.c b/drivers/power/supply/bq257xx_charger.c index 569608bc0d6a..36e675237f97 100644 --- a/drivers/power/supply/bq257xx_charger.c +++ b/drivers/power/supply/bq257xx_charger.c @@ -1230,7 +1230,7 @@ static int bq257xx_charger_probe(struct platform_device *pdev) device_set_of_node_from_dev(dev, pdev->dev.parent); - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c index f7510ada6b73..6af1811909e4 100644 --- a/drivers/power/supply/bq25890_charger.c +++ b/drivers/power/supply/bq25890_charger.c @@ -1465,7 +1465,7 @@ static int bq25890_probe(struct i2c_client *client) struct bq25890_device *bq; int ret; - bq = devm_kzalloc(dev, sizeof(*bq), GFP_KERNEL); + bq = devm_kzalloc_obj(dev, *bq); if (!bq) return -ENOMEM; diff --git a/drivers/power/supply/bq25980_charger.c b/drivers/power/supply/bq25980_charger.c index eced3aecc7d2..57e9ffa3c786 100644 --- a/drivers/power/supply/bq25980_charger.c +++ b/drivers/power/supply/bq25980_charger.c @@ -1213,7 +1213,7 @@ static int bq25980_probe(struct i2c_client *client) struct bq25980_device *bq; int ret; - bq = devm_kzalloc(dev, sizeof(*bq), GFP_KERNEL); + bq = devm_kzalloc_obj(dev, *bq); if (!bq) return -ENOMEM; diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c index 09272249b4f7..b6110940f8a7 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -2256,7 +2256,7 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di) di->dm_regs = bq27xxx_chip_data[di->chip].dm_regs; di->opts = bq27xxx_chip_data[di->chip].opts; - psy_desc = devm_kzalloc(di->dev, sizeof(*psy_desc), GFP_KERNEL); + psy_desc = devm_kzalloc_obj(di->dev, *psy_desc); if (!psy_desc) return -ENOMEM; diff --git a/drivers/power/supply/bq27xxx_battery_hdq.c b/drivers/power/supply/bq27xxx_battery_hdq.c index 922759ab2e04..058371bafe9d 100644 --- a/drivers/power/supply/bq27xxx_battery_hdq.c +++ b/drivers/power/supply/bq27xxx_battery_hdq.c @@ -76,7 +76,7 @@ static int bq27xxx_battery_hdq_add_slave(struct w1_slave *sl) { struct bq27xxx_device_info *di; - di = devm_kzalloc(&sl->dev, sizeof(*di), GFP_KERNEL); + di = devm_kzalloc_obj(&sl->dev, *di); if (!di) return -ENOMEM; diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c index 715ce8b6e401..bd1d5d046a17 100644 --- a/drivers/power/supply/bq27xxx_battery_i2c.c +++ b/drivers/power/supply/bq27xxx_battery_i2c.c @@ -175,7 +175,7 @@ static int bq27xxx_battery_i2c_probe(struct i2c_client *client) if (!name) return -ENOMEM; - di = devm_kzalloc(&client->dev, sizeof(*di), GFP_KERNEL); + di = devm_kzalloc_obj(&client->dev, *di); if (!di) return -ENOMEM; diff --git a/drivers/power/supply/chagall-battery.c b/drivers/power/supply/chagall-battery.c index 129566d0bd9d..23836ae96108 100644 --- a/drivers/power/supply/chagall-battery.c +++ b/drivers/power/supply/chagall-battery.c @@ -195,7 +195,7 @@ static int chagall_battery_probe(struct i2c_client *client) struct power_supply_config cfg = { }; int ret; - cg = devm_kzalloc(dev, sizeof(*cg), GFP_KERNEL); + cg = devm_kzalloc_obj(dev, *cg); if (!cg) return -ENOMEM; diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c index 8e8c5109401a..b688623a20d0 100644 --- a/drivers/power/supply/charger-manager.c +++ b/drivers/power/supply/charger-manager.c @@ -1299,7 +1299,7 @@ static struct charger_desc *of_cm_parse_desc(struct device *dev) u32 battery_stat = CM_NO_BATTERY; int num_chgs = 0; - desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL); + desc = devm_kzalloc_obj(dev, *desc); if (!desc) return ERR_PTR(-ENOMEM); @@ -1360,19 +1360,15 @@ static struct charger_desc *of_cm_parse_desc(struct device *dev) struct charger_regulator *chg_regs; struct device_node *child; - chg_regs = devm_kcalloc(dev, - desc->num_charger_regulators, - sizeof(*chg_regs), - GFP_KERNEL); + chg_regs = devm_kzalloc_objs(dev, *chg_regs, + desc->num_charger_regulators); if (!chg_regs) return ERR_PTR(-ENOMEM); desc->charger_regulators = chg_regs; - desc->sysfs_groups = devm_kcalloc(dev, - desc->num_charger_regulators + 1, - sizeof(*desc->sysfs_groups), - GFP_KERNEL); + desc->sysfs_groups = devm_kzalloc_objs(dev, *desc->sysfs_groups, + desc->num_charger_regulators + 1); if (!desc->sysfs_groups) return ERR_PTR(-ENOMEM); @@ -1386,10 +1382,8 @@ static struct charger_desc *of_cm_parse_desc(struct device *dev) /* charger cables */ chg_regs->num_cables = of_get_child_count(child); if (chg_regs->num_cables) { - cables = devm_kcalloc(dev, - chg_regs->num_cables, - sizeof(*cables), - GFP_KERNEL); + cables = devm_kzalloc_objs(dev, *cables, + chg_regs->num_cables); if (!cables) { of_node_put(child); return ERR_PTR(-ENOMEM); @@ -1446,7 +1440,7 @@ static int charger_manager_probe(struct platform_device *pdev) return PTR_ERR(desc); } - cm = devm_kzalloc(&pdev->dev, sizeof(*cm), GFP_KERNEL); + cm = devm_kzalloc_obj(&pdev->dev, *cm); if (!cm) return -ENOMEM; @@ -1457,7 +1451,7 @@ static int charger_manager_probe(struct platform_device *pdev) /* Initialize alarm timer */ if (alarmtimer_get_rtcdev()) { - cm_timer = devm_kzalloc(cm->dev, sizeof(*cm_timer), GFP_KERNEL); + cm_timer = devm_kzalloc_obj(cm->dev, *cm_timer); if (!cm_timer) return -ENOMEM; alarm_init(cm_timer, ALARM_BOOTTIME, cm_timer_func); @@ -1536,10 +1530,8 @@ static int charger_manager_probe(struct platform_device *pdev) cm->charger_psy_desc.name = cm->psy_name_buf; /* Allocate for psy properties because they may vary */ - properties = devm_kcalloc(&pdev->dev, - ARRAY_SIZE(default_charger_props) + - NUM_CHARGER_PSY_OPTIONAL, - sizeof(*properties), GFP_KERNEL); + properties = devm_kzalloc_objs(&pdev->dev, *properties, + ARRAY_SIZE(default_charger_props) + NUM_CHARGER_PSY_OPTIONAL); if (!properties) return -ENOMEM; diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c index 808714c6ce95..da214b37aa54 100644 --- a/drivers/power/supply/cpcap-battery.c +++ b/drivers/power/supply/cpcap-battery.c @@ -960,7 +960,7 @@ static int cpcap_battery_init_irq(struct platform_device *pdev, if (error) return error; - d = devm_kzalloc(ddata->dev, sizeof(*d), GFP_KERNEL); + d = devm_kzalloc_obj(ddata->dev, *d); if (!d) return -ENOMEM; @@ -1117,7 +1117,7 @@ static int cpcap_battery_probe(struct platform_device *pdev) struct power_supply_config psy_cfg = {}; int error; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/power/supply/cpcap-charger.c b/drivers/power/supply/cpcap-charger.c index d423a8bdc0c2..f7507c5751f4 100644 --- a/drivers/power/supply/cpcap-charger.c +++ b/drivers/power/supply/cpcap-charger.c @@ -764,7 +764,7 @@ static int cpcap_usb_init_irq(struct platform_device *pdev, if (error) return error; - d = devm_kzalloc(ddata->dev, sizeof(*d), GFP_KERNEL); + d = devm_kzalloc_obj(ddata->dev, *d); if (!d) return -ENOMEM; @@ -874,7 +874,7 @@ static int cpcap_charger_probe(struct platform_device *pdev) struct power_supply_config psy_cfg = {}; int error; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/power/supply/cros_charge-control.c b/drivers/power/supply/cros_charge-control.c index e5841b40563e..5f2916c5bb57 100644 --- a/drivers/power/supply/cros_charge-control.c +++ b/drivers/power/supply/cros_charge-control.c @@ -397,7 +397,7 @@ static int cros_chctl_probe(struct platform_device *pdev) return -ENODEV; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/power/supply/cros_peripheral_charger.c b/drivers/power/supply/cros_peripheral_charger.c index b640930366d4..fdfa510f0f2d 100644 --- a/drivers/power/supply/cros_peripheral_charger.c +++ b/drivers/power/supply/cros_peripheral_charger.c @@ -280,7 +280,7 @@ static int cros_pchg_probe(struct platform_device *pdev) int ret; int i; - charger = devm_kzalloc(dev, sizeof(*charger), GFP_KERNEL); + charger = devm_kzalloc_obj(dev, *charger); if (!charger) return -ENOMEM; @@ -319,7 +319,7 @@ static int cros_pchg_probe(struct platform_device *pdev) for (i = 0; i < num_ports; i++) { struct power_supply_config psy_cfg = {}; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return -ENOMEM; diff --git a/drivers/power/supply/cros_usbpd-charger.c b/drivers/power/supply/cros_usbpd-charger.c index 69d227ceb5c9..1adafcc15513 100644 --- a/drivers/power/supply/cros_usbpd-charger.c +++ b/drivers/power/supply/cros_usbpd-charger.c @@ -546,8 +546,7 @@ static int cros_usbpd_charger_probe(struct platform_device *pd) int ret = -EINVAL; int i; - charger = devm_kzalloc(dev, sizeof(struct charger_data), - GFP_KERNEL); + charger = devm_kzalloc_obj(dev, struct charger_data); if (!charger) return -ENOMEM; @@ -613,7 +612,7 @@ static int cros_usbpd_charger_probe(struct platform_device *pd) for (i = 0; i < charger->num_charger_ports; i++) { struct power_supply_config psy_cfg = {}; - port = devm_kzalloc(dev, sizeof(struct port_data), GFP_KERNEL); + port = devm_kzalloc_obj(dev, struct port_data); if (!port) { ret = -ENOMEM; goto fail; diff --git a/drivers/power/supply/cw2015_battery.c b/drivers/power/supply/cw2015_battery.c index 1bcb60cf763d..9fab56756dcf 100644 --- a/drivers/power/supply/cw2015_battery.c +++ b/drivers/power/supply/cw2015_battery.c @@ -642,7 +642,7 @@ static int cw_bat_probe(struct i2c_client *client) struct cw_battery *cw_bat; struct power_supply_config psy_cfg = { 0 }; - cw_bat = devm_kzalloc(&client->dev, sizeof(*cw_bat), GFP_KERNEL); + cw_bat = devm_kzalloc_obj(&client->dev, *cw_bat); if (!cw_bat) return -ENOMEM; @@ -685,9 +685,8 @@ static int cw_bat_probe(struct i2c_client *client) ret = power_supply_get_battery_info(cw_bat->rk_bat, &cw_bat->battery); if (ret) { /* Allocate an empty battery */ - cw_bat->battery = devm_kzalloc(&client->dev, - sizeof(*cw_bat->battery), - GFP_KERNEL); + cw_bat->battery = devm_kzalloc_obj(&client->dev, + *cw_bat->battery); if (!cw_bat->battery) return -ENOMEM; dev_warn(cw_bat->dev, diff --git a/drivers/power/supply/da9030_battery.c b/drivers/power/supply/da9030_battery.c index 8c4daec0a6b6..8d7d585f2d42 100644 --- a/drivers/power/supply/da9030_battery.c +++ b/drivers/power/supply/da9030_battery.c @@ -494,7 +494,7 @@ static int da9030_battery_probe(struct platform_device *pdev) pdata->charge_millivolt > 4350) return -EINVAL; - charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); + charger = devm_kzalloc_obj(&pdev->dev, *charger); if (charger == NULL) return -ENOMEM; diff --git a/drivers/power/supply/da9052-battery.c b/drivers/power/supply/da9052-battery.c index 6f17e2fa1a28..f49d9b0cf7fb 100644 --- a/drivers/power/supply/da9052-battery.c +++ b/drivers/power/supply/da9052-battery.c @@ -590,8 +590,7 @@ static s32 da9052_bat_probe(struct platform_device *pdev) int ret; int i; - bat = devm_kzalloc(&pdev->dev, sizeof(struct da9052_battery), - GFP_KERNEL); + bat = devm_kzalloc_obj(&pdev->dev, struct da9052_battery); if (!bat) return -ENOMEM; diff --git a/drivers/power/supply/da9150-charger.c b/drivers/power/supply/da9150-charger.c index 58449df6068c..52c63c175db5 100644 --- a/drivers/power/supply/da9150-charger.c +++ b/drivers/power/supply/da9150-charger.c @@ -512,7 +512,7 @@ static int da9150_charger_probe(struct platform_device *pdev) u8 reg; int ret; - charger = devm_kzalloc(dev, sizeof(struct da9150_charger), GFP_KERNEL); + charger = devm_kzalloc_obj(dev, struct da9150_charger); if (!charger) return -ENOMEM; diff --git a/drivers/power/supply/da9150-fg.c b/drivers/power/supply/da9150-fg.c index 7b2fa723acd9..1a0777302d87 100644 --- a/drivers/power/supply/da9150-fg.c +++ b/drivers/power/supply/da9150-fg.c @@ -420,7 +420,7 @@ static struct da9150_fg_pdata *da9150_fg_dt_pdata(struct device *dev) struct device_node *fg_node = dev->of_node; struct da9150_fg_pdata *pdata; - pdata = devm_kzalloc(dev, sizeof(struct da9150_fg_pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, struct da9150_fg_pdata); if (!pdata) return NULL; @@ -450,7 +450,7 @@ static int da9150_fg_probe(struct platform_device *pdev) struct da9150_fg *fg; int ver, irq, ret = 0; - fg = devm_kzalloc(dev, sizeof(*fg), GFP_KERNEL); + fg = devm_kzalloc_obj(dev, *fg); if (fg == NULL) return -ENOMEM; diff --git a/drivers/power/supply/ds2760_battery.c b/drivers/power/supply/ds2760_battery.c index 142c7492c3c2..49184fce26ea 100644 --- a/drivers/power/supply/ds2760_battery.c +++ b/drivers/power/supply/ds2760_battery.c @@ -630,7 +630,7 @@ static int w1_ds2760_add_slave(struct w1_slave *sl) char name[32]; char status; - di = devm_kzalloc(dev, sizeof(*di), GFP_KERNEL); + di = devm_kzalloc_obj(dev, *di); if (!di) { retval = -ENOMEM; goto di_alloc_failed; diff --git a/drivers/power/supply/ds2780_battery.c b/drivers/power/supply/ds2780_battery.c index ef2446386c2a..6472c06fe77d 100644 --- a/drivers/power/supply/ds2780_battery.c +++ b/drivers/power/supply/ds2780_battery.c @@ -747,7 +747,7 @@ static int ds2780_battery_probe(struct platform_device *pdev) struct power_supply_config psy_cfg = {}; struct ds2780_device_info *dev_info; - dev_info = devm_kzalloc(&pdev->dev, sizeof(*dev_info), GFP_KERNEL); + dev_info = devm_kzalloc_obj(&pdev->dev, *dev_info); if (!dev_info) return -ENOMEM; diff --git a/drivers/power/supply/ds2781_battery.c b/drivers/power/supply/ds2781_battery.c index 1319e02f3f95..9eaf77e7eceb 100644 --- a/drivers/power/supply/ds2781_battery.c +++ b/drivers/power/supply/ds2781_battery.c @@ -751,7 +751,7 @@ static int ds2781_battery_probe(struct platform_device *pdev) struct power_supply_config psy_cfg = {}; struct ds2781_device_info *dev_info; - dev_info = devm_kzalloc(&pdev->dev, sizeof(*dev_info), GFP_KERNEL); + dev_info = devm_kzalloc_obj(&pdev->dev, *dev_info); if (!dev_info) return -ENOMEM; diff --git a/drivers/power/supply/ds2782_battery.c b/drivers/power/supply/ds2782_battery.c index ed44837473e7..d4152d33558f 100644 --- a/drivers/power/supply/ds2782_battery.c +++ b/drivers/power/supply/ds2782_battery.c @@ -385,7 +385,7 @@ static int ds278x_battery_probe(struct i2c_client *client) if (ret) return ret; - info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&client->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/power/supply/generic-adc-battery.c b/drivers/power/supply/generic-adc-battery.c index 7a1f8188bd27..bf92e2c05ad3 100644 --- a/drivers/power/supply/generic-adc-battery.c +++ b/drivers/power/supply/generic-adc-battery.c @@ -167,7 +167,7 @@ static int gab_probe(struct platform_device *pdev) int index = ARRAY_SIZE(gab_props); bool any = false; - adc_bat = devm_kzalloc(&pdev->dev, sizeof(*adc_bat), GFP_KERNEL); + adc_bat = devm_kzalloc_obj(&pdev->dev, *adc_bat); if (!adc_bat) return -ENOMEM; @@ -186,11 +186,8 @@ static int gab_probe(struct platform_device *pdev) * copying the static properties and allocating extra memory for holding * the extra configurable properties received from platform data. */ - properties = devm_kcalloc(&pdev->dev, - ARRAY_SIZE(gab_props) + - ARRAY_SIZE(gab_chan_name), - sizeof(*properties), - GFP_KERNEL); + properties = devm_kzalloc_objs(&pdev->dev, *properties, + ARRAY_SIZE(gab_props) + ARRAY_SIZE(gab_chan_name)); if (!properties) return -ENOMEM; diff --git a/drivers/power/supply/goldfish_battery.c b/drivers/power/supply/goldfish_battery.c index 5aa24e4dc445..205dff783307 100644 --- a/drivers/power/supply/goldfish_battery.c +++ b/drivers/power/supply/goldfish_battery.c @@ -202,7 +202,7 @@ static int goldfish_battery_probe(struct platform_device *pdev) struct goldfish_battery_data *data; struct power_supply_config psy_cfg = {}; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (data == NULL) return -ENOMEM; diff --git a/drivers/power/supply/gpio-charger.c b/drivers/power/supply/gpio-charger.c index 1dad49acc424..3b2fafb5694b 100644 --- a/drivers/power/supply/gpio-charger.c +++ b/drivers/power/supply/gpio-charger.c @@ -222,8 +222,9 @@ static int init_charge_current_limit(struct device *dev, return -EINVAL; } - gpio_charger->current_limit_map = devm_kmalloc_array(dev, - len / 2, sizeof(*gpio_charger->current_limit_map), GFP_KERNEL); + gpio_charger->current_limit_map = devm_kmalloc_objs(dev, + *gpio_charger->current_limit_map, + len / 2); if (!gpio_charger->current_limit_map) return -ENOMEM; @@ -290,7 +291,7 @@ static int gpio_charger_probe(struct platform_device *pdev) return -ENOENT; } - gpio_charger = devm_kzalloc(dev, sizeof(*gpio_charger), GFP_KERNEL); + gpio_charger = devm_kzalloc_obj(dev, *gpio_charger); if (!gpio_charger) return -ENOMEM; gpio_charger->dev = dev; diff --git a/drivers/power/supply/huawei-gaokun-battery.c b/drivers/power/supply/huawei-gaokun-battery.c index e4dfec3b4241..c88eda5691e0 100644 --- a/drivers/power/supply/huawei-gaokun-battery.c +++ b/drivers/power/supply/huawei-gaokun-battery.c @@ -588,7 +588,7 @@ static int gaokun_psy_probe(struct auxiliary_device *adev, struct device *dev = &adev->dev; struct gaokun_psy *ecbat; - ecbat = devm_kzalloc(&adev->dev, sizeof(*ecbat), GFP_KERNEL); + ecbat = devm_kzalloc_obj(&adev->dev, *ecbat); if (!ecbat) return -ENOMEM; diff --git a/drivers/power/supply/ingenic-battery.c b/drivers/power/supply/ingenic-battery.c index 5be269f17bff..3f7029614ffb 100644 --- a/drivers/power/supply/ingenic-battery.c +++ b/drivers/power/supply/ingenic-battery.c @@ -130,7 +130,7 @@ static int ingenic_battery_probe(struct platform_device *pdev) struct power_supply_desc *desc; int ret; - bat = devm_kzalloc(dev, sizeof(*bat), GFP_KERNEL); + bat = devm_kzalloc_obj(dev, *bat); if (!bat) return -ENOMEM; diff --git a/drivers/power/supply/intel_dc_ti_battery.c b/drivers/power/supply/intel_dc_ti_battery.c index 5819df23a543..5414e8ea41c6 100644 --- a/drivers/power/supply/intel_dc_ti_battery.c +++ b/drivers/power/supply/intel_dc_ti_battery.c @@ -340,7 +340,7 @@ static int dc_ti_battery_probe(struct platform_device *pdev) fwnode_handle_put(args.fwnode); - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/power/supply/ip5xxx_power.c b/drivers/power/supply/ip5xxx_power.c index 24eea7a91b30..9a0e612423fa 100644 --- a/drivers/power/supply/ip5xxx_power.c +++ b/drivers/power/supply/ip5xxx_power.c @@ -834,7 +834,7 @@ static int ip5xxx_power_probe(struct i2c_client *client) struct power_supply *psy; struct ip5xxx *ip5xxx; - ip5xxx = devm_kzalloc(dev, sizeof(*ip5xxx), GFP_KERNEL); + ip5xxx = devm_kzalloc_obj(dev, *ip5xxx); if (!ip5xxx) return -ENOMEM; diff --git a/drivers/power/supply/ipaq_micro_battery.c b/drivers/power/supply/ipaq_micro_battery.c index 5e3fe3852d0e..f1d179b91aab 100644 --- a/drivers/power/supply/ipaq_micro_battery.c +++ b/drivers/power/supply/ipaq_micro_battery.c @@ -228,7 +228,7 @@ static int micro_batt_probe(struct platform_device *pdev) struct micro_battery *mb; int ret; - mb = devm_kzalloc(&pdev->dev, sizeof(*mb), GFP_KERNEL); + mb = devm_kzalloc_obj(&pdev->dev, *mb); if (!mb) return -ENOMEM; diff --git a/drivers/power/supply/isp1704_charger.c b/drivers/power/supply/isp1704_charger.c index e329321d06db..d9596b24e6ad 100644 --- a/drivers/power/supply/isp1704_charger.c +++ b/drivers/power/supply/isp1704_charger.c @@ -383,7 +383,7 @@ static int isp1704_charger_probe(struct platform_device *pdev) int ret = -ENODEV; struct power_supply_config psy_cfg = {}; - isp = devm_kzalloc(&pdev->dev, sizeof(*isp), GFP_KERNEL); + isp = devm_kzalloc_obj(&pdev->dev, *isp); if (!isp) return -ENOMEM; diff --git a/drivers/power/supply/lego_ev3_battery.c b/drivers/power/supply/lego_ev3_battery.c index 1e53f11a8e2b..5fd87efbfd70 100644 --- a/drivers/power/supply/lego_ev3_battery.c +++ b/drivers/power/supply/lego_ev3_battery.c @@ -158,7 +158,7 @@ static int lego_ev3_battery_probe(struct platform_device *pdev) struct power_supply_config psy_cfg = {}; int err; - batt = devm_kzalloc(dev, sizeof(*batt), GFP_KERNEL); + batt = devm_kzalloc_obj(dev, *batt); if (!batt) return -ENOMEM; diff --git a/drivers/power/supply/lenovo_yoga_c630_battery.c b/drivers/power/supply/lenovo_yoga_c630_battery.c index 7a6c8af9e8c2..a083e22d3b51 100644 --- a/drivers/power/supply/lenovo_yoga_c630_battery.c +++ b/drivers/power/supply/lenovo_yoga_c630_battery.c @@ -427,7 +427,7 @@ static int yoga_c630_psy_probe(struct auxiliary_device *adev, struct yoga_c630_psy *ecbat; int ret; - ecbat = devm_kzalloc(&adev->dev, sizeof(*ecbat), GFP_KERNEL); + ecbat = devm_kzalloc_obj(&adev->dev, *ecbat); if (!ecbat) return -ENOMEM; diff --git a/drivers/power/supply/lp8727_charger.c b/drivers/power/supply/lp8727_charger.c index 4537b7b413dd..337028601d81 100644 --- a/drivers/power/supply/lp8727_charger.c +++ b/drivers/power/supply/lp8727_charger.c @@ -444,7 +444,7 @@ static int lp8727_register_psy(struct lp8727_chg *pchg) struct power_supply_config psy_cfg = {}; /* Only for ac and usb */ struct lp8727_psy *psy; - psy = devm_kzalloc(pchg->dev, sizeof(*psy), GFP_KERNEL); + psy = devm_kzalloc_obj(pchg->dev, *psy); if (!psy) return -ENOMEM; @@ -475,7 +475,7 @@ static struct lp8727_chg_param { struct lp8727_chg_param *param; - param = devm_kzalloc(dev, sizeof(*param), GFP_KERNEL); + param = devm_kzalloc_obj(dev, *param); if (!param) goto out; @@ -492,7 +492,7 @@ static struct lp8727_platform_data *lp8727_parse_dt(struct device *dev) struct lp8727_platform_data *pdata; const char *type; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); @@ -538,7 +538,7 @@ static int lp8727_probe(struct i2c_client *cl) pdata = dev_get_platdata(&cl->dev); } - pchg = devm_kzalloc(&cl->dev, sizeof(*pchg), GFP_KERNEL); + pchg = devm_kzalloc_obj(&cl->dev, *pchg); if (!pchg) return -ENOMEM; diff --git a/drivers/power/supply/lp8788-charger.c b/drivers/power/supply/lp8788-charger.c index b8b74efc9671..f72c3ba5c6c8 100644 --- a/drivers/power/supply/lp8788-charger.c +++ b/drivers/power/supply/lp8788-charger.c @@ -681,7 +681,7 @@ static int lp8788_charger_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - pchg = devm_kzalloc(dev, sizeof(struct lp8788_charger), GFP_KERNEL); + pchg = devm_kzalloc_obj(dev, struct lp8788_charger); if (!pchg) return -ENOMEM; diff --git a/drivers/power/supply/lt3651-charger.c b/drivers/power/supply/lt3651-charger.c index ebfbdbcb7683..fe73c6626408 100644 --- a/drivers/power/supply/lt3651-charger.c +++ b/drivers/power/supply/lt3651-charger.c @@ -98,8 +98,7 @@ static int lt3651_charger_probe(struct platform_device *pdev) struct power_supply_desc *charger_desc; int ret; - lt3651_charger = devm_kzalloc(&pdev->dev, sizeof(*lt3651_charger), - GFP_KERNEL); + lt3651_charger = devm_kzalloc_obj(&pdev->dev, *lt3651_charger); if (!lt3651_charger) return -ENOMEM; diff --git a/drivers/power/supply/ltc2941-battery-gauge.c b/drivers/power/supply/ltc2941-battery-gauge.c index 6ebb555f203d..9924cbcacb11 100644 --- a/drivers/power/supply/ltc2941-battery-gauge.c +++ b/drivers/power/supply/ltc2941-battery-gauge.c @@ -449,7 +449,7 @@ static int ltc294x_i2c_probe(struct i2c_client *client) s32 r_sense; u8 status; - info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&client->dev, *info); if (info == NULL) return -ENOMEM; diff --git a/drivers/power/supply/ltc4162-l-charger.c b/drivers/power/supply/ltc4162-l-charger.c index 01b0511da9ae..31417e0f0ea6 100644 --- a/drivers/power/supply/ltc4162-l-charger.c +++ b/drivers/power/supply/ltc4162-l-charger.c @@ -1189,7 +1189,7 @@ static int ltc4162l_probe(struct i2c_client *client) dev_err(dev, "No support for SMBUS_WORD_DATA\n"); return -ENODEV; } - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/power/supply/macsmc-power.c b/drivers/power/supply/macsmc-power.c index ef735f86394e..ad2c4dea0334 100644 --- a/drivers/power/supply/macsmc-power.c +++ b/drivers/power/supply/macsmc-power.c @@ -653,7 +653,7 @@ static int macsmc_power_probe(struct platform_device *pdev) if (!smc) return -ENODEV; - power = devm_kzalloc(dev, sizeof(*power), GFP_KERNEL); + power = devm_kzalloc_obj(dev, *power); if (!power) return -ENOMEM; @@ -686,9 +686,8 @@ static int macsmc_power_probe(struct platform_device *pdev) if (has_battery) { power->batt_desc = macsmc_battery_desc_template; - props = devm_kcalloc(dev, MACSMC_MAX_BATT_PROPS, - sizeof(enum power_supply_property), - GFP_KERNEL); + props = devm_kzalloc_objs(dev, enum power_supply_property, + MACSMC_MAX_BATT_PROPS); if (!props) return -ENOMEM; @@ -818,9 +817,8 @@ static int macsmc_power_probe(struct platform_device *pdev) if (has_ac_adapter) { power->ac_desc = macsmc_ac_desc_template; - props = devm_kcalloc(dev, MACSMC_MAX_AC_PROPS, - sizeof(enum power_supply_property), - GFP_KERNEL); + props = devm_kzalloc_objs(dev, enum power_supply_property, + MACSMC_MAX_AC_PROPS); if (!props) return -ENOMEM; diff --git a/drivers/power/supply/max14577_charger.c b/drivers/power/supply/max14577_charger.c index a15d94942184..00bb07bee21a 100644 --- a/drivers/power/supply/max14577_charger.c +++ b/drivers/power/supply/max14577_charger.c @@ -465,7 +465,7 @@ static struct max14577_charger_platform_data *max14577_charger_dt_init( return ERR_PTR(-EINVAL); } - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); @@ -563,7 +563,7 @@ static int max14577_charger_probe(struct platform_device *pdev) struct max14577 *max14577 = dev_get_drvdata(pdev->dev.parent); int ret; - chg = devm_kzalloc(&pdev->dev, sizeof(*chg), GFP_KERNEL); + chg = devm_kzalloc_obj(&pdev->dev, *chg); if (!chg) return -ENOMEM; diff --git a/drivers/power/supply/max14656_charger_detector.c b/drivers/power/supply/max14656_charger_detector.c index f78d0341d0ef..9d64325f218a 100644 --- a/drivers/power/supply/max14656_charger_detector.c +++ b/drivers/power/supply/max14656_charger_detector.c @@ -252,7 +252,7 @@ static int max14656_probe(struct i2c_client *client) return -ENODEV; } - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c index 16e42de28436..5c7f25acffed 100644 --- a/drivers/power/supply/max17040_battery.c +++ b/drivers/power/supply/max17040_battery.c @@ -480,7 +480,7 @@ static int max17040_probe(struct i2c_client *client) bool enable_irq = false; int ret; - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c index f67ec2f0d3b6..ae7e9b42579c 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -1332,7 +1332,7 @@ static int max17042_apply_battery_properties(struct max17042_chip *chip, config = chip->config_data; if (!config) { - config = devm_kzalloc(dev, sizeof(*config), GFP_KERNEL); + config = devm_kzalloc_obj(dev, *config); if (!config) return -ENOMEM; } @@ -1446,7 +1446,7 @@ static int max17042_probe(struct i2c_client *client, struct device *dev, int irq if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) return -EIO; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/power/supply/max1720x_battery.c b/drivers/power/supply/max1720x_battery.c index e2bd54ee3970..4686b871be68 100644 --- a/drivers/power/supply/max1720x_battery.c +++ b/drivers/power/supply/max1720x_battery.c @@ -589,7 +589,7 @@ static int max1720x_probe(struct i2c_client *client) struct power_supply *bat; int ret; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/power/supply/max1721x_battery.c b/drivers/power/supply/max1721x_battery.c index bac43ab9e97c..450cd1f62bc5 100644 --- a/drivers/power/supply/max1721x_battery.c +++ b/drivers/power/supply/max1721x_battery.c @@ -325,7 +325,7 @@ static int devm_w1_max1721x_add_device(struct w1_slave *sl) struct power_supply_config psy_cfg = {}; struct max17211_device_info *info; - info = devm_kzalloc(&sl->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&sl->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/power/supply/max77650-charger.c b/drivers/power/supply/max77650-charger.c index 4ae43668992e..154fcd6aa71c 100644 --- a/drivers/power/supply/max77650-charger.c +++ b/drivers/power/supply/max77650-charger.c @@ -286,7 +286,7 @@ static int max77650_charger_probe(struct platform_device *pdev) dev = &pdev->dev; parent = dev->parent; - chg = devm_kzalloc(dev, sizeof(*chg), GFP_KERNEL); + chg = devm_kzalloc_obj(dev, *chg); if (!chg) return -ENOMEM; diff --git a/drivers/power/supply/max77693_charger.c b/drivers/power/supply/max77693_charger.c index 76c58b32a374..d6f07e59f751 100644 --- a/drivers/power/supply/max77693_charger.c +++ b/drivers/power/supply/max77693_charger.c @@ -724,7 +724,7 @@ static int max77693_charger_probe(struct platform_device *pdev) struct max77693_dev *max77693 = dev_get_drvdata(pdev->dev.parent); int ret; - chg = devm_kzalloc(&pdev->dev, sizeof(*chg), GFP_KERNEL); + chg = devm_kzalloc_obj(&pdev->dev, *chg); if (!chg) return -ENOMEM; diff --git a/drivers/power/supply/max77705_charger.c b/drivers/power/supply/max77705_charger.c index 63b0b4f0cd21..ca9ad041f1ed 100644 --- a/drivers/power/supply/max77705_charger.c +++ b/drivers/power/supply/max77705_charger.c @@ -607,7 +607,7 @@ static int max77705_charger_probe(struct i2c_client *i2c) dev = &i2c->dev; - chg = devm_kzalloc(dev, sizeof(*chg), GFP_KERNEL); + chg = devm_kzalloc_obj(dev, *chg); if (!chg) return -ENOMEM; diff --git a/drivers/power/supply/max77759_charger.c b/drivers/power/supply/max77759_charger.c index 689fc733fa3f..a93adb266f01 100644 --- a/drivers/power/supply/max77759_charger.c +++ b/drivers/power/supply/max77759_charger.c @@ -690,7 +690,7 @@ static int max77759_charger_probe(struct platform_device *pdev) int ret; device_set_of_node_from_dev(dev, dev->parent); - chg = devm_kzalloc(dev, sizeof(*chg), GFP_KERNEL); + chg = devm_kzalloc_obj(dev, *chg); if (!chg) return -ENOMEM; diff --git a/drivers/power/supply/max77976_charger.c b/drivers/power/supply/max77976_charger.c index 9a8a09d2a55e..379b862a7048 100644 --- a/drivers/power/supply/max77976_charger.c +++ b/drivers/power/supply/max77976_charger.c @@ -446,7 +446,7 @@ static int max77976_probe(struct i2c_client *client) int err; int i; - chg = devm_kzalloc(dev, sizeof(*chg), GFP_KERNEL); + chg = devm_kzalloc_obj(dev, *chg); if (!chg) return -ENOMEM; diff --git a/drivers/power/supply/max8903_charger.c b/drivers/power/supply/max8903_charger.c index 35c785b940f5..1f76a8ed0608 100644 --- a/drivers/power/supply/max8903_charger.c +++ b/drivers/power/supply/max8903_charger.c @@ -511,10 +511,9 @@ static int max8903_parse_dc_current_limit(struct platform_device *pdev, } data->dc_current_limit_map_size = map_size / 2; - data->dc_current_limit_map = devm_kcalloc(dev, - data->dc_current_limit_map_size, - sizeof(*data->dc_current_limit_map), - GFP_KERNEL); + data->dc_current_limit_map = devm_kzalloc_objs(dev, + *data->dc_current_limit_map, + data->dc_current_limit_map_size); if (!data->dc_current_limit_map) { kfree(map); return -ENOMEM; @@ -700,7 +699,7 @@ static int max8903_probe(struct platform_device *pdev) struct power_supply_config psy_cfg = {}; int ret = 0; - data = devm_kzalloc(dev, sizeof(struct max8903_data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct max8903_data); if (!data) return -ENOMEM; diff --git a/drivers/power/supply/max8925_power.c b/drivers/power/supply/max8925_power.c index d753145de3bb..9928f83275f5 100644 --- a/drivers/power/supply/max8925_power.c +++ b/drivers/power/supply/max8925_power.c @@ -471,9 +471,7 @@ max8925_power_dt_init(struct platform_device *pdev) return NULL; } - pdata = devm_kzalloc(&pdev->dev, - sizeof(struct max8925_power_pdata), - GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, struct max8925_power_pdata); if (!pdata) goto ret; @@ -515,8 +513,7 @@ static int max8925_power_probe(struct platform_device *pdev) return -EINVAL; } - info = devm_kzalloc(&pdev->dev, sizeof(struct max8925_power_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct max8925_power_info); if (!info) return -ENOMEM; info->chip = chip; diff --git a/drivers/power/supply/max8971_charger.c b/drivers/power/supply/max8971_charger.c index 0d69e9f44c05..54cdad4dba7d 100644 --- a/drivers/power/supply/max8971_charger.c +++ b/drivers/power/supply/max8971_charger.c @@ -646,7 +646,7 @@ static int max8971_probe(struct i2c_client *client) struct power_supply_config cfg = { }; int err, i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/power/supply/max8997_charger.c b/drivers/power/supply/max8997_charger.c index 19da9eff0372..a1abb143dd83 100644 --- a/drivers/power/supply/max8997_charger.c +++ b/drivers/power/supply/max8997_charger.c @@ -213,7 +213,7 @@ static int max8997_battery_probe(struct platform_device *pdev) return ret; } - charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); + charger = devm_kzalloc_obj(&pdev->dev, *charger); if (!charger) return -ENOMEM; diff --git a/drivers/power/supply/max8998_charger.c b/drivers/power/supply/max8998_charger.c index 13071350f318..eefada4a1f3c 100644 --- a/drivers/power/supply/max8998_charger.c +++ b/drivers/power/supply/max8998_charger.c @@ -101,8 +101,7 @@ static int max8998_battery_probe(struct platform_device *pdev) return -ENODEV; } - max8998 = devm_kzalloc(&pdev->dev, sizeof(struct max8998_battery_data), - GFP_KERNEL); + max8998 = devm_kzalloc_obj(&pdev->dev, struct max8998_battery_data); if (!max8998) return -ENOMEM; diff --git a/drivers/power/supply/mm8013.c b/drivers/power/supply/mm8013.c index c38f48338d42..a8d4416e857f 100644 --- a/drivers/power/supply/mm8013.c +++ b/drivers/power/supply/mm8013.c @@ -257,7 +257,7 @@ static int mm8013_probe(struct i2c_client *client) return dev_err_probe(dev, -EIO, "I2C_FUNC_SMBUS_WORD_DATA not supported\n"); - chip = devm_kzalloc(dev, sizeof(struct mm8013_chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, struct mm8013_chip); if (!chip) return -ENOMEM; diff --git a/drivers/power/supply/mp2629_charger.c b/drivers/power/supply/mp2629_charger.c index 0aace0040259..24af66be3007 100644 --- a/drivers/power/supply/mp2629_charger.c +++ b/drivers/power/supply/mp2629_charger.c @@ -566,7 +566,7 @@ static int mp2629_charger_probe(struct platform_device *pdev) struct power_supply_config psy_cfg = {}; int ret, i, irq; - charger = devm_kzalloc(dev, sizeof(*charger), GFP_KERNEL); + charger = devm_kzalloc_obj(dev, *charger); if (!charger) return -ENOMEM; diff --git a/drivers/power/supply/mt6360_charger.c b/drivers/power/supply/mt6360_charger.c index b4d462343151..b927870a54f7 100644 --- a/drivers/power/supply/mt6360_charger.c +++ b/drivers/power/supply/mt6360_charger.c @@ -782,7 +782,7 @@ static int mt6360_charger_probe(struct platform_device *pdev) struct regulator_config config = { }; int ret; - mci = devm_kzalloc(&pdev->dev, sizeof(*mci), GFP_KERNEL); + mci = devm_kzalloc_obj(&pdev->dev, *mci); if (!mci) return -ENOMEM; diff --git a/drivers/power/supply/mt6370-charger.c b/drivers/power/supply/mt6370-charger.c index 29ce34fd3804..ceb246b8bf34 100644 --- a/drivers/power/supply/mt6370-charger.c +++ b/drivers/power/supply/mt6370-charger.c @@ -849,7 +849,7 @@ static int mt6370_chg_probe(struct platform_device *pdev) struct mt6370_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/power/supply/olpc_battery.c b/drivers/power/supply/olpc_battery.c index 17433c58fcd4..fd755afb8dcb 100644 --- a/drivers/power/supply/olpc_battery.c +++ b/drivers/power/supply/olpc_battery.c @@ -638,7 +638,7 @@ static int olpc_battery_probe(struct platform_device *pdev) uint8_t ecver; int ret; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; platform_set_drvdata(pdev, data); diff --git a/drivers/power/supply/pf1550-charger.c b/drivers/power/supply/pf1550-charger.c index e3d4e9817f91..9a7b3a831cd4 100644 --- a/drivers/power/supply/pf1550-charger.c +++ b/drivers/power/supply/pf1550-charger.c @@ -553,7 +553,7 @@ static int pf1550_charger_probe(struct platform_device *pdev) struct pf1550_charger *chg; int i, irq, ret; - chg = devm_kzalloc(&pdev->dev, sizeof(*chg), GFP_KERNEL); + chg = devm_kzalloc_obj(&pdev->dev, *chg); if (!chg) return -ENOMEM; diff --git a/drivers/power/supply/pm8916_bms_vm.c b/drivers/power/supply/pm8916_bms_vm.c index b279f79f302c..3cea8c85ef3d 100644 --- a/drivers/power/supply/pm8916_bms_vm.c +++ b/drivers/power/supply/pm8916_bms_vm.c @@ -152,7 +152,7 @@ static int pm8916_bms_vm_battery_probe(struct platform_device *pdev) int ret, irq; unsigned int tmp; - bat = devm_kzalloc(dev, sizeof(*bat), GFP_KERNEL); + bat = devm_kzalloc_obj(dev, *bat); if (!bat) return -ENOMEM; diff --git a/drivers/power/supply/pm8916_lbc.c b/drivers/power/supply/pm8916_lbc.c index 6910b8c24343..c71d7862b2ba 100644 --- a/drivers/power/supply/pm8916_lbc.c +++ b/drivers/power/supply/pm8916_lbc.c @@ -252,7 +252,7 @@ static int pm8916_lbc_charger_probe(struct platform_device *pdev) int ret, len, irq; unsigned int tmp; - chg = devm_kzalloc(dev, sizeof(*chg), GFP_KERNEL); + chg = devm_kzalloc_obj(dev, *chg); if (!chg) return -ENOMEM; diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index de15314ef954..1cc203f2780b 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -202,9 +202,8 @@ static int power_supply_check_supplies_by_name(struct power_supply *psy) if (nval <= 0) return 0; - psy->supplied_from = devm_kmalloc_array(&psy->dev, nval, - sizeof(*psy->supplied_from), - GFP_KERNEL); + psy->supplied_from = devm_kmalloc_objs(&psy->dev, *psy->supplied_from, + nval); if (!psy->supplied_from) return -ENOMEM; @@ -320,9 +319,8 @@ static int power_supply_check_supplies(struct power_supply *psy) return power_supply_check_supplies_by_name(psy); /* All supplies found, allocate char * array for filling */ - psy->supplied_from = devm_kcalloc(&psy->dev, - cnt, sizeof(*psy->supplied_from), - GFP_KERNEL); + psy->supplied_from = devm_kzalloc_objs(&psy->dev, *psy->supplied_from, + cnt); if (!psy->supplied_from) return -ENOMEM; @@ -765,7 +763,7 @@ int power_supply_get_battery_info(struct power_supply *psy, goto out_put_node; } - info = devm_kzalloc(&psy->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&psy->dev, *info); if (!info) { err = -ENOMEM; goto out_put_node; @@ -921,7 +919,7 @@ int power_supply_get_battery_info(struct power_supply *psy, info->ocv_table_size[index] = tab_len; info->ocv_table[index] = table = - devm_kcalloc(&psy->dev, tab_len, sizeof(*table), GFP_KERNEL); + devm_kzalloc_objs(&psy->dev, *table, tab_len); if (!info->ocv_table[index]) { power_supply_put_battery_info(psy, info); err = -ENOMEM; @@ -959,10 +957,9 @@ int power_supply_get_battery_info(struct power_supply *psy, } info->resist_table_size = proplen / 2; - info->resist_table = resist_table = devm_kcalloc(&psy->dev, - info->resist_table_size, - sizeof(*resist_table), - GFP_KERNEL); + info->resist_table = resist_table = devm_kzalloc_objs(&psy->dev, + *resist_table, + info->resist_table_size); if (!info->resist_table) { power_supply_put_battery_info(psy, info); err = -ENOMEM; diff --git a/drivers/power/supply/power_supply_hwmon.c b/drivers/power/supply/power_supply_hwmon.c index 95245e6a6baa..3958e390ee01 100644 --- a/drivers/power/supply/power_supply_hwmon.c +++ b/drivers/power/supply/power_supply_hwmon.c @@ -381,7 +381,7 @@ int power_supply_add_hwmon_sysfs(struct power_supply *psy) GFP_KERNEL)) return -ENOMEM; - psyhw = devm_kzalloc(dev, sizeof(*psyhw), GFP_KERNEL); + psyhw = devm_kzalloc_obj(dev, *psyhw); if (!psyhw) { ret = -ENOMEM; goto error; diff --git a/drivers/power/supply/qcom_battmgr.c b/drivers/power/supply/qcom_battmgr.c index 636d6f6acecc..58e238e6fb2a 100644 --- a/drivers/power/supply/qcom_battmgr.c +++ b/drivers/power/supply/qcom_battmgr.c @@ -1662,7 +1662,7 @@ static int qcom_battmgr_probe(struct auxiliary_device *adev, struct device *dev = &adev->dev; int ret; - battmgr = devm_kzalloc(dev, sizeof(*battmgr), GFP_KERNEL); + battmgr = devm_kzalloc_obj(dev, *battmgr); if (!battmgr) return -ENOMEM; diff --git a/drivers/power/supply/qcom_smbb.c b/drivers/power/supply/qcom_smbb.c index f33aab9619c4..378c121e473e 100644 --- a/drivers/power/supply/qcom_smbb.c +++ b/drivers/power/supply/qcom_smbb.c @@ -837,7 +837,7 @@ static int smbb_charger_probe(struct platform_device *pdev) struct regulator_config config = { }; int rc, i; - chg = devm_kzalloc(&pdev->dev, sizeof(*chg), GFP_KERNEL); + chg = devm_kzalloc_obj(&pdev->dev, *chg); if (!chg) return -ENOMEM; diff --git a/drivers/power/supply/qcom_smbx.c b/drivers/power/supply/qcom_smbx.c index 52bb5a6eb145..8a2f635a6ccb 100644 --- a/drivers/power/supply/qcom_smbx.c +++ b/drivers/power/supply/qcom_smbx.c @@ -961,7 +961,7 @@ static int smb_probe(struct platform_device *pdev) int float_voltage_uv; int rc, irq; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; @@ -1008,7 +1008,7 @@ static int smb_probe(struct platform_device *pdev) supply_config.drv_data = chip; supply_config.fwnode = dev_fwnode(&pdev->dev); - desc = devm_kzalloc(chip->dev, sizeof(*desc), GFP_KERNEL); + desc = devm_kzalloc_obj(chip->dev, *desc); if (!desc) return -ENOMEM; memcpy(desc, &smb_psy_desc, sizeof(smb_psy_desc)); diff --git a/drivers/power/supply/rk817_charger.c b/drivers/power/supply/rk817_charger.c index 5558b182a1a6..39b45e085fc4 100644 --- a/drivers/power/supply/rk817_charger.c +++ b/drivers/power/supply/rk817_charger.c @@ -1076,7 +1076,7 @@ static int rk817_charger_probe(struct platform_device *pdev) if (ret) return ret; - charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); + charger = devm_kzalloc_obj(&pdev->dev, *charger); if (!charger) return -ENOMEM; diff --git a/drivers/power/supply/rn5t618_power.c b/drivers/power/supply/rn5t618_power.c index 84b9d6248489..92243a2f6a44 100644 --- a/drivers/power/supply/rn5t618_power.c +++ b/drivers/power/supply/rn5t618_power.c @@ -719,7 +719,7 @@ static int rn5t618_power_probe(struct platform_device *pdev) struct power_supply_config psy_cfg = {}; struct rn5t618_power_info *info; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/power/supply/rt5033_battery.c b/drivers/power/supply/rt5033_battery.c index 63333f6aa819..f8c3939708dd 100644 --- a/drivers/power/supply/rt5033_battery.c +++ b/drivers/power/supply/rt5033_battery.c @@ -147,7 +147,7 @@ static int rt5033_battery_probe(struct i2c_client *client) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) return -EIO; - battery = devm_kzalloc(&client->dev, sizeof(*battery), GFP_KERNEL); + battery = devm_kzalloc_obj(&client->dev, *battery); if (!battery) return -ENOMEM; diff --git a/drivers/power/supply/rt5033_charger.c b/drivers/power/supply/rt5033_charger.c index e545a6e7fad7..5d5419807970 100644 --- a/drivers/power/supply/rt5033_charger.c +++ b/drivers/power/supply/rt5033_charger.c @@ -666,7 +666,7 @@ static int rt5033_charger_probe(struct platform_device *pdev) struct device_node *np_conn, *np_edev; int ret; - charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); + charger = devm_kzalloc_obj(&pdev->dev, *charger); if (!charger) return -ENOMEM; diff --git a/drivers/power/supply/rt9455_charger.c b/drivers/power/supply/rt9455_charger.c index 313a7371211e..502410f5564a 100644 --- a/drivers/power/supply/rt9455_charger.c +++ b/drivers/power/supply/rt9455_charger.c @@ -1615,7 +1615,7 @@ static int rt9455_probe(struct i2c_client *client) dev_err(dev, "No support for SMBUS_BYTE_DATA\n"); return -ENODEV; } - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/power/supply/rt9467-charger.c b/drivers/power/supply/rt9467-charger.c index f0d10f44b109..9399c06ad50c 100644 --- a/drivers/power/supply/rt9467-charger.c +++ b/drivers/power/supply/rt9467-charger.c @@ -1205,7 +1205,7 @@ static int rt9467_charger_probe(struct i2c_client *i2c) struct gpio_desc *ceb_gpio; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/power/supply/rt9471.c b/drivers/power/supply/rt9471.c index b16d39a774dd..2eaa2db016c9 100644 --- a/drivers/power/supply/rt9471.c +++ b/drivers/power/supply/rt9471.c @@ -898,7 +898,7 @@ static int rt9471_probe(struct i2c_client *i2c) struct regmap *regmap; int ret; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/power/supply/rt9756.c b/drivers/power/supply/rt9756.c index a7b7e3fb69b1..7da6974b2099 100644 --- a/drivers/power/supply/rt9756.c +++ b/drivers/power/supply/rt9756.c @@ -641,7 +641,7 @@ static int rt9756_register_psy(struct rt9756_data *data) if (IS_ERR(data->bat_psy)) return dev_err_probe(dev, PTR_ERR(data->bat_psy), "Failed to register battery\n"); - supplied_to = devm_kzalloc(dev, sizeof(*supplied_to), GFP_KERNEL); + supplied_to = devm_kzalloc_obj(dev, *supplied_to); if (!supplied_to) return -ENOMEM; @@ -860,7 +860,7 @@ static int rt9756_probe(struct i2c_client *i2c) if (!dev_data) return dev_err_probe(dev, -EINVAL, "No device data found\n"); - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/power/supply/rx51_battery.c b/drivers/power/supply/rx51_battery.c index 57266921dc8e..fd8c50b07a3f 100644 --- a/drivers/power/supply/rx51_battery.c +++ b/drivers/power/supply/rx51_battery.c @@ -193,7 +193,7 @@ static int rx51_battery_probe(struct platform_device *pdev) struct power_supply_config psy_cfg = {}; struct rx51_device_info *di; - di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); + di = devm_kzalloc_obj(&pdev->dev, *di); if (!di) return -ENOMEM; diff --git a/drivers/power/supply/s2m-charger.c b/drivers/power/supply/s2m-charger.c index 4d1f2c2c7144..60a3c12683d9 100644 --- a/drivers/power/supply/s2m-charger.c +++ b/drivers/power/supply/s2m-charger.c @@ -245,7 +245,7 @@ static int s2m_chgr_probe(struct platform_device *pdev) work_func_t extcon_work_func; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/power/supply/s2mu005-battery.c b/drivers/power/supply/s2mu005-battery.c index a76154e5a091..712f05051935 100644 --- a/drivers/power/supply/s2mu005-battery.c +++ b/drivers/power/supply/s2mu005-battery.c @@ -248,7 +248,7 @@ static int s2mu005_fg_i2c_probe(struct i2c_client *client) const struct power_supply_desc *psy_desc; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c index 6714313bb3a3..8e8a1039d8be 100644 --- a/drivers/power/supply/sbs-battery.c +++ b/drivers/power/supply/sbs-battery.c @@ -1148,7 +1148,7 @@ static int sbs_probe(struct i2c_client *client) if (!sbs_desc->name) return -ENOMEM; - chip = devm_kzalloc(&client->dev, sizeof(struct sbs_info), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, struct sbs_info); if (!chip) return -ENOMEM; diff --git a/drivers/power/supply/sbs-charger.c b/drivers/power/supply/sbs-charger.c index bc40bbb429e6..497ed1a9fb5c 100644 --- a/drivers/power/supply/sbs-charger.c +++ b/drivers/power/supply/sbs-charger.c @@ -178,7 +178,7 @@ static int sbs_probe(struct i2c_client *client) if (!sbs_desc->name) return -ENOMEM; - chip = devm_kzalloc(&client->dev, sizeof(struct sbs_info), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, struct sbs_info); if (!chip) return -ENOMEM; diff --git a/drivers/power/supply/sbs-manager.c b/drivers/power/supply/sbs-manager.c index 9ad3fb117a4d..5071a4f29c5c 100644 --- a/drivers/power/supply/sbs-manager.c +++ b/drivers/power/supply/sbs-manager.c @@ -332,7 +332,7 @@ static int sbsm_probe(struct i2c_client *client) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) return -EPFNOSUPPORT; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/power/supply/sc2731_charger.c b/drivers/power/supply/sc2731_charger.c index 2b25e44da797..79a379711b14 100644 --- a/drivers/power/supply/sc2731_charger.c +++ b/drivers/power/supply/sc2731_charger.c @@ -459,7 +459,7 @@ static int sc2731_charger_probe(struct platform_device *pdev) struct power_supply_config charger_cfg = { }; int ret; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/power/supply/sc27xx_fuel_gauge.c b/drivers/power/supply/sc27xx_fuel_gauge.c index 0999fc5bc662..345fb5b3396c 100644 --- a/drivers/power/supply/sc27xx_fuel_gauge.c +++ b/drivers/power/supply/sc27xx_fuel_gauge.c @@ -1144,7 +1144,7 @@ static int sc27xx_fgu_probe(struct platform_device *pdev) struct sc27xx_fgu_data *data; int ret, irq; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/power/supply/sgm41542_charger.c b/drivers/power/supply/sgm41542_charger.c index 8880962528d6..efdaa28f124e 100644 --- a/drivers/power/supply/sgm41542_charger.c +++ b/drivers/power/supply/sgm41542_charger.c @@ -988,7 +988,7 @@ static int sgm4154x_probe(struct i2c_client *client) struct sgm4154x_device *sgm; int ret; - sgm = devm_kzalloc(dev, sizeof(*sgm), GFP_KERNEL); + sgm = devm_kzalloc_obj(dev, *sgm); if (!sgm) return -ENOMEM; diff --git a/drivers/power/supply/smb347-charger.c b/drivers/power/supply/smb347-charger.c index 72dfa15b3d80..0b8e12ae62e5 100644 --- a/drivers/power/supply/smb347-charger.c +++ b/drivers/power/supply/smb347-charger.c @@ -1537,7 +1537,7 @@ static int smb347_probe(struct i2c_client *client) struct smb347_charger *smb; int ret; - smb = devm_kzalloc(dev, sizeof(*smb), GFP_KERNEL); + smb = devm_kzalloc_obj(dev, *smb); if (!smb) return -ENOMEM; smb->dev = &client->dev; diff --git a/drivers/power/supply/stc3117_fuel_gauge.c b/drivers/power/supply/stc3117_fuel_gauge.c index 469f2b359920..81963b526eb9 100644 --- a/drivers/power/supply/stc3117_fuel_gauge.c +++ b/drivers/power/supply/stc3117_fuel_gauge.c @@ -532,7 +532,7 @@ static int stc3117_probe(struct i2c_client *client) struct power_supply_battery_info *info; int ret; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/power/supply/surface-rt-ec.c b/drivers/power/supply/surface-rt-ec.c index da57b0a1a495..b175bc63c504 100644 --- a/drivers/power/supply/surface-rt-ec.c +++ b/drivers/power/supply/surface-rt-ec.c @@ -269,7 +269,7 @@ static int srt_ec_probe(struct i2c_client *client) char str_buf[4]; int ret; - srt = devm_kzalloc(dev, sizeof(*srt), GFP_KERNEL); + srt = devm_kzalloc_obj(dev, *srt); if (!srt) return -ENOMEM; diff --git a/drivers/power/supply/surface_battery.c b/drivers/power/supply/surface_battery.c index 1273b6082311..dac19932c831 100644 --- a/drivers/power/supply/surface_battery.c +++ b/drivers/power/supply/surface_battery.c @@ -823,7 +823,7 @@ static int surface_battery_probe(struct ssam_device *sdev) if (!p) return -ENODEV; - bat = devm_kzalloc(&sdev->dev, sizeof(*bat), GFP_KERNEL); + bat = devm_kzalloc_obj(&sdev->dev, *bat); if (!bat) return -ENOMEM; diff --git a/drivers/power/supply/surface_charger.c b/drivers/power/supply/surface_charger.c index d4bba6b41794..e8e790f65975 100644 --- a/drivers/power/supply/surface_charger.c +++ b/drivers/power/supply/surface_charger.c @@ -237,7 +237,7 @@ static int surface_ac_probe(struct ssam_device *sdev) if (!p) return -ENODEV; - ac = devm_kzalloc(&sdev->dev, sizeof(*ac), GFP_KERNEL); + ac = devm_kzalloc_obj(&sdev->dev, *ac); if (!ac) return -ENOMEM; diff --git a/drivers/power/supply/tps65090-charger.c b/drivers/power/supply/tps65090-charger.c index 36340c56d272..c6f7f0d0cb88 100644 --- a/drivers/power/supply/tps65090-charger.c +++ b/drivers/power/supply/tps65090-charger.c @@ -191,7 +191,7 @@ static struct tps65090_platform_data * struct device_node *np = pdev->dev.of_node; unsigned int prop; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) { dev_err(&pdev->dev, "Memory alloc for tps65090_pdata failed\n"); return NULL; @@ -246,7 +246,7 @@ static int tps65090_charger_probe(struct platform_device *pdev) return -ENODEV; } - cdata = devm_kzalloc(&pdev->dev, sizeof(*cdata), GFP_KERNEL); + cdata = devm_kzalloc_obj(&pdev->dev, *cdata); if (!cdata) { dev_err(&pdev->dev, "failed to allocate memory status\n"); return -ENOMEM; diff --git a/drivers/power/supply/tps65217_charger.c b/drivers/power/supply/tps65217_charger.c index cd00a3f372b3..2d11c5fcaf33 100644 --- a/drivers/power/supply/tps65217_charger.c +++ b/drivers/power/supply/tps65217_charger.c @@ -190,7 +190,7 @@ static int tps65217_charger_probe(struct platform_device *pdev) int ret; int i; - charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); + charger = devm_kzalloc_obj(&pdev->dev, *charger); if (!charger) return -ENOMEM; diff --git a/drivers/power/supply/twl4030_charger.c b/drivers/power/supply/twl4030_charger.c index e6c9b2b1ffce..35b974c0a44a 100644 --- a/drivers/power/supply/twl4030_charger.c +++ b/drivers/power/supply/twl4030_charger.c @@ -934,7 +934,7 @@ twl4030_bci_parse_dt(struct device *dev) if (!np) return NULL; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return pdata; @@ -979,7 +979,7 @@ static int twl4030_bci_probe(struct platform_device *pdev) int ret; u32 reg; - bci = devm_kzalloc(&pdev->dev, sizeof(*bci), GFP_KERNEL); + bci = devm_kzalloc_obj(&pdev->dev, *bci); if (bci == NULL) return -ENOMEM; diff --git a/drivers/power/supply/twl4030_madc_battery.c b/drivers/power/supply/twl4030_madc_battery.c index 5e04b4f0a135..40634839261b 100644 --- a/drivers/power/supply/twl4030_madc_battery.c +++ b/drivers/power/supply/twl4030_madc_battery.c @@ -187,8 +187,7 @@ static int twl4030_madc_battery_probe(struct platform_device *pdev) struct twl4030_madc_bat_platform_data *pdata = pdev->dev.platform_data; struct power_supply_config psy_cfg = {}; - twl4030_madc_bat = devm_kzalloc(&pdev->dev, sizeof(*twl4030_madc_bat), - GFP_KERNEL); + twl4030_madc_bat = devm_kzalloc_obj(&pdev->dev, *twl4030_madc_bat); if (!twl4030_madc_bat) return -ENOMEM; diff --git a/drivers/power/supply/twl6030_charger.c b/drivers/power/supply/twl6030_charger.c index e8ef221fa0f3..5812d44cf41c 100644 --- a/drivers/power/supply/twl6030_charger.c +++ b/drivers/power/supply/twl6030_charger.c @@ -453,7 +453,7 @@ static int twl6030_charger_probe(struct platform_device *pdev) int ret; u8 val; - charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); + charger = devm_kzalloc_obj(&pdev->dev, *charger); if (!charger) return -ENOMEM; diff --git a/drivers/power/supply/ucs1002_power.c b/drivers/power/supply/ucs1002_power.c index bf13e958982e..f6a3e5da9be6 100644 --- a/drivers/power/supply/ucs1002_power.c +++ b/drivers/power/supply/ucs1002_power.c @@ -544,7 +544,7 @@ static int ucs1002_probe(struct i2c_client *client) struct ucs1002_info *info; unsigned int regval; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/power/supply/ug3105_battery.c b/drivers/power/supply/ug3105_battery.c index cccf7499e129..ff29a3ab66f9 100644 --- a/drivers/power/supply/ug3105_battery.c +++ b/drivers/power/supply/ug3105_battery.c @@ -134,7 +134,7 @@ static int ug3105_probe(struct i2c_client *client) struct ug3105_chip *chip; int ret; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/power/supply/wm831x_backup.c b/drivers/power/supply/wm831x_backup.c index 9673fcf7f3af..ac6dd5b20a50 100644 --- a/drivers/power/supply/wm831x_backup.c +++ b/drivers/power/supply/wm831x_backup.c @@ -165,8 +165,7 @@ static int wm831x_backup_probe(struct platform_device *pdev) struct wm831x_pdata *wm831x_pdata = wm831x->dev->platform_data; struct wm831x_backup *devdata; - devdata = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_backup), - GFP_KERNEL); + devdata = devm_kzalloc_obj(&pdev->dev, struct wm831x_backup); if (devdata == NULL) return -ENOMEM; diff --git a/drivers/power/supply/wm831x_power.c b/drivers/power/supply/wm831x_power.c index 78fa0573ef25..d4e85c233be9 100644 --- a/drivers/power/supply/wm831x_power.c +++ b/drivers/power/supply/wm831x_power.c @@ -542,8 +542,7 @@ static int wm831x_power_probe(struct platform_device *pdev) struct wm831x_power *power; int ret, irq, i; - power = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_power), - GFP_KERNEL); + power = devm_kzalloc_obj(&pdev->dev, struct wm831x_power); if (power == NULL) return -ENOMEM; diff --git a/drivers/power/supply/wm97xx_battery.c b/drivers/power/supply/wm97xx_battery.c index a6c55b1e0286..9c66dd490fa4 100644 --- a/drivers/power/supply/wm97xx_battery.c +++ b/drivers/power/supply/wm97xx_battery.c @@ -192,7 +192,7 @@ static int wm97xx_bat_probe(struct platform_device *dev) if (pdata->min_voltage >= 0) props++; /* POWER_SUPPLY_PROP_VOLTAGE_MIN */ - prop = devm_kcalloc(&dev->dev, props, sizeof(*prop), GFP_KERNEL); + prop = devm_kzalloc_objs(&dev->dev, *prop, props); if (!prop) return -ENOMEM; diff --git a/drivers/powercap/arm_scmi_powercap.c b/drivers/powercap/arm_scmi_powercap.c index ab66e9a3b1e2..63a956cf8d2b 100644 --- a/drivers/powercap/arm_scmi_powercap.c +++ b/drivers/powercap/arm_scmi_powercap.c @@ -432,7 +432,7 @@ static int scmi_powercap_probe(struct scmi_device *sdev) if (IS_ERR(powercap_ops)) return PTR_ERR(powercap_ops); - pr = devm_kzalloc(dev, sizeof(*pr), GFP_KERNEL); + pr = devm_kzalloc_obj(dev, *pr); if (!pr) return -ENOMEM; @@ -443,15 +443,13 @@ static int scmi_powercap_probe(struct scmi_device *sdev) } pr->num_zones = ret; - pr->spzones = devm_kcalloc(dev, pr->num_zones, - sizeof(*pr->spzones), GFP_KERNEL); + pr->spzones = devm_kzalloc_objs(dev, *pr->spzones, pr->num_zones); if (!pr->spzones) return -ENOMEM; /* Allocate for worst possible scenario of maximum tree height. */ - pr->registered_zones = devm_kcalloc(dev, pr->num_zones, - sizeof(*pr->registered_zones), - GFP_KERNEL); + pr->registered_zones = devm_kzalloc_objs(dev, *pr->registered_zones, + pr->num_zones); if (!pr->registered_zones) return -ENOMEM; diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c index 73ec2c7335e5..fbaa1e3413a8 100644 --- a/drivers/pps/clients/pps-gpio.c +++ b/drivers/pps/clients/pps-gpio.c @@ -150,7 +150,7 @@ static int pps_gpio_probe(struct platform_device *pdev) int pps_default_params; /* allocate space for device info */ - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/pps/generators/pps_gen_tio.c b/drivers/pps/generators/pps_gen_tio.c index 5088aaf1a63a..c6d41fb2105f 100644 --- a/drivers/pps/generators/pps_gen_tio.c +++ b/drivers/pps/generators/pps_gen_tio.c @@ -203,7 +203,7 @@ static int pps_gen_tio_probe(struct platform_device *pdev) return -ENODEV; } - tio = devm_kzalloc(dev, sizeof(*tio), GFP_KERNEL); + tio = devm_kzalloc_obj(dev, *tio); if (!tio) return -ENOMEM; diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c index 59cd6bbb33f3..6fd1fb669d6d 100644 --- a/drivers/ptp/ptp_clockmatrix.c +++ b/drivers/ptp/ptp_clockmatrix.c @@ -2391,7 +2391,7 @@ static int idtcm_probe(struct platform_device *pdev) int err; u8 i; - idtcm = devm_kzalloc(&pdev->dev, sizeof(struct idtcm), GFP_KERNEL); + idtcm = devm_kzalloc_obj(&pdev->dev, struct idtcm); if (!idtcm) return -ENOMEM; diff --git a/drivers/ptp/ptp_dfl_tod.c b/drivers/ptp/ptp_dfl_tod.c index f699d541b360..eaa3b4c683c4 100644 --- a/drivers/ptp/ptp_dfl_tod.c +++ b/drivers/ptp/ptp_dfl_tod.c @@ -282,7 +282,7 @@ static int dfl_tod_probe(struct dfl_device *ddev) struct device *dev = &ddev->dev; struct dfl_tod *dt; - dt = devm_kzalloc(dev, sizeof(*dt), GFP_KERNEL); + dt = devm_kzalloc_obj(dev, *dt); if (!dt) return -ENOMEM; diff --git a/drivers/ptp/ptp_dte.c b/drivers/ptp/ptp_dte.c index 834ecacc7bd3..a6ea65cd468d 100644 --- a/drivers/ptp/ptp_dte.c +++ b/drivers/ptp/ptp_dte.c @@ -231,7 +231,7 @@ static int ptp_dte_probe(struct platform_device *pdev) struct ptp_dte *ptp_dte; struct device *dev = &pdev->dev; - ptp_dte = devm_kzalloc(dev, sizeof(struct ptp_dte), GFP_KERNEL); + ptp_dte = devm_kzalloc_obj(dev, struct ptp_dte); if (!ptp_dte) return -ENOMEM; diff --git a/drivers/ptp/ptp_fc3.c b/drivers/ptp/ptp_fc3.c index 02b973995d7c..c84b60fa1ff5 100644 --- a/drivers/ptp/ptp_fc3.c +++ b/drivers/ptp/ptp_fc3.c @@ -951,7 +951,7 @@ static int idtfc3_probe(struct platform_device *pdev) struct idtfc3 *idtfc3; int err; - idtfc3 = devm_kzalloc(&pdev->dev, sizeof(struct idtfc3), GFP_KERNEL); + idtfc3 = devm_kzalloc_obj(&pdev->dev, struct idtfc3); if (!idtfc3) return -ENOMEM; diff --git a/drivers/ptp/ptp_idt82p33.c b/drivers/ptp/ptp_idt82p33.c index ffc2ec1fc4be..ef141311b6c3 100644 --- a/drivers/ptp/ptp_idt82p33.c +++ b/drivers/ptp/ptp_idt82p33.c @@ -1396,8 +1396,7 @@ static int idt82p33_probe(struct platform_device *pdev) int err; u8 i; - idt82p33 = devm_kzalloc(&pdev->dev, - sizeof(struct idt82p33), GFP_KERNEL); + idt82p33 = devm_kzalloc_obj(&pdev->dev, struct idt82p33); if (!idt82p33) return -ENOMEM; diff --git a/drivers/ptp/ptp_netc.c b/drivers/ptp/ptp_netc.c index 19ca99d80e95..1a327a7561e3 100644 --- a/drivers/ptp/ptp_netc.c +++ b/drivers/ptp/ptp_netc.c @@ -803,7 +803,7 @@ static int netc_timer_pci_probe(struct pci_dev *pdev) struct netc_timer *priv; int err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c index f854da2fd812..68dfc48ad43b 100644 --- a/drivers/ptp/ptp_pch.c +++ b/drivers/ptp/ptp_pch.c @@ -452,7 +452,7 @@ pch_probe(struct pci_dev *pdev, const struct pci_device_id *id) unsigned long flags; struct pch_dev *chip; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (chip == NULL) return -ENOMEM; diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c index bb0e14bac9f2..7f25fe6c2ce2 100644 --- a/drivers/ptp/ptp_vmclock.c +++ b/drivers/ptp/ptp_vmclock.c @@ -665,7 +665,7 @@ static int vmclock_probe(struct platform_device *pdev) struct vmclock_state *st; int ret; - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/pwm/pwm-dwc.c b/drivers/pwm/pwm-dwc.c index 8ba7ef2c27d0..eadb11c28ad3 100644 --- a/drivers/pwm/pwm-dwc.c +++ b/drivers/pwm/pwm-dwc.c @@ -68,7 +68,7 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id) pci_set_master(pci); info = (const struct dwc_pwm_info *)id->driver_data; - ddata = devm_kzalloc(dev, struct_size(ddata, chips, info->nr), GFP_KERNEL); + ddata = devm_kzalloc_flex(dev, *ddata, chips, info->nr); if (!ddata) return -ENOMEM; diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c index e42af9007546..a8e34939ba27 100644 --- a/drivers/pwm/pwm-lp3943.c +++ b/drivers/pwm/pwm-lp3943.c @@ -226,7 +226,7 @@ static int lp3943_pwm_parse_dt(struct device *dev, if (!node) return -EINVAL; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; @@ -240,8 +240,7 @@ static int lp3943_pwm_parse_dt(struct device *dev, if (num_outputs <= 0) continue; - output = devm_kcalloc(dev, num_outputs, sizeof(*output), - GFP_KERNEL); + output = devm_kzalloc_objs(dev, *output, num_outputs); if (!output) return -ENOMEM; @@ -250,7 +249,7 @@ static int lp3943_pwm_parse_dt(struct device *dev, if (err) return err; - pwm_map = devm_kzalloc(dev, sizeof(*pwm_map), GFP_KERNEL); + pwm_map = devm_kzalloc_obj(dev, *pwm_map); if (!pwm_map) return -ENOMEM; diff --git a/drivers/pwm/pwm-sti.c b/drivers/pwm/pwm-sti.c index e5c3cf594571..c1beacb26b4d 100644 --- a/drivers/pwm/pwm-sti.c +++ b/drivers/pwm/pwm-sti.c @@ -602,8 +602,7 @@ static int sti_pwm_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(pc->cpt_clk), "failed to get PWM capture clock\n"); - pc->ddata = devm_kcalloc(dev, cpt_num_devs, - sizeof(*pc->ddata), GFP_KERNEL); + pc->ddata = devm_kzalloc_objs(dev, *pc->ddata, cpt_num_devs); if (!pc->ddata) return -ENOMEM; diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c index 882b6e58e911..c2460f5904b9 100644 --- a/drivers/regulator/act8865-regulator.c +++ b/drivers/regulator/act8865-regulator.c @@ -711,7 +711,7 @@ static int act8865_pmic_probe(struct i2c_client *client) return -EINVAL; } - act8865 = devm_kzalloc(dev, sizeof(struct act8865), GFP_KERNEL); + act8865 = devm_kzalloc_obj(dev, struct act8865); if (!act8865) return -ENOMEM; diff --git a/drivers/regulator/act8945a-regulator.c b/drivers/regulator/act8945a-regulator.c index 5bbe2bce740e..7c9711b72775 100644 --- a/drivers/regulator/act8945a-regulator.c +++ b/drivers/regulator/act8945a-regulator.c @@ -280,7 +280,7 @@ static int act8945a_pmic_probe(struct platform_device *pdev) int i, num_regulators; bool voltage_select; - act8945a = devm_kzalloc(&pdev->dev, sizeof(*act8945a), GFP_KERNEL); + act8945a = devm_kzalloc_obj(&pdev->dev, *act8945a); if (!act8945a) return -ENOMEM; diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c index 0123ca8157a8..0bdaa46532e0 100644 --- a/drivers/regulator/ad5398.c +++ b/drivers/regulator/ad5398.c @@ -222,7 +222,7 @@ static int ad5398_probe(struct i2c_client *client) const struct ad5398_current_data_format *df = (struct ad5398_current_data_format *)id->driver_data; - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/regulator/adp5055-regulator.c b/drivers/regulator/adp5055-regulator.c index 194dcfe4f527..cb7314d57cc5 100644 --- a/drivers/regulator/adp5055-regulator.c +++ b/drivers/regulator/adp5055-regulator.c @@ -354,7 +354,7 @@ static int adp5055_probe(struct i2c_client *client) if (!init_data) return -EINVAL; - adp5055 = devm_kzalloc(dev, sizeof(struct adp5055), GFP_KERNEL); + adp5055 = devm_kzalloc_obj(dev, struct adp5055); if (!adp5055) return -ENOMEM; diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 700bd0343196..04cbd41a95a4 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c @@ -172,7 +172,7 @@ static int anatop_regulator_probe(struct platform_device *pdev) int ret = 0; u32 val; - sreg = devm_kzalloc(dev, sizeof(*sreg), GFP_KERNEL); + sreg = devm_kzalloc_obj(dev, *sreg); if (!sreg) return -ENOMEM; diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c index 501843996faa..ae4df04cbcbf 100644 --- a/drivers/regulator/arizona-ldo1.c +++ b/drivers/regulator/arizona-ldo1.c @@ -300,7 +300,7 @@ static int arizona_ldo1_probe(struct platform_device *pdev) bool external_dcvdd; int ret; - ldo1 = devm_kzalloc(&pdev->dev, sizeof(*ldo1), GFP_KERNEL); + ldo1 = devm_kzalloc_obj(&pdev->dev, *ldo1); if (!ldo1) return -ENOMEM; @@ -354,7 +354,7 @@ static int madera_ldo1_probe(struct platform_device *pdev) bool external_dcvdd; int ret; - ldo1 = devm_kzalloc(&pdev->dev, sizeof(*ldo1), GFP_KERNEL); + ldo1 = devm_kzalloc_obj(&pdev->dev, *ldo1); if (!ldo1) return -ENOMEM; diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c index be7208bc7409..5886b468ed5b 100644 --- a/drivers/regulator/arizona-micsupp.c +++ b/drivers/regulator/arizona-micsupp.c @@ -306,7 +306,7 @@ static int arizona_micsupp_probe(struct platform_device *pdev) const struct regulator_desc *desc; struct arizona_micsupp *micsupp; - micsupp = devm_kzalloc(&pdev->dev, sizeof(*micsupp), GFP_KERNEL); + micsupp = devm_kzalloc_obj(&pdev->dev, *micsupp); if (!micsupp) return -ENOMEM; @@ -342,7 +342,7 @@ static int madera_micsupp_probe(struct platform_device *pdev) struct madera *madera = dev_get_drvdata(pdev->dev.parent); struct arizona_micsupp *micsupp; - micsupp = devm_kzalloc(&pdev->dev, sizeof(*micsupp), GFP_KERNEL); + micsupp = devm_kzalloc_obj(&pdev->dev, *micsupp); if (!micsupp) return -ENOMEM; diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c index 85e2aaa1a06b..42e5fc54f95f 100644 --- a/drivers/regulator/as3722-regulator.c +++ b/drivers/regulator/as3722-regulator.c @@ -642,8 +642,7 @@ static int as3722_regulator_probe(struct platform_device *pdev) int id; int ret; - as3722_regs = devm_kzalloc(&pdev->dev, sizeof(*as3722_regs), - GFP_KERNEL); + as3722_regs = devm_kzalloc_obj(&pdev->dev, *as3722_regs); if (!as3722_regs) return -ENOMEM; diff --git a/drivers/regulator/atc260x-regulator.c b/drivers/regulator/atc260x-regulator.c index 3e9f8fd54fca..f795330ef741 100644 --- a/drivers/regulator/atc260x-regulator.c +++ b/drivers/regulator/atc260x-regulator.c @@ -481,7 +481,7 @@ static int atc260x_regulator_probe(struct platform_device *pdev) bool atc2603c_ver_b = false; int i, nregulators; - atc260x_data = devm_kzalloc(&pdev->dev, sizeof(*atc260x_data), GFP_KERNEL); + atc260x_data = devm_kzalloc_obj(&pdev->dev, *atc260x_data); if (!atc260x_data) return -ENOMEM; diff --git a/drivers/regulator/aw37503-regulator.c b/drivers/regulator/aw37503-regulator.c index ca5f2a14c28c..27a779e4cf50 100644 --- a/drivers/regulator/aw37503-regulator.c +++ b/drivers/regulator/aw37503-regulator.c @@ -184,7 +184,7 @@ static int aw37503_probe(struct i2c_client *client) struct regulator_config config = { }; int id; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c index ec6ec071ffde..e88da44aa2a0 100644 --- a/drivers/regulator/axp20x-regulator.c +++ b/drivers/regulator/axp20x-regulator.c @@ -1652,8 +1652,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev) (regulators == axp803_regulators && i == AXP803_DC1SW) || (regulators == axp809_regulators && i == AXP809_DC1SW) || (regulators == axp15060_regulators && i == AXP15060_SW)) { - new_desc = devm_kzalloc(&pdev->dev, sizeof(*new_desc), - GFP_KERNEL); + new_desc = devm_kzalloc_obj(&pdev->dev, *new_desc); if (!new_desc) return -ENOMEM; @@ -1665,8 +1664,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev) if ((regulators == axp22x_regulators && i == AXP22X_DC5LDO) || (regulators == axp809_regulators && i == AXP809_DC5LDO) || (regulators == axp15060_regulators && i == AXP15060_CPUSLDO)) { - new_desc = devm_kzalloc(&pdev->dev, sizeof(*new_desc), - GFP_KERNEL); + new_desc = devm_kzalloc_obj(&pdev->dev, *new_desc); if (!new_desc) return -ENOMEM; @@ -1677,8 +1675,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev) if (regulators == axp15060_regulators && i == AXP15060_RTC_LDO) { - new_desc = devm_kzalloc(&pdev->dev, sizeof(*new_desc), - GFP_KERNEL); + new_desc = devm_kzalloc_obj(&pdev->dev, *new_desc); if (!new_desc) return -ENOMEM; diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c index 50414f4cb109..1f82e204b58c 100644 --- a/drivers/regulator/bcm590xx-regulator.c +++ b/drivers/regulator/bcm590xx-regulator.c @@ -1104,7 +1104,7 @@ static int bcm590xx_probe(struct platform_device *pdev) struct regulator_dev *rdev; unsigned int i; - pmu = devm_kzalloc(&pdev->dev, sizeof(*pmu), GFP_KERNEL); + pmu = devm_kzalloc_obj(&pdev->dev, *pmu); if (!pmu) return -ENOMEM; diff --git a/drivers/regulator/bd718x7-regulator.c b/drivers/regulator/bd718x7-regulator.c index 9cc29b9409d0..828b74ea35a6 100644 --- a/drivers/regulator/bd718x7-regulator.c +++ b/drivers/regulator/bd718x7-regulator.c @@ -1598,9 +1598,8 @@ static int setup_feedback_loop(struct device *dev, struct device_node *np, if (desc->n_linear_ranges && desc->linear_ranges) { struct linear_range *new; - new = devm_kcalloc(dev, desc->n_linear_ranges, - sizeof(struct linear_range), - GFP_KERNEL); + new = devm_kzalloc_objs(dev, struct linear_range, + desc->n_linear_ranges); if (!new) return -ENOMEM; diff --git a/drivers/regulator/bd9571mwv-regulator.c b/drivers/regulator/bd9571mwv-regulator.c index 5bf02dc0d20e..b52810abd050 100644 --- a/drivers/regulator/bd9571mwv-regulator.c +++ b/drivers/regulator/bd9571mwv-regulator.c @@ -279,7 +279,7 @@ static int bd9571mwv_regulator_probe(struct platform_device *pdev) int i; enum rohm_chip_type chip = platform_get_device_id(pdev)->driver_data; - bdreg = devm_kzalloc(&pdev->dev, sizeof(*bdreg), GFP_KERNEL); + bdreg = devm_kzalloc_obj(&pdev->dev, *bdreg); if (!bdreg) return -ENOMEM; diff --git a/drivers/regulator/bd96801-regulator.c b/drivers/regulator/bd96801-regulator.c index 308279b31fd3..e3aadfa003ee 100644 --- a/drivers/regulator/bd96801-regulator.c +++ b/drivers/regulator/bd96801-regulator.c @@ -1053,7 +1053,7 @@ static int initialize_pmic_data(struct platform_device *pdev, template = pdata->regulator_data[r].irq_desc.irqinfo; num_infos = pdata->regulator_data[r].irq_desc.num_irqs; - new = devm_kcalloc(dev, num_infos, sizeof(*new), GFP_KERNEL); + new = devm_kzalloc_objs(dev, *new, num_infos); if (!new) return -ENOMEM; diff --git a/drivers/regulator/bq257xx-regulator.c b/drivers/regulator/bq257xx-regulator.c index 577b277efd7f..02221a822471 100644 --- a/drivers/regulator/bq257xx-regulator.c +++ b/drivers/regulator/bq257xx-regulator.c @@ -147,7 +147,7 @@ static int bq257xx_regulator_probe(struct platform_device *pdev) device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); - pdata = devm_kzalloc(&pdev->dev, sizeof(struct bq257xx_reg_data), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, struct bq257xx_reg_data); if (!pdata) return -ENOMEM; diff --git a/drivers/regulator/cpcap-regulator.c b/drivers/regulator/cpcap-regulator.c index 63f5c90ddf50..de34f73dcc32 100644 --- a/drivers/regulator/cpcap-regulator.c +++ b/drivers/regulator/cpcap-regulator.c @@ -613,7 +613,7 @@ static int cpcap_regulator_probe(struct platform_device *pdev) return -ENODEV; } - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/regulator/cros-ec-regulator.c b/drivers/regulator/cros-ec-regulator.c index aec275fe1f44..cfe464fe6686 100644 --- a/drivers/regulator/cros-ec-regulator.c +++ b/drivers/regulator/cros-ec-regulator.c @@ -164,8 +164,7 @@ static int cros_ec_regulator_probe(struct platform_device *pdev) struct regulator_desc *desc; int ret; - drvdata = devm_kzalloc( - &pdev->dev, sizeof(struct cros_ec_regulator_data), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, struct cros_ec_regulator_data); if (!drvdata) return -ENOMEM; diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c index fbebe538a648..6a09488173cb 100644 --- a/drivers/regulator/da9052-regulator.c +++ b/drivers/regulator/da9052-regulator.c @@ -398,8 +398,7 @@ static int da9052_regulator_probe(struct platform_device *pdev) struct da9052 *da9052; struct da9052_pdata *pdata; - regulator = devm_kzalloc(&pdev->dev, sizeof(struct da9052_regulator), - GFP_KERNEL); + regulator = devm_kzalloc_obj(&pdev->dev, struct da9052_regulator); if (!regulator) return -ENOMEM; diff --git a/drivers/regulator/da9055-regulator.c b/drivers/regulator/da9055-regulator.c index a0d3414aa79e..21a444a357e8 100644 --- a/drivers/regulator/da9055-regulator.c +++ b/drivers/regulator/da9055-regulator.c @@ -513,8 +513,7 @@ static int da9055_regulator_probe(struct platform_device *pdev) struct da9055_pdata *pdata = dev_get_platdata(da9055->dev); int ret, irq; - regulator = devm_kzalloc(&pdev->dev, sizeof(struct da9055_regulator), - GFP_KERNEL); + regulator = devm_kzalloc_obj(&pdev->dev, struct da9055_regulator); if (!regulator) return -ENOMEM; diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-regulator.c index e0c96f10e570..21f6511ab9ba 100644 --- a/drivers/regulator/da9062-regulator.c +++ b/drivers/regulator/da9062-regulator.c @@ -942,8 +942,8 @@ static int da9062_regulator_probe(struct platform_device *pdev) } /* Allocate memory required by usable regulators */ - regulators = devm_kzalloc(&pdev->dev, struct_size(regulators, regulator, - max_regulators), GFP_KERNEL); + regulators = devm_kzalloc_flex(&pdev->dev, *regulators, regulator, + max_regulators); if (!regulators) return -ENOMEM; diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index bf34ea440d77..4a2bf69b68cf 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c @@ -857,7 +857,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt( return ERR_PTR(-EINVAL); } - pdata = devm_kzalloc(&pdev->dev, struct_size(pdata, regulator_data, num), GFP_KERNEL); + pdata = devm_kzalloc_flex(&pdev->dev, *pdata, regulator_data, num); if (!pdata) return ERR_PTR(-ENOMEM); @@ -930,8 +930,8 @@ static int da9063_regulator_probe(struct platform_device *pdev) n_regulators--; /* remove BMEM_BIO_MERGED */ /* Allocate memory required by usable regulators */ - regulators = devm_kzalloc(&pdev->dev, struct_size(regulators, - regulator, n_regulators), GFP_KERNEL); + regulators = devm_kzalloc_flex(&pdev->dev, *regulators, regulator, + n_regulators); if (!regulators) return -ENOMEM; diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c index f501cf8152c2..8fe9817f7a45 100644 --- a/drivers/regulator/da9121-regulator.c +++ b/drivers/regulator/da9121-regulator.c @@ -382,7 +382,7 @@ static int da9121_of_parse_cb(struct device_node *np, struct gpio_desc *ena_gpiod; if (chip->pdata == NULL) { - pdata = devm_kzalloc(chip->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(chip->dev, *pdata); if (!pdata) return -ENOMEM; } else { @@ -1151,7 +1151,7 @@ static int da9121_i2c_probe(struct i2c_client *i2c) const int mask_all[4] = { 0xFF, 0xFF, 0xFF, 0xFF }; int ret = 0; - chip = devm_kzalloc(&i2c->dev, sizeof(struct da9121), GFP_KERNEL); + chip = devm_kzalloc_obj(&i2c->dev, struct da9121); if (!chip) { ret = -ENOMEM; goto error; diff --git a/drivers/regulator/da9210-regulator.c b/drivers/regulator/da9210-regulator.c index 9154e32bd745..dd9e943b22a4 100644 --- a/drivers/regulator/da9210-regulator.c +++ b/drivers/regulator/da9210-regulator.c @@ -136,7 +136,7 @@ static int da9210_i2c_probe(struct i2c_client *i2c) struct regulator_config config = { }; int error; - chip = devm_kzalloc(&i2c->dev, sizeof(struct da9210), GFP_KERNEL); + chip = devm_kzalloc_obj(&i2c->dev, struct da9210); if (!chip) return -ENOMEM; diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c index 9cf713755636..0b51acf10d4f 100644 --- a/drivers/regulator/da9211-regulator.c +++ b/drivers/regulator/da9211-regulator.c @@ -302,7 +302,7 @@ static struct da9211_pdata *da9211_parse_regulators_dt( return ERR_PTR(-EINVAL); } - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); @@ -450,7 +450,7 @@ static int da9211_i2c_probe(struct i2c_client *i2c) int error, ret; unsigned int data; - chip = devm_kzalloc(&i2c->dev, sizeof(struct da9211), GFP_KERNEL); + chip = devm_kzalloc_obj(&i2c->dev, struct da9211); if (!chip) return -ENOMEM; diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c index 615deba5d22c..62c67b9fd0cf 100644 --- a/drivers/regulator/devres.c +++ b/drivers/regulator/devres.c @@ -407,12 +407,11 @@ int devm_regulator_bulk_get_enable(struct device *dev, int num_consumers, struct regulator_bulk_data *consumers; int i, ret; - devres = devm_kmalloc(dev, sizeof(*devres), GFP_KERNEL); + devres = devm_kmalloc_obj(dev, *devres); if (!devres) return -ENOMEM; - devres->consumers = devm_kcalloc(dev, num_consumers, sizeof(*consumers), - GFP_KERNEL); + devres->consumers = devm_kzalloc_objs(dev, *consumers, num_consumers); consumers = devres->consumers; if (!consumers) return -ENOMEM; diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index 6557d8cbe98d..f3fd5a988a1f 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c @@ -657,7 +657,7 @@ static struct fan53555_platform_data *fan53555_parse_dt(struct device *dev, int ret; u32 tmp; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return NULL; @@ -711,8 +711,7 @@ static int fan53555_regulator_probe(struct i2c_client *client) unsigned int val; int ret; - di = devm_kzalloc(&client->dev, sizeof(struct fan53555_device_info), - GFP_KERNEL); + di = devm_kzalloc_obj(&client->dev, struct fan53555_device_info); if (!di) return -ENOMEM; diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index faa82f30eb1f..c353bcc72da0 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c @@ -168,8 +168,7 @@ of_get_fixed_voltage_config(struct device *dev, struct device_node *np = dev->of_node; struct regulator_init_data *init_data; - config = devm_kzalloc(dev, sizeof(struct fixed_voltage_config), - GFP_KERNEL); + config = devm_kzalloc_obj(dev, struct fixed_voltage_config); if (!config) return ERR_PTR(-ENOMEM); @@ -229,8 +228,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) if (!pdev->dev.of_node && strcmp(pdev->name, "reg-fixed-voltage")) return -ENODEV; - drvdata = devm_kzalloc(&pdev->dev, sizeof(struct fixed_voltage_data), - GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, struct fixed_voltage_data); if (!drvdata) return -ENOMEM; diff --git a/drivers/regulator/fp9931.c b/drivers/regulator/fp9931.c index ff743a8b0dfe..da0f5dd87f2f 100644 --- a/drivers/regulator/fp9931.c +++ b/drivers/regulator/fp9931.c @@ -407,7 +407,7 @@ static int fp9931_probe(struct i2c_client *client) int ret = 0; int i; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index 6351ceefdb3e..352a9385894f 100644 --- a/drivers/regulator/gpio-regulator.c +++ b/drivers/regulator/gpio-regulator.c @@ -136,9 +136,7 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np, int ngpios; int ret; - config = devm_kzalloc(dev, - sizeof(struct gpio_regulator_config), - GFP_KERNEL); + config = devm_kzalloc_obj(dev, struct gpio_regulator_config); if (!config) return ERR_PTR(-ENOMEM); @@ -193,10 +191,8 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np, return ERR_PTR(-EINVAL); } - config->states = devm_kcalloc(dev, - proplen / 2, - sizeof(struct gpio_regulator_state), - GFP_KERNEL); + config->states = devm_kzalloc_objs(dev, struct gpio_regulator_state, + proplen / 2); if (!config->states) return ERR_PTR(-ENOMEM); @@ -242,8 +238,7 @@ static int gpio_regulator_probe(struct platform_device *pdev) enum gpiod_flags gflags; int ptr, state, i; - drvdata = devm_kzalloc(dev, sizeof(struct gpio_regulator_data), - GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, struct gpio_regulator_data); if (drvdata == NULL) return -ENOMEM; @@ -260,8 +255,8 @@ static int gpio_regulator_probe(struct platform_device *pdev) return -ENOMEM; } - drvdata->gpiods = devm_kcalloc(dev, config->ngpios, - sizeof(struct gpio_desc *), GFP_KERNEL); + drvdata->gpiods = devm_kzalloc_objs(dev, struct gpio_desc *, + config->ngpios); if (!drvdata->gpiods) return -ENOMEM; diff --git a/drivers/regulator/hi6421-regulator.c b/drivers/regulator/hi6421-regulator.c index 3373c4fdbddf..6a1894729dc7 100644 --- a/drivers/regulator/hi6421-regulator.c +++ b/drivers/regulator/hi6421-regulator.c @@ -544,7 +544,7 @@ static int hi6421_regulator_probe(struct platform_device *pdev) struct regulator_dev *rdev; int i; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; mutex_init(&pdata->lock); diff --git a/drivers/regulator/hi6421v600-regulator.c b/drivers/regulator/hi6421v600-regulator.c index c42858c93b47..52abea0b6c20 100644 --- a/drivers/regulator/hi6421v600-regulator.c +++ b/drivers/regulator/hi6421v600-regulator.c @@ -250,7 +250,7 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev) if (WARN_ON(!regmap)) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/regulator/irq_helpers.c b/drivers/regulator/irq_helpers.c index cdbd170d2b15..c03625a19a8e 100644 --- a/drivers/regulator/irq_helpers.c +++ b/drivers/regulator/irq_helpers.c @@ -338,7 +338,7 @@ void *regulator_irq_helper(struct device *dev, if (!rdev_amount || !d || !d->map_event || !d->name) return ERR_PTR(-EINVAL); - h = devm_kzalloc(dev, sizeof(*h), GFP_KERNEL); + h = devm_kzalloc_obj(dev, *h); if (!h) return ERR_PTR(-ENOMEM); diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c index 868f2b823a10..819324033928 100644 --- a/drivers/regulator/isl6271a-regulator.c +++ b/drivers/regulator/isl6271a-regulator.c @@ -109,7 +109,7 @@ static int isl6271a_probe(struct i2c_client *i2c) if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - pmic = devm_kzalloc(&i2c->dev, sizeof(struct isl_pmic), GFP_KERNEL); + pmic = devm_kzalloc_obj(&i2c->dev, struct isl_pmic); if (!pmic) return -ENOMEM; diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c index 6f830ae1bb61..75d1ec208483 100644 --- a/drivers/regulator/lp3971.c +++ b/drivers/regulator/lp3971.c @@ -412,7 +412,7 @@ static int lp3971_i2c_probe(struct i2c_client *i2c) return -ENODEV; } - lp3971 = devm_kzalloc(&i2c->dev, sizeof(struct lp3971), GFP_KERNEL); + lp3971 = devm_kzalloc_obj(&i2c->dev, struct lp3971); if (lp3971 == NULL) return -ENOMEM; diff --git a/drivers/regulator/lp3972.c b/drivers/regulator/lp3972.c index 235c640ba57f..712b18d171cd 100644 --- a/drivers/regulator/lp3972.c +++ b/drivers/regulator/lp3972.c @@ -507,7 +507,7 @@ static int lp3972_i2c_probe(struct i2c_client *i2c) return -ENODEV; } - lp3972 = devm_kzalloc(&i2c->dev, sizeof(struct lp3972), GFP_KERNEL); + lp3972 = devm_kzalloc_obj(&i2c->dev, struct lp3972); if (!lp3972) return -ENOMEM; diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c index 8b95c2cbb023..8887037c33f8 100644 --- a/drivers/regulator/lp872x.c +++ b/drivers/regulator/lp872x.c @@ -611,7 +611,7 @@ static int lp872x_probe(struct i2c_client *cl) struct lp872x *lp; int ret; - lp = devm_kzalloc(dev, sizeof(*lp), GFP_KERNEL); + lp = devm_kzalloc_obj(dev, *lp); if (!lp) return -ENOMEM; diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c index 632320ba1800..0b5812e4edbb 100644 --- a/drivers/regulator/lp8755.c +++ b/drivers/regulator/lp8755.c @@ -367,8 +367,7 @@ static int lp8755_probe(struct i2c_client *client) return -EOPNOTSUPP; } - pchip = devm_kzalloc(&client->dev, - sizeof(struct lp8755_chip), GFP_KERNEL); + pchip = devm_kzalloc_obj(&client->dev, struct lp8755_chip); if (!pchip) return -ENOMEM; @@ -385,9 +384,8 @@ static int lp8755_probe(struct i2c_client *client) pchip->pdata = pdata; pchip->mphase = pdata->mphase; } else { - pchip->pdata = devm_kzalloc(pchip->dev, - sizeof(struct lp8755_platform_data), - GFP_KERNEL); + pchip->pdata = devm_kzalloc_obj(pchip->dev, + struct lp8755_platform_data); if (!pchip->pdata) return -ENOMEM; ret = lp8755_init_data(pchip); diff --git a/drivers/regulator/lp8788-buck.c b/drivers/regulator/lp8788-buck.c index 2ade249ab6df..a9bac86d8961 100644 --- a/drivers/regulator/lp8788-buck.c +++ b/drivers/regulator/lp8788-buck.c @@ -486,7 +486,7 @@ static int lp8788_buck_probe(struct platform_device *pdev) if (id >= LP8788_NUM_BUCKS) return -EINVAL; - buck = devm_kzalloc(&pdev->dev, sizeof(struct lp8788_buck), GFP_KERNEL); + buck = devm_kzalloc_obj(&pdev->dev, struct lp8788_buck); if (!buck) return -ENOMEM; diff --git a/drivers/regulator/lp8788-ldo.c b/drivers/regulator/lp8788-ldo.c index 8e45b7b99556..64915ee00121 100644 --- a/drivers/regulator/lp8788-ldo.c +++ b/drivers/regulator/lp8788-ldo.c @@ -529,7 +529,7 @@ static int lp8788_dldo_probe(struct platform_device *pdev) struct regulator_dev *rdev; int ret; - ldo = devm_kzalloc(&pdev->dev, sizeof(struct lp8788_ldo), GFP_KERNEL); + ldo = devm_kzalloc_obj(&pdev->dev, struct lp8788_ldo); if (!ldo) return -ENOMEM; @@ -577,7 +577,7 @@ static int lp8788_aldo_probe(struct platform_device *pdev) struct regulator_dev *rdev; int ret; - ldo = devm_kzalloc(&pdev->dev, sizeof(struct lp8788_ldo), GFP_KERNEL); + ldo = devm_kzalloc_obj(&pdev->dev, struct lp8788_ldo); if (!ldo) return -ENOMEM; diff --git a/drivers/regulator/ltc3589.c b/drivers/regulator/ltc3589.c index 8bae5d8aeaf4..6f54757333bb 100644 --- a/drivers/regulator/ltc3589.c +++ b/drivers/regulator/ltc3589.c @@ -383,7 +383,7 @@ static int ltc3589_probe(struct i2c_client *client) struct ltc3589 *ltc3589; int i, ret; - ltc3589 = devm_kzalloc(dev, sizeof(*ltc3589), GFP_KERNEL); + ltc3589 = devm_kzalloc_obj(dev, *ltc3589); if (!ltc3589) return -ENOMEM; diff --git a/drivers/regulator/ltc3676.c b/drivers/regulator/ltc3676.c index d67cee4e0be0..010a13bff167 100644 --- a/drivers/regulator/ltc3676.c +++ b/drivers/regulator/ltc3676.c @@ -312,7 +312,7 @@ static int ltc3676_regulator_probe(struct i2c_client *client) struct ltc3676 *ltc3676; int i, ret; - ltc3676 = devm_kzalloc(dev, sizeof(*ltc3676), GFP_KERNEL); + ltc3676 = devm_kzalloc_obj(dev, *ltc3676); if (!ltc3676) return -ENOMEM; diff --git a/drivers/regulator/max14577-regulator.c b/drivers/regulator/max14577-regulator.c index cd592c5de148..aea39c867353 100644 --- a/drivers/regulator/max14577-regulator.c +++ b/drivers/regulator/max14577-regulator.c @@ -300,8 +300,7 @@ static int max14577_regulator_probe(struct platform_device *pdev) supported_regulators[i].id == MAX77836_LDO2)) { struct max77836_ldo *ldo; - ldo = devm_kzalloc(&pdev->dev, sizeof(*ldo), - GFP_KERNEL); + ldo = devm_kzalloc_obj(&pdev->dev, *ldo); if (!ldo) return -ENOMEM; diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c index e5cbc09c2d39..6bb819681c4b 100644 --- a/drivers/regulator/max1586.c +++ b/drivers/regulator/max1586.c @@ -181,10 +181,8 @@ static int of_get_max1586_platform_data(struct device *dev, if (matched <= 0) return matched; - pdata->subdevs = devm_kcalloc(dev, - matched, - sizeof(struct max1586_subdev_data), - GFP_KERNEL); + pdata->subdevs = devm_kzalloc_objs(dev, struct max1586_subdev_data, + matched); if (!pdata->subdevs) return -ENOMEM; @@ -222,8 +220,7 @@ static int max1586_pmic_probe(struct i2c_client *client) pdata = &pdata_of; } - max1586 = devm_kzalloc(&client->dev, sizeof(struct max1586_data), - GFP_KERNEL); + max1586 = devm_kzalloc_obj(&client->dev, struct max1586_data); if (!max1586) return -ENOMEM; diff --git a/drivers/regulator/max20086-regulator.c b/drivers/regulator/max20086-regulator.c index 92594b2915f3..8c3ba372d940 100644 --- a/drivers/regulator/max20086-regulator.c +++ b/drivers/regulator/max20086-regulator.c @@ -144,8 +144,8 @@ static int max20086_parse_regulators_dt(struct max20086 *chip, bool *boot_on) return -ENODEV; } - matches = devm_kcalloc(chip->dev, chip->info->num_outputs, - sizeof(*matches), GFP_KERNEL); + matches = devm_kzalloc_objs(chip->dev, *matches, + chip->info->num_outputs); if (!matches) return -ENOMEM; @@ -223,7 +223,7 @@ static int max20086_i2c_probe(struct i2c_client *i2c) bool boot_on; int ret; - chip = devm_kzalloc(&i2c->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&i2c->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/regulator/max20411-regulator.c b/drivers/regulator/max20411-regulator.c index ac7a9aa014aa..01c920490573 100644 --- a/drivers/regulator/max20411-regulator.c +++ b/drivers/regulator/max20411-regulator.c @@ -103,7 +103,7 @@ static int max20411_probe(struct i2c_client *client) struct regulator_config cfg = {}; struct max20411 *max20411; - max20411 = devm_kzalloc(dev, sizeof(*max20411), GFP_KERNEL); + max20411 = devm_kzalloc_obj(dev, *max20411); if (!max20411) return -ENOMEM; diff --git a/drivers/regulator/max5970-regulator.c b/drivers/regulator/max5970-regulator.c index fc14177ddf5d..4393c036b1a7 100644 --- a/drivers/regulator/max5970-regulator.c +++ b/drivers/regulator/max5970-regulator.c @@ -565,8 +565,8 @@ static int max597x_regulator_probe(struct platform_device *pdev) if (!regmap) return -EPROBE_DEFER; - rdevs = devm_kcalloc(&i2c->dev, MAX5970_NUM_SWITCHES, sizeof(struct regulator_dev *), - GFP_KERNEL); + rdevs = devm_kzalloc_objs(&i2c->dev, struct regulator_dev *, + MAX5970_NUM_SWITCHES); if (!rdevs) return -ENOMEM; @@ -579,8 +579,7 @@ static int max597x_regulator_probe(struct platform_device *pdev) for (i = 0; i < num_switches; i++) { data = - devm_kzalloc(&i2c->dev, sizeof(struct max5970_regulator), - GFP_KERNEL); + devm_kzalloc_obj(&i2c->dev, struct max5970_regulator); if (!data) return -ENOMEM; diff --git a/drivers/regulator/max77620-regulator.c b/drivers/regulator/max77620-regulator.c index 5099c372eea5..8b42595ebb1c 100644 --- a/drivers/regulator/max77620-regulator.c +++ b/drivers/regulator/max77620-regulator.c @@ -786,7 +786,7 @@ static int max77620_regulator_probe(struct platform_device *pdev) int ret = 0; int id; - pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); + pmic = devm_kzalloc_obj(dev, *pmic); if (!pmic) return -ENOMEM; diff --git a/drivers/regulator/max77650-regulator.c b/drivers/regulator/max77650-regulator.c index 11b04a13f889..6b177897eece 100644 --- a/drivers/regulator/max77650-regulator.c +++ b/drivers/regulator/max77650-regulator.c @@ -339,8 +339,8 @@ static int max77650_regulator_probe(struct platform_device *pdev) if (!dev->of_node) device_set_of_node_from_dev(dev, parent); - rdescs = devm_kcalloc(dev, MAX77650_REGULATOR_NUM_REGULATORS, - sizeof(*rdescs), GFP_KERNEL); + rdescs = devm_kzalloc_objs(dev, *rdescs, + MAX77650_REGULATOR_NUM_REGULATORS); if (!rdescs) return -ENOMEM; diff --git a/drivers/regulator/max77675-regulator.c b/drivers/regulator/max77675-regulator.c index 23b54b44f8b7..375ed94f62e2 100644 --- a/drivers/regulator/max77675-regulator.c +++ b/drivers/regulator/max77675-regulator.c @@ -968,7 +968,7 @@ static int max77675_regulator_probe(struct i2c_client *client) struct regulator_config config = {}; int i, ret; - maxreg = devm_kzalloc(&client->dev, sizeof(*maxreg), GFP_KERNEL); + maxreg = devm_kzalloc_obj(&client->dev, *maxreg); if (!maxreg) return -ENOMEM; diff --git a/drivers/regulator/max77686-regulator.c b/drivers/regulator/max77686-regulator.c index 3a0156f4d6e7..00aa3bec1dd0 100644 --- a/drivers/regulator/max77686-regulator.c +++ b/drivers/regulator/max77686-regulator.c @@ -487,8 +487,7 @@ static int max77686_pmic_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "%s\n", __func__); - max77686 = devm_kzalloc(&pdev->dev, sizeof(struct max77686_data), - GFP_KERNEL); + max77686 = devm_kzalloc_obj(&pdev->dev, struct max77686_data); if (!max77686) return -ENOMEM; diff --git a/drivers/regulator/max77802-regulator.c b/drivers/regulator/max77802-regulator.c index 4c05cc9c4bd2..6ed32c4de097 100644 --- a/drivers/regulator/max77802-regulator.c +++ b/drivers/regulator/max77802-regulator.c @@ -494,9 +494,7 @@ static int max77802_pmic_probe(struct platform_device *pdev) int i, val; struct regulator_config config = { }; - max77802 = devm_kzalloc(&pdev->dev, - sizeof(struct max77802_regulator_prv), - GFP_KERNEL); + max77802 = devm_kzalloc_obj(&pdev->dev, struct max77802_regulator_prv); if (!max77802) return -ENOMEM; diff --git a/drivers/regulator/max77826-regulator.c b/drivers/regulator/max77826-regulator.c index 8b60a9fcab44..bd4611e8de63 100644 --- a/drivers/regulator/max77826-regulator.c +++ b/drivers/regulator/max77826-regulator.c @@ -240,8 +240,7 @@ static int max77826_i2c_probe(struct i2c_client *client) struct regmap *regmap; int i; - info = devm_kzalloc(dev, sizeof(struct max77826_regulator_info), - GFP_KERNEL); + info = devm_kzalloc_obj(dev, struct max77826_regulator_info); if (!info) return -ENOMEM; diff --git a/drivers/regulator/max77838-regulator.c b/drivers/regulator/max77838-regulator.c index 765756fdcf6e..5e836477d9c1 100644 --- a/drivers/regulator/max77838-regulator.c +++ b/drivers/regulator/max77838-regulator.c @@ -162,8 +162,7 @@ static int max77838_i2c_probe(struct i2c_client *client) struct regmap *regmap; int i; - info = devm_kzalloc(dev, sizeof(struct max77838_regulator_info), - GFP_KERNEL); + info = devm_kzalloc_obj(dev, struct max77838_regulator_info); if (!info) return -ENOMEM; diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c index 2d17405242e7..d02b9373ec4c 100644 --- a/drivers/regulator/max8649.c +++ b/drivers/regulator/max8649.c @@ -155,8 +155,7 @@ static int max8649_regulator_probe(struct i2c_client *client) unsigned char data; int ret; - info = devm_kzalloc(&client->dev, sizeof(struct max8649_regulator_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&client->dev, struct max8649_regulator_info); if (!info) return -ENOMEM; diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c index ede17099b727..9bcecdc17c98 100644 --- a/drivers/regulator/max8660.c +++ b/drivers/regulator/max8660.c @@ -338,10 +338,8 @@ static int max8660_pdata_from_dt(struct device *dev, if (matched <= 0) return matched; - pdata->subdevs = devm_kcalloc(dev, - matched, - sizeof(struct max8660_subdev_data), - GFP_KERNEL); + pdata->subdevs = devm_kzalloc_objs(dev, struct max8660_subdev_data, + matched); if (!pdata->subdevs) return -ENOMEM; @@ -401,7 +399,7 @@ static int max8660_probe(struct i2c_client *client) return -EINVAL; } - max8660 = devm_kzalloc(dev, sizeof(struct max8660), GFP_KERNEL); + max8660 = devm_kzalloc_obj(dev, struct max8660); if (!max8660) return -ENOMEM; diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c index e59aa7a3ee54..a9f014eae4d6 100644 --- a/drivers/regulator/max8907-regulator.c +++ b/drivers/regulator/max8907-regulator.c @@ -287,7 +287,7 @@ static int max8907_regulator_probe(struct platform_device *pdev) if (ret) return ret; - pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); + pmic = devm_kzalloc_obj(&pdev->dev, *pmic); if (!pmic) return -ENOMEM; diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c index f8b91a5701f3..03988a37ff8c 100644 --- a/drivers/regulator/max8952.c +++ b/drivers/regulator/max8952.c @@ -128,7 +128,7 @@ static struct max8952_platform_data *max8952_parse_dt(struct device *dev) int ret; int i; - pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(dev, *pd); if (!pd) return NULL; @@ -194,8 +194,7 @@ static int max8952_pmic_probe(struct i2c_client *client) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) return -EIO; - max8952 = devm_kzalloc(&client->dev, sizeof(struct max8952_data), - GFP_KERNEL); + max8952 = devm_kzalloc_obj(&client->dev, struct max8952_data); if (!max8952) return -ENOMEM; diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c index 95062032dc7e..1dd3a5afb52f 100644 --- a/drivers/regulator/max8973-regulator.c +++ b/drivers/regulator/max8973-regulator.c @@ -520,7 +520,7 @@ static struct max8973_regulator_platform_data *max8973_parse_dt( bool etr_enable; bool etr_sensitivity_high; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return NULL; @@ -606,7 +606,7 @@ static int max8973_probe(struct i2c_client *client) return -EIO; } - max = devm_kzalloc(&client->dev, sizeof(*max), GFP_KERNEL); + max = devm_kzalloc_obj(&client->dev, *max); if (!max) return -ENOMEM; diff --git a/drivers/regulator/max8997-regulator.c b/drivers/regulator/max8997-regulator.c index e48ba694a906..22f28f2a0a5e 100644 --- a/drivers/regulator/max8997-regulator.c +++ b/drivers/regulator/max8997-regulator.c @@ -897,9 +897,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, /* count the number of regulators to be supported in pmic */ pdata->num_regulators = of_get_child_count(regulators_np); - rdata = devm_kcalloc(&pdev->dev, - pdata->num_regulators, sizeof(*rdata), - GFP_KERNEL); + rdata = devm_kzalloc_objs(&pdev->dev, *rdata, pdata->num_regulators); if (!rdata) return -ENOMEM; @@ -999,8 +997,7 @@ static int max8997_pmic_probe(struct platform_device *pdev) return ret; } - max8997 = devm_kzalloc(&pdev->dev, sizeof(struct max8997_data), - GFP_KERNEL); + max8997 = devm_kzalloc_obj(&pdev->dev, struct max8997_data); if (!max8997) return -ENOMEM; diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index 90651f4d1828..281904f8b0a3 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c @@ -558,9 +558,7 @@ static int max8998_pmic_dt_parse_pdata(struct max8998_dev *iodev, /* count the number of regulators to be supported in pmic */ pdata->num_regulators = of_get_child_count(regulators_np); - rdata = devm_kcalloc(iodev->dev, - pdata->num_regulators, sizeof(*rdata), - GFP_KERNEL); + rdata = devm_kzalloc_objs(iodev->dev, *rdata, pdata->num_regulators); if (!rdata) { of_node_put(regulators_np); return -ENOMEM; @@ -646,8 +644,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) return ret; } - max8998 = devm_kzalloc(&pdev->dev, sizeof(struct max8998_data), - GFP_KERNEL); + max8998 = devm_kzalloc_obj(&pdev->dev, struct max8998_data); if (!max8998) return -ENOMEM; diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c index fb3aa1cec1f2..b9df98b5e9c9 100644 --- a/drivers/regulator/mc13783-regulator.c +++ b/drivers/regulator/mc13783-regulator.c @@ -405,9 +405,7 @@ static int mc13783_regulator_probe(struct platform_device *pdev) if (num_regulators <= 0) return -EINVAL; - priv = devm_kzalloc(&pdev->dev, - struct_size(priv, regulators, num_regulators), - GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, regulators, num_regulators); if (!priv) return -ENOMEM; diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c index b29cf6ba6f12..3b4ecf078a74 100644 --- a/drivers/regulator/mc13892-regulator.c +++ b/drivers/regulator/mc13892-regulator.c @@ -543,9 +543,7 @@ static int mc13892_regulator_probe(struct platform_device *pdev) if (num_regulators <= 0) return -EINVAL; - priv = devm_kzalloc(&pdev->dev, - struct_size(priv, regulators, num_regulators), - GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, regulators, num_regulators); if (!priv) return -ENOMEM; diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c index 8ff19150ca92..a8a1433cc48c 100644 --- a/drivers/regulator/mc13xxx-regulator-core.c +++ b/drivers/regulator/mc13xxx-regulator-core.c @@ -171,8 +171,7 @@ struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt( if (!parent) return NULL; - data = devm_kcalloc(&pdev->dev, priv->num_regulators, sizeof(*data), - GFP_KERNEL); + data = devm_kzalloc_objs(&pdev->dev, *data, priv->num_regulators); if (!data) { of_node_put(parent); return NULL; diff --git a/drivers/regulator/mcp16502.c b/drivers/regulator/mcp16502.c index 07c67ad1ab7f..7ccccc4f1c59 100644 --- a/drivers/regulator/mcp16502.c +++ b/drivers/regulator/mcp16502.c @@ -513,7 +513,7 @@ static int mcp16502_probe(struct i2c_client *client) dev = &client->dev; config.dev = dev; - mcp = devm_kzalloc(dev, sizeof(*mcp), GFP_KERNEL); + mcp = devm_kzalloc_obj(dev, *mcp); if (!mcp) return -ENOMEM; diff --git a/drivers/regulator/mp886x.c b/drivers/regulator/mp886x.c index e483e9d7dcf2..58d25d58af8e 100644 --- a/drivers/regulator/mp886x.c +++ b/drivers/regulator/mp886x.c @@ -319,7 +319,7 @@ static int mp886x_i2c_probe(struct i2c_client *client) u32 freq; int ret; - di = devm_kzalloc(dev, sizeof(struct mp886x_device_info), GFP_KERNEL); + di = devm_kzalloc_obj(dev, struct mp886x_device_info); if (!di) return -ENOMEM; diff --git a/drivers/regulator/mpq4210.c b/drivers/regulator/mpq4210.c index 293e7b209a98..5befbf0c6da5 100644 --- a/drivers/regulator/mpq4210.c +++ b/drivers/regulator/mpq4210.c @@ -173,8 +173,7 @@ static int mpq4210_i2c_probe(struct i2c_client *client) r[0], r[1]); desc->uV_step = mpq4210_scale(MPQ4210_REF_STEP_UV, r[0], r[1]); - slew = devm_kcalloc(dev, ARRAY_SIZE(mpq4210_ref_slew_rate), - sizeof(*slew), GFP_KERNEL); + slew = devm_kzalloc_objs(dev, *slew, ARRAY_SIZE(mpq4210_ref_slew_rate)); if (!slew) return -ENOMEM; diff --git a/drivers/regulator/mpq7920.c b/drivers/regulator/mpq7920.c index 0cbc17deb1d1..eb1808f537f9 100644 --- a/drivers/regulator/mpq7920.c +++ b/drivers/regulator/mpq7920.c @@ -268,8 +268,7 @@ static int mpq7920_i2c_probe(struct i2c_client *client) struct regmap *regmap; int i; - info = devm_kzalloc(dev, sizeof(struct mpq7920_regulator_info), - GFP_KERNEL); + info = devm_kzalloc_obj(dev, struct mpq7920_regulator_info); if (!info) return -ENOMEM; diff --git a/drivers/regulator/mt6315-regulator.c b/drivers/regulator/mt6315-regulator.c index 231e64fb0596..6603daa3d926 100644 --- a/drivers/regulator/mt6315-regulator.c +++ b/drivers/regulator/mt6315-regulator.c @@ -227,11 +227,11 @@ static int mt6315_regulator_probe(struct spmi_device *pdev) if (IS_ERR(regmap)) return PTR_ERR(regmap); - chip = devm_kzalloc(dev, sizeof(struct mt6315_chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, struct mt6315_chip); if (!chip) return -ENOMEM; - init_data = devm_kzalloc(dev, sizeof(struct mt_regulator_init_data), GFP_KERNEL); + init_data = devm_kzalloc_obj(dev, struct mt_regulator_init_data); if (!init_data) return -ENOMEM; diff --git a/drivers/regulator/mt6359-regulator.c b/drivers/regulator/mt6359-regulator.c index 7c3a3ecb3641..4363fe4903c2 100644 --- a/drivers/regulator/mt6359-regulator.c +++ b/drivers/regulator/mt6359-regulator.c @@ -1075,7 +1075,7 @@ static int mt6359_regulator_probe(struct platform_device *pdev) /* Use vio18's actual name as supply_name for vbbck */ if (i == MT6359_ID_VBBCK && strcmp(desc->supply_name, vio18_name) != 0) { - _desc = devm_kzalloc(&pdev->dev, sizeof(*_desc), GFP_KERNEL); + _desc = devm_kzalloc_obj(&pdev->dev, *_desc); if (!_desc) return -ENOMEM; @@ -1087,7 +1087,7 @@ static int mt6359_regulator_probe(struct platform_device *pdev) /* Use vcn33_1's actual name as supply_name for vcn33_1_(bt|wifi) */ if ((i == MT6359_ID_VCN33_1_BT || i == MT6359_ID_VCN33_1_WIFI) && strcmp(desc->supply_name, vcn33_1_name) != 0) { - _desc = devm_kzalloc(&pdev->dev, sizeof(*_desc), GFP_KERNEL); + _desc = devm_kzalloc_obj(&pdev->dev, *_desc); if (!_desc) return -ENOMEM; @@ -1099,7 +1099,7 @@ static int mt6359_regulator_probe(struct platform_device *pdev) /* Use vcn33_2's actual name as supply_name for vcn33_2_(bt|wifi) */ if ((i == MT6359_ID_VCN33_2_BT || i == MT6359_ID_VCN33_2_WIFI) && strcmp(desc->supply_name, vcn33_2_name) != 0) { - _desc = devm_kzalloc(&pdev->dev, sizeof(*_desc), GFP_KERNEL); + _desc = devm_kzalloc_obj(&pdev->dev, *_desc); if (!_desc) return -ENOMEM; diff --git a/drivers/regulator/mt6360-regulator.c b/drivers/regulator/mt6360-regulator.c index ed25e9603b2b..5ebeb4d4e19d 100644 --- a/drivers/regulator/mt6360-regulator.c +++ b/drivers/regulator/mt6360-regulator.c @@ -408,7 +408,7 @@ static int mt6360_regulator_probe(struct platform_device *pdev) struct regulator_config config = {}; int i, ret; - mrd = devm_kzalloc(&pdev->dev, sizeof(*mrd), GFP_KERNEL); + mrd = devm_kzalloc_obj(&pdev->dev, *mrd); if (!mrd) return -ENOMEM; diff --git a/drivers/regulator/mt6370-regulator.c b/drivers/regulator/mt6370-regulator.c index 6997beb51409..2447be34e8f8 100644 --- a/drivers/regulator/mt6370-regulator.c +++ b/drivers/regulator/mt6370-regulator.c @@ -350,7 +350,7 @@ static int mt6370_regulator_probe(struct platform_device *pdev) struct mt6370_priv *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 09e26febfc83..81d4f8b6458b 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -355,7 +355,7 @@ struct regulator_init_data *of_get_regulator_init_data(struct device *dev, if (!node) return NULL; - init_data = devm_kzalloc(dev, sizeof(*init_data), GFP_KERNEL); + init_data = devm_kzalloc_obj(dev, *init_data); if (!init_data) return NULL; /* Out of memory? */ diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index f82618a70106..cbc5289def33 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c @@ -1496,7 +1496,7 @@ static int palmas_dt_to_pdata(struct device *dev, if (!match->init_data || !np) continue; - rinit = devm_kzalloc(dev, sizeof(*rinit), GFP_KERNEL); + rinit = devm_kzalloc_obj(dev, *rinit); if (!rinit) return -ENOMEM; @@ -1608,11 +1608,11 @@ static int palmas_regulators_probe(struct platform_device *pdev) if (!driver_data) return -ENODATA; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; - pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); + pmic = devm_kzalloc_obj(&pdev->dev, *pmic); if (!pmic) return -ENOMEM; diff --git a/drivers/regulator/pbias-regulator.c b/drivers/regulator/pbias-regulator.c index cd5a0d7e4455..c630465e8825 100644 --- a/drivers/regulator/pbias-regulator.c +++ b/drivers/regulator/pbias-regulator.c @@ -162,7 +162,7 @@ static int pbias_regulator_probe(struct platform_device *pdev) if (count < 0) return count; - desc = devm_kcalloc(&pdev->dev, count, sizeof(*desc), GFP_KERNEL); + desc = devm_kzalloc_objs(&pdev->dev, *desc, count); if (!desc) return -ENOMEM; diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c index 613bce411f31..f1c787e6db8b 100644 --- a/drivers/regulator/pca9450-regulator.c +++ b/drivers/regulator/pca9450-regulator.c @@ -1356,7 +1356,7 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) const char *type_name; int ret; - pca9450 = devm_kzalloc(&i2c->dev, sizeof(struct pca9450), GFP_KERNEL); + pca9450 = devm_kzalloc_obj(&i2c->dev, struct pca9450); if (!pca9450) return -ENOMEM; diff --git a/drivers/regulator/pf0900-regulator.c b/drivers/regulator/pf0900-regulator.c index 5c44d2dbcab4..c8fbe150a674 100644 --- a/drivers/regulator/pf0900-regulator.c +++ b/drivers/regulator/pf0900-regulator.c @@ -837,7 +837,7 @@ static int pf0900_i2c_probe(struct i2c_client *i2c) if (!i2c->irq) return dev_err_probe(&i2c->dev, -EINVAL, "No IRQ configured?\n"); - pf0900 = devm_kzalloc(&i2c->dev, sizeof(struct pf0900), GFP_KERNEL); + pf0900 = devm_kzalloc_obj(&i2c->dev, struct pf0900); if (!pf0900) return -ENOMEM; diff --git a/drivers/regulator/pf1550-regulator.c b/drivers/regulator/pf1550-regulator.c index 84f8b187a91b..6a2fa00a0220 100644 --- a/drivers/regulator/pf1550-regulator.c +++ b/drivers/regulator/pf1550-regulator.c @@ -357,7 +357,7 @@ static int pf1550_regulator_probe(struct platform_device *pdev) struct pf1550_regulator_info *info; int i, irq = -1, ret = 0; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/regulator/pf530x-regulator.c b/drivers/regulator/pf530x-regulator.c index 8ad1cbbd7a8c..cbc6b4303fc1 100644 --- a/drivers/regulator/pf530x-regulator.c +++ b/drivers/regulator/pf530x-regulator.c @@ -308,7 +308,7 @@ static int pf530x_i2c_probe(struct i2c_client *client) struct regulator_dev *rdev; struct regulator_init_data *init_data; - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/regulator/pf8x00-regulator.c b/drivers/regulator/pf8x00-regulator.c index c938b4632ef1..fa3aa4ae391e 100644 --- a/drivers/regulator/pf8x00-regulator.c +++ b/drivers/regulator/pf8x00-regulator.c @@ -549,7 +549,7 @@ static int pf8x00_i2c_probe(struct i2c_client *client) int id; int ret; - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/regulator/pf9453-regulator.c b/drivers/regulator/pf9453-regulator.c index 07cbcd312653..88a24b40b721 100644 --- a/drivers/regulator/pf9453-regulator.c +++ b/drivers/regulator/pf9453-regulator.c @@ -771,7 +771,7 @@ static int pf9453_i2c_probe(struct i2c_client *i2c) if (!i2c->irq) return dev_err_probe(&i2c->dev, -EINVAL, "No IRQ configured?\n"); - pf9453 = devm_kzalloc(&i2c->dev, sizeof(struct pf9453), GFP_KERNEL); + pf9453 = devm_kzalloc_obj(&i2c->dev, struct pf9453); if (!pf9453) return -ENOMEM; diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c index d3a0e2505524..3535a5941099 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c @@ -713,8 +713,7 @@ static int pfuze100_regulator_probe(struct i2c_client *client) u32 regulator_num; u32 sw_check_start, sw_check_end, sw_hi = 0x40; - pfuze_chip = devm_kzalloc(&client->dev, sizeof(*pfuze_chip), - GFP_KERNEL); + pfuze_chip = devm_kzalloc_obj(&client->dev, *pfuze_chip); if (!pfuze_chip) return -ENOMEM; diff --git a/drivers/regulator/pv88060-regulator.c b/drivers/regulator/pv88060-regulator.c index 375d9e759c47..94c7eefa0da9 100644 --- a/drivers/regulator/pv88060-regulator.c +++ b/drivers/regulator/pv88060-regulator.c @@ -280,7 +280,7 @@ static int pv88060_i2c_probe(struct i2c_client *i2c) struct regulator_config config = { }; int error, i, ret = 0; - chip = devm_kzalloc(&i2c->dev, sizeof(struct pv88060), GFP_KERNEL); + chip = devm_kzalloc_obj(&i2c->dev, struct pv88060); if (!chip) return -ENOMEM; diff --git a/drivers/regulator/pv88080-regulator.c b/drivers/regulator/pv88080-regulator.c index 1f2c405fd2bd..acc4633df48c 100644 --- a/drivers/regulator/pv88080-regulator.c +++ b/drivers/regulator/pv88080-regulator.c @@ -368,7 +368,7 @@ static int pv88080_i2c_probe(struct i2c_client *i2c) int i, error, ret; unsigned int conf2, conf5; - chip = devm_kzalloc(&i2c->dev, sizeof(struct pv88080), GFP_KERNEL); + chip = devm_kzalloc_obj(&i2c->dev, struct pv88080); if (!chip) return -ENOMEM; diff --git a/drivers/regulator/pv88090-regulator.c b/drivers/regulator/pv88090-regulator.c index ca5eeb5dfe62..5821014829f4 100644 --- a/drivers/regulator/pv88090-regulator.c +++ b/drivers/regulator/pv88090-regulator.c @@ -274,7 +274,7 @@ static int pv88090_i2c_probe(struct i2c_client *i2c) int error, i, ret = 0; unsigned int conf2, range, index; - chip = devm_kzalloc(&i2c->dev, sizeof(struct pv88090), GFP_KERNEL); + chip = devm_kzalloc_obj(&i2c->dev, struct pv88090); if (!chip) return -ENOMEM; diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c index 7434b6b22d32..af4aafeb96b6 100644 --- a/drivers/regulator/pwm-regulator.c +++ b/drivers/regulator/pwm-regulator.c @@ -361,7 +361,7 @@ static int pwm_regulator_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, -EINVAL, "Device Tree node missing\n"); - drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/regulator/qcom-labibb-regulator.c b/drivers/regulator/qcom-labibb-regulator.c index 1b14015caca6..8641e69b55c3 100644 --- a/drivers/regulator/qcom-labibb-regulator.c +++ b/drivers/regulator/qcom-labibb-regulator.c @@ -799,8 +799,7 @@ static int qcom_labibb_regulator_probe(struct platform_device *pdev) WARN_ON(type != reg_data->type)) return -EINVAL; - vreg = devm_kzalloc(&pdev->dev, sizeof(*vreg), - GFP_KERNEL); + vreg = devm_kzalloc_obj(&pdev->dev, *vreg); if (!vreg) return -ENOMEM; diff --git a/drivers/regulator/qcom-pm8008-regulator.c b/drivers/regulator/qcom-pm8008-regulator.c index 9c9b8be2e15a..c1ebe5a0b500 100644 --- a/drivers/regulator/qcom-pm8008-regulator.c +++ b/drivers/regulator/qcom-pm8008-regulator.c @@ -127,7 +127,7 @@ static int pm8008_regulator_probe(struct platform_device *pdev) for (i = 0; i < ARRAY_SIZE(pm8008_reg_data); i++) { data = &pm8008_reg_data[i]; - preg = devm_kzalloc(dev, sizeof(*preg), GFP_KERNEL); + preg = devm_kzalloc_obj(dev, *preg); if (!preg) return -ENOMEM; diff --git a/drivers/regulator/qcom-refgen-regulator.c b/drivers/regulator/qcom-refgen-regulator.c index cc72e5a43ba6..aeacd44de6f8 100644 --- a/drivers/regulator/qcom-refgen-regulator.c +++ b/drivers/regulator/qcom-refgen-regulator.c @@ -197,7 +197,7 @@ static int qcom_refgen_probe(struct platform_device *pdev) return -ENODATA; if (data->has_clocks) { - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/regulator/qcom-rpmh-regulator.c b/drivers/regulator/qcom-rpmh-regulator.c index 4c90d206e63b..08e39499be86 100644 --- a/drivers/regulator/qcom-rpmh-regulator.c +++ b/drivers/regulator/qcom-rpmh-regulator.c @@ -1952,7 +1952,7 @@ static int rpmh_regulator_probe(struct platform_device *pdev) } for_each_available_child_of_node_scoped(dev->of_node, node) { - vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); + vreg = devm_kzalloc_obj(dev, *vreg); if (!vreg) return -ENOMEM; diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c index 23ed594b574e..6292a1643fb5 100644 --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c @@ -1511,7 +1511,7 @@ static int rpm_reg_probe(struct platform_device *pdev) return -ENODEV; for_each_available_child_of_node_scoped(dev->of_node, node) { - vreg = devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); + vreg = devm_kzalloc_obj(&pdev->dev, *vreg); if (!vreg) return -ENOMEM; diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c index c1a41ce70b36..bb8c3dfb539e 100644 --- a/drivers/regulator/qcom_spmi-regulator.c +++ b/drivers/regulator/qcom_spmi-regulator.c @@ -2509,7 +2509,7 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev) int ret, lenp; struct list_head *vreg_list; - vreg_list = devm_kzalloc(dev, sizeof(*vreg_list), GFP_KERNEL); + vreg_list = devm_kzalloc_obj(dev, *vreg_list); if (!vreg_list) return -ENOMEM; INIT_LIST_HEAD(vreg_list); @@ -2542,7 +2542,7 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev) continue; } - vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); + vreg = devm_kzalloc_obj(dev, *vreg); if (!vreg) return -ENOMEM; diff --git a/drivers/regulator/qcom_usb_vbus-regulator.c b/drivers/regulator/qcom_usb_vbus-regulator.c index 9aea68876284..d909a6f2b7f1 100644 --- a/drivers/regulator/qcom_usb_vbus-regulator.c +++ b/drivers/regulator/qcom_usb_vbus-regulator.c @@ -116,7 +116,7 @@ static int qcom_usb_vbus_regulator_probe(struct platform_device *pdev) return -ENOENT; } - rdesc = devm_kzalloc(dev, sizeof(*rdesc), GFP_KERNEL); + rdesc = devm_kzalloc_obj(dev, *rdesc); if (!rdesc) return -ENOMEM; diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c index 1e956153427e..3e51a758cc47 100644 --- a/drivers/regulator/rk808-regulator.c +++ b/drivers/regulator/rk808-regulator.c @@ -2120,7 +2120,7 @@ static int rk808_regulator_probe(struct platform_device *pdev) if (!regmap) return -ENODEV; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/regulator/rpi-panel-attiny-regulator.c b/drivers/regulator/rpi-panel-attiny-regulator.c index 77da916852e1..3e09300e577c 100644 --- a/drivers/regulator/rpi-panel-attiny-regulator.c +++ b/drivers/regulator/rpi-panel-attiny-regulator.c @@ -289,7 +289,7 @@ static int attiny_i2c_probe(struct i2c_client *i2c) unsigned int data; int ret; - state = devm_kzalloc(&i2c->dev, sizeof(*state), GFP_KERNEL); + state = devm_kzalloc_obj(&i2c->dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/regulator/rt4801-regulator.c b/drivers/regulator/rt4801-regulator.c index 4955bfea4e84..3610e82a3233 100644 --- a/drivers/regulator/rt4801-regulator.c +++ b/drivers/regulator/rt4801-regulator.c @@ -180,7 +180,7 @@ static int rt4801_probe(struct i2c_client *i2c) struct regmap *regmap; int i; - priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&i2c->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/regulator/rt4803.c b/drivers/regulator/rt4803.c index 34cd3f249ada..d246efde0790 100644 --- a/drivers/regulator/rt4803.c +++ b/drivers/regulator/rt4803.c @@ -158,7 +158,7 @@ static int rt4803_probe(struct i2c_client *i2c) bool vsel_act_high; int ret; - desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL); + desc = devm_kzalloc_obj(dev, *desc); if (!desc) return -ENOMEM; diff --git a/drivers/regulator/rt5120-regulator.c b/drivers/regulator/rt5120-regulator.c index a2a13ce2e67b..fe8e48498937 100644 --- a/drivers/regulator/rt5120-regulator.c +++ b/drivers/regulator/rt5120-regulator.c @@ -357,7 +357,7 @@ static int rt5120_regulator_probe(struct platform_device *pdev) struct regulator_config config = {}; int i, ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/regulator/rt5133-regulator.c b/drivers/regulator/rt5133-regulator.c index 129b1f13c880..22e28f53dd77 100644 --- a/drivers/regulator/rt5133-regulator.c +++ b/drivers/regulator/rt5133-regulator.c @@ -546,7 +546,7 @@ static int rt5133_probe(struct i2c_client *i2c) struct regulator_config config = {0}; int i, ret; - priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&i2c->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/regulator/rt5190a-regulator.c b/drivers/regulator/rt5190a-regulator.c index a53ed523b5d7..eead8d6fc8a4 100644 --- a/drivers/regulator/rt5190a-regulator.c +++ b/drivers/regulator/rt5190a-regulator.c @@ -434,7 +434,7 @@ static int rt5190a_probe(struct i2c_client *i2c) struct regulator_config cfg = {}; int i, ret; - priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&i2c->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/regulator/rt5739.c b/drivers/regulator/rt5739.c index 00706cba9f9e..414605133146 100644 --- a/drivers/regulator/rt5739.c +++ b/drivers/regulator/rt5739.c @@ -263,7 +263,7 @@ static int rt5739_probe(struct i2c_client *i2c) unsigned int vid; int ret; - desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL); + desc = devm_kzalloc_obj(dev, *desc); if (!desc) return -ENOMEM; diff --git a/drivers/regulator/rt5759-regulator.c b/drivers/regulator/rt5759-regulator.c index c2553dcee050..abdd8905eac1 100644 --- a/drivers/regulator/rt5759-regulator.c +++ b/drivers/regulator/rt5759-regulator.c @@ -319,7 +319,7 @@ static int rt5759_probe(struct i2c_client *i2c) struct rt5759_priv *priv; int ret; - priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&i2c->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/regulator/rt6160-regulator.c b/drivers/regulator/rt6160-regulator.c index 548ffdf537d3..26bb9c465dc6 100644 --- a/drivers/regulator/rt6160-regulator.c +++ b/drivers/regulator/rt6160-regulator.c @@ -237,7 +237,7 @@ static int rt6160_probe(struct i2c_client *i2c) unsigned int devid; int ret; - priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&i2c->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/regulator/rt6190-regulator.c b/drivers/regulator/rt6190-regulator.c index 21ced348a2cf..6c5e56b3d1e7 100644 --- a/drivers/regulator/rt6190-regulator.c +++ b/drivers/regulator/rt6190-regulator.c @@ -389,7 +389,7 @@ static int rt6190_probe(struct i2c_client *i2c) unsigned int vid; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/regulator/rt6245-regulator.c b/drivers/regulator/rt6245-regulator.c index 5c0ee04e97ac..cc284676a71c 100644 --- a/drivers/regulator/rt6245-regulator.c +++ b/drivers/regulator/rt6245-regulator.c @@ -196,7 +196,7 @@ static int rt6245_probe(struct i2c_client *i2c) struct regulator_dev *rdev; int ret; - priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&i2c->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/regulator/rt8092.c b/drivers/regulator/rt8092.c index 2ea4872ad8e0..a131ffbce618 100644 --- a/drivers/regulator/rt8092.c +++ b/drivers/regulator/rt8092.c @@ -242,7 +242,7 @@ static int rt8092_probe(struct i2c_client *i2c) bool vsel_high; int ret; - desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL); + desc = devm_kzalloc_obj(dev, *desc); if (!desc) return -ENOMEM; diff --git a/drivers/regulator/rtmv20-regulator.c b/drivers/regulator/rtmv20-regulator.c index 3d8d29f87b58..0358b752b37a 100644 --- a/drivers/regulator/rtmv20-regulator.c +++ b/drivers/regulator/rtmv20-regulator.c @@ -327,7 +327,7 @@ static int rtmv20_probe(struct i2c_client *i2c) struct regulator_config config = {}; int ret; - priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&i2c->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/regulator/rtq2208-regulator.c b/drivers/regulator/rtq2208-regulator.c index b4eb5d3eb5bd..1846fbf6e7a8 100644 --- a/drivers/regulator/rtq2208-regulator.c +++ b/drivers/regulator/rtq2208-regulator.c @@ -477,7 +477,7 @@ static int rtq2208_parse_regulator_dt_data(int n_regulator, const unsigned int * for (i = 0; i < n_regulator; i++) { idx = regulator_idx_table[i]; - rdesc[i] = devm_kcalloc(dev, 1, sizeof(*rdesc[0]), GFP_KERNEL); + rdesc[i] = devm_kzalloc_objs(dev, *rdesc[0], 1); if (!rdesc[i]) return -ENOMEM; @@ -606,7 +606,7 @@ static int rtq2208_probe(struct i2c_client *i2c) buck_masks[RTQ2208_BUCK_NUM_IRQ_REGS] = {0x33, 0x33, 0x33, 0x33, 0x33}; unsigned int ldo1_fixed_uV, ldo2_fixed_uV; - rdev_map = devm_kzalloc(dev, sizeof(struct rtq2208_rdev_map), GFP_KERNEL); + rdev_map = devm_kzalloc_obj(dev, struct rtq2208_rdev_map); if (!rdev_map) return -ENOMEM; diff --git a/drivers/regulator/rtq6752-regulator.c b/drivers/regulator/rtq6752-regulator.c index 618904ede72c..1ef1e5139b0e 100644 --- a/drivers/regulator/rtq6752-regulator.c +++ b/drivers/regulator/rtq6752-regulator.c @@ -223,7 +223,7 @@ static int rtq6752_probe(struct i2c_client *i2c) struct regulator_dev *rdev; int i, ret; - priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&i2c->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/regulator/s2dos05-regulator.c b/drivers/regulator/s2dos05-regulator.c index 6e25f663496a..b2ae716a73d3 100644 --- a/drivers/regulator/s2dos05-regulator.c +++ b/drivers/regulator/s2dos05-regulator.c @@ -117,7 +117,7 @@ static int s2dos05_pmic_probe(struct platform_device *pdev) struct regulator_config config = { }; unsigned int rdev_num = ARRAY_SIZE(regulators); - s2dos05 = devm_kzalloc(dev, sizeof(*s2dos05), GFP_KERNEL); + s2dos05 = devm_kzalloc_obj(dev, *s2dos05); if (!s2dos05) return -ENOMEM; diff --git a/drivers/regulator/s2mpa01.c b/drivers/regulator/s2mpa01.c index 8171503861c1..1cadf695c4ae 100644 --- a/drivers/regulator/s2mpa01.c +++ b/drivers/regulator/s2mpa01.c @@ -343,7 +343,7 @@ static int s2mpa01_pmic_probe(struct platform_device *pdev) struct s2mpa01_info *s2mpa01; int i; - s2mpa01 = devm_kzalloc(&pdev->dev, sizeof(*s2mpa01), GFP_KERNEL); + s2mpa01 = devm_kzalloc_obj(&pdev->dev, *s2mpa01); if (!s2mpa01) return -ENOMEM; diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 0fb54617b8a7..3c77b59ea3d7 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -2170,8 +2170,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev) const struct regulator_desc *regulators; const struct s2mpg10_regulator_desc *s2mpg1x_regulators = NULL; - s2mps11 = devm_kzalloc(&pdev->dev, sizeof(struct s2mps11_info), - GFP_KERNEL); + s2mps11 = devm_kzalloc_obj(&pdev->dev, struct s2mps11_info); if (!s2mps11) return -ENOMEM; diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index 2794245d4042..3116d0f97d21 100644 --- a/drivers/regulator/s5m8767.c +++ b/drivers/regulator/s5m8767.c @@ -507,15 +507,11 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, /* count the number of regulators to be supported in pmic */ pdata->num_regulators = of_get_child_count(regulators_np); - rdata = devm_kcalloc(&pdev->dev, - pdata->num_regulators, sizeof(*rdata), - GFP_KERNEL); + rdata = devm_kzalloc_objs(&pdev->dev, *rdata, pdata->num_regulators); if (!rdata) return -ENOMEM; - rmode = devm_kcalloc(&pdev->dev, - pdata->num_regulators, sizeof(*rmode), - GFP_KERNEL); + rmode = devm_kzalloc_objs(&pdev->dev, *rmode, pdata->num_regulators); if (!rmode) return -ENOMEM; @@ -675,8 +671,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) } } - s5m8767 = devm_kzalloc(&pdev->dev, sizeof(struct s5m8767_info), - GFP_KERNEL); + s5m8767 = devm_kzalloc_obj(&pdev->dev, struct s5m8767_info); if (!s5m8767) return -ENOMEM; diff --git a/drivers/regulator/scmi-regulator.c b/drivers/regulator/scmi-regulator.c index c005e65ba0ec..05aaa59aacf6 100644 --- a/drivers/regulator/scmi-regulator.c +++ b/drivers/regulator/scmi-regulator.c @@ -274,9 +274,7 @@ static int process_scmi_regulator_of_node(struct scmi_device *sdev, return -EINVAL; } - rinfo->sregv[dom] = devm_kzalloc(&sdev->dev, - sizeof(struct scmi_regulator), - GFP_KERNEL); + rinfo->sregv[dom] = devm_kzalloc_obj(&sdev->dev, struct scmi_regulator); if (!rinfo->sregv[dom]) return -ENOMEM; @@ -322,7 +320,7 @@ static int scmi_regulator_probe(struct scmi_device *sdev) return num_doms; } - rinfo = devm_kzalloc(&sdev->dev, sizeof(*rinfo), GFP_KERNEL); + rinfo = devm_kzalloc_obj(&sdev->dev, *rinfo); if (!rinfo) return -ENOMEM; diff --git a/drivers/regulator/sgm3804-regulator.c b/drivers/regulator/sgm3804-regulator.c index a34c9418b275..7314ca414049 100644 --- a/drivers/regulator/sgm3804-regulator.c +++ b/drivers/regulator/sgm3804-regulator.c @@ -231,7 +231,7 @@ static int sgm3804_probe(struct i2c_client *i2c) struct sgm3804_data *ctx; int ret, i; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/regulator/slg51000-regulator.c b/drivers/regulator/slg51000-regulator.c index d682764cdbf8..9a70ff434f4a 100644 --- a/drivers/regulator/slg51000-regulator.c +++ b/drivers/regulator/slg51000-regulator.c @@ -442,7 +442,7 @@ static int slg51000_i2c_probe(struct i2c_client *client) struct gpio_desc *cs_gpiod; int error, ret; - chip = devm_kzalloc(dev, sizeof(struct slg51000), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, struct slg51000); if (!chip) return -ENOMEM; diff --git a/drivers/regulator/stm32-pwr.c b/drivers/regulator/stm32-pwr.c index b7aeef6e09e7..435c058e707d 100644 --- a/drivers/regulator/stm32-pwr.c +++ b/drivers/regulator/stm32-pwr.c @@ -143,8 +143,7 @@ static int stm32_pwr_regulator_probe(struct platform_device *pdev) config.dev = &pdev->dev; for (i = 0; i < STM32PWR_REG_NUM_REGS; i++) { - priv = devm_kzalloc(&pdev->dev, sizeof(struct stm32_pwr_reg), - GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct stm32_pwr_reg); if (!priv) return -ENOMEM; priv->base = base; diff --git a/drivers/regulator/stm32-vrefbuf.c b/drivers/regulator/stm32-vrefbuf.c index 9e391206f09d..759ea9036f9e 100644 --- a/drivers/regulator/stm32-vrefbuf.c +++ b/drivers/regulator/stm32-vrefbuf.c @@ -172,7 +172,7 @@ static int stm32_vrefbuf_probe(struct platform_device *pdev) struct regulator_dev *rdev; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; priv->dev = &pdev->dev; diff --git a/drivers/regulator/sy7636a-regulator.c b/drivers/regulator/sy7636a-regulator.c index c44c445ea139..8108f578cf1a 100644 --- a/drivers/regulator/sy7636a-regulator.c +++ b/drivers/regulator/sy7636a-regulator.c @@ -94,7 +94,7 @@ static int sy7636a_regulator_probe(struct platform_device *pdev) return PTR_ERR(gdp); } - data = devm_kzalloc(&pdev->dev, sizeof(struct sy7636a_data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct sy7636a_data); if (!data) return -ENOMEM; diff --git a/drivers/regulator/sy8824x.c b/drivers/regulator/sy8824x.c index 3f07e7da90cb..6c369cb275a8 100644 --- a/drivers/regulator/sy8824x.c +++ b/drivers/regulator/sy8824x.c @@ -131,7 +131,7 @@ static int sy8824_i2c_probe(struct i2c_client *client) struct regmap *regmap; int ret; - di = devm_kzalloc(dev, sizeof(struct sy8824_device_info), GFP_KERNEL); + di = devm_kzalloc_obj(dev, struct sy8824_device_info); if (!di) return -ENOMEM; diff --git a/drivers/regulator/sy8827n.c b/drivers/regulator/sy8827n.c index a1cac8cc3d96..32d128acbfe4 100644 --- a/drivers/regulator/sy8827n.c +++ b/drivers/regulator/sy8827n.c @@ -130,7 +130,7 @@ static int sy8827n_i2c_probe(struct i2c_client *client) struct regmap *regmap; int ret; - di = devm_kzalloc(dev, sizeof(struct sy8827n_device_info), GFP_KERNEL); + di = devm_kzalloc_obj(dev, struct sy8827n_device_info); if (!di) return -ENOMEM; diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c index 04133510e5af..e89e2a48cdc3 100644 --- a/drivers/regulator/ti-abb-regulator.c +++ b/drivers/regulator/ti-abb-regulator.c @@ -523,14 +523,13 @@ static int ti_abb_init_table(struct device *dev, struct ti_abb *abb, } num_entries /= num_values; - info = devm_kcalloc(dev, num_entries, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_objs(dev, *info, num_entries); if (!info) return -ENOMEM; abb->info = info; - volt_table = devm_kcalloc(dev, num_entries, sizeof(unsigned int), - GFP_KERNEL); + volt_table = devm_kzalloc_objs(dev, unsigned int, num_entries); if (!volt_table) return -ENOMEM; @@ -697,7 +696,7 @@ static int ti_abb_probe(struct platform_device *pdev) char *pname; int ret = 0; - abb = devm_kzalloc(dev, sizeof(struct ti_abb), GFP_KERNEL); + abb = devm_kzalloc_obj(dev, struct ti_abb); if (!abb) return -ENOMEM; diff --git a/drivers/regulator/tps51632-regulator.c b/drivers/regulator/tps51632-regulator.c index 8459b49ec26e..5046c42e1113 100644 --- a/drivers/regulator/tps51632-regulator.c +++ b/drivers/regulator/tps51632-regulator.c @@ -216,7 +216,7 @@ static struct tps51632_regulator_platform_data * struct tps51632_regulator_platform_data *pdata; struct device_node *np = dev->of_node; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return NULL; @@ -254,7 +254,7 @@ static int tps51632_probe(struct i2c_client *client) int ret; struct regulator_config config = { }; - tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); + tps = devm_kzalloc_obj(&client->dev, *tps); if (!tps) return -ENOMEM; diff --git a/drivers/regulator/tps62360-regulator.c b/drivers/regulator/tps62360-regulator.c index 00f19082c1da..1b2d40e79738 100644 --- a/drivers/regulator/tps62360-regulator.c +++ b/drivers/regulator/tps62360-regulator.c @@ -285,7 +285,7 @@ static struct tps62360_regulator_platform_data * struct tps62360_regulator_platform_data *pdata; struct device_node *np = dev->of_node; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return NULL; @@ -329,7 +329,7 @@ static int tps62360_probe(struct i2c_client *client) pdata = dev_get_platdata(&client->dev); - tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); + tps = devm_kzalloc_obj(&client->dev, *tps); if (!tps) return -ENOMEM; diff --git a/drivers/regulator/tps6287x-regulator.c b/drivers/regulator/tps6287x-regulator.c index e6403398facc..cd81c7e7056d 100644 --- a/drivers/regulator/tps6287x-regulator.c +++ b/drivers/regulator/tps6287x-regulator.c @@ -187,7 +187,7 @@ static int tps6287x_i2c_probe(struct i2c_client *i2c) struct tps6287x_reg_data *reg_data; struct regulator_dev *rdev; - reg_data = devm_kzalloc(dev, sizeof(struct tps6287x_reg_data), GFP_KERNEL); + reg_data = devm_kzalloc_obj(dev, struct tps6287x_reg_data); if (!reg_data) return -ENOMEM; diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c index 5a2fc57cddf6..57b91b1fe328 100644 --- a/drivers/regulator/tps65023-regulator.c +++ b/drivers/regulator/tps65023-regulator.c @@ -266,7 +266,7 @@ static int tps_65023_probe(struct i2c_client *client) int i; int error; - tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); + tps = devm_kzalloc_obj(&client->dev, *tps); if (!tps) return -ENOMEM; diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c index 6655d9c31187..e45ed4d49493 100644 --- a/drivers/regulator/tps6507x-regulator.c +++ b/drivers/regulator/tps6507x-regulator.c @@ -386,7 +386,7 @@ static int tps6507x_pmic_probe(struct platform_device *pdev) if (tps_board) init_data = tps_board->tps6507x_pmic_init_data; - tps = devm_kzalloc(&pdev->dev, sizeof(*tps), GFP_KERNEL); + tps = devm_kzalloc_obj(&pdev->dev, *tps); if (!tps) return -ENOMEM; diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c index 8f916ee366e5..7433b2733792 100644 --- a/drivers/regulator/tps65090-regulator.c +++ b/drivers/regulator/tps65090-regulator.c @@ -316,14 +316,12 @@ static struct tps65090_platform_data *tps65090_parse_dt_reg_data( int idx = 0, ret; struct tps65090_regulator_plat_data *reg_pdata; - tps65090_pdata = devm_kzalloc(&pdev->dev, sizeof(*tps65090_pdata), - GFP_KERNEL); + tps65090_pdata = devm_kzalloc_obj(&pdev->dev, *tps65090_pdata); if (!tps65090_pdata) return ERR_PTR(-ENOMEM); - reg_pdata = devm_kcalloc(&pdev->dev, - TPS65090_REGULATOR_MAX, sizeof(*reg_pdata), - GFP_KERNEL); + reg_pdata = devm_kzalloc_objs(&pdev->dev, *reg_pdata, + TPS65090_REGULATOR_MAX); if (!reg_pdata) return ERR_PTR(-ENOMEM); @@ -426,9 +424,7 @@ static int tps65090_regulator_probe(struct platform_device *pdev) return tps65090_pdata ? PTR_ERR(tps65090_pdata) : -EINVAL; } - pmic = devm_kcalloc(&pdev->dev, - TPS65090_REGULATOR_MAX, sizeof(*pmic), - GFP_KERNEL); + pmic = devm_kzalloc_objs(&pdev->dev, *pmic, TPS65090_REGULATOR_MAX); if (!pmic) return -ENOMEM; diff --git a/drivers/regulator/tps65132-regulator.c b/drivers/regulator/tps65132-regulator.c index fecda3fd8ebc..912db82ab51d 100644 --- a/drivers/regulator/tps65132-regulator.c +++ b/drivers/regulator/tps65132-regulator.c @@ -230,7 +230,7 @@ static int tps65132_probe(struct i2c_client *client) int id; int ret; - tps = devm_kzalloc(dev, sizeof(*tps), GFP_KERNEL); + tps = devm_kzalloc_obj(dev, *tps); if (!tps) return -ENOMEM; diff --git a/drivers/regulator/tps65185.c b/drivers/regulator/tps65185.c index 4865227e444a..33728e764eb5 100644 --- a/drivers/regulator/tps65185.c +++ b/drivers/regulator/tps65185.c @@ -335,7 +335,7 @@ static int tps65185_probe(struct i2c_client *client) int ret = 0; int i; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/regulator/tps65219-regulator.c b/drivers/regulator/tps65219-regulator.c index a667c3f44bb7..429c3fd20db1 100644 --- a/drivers/regulator/tps65219-regulator.c +++ b/drivers/regulator/tps65219-regulator.c @@ -431,7 +431,7 @@ static int tps65219_register_irqs(struct platform_device *pdev, if (irq < 0) return -EINVAL; - irq_data = devm_kmalloc(tps->dev, sizeof(*irq_data), GFP_KERNEL); + irq_data = devm_kmalloc_obj(tps->dev, *irq_data); if (!irq_data) return -ENOMEM; diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c index 6beb51293e8e..015f3ceb76ff 100644 --- a/drivers/regulator/tps6524x-regulator.c +++ b/drivers/regulator/tps6524x-regulator.c @@ -592,7 +592,7 @@ static int pmic_probe(struct spi_device *spi) return -EINVAL; } - hw = devm_kzalloc(&spi->dev, sizeof(struct tps6524x), GFP_KERNEL); + hw = devm_kzalloc_obj(&spi->dev, struct tps6524x); if (!hw) return -ENOMEM; diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c index 1ab5767590f3..08403e50c5f9 100644 --- a/drivers/regulator/tps6586x-regulator.c +++ b/drivers/regulator/tps6586x-regulator.c @@ -415,7 +415,7 @@ static struct tps6586x_platform_data *tps6586x_parse_regulator_dt( return NULL; } - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return NULL; diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index 3a3027e0b94e..6b14c39e42de 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c @@ -1005,8 +1005,7 @@ static struct tps65910_board *tps65910_parse_dt_reg_data( unsigned int prop; int idx = 0, ret, count; - pmic_plat_data = devm_kzalloc(&pdev->dev, sizeof(*pmic_plat_data), - GFP_KERNEL); + pmic_plat_data = devm_kzalloc_obj(&pdev->dev, *pmic_plat_data); if (!pmic_plat_data) return NULL; @@ -1089,7 +1088,7 @@ static int tps65910_probe(struct platform_device *pdev) return -EINVAL; } - pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); + pmic = devm_kzalloc_obj(&pdev->dev, *pmic); if (!pmic) return -ENOMEM; @@ -1128,24 +1127,18 @@ static int tps65910_probe(struct platform_device *pdev) return -ENODEV; } - pmic->desc = devm_kcalloc(&pdev->dev, - pmic->num_regulators, - sizeof(struct regulator_desc), - GFP_KERNEL); + pmic->desc = devm_kzalloc_objs(&pdev->dev, struct regulator_desc, + pmic->num_regulators); if (!pmic->desc) return -ENOMEM; - pmic->info = devm_kcalloc(&pdev->dev, - pmic->num_regulators, - sizeof(struct tps_info *), - GFP_KERNEL); + pmic->info = devm_kzalloc_objs(&pdev->dev, struct tps_info *, + pmic->num_regulators); if (!pmic->info) return -ENOMEM; - pmic->rdev = devm_kcalloc(&pdev->dev, - pmic->num_regulators, - sizeof(struct regulator_dev *), - GFP_KERNEL); + pmic->rdev = devm_kzalloc_objs(&pdev->dev, struct regulator_dev *, + pmic->num_regulators); if (!pmic->rdev) return -ENOMEM; diff --git a/drivers/regulator/tps6594-regulator.c b/drivers/regulator/tps6594-regulator.c index 503b89a2f5f8..fbf365a46a9e 100644 --- a/drivers/regulator/tps6594-regulator.c +++ b/drivers/regulator/tps6594-regulator.c @@ -721,8 +721,9 @@ static int tps6594_regulator_probe(struct platform_device *pdev) reg_irq_nb = desc->num_irq_types * (desc->num_buck_regs + desc->num_ldo_regs); - irq_data = devm_kmalloc_array(tps->dev, reg_irq_nb, - sizeof(struct tps6594_regulator_irq_data), GFP_KERNEL); + irq_data = devm_kmalloc_objs(tps->dev, + struct tps6594_regulator_irq_data, + reg_irq_nb); if (!irq_data) return -ENOMEM; @@ -810,10 +811,9 @@ static int tps6594_regulator_probe(struct platform_device *pdev) return error; } - irq_ext_reg_data = devm_kmalloc_array(tps->dev, - desc->num_ext_irqs, - sizeof(struct tps6594_ext_regulator_irq_data), - GFP_KERNEL); + irq_ext_reg_data = devm_kmalloc_objs(tps->dev, + struct tps6594_ext_regulator_irq_data, + desc->num_ext_irqs); if (!irq_ext_reg_data) return -ENOMEM; diff --git a/drivers/regulator/tps68470-regulator.c b/drivers/regulator/tps68470-regulator.c index de7db7690f6b..4e84cde07f61 100644 --- a/drivers/regulator/tps68470-regulator.c +++ b/drivers/regulator/tps68470-regulator.c @@ -144,7 +144,7 @@ static int tps68470_regulator_probe(struct platform_device *pdev) struct regulator_dev *rdev; int i; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/regulator/uniphier-regulator.c b/drivers/regulator/uniphier-regulator.c index 74939b7fcd81..0bd4dc07dfa1 100644 --- a/drivers/regulator/uniphier-regulator.c +++ b/drivers/regulator/uniphier-regulator.c @@ -49,7 +49,7 @@ static int uniphier_regulator_probe(struct platform_device *pdev) const char *name; int i, ret, nr; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/regulator/userspace-consumer.c b/drivers/regulator/userspace-consumer.c index 72bb5ffb49a8..9172a26e0ac4 100644 --- a/drivers/regulator/userspace-consumer.c +++ b/drivers/regulator/userspace-consumer.c @@ -132,7 +132,7 @@ static int regulator_userspace_consumer_probe(struct platform_device *pdev) pdata->no_autoswitch = true; pdata->num_supplies = 1; - pdata->supplies = devm_kzalloc(&pdev->dev, sizeof(*pdata->supplies), GFP_KERNEL); + pdata->supplies = devm_kzalloc_obj(&pdev->dev, *pdata->supplies); if (!pdata->supplies) return -ENOMEM; pdata->supplies[0].supply = "vout"; @@ -143,9 +143,7 @@ static int regulator_userspace_consumer_probe(struct platform_device *pdev) return -EINVAL; } - drvdata = devm_kzalloc(&pdev->dev, - sizeof(struct userspace_consumer_data), - GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, struct userspace_consumer_data); if (drvdata == NULL) return -ENOMEM; diff --git a/drivers/regulator/vctrl-regulator.c b/drivers/regulator/vctrl-regulator.c index 2796580a3a3c..c5a5447d057a 100644 --- a/drivers/regulator/vctrl-regulator.c +++ b/drivers/regulator/vctrl-regulator.c @@ -347,9 +347,9 @@ static int vctrl_init_vtable(struct platform_device *pdev, return -EINVAL; } - vctrl->vtable = devm_kcalloc(&pdev->dev, rdesc->n_voltages, - sizeof(struct vctrl_voltage_table), - GFP_KERNEL); + vctrl->vtable = devm_kzalloc_objs(&pdev->dev, + struct vctrl_voltage_table, + rdesc->n_voltages); if (!vctrl->vtable) return -ENOMEM; @@ -451,8 +451,7 @@ static int vctrl_probe(struct platform_device *pdev) int ctrl_uV; int ret; - vctrl = devm_kzalloc(&pdev->dev, sizeof(struct vctrl_data), - GFP_KERNEL); + vctrl = devm_kzalloc_obj(&pdev->dev, struct vctrl_data); if (!vctrl) return -ENOMEM; diff --git a/drivers/regulator/vexpress-regulator.c b/drivers/regulator/vexpress-regulator.c index 5a2e0143cfdf..e2c9b4331af0 100644 --- a/drivers/regulator/vexpress-regulator.c +++ b/drivers/regulator/vexpress-regulator.c @@ -45,7 +45,7 @@ static int vexpress_regulator_probe(struct platform_device *pdev) struct regulator_dev *rdev; struct regmap *regmap; - desc = devm_kzalloc(&pdev->dev, sizeof(*desc), GFP_KERNEL); + desc = devm_kzalloc_obj(&pdev->dev, *desc); if (!desc) return -ENOMEM; diff --git a/drivers/regulator/virtual.c b/drivers/regulator/virtual.c index 218a0d66a152..a7e3c67967e8 100644 --- a/drivers/regulator/virtual.c +++ b/drivers/regulator/virtual.c @@ -309,8 +309,7 @@ static int regulator_virtual_probe(struct platform_device *pdev) pr_warn("**********************************************************\n"); } - drvdata = devm_kzalloc(&pdev->dev, sizeof(struct virtual_consumer_data), - GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, struct virtual_consumer_data); if (drvdata == NULL) return -ENOMEM; diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index 834d7c181971..2036735f0e15 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c @@ -402,8 +402,7 @@ static int wm831x_buckv_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "Probing DCDC%d\n", id + 1); - dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), - GFP_KERNEL); + dcdc = devm_kzalloc_obj(&pdev->dev, struct wm831x_dcdc); if (!dcdc) return -ENOMEM; @@ -561,8 +560,7 @@ static int wm831x_buckp_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "Probing DCDC%d\n", id + 1); - dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), - GFP_KERNEL); + dcdc = devm_kzalloc_obj(&pdev->dev, struct wm831x_dcdc); if (!dcdc) return -ENOMEM; @@ -691,7 +689,7 @@ static int wm831x_boostp_probe(struct platform_device *pdev) if (pdata == NULL || pdata->dcdc[id] == NULL) return -ENODEV; - dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), GFP_KERNEL); + dcdc = devm_kzalloc_obj(&pdev->dev, struct wm831x_dcdc); if (!dcdc) return -ENOMEM; @@ -780,7 +778,7 @@ static int wm831x_epe_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "Probing EPE%d\n", id + 1); - dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), GFP_KERNEL); + dcdc = devm_kzalloc_obj(&pdev->dev, struct wm831x_dcdc); if (!dcdc) return -ENOMEM; diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c index b46e2cde5e9d..5afd3094b3ce 100644 --- a/drivers/regulator/wm831x-isink.c +++ b/drivers/regulator/wm831x-isink.c @@ -118,8 +118,7 @@ static int wm831x_isink_probe(struct platform_device *pdev) if (pdata == NULL || pdata->isink[id] == NULL) return -ENODEV; - isink = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_isink), - GFP_KERNEL); + isink = devm_kzalloc_obj(&pdev->dev, struct wm831x_isink); if (!isink) return -ENOMEM; diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c index 76b89b1cd519..34a6d6cf753a 100644 --- a/drivers/regulator/wm831x-ldo.c +++ b/drivers/regulator/wm831x-ldo.c @@ -229,7 +229,7 @@ static int wm831x_gp_ldo_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); - ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL); + ldo = devm_kzalloc_obj(&pdev->dev, struct wm831x_ldo); if (!ldo) return -ENOMEM; @@ -440,7 +440,7 @@ static int wm831x_aldo_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); - ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL); + ldo = devm_kzalloc_obj(&pdev->dev, struct wm831x_ldo); if (!ldo) return -ENOMEM; @@ -586,7 +586,7 @@ static int wm831x_alive_ldo_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); - ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL); + ldo = devm_kzalloc_obj(&pdev->dev, struct wm831x_ldo); if (!ldo) return -ENOMEM; diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c index 2946db448aec..0ce30f4c140d 100644 --- a/drivers/regulator/wm8994-regulator.c +++ b/drivers/regulator/wm8994-regulator.c @@ -158,7 +158,7 @@ static int wm8994_ldo_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); - ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm8994_ldo), GFP_KERNEL); + ldo = devm_kzalloc_obj(&pdev->dev, struct wm8994_ldo); if (!ldo) return -ENOMEM; diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c index 006fa7b56727..e57dcb5598df 100644 --- a/drivers/remoteproc/da8xx_remoteproc.c +++ b/drivers/remoteproc/da8xx_remoteproc.c @@ -201,8 +201,7 @@ static int da8xx_rproc_get_internal_memories(struct platform_device *pdev, struct resource *res; int i; - drproc->mem = devm_kcalloc(dev, num_mems, sizeof(*drproc->mem), - GFP_KERNEL); + drproc->mem = devm_kzalloc_objs(dev, *drproc->mem, num_mems); if (!drproc->mem) return -ENOMEM; diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c index 407d6034f748..1b6b49a22454 100644 --- a/drivers/remoteproc/keystone_remoteproc.c +++ b/drivers/remoteproc/keystone_remoteproc.c @@ -283,8 +283,7 @@ static int keystone_rproc_of_get_memories(struct platform_device *pdev, int i; num_mems = ARRAY_SIZE(mem_names); - ksproc->mem = devm_kcalloc(ksproc->dev, num_mems, - sizeof(*ksproc->mem), GFP_KERNEL); + ksproc->mem = devm_kzalloc_objs(ksproc->dev, *ksproc->mem, num_mems); if (!ksproc->mem) return -ENOMEM; diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 9751acc2bf83..3a4627fd6cbf 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -1408,7 +1408,7 @@ static int scp_probe(struct platform_device *pdev) struct resource *res; int ret; - scp_cluster = devm_kzalloc(dev, sizeof(*scp_cluster), GFP_KERNEL); + scp_cluster = devm_kzalloc_obj(dev, *scp_cluster); if (!scp_cluster) return -ENOMEM; diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c index 1e96506ce7ca..f52a531877ae 100644 --- a/drivers/remoteproc/omap_remoteproc.c +++ b/drivers/remoteproc/omap_remoteproc.c @@ -1143,8 +1143,7 @@ static int omap_rproc_get_boot_data(struct platform_device *pdev, if (!of_property_present(np, "ti,bootreg")) return 0; - oproc->boot_data = devm_kzalloc(&pdev->dev, sizeof(*oproc->boot_data), - GFP_KERNEL); + oproc->boot_data = devm_kzalloc_obj(&pdev->dev, *oproc->boot_data); if (!oproc->boot_data) return -ENOMEM; @@ -1185,8 +1184,7 @@ static int omap_rproc_of_get_internal_memories(struct platform_device *pdev, num_mems = of_property_count_elems_of_size(dev->of_node, "reg", sizeof(u32)) / 2; - oproc->mem = devm_kcalloc(dev, num_mems, sizeof(*oproc->mem), - GFP_KERNEL); + oproc->mem = devm_kzalloc_objs(dev, *oproc->mem, num_mems); if (!oproc->mem) return -ENOMEM; @@ -1263,9 +1261,8 @@ static int omap_rproc_of_get_timers(struct platform_device *pdev, num_timers = oproc->num_timers + oproc->num_wd_timers; if (num_timers) { - oproc->timers = devm_kcalloc(dev, num_timers, - sizeof(*oproc->timers), - GFP_KERNEL); + oproc->timers = devm_kzalloc_objs(dev, *oproc->timers, + num_timers); if (!oproc->timers) return -ENOMEM; diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c index 46d9169a37f6..23fabf4ce84d 100644 --- a/drivers/remoteproc/qcom_q6v5_adsp.c +++ b/drivers/remoteproc/qcom_q6v5_adsp.c @@ -545,8 +545,7 @@ static int adsp_init_clock(struct qcom_adsp *adsp, const char **clk_ids) num_clks++; adsp->num_clks = num_clks; - adsp->clks = devm_kcalloc(adsp->dev, adsp->num_clks, - sizeof(*adsp->clks), GFP_KERNEL); + adsp->clks = devm_kzalloc_objs(adsp->dev, *adsp->clks, adsp->num_clks); if (!adsp->clks) return -ENOMEM; diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index f37b77ae187e..e7dfad27e526 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -859,8 +859,7 @@ static int qcom_pas_setup_tmd(struct qcom_pas *pas, const struct qcom_pas_data * if (!desc->tmd_name || desc->num_tmd == 0) return 0; - tmd_names = devm_kcalloc(pas->dev, desc->num_tmd, - sizeof(*tmd_names), GFP_KERNEL); + tmd_names = devm_kzalloc_objs(pas->dev, *tmd_names, desc->num_tmd); if (!tmd_names) return -ENOMEM; diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c index c856a92af43c..02f38fe29f20 100644 --- a/drivers/remoteproc/qcom_wcnss.c +++ b/drivers/remoteproc/qcom_wcnss.c @@ -468,9 +468,8 @@ static int wcnss_init_regulators(struct qcom_wcnss *wcnss, num_vregs += data->num_pd_vregs; } - bulk = devm_kcalloc(wcnss->dev, - num_vregs, sizeof(struct regulator_bulk_data), - GFP_KERNEL); + bulk = devm_kzalloc_objs(wcnss->dev, struct regulator_bulk_data, + num_vregs); if (!bulk) return -ENOMEM; diff --git a/drivers/remoteproc/qcom_wcnss_iris.c b/drivers/remoteproc/qcom_wcnss_iris.c index 2b89b4db6c94..415ad475036b 100644 --- a/drivers/remoteproc/qcom_wcnss_iris.c +++ b/drivers/remoteproc/qcom_wcnss_iris.c @@ -161,10 +161,8 @@ struct qcom_iris *qcom_iris_probe(struct device *parent, bool *use_48mhz_xo) } iris->num_vregs = data->num_vregs; - iris->vregs = devm_kcalloc(&iris->dev, - iris->num_vregs, - sizeof(struct regulator_bulk_data), - GFP_KERNEL); + iris->vregs = devm_kzalloc_objs(&iris->dev, struct regulator_bulk_data, + iris->num_vregs); if (!iris->vregs) { ret = -ENOMEM; goto err_device_del; diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c index 12f55a81cfa0..6098fc237425 100644 --- a/drivers/remoteproc/remoteproc_virtio.c +++ b/drivers/remoteproc/remoteproc_virtio.c @@ -513,7 +513,7 @@ static int rproc_virtio_probe(struct platform_device *pdev) if (!rvdev_data) return -EINVAL; - rvdev = devm_kzalloc(dev, sizeof(*rvdev), GFP_KERNEL); + rvdev = devm_kzalloc_obj(dev, *rvdev); if (!rvdev) return -ENOMEM; diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c index a47e040c6db8..b1d73ffc8a14 100644 --- a/drivers/remoteproc/stm32_rproc.c +++ b/drivers/remoteproc/stm32_rproc.c @@ -132,7 +132,7 @@ static int stm32_rproc_of_memory_translations(struct platform_device *pdev, return -EINVAL; } - p_mems = devm_kcalloc(dev, cnt, sizeof(*p_mems), GFP_KERNEL); + p_mems = devm_kzalloc_objs(dev, *p_mems, cnt); if (!p_mems) return -ENOMEM; mem_range = kzalloc_objs(*mem_range, cnt); diff --git a/drivers/remoteproc/ti_k3_common.c b/drivers/remoteproc/ti_k3_common.c index 4b6da3363f6c..f79ccb57a372 100644 --- a/drivers/remoteproc/ti_k3_common.c +++ b/drivers/remoteproc/ti_k3_common.c @@ -409,8 +409,7 @@ int k3_rproc_of_get_memories(struct platform_device *pdev, int i; num_mems = data->num_mems; - kproc->mem = devm_kcalloc(kproc->dev, num_mems, - sizeof(*kproc->mem), GFP_KERNEL); + kproc->mem = devm_kzalloc_objs(kproc->dev, *kproc->mem, num_mems); if (!kproc->mem) return -ENOMEM; @@ -490,7 +489,7 @@ int k3_reserved_mem_init(struct k3_rproc *kproc) return ret; num_rmems--; - kproc->rmem = devm_kcalloc(dev, num_rmems, sizeof(*kproc->rmem), GFP_KERNEL); + kproc->rmem = devm_kzalloc_objs(dev, *kproc->rmem, num_rmems); if (!kproc->rmem) return -ENOMEM; diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c index d7d9756afed0..618c72dc08ec 100644 --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c @@ -921,8 +921,7 @@ static int k3_r5_core_of_get_internal_memories(struct platform_device *pdev, int i, ret; num_mems = data->num_mems; - kproc->mem = devm_kcalloc(kproc->dev, num_mems, sizeof(*kproc->mem), - GFP_KERNEL); + kproc->mem = devm_kzalloc_objs(kproc->dev, *kproc->mem, num_mems); if (!kproc->mem) return -ENOMEM; @@ -972,7 +971,7 @@ static int k3_r5_core_of_get_sram_memories(struct platform_device *pdev, return 0; } - core->sram = devm_kcalloc(dev, num_sram, sizeof(*core->sram), GFP_KERNEL); + core->sram = devm_kzalloc_objs(dev, *core->sram, num_sram); if (!core->sram) return -ENOMEM; @@ -1216,7 +1215,7 @@ static int k3_r5_core_of_init(struct platform_device *pdev) if (!devres_open_group(dev, k3_r5_core_of_init, GFP_KERNEL)) return -ENOMEM; - core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); + core = devm_kzalloc_obj(dev, *core); if (!core) { ret = -ENOMEM; goto err; @@ -1345,7 +1344,7 @@ static int k3_r5_probe(struct platform_device *pdev) return -ENODEV; } - cluster = devm_kzalloc(dev, sizeof(*cluster), GFP_KERNEL); + cluster = devm_kzalloc_obj(dev, *cluster); if (!cluster) return -ENOMEM; diff --git a/drivers/remoteproc/ti_sci_proc.h b/drivers/remoteproc/ti_sci_proc.h index f3911ce75252..aa9cffbfdd85 100644 --- a/drivers/remoteproc/ti_sci_proc.h +++ b/drivers/remoteproc/ti_sci_proc.h @@ -41,7 +41,7 @@ struct ti_sci_proc *ti_sci_proc_of_get_tsp(struct device *dev, if (ret < 0) return ERR_PTR(ret); - tsp = devm_kzalloc(dev, sizeof(*tsp), GFP_KERNEL); + tsp = devm_kzalloc_obj(dev, *tsp); if (!tsp) return ERR_PTR(-ENOMEM); diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c b/drivers/remoteproc/xlnx_r5_remoteproc.c index a9873a37dd8f..dfa01a324281 100644 --- a/drivers/remoteproc/xlnx_r5_remoteproc.c +++ b/drivers/remoteproc/xlnx_r5_remoteproc.c @@ -954,8 +954,7 @@ static int zynqmp_r5_get_sram_banks(struct zynqmp_r5_core *r5_core) return -EINVAL; } - sram = devm_kcalloc(dev, num_sram, - sizeof(struct zynqmp_sram_bank), GFP_KERNEL); + sram = devm_kzalloc_objs(dev, struct zynqmp_sram_bank, num_sram); if (!sram) return -ENOMEM; @@ -1038,16 +1037,15 @@ static int zynqmp_r5_get_tcm_node_from_dt(struct zynqmp_r5_cluster *cluster) return -EINVAL; } - r5_core->tcm_banks = devm_kcalloc(dev, tcm_bank_count, - sizeof(struct mem_bank_data *), - GFP_KERNEL); + r5_core->tcm_banks = devm_kzalloc_objs(dev, + struct mem_bank_data *, + tcm_bank_count); if (!r5_core->tcm_banks) return -ENOMEM; r5_core->tcm_bank_count = tcm_bank_count; for (j = 0, tcm_pd_idx = 1; j < tcm_bank_count; j++, tcm_pd_idx++) { - tcm = devm_kzalloc(dev, sizeof(struct mem_bank_data), - GFP_KERNEL); + tcm = devm_kzalloc_obj(dev, struct mem_bank_data); if (!tcm) return -ENOMEM; @@ -1139,9 +1137,9 @@ static int zynqmp_r5_get_tcm_node(struct zynqmp_r5_cluster *cluster) tcm_node = 0; for (i = 0; i < cluster->core_count; i++) { r5_core = cluster->r5_cores[i]; - r5_core->tcm_banks = devm_kcalloc(dev, tcm_bank_count, - sizeof(struct mem_bank_data *), - GFP_KERNEL); + r5_core->tcm_banks = devm_kzalloc_objs(dev, + struct mem_bank_data *, + tcm_bank_count); if (!r5_core->tcm_banks) return -ENOMEM; diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c index c067b6d57d71..27abf60f4d67 100644 --- a/drivers/resctrl/mpam_devices.c +++ b/drivers/resctrl/mpam_devices.c @@ -706,7 +706,7 @@ static int mpam_ris_create_locked(struct mpam_msc *msc, u8 ris_idx, if (test_and_set_bit(ris_idx, &msc->ris_idxs)) return -EBUSY; - ris = devm_kzalloc(&msc->pdev->dev, sizeof(*ris), GFP_KERNEL); + ris = devm_kzalloc_obj(&msc->pdev->dev, *ris); if (!ris) return -ENOMEM; init_garbage(&ris->garbage); @@ -2450,7 +2450,7 @@ static struct mpam_msc *do_mpam_msc_drv_probe(struct platform_device *pdev) lockdep_assert_held(&mpam_list_lock); - msc = devm_kzalloc(&pdev->dev, sizeof(*msc), GFP_KERNEL); + msc = devm_kzalloc_obj(&pdev->dev, *msc); if (!msc) return ERR_PTR(-ENOMEM); init_garbage(&msc->garbage); diff --git a/drivers/reset/amlogic/reset-meson-audio-arb.c b/drivers/reset/amlogic/reset-meson-audio-arb.c index 6ec253976bed..1cb41459e605 100644 --- a/drivers/reset/amlogic/reset-meson-audio-arb.c +++ b/drivers/reset/amlogic/reset-meson-audio-arb.c @@ -141,7 +141,7 @@ static int meson_audio_arb_probe(struct platform_device *pdev) if (!data) return -EINVAL; - arb = devm_kzalloc(dev, sizeof(*arb), GFP_KERNEL); + arb = devm_kzalloc_obj(dev, *arb); if (!arb) return -ENOMEM; platform_set_drvdata(pdev, arb); diff --git a/drivers/reset/amlogic/reset-meson-common.c b/drivers/reset/amlogic/reset-meson-common.c index a90e0ecaaadf..998b23d0a3a9 100644 --- a/drivers/reset/amlogic/reset-meson-common.c +++ b/drivers/reset/amlogic/reset-meson-common.c @@ -120,7 +120,7 @@ int meson_reset_controller_register(struct device *dev, struct regmap *map, { struct meson_reset *data; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/reset/hisilicon/hi6220_reset.c b/drivers/reset/hisilicon/hi6220_reset.c index 65aa5ff5ed82..804d22a3979c 100644 --- a/drivers/reset/hisilicon/hi6220_reset.c +++ b/drivers/reset/hisilicon/hi6220_reset.c @@ -159,7 +159,7 @@ static int hi6220_reset_probe(struct platform_device *pdev) struct hi6220_reset_data *data; struct regmap *regmap; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/reset/hisilicon/reset-hi3660.c b/drivers/reset/hisilicon/reset-hi3660.c index 1beb275275ad..c2d350b0ec28 100644 --- a/drivers/reset/hisilicon/reset-hi3660.c +++ b/drivers/reset/hisilicon/reset-hi3660.c @@ -79,7 +79,7 @@ static int hi3660_reset_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct device *dev = &pdev->dev; - rc = devm_kzalloc(dev, sizeof(*rc), GFP_KERNEL); + rc = devm_kzalloc_obj(dev, *rc); if (!rc) return -ENOMEM; diff --git a/drivers/reset/reset-a10sr.c b/drivers/reset/reset-a10sr.c index 99b3bc8382f3..748a12826786 100644 --- a/drivers/reset/reset-a10sr.c +++ b/drivers/reset/reset-a10sr.c @@ -92,8 +92,7 @@ static int a10sr_reset_probe(struct platform_device *pdev) struct altr_a10sr *a10sr = dev_get_drvdata(pdev->dev.parent); struct a10sr_reset *a10r; - a10r = devm_kzalloc(&pdev->dev, sizeof(struct a10sr_reset), - GFP_KERNEL); + a10r = devm_kzalloc_obj(&pdev->dev, struct a10sr_reset); if (!a10r) return -ENOMEM; diff --git a/drivers/reset/reset-aspeed.c b/drivers/reset/reset-aspeed.c index dd2f860a69d7..1cb65f02fde4 100644 --- a/drivers/reset/reset-aspeed.c +++ b/drivers/reset/reset-aspeed.c @@ -206,7 +206,7 @@ static int aspeed_reset_probe(struct auxiliary_device *adev, struct aspeed_reset *reset; struct device *dev = &adev->dev; - reset = devm_kzalloc(dev, sizeof(*reset), GFP_KERNEL); + reset = devm_kzalloc_obj(dev, *reset); if (!reset) return -ENOMEM; diff --git a/drivers/reset/reset-ath79.c b/drivers/reset/reset-ath79.c index 1a2c0f8a5e9e..2ff62820ff1c 100644 --- a/drivers/reset/reset-ath79.c +++ b/drivers/reset/reset-ath79.c @@ -84,8 +84,7 @@ static int ath79_reset_probe(struct platform_device *pdev) struct ath79_reset *ath79_reset; int err; - ath79_reset = devm_kzalloc(&pdev->dev, - sizeof(*ath79_reset), GFP_KERNEL); + ath79_reset = devm_kzalloc_obj(&pdev->dev, *ath79_reset); if (!ath79_reset) return -ENOMEM; diff --git a/drivers/reset/reset-axs10x.c b/drivers/reset/reset-axs10x.c index ea0e6b0b6b4d..3e4c3b88dd16 100644 --- a/drivers/reset/reset-axs10x.c +++ b/drivers/reset/reset-axs10x.c @@ -44,7 +44,7 @@ static int axs10x_reset_probe(struct platform_device *pdev) { struct axs10x_rst *rst; - rst = devm_kzalloc(&pdev->dev, sizeof(*rst), GFP_KERNEL); + rst = devm_kzalloc_obj(&pdev->dev, *rst); if (!rst) return -ENOMEM; diff --git a/drivers/reset/reset-bcm6345.c b/drivers/reset/reset-bcm6345.c index 441d9dd76572..f6857dea0ea0 100644 --- a/drivers/reset/reset-bcm6345.c +++ b/drivers/reset/reset-bcm6345.c @@ -96,8 +96,7 @@ static int bcm6345_reset_probe(struct platform_device *pdev) { struct bcm6345_reset *bcm6345_reset; - bcm6345_reset = devm_kzalloc(&pdev->dev, - sizeof(*bcm6345_reset), GFP_KERNEL); + bcm6345_reset = devm_kzalloc_obj(&pdev->dev, *bcm6345_reset); if (!bcm6345_reset) return -ENOMEM; diff --git a/drivers/reset/reset-berlin.c b/drivers/reset/reset-berlin.c index 578fe867080c..ffdcd4a2e093 100644 --- a/drivers/reset/reset-berlin.c +++ b/drivers/reset/reset-berlin.c @@ -71,7 +71,7 @@ static int berlin2_reset_probe(struct platform_device *pdev) struct device_node *parent_np; struct berlin_reset_priv *priv; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-brcmstb-rescal.c b/drivers/reset/reset-brcmstb-rescal.c index 823317772bac..92c90c4e1749 100644 --- a/drivers/reset/reset-brcmstb-rescal.c +++ b/drivers/reset/reset-brcmstb-rescal.c @@ -67,7 +67,7 @@ static int brcm_rescal_reset_probe(struct platform_device *pdev) { struct brcm_rescal_reset *data; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/reset/reset-brcmstb.c b/drivers/reset/reset-brcmstb.c index 810fe76452d6..af243486c9bc 100644 --- a/drivers/reset/reset-brcmstb.c +++ b/drivers/reset/reset-brcmstb.c @@ -86,7 +86,7 @@ static int brcmstb_reset_probe(struct platform_device *pdev) struct brcmstb_reset *priv; struct resource *res; - priv = devm_kzalloc(kdev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(kdev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-dr1v90.c b/drivers/reset/reset-dr1v90.c index daa99c797b1a..8cfbc7f9f625 100644 --- a/drivers/reset/reset-dr1v90.c +++ b/drivers/reset/reset-dr1v90.c @@ -105,7 +105,7 @@ static int dr1v90_reset_probe(struct auxiliary_device *adev, struct dr1v90_reset_controller *rstc; struct device *dev = &adev->dev; - rstc = devm_kzalloc(dev, sizeof(*rstc), GFP_KERNEL); + rstc = devm_kzalloc_obj(dev, *rstc); if (!rstc) return -ENOMEM; diff --git a/drivers/reset/reset-eic7700-hsp.c b/drivers/reset/reset-eic7700-hsp.c index 1575ee4a20d6..2b20975ccea7 100644 --- a/drivers/reset/reset-eic7700-hsp.c +++ b/drivers/reset/reset-eic7700-hsp.c @@ -78,7 +78,7 @@ static int eic7700_hsp_reset_probe(struct auxiliary_device *adev, struct eic7700_hsp_reset_data *data; struct device *dev = &adev->dev; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/reset/reset-eic7700.c b/drivers/reset/reset-eic7700.c index b72283b18b08..09a742f8e38a 100644 --- a/drivers/reset/reset-eic7700.c +++ b/drivers/reset/reset-eic7700.c @@ -390,7 +390,7 @@ static int eic7700_reset_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; void __iomem *base; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/reset/reset-eyeq.c b/drivers/reset/reset-eyeq.c index f2533086bb76..6b210e2ae6e7 100644 --- a/drivers/reset/reset-eyeq.c +++ b/drivers/reset/reset-eyeq.c @@ -564,7 +564,7 @@ static int eqr_probe(struct auxiliary_device *adev, if (!match || !match->data) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-gpio.c b/drivers/reset/reset-gpio.c index bf95296a512e..d11d1d6de445 100644 --- a/drivers/reset/reset-gpio.c +++ b/drivers/reset/reset-gpio.c @@ -57,7 +57,7 @@ static int reset_gpio_probe(struct auxiliary_device *adev, struct device *dev = &adev->dev; struct reset_gpio_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-hsdk.c b/drivers/reset/reset-hsdk.c index 98460e08752c..076c5ddb3f36 100644 --- a/drivers/reset/reset-hsdk.c +++ b/drivers/reset/reset-hsdk.c @@ -93,7 +93,7 @@ static int hsdk_reset_probe(struct platform_device *pdev) { struct hsdk_rst *rst; - rst = devm_kzalloc(&pdev->dev, sizeof(*rst), GFP_KERNEL); + rst = devm_kzalloc_obj(&pdev->dev, *rst); if (!rst) return -ENOMEM; diff --git a/drivers/reset/reset-imx-scu.c b/drivers/reset/reset-imx-scu.c index 919fc29f944c..cf7b9619639d 100644 --- a/drivers/reset/reset-imx-scu.c +++ b/drivers/reset/reset-imx-scu.c @@ -61,7 +61,7 @@ static int imx_scu_reset_probe(struct platform_device *pdev) struct imx_scu_reset *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-imx7.c b/drivers/reset/reset-imx7.c index a3cb8244d76a..b4821044b88f 100644 --- a/drivers/reset/reset-imx7.c +++ b/drivers/reset/reset-imx7.c @@ -371,7 +371,7 @@ static int imx7_reset_probe(struct platform_device *pdev) struct regmap_config config = { .name = "src" }; const struct imx7_src_variant *variant = of_device_get_match_data(dev); - imx7src = devm_kzalloc(dev, sizeof(*imx7src), GFP_KERNEL); + imx7src = devm_kzalloc_obj(dev, *imx7src); if (!imx7src) return -ENOMEM; diff --git a/drivers/reset/reset-imx8mp-audiomix.c b/drivers/reset/reset-imx8mp-audiomix.c index b7fa3110f282..7213abafaf66 100644 --- a/drivers/reset/reset-imx8mp-audiomix.c +++ b/drivers/reset/reset-imx8mp-audiomix.c @@ -192,7 +192,7 @@ static int imx8mp_audiomix_reset_probe(struct auxiliary_device *adev, rinfo = (void *)id->driver_data; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-intel-gw.c b/drivers/reset/reset-intel-gw.c index 0db64cc8a282..151e3f8dcd67 100644 --- a/drivers/reset/reset-intel-gw.c +++ b/drivers/reset/reset-intel-gw.c @@ -170,7 +170,7 @@ static int intel_reset_probe(struct platform_device *pdev) u32 rb_id[3]; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/reset/reset-k210.c b/drivers/reset/reset-k210.c index e77e4cca377d..7ad462711af8 100644 --- a/drivers/reset/reset-k210.c +++ b/drivers/reset/reset-k210.c @@ -95,7 +95,7 @@ static int k210_rst_probe(struct platform_device *pdev) dev_info(dev, "K210 reset controller\n"); - ksr = devm_kzalloc(dev, sizeof(*ksr), GFP_KERNEL); + ksr = devm_kzalloc_obj(dev, *ksr); if (!ksr) return -ENOMEM; diff --git a/drivers/reset/reset-k230.c b/drivers/reset/reset-k230.c index c81045bb4a14..4ca74ba6cec0 100644 --- a/drivers/reset/reset-k230.c +++ b/drivers/reset/reset-k230.c @@ -332,7 +332,7 @@ static int k230_rst_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct k230_rst *rstc; - rstc = devm_kzalloc(dev, sizeof(*rstc), GFP_KERNEL); + rstc = devm_kzalloc_obj(dev, *rstc); if (!rstc) return -ENOMEM; diff --git a/drivers/reset/reset-lantiq.c b/drivers/reset/reset-lantiq.c index 652a45890cb2..b41295c22128 100644 --- a/drivers/reset/reset-lantiq.c +++ b/drivers/reset/reset-lantiq.c @@ -168,7 +168,7 @@ static int lantiq_rcu_reset_probe(struct platform_device *pdev) struct lantiq_rcu_reset_priv *priv; int err; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-lpc18xx.c b/drivers/reset/reset-lpc18xx.c index 8ac9f237e1ce..631f67b76cf1 100644 --- a/drivers/reset/reset-lpc18xx.c +++ b/drivers/reset/reset-lpc18xx.c @@ -139,7 +139,7 @@ static int lpc18xx_rgu_probe(struct platform_device *pdev) u32 fcclk, firc; int ret; - rc = devm_kzalloc(&pdev->dev, sizeof(*rc), GFP_KERNEL); + rc = devm_kzalloc_obj(&pdev->dev, *rc); if (!rc) return -ENOMEM; diff --git a/drivers/reset/reset-ma35d1.c b/drivers/reset/reset-ma35d1.c index 4ee901f00132..d2962c0c80be 100644 --- a/drivers/reset/reset-ma35d1.c +++ b/drivers/reset/reset-ma35d1.c @@ -199,7 +199,7 @@ static int ma35d1_reset_probe(struct platform_device *pdev) return -EINVAL; } - reset_data = devm_kzalloc(dev, sizeof(*reset_data), GFP_KERNEL); + reset_data = devm_kzalloc_obj(dev, *reset_data); if (!reset_data) return -ENOMEM; diff --git a/drivers/reset/reset-microchip-sparx5.c b/drivers/reset/reset-microchip-sparx5.c index 6d3e75b33260..a190c84e1d23 100644 --- a/drivers/reset/reset-microchip-sparx5.c +++ b/drivers/reset/reset-microchip-sparx5.c @@ -151,7 +151,7 @@ static int mchp_sparx5_reset_probe(struct platform_device *pdev) struct mchp_reset_context *ctx; int err; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/reset/reset-mpfs.c b/drivers/reset/reset-mpfs.c index 8ffcc54ee6f6..e034048fb552 100644 --- a/drivers/reset/reset-mpfs.c +++ b/drivers/reset/reset-mpfs.c @@ -121,7 +121,7 @@ static int mpfs_reset_mfd_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct mpfs_reset *rst; - rst = devm_kzalloc(dev, sizeof(*rst), GFP_KERNEL); + rst = devm_kzalloc_obj(dev, *rst); if (!rst) return -ENOMEM; @@ -157,7 +157,7 @@ static int mpfs_reset_adev_probe(struct auxiliary_device *adev, struct device *dev = &adev->dev; struct mpfs_reset *rst; - rst = devm_kzalloc(dev, sizeof(*rst), GFP_KERNEL); + rst = devm_kzalloc_obj(dev, *rst); if (!rst) return -ENOMEM; diff --git a/drivers/reset/reset-npcm.c b/drivers/reset/reset-npcm.c index a762d0215e76..d083e2619337 100644 --- a/drivers/reset/reset-npcm.c +++ b/drivers/reset/reset-npcm.c @@ -440,7 +440,7 @@ static int npcm_rc_probe(struct platform_device *pdev) struct npcm_rc_data *rc; int ret; - rc = devm_kzalloc(&pdev->dev, sizeof(*rc), GFP_KERNEL); + rc = devm_kzalloc_obj(&pdev->dev, *rc); if (!rc) return -ENOMEM; diff --git a/drivers/reset/reset-pistachio.c b/drivers/reset/reset-pistachio.c index 151ceeb42c30..d3a28ce7ab06 100644 --- a/drivers/reset/reset-pistachio.c +++ b/drivers/reset/reset-pistachio.c @@ -105,7 +105,7 @@ static int pistachio_reset_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *np = pdev->dev.of_node; - rd = devm_kzalloc(dev, sizeof(*rd), GFP_KERNEL); + rd = devm_kzalloc_obj(dev, *rd); if (!rd) return -ENOMEM; diff --git a/drivers/reset/reset-qcom-aoss.c b/drivers/reset/reset-qcom-aoss.c index 93c84d70ef64..5a6481239fa9 100644 --- a/drivers/reset/reset-qcom-aoss.c +++ b/drivers/reset/reset-qcom-aoss.c @@ -95,7 +95,7 @@ static int qcom_aoss_reset_probe(struct platform_device *pdev) if (!desc) return -EINVAL; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/reset/reset-qcom-pdc.c b/drivers/reset/reset-qcom-pdc.c index ae2b5aba7a59..70721fe8cd48 100644 --- a/drivers/reset/reset-qcom-pdc.c +++ b/drivers/reset/reset-qcom-pdc.c @@ -118,7 +118,7 @@ static int qcom_pdc_reset_probe(struct platform_device *pdev) if (!desc) return -EINVAL; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/reset/reset-raspberrypi.c b/drivers/reset/reset-raspberrypi.c index fa23db554bcf..90117ed1788a 100644 --- a/drivers/reset/reset-raspberrypi.c +++ b/drivers/reset/reset-raspberrypi.c @@ -87,7 +87,7 @@ static int rpi_reset_probe(struct platform_device *pdev) if (!fw) return -EPROBE_DEFER; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c index f003b360629c..ed0d14ed61ab 100644 --- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c +++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c @@ -194,7 +194,7 @@ static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev) struct regmap *regmap; int error; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-rzv2h-usb2phy.c b/drivers/reset/reset-rzv2h-usb2phy.c index d96042e28cd5..8fd989111ea4 100644 --- a/drivers/reset/reset-rzv2h-usb2phy.c +++ b/drivers/reset/reset-rzv2h-usb2phy.c @@ -136,7 +136,7 @@ static int rzv2h_usb2phy_reset_probe(struct platform_device *pdev) void __iomem *base; int error; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-scmi.c b/drivers/reset/reset-scmi.c index 4335811e0cfa..5cb925321c6c 100644 --- a/drivers/reset/reset-scmi.c +++ b/drivers/reset/reset-scmi.c @@ -101,7 +101,7 @@ static int scmi_reset_probe(struct scmi_device *sdev) if (IS_ERR(reset_ops)) return PTR_ERR(reset_ops); - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/reset/reset-simple.c b/drivers/reset/reset-simple.c index 79e94ecfe4f5..85e3ac55cccf 100644 --- a/drivers/reset/reset-simple.c +++ b/drivers/reset/reset-simple.c @@ -169,7 +169,7 @@ static int reset_simple_probe(struct platform_device *pdev) devdata = of_device_get_match_data(dev); - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/reset/reset-sky1-audss.c b/drivers/reset/reset-sky1-audss.c index d9735db681c7..fbdb818ab4c0 100644 --- a/drivers/reset/reset-sky1-audss.c +++ b/drivers/reset/reset-sky1-audss.c @@ -92,7 +92,7 @@ static int sky1_audss_reset_probe(struct auxiliary_device *adev, struct sky1_audss_reset *priv; struct device *dev = &adev->dev; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-sky1.c b/drivers/reset/reset-sky1.c index 78e80a533c39..18395f09bdf6 100644 --- a/drivers/reset/reset-sky1.c +++ b/drivers/reset/reset-sky1.c @@ -324,7 +324,7 @@ static int sky1_reset_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; const struct sky1_src_variant *variant; - sky1src = devm_kzalloc(dev, sizeof(*sky1src), GFP_KERNEL); + sky1src = devm_kzalloc_obj(dev, *sky1src); if (!sky1src) return -ENOMEM; diff --git a/drivers/reset/reset-sunplus.c b/drivers/reset/reset-sunplus.c index c136a1f0767a..c847a151d7e7 100644 --- a/drivers/reset/reset-sunplus.c +++ b/drivers/reset/reset-sunplus.c @@ -169,7 +169,7 @@ static int sp_reset_probe(struct platform_device *pdev) struct resource *res; int ret; - reset = devm_kzalloc(dev, sizeof(*reset), GFP_KERNEL); + reset = devm_kzalloc_obj(dev, *reset); if (!reset) return -ENOMEM; diff --git a/drivers/reset/reset-tenstorrent-atlantis.c b/drivers/reset/reset-tenstorrent-atlantis.c index ab8be52fdd5e..0b976c10ae21 100644 --- a/drivers/reset/reset-tenstorrent-atlantis.c +++ b/drivers/reset/reset-tenstorrent-atlantis.c @@ -145,7 +145,7 @@ static int atlantis_reset_probe(struct auxiliary_device *adev, if (!regmap) return -ENODEV; - controller = devm_kzalloc(dev, sizeof(*controller), GFP_KERNEL); + controller = devm_kzalloc_obj(dev, *controller); if (!controller) return -ENOMEM; controller->data = diff --git a/drivers/reset/reset-th1520.c b/drivers/reset/reset-th1520.c index fd32e991c4cb..c89f8a9c7d39 100644 --- a/drivers/reset/reset-th1520.c +++ b/drivers/reset/reset-th1520.c @@ -897,7 +897,7 @@ static int th1520_reset_probe(struct platform_device *pdev) data = device_get_match_data(dev); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-ti-sci.c b/drivers/reset/reset-ti-sci.c index 1dc5b766aac1..11b42f133ed7 100644 --- a/drivers/reset/reset-ti-sci.c +++ b/drivers/reset/reset-ti-sci.c @@ -190,7 +190,7 @@ static int ti_sci_reset_of_xlate(struct reset_controller_dev *rcdev, if (WARN_ON(reset_spec->args_count != rcdev->of_reset_n_cells)) return -EINVAL; - control = devm_kzalloc(data->dev, sizeof(*control), GFP_KERNEL); + control = devm_kzalloc_obj(data->dev, *control); if (!control) return -ENOMEM; @@ -214,7 +214,7 @@ static int ti_sci_reset_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/reset/reset-ti-syscon.c b/drivers/reset/reset-ti-syscon.c index 23f86ddb8668..6d10ea3a1921 100644 --- a/drivers/reset/reset-ti-syscon.c +++ b/drivers/reset/reset-ti-syscon.c @@ -166,7 +166,7 @@ static int ti_syscon_reset_probe(struct platform_device *pdev) struct ti_syscon_reset_control *controls; int size, nr_controls, i; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; @@ -181,8 +181,7 @@ static int ti_syscon_reset_probe(struct platform_device *pdev) } nr_controls = (size / sizeof(*list)) / 7; - controls = devm_kcalloc(dev, nr_controls, sizeof(*controls), - GFP_KERNEL); + controls = devm_kzalloc_objs(dev, *controls, nr_controls); if (!controls) return -ENOMEM; diff --git a/drivers/reset/reset-tn48m.c b/drivers/reset/reset-tn48m.c index 177ee5127a1e..81a89299f8c6 100644 --- a/drivers/reset/reset-tn48m.c +++ b/drivers/reset/reset-tn48m.c @@ -93,7 +93,7 @@ static int tn48m_reset_probe(struct platform_device *pdev) if (!regmap) return -ENODEV; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/reset/reset-tps380x.c b/drivers/reset/reset-tps380x.c index 09d511f069ba..f07fec0fc040 100644 --- a/drivers/reset/reset-tps380x.c +++ b/drivers/reset/reset-tps380x.c @@ -78,7 +78,7 @@ static int tps380x_reset_probe(struct platform_device *pdev) if (!devdata) return -EINVAL; - tps380x = devm_kzalloc(dev, sizeof(*tps380x), GFP_KERNEL); + tps380x = devm_kzalloc_obj(dev, *tps380x); if (!tps380x) return -ENOMEM; diff --git a/drivers/reset/reset-uniphier-glue.c b/drivers/reset/reset-uniphier-glue.c index a2a262bf6bfc..9575e02a0094 100644 --- a/drivers/reset/reset-uniphier-glue.c +++ b/drivers/reset/reset-uniphier-glue.c @@ -42,7 +42,7 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) struct resource *res; int i, ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-uniphier.c b/drivers/reset/reset-uniphier.c index 79c43c204d46..aef8ccebf75a 100644 --- a/drivers/reset/reset-uniphier.c +++ b/drivers/reset/reset-uniphier.c @@ -362,7 +362,7 @@ static int uniphier_reset_probe(struct platform_device *pdev) return PTR_ERR(regmap); } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-zynq.c b/drivers/reset/reset-zynq.c index 688b512882ec..fd4a90aa5b7c 100644 --- a/drivers/reset/reset-zynq.c +++ b/drivers/reset/reset-zynq.c @@ -91,7 +91,7 @@ static int zynq_reset_probe(struct platform_device *pdev) struct resource *res; struct zynq_reset_data *priv; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/reset-zynqmp.c b/drivers/reset/reset-zynqmp.c index c770ea3a1894..58865161c931 100644 --- a/drivers/reset/reset-zynqmp.c +++ b/drivers/reset/reset-zynqmp.c @@ -104,7 +104,7 @@ static int zynqmp_reset_probe(struct platform_device *pdev) { struct zynqmp_reset_data *priv; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/reset/spacemit/reset-spacemit-common.c b/drivers/reset/spacemit/reset-spacemit-common.c index 0626633a5e7d..2d96f9f769e0 100644 --- a/drivers/reset/spacemit/reset-spacemit-common.c +++ b/drivers/reset/spacemit/reset-spacemit-common.c @@ -63,7 +63,7 @@ int spacemit_reset_probe(struct auxiliary_device *adev, struct ccu_reset_controller *controller; struct device *dev = &adev->dev; - controller = devm_kzalloc(dev, sizeof(*controller), GFP_KERNEL); + controller = devm_kzalloc_obj(dev, *controller); if (!controller) return -ENOMEM; controller->data = (const struct ccu_reset_controller_data *)id->driver_data; diff --git a/drivers/reset/starfive/reset-starfive-jh71x0.c b/drivers/reset/starfive/reset-starfive-jh71x0.c index 29ce3486752f..d410a5a0ded4 100644 --- a/drivers/reset/starfive/reset-starfive-jh71x0.c +++ b/drivers/reset/starfive/reset-starfive-jh71x0.c @@ -114,7 +114,7 @@ int reset_starfive_jh71x0_register(struct device *dev, struct device_node *of_no { struct jh71x0_reset *data; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/reset/sti/reset-syscfg.c b/drivers/reset/sti/reset-syscfg.c index 38f78d78fa4f..ed50ff564977 100644 --- a/drivers/reset/sti/reset-syscfg.c +++ b/drivers/reset/sti/reset-syscfg.c @@ -135,7 +135,7 @@ static int syscfg_reset_controller_register(struct device *dev, struct syscfg_reset_controller *rc; int i, err; - rc = devm_kzalloc(dev, struct_size(rc, channels, data->nr_channels), GFP_KERNEL); + rc = devm_kzalloc_flex(dev, *rc, channels, data->nr_channels); if (!rc) return -ENOMEM; diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 55793fc18293..f848ab46161d 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1894,7 +1894,7 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev, int ret; struct qcom_glink *glink; - glink = devm_kzalloc(dev, sizeof(*glink), GFP_KERNEL); + glink = devm_kzalloc_obj(dev, *glink); if (!glink) return ERR_PTR(-ENOMEM); diff --git a/drivers/rpmsg/qcom_glink_rpm.c b/drivers/rpmsg/qcom_glink_rpm.c index e3ba2c63a5fc..0d4465d4f598 100644 --- a/drivers/rpmsg/qcom_glink_rpm.c +++ b/drivers/rpmsg/qcom_glink_rpm.c @@ -296,7 +296,7 @@ static int glink_rpm_probe(struct platform_device *pdev) struct resource r; int ret; - rpm = devm_kzalloc(&pdev->dev, sizeof(*rpm), GFP_KERNEL); + rpm = devm_kzalloc_obj(&pdev->dev, *rpm); if (!rpm) return -ENOMEM; diff --git a/drivers/rpmsg/qcom_glink_smem.c b/drivers/rpmsg/qcom_glink_smem.c index 35bb03e67ae8..a35f41cb2e01 100644 --- a/drivers/rpmsg/qcom_glink_smem.c +++ b/drivers/rpmsg/qcom_glink_smem.c @@ -263,8 +263,8 @@ struct qcom_glink_smem *qcom_glink_smem_register(struct device *parent, smem->remote_pid = remote_pid; - rx_pipe = devm_kzalloc(dev, sizeof(*rx_pipe), GFP_KERNEL); - tx_pipe = devm_kzalloc(dev, sizeof(*tx_pipe), GFP_KERNEL); + rx_pipe = devm_kzalloc_obj(dev, *rx_pipe); + tx_pipe = devm_kzalloc_obj(dev, *tx_pipe); if (!rx_pipe || !tx_pipe) { ret = -ENOMEM; goto err_put_dev; diff --git a/drivers/rpmsg/qcom_glink_ssr.c b/drivers/rpmsg/qcom_glink_ssr.c index e71d3716c55c..950f711a47ed 100644 --- a/drivers/rpmsg/qcom_glink_ssr.c +++ b/drivers/rpmsg/qcom_glink_ssr.c @@ -128,7 +128,7 @@ static int qcom_glink_ssr_probe(struct rpmsg_device *rpdev) { struct glink_ssr *ssr; - ssr = devm_kzalloc(&rpdev->dev, sizeof(*ssr), GFP_KERNEL); + ssr = devm_kzalloc_obj(&rpdev->dev, *ssr); if (!ssr) return -ENOMEM; diff --git a/drivers/rtc/rtc-88pm80x.c b/drivers/rtc/rtc-88pm80x.c index a3e52a5a708f..0f2b37eb0d69 100644 --- a/drivers/rtc/rtc-88pm80x.c +++ b/drivers/rtc/rtc-88pm80x.c @@ -251,7 +251,7 @@ static int pm80x_rtc_probe(struct platform_device *pdev) } if (!pdata) { - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) { dev_err(&pdev->dev, "failed to allocate memory\n"); return -ENOMEM; @@ -259,7 +259,7 @@ static int pm80x_rtc_probe(struct platform_device *pdev) } info = - devm_kzalloc(&pdev->dev, sizeof(struct pm80x_rtc_info), GFP_KERNEL); + devm_kzalloc_obj(&pdev->dev, struct pm80x_rtc_info); if (!info) return -ENOMEM; info->irq = platform_get_irq(pdev, 0); diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c index 964cd048fcdb..5d23d2cc231d 100644 --- a/drivers/rtc/rtc-88pm860x.c +++ b/drivers/rtc/rtc-88pm860x.c @@ -270,8 +270,7 @@ static int pm860x_rtc_probe(struct platform_device *pdev) struct pm860x_rtc_info *info; int ret; - info = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_rtc_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct pm860x_rtc_info); if (!info) return -ENOMEM; info->irq = platform_get_irq(pdev, 0); diff --git a/drivers/rtc/rtc-ab-b5ze-s3.c b/drivers/rtc/rtc-ab-b5ze-s3.c index 6439ca427c32..81d75ab401ec 100644 --- a/drivers/rtc/rtc-ab-b5ze-s3.c +++ b/drivers/rtc/rtc-ab-b5ze-s3.c @@ -841,7 +841,7 @@ static int abb5zes3_probe(struct i2c_client *client) if (ret) return ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/rtc/rtc-ab-eoz9.c b/drivers/rtc/rtc-ab-eoz9.c index eb6d267c2ec3..f339d0396481 100644 --- a/drivers/rtc/rtc-ab-eoz9.c +++ b/drivers/rtc/rtc-ab-eoz9.c @@ -485,7 +485,7 @@ static int abeoz9_probe(struct i2c_client *client) return ret; } - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c index 1c69d0e2f940..02eaaf58dabd 100644 --- a/drivers/rtc/rtc-abx80x.c +++ b/drivers/rtc/rtc-abx80x.c @@ -785,7 +785,7 @@ static int abx80x_probe(struct device *dev, struct regmap *regmap, int irq, unsigned int wafer; unsigned int uid; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (priv == NULL) return -ENOMEM; diff --git a/drivers/rtc/rtc-ac100.c b/drivers/rtc/rtc-ac100.c index c6fca15af241..be57a33ecf53 100644 --- a/drivers/rtc/rtc-ac100.c +++ b/drivers/rtc/rtc-ac100.c @@ -310,10 +310,8 @@ static int ac100_rtc_register_clks(struct ac100_rtc_dev *chip) const char *parents[2] = {AC100_RTC_32K_NAME}; int i, ret; - chip->clk_data = devm_kzalloc(chip->dev, - struct_size(chip->clk_data, hws, - AC100_CLKOUT_NUM), - GFP_KERNEL); + chip->clk_data = devm_kzalloc_flex(chip->dev, *chip->clk_data, hws, + AC100_CLKOUT_NUM); if (!chip->clk_data) return -ENOMEM; @@ -555,7 +553,7 @@ static int ac100_rtc_probe(struct platform_device *pdev) struct ac100_rtc_dev *chip; int ret; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/rtc/rtc-amlogic-a4.c b/drivers/rtc/rtc-amlogic-a4.c index 50938c35af36..1e42d981485d 100644 --- a/drivers/rtc/rtc-amlogic-a4.c +++ b/drivers/rtc/rtc-amlogic-a4.c @@ -328,7 +328,7 @@ static int aml_rtc_probe(struct platform_device *pdev) .max_register = RTC_REAL_TIME, }; - rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c index 245290ae1a8d..30eb103595f1 100644 --- a/drivers/rtc/rtc-armada38x.c +++ b/drivers/rtc/rtc-armada38x.c @@ -490,8 +490,7 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev) { struct armada38x_rtc *rtc; - rtc = devm_kzalloc(&pdev->dev, struct_size(rtc, val_to_freq, SAMPLE_NR), - GFP_KERNEL); + rtc = devm_kzalloc_flex(&pdev->dev, *rtc, val_to_freq, SAMPLE_NR); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-as3722.c b/drivers/rtc/rtc-as3722.c index 9682d6457b7f..b9199d31cd84 100644 --- a/drivers/rtc/rtc-as3722.c +++ b/drivers/rtc/rtc-as3722.c @@ -170,7 +170,7 @@ static int as3722_rtc_probe(struct platform_device *pdev) struct as3722_rtc *as3722_rtc; int ret; - as3722_rtc = devm_kzalloc(&pdev->dev, sizeof(*as3722_rtc), GFP_KERNEL); + as3722_rtc = devm_kzalloc_obj(&pdev->dev, *as3722_rtc); if (!as3722_rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-asm9260.c b/drivers/rtc/rtc-asm9260.c index 422c2e5d83aa..95d7b894acd5 100644 --- a/drivers/rtc/rtc-asm9260.c +++ b/drivers/rtc/rtc-asm9260.c @@ -246,7 +246,7 @@ static int asm9260_rtc_probe(struct platform_device *pdev) int irq_alarm, ret; u32 ccr; - priv = devm_kzalloc(dev, sizeof(struct asm9260_rtc_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct asm9260_rtc_priv); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-aspeed.c b/drivers/rtc/rtc-aspeed.c index 8f5b440f8c0a..25192ebdad19 100644 --- a/drivers/rtc/rtc-aspeed.c +++ b/drivers/rtc/rtc-aspeed.c @@ -86,7 +86,7 @@ static int aspeed_rtc_probe(struct platform_device *pdev) struct aspeed_rtc *rtc; struct rtc_device *rtc_dev; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 38991cca5930..cbd2f1a6c54a 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c @@ -344,7 +344,7 @@ static int at91_rtc_probe(struct platform_device *pdev) if (irq < 0) return irq; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-atcrtc100.c b/drivers/rtc/rtc-atcrtc100.c index 2433df386c40..25183331a158 100644 --- a/drivers/rtc/rtc-atcrtc100.c +++ b/drivers/rtc/rtc-atcrtc100.c @@ -272,7 +272,7 @@ static int atcrtc_probe(struct platform_device *pdev) unsigned int rtc_id; int ret; - atcrtc_dev = devm_kzalloc(&pdev->dev, sizeof(*atcrtc_dev), GFP_KERNEL); + atcrtc_dev = devm_kzalloc_obj(&pdev->dev, *atcrtc_dev); if (!atcrtc_dev) return -ENOMEM; platform_set_drvdata(pdev, atcrtc_dev); diff --git a/drivers/rtc/rtc-bd70528.c b/drivers/rtc/rtc-bd70528.c index dd5569d17567..b9d27e169b88 100644 --- a/drivers/rtc/rtc-bd70528.c +++ b/drivers/rtc/rtc-bd70528.c @@ -246,7 +246,7 @@ static int bd70528_probe(struct platform_device *pdev) u8 hour_reg; enum rohm_chip_type chip = platform_get_device_id(pdev)->driver_data; - bd_rtc = devm_kzalloc(&pdev->dev, sizeof(*bd_rtc), GFP_KERNEL); + bd_rtc = devm_kzalloc_obj(&pdev->dev, *bd_rtc); if (!bd_rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-bq4802.c b/drivers/rtc/rtc-bq4802.c index 472e75668917..4a9903f996d6 100644 --- a/drivers/rtc/rtc-bq4802.c +++ b/drivers/rtc/rtc-bq4802.c @@ -141,7 +141,7 @@ static const struct rtc_class_ops bq4802_ops = { static int bq4802_probe(struct platform_device *pdev) { - struct bq4802 *p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); + struct bq4802 *p = devm_kzalloc_obj(&pdev->dev, *p); int err = -ENOMEM; if (!p) diff --git a/drivers/rtc/rtc-brcmstb-waketimer.c b/drivers/rtc/rtc-brcmstb-waketimer.c index 55c15aad42cf..6f73def04ad9 100644 --- a/drivers/rtc/rtc-brcmstb-waketimer.c +++ b/drivers/rtc/rtc-brcmstb-waketimer.c @@ -276,7 +276,7 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev) struct brcmstb_waketmr *timer; int ret; - timer = devm_kzalloc(dev, sizeof(*timer), GFP_KERNEL); + timer = devm_kzalloc_obj(dev, *timer); if (!timer) return -ENOMEM; diff --git a/drivers/rtc/rtc-cadence.c b/drivers/rtc/rtc-cadence.c index 8634eea799ab..711ba97d4cfb 100644 --- a/drivers/rtc/rtc-cadence.c +++ b/drivers/rtc/rtc-cadence.c @@ -258,7 +258,7 @@ static int cdns_rtc_probe(struct platform_device *pdev) int ret; unsigned long ref_clk_freq; - crtc = devm_kzalloc(&pdev->dev, sizeof(*crtc), GFP_KERNEL); + crtc = devm_kzalloc_obj(&pdev->dev, *crtc); if (!crtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-cpcap.c b/drivers/rtc/rtc-cpcap.c index a7db3173d24c..d6c4b2730994 100644 --- a/drivers/rtc/rtc-cpcap.c +++ b/drivers/rtc/rtc-cpcap.c @@ -246,7 +246,7 @@ static int cpcap_rtc_probe(struct platform_device *pdev) struct cpcap_rtc *rtc; int err; - rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-cros-ec.c b/drivers/rtc/rtc-cros-ec.c index f56650899b37..293dd1dad6d1 100644 --- a/drivers/rtc/rtc-cros-ec.c +++ b/drivers/rtc/rtc-cros-ec.c @@ -315,8 +315,7 @@ static int cros_ec_rtc_probe(struct platform_device *pdev) struct rtc_time tm; int ret; - cros_ec_rtc = devm_kzalloc(&pdev->dev, sizeof(*cros_ec_rtc), - GFP_KERNEL); + cros_ec_rtc = devm_kzalloc_obj(&pdev->dev, *cros_ec_rtc); if (!cros_ec_rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-cv1800.c b/drivers/rtc/rtc-cv1800.c index 678c2c10bf58..b9f35a0dd177 100644 --- a/drivers/rtc/rtc-cv1800.c +++ b/drivers/rtc/rtc-cv1800.c @@ -160,7 +160,7 @@ static int cv1800_rtc_probe(struct platform_device *pdev) struct cv1800_rtc_priv *rtc; int ret; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c index 9ca99bd35702..a0b0e224c6ae 100644 --- a/drivers/rtc/rtc-da9052.c +++ b/drivers/rtc/rtc-da9052.c @@ -276,7 +276,7 @@ static int da9052_rtc_probe(struct platform_device *pdev) struct da9052_rtc *rtc; int ret; - rtc = devm_kzalloc(&pdev->dev, sizeof(struct da9052_rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, struct da9052_rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-da9055.c b/drivers/rtc/rtc-da9055.c index 05adec6b77bf..8c1cee091282 100644 --- a/drivers/rtc/rtc-da9055.c +++ b/drivers/rtc/rtc-da9055.c @@ -269,7 +269,7 @@ static int da9055_rtc_probe(struct platform_device *pdev) struct da9055_pdata *pdata = NULL; int ret, alm_irq; - rtc = devm_kzalloc(&pdev->dev, sizeof(struct da9055_rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, struct da9055_rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-da9063.c b/drivers/rtc/rtc-da9063.c index 557c9b29dcc1..b56b9d9cb4e5 100644 --- a/drivers/rtc/rtc-da9063.c +++ b/drivers/rtc/rtc-da9063.c @@ -366,7 +366,7 @@ static int da9063_rtc_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENXIO; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-digicolor.c b/drivers/rtc/rtc-digicolor.c index 218a6de19247..4f04bc60fbd2 100644 --- a/drivers/rtc/rtc-digicolor.c +++ b/drivers/rtc/rtc-digicolor.c @@ -178,7 +178,7 @@ static int __init dc_rtc_probe(struct platform_device *pdev) struct dc_rtc *rtc; int irq, ret; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-ds1216.c b/drivers/rtc/rtc-ds1216.c index 7eeb3f359de8..2b450edb6548 100644 --- a/drivers/rtc/rtc-ds1216.c +++ b/drivers/rtc/rtc-ds1216.c @@ -140,7 +140,7 @@ static int __init ds1216_rtc_probe(struct platform_device *pdev) struct ds1216_priv *priv; u8 dummy[8]; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c index 7acf849d4902..648a705c55e9 100644 --- a/drivers/rtc/rtc-ds1286.c +++ b/drivers/rtc/rtc-ds1286.c @@ -325,7 +325,7 @@ static int ds1286_probe(struct platform_device *pdev) struct rtc_device *rtc; struct ds1286_priv *priv; - priv = devm_kzalloc(&pdev->dev, sizeof(struct ds1286_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct ds1286_priv); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c index 19a32d3476b5..20c6e4cfd1df 100644 --- a/drivers/rtc/rtc-ds1305.c +++ b/drivers/rtc/rtc-ds1305.c @@ -564,7 +564,7 @@ static int ds1305_probe(struct spi_device *spi) return -EINVAL; /* set up driver data */ - ds1305 = devm_kzalloc(&spi->dev, sizeof(*ds1305), GFP_KERNEL); + ds1305 = devm_kzalloc_obj(&spi->dev, *ds1305); if (!ds1305) return -ENOMEM; ds1305->spi = spi; diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index 206a79d28568..8ab28cc2f181 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c @@ -1622,13 +1622,13 @@ static int ds3231_clks_register(struct ds1307 *ds1307) struct clk_onecell_data *onecell; int i; - onecell = devm_kzalloc(ds1307->dev, sizeof(*onecell), GFP_KERNEL); + onecell = devm_kzalloc_obj(ds1307->dev, *onecell); if (!onecell) return -ENOMEM; onecell->clk_num = ARRAY_SIZE(ds3231_clks_init); - onecell->clks = devm_kcalloc(ds1307->dev, onecell->clk_num, - sizeof(onecell->clks[0]), GFP_KERNEL); + onecell->clks = devm_kzalloc_objs(ds1307->dev, onecell->clks[0], + onecell->clk_num); if (!onecell->clks) return -ENOMEM; @@ -1843,7 +1843,7 @@ static void ds1307_wdt_register(struct ds1307 *ds1307) if (ds1307->type != ds_1388) return; - wdt = devm_kzalloc(ds1307->dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(ds1307->dev, *wdt); if (!wdt) return; @@ -1886,7 +1886,7 @@ static int ds1307_probe(struct i2c_client *client) struct ds1307_platform_data *pdata = dev_get_platdata(&client->dev); u8 trickle_charger_setup = 0; - ds1307 = devm_kzalloc(&client->dev, sizeof(struct ds1307), GFP_KERNEL); + ds1307 = devm_kzalloc_obj(&client->dev, struct ds1307); if (!ds1307) return -ENOMEM; diff --git a/drivers/rtc/rtc-ds1343.c b/drivers/rtc/rtc-ds1343.c index 0ec5eaba6bd4..455ed8582e8d 100644 --- a/drivers/rtc/rtc-ds1343.c +++ b/drivers/rtc/rtc-ds1343.c @@ -355,7 +355,7 @@ static int ds1343_probe(struct spi_device *spi) .reg_write = ds1343_nvram_write, }; - priv = devm_kzalloc(&spi->dev, sizeof(struct ds1343_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&spi->dev, struct ds1343_priv); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index 2ed6777e7035..6ee2b31ca120 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c @@ -473,7 +473,7 @@ static int ds1374_probe(struct i2c_client *client) struct ds1374 *ds1374; int ret; - ds1374 = devm_kzalloc(&client->dev, sizeof(struct ds1374), GFP_KERNEL); + ds1374 = devm_kzalloc_obj(&client->dev, struct ds1374); if (!ds1374) return -ENOMEM; diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c index f7afd6bdeb4a..0c51ee4d097d 100644 --- a/drivers/rtc/rtc-ds1390.c +++ b/drivers/rtc/rtc-ds1390.c @@ -188,7 +188,7 @@ static int ds1390_probe(struct spi_device *spi) spi->bits_per_word = 8; spi_setup(spi); - chip = devm_kzalloc(&spi->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&spi->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c index 8b087d9556be..1afc0df49670 100644 --- a/drivers/rtc/rtc-ds1511.c +++ b/drivers/rtc/rtc-ds1511.c @@ -283,7 +283,7 @@ static int ds1511_rtc_probe(struct platform_device *pdev) .priv = &pdev->dev, }; - ds1511 = devm_kzalloc(&pdev->dev, sizeof(*ds1511), GFP_KERNEL); + ds1511 = devm_kzalloc_obj(&pdev->dev, *ds1511); if (!ds1511) return -ENOMEM; diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index dbff5b621ef5..3e65b2a4eadb 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c @@ -263,7 +263,7 @@ static int ds1553_rtc_probe(struct platform_device *pdev) .priv = pdev, }; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c index 3d0f491d0e88..f27d6ae4f783 100644 --- a/drivers/rtc/rtc-ds1685.c +++ b/drivers/rtc/rtc-ds1685.c @@ -1085,7 +1085,7 @@ ds1685_rtc_probe(struct platform_device *pdev) return -ENODEV; /* Allocate memory for the rtc device. */ - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index 6ae8b9a294fe..c8593626c622 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c @@ -153,7 +153,7 @@ static int ds1742_rtc_probe(struct platform_device *pdev) }; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/rtc/rtc-ds2404.c b/drivers/rtc/rtc-ds2404.c index 217694eca36c..07fe7637676c 100644 --- a/drivers/rtc/rtc-ds2404.c +++ b/drivers/rtc/rtc-ds2404.c @@ -184,7 +184,7 @@ static int rtc_probe(struct platform_device *pdev) struct rtc_device *rtc; int retval = -EBUSY; - chip = devm_kzalloc(&pdev->dev, sizeof(struct ds2404), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, struct ds2404); if (!chip) return -ENOMEM; diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c index f6407c631d6d..75ac99b192fb 100644 --- a/drivers/rtc/rtc-ds3232.c +++ b/drivers/rtc/rtc-ds3232.c @@ -468,7 +468,7 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq, .type = NVMEM_TYPE_BATTERY_BACKED }; - ds3232 = devm_kzalloc(dev, sizeof(*ds3232), GFP_KERNEL); + ds3232 = devm_kzalloc_obj(dev, *ds3232); if (!ds3232) return -ENOMEM; diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c index f105aba28459..6eab05fb8d42 100644 --- a/drivers/rtc/rtc-ep93xx.c +++ b/drivers/rtc/rtc-ep93xx.c @@ -124,7 +124,7 @@ static int ep93xx_rtc_probe(struct platform_device *pdev) struct rtc_device *rtc; int err; - ep93xx_rtc = devm_kzalloc(&pdev->dev, sizeof(*ep93xx_rtc), GFP_KERNEL); + ep93xx_rtc = devm_kzalloc_obj(&pdev->dev, *ep93xx_rtc); if (!ep93xx_rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-fm3130.c b/drivers/rtc/rtc-fm3130.c index 28bb6d3f644e..7e43a51c62ea 100644 --- a/drivers/rtc/rtc-fm3130.c +++ b/drivers/rtc/rtc-fm3130.c @@ -351,7 +351,7 @@ static int fm3130_probe(struct i2c_client *client) I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) return -EIO; - fm3130 = devm_kzalloc(&client->dev, sizeof(struct fm3130), GFP_KERNEL); + fm3130 = devm_kzalloc_obj(&client->dev, struct fm3130); if (!fm3130) return -ENOMEM; diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c index dcb7ef663a78..5473f697d4ea 100644 --- a/drivers/rtc/rtc-fsl-ftm-alarm.c +++ b/drivers/rtc/rtc-fsl-ftm-alarm.c @@ -246,7 +246,7 @@ static int ftm_rtc_probe(struct platform_device *pdev) int ret; struct ftm_rtc *rtc; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (unlikely(!rtc)) { dev_err(&pdev->dev, "cannot alloc memory for rtc\n"); return -ENOMEM; diff --git a/drivers/rtc/rtc-ftrtc010.c b/drivers/rtc/rtc-ftrtc010.c index c66d4a85f23c..d3331a70f4c7 100644 --- a/drivers/rtc/rtc-ftrtc010.c +++ b/drivers/rtc/rtc-ftrtc010.c @@ -114,7 +114,7 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev) struct rtc_device *rtc_dev; int ret; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (unlikely(!rtc)) return -ENOMEM; platform_set_drvdata(pdev, rtc); diff --git a/drivers/rtc/rtc-gamecube.c b/drivers/rtc/rtc-gamecube.c index 889028cecf4a..3fd562d3526a 100644 --- a/drivers/rtc/rtc-gamecube.c +++ b/drivers/rtc/rtc-gamecube.c @@ -323,7 +323,7 @@ static int gamecube_rtc_probe(struct platform_device *pdev) struct priv *d; int ret; - d = devm_kzalloc(dev, sizeof(struct priv), GFP_KERNEL); + d = devm_kzalloc_obj(dev, struct priv); if (!d) return -ENOMEM; diff --git a/drivers/rtc/rtc-goldfish.c b/drivers/rtc/rtc-goldfish.c index 53ec7173c28e..c77d966e49e9 100644 --- a/drivers/rtc/rtc-goldfish.c +++ b/drivers/rtc/rtc-goldfish.c @@ -158,7 +158,7 @@ static int goldfish_rtc_probe(struct platform_device *pdev) struct goldfish_rtc *rtcdrv; int err; - rtcdrv = devm_kzalloc(&pdev->dev, sizeof(*rtcdrv), GFP_KERNEL); + rtcdrv = devm_kzalloc_obj(&pdev->dev, *rtcdrv); if (!rtcdrv) return -ENOMEM; diff --git a/drivers/rtc/rtc-hid-sensor-time.c b/drivers/rtc/rtc-hid-sensor-time.c index 6228d0b2486e..911711c45f14 100644 --- a/drivers/rtc/rtc-hid-sensor-time.c +++ b/drivers/rtc/rtc-hid-sensor-time.c @@ -223,8 +223,8 @@ static int hid_time_probe(struct platform_device *pdev) { int ret = 0; struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev); - struct hid_time_state *time_state = devm_kzalloc(&pdev->dev, - sizeof(struct hid_time_state), GFP_KERNEL); + struct hid_time_state *time_state = devm_kzalloc_obj(&pdev->dev, + struct hid_time_state); if (time_state == NULL) return -ENOMEM; diff --git a/drivers/rtc/rtc-hym8563.c b/drivers/rtc/rtc-hym8563.c index e3d7ca477e75..62726eaf57c1 100644 --- a/drivers/rtc/rtc-hym8563.c +++ b/drivers/rtc/rtc-hym8563.c @@ -503,7 +503,7 @@ static int hym8563_probe(struct i2c_client *client) struct hym8563 *hym8563; int ret; - hym8563 = devm_kzalloc(&client->dev, sizeof(*hym8563), GFP_KERNEL); + hym8563 = devm_kzalloc_obj(&client->dev, *hym8563); if (!hym8563) return -ENOMEM; diff --git a/drivers/rtc/rtc-imx-sm-bbm.c b/drivers/rtc/rtc-imx-sm-bbm.c index daa472be7c80..c260c7436a35 100644 --- a/drivers/rtc/rtc-imx-sm-bbm.c +++ b/drivers/rtc/rtc-imx-sm-bbm.c @@ -123,7 +123,7 @@ static int scmi_imx_bbm_rtc_probe(struct scmi_device *sdev) if (!handle) return -ENODEV; - bbnsm = devm_kzalloc(dev, sizeof(*bbnsm), GFP_KERNEL); + bbnsm = devm_kzalloc_obj(dev, *bbnsm); if (!bbnsm) return -ENOMEM; diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c index ca4a0af95e8c..4066e32b58f2 100644 --- a/drivers/rtc/rtc-imxdi.c +++ b/drivers/rtc/rtc-imxdi.c @@ -745,7 +745,7 @@ static int __init dryice_rtc_probe(struct platform_device *pdev) int norm_irq, sec_irq; int rc; - imxdi = devm_kzalloc(&pdev->dev, sizeof(*imxdi), GFP_KERNEL); + imxdi = devm_kzalloc_obj(&pdev->dev, *imxdi); if (!imxdi) return -ENOMEM; diff --git a/drivers/rtc/rtc-isl12022.c b/drivers/rtc/rtc-isl12022.c index bc36288854ee..ebd69b4693dc 100644 --- a/drivers/rtc/rtc-isl12022.c +++ b/drivers/rtc/rtc-isl12022.c @@ -558,7 +558,7 @@ static int isl12022_probe(struct i2c_client *client) return -ENODEV; /* Allocate driver state */ - isl12022 = devm_kzalloc(&client->dev, sizeof(*isl12022), GFP_KERNEL); + isl12022 = devm_kzalloc_obj(&client->dev, *isl12022); if (!isl12022) return -ENOMEM; diff --git a/drivers/rtc/rtc-isl12026.c b/drivers/rtc/rtc-isl12026.c index b86a325d8a23..2aa3694c4de7 100644 --- a/drivers/rtc/rtc-isl12026.c +++ b/drivers/rtc/rtc-isl12026.c @@ -445,7 +445,7 @@ static int isl12026_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -ENODEV; - priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&client->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index ee2eb8c475ea..5150a1051e01 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c @@ -881,7 +881,7 @@ isl1208_probe(struct i2c_client *client) return -ENODEV; /* Allocate driver state, point i2c client data to it */ - isl1208 = devm_kzalloc(&client->dev, sizeof(*isl1208), GFP_KERNEL); + isl1208 = devm_kzalloc_obj(&client->dev, *isl1208); if (!isl1208) return -ENOMEM; i2c_set_clientdata(client, isl1208); diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c index 11fce47be780..32c331f3feb3 100644 --- a/drivers/rtc/rtc-jz4740.c +++ b/drivers/rtc/rtc-jz4740.c @@ -345,7 +345,7 @@ static int jz4740_rtc_probe(struct platform_device *pdev) struct clk *clk; int ret, irq; - rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-loongson.c b/drivers/rtc/rtc-loongson.c index 066f0644d1c3..d337241b6f12 100644 --- a/drivers/rtc/rtc-loongson.c +++ b/drivers/rtc/rtc-loongson.c @@ -344,7 +344,7 @@ static int loongson_rtc_probe(struct platform_device *pdev) struct loongson_rtc_priv *priv; struct device *dev = &pdev->dev; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-lp8788.c b/drivers/rtc/rtc-lp8788.c index 0793d70507f7..1deda55cf2f8 100644 --- a/drivers/rtc/rtc-lp8788.c +++ b/drivers/rtc/rtc-lp8788.c @@ -285,7 +285,7 @@ static int lp8788_rtc_probe(struct platform_device *pdev) struct lp8788_rtc *rtc; struct device *dev = &pdev->dev; - rtc = devm_kzalloc(dev, sizeof(struct lp8788_rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(dev, struct lp8788_rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-lpc24xx.c b/drivers/rtc/rtc-lpc24xx.c index a1266986dead..04a09bdf807d 100644 --- a/drivers/rtc/rtc-lpc24xx.c +++ b/drivers/rtc/rtc-lpc24xx.c @@ -194,7 +194,7 @@ static int lpc24xx_rtc_probe(struct platform_device *pdev) struct lpc24xx_rtc *rtc; int irq, ret; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-lpc32xx.c b/drivers/rtc/rtc-lpc32xx.c index 74280bffe1b0..a78030f2d964 100644 --- a/drivers/rtc/rtc-lpc32xx.c +++ b/drivers/rtc/rtc-lpc32xx.c @@ -189,7 +189,7 @@ static int lpc32xx_rtc_probe(struct platform_device *pdev) int err; u32 tmp; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (unlikely(!rtc)) return -ENOMEM; diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index 1385cb43864b..cfab27aaa518 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c @@ -912,8 +912,7 @@ static int m41t80_probe(struct i2c_client *client) return -ENODEV; } - m41t80_data = devm_kzalloc(&client->dev, sizeof(*m41t80_data), - GFP_KERNEL); + m41t80_data = devm_kzalloc_obj(&client->dev, *m41t80_data); if (!m41t80_data) return -ENOMEM; diff --git a/drivers/rtc/rtc-m41t93.c b/drivers/rtc/rtc-m41t93.c index fa7a4b5f848d..fa97251f2482 100644 --- a/drivers/rtc/rtc-m41t93.c +++ b/drivers/rtc/rtc-m41t93.c @@ -524,7 +524,7 @@ static int m41t93_probe(struct spi_device *spi) spi->bits_per_word = 8; spi_setup(spi); - m41t93 = devm_kzalloc(&spi->dev, sizeof(struct m41t93_data), GFP_KERNEL); + m41t93 = devm_kzalloc_obj(&spi->dev, struct m41t93_data); if (!m41t93) return -ENOMEM; diff --git a/drivers/rtc/rtc-m48t35.c b/drivers/rtc/rtc-m48t35.c index 92f19bf997b2..ddcd1a17c281 100644 --- a/drivers/rtc/rtc-m48t35.c +++ b/drivers/rtc/rtc-m48t35.c @@ -155,7 +155,7 @@ static int m48t35_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) return -ENODEV; - priv = devm_kzalloc(&pdev->dev, sizeof(struct m48t35_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct m48t35_priv); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c index 4e608bc8bbd3..1208ebfc7a7f 100644 --- a/drivers/rtc/rtc-m48t59.c +++ b/drivers/rtc/rtc-m48t59.c @@ -369,8 +369,7 @@ static int m48t59_rtc_probe(struct platform_device *pdev) } else if (res->flags & IORESOURCE_MEM) { /* we are memory-mapped */ if (!pdata) { - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), - GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; /* Ensure we only kmalloc platform data once */ @@ -386,7 +385,7 @@ static int m48t59_rtc_probe(struct platform_device *pdev) pdata->read_byte = m48t59_mem_readb; } - m48t59 = devm_kzalloc(&pdev->dev, sizeof(*m48t59), GFP_KERNEL); + m48t59 = devm_kzalloc_obj(&pdev->dev, *m48t59); if (!m48t59) return -ENOMEM; diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c index db3bdb171ff0..d0f7f146bd65 100644 --- a/drivers/rtc/rtc-m48t86.c +++ b/drivers/rtc/rtc-m48t86.c @@ -230,7 +230,7 @@ static int m48t86_rtc_probe(struct platform_device *pdev) .priv = &pdev->dev, }; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/rtc/rtc-ma35d1.c b/drivers/rtc/rtc-ma35d1.c index cfcfc28060f6..eb0da8b091dc 100644 --- a/drivers/rtc/rtc-ma35d1.c +++ b/drivers/rtc/rtc-ma35d1.c @@ -213,7 +213,7 @@ static int ma35d1_rtc_probe(struct platform_device *pdev) struct clk *clk; int ret; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-macsmc.c b/drivers/rtc/rtc-macsmc.c index 8fe883066956..f01b3dab34ee 100644 --- a/drivers/rtc/rtc-macsmc.c +++ b/drivers/rtc/rtc-macsmc.c @@ -95,7 +95,7 @@ static int macsmc_rtc_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-max31335.c b/drivers/rtc/rtc-max31335.c index 595816973851..1953921f8335 100644 --- a/drivers/rtc/rtc-max31335.c +++ b/drivers/rtc/rtc-max31335.c @@ -678,7 +678,7 @@ static int max31335_probe(struct i2c_client *client) const struct chip_desc *match; int ret; - max31335 = devm_kzalloc(&client->dev, sizeof(*max31335), GFP_KERNEL); + max31335 = devm_kzalloc_obj(&client->dev, *max31335); if (!max31335) return -ENOMEM; diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c index 375565a3bddf..fc7756c80240 100644 --- a/drivers/rtc/rtc-max77686.c +++ b/drivers/rtc/rtc-max77686.c @@ -753,8 +753,7 @@ static int max77686_rtc_probe(struct platform_device *pdev) const struct platform_device_id *id = platform_get_device_id(pdev); int ret; - info = devm_kzalloc(&pdev->dev, sizeof(struct max77686_rtc_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct max77686_rtc_info); if (!info) return -ENOMEM; diff --git a/drivers/rtc/rtc-max8907.c b/drivers/rtc/rtc-max8907.c index af97140dd00a..14b8639259ca 100644 --- a/drivers/rtc/rtc-max8907.c +++ b/drivers/rtc/rtc-max8907.c @@ -177,7 +177,7 @@ static int max8907_rtc_probe(struct platform_device *pdev) struct max8907_rtc *rtc; int ret; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; platform_set_drvdata(pdev, rtc); diff --git a/drivers/rtc/rtc-max8925.c b/drivers/rtc/rtc-max8925.c index 6ce8afbeac68..f998fabe3e5b 100644 --- a/drivers/rtc/rtc-max8925.c +++ b/drivers/rtc/rtc-max8925.c @@ -248,8 +248,7 @@ static int max8925_rtc_probe(struct platform_device *pdev) struct max8925_rtc_info *info; int ret; - info = devm_kzalloc(&pdev->dev, sizeof(struct max8925_rtc_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct max8925_rtc_info); if (!info) return -ENOMEM; info->chip = chip; diff --git a/drivers/rtc/rtc-max8997.c b/drivers/rtc/rtc-max8997.c index 89203c92e2cd..c0bd6c5edb1d 100644 --- a/drivers/rtc/rtc-max8997.c +++ b/drivers/rtc/rtc-max8997.c @@ -451,8 +451,7 @@ static int max8997_rtc_probe(struct platform_device *pdev) struct max8997_rtc_info *info; int ret, virq; - info = devm_kzalloc(&pdev->dev, sizeof(struct max8997_rtc_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct max8997_rtc_info); if (!info) return -ENOMEM; diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c index a2c946edcd1a..07dec77aa282 100644 --- a/drivers/rtc/rtc-max8998.c +++ b/drivers/rtc/rtc-max8998.c @@ -251,8 +251,7 @@ static int max8998_rtc_probe(struct platform_device *pdev) struct max8998_rtc_info *info; int ret; - info = devm_kzalloc(&pdev->dev, sizeof(struct max8998_rtc_info), - GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct max8998_rtc_info); if (!info) return -ENOMEM; diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c index 7960d5fa8cf0..107c5ddc273a 100644 --- a/drivers/rtc/rtc-mc13xxx.c +++ b/drivers/rtc/rtc-mc13xxx.c @@ -262,7 +262,7 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev) struct mc13xxx_rtc *priv; struct mc13xxx *mc13xxx; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-meson-vrtc.c b/drivers/rtc/rtc-meson-vrtc.c index 7d38258cbe37..e5f9f05ffee0 100644 --- a/drivers/rtc/rtc-meson-vrtc.c +++ b/drivers/rtc/rtc-meson-vrtc.c @@ -66,7 +66,7 @@ static int meson_vrtc_probe(struct platform_device *pdev) struct meson_vrtc_data *vrtc; struct rtc_device *rtc; - vrtc = devm_kzalloc(&pdev->dev, sizeof(*vrtc), GFP_KERNEL); + vrtc = devm_kzalloc_obj(&pdev->dev, *vrtc); if (!vrtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-meson.c b/drivers/rtc/rtc-meson.c index 21eceb9e2e13..ca857ebfbcfa 100644 --- a/drivers/rtc/rtc-meson.c +++ b/drivers/rtc/rtc-meson.c @@ -295,7 +295,7 @@ static int meson_rtc_probe(struct platform_device *pdev) int ret; u32 tm; - rtc = devm_kzalloc(dev, sizeof(struct meson_rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(dev, struct meson_rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-moxart.c b/drivers/rtc/rtc-moxart.c index bc0345db6ed6..04c965253443 100644 --- a/drivers/rtc/rtc-moxart.c +++ b/drivers/rtc/rtc-moxart.c @@ -245,7 +245,7 @@ static int moxart_rtc_probe(struct platform_device *pdev) struct moxart_rtc *moxart_rtc; int ret = 0; - moxart_rtc = devm_kzalloc(&pdev->dev, sizeof(*moxart_rtc), GFP_KERNEL); + moxart_rtc = devm_kzalloc_obj(&pdev->dev, *moxart_rtc); if (!moxart_rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c index b90f8337a7e6..e1cef77c1a0e 100644 --- a/drivers/rtc/rtc-mpc5121.c +++ b/drivers/rtc/rtc-mpc5121.c @@ -293,7 +293,7 @@ static int mpc5121_rtc_probe(struct platform_device *op) struct mpc5121_rtc_data *rtc; int err = 0; - rtc = devm_kzalloc(&op->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&op->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-mpfs.c b/drivers/rtc/rtc-mpfs.c index 6616ca1f02c7..628305b48615 100644 --- a/drivers/rtc/rtc-mpfs.c +++ b/drivers/rtc/rtc-mpfs.c @@ -219,7 +219,7 @@ static int mpfs_rtc_probe(struct platform_device *pdev) unsigned long prescaler; int wakeup_irq, ret; - rtcdev = devm_kzalloc(&pdev->dev, sizeof(struct mpfs_rtc_dev), GFP_KERNEL); + rtcdev = devm_kzalloc_obj(&pdev->dev, struct mpfs_rtc_dev); if (!rtcdev) return -ENOMEM; diff --git a/drivers/rtc/rtc-msc313.c b/drivers/rtc/rtc-msc313.c index 912a46c6f17e..27fc95734e5e 100644 --- a/drivers/rtc/rtc-msc313.c +++ b/drivers/rtc/rtc-msc313.c @@ -185,7 +185,7 @@ static int msc313_rtc_probe(struct platform_device *pdev) int ret; int irq; - priv = devm_kzalloc(&pdev->dev, sizeof(struct msc313_rtc), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct msc313_rtc); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-msm6242.c b/drivers/rtc/rtc-msm6242.c index 80e364baac53..b58ba463791d 100644 --- a/drivers/rtc/rtc-msm6242.c +++ b/drivers/rtc/rtc-msm6242.c @@ -196,7 +196,7 @@ static int __init msm6242_rtc_probe(struct platform_device *pdev) if (!res) return -ENODEV; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-mt2712.c b/drivers/rtc/rtc-mt2712.c index cd92a9788351..2dbd51a00478 100644 --- a/drivers/rtc/rtc-mt2712.c +++ b/drivers/rtc/rtc-mt2712.c @@ -313,8 +313,7 @@ static int mt2712_rtc_probe(struct platform_device *pdev) struct mt2712_rtc *mt2712_rtc; int ret; - mt2712_rtc = devm_kzalloc(&pdev->dev, - sizeof(struct mt2712_rtc), GFP_KERNEL); + mt2712_rtc = devm_kzalloc_obj(&pdev->dev, struct mt2712_rtc); if (!mt2712_rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index d6e156516aa6..ab402f9f85c3 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -333,7 +333,7 @@ static int mtk_rtc_probe(struct platform_device *pdev) struct mt6397_rtc *rtc; int ret; - rtc = devm_kzalloc(&pdev->dev, sizeof(struct mt6397_rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, struct mt6397_rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-mt7622.c b/drivers/rtc/rtc-mt7622.c index 9e17dd09d567..1772cb25b25d 100644 --- a/drivers/rtc/rtc-mt7622.c +++ b/drivers/rtc/rtc-mt7622.c @@ -304,7 +304,7 @@ static int mtk_rtc_probe(struct platform_device *pdev) struct mtk_rtc *hw; int ret; - hw = devm_kzalloc(&pdev->dev, sizeof(*hw), GFP_KERNEL); + hw = devm_kzalloc_obj(&pdev->dev, *hw); if (!hw) return -ENOMEM; diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c index db64c459ee19..3f48b4eaeef2 100644 --- a/drivers/rtc/rtc-mv.c +++ b/drivers/rtc/rtc-mv.c @@ -211,7 +211,7 @@ static int __init mv_rtc_probe(struct platform_device *pdev) u32 rtc_time; int ret = 0; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c index 608db97d450c..f91b0994b715 100644 --- a/drivers/rtc/rtc-mxc.c +++ b/drivers/rtc/rtc-mxc.c @@ -298,7 +298,7 @@ static int mxc_rtc_probe(struct platform_device *pdev) unsigned long rate; int ret; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/rtc/rtc-mxc_v2.c b/drivers/rtc/rtc-mxc_v2.c index a07acbbcfaeb..965170bb8cd7 100644 --- a/drivers/rtc/rtc-mxc_v2.c +++ b/drivers/rtc/rtc-mxc_v2.c @@ -280,7 +280,7 @@ static int mxc_rtc_probe(struct platform_device *pdev) void __iomem *ioaddr; int ret = 0; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/rtc/rtc-nct3018y.c b/drivers/rtc/rtc-nct3018y.c index 194ba077363a..c770450e48b4 100644 --- a/drivers/rtc/rtc-nct3018y.c +++ b/drivers/rtc/rtc-nct3018y.c @@ -593,8 +593,7 @@ static int nct3018y_probe(struct i2c_client *client) I2C_FUNC_SMBUS_BLOCK_DATA)) return -ENODEV; - nct3018y = devm_kzalloc(&client->dev, sizeof(struct nct3018y), - GFP_KERNEL); + nct3018y = devm_kzalloc_obj(&client->dev, struct nct3018y); if (!nct3018y) return -ENOMEM; diff --git a/drivers/rtc/rtc-nct6694.c b/drivers/rtc/rtc-nct6694.c index 1cf9b672256a..501c364277d8 100644 --- a/drivers/rtc/rtc-nct6694.c +++ b/drivers/rtc/rtc-nct6694.c @@ -236,12 +236,11 @@ static int nct6694_rtc_probe(struct platform_device *pdev) struct nct6694 *nct6694 = dev_get_drvdata(pdev->dev.parent); int ret; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; - data->msg = devm_kzalloc(&pdev->dev, sizeof(union nct6694_rtc_msg), - GFP_KERNEL); + data->msg = devm_kzalloc_obj(&pdev->dev, union nct6694_rtc_msg); if (!data->msg) return -ENOMEM; diff --git a/drivers/rtc/rtc-ntxec.c b/drivers/rtc/rtc-ntxec.c index d28ddb34e19e..d5dda13b5cd2 100644 --- a/drivers/rtc/rtc-ntxec.c +++ b/drivers/rtc/rtc-ntxec.c @@ -112,7 +112,7 @@ static int ntxec_rtc_probe(struct platform_device *pdev) device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-nvidia-vrs10.c b/drivers/rtc/rtc-nvidia-vrs10.c index caac63f4e0fc..afd6e41f8470 100644 --- a/drivers/rtc/rtc-nvidia-vrs10.c +++ b/drivers/rtc/rtc-nvidia-vrs10.c @@ -423,7 +423,7 @@ static int nvvrs_rtc_probe(struct i2c_client *client) struct nvvrs_rtc_info *info; int ret; - info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&client->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/rtc/rtc-nxp-bbnsm.c b/drivers/rtc/rtc-nxp-bbnsm.c index d4fc9dc583d3..a369908db3a0 100644 --- a/drivers/rtc/rtc-nxp-bbnsm.c +++ b/drivers/rtc/rtc-nxp-bbnsm.c @@ -166,7 +166,7 @@ static int bbnsm_rtc_probe(struct platform_device *pdev) struct bbnsm_rtc *bbnsm; int ret; - bbnsm = devm_kzalloc(&pdev->dev, sizeof(*bbnsm), GFP_KERNEL); + bbnsm = devm_kzalloc_obj(&pdev->dev, *bbnsm); if (!bbnsm) return -ENOMEM; diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 18492165a19f..3c978edd6c2c 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c @@ -730,7 +730,7 @@ static int omap_rtc_probe(struct platform_device *pdev) const struct platform_device_id *id_entry; int ret; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-optee.c b/drivers/rtc/rtc-optee.c index 6c908c0d861a..256f60f1800a 100644 --- a/drivers/rtc/rtc-optee.c +++ b/drivers/rtc/rtc-optee.c @@ -554,7 +554,7 @@ static int optee_rtc_probe(struct tee_client_device *rtc_device) struct tee_shm *shm; int ret, err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-palmas.c b/drivers/rtc/rtc-palmas.c index aecada6bcf8b..64c901106cd9 100644 --- a/drivers/rtc/rtc-palmas.c +++ b/drivers/rtc/rtc-palmas.c @@ -235,8 +235,7 @@ static int palmas_rtc_probe(struct platform_device *pdev) "ti,backup-battery-charge-high-current"); } - palmas_rtc = devm_kzalloc(&pdev->dev, sizeof(struct palmas_rtc), - GFP_KERNEL); + palmas_rtc = devm_kzalloc_obj(&pdev->dev, struct palmas_rtc); if (!palmas_rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-pcf2123.c b/drivers/rtc/rtc-pcf2123.c index 22c626d57090..95654be6f725 100644 --- a/drivers/rtc/rtc-pcf2123.c +++ b/drivers/rtc/rtc-pcf2123.c @@ -378,8 +378,7 @@ static int pcf2123_probe(struct spi_device *spi) struct pcf2123_data *pcf2123; int ret = 0; - pcf2123 = devm_kzalloc(&spi->dev, sizeof(struct pcf2123_data), - GFP_KERNEL); + pcf2123 = devm_kzalloc_obj(&spi->dev, struct pcf2123_data); if (!pcf2123) return -ENOMEM; diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c index 49542cc53411..27c5fb9b2aaa 100644 --- a/drivers/rtc/rtc-pcf2127.c +++ b/drivers/rtc/rtc-pcf2127.c @@ -1196,7 +1196,7 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap, dev_dbg(dev, "%s\n", __func__); - pcf2127 = devm_kzalloc(dev, sizeof(*pcf2127), GFP_KERNEL); + pcf2127 = devm_kzalloc_obj(dev, *pcf2127); if (!pcf2127) return -ENOMEM; diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c index 32952e73f2f1..819648619dff 100644 --- a/drivers/rtc/rtc-pcf85063.c +++ b/drivers/rtc/rtc-pcf85063.c @@ -645,8 +645,7 @@ static int pcf85063_probe(struct device *dev, struct regmap *regmap, int irq, dev_dbg(dev, "%s\n", __func__); - pcf85063 = devm_kzalloc(dev, sizeof(struct pcf85063), - GFP_KERNEL); + pcf85063 = devm_kzalloc_obj(dev, struct pcf85063); if (!pcf85063) return -ENOMEM; diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c index e8354953836c..bbd42358a4c2 100644 --- a/drivers/rtc/rtc-pcf8523.c +++ b/drivers/rtc/rtc-pcf8523.c @@ -424,7 +424,7 @@ static int pcf8523_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -ENODEV; - pcf8523 = devm_kzalloc(&client->dev, sizeof(struct pcf8523), GFP_KERNEL); + pcf8523 = devm_kzalloc_obj(&client->dev, struct pcf8523); if (!pcf8523) return -ENOMEM; diff --git a/drivers/rtc/rtc-pcf85363.c b/drivers/rtc/rtc-pcf85363.c index ccc7834e5759..54f7ffca239e 100644 --- a/drivers/rtc/rtc-pcf85363.c +++ b/drivers/rtc/rtc-pcf85363.c @@ -407,8 +407,7 @@ static int pcf85363_probe(struct i2c_client *client) if (data) config = data; - pcf85363 = devm_kzalloc(&client->dev, sizeof(struct pcf85363), - GFP_KERNEL); + pcf85363 = devm_kzalloc_obj(&client->dev, struct pcf85363); if (!pcf85363) return -ENOMEM; diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index 3801acc9ac8d..62e68ba9a226 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c @@ -483,8 +483,7 @@ static int pcf8563_probe(struct i2c_client *client) !i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) return -ENODEV; - pcf8563 = devm_kzalloc(&client->dev, sizeof(struct pcf8563), - GFP_KERNEL); + pcf8563 = devm_kzalloc_obj(&client->dev, struct pcf8563); if (!pcf8563) return -ENOMEM; diff --git a/drivers/rtc/rtc-pcf8583.c b/drivers/rtc/rtc-pcf8583.c index df5e20cbc26c..8c50df84c417 100644 --- a/drivers/rtc/rtc-pcf8583.c +++ b/drivers/rtc/rtc-pcf8583.c @@ -282,8 +282,7 @@ static int pcf8583_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -ENODEV; - pcf8583 = devm_kzalloc(&client->dev, sizeof(struct pcf8583), - GFP_KERNEL); + pcf8583 = devm_kzalloc_obj(&client->dev, struct pcf8583); if (!pcf8583) return -ENOMEM; diff --git a/drivers/rtc/rtc-pic32.c b/drivers/rtc/rtc-pic32.c index 3c7a38a4ac08..4a4fedb7cf71 100644 --- a/drivers/rtc/rtc-pic32.c +++ b/drivers/rtc/rtc-pic32.c @@ -297,7 +297,7 @@ static int pic32_rtc_probe(struct platform_device *pdev) struct pic32_rtc_dev *pdata; int ret; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/rtc/rtc-pl030.c b/drivers/rtc/rtc-pl030.c index 5caaa714f448..60a377b542c0 100644 --- a/drivers/rtc/rtc-pl030.c +++ b/drivers/rtc/rtc-pl030.c @@ -91,7 +91,7 @@ static int pl030_probe(struct amba_device *dev, const struct amba_id *id) if (ret) goto err_req; - rtc = devm_kzalloc(&dev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&dev->dev, *rtc); if (!rtc) { ret = -ENOMEM; goto err_rtc; diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index eab39dfa4e5f..9adbf4e36dcc 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c @@ -303,8 +303,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) if (ret) goto err_req; - ldata = devm_kzalloc(&adev->dev, sizeof(struct pl031_local), - GFP_KERNEL); + ldata = devm_kzalloc_obj(&adev->dev, struct pl031_local); ops = devm_kmemdup(&adev->dev, &vendor->ops, sizeof(vendor->ops), GFP_KERNEL); if (!ldata || !ops) { diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c index e624f848c22b..40b6b62116dc 100644 --- a/drivers/rtc/rtc-pm8xxx.c +++ b/drivers/rtc/rtc-pm8xxx.c @@ -602,7 +602,7 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev) if (!match) return -ENXIO; - rtc_dd = devm_kzalloc(&pdev->dev, sizeof(*rtc_dd), GFP_KERNEL); + rtc_dd = devm_kzalloc_obj(&pdev->dev, *rtc_dd); if (rtc_dd == NULL) return -ENOMEM; diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c index 62ee6b8f9bcd..6443824f2a3e 100644 --- a/drivers/rtc/rtc-pxa.c +++ b/drivers/rtc/rtc-pxa.c @@ -306,7 +306,7 @@ static int __init pxa_rtc_probe(struct platform_device *pdev) struct sa1100_rtc *sa1100_rtc; int ret; - pxa_rtc = devm_kzalloc(dev, sizeof(*pxa_rtc), GFP_KERNEL); + pxa_rtc = devm_kzalloc_obj(dev, *pxa_rtc); if (!pxa_rtc) return -ENOMEM; sa1100_rtc = &pxa_rtc->sa1100_rtc; diff --git a/drivers/rtc/rtc-r7301.c b/drivers/rtc/rtc-r7301.c index 6323b777151f..ceec6c05ed2b 100644 --- a/drivers/rtc/rtc-r7301.c +++ b/drivers/rtc/rtc-r7301.c @@ -371,7 +371,7 @@ static int __init rtc7301_rtc_probe(struct platform_device *dev) int ret; u32 val; - priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&dev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-raspberrypi.c b/drivers/rtc/rtc-raspberrypi.c index 0547a96c62ac..cfeec1956feb 100644 --- a/drivers/rtc/rtc-raspberrypi.c +++ b/drivers/rtc/rtc-raspberrypi.c @@ -215,7 +215,7 @@ static int rpi_rtc_probe(struct platform_device *pdev) if (!firmware) return -EPROBE_DEFER; - rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-rc5t583.c b/drivers/rtc/rtc-rc5t583.c index 8ba9cda74acf..e7ebc6680ce2 100644 --- a/drivers/rtc/rtc-rc5t583.c +++ b/drivers/rtc/rtc-rc5t583.c @@ -210,8 +210,7 @@ static int rc5t583_rtc_probe(struct platform_device *pdev) int ret; int irq; - ricoh_rtc = devm_kzalloc(&pdev->dev, sizeof(struct rc5t583_rtc), - GFP_KERNEL); + ricoh_rtc = devm_kzalloc_obj(&pdev->dev, struct rc5t583_rtc); if (!ricoh_rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-rc5t619.c b/drivers/rtc/rtc-rc5t619.c index 74d169102074..37a391d71308 100644 --- a/drivers/rtc/rtc-rc5t619.c +++ b/drivers/rtc/rtc-rc5t619.c @@ -355,7 +355,7 @@ static int rc5t619_rtc_probe(struct platform_device *pdev) unsigned int ctrl2; int err; - rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-renesas-rtca3.c b/drivers/rtc/rtc-renesas-rtca3.c index b3875d041de5..1d808e507a93 100644 --- a/drivers/rtc/rtc-renesas-rtca3.c +++ b/drivers/rtc/rtc-renesas-rtca3.c @@ -718,7 +718,7 @@ static int rtca3_probe(struct platform_device *pdev) struct clk *clk; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-rk808.c b/drivers/rtc/rtc-rk808.c index 59b8e9a30fe6..43ee263ee175 100644 --- a/drivers/rtc/rtc-rk808.c +++ b/drivers/rtc/rtc-rk808.c @@ -381,7 +381,7 @@ static int rk808_rtc_probe(struct platform_device *pdev) struct rk808_rtc *rk808_rtc; int ret; - rk808_rtc = devm_kzalloc(&pdev->dev, sizeof(*rk808_rtc), GFP_KERNEL); + rk808_rtc = devm_kzalloc_obj(&pdev->dev, *rk808_rtc); if (rk808_rtc == NULL) return -ENOMEM; diff --git a/drivers/rtc/rtc-rp5c01.c b/drivers/rtc/rtc-rp5c01.c index 44afa6d996e7..13ba5dd8655c 100644 --- a/drivers/rtc/rtc-rp5c01.c +++ b/drivers/rtc/rtc-rp5c01.c @@ -234,7 +234,7 @@ static int __init rp5c01_rtc_probe(struct platform_device *dev) if (!res) return -ENODEV; - priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&dev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c index fec633f80789..5fb3d887dff7 100644 --- a/drivers/rtc/rtc-rs5c348.c +++ b/drivers/rtc/rtc-rs5c348.c @@ -167,8 +167,7 @@ static int rs5c348_probe(struct spi_device *spi) struct rtc_device *rtc; struct rs5c348_plat_data *pdata; - pdata = devm_kzalloc(&spi->dev, sizeof(struct rs5c348_plat_data), - GFP_KERNEL); + pdata = devm_kzalloc_obj(&spi->dev, struct rs5c348_plat_data); if (!pdata) return -ENOMEM; spi->dev.platform_data = pdata; diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index a4bd042908b8..8a61d0a54822 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c @@ -851,8 +851,7 @@ static int rs5c372_probe(struct i2c_client *client) } } - rs5c372 = devm_kzalloc(&client->dev, sizeof(struct rs5c372), - GFP_KERNEL); + rs5c372 = devm_kzalloc_obj(&client->dev, struct rs5c372); if (!rs5c372) { err = -ENOMEM; goto exit; diff --git a/drivers/rtc/rtc-rtd119x.c b/drivers/rtc/rtc-rtd119x.c index 85a138db81d7..04b4ab4017bb 100644 --- a/drivers/rtc/rtc-rtd119x.c +++ b/drivers/rtc/rtc-rtd119x.c @@ -169,7 +169,7 @@ static int rtd119x_rtc_probe(struct platform_device *pdev) u32 val; int ret; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c index b3a5b1ef33d1..44afac814aff 100644 --- a/drivers/rtc/rtc-rv3028.c +++ b/drivers/rtc/rtc-rv3028.c @@ -943,8 +943,7 @@ static int rv3028_probe(struct i2c_client *client) .reg_write = rv3028_eeprom_write, }; - rv3028 = devm_kzalloc(&client->dev, sizeof(struct rv3028_data), - GFP_KERNEL); + rv3028 = devm_kzalloc_obj(&client->dev, struct rv3028_data); if (!rv3028) return -ENOMEM; diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c index 33b73bbcaf52..b5db9546fa3b 100644 --- a/drivers/rtc/rtc-rv3029c2.c +++ b/drivers/rtc/rtc-rv3029c2.c @@ -715,7 +715,7 @@ static int rv3029_probe(struct device *dev, struct regmap *regmap, int irq, }; int rc = 0; - rv3029 = devm_kzalloc(dev, sizeof(*rv3029), GFP_KERNEL); + rv3029 = devm_kzalloc_obj(dev, *rv3029); if (!rv3029) return -ENOMEM; diff --git a/drivers/rtc/rtc-rv3032.c b/drivers/rtc/rtc-rv3032.c index 687faaef42b2..916e5ca5cfa1 100644 --- a/drivers/rtc/rtc-rv3032.c +++ b/drivers/rtc/rtc-rv3032.c @@ -914,8 +914,7 @@ static int rv3032_probe(struct i2c_client *client) .reg_write = rv3032_eeprom_write, }; - rv3032 = devm_kzalloc(&client->dev, sizeof(struct rv3032_data), - GFP_KERNEL); + rv3032 = devm_kzalloc_obj(&client->dev, struct rv3032_data); if (!rv3032) return -ENOMEM; diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c index b9b5fee16ee4..7445c8151056 100644 --- a/drivers/rtc/rtc-rv8803.c +++ b/drivers/rtc/rtc-rv8803.c @@ -660,8 +660,7 @@ static int rv8803_probe(struct i2c_client *client) return -EIO; } - rv8803 = devm_kzalloc(&client->dev, sizeof(struct rv8803_data), - GFP_KERNEL); + rv8803 = devm_kzalloc_obj(&client->dev, struct rv8803_data); if (!rv8803) return -ENOMEM; diff --git a/drivers/rtc/rtc-rx6110.c b/drivers/rtc/rtc-rx6110.c index 1eacd470a27c..c0fa43367cc1 100644 --- a/drivers/rtc/rtc-rx6110.c +++ b/drivers/rtc/rtc-rx6110.c @@ -351,7 +351,7 @@ static int rx6110_spi_probe(struct spi_device *spi) dev_warn(&spi->dev, "driving device in an unsupported mode"); } - rx6110 = devm_kzalloc(&spi->dev, sizeof(*rx6110), GFP_KERNEL); + rx6110 = devm_kzalloc_obj(&spi->dev, *rx6110); if (!rx6110) return -ENOMEM; @@ -427,7 +427,7 @@ static int rx6110_i2c_probe(struct i2c_client *client) return -EIO; } - rx6110 = devm_kzalloc(&client->dev, sizeof(*rx6110), GFP_KERNEL); + rx6110 = devm_kzalloc_obj(&client->dev, *rx6110); if (!rx6110) return -ENOMEM; diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c index 0a9be6ea62d0..2fbd66a1f312 100644 --- a/drivers/rtc/rtc-rx8010.c +++ b/drivers/rtc/rtc-rx8010.c @@ -373,7 +373,7 @@ static int rx8010_probe(struct i2c_client *client) struct rx8010_data *rx8010; int err = 0; - rx8010 = devm_kzalloc(dev, sizeof(*rx8010), GFP_KERNEL); + rx8010 = devm_kzalloc_obj(dev, *rx8010); if (!rx8010) return -ENOMEM; diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c index 96a04c977d0f..1ccec7b5ae42 100644 --- a/drivers/rtc/rtc-rx8025.c +++ b/drivers/rtc/rtc-rx8025.c @@ -531,7 +531,7 @@ static int rx8025_probe(struct i2c_client *client) return -EIO; } - rx8025 = devm_kzalloc(&client->dev, sizeof(*rx8025), GFP_KERNEL); + rx8025 = devm_kzalloc_obj(&client->dev, *rx8025); if (!rx8025) return -ENOMEM; diff --git a/drivers/rtc/rtc-rx8111.c b/drivers/rtc/rtc-rx8111.c index 8450d9f0b566..4019a3354f01 100644 --- a/drivers/rtc/rtc-rx8111.c +++ b/drivers/rtc/rtc-rx8111.c @@ -306,7 +306,7 @@ static int rx8111_probe(struct i2c_client *client) struct rtc_device *rtc; size_t i; - data = devm_kmalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kmalloc_obj(&client->dev, *data); if (!data) { dev_dbg(&client->dev, "Could not allocate device data\n"); return -ENOMEM; diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c index 1db518ab3a3a..df2c5a3c30f6 100644 --- a/drivers/rtc/rtc-rzn1.c +++ b/drivers/rtc/rtc-rzn1.c @@ -427,7 +427,7 @@ static int rzn1_rtc_probe(struct platform_device *pdev) if (!data) return -ENODEV; - rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-s32g.c b/drivers/rtc/rtc-s32g.c index 86716192d10f..a8a67d496eae 100644 --- a/drivers/rtc/rtc-s32g.c +++ b/drivers/rtc/rtc-s32g.c @@ -272,7 +272,7 @@ static int s32g_rtc_probe(struct platform_device *pdev) unsigned long rtc_hz; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c index d3e829052927..04797e6c440d 100644 --- a/drivers/rtc/rtc-s35390a.c +++ b/drivers/rtc/rtc-s35390a.c @@ -704,7 +704,7 @@ static int s35390a_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -ENODEV; - s35390a = devm_kzalloc(dev, sizeof(struct s35390a), GFP_KERNEL); + s35390a = devm_kzalloc_obj(dev, struct s35390a); if (!s35390a) return -ENOMEM; diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 291c0ccb0acd..221a9461dbc0 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -387,7 +387,7 @@ static int s3c_rtc_probe(struct platform_device *pdev) struct s3c_rtc *info = NULL; int ret; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index aa706074ec3e..031191d4eeb9 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c @@ -669,7 +669,7 @@ static int s5m_rtc_probe(struct platform_device *pdev) struct s5m_rtc_info *info; int ret, alarm_irq; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index 26b2f4184ecc..b170685237c5 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c @@ -248,7 +248,7 @@ static int sa1100_rtc_probe(struct platform_device *pdev) if (irq_1hz < 0 || irq_alarm < 0) return -ENODEV; - info = devm_kzalloc(&pdev->dev, sizeof(struct sa1100_rtc), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct sa1100_rtc); if (!info) return -ENOMEM; info->irq_1hz = irq_1hz; diff --git a/drivers/rtc/rtc-sc27xx.c b/drivers/rtc/rtc-sc27xx.c index 2b83561d4d28..c71e4f05614a 100644 --- a/drivers/rtc/rtc-sc27xx.c +++ b/drivers/rtc/rtc-sc27xx.c @@ -565,7 +565,7 @@ static int sprd_rtc_probe(struct platform_device *pdev) struct sprd_rtc *rtc; int ret; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-sd2405al.c b/drivers/rtc/rtc-sd2405al.c index 7982a910a537..990080f09457 100644 --- a/drivers/rtc/rtc-sd2405al.c +++ b/drivers/rtc/rtc-sd2405al.c @@ -174,7 +174,7 @@ static int sd2405al_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -ENODEV; - sd2405al = devm_kzalloc(&client->dev, sizeof(*sd2405al), GFP_KERNEL); + sd2405al = devm_kzalloc_obj(&client->dev, *sd2405al); if (!sd2405al) return -ENOMEM; diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 7a5feceb9ee7..49f737206e45 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c @@ -330,7 +330,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev) unsigned int tmp; resource_size_t regsize; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (unlikely(!rtc)) return -ENOMEM; diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c index d82acf1af1fa..d99a352d6d31 100644 --- a/drivers/rtc/rtc-snvs.c +++ b/drivers/rtc/rtc-snvs.c @@ -320,7 +320,7 @@ static int snvs_rtc_probe(struct platform_device *pdev) int ret; void __iomem *mmio; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/rtc/rtc-spacemit-p1.c b/drivers/rtc/rtc-spacemit-p1.c index 1de7bd995d29..fcfce534f60c 100644 --- a/drivers/rtc/rtc-spacemit-p1.c +++ b/drivers/rtc/rtc-spacemit-p1.c @@ -129,7 +129,7 @@ static int p1_rtc_probe(struct platform_device *pdev) struct rtc_device *rtc; struct p1_rtc *p1; - p1 = devm_kzalloc(dev, sizeof(*p1), GFP_KERNEL); + p1 = devm_kzalloc_obj(dev, *p1); if (!p1) return -ENOMEM; dev_set_drvdata(dev, p1); diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c index d12bccb3cf5e..408df168a1fe 100644 --- a/drivers/rtc/rtc-spear.c +++ b/drivers/rtc/rtc-spear.c @@ -350,7 +350,7 @@ static int spear_rtc_probe(struct platform_device *pdev) int status = 0; int irq; - config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL); + config = devm_kzalloc_obj(&pdev->dev, *config); if (!config) return -ENOMEM; diff --git a/drivers/rtc/rtc-ssd202d.c b/drivers/rtc/rtc-ssd202d.c index 72aa02eb86ea..dd0cf5391fe9 100644 --- a/drivers/rtc/rtc-ssd202d.c +++ b/drivers/rtc/rtc-ssd202d.c @@ -207,7 +207,7 @@ static int ssd202d_rtc_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct ssd202d_rtc *priv; - priv = devm_kzalloc(&pdev->dev, sizeof(struct ssd202d_rtc), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct ssd202d_rtc); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-st-lpc.c b/drivers/rtc/rtc-st-lpc.c index ae79ddf24f37..0b6e58d8bbbf 100644 --- a/drivers/rtc/rtc-st-lpc.c +++ b/drivers/rtc/rtc-st-lpc.c @@ -197,7 +197,7 @@ static int st_rtc_probe(struct platform_device *pdev) if (mode != ST_LPC_MODE_RTC) return -ENODEV; - rtc = devm_kzalloc(&pdev->dev, sizeof(struct st_rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, struct st_rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c index 7cb6be1b7815..8155315bb92a 100644 --- a/drivers/rtc/rtc-stk17ta8.c +++ b/drivers/rtc/rtc-stk17ta8.c @@ -270,7 +270,7 @@ static int stk17ta8_rtc_probe(struct platform_device *pdev) .reg_write = stk17ta8_nvram_write, }; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c index 1c4e4bd7afe4..0e51626824a4 100644 --- a/drivers/rtc/rtc-stm32.c +++ b/drivers/rtc/rtc-stm32.c @@ -1059,7 +1059,7 @@ static int stm32_rtc_probe(struct platform_device *pdev) struct pinctrl_dev *pctl; int ret; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c index 7afcd14aeee5..d79e282e3817 100644 --- a/drivers/rtc/rtc-stmp3xxx.c +++ b/drivers/rtc/rtc-stmp3xxx.c @@ -251,7 +251,7 @@ static int stmp3xxx_rtc_probe(struct platform_device *pdev) u32 crystalfreq = 0; int err; - rtc_data = devm_kzalloc(&pdev->dev, sizeof(*rtc_data), GFP_KERNEL); + rtc_data = devm_kzalloc_obj(&pdev->dev, *rtc_data); if (!rtc_data) return -ENOMEM; diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index c6916edbf400..121a7f77153d 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -778,7 +778,7 @@ static int sun6i_rtc_probe(struct platform_device *pdev) } if (!chip) { - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/rtc/rtc-sunplus.c b/drivers/rtc/rtc-sunplus.c index 519a06e728d6..aeff6f1d259f 100644 --- a/drivers/rtc/rtc-sunplus.c +++ b/drivers/rtc/rtc-sunplus.c @@ -231,7 +231,7 @@ static int sp_rtc_probe(struct platform_device *plat_dev) struct sunplus_rtc *sp_rtc; int ret; - sp_rtc = devm_kzalloc(&plat_dev->dev, sizeof(*sp_rtc), GFP_KERNEL); + sp_rtc = devm_kzalloc_obj(&plat_dev->dev, *sp_rtc); if (!sp_rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-sunxi.c b/drivers/rtc/rtc-sunxi.c index 5cab9953c44f..8f415d0ee56d 100644 --- a/drivers/rtc/rtc-sunxi.c +++ b/drivers/rtc/rtc-sunxi.c @@ -422,7 +422,7 @@ static int sunxi_rtc_probe(struct platform_device *pdev) struct sunxi_rtc_dev *chip; int ret; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c index f16405c3911c..4bc1d1f8c24c 100644 --- a/drivers/rtc/rtc-tegra.c +++ b/drivers/rtc/rtc-tegra.c @@ -284,7 +284,7 @@ static int tegra_rtc_probe(struct platform_device *pdev) struct tegra_rtc_info *info; int ret; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c index 94f995febe5b..9214497ece0a 100644 --- a/drivers/rtc/rtc-test.c +++ b/drivers/rtc/rtc-test.c @@ -116,7 +116,7 @@ static int test_probe(struct platform_device *plat_dev) { struct rtc_test_data *rtd; - rtd = devm_kzalloc(&plat_dev->dev, sizeof(*rtd), GFP_KERNEL); + rtd = devm_kzalloc_obj(&plat_dev->dev, *rtd); if (!rtd) return -ENOMEM; diff --git a/drivers/rtc/rtc-ti-k3.c b/drivers/rtc/rtc-ti-k3.c index 8df00319cb6b..8bde650b2458 100644 --- a/drivers/rtc/rtc-ti-k3.c +++ b/drivers/rtc/rtc-ti-k3.c @@ -556,7 +556,7 @@ static int ti_k3_rtc_probe(struct platform_device *pdev) void __iomem *rtc_base; int ret; - priv = devm_kzalloc(dev, sizeof(struct ti_k3_rtc), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct ti_k3_rtc); if (!priv) return -ENOMEM; diff --git a/drivers/rtc/rtc-tps6586x.c b/drivers/rtc/rtc-tps6586x.c index 54c8429b16bf..521f1bce85c8 100644 --- a/drivers/rtc/rtc-tps6586x.c +++ b/drivers/rtc/rtc-tps6586x.c @@ -224,7 +224,7 @@ static int tps6586x_rtc_probe(struct platform_device *pdev) struct tps6586x_rtc *rtc; int ret; - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(&pdev->dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c index 284aa2f0392b..8b2f04dbaa45 100644 --- a/drivers/rtc/rtc-tps65910.c +++ b/drivers/rtc/rtc-tps65910.c @@ -372,8 +372,7 @@ static int tps65910_rtc_probe(struct platform_device *pdev) tps65910 = dev_get_drvdata(pdev->dev.parent); - tps_rtc = devm_kzalloc(&pdev->dev, sizeof(struct tps65910_rtc), - GFP_KERNEL); + tps_rtc = devm_kzalloc_obj(&pdev->dev, struct tps65910_rtc); if (!tps_rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-tps6594.c b/drivers/rtc/rtc-tps6594.c index f89fc3e59be0..45e52cca3f06 100644 --- a/drivers/rtc/rtc-tps6594.c +++ b/drivers/rtc/rtc-tps6594.c @@ -364,7 +364,7 @@ static int tps6594_rtc_probe(struct platform_device *pdev) int irq; int ret; - rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL); + rtc = devm_kzalloc_obj(dev, *rtc); if (!rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index e6106e67e1f4..e6f12071c4b6 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c @@ -518,7 +518,7 @@ static int twl_rtc_probe(struct platform_device *pdev) if (irq <= 0) return ret; - twl_rtc = devm_kzalloc(&pdev->dev, sizeof(*twl_rtc), GFP_KERNEL); + twl_rtc = devm_kzalloc_obj(&pdev->dev, *twl_rtc); if (!twl_rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c index c8b568498016..543577469055 100644 --- a/drivers/rtc/rtc-vt8500.c +++ b/drivers/rtc/rtc-vt8500.c @@ -196,8 +196,7 @@ static int vt8500_rtc_probe(struct platform_device *pdev) struct vt8500_rtc *vt8500_rtc; int ret; - vt8500_rtc = devm_kzalloc(&pdev->dev, - sizeof(struct vt8500_rtc), GFP_KERNEL); + vt8500_rtc = devm_kzalloc_obj(&pdev->dev, struct vt8500_rtc); if (!vt8500_rtc) return -ENOMEM; diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c index 218316be942a..1943cb1eb94b 100644 --- a/drivers/rtc/rtc-wm831x.c +++ b/drivers/rtc/rtc-wm831x.c @@ -405,7 +405,7 @@ static int wm831x_rtc_probe(struct platform_device *pdev) int alm_irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "ALM")); int ret = 0; - wm831x_rtc = devm_kzalloc(&pdev->dev, sizeof(*wm831x_rtc), GFP_KERNEL); + wm831x_rtc = devm_kzalloc_obj(&pdev->dev, *wm831x_rtc); if (wm831x_rtc == NULL) return -ENOMEM; diff --git a/drivers/rtc/rtc-xgene.c b/drivers/rtc/rtc-xgene.c index 6660b664e8dd..b44d69794b7b 100644 --- a/drivers/rtc/rtc-xgene.c +++ b/drivers/rtc/rtc-xgene.c @@ -139,7 +139,7 @@ static int xgene_rtc_probe(struct platform_device *pdev) int ret; int irq; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; platform_set_drvdata(pdev, pdata); diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c index 5bcb7536e973..31e65fc89203 100644 --- a/drivers/rtc/rtc-zynqmp.c +++ b/drivers/rtc/rtc-zynqmp.c @@ -282,7 +282,7 @@ static int xlnx_rtc_probe(struct platform_device *pdev) u32 alarm_time; int ret; - xrtcdev = devm_kzalloc(&pdev->dev, sizeof(*xrtcdev), GFP_KERNEL); + xrtcdev = devm_kzalloc_obj(&pdev->dev, *xrtcdev); if (!xrtcdev) return -ENOMEM; diff --git a/drivers/rtc/sysfs.c b/drivers/rtc/sysfs.c index 4ab05e105a76..8771c3a696bc 100644 --- a/drivers/rtc/sysfs.c +++ b/drivers/rtc/sysfs.c @@ -326,7 +326,7 @@ int rtc_add_groups(struct rtc_device *rtc, const struct attribute_group **grps) old_cnt++; new_cnt = old_cnt + add_cnt + 1; - groups = devm_kcalloc(&rtc->dev, new_cnt, sizeof(*groups), GFP_KERNEL); + groups = devm_kzalloc_objs(&rtc->dev, *groups, new_cnt); if (!groups) return -ENOMEM; memcpy(groups, rtc->dev.groups, old_cnt * sizeof(*groups)); diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c index e94222b3523c..60fe022783ed 100644 --- a/drivers/sbus/char/display7seg.c +++ b/drivers/sbus/char/display7seg.c @@ -177,7 +177,7 @@ static int d7s_probe(struct platform_device *op) if (d7s_device) goto out; - p = devm_kzalloc(&op->dev, sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(&op->dev, *p); err = -ENOMEM; if (!p) goto out; diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index cf7aa0a699cd..06455c7a9e2a 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -2320,9 +2320,8 @@ int hisi_sas_alloc(struct hisi_hba *hisi_hba) if (!hisi_hba->itct) goto err_out; - hisi_hba->slot_info = devm_kcalloc(dev, max_command_entries, - sizeof(struct hisi_sas_slot), - GFP_KERNEL); + hisi_hba->slot_info = devm_kzalloc_objs(dev, struct hisi_sas_slot, + max_command_entries); if (!hisi_hba->slot_info) goto err_out; diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c index acf0c2038d20..005477f02cd6 100644 --- a/drivers/scsi/isci/init.c +++ b/drivers/scsi/isci/init.c @@ -483,7 +483,7 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id) struct Scsi_Host *shost; int err, i; - ihost = devm_kzalloc(&pdev->dev, sizeof(*ihost), GFP_KERNEL); + ihost = devm_kzalloc_obj(&pdev->dev, *ihost); if (!ihost) return NULL; @@ -599,7 +599,7 @@ static int isci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) dev_info(&pdev->dev, "driver configured for rev: %d silicon\n", pdev->revision); - pci_info = devm_kzalloc(&pdev->dev, sizeof(*pci_info), GFP_KERNEL); + pci_info = devm_kzalloc_obj(&pdev->dev, *pci_info); if (!pci_info) return -ENOMEM; pci_set_drvdata(pdev, pci_info); diff --git a/drivers/scsi/isci/probe_roms.c b/drivers/scsi/isci/probe_roms.c index a2bbe46f8ccb..cfcf6d430a2e 100644 --- a/drivers/scsi/isci/probe_roms.c +++ b/drivers/scsi/isci/probe_roms.c @@ -52,7 +52,7 @@ struct isci_orom *isci_request_oprom(struct pci_dev *pdev) return NULL; len = pci_biosrom_size(pdev); - rom = devm_kzalloc(&pdev->dev, sizeof(*rom), GFP_KERNEL); + rom = devm_kzalloc_obj(&pdev->dev, *rom); if (!rom) { pci_unmap_biosrom(oprom); dev_warn(&pdev->dev, diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index eb983b6d1815..8da75c4b50e5 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -456,7 +456,7 @@ static int qcom_slim_qmi_init(struct qcom_slim_ngd_ctrl *ctrl, struct qmi_handle *handle; int rc; - handle = devm_kzalloc(ctrl->dev, sizeof(*handle), GFP_KERNEL); + handle = devm_kzalloc_obj(ctrl->dev, *handle); if (!handle) return -ENOMEM; @@ -1673,7 +1673,7 @@ static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev) int ret; struct pdr_service *pds; - ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(dev, *ctrl); if (!ctrl) return -ENOMEM; diff --git a/drivers/soc/amlogic/meson-canvas.c b/drivers/soc/amlogic/meson-canvas.c index 79681afea8c6..124187fe0832 100644 --- a/drivers/soc/amlogic/meson-canvas.c +++ b/drivers/soc/amlogic/meson-canvas.c @@ -168,7 +168,7 @@ static int meson_canvas_probe(struct platform_device *pdev) struct meson_canvas *canvas; struct device *dev = &pdev->dev; - canvas = devm_kzalloc(dev, sizeof(*canvas), GFP_KERNEL); + canvas = devm_kzalloc_obj(dev, *canvas); if (!canvas) return -ENOMEM; diff --git a/drivers/soc/amlogic/meson-clk-measure.c b/drivers/soc/amlogic/meson-clk-measure.c index 33767f0bc67c..9e4d4d7d7162 100644 --- a/drivers/soc/amlogic/meson-clk-measure.c +++ b/drivers/soc/amlogic/meson-clk-measure.c @@ -2002,8 +2002,7 @@ static int meson_msr_probe(struct platform_device *pdev) void __iomem *base; int i; - priv = devm_kzalloc(&pdev->dev, sizeof(struct meson_msr), - GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct meson_msr); if (!priv) return -ENOMEM; @@ -2013,10 +2012,9 @@ static int meson_msr_probe(struct platform_device *pdev) return -ENODEV; } - priv->data.msr_table = devm_kcalloc(&pdev->dev, - match_data->msr_count, - sizeof(struct meson_msr_id), - GFP_KERNEL); + priv->data.msr_table = devm_kzalloc_objs(&pdev->dev, + struct meson_msr_id, + match_data->msr_count); if (!priv->data.msr_table) return -ENOMEM; @@ -2034,8 +2032,7 @@ static int meson_msr_probe(struct platform_device *pdev) if (IS_ERR(priv->regmap)) return PTR_ERR(priv->regmap); - priv->data.reg = devm_kzalloc(&pdev->dev, sizeof(struct msr_reg_offset), - GFP_KERNEL); + priv->data.reg = devm_kzalloc_obj(&pdev->dev, struct msr_reg_offset); if (!priv->data.reg) return -ENOMEM; diff --git a/drivers/soc/apple/apple-pmgr-misc.c b/drivers/soc/apple/apple-pmgr-misc.c index 7db29f7de329..4e6f9f24e719 100644 --- a/drivers/soc/apple/apple-pmgr-misc.c +++ b/drivers/soc/apple/apple-pmgr-misc.c @@ -116,7 +116,7 @@ static int apple_pmgr_misc_probe(struct platform_device *pdev) struct apple_pmgr_misc *misc; int ret; - misc = devm_kzalloc(dev, sizeof(*misc), GFP_KERNEL); + misc = devm_kzalloc_obj(dev, *misc); if (!misc) return -ENOMEM; diff --git a/drivers/soc/apple/mailbox.c b/drivers/soc/apple/mailbox.c index 5c48455185c9..9770ef4fb7b4 100644 --- a/drivers/soc/apple/mailbox.c +++ b/drivers/soc/apple/mailbox.c @@ -338,7 +338,7 @@ static int apple_mbox_probe(struct platform_device *pdev) struct apple_mbox *mbox; struct device *dev = &pdev->dev; - mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); + mbox = devm_kzalloc_obj(dev, *mbox); if (!mbox) return -ENOMEM; diff --git a/drivers/soc/apple/sart.c b/drivers/soc/apple/sart.c index 66b99955b395..520396e8bd17 100644 --- a/drivers/soc/apple/sart.c +++ b/drivers/soc/apple/sart.c @@ -183,7 +183,7 @@ static int apple_sart_probe(struct platform_device *pdev) struct apple_sart *sart; struct device *dev = &pdev->dev; - sart = devm_kzalloc(dev, sizeof(*sart), GFP_KERNEL); + sart = devm_kzalloc_obj(dev, *sart); if (!sart) return -ENOMEM; diff --git a/drivers/soc/apple/tunable.c b/drivers/soc/apple/tunable.c index 659323839171..10fa09a631c5 100644 --- a/drivers/soc/apple/tunable.c +++ b/drivers/soc/apple/tunable.c @@ -38,7 +38,7 @@ struct apple_tunable *devm_apple_tunable_parse(struct device *dev, return ERR_PTR(-EINVAL); sz = prop->length / (3 * sizeof(u32)); - tunable = devm_kzalloc(dev, struct_size(tunable, values, sz), GFP_KERNEL); + tunable = devm_kzalloc_flex(dev, *tunable, values, sz); if (!tunable) return ERR_PTR(-ENOMEM); tunable->sz = sz; diff --git a/drivers/soc/aspeed/aspeed-lpc-ctrl.c b/drivers/soc/aspeed/aspeed-lpc-ctrl.c index 4d8574cac703..5d91ba2038d5 100644 --- a/drivers/soc/aspeed/aspeed-lpc-ctrl.c +++ b/drivers/soc/aspeed/aspeed-lpc-ctrl.c @@ -231,7 +231,7 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev) dev = &pdev->dev; - lpc_ctrl = devm_kzalloc(dev, sizeof(*lpc_ctrl), GFP_KERNEL); + lpc_ctrl = devm_kzalloc_obj(dev, *lpc_ctrl); if (!lpc_ctrl) return -ENOMEM; diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c index b09dca34099f..99fca2cbb9b3 100644 --- a/drivers/soc/aspeed/aspeed-lpc-snoop.c +++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c @@ -314,7 +314,7 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev) dev = &pdev->dev; - lpc_snoop = devm_kzalloc(dev, sizeof(*lpc_snoop), GFP_KERNEL); + lpc_snoop = devm_kzalloc_obj(dev, *lpc_snoop); if (!lpc_snoop) return -ENOMEM; diff --git a/drivers/soc/aspeed/aspeed-p2a-ctrl.c b/drivers/soc/aspeed/aspeed-p2a-ctrl.c index b6b7b80f842a..efa106d37bd7 100644 --- a/drivers/soc/aspeed/aspeed-p2a-ctrl.c +++ b/drivers/soc/aspeed/aspeed-p2a-ctrl.c @@ -338,7 +338,7 @@ static int aspeed_p2a_ctrl_probe(struct platform_device *pdev) dev = &pdev->dev; - misc_ctrl = devm_kzalloc(dev, sizeof(*misc_ctrl), GFP_KERNEL); + misc_ctrl = devm_kzalloc_obj(dev, *misc_ctrl); if (!misc_ctrl) return -ENOMEM; diff --git a/drivers/soc/aspeed/aspeed-uart-routing.c b/drivers/soc/aspeed/aspeed-uart-routing.c index b4b521b5ddf1..3b3f18b00968 100644 --- a/drivers/soc/aspeed/aspeed-uart-routing.c +++ b/drivers/soc/aspeed/aspeed-uart-routing.c @@ -542,7 +542,7 @@ static int aspeed_uart_routing_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct aspeed_uart_routing *uart_routing; - uart_routing = devm_kzalloc(&pdev->dev, sizeof(*uart_routing), GFP_KERNEL); + uart_routing = devm_kzalloc_obj(&pdev->dev, *uart_routing); if (!uart_routing) return -ENOMEM; diff --git a/drivers/soc/atmel/sfr.c b/drivers/soc/atmel/sfr.c index cc94ca1b494c..badd7c550fa5 100644 --- a/drivers/soc/atmel/sfr.c +++ b/drivers/soc/atmel/sfr.c @@ -47,7 +47,7 @@ static int atmel_sfr_probe(struct platform_device *pdev) u8 sn[SFR_SN_SIZE]; int ret; - priv = devm_kmalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kmalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/soc/cirrus/soc-ep93xx.c b/drivers/soc/cirrus/soc-ep93xx.c index d55cf28ed726..5f6820925040 100644 --- a/drivers/soc/cirrus/soc-ep93xx.c +++ b/drivers/soc/cirrus/soc-ep93xx.c @@ -189,7 +189,7 @@ static int __init ep93xx_syscon_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - attrs = devm_kzalloc(dev, sizeof(*attrs), GFP_KERNEL); + attrs = devm_kzalloc_obj(dev, *attrs); if (!attrs) return -ENOMEM; @@ -203,7 +203,7 @@ static int __init ep93xx_syscon_probe(struct platform_device *pdev) if (IS_ERR(soc_dev)) return PTR_ERR(soc_dev); - map_info = devm_kzalloc(dev, sizeof(*map_info), GFP_KERNEL); + map_info = devm_kzalloc_obj(dev, *map_info); if (!map_info) return -ENOMEM; diff --git a/drivers/soc/fsl/dpio/dpio-driver.c b/drivers/soc/fsl/dpio/dpio-driver.c index d8f28fb7c37a..3534453047f6 100644 --- a/drivers/soc/fsl/dpio/dpio-driver.c +++ b/drivers/soc/fsl/dpio/dpio-driver.c @@ -125,7 +125,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) int possible_next_cpu; int sdest; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) goto err_priv_alloc; diff --git a/drivers/soc/fsl/qbman/bman_portal.c b/drivers/soc/fsl/qbman/bman_portal.c index 4d7b9caee1c4..046034a7cba3 100644 --- a/drivers/soc/fsl/qbman/bman_portal.c +++ b/drivers/soc/fsl/qbman/bman_portal.c @@ -110,7 +110,7 @@ static int bman_portal_probe(struct platform_device *pdev) return -ENODEV; } - pcfg = devm_kmalloc(dev, sizeof(*pcfg), GFP_KERNEL); + pcfg = devm_kmalloc_obj(dev, *pcfg); if (!pcfg) { __bman_portals_probed = -1; return -ENOMEM; diff --git a/drivers/soc/fsl/qbman/dpaa_sys.c b/drivers/soc/fsl/qbman/dpaa_sys.c index e1d7b79cc450..3504ff557231 100644 --- a/drivers/soc/fsl/qbman/dpaa_sys.c +++ b/drivers/soc/fsl/qbman/dpaa_sys.c @@ -69,7 +69,7 @@ int qbman_init_private_mem(struct device *dev, int idx, const char *compat, if (!of_property_present(mem_node, "reg")) { struct property *prop; - prop = devm_kzalloc(dev, sizeof(*prop), GFP_KERNEL); + prop = devm_kzalloc_obj(dev, *prop); if (!prop) return -ENOMEM; prop->value = res_array = devm_kzalloc(dev, sizeof(__be32) * 4, diff --git a/drivers/soc/fsl/qbman/qman_portal.c b/drivers/soc/fsl/qbman/qman_portal.c index 456ef5d5c199..d2063a86866a 100644 --- a/drivers/soc/fsl/qbman/qman_portal.c +++ b/drivers/soc/fsl/qbman/qman_portal.c @@ -196,7 +196,7 @@ static int qman_portal_probe(struct platform_device *pdev) return -ENODEV; } - pcfg = devm_kmalloc(dev, sizeof(*pcfg), GFP_KERNEL); + pcfg = devm_kmalloc_obj(dev, *pcfg); if (!pcfg) { __qman_portals_probed = -1; return -ENOMEM; diff --git a/drivers/soc/fsl/qe/gpio.c b/drivers/soc/fsl/qe/gpio.c index 1b5a1b134596..3fc1ff742279 100644 --- a/drivers/soc/fsl/qe/gpio.c +++ b/drivers/soc/fsl/qe/gpio.c @@ -330,7 +330,7 @@ static int qe_gpio_probe(struct platform_device *ofdev) struct qe_gpio_chip *qe_gc; struct gpio_chip *gc; - qe_gc = devm_kzalloc(dev, sizeof(*qe_gc), GFP_KERNEL); + qe_gc = devm_kzalloc_obj(dev, *qe_gc); if (!qe_gc) return -ENOMEM; qe_gc->np = np; diff --git a/drivers/soc/fsl/qe/qe_ic.c b/drivers/soc/fsl/qe/qe_ic.c index bccc7d612009..f9fc976a1dd4 100644 --- a/drivers/soc/fsl/qe/qe_ic.c +++ b/drivers/soc/fsl/qe/qe_ic.c @@ -414,7 +414,7 @@ static int qe_ic_init(struct platform_device *pdev) return -ENODEV; } - qe_ic = devm_kzalloc(dev, sizeof(*qe_ic), GFP_KERNEL); + qe_ic = devm_kzalloc_obj(dev, *qe_ic); if (qe_ic == NULL) return -ENOMEM; diff --git a/drivers/soc/fsl/qe/qe_ports_ic.c b/drivers/soc/fsl/qe/qe_ports_ic.c index fb3b92039547..14242dcddd36 100644 --- a/drivers/soc/fsl/qe/qe_ports_ic.c +++ b/drivers/soc/fsl/qe/qe_ports_ic.c @@ -151,7 +151,7 @@ static int qepic_probe(struct platform_device *pdev) struct irq_domain *domain; struct qepic_data *data; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; d_info.host_data = data; diff --git a/drivers/soc/fsl/qe/qmc.c b/drivers/soc/fsl/qe/qmc.c index 672adff8e35f..f17829fc0aad 100644 --- a/drivers/soc/fsl/qe/qmc.c +++ b/drivers/soc/fsl/qe/qmc.c @@ -1301,7 +1301,7 @@ static int qmc_of_parse_chans(struct qmc *qmc, struct device_node *np) return -EINVAL; } - chan = devm_kzalloc(qmc->dev, sizeof(*chan), GFP_KERNEL); + chan = devm_kzalloc_obj(qmc->dev, *chan); if (!chan) return -ENOMEM; @@ -1906,7 +1906,7 @@ static int qmc_probe(struct platform_device *pdev) int irq; int ret; - qmc = devm_kzalloc(&pdev->dev, sizeof(*qmc), GFP_KERNEL); + qmc = devm_kzalloc_obj(&pdev->dev, *qmc); if (!qmc) return -ENOMEM; diff --git a/drivers/soc/fsl/qe/tsa.c b/drivers/soc/fsl/qe/tsa.c index 502e2ffe8689..1bb4d3bc553b 100644 --- a/drivers/soc/fsl/qe/tsa.c +++ b/drivers/soc/fsl/qe/tsa.c @@ -972,7 +972,7 @@ static int tsa_probe(struct platform_device *pdev) unsigned int i; int ret; - tsa = devm_kzalloc(&pdev->dev, sizeof(*tsa), GFP_KERNEL); + tsa = devm_kzalloc_obj(&pdev->dev, *tsa); if (!tsa) return -ENOMEM; diff --git a/drivers/soc/fsl/rcpm.c b/drivers/soc/fsl/rcpm.c index 06bd94b29fb3..7a613b691684 100644 --- a/drivers/soc/fsl/rcpm.c +++ b/drivers/soc/fsl/rcpm.c @@ -150,7 +150,7 @@ static int rcpm_probe(struct platform_device *pdev) struct rcpm *rcpm; int ret; - rcpm = devm_kzalloc(dev, sizeof(*rcpm), GFP_KERNEL); + rcpm = devm_kzalloc_obj(dev, *rcpm); if (!rcpm) return -ENOMEM; diff --git a/drivers/soc/fujitsu/a64fx-diag.c b/drivers/soc/fujitsu/a64fx-diag.c index 76cb0b6a221c..aafbd7050cb5 100644 --- a/drivers/soc/fujitsu/a64fx-diag.c +++ b/drivers/soc/fujitsu/a64fx-diag.c @@ -79,7 +79,7 @@ static int a64fx_diag_probe(struct platform_device *pdev) unsigned long irq_flags; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (priv == NULL) return -ENOMEM; diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c index 0cc2953d59a5..3b9fa3a74abd 100644 --- a/drivers/soc/hisilicon/kunpeng_hccs.c +++ b/drivers/soc/hisilicon/kunpeng_hccs.c @@ -737,9 +737,9 @@ static int hccs_init_type_name_maps(struct hccs_dev *hdev) u16 idx = 0; hdev->used_type_num = hccs_calc_used_type_num(hdev, hccs_ver); - hdev->type_name_maps = devm_kcalloc(hdev->dev, hdev->used_type_num, - sizeof(struct hccs_type_name_map), - GFP_KERNEL); + hdev->type_name_maps = devm_kzalloc_objs(hdev->dev, + struct hccs_type_name_map, + hdev->used_type_num); if (!hdev->type_name_maps) return -ENOMEM; @@ -1741,7 +1741,7 @@ static int hccs_probe(struct platform_device *pdev) if (!acpi_dev) return -ENODEV; - hdev = devm_kzalloc(&pdev->dev, sizeof(*hdev), GFP_KERNEL); + hdev = devm_kzalloc_obj(&pdev->dev, *hdev); if (!hdev) return -ENOMEM; hdev->acpi_dev = acpi_dev; diff --git a/drivers/soc/imx/soc-imx8m.c b/drivers/soc/imx/soc-imx8m.c index fc080e56f50d..f0929916f042 100644 --- a/drivers/soc/imx/soc-imx8m.c +++ b/drivers/soc/imx/soc-imx8m.c @@ -231,11 +231,11 @@ static int imx8m_soc_probe(struct platform_device *pdev) u64 soc_uid[2] = {0, 0}; int ret; - soc_dev_attr = devm_kzalloc(dev, sizeof(*soc_dev_attr), GFP_KERNEL); + soc_dev_attr = devm_kzalloc_obj(dev, *soc_dev_attr); if (!soc_dev_attr) return -ENOMEM; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/soc/imx/soc-imx9.c b/drivers/soc/imx/soc-imx9.c index 23b54b7d7502..cc8f3b7d39e6 100644 --- a/drivers/soc/imx/soc-imx9.c +++ b/drivers/soc/imx/soc-imx9.c @@ -26,7 +26,7 @@ static int imx9_soc_probe(struct platform_device *pdev) u64 uid127_64, uid63_0; int err; - attr = devm_kzalloc(dev, sizeof(*attr), GFP_KERNEL); + attr = devm_kzalloc_obj(dev, *attr); if (!attr) return -ENOMEM; diff --git a/drivers/soc/litex/litex_soc_ctrl.c b/drivers/soc/litex/litex_soc_ctrl.c index 104a5f9bfd26..6a2bd4cbc0ce 100644 --- a/drivers/soc/litex/litex_soc_ctrl.c +++ b/drivers/soc/litex/litex_soc_ctrl.c @@ -90,7 +90,7 @@ static int litex_soc_ctrl_probe(struct platform_device *pdev) struct litex_soc_ctrl_device *soc_ctrl_dev; int error; - soc_ctrl_dev = devm_kzalloc(&pdev->dev, sizeof(*soc_ctrl_dev), GFP_KERNEL); + soc_ctrl_dev = devm_kzalloc_obj(&pdev->dev, *soc_ctrl_dev); if (!soc_ctrl_dev) return -ENOMEM; diff --git a/drivers/soc/loongson/loongson2_guts.c b/drivers/soc/loongson/loongson2_guts.c index a2f2c1e119fe..b28d101eb110 100644 --- a/drivers/soc/loongson/loongson2_guts.c +++ b/drivers/soc/loongson/loongson2_guts.c @@ -99,7 +99,7 @@ static int loongson2_guts_probe(struct platform_device *pdev) u32 svr; /* Initialize guts */ - guts = devm_kzalloc(dev, sizeof(*guts), GFP_KERNEL); + guts = devm_kzalloc_obj(dev, *guts); if (!guts) return -ENOMEM; diff --git a/drivers/soc/mediatek/mtk-devapc.c b/drivers/soc/mediatek/mtk-devapc.c index f54c966138b5..aaa3c800fe35 100644 --- a/drivers/soc/mediatek/mtk-devapc.c +++ b/drivers/soc/mediatek/mtk-devapc.c @@ -261,7 +261,7 @@ static int mtk_devapc_probe(struct platform_device *pdev) if (IS_ERR(node)) return -ENODEV; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/soc/mediatek/mtk-dvfsrc.c b/drivers/soc/mediatek/mtk-dvfsrc.c index e8cdee8aed35..c691a895c92c 100644 --- a/drivers/soc/mediatek/mtk-dvfsrc.c +++ b/drivers/soc/mediatek/mtk-dvfsrc.c @@ -520,12 +520,11 @@ static int dvfsrc_get_hw_opps_v4(struct mtk_dvfsrc *dvfsrc) num_opps, num_vcore, num_dram, num_emi); /* Allocate everything now as anything else after that cannot fail */ - desc = devm_kzalloc(dvfsrc->dev, sizeof(*desc), GFP_KERNEL); + desc = devm_kzalloc_obj(dvfsrc->dev, *desc); if (!desc) return -ENOMEM; - dvfsrc_opps = devm_kcalloc(dvfsrc->dev, num_opps + 1, - sizeof(*dvfsrc_opps), GFP_KERNEL); + dvfsrc_opps = devm_kzalloc_objs(dvfsrc->dev, *dvfsrc_opps, num_opps + 1); if (!dvfsrc_opps) return -ENOMEM; @@ -653,7 +652,7 @@ static int mtk_dvfsrc_probe(struct platform_device *pdev) struct mtk_dvfsrc *dvfsrc; int ret; - dvfsrc = devm_kzalloc(&pdev->dev, sizeof(*dvfsrc), GFP_KERNEL); + dvfsrc = devm_kzalloc_obj(&pdev->dev, *dvfsrc); if (!dvfsrc) return -ENOMEM; diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c index 2f3e0778bb17..bfcd93830856 100644 --- a/drivers/soc/mediatek/mtk-mmsys.c +++ b/drivers/soc/mediatek/mtk-mmsys.c @@ -394,7 +394,7 @@ static int mtk_mmsys_probe(struct platform_device *pdev) struct mtk_mmsys *mmsys; int ret; - mmsys = devm_kzalloc(dev, sizeof(*mmsys), GFP_KERNEL); + mmsys = devm_kzalloc_obj(dev, *mmsys); if (!mmsys) return -ENOMEM; diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mutex.c index eb5d381ff5af..6d4e475cb92d 100644 --- a/drivers/soc/mediatek/mtk-mutex.c +++ b/drivers/soc/mediatek/mtk-mutex.c @@ -1098,7 +1098,7 @@ static int mtk_mutex_probe(struct platform_device *pdev) struct resource *regs; int i, ret; - mtx = devm_kzalloc(dev, sizeof(*mtx), GFP_KERNEL); + mtx = devm_kzalloc_obj(dev, *mtx); if (!mtx) return -ENOMEM; diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c index 0bcd85826375..90677187c3b5 100644 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c @@ -2480,7 +2480,7 @@ static int pwrap_probe(struct platform_device *pdev) return -EINVAL; } - wrp = devm_kzalloc(&pdev->dev, sizeof(*wrp), GFP_KERNEL); + wrp = devm_kzalloc_obj(&pdev->dev, *wrp); if (!wrp) return -ENOMEM; diff --git a/drivers/soc/mediatek/mtk-socinfo.c b/drivers/soc/mediatek/mtk-socinfo.c index e294730ba709..cd14706c2f28 100644 --- a/drivers/soc/mediatek/mtk-socinfo.c +++ b/drivers/soc/mediatek/mtk-socinfo.c @@ -72,7 +72,7 @@ static int mtk_socinfo_create_socinfo_node(struct mtk_socinfo *mtk_socinfop) struct socinfo_data *data = mtk_socinfop->socinfo_data; static const char *soc_manufacturer = "MediaTek"; - attrs = devm_kzalloc(mtk_socinfop->dev, sizeof(*attrs), GFP_KERNEL); + attrs = devm_kzalloc_obj(mtk_socinfop->dev, *attrs); if (!attrs) return -ENOMEM; @@ -177,7 +177,7 @@ static int mtk_socinfo_probe(struct platform_device *pdev) struct mtk_socinfo *mtk_socinfop; int ret; - mtk_socinfop = devm_kzalloc(&pdev->dev, sizeof(*mtk_socinfop), GFP_KERNEL); + mtk_socinfop = devm_kzalloc_obj(&pdev->dev, *mtk_socinfop); if (!mtk_socinfop) return -ENOMEM; diff --git a/drivers/soc/mediatek/mtk-svs.c b/drivers/soc/mediatek/mtk-svs.c index 99edecb204f2..0f37b3aadaa2 100644 --- a/drivers/soc/mediatek/mtk-svs.c +++ b/drivers/soc/mediatek/mtk-svs.c @@ -1783,7 +1783,7 @@ static int svs_bank_resource_setup(struct svs_platform *svsp) return -EINVAL; } - svsb->dev = devm_kzalloc(svsp->dev, sizeof(*svsb->dev), GFP_KERNEL); + svsb->dev = devm_kzalloc_obj(svsp->dev, *svsb->dev); if (!svsb->dev) return -ENOMEM; @@ -2844,7 +2844,7 @@ static int svs_probe(struct platform_device *pdev) svsp_data = of_device_get_match_data(&pdev->dev); - svsp = devm_kzalloc(&pdev->dev, sizeof(*svsp), GFP_KERNEL); + svsp = devm_kzalloc_obj(&pdev->dev, *svsp); if (!svsp) return -ENOMEM; diff --git a/drivers/soc/pxa/ssp.c b/drivers/soc/pxa/ssp.c index bb0062c165fe..91ed3c110ec5 100644 --- a/drivers/soc/pxa/ssp.c +++ b/drivers/soc/pxa/ssp.c @@ -114,7 +114,7 @@ static int pxa_ssp_probe(struct platform_device *pdev) struct ssp_device *ssp; struct device *dev = &pdev->dev; - ssp = devm_kzalloc(dev, sizeof(struct ssp_device), GFP_KERNEL); + ssp = devm_kzalloc_obj(dev, struct ssp_device); if (ssp == NULL) return -ENOMEM; diff --git a/drivers/soc/qcom/apr.c b/drivers/soc/qcom/apr.c index 2d5645ff9919..028e57bfae1e 100644 --- a/drivers/soc/qcom/apr.c +++ b/drivers/soc/qcom/apr.c @@ -583,7 +583,7 @@ static int apr_probe(struct rpmsg_device *rpdev) struct packet_router *apr; int ret; - apr = devm_kzalloc(dev, sizeof(*apr), GFP_KERNEL); + apr = devm_kzalloc_obj(dev, *apr); if (!apr) return -ENOMEM; diff --git a/drivers/soc/qcom/icc-bwmon.c b/drivers/soc/qcom/icc-bwmon.c index 597f9025e422..1ee9f5ce35cd 100644 --- a/drivers/soc/qcom/icc-bwmon.c +++ b/drivers/soc/qcom/icc-bwmon.c @@ -757,7 +757,7 @@ static int bwmon_probe(struct platform_device *pdev) struct icc_bwmon *bwmon; int ret; - bwmon = devm_kzalloc(dev, sizeof(*bwmon), GFP_KERNEL); + bwmon = devm_kzalloc_obj(dev, *bwmon); if (!bwmon) return -ENOMEM; diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c index e256595b9826..f9ac45505908 100644 --- a/drivers/soc/qcom/ice.c +++ b/drivers/soc/qcom/ice.c @@ -573,7 +573,7 @@ static struct qcom_ice *qcom_ice_create(struct device *dev, return ERR_PTR(-EOPNOTSUPP); } - engine = devm_kzalloc(dev, sizeof(*engine), GFP_KERNEL); + engine = devm_kzalloc_obj(dev, *engine); if (!engine) return ERR_PTR(-ENOMEM); diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c index d7a42a8040a1..623765421f07 100644 --- a/drivers/soc/qcom/llcc-qcom.c +++ b/drivers/soc/qcom/llcc-qcom.c @@ -5628,8 +5628,7 @@ static int qcom_llcc_get_fw_config(struct platform_device *pdev) sz = le32_to_cpu(slc_mem->slice_descs_count); - drv_data->desc = devm_kcalloc(dev, sz, sizeof(struct llcc_slice_desc), - GFP_KERNEL); + drv_data->desc = devm_kzalloc_objs(dev, struct llcc_slice_desc, sz); if (!drv_data->desc) return -ENOMEM; @@ -5688,7 +5687,7 @@ static int qcom_llcc_probe(struct platform_device *pdev) if (!IS_ERR(drv_data)) return -EBUSY; - drv_data = devm_kzalloc(dev, sizeof(*drv_data), GFP_KERNEL); + drv_data = devm_kzalloc_obj(dev, *drv_data); if (!drv_data) { ret = -ENOMEM; goto err; @@ -5724,7 +5723,8 @@ static int qcom_llcc_probe(struct platform_device *pdev) drv_data->num_banks = num_banks; - drv_data->regmaps = devm_kcalloc(dev, num_banks, sizeof(*drv_data->regmaps), GFP_KERNEL); + drv_data->regmaps = devm_kzalloc_objs(dev, *drv_data->regmaps, + num_banks); if (!drv_data->regmaps) { ret = -ENOMEM; goto err; @@ -5781,8 +5781,8 @@ static int qcom_llcc_probe(struct platform_device *pdev) } else { drv_data->cfg = cfg->sct_data; drv_data->cfg_size = cfg->size; - drv_data->desc = devm_kcalloc(dev, cfg->size, - sizeof(struct llcc_slice_desc), GFP_KERNEL); + drv_data->desc = devm_kzalloc_objs(dev, struct llcc_slice_desc, + cfg->size); if (!drv_data->desc) { ret = -ENOMEM; diff --git a/drivers/soc/qcom/ocmem.c b/drivers/soc/qcom/ocmem.c index 96ca0b87bfc4..6857701e8be1 100644 --- a/drivers/soc/qcom/ocmem.c +++ b/drivers/soc/qcom/ocmem.c @@ -300,7 +300,7 @@ static int ocmem_dev_probe(struct platform_device *pdev) if (!qcom_scm_is_available()) return -EPROBE_DEFER; - ocmem = devm_kzalloc(dev, sizeof(*ocmem), GFP_KERNEL); + ocmem = devm_kzalloc_obj(dev, *ocmem); if (!ocmem) return -ENOMEM; @@ -369,8 +369,8 @@ static int ocmem_dev_probe(struct platform_device *pdev) ocmem->num_ports, ocmem->config->num_regions, ocmem->num_macros, ocmem->interleaved ? "" : "not "); - ocmem->regions = devm_kcalloc(dev, ocmem->config->num_regions, - sizeof(struct ocmem_region), GFP_KERNEL); + ocmem->regions = devm_kzalloc_objs(dev, struct ocmem_region, + ocmem->config->num_regions); if (!ocmem->regions) { ret = -ENOMEM; goto err_clk_disable; diff --git a/drivers/soc/qcom/pmic_glink.c b/drivers/soc/qcom/pmic_glink.c index 84fd0c82c0c4..0e354fcd87c9 100644 --- a/drivers/soc/qcom/pmic_glink.c +++ b/drivers/soc/qcom/pmic_glink.c @@ -303,7 +303,7 @@ static int pmic_glink_probe(struct platform_device *pdev) struct pmic_glink *pg; int ret; - pg = devm_kzalloc(&pdev->dev, sizeof(*pg), GFP_KERNEL); + pg = devm_kzalloc_obj(&pdev->dev, *pg); if (!pg) return -ENOMEM; diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c index 465e5d2316a0..9fd077737e9f 100644 --- a/drivers/soc/qcom/pmic_glink_altmode.c +++ b/drivers/soc/qcom/pmic_glink_altmode.c @@ -577,7 +577,7 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev, u32 port; int ret; - altmode = devm_kzalloc(dev, sizeof(*altmode), GFP_KERNEL); + altmode = devm_kzalloc_obj(dev, *altmode); if (!altmode) return -ENOMEM; diff --git a/drivers/soc/qcom/pmic_pdcharger_ulog.c b/drivers/soc/qcom/pmic_pdcharger_ulog.c index 06cd9c4411c2..105a12458d6b 100644 --- a/drivers/soc/qcom/pmic_pdcharger_ulog.c +++ b/drivers/soc/qcom/pmic_pdcharger_ulog.c @@ -125,7 +125,7 @@ static int pmic_pdcharger_ulog_rpmsg_probe(struct rpmsg_device *rpdev) struct pmic_pdcharger_ulog *pg; struct device *dev = &rpdev->dev; - pg = devm_kzalloc(dev, sizeof(*pg), GFP_KERNEL); + pg = devm_kzalloc_obj(dev, *pg); if (!pg) return -ENOMEM; diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c index 074087c592cc..f2efeca78b56 100644 --- a/drivers/soc/qcom/qcom-geni-se.c +++ b/drivers/soc/qcom/qcom-geni-se.c @@ -698,9 +698,8 @@ int geni_se_clk_tbl_get(struct geni_se *se, unsigned long **tbl) return se->num_clk_levels; } - se->clk_perf_tbl = devm_kcalloc(se->dev, MAX_CLK_PERF_LEVEL, - sizeof(*se->clk_perf_tbl), - GFP_KERNEL); + se->clk_perf_tbl = devm_kzalloc_objs(se->dev, *se->clk_perf_tbl, + MAX_CLK_PERF_LEVEL); if (!se->clk_perf_tbl) return -ENOMEM; @@ -1618,7 +1617,7 @@ static int geni_se_probe(struct platform_device *pdev) const struct geni_se_desc *desc; int ret; - wrapper = devm_kzalloc(dev, sizeof(*wrapper), GFP_KERNEL); + wrapper = devm_kzalloc_obj(dev, *wrapper); if (!wrapper) return -ENOMEM; diff --git a/drivers/soc/qcom/qcom-pbs.c b/drivers/soc/qcom/qcom-pbs.c index 06b4a596e275..aee447200aff 100644 --- a/drivers/soc/qcom/qcom-pbs.c +++ b/drivers/soc/qcom/qcom-pbs.c @@ -185,7 +185,7 @@ static int qcom_pbs_probe(struct platform_device *pdev) u32 val; int ret; - pbs = devm_kzalloc(&pdev->dev, sizeof(*pbs), GFP_KERNEL); + pbs = devm_kzalloc_obj(&pdev->dev, *pbs); if (!pbs) return -ENOMEM; diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c index a6b673cd7678..2d248c7bee0d 100644 --- a/drivers/soc/qcom/qcom_aoss.c +++ b/drivers/soc/qcom/qcom_aoss.c @@ -401,9 +401,8 @@ static int qmp_cooling_devices_register(struct qmp *qmp) np = qmp->dev->of_node; - qmp->cooling_devs = devm_kcalloc(qmp->dev, QMP_NUM_COOLING_RESOURCES, - sizeof(*qmp->cooling_devs), - GFP_KERNEL); + qmp->cooling_devs = devm_kzalloc_objs(qmp->dev, *qmp->cooling_devs, + QMP_NUM_COOLING_RESOURCES); if (!qmp->cooling_devs) return -ENOMEM; @@ -579,7 +578,7 @@ static int qmp_probe(struct platform_device *pdev) int irq; int ret; - qmp = devm_kzalloc(&pdev->dev, sizeof(*qmp), GFP_KERNEL); + qmp = devm_kzalloc_obj(&pdev->dev, *qmp); if (!qmp) return -ENOMEM; diff --git a/drivers/soc/qcom/qcom_gsbi.c b/drivers/soc/qcom/qcom_gsbi.c index a25d1de592f0..dfffd4c27c08 100644 --- a/drivers/soc/qcom/qcom_gsbi.c +++ b/drivers/soc/qcom/qcom_gsbi.c @@ -133,7 +133,7 @@ static int gsbi_probe(struct platform_device *pdev) u32 mask, gsbi_num; const struct crci_config *config = NULL; - gsbi = devm_kzalloc(&pdev->dev, sizeof(*gsbi), GFP_KERNEL); + gsbi = devm_kzalloc_obj(&pdev->dev, *gsbi); if (!gsbi) return -ENOMEM; diff --git a/drivers/soc/qcom/qcom_stats.c b/drivers/soc/qcom/qcom_stats.c index 3422d6df7b51..af40b2ec49be 100644 --- a/drivers/soc/qcom/qcom_stats.c +++ b/drivers/soc/qcom/qcom_stats.c @@ -311,8 +311,7 @@ static int qcom_stats_probe(struct platform_device *pdev) if (IS_ERR(reg)) return -ENOMEM; - d = devm_kcalloc(&pdev->dev, config->num_records, - sizeof(*d), GFP_KERNEL); + d = devm_kzalloc_objs(&pdev->dev, *d, config->num_records); if (!d) return -ENOMEM; diff --git a/drivers/soc/qcom/qmi_tmd.c b/drivers/soc/qcom/qmi_tmd.c index d72fa75c3217..0d7f60910934 100644 --- a/drivers/soc/qcom/qmi_tmd.c +++ b/drivers/soc/qcom/qmi_tmd.c @@ -535,7 +535,7 @@ struct qmi_tmd_client *qmi_tmd_init(struct device *dev, if (!dev || !tmd_names || num_tmds <= 0) return ERR_PTR(-EINVAL); - qmi_tmd_cli = devm_kzalloc(dev, struct_size(qmi_tmd_cli, tmds, num_tmds), GFP_KERNEL); + qmi_tmd_cli = devm_kzalloc_flex(dev, *qmi_tmd_cli, tmds, num_tmds); if (!qmi_tmd_cli) return ERR_PTR(-ENOMEM); diff --git a/drivers/soc/qcom/ramp_controller.c b/drivers/soc/qcom/ramp_controller.c index 15782bed2925..c93842a31493 100644 --- a/drivers/soc/qcom/ramp_controller.c +++ b/drivers/soc/qcom/ramp_controller.c @@ -290,7 +290,7 @@ static int qcom_ramp_controller_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - qrc = devm_kmalloc(&pdev->dev, sizeof(*qrc), GFP_KERNEL); + qrc = devm_kmalloc_obj(&pdev->dev, *qrc); if (!qrc) return -ENOMEM; diff --git a/drivers/soc/qcom/rpm_master_stats.c b/drivers/soc/qcom/rpm_master_stats.c index c7788337e164..df3c10f08ea3 100644 --- a/drivers/soc/qcom/rpm_master_stats.c +++ b/drivers/soc/qcom/rpm_master_stats.c @@ -78,7 +78,7 @@ static int master_stats_probe(struct platform_device *pdev) if (count < 0) return count; - data = devm_kcalloc(dev, count, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_objs(dev, *data, count); if (!data) return -ENOMEM; diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index c4542318eac4..aa4b722c0a87 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -1068,7 +1068,7 @@ static int rpmh_rsc_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, ret, "Command DB not available\n"); - drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(&pdev->dev, *drv); if (!drv) return -ENOMEM; diff --git a/drivers/soc/qcom/smd-rpm.c b/drivers/soc/qcom/smd-rpm.c index f2b3e02abdf1..7037d9845d98 100644 --- a/drivers/soc/qcom/smd-rpm.c +++ b/drivers/soc/qcom/smd-rpm.c @@ -196,7 +196,7 @@ static int qcom_smd_rpm_probe(struct rpmsg_device *rpdev) { struct qcom_smd_rpm *rpm; - rpm = devm_kzalloc(&rpdev->dev, sizeof(*rpm), GFP_KERNEL); + rpm = devm_kzalloc_obj(&rpdev->dev, *rpm); if (!rpm) return -ENOMEM; diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index b5e7bd8c1512..c394a63e8562 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -1061,7 +1061,7 @@ qcom_smem_enumerate_partitions(struct qcom_smem *smem, u16 local_host) if (!header) return -EINVAL; - part = devm_kzalloc(smem->dev, sizeof(struct smem_partition), GFP_KERNEL); + part = devm_kzalloc_obj(smem->dev, struct smem_partition); if (!part) return -ENOMEM; @@ -1153,8 +1153,7 @@ static int qcom_smem_probe(struct platform_device *pdev) if (of_property_present(pdev->dev.of_node, "qcom,rpm-msg-ram")) num_regions++; - smem = devm_kzalloc(&pdev->dev, struct_size(smem, regions, num_regions), - GFP_KERNEL); + smem = devm_kzalloc_flex(&pdev->dev, *smem, regions, num_regions); if (!smem) return -ENOMEM; diff --git a/drivers/soc/qcom/smem_dramc.c b/drivers/soc/qcom/smem_dramc.c index 497513c95308..a1964faf2341 100644 --- a/drivers/soc/qcom/smem_dramc.c +++ b/drivers/soc/qcom/smem_dramc.c @@ -458,7 +458,7 @@ struct dentry *smem_dram_parse(struct qcom_smem *smem, struct device *dev) return ERR_PTR(-EINVAL); } - dram = devm_kzalloc(dev, sizeof(*dram), GFP_KERNEL); + dram = devm_kzalloc_obj(dev, *dram); if (!dram) return ERR_PTR(-ENOMEM); diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c index 01b8580c9f27..027c588ee467 100644 --- a/drivers/soc/qcom/smp2p.c +++ b/drivers/soc/qcom/smp2p.c @@ -627,7 +627,7 @@ static int qcom_smp2p_probe(struct platform_device *pdev) int irq; int ret; - smp2p = devm_kzalloc(&pdev->dev, sizeof(*smp2p), GFP_KERNEL); + smp2p = devm_kzalloc_obj(&pdev->dev, *smp2p); if (!smp2p) return -ENOMEM; @@ -676,7 +676,7 @@ static int qcom_smp2p_probe(struct platform_device *pdev) goto release_mbox; for_each_available_child_of_node_scoped(pdev->dev.of_node, node) { - entry = devm_kzalloc(&pdev->dev, sizeof(*entry), GFP_KERNEL); + entry = devm_kzalloc_obj(&pdev->dev, *entry); if (!entry) { ret = -ENOMEM; goto unwind_interfaces; diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c index bb487bf6bf03..f6b7266a5af0 100644 --- a/drivers/soc/qcom/smsm.c +++ b/drivers/soc/qcom/smsm.c @@ -509,7 +509,7 @@ static int qcom_smsm_probe(struct platform_device *pdev) u32 id; int ret; - smsm = devm_kzalloc(&pdev->dev, sizeof(*smsm), GFP_KERNEL); + smsm = devm_kzalloc_obj(&pdev->dev, *smsm); if (!smsm) return -ENOMEM; smsm->dev = &pdev->dev; @@ -519,17 +519,13 @@ static int qcom_smsm_probe(struct platform_device *pdev) if (ret) return ret; - smsm->entries = devm_kcalloc(&pdev->dev, - smsm->num_entries, - sizeof(struct smsm_entry), - GFP_KERNEL); + smsm->entries = devm_kzalloc_objs(&pdev->dev, struct smsm_entry, + smsm->num_entries); if (!smsm->entries) return -ENOMEM; - smsm->hosts = devm_kcalloc(&pdev->dev, - smsm->num_hosts, - sizeof(struct smsm_host), - GFP_KERNEL); + smsm->hosts = devm_kzalloc_objs(&pdev->dev, struct smsm_host, + smsm->num_hosts); if (!smsm->hosts) return -ENOMEM; diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index 38efc5db7fa8..b794ae3b18f5 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -908,7 +908,7 @@ static int qcom_socinfo_probe(struct platform_device *pdev) return PTR_ERR(info); } - qs = devm_kzalloc(&pdev->dev, sizeof(*qs), GFP_KERNEL); + qs = devm_kzalloc_obj(&pdev->dev, *qs); if (!qs) return -ENOMEM; diff --git a/drivers/soc/qcom/spm.c b/drivers/soc/qcom/spm.c index f75659fff287..2e10ab48f17b 100644 --- a/drivers/soc/qcom/spm.c +++ b/drivers/soc/qcom/spm.c @@ -425,7 +425,7 @@ static int spm_register_regulator(struct device *dev, struct spm_driver_data *dr if (!drv->reg_data->set_vdd) return 0; - rdesc = devm_kzalloc(dev, sizeof(*rdesc), GFP_KERNEL); + rdesc = devm_kzalloc_obj(dev, *rdesc); if (!rdesc) return -ENOMEM; @@ -511,7 +511,7 @@ static int spm_dev_probe(struct platform_device *pdev) struct spm_driver_data *drv; void __iomem *addr; - drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(&pdev->dev, *drv); if (!drv) return -ENOMEM; diff --git a/drivers/soc/qcom/wcnss_ctrl.c b/drivers/soc/qcom/wcnss_ctrl.c index 942e11feba65..358e9a152a4b 100644 --- a/drivers/soc/qcom/wcnss_ctrl.c +++ b/drivers/soc/qcom/wcnss_ctrl.c @@ -320,7 +320,7 @@ static int wcnss_ctrl_probe(struct rpmsg_device *rpdev) { struct wcnss_ctrl *wcnss; - wcnss = devm_kzalloc(&rpdev->dev, sizeof(*wcnss), GFP_KERNEL); + wcnss = devm_kzalloc_obj(&rpdev->dev, *wcnss); if (!wcnss) return -ENOMEM; diff --git a/drivers/soc/renesas/pwc-rzv2m.c b/drivers/soc/renesas/pwc-rzv2m.c index 6209168b3734..5f336035ee73 100644 --- a/drivers/soc/renesas/pwc-rzv2m.c +++ b/drivers/soc/renesas/pwc-rzv2m.c @@ -91,7 +91,7 @@ static int rzv2m_pwc_probe(struct platform_device *pdev) struct rzv2m_pwc_priv *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/soc/renesas/rcar-mfis.c b/drivers/soc/renesas/rcar-mfis.c index d5bbc3077373..821032d141d1 100644 --- a/drivers/soc/renesas/rcar-mfis.c +++ b/drivers/soc/renesas/rcar-mfis.c @@ -300,12 +300,11 @@ static int mfis_mb_probe(struct mfis_priv *priv) num_chan *= 2; } - chan = devm_kcalloc(dev, num_chan, sizeof(*chan), GFP_KERNEL); + chan = devm_kzalloc_objs(dev, *chan, num_chan); if (!chan) return -ENOMEM; - priv->chan_privs = devm_kcalloc(dev, num_chan, sizeof(*priv->chan_privs), - GFP_KERNEL); + priv->chan_privs = devm_kzalloc_objs(dev, *priv->chan_privs, num_chan); if (!priv->chan_privs) return -ENOMEM; @@ -357,7 +356,7 @@ static int mfis_probe(struct platform_device *pdev) struct mfis_priv *priv; int ret; - priv = devm_kzalloc(dev, struct_size(priv, bank.lock, MFIS_NUM_LOCKS), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, bank.lock, MFIS_NUM_LOCKS); if (!priv) return -ENOMEM; diff --git a/drivers/soc/renesas/rz-sysc.c b/drivers/soc/renesas/rz-sysc.c index 0e92c415d4be..987f826ef09d 100644 --- a/drivers/soc/renesas/rz-sysc.c +++ b/drivers/soc/renesas/rz-sysc.c @@ -46,7 +46,7 @@ static int rz_sysc_soc_init(struct rz_sysc *sysc, const struct of_device_id *mat size = sizeof(soc_id); strscpy(soc_id, soc_id_start, size); - soc_dev_attr = devm_kzalloc(sysc->dev, sizeof(*soc_dev_attr), GFP_KERNEL); + soc_dev_attr = devm_kzalloc_obj(sysc->dev, *soc_dev_attr); if (!soc_dev_attr) return -ENOMEM; @@ -124,7 +124,7 @@ static int rz_sysc_probe(struct platform_device *pdev) data = match->data; - sysc = devm_kzalloc(dev, sizeof(*sysc), GFP_KERNEL); + sysc = devm_kzalloc_obj(dev, *sysc); if (!sysc) return -ENOMEM; diff --git a/drivers/soc/rockchip/io-domain.c b/drivers/soc/rockchip/io-domain.c index f94985a905c2..91fe641298b2 100644 --- a/drivers/soc/rockchip/io-domain.c +++ b/drivers/soc/rockchip/io-domain.c @@ -619,7 +619,7 @@ static int rockchip_iodomain_probe(struct platform_device *pdev) if (!np) return -ENODEV; - iod = devm_kzalloc(&pdev->dev, sizeof(*iod), GFP_KERNEL); + iod = devm_kzalloc_obj(&pdev->dev, *iod); if (!iod) return -ENOMEM; diff --git a/drivers/soc/samsung/exynos-asv.c b/drivers/soc/samsung/exynos-asv.c index 8e681f519526..2279d7ddace6 100644 --- a/drivers/soc/samsung/exynos-asv.c +++ b/drivers/soc/samsung/exynos-asv.c @@ -125,7 +125,7 @@ int exynos_asv_init(struct device *dev, struct regmap *regmap) u32 product_id = 0; int ret, i; - asv = devm_kzalloc(dev, sizeof(*asv), GFP_KERNEL); + asv = devm_kzalloc_obj(dev, *asv); if (!asv) return -ENOMEM; diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c index 506a0bcdfe30..ad41691cfee8 100644 --- a/drivers/soc/samsung/exynos-chipid.c +++ b/drivers/soc/samsung/exynos-chipid.c @@ -180,7 +180,7 @@ static int exynos_chipid_probe(struct platform_device *pdev) if (ret < 0) return ret; - soc_dev_attr = devm_kzalloc(dev, sizeof(*soc_dev_attr), GFP_KERNEL); + soc_dev_attr = devm_kzalloc_obj(dev, *soc_dev_attr); if (!soc_dev_attr) return -ENOMEM; diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c index 702f7d21eda7..b4324c468557 100644 --- a/drivers/soc/samsung/exynos-pmu.c +++ b/drivers/soc/samsung/exynos-pmu.c @@ -527,8 +527,7 @@ static int exynos_pmu_probe(struct platform_device *pdev) if (IS_ERR(pmu_base_addr)) return PTR_ERR(pmu_base_addr); - ctx = devm_kzalloc(&pdev->dev, sizeof(struct exynos_pmu_context), - GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, struct exynos_pmu_context); if (!ctx) return -ENOMEM; diff --git a/drivers/soc/samsung/exynos-usi.c b/drivers/soc/samsung/exynos-usi.c index 5f7bdf3bab05..dd05c807629c 100644 --- a/drivers/soc/samsung/exynos-usi.c +++ b/drivers/soc/samsung/exynos-usi.c @@ -275,7 +275,7 @@ static int exynos_usi_get_clocks(struct exynos_usi *usi) if (num == 0) return 0; - usi->clks = devm_kcalloc(dev, num, sizeof(*usi->clks), GFP_KERNEL); + usi->clks = devm_kzalloc_objs(dev, *usi->clks, num); if (!usi->clks) return -ENOMEM; @@ -292,7 +292,7 @@ static int exynos_usi_probe(struct platform_device *pdev) struct exynos_usi *usi; int ret; - usi = devm_kzalloc(dev, sizeof(*usi), GFP_KERNEL); + usi = devm_kzalloc_obj(dev, *usi); if (!usi) return -ENOMEM; diff --git a/drivers/soc/starfive/socinfo/jhb100-socinfo.c b/drivers/soc/starfive/socinfo/jhb100-socinfo.c index 0a31cae9b4f5..38d2d2fa1871 100644 --- a/drivers/soc/starfive/socinfo/jhb100-socinfo.c +++ b/drivers/soc/starfive/socinfo/jhb100-socinfo.c @@ -51,7 +51,7 @@ static int jhb100_socinfo_probe(struct platform_device *pdev) if (ret) return dev_err_probe(dev, ret, "failed to read revision ID\n"); - attrs = devm_kzalloc(dev, sizeof(*attrs), GFP_KERNEL); + attrs = devm_kzalloc_obj(dev, *attrs); if (!attrs) return -ENOMEM; diff --git a/drivers/soc/tegra/cbb/tegra194-cbb.c b/drivers/soc/tegra/cbb/tegra194-cbb.c index be35ec0f39de..349db7a6186e 100644 --- a/drivers/soc/tegra/cbb/tegra194-cbb.c +++ b/drivers/soc/tegra/cbb/tegra194-cbb.c @@ -2204,8 +2204,8 @@ static int tegra194_cbb_get_bridges(struct tegra194_cbb *cbb, struct device_node if (!cbb->bridges) { cbb->num_bridges = of_address_count(np); - cbb->bridges = devm_kcalloc(cbb->base.dev, cbb->num_bridges, - sizeof(*cbb->bridges), GFP_KERNEL); + cbb->bridges = devm_kzalloc_objs(cbb->base.dev, *cbb->bridges, + cbb->num_bridges); if (!cbb->bridges) return -ENOMEM; @@ -2254,7 +2254,7 @@ static int tegra194_cbb_probe(struct platform_device *pdev) } } - cbb = devm_kzalloc(&pdev->dev, sizeof(*cbb), GFP_KERNEL); + cbb = devm_kzalloc_obj(&pdev->dev, *cbb); if (!cbb) return -ENOMEM; diff --git a/drivers/soc/tegra/cbb/tegra234-cbb.c b/drivers/soc/tegra/cbb/tegra234-cbb.c index 785072fa4e85..947fdb37ab95 100644 --- a/drivers/soc/tegra/cbb/tegra234-cbb.c +++ b/drivers/soc/tegra/cbb/tegra234-cbb.c @@ -1702,7 +1702,7 @@ static int tegra234_cbb_probe(struct platform_device *pdev) } } - cbb = devm_kzalloc(&pdev->dev, sizeof(*cbb), GFP_KERNEL); + cbb = devm_kzalloc_obj(&pdev->dev, *cbb); if (!cbb) return -ENOMEM; diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index a24ac7d71d23..721e9596b07d 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -1465,7 +1465,7 @@ static int tegra_pmc_core_pd_add(struct tegra_pmc *pmc, struct device_node *np) struct tegra_pmc_core_pd *pd; int err; - pd = devm_kzalloc(pmc->dev, sizeof(*pd), GFP_KERNEL); + pd = devm_kzalloc_obj(pmc->dev, *pd); if (!pd) return -ENOMEM; @@ -2698,7 +2698,7 @@ tegra_pmc_clk_out_register(struct tegra_pmc *pmc, struct clk_init_data init = {}; struct pmc_clk *pmc_clk; - pmc_clk = devm_kzalloc(pmc->dev, sizeof(*pmc_clk), GFP_KERNEL); + pmc_clk = devm_kzalloc_obj(pmc->dev, *pmc_clk); if (!pmc_clk) return ERR_PTR(-ENOMEM); @@ -2756,7 +2756,7 @@ tegra_pmc_clk_gate_register(struct tegra_pmc *pmc, const char *name, struct clk_init_data init = {}; struct pmc_clk_gate *gate; - gate = devm_kzalloc(pmc->dev, sizeof(*gate), GFP_KERNEL); + gate = devm_kzalloc_obj(pmc->dev, *gate); if (!gate) return ERR_PTR(-ENOMEM); @@ -2789,12 +2789,12 @@ static void tegra_pmc_clock_register(struct tegra_pmc *pmc, if (!num_clks) return; - clk_data = devm_kmalloc(pmc->dev, sizeof(*clk_data), GFP_KERNEL); + clk_data = devm_kmalloc_obj(pmc->dev, *clk_data); if (!clk_data) return; - clk_data->clks = devm_kcalloc(pmc->dev, TEGRA_PMC_CLK_MAX, - sizeof(*clk_data->clks), GFP_KERNEL); + clk_data->clks = devm_kzalloc_objs(pmc->dev, *clk_data->clks, + TEGRA_PMC_CLK_MAX); if (!clk_data->clks) return; @@ -3009,7 +3009,7 @@ static int tegra_pmc_probe(struct platform_device *pdev) return -ENODEV; #endif - pmc = devm_kzalloc(&pdev->dev, sizeof(*pmc), GFP_KERNEL); + pmc = devm_kzalloc_obj(&pdev->dev, *pmc); if (!pmc) return -ENOMEM; diff --git a/drivers/soc/ti/k3-ringacc.c b/drivers/soc/ti/k3-ringacc.c index 5966db4327b1..8c5f685e10f6 100644 --- a/drivers/soc/ti/k3-ringacc.c +++ b/drivers/soc/ti/k3-ringacc.c @@ -1469,7 +1469,7 @@ struct k3_ringacc *k3_ringacc_dmarings_init(struct platform_device *pdev, void __iomem *base_rt; int i; - ringacc = devm_kzalloc(dev, sizeof(*ringacc), GFP_KERNEL); + ringacc = devm_kzalloc_obj(dev, *ringacc); if (!ringacc) return ERR_PTR(-ENOMEM); @@ -1531,7 +1531,7 @@ static int k3_ringacc_probe(struct platform_device *pdev) if (!match_data) return -ENODEV; - ringacc = devm_kzalloc(dev, sizeof(*ringacc), GFP_KERNEL); + ringacc = devm_kzalloc_obj(dev, *ringacc); if (!ringacc) return -ENOMEM; diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c index 96df3982e47b..8b587df224e9 100644 --- a/drivers/soc/ti/knav_dma.c +++ b/drivers/soc/ti/knav_dma.c @@ -566,7 +566,7 @@ static int pktdma_init_chan(struct knav_dma_device *dma, struct knav_dma_chan *chan; int ret = -EINVAL; - chan = devm_kzalloc(dev, sizeof(*chan), GFP_KERNEL); + chan = devm_kzalloc_obj(dev, *chan); if (!chan) return -ENOMEM; @@ -601,7 +601,7 @@ static int dma_init(struct device_node *cloud, struct device_node *dma_node) u32 timeout; u32 i; - dma = devm_kzalloc(kdev->dev, sizeof(*dma), GFP_KERNEL); + dma = devm_kzalloc_obj(kdev->dev, *dma); if (!dma) { dev_err(kdev->dev, "could not allocate driver mem\n"); return -ENOMEM; @@ -705,8 +705,7 @@ static int knav_dma_probe(struct platform_device *pdev) if (!node) return dev_err_probe(dev, -EINVAL, "could not find device info\n"); - kdev = devm_kzalloc(dev, - sizeof(struct knav_dma_pool_device), GFP_KERNEL); + kdev = devm_kzalloc_obj(dev, struct knav_dma_pool_device); if (!kdev) return -ENOMEM; diff --git a/drivers/soc/ti/knav_qmss_acc.c b/drivers/soc/ti/knav_qmss_acc.c index 1f8b5acdd462..261ae82d5e7e 100644 --- a/drivers/soc/ti/knav_qmss_acc.c +++ b/drivers/soc/ti/knav_qmss_acc.c @@ -397,8 +397,7 @@ static int knav_acc_init_queue(struct knav_range_info *range, { unsigned id = kq->id - range->queue_base; - kq->descs = devm_kcalloc(range->kdev->dev, - ACC_DESCS_MAX, sizeof(u32), GFP_KERNEL); + kq->descs = devm_kzalloc_objs(range->kdev->dev, u32, ACC_DESCS_MAX); if (!kq->descs) return -ENOMEM; @@ -544,8 +543,7 @@ int knav_init_acc_range(struct knav_device *kdev, info->list_size = list_size; mem_size = PAGE_ALIGN(list_size * 2); info->mem_size = mem_size; - range->acc = devm_kcalloc(kdev->dev, channels, sizeof(*range->acc), - GFP_KERNEL); + range->acc = devm_kzalloc_objs(kdev->dev, *range->acc, channels); if (!range->acc) return -ENOMEM; diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c index 6186454dff51..e86fed21fae0 100644 --- a/drivers/soc/ti/knav_qmss_queue.c +++ b/drivers/soc/ti/knav_qmss_queue.c @@ -217,7 +217,7 @@ static struct knav_queue *__knav_queue_open(struct knav_queue_inst *inst, unsigned id; int ret = 0; - qh = devm_kzalloc(inst->kdev->dev, sizeof(*qh), GFP_KERNEL); + qh = devm_kzalloc_obj(inst->kdev->dev, *qh); if (!qh) return ERR_PTR(-ENOMEM); @@ -765,7 +765,7 @@ void *knav_pool_create(const char *name, if (!knav_qdev->dev) return ERR_PTR(-ENODEV); - pool = devm_kzalloc(knav_qdev->dev, sizeof(*pool), GFP_KERNEL); + pool = devm_kzalloc_obj(knav_qdev->dev, *pool); if (!pool) return ERR_PTR(-ENOMEM); @@ -1020,7 +1020,7 @@ static void knav_queue_setup_region(struct knav_device *kdev, } region->dma_end = region->dma_start + size; - pool = devm_kzalloc(kdev->dev, sizeof(*pool), GFP_KERNEL); + pool = devm_kzalloc_obj(kdev->dev, *pool); if (!pool) goto fail; pool->num_desc = 0; @@ -1081,7 +1081,7 @@ static int knav_queue_setup_regions(struct knav_device *kdev, "descriptor-regions not specified\n"); for_each_child_of_node_scoped(regions, child) { - region = devm_kzalloc(dev, sizeof(*region), GFP_KERNEL); + region = devm_kzalloc_obj(dev, *region); if (!region) return -ENOMEM; @@ -1204,7 +1204,7 @@ static int knav_setup_queue_range(struct knav_device *kdev, u32 temp[2], start, end, id, index; int ret, i; - range = devm_kzalloc(dev, sizeof(*range), GFP_KERNEL); + range = devm_kzalloc_obj(dev, *range); if (!range) return -ENOMEM; @@ -1393,7 +1393,7 @@ static int knav_queue_init_qmgrs(struct knav_device *kdev, "queue manager info not specified\n"); for_each_child_of_node_scoped(qmgrs, child) { - qmgr = devm_kzalloc(dev, sizeof(*qmgr), GFP_KERNEL); + qmgr = devm_kzalloc_obj(dev, *qmgr); if (!qmgr) return -ENOMEM; @@ -1489,7 +1489,7 @@ static int knav_queue_init_pdsps(struct knav_device *kdev, struct knav_pdsp_info *pdsp; for_each_child_of_node_scoped(pdsps, child) { - pdsp = devm_kzalloc(dev, sizeof(*pdsp), GFP_KERNEL); + pdsp = devm_kzalloc_obj(dev, *pdsp); if (!pdsp) return -ENOMEM; @@ -1773,7 +1773,7 @@ static int knav_queue_probe(struct platform_device *pdev) return -ENODEV; } - knav_qdev = devm_kzalloc(dev, sizeof(struct knav_device), GFP_KERNEL); + knav_qdev = devm_kzalloc_obj(dev, struct knav_device); if (!knav_qdev) { dev_err(dev, "memory allocation failed\n"); return -ENOMEM; diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c index 0fd59c73f585..7a72bb4dacdb 100644 --- a/drivers/soc/ti/pruss.c +++ b/drivers/soc/ti/pruss.c @@ -325,8 +325,7 @@ static int pruss_clk_mux_setup(struct pruss *pruss, struct clk *clk_mux, goto put_clk_mux_np; } - parent_names = devm_kcalloc(dev, sizeof(*parent_names), num_parents, - GFP_KERNEL); + parent_names = devm_kzalloc_objs(dev, *parent_names, num_parents); if (!parent_names) { ret = -ENOMEM; goto put_clk_mux_np; @@ -510,7 +509,7 @@ static int pruss_probe(struct platform_device *pdev) return ret; } - pruss = devm_kzalloc(dev, sizeof(*pruss), GFP_KERNEL); + pruss = devm_kzalloc_obj(dev, *pruss); if (!pruss) return -ENOMEM; diff --git a/drivers/soc/ti/smartreflex.c b/drivers/soc/ti/smartreflex.c index 01a214c3fa21..4a80499b0074 100644 --- a/drivers/soc/ti/smartreflex.c +++ b/drivers/soc/ti/smartreflex.c @@ -817,7 +817,7 @@ static int omap_sr_probe(struct platform_device *pdev) struct dentry *nvalue_dir; int i, ret = 0; - sr_info = devm_kzalloc(&pdev->dev, sizeof(struct omap_sr), GFP_KERNEL); + sr_info = devm_kzalloc_obj(&pdev->dev, struct omap_sr); if (!sr_info) return -ENOMEM; diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c index f8640cdc2a21..eb6074a67ba3 100644 --- a/drivers/soc/ti/wkup_m3_ipc.c +++ b/drivers/soc/ti/wkup_m3_ipc.c @@ -616,7 +616,7 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev) struct wkup_m3_ipc *m3_ipc; struct device_node *np = dev->of_node; - m3_ipc = devm_kzalloc(dev, sizeof(*m3_ipc), GFP_KERNEL); + m3_ipc = devm_kzalloc_obj(dev, *m3_ipc); if (!m3_ipc) return -ENOMEM; diff --git a/drivers/soc/versatile/soc-realview.c b/drivers/soc/versatile/soc-realview.c index cf91abe07d38..addb8eb32f0d 100644 --- a/drivers/soc/versatile/soc-realview.c +++ b/drivers/soc/versatile/soc-realview.c @@ -101,7 +101,7 @@ static int realview_soc_probe(struct platform_device *pdev) if (IS_ERR(syscon_regmap)) return PTR_ERR(syscon_regmap); - soc_dev_attr = devm_kzalloc(&pdev->dev, sizeof(*soc_dev_attr), GFP_KERNEL); + soc_dev_attr = devm_kzalloc_obj(&pdev->dev, *soc_dev_attr); if (!soc_dev_attr) return -ENOMEM; diff --git a/drivers/soc/vt8500/wmt-socinfo.c b/drivers/soc/vt8500/wmt-socinfo.c index 461f8c1ae56e..e514c98a796f 100644 --- a/drivers/soc/vt8500/wmt-socinfo.c +++ b/drivers/soc/vt8500/wmt-socinfo.c @@ -59,7 +59,7 @@ static int wmt_socinfo_probe(struct platform_device *pdev) sccid = readl(reg); - attrs = devm_kzalloc(&pdev->dev, sizeof(*attrs), GFP_KERNEL); + attrs = devm_kzalloc_obj(&pdev->dev, *attrs); if (!attrs) return -ENOMEM; diff --git a/drivers/soc/xilinx/zynqmp_power.c b/drivers/soc/xilinx/zynqmp_power.c index 54c796afb89e..555cb2976013 100644 --- a/drivers/soc/xilinx/zynqmp_power.c +++ b/drivers/soc/xilinx/zynqmp_power.c @@ -303,9 +303,8 @@ static int zynqmp_pm_probe(struct platform_device *pdev) * is not available to use) or -ENODEV(Xilinx Event Manager not compiled), * then use ipi-mailbox or interrupt method. */ - zynqmp_pm_init_suspend_work = devm_kzalloc(&pdev->dev, - sizeof(struct zynqmp_pm_work_struct), - GFP_KERNEL); + zynqmp_pm_init_suspend_work = devm_kzalloc_obj(&pdev->dev, + struct zynqmp_pm_work_struct); if (!zynqmp_pm_init_suspend_work) return -ENOMEM; @@ -326,9 +325,8 @@ static int zynqmp_pm_probe(struct platform_device *pdev) else return -ENODEV; - zynqmp_pm_init_restart_work = devm_kzalloc(&pdev->dev, - sizeof(struct zynqmp_pm_work_struct), - GFP_KERNEL); + zynqmp_pm_init_restart_work = devm_kzalloc_obj(&pdev->dev, + struct zynqmp_pm_work_struct); if (!zynqmp_pm_init_restart_work) return -ENOMEM; @@ -346,7 +344,7 @@ static int zynqmp_pm_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Failed to Register with Xilinx Event manager %d\n", ret); return ret; } else if (of_property_present(pdev->dev.of_node, "mboxes")) { - client = devm_kzalloc(&pdev->dev, sizeof(*client), GFP_KERNEL); + client = devm_kzalloc_obj(&pdev->dev, *client); if (!client) return -ENOMEM; diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c index a3316efdf8ac..d1a029446d3a 100644 --- a/drivers/soundwire/amd_manager.c +++ b/drivers/soundwire/amd_manager.c @@ -897,13 +897,12 @@ static int amd_sdw_register_dais(struct amd_sdw_manager *amd_manager) dev = amd_manager->dev; num_dais = amd_manager->num_dout_ports + amd_manager->num_din_ports; - dais = devm_kcalloc(dev, num_dais, sizeof(*dais), GFP_KERNEL); + dais = devm_kzalloc_objs(dev, *dais, num_dais); if (!dais) return -ENOMEM; - dai_runtime_array = devm_kcalloc(dev, num_dais, - sizeof(struct sdw_amd_dai_runtime *), - GFP_KERNEL); + dai_runtime_array = devm_kzalloc_objs(dev, struct sdw_amd_dai_runtime *, + num_dais); if (!dai_runtime_array) return -ENOMEM; amd_manager->dai_runtime_array = dai_runtime_array; @@ -1064,7 +1063,7 @@ static int amd_sdw_manager_probe(struct platform_device *pdev) struct amd_sdw_manager *amd_manager; int ret; - amd_manager = devm_kzalloc(dev, sizeof(struct amd_sdw_manager), GFP_KERNEL); + amd_manager = devm_kzalloc_obj(dev, struct amd_sdw_manager); if (!amd_manager) return -ENOMEM; diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index a0a63b76793e..46c957447e60 100644 --- a/drivers/soundwire/cadence_master.c +++ b/drivers/soundwire/cadence_master.c @@ -1283,7 +1283,7 @@ static int cdns_allocate_pdi(struct sdw_cdns *cdns, if (!num) return 0; - pdi = devm_kcalloc(cdns->dev, num, sizeof(*pdi), GFP_KERNEL); + pdi = devm_kzalloc_objs(cdns->dev, *pdi, num); if (!pdi) return -ENOMEM; diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index af65214836b4..6ab8691ec755 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1031,14 +1031,14 @@ static int intel_register_dai(struct sdw_intel *sdw) /* DAIs are created based on total number of PDIs supported */ num_dai = cdns->pcm.num_pdi; - dai_runtime_array = devm_kcalloc(cdns->dev, num_dai, - sizeof(struct sdw_cdns_dai_runtime *), - GFP_KERNEL); + dai_runtime_array = devm_kzalloc_objs(cdns->dev, + struct sdw_cdns_dai_runtime *, + num_dai); if (!dai_runtime_array) return -ENOMEM; cdns->dai_runtime_array = dai_runtime_array; - dais = devm_kcalloc(cdns->dev, num_dai, sizeof(*dais), GFP_KERNEL); + dais = devm_kzalloc_objs(cdns->dev, *dais, num_dai); if (!dais) return -ENOMEM; diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c index 642b33ab5526..43961c45ed27 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -1080,14 +1080,14 @@ static int intel_register_dai(struct sdw_intel *sdw) /* DAIs are created based on total number of PDIs supported */ num_dai = cdns->pcm.num_pdi; - dai_runtime_array = devm_kcalloc(cdns->dev, num_dai, - sizeof(struct sdw_cdns_dai_runtime *), - GFP_KERNEL); + dai_runtime_array = devm_kzalloc_objs(cdns->dev, + struct sdw_cdns_dai_runtime *, + num_dai); if (!dai_runtime_array) return -ENOMEM; cdns->dai_runtime_array = dai_runtime_array; - dais = devm_kcalloc(cdns->dev, num_dai, sizeof(*dais), GFP_KERNEL); + dais = devm_kzalloc_objs(cdns->dev, *dais, num_dai); if (!dais) return -ENOMEM; diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_auxdevice.c index 5983fbc5725a..8bdb2bf1c644 100644 --- a/drivers/soundwire/intel_auxdevice.c +++ b/drivers/soundwire/intel_auxdevice.c @@ -197,7 +197,7 @@ static int sdw_master_read_intel_prop(struct sdw_bus *bus) prop->quirks = SDW_MASTER_QUIRKS_CLEAR_INITIAL_CLASH | SDW_MASTER_QUIRKS_CLEAR_INITIAL_PARITY; - intel_prop = devm_kzalloc(bus->dev, sizeof(*intel_prop), GFP_KERNEL); + intel_prop = devm_kzalloc_obj(bus->dev, *intel_prop); if (!intel_prop) { fwnode_handle_put(link); return -ENOMEM; @@ -320,7 +320,7 @@ static int intel_link_probe(struct auxiliary_device *auxdev, struct sdw_bus *bus; int ret; - sdw = devm_kzalloc(dev, sizeof(*sdw), GFP_KERNEL); + sdw = devm_kzalloc_obj(dev, *sdw); if (!sdw) return -ENOMEM; diff --git a/drivers/soundwire/mipi_disco.c b/drivers/soundwire/mipi_disco.c index 259ad98b5b7a..8110a5399fd9 100644 --- a/drivers/soundwire/mipi_disco.c +++ b/drivers/soundwire/mipi_disco.c @@ -85,9 +85,8 @@ int sdw_master_read_prop(struct sdw_bus *bus) nval = fwnode_property_count_u32(link, "mipi-sdw-clock-frequencies-supported"); if (nval > 0) { prop->num_clk_freq = nval; - prop->clk_freq = devm_kcalloc(bus->dev, prop->num_clk_freq, - sizeof(*prop->clk_freq), - GFP_KERNEL); + prop->clk_freq = devm_kzalloc_objs(bus->dev, *prop->clk_freq, + prop->num_clk_freq); if (!prop->clk_freq) { fwnode_handle_put(link); return -ENOMEM; @@ -120,9 +119,8 @@ int sdw_master_read_prop(struct sdw_bus *bus) } if (nval > 0) { prop->num_clk_gears = nval; - prop->clk_gears = devm_kcalloc(bus->dev, prop->num_clk_gears, - sizeof(*prop->clk_gears), - GFP_KERNEL); + prop->clk_gears = devm_kzalloc_objs(bus->dev, *prop->clk_gears, + prop->num_clk_gears); if (!prop->clk_gears) { fwnode_handle_put(link); return -ENOMEM; @@ -174,9 +172,8 @@ static int sdw_slave_read_dp0(struct sdw_slave *slave, if (nval > 0) { dp0->num_words = nval; - dp0->words = devm_kcalloc(&slave->dev, - dp0->num_words, sizeof(*dp0->words), - GFP_KERNEL); + dp0->words = devm_kzalloc_objs(&slave->dev, *dp0->words, + dp0->num_words); if (!dp0->words) return -ENOMEM; @@ -199,9 +196,8 @@ static int sdw_slave_read_dp0(struct sdw_slave *slave, nval = fwnode_property_count_u32(port, "mipi-sdw-lane-list"); if (nval > 0) { dp0->num_lanes = nval; - dp0->lane_list = devm_kcalloc(&slave->dev, - dp0->num_lanes, sizeof(*dp0->lane_list), - GFP_KERNEL); + dp0->lane_list = devm_kzalloc_objs(&slave->dev, *dp0->lane_list, + dp0->num_lanes); if (!dp0->lane_list) return -ENOMEM; @@ -250,10 +246,9 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, nval = fwnode_property_count_u32(node, "mipi-sdw-port-wordlength-configs"); if (nval > 0) { dpn[i].num_words = nval; - dpn[i].words = devm_kcalloc(&slave->dev, - dpn[i].num_words, - sizeof(*dpn[i].words), - GFP_KERNEL); + dpn[i].words = devm_kzalloc_objs(&slave->dev, + *dpn[i].words, + dpn[i].num_words); if (!dpn[i].words) { fwnode_handle_put(node); return -ENOMEM; @@ -293,10 +288,9 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, nval = fwnode_property_count_u32(node, "mipi-sdw-channel-number-list"); if (nval > 0) { dpn[i].num_channels = nval; - dpn[i].channels = devm_kcalloc(&slave->dev, - dpn[i].num_channels, - sizeof(*dpn[i].channels), - GFP_KERNEL); + dpn[i].channels = devm_kzalloc_objs(&slave->dev, + *dpn[i].channels, + dpn[i].num_channels); if (!dpn[i].channels) { fwnode_handle_put(node); return -ENOMEM; @@ -312,10 +306,9 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, nval = fwnode_property_count_u32(node, "mipi-sdw-channel-combination-list"); if (nval > 0) { dpn[i].num_ch_combinations = nval; - dpn[i].ch_combinations = devm_kcalloc(&slave->dev, - dpn[i].num_ch_combinations, - sizeof(*dpn[i].ch_combinations), - GFP_KERNEL); + dpn[i].ch_combinations = devm_kzalloc_objs(&slave->dev, + *dpn[i].ch_combinations, + dpn[i].num_ch_combinations); if (!dpn[i].ch_combinations) { fwnode_handle_put(node); return -ENOMEM; @@ -344,9 +337,9 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, nval = fwnode_property_count_u32(node, "mipi-sdw-lane-list"); if (nval > 0) { dpn[i].num_lanes = nval; - dpn[i].lane_list = devm_kcalloc(&slave->dev, - dpn[i].num_lanes, sizeof(*dpn[i].lane_list), - GFP_KERNEL); + dpn[i].lane_list = devm_kzalloc_objs(&slave->dev, + *dpn[i].lane_list, + dpn[i].num_lanes); if (!dpn[i].lane_list) return -ENOMEM; @@ -488,9 +481,7 @@ int sdw_slave_read_prop(struct sdw_slave *slave) if (!port) { dev_dbg(dev, "DP0 node not found!!\n"); } else { - prop->dp0_prop = devm_kzalloc(&slave->dev, - sizeof(*prop->dp0_prop), - GFP_KERNEL); + prop->dp0_prop = devm_kzalloc_obj(&slave->dev, *prop->dp0_prop); if (!prop->dp0_prop) { fwnode_handle_put(port); return -ENOMEM; @@ -508,9 +499,8 @@ int sdw_slave_read_prop(struct sdw_slave *slave) /* Allocate memory for set bits in port lists */ nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), - GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -519,9 +509,8 @@ int sdw_slave_read_prop(struct sdw_slave *slave) prop->source_ports, "source"); nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), - GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 6e0c5fb10efa..c31d921f679f 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -1463,12 +1463,12 @@ static int qcom_swrm_register_dais(struct qcom_swrm_ctrl *ctrl) struct device *dev = ctrl->dev; int i; - ctrl->sruntime = devm_kcalloc(dev, num_dais, sizeof(*ctrl->sruntime), GFP_KERNEL); + ctrl->sruntime = devm_kzalloc_objs(dev, *ctrl->sruntime, num_dais); if (!ctrl->sruntime) return -ENOMEM; /* PDM dais are only tested for now */ - dais = devm_kcalloc(dev, num_dais, sizeof(*dais), GFP_KERNEL); + dais = devm_kzalloc_objs(dev, *dais, num_dais); if (!dais) return -ENOMEM; @@ -1529,8 +1529,8 @@ static int qcom_swrm_get_port_config(struct qcom_swrm_ctrl *ctrl) ctrl->nports = ctrl->num_dout_ports + ctrl->num_din_ports; - ctrl->pconfig = devm_kcalloc(ctrl->dev, ctrl->nports + 1, - sizeof(*ctrl->pconfig), GFP_KERNEL); + ctrl->pconfig = devm_kzalloc_objs(ctrl->dev, *ctrl->pconfig, + ctrl->nports + 1); if (!ctrl->pconfig) return -ENOMEM; @@ -1623,7 +1623,7 @@ static int qcom_swrm_probe(struct platform_device *pdev) int ret; u32 val; - ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(dev, *ctrl); if (!ctrl) return -ENOMEM; diff --git a/drivers/soundwire/sysfs_slave_dpn.c b/drivers/soundwire/sysfs_slave_dpn.c index d2561400da77..d280913160a4 100644 --- a/drivers/soundwire/sysfs_slave_dpn.c +++ b/drivers/soundwire/sysfs_slave_dpn.c @@ -31,7 +31,7 @@ static int field##_attribute_alloc(struct device *dev, \ { \ struct dpn_attribute *dpn_attr; \ \ - dpn_attr = devm_kzalloc(dev, sizeof(*dpn_attr), GFP_KERNEL); \ + dpn_attr = devm_kzalloc_obj(dev, *dpn_attr); \ if (!dpn_attr) \ return -ENOMEM; \ dpn_attr->N = N; \ @@ -171,9 +171,8 @@ static int add_all_attributes(struct device *dev, int N, int dir) int ret; /* allocate attributes, last one is NULL */ - dpn_attrs = devm_kcalloc(dev, SDW_DPN_ATTRIBUTES + 1, - sizeof(struct attribute *), - GFP_KERNEL); + dpn_attrs = devm_kzalloc_objs(dev, struct attribute *, + SDW_DPN_ATTRIBUTES + 1); if (!dpn_attrs) return -ENOMEM; @@ -259,7 +258,7 @@ static int add_all_attributes(struct device *dev, int N, int dir) return -EINVAL; } - dpn_group = devm_kzalloc(dev, sizeof(*dpn_group), GFP_KERNEL); + dpn_group = devm_kzalloc_obj(dev, *dpn_group); if (!dpn_group) return -ENOMEM; diff --git a/drivers/spi/spi-amlogic-spisg.c b/drivers/spi/spi-amlogic-spisg.c index 1b00f34e9e93..c59df9b115ee 100644 --- a/drivers/spi/spi-amlogic-spisg.c +++ b/drivers/spi/spi-amlogic-spisg.c @@ -708,7 +708,7 @@ static int aml_spisg_clk_init(struct spisg_device *spisg, void __iomem *base) clk_disable_unprepare(spisg->pclk); - tbl = devm_kcalloc(dev, (DIV_NUM + 1), sizeof(*tbl), GFP_KERNEL); + tbl = devm_kzalloc_objs(dev, *tbl, (DIV_NUM + 1)); if (!tbl) return -ENOMEM; @@ -718,7 +718,7 @@ static int aml_spisg_clk_init(struct spisg_device *spisg, void __iomem *base) } spisg->tbl = tbl; - div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL); + div = devm_kzalloc_obj(dev, *div); if (!div) return -ENOMEM; diff --git a/drivers/spi/spi-cs42l43.c b/drivers/spi/spi-cs42l43.c index 46eeb44130dd..74eaa96ba2d6 100644 --- a/drivers/spi/spi-cs42l43.c +++ b/drivers/spi/spi-cs42l43.c @@ -385,14 +385,14 @@ static struct spi_board_info *cs42l43_create_bridge_amp(struct cs42l43_spi *priv struct spi_board_info *info; if (spkid >= 0) { - props = devm_kcalloc(priv->dev, 2, sizeof(*props), GFP_KERNEL); + props = devm_kzalloc_objs(priv->dev, *props, 2); if (!props) return NULL; *props = PROPERTY_ENTRY_U32("cirrus,speaker-id", spkid); } - swnode = devm_kmalloc(priv->dev, sizeof(*swnode), GFP_KERNEL); + swnode = devm_kmalloc_obj(priv->dev, *swnode); if (!swnode) return NULL; @@ -424,7 +424,7 @@ static int cs42l43_spi_probe(struct platform_device *pdev) int spkid = -EINVAL; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index 9c70947c969c..dd703c1e56c5 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c @@ -103,7 +103,7 @@ static int dw_spi_mscc_init(struct platform_device *pdev, { struct dw_spi_mscc *dwsmscc; - dwsmscc = devm_kzalloc(&pdev->dev, sizeof(*dwsmscc), GFP_KERNEL); + dwsmscc = devm_kzalloc_obj(&pdev->dev, *dwsmscc); if (!dwsmscc) return -ENOMEM; @@ -187,7 +187,7 @@ static int dw_spi_mscc_sparx5_init(struct platform_device *pdev, return -EOPNOTSUPP; } - dwsmscc = devm_kzalloc(dev, sizeof(*dwsmscc), GFP_KERNEL); + dwsmscc = devm_kzalloc_obj(dev, *dwsmscc); if (!dwsmscc) return -ENOMEM; @@ -377,8 +377,7 @@ static int dw_spi_mmio_probe(struct platform_device *pdev) struct dw_spi *dws; int ret; - dwsmmio = devm_kzalloc(&pdev->dev, sizeof(struct dw_spi_mmio), - GFP_KERNEL); + dwsmmio = devm_kzalloc_obj(&pdev->dev, struct dw_spi_mmio); if (!dwsmmio) return -ENOMEM; diff --git a/drivers/spi/spi-dw-pci.c b/drivers/spi/spi-dw-pci.c index 2f3bea51f1e6..66511db8e2b7 100644 --- a/drivers/spi/spi-dw-pci.c +++ b/drivers/spi/spi-dw-pci.c @@ -90,7 +90,7 @@ static int dw_spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en if (ret) return ret; - dws = devm_kzalloc(&pdev->dev, sizeof(*dws), GFP_KERNEL); + dws = devm_kzalloc_obj(&pdev->dev, *dws); if (!dws) return -ENOMEM; diff --git a/drivers/spi/spi-fsi.c b/drivers/spi/spi-fsi.c index 451cb4cfdb9c..10867b84bf81 100644 --- a/drivers/spi/spi-fsi.c +++ b/drivers/spi/spi-fsi.c @@ -539,7 +539,7 @@ static int fsi_spi_probe(struct fsi_device *fsi) if (rc) return -ENODEV; - bridge = devm_kzalloc(dev, sizeof(*bridge), GFP_KERNEL); + bridge = devm_kzalloc_obj(dev, *bridge); if (!bridge) return -ENOMEM; diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index f03488870d02..ea45da285841 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -675,7 +675,7 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) struct fsl_dspi_dma *dma; int ret; - dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL); + dma = devm_kzalloc_obj(dev, *dma); if (!dma) return -ENOMEM; @@ -1554,7 +1554,7 @@ static int dspi_probe(struct platform_device *pdev) void __iomem *base; bool big_endian; - dspi = devm_kzalloc(&pdev->dev, sizeof(*dspi), GFP_KERNEL); + dspi = devm_kzalloc_obj(&pdev->dev, *dspi); if (!dspi) return -ENOMEM; diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c index 1f8960f15483..9a431807eb9f 100644 --- a/drivers/spi/spi-fsl-lib.c +++ b/drivers/spi/spi-fsl-lib.c @@ -119,7 +119,7 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev) const void *prop; int ret = -ENOMEM; - pinfo = devm_kzalloc(&ofdev->dev, sizeof(*pinfo), GFP_KERNEL); + pinfo = devm_kzalloc_obj(&ofdev->dev, *pinfo); if (!pinfo) return ret; diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c index c32c33b27e1a..1b18b623a6d3 100644 --- a/drivers/spi/spi-gpio.c +++ b/drivers/spi/spi-gpio.c @@ -320,9 +320,8 @@ static int spi_gpio_probe_pdata(struct platform_device *pdev, return 0; host->num_chipselect = pdata->num_chipselect; - spi_gpio->cs_gpios = devm_kcalloc(dev, host->num_chipselect, - sizeof(*spi_gpio->cs_gpios), - GFP_KERNEL); + spi_gpio->cs_gpios = devm_kzalloc_objs(dev, *spi_gpio->cs_gpios, + host->num_chipselect); if (!spi_gpio->cs_gpios) return -ENOMEM; diff --git a/drivers/spi/spi-intel.c b/drivers/spi/spi-intel.c index 7494b921a743..5be123b63107 100644 --- a/drivers/spi/spi-intel.c +++ b/drivers/spi/spi-intel.c @@ -1383,13 +1383,13 @@ static int intel_spi_populate_chip(struct intel_spi *ispi) if (ret) return ret; - pdata = devm_kzalloc(ispi->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(ispi->dev, *pdata); if (!pdata) return -ENOMEM; pdata->nr_parts = 1; - pdata->parts = devm_kcalloc(ispi->dev, pdata->nr_parts, - sizeof(*pdata->parts), GFP_KERNEL); + pdata->parts = devm_kzalloc_objs(ispi->dev, *pdata->parts, + pdata->nr_parts); if (!pdata->parts) return -ENOMEM; @@ -1406,7 +1406,7 @@ static int intel_spi_populate_chip(struct intel_spi *ispi) if (ispi->host->num_chipselect < 2) return 0; - pdata = devm_kzalloc(ispi->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(ispi->dev, *pdata); if (!pdata) return -ENOMEM; @@ -1416,8 +1416,7 @@ static int intel_spi_populate_chip(struct intel_spi *ispi) return -ENOMEM; pdata->nr_parts = 1; - parts = devm_kcalloc(ispi->dev, pdata->nr_parts, sizeof(*parts), - GFP_KERNEL); + parts = devm_kzalloc_objs(ispi->dev, *parts, pdata->nr_parts); if (!parts) return -ENOMEM; diff --git a/drivers/spi/spi-iproc-qspi.c b/drivers/spi/spi-iproc-qspi.c index 5255d5124385..2116675ec4a3 100644 --- a/drivers/spi/spi-iproc-qspi.c +++ b/drivers/spi/spi-iproc-qspi.c @@ -95,7 +95,7 @@ static int bcm_iproc_probe(struct platform_device *pdev) struct bcm_iproc_intc *priv; struct bcm_qspi_soc_intc *soc_intc; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; soc_intc = &priv->soc_intc; diff --git a/drivers/spi/spi-kspi2.c b/drivers/spi/spi-kspi2.c index ca73ec52ce63..0a93ecce9ad0 100644 --- a/drivers/spi/spi-kspi2.c +++ b/drivers/spi/spi-kspi2.c @@ -350,8 +350,8 @@ static int kspi2_probe(struct auxiliary_device *auxdev, kspi = spi_controller_get_devdata(host); kspi->auxdev = container_of(auxdev, struct keba_spi_auxdev, auxdev); kspi->host = host; - kspi->device = devm_kcalloc(dev, kspi->auxdev->info_size, - sizeof(*kspi->device), GFP_KERNEL); + kspi->device = devm_kzalloc_objs(dev, *kspi->device, + kspi->auxdev->info_size); if (!kspi->device) return -ENOMEM; kspi->device_size = kspi->auxdev->info_size; diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index b94680b60af9..8047b7508c8d 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -1084,7 +1084,7 @@ static int spi_mem_probe(struct spi_device *spi) struct spi_controller *ctlr = spi->controller; struct spi_mem *mem; - mem = devm_kzalloc(&spi->dev, sizeof(*mem), GFP_KERNEL); + mem = devm_kzalloc_obj(&spi->dev, *mem); if (!mem) return -ENOMEM; diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c index b1f8c823d5d0..3f8c2bc37fb1 100644 --- a/drivers/spi/spi-meson-spicc.c +++ b/drivers/spi/spi-meson-spicc.c @@ -848,7 +848,7 @@ static int meson_spicc_pow2_clk_init(struct meson_spicc_device *spicc) /* algorithm for pow2 div: rate = freq / 4 / (2 ^ N) */ - pow2_fixed_div = devm_kzalloc(dev, sizeof(*pow2_fixed_div), GFP_KERNEL); + pow2_fixed_div = devm_kzalloc_obj(dev, *pow2_fixed_div); if (!pow2_fixed_div) return -ENOMEM; @@ -914,7 +914,7 @@ static int meson_spicc_enh_clk_init(struct meson_spicc_device *spicc) /* algorithm for enh div: rate = freq / 2 / (N + 1) */ - enh_fixed_div = devm_kzalloc(dev, sizeof(*enh_fixed_div), GFP_KERNEL); + enh_fixed_div = devm_kzalloc_obj(dev, *enh_fixed_div); if (!enh_fixed_div) return -ENOMEM; @@ -938,7 +938,7 @@ static int meson_spicc_enh_clk_init(struct meson_spicc_device *spicc) if (WARN_ON(IS_ERR(clk))) return PTR_ERR(clk); - enh_div = devm_kzalloc(dev, sizeof(*enh_div), GFP_KERNEL); + enh_div = devm_kzalloc_obj(dev, *enh_div); if (!enh_div) return -ENOMEM; @@ -958,7 +958,7 @@ static int meson_spicc_enh_clk_init(struct meson_spicc_device *spicc) if (WARN_ON(IS_ERR(clk))) return PTR_ERR(clk); - mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); + mux = devm_kzalloc_obj(dev, *mux); if (!mux) return -ENOMEM; diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c index b845a599f7c6..8b4deef91fa3 100644 --- a/drivers/spi/spi-mt65xx.c +++ b/drivers/spi/spi-mt65xx.c @@ -1221,8 +1221,7 @@ static int mtk_spi_probe(struct platform_device *pdev) return dev_err_probe(dev, -EINVAL, "No 'mediatek,pad-select' property\n"); - mdata->pad_sel = devm_kmalloc_array(dev, mdata->pad_num, - sizeof(u32), GFP_KERNEL); + mdata->pad_sel = devm_kmalloc_objs(dev, u32, mdata->pad_num); if (!mdata->pad_sel) return -ENOMEM; diff --git a/drivers/spi/spi-offload-trigger-pwm.c b/drivers/spi/spi-offload-trigger-pwm.c index 0eff14328a6b..e0e1abf58538 100644 --- a/drivers/spi/spi-offload-trigger-pwm.c +++ b/drivers/spi/spi-offload-trigger-pwm.c @@ -125,7 +125,7 @@ static int spi_offload_trigger_pwm_probe(struct platform_device *pdev) struct pwm_state state; int ret; - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/drivers/spi/spi-offload.c b/drivers/spi/spi-offload.c index a446927a51d3..8fd5ea509454 100644 --- a/drivers/spi/spi-offload.c +++ b/drivers/spi/spi-offload.c @@ -68,7 +68,7 @@ struct spi_offload *devm_spi_offload_alloc(struct device *dev, struct spi_offload *offload; void *priv; - offload = devm_kzalloc(dev, sizeof(*offload), GFP_KERNEL); + offload = devm_kzalloc_obj(dev, *offload); if (!offload) return ERR_PTR(-ENOMEM); diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index e46b1d9c8cd0..73b6c29cae1b 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1635,9 +1635,9 @@ static int omap2_mcspi_probe(struct platform_device *pdev) INIT_LIST_HEAD(&mcspi->ctx.cs); - mcspi->dma_channels = devm_kcalloc(&pdev->dev, ctlr->num_chipselect, - sizeof(struct omap2_mcspi_dma), - GFP_KERNEL); + mcspi->dma_channels = devm_kzalloc_objs(&pdev->dev, + struct omap2_mcspi_dma, + ctlr->num_chipselect); if (mcspi->dma_channels == NULL) return -ENOMEM; diff --git a/drivers/spi/spi-pci1xxxx.c b/drivers/spi/spi-pci1xxxx.c index c50e6841de52..e00b59ed823a 100644 --- a/drivers/spi/spi-pci1xxxx.c +++ b/drivers/spi/spi-pci1xxxx.c @@ -886,9 +886,7 @@ static int pci1xxxx_spi_probe(struct pci_dev *pdev, const struct pci_device_id * else only_sec_inst = 0; - spi_bus = devm_kzalloc(&pdev->dev, - struct_size(spi_bus, spi_int, hw_inst_cnt), - GFP_KERNEL); + spi_bus = devm_kzalloc_flex(&pdev->dev, *spi_bus, spi_int, hw_inst_cnt); if (!spi_bus) return -ENOMEM; @@ -897,9 +895,8 @@ static int pci1xxxx_spi_probe(struct pci_dev *pdev, const struct pci_device_id * pci_set_master(pdev); for (iter = 0; iter < hw_inst_cnt; iter++) { - spi_bus->spi_int[iter] = devm_kzalloc(&pdev->dev, - sizeof(struct pci1xxxx_spi_internal), - GFP_KERNEL); + spi_bus->spi_int[iter] = devm_kzalloc_obj(&pdev->dev, + struct pci1xxxx_spi_internal); if (!spi_bus->spi_int[iter]) return -ENOMEM; spi_sub_ptr = spi_bus->spi_int[iter]; diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 3ff30486b289..f52130465abd 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -1839,7 +1839,7 @@ pl022_platform_data_dt_get(struct device *dev) return NULL; } - pd = devm_kzalloc(dev, sizeof(struct pl022_ssp_controller), GFP_KERNEL); + pd = devm_kzalloc_obj(dev, struct pl022_ssp_controller); if (!pd) return NULL; diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index cae77ac18520..77dfdb9139c8 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -273,7 +273,7 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, if (ret) return ret; - pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&dev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/spi/spi-pxa2xx-platform.c b/drivers/spi/spi-pxa2xx-platform.c index 849a14cd0343..c8d7b235c354 100644 --- a/drivers/spi/spi-pxa2xx-platform.c +++ b/drivers/spi/spi-pxa2xx-platform.c @@ -106,7 +106,7 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) if (!(type > SSP_UNDEFINED && type < SSP_MAX)) return ERR_PTR(-EINVAL); - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); diff --git a/drivers/spi/spi-qcom-qspi.c b/drivers/spi/spi-qcom-qspi.c index e5b7755ae4f9..7c92395721ed 100644 --- a/drivers/spi/spi-qcom-qspi.c +++ b/drivers/spi/spi-qcom-qspi.c @@ -721,8 +721,7 @@ static int qcom_qspi_probe(struct platform_device *pdev) if (IS_ERR(ctrl->base)) return PTR_ERR(ctrl->base); - ctrl->clks = devm_kcalloc(dev, QSPI_NUM_CLKS, - sizeof(*ctrl->clks), GFP_KERNEL); + ctrl->clks = devm_kzalloc_objs(dev, *ctrl->clks, QSPI_NUM_CLKS); if (!ctrl->clks) return -ENOMEM; diff --git a/drivers/spi/spi-qpic-snand.c b/drivers/spi/spi-qpic-snand.c index c90c2001ee8d..b03e2e4f0f0b 100644 --- a/drivers/spi/spi-qpic-snand.c +++ b/drivers/spi/spi-qpic-snand.c @@ -1581,7 +1581,7 @@ static int qcom_spi_probe(struct platform_device *pdev) struct resource *res; int ret; - qspi = devm_kzalloc(dev, sizeof(*qspi), GFP_KERNEL); + qspi = devm_kzalloc_obj(dev, *qspi); if (!qspi) return -ENOMEM; diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 58e306cc730f..79c278b3c829 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1161,7 +1161,7 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev) struct s3c64xx_spi_info *sci; u32 temp; - sci = devm_kzalloc(dev, sizeof(*sci), GFP_KERNEL); + sci = devm_kzalloc_obj(dev, *sci); if (!sci) return ERR_PTR(-ENOMEM); diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index 89fbdde46cfe..8e3f07036137 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c @@ -1029,7 +1029,7 @@ static struct sh_msiof_spi_info *sh_msiof_spi_parse_dt(struct device *dev) struct device_node *np = dev->of_node; u32 num_cs = 1; - info = devm_kzalloc(dev, sizeof(struct sh_msiof_spi_info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, struct sh_msiof_spi_info); if (!info) return NULL; diff --git a/drivers/spi/spi-slave-system-control.c b/drivers/spi/spi-slave-system-control.c index 8f5c32b61a5b..da39eb5a81a4 100644 --- a/drivers/spi/spi-slave-system-control.c +++ b/drivers/spi/spi-slave-system-control.c @@ -115,7 +115,7 @@ static int spi_slave_system_control_probe(struct spi_device *spi) struct spi_slave_system_control_priv *priv; int ret; - priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&spi->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/spi/spi-slave-time.c b/drivers/spi/spi-slave-time.c index 8bb3070e4b80..c64bf9222960 100644 --- a/drivers/spi/spi-slave-time.c +++ b/drivers/spi/spi-slave-time.c @@ -89,7 +89,7 @@ static int spi_slave_time_probe(struct spi_device *spi) struct spi_slave_time_priv *priv; int ret; - priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&spi->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c index d8cca3aa276b..f68c46f06ce7 100644 --- a/drivers/spi/spi-tegra210-quad.c +++ b/drivers/spi/spi-tegra210-quad.c @@ -1032,7 +1032,7 @@ static struct tegra_qspi_client_data *tegra_qspi_parse_cdata_dt(struct spi_devic struct tegra_qspi_client_data *cdata; struct tegra_qspi *tqspi = spi_controller_get_devdata(spi->controller); - cdata = devm_kzalloc(tqspi->dev, sizeof(*cdata), GFP_KERNEL); + cdata = devm_kzalloc_obj(tqspi->dev, *cdata); if (!cdata) return NULL; diff --git a/drivers/spi/spi-xlp.c b/drivers/spi/spi-xlp.c index d014955e6d4b..26764b031fa5 100644 --- a/drivers/spi/spi-xlp.c +++ b/drivers/spi/spi-xlp.c @@ -372,7 +372,7 @@ static int xlp_spi_probe(struct platform_device *pdev) struct clk *clk; int irq, err; - xspi = devm_kzalloc(&pdev->dev, sizeof(*xspi), GFP_KERNEL); + xspi = devm_kzalloc_obj(&pdev->dev, *xspi); if (!xspi) return -ENOMEM; diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 40cda0037ea5..952f38e185ce 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3551,8 +3551,7 @@ static int spi_get_gpio_descs(struct spi_controller *ctlr) ctlr->num_chipselect = max_t(int, nb, ctlr->num_chipselect); - cs = devm_kcalloc(dev, ctlr->num_chipselect, sizeof(*cs), - GFP_KERNEL); + cs = devm_kzalloc_objs(dev, *cs, ctlr->num_chipselect); if (!cs) return -ENOMEM; ctlr->cs_gpiods = cs; diff --git a/drivers/spmi/spmi-mtk-pmif.c b/drivers/spmi/spmi-mtk-pmif.c index 833c2b30d09f..4d5c5f2b9543 100644 --- a/drivers/spmi/spmi-mtk-pmif.c +++ b/drivers/spmi/spmi-mtk-pmif.c @@ -799,7 +799,7 @@ static int mtk_spmi_probe(struct platform_device *pdev) u8 cur_bus = 0; int ret; - arb = devm_kzalloc(&pdev->dev, sizeof(*arb), GFP_KERNEL); + arb = devm_kzalloc_obj(&pdev->dev, *arb); if (!arb) return -ENOMEM; diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 402ffeaff8e2..a7293fbec729 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -1097,8 +1097,8 @@ static int pmic_arb_init_apid_v1(struct spmi_pmic_arb_bus *bus, int index) return -EINVAL; } - mapping_table = devm_kcalloc(&bus->spmic->dev, pmic_arb->max_periphs, - sizeof(*mapping_table), GFP_KERNEL); + mapping_table = devm_kzalloc_objs(&bus->spmic->dev, *mapping_table, + pmic_arb->max_periphs); if (!mapping_table) return -ENOMEM; @@ -1965,15 +1965,13 @@ static int spmi_pmic_arb_bus_init(struct platform_device *pdev, raw_spin_lock_init(&bus->lock); - bus->ppid_to_apid = devm_kcalloc(dev, PMIC_ARB_MAX_PPID, - sizeof(*bus->ppid_to_apid), - GFP_KERNEL); + bus->ppid_to_apid = devm_kzalloc_objs(dev, *bus->ppid_to_apid, + PMIC_ARB_MAX_PPID); if (!bus->ppid_to_apid) return -ENOMEM; - bus->apid_data = devm_kcalloc(dev, pmic_arb->max_periphs, - sizeof(*bus->apid_data), - GFP_KERNEL); + bus->apid_data = devm_kzalloc_objs(dev, *bus->apid_data, + pmic_arb->max_periphs); if (!bus->apid_data) return -ENOMEM; @@ -2085,7 +2083,7 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev) u32 channel, ee, hw_ver; int err; - pmic_arb = devm_kzalloc(dev, sizeof(*pmic_arb), GFP_KERNEL); + pmic_arb = devm_kzalloc_obj(dev, *pmic_arb); if (!pmic_arb) return -ENOMEM; diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c index 7bb35e11d1dd..233d2b153934 100644 --- a/drivers/staging/axis-fifo/axis-fifo.c +++ b/drivers/staging/axis-fifo/axis-fifo.c @@ -434,7 +434,7 @@ static int axis_fifo_probe(struct platform_device *pdev) int rc = 0; /* error return value */ int irq; - fifo = devm_kzalloc(dev, sizeof(*fifo), GFP_KERNEL); + fifo = devm_kzalloc_obj(dev, *fifo); if (!fifo) return -ENOMEM; diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 3d78b527cab5..c69ba12d43b0 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -564,7 +564,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, height = display->height; } - fbdefio = devm_kzalloc(dev, sizeof(struct fb_deferred_io), GFP_KERNEL); + fbdefio = devm_kzalloc_obj(dev, struct fb_deferred_io); if (!fbdefio) return NULL; @@ -573,11 +573,8 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, return NULL; if (display->gamma_num && display->gamma_len) { - gamma_curves = devm_kcalloc(dev, - display->gamma_num * - display->gamma_len, - sizeof(gamma_curves[0]), - GFP_KERNEL); + gamma_curves = devm_kzalloc_objs(dev, gamma_curves[0], + display->gamma_num * display->gamma_len); if (!gamma_curves) return NULL; } @@ -1095,7 +1092,7 @@ static struct fbtft_platform_data *fbtft_properties_read(struct device *dev) return ERR_PTR(-EINVAL); } - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index 6daa4e706792..9a4f6bca88df 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -699,7 +699,7 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, snprintf(module->jack_name, NAME_SIZE, "GB %d Headset Jack", module->dev_id); - headset = devm_kzalloc(module->dev, sizeof(*headset), GFP_KERNEL); + headset = devm_kzalloc_obj(module->dev, *headset); if (!headset) return -ENOMEM; @@ -721,7 +721,7 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, snprintf(module->button_name, NAME_SIZE, "GB %d Button Jack", module->dev_id); - button = devm_kzalloc(module->dev, sizeof(*button), GFP_KERNEL); + button = devm_kzalloc_obj(module->dev, *button); if (!button) { ret = -ENOMEM; goto free_jacks; @@ -1005,7 +1005,7 @@ static int gbcodec_probe(struct snd_soc_component *comp) struct gbaudio_codec_info *info; struct gbaudio_codec_dai *dai; - info = devm_kzalloc(comp->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(comp->dev, *info); if (!info) return -ENOMEM; @@ -1017,7 +1017,7 @@ static int gbcodec_probe(struct snd_soc_component *comp) /* init dai_list used to maintain runtime stream info */ for (i = 0; i < ARRAY_SIZE(gbaudio_dai); i++) { - dai = devm_kzalloc(comp->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(comp->dev, *dai); if (!dai) return -ENOMEM; dai->id = gbaudio_dai[i].id; diff --git a/drivers/staging/greybus/audio_module.c b/drivers/staging/greybus/audio_module.c index 4cd1f42c11f0..c7fa4d2d3337 100644 --- a/drivers/staging/greybus/audio_module.c +++ b/drivers/staging/greybus/audio_module.c @@ -205,7 +205,7 @@ static int gb_audio_add_data_connection(struct gbaudio_module_info *gbmodule, struct gb_connection *connection; struct gbaudio_data_connection *dai; - dai = devm_kzalloc(gbmodule->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(gbmodule->dev, *dai); if (!dai) return -ENOMEM; @@ -250,7 +250,7 @@ static int gb_audio_probe(struct gb_bundle *bundle, * There can be only one Management connection and any number of data * connections. */ - gbmodule = devm_kzalloc(dev, sizeof(*gbmodule), GFP_KERNEL); + gbmodule = devm_kzalloc_obj(dev, *gbmodule); if (!gbmodule) return -ENOMEM; diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c index 76146f91cddc..82d6339b2a22 100644 --- a/drivers/staging/greybus/audio_topology.c +++ b/drivers/staging/greybus/audio_topology.c @@ -642,7 +642,7 @@ static int gbaudio_tplg_create_enum_kctl(struct gbaudio_module_info *gb, struct gb_audio_enumerated *gb_enum; int i; - gbe = devm_kzalloc(gb->dev, sizeof(*gbe), GFP_KERNEL); + gbe = devm_kzalloc_obj(gb->dev, *gbe); if (!gbe) return -ENOMEM; @@ -680,9 +680,8 @@ static int gbaudio_tplg_create_kcontrol(struct gbaudio_module_info *gb, ret = gbaudio_tplg_create_enum_kctl(gb, kctl, ctl); break; default: - ctldata = devm_kzalloc(gb->dev, - sizeof(struct gbaudio_ctl_pvt), - GFP_KERNEL); + ctldata = devm_kzalloc_obj(gb->dev, + struct gbaudio_ctl_pvt); if (!ctldata) return -ENOMEM; ctldata->ctl_id = ctl->id; @@ -848,7 +847,7 @@ static int gbaudio_tplg_create_enum_ctl(struct gbaudio_module_info *gb, struct gb_audio_enumerated *gb_enum; int i; - gbe = devm_kzalloc(gb->dev, sizeof(*gbe), GFP_KERNEL); + gbe = devm_kzalloc_obj(gb->dev, *gbe); if (!gbe) return -ENOMEM; @@ -878,8 +877,7 @@ static int gbaudio_tplg_create_mixer_ctl(struct gbaudio_module_info *gb, { struct gbaudio_ctl_pvt *ctldata; - ctldata = devm_kzalloc(gb->dev, sizeof(struct gbaudio_ctl_pvt), - GFP_KERNEL); + ctldata = devm_kzalloc_obj(gb->dev, struct gbaudio_ctl_pvt); if (!ctldata) return -ENOMEM; ctldata->ctl_id = ctl->id; @@ -1048,9 +1046,7 @@ static int gbaudio_tplg_create_widget(struct gbaudio_module_info *module, curr->name, curr->iface); goto error; } - control = devm_kzalloc(module->dev, - sizeof(struct gbaudio_control), - GFP_KERNEL); + control = devm_kzalloc_obj(module->dev, struct gbaudio_control); if (!control) { ret = -ENOMEM; goto error; @@ -1159,9 +1155,7 @@ static int gbaudio_tplg_process_kcontrols(struct gbaudio_module_info *module, curr->name, curr->iface); goto error; } - control = devm_kzalloc(module->dev, sizeof(struct - gbaudio_control), - GFP_KERNEL); + control = devm_kzalloc_obj(module->dev, struct gbaudio_control); if (!control) { ret = -ENOMEM; goto error; @@ -1232,9 +1226,7 @@ static int gbaudio_tplg_process_widgets(struct gbaudio_module_info *module, curr->name, curr->type); goto error; } - widget = devm_kzalloc(module->dev, sizeof(struct - gbaudio_widget), - GFP_KERNEL); + widget = devm_kzalloc_obj(module->dev, struct gbaudio_widget); if (!widget) { ret = -ENOMEM; goto error; diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index f8875d2b581b..ef5d0169e8ce 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -1200,7 +1200,7 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i start = pci_resource_start(pdev, ATOM_ISP_PCI_BAR); dev_dbg(&pdev->dev, "start: 0x%x\n", start); - isp = devm_kzalloc(&pdev->dev, sizeof(*isp), GFP_KERNEL); + isp = devm_kzalloc_obj(&pdev->dev, *isp); if (!isp) return -ENOMEM; diff --git a/drivers/staging/media/imx/imx-ic-common.c b/drivers/staging/media/imx/imx-ic-common.c index 6df1ffb53895..d36bf0a26ce6 100644 --- a/drivers/staging/media/imx/imx-ic-common.c +++ b/drivers/staging/media/imx/imx-ic-common.c @@ -26,7 +26,7 @@ struct v4l2_subdev *imx_media_ic_register(struct v4l2_device *v4l2_dev, struct imx_ic_priv *priv; int ret; - priv = devm_kzalloc(ipu_dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(ipu_dev, *priv); if (!priv) return ERR_PTR(-ENOMEM); diff --git a/drivers/staging/media/imx/imx-ic-prp.c b/drivers/staging/media/imx/imx-ic-prp.c index b2c648149964..4c0aee369025 100644 --- a/drivers/staging/media/imx/imx-ic-prp.c +++ b/drivers/staging/media/imx/imx-ic-prp.c @@ -496,7 +496,7 @@ static int prp_init(struct imx_ic_priv *ic_priv) struct prp_priv *priv; int i; - priv = devm_kzalloc(ic_priv->ipu_dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(ic_priv->ipu_dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c index 3430ddeac356..ceb5ea40ebe1 100644 --- a/drivers/staging/media/imx/imx-ic-prpencvf.c +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c @@ -1345,7 +1345,7 @@ static int prp_init(struct imx_ic_priv *ic_priv) struct prp_priv *priv; int i, ret; - priv = devm_kzalloc(ic_priv->ipu_dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(ic_priv->ipu_dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c index 9216a221b72f..1e58e2a48d91 100644 --- a/drivers/staging/media/imx/imx-media-capture.c +++ b/drivers/staging/media/imx/imx-media-capture.c @@ -967,7 +967,7 @@ imx_media_capture_device_init(struct device *dev, struct v4l2_subdev *src_sd, struct vb2_queue *vq; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return ERR_PTR(-ENOMEM); diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index 43c637b333f2..34827f96067a 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -1981,7 +1981,7 @@ static int imx_csi_probe(struct platform_device *pdev) struct csi_priv *priv; int i, ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/staging/media/imx/imx-media-dev-common.c b/drivers/staging/media/imx/imx-media-dev-common.c index 0d0ee8627a2d..c49877907296 100644 --- a/drivers/staging/media/imx/imx-media-dev-common.c +++ b/drivers/staging/media/imx/imx-media-dev-common.c @@ -85,7 +85,7 @@ static int imx_media_add_vdev_to_pad(struct imx_media_dev *imxmd, dev_dbg(imxmd->md.dev, "adding %s to pad %s:%u\n", vdev->vfd->entity.name, entity->name, srcpad->index); - pad_vdev = devm_kzalloc(imxmd->md.dev, sizeof(*pad_vdev), GFP_KERNEL); + pad_vdev = devm_kzalloc_obj(imxmd->md.dev, *pad_vdev); if (!pad_vdev) return -ENOMEM; @@ -127,9 +127,8 @@ static int imx_media_alloc_pad_vdev_lists(struct imx_media_dev *imxmd) list_for_each_entry(sd, &imxmd->v4l2_dev.subdevs, list) { entity = &sd->entity; - vdev_lists = devm_kcalloc(imxmd->md.dev, - entity->num_pads, sizeof(*vdev_lists), - GFP_KERNEL); + vdev_lists = devm_kzalloc_objs(imxmd->md.dev, *vdev_lists, + entity->num_pads); if (!vdev_lists) return -ENOMEM; @@ -335,7 +334,7 @@ struct imx_media_dev *imx_media_dev_init(struct device *dev, struct imx_media_dev *imxmd; int ret; - imxmd = devm_kzalloc(dev, sizeof(*imxmd), GFP_KERNEL); + imxmd = devm_kzalloc_obj(dev, *imxmd); if (!imxmd) return ERR_PTR(-ENOMEM); diff --git a/drivers/staging/media/imx/imx-media-fim.c b/drivers/staging/media/imx/imx-media-fim.c index ccbc0371fba2..d56019b3632c 100644 --- a/drivers/staging/media/imx/imx-media-fim.c +++ b/drivers/staging/media/imx/imx-media-fim.c @@ -410,7 +410,7 @@ struct imx_media_fim *imx_media_fim_init(struct v4l2_subdev *sd) struct imx_media_fim *fim; int ret; - fim = devm_kzalloc(sd->dev, sizeof(*fim), GFP_KERNEL); + fim = devm_kzalloc_obj(sd->dev, *fim); if (!fim) return ERR_PTR(-ENOMEM); diff --git a/drivers/staging/media/imx/imx-media-vdic.c b/drivers/staging/media/imx/imx-media-vdic.c index 8dcbb6fe7649..4838d11f5f6d 100644 --- a/drivers/staging/media/imx/imx-media-vdic.c +++ b/drivers/staging/media/imx/imx-media-vdic.c @@ -881,7 +881,7 @@ struct v4l2_subdev *imx_media_vdic_register(struct v4l2_device *v4l2_dev, struct vdic_priv *priv; int i, ret; - priv = devm_kzalloc(ipu_dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(ipu_dev, *priv); if (!priv) return ERR_PTR(-ENOMEM); diff --git a/drivers/staging/media/imx/imx6-mipi-csi2.c b/drivers/staging/media/imx/imx6-mipi-csi2.c index f6cbf0310e89..e429aeb345ca 100644 --- a/drivers/staging/media/imx/imx6-mipi-csi2.c +++ b/drivers/staging/media/imx/imx6-mipi-csi2.c @@ -722,7 +722,7 @@ static int csi2_probe(struct platform_device *pdev) struct csi2_dev *csi2; int i, ret; - csi2 = devm_kzalloc(&pdev->dev, sizeof(*csi2), GFP_KERNEL); + csi2 = devm_kzalloc_obj(&pdev->dev, *csi2); if (!csi2) return -ENOMEM; diff --git a/drivers/staging/media/ipu3/ipu3.c b/drivers/staging/media/ipu3/ipu3.c index 84c4d0bf027d..8f8817c83f15 100644 --- a/drivers/staging/media/ipu3/ipu3.c +++ b/drivers/staging/media/ipu3/ipu3.c @@ -622,7 +622,7 @@ static int imgu_pci_probe(struct pci_dev *pci_dev, void __iomem *const *iomap; int r; - imgu = devm_kzalloc(&pci_dev->dev, sizeof(*imgu), GFP_KERNEL); + imgu = devm_kzalloc_obj(&pci_dev->dev, *imgu); if (!imgu) return -ENOMEM; diff --git a/drivers/staging/media/ipu7/ipu7-fw-isys.c b/drivers/staging/media/ipu7/ipu7-fw-isys.c index e4b9c364572b..309830921f2c 100644 --- a/drivers/staging/media/ipu7/ipu7-fw-isys.c +++ b/drivers/staging/media/ipu7/ipu7-fw-isys.c @@ -92,8 +92,7 @@ int ipu7_fw_isys_init(struct ipu7_isys *isys) int ret; /* Allocate and init syscom context. */ - syscom = devm_kzalloc(dev, sizeof(struct ipu7_syscom_context), - GFP_KERNEL); + syscom = devm_kzalloc_obj(dev, struct ipu7_syscom_context); if (!syscom) return -ENOMEM; diff --git a/drivers/staging/media/ipu7/ipu7-isys-subdev.c b/drivers/staging/media/ipu7/ipu7-isys-subdev.c index 2cb0521b4240..a4003132a2cc 100644 --- a/drivers/staging/media/ipu7/ipu7-isys-subdev.c +++ b/drivers/staging/media/ipu7/ipu7-isys-subdev.c @@ -282,8 +282,8 @@ int ipu7_isys_subdev_init(struct ipu7_isys_subdev *asd, asd->sd.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE; asd->sd.internal_ops = &ipu7_isys_subdev_internal_ops; - asd->pad = devm_kcalloc(&asd->isys->adev->auxdev.dev, num_pads, - sizeof(*asd->pad), GFP_KERNEL); + asd->pad = devm_kzalloc_objs(&asd->isys->adev->auxdev.dev, *asd->pad, + num_pads); if (!asd->pad) return -ENOMEM; diff --git a/drivers/staging/media/ipu7/ipu7-isys.c b/drivers/staging/media/ipu7/ipu7-isys.c index a54393fbb9db..f2d778ba9c2a 100644 --- a/drivers/staging/media/ipu7/ipu7-isys.c +++ b/drivers/staging/media/ipu7/ipu7-isys.c @@ -119,7 +119,7 @@ static int isys_fw_log_init(struct ipu7_isys *isys) if (isys->fw_log) return 0; - fw_log = devm_kzalloc(dev, sizeof(*fw_log), GFP_KERNEL); + fw_log = devm_kzalloc_obj(dev, *fw_log); if (!fw_log) return -ENOMEM; @@ -706,7 +706,7 @@ static int isys_probe(struct auxiliary_device *auxdev, if (!isp->ipu7_bus_ready_to_probe) return -EPROBE_DEFER; - isys = devm_kzalloc(&auxdev->dev, sizeof(*isys), GFP_KERNEL); + isys = devm_kzalloc_obj(&auxdev->dev, *isys); if (!isys) return -ENOMEM; @@ -723,8 +723,8 @@ static int isys_probe(struct auxiliary_device *auxdev, INIT_LIST_HEAD(&isys->requests); csi2_pdata = &isys->pdata->ipdata->csi2; - isys->csi2 = devm_kcalloc(&auxdev->dev, csi2_pdata->nports, - sizeof(*isys->csi2), GFP_KERNEL); + isys->csi2 = devm_kzalloc_objs(&auxdev->dev, *isys->csi2, + csi2_pdata->nports); if (!isys->csi2) { ret = -ENOMEM; goto out_runtime_put; diff --git a/drivers/staging/media/ipu7/ipu7-mmu.c b/drivers/staging/media/ipu7/ipu7-mmu.c index 6ded07ccd780..b50ae3722593 100644 --- a/drivers/staging/media/ipu7/ipu7-mmu.c +++ b/drivers/staging/media/ipu7/ipu7-mmu.c @@ -802,7 +802,7 @@ struct ipu7_mmu *ipu7_mmu_init(struct device *dev, if (hw->nr_mmus > IPU_MMU_MAX_NUM) return ERR_PTR(-EINVAL); - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); @@ -820,7 +820,7 @@ struct ipu7_mmu *ipu7_mmu_init(struct device *dev, pdata_mmu->uao_base = base + src_mmu->uao_offset; } - mmu = devm_kzalloc(dev, sizeof(*mmu), GFP_KERNEL); + mmu = devm_kzalloc_obj(dev, *mmu); if (!mmu) return ERR_PTR(-ENOMEM); diff --git a/drivers/staging/media/ipu7/ipu7.c b/drivers/staging/media/ipu7/ipu7.c index 88e362c7ae35..543c9f08da88 100644 --- a/drivers/staging/media/ipu7/ipu7.c +++ b/drivers/staging/media/ipu7/ipu7.c @@ -2424,7 +2424,7 @@ static int ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (!fwnode || fwnode_property_read_u32(fwnode, "is_es", &is_es)) is_es = 0; - isp = devm_kzalloc(dev, sizeof(*isp), GFP_KERNEL); + isp = devm_kzalloc_obj(dev, *isp); if (!isp) return -ENOMEM; diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/media/meson/vdec/vdec.c index be29d5a11c2e..3e086223c4f8 100644 --- a/drivers/staging/media/meson/vdec/vdec.c +++ b/drivers/staging/media/meson/vdec/vdec.c @@ -992,7 +992,7 @@ static int vdec_probe(struct platform_device *pdev) int irq; int ret; - core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); + core = devm_kzalloc_obj(dev, *core); if (!core) return -ENOMEM; diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c index c3331b4f3f02..d060dcd3c01c 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c @@ -456,7 +456,7 @@ static int cedrus_probe(struct platform_device *pdev) struct video_device *vfd; int ret; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c b/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c index 6877f2beee8c..d6685442ce62 100644 --- a/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c +++ b/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c @@ -428,7 +428,7 @@ static int sun6i_isp_probe(struct platform_device *platform_dev) if (!variant) return -EINVAL; - isp_dev = devm_kzalloc(dev, sizeof(*isp_dev), GFP_KERNEL); + isp_dev = devm_kzalloc_obj(dev, *isp_dev); if (!isp_dev) return -ENOMEM; diff --git a/drivers/staging/media/tegra-video/csi.c b/drivers/staging/media/tegra-video/csi.c index 5a5fca378ae6..a18515c45320 100644 --- a/drivers/staging/media/tegra-video/csi.c +++ b/drivers/staging/media/tegra-video/csi.c @@ -791,7 +791,7 @@ static int tegra_csi_probe(struct platform_device *pdev) unsigned int i; int ret; - csi = devm_kzalloc(&pdev->dev, sizeof(*csi), GFP_KERNEL); + csi = devm_kzalloc_obj(&pdev->dev, *csi); if (!csi) return -ENOMEM; @@ -801,8 +801,8 @@ static int tegra_csi_probe(struct platform_device *pdev) csi->soc = of_device_get_match_data(&pdev->dev); - csi->clks = devm_kcalloc(&pdev->dev, csi->soc->num_clks, - sizeof(*csi->clks), GFP_KERNEL); + csi->clks = devm_kzalloc_objs(&pdev->dev, *csi->clks, + csi->soc->num_clks); if (!csi->clks) return -ENOMEM; diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c index d8c77d1290ef..720433591771 100644 --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c @@ -1864,7 +1864,7 @@ static int tegra_vi_probe(struct platform_device *pdev) struct tegra_vi *vi; int ret; - vi = devm_kzalloc(&pdev->dev, sizeof(*vi), GFP_KERNEL); + vi = devm_kzalloc_obj(&pdev->dev, *vi); if (!vi) return -ENOMEM; diff --git a/drivers/staging/media/tegra-video/vip.c b/drivers/staging/media/tegra-video/vip.c index 5fba11e31e1d..b73ba0eab557 100644 --- a/drivers/staging/media/tegra-video/vip.c +++ b/drivers/staging/media/tegra-video/vip.c @@ -227,7 +227,7 @@ static int tegra_vip_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "Probing VIP \"%s\" from %pOF\n", pdev->name, pdev->dev.of_node); - vip = devm_kzalloc(&pdev->dev, sizeof(*vip), GFP_KERNEL); + vip = devm_kzalloc_obj(&pdev->dev, *vip); if (!vip) return -ENOMEM; diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 41cbdfdc1da6..b4ad6cb275da 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -797,7 +797,7 @@ static int tegra_nvec_probe(struct platform_device *pdev) return -ENODEV; } - nvec = devm_kzalloc(dev, sizeof(struct nvec_chip), GFP_KERNEL); + nvec = devm_kzalloc_obj(dev, struct nvec_chip); if (!nvec) return -ENOMEM; diff --git a/drivers/staging/nvec/nvec_paz00.c b/drivers/staging/nvec/nvec_paz00.c index 55d59840fca4..81cc7b99142f 100644 --- a/drivers/staging/nvec/nvec_paz00.c +++ b/drivers/staging/nvec/nvec_paz00.c @@ -42,7 +42,7 @@ static int nvec_paz00_probe(struct platform_device *pdev) struct nvec_led *led; int ret = 0; - led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); + led = devm_kzalloc_obj(&pdev->dev, *led); if (!led) return -ENOMEM; diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c index c514d51a9e57..c9173a0609c0 100644 --- a/drivers/staging/nvec/nvec_power.c +++ b/drivers/staging/nvec/nvec_power.c @@ -377,7 +377,7 @@ static int nvec_power_probe(struct platform_device *pdev) struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); struct power_supply_config psy_cfg = {}; - power = devm_kzalloc(&pdev->dev, sizeof(struct nvec_power), GFP_KERNEL); + power = devm_kzalloc_obj(&pdev->dev, struct nvec_power); if (!power) return -ENOMEM; diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 42ec4b8324a8..dea5696a6642 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c @@ -695,7 +695,7 @@ static int cvm_oct_probe(struct platform_device *pdev) int mtu_overhead = ETH_HLEN + ETH_FCS_LEN; struct octeon_ethernet_platform *plat; - plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); + plat = devm_kzalloc_obj(&pdev->dev, *plat); if (!plat) return -ENOMEM; diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 21e310274330..6ce02ea48d2c 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -973,7 +973,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, return err; err = -ENOMEM; - sm750_dev = devm_kzalloc(&pdev->dev, sizeof(*sm750_dev), GFP_KERNEL); + sm750_dev = devm_kzalloc_obj(&pdev->dev, *sm750_dev); if (!sm750_dev) return err; diff --git a/drivers/thermal/airoha_thermal.c b/drivers/thermal/airoha_thermal.c index 7c63a1b44a6b..e328b6a0cf53 100644 --- a/drivers/thermal/airoha_thermal.c +++ b/drivers/thermal/airoha_thermal.c @@ -729,7 +729,7 @@ static int airoha_thermal_probe(struct platform_device *pdev) soc_data = device_get_match_data(dev); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -751,7 +751,7 @@ static int airoha_thermal_probe(struct platform_device *pdev) struct airoha_thermal_zone *zone; struct thermal_zone_device *tz; - zone = devm_kzalloc(dev, sizeof(*zone), GFP_KERNEL); + zone = devm_kzalloc_obj(dev, *zone); if (!zone) return -ENOMEM; diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c index 60728de6968a..5f2565d02829 100644 --- a/drivers/thermal/amlogic_thermal.c +++ b/drivers/thermal/amlogic_thermal.c @@ -307,7 +307,7 @@ static int amlogic_thermal_probe(struct platform_device *pdev) void __iomem *base; int ret; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index ff63b4f2b977..83672f95b011 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -821,11 +821,11 @@ static int armada_thermal_probe(struct platform_device *pdev) if (!match) return -ENODEV; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; - drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, *drvdata); if (!drvdata) return -ENOMEM; @@ -910,9 +910,8 @@ static int armada_thermal_probe(struct platform_device *pdev) * channel has one sensor. */ for (sensor_id = 0; sensor_id <= priv->data->cpu_nr; sensor_id++) { - sensor = devm_kzalloc(&pdev->dev, - sizeof(struct armada_thermal_sensor), - GFP_KERNEL); + sensor = devm_kzalloc_obj(&pdev->dev, + struct armada_thermal_sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/bcm2711_thermal.c index 03ac2d02e9d4..5ebc987ff985 100644 --- a/drivers/thermal/broadcom/bcm2711_thermal.c +++ b/drivers/thermal/broadcom/bcm2711_thermal.c @@ -73,7 +73,7 @@ static int bcm2711_thermal_probe(struct platform_device *pdev) struct regmap *regmap; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c index c5105dfc6ec9..d2200f36907f 100644 --- a/drivers/thermal/broadcom/bcm2835_thermal.c +++ b/drivers/thermal/broadcom/bcm2835_thermal.c @@ -120,7 +120,7 @@ static void bcm2835_thermal_debugfs(struct platform_device *pdev) data->debugfsdir = debugfs_create_dir("bcm2835_thermal", NULL); - regset = devm_kzalloc(&pdev->dev, sizeof(*regset), GFP_KERNEL); + regset = devm_kzalloc_obj(&pdev->dev, *regset); if (!regset) return; @@ -167,7 +167,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) u32 val; unsigned long rate; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 5e23f9e00847..7403fa7a77ec 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -326,7 +326,7 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) struct brcmstb_thermal_priv *priv; int irq, ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/thermal/broadcom/sr-thermal.c b/drivers/thermal/broadcom/sr-thermal.c index 9a29dfd4c7fe..f8d1d7b013b3 100644 --- a/drivers/thermal/broadcom/sr-thermal.c +++ b/drivers/thermal/broadcom/sr-thermal.c @@ -55,7 +55,7 @@ static int sr_thermal_probe(struct platform_device *pdev) unsigned int i; int ret; - sr_thermal = devm_kzalloc(dev, sizeof(*sr_thermal), GFP_KERNEL); + sr_thermal = devm_kzalloc_obj(dev, *sr_thermal); if (!sr_thermal) return -ENOMEM; diff --git a/drivers/thermal/da9062-thermal.c b/drivers/thermal/da9062-thermal.c index a8d4b766ba21..515ca492a4e3 100644 --- a/drivers/thermal/da9062-thermal.c +++ b/drivers/thermal/da9062-thermal.c @@ -182,8 +182,7 @@ static int da9062_thermal_probe(struct platform_device *pdev) } } - thermal = devm_kzalloc(&pdev->dev, sizeof(struct da9062_thermal), - GFP_KERNEL); + thermal = devm_kzalloc_obj(&pdev->dev, struct da9062_thermal); if (!thermal) { ret = -ENOMEM; goto err; diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c index 46005b476722..48981247763f 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c @@ -154,7 +154,7 @@ static int db8500_thermal_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int low_irq, high_irq, ret = 0; - th = devm_kzalloc(dev, sizeof(*th), GFP_KERNEL); + th = devm_kzalloc_obj(dev, *th); if (!th) return -ENOMEM; diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c index 723bc72f0626..0bfdc9ffcea8 100644 --- a/drivers/thermal/dove_thermal.c +++ b/drivers/thermal/dove_thermal.c @@ -121,7 +121,7 @@ static int dove_thermal_probe(struct platform_device *pdev) struct dove_thermal_priv *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 17ed0c5b7767..9986fb09b177 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -393,7 +393,7 @@ static int hi6220_thermal_probe(struct hisi_thermal_data *data) if (IS_ERR(data->clk)) return dev_err_probe(dev, PTR_ERR(data->clk), "failed to get thermal clk\n"); - data->sensor = devm_kzalloc(dev, sizeof(*data->sensor), GFP_KERNEL); + data->sensor = devm_kzalloc_obj(dev, *data->sensor); if (!data->sensor) return -ENOMEM; @@ -412,8 +412,7 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data) data->nr_sensors = 1; - data->sensor = devm_kcalloc(dev, data->nr_sensors, - sizeof(*data->sensor), GFP_KERNEL); + data->sensor = devm_kzalloc_objs(dev, *data->sensor, data->nr_sensors); if (!data->sensor) return -ENOMEM; @@ -544,7 +543,7 @@ static int hisi_thermal_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int i, ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c index 719d71f5b235..8cf9d554a218 100644 --- a/drivers/thermal/imx8mm_thermal.c +++ b/drivers/thermal/imx8mm_thermal.c @@ -300,8 +300,7 @@ static int imx8mm_tmu_probe(struct platform_device *pdev) data = of_device_get_match_data(&pdev->dev); - tmu = devm_kzalloc(&pdev->dev, struct_size(tmu, sensors, - data->num_sensors), GFP_KERNEL); + tmu = devm_kzalloc_flex(&pdev->dev, *tmu, sensors, data->num_sensors); if (!tmu) return -ENOMEM; diff --git a/drivers/thermal/imx91_thermal.c b/drivers/thermal/imx91_thermal.c index 196ee20fce1e..6d0aba992244 100644 --- a/drivers/thermal/imx91_thermal.c +++ b/drivers/thermal/imx91_thermal.c @@ -239,7 +239,7 @@ static int imx91_tmu_probe(struct platform_device *pdev) int irq, ret; u32 div; - tmu = devm_kzalloc(dev, sizeof(struct imx91_tmu), GFP_KERNEL); + tmu = devm_kzalloc_obj(dev, struct imx91_tmu); if (!tmu) return -ENOMEM; diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c index 88558ce58880..28154dffdaf8 100644 --- a/drivers/thermal/imx_sc_thermal.c +++ b/drivers/thermal/imx_sc_thermal.c @@ -85,7 +85,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev) for (i = 0; resource_id[i] >= 0; i++) { - sensor = devm_kzalloc(&pdev->dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(&pdev->dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 887d381541a3..1a57aa9dc900 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -590,7 +590,7 @@ static int imx_thermal_probe(struct platform_device *pdev) int measure_freq; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c index 96d6277a5a8c..ffaf1911c1b8 100644 --- a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c @@ -23,7 +23,7 @@ static int int3401_add(struct platform_device *pdev) struct proc_thermal_device *proc_priv; int ret; - proc_priv = devm_kzalloc(&pdev->dev, sizeof(*proc_priv), GFP_KERNEL); + proc_priv = devm_kzalloc_obj(&pdev->dev, *proc_priv); if (!proc_priv) return -ENOMEM; diff --git a/drivers/thermal/intel/int340x_thermal/int3402_thermal.c b/drivers/thermal/intel/int340x_thermal/int3402_thermal.c index 57b90005888a..2691f585e2d2 100644 --- a/drivers/thermal/intel/int340x_thermal/int3402_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3402_thermal.c @@ -51,7 +51,7 @@ static int int3402_thermal_probe(struct platform_device *pdev) if (!acpi_has_method(adev->handle, "_TMP")) return -ENODEV; - d = devm_kzalloc(&pdev->dev, sizeof(*d), GFP_KERNEL); + d = devm_kzalloc_obj(&pdev->dev, *d); if (!d) return -ENOMEM; diff --git a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c index 2262de1e14d9..65ad648bece7 100644 --- a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c @@ -73,7 +73,7 @@ static int int3403_sensor_add(struct int3403_priv *priv) int result = 0; struct int3403_sensor *obj; - obj = devm_kzalloc(&priv->pdev->dev, sizeof(*obj), GFP_KERNEL); + obj = devm_kzalloc_obj(&priv->pdev->dev, *obj); if (!obj) return -ENOMEM; @@ -160,7 +160,7 @@ static int int3403_cdev_add(struct int3403_priv *priv) struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *p; - obj = devm_kzalloc(&priv->pdev->dev, sizeof(*obj), GFP_KERNEL); + obj = devm_kzalloc_obj(&priv->pdev->dev, *obj); if (!obj) return -ENOMEM; @@ -204,8 +204,7 @@ static int int3403_add(struct platform_device *pdev) unsigned long long tmp; acpi_status status; - priv = devm_kzalloc(&pdev->dev, sizeof(struct int3403_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct int3403_priv); if (!priv) return -ENOMEM; diff --git a/drivers/thermal/intel/int340x_thermal/int3406_thermal.c b/drivers/thermal/intel/int340x_thermal/int3406_thermal.c index e21fcbccf4ba..7b2ad59733b4 100644 --- a/drivers/thermal/intel/int340x_thermal/int3406_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3406_thermal.c @@ -141,7 +141,7 @@ static int int3406_thermal_probe(struct platform_device *pdev) if (!ACPI_HANDLE(&pdev->dev)) return -ENODEV; - d = devm_kzalloc(&pdev->dev, sizeof(*d), GFP_KERNEL); + d = devm_kzalloc_obj(&pdev->dev, *d); if (!d) return -ENOMEM; d->handle = ACPI_HANDLE(&pdev->dev); diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c index c5131423ec9b..7d6fee59ade2 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c @@ -334,11 +334,11 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_ }; int irq_flag = 0, irq, ret; - proc_priv = devm_kzalloc(&pdev->dev, sizeof(*proc_priv), GFP_KERNEL); + proc_priv = devm_kzalloc_obj(&pdev->dev, *proc_priv); if (!proc_priv) return -ENOMEM; - pci_info = devm_kzalloc(&pdev->dev, sizeof(*pci_info), GFP_KERNEL); + pci_info = devm_kzalloc_obj(&pdev->dev, *pci_info); if (!pci_info) return -ENOMEM; diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci_legacy.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci_legacy.c index ccfdd2f9d973..5a474db14a36 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci_legacy.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci_legacy.c @@ -40,7 +40,7 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, return ret; } - proc_priv = devm_kzalloc(&pdev->dev, sizeof(*proc_priv), GFP_KERNEL); + proc_priv = devm_kzalloc_obj(&pdev->dev, *proc_priv); if (!proc_priv) return -ENOMEM; diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/intel/intel_pch_thermal.c index 52e71af67dc6..074bc8ca5f0f 100644 --- a/drivers/thermal/intel/intel_pch_thermal.c +++ b/drivers/thermal/intel/intel_pch_thermal.c @@ -168,7 +168,7 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev, u8 tsel; int err; - ptd = devm_kzalloc(&pdev->dev, sizeof(*ptd), GFP_KERNEL); + ptd = devm_kzalloc_obj(&pdev->dev, *ptd); if (!ptd) return -ENOMEM; diff --git a/drivers/thermal/k3_bandgap.c b/drivers/thermal/k3_bandgap.c index 678d6ed711b5..7ac348f724a6 100644 --- a/drivers/thermal/k3_bandgap.c +++ b/drivers/thermal/k3_bandgap.c @@ -168,7 +168,7 @@ static int k3_bandgap_probe(struct platform_device *pdev) K3_VTM_ADC_BEGIN_VAL)) return -EINVAL; - bgp = devm_kzalloc(&pdev->dev, sizeof(*bgp), GFP_KERNEL); + bgp = devm_kzalloc_obj(&pdev->dev, *bgp); if (!bgp) return -ENOMEM; @@ -190,7 +190,7 @@ static int k3_bandgap_probe(struct platform_device *pdev) cnt = val & K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK; cnt >>= __ffs(K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK); - data = devm_kcalloc(dev, cnt, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_objs(dev, *data, cnt); if (!data) { ret = -ENOMEM; goto err_alloc; diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_bandgap.c index 6aba00d8b8fd..5debfd5dfb9b 100644 --- a/drivers/thermal/k3_j72xx_bandgap.c +++ b/drivers/thermal/k3_j72xx_bandgap.c @@ -402,7 +402,7 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev) -1157800000000, }; - bgp = devm_kzalloc(&pdev->dev, sizeof(*bgp), GFP_KERNEL); + bgp = devm_kzalloc_obj(&pdev->dev, *bgp); if (!bgp) return -ENOMEM; @@ -456,7 +456,7 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev) bgp->cnt = val & K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK; bgp->cnt >>= __ffs(K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK); - data = devm_kcalloc(bgp->dev, bgp->cnt, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_objs(bgp->dev, *data, bgp->cnt); if (!data) { ret = -ENOMEM; goto err_alloc; @@ -468,8 +468,7 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev) goto err_alloc; } - derived_table = devm_kcalloc(bgp->dev, TABLE_SIZE, sizeof(*derived_table), - GFP_KERNEL); + derived_table = devm_kzalloc_objs(bgp->dev, *derived_table, TABLE_SIZE); if (!derived_table) { ret = -ENOMEM; goto err_free_ref_table; diff --git a/drivers/thermal/khadas_mcu_fan.c b/drivers/thermal/khadas_mcu_fan.c index 1da639d05497..9bda503615fe 100644 --- a/drivers/thermal/khadas_mcu_fan.c +++ b/drivers/thermal/khadas_mcu_fan.c @@ -109,7 +109,7 @@ static int khadas_mcu_fan_probe(struct platform_device *pdev) if (!id) return -EINVAL; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c index 4619e090f756..7519a97d7828 100644 --- a/drivers/thermal/kirkwood_thermal.c +++ b/drivers/thermal/kirkwood_thermal.c @@ -63,7 +63,7 @@ static int kirkwood_thermal_probe(struct platform_device *pdev) struct kirkwood_thermal_priv *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/thermal/loongson2_thermal.c b/drivers/thermal/loongson2_thermal.c index 4d40fc706a53..197ed24d99e7 100644 --- a/drivers/thermal/loongson2_thermal.c +++ b/drivers/thermal/loongson2_thermal.c @@ -129,7 +129,7 @@ static int loongson2_thermal_probe(struct platform_device *pdev) struct thermal_zone_device *tzd; int ret, irq, i; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_thermal.c index f4a1535f4806..1456dcc1d4d8 100644 --- a/drivers/thermal/max77620_thermal.c +++ b/drivers/thermal/max77620_thermal.c @@ -88,7 +88,7 @@ static int max77620_thermal_probe(struct platform_device *pdev) struct max77620_therm_info *mtherm; int ret; - mtherm = devm_kzalloc(&pdev->dev, sizeof(*mtherm), GFP_KERNEL); + mtherm = devm_kzalloc_obj(&pdev->dev, *mtherm); if (!mtherm) return -ENOMEM; diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c index 9ee2e7283435..434f856c0f04 100644 --- a/drivers/thermal/mediatek/auxadc_thermal.c +++ b/drivers/thermal/mediatek/auxadc_thermal.c @@ -1200,7 +1200,7 @@ static int mtk_thermal_probe(struct platform_device *pdev) struct thermal_zone_device *tzdev; void __iomem *apmixed_base, *auxadc_base; - mt = devm_kzalloc(&pdev->dev, sizeof(*mt), GFP_KERNEL); + mt = devm_kzalloc_obj(&pdev->dev, *mt); if (!mt) return -ENOMEM; diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c index 52f99f3e6450..350fffd3e5a2 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -276,7 +276,7 @@ static int lvts_debugfs_init(struct device *dev, struct lvts_domain *lvts_td) if (IS_ERR(dentry)) continue; - regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL); + regset = devm_kzalloc_obj(dev, *regset); if (!regset) continue; @@ -1450,7 +1450,7 @@ static int lvts_probe(struct platform_device *pdev) struct resource *res; int irq, ret; - lvts_td = devm_kzalloc(dev, sizeof(*lvts_td), GFP_KERNEL); + lvts_td = devm_kzalloc_obj(dev, *lvts_td); if (!lvts_td) return -ENOMEM; diff --git a/drivers/thermal/qcom/lmh.c b/drivers/thermal/qcom/lmh.c index 99396b93eff5..6bfe25021e05 100644 --- a/drivers/thermal/qcom/lmh.c +++ b/drivers/thermal/qcom/lmh.c @@ -107,7 +107,7 @@ static int lmh_probe(struct platform_device *pdev) if (!qcom_scm_is_available()) return -EPROBE_DEFER; - lmh_data = devm_kzalloc(dev, sizeof(*lmh_data), GFP_KERNEL); + lmh_data = devm_kzalloc_obj(dev, *lmh_data); if (!lmh_data) return -ENOMEM; diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5-gen3.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5-gen3.c index 9cf552d36868..910b241fa94d 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5-gen3.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5-gen3.c @@ -347,7 +347,7 @@ static int adc_tm5_probe(struct auxiliary_device *aux_dev, struct device *dev = &aux_dev->dev; int ret; - adc_tm5 = devm_kzalloc(dev, sizeof(*adc_tm5), GFP_KERNEL); + adc_tm5 = devm_kzalloc_obj(dev, *adc_tm5); if (!adc_tm5) return -ENOMEM; @@ -356,8 +356,8 @@ static int adc_tm5_probe(struct auxiliary_device *aux_dev, adc_tm5->dev = dev; adc_tm5->dev_data = aux_dev_wrapper->dev_data; adc_tm5->nchannels = aux_dev_wrapper->n_tm_channels; - adc_tm5->chan_props = devm_kcalloc(dev, aux_dev_wrapper->n_tm_channels, - sizeof(*adc_tm5->chan_props), GFP_KERNEL); + adc_tm5->chan_props = devm_kzalloc_objs(dev, *adc_tm5->chan_props, + aux_dev_wrapper->n_tm_channels); if (!adc_tm5->chan_props) return -ENOMEM; diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c index 4554a6fa55d1..12d30affcc5d 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c @@ -943,8 +943,8 @@ static int adc_tm5_get_dt_data(struct adc_tm5_chip *adc_tm, struct device_node * if (!adc_tm->nchannels) return -EINVAL; - adc_tm->channels = devm_kcalloc(dev, adc_tm->nchannels, - sizeof(*adc_tm->channels), GFP_KERNEL); + adc_tm->channels = devm_kzalloc_objs(dev, *adc_tm->channels, + adc_tm->nchannels); if (!adc_tm->channels) return -ENOMEM; @@ -1006,7 +1006,7 @@ static int adc_tm5_probe(struct platform_device *pdev) if (ret) return ret; - adc_tm = devm_kzalloc(&pdev->dev, sizeof(*adc_tm), GFP_KERNEL); + adc_tm = devm_kzalloc_obj(&pdev->dev, *adc_tm); if (!adc_tm) return -ENOMEM; diff --git a/drivers/thermal/qcom/qcom-spmi-mbg-tm.c b/drivers/thermal/qcom/qcom-spmi-mbg-tm.c index a05bb444627a..512bfda54048 100644 --- a/drivers/thermal/qcom/qcom-spmi-mbg-tm.c +++ b/drivers/thermal/qcom/qcom-spmi-mbg-tm.c @@ -202,7 +202,7 @@ static int mbg_tm_probe(struct platform_device *pdev) u32 res; int ret; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c index 911ebfd0cdeb..9fb63fa36fa7 100644 --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c @@ -765,7 +765,7 @@ static int qpnp_tm_probe(struct platform_device *pdev) node = pdev->dev.of_node; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 4d7013fc79d6..ff7c573c6a21 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -1410,9 +1410,7 @@ static int tsens_probe(struct platform_device *pdev) return -EINVAL; } - priv = devm_kzalloc(dev, - struct_size(priv, sensor, num_sensors), - GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, sensor, num_sensors); if (!priv) return -ENOMEM; diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c index 297724e81593..320ad33bd160 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -334,8 +334,7 @@ static int qoriq_tmu_probe(struct platform_device *pdev) }; void __iomem *base; - data = devm_kzalloc(dev, sizeof(struct qoriq_tmu_data), - GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct qoriq_tmu_data); if (!data) return -ENOMEM; diff --git a/drivers/thermal/renesas/rcar_gen3_thermal.c b/drivers/thermal/renesas/rcar_gen3_thermal.c index 94804816e9e1..9c64cbc2ee67 100644 --- a/drivers/thermal/renesas/rcar_gen3_thermal.c +++ b/drivers/thermal/renesas/rcar_gen3_thermal.c @@ -518,7 +518,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) unsigned int i; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -540,7 +540,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) if (!res) break; - tsc = devm_kzalloc(dev, sizeof(*tsc), GFP_KERNEL); + tsc = devm_kzalloc_obj(dev, *tsc); if (!tsc) { ret = -ENOMEM; goto error_unregister; diff --git a/drivers/thermal/renesas/rcar_thermal.c b/drivers/thermal/renesas/rcar_thermal.c index 9a9038671b04..af6d09a75bb6 100644 --- a/drivers/thermal/renesas/rcar_thermal.c +++ b/drivers/thermal/renesas/rcar_thermal.c @@ -403,7 +403,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) int idle = IDLE_INTERVAL; u32 enr_bits = 0; - common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); + common = devm_kzalloc_obj(dev, *common); if (!common) return -ENOMEM; @@ -459,7 +459,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) if (!res) break; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) { ret = -ENOMEM; goto error_unregister; diff --git a/drivers/thermal/renesas/rzg2l_thermal.c b/drivers/thermal/renesas/rzg2l_thermal.c index d9afd0619167..90e2ba378a4b 100644 --- a/drivers/thermal/renesas/rzg2l_thermal.c +++ b/drivers/thermal/renesas/rzg2l_thermal.c @@ -164,7 +164,7 @@ static int rzg2l_thermal_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/thermal/renesas/rzg3e_thermal.c b/drivers/thermal/renesas/rzg3e_thermal.c index e806d130dc53..bba1eecf19e4 100644 --- a/drivers/thermal/renesas/rzg3e_thermal.c +++ b/drivers/thermal/renesas/rzg3e_thermal.c @@ -402,7 +402,7 @@ static int rzg3e_thermal_probe(struct platform_device *pdev) struct clk *clk; int irq, ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/thermal/renesas/rzg3s_thermal.c b/drivers/thermal/renesas/rzg3s_thermal.c index a8716da7fcd2..7582c770ba4a 100644 --- a/drivers/thermal/renesas/rzg3s_thermal.c +++ b/drivers/thermal/renesas/rzg3s_thermal.c @@ -191,7 +191,7 @@ static int rzg3s_thermal_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 08891608baa6..5e32703960ba 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1702,8 +1702,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev) if (irq < 0) return -EINVAL; - thermal = devm_kzalloc(&pdev->dev, sizeof(struct rockchip_thermal_data), - GFP_KERNEL); + thermal = devm_kzalloc_obj(&pdev->dev, struct rockchip_thermal_data); if (!thermal) return -ENOMEM; @@ -1713,8 +1712,8 @@ static int rockchip_thermal_probe(struct platform_device *pdev) if (!thermal->chip) return -EINVAL; - thermal->sensors = devm_kcalloc(&pdev->dev, thermal->chip->chn_num, - sizeof(*thermal->sensors), GFP_KERNEL); + thermal->sensors = devm_kzalloc_objs(&pdev->dev, *thermal->sensors, + thermal->chip->chn_num); if (!thermal->sensors) return -ENOMEM; diff --git a/drivers/thermal/samsung/acpm-tmu.c b/drivers/thermal/samsung/acpm-tmu.c index f9802080acd7..b86dfa3c3ddb 100644 --- a/drivers/thermal/samsung/acpm-tmu.c +++ b/drivers/thermal/samsung/acpm-tmu.c @@ -416,9 +416,7 @@ static int acpm_tmu_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(acpm_handle), "Failed to get ACPM handle\n"); - priv = devm_kzalloc(dev, - struct_size(priv, sensors, data->num_sensor_groups), - GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, sensors, data->num_sensor_groups); if (!priv) return -ENOMEM; diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 56717bb50d60..0f9e1cbf6652 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1008,7 +1008,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) struct exynos_tmu_data *data; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/thermal/spacemit/k1_tsensor.c b/drivers/thermal/spacemit/k1_tsensor.c index ef91453e5538..568ada885cff 100644 --- a/drivers/thermal/spacemit/k1_tsensor.c +++ b/drivers/thermal/spacemit/k1_tsensor.c @@ -239,7 +239,7 @@ static int k1_tsensor_probe(struct platform_device *pdev) struct clk *clk; int i, irq, ret; - ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c index 5e3e9c1f32f8..4cf7c570be64 100644 --- a/drivers/thermal/spear_thermal.c +++ b/drivers/thermal/spear_thermal.c @@ -98,7 +98,7 @@ static int spear_thermal_probe(struct platform_device *pdev) return -EINVAL; } - stdev = devm_kzalloc(&pdev->dev, sizeof(*stdev), GFP_KERNEL); + stdev = devm_kzalloc_obj(&pdev->dev, *stdev); if (!stdev) return -ENOMEM; diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c index b57277e2eac0..4b1950f5e642 100644 --- a/drivers/thermal/sprd_thermal.c +++ b/drivers/thermal/sprd_thermal.c @@ -344,7 +344,7 @@ static int sprd_thm_probe(struct platform_device *pdev) return -EINVAL; } - thm = devm_kzalloc(&pdev->dev, sizeof(*thm), GFP_KERNEL); + thm = devm_kzalloc_obj(&pdev->dev, *thm); if (!thm) return -ENOMEM; @@ -381,7 +381,7 @@ static int sprd_thm_probe(struct platform_device *pdev) return ret; for_each_child_of_node(np, sen_child) { - sen = devm_kzalloc(&pdev->dev, sizeof(*sen), GFP_KERNEL); + sen = devm_kzalloc_obj(&pdev->dev, *sen); if (!sen) { ret = -ENOMEM; goto of_put; diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c index 1470ca519def..d678d1e5fe75 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -151,7 +151,7 @@ int st_thermal_register(struct platform_device *pdev, return -EINVAL; } - sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c index 3290da7ab607..46d1db8618e9 100644 --- a/drivers/thermal/st/stm_thermal.c +++ b/drivers/thermal/st/stm_thermal.c @@ -489,7 +489,7 @@ static int stm_thermal_probe(struct platform_device *pdev) return -EINVAL; } - sensor = devm_kzalloc(&pdev->dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(&pdev->dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 284684137c43..b3f551e02886 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -556,7 +556,7 @@ static int sun8i_ths_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret, irq; - tmdev = devm_kzalloc(dev, sizeof(*tmdev), GFP_KERNEL); + tmdev = devm_kzalloc_obj(dev, *tmdev); if (!tmdev) return -ENOMEM; diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index f74acf13b24d..fa179dfd76e3 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -1561,7 +1561,7 @@ static int soctherm_thermtrips_parse(struct platform_device *pdev) n = min(max_num_prop, n); - tlb = devm_kcalloc(&pdev->dev, max_num_prop, sizeof(u32), GFP_KERNEL); + tlb = devm_kzalloc_objs(&pdev->dev, u32, max_num_prop); if (!tlb) return -ENOMEM; ret = of_property_read_u32_array(dev->of_node, "nvidia,thermtrips", @@ -2101,7 +2101,7 @@ static int tegra_soctherm_probe(struct platform_device *pdev) if (soc->num_ttgs > TEGRA124_SOCTHERM_SENSOR_NUM) return -EINVAL; - tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL); + tegra = devm_kzalloc_obj(&pdev->dev, *tegra); if (!tegra) return -ENOMEM; @@ -2148,9 +2148,7 @@ static int tegra_soctherm_probe(struct platform_device *pdev) return PTR_ERR(tegra->clock_soctherm); } - tegra->calib = devm_kcalloc(&pdev->dev, - soc->num_tsensors, sizeof(u32), - GFP_KERNEL); + tegra->calib = devm_kzalloc_objs(&pdev->dev, u32, soc->num_tsensors); if (!tegra->calib) return -ENOMEM; @@ -2168,9 +2166,7 @@ static int tegra_soctherm_probe(struct platform_device *pdev) return err; } - tegra->thermctl_tzs = devm_kcalloc(&pdev->dev, - soc->num_ttgs, sizeof(z), - GFP_KERNEL); + tegra->thermctl_tzs = devm_kzalloc_objs(&pdev->dev, z, soc->num_ttgs); if (!tegra->thermctl_tzs) return -ENOMEM; @@ -2189,8 +2185,8 @@ static int tegra_soctherm_probe(struct platform_device *pdev) soctherm_init(pdev); for (i = 0; i < soc->num_ttgs; ++i) { - struct tegra_thermctl_zone *zone = - devm_kzalloc(&pdev->dev, sizeof(*zone), GFP_KERNEL); + struct tegra_thermctl_zone *zone = devm_kzalloc_obj(&pdev->dev, + *zone); if (!zone) return -ENOMEM; diff --git a/drivers/thermal/tegra/tegra-bpmp-thermal.c b/drivers/thermal/tegra/tegra-bpmp-thermal.c index 997d77ce30d9..5ac1f63e163e 100644 --- a/drivers/thermal/tegra/tegra-bpmp-thermal.c +++ b/drivers/thermal/tegra/tegra-bpmp-thermal.c @@ -230,7 +230,7 @@ static int tegra_bpmp_thermal_probe(struct platform_device *pdev) else thermal_ops = &tegra_bpmp_of_thermal_ops_notrips; - tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL); + tegra = devm_kzalloc_obj(&pdev->dev, *tegra); if (!tegra) return -ENOMEM; @@ -244,8 +244,8 @@ static int tegra_bpmp_thermal_probe(struct platform_device *pdev) return err; } - tegra->zones = devm_kcalloc(&pdev->dev, max_num_zones, - sizeof(*tegra->zones), GFP_KERNEL); + tegra->zones = devm_kzalloc_objs(&pdev->dev, *tegra->zones, + max_num_zones); if (!tegra->zones) return -ENOMEM; @@ -253,7 +253,7 @@ static int tegra_bpmp_thermal_probe(struct platform_device *pdev) struct tegra_bpmp_thermal_zone *zone; int temp; - zone = devm_kzalloc(&pdev->dev, sizeof(*zone), GFP_KERNEL); + zone = devm_kzalloc_obj(&pdev->dev, *zone); if (!zone) return -ENOMEM; diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c index 10a5ab1fe1b9..c8f722807866 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -539,7 +539,7 @@ static int tegra_tsensor_probe(struct platform_device *pdev) unsigned int i; int err, irq; - ts = devm_kzalloc(&pdev->dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc_obj(&pdev->dev, *ts); if (!ts) return -ENOMEM; diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c index cfdb8e674dd2..c6a7a65aa6a6 100644 --- a/drivers/thermal/thermal-generic-adc.c +++ b/drivers/thermal/thermal-generic-adc.c @@ -149,9 +149,7 @@ static int gadc_thermal_read_linear_lookup_table(struct device *dev, return -EINVAL; } - gti->lookup_table = devm_kcalloc(dev, - ntable, sizeof(*gti->lookup_table), - GFP_KERNEL); + gti->lookup_table = devm_kzalloc_objs(dev, *gti->lookup_table, ntable); if (!gti->lookup_table) return -ENOMEM; @@ -179,7 +177,7 @@ static int gadc_thermal_probe(struct platform_device *pdev) return -ENODEV; } - gti = devm_kzalloc(dev, sizeof(*gti), GFP_KERNEL); + gti = devm_kzalloc_obj(dev, *gti); if (!gti) return -ENOMEM; diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c index 6845756ad5e7..201b70b6be58 100644 --- a/drivers/thermal/thermal_mmio.c +++ b/drivers/thermal/thermal_mmio.c @@ -46,7 +46,7 @@ static int thermal_mmio_probe(struct platform_device *pdev) int ret; int temperature; - sensor = devm_kzalloc(&pdev->dev, sizeof(*sensor), GFP_KERNEL); + sensor = devm_kzalloc_obj(&pdev->dev, *sensor); if (!sensor) return -ENOMEM; diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c index 457639be2b32..13b00bcc7472 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c @@ -830,7 +830,7 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev) return ERR_PTR(-EINVAL); } - bgp = devm_kzalloc(&pdev->dev, sizeof(*bgp), GFP_KERNEL); + bgp = devm_kzalloc_obj(&pdev->dev, *bgp); if (!bgp) return ERR_PTR(-ENOMEM); @@ -839,8 +839,8 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev) bgp->conf = of_id->data; /* register shadow for context save and restore */ - bgp->regval = devm_kcalloc(&pdev->dev, bgp->conf->sensor_count, - sizeof(*bgp->regval), GFP_KERNEL); + bgp->regval = devm_kzalloc_objs(&pdev->dev, *bgp->regval, + bgp->conf->sensor_count); if (!bgp->regval) return ERR_PTR(-ENOMEM); diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index 4bf3b2e0fc68..6f6ca0444f5b 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -144,7 +144,7 @@ static struct ti_thermal_data { struct ti_thermal_data *data; - data = devm_kzalloc(bgp->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(bgp->dev, *data); if (!data) { dev_err(bgp->dev, "kzalloc fail\n"); return NULL; diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c index 1a04294effea..be4474729b59 100644 --- a/drivers/thermal/uniphier_thermal.c +++ b/drivers/thermal/uniphier_thermal.c @@ -268,7 +268,7 @@ static int uniphier_tm_probe(struct platform_device *pdev) struct uniphier_tm_dev *tdev; int ret, irq; - tdev = devm_kzalloc(dev, sizeof(*tdev), GFP_KERNEL); + tdev = devm_kzalloc_obj(dev, *tdev); if (!tdev) return -ENOMEM; tdev->dev = dev; diff --git a/drivers/thunderbolt/dma_test.c b/drivers/thunderbolt/dma_test.c index bcecb0edcb81..cfaa4b3365f2 100644 --- a/drivers/thunderbolt/dma_test.c +++ b/drivers/thunderbolt/dma_test.c @@ -641,7 +641,7 @@ static int dma_test_probe(struct tb_service *svc) struct tb_xdomain *xd = tb_service_parent(svc); struct dma_test *dt; - dt = devm_kzalloc(&svc->dev, sizeof(*dt), GFP_KERNEL); + dt = devm_kzalloc_obj(&svc->dev, *dt); if (!dt) return -ENOMEM; diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c index e99a3fcc4a29..f54ab2189cf4 100644 --- a/drivers/thunderbolt/nhi.c +++ b/drivers/thunderbolt/nhi.c @@ -1321,13 +1321,10 @@ int nhi_probe(struct tb_nhi *nhi) nhi->hop_count = ioread32(nhi->iobase + REG_CAPS) & 0x3ff; dev_dbg(dev, "total paths: %d\n", nhi->hop_count); - nhi->tx_rings = devm_kcalloc(dev, nhi->hop_count, - sizeof(*nhi->tx_rings), GFP_KERNEL); - nhi->rx_rings = devm_kcalloc(dev, nhi->hop_count, - sizeof(*nhi->rx_rings), GFP_KERNEL); - nhi->interrupt_mask = devm_kcalloc(dev, RING_INTERRUPT_REG_COUNT(nhi), - sizeof(*nhi->interrupt_mask), - GFP_KERNEL); + nhi->tx_rings = devm_kzalloc_objs(dev, *nhi->tx_rings, nhi->hop_count); + nhi->rx_rings = devm_kzalloc_objs(dev, *nhi->rx_rings, nhi->hop_count); + nhi->interrupt_mask = devm_kzalloc_objs(dev, *nhi->interrupt_mask, + RING_INTERRUPT_REG_COUNT(nhi)); if (!nhi->tx_rings || !nhi->rx_rings || !nhi->interrupt_mask) return -ENOMEM; diff --git a/drivers/thunderbolt/pci.c b/drivers/thunderbolt/pci.c index 4408229d8ac7..9fe2ef43d8ac 100644 --- a/drivers/thunderbolt/pci.c +++ b/drivers/thunderbolt/pci.c @@ -570,7 +570,7 @@ static int nhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (res) return dev_err_probe(dev, res, "cannot enable PCI device, aborting\n"); - nhi_pci = devm_kzalloc(dev, sizeof(*nhi_pci), GFP_KERNEL); + nhi_pci = devm_kzalloc_obj(dev, *nhi_pci); if (!nhi_pci) return -ENOMEM; diff --git a/drivers/tty/mips_ejtag_fdc.c b/drivers/tty/mips_ejtag_fdc.c index ba7690c3e15e..4a41a5c3d7dd 100644 --- a/drivers/tty/mips_ejtag_fdc.c +++ b/drivers/tty/mips_ejtag_fdc.c @@ -891,7 +891,7 @@ static int mips_ejtag_fdc_tty_probe(struct mips_cdmm_device *dev) struct tty_driver *driver; unsigned int cfg, tx_fifo; - priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&dev->dev, *priv); if (!priv) return -ENOMEM; priv->cpu = dev->cpu; diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 94677fec685e..281c599a12f2 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1742,8 +1742,7 @@ static int mxser_probe(struct pci_dev *pdev, goto err; } - brd = devm_kzalloc(&pdev->dev, struct_size(brd, ports, nports), - GFP_KERNEL); + brd = devm_kzalloc_flex(&pdev->dev, *brd, ports, nports); if (!brd) goto err; diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c index c8dc87f6886c..452bef82bec2 100644 --- a/drivers/tty/serial/8250/8250_aspeed_vuart.c +++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c @@ -426,7 +426,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev) np = pdev->dev.of_node; - vuart = devm_kzalloc(&pdev->dev, sizeof(*vuart), GFP_KERNEL); + vuart = devm_kzalloc_obj(&pdev->dev, *vuart); if (!vuart) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial/8250/8250_bcm2835aux.c index b842dba3059d..8624c46ade64 100644 --- a/drivers/tty/serial/8250/8250_bcm2835aux.c +++ b/drivers/tty/serial/8250/8250_bcm2835aux.c @@ -244,7 +244,7 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev) int ret; /* allocate the custom structure */ - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c index 974d9af146a1..65df87a65a46 100644 --- a/drivers/tty/serial/8250/8250_bcm7271.c +++ b/drivers/tty/serial/8250/8250_bcm7271.c @@ -966,8 +966,7 @@ static int brcmuart_probe(struct platform_device *pdev) "uart", "dma_rx", "dma_tx", "dma_intr2", "dma_arb" }; - priv = devm_kzalloc(dev, sizeof(struct brcmuart_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct brcmuart_priv); if (!priv) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index eca02e8bd6d1..a5e893e45959 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -653,7 +653,7 @@ static int dw8250_probe(struct platform_device *pdev) p->set_termios = dw8250_set_termios; p->set_divisor = dw8250_set_divisor; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c index 57847c5bd2fc..2737a09cf8be 100644 --- a/drivers/tty/serial/8250/8250_exar.c +++ b/drivers/tty/serial/8250/8250_exar.c @@ -1461,7 +1461,7 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent) if (nr_ports == 0) return dev_err_probe(&pcidev->dev, -ENODEV, "failed to get number of ports\n"); - priv = devm_kzalloc(&pcidev->dev, struct_size(priv, uport, nr_ports), GFP_KERNEL); + priv = devm_kzalloc_flex(&pcidev->dev, *priv, uport, nr_ports); if (!priv) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_fintek.c b/drivers/tty/serial/8250/8250_fintek.c index 976c5748905c..b2843c664b9d 100644 --- a/drivers/tty/serial/8250/8250_fintek.c +++ b/drivers/tty/serial/8250/8250_fintek.c @@ -471,7 +471,7 @@ int fintek_8250_probe(struct uart_8250_port *uart) if (probe_setup_port(&probe_data, uart)) return -ENODEV; - pdata = devm_kzalloc(uart->port.dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(uart->port.dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/8250/8250_ingenic.c index 0cdadacd7019..bb8aa3ac44e6 100644 --- a/drivers/tty/serial/8250/8250_ingenic.c +++ b/drivers/tty/serial/8250/8250_ingenic.c @@ -249,7 +249,7 @@ static int ingenic_uart_probe(struct platform_device *pdev) return -EINVAL; } - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_keba.c b/drivers/tty/serial/8250/8250_keba.c index c53ca05a57d7..6c44f3bc853e 100644 --- a/drivers/tty/serial/8250/8250_keba.c +++ b/drivers/tty/serial/8250/8250_keba.c @@ -175,7 +175,7 @@ static int kuart_probe(struct auxiliary_device *auxdev, struct resource res; struct kuart *kuart; - kuart = devm_kzalloc(dev, sizeof(*kuart), GFP_KERNEL); + kuart = devm_kzalloc_obj(dev, *kuart); if (!kuart) return -ENOMEM; kuart->auxdev = container_of(auxdev, struct keba_uart_auxdev, auxdev); diff --git a/drivers/tty/serial/8250/8250_loongson.c b/drivers/tty/serial/8250/8250_loongson.c index 6d06ed28382d..eadde70417f9 100644 --- a/drivers/tty/serial/8250/8250_loongson.c +++ b/drivers/tty/serial/8250/8250_loongson.c @@ -112,7 +112,7 @@ static int loongson_uart_probe(struct platform_device *pdev) struct uart_port *port; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_lpc18xx.c b/drivers/tty/serial/8250/8250_lpc18xx.c index 5d4d4366e711..5fe5027567d3 100644 --- a/drivers/tty/serial/8250/8250_lpc18xx.c +++ b/drivers/tty/serial/8250/8250_lpc18xx.c @@ -108,7 +108,7 @@ static int lpc18xx_serial_probe(struct platform_device *pdev) if (!uart.port.membase) return -ENOMEM; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c index f1b4b975571a..f94a54cc57ca 100644 --- a/drivers/tty/serial/8250/8250_lpss.c +++ b/drivers/tty/serial/8250/8250_lpss.c @@ -320,7 +320,7 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id) pci_set_master(pdev); - lpss = devm_kzalloc(&pdev->dev, sizeof(*lpss), GFP_KERNEL); + lpss = devm_kzalloc_obj(&pdev->dev, *lpss); if (!lpss) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_men_mcb.c b/drivers/tty/serial/8250/8250_men_mcb.c index 1f34e58aaeaf..94264d11e937 100644 --- a/drivers/tty/serial/8250/8250_men_mcb.c +++ b/drivers/tty/serial/8250/8250_men_mcb.c @@ -189,9 +189,7 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev, if (mem == NULL) return -ENXIO; - data = devm_kzalloc(&mdev->dev, - sizeof(struct serial_8250_men_mcb_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&mdev->dev, struct serial_8250_men_mcb_data); if (!data) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_mid.c b/drivers/tty/serial/8250/8250_mid.c index 44b43163df51..df721418e97e 100644 --- a/drivers/tty/serial/8250/8250_mid.c +++ b/drivers/tty/serial/8250/8250_mid.c @@ -269,11 +269,11 @@ static int mid8250_dma_setup(struct mid8250 *mid, struct uart_8250_port *port) if (!mid->dma_dev) return 0; - rx_param = devm_kzalloc(dev, sizeof(*rx_param), GFP_KERNEL); + rx_param = devm_kzalloc_obj(dev, *rx_param); if (!rx_param) return -ENOMEM; - tx_param = devm_kzalloc(dev, sizeof(*tx_param), GFP_KERNEL); + tx_param = devm_kzalloc_obj(dev, *tx_param); if (!tx_param) return -ENOMEM; @@ -304,7 +304,7 @@ static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (ret) return ret; - mid = devm_kzalloc(&pdev->dev, sizeof(*mid), GFP_KERNEL); + mid = devm_kzalloc_obj(&pdev->dev, *mid); if (!mid) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c index d1fb917b762a..4e16cfb05a85 100644 --- a/drivers/tty/serial/8250/8250_mtk.c +++ b/drivers/tty/serial/8250/8250_mtk.c @@ -503,8 +503,7 @@ static int mtk8250_probe_of(struct platform_device *pdev, struct uart_port *p, #ifdef CONFIG_SERIAL_8250_DMA dmacnt = of_property_count_strings(pdev->dev.of_node, "dma-names"); if (dmacnt == 2) { - data->dma = devm_kzalloc(&pdev->dev, sizeof(*data->dma), - GFP_KERNEL); + data->dma = devm_kzalloc_obj(&pdev->dev, *data->dma); if (!data->dma) return -ENOMEM; @@ -541,7 +540,7 @@ static int mtk8250_probe(struct platform_device *pdev) if (!uart.port.membase) return -ENOMEM; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_mxpcie.c b/drivers/tty/serial/8250/8250_mxpcie.c index 4935a5d1c1a3..a4e45e3923ae 100644 --- a/drivers/tty/serial/8250/8250_mxpcie.c +++ b/drivers/tty/serial/8250/8250_mxpcie.c @@ -528,7 +528,7 @@ static int mxpcie8250_probe(struct pci_dev *pdev, const struct pci_device_id *id num_ports = mxpcie8250_get_nports(device); - priv = devm_kzalloc(dev, struct_size(priv, port, num_ports), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, port, num_ports); if (!priv) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_ni.c b/drivers/tty/serial/8250/8250_ni.c index 509c1814cc87..60775fae479a 100644 --- a/drivers/tty/serial/8250/8250_ni.c +++ b/drivers/tty/serial/8250/8250_ni.c @@ -289,7 +289,7 @@ static int ni16550_probe(struct platform_device *pdev) if (!uart) return -ENOMEM; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c index 29a203ed93fd..ed0b8f125332 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -1425,7 +1425,7 @@ static int omap8250_probe(struct platform_device *pdev) return -EINVAL; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index 1dda63be6b89..c34eb2dd1716 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -1759,7 +1759,7 @@ static int pci_fintek_f815xxa_setup(struct serial_private *priv, struct pci_dev *pdev = priv->dev; struct f815xxa_data *data; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_pci1xxxx.c b/drivers/tty/serial/8250/8250_pci1xxxx.c index af4c5c745fa9..72fdb1bac2eb 100644 --- a/drivers/tty/serial/8250/8250_pci1xxxx.c +++ b/drivers/tty/serial/8250/8250_pci1xxxx.c @@ -778,7 +778,7 @@ static int pci1xxxx_serial_probe(struct pci_dev *pdev, nr_ports = pci1xxxx_get_num_ports(pdev); - priv = devm_kzalloc(dev, struct_size(priv, uport, nr_ports), GFP_KERNEL); + priv = devm_kzalloc_flex(dev, *priv, uport, nr_ports); if (!priv) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_pericom.c b/drivers/tty/serial/8250/8250_pericom.c index bbbf48c6d07d..199d69fa828f 100644 --- a/drivers/tty/serial/8250/8250_pericom.c +++ b/drivers/tty/serial/8250/8250_pericom.c @@ -103,7 +103,7 @@ static int pericom8250_probe(struct pci_dev *pdev, const struct pci_device_id *i else nr = 1; - pericom = devm_kzalloc(&pdev->dev, struct_size(pericom, uport, nr), GFP_KERNEL); + pericom = devm_kzalloc_flex(&pdev->dev, *pericom, uport, nr); if (!pericom) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_pxa.c b/drivers/tty/serial/8250/8250_pxa.c index a56aa5fec563..0fca8ef2b3cf 100644 --- a/drivers/tty/serial/8250/8250_pxa.c +++ b/drivers/tty/serial/8250/8250_pxa.c @@ -99,7 +99,7 @@ static int serial_pxa_probe(struct platform_device *pdev) if (!mmres) return -ENODEV; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_tegra.c b/drivers/tty/serial/8250/8250_tegra.c index 2f6b822f79a8..1e616b6d1a1a 100644 --- a/drivers/tty/serial/8250/8250_tegra.c +++ b/drivers/tty/serial/8250/8250_tegra.c @@ -49,7 +49,7 @@ static int tegra_uart_probe(struct platform_device *pdev) struct resource *res; int ret; - uart = devm_kzalloc(&pdev->dev, sizeof(*uart), GFP_KERNEL); + uart = devm_kzalloc_obj(&pdev->dev, *uart); if (!uart) return -ENOMEM; diff --git a/drivers/tty/serial/8250/8250_uniphier.c b/drivers/tty/serial/8250/8250_uniphier.c index a8ee45a0d41e..4d131c323e44 100644 --- a/drivers/tty/serial/8250/8250_uniphier.c +++ b/drivers/tty/serial/8250/8250_uniphier.c @@ -173,7 +173,7 @@ static int uniphier_uart_probe(struct platform_device *pdev) if (!membase) return -ENOMEM; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c index c3a7fad02ac9..362620b7f6ff 100644 --- a/drivers/tty/serial/amba-pl010.c +++ b/drivers/tty/serial/amba-pl010.c @@ -672,8 +672,7 @@ static int pl010_probe(struct amba_device *dev, const struct amba_id *id) if (i == ARRAY_SIZE(amba_ports)) return -EBUSY; - uap = devm_kzalloc(&dev->dev, sizeof(struct uart_amba_port), - GFP_KERNEL); + uap = devm_kzalloc_obj(&dev->dev, struct uart_amba_port); if (!uap) return -ENOMEM; diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index e6f652905ca6..7b1f99395f6c 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -3120,8 +3120,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) if (portnr < 0) return portnr; - uap = devm_kzalloc(&dev->dev, sizeof(struct uart_amba_port), - GFP_KERNEL); + uap = devm_kzalloc_obj(&dev->dev, struct uart_amba_port); if (!uap) return -ENOMEM; @@ -3266,8 +3265,7 @@ static int sbsa_uart_probe(struct platform_device *pdev) if (portnr < 0) return portnr; - uap = devm_kzalloc(&pdev->dev, sizeof(struct uart_amba_port), - GFP_KERNEL); + uap = devm_kzalloc_obj(&pdev->dev, struct uart_amba_port); if (!uap) return -ENOMEM; diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c index 5b491db9d2fc..f9c2e5c8b324 100644 --- a/drivers/tty/serial/ar933x_uart.c +++ b/drivers/tty/serial/ar933x_uart.c @@ -790,8 +790,7 @@ static int ar933x_uart_probe(struct platform_device *pdev) if (irq < 0) return irq; - up = devm_kzalloc(&pdev->dev, sizeof(struct ar933x_uart_port), - GFP_KERNEL); + up = devm_kzalloc_obj(&pdev->dev, struct ar933x_uart_port); if (!up) return -ENOMEM; diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c index 83186bf50002..f0f19481ce1e 100644 --- a/drivers/tty/serial/clps711x.c +++ b/drivers/tty/serial/clps711x.c @@ -443,7 +443,7 @@ static int uart_clps711x_probe(struct platform_device *pdev) struct clk *uart_clk; int irq, ret; - s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL); + s = devm_kzalloc_obj(&pdev->dev, *s); if (!s) return -ENOMEM; diff --git a/drivers/tty/serial/digicolor-usart.c b/drivers/tty/serial/digicolor-usart.c index d2482df5cb9b..0c64aeb79e79 100644 --- a/drivers/tty/serial/digicolor-usart.c +++ b/drivers/tty/serial/digicolor-usart.c @@ -463,7 +463,7 @@ static int digicolor_uart_probe(struct platform_device *pdev) if (index < 0 || index >= DIGICOLOR_USART_NR) return -EINVAL; - dp = devm_kzalloc(&pdev->dev, sizeof(*dp), GFP_KERNEL); + dp = devm_kzalloc_obj(&pdev->dev, *dp); if (!dp) return -ENOMEM; diff --git a/drivers/tty/serial/fsl_linflexuart.c b/drivers/tty/serial/fsl_linflexuart.c index e70a56de1fce..62cae6fd5b3c 100644 --- a/drivers/tty/serial/fsl_linflexuart.c +++ b/drivers/tty/serial/fsl_linflexuart.c @@ -811,7 +811,7 @@ static int linflex_probe(struct platform_device *pdev) struct resource *res; int ret; - sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL); + sport = devm_kzalloc_obj(&pdev->dev, *sport); if (!sport) return -ENOMEM; diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index c8575c965203..6ccc6a8b653b 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -2878,7 +2878,7 @@ static int lpuart_probe(struct platform_device *pdev) irq_handler_t handler; int ret; - sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL); + sport = devm_kzalloc_obj(&pdev->dev, *sport); if (!sport) return -ENOMEM; diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 986fefb45c63..256d85e398d1 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2421,7 +2421,7 @@ static int imx_uart_probe(struct platform_device *pdev) struct resource *res; int txirq, rxirq, rtsirq; - sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL); + sport = devm_kzalloc_obj(&pdev->dev, *sport); if (!sport) return -ENOMEM; diff --git a/drivers/tty/serial/lantiq.c b/drivers/tty/serial/lantiq.c index 62cd9e0bb377..fc75476c0935 100644 --- a/drivers/tty/serial/lantiq.c +++ b/drivers/tty/serial/lantiq.c @@ -817,8 +817,7 @@ static int lqasc_probe(struct platform_device *pdev) return -ENODEV; } - ltq_port = devm_kzalloc(&pdev->dev, sizeof(struct ltq_uart_port), - GFP_KERNEL); + ltq_port = devm_kzalloc_obj(&pdev->dev, struct ltq_uart_port); if (!ltq_port) return -ENOMEM; diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 6429e8f11f36..021c69f473b3 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -284,7 +284,7 @@ static int liteuart_probe(struct platform_device *pdev) struct xa_limit limit; int dev_id, ret; - uart = devm_kzalloc(&pdev->dev, sizeof(struct liteuart_port), GFP_KERNEL); + uart = devm_kzalloc_obj(&pdev->dev, struct liteuart_port); if (!uart) return -ENOMEM; diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index a0ed70185555..de8a1f05cf30 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c @@ -1871,7 +1871,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty return PTR_ERR(regmaps[i]); /* Alloc port structure */ - s = devm_kzalloc(dev, struct_size(s, p, devtype->nr), GFP_KERNEL); + s = devm_kzalloc_flex(dev, *s, p, devtype->nr); if (!s) return -ENOMEM; diff --git a/drivers/tty/serial/men_z135_uart.c b/drivers/tty/serial/men_z135_uart.c index 9138fa29d301..861b783cec3d 100644 --- a/drivers/tty/serial/men_z135_uart.c +++ b/drivers/tty/serial/men_z135_uart.c @@ -808,7 +808,7 @@ static int men_z135_probe(struct mcb_device *mdev, dev = &mdev->dev; - uart = devm_kzalloc(dev, sizeof(struct men_z135_port), GFP_KERNEL); + uart = devm_kzalloc_obj(dev, struct men_z135_port); if (!uart) return -ENOMEM; diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c index a6cb2a535f9d..03faa39de51a 100644 --- a/drivers/tty/serial/meson_uart.c +++ b/drivers/tty/serial/meson_uart.c @@ -736,7 +736,7 @@ static int meson_uart_probe(struct platform_device *pdev) "port %d already allocated\n", pdev->id); } - port = devm_kzalloc(&pdev->dev, sizeof(struct uart_port), GFP_KERNEL); + port = devm_kzalloc_obj(&pdev->dev, struct uart_port); if (!port) return -ENOMEM; diff --git a/drivers/tty/serial/mps2-uart.c b/drivers/tty/serial/mps2-uart.c index 2a4c09f3a834..fdd4984080e9 100644 --- a/drivers/tty/serial/mps2-uart.c +++ b/drivers/tty/serial/mps2-uart.c @@ -579,7 +579,7 @@ static int mps2_serial_probe(struct platform_device *pdev) struct mps2_uart_port *mps_port; int ret; - mps_port = devm_kzalloc(&pdev->dev, sizeof(struct mps2_uart_port), GFP_KERNEL); + mps_port = devm_kzalloc_obj(&pdev->dev, struct mps2_uart_port); if (!mps_port) return -ENOMEM; diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c index 33ea496c93b2..8a61517d81f2 100644 --- a/drivers/tty/serial/mvebu-uart.c +++ b/drivers/tty/serial/mvebu-uart.c @@ -913,8 +913,7 @@ static int mvebu_uart_probe(struct platform_device *pdev) return PTR_ERR(port->membase); port->mapbase = reg->start; - mvuart = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_uart), - GFP_KERNEL); + mvuart = devm_kzalloc_obj(&pdev->dev, struct mvebu_uart); if (!mvuart) return -ENOMEM; @@ -1330,9 +1329,7 @@ static int mvebu_uart_clock_probe(struct platform_device *pdev) BUILD_BUG_ON(ARRAY_SIZE(parent_clk_names) != ARRAY_SIZE(uart_clock_base->parent_rates)); - uart_clock_base = devm_kzalloc(dev, - sizeof(*uart_clock_base), - GFP_KERNEL); + uart_clock_base = devm_kzalloc_obj(dev, *uart_clock_base); if (!uart_clock_base) return -ENOMEM; @@ -1374,10 +1371,8 @@ static int mvebu_uart_clock_probe(struct platform_device *pdev) if (!uart_clock_base->reg2) return -ENOMEM; - hw_clk_data = devm_kzalloc(dev, - struct_size(hw_clk_data, hws, - ARRAY_SIZE(uart_clk_names)), - GFP_KERNEL); + hw_clk_data = devm_kzalloc_flex(dev, *hw_clk_data, hws, + ARRAY_SIZE(uart_clk_names)); if (!hw_clk_data) return -ENOMEM; diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 697318dbb146..211cf85f38c5 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -1575,7 +1575,7 @@ static int mxs_auart_probe(struct platform_device *pdev) int ret, irq; struct resource *r; - s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL); + s = devm_kzalloc_obj(&pdev->dev, *s); if (!s) return -ENOMEM; diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index a689d190940c..6d60084ad341 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -1466,7 +1466,7 @@ static struct omap_uart_port_info *of_get_uart_port_info(struct device *dev) { struct omap_uart_port_info *omap_up_info; - omap_up_info = devm_kzalloc(dev, sizeof(*omap_up_info), GFP_KERNEL); + omap_up_info = devm_kzalloc_obj(dev, *omap_up_info); if (!omap_up_info) return NULL; /* out of memory */ @@ -1560,7 +1560,7 @@ static int serial_omap_probe(struct platform_device *pdev) return -EPROBE_DEFER; } - up = devm_kzalloc(&pdev->dev, sizeof(*up), GFP_KERNEL); + up = devm_kzalloc_obj(&pdev->dev, *up); if (!up) return -ENOMEM; diff --git a/drivers/tty/serial/owl-uart.c b/drivers/tty/serial/owl-uart.c index 0542882cfbbe..863363ddad00 100644 --- a/drivers/tty/serial/owl-uart.c +++ b/drivers/tty/serial/owl-uart.c @@ -676,7 +676,7 @@ static int owl_uart_probe(struct platform_device *pdev) return -EBUSY; } - owl_port = devm_kzalloc(&pdev->dev, sizeof(*owl_port), GFP_KERNEL); + owl_port = devm_kzalloc_obj(&pdev->dev, *owl_port); if (!owl_port) return -ENOMEM; diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c index 8407f85776c0..a645b646bf8d 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -877,7 +877,7 @@ static int pic32_uart_probe(struct platform_device *pdev) if (!res_mem) return -EINVAL; - sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL); + sport = devm_kzalloc_obj(&pdev->dev, *sport); if (!sport) return -ENOMEM; diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index bfdc155c128d..8ea43b294915 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -287,7 +287,7 @@ static struct qcom_geni_serial_port *get_port_from_line(int line, bool console, } else { int max_alias_num = of_alias_get_highest_id("serial"); - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return ERR_PTR(-ENOMEM); diff --git a/drivers/tty/serial/rda-uart.c b/drivers/tty/serial/rda-uart.c index 87fa30d68687..9da58ffa02d5 100644 --- a/drivers/tty/serial/rda-uart.c +++ b/drivers/tty/serial/rda-uart.c @@ -729,7 +729,7 @@ static int rda_uart_probe(struct platform_device *pdev) return -EBUSY; } - rda_port = devm_kzalloc(&pdev->dev, sizeof(*rda_port), GFP_KERNEL); + rda_port = devm_kzalloc_obj(&pdev->dev, *rda_port); if (!rda_port) return -ENOMEM; diff --git a/drivers/tty/serial/rp2.c b/drivers/tty/serial/rp2.c index 51e81ec0ffdb..158b06424b56 100644 --- a/drivers/tty/serial/rp2.c +++ b/drivers/tty/serial/rp2.c @@ -700,7 +700,7 @@ static int rp2_probe(struct pci_dev *pdev, struct rp2_uart_port *ports; int rc; - card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(&pdev->dev, *card); if (!card) return -ENOMEM; pci_set_drvdata(pdev, card); @@ -734,8 +734,7 @@ static int rp2_probe(struct pci_dev *pdev, rp2_init_card(card); - ports = devm_kcalloc(&pdev->dev, card->n_ports, sizeof(*ports), - GFP_KERNEL); + ports = devm_kzalloc_objs(&pdev->dev, *ports, card->n_ports); if (!ports) return -ENOMEM; card->ports = ports; diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index 640f85e2d636..738536014742 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -1860,9 +1860,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, */ if (platdev->dev.of_node && of_find_property(platdev->dev.of_node, "dmas", NULL)) { - ourport->dma = devm_kzalloc(port->dev, - sizeof(*ourport->dma), - GFP_KERNEL); + ourport->dma = devm_kzalloc_obj(port->dev, *ourport->dma); if (!ourport->dma) { ret = -ENOMEM; goto err; diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index fba588559595..dbf38825a78c 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1593,7 +1593,7 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype, return -EPROBE_DEFER; /* Alloc port structure */ - s = devm_kzalloc(dev, struct_size(s, p, devtype->nr_uart), GFP_KERNEL); + s = devm_kzalloc_flex(dev, *s, p, devtype->nr_uart); if (!s) return -ENOMEM; diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c index cb31e3aceb62..b8f81dd6e7db 100644 --- a/drivers/tty/serial/sccnxp.c +++ b/drivers/tty/serial/sccnxp.c @@ -893,7 +893,7 @@ static int sccnxp_probe(struct platform_device *pdev) if (IS_ERR(membase)) return PTR_ERR(membase); - s = devm_kzalloc(&pdev->dev, sizeof(struct sccnxp_port), GFP_KERNEL); + s = devm_kzalloc_obj(&pdev->dev, struct sccnxp_port); if (!s) { dev_err(&pdev->dev, "Error allocating port structure\n"); return -ENOMEM; diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c index b0fc4ae3686f..e93873a1d1c6 100644 --- a/drivers/tty/serial/serial-tegra.c +++ b/drivers/tty/serial/serial-tegra.c @@ -1582,7 +1582,7 @@ static int tegra_uart_probe(struct platform_device *pdev) return -ENODEV; } - tup = devm_kzalloc(&pdev->dev, sizeof(*tup), GFP_KERNEL); + tup = devm_kzalloc_obj(&pdev->dev, *tup); if (!tup) { dev_err(&pdev->dev, "Failed to allocate memory for tup\n"); return -ENOMEM; diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c index dff13a9f2614..4399ae3b70ae 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -140,7 +140,7 @@ struct mctrl_gpios *mctrl_gpio_init_noauto(struct device *dev, unsigned int idx) struct mctrl_gpios *gpios; enum mctrl_gpio_idx i; - gpios = devm_kzalloc(dev, sizeof(*gpios), GFP_KERNEL); + gpios = devm_kzalloc_obj(dev, *gpios); if (!gpios) return ERR_PTR(-ENOMEM); diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index bd58bbfa65aa..abaab62971b0 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -3757,7 +3757,7 @@ static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev, return ERR_PTR(ret); } - p = devm_kzalloc(&pdev->dev, sizeof(struct plat_sci_port), GFP_KERNEL); + p = devm_kzalloc_obj(&pdev->dev, struct plat_sci_port); if (!p) return ERR_PTR(-ENOMEM); diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c index c720e9888416..892b498540ac 100644 --- a/drivers/tty/serial/sifive.c +++ b/drivers/tty/serial/sifive.c @@ -1005,7 +1005,7 @@ static int sifive_serial_probe(struct platform_device *pdev) } #endif - ssp = devm_kzalloc(&pdev->dev, sizeof(*ssp), GFP_KERNEL); + ssp = devm_kzalloc_obj(&pdev->dev, *ssp); if (!ssp) return -ENOMEM; diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c index 3fdf5939a62c..7bca7151344e 100644 --- a/drivers/tty/serial/sprd_serial.c +++ b/drivers/tty/serial/sprd_serial.c @@ -1186,7 +1186,7 @@ static int sprd_probe(struct platform_device *pdev) return -EINVAL; } - sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL); + sport = devm_kzalloc_obj(&pdev->dev, *sport); if (!sport) return -ENOMEM; diff --git a/drivers/tty/serial/sunplus-uart.c b/drivers/tty/serial/sunplus-uart.c index 38deee571b0d..62e516bdf6b8 100644 --- a/drivers/tty/serial/sunplus-uart.c +++ b/drivers/tty/serial/sunplus-uart.c @@ -595,7 +595,7 @@ static int sunplus_uart_probe(struct platform_device *pdev) if (pdev->id < 0 || pdev->id >= SUP_UART_NR) return -EINVAL; - sup = devm_kzalloc(&pdev->dev, sizeof(*sup), GFP_KERNEL); + sup = devm_kzalloc_obj(&pdev->dev, *sup); if (!sup) return -ENOMEM; diff --git a/drivers/tty/serial/tegra-tcu.c b/drivers/tty/serial/tegra-tcu.c index 077023ce1842..6c45de1aad8c 100644 --- a/drivers/tty/serial/tegra-tcu.c +++ b/drivers/tty/serial/tegra-tcu.c @@ -182,7 +182,7 @@ static int tegra_tcu_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int err; - tcu = devm_kzalloc(dev, sizeof(*tcu), GFP_KERNEL); + tcu = devm_kzalloc_obj(dev, *tcu); if (!tcu) return -ENOMEM; diff --git a/drivers/tty/serial/tegra-utc.c b/drivers/tty/serial/tegra-utc.c index 3d43c11824ca..8b38f4f18554 100644 --- a/drivers/tty/serial/tegra-utc.c +++ b/drivers/tty/serial/tegra-utc.c @@ -537,7 +537,7 @@ static int tegra_utc_probe(struct platform_device *pdev) struct tegra_utc_port *tup; int ret; - tup = devm_kzalloc(dev, sizeof(*tup), GFP_KERNEL); + tup = devm_kzalloc_obj(dev, *tup); if (!tup) return -ENOMEM; diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c index 6240c3d4dfd7..b9a14dc2f2fd 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c @@ -783,8 +783,7 @@ static int ulite_probe(struct platform_device *pdev) int irq, ret; int id = pdev->id; - pdata = devm_kzalloc(&pdev->dev, sizeof(struct uartlite_data), - GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, struct uartlite_data); if (!pdata) return -ENOMEM; diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c index fc6fdc751b16..a7f167a73416 100644 --- a/drivers/tty/serial/vt8500_serial.c +++ b/drivers/tty/serial/vt8500_serial.c @@ -638,8 +638,7 @@ static int vt8500_serial_probe(struct platform_device *pdev) return -EBUSY; } - vt8500_port = devm_kzalloc(&pdev->dev, sizeof(struct vt8500_port), - GFP_KERNEL); + vt8500_port = devm_kzalloc_obj(&pdev->dev, struct vt8500_port); if (!vt8500_port) return -ENOMEM; diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index a072b75dbaf2..e8c4b1fa7658 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -1646,11 +1646,10 @@ static int cdns_uart_probe(struct platform_device *pdev) struct cdns_uart *cdns_uart_data; const struct of_device_id *match; - cdns_uart_data = devm_kzalloc(&pdev->dev, sizeof(*cdns_uart_data), - GFP_KERNEL); + cdns_uart_data = devm_kzalloc_obj(&pdev->dev, *cdns_uart_data); if (!cdns_uart_data) return -ENOMEM; - port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(&pdev->dev, *port); if (!port) return -ENOMEM; diff --git a/drivers/ufs/core/ufs-rpmb.c b/drivers/ufs/core/ufs-rpmb.c index 65f2d71cf073..756673337648 100644 --- a/drivers/ufs/core/ufs-rpmb.c +++ b/drivers/ufs/core/ufs-rpmb.c @@ -189,7 +189,7 @@ int ufs_rpmb_probe(struct ufs_hba *hba) if (!cap) continue; - ufs_rpmb = devm_kzalloc(hba->dev, sizeof(*ufs_rpmb), GFP_KERNEL); + ufs_rpmb = devm_kzalloc_obj(hba->dev, *ufs_rpmb); if (!ufs_rpmb) { ret = -ENOMEM; goto err_out; diff --git a/drivers/ufs/core/ufs-txeq.c b/drivers/ufs/core/ufs-txeq.c index 6192512e29de..428a1895dc63 100644 --- a/drivers/ufs/core/ufs-txeq.c +++ b/drivers/ufs/core/ufs-txeq.c @@ -1239,9 +1239,8 @@ static int ufshcd_tx_eqtr(struct ufs_hba *hba, noio_flag = memalloc_noio_save(); if (!params->eqtr_record) { - params->eqtr_record = devm_kzalloc(hba->dev, - sizeof(*params->eqtr_record), - GFP_KERNEL); + params->eqtr_record = devm_kzalloc_obj(hba->dev, + *params->eqtr_record); if (!params->eqtr_record) { ret = -ENOMEM; goto out_noio_restore; diff --git a/drivers/ufs/core/ufshcd-crypto.c b/drivers/ufs/core/ufshcd-crypto.c index 9e63a9d3cb7e..dec59551169b 100644 --- a/drivers/ufs/core/ufshcd-crypto.c +++ b/drivers/ufs/core/ufshcd-crypto.c @@ -168,8 +168,8 @@ int ufshcd_hba_init_crypto_capabilities(struct ufs_hba *hba) hba->crypto_cfg_register = (u32)hba->crypto_capabilities.config_array_ptr * 0x100; hba->crypto_cap_array = - devm_kcalloc(hba->dev, hba->crypto_capabilities.num_crypto_cap, - sizeof(hba->crypto_cap_array[0]), GFP_KERNEL); + devm_kzalloc_objs(hba->dev, hba->crypto_cap_array[0], + hba->crypto_capabilities.num_crypto_cap); if (!hba->crypto_cap_array) { err = -ENOMEM; goto out; diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index ee643830a57a..0911fd204f4a 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -11184,8 +11184,7 @@ static int ufshcd_add_scsi_host(struct ufs_hba *hba) err = PTR_ERR(hba->tmf_queue); goto free_tmf_tag_set; } - hba->tmf_rqs = devm_kcalloc(hba->dev, hba->nutmrs, - sizeof(*hba->tmf_rqs), GFP_KERNEL); + hba->tmf_rqs = devm_kzalloc_objs(hba->dev, *hba->tmf_rqs, hba->nutmrs); if (!hba->tmf_rqs) { err = -ENOMEM; goto free_tmf_queue; diff --git a/drivers/ufs/host/cdns-pltfrm.c b/drivers/ufs/host/cdns-pltfrm.c index e793e3538c48..3ef62acb04fa 100644 --- a/drivers/ufs/host/cdns-pltfrm.c +++ b/drivers/ufs/host/cdns-pltfrm.c @@ -215,7 +215,7 @@ static int cdns_ufs_init(struct ufs_hba *hba) struct cdns_ufs_host *host; struct device *dev = hba->dev; - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/ufs/host/ti-j721e-ufs.c b/drivers/ufs/host/ti-j721e-ufs.c index 43781593b5c1..d246bde505b1 100644 --- a/drivers/ufs/host/ti-j721e-ufs.c +++ b/drivers/ufs/host/ti-j721e-ufs.c @@ -28,7 +28,7 @@ static int ti_j721e_ufs_probe(struct platform_device *pdev) struct clk *clk; int ret; - ufs = devm_kzalloc(dev, sizeof(*ufs), GFP_KERNEL); + ufs = devm_kzalloc_obj(dev, *ufs); if (!ufs) return -ENOMEM; diff --git a/drivers/ufs/host/ufs-amd-versal2.c b/drivers/ufs/host/ufs-amd-versal2.c index dff0c2c95486..65cb0b5028b9 100644 --- a/drivers/ufs/host/ufs-amd-versal2.c +++ b/drivers/ufs/host/ufs-amd-versal2.c @@ -276,7 +276,7 @@ static int ufs_versal2_init(struct ufs_hba *hba) int ret; u32 cal; - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index 3bcbc9ebbb28..265e01467a9b 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -1537,7 +1537,7 @@ static int exynos_ufs_init(struct ufs_hba *hba) struct exynos_ufs *ufs; int ret; - ufs = devm_kzalloc(dev, sizeof(*ufs), GFP_KERNEL); + ufs = devm_kzalloc_obj(dev, *ufs); if (!ufs) return -ENOMEM; @@ -1880,7 +1880,7 @@ static int exynosauto_ufs_vh_init(struct ufs_hba *hba) struct exynos_ufs *ufs; int ret; - ufs = devm_kzalloc(dev, sizeof(*ufs), GFP_KERNEL); + ufs = devm_kzalloc_obj(dev, *ufs); if (!ufs) return -ENOMEM; diff --git a/drivers/ufs/host/ufs-hisi.c b/drivers/ufs/host/ufs-hisi.c index 993e20ac211d..73eef0e0d278 100644 --- a/drivers/ufs/host/ufs-hisi.c +++ b/drivers/ufs/host/ufs-hisi.c @@ -472,7 +472,7 @@ static int ufs_hisi_init_common(struct ufs_hba *hba) struct device *dev = hba->dev; struct ufs_hisi_host *host; - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c index 5b6bff2cf9a2..7691349c502a 100644 --- a/drivers/ufs/host/ufs-mediatek.c +++ b/drivers/ufs/host/ufs-mediatek.c @@ -649,8 +649,7 @@ static void ufs_mtk_init_boost_crypt(struct ufs_hba *hba) struct regulator *reg; u32 volt; - host->crypt = devm_kzalloc(dev, sizeof(*(host->crypt)), - GFP_KERNEL); + host->crypt = devm_kzalloc_obj(dev, *(host->crypt)); if (!host->crypt) goto disable_caps; @@ -1234,7 +1233,7 @@ static int ufs_mtk_init(struct ufs_hba *hba) int err = 0; struct arm_smccc_res res; - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) { err = -ENOMEM; dev_info(dev, "%s: no memory for mtk ufs host\n", __func__); diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 27c87e62f8e9..67c2a3b95e58 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1608,7 +1608,7 @@ static int ufs_qcom_init(struct ufs_hba *hba) struct ufs_clk_info *clki; const struct ufs_qcom_drvdata *drvdata = of_device_get_match_data(hba->dev); - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) return -ENOMEM; @@ -1713,7 +1713,7 @@ static int ufs_qcom_fw_managed_init(struct ufs_hba *hba) struct ufs_qcom_host *host; int err; - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) return -ENOMEM; @@ -2457,7 +2457,7 @@ static int ufs_qcom_config_esi(struct ufs_hba *hba) return ret; /* Continue without ESI */ } - qi = devm_kcalloc(hba->dev, nr_irqs, sizeof(*qi), GFP_KERNEL); + qi = devm_kzalloc_objs(hba->dev, *qi, nr_irqs); if (!qi) { platform_device_msi_free_irqs_all(hba->dev); return -ENOMEM; diff --git a/drivers/ufs/host/ufs-renesas.c b/drivers/ufs/host/ufs-renesas.c index 5bf7d0e77ad8..e418c5878038 100644 --- a/drivers/ufs/host/ufs-renesas.c +++ b/drivers/ufs/host/ufs-renesas.c @@ -455,7 +455,7 @@ static int ufs_renesas_init(struct ufs_hba *hba) size_t len; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; ufshcd_set_variant(hba, priv); diff --git a/drivers/ufs/host/ufs-rockchip.c b/drivers/ufs/host/ufs-rockchip.c index bac68f238e1c..8ce6534a73de 100644 --- a/drivers/ufs/host/ufs-rockchip.c +++ b/drivers/ufs/host/ufs-rockchip.c @@ -143,7 +143,7 @@ static int ufs_rockchip_common_init(struct ufs_hba *hba) struct ufs_rockchip_host *host; int err; - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/ufs/host/ufs-sprd.c b/drivers/ufs/host/ufs-sprd.c index 6862250c542e..8c0a13e95556 100644 --- a/drivers/ufs/host/ufs-sprd.c +++ b/drivers/ufs/host/ufs-sprd.c @@ -137,7 +137,7 @@ static int ufs_sprd_common_init(struct ufs_hba *hba) const struct of_device_id *of_id; int ret = 0; - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(dev, *host); if (!host) return -ENOMEM; diff --git a/drivers/ufs/host/ufshcd-pci.c b/drivers/ufs/host/ufshcd-pci.c index 668b57403e62..8d7a266f4529 100644 --- a/drivers/ufs/host/ufshcd-pci.c +++ b/drivers/ufs/host/ufshcd-pci.c @@ -365,7 +365,7 @@ static int ufs_intel_common_init(struct ufs_hba *hba) hba->caps |= UFSHCD_CAP_RPM_AUTOSUSPEND; - host = devm_kzalloc(hba->dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(hba->dev, *host); if (!host) return -ENOMEM; host->saved_spm_lvl = -1; diff --git a/drivers/ufs/host/ufshcd-pltfrm.c b/drivers/ufs/host/ufshcd-pltfrm.c index 169dbc1a75fe..c238f6073ad0 100644 --- a/drivers/ufs/host/ufshcd-pltfrm.c +++ b/drivers/ufs/host/ufshcd-pltfrm.c @@ -61,8 +61,7 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) goto out; } - clkfreq = devm_kcalloc(dev, sz, sizeof(*clkfreq), - GFP_KERNEL); + clkfreq = devm_kzalloc_objs(dev, *clkfreq, sz); if (!clkfreq) { ret = -ENOMEM; goto out; @@ -82,7 +81,7 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) if (ret) goto out; - clki = devm_kzalloc(dev, sizeof(*clki), GFP_KERNEL); + clki = devm_kzalloc_obj(dev, *clki); if (!clki) { ret = -ENOMEM; goto out; @@ -137,7 +136,7 @@ int ufshcd_populate_vreg(struct device *dev, const char *name, goto out; } - vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); + vreg = devm_kzalloc_obj(dev, *vreg); if (!vreg) return -ENOMEM; @@ -440,7 +439,7 @@ static int ufshcd_parse_operating_points(struct ufs_hba *hba) } /* OPP expects clk_names to be NULL terminated */ - clk_names = devm_kcalloc(dev, cnt + 1, sizeof(*clk_names), GFP_KERNEL); + clk_names = devm_kzalloc_objs(dev, *clk_names, cnt + 1); if (!clk_names) return -ENOMEM; @@ -454,7 +453,7 @@ static int ufshcd_parse_operating_points(struct ufs_hba *hba) if (ret) return ret; - clki = devm_kzalloc(dev, sizeof(*clki), GFP_KERNEL); + clki = devm_kzalloc_obj(dev, *clki); if (!clki) return -ENOMEM; diff --git a/drivers/uio/uio_aec.c b/drivers/uio/uio_aec.c index dafcc5f44f24..1dd163d5b902 100644 --- a/drivers/uio/uio_aec.c +++ b/drivers/uio/uio_aec.c @@ -71,7 +71,7 @@ static int probe(struct pci_dev *pdev, const struct pci_device_id *id) struct uio_info *info; int ret; - info = devm_kzalloc(&pdev->dev, sizeof(struct uio_info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct uio_info); if (!info) return -ENOMEM; diff --git a/drivers/uio/uio_cif.c b/drivers/uio/uio_cif.c index 4e4b589ddef1..eba80af2ef5b 100644 --- a/drivers/uio/uio_cif.c +++ b/drivers/uio/uio_cif.c @@ -43,7 +43,7 @@ static int hilscher_pci_probe(struct pci_dev *dev, { struct uio_info *info; - info = devm_kzalloc(&dev->dev, sizeof(struct uio_info), GFP_KERNEL); + info = devm_kzalloc_obj(&dev->dev, struct uio_info); if (!info) return -ENOMEM; diff --git a/drivers/uio/uio_dfl.c b/drivers/uio/uio_dfl.c index 6d99e5a06ae8..e07475398f0a 100644 --- a/drivers/uio/uio_dfl.c +++ b/drivers/uio/uio_dfl.c @@ -19,7 +19,7 @@ static int uio_dfl_probe(struct dfl_device *ddev) struct uio_mem *uiomem; int ret; - uioinfo = devm_kzalloc(dev, sizeof(struct uio_info), GFP_KERNEL); + uioinfo = devm_kzalloc_obj(dev, struct uio_info); if (!uioinfo) return -ENOMEM; diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c index 41c18ec62a45..263c1ebc2d57 100644 --- a/drivers/uio/uio_dmem_genirq.c +++ b/drivers/uio/uio_dmem_genirq.c @@ -160,7 +160,7 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev) if (pdev->dev.of_node) { /* alloc uioinfo for one device */ - uioinfo = devm_kzalloc(&pdev->dev, sizeof(*uioinfo), GFP_KERNEL); + uioinfo = devm_kzalloc_obj(&pdev->dev, *uioinfo); if (!uioinfo) { dev_err(&pdev->dev, "unable to kmalloc\n"); return -ENOMEM; @@ -183,7 +183,7 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev) return -EINVAL; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) { dev_err(&pdev->dev, "unable to kmalloc\n"); return -ENOMEM; diff --git a/drivers/uio/uio_fsl_elbc_gpcm.c b/drivers/uio/uio_fsl_elbc_gpcm.c index 08cb150fb12f..a8e4d8203ad8 100644 --- a/drivers/uio/uio_fsl_elbc_gpcm.c +++ b/drivers/uio/uio_fsl_elbc_gpcm.c @@ -324,7 +324,7 @@ static int uio_fsl_elbc_gpcm_probe(struct platform_device *pdev) return irq; /* allocate private data */ - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; priv->dev = &pdev->dev; @@ -337,7 +337,7 @@ static int uio_fsl_elbc_gpcm_probe(struct platform_device *pdev) return ret; /* allocate UIO structure */ - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c index 7b4cc456c453..dff92dcbb10d 100644 --- a/drivers/uio/uio_hv_generic.c +++ b/drivers/uio/uio_hv_generic.c @@ -262,7 +262,7 @@ hv_uio_probe(struct hv_device *dev, /* Adjust ring size if necessary to have it page aligned */ ring_size = VMBUS_RING_SIZE(ring_size); - pdata = devm_kzalloc(&dev->device, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&dev->device, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/uio/uio_mf624.c b/drivers/uio/uio_mf624.c index 790412f8dfd5..5fb44b560ea9 100644 --- a/drivers/uio/uio_mf624.c +++ b/drivers/uio/uio_mf624.c @@ -136,7 +136,7 @@ static int mf624_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { struct uio_info *info; - info = devm_kzalloc(&dev->dev, sizeof(struct uio_info), GFP_KERNEL); + info = devm_kzalloc_obj(&dev->dev, struct uio_info); if (!info) return -ENOMEM; diff --git a/drivers/uio/uio_netx.c b/drivers/uio/uio_netx.c index 18917b2ac04c..0a84b9d8f28b 100644 --- a/drivers/uio/uio_netx.c +++ b/drivers/uio/uio_netx.c @@ -53,7 +53,7 @@ static int netx_pci_probe(struct pci_dev *dev, struct uio_info *info; int bar; - info = devm_kzalloc(&dev->dev, sizeof(struct uio_info), GFP_KERNEL); + info = devm_kzalloc_obj(&dev->dev, struct uio_info); if (!info) return -ENOMEM; diff --git a/drivers/uio/uio_pci_generic.c b/drivers/uio/uio_pci_generic.c index e03f9b532a96..c0cab3adb7b0 100644 --- a/drivers/uio/uio_pci_generic.c +++ b/drivers/uio/uio_pci_generic.c @@ -86,7 +86,7 @@ static int probe(struct pci_dev *pdev, if (pdev->irq && !pci_intx_mask_supported(pdev)) return -ENODEV; - gdev = devm_kzalloc(&pdev->dev, sizeof(struct uio_pci_generic_dev), GFP_KERNEL); + gdev = devm_kzalloc_obj(&pdev->dev, struct uio_pci_generic_dev); if (!gdev) return -ENOMEM; diff --git a/drivers/uio/uio_pci_generic_sva.c b/drivers/uio/uio_pci_generic_sva.c index d05ef77f7e32..08ba6f67ae8a 100644 --- a/drivers/uio/uio_pci_generic_sva.c +++ b/drivers/uio/uio_pci_generic_sva.c @@ -88,8 +88,7 @@ static int probe(struct pci_dev *pdev, const struct pci_device_id *id) dev_warn(&pdev->dev, "No IRQ vectors available (%d), using polling\n", ret); - udev = devm_kzalloc(&pdev->dev, sizeof(struct uio_pci_sva_dev), - GFP_KERNEL); + udev = devm_kzalloc_obj(&pdev->dev, struct uio_pci_sva_dev); if (!udev) { ret = -ENOMEM; goto out_disable; diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c index 0c8d73e7be52..87e43821ab0c 100644 --- a/drivers/uio/uio_pdrv_genirq.c +++ b/drivers/uio/uio_pdrv_genirq.c @@ -119,8 +119,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev) const char *name; /* alloc uioinfo for one device */ - uioinfo = devm_kzalloc(&pdev->dev, sizeof(*uioinfo), - GFP_KERNEL); + uioinfo = devm_kzalloc_obj(&pdev->dev, *uioinfo); if (!uioinfo) { dev_err(&pdev->dev, "unable to kmalloc\n"); return -ENOMEM; @@ -147,7 +146,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev) return ret; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) { dev_err(&pdev->dev, "unable to kmalloc\n"); return -ENOMEM; diff --git a/drivers/uio/uio_sercos3.c b/drivers/uio/uio_sercos3.c index 80087897f9b8..83b760e867c7 100644 --- a/drivers/uio/uio_sercos3.c +++ b/drivers/uio/uio_sercos3.c @@ -124,11 +124,11 @@ static int sercos3_pci_probe(struct pci_dev *dev, struct sercos3_priv *priv; int i; - info = devm_kzalloc(&dev->dev, sizeof(struct uio_info), GFP_KERNEL); + info = devm_kzalloc_obj(&dev->dev, struct uio_info); if (!info) return -ENOMEM; - priv = devm_kzalloc(&dev->dev, sizeof(struct sercos3_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&dev->dev, struct sercos3_priv); if (!priv) return -ENOMEM; diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c index f4dfd0131708..380c4fde8298 100644 --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -3190,8 +3190,7 @@ static int cdns3_init_eps(struct cdns3_device *priv_dev) continue; } - priv_ep = devm_kzalloc(priv_dev->dev, sizeof(*priv_ep), - GFP_KERNEL); + priv_ep = devm_kzalloc_obj(priv_dev->dev, *priv_ep); if (!priv_ep) goto err; @@ -3512,7 +3511,7 @@ int cdns3_gadget_init(struct cdns *cdns) { struct cdns_role_driver *rdrv; - rdrv = devm_kzalloc(cdns->dev, sizeof(*rdrv), GFP_KERNEL); + rdrv = devm_kzalloc_obj(cdns->dev, *rdrv); if (!rdrv) return -ENOMEM; diff --git a/drivers/usb/cdns3/cdns3-imx.c b/drivers/usb/cdns3/cdns3-imx.c index a2f041e1707c..710334c3431e 100644 --- a/drivers/usb/cdns3/cdns3-imx.c +++ b/drivers/usb/cdns3/cdns3-imx.c @@ -172,7 +172,7 @@ static int cdns_imx_probe(struct platform_device *pdev) if (!node) return -ENODEV; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/usb/cdns3/cdns3-plat.c b/drivers/usb/cdns3/cdns3-plat.c index e3f32c3e9535..af67e8bc160c 100644 --- a/drivers/usb/cdns3/cdns3-plat.c +++ b/drivers/usb/cdns3/cdns3-plat.c @@ -72,7 +72,7 @@ static int cdns3_plat_probe(struct platform_device *pdev) void __iomem *regs; int ret; - cdns = devm_kzalloc(dev, sizeof(*cdns), GFP_KERNEL); + cdns = devm_kzalloc_obj(dev, *cdns); if (!cdns) return -ENOMEM; diff --git a/drivers/usb/cdns3/cdns3-starfive.c b/drivers/usb/cdns3/cdns3-starfive.c index 2ff7f2b48cc2..a6ac650e2205 100644 --- a/drivers/usb/cdns3/cdns3-starfive.c +++ b/drivers/usb/cdns3/cdns3-starfive.c @@ -111,7 +111,7 @@ static int cdns_starfive_probe(struct platform_device *pdev) unsigned int args; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index 302ebf6d8e53..61850cd5b68f 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -144,7 +144,7 @@ static int cdns_ti_probe(struct platform_device *pdev) unsigned long rate; int error, i; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c index e84405352caa..2830b595d632 100644 --- a/drivers/usb/cdns3/cdnsp-gadget.c +++ b/drivers/usb/cdns3/cdnsp-gadget.c @@ -2179,7 +2179,7 @@ int cdnsp_gadget_init(struct cdns *cdns) { struct cdns_role_driver *rdrv; - rdrv = devm_kzalloc(cdns->dev, sizeof(*rdrv), GFP_KERNEL); + rdrv = devm_kzalloc_obj(cdns->dev, *rdrv); if (!rdrv) return -ENOMEM; diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c index 87122fb5bdb8..0c455a46a8f9 100644 --- a/drivers/usb/cdns3/core.c +++ b/drivers/usb/cdns3/core.c @@ -265,7 +265,7 @@ static int cdns_idle_init(struct cdns *cdns) { struct cdns_role_driver *rdrv; - rdrv = devm_kzalloc(cdns->dev, sizeof(*rdrv), GFP_KERNEL); + rdrv = devm_kzalloc_obj(cdns->dev, *rdrv); if (!rdrv) return -ENOMEM; diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c index f0df114c2b53..e01264dc625d 100644 --- a/drivers/usb/cdns3/host.c +++ b/drivers/usb/cdns3/host.c @@ -152,7 +152,7 @@ int cdns_host_init(struct cdns *cdns) { struct cdns_role_driver *rdrv; - rdrv = devm_kzalloc(cdns->dev, sizeof(*rdrv), GFP_KERNEL); + rdrv = devm_kzalloc_obj(cdns->dev, *rdrv); if (!rdrv) return -ENOMEM; diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index edbf9df9b8f2..418be1f2f48f 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -144,7 +144,7 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev) if (!of_property_present(np, "fsl,usbmisc")) return NULL; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return ERR_PTR(-ENOMEM); @@ -389,7 +389,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) imx_platform_flag = of_device_get_match_data(&pdev->dev); - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index 3ab3daa78e34..cec8474d7a95 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c @@ -180,7 +180,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "ci_hdrc_msm_probe\n"); - ci = devm_kzalloc(&pdev->dev, sizeof(*ci), GFP_KERNEL); + ci = devm_kzalloc_obj(&pdev->dev, *ci); if (!ci) return -ENOMEM; platform_set_drvdata(pdev, ci); diff --git a/drivers/usb/chipidea/ci_hdrc_npcm.c b/drivers/usb/chipidea/ci_hdrc_npcm.c index e52a2b05cbe2..75a0223b578a 100644 --- a/drivers/usb/chipidea/ci_hdrc_npcm.c +++ b/drivers/usb/chipidea/ci_hdrc_npcm.c @@ -42,7 +42,7 @@ static int npcm_udc_probe(struct platform_device *pdev) struct platform_device *plat_ci; struct device *dev = &pdev->dev; - ci = devm_kzalloc(&pdev->dev, sizeof(*ci), GFP_KERNEL); + ci = devm_kzalloc_obj(&pdev->dev, *ci); if (!ci) return -ENOMEM; platform_set_drvdata(pdev, ci); diff --git a/drivers/usb/chipidea/ci_hdrc_pci.c b/drivers/usb/chipidea/ci_hdrc_pci.c index d63479e1ad10..e41a400c892d 100644 --- a/drivers/usb/chipidea/ci_hdrc_pci.c +++ b/drivers/usb/chipidea/ci_hdrc_pci.c @@ -64,7 +64,7 @@ static int ci_hdrc_pci_probe(struct pci_dev *pdev, return -ENODEV; } - ci = devm_kzalloc(&pdev->dev, sizeof(*ci), GFP_KERNEL); + ci = devm_kzalloc_obj(&pdev->dev, *ci); if (!ci) return -ENOMEM; diff --git a/drivers/usb/chipidea/ci_hdrc_tegra.c b/drivers/usb/chipidea/ci_hdrc_tegra.c index 26225b034d3b..e42e1b6a1933 100644 --- a/drivers/usb/chipidea/ci_hdrc_tegra.c +++ b/drivers/usb/chipidea/ci_hdrc_tegra.c @@ -278,7 +278,7 @@ static int tegra_usb_probe(struct platform_device *pdev) struct tegra_usb *usb; int err; - usb = devm_kzalloc(&pdev->dev, sizeof(*usb), GFP_KERNEL); + usb = devm_kzalloc_obj(&pdev->dev, *usb); if (!usb) return -ENOMEM; diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c index 8ffa1e95d8e8..b0200c5937cd 100644 --- a/drivers/usb/chipidea/ci_hdrc_usb2.c +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c @@ -55,7 +55,7 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev) int ret; if (!ci_pdata) { - ci_pdata = devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL); + ci_pdata = devm_kmalloc_obj(dev, *ci_pdata); if (!ci_pdata) return -ENOMEM; *ci_pdata = ci_default_pdata; /* struct copy */ @@ -66,7 +66,7 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev) /* struct copy */ *ci_pdata = *data; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 3461dd763a6e..1f7c73fdc74b 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -1041,7 +1041,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - ci = devm_kzalloc(dev, sizeof(*ci), GFP_KERNEL); + ci = devm_kzalloc_obj(dev, *ci); if (!ci) return -ENOMEM; diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index ced6076a8248..3862aebccb23 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c @@ -478,7 +478,7 @@ int ci_hdrc_host_init(struct ci_hdrc *ci) if (!hw_read(ci, CAP_DCCPARAMS, DCCPARAMS_HC)) return -ENXIO; - rdrv = devm_kzalloc(ci->dev, sizeof(struct ci_role_driver), GFP_KERNEL); + rdrv = devm_kzalloc_obj(ci->dev, struct ci_role_driver); if (!rdrv) return -ENOMEM; diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index c29b2d0dcc7c..9afffd22d697 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -2417,7 +2417,7 @@ int ci_hdrc_gadget_init(struct ci_hdrc *ci) if (!hw_read(ci, CAP_DCCPARAMS, DCCPARAMS_DC)) return -ENXIO; - rdrv = devm_kzalloc(ci->dev, sizeof(*rdrv), GFP_KERNEL); + rdrv = devm_kzalloc_obj(ci->dev, *rdrv); if (!rdrv) return -ENOMEM; diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index bb027d2bd700..c799162402ce 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -1514,7 +1514,7 @@ static int usbmisc_imx_probe(struct platform_device *pdev) struct imx_usbmisc *data; struct resource *res; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/usb/common/usb-conn-gpio.c b/drivers/usb/common/usb-conn-gpio.c index f6db03d89efd..6850d45c18b3 100644 --- a/drivers/usb/common/usb-conn-gpio.c +++ b/drivers/usb/common/usb-conn-gpio.c @@ -197,7 +197,7 @@ static int usb_conn_probe(struct platform_device *pdev) struct usb_conn_info *info; int ret = 0; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return -ENOMEM; diff --git a/drivers/usb/core/phy.c b/drivers/usb/core/phy.c index 4d966cc9cdc9..0981dce4e2f1 100644 --- a/drivers/usb/core/phy.c +++ b/drivers/usb/core/phy.c @@ -30,7 +30,7 @@ static int usb_phy_roothub_add_phy_by_name(struct device *dev, const char *name, if (IS_ERR(phy)) return PTR_ERR(phy); - roothub_entry = devm_kzalloc(dev, sizeof(*roothub_entry), GFP_KERNEL); + roothub_entry = devm_kzalloc_obj(dev, *roothub_entry); if (!roothub_entry) return -ENOMEM; @@ -57,7 +57,7 @@ static int usb_phy_roothub_add_phy(struct device *dev, int index, return PTR_ERR(phy); } - roothub_entry = devm_kzalloc(dev, sizeof(*roothub_entry), GFP_KERNEL); + roothub_entry = devm_kzalloc_obj(dev, *roothub_entry); if (!roothub_entry) return -ENOMEM; @@ -83,7 +83,7 @@ struct usb_phy_roothub *usb_phy_roothub_alloc(struct device *dev) if (num_phys <= 0) return NULL; - phy_roothub = devm_kzalloc(dev, sizeof(*phy_roothub), GFP_KERNEL); + phy_roothub = devm_kzalloc_obj(dev, *phy_roothub); if (!phy_roothub) return ERR_PTR(-ENOMEM); @@ -134,7 +134,7 @@ struct usb_phy_roothub *usb_phy_roothub_alloc_usb3_phy(struct device *dev) if (usb2_phy_index < 0) return NULL; - phy_roothub = devm_kzalloc(dev, sizeof(*phy_roothub), GFP_KERNEL); + phy_roothub = devm_kzalloc_obj(dev, *phy_roothub); if (!phy_roothub) return ERR_PTR(-ENOMEM); diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 6c8a9f05fff0..c72f02adff59 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -4964,9 +4964,7 @@ static int dwc2_hsotg_hw_cfg(struct dwc2_hsotg *hsotg) /* Add ep0 */ hsotg->num_of_eps++; - hsotg->eps_in[0] = devm_kzalloc(hsotg->dev, - sizeof(struct dwc2_hsotg_ep), - GFP_KERNEL); + hsotg->eps_in[0] = devm_kzalloc_obj(hsotg->dev, struct dwc2_hsotg_ep); if (!hsotg->eps_in[0]) return -ENOMEM; /* Same dwc2_hsotg_ep is used in both directions for ep0 */ @@ -4977,15 +4975,15 @@ static int dwc2_hsotg_hw_cfg(struct dwc2_hsotg *hsotg) ep_type = cfg & 3; /* Direction in or both */ if (!(ep_type & 2)) { - hsotg->eps_in[i] = devm_kzalloc(hsotg->dev, - sizeof(struct dwc2_hsotg_ep), GFP_KERNEL); + hsotg->eps_in[i] = devm_kzalloc_obj(hsotg->dev, + struct dwc2_hsotg_ep); if (!hsotg->eps_in[i]) return -ENOMEM; } /* Direction out or both */ if (!(ep_type & 1)) { - hsotg->eps_out[i] = devm_kzalloc(hsotg->dev, - sizeof(struct dwc2_hsotg_ep), GFP_KERNEL); + hsotg->eps_out[i] = devm_kzalloc_obj(hsotg->dev, + struct dwc2_hsotg_ep); if (!hsotg->eps_out[i]) return -ENOMEM; } diff --git a/drivers/usb/dwc2/pci.c b/drivers/usb/dwc2/pci.c index f3a1e4232a31..75a2891475ef 100644 --- a/drivers/usb/dwc2/pci.c +++ b/drivers/usb/dwc2/pci.c @@ -99,7 +99,7 @@ static int dwc2_pci_probe(struct pci_dev *pci, dwc2->dev.parent = dev; - glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL); + glue = devm_kzalloc_obj(dev, *glue); if (!glue) { ret = -ENOMEM; goto err; diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index ef0d73077034..3df9b198d1b2 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -442,7 +442,7 @@ static int dwc2_driver_probe(struct platform_device *dev) struct resource *res; int retval; - hsotg = devm_kzalloc(&dev->dev, sizeof(*hsotg), GFP_KERNEL); + hsotg = devm_kzalloc_obj(&dev->dev, *hsotg); if (!hsotg) return -ENOMEM; diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 6859d62b21a4..372737f4750b 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -489,7 +489,7 @@ static struct dwc3_event_buffer *dwc3_alloc_one_event_buffer(struct dwc3 *dwc, { struct dwc3_event_buffer *evt; - evt = devm_kzalloc(dwc->dev, sizeof(*evt), GFP_KERNEL); + evt = devm_kzalloc_obj(dwc->dev, *evt); if (!evt) return ERR_PTR(-ENOMEM); @@ -2460,7 +2460,7 @@ static int dwc3_probe(struct platform_device *pdev) return -ENODEV; } - dwc = devm_kzalloc(&pdev->dev, sizeof(*dwc), GFP_KERNEL); + dwc = devm_kzalloc_obj(&pdev->dev, *dwc); if (!dwc) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index d03b3950ce04..887028684364 100644 --- a/drivers/usb/dwc3/dwc3-am62.c +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -225,7 +225,7 @@ static int dwc3_ti_probe(struct platform_device *pdev) unsigned long rate; int i, ret; - am62 = devm_kzalloc(dev, sizeof(*am62), GFP_KERNEL); + am62 = devm_kzalloc_obj(dev, *am62); if (!am62) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-apple.c b/drivers/usb/dwc3/dwc3-apple.c index 40c3ccfddb67..1f474a8bc59e 100644 --- a/drivers/usb/dwc3/dwc3-apple.c +++ b/drivers/usb/dwc3/dwc3-apple.c @@ -438,7 +438,7 @@ static int dwc3_apple_probe(struct platform_device *pdev) struct dwc3_apple *appledwc; int ret; - appledwc = devm_kzalloc(&pdev->dev, sizeof(*appledwc), GFP_KERNEL); + appledwc = devm_kzalloc_obj(&pdev->dev, *appledwc); if (!appledwc) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index e934f94e8fd8..a4dab9285874 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c @@ -45,7 +45,7 @@ static int dwc3_exynos_probe(struct platform_device *pdev) const struct dwc3_exynos_driverdata *driver_data; int i, ret; - exynos = devm_kzalloc(dev, sizeof(*exynos), GFP_KERNEL); + exynos = devm_kzalloc_obj(dev, *exynos); if (!exynos) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-generic-plat.c b/drivers/usb/dwc3/dwc3-generic-plat.c index ca69ac0eb07c..a53991a46b4c 100644 --- a/drivers/usb/dwc3/dwc3-generic-plat.c +++ b/drivers/usb/dwc3/dwc3-generic-plat.c @@ -94,7 +94,7 @@ static int dwc3_generic_probe(struct platform_device *pdev) struct resource *res; int ret; - dwc3g = devm_kzalloc(dev, sizeof(*dwc3g), GFP_KERNEL); + dwc3g = devm_kzalloc_obj(dev, *dwc3g); if (!dwc3g) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-google.c b/drivers/usb/dwc3/dwc3-google.c index ec53e658760e..67eda7f0d528 100644 --- a/drivers/usb/dwc3/dwc3-google.c +++ b/drivers/usb/dwc3/dwc3-google.c @@ -367,7 +367,7 @@ static int dwc3_google_probe(struct platform_device *pdev) int ret; u32 args[2]; - google = devm_kzalloc(&pdev->dev, sizeof(*google), GFP_KERNEL); + google = devm_kzalloc_obj(&pdev->dev, *google); if (!google) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-haps.c b/drivers/usb/dwc3/dwc3-haps.c index f6e3817fa7af..fc54e5fd0cbb 100644 --- a/drivers/usb/dwc3/dwc3-haps.c +++ b/drivers/usb/dwc3/dwc3-haps.c @@ -53,7 +53,7 @@ static int dwc3_haps_probe(struct pci_dev *pci, pci_set_master(pci); - dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL); + dwc = devm_kzalloc_obj(dev, *dwc); if (!dwc) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-imx.c b/drivers/usb/dwc3/dwc3-imx.c index d967acd43d44..845358f7b333 100644 --- a/drivers/usb/dwc3/dwc3-imx.c +++ b/drivers/usb/dwc3/dwc3-imx.c @@ -201,7 +201,7 @@ static int dwc3_imx_probe(struct platform_device *pdev) struct dwc3_probe_data probe_data = {}; int ret, irq; - dwc_imx = devm_kzalloc(dev, sizeof(*dwc_imx), GFP_KERNEL); + dwc_imx = devm_kzalloc_obj(dev, *dwc_imx); if (!dwc_imx) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c index ee92a5efaa6e..ad1d6442bbf9 100644 --- a/drivers/usb/dwc3/dwc3-imx8mp.c +++ b/drivers/usb/dwc3/dwc3-imx8mp.c @@ -191,7 +191,7 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) return -EINVAL; } - dwc3_imx = devm_kzalloc(dev, sizeof(*dwc3_imx), GFP_KERNEL); + dwc3_imx = devm_kzalloc_obj(dev, *dwc3_imx); if (!dwc3_imx) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c index 8ad302abe883..7a5fc8545d4b 100644 --- a/drivers/usb/dwc3/dwc3-keystone.c +++ b/drivers/usb/dwc3/dwc3-keystone.c @@ -86,7 +86,7 @@ static int kdwc3_probe(struct platform_device *pdev) struct dwc3_keystone *kdwc; int error, irq; - kdwc = devm_kzalloc(dev, sizeof(*kdwc), GFP_KERNEL); + kdwc = devm_kzalloc_obj(dev, *kdwc); if (!kdwc) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c index 4d611c08e8a4..ca07e813fd64 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -702,7 +702,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) void __iomem *base; int ret, i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-octeon.c b/drivers/usb/dwc3/dwc3-octeon.c index 2201f0f34abb..0c221429f94e 100644 --- a/drivers/usb/dwc3/dwc3-octeon.c +++ b/drivers/usb/dwc3/dwc3-octeon.c @@ -479,7 +479,7 @@ static int dwc3_octeon_probe(struct platform_device *pdev) power_gpio = gpio_pwr[1]; } - octeon = devm_kzalloc(dev, sizeof(*octeon), GFP_KERNEL); + octeon = devm_kzalloc_obj(dev, *octeon); if (!octeon) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c index c116143335d9..541524d167a6 100644 --- a/drivers/usb/dwc3/dwc3-of-simple.c +++ b/drivers/usb/dwc3/dwc3-of-simple.c @@ -38,7 +38,7 @@ static int dwc3_of_simple_probe(struct platform_device *pdev) int ret; - simple = devm_kzalloc(dev, sizeof(*simple), GFP_KERNEL); + simple = devm_kzalloc_obj(dev, *simple); if (!simple) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 3bff775fbe4e..0c6e72c4bdfb 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -469,7 +469,7 @@ static int dwc3_omap_probe(struct platform_device *pdev) return -EINVAL; } - omap = devm_kzalloc(dev, sizeof(*omap), GFP_KERNEL); + omap = devm_kzalloc_obj(dev, *omap); if (!omap) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 6c1cbb722ca8..0b03db68a0e7 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -343,7 +343,7 @@ static int dwc3_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) pci_set_master(pci); - dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL); + dwc = devm_kzalloc_obj(dev, *dwc); if (!dwc) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-qcom-legacy.c b/drivers/usb/dwc3/dwc3-qcom-legacy.c index d3fad0fcfdac..189f5447aa78 100644 --- a/drivers/usb/dwc3/dwc3-qcom-legacy.c +++ b/drivers/usb/dwc3/dwc3-qcom-legacy.c @@ -667,8 +667,7 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count) qcom->num_clocks = count; - qcom->clks = devm_kcalloc(dev, qcom->num_clocks, - sizeof(struct clk *), GFP_KERNEL); + qcom->clks = devm_kzalloc_objs(dev, struct clk *, qcom->num_clocks); if (!qcom->clks) return -ENOMEM; @@ -739,7 +738,7 @@ static int dwc3_qcom_probe(struct platform_device *pdev) bool ignore_pipe_clk; bool wakeup_source; - qcom = devm_kzalloc(&pdev->dev, sizeof(*qcom), GFP_KERNEL); + qcom = devm_kzalloc_obj(&pdev->dev, *qcom); if (!qcom) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index ac68b4218b56..a2608416e04e 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -618,7 +618,7 @@ static int dwc3_qcom_probe(struct platform_device *pdev) bool ignore_pipe_clk; bool wakeup_source; - qcom = devm_kzalloc(&pdev->dev, sizeof(*qcom), GFP_KERNEL); + qcom = devm_kzalloc_obj(&pdev->dev, *qcom); if (!qcom) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-rtk.c b/drivers/usb/dwc3/dwc3-rtk.c index 56c53e0c0257..5ee84812d7cd 100644 --- a/drivers/usb/dwc3/dwc3-rtk.c +++ b/drivers/usb/dwc3/dwc3-rtk.c @@ -359,7 +359,7 @@ static int dwc3_rtk_probe(struct platform_device *pdev) struct resource *res; void __iomem *regs; - rtk = devm_kzalloc(dev, sizeof(*rtk), GFP_KERNEL); + rtk = devm_kzalloc_obj(dev, *rtk); if (!rtk) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c index 5d513decaacd..64fb866cd7b0 100644 --- a/drivers/usb/dwc3/dwc3-st.c +++ b/drivers/usb/dwc3/dwc3-st.c @@ -203,7 +203,7 @@ static int st_dwc3_probe(struct platform_device *pdev) struct regmap *regmap; int ret; - dwc3_data = devm_kzalloc(dev, sizeof(*dwc3_data), GFP_KERNEL); + dwc3_data = devm_kzalloc_obj(dev, *dwc3_data); if (!dwc3_data) return -ENOMEM; diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c index b832505e1b04..c9fb8c259493 100644 --- a/drivers/usb/dwc3/dwc3-xilinx.c +++ b/drivers/usb/dwc3/dwc3-xilinx.c @@ -283,7 +283,7 @@ static int dwc3_xlnx_probe(struct platform_device *pdev) void __iomem *regs; int ret; - priv_data = devm_kzalloc(dev, sizeof(*priv_data), GFP_KERNEL); + priv_data = devm_kzalloc_obj(dev, *priv_data); if (!priv_data) return -ENOMEM; diff --git a/drivers/usb/fotg210/fotg210-core.c b/drivers/usb/fotg210/fotg210-core.c index 7de49b7eb3aa..2ead1300d723 100644 --- a/drivers/usb/fotg210/fotg210-core.c +++ b/drivers/usb/fotg210/fotg210-core.c @@ -184,7 +184,7 @@ static int fotg210_probe(struct platform_device *pdev) u32 val; int ret; - fotg = devm_kzalloc(dev, sizeof(*fotg), GFP_KERNEL); + fotg = devm_kzalloc_obj(dev, *fotg); if (!fotg) return -ENOMEM; fotg->dev = dev; diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c index cabe8703fa6c..c8a69893b584 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c @@ -306,7 +306,7 @@ static int ast_vhub_probe(struct platform_device *pdev) int i, rc = 0; const struct device_node *np = pdev->dev.of_node; - vhub = devm_kzalloc(&pdev->dev, sizeof(*vhub), GFP_KERNEL); + vhub = devm_kzalloc_obj(&pdev->dev, *vhub); if (!vhub) return -ENOMEM; @@ -315,8 +315,8 @@ static int ast_vhub_probe(struct platform_device *pdev) if (rc < 0) vhub->max_ports = AST_VHUB_NUM_PORTS; - vhub->ports = devm_kcalloc(&pdev->dev, vhub->max_ports, - sizeof(*vhub->ports), GFP_KERNEL); + vhub->ports = devm_kzalloc_objs(&pdev->dev, *vhub->ports, + vhub->max_ports); if (!vhub->ports) return -ENOMEM; @@ -325,8 +325,7 @@ static int ast_vhub_probe(struct platform_device *pdev) if (rc < 0) vhub->max_epns = AST_VHUB_NUM_GEN_EPs; - vhub->epns = devm_kcalloc(&pdev->dev, vhub->max_epns, - sizeof(*vhub->epns), GFP_KERNEL); + vhub->epns = devm_kzalloc_objs(&pdev->dev, *vhub->epns, vhub->max_epns); if (!vhub->epns) return -ENOMEM; diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c index 81fa495bbacd..10214232c08f 100644 --- a/drivers/usb/gadget/udc/aspeed_udc.c +++ b/drivers/usb/gadget/udc/aspeed_udc.c @@ -1482,7 +1482,7 @@ static int ast_udc_probe(struct platform_device *pdev) struct ast_udc_dev *udc; int rc; - udc = devm_kzalloc(&pdev->dev, sizeof(struct ast_udc_dev), GFP_KERNEL); + udc = devm_kzalloc_obj(&pdev->dev, struct ast_udc_dev); if (!udc) return -ENOMEM; diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c index 0fccca187803..ecb3805e7a58 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c @@ -1814,7 +1814,7 @@ static int at91udc_probe(struct platform_device *pdev) struct at91_ep *ep; int i; - udc = devm_kzalloc(dev, sizeof(*udc), GFP_KERNEL); + udc = devm_kzalloc_obj(dev, *udc); if (!udc) return -ENOMEM; diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index 18b4b2358d1e..9036ff323101 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -2172,8 +2172,7 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, udc->num_ep = usba_config_fifo_table(udc); } - eps = devm_kcalloc(&pdev->dev, udc->num_ep, sizeof(struct usba_ep), - GFP_KERNEL); + eps = devm_kzalloc_objs(&pdev->dev, struct usba_ep, udc->num_ep); if (!eps) return ERR_PTR(-ENOMEM); @@ -2276,7 +2275,7 @@ static int usba_udc_probe(struct platform_device *pdev) struct usba_udc *udc; int irq, ret, i; - udc = devm_kzalloc(&pdev->dev, sizeof(*udc), GFP_KERNEL); + udc = devm_kzalloc_obj(&pdev->dev, *udc); if (!udc) return -ENOMEM; diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c index ba91b1ebbf57..54ce0ddbd9e1 100644 --- a/drivers/usb/gadget/udc/bcm63xx_udc.c +++ b/drivers/usb/gadget/udc/bcm63xx_udc.c @@ -2273,7 +2273,7 @@ static int bcm63xx_udc_probe(struct platform_device *pdev) struct bcm63xx_udc *udc; int rc = -ENOMEM, i, irq; - udc = devm_kzalloc(dev, sizeof(*udc), GFP_KERNEL); + udc = devm_kzalloc_obj(dev, *udc); if (!udc) return -ENOMEM; diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c index a8dbaef54aba..5149c98bf9bf 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_core.c +++ b/drivers/usb/gadget/udc/bdc/bdc_core.c @@ -491,7 +491,7 @@ static int bdc_probe(struct platform_device *pdev) dev_dbg(dev, "%s()\n", __func__); - bdc = devm_kzalloc(dev, sizeof(*bdc), GFP_KERNEL); + bdc = devm_kzalloc_obj(dev, *bdc); if (!bdc) return -ENOMEM; @@ -511,8 +511,7 @@ static int bdc_probe(struct platform_device *pdev) bdc->num_phys = of_count_phandle_with_args(dev->of_node, "phys", "#phy-cells"); if (bdc->num_phys > 0) { - bdc->phys = devm_kcalloc(dev, bdc->num_phys, - sizeof(struct phy *), GFP_KERNEL); + bdc->phys = devm_kzalloc_objs(dev, struct phy *, bdc->num_phys); if (!bdc->phys) return -ENOMEM; } else { diff --git a/drivers/usb/gadget/udc/cdns2/cdns2-pci.c b/drivers/usb/gadget/udc/cdns2/cdns2-pci.c index e589593b4cbf..b579e9cfc214 100644 --- a/drivers/usb/gadget/udc/cdns2/cdns2-pci.c +++ b/drivers/usb/gadget/udc/cdns2/cdns2-pci.c @@ -40,7 +40,7 @@ static int cdns2_pci_probe(struct pci_dev *pdev, pci_set_master(pdev); - priv_dev = devm_kzalloc(&pdev->dev, sizeof(*priv_dev), GFP_KERNEL); + priv_dev = devm_kzalloc_obj(&pdev->dev, *priv_dev); if (!priv_dev) return -ENOMEM; diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c index cdcbfae140e9..3b407de88eb5 100644 --- a/drivers/usb/gadget/udc/gr_udc.c +++ b/drivers/usb/gadget/udc/gr_udc.c @@ -2127,7 +2127,7 @@ static int gr_probe(struct platform_device *pdev) int retval; u32 status; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; dev->dev = &pdev->dev; diff --git a/drivers/usb/gadget/udc/max3420_udc.c b/drivers/usb/gadget/udc/max3420_udc.c index 11fd61cba5af..6dbea43022a7 100644 --- a/drivers/usb/gadget/udc/max3420_udc.c +++ b/drivers/usb/gadget/udc/max3420_udc.c @@ -1215,7 +1215,7 @@ static int max3420_probe(struct spi_device *spi) return -EFAULT; } - udc = devm_kzalloc(&spi->dev, sizeof(*udc), GFP_KERNEL); + udc = devm_kzalloc_obj(&spi->dev, *udc); if (!udc) return -ENOMEM; diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c index 99b3ce28210f..78183eff9318 100644 --- a/drivers/usb/gadget/udc/pch_udc.c +++ b/drivers/usb/gadget/udc/pch_udc.c @@ -3041,7 +3041,7 @@ static int pch_udc_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct pch_udc_dev *dev; /* init */ - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c index 915786c9628c..469075b064ba 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.c +++ b/drivers/usb/gadget/udc/r8a66597-udc.c @@ -1858,7 +1858,7 @@ static int r8a66597_probe(struct platform_device *pdev) } /* initialize ucd */ - r8a66597 = devm_kzalloc(dev, sizeof(struct r8a66597), GFP_KERNEL); + r8a66597 = devm_kzalloc_obj(dev, struct r8a66597); if (r8a66597 == NULL) return -ENOMEM; diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c index 2c9c3e935a5e..0ebea52cbf2f 100644 --- a/drivers/usb/gadget/udc/renesas_usb3.c +++ b/drivers/usb/gadget/udc/renesas_usb3.c @@ -2689,9 +2689,7 @@ static int renesas_usb3_init_ep(struct renesas_usb3 *usb3, struct device *dev, if (usb3->num_usb3_eps > USB3_MAX_NUM_PIPES(usb3)) usb3->num_usb3_eps = USB3_MAX_NUM_PIPES(usb3); - usb3->usb3_ep = devm_kcalloc(dev, - usb3->num_usb3_eps, sizeof(*usb3_ep), - GFP_KERNEL); + usb3->usb3_ep = devm_kzalloc_objs(dev, *usb3_ep, usb3->num_usb3_eps); if (!usb3->usb3_ep) return -ENOMEM; @@ -2849,7 +2847,7 @@ static int renesas_usb3_probe(struct platform_device *pdev) if (irq < 0) return irq; - usb3 = devm_kzalloc(&pdev->dev, sizeof(*usb3), GFP_KERNEL); + usb3 = devm_kzalloc_obj(&pdev->dev, *usb3); if (!usb3) return -ENOMEM; diff --git a/drivers/usb/gadget/udc/renesas_usbf.c b/drivers/usb/gadget/udc/renesas_usbf.c index 367c9e73f366..e482d89850bd 100644 --- a/drivers/usb/gadget/udc/renesas_usbf.c +++ b/drivers/usb/gadget/udc/renesas_usbf.c @@ -3249,7 +3249,7 @@ static int usbf_probe(struct platform_device *pdev) int irq; int ret; - udc = devm_kzalloc(dev, sizeof(*udc), GFP_KERNEL); + udc = devm_kzalloc_obj(dev, *udc); if (!udc) return -ENOMEM; platform_set_drvdata(pdev, udc); diff --git a/drivers/usb/gadget/udc/rzv2m_usb3drd.c b/drivers/usb/gadget/udc/rzv2m_usb3drd.c index 4692eae89f44..f9480f856b0a 100644 --- a/drivers/usb/gadget/udc/rzv2m_usb3drd.c +++ b/drivers/usb/gadget/udc/rzv2m_usb3drd.c @@ -73,7 +73,7 @@ static int rzv2m_usb3drd_probe(struct platform_device *pdev) struct rzv2m_usb3drd *usb3; int ret; - usb3 = devm_kzalloc(&pdev->dev, sizeof(*usb3), GFP_KERNEL); + usb3 = devm_kzalloc_obj(&pdev->dev, *usb3); if (!usb3) return -ENOMEM; diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c b/drivers/usb/gadget/udc/snps_udc_plat.c index 8ce43c4f8fba..3687690ca33d 100644 --- a/drivers/usb/gadget/udc/snps_udc_plat.c +++ b/drivers/usb/gadget/udc/snps_udc_plat.c @@ -104,7 +104,7 @@ static int udc_plat_probe(struct platform_device *pdev) struct udc *udc; int ret; - udc = devm_kzalloc(dev, sizeof(*udc), GFP_KERNEL); + udc = devm_kzalloc_obj(dev, *udc); if (!udc) return -ENOMEM; diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c index 5042c13f92be..a7736627e6e2 100644 --- a/drivers/usb/gadget/udc/tegra-xudc.c +++ b/drivers/usb/gadget/udc/tegra-xudc.c @@ -3497,18 +3497,18 @@ static int tegra_xudc_phy_get(struct tegra_xudc *xudc) int err = 0, usb3_companion_port; unsigned int i, j; - xudc->utmi_phy = devm_kcalloc(xudc->dev, xudc->soc->num_phys, - sizeof(*xudc->utmi_phy), GFP_KERNEL); + xudc->utmi_phy = devm_kzalloc_objs(xudc->dev, *xudc->utmi_phy, + xudc->soc->num_phys); if (!xudc->utmi_phy) return -ENOMEM; - xudc->usb3_phy = devm_kcalloc(xudc->dev, xudc->soc->num_phys, - sizeof(*xudc->usb3_phy), GFP_KERNEL); + xudc->usb3_phy = devm_kzalloc_objs(xudc->dev, *xudc->usb3_phy, + xudc->soc->num_phys); if (!xudc->usb3_phy) return -ENOMEM; - xudc->usbphy = devm_kcalloc(xudc->dev, xudc->soc->num_phys, - sizeof(*xudc->usbphy), GFP_KERNEL); + xudc->usbphy = devm_kzalloc_objs(xudc->dev, *xudc->usbphy, + xudc->soc->num_phys); if (!xudc->usbphy) return -ENOMEM; @@ -3770,7 +3770,7 @@ static int tegra_xudc_probe(struct platform_device *pdev) unsigned int i; int err; - xudc = devm_kzalloc(&pdev->dev, sizeof(*xudc), GFP_KERNEL); + xudc = devm_kzalloc_obj(&pdev->dev, *xudc); if (!xudc) return -ENOMEM; @@ -3806,8 +3806,8 @@ static int tegra_xudc_probe(struct platform_device *pdev) if (err < 0) return err; - xudc->clks = devm_kcalloc(&pdev->dev, xudc->soc->num_clks, sizeof(*xudc->clks), - GFP_KERNEL); + xudc->clks = devm_kzalloc_objs(&pdev->dev, *xudc->clks, + xudc->soc->num_clks); if (!xudc->clks) return -ENOMEM; @@ -3820,8 +3820,8 @@ static int tegra_xudc_probe(struct platform_device *pdev) return err; } - xudc->supplies = devm_kcalloc(&pdev->dev, xudc->soc->num_supplies, - sizeof(*xudc->supplies), GFP_KERNEL); + xudc->supplies = devm_kzalloc_objs(&pdev->dev, *xudc->supplies, + xudc->soc->num_supplies); if (!xudc->supplies) return -ENOMEM; diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c index bef06fe7543b..8abe40d12ad2 100644 --- a/drivers/usb/gadget/udc/udc-xilinx.c +++ b/drivers/usb/gadget/udc/udc-xilinx.c @@ -2067,13 +2067,12 @@ static int xudc_probe(struct platform_device *pdev) u32 ier; u8 *buff; - udc = devm_kzalloc(&pdev->dev, sizeof(*udc), GFP_KERNEL); + udc = devm_kzalloc_obj(&pdev->dev, *udc); if (!udc) return -ENOMEM; /* Create a dummy request for GET_STATUS, SET_ADDRESS */ - udc->req = devm_kzalloc(&pdev->dev, sizeof(struct xusb_req), - GFP_KERNEL); + udc->req = devm_kzalloc_obj(&pdev->dev, struct xusb_req); if (!udc->req) return -ENOMEM; diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c index 519386255886..9b7bb8bad35f 100644 --- a/drivers/usb/host/bcma-hcd.c +++ b/drivers/usb/host/bcma-hcd.c @@ -399,8 +399,7 @@ static int bcma_hcd_probe(struct bcma_device *core) /* TODO: Probably need checks here; is the core connected? */ - usb_dev = devm_kzalloc(&core->dev, sizeof(struct bcma_hcd_device), - GFP_KERNEL); + usb_dev = devm_kzalloc_obj(&core->dev, struct bcma_hcd_device); if (!usb_dev) return -ENOMEM; usb_dev->core = core; diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c index 2d23690d72c5..200a51ecf462 100644 --- a/drivers/usb/host/ehci-sh.c +++ b/drivers/usb/host/ehci-sh.c @@ -103,8 +103,7 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) hcd->rsrc_start = res->start; hcd->rsrc_len = resource_size(res); - priv = devm_kzalloc(&pdev->dev, sizeof(struct ehci_sh_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct ehci_sh_priv); if (!priv) { ret = -ENOMEM; goto fail_request_resource; diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c index 73e76d0e6973..11c0d0e1f48d 100644 --- a/drivers/usb/host/max3421-hcd.c +++ b/drivers/usb/host/max3421-hcd.c @@ -1845,7 +1845,7 @@ max3421_probe(struct spi_device *spi) } if (IS_ENABLED(CONFIG_OF) && dev->of_node) { - pdata = devm_kzalloc(&spi->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&spi->dev, *pdata); if (!pdata) { retval = -ENOMEM; goto error; diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 12fdb18934cf..ccbb42b20131 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -545,7 +545,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) if (ret) return ret; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 45d026e85168..2a25307987a4 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -348,7 +348,7 @@ static int ohci_pxa_of_init(struct platform_device *pdev) if (ret) return ret; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c index ca96067e6d6d..d12cf85bbf22 100644 --- a/drivers/usb/host/oxu210hp-hcd.c +++ b/drivers/usb/host/oxu210hp-hcd.c @@ -4224,7 +4224,7 @@ static int oxu_drv_probe(struct platform_device *pdev) /* Allocate a driver data struct to hold useful info for both * SPH & OTG devices */ - info = devm_kzalloc(&pdev->dev, sizeof(struct oxu_info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, struct oxu_info); if (!info) { ret = -EFAULT; goto error; diff --git a/drivers/usb/host/ssb-hcd.c b/drivers/usb/host/ssb-hcd.c index 016987764afb..ec3627295a6d 100644 --- a/drivers/usb/host/ssb-hcd.c +++ b/drivers/usb/host/ssb-hcd.c @@ -165,8 +165,7 @@ static int ssb_hcd_probe(struct ssb_device *dev, if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32))) return -EOPNOTSUPP; - usb_dev = devm_kzalloc(dev->dev, sizeof(struct ssb_hcd_device), - GFP_KERNEL); + usb_dev = devm_kzalloc_obj(dev->dev, struct ssb_hcd_device); if (!usb_dev) return -ENOMEM; diff --git a/drivers/usb/host/xhci-histb.c b/drivers/usb/host/xhci-histb.c index fddb43bf6323..aa6364d7b406 100644 --- a/drivers/usb/host/xhci-histb.c +++ b/drivers/usb/host/xhci-histb.c @@ -199,7 +199,7 @@ static int xhci_histb_probe(struct platform_device *pdev) return -ENODEV; driver = &xhci_histb_hc_driver; - histb = devm_kzalloc(dev, sizeof(*histb), GFP_KERNEL); + histb = devm_kzalloc_obj(dev, *histb); if (!histb) return -ENOMEM; diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index 60af5fe29bd4..6a5a42eccbca 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c @@ -524,7 +524,7 @@ static int xhci_mtk_probe(struct platform_device *pdev) return -ENODEV; driver = &xhci_mtk_hc_driver; - mtk = devm_kzalloc(dev, sizeof(*mtk), GFP_KERNEL); + mtk = devm_kzalloc_obj(dev, *mtk); if (!mtk) return -ENOMEM; diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c index 50d733b2ad71..1a14aea58b0b 100644 --- a/drivers/usb/host/xhci-tegra.c +++ b/drivers/usb/host/xhci-tegra.c @@ -937,13 +937,13 @@ static int tegra_xusb_init_context(struct tegra_xusb *tegra) { const struct tegra_xusb_context_soc *soc = tegra->soc->context; - tegra->context.ipfs = devm_kcalloc(tegra->dev, soc->ipfs.num_offsets, - sizeof(u32), GFP_KERNEL); + tegra->context.ipfs = devm_kzalloc_objs(tegra->dev, u32, + soc->ipfs.num_offsets); if (!tegra->context.ipfs) return -ENOMEM; - tegra->context.fpci = devm_kcalloc(tegra->dev, soc->fpci.num_offsets, - sizeof(u32), GFP_KERNEL); + tegra->context.fpci = devm_kzalloc_objs(tegra->dev, u32, + soc->fpci.num_offsets); if (!tegra->context.fpci) return -ENOMEM; @@ -1509,8 +1509,8 @@ static int tegra_xusb_init_usb_phy(struct tegra_xusb *tegra) { unsigned int i; - tegra->usbphy = devm_kcalloc(tegra->dev, tegra->num_usb_phys, - sizeof(*tegra->usbphy), GFP_KERNEL); + tegra->usbphy = devm_kzalloc_objs(tegra->dev, *tegra->usbphy, + tegra->num_usb_phys); if (!tegra->usbphy) return -ENOMEM; @@ -1560,9 +1560,8 @@ static int tegra_xusb_setup_wakeup(struct platform_device *pdev, struct tegra_xu if (tegra->soc->max_num_wakes == 0) return 0; - tegra->wake_irqs = devm_kcalloc(tegra->dev, - tegra->soc->max_num_wakes, - sizeof(*tegra->wake_irqs), GFP_KERNEL); + tegra->wake_irqs = devm_kzalloc_objs(tegra->dev, *tegra->wake_irqs, + tegra->soc->max_num_wakes); if (!tegra->wake_irqs) return -ENOMEM; @@ -1606,7 +1605,7 @@ static int tegra_xusb_probe(struct platform_device *pdev) BUILD_BUG_ON(sizeof(struct tegra_xusb_fw_header) != 256); - tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL); + tegra = devm_kzalloc_obj(&pdev->dev, *tegra); if (!tegra) return -ENOMEM; @@ -1762,8 +1761,8 @@ static int tegra_xusb_probe(struct platform_device *pdev) goto put_powerdomains; } - tegra->supplies = devm_kcalloc(&pdev->dev, tegra->soc->num_supplies, - sizeof(*tegra->supplies), GFP_KERNEL); + tegra->supplies = devm_kzalloc_objs(&pdev->dev, *tegra->supplies, + tegra->soc->num_supplies); if (!tegra->supplies) { err = -ENOMEM; goto put_powerdomains; @@ -1786,8 +1785,8 @@ static int tegra_xusb_probe(struct platform_device *pdev) tegra->num_phys += tegra->soc->phy_types[i].num; } - tegra->phys = devm_kcalloc(&pdev->dev, tegra->num_phys, - sizeof(*tegra->phys), GFP_KERNEL); + tegra->phys = devm_kzalloc_objs(&pdev->dev, *tegra->phys, + tegra->num_phys); if (!tegra->phys) { err = -ENOMEM; goto put_powerdomains; diff --git a/drivers/usb/isp1760/isp1760-core.c b/drivers/usb/isp1760/isp1760-core.c index af88f4fe00d2..89ae81f0c187 100644 --- a/drivers/usb/isp1760/isp1760-core.c +++ b/drivers/usb/isp1760/isp1760-core.c @@ -504,7 +504,7 @@ int isp1760_register(struct resource *mem, int irq, unsigned long irqflags, (!udc_enabled || !IS_ENABLED(CONFIG_USB_ISP1761_UDC))) return -ENODEV; - isp = devm_kzalloc(dev, sizeof(*isp), GFP_KERNEL); + isp = devm_kzalloc_obj(dev, *isp); if (!isp) return -ENOMEM; diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c index 9b6e10177f80..0bab02cf9c70 100644 --- a/drivers/usb/misc/lvstest.c +++ b/drivers/usb/misc/lvstest.c @@ -412,7 +412,7 @@ static int lvs_rh_probe(struct usb_interface *intf, return -EINVAL; } - lvs = devm_kzalloc(&intf->dev, sizeof(*lvs), GFP_KERNEL); + lvs = devm_kzalloc_obj(&intf->dev, *lvs); if (!lvs) return -ENOMEM; diff --git a/drivers/usb/misc/onboard_usb_dev.c b/drivers/usb/misc/onboard_usb_dev.c index c60406240416..0606d405c16f 100644 --- a/drivers/usb/misc/onboard_usb_dev.c +++ b/drivers/usb/misc/onboard_usb_dev.c @@ -432,7 +432,7 @@ static int onboard_dev_probe(struct platform_device *pdev) struct device_node *i2c_node; int err; - onboard_dev = devm_kzalloc(dev, sizeof(*onboard_dev), GFP_KERNEL); + onboard_dev = devm_kzalloc_obj(dev, *onboard_dev); if (!onboard_dev) return -ENOMEM; diff --git a/drivers/usb/misc/qcom_eud.c b/drivers/usb/misc/qcom_eud.c index a7b9ed4ac071..73f9fac22e19 100644 --- a/drivers/usb/misc/qcom_eud.c +++ b/drivers/usb/misc/qcom_eud.c @@ -194,7 +194,7 @@ static int eud_probe(struct platform_device *pdev) struct resource *res; int ret; - chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/usb/misc/usb-ljca.c b/drivers/usb/misc/usb-ljca.c index fcb627b49eac..6a84ba721907 100644 --- a/drivers/usb/misc/usb-ljca.c +++ b/drivers/usb/misc/usb-ljca.c @@ -763,7 +763,7 @@ static int ljca_probe(struct usb_interface *interface, struct ljca_adapter *adap; int ret; - adap = devm_kzalloc(dev, sizeof(*adap), GFP_KERNEL); + adap = devm_kzalloc_obj(dev, *adap); if (!adap) return -ENOMEM; diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c index fb0693742f01..81bba33e66a7 100644 --- a/drivers/usb/misc/usb251xb.c +++ b/drivers/usb/misc/usb251xb.c @@ -700,7 +700,7 @@ static int usb251xb_i2c_probe(struct i2c_client *i2c) { struct usb251xb *hub; - hub = devm_kzalloc(&i2c->dev, sizeof(struct usb251xb), GFP_KERNEL); + hub = devm_kzalloc_obj(&i2c->dev, struct usb251xb); if (!hub) return -ENOMEM; @@ -773,7 +773,7 @@ static int usb251xb_plat_probe(struct platform_device *pdev) { struct usb251xb *hub; - hub = devm_kzalloc(&pdev->dev, sizeof(*hub), GFP_KERNEL); + hub = devm_kzalloc_obj(&pdev->dev, *hub); if (!hub) return -ENOMEM; diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c index 759770a13260..9f356b4bd84e 100644 --- a/drivers/usb/misc/usb3503.c +++ b/drivers/usb/misc/usb3503.c @@ -298,7 +298,7 @@ static int usb3503_i2c_probe(struct i2c_client *i2c) struct usb3503 *hub; int err; - hub = devm_kzalloc(&i2c->dev, sizeof(struct usb3503), GFP_KERNEL); + hub = devm_kzalloc_obj(&i2c->dev, struct usb3503); if (!hub) return -ENOMEM; @@ -326,7 +326,7 @@ static int usb3503_platform_probe(struct platform_device *pdev) { struct usb3503 *hub; - hub = devm_kzalloc(&pdev->dev, sizeof(struct usb3503), GFP_KERNEL); + hub = devm_kzalloc_obj(&pdev->dev, struct usb3503); if (!hub) return -ENOMEM; hub->dev = &pdev->dev; diff --git a/drivers/usb/misc/usb4604.c b/drivers/usb/misc/usb4604.c index 2ae9656715e0..d3505288e7ba 100644 --- a/drivers/usb/misc/usb4604.c +++ b/drivers/usb/misc/usb4604.c @@ -101,7 +101,7 @@ static int usb4604_i2c_probe(struct i2c_client *i2c) { struct usb4604 *hub; - hub = devm_kzalloc(&i2c->dev, sizeof(*hub), GFP_KERNEL); + hub = devm_kzalloc_obj(&i2c->dev, *hub); if (!hub) return -ENOMEM; diff --git a/drivers/usb/misc/usbio.c b/drivers/usb/misc/usbio.c index fe093e7760d5..7b5f8669aee3 100644 --- a/drivers/usb/misc/usbio.c +++ b/drivers/usb/misc/usbio.c @@ -555,7 +555,7 @@ static int usbio_probe(struct usb_interface *intf, const struct usb_device_id *i struct usbio_fwver fwver; int ret; - usbio = devm_kzalloc(dev, sizeof(*usbio), GFP_KERNEL); + usbio = devm_kzalloc_obj(dev, *usbio); if (!usbio) return -ENOMEM; diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c index 990e2e8e6bc2..386fcb5d628e 100644 --- a/drivers/usb/mtu3/mtu3_core.c +++ b/drivers/usb/mtu3/mtu3_core.c @@ -926,7 +926,7 @@ int ssusb_gadget_init(struct ssusb_mtk *ssusb) struct mtu3 *mtu = NULL; int ret = -ENOMEM; - mtu = devm_kzalloc(dev, sizeof(struct mtu3), GFP_KERNEL); + mtu = devm_kzalloc_obj(dev, struct mtu3); if (mtu == NULL) return -ENOMEM; diff --git a/drivers/usb/mtu3/mtu3_debugfs.c b/drivers/usb/mtu3/mtu3_debugfs.c index c003049bafbf..1651614231c7 100644 --- a/drivers/usb/mtu3/mtu3_debugfs.c +++ b/drivers/usb/mtu3/mtu3_debugfs.c @@ -129,7 +129,7 @@ static void mtu3_debugfs_regset(struct mtu3 *mtu, void __iomem *base, struct debugfs_regset32 *regset; struct mtu3_regset *mregs; - mregs = devm_kzalloc(mtu->dev, sizeof(*mregs), GFP_KERNEL); + mregs = devm_kzalloc_obj(mtu->dev, *mregs); if (!mregs) return; @@ -149,7 +149,7 @@ static void mtu3_debugfs_ep_regset(struct mtu3 *mtu, struct mtu3_ep *mep, int epnum = mep->epnum; int in = mep->is_in; - regs = devm_kcalloc(mtu->dev, 7, sizeof(*regs), GFP_KERNEL); + regs = devm_kzalloc_objs(mtu->dev, *regs, 7); if (!regs) return; diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c index b4f4c776adb9..e50e32c27a4b 100644 --- a/drivers/usb/mtu3/mtu3_plat.c +++ b/drivers/usb/mtu3/mtu3_plat.c @@ -243,8 +243,8 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb) ssusb->num_phys = of_count_phandle_with_args(node, "phys", "#phy-cells"); if (ssusb->num_phys > 0) { - ssusb->phys = devm_kcalloc(dev, ssusb->num_phys, - sizeof(*ssusb->phys), GFP_KERNEL); + ssusb->phys = devm_kzalloc_objs(dev, *ssusb->phys, + ssusb->num_phys); if (!ssusb->phys) return -ENOMEM; } else { @@ -332,7 +332,7 @@ static int mtu3_probe(struct platform_device *pdev) int ret = -ENOMEM; /* all elements are set to ZERO as default value */ - ssusb = devm_kzalloc(dev, sizeof(*ssusb), GFP_KERNEL); + ssusb = devm_kzalloc_obj(dev, *ssusb); if (!ssusb) return -ENOMEM; diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 6c859a1a11d0..bd7ba674140b 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -521,7 +521,7 @@ static int da8xx_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; int ret; - glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); + glue = devm_kzalloc_obj(&pdev->dev, *glue); if (!glue) return -ENOMEM; @@ -540,7 +540,7 @@ static int da8xx_probe(struct platform_device *pdev) glue->clk = clk; if (IS_ENABLED(CONFIG_OF) && np) { - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c index c770ba576f05..c5f2a1c8d147 100644 --- a/drivers/usb/musb/jz4740.c +++ b/drivers/usb/musb/jz4740.c @@ -241,7 +241,7 @@ static int jz4740_probe(struct platform_device *pdev) struct clk *clk; int ret; - glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL); + glue = devm_kzalloc_obj(dev, *glue); if (!glue) return -ENOMEM; diff --git a/drivers/usb/musb/mediatek.c b/drivers/usb/musb/mediatek.c index c6cbe718b1da..45eea9aaa821 100644 --- a/drivers/usb/musb/mediatek.c +++ b/drivers/usb/musb/mediatek.c @@ -406,12 +406,12 @@ static int mtk_musb_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; int ret; - glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL); + glue = devm_kzalloc_obj(dev, *glue); if (!glue) return -ENOMEM; glue->dev = dev; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c index 587127abd30a..1ec93af9e5f5 100644 --- a/drivers/usb/musb/mpfs.c +++ b/drivers/usb/musb/mpfs.c @@ -262,7 +262,7 @@ static int mpfs_probe(struct platform_device *pdev) struct clk *clk; int ret; - glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL); + glue = devm_kzalloc_obj(dev, *glue); if (!glue) return -ENOMEM; @@ -294,7 +294,7 @@ static int mpfs_probe(struct platform_device *pdev) glue->musb = musb_pdev; glue->clk = clk; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) { ret = -ENOMEM; goto err_clk_disable; diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 73ac25f53698..9b63b56edc45 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2144,7 +2144,7 @@ static struct musb *allocate_instance(struct device *dev, int epnum; int ret; - musb = devm_kzalloc(dev, sizeof(*musb), GFP_KERNEL); + musb = devm_kzalloc_obj(dev, *musb); if (!musb) return NULL; @@ -2257,7 +2257,7 @@ int musb_queue_resume_work(struct musb *musb, is_suspended = musb->is_runtime_suspended; if (is_suspended) { - w = devm_kzalloc(musb->controller, sizeof(*w), GFP_ATOMIC); + w = devm_kzalloc_obj(musb->controller, *w, GFP_ATOMIC); if (!w) { error = -ENOMEM; goto out_unlock; diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index efd1f0dbb926..91d8712efa41 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -794,7 +794,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue, goto err; } - config = devm_kzalloc(&parent->dev, sizeof(*config), GFP_KERNEL); + config = devm_kzalloc_obj(&parent->dev, *config); if (!config) { ret = -ENOMEM; goto err; @@ -906,7 +906,7 @@ static int dsps_probe(struct platform_device *pdev) dsps_ops.read_fifo = dsps_read_fifo32; /* allocate glue */ - glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); + glue = devm_kzalloc_obj(&pdev->dev, *glue); if (!glue) return -ENOMEM; diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 6e749faac33c..8d2c5b2cd652 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -315,7 +315,7 @@ static int omap2430_probe(struct platform_device *pdev) if (!np) return -ENODEV; - glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); + glue = devm_kzalloc_obj(&pdev->dev, *glue); if (!glue) return -ENOMEM; @@ -343,15 +343,15 @@ static int omap2430_probe(struct platform_device *pdev) glue->status = MUSB_UNKNOWN; glue->control_otghs = ERR_PTR(-ENODEV); - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) goto err_put_musb; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) goto err_put_musb; - config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL); + config = devm_kzalloc_obj(&pdev->dev, *config); if (!config) goto err_put_musb; diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c index a6bd3e968cc7..a17b1c150626 100644 --- a/drivers/usb/musb/sunxi.c +++ b/drivers/usb/musb/sunxi.c @@ -688,7 +688,7 @@ static int sunxi_musb_probe(struct platform_device *pdev) return -EINVAL; } - glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); + glue = devm_kzalloc_obj(&pdev->dev, *glue); if (!glue) return -ENOMEM; diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 1d9571f24a56..86e5ddf7dbdb 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -1228,7 +1228,7 @@ static int tusb_probe(struct platform_device *pdev) struct platform_device_info pinfo; int ret; - glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); + glue = devm_kzalloc_obj(&pdev->dev, *glue); if (!glue) return -ENOMEM; diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index 8c2a43d992f5..1a9f0f129832 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c @@ -192,7 +192,7 @@ ux500_of_probe(struct platform_device *pdev, struct device_node *np) const char *mode; int strlen; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) return NULL; @@ -236,7 +236,7 @@ static int ux500_probe(struct platform_device *pdev) } } - glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); + glue = devm_kzalloc_obj(&pdev->dev, *glue); if (!glue) goto err0; diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index e2e06e57dced..5bd78e8f5b24 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c @@ -875,11 +875,11 @@ static int ab8500_usb_probe(struct platform_device *pdev) return -ENODEV; } - ab = devm_kzalloc(&pdev->dev, sizeof(*ab), GFP_KERNEL); + ab = devm_kzalloc_obj(&pdev->dev, *ab); if (!ab) return -ENOMEM; - otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL); + otg = devm_kzalloc_obj(&pdev->dev, *otg); if (!otg) return -ENOMEM; diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c index ada508be090a..e2889d288d30 100644 --- a/drivers/usb/phy/phy-am335x-control.c +++ b/drivers/usb/phy/phy-am335x-control.c @@ -159,7 +159,7 @@ static int am335x_control_usb_probe(struct platform_device *pdev) phy_ctrl = of_id->data; - ctrl_usb = devm_kzalloc(&pdev->dev, sizeof(*ctrl_usb), GFP_KERNEL); + ctrl_usb = devm_kzalloc_obj(&pdev->dev, *ctrl_usb); if (!ctrl_usb) return -ENOMEM; diff --git a/drivers/usb/phy/phy-am335x.c b/drivers/usb/phy/phy-am335x.c index ca9353dad71a..a107e86ef4d8 100644 --- a/drivers/usb/phy/phy-am335x.c +++ b/drivers/usb/phy/phy-am335x.c @@ -41,7 +41,7 @@ static int am335x_phy_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - am_phy = devm_kzalloc(dev, sizeof(*am_phy), GFP_KERNEL); + am_phy = devm_kzalloc_obj(dev, *am_phy); if (!am_phy) return -ENOMEM; diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index a41671eda2a1..76641c385b5e 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c @@ -216,8 +216,7 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) if (nop->gpiod_reset) gpiod_direction_output(nop->gpiod_reset, 1); - nop->phy.otg = devm_kzalloc(dev, sizeof(*nop->phy.otg), - GFP_KERNEL); + nop->phy.otg = devm_kzalloc_obj(dev, *nop->phy.otg); if (!nop->phy.otg) return -ENOMEM; @@ -267,7 +266,7 @@ static int usb_phy_generic_probe(struct platform_device *pdev) struct usb_phy_generic *nop; int err; - nop = devm_kzalloc(dev, sizeof(*nop), GFP_KERNEL); + nop = devm_kzalloc_obj(dev, *nop); if (!nop) return -ENOMEM; diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c index c0135a30cabd..60b7c1219dd2 100644 --- a/drivers/usb/phy/phy-gpio-vbus-usb.c +++ b/drivers/usb/phy/phy-gpio-vbus-usb.c @@ -236,13 +236,11 @@ static int gpio_vbus_probe(struct platform_device *pdev) int err, irq; unsigned long irqflags; - gpio_vbus = devm_kzalloc(&pdev->dev, sizeof(struct gpio_vbus_data), - GFP_KERNEL); + gpio_vbus = devm_kzalloc_obj(&pdev->dev, struct gpio_vbus_data); if (!gpio_vbus) return -ENOMEM; - gpio_vbus->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), - GFP_KERNEL); + gpio_vbus->phy.otg = devm_kzalloc_obj(&pdev->dev, struct usb_otg); if (!gpio_vbus->phy.otg) return -ENOMEM; diff --git a/drivers/usb/phy/phy-isp1301.c b/drivers/usb/phy/phy-isp1301.c index 73cc70e958de..bd8a556b2fbd 100644 --- a/drivers/usb/phy/phy-isp1301.c +++ b/drivers/usb/phy/phy-isp1301.c @@ -97,7 +97,7 @@ static int isp1301_probe(struct i2c_client *client) struct isp1301 *isp; struct usb_phy *phy; - isp = devm_kzalloc(&client->dev, sizeof(*isp), GFP_KERNEL); + isp = devm_kzalloc_obj(&client->dev, *isp); if (!isp) return -ENOMEM; diff --git a/drivers/usb/phy/phy-keystone.c b/drivers/usb/phy/phy-keystone.c index 51155c5513d3..ca8759bce891 100644 --- a/drivers/usb/phy/phy-keystone.c +++ b/drivers/usb/phy/phy-keystone.c @@ -68,7 +68,7 @@ static int keystone_usbphy_probe(struct platform_device *pdev) struct keystone_usbphy *k_phy; int ret; - k_phy = devm_kzalloc(dev, sizeof(*k_phy), GFP_KERNEL); + k_phy = devm_kzalloc_obj(dev, *k_phy); if (!k_phy) return -ENOMEM; diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 7069dd3f4d0d..d899369d2d92 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -773,7 +773,7 @@ static int mxs_phy_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(clk), "can't get the clock\n"); - mxs_phy = devm_kzalloc(&pdev->dev, sizeof(*mxs_phy), GFP_KERNEL); + mxs_phy = devm_kzalloc_obj(&pdev->dev, *mxs_phy); if (!mxs_phy) return -ENOMEM; diff --git a/drivers/usb/phy/phy-omap-otg.c b/drivers/usb/phy/phy-omap-otg.c index 6e6ef8c0bc7e..84330ee0af65 100644 --- a/drivers/usb/phy/phy-omap-otg.c +++ b/drivers/usb/phy/phy-omap-otg.c @@ -98,7 +98,7 @@ static int omap_otg_probe(struct platform_device *pdev) if (IS_ERR(extcon)) return PTR_ERR(extcon); - otg_dev = devm_kzalloc(&pdev->dev, sizeof(*otg_dev), GFP_KERNEL); + otg_dev = devm_kzalloc_obj(&pdev->dev, *otg_dev); if (!otg_dev) return -ENOMEM; diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c index 88607d0edb01..3db327eaf90b 100644 --- a/drivers/usb/phy/phy-tahvo.c +++ b/drivers/usb/phy/phy-tahvo.c @@ -322,12 +322,11 @@ static int tahvo_usb_probe(struct platform_device *pdev) struct tahvo_usb *tu; int ret; - tu = devm_kzalloc(&pdev->dev, sizeof(*tu), GFP_KERNEL); + tu = devm_kzalloc_obj(&pdev->dev, *tu); if (!tu) return -ENOMEM; - tu->phy.otg = devm_kzalloc(&pdev->dev, sizeof(*tu->phy.otg), - GFP_KERNEL); + tu->phy.otg = devm_kzalloc_obj(&pdev->dev, *tu->phy.otg); if (!tu->phy.otg) return -ENOMEM; diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c index 00443a7beaeb..7b37f61b4f40 100644 --- a/drivers/usb/phy/phy-tegra-usb.c +++ b/drivers/usb/phy/phy-tegra-usb.c @@ -1345,8 +1345,7 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy, return -ENOMEM; } - tegra_phy->config = devm_kzalloc(&pdev->dev, sizeof(*config), - GFP_KERNEL); + tegra_phy->config = devm_kzalloc_obj(&pdev->dev, *config); if (!tegra_phy->config) return -ENOMEM; @@ -1497,7 +1496,7 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) struct usb_phy *phy; int err; - tegra_phy = devm_kzalloc(&pdev->dev, sizeof(*tegra_phy), GFP_KERNEL); + tegra_phy = devm_kzalloc_obj(&pdev->dev, *tegra_phy); if (!tegra_phy) return -ENOMEM; diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c index 8c09db750bfd..9bfcb2c1dfd0 100644 --- a/drivers/usb/phy/phy-twl6030-usb.c +++ b/drivers/usb/phy/phy-twl6030-usb.c @@ -338,7 +338,7 @@ static int twl6030_usb_probe(struct platform_device *pdev) return -EINVAL; } - twl = devm_kzalloc(dev, sizeof(*twl), GFP_KERNEL); + twl = devm_kzalloc_obj(dev, *twl); if (!twl) return -ENOMEM; diff --git a/drivers/usb/phy/phy-ulpi.c b/drivers/usb/phy/phy-ulpi.c index 4df63e67bb37..dbb26680e028 100644 --- a/drivers/usb/phy/phy-ulpi.c +++ b/drivers/usb/phy/phy-ulpi.c @@ -263,11 +263,11 @@ devm_otg_ulpi_create(struct device *dev, struct usb_phy *phy; struct usb_otg *otg; - phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + phy = devm_kzalloc_obj(dev, *phy); if (!phy) return NULL; - otg = devm_kzalloc(dev, sizeof(*otg), GFP_KERNEL); + otg = devm_kzalloc_obj(dev, *otg); if (!otg) { devm_kfree(dev, phy); return NULL; diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index 51d3035f82be..22a5175dcceb 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -630,7 +630,7 @@ static int usbhs_probe(struct platform_device *pdev) return irq; /* usb private data */ - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/usb/roles/intel-xhci-usb-role-switch.c b/drivers/usb/roles/intel-xhci-usb-role-switch.c index cd2e026dcb22..2f3d85ca8a7c 100644 --- a/drivers/usb/roles/intel-xhci-usb-role-switch.c +++ b/drivers/usb/roles/intel-xhci-usb-role-switch.c @@ -156,7 +156,7 @@ static int intel_xhci_usb_probe(struct platform_device *pdev) struct resource *res; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index dcceb95d7d99..9a3ede35a3d9 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -915,7 +915,7 @@ static int f81232_port_probe(struct usb_serial_port *port) { struct f81232_private *priv; - priv = devm_kzalloc(&port->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&port->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/usb/serial/f81534.c b/drivers/usb/serial/f81534.c index 0037767e4bbf..8fc60c4d6166 100644 --- a/drivers/usb/serial/f81534.c +++ b/drivers/usb/serial/f81534.c @@ -851,8 +851,7 @@ static int f81534_calc_num_ports(struct usb_serial *serial, return -ENODEV; } - serial_priv = devm_kzalloc(&serial->interface->dev, - sizeof(*serial_priv), GFP_KERNEL); + serial_priv = devm_kzalloc_obj(&serial->interface->dev, *serial_priv); if (!serial_priv) return -ENOMEM; @@ -1357,7 +1356,7 @@ static int f81534_port_probe(struct usb_serial_port *port) u8 value; serial_priv = usb_get_serial_data(port->serial); - port_priv = devm_kzalloc(&port->dev, sizeof(*port_priv), GFP_KERNEL); + port_priv = devm_kzalloc_obj(&port->dev, *port_priv); if (!port_priv) return -ENOMEM; diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c index 319704e64528..953e24620bb1 100644 --- a/drivers/usb/serial/mxuport.c +++ b/drivers/usb/serial/mxuport.c @@ -1419,8 +1419,7 @@ static int mxuport_port_probe(struct usb_serial_port *port) struct mxuport_port *mxport; int err; - mxport = devm_kzalloc(&port->dev, sizeof(struct mxuport_port), - GFP_KERNEL); + mxport = devm_kzalloc_obj(&port->dev, struct mxuport_port); if (!mxport) return -ENOMEM; diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c index 51c92dd887ab..4a566388bd6a 100644 --- a/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c @@ -791,7 +791,7 @@ int dp_altmode_probe(struct typec_altmode *alt) return -ENODEV; } - dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL); + dp = devm_kzalloc_obj(&alt->dev, *dp); if (!dp) { typec_altmode_put_plug(plug); return -ENOMEM; diff --git a/drivers/usb/typec/altmodes/thunderbolt.c b/drivers/usb/typec/altmodes/thunderbolt.c index 2e1b1a1da7d9..0fb21c6fac58 100644 --- a/drivers/usb/typec/altmodes/thunderbolt.c +++ b/drivers/usb/typec/altmodes/thunderbolt.c @@ -274,7 +274,7 @@ static int tbt_altmode_probe(struct typec_altmode *alt) { struct tbt_altmode *tbt; - tbt = devm_kzalloc(&alt->dev, sizeof(*tbt), GFP_KERNEL); + tbt = devm_kzalloc_obj(&alt->dev, *tbt); if (!tbt) return -ENOMEM; diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c index 06c25af094b3..6f9c15ee0d86 100644 --- a/drivers/usb/typec/anx7411.c +++ b/drivers/usb/typec/anx7411.c @@ -1468,7 +1468,7 @@ static int anx7411_i2c_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) return -ENODEV; - plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL); + plat = devm_kzalloc_obj(dev, *plat); if (!plat) return -ENOMEM; diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c index a717d0f8a4e5..60d6de9ba339 100644 --- a/drivers/usb/typec/hd3ss3220.c +++ b/drivers/usb/typec/hd3ss3220.c @@ -400,8 +400,7 @@ static int hd3ss3220_probe(struct i2c_client *client) unsigned int data; int ret; - hd3ss3220 = devm_kzalloc(&client->dev, sizeof(struct hd3ss3220), - GFP_KERNEL); + hd3ss3220 = devm_kzalloc_obj(&client->dev, struct hd3ss3220); if (!hd3ss3220) return -ENOMEM; diff --git a/drivers/usb/typec/mux/fsa4480.c b/drivers/usb/typec/mux/fsa4480.c index bea0c1deec94..88783f9ed44c 100644 --- a/drivers/usb/typec/mux/fsa4480.c +++ b/drivers/usb/typec/mux/fsa4480.c @@ -259,7 +259,7 @@ static int fsa4480_probe(struct i2c_client *client) int val = 0; int ret; - fsa = devm_kzalloc(dev, sizeof(*fsa), GFP_KERNEL); + fsa = devm_kzalloc_obj(dev, *fsa); if (!fsa) return -ENOMEM; diff --git a/drivers/usb/typec/mux/gpio-sbu-mux.c b/drivers/usb/typec/mux/gpio-sbu-mux.c index b1aa976aca24..8a8aa7470df4 100644 --- a/drivers/usb/typec/mux/gpio-sbu-mux.c +++ b/drivers/usb/typec/mux/gpio-sbu-mux.c @@ -105,7 +105,7 @@ static int gpio_sbu_mux_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct gpio_sbu_mux *sbu_mux; - sbu_mux = devm_kzalloc(dev, sizeof(*sbu_mux), GFP_KERNEL); + sbu_mux = devm_kzalloc_obj(dev, *sbu_mux); if (!sbu_mux) return -ENOMEM; diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c index 219a32da1348..18e6e92584e1 100644 --- a/drivers/usb/typec/mux/intel_pmc_mux.c +++ b/drivers/usb/typec/mux/intel_pmc_mux.c @@ -745,7 +745,7 @@ static int pmc_usb_probe(struct platform_device *pdev) return -ERANGE; } - pmc = devm_kzalloc(&pdev->dev, struct_size(pmc, port, num_ports), GFP_KERNEL); + pmc = devm_kzalloc_flex(&pdev->dev, *pmc, port, num_ports); if (!pmc) return -ENOMEM; diff --git a/drivers/usb/typec/mux/it5205.c b/drivers/usb/typec/mux/it5205.c index 2ab2ba6a3cbd..d78f41e59be5 100644 --- a/drivers/usb/typec/mux/it5205.c +++ b/drivers/usb/typec/mux/it5205.c @@ -178,7 +178,7 @@ static int it5205_probe(struct i2c_client *client) u32 val, chipid = 0; int i, ret; - it = devm_kzalloc(dev, sizeof(*it), GFP_KERNEL); + it = devm_kzalloc_obj(dev, *it); if (!it) return -ENOMEM; diff --git a/drivers/usb/typec/mux/nb7vpq904m.c b/drivers/usb/typec/mux/nb7vpq904m.c index d1fa26ff442c..00b2a1784e6c 100644 --- a/drivers/usb/typec/mux/nb7vpq904m.c +++ b/drivers/usb/typec/mux/nb7vpq904m.c @@ -391,7 +391,7 @@ static int nb7vpq904m_probe(struct i2c_client *client) struct nb7vpq904m *nb7; int ret; - nb7 = devm_kzalloc(dev, sizeof(*nb7), GFP_KERNEL); + nb7 = devm_kzalloc_obj(dev, *nb7); if (!nb7) return -ENOMEM; diff --git a/drivers/usb/typec/mux/pi3usb30532.c b/drivers/usb/typec/mux/pi3usb30532.c index 985683fe49e9..5728b539907a 100644 --- a/drivers/usb/typec/mux/pi3usb30532.c +++ b/drivers/usb/typec/mux/pi3usb30532.c @@ -119,7 +119,7 @@ static int pi3usb30532_probe(struct i2c_client *client) struct pi3usb30532 *pi; int ret; - pi = devm_kzalloc(dev, sizeof(*pi), GFP_KERNEL); + pi = devm_kzalloc_obj(dev, *pi); if (!pi) return -ENOMEM; diff --git a/drivers/usb/typec/mux/ps883x.c b/drivers/usb/typec/mux/ps883x.c index 2ec57cfe748a..66072a08d3bd 100644 --- a/drivers/usb/typec/mux/ps883x.c +++ b/drivers/usb/typec/mux/ps883x.c @@ -416,7 +416,7 @@ static int ps883x_retimer_probe(struct i2c_client *client) unsigned int val; int ret; - retimer = devm_kzalloc(dev, sizeof(*retimer), GFP_KERNEL); + retimer = devm_kzalloc_obj(dev, *retimer); if (!retimer) return -ENOMEM; diff --git a/drivers/usb/typec/mux/ptn36502.c b/drivers/usb/typec/mux/ptn36502.c index afd16775dbaf..0c39bfb863fa 100644 --- a/drivers/usb/typec/mux/ptn36502.c +++ b/drivers/usb/typec/mux/ptn36502.c @@ -304,7 +304,7 @@ static int ptn36502_probe(struct i2c_client *client) struct ptn36502 *ptn; int ret; - ptn = devm_kzalloc(dev, sizeof(*ptn), GFP_KERNEL); + ptn = devm_kzalloc_obj(dev, *ptn); if (!ptn) return -ENOMEM; diff --git a/drivers/usb/typec/mux/tusb1046.c b/drivers/usb/typec/mux/tusb1046.c index 34ef81f75693..55a7b246f3f9 100644 --- a/drivers/usb/typec/mux/tusb1046.c +++ b/drivers/usb/typec/mux/tusb1046.c @@ -126,7 +126,7 @@ static int tusb1046_i2c_probe(struct i2c_client *client) struct tusb1046_priv *priv; int ret = 0; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/usb/typec/mux/wcd939x-usbss.c b/drivers/usb/typec/mux/wcd939x-usbss.c index 73db3aa3cec4..ca806041aa0a 100644 --- a/drivers/usb/typec/mux/wcd939x-usbss.c +++ b/drivers/usb/typec/mux/wcd939x-usbss.c @@ -590,7 +590,7 @@ static int wcd939x_usbss_probe(struct i2c_client *client) struct wcd939x_usbss *usbss; int ret; - usbss = devm_kzalloc(dev, sizeof(*usbss), GFP_KERNEL); + usbss = devm_kzalloc_obj(dev, *usbss); if (!usbss) return -ENOMEM; diff --git a/drivers/usb/typec/rt1719.c b/drivers/usb/typec/rt1719.c index 0b0c23a0b014..354ecb25e976 100644 --- a/drivers/usb/typec/rt1719.c +++ b/drivers/usb/typec/rt1719.c @@ -842,7 +842,7 @@ static int rt1719_probe(struct i2c_client *i2c) struct typec_capability typec_cap = { }; int ret; - data = devm_kzalloc(&i2c->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&i2c->dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/usb/typec/stusb160x.c b/drivers/usb/typec/stusb160x.c index 6d85b25b40bc..a2ec0565bd85 100644 --- a/drivers/usb/typec/stusb160x.c +++ b/drivers/usb/typec/stusb160x.c @@ -638,7 +638,7 @@ static int stusb160x_probe(struct i2c_client *client) struct fwnode_handle *fwnode; int ret; - chip = devm_kzalloc(&client->dev, sizeof(struct stusb160x), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, struct stusb160x); if (!chip) return -ENOMEM; diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c index 3319f6a2b0c9..83bd287dadc7 100644 --- a/drivers/usb/typec/tcpm/fusb302.c +++ b/drivers/usb/typec/tcpm/fusb302.c @@ -1700,7 +1700,7 @@ static int fusb302_probe(struct i2c_client *client) "I2C/SMBus block functionality not supported!\n"); return -ENODEV; } - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c index d770e58bc16c..58d1e6aae637 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -43,7 +43,7 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) if (!res) return -ENODEV; - tcpm = devm_kzalloc(dev, sizeof(*tcpm), GFP_KERNEL); + tcpm = devm_kzalloc_obj(dev, *tcpm); if (!tcpm) return -ENOMEM; diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c index 926fa017ebaf..435e07659d65 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c @@ -561,15 +561,14 @@ int qcom_pmic_typec_pdphy_probe(struct platform_device *pdev, struct pmic_typec_pdphy_irq_data *irq_data; int i, ret, irq; - pmic_typec_pdphy = devm_kzalloc(dev, sizeof(*pmic_typec_pdphy), GFP_KERNEL); + pmic_typec_pdphy = devm_kzalloc_obj(dev, *pmic_typec_pdphy); if (!pmic_typec_pdphy) return -ENOMEM; if (!res->nr_irqs || res->nr_irqs > PMIC_PDPHY_MAX_IRQS) return -EINVAL; - irq_data = devm_kcalloc(dev, res->nr_irqs, sizeof(*irq_data), - GFP_KERNEL); + irq_data = devm_kzalloc_objs(dev, *irq_data, res->nr_irqs); if (!irq_data) return -ENOMEM; diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c index d3523435f3e0..b2ad31e85b5e 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c @@ -712,15 +712,14 @@ int qcom_pmic_typec_port_probe(struct platform_device *pdev, struct fwnode_handle *connector; int i, ret, irq; - pmic_typec_port = devm_kzalloc(dev, sizeof(*pmic_typec_port), GFP_KERNEL); + pmic_typec_port = devm_kzalloc_obj(dev, *pmic_typec_port); if (!pmic_typec_port) return -ENOMEM; if (!res->nr_irqs || res->nr_irqs > PMIC_TYPEC_MAX_IRQS) return -EINVAL; - irq_data = devm_kcalloc(dev, res->nr_irqs, sizeof(*irq_data), - GFP_KERNEL); + irq_data = devm_kzalloc_objs(dev, *irq_data, res->nr_irqs); if (!irq_data) return -ENOMEM; diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c index 6717ac914c6a..c6165466c54b 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -847,7 +847,7 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data) struct tcpci *tcpci; int err; - tcpci = devm_kzalloc(dev, sizeof(*tcpci), GFP_KERNEL); + tcpci = devm_kzalloc_obj(dev, *tcpci); if (!tcpci) return ERR_PTR(-ENOMEM); @@ -924,7 +924,7 @@ static int tcpci_probe(struct i2c_client *client) if (err && err != -ENODEV) return dev_err_probe(&client->dev, err, "Failed to get regulator\n"); - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/usb/typec/tcpm/tcpci_maxim_core.c b/drivers/usb/typec/tcpm/tcpci_maxim_core.c index 52dbbbe53691..a19f52515429 100644 --- a/drivers/usb/typec/tcpm/tcpci_maxim_core.c +++ b/drivers/usb/typec/tcpm/tcpci_maxim_core.c @@ -493,7 +493,7 @@ static int max_tcpci_probe(struct i2c_client *client) struct max_tcpci_chip *chip; u8 power_status; - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/usb/typec/tcpm/tcpci_mt6360.c b/drivers/usb/typec/tcpm/tcpci_mt6360.c index d4010ea5183b..ef7e235ae33d 100644 --- a/drivers/usb/typec/tcpm/tcpci_mt6360.c +++ b/drivers/usb/typec/tcpm/tcpci_mt6360.c @@ -141,7 +141,7 @@ static int mt6360_tcpc_probe(struct platform_device *pdev) struct mt6360_tcpc_info *mti; int ret; - mti = devm_kzalloc(&pdev->dev, sizeof(*mti), GFP_KERNEL); + mti = devm_kzalloc_obj(&pdev->dev, *mti); if (!mti) return -ENOMEM; diff --git a/drivers/usb/typec/tcpm/tcpci_mt6370.c b/drivers/usb/typec/tcpm/tcpci_mt6370.c index 2e85cb05ed37..fc8f1a0c3759 100644 --- a/drivers/usb/typec/tcpm/tcpci_mt6370.c +++ b/drivers/usb/typec/tcpm/tcpci_mt6370.c @@ -129,7 +129,7 @@ static int mt6370_tcpc_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int irq, ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c index af8356df6b98..0581659763a8 100644 --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c @@ -306,7 +306,7 @@ static int rt1711h_probe(struct i2c_client *client) TCPC_ALERT_CC_STATUS | TCPC_ALERT_RX_BUF_OVF | TCPC_ALERT_FAULT; - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index d721baef5210..bb90211660ca 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -8376,22 +8376,22 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode } } - port->pds = devm_kcalloc(port->dev, port->pd_count, sizeof(struct usb_power_delivery *), - GFP_KERNEL); + port->pds = devm_kzalloc_objs(port->dev, struct usb_power_delivery *, + port->pd_count); if (!port->pds) { ret = -ENOMEM; goto put_capabilities; } - port->pd_list = devm_kcalloc(port->dev, port->pd_count, sizeof(struct pd_data *), - GFP_KERNEL); + port->pd_list = devm_kzalloc_objs(port->dev, struct pd_data *, + port->pd_count); if (!port->pd_list) { ret = -ENOMEM; goto put_capabilities; } for (i = 0; i < port->pd_count; i++) { - port->pd_list[i] = devm_kzalloc(port->dev, sizeof(struct pd_data), GFP_KERNEL); + port->pd_list[i] = devm_kzalloc_obj(port->dev, struct pd_data); if (!port->pd_list[i]) { ret = -ENOMEM; goto put_capabilities; @@ -8873,7 +8873,7 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc) !tcpc->set_pd_rx || !tcpc->set_roles || !tcpc->pd_transmit) return ERR_PTR(-EINVAL); - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + port = devm_kzalloc_obj(dev, *port); if (!port) return ERR_PTR(-ENOMEM); diff --git a/drivers/usb/typec/tcpm/wcove.c b/drivers/usb/typec/tcpm/wcove.c index 0e5a3e277c3e..ee2a348d1b77 100644 --- a/drivers/usb/typec/tcpm/wcove.c +++ b/drivers/usb/typec/tcpm/wcove.c @@ -612,7 +612,7 @@ static int wcove_typec_probe(struct platform_device *pdev) int irq; int ret; - wcove = devm_kzalloc(&pdev->dev, sizeof(*wcove), GFP_KERNEL); + wcove = devm_kzalloc_obj(&pdev->dev, *wcove); if (!wcove) return -ENOMEM; diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c index c38eb678d5fe..1a052524ed83 100644 --- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c @@ -263,7 +263,7 @@ static int cros_ucsi_probe(struct platform_device *pdev) struct cros_ucsi_data *udata; int ret; - udata = devm_kzalloc(dev, sizeof(*udata), GFP_KERNEL); + udata = devm_kzalloc_obj(dev, *udata); if (!udata) return -ENOMEM; diff --git a/drivers/usb/typec/ucsi/displayport.c b/drivers/usb/typec/ucsi/displayport.c index 572da7bbd29c..c36ed27da21c 100644 --- a/drivers/usb/typec/ucsi/displayport.c +++ b/drivers/usb/typec/ucsi/displayport.c @@ -332,7 +332,7 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con, if (IS_ERR(alt)) return alt; - dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL); + dp = devm_kzalloc_obj(&alt->dev, *dp); if (!dp) { typec_unregister_altmode(alt); return ERR_PTR(-ENOMEM); diff --git a/drivers/usb/typec/ucsi/thunderbolt.c b/drivers/usb/typec/ucsi/thunderbolt.c index 434d3d8ea5b6..6641d536197c 100644 --- a/drivers/usb/typec/ucsi/thunderbolt.c +++ b/drivers/usb/typec/ucsi/thunderbolt.c @@ -184,7 +184,7 @@ struct typec_altmode *ucsi_register_thunderbolt(struct ucsi_connector *con, if (IS_ERR(alt) || !override) return alt; - tbt = devm_kzalloc(&alt->dev, sizeof(*tbt), GFP_KERNEL); + tbt = devm_kzalloc_obj(&alt->dev, *tbt); if (!tbt) { typec_unregister_altmode(alt); return ERR_PTR(-ENOMEM); diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c index 5697ccc24ec3..2d079d7177ac 100644 --- a/drivers/usb/typec/ucsi/ucsi_acpi.c +++ b/drivers/usb/typec/ucsi/ucsi_acpi.c @@ -233,7 +233,7 @@ static int ucsi_acpi_probe(struct platform_device *pdev) if (adev->dep_unmet) return -EPROBE_DEFER; - ua = devm_kzalloc(&pdev->dev, sizeof(*ua), GFP_KERNEL); + ua = devm_kzalloc_obj(&pdev->dev, *ua); if (!ua) return -ENOMEM; diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c index 3f12db95c7f4..96d0557a862d 100644 --- a/drivers/usb/typec/ucsi/ucsi_ccg.c +++ b/drivers/usb/typec/ucsi/ucsi_ccg.c @@ -1466,7 +1466,7 @@ static int ucsi_ccg_probe(struct i2c_client *client) const char *fw_name; int status; - uc = devm_kzalloc(dev, sizeof(*uc), GFP_KERNEL); + uc = devm_kzalloc_obj(dev, *uc); if (!uc) return -ENOMEM; diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c index 1db0c88d817e..1c64b3a3ca4f 100644 --- a/drivers/usb/typec/ucsi/ucsi_glink.c +++ b/drivers/usb/typec/ucsi/ucsi_glink.c @@ -398,7 +398,7 @@ static int pmic_glink_ucsi_probe(struct auxiliary_device *adev, const struct of_device_id *match; int ret; - ucsi = devm_kzalloc(dev, sizeof(*ucsi), GFP_KERNEL); + ucsi = devm_kzalloc_obj(dev, *ucsi); if (!ucsi) return -ENOMEM; diff --git a/drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c b/drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c index 57b37fca150c..54e5b6013ee6 100644 --- a/drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c +++ b/drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c @@ -413,8 +413,7 @@ static int gaokun_ucsi_ports_init(struct gaokun_ucsi *uec) gaokun_ec_ucsi_get_reg(uec->ec, &ureg); num_ports = ureg.num_ports; - uec->ports = devm_kcalloc(dev, num_ports, sizeof(*uec->ports), - GFP_KERNEL); + uec->ports = devm_kzalloc_objs(dev, *uec->ports, num_ports); if (!uec->ports) return -ENOMEM; @@ -500,7 +499,7 @@ static int gaokun_ucsi_probe(struct auxiliary_device *adev, struct gaokun_ucsi *uec; int ret; - uec = devm_kzalloc(dev, sizeof(*uec), GFP_KERNEL); + uec = devm_kzalloc_obj(dev, *uec); if (!uec) return -ENOMEM; diff --git a/drivers/usb/typec/ucsi/ucsi_stm32g0.c b/drivers/usb/typec/ucsi/ucsi_stm32g0.c index 848ed459a6de..7341abe0f0b6 100644 --- a/drivers/usb/typec/ucsi/ucsi_stm32g0.c +++ b/drivers/usb/typec/ucsi/ucsi_stm32g0.c @@ -618,7 +618,7 @@ static int ucsi_stm32g0_probe(struct i2c_client *client) struct ucsi_stm32g0 *g0; int ret; - g0 = devm_kzalloc(dev, sizeof(*g0), GFP_KERNEL); + g0 = devm_kzalloc_obj(dev, *g0); if (!g0) return -ENOMEM; diff --git a/drivers/usb/typec/ucsi/ucsi_yoga_c630.c b/drivers/usb/typec/ucsi/ucsi_yoga_c630.c index bb7b09bc7c1c..91ea486c731a 100644 --- a/drivers/usb/typec/ucsi/ucsi_yoga_c630.c +++ b/drivers/usb/typec/ucsi/ucsi_yoga_c630.c @@ -221,7 +221,7 @@ static int yoga_c630_ucsi_probe(struct auxiliary_device *adev, struct yoga_c630_ucsi *uec; int ret; - uec = devm_kzalloc(&adev->dev, sizeof(*uec), GFP_KERNEL); + uec = devm_kzalloc_obj(&adev->dev, *uec); if (!uec) return -ENOMEM; diff --git a/drivers/usb/typec/wusb3801.c b/drivers/usb/typec/wusb3801.c index 6062875fb04a..fe231095e86d 100644 --- a/drivers/usb/typec/wusb3801.c +++ b/drivers/usb/typec/wusb3801.c @@ -327,7 +327,7 @@ static int wusb3801_probe(struct i2c_client *client) const char *cap_str; int ret; - wusb3801 = devm_kzalloc(dev, sizeof(*wusb3801), GFP_KERNEL); + wusb3801 = devm_kzalloc_obj(dev, *wusb3801); if (!wusb3801) return -ENOMEM; diff --git a/drivers/vdpa/alibaba/eni_vdpa.c b/drivers/vdpa/alibaba/eni_vdpa.c index 1288402d3dd8..9910d283d727 100644 --- a/drivers/vdpa/alibaba/eni_vdpa.c +++ b/drivers/vdpa/alibaba/eni_vdpa.c @@ -503,9 +503,8 @@ static int eni_vdpa_probe(struct pci_dev *pdev, const struct pci_device_id *id) eni_vdpa->vdpa.vmap.dma_dev = &pdev->dev; eni_vdpa->queues = eni_vdpa_get_num_queues(eni_vdpa); - eni_vdpa->vring = devm_kcalloc(&pdev->dev, eni_vdpa->queues, - sizeof(*eni_vdpa->vring), - GFP_KERNEL); + eni_vdpa->vring = devm_kzalloc_objs(&pdev->dev, *eni_vdpa->vring, + eni_vdpa->queues); if (!eni_vdpa->vring) { ret = -ENOMEM; ENI_ERR(pdev, "failed to allocate virtqueues\n"); diff --git a/drivers/vdpa/octeon_ep/octep_vdpa_hw.c b/drivers/vdpa/octeon_ep/octep_vdpa_hw.c index 74240101c505..a8c657a6940f 100644 --- a/drivers/vdpa/octeon_ep/octep_vdpa_hw.c +++ b/drivers/vdpa/octeon_ep/octep_vdpa_hw.c @@ -525,7 +525,8 @@ int octep_hw_caps_read(struct octep_hw *oct_hw, struct pci_dev *pdev) } oct_hw->nr_vring = vp_ioread16(&oct_hw->common_cfg->num_queues); - oct_hw->vqs = devm_kcalloc(&pdev->dev, oct_hw->nr_vring, sizeof(*oct_hw->vqs), GFP_KERNEL); + oct_hw->vqs = devm_kzalloc_objs(&pdev->dev, *oct_hw->vqs, + oct_hw->nr_vring); if (!oct_hw->vqs) return -ENOMEM; diff --git a/drivers/vdpa/octeon_ep/octep_vdpa_main.c b/drivers/vdpa/octeon_ep/octep_vdpa_main.c index 85a3d35ea1e4..984780f32218 100644 --- a/drivers/vdpa/octeon_ep/octep_vdpa_main.c +++ b/drivers/vdpa/octeon_ep/octep_vdpa_main.c @@ -156,7 +156,7 @@ static int octep_request_irqs(struct octep_hw *oct_hw, irqreturn_t (*irq_handler else return 0; - oct_hw->irqs = devm_kcalloc(&pdev->dev, nb_irqs, sizeof(int), GFP_KERNEL); + oct_hw->irqs = devm_kzalloc_objs(&pdev->dev, int, nb_irqs); if (!oct_hw->irqs) return -ENOMEM; @@ -770,7 +770,7 @@ static int octep_vdpa_probe_vf(struct pci_dev *pdev) } pci_set_master(pdev); - mgmt_dev = devm_kzalloc(dev, sizeof(struct octep_vdpa_mgmt_dev), GFP_KERNEL); + mgmt_dev = devm_kzalloc_obj(dev, struct octep_vdpa_mgmt_dev); if (!mgmt_dev) return -ENOMEM; @@ -935,7 +935,7 @@ static int octep_vdpa_probe_pf(struct pci_dev *pdev) dev_err(dev, "No usable DMA configuration\n"); goto disable_pci; } - octpf = devm_kzalloc(dev, sizeof(*octpf), GFP_KERNEL); + octpf = devm_kzalloc_obj(dev, *octpf); if (!octpf) { ret = -ENOMEM; goto disable_pci; diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c index f2eb654b1665..646efd9384fb 100644 --- a/drivers/vdpa/virtio_pci/vp_vdpa.c +++ b/drivers/vdpa/virtio_pci/vp_vdpa.c @@ -540,9 +540,8 @@ static int vp_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, goto err; } - vp_vdpa->vring = devm_kcalloc(&pdev->dev, vp_vdpa->queues, - sizeof(*vp_vdpa->vring), - GFP_KERNEL); + vp_vdpa->vring = devm_kzalloc_objs(&pdev->dev, *vp_vdpa->vring, + vp_vdpa->queues); if (!vp_vdpa->vring) { ret = -ENOMEM; dev_err(&pdev->dev, "Fail to allocate virtqueues\n"); diff --git a/drivers/video/aperture.c b/drivers/video/aperture.c index 2b5a1e666e9b..4530e22ed7f0 100644 --- a/drivers/video/aperture.c +++ b/drivers/video/aperture.c @@ -178,7 +178,7 @@ static int devm_aperture_acquire(struct device *dev, } } - ap = devm_kzalloc(dev, sizeof(*ap), GFP_KERNEL); + ap = devm_kzalloc_obj(dev, *ap); if (!ap) { mutex_unlock(&apertures_lock); return -ENOMEM; diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c index 0a1db2824076..9381d202a0f8 100644 --- a/drivers/video/backlight/88pm860x_bl.c +++ b/drivers/video/backlight/88pm860x_bl.c @@ -186,8 +186,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev) char name[MFD_NAME_SIZE]; int ret = 0; - data = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_backlight_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct pm860x_backlight_data); if (data == NULL) return -ENOMEM; res = platform_get_resource_byname(pdev, IORESOURCE_REG, "duty cycle"); diff --git a/drivers/video/backlight/aat2870_bl.c b/drivers/video/backlight/aat2870_bl.c index 8b790df1e842..5af36d3784f1 100644 --- a/drivers/video/backlight/aat2870_bl.c +++ b/drivers/video/backlight/aat2870_bl.c @@ -114,9 +114,7 @@ static int aat2870_bl_probe(struct platform_device *pdev) goto out; } - aat2870_bl = devm_kzalloc(&pdev->dev, - sizeof(struct aat2870_bl_driver_data), - GFP_KERNEL); + aat2870_bl = devm_kzalloc_obj(&pdev->dev, struct aat2870_bl_driver_data); if (!aat2870_bl) { ret = -ENOMEM; goto out; diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c index 81c40d355aae..329af17f1956 100644 --- a/drivers/video/backlight/adp5520_bl.c +++ b/drivers/video/backlight/adp5520_bl.c @@ -283,7 +283,7 @@ static int adp5520_bl_probe(struct platform_device *pdev) struct adp5520_bl *data; int ret = 0; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (data == NULL) return -ENOMEM; diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c index 09dd67702431..75c2cd171f62 100644 --- a/drivers/video/backlight/adp8860_bl.c +++ b/drivers/video/backlight/adp8860_bl.c @@ -221,8 +221,7 @@ static int adp8860_led_probe(struct i2c_client *client) struct led_info *cur_led; int ret, i; - led = devm_kcalloc(&client->dev, pdata->num_leds, sizeof(*led), - GFP_KERNEL); + led = devm_kzalloc_objs(&client->dev, *led, pdata->num_leds); if (led == NULL) return -ENOMEM; @@ -669,7 +668,7 @@ static int adp8860_probe(struct i2c_client *client) return -EINVAL; } - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (data == NULL) return -ENOMEM; diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c index d009f2c8a11d..095fcb44b638 100644 --- a/drivers/video/backlight/adp8870_bl.c +++ b/drivers/video/backlight/adp8870_bl.c @@ -244,8 +244,7 @@ static int adp8870_led_probe(struct i2c_client *client) struct led_info *cur_led; int ret, i; - led = devm_kcalloc(&client->dev, pdata->num_leds, sizeof(*led), - GFP_KERNEL); + led = devm_kzalloc_objs(&client->dev, *led, pdata->num_leds); if (led == NULL) return -ENOMEM; @@ -866,7 +865,7 @@ static int adp8870_probe(struct i2c_client *client) return -ENODEV; } - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (data == NULL) return -ENOMEM; diff --git a/drivers/video/backlight/ams369fg06.c b/drivers/video/backlight/ams369fg06.c index f8442689ac43..538d985559c7 100644 --- a/drivers/video/backlight/ams369fg06.c +++ b/drivers/video/backlight/ams369fg06.c @@ -443,7 +443,7 @@ static int ams369fg06_probe(struct spi_device *spi) struct backlight_device *bd = NULL; struct backlight_properties props; - lcd = devm_kzalloc(&spi->dev, sizeof(struct ams369fg06), GFP_KERNEL); + lcd = devm_kzalloc_obj(&spi->dev, struct ams369fg06); if (!lcd) return -ENOMEM; diff --git a/drivers/video/backlight/apple_dwi_bl.c b/drivers/video/backlight/apple_dwi_bl.c index 93bd744972d6..a006506f7751 100644 --- a/drivers/video/backlight/apple_dwi_bl.c +++ b/drivers/video/backlight/apple_dwi_bl.c @@ -76,7 +76,7 @@ static int dwi_bl_probe(struct platform_device *dev) struct backlight_properties props; struct resource *res; - dwi_bl = devm_kzalloc(&dev->dev, sizeof(*dwi_bl), GFP_KERNEL); + dwi_bl = devm_kzalloc_obj(&dev->dev, *dwi_bl); if (!dwi_bl) return -ENOMEM; diff --git a/drivers/video/backlight/arcxcnn_bl.c b/drivers/video/backlight/arcxcnn_bl.c index f46eeab02e90..3abe13529ccb 100644 --- a/drivers/video/backlight/arcxcnn_bl.c +++ b/drivers/video/backlight/arcxcnn_bl.c @@ -152,7 +152,7 @@ static int arcxcnn_backlight_register(struct arcxcnn *lp) struct backlight_properties *props; const char *name = lp->pdata->name ? : "arctic_bl"; - props = devm_kzalloc(lp->dev, sizeof(*props), GFP_KERNEL); + props = devm_kzalloc_obj(lp->dev, *props); if (!props) return -ENOMEM; @@ -246,7 +246,7 @@ static int arcxcnn_probe(struct i2c_client *cl) if (!i2c_check_functionality(cl->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - lp = devm_kzalloc(&cl->dev, sizeof(*lp), GFP_KERNEL); + lp = devm_kzalloc_obj(&cl->dev, *lp); if (!lp) return -ENOMEM; @@ -261,8 +261,7 @@ static int arcxcnn_probe(struct i2c_client *cl) goto probe_err; if (!lp->pdata) { - lp->pdata = devm_kzalloc(lp->dev, - sizeof(*lp->pdata), GFP_KERNEL); + lp->pdata = devm_kzalloc_obj(lp->dev, *lp->pdata); if (!lp->pdata) return -ENOMEM; diff --git a/drivers/video/backlight/as3711_bl.c b/drivers/video/backlight/as3711_bl.c index 753160bbc3e7..2d419b9e8aea 100644 --- a/drivers/video/backlight/as3711_bl.c +++ b/drivers/video/backlight/as3711_bl.c @@ -406,7 +406,7 @@ static int as3711_backlight_probe(struct platform_device *pdev) return -EINVAL; } - supply = devm_kzalloc(&pdev->dev, sizeof(*supply), GFP_KERNEL); + supply = devm_kzalloc_obj(&pdev->dev, *supply); if (!supply) return -ENOMEM; diff --git a/drivers/video/backlight/aw99706.c b/drivers/video/backlight/aw99706.c index c4a66b59ecf1..43f82c83f91a 100644 --- a/drivers/video/backlight/aw99706.c +++ b/drivers/video/backlight/aw99706.c @@ -376,7 +376,7 @@ static int aw99706_probe(struct i2c_client *client) struct backlight_properties props = {}; int ret = 0; - aw = devm_kzalloc(dev, sizeof(*aw), GFP_KERNEL); + aw = devm_kzalloc_obj(dev, *aw); if (!aw) return -ENOMEM; diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c index 6778b4030b02..371d6384a864 100644 --- a/drivers/video/backlight/bd6107.c +++ b/drivers/video/backlight/bd6107.c @@ -131,7 +131,7 @@ static int bd6107_probe(struct i2c_client *client) return -EIO; } - bd = devm_kzalloc(&client->dev, sizeof(*bd), GFP_KERNEL); + bd = devm_kzalloc_obj(&client->dev, *bd); if (!bd) return -ENOMEM; diff --git a/drivers/video/backlight/cgbc_bl.c b/drivers/video/backlight/cgbc_bl.c index ab27e14338a8..3be140284eab 100644 --- a/drivers/video/backlight/cgbc_bl.c +++ b/drivers/video/backlight/cgbc_bl.c @@ -136,7 +136,7 @@ static int cgbc_bl_probe(struct platform_device *pdev) struct cgbc_bl_data *bl_data; int ret; - bl_data = devm_kzalloc(&pdev->dev, sizeof(*bl_data), GFP_KERNEL); + bl_data = devm_kzalloc_obj(&pdev->dev, *bl_data); if (!bl_data) return -ENOMEM; diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index 69f49371ea35..c76e61db59fa 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c @@ -501,7 +501,7 @@ static int corgi_lcd_probe(struct spi_device *spi) return -EINVAL; } - lcd = devm_kzalloc(&spi->dev, sizeof(struct corgi_lcd), GFP_KERNEL); + lcd = devm_kzalloc_obj(&spi->dev, struct corgi_lcd); if (!lcd) return -ENOMEM; diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c index 81ff42bec0ad..8bfd9c144ff9 100644 --- a/drivers/video/backlight/da903x_bl.c +++ b/drivers/video/backlight/da903x_bl.c @@ -100,7 +100,7 @@ static int da903x_backlight_probe(struct platform_device *pdev) struct backlight_properties props; int max_brightness; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (data == NULL) return -ENOMEM; diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c index f41523d78121..406c12434c44 100644 --- a/drivers/video/backlight/da9052_bl.c +++ b/drivers/video/backlight/da9052_bl.c @@ -107,7 +107,7 @@ static int da9052_backlight_probe(struct platform_device *pdev) struct backlight_properties props; struct da9052_bl *wleds; - wleds = devm_kzalloc(&pdev->dev, sizeof(struct da9052_bl), GFP_KERNEL); + wleds = devm_kzalloc_obj(&pdev->dev, struct da9052_bl); if (!wleds) return -ENOMEM; diff --git a/drivers/video/backlight/ep93xx_bl.c b/drivers/video/backlight/ep93xx_bl.c index f59effc02352..bcfbea77abd1 100644 --- a/drivers/video/backlight/ep93xx_bl.c +++ b/drivers/video/backlight/ep93xx_bl.c @@ -57,7 +57,7 @@ static int ep93xxbl_probe(struct platform_device *dev) struct backlight_properties props; struct resource *res; - ep93xxbl = devm_kzalloc(&dev->dev, sizeof(*ep93xxbl), GFP_KERNEL); + ep93xxbl = devm_kzalloc_obj(&dev->dev, *ep93xxbl); if (!ep93xxbl) return -ENOMEM; diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 728a546904b0..1864a4e77d32 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -53,7 +53,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) struct gpio_backlight *gbl; int ret, init_brightness, def_value; - gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL); + gbl = devm_kzalloc_obj(dev, *gbl); if (gbl == NULL) return -ENOMEM; diff --git a/drivers/video/backlight/hx8357.c b/drivers/video/backlight/hx8357.c index d69a7ebbf5f7..27d895b57678 100644 --- a/drivers/video/backlight/hx8357.c +++ b/drivers/video/backlight/hx8357.c @@ -573,7 +573,7 @@ static int hx8357_probe(struct spi_device *spi) hx8357_init_fn init_fn; int i, ret; - lcd = devm_kzalloc(dev, sizeof(*lcd), GFP_KERNEL); + lcd = devm_kzalloc_obj(dev, *lcd); if (!lcd) return -ENOMEM; diff --git a/drivers/video/backlight/ili922x.c b/drivers/video/backlight/ili922x.c index 5e1bf0c5831f..b07fcf6425c5 100644 --- a/drivers/video/backlight/ili922x.c +++ b/drivers/video/backlight/ili922x.c @@ -483,7 +483,7 @@ static int ili922x_probe(struct spi_device *spi) int ret; u16 reg = 0; - ili = devm_kzalloc(&spi->dev, sizeof(*ili), GFP_KERNEL); + ili = devm_kzalloc_obj(&spi->dev, *ili); if (!ili) return -ENOMEM; diff --git a/drivers/video/backlight/ili9320.c b/drivers/video/backlight/ili9320.c index d2f094dd7fc3..3117d8183fec 100644 --- a/drivers/video/backlight/ili9320.c +++ b/drivers/video/backlight/ili9320.c @@ -214,7 +214,7 @@ int ili9320_probe_spi(struct spi_device *spi, /* allocate and initialse our state */ - ili = devm_kzalloc(&spi->dev, sizeof(struct ili9320), GFP_KERNEL); + ili = devm_kzalloc_obj(&spi->dev, struct ili9320); if (ili == NULL) return -ENOMEM; diff --git a/drivers/video/backlight/ktd253-backlight.c b/drivers/video/backlight/ktd253-backlight.c index f2c5527d02e0..8091c7e085e8 100644 --- a/drivers/video/backlight/ktd253-backlight.c +++ b/drivers/video/backlight/ktd253-backlight.c @@ -148,7 +148,7 @@ static int ktd253_backlight_probe(struct platform_device *pdev) u32 brightness; int ret; - ktd253 = devm_kzalloc(dev, sizeof(*ktd253), GFP_KERNEL); + ktd253 = devm_kzalloc_obj(dev, *ktd253); if (!ktd253) return -ENOMEM; ktd253->dev = dev; diff --git a/drivers/video/backlight/ktd2801-backlight.c b/drivers/video/backlight/ktd2801-backlight.c index 02baf3a60b2a..c218ee55f253 100644 --- a/drivers/video/backlight/ktd2801-backlight.c +++ b/drivers/video/backlight/ktd2801-backlight.c @@ -64,7 +64,7 @@ static int ktd2801_backlight_probe(struct platform_device *pdev) u32 brightness, max_brightness; int ret; - ktd2801 = devm_kzalloc(dev, sizeof(*ktd2801), GFP_KERNEL); + ktd2801 = devm_kzalloc_obj(dev, *ktd2801); if (!ktd2801) return -ENOMEM; ktd2801->was_on = true; diff --git a/drivers/video/backlight/ktz8866.c b/drivers/video/backlight/ktz8866.c index 53c1301dbb8c..20b8483433b4 100644 --- a/drivers/video/backlight/ktz8866.c +++ b/drivers/video/backlight/ktz8866.c @@ -131,7 +131,7 @@ static int ktz8866_probe(struct i2c_client *client) struct ktz8866 *ktz; int ret = 0; - ktz = devm_kzalloc(&client->dev, sizeof(*ktz), GFP_KERNEL); + ktz = devm_kzalloc_obj(&client->dev, *ktz); if (!ktz) return -ENOMEM; diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c index d04d2256306e..9dd4f6882218 100644 --- a/drivers/video/backlight/l4f00242t03.c +++ b/drivers/video/backlight/l4f00242t03.c @@ -168,8 +168,7 @@ static int l4f00242t03_probe(struct spi_device *spi) struct l4f00242t03_priv *priv; int ret; - priv = devm_kzalloc(&spi->dev, sizeof(struct l4f00242t03_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(&spi->dev, struct l4f00242t03_priv); if (priv == NULL) return -ENOMEM; diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c index f7ab9b360731..70b74a535f44 100644 --- a/drivers/video/backlight/led_bl.c +++ b/drivers/video/backlight/led_bl.c @@ -90,8 +90,7 @@ static int led_bl_get_leds(struct device *dev, return -EINVAL; } - leds = devm_kcalloc(dev, nb_leds, sizeof(struct led_classdev *), - GFP_KERNEL); + leds = devm_kzalloc_objs(dev, struct led_classdev *, nb_leds); if (!leds) return -ENOMEM; @@ -138,8 +137,7 @@ static int led_bl_parse_levels(struct device *dev, unsigned int db; u32 *levels = NULL; - levels = devm_kcalloc(dev, num_levels, sizeof(u32), - GFP_KERNEL); + levels = devm_kzalloc_objs(dev, u32, num_levels); if (!levels) return -ENOMEM; @@ -179,7 +177,7 @@ static int led_bl_probe(struct platform_device *pdev) struct led_bl_data *priv; int ret, i; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/video/backlight/lm3509_bl.c b/drivers/video/backlight/lm3509_bl.c index 53136c5e1460..2789d99bc961 100644 --- a/drivers/video/backlight/lm3509_bl.c +++ b/drivers/video/backlight/lm3509_bl.c @@ -223,7 +223,7 @@ static int lm3509_probe(struct i2c_client *client) return -EOPNOTSUPP; } - data = devm_kzalloc(dev, sizeof(struct lm3509_bl), GFP_KERNEL); + data = devm_kzalloc_obj(dev, struct lm3509_bl); if (!data) return -ENOMEM; diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c index adcd6ac7cf22..fd6e7f4f1f61 100644 --- a/drivers/video/backlight/lm3533_bl.c +++ b/drivers/video/backlight/lm3533_bl.c @@ -271,7 +271,7 @@ static int lm3533_bl_probe(struct platform_device *pdev) return -EINVAL; } - bl = devm_kzalloc(&pdev->dev, sizeof(*bl), GFP_KERNEL); + bl = devm_kzalloc_obj(&pdev->dev, *bl); if (!bl) return -ENOMEM; diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c index 8ef8163c7fef..83cd116ff944 100644 --- a/drivers/video/backlight/lm3630a_bl.c +++ b/drivers/video/backlight/lm3630a_bl.c @@ -503,8 +503,7 @@ static int lm3630a_probe(struct i2c_client *client) return -EOPNOTSUPP; } - pchip = devm_kzalloc(&client->dev, sizeof(struct lm3630a_chip), - GFP_KERNEL); + pchip = devm_kzalloc_obj(&client->dev, struct lm3630a_chip); if (!pchip) return -ENOMEM; pchip->dev = &client->dev; @@ -518,9 +517,8 @@ static int lm3630a_probe(struct i2c_client *client) i2c_set_clientdata(client, pchip); if (pdata == NULL) { - pdata = devm_kzalloc(pchip->dev, - sizeof(struct lm3630a_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc_obj(pchip->dev, + struct lm3630a_platform_data); if (pdata == NULL) return -ENOMEM; diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c index ea748b80b737..88025c09b8d8 100644 --- a/drivers/video/backlight/lm3639_bl.c +++ b/drivers/video/backlight/lm3639_bl.c @@ -313,8 +313,7 @@ static int lm3639_probe(struct i2c_client *client) return -ENODATA; } - pchip = devm_kzalloc(&client->dev, - sizeof(struct lm3639_chip_data), GFP_KERNEL); + pchip = devm_kzalloc_obj(&client->dev, struct lm3639_chip_data); if (!pchip) return -ENOMEM; diff --git a/drivers/video/backlight/lms283gf05.c b/drivers/video/backlight/lms283gf05.c index c8b7eeeb333e..734ab79fba0b 100644 --- a/drivers/video/backlight/lms283gf05.c +++ b/drivers/video/backlight/lms283gf05.c @@ -149,8 +149,7 @@ static int lms283gf05_probe(struct spi_device *spi) struct lms283gf05_state *st; struct lcd_device *ld; - st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state), - GFP_KERNEL); + st = devm_kzalloc_obj(&spi->dev, struct lms283gf05_state); if (st == NULL) return -ENOMEM; diff --git a/drivers/video/backlight/lms501kf03.c b/drivers/video/backlight/lms501kf03.c index 28721b48b4c7..db4ad52882b6 100644 --- a/drivers/video/backlight/lms501kf03.c +++ b/drivers/video/backlight/lms501kf03.c @@ -313,7 +313,7 @@ static int lms501kf03_probe(struct spi_device *spi) struct lcd_device *ld = NULL; int ret = 0; - lcd = devm_kzalloc(&spi->dev, sizeof(struct lms501kf03), GFP_KERNEL); + lcd = devm_kzalloc_obj(&spi->dev, struct lms501kf03); if (!lcd) return -ENOMEM; diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c index 43a2123d3a4d..a8126a672731 100644 --- a/drivers/video/backlight/lp855x_bl.c +++ b/drivers/video/backlight/lp855x_bl.c @@ -346,7 +346,7 @@ static int lp855x_parse_dt(struct lp855x *lp) struct device_node *child; int i = 0; - rom = devm_kcalloc(dev, rom_length, sizeof(*rom), GFP_KERNEL); + rom = devm_kzalloc_objs(dev, *rom, rom_length); if (!rom) return -ENOMEM; @@ -403,7 +403,7 @@ static int lp855x_probe(struct i2c_client *cl) if (!i2c_check_functionality(cl->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) return -EIO; - lp = devm_kzalloc(dev, sizeof(struct lp855x), GFP_KERNEL); + lp = devm_kzalloc_obj(dev, struct lp855x); if (!lp) return -ENOMEM; @@ -440,7 +440,7 @@ static int lp855x_probe(struct i2c_client *cl) } if (!lp->pdata) { - lp->pdata = devm_kzalloc(dev, sizeof(*lp->pdata), GFP_KERNEL); + lp->pdata = devm_kzalloc_obj(dev, *lp->pdata); if (!lp->pdata) return -ENOMEM; diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c index f61a64905a02..9a4e499d1bef 100644 --- a/drivers/video/backlight/lp8788_bl.c +++ b/drivers/video/backlight/lp8788_bl.c @@ -128,7 +128,7 @@ static int lp8788_backlight_probe(struct platform_device *pdev) struct lp8788_bl *bl; int ret; - bl = devm_kzalloc(lp->dev, sizeof(struct lp8788_bl), GFP_KERNEL); + bl = devm_kzalloc_obj(lp->dev, struct lp8788_bl); if (!bl) return -ENOMEM; diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c index c919b0fe4cd9..392708f25f2b 100644 --- a/drivers/video/backlight/ltv350qv.c +++ b/drivers/video/backlight/ltv350qv.c @@ -227,7 +227,7 @@ static int ltv350qv_probe(struct spi_device *spi) struct lcd_device *ld; int ret; - lcd = devm_kzalloc(&spi->dev, sizeof(struct ltv350qv), GFP_KERNEL); + lcd = devm_kzalloc_obj(&spi->dev, struct ltv350qv); if (!lcd) return -ENOMEM; diff --git a/drivers/video/backlight/lv5207lp.c b/drivers/video/backlight/lv5207lp.c index e643ab9c3536..a22b0772b162 100644 --- a/drivers/video/backlight/lv5207lp.c +++ b/drivers/video/backlight/lv5207lp.c @@ -94,7 +94,7 @@ static int lv5207lp_probe(struct i2c_client *client) return -EIO; } - lv = devm_kzalloc(&client->dev, sizeof(*lv), GFP_KERNEL); + lv = devm_kzalloc_obj(&client->dev, *lv); if (!lv) return -ENOMEM; diff --git a/drivers/video/backlight/max25014.c b/drivers/video/backlight/max25014.c index 3ee45617261f..64d21b17f004 100644 --- a/drivers/video/backlight/max25014.c +++ b/drivers/video/backlight/max25014.c @@ -277,7 +277,7 @@ static int max25014_probe(struct i2c_client *cl) struct max25014 *maxim; int ret; - maxim = devm_kzalloc(&cl->dev, sizeof(struct max25014), GFP_KERNEL); + maxim = devm_kzalloc_obj(&cl->dev, struct max25014); if (!maxim) return -ENOMEM; diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index 4ac20a59e007..0fbf272d22a7 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -95,9 +95,7 @@ static void max8925_backlight_dt_init(struct platform_device *pdev) if (!nproot || !IS_ENABLED(CONFIG_OF)) return; - pdata = devm_kzalloc(&pdev->dev, - sizeof(struct max8925_backlight_pdata), - GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, struct max8925_backlight_pdata); if (!pdata) return; @@ -126,8 +124,7 @@ static int max8925_backlight_probe(struct platform_device *pdev) unsigned char value; int ret = 0; - data = devm_kzalloc(&pdev->dev, sizeof(struct max8925_backlight_data), - GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, struct max8925_backlight_data); if (data == NULL) return -ENOMEM; diff --git a/drivers/video/backlight/mp3309c.c b/drivers/video/backlight/mp3309c.c index 752a45798bfc..a966c1e8f92c 100644 --- a/drivers/video/backlight/mp3309c.c +++ b/drivers/video/backlight/mp3309c.c @@ -256,7 +256,7 @@ static int mp3309c_parse_fwnode(struct mp3309c_chip *chip, } /* Fill brightness levels array */ - pdata->levels = devm_kcalloc(dev, num_levels, sizeof(*pdata->levels), GFP_KERNEL); + pdata->levels = devm_kzalloc_objs(dev, *pdata->levels, num_levels); if (!pdata->levels) return -ENOMEM; if (device_property_present(dev, "brightness-levels")) { @@ -326,7 +326,7 @@ static int mp3309c_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return dev_err_probe(dev, -EOPNOTSUPP, "failed to check i2c functionality\n"); - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; @@ -340,7 +340,7 @@ static int mp3309c_probe(struct i2c_client *client) i2c_set_clientdata(client, chip); if (!pdata) { - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/drivers/video/backlight/mt6370-backlight.c b/drivers/video/backlight/mt6370-backlight.c index 7905372c2a4c..1ba37c0048f7 100644 --- a/drivers/video/backlight/mt6370-backlight.c +++ b/drivers/video/backlight/mt6370-backlight.c @@ -280,7 +280,7 @@ static int mt6370_bl_probe(struct platform_device *pdev) struct mt6370_priv *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c index e461e19231ae..65481d046946 100644 --- a/drivers/video/backlight/omap1_bl.c +++ b/drivers/video/backlight/omap1_bl.c @@ -116,8 +116,7 @@ static int omapbl_probe(struct platform_device *pdev) if (!pdata) return -ENXIO; - bl = devm_kzalloc(&pdev->dev, sizeof(struct omap_backlight), - GFP_KERNEL); + bl = devm_kzalloc_obj(&pdev->dev, struct omap_backlight); if (unlikely(!bl)) return -ENOMEM; diff --git a/drivers/video/backlight/otm3225a.c b/drivers/video/backlight/otm3225a.c index 5c6575f23ea8..5991b849aeeb 100644 --- a/drivers/video/backlight/otm3225a.c +++ b/drivers/video/backlight/otm3225a.c @@ -216,7 +216,7 @@ static int otm3225a_probe(struct spi_device *spi) struct lcd_device *ld; struct device *dev = &spi->dev; - dd = devm_kzalloc(dev, sizeof(struct otm3225a_data), GFP_KERNEL); + dd = devm_kzalloc_obj(dev, struct otm3225a_data); if (dd == NULL) return -ENOMEM; diff --git a/drivers/video/backlight/pandora_bl.c b/drivers/video/backlight/pandora_bl.c index 8a63ded0fa90..e6889e2ac55e 100644 --- a/drivers/video/backlight/pandora_bl.c +++ b/drivers/video/backlight/pandora_bl.c @@ -112,7 +112,7 @@ static int pandora_backlight_probe(struct platform_device *pdev) struct pandora_private *priv; u8 r; - priv = devm_kmalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kmalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/video/backlight/platform_lcd.c b/drivers/video/backlight/platform_lcd.c index c9fe50f4d8ed..7a46192963d2 100644 --- a/drivers/video/backlight/platform_lcd.c +++ b/drivers/video/backlight/platform_lcd.c @@ -81,8 +81,7 @@ static int platform_lcd_probe(struct platform_device *pdev) return err; } - plcd = devm_kzalloc(&pdev->dev, sizeof(struct platform_lcd), - GFP_KERNEL); + plcd = devm_kzalloc_obj(&pdev->dev, struct platform_lcd); if (!plcd) return -ENOMEM; diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 237d3d3f3bb1..3ad71ee3657a 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -194,8 +194,8 @@ int pwm_backlight_brightness_default(struct device *dev, data->max_brightness = min((int)DIV_ROUND_UP(period, fls(period)), 4096); - data->levels = devm_kcalloc(dev, data->max_brightness, - sizeof(*data->levels), GFP_KERNEL); + data->levels = devm_kzalloc_objs(dev, *data->levels, + data->max_brightness); if (!data->levels) return -ENOMEM; @@ -252,8 +252,7 @@ static int pwm_backlight_parse_dt(struct device *dev, /* read brightness levels from DT property */ if (num_levels > 0) { - data->levels = devm_kcalloc(dev, num_levels, - sizeof(*data->levels), GFP_KERNEL); + data->levels = devm_kzalloc_objs(dev, *data->levels, num_levels); if (!data->levels) return -ENOMEM; @@ -308,8 +307,7 @@ static int pwm_backlight_parse_dt(struct device *dev, * Create a new table of brightness levels with all the * interpolated steps. */ - table = devm_kcalloc(dev, num_levels, sizeof(*table), - GFP_KERNEL); + table = devm_kzalloc_objs(dev, *table, num_levels); if (!table) return -ENOMEM; /* @@ -463,7 +461,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) return ret; } - pb = devm_kzalloc(&pdev->dev, sizeof(*pb), GFP_KERNEL); + pb = devm_kzalloc_obj(&pdev->dev, *pb); if (!pb) { ret = -ENOMEM; goto err_alloc; diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c index ca350f320e17..a95eb6736642 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -1725,7 +1725,7 @@ static int wled_probe(struct platform_device *pdev) return -EINVAL; } - wled = devm_kzalloc(&pdev->dev, sizeof(*wled), GFP_KERNEL); + wled = devm_kzalloc_obj(&pdev->dev, *wled); if (!wled) return -ENOMEM; diff --git a/drivers/video/backlight/rt4831-backlight.c b/drivers/video/backlight/rt4831-backlight.c index 7ead75929a43..d93734a858dd 100644 --- a/drivers/video/backlight/rt4831-backlight.c +++ b/drivers/video/backlight/rt4831-backlight.c @@ -172,7 +172,7 @@ static int rt4831_bl_probe(struct platform_device *pdev) .scale = BACKLIGHT_SCALE_LINEAR }; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/video/backlight/sky81452-backlight.c b/drivers/video/backlight/sky81452-backlight.c index b2679b24de14..a0eac28ad78a 100644 --- a/drivers/video/backlight/sky81452-backlight.c +++ b/drivers/video/backlight/sky81452-backlight.c @@ -193,7 +193,7 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt( return ERR_PTR(-ENODATA); } - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); diff --git a/drivers/video/backlight/sy7758.c b/drivers/video/backlight/sy7758.c index 786589cb8df9..e9017c74a750 100644 --- a/drivers/video/backlight/sy7758.c +++ b/drivers/video/backlight/sy7758.c @@ -164,7 +164,7 @@ static int sy7758_probe(struct i2c_client *client) unsigned int dev_id; int ret; - sydev = devm_kzalloc(dev, sizeof(*sydev), GFP_KERNEL); + sydev = devm_kzalloc_obj(dev, *sydev); if (!sydev) return -ENOMEM; diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c index c04ee3d04d87..505d3119e434 100644 --- a/drivers/video/backlight/tdo24m.c +++ b/drivers/video/backlight/tdo24m.c @@ -348,7 +348,7 @@ static int tdo24m_probe(struct spi_device *spi) if (err) return err; - lcd = devm_kzalloc(&spi->dev, sizeof(struct tdo24m), GFP_KERNEL); + lcd = devm_kzalloc_obj(&spi->dev, struct tdo24m); if (!lcd) return -ENOMEM; diff --git a/drivers/video/backlight/tps65217_bl.c b/drivers/video/backlight/tps65217_bl.c index 8aa860350644..44b332a478e9 100644 --- a/drivers/video/backlight/tps65217_bl.c +++ b/drivers/video/backlight/tps65217_bl.c @@ -175,7 +175,7 @@ tps65217_bl_parse_dt(struct platform_device *pdev) if (!node) return ERR_PTR(-ENODEV); - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (!pdata) { err = ERR_PTR(-ENOMEM); goto err; @@ -261,8 +261,7 @@ static int tps65217_bl_probe(struct platform_device *pdev) if (IS_ERR(pdata)) return PTR_ERR(pdata); - tps65217_bl = devm_kzalloc(&pdev->dev, sizeof(*tps65217_bl), - GFP_KERNEL); + tps65217_bl = devm_kzalloc_obj(&pdev->dev, *tps65217_bl); if (tps65217_bl == NULL) return -ENOMEM; diff --git a/drivers/video/backlight/wm831x_bl.c b/drivers/video/backlight/wm831x_bl.c index 49027f04a1ec..7f4d6cf5e99a 100644 --- a/drivers/video/backlight/wm831x_bl.c +++ b/drivers/video/backlight/wm831x_bl.c @@ -170,7 +170,7 @@ static int wm831x_backlight_probe(struct platform_device *pdev) if (ret < 0) return ret; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (data == NULL) return -ENOMEM; diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index bed11a652d14..a8dce75d14bc 100644 --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c @@ -969,7 +969,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) if (IS_ERR(gpiod)) continue; - og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL); + og = devm_kzalloc_obj(dev, *og); if (!og) goto put_display_node; diff --git a/drivers/video/fbdev/au1100fb.c b/drivers/video/fbdev/au1100fb.c index 71610d5ecc2b..1b29542aa69d 100644 --- a/drivers/video/fbdev/au1100fb.c +++ b/drivers/video/fbdev/au1100fb.c @@ -732,7 +732,7 @@ static int au1100fb_drv_probe(struct platform_device *dev) struct clk *c; /* Allocate new device private */ - fbdev = devm_kzalloc(&dev->dev, sizeof(*fbdev), GFP_KERNEL); + fbdev = devm_kzalloc_obj(&dev->dev, *fbdev); if (!fbdev) return -ENOMEM; diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c index 7a021da0a32a..f6f910110f85 100644 --- a/drivers/video/fbdev/imxfb.c +++ b/drivers/video/fbdev/imxfb.c @@ -918,8 +918,7 @@ static int imxfb_probe(struct platform_device *pdev) */ fbi->num_modes = 1; - fbi->mode = devm_kzalloc(&pdev->dev, - sizeof(struct imx_fb_videomode), GFP_KERNEL); + fbi->mode = devm_kzalloc_obj(&pdev->dev, struct imx_fb_videomode); if (!fbi->mode) { ret = -ENOMEM; of_node_put(display_np); diff --git a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c index 3db608e5aef1..9d139efef2fe 100644 --- a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c +++ b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c @@ -469,9 +469,7 @@ static int mmphw_probe(struct platform_device *pdev) } /* allocate */ - ctrl = devm_kzalloc(&pdev->dev, - struct_size(ctrl, path_plats, mi->path_num), - GFP_KERNEL); + ctrl = devm_kzalloc_flex(&pdev->dev, *ctrl, path_plats, mi->path_num); if (!ctrl) { ret = -ENOMEM; goto failed; diff --git a/drivers/video/fbdev/ocfb.c b/drivers/video/fbdev/ocfb.c index c16e907e5710..e9df603220d2 100644 --- a/drivers/video/fbdev/ocfb.c +++ b/drivers/video/fbdev/ocfb.c @@ -297,7 +297,7 @@ static int ocfb_probe(struct platform_device *pdev) struct ocfb_dev *fbdev; int fbsize; - fbdev = devm_kzalloc(&pdev->dev, sizeof(*fbdev), GFP_KERNEL); + fbdev = devm_kzalloc_obj(&pdev->dev, *fbdev); if (!fbdev) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c b/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c index cef1603b7530..0794d97a9378 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c @@ -186,7 +186,7 @@ static int tvc_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c b/drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c index 3f129ce9ff01..ba691fce42b5 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c @@ -268,7 +268,7 @@ static int dvic_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/connector-hdmi.c b/drivers/video/fbdev/omap2/omapfb/displays/connector-hdmi.c index e3df731172e8..712210c9a6dd 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/connector-hdmi.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/connector-hdmi.c @@ -207,7 +207,7 @@ static int hdmic_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/encoder-opa362.c b/drivers/video/fbdev/omap2/omapfb/displays/encoder-opa362.c index 8423d90313da..cb6e1d2ff556 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/encoder-opa362.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/encoder-opa362.c @@ -191,7 +191,7 @@ static int opa362_probe(struct platform_device *pdev) return -EINVAL; } - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/encoder-tfp410.c b/drivers/video/fbdev/omap2/omapfb/displays/encoder-tfp410.c index 881c8f1ad7a8..46a785938760 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/encoder-tfp410.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/encoder-tfp410.c @@ -172,7 +172,7 @@ static int tfp410_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c b/drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c index 635375e9080c..4a2f9d7300c1 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c @@ -220,7 +220,7 @@ static int tpd_probe(struct platform_device *pdev) int r; struct gpio_desc *gpio; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-dpi.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-dpi.c index 22f4262b2432..8e6ebb853d90 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-dpi.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-dpi.c @@ -180,7 +180,7 @@ static int panel_dpi_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (ddata == NULL) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c index b2328671e067..2b16f80e2748 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c @@ -1121,7 +1121,7 @@ static int dsicm_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c index e69856cb62d5..dd8d54caebba 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c @@ -261,7 +261,7 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi) if (!spi->dev.of_node) return -ENODEV; - ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&spi->dev, *ddata); if (ddata == NULL) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-nec-nl8048hl11.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-nec-nl8048hl11.c index 33563953b2ff..449b362165cd 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-nec-nl8048hl11.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-nec-nl8048hl11.c @@ -243,7 +243,7 @@ static int nec_8048_probe(struct spi_device *spi) init_nec_8048_wvga_lcd(spi); - ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&spi->dev, *ddata); if (ddata == NULL) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c index 888d94ea8e7d..4ccb95294ee5 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c @@ -259,7 +259,7 @@ static int sharp_ls_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (ddata == NULL) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c index 0202ca8cbfc2..c69597e912f1 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c @@ -706,7 +706,7 @@ static int acx565akm_probe(struct spi_device *spi) spi->mode = SPI_MODE_3; - ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&spi->dev, *ddata); if (ddata == NULL) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c index c18d290693c1..dcb0c6c8aa2d 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c @@ -389,7 +389,7 @@ static int td028ttec1_panel_probe(struct spi_device *spi) return r; } - ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&spi->dev, *ddata); if (ddata == NULL) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c index d487941853e6..19bf60800b0d 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c @@ -466,7 +466,7 @@ static int tpo_td043_probe(struct spi_device *spi) return r; } - ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&spi->dev, *ddata); if (ddata == NULL) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dpi.c b/drivers/video/fbdev/omap2/omapfb/dss/dpi.c index ad8ae1727966..246d36140f63 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dpi.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dpi.c @@ -778,7 +778,7 @@ static int dpi_bind(struct device *dev, struct device *master, void *data) struct platform_device *pdev = to_platform_device(dev); struct dpi_data *dpi; - dpi = devm_kzalloc(&pdev->dev, sizeof(*dpi), GFP_KERNEL); + dpi = devm_kzalloc_obj(&pdev->dev, *dpi); if (!dpi) return -ENOMEM; @@ -841,7 +841,7 @@ int dpi_init_port(struct platform_device *pdev, struct device_node *port) u32 datalines; int r; - dpi = devm_kzalloc(&pdev->dev, sizeof(*dpi), GFP_KERNEL); + dpi = devm_kzalloc_obj(&pdev->dev, *dpi); if (!dpi) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c index d98db01fdd39..e91f1dab98f1 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c @@ -5259,7 +5259,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data) struct resource *res; struct resource temp_res; - dsi = devm_kzalloc(&dsidev->dev, sizeof(*dsi), GFP_KERNEL); + dsi = devm_kzalloc_obj(&dsidev->dev, *dsi); if (!dsi) return -ENOMEM; diff --git a/drivers/video/fbdev/omap2/omapfb/dss/video-pll.c b/drivers/video/fbdev/omap2/omapfb/dss/video-pll.c index ca430ca69ba3..42999ee04c8c 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/video-pll.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/video-pll.c @@ -159,7 +159,7 @@ struct dss_pll *dss_video_pll_init(struct platform_device *pdev, int id, return ERR_CAST(clk); } - vpll = devm_kzalloc(&pdev->dev, sizeof(*vpll), GFP_KERNEL); + vpll = devm_kzalloc_obj(&pdev->dev, *vpll); if (!vpll) return ERR_PTR(-ENOMEM); diff --git a/drivers/video/fbdev/omap2/omapfb/omapfb-main.c b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c index 046892682fc6..776ad60efa64 100644 --- a/drivers/video/fbdev/omap2/omapfb/omapfb-main.c +++ b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c @@ -2472,8 +2472,7 @@ static int omapfb_probe(struct platform_device *pdev) goto err0; } - fbdev = devm_kzalloc(&pdev->dev, sizeof(struct omapfb2_device), - GFP_KERNEL); + fbdev = devm_kzalloc_obj(&pdev->dev, struct omapfb2_device); if (fbdev == NULL) { r = -ENOMEM; goto err0; diff --git a/drivers/video/fbdev/omap2/omapfb/vrfb.c b/drivers/video/fbdev/omap2/omapfb/vrfb.c index 675482cde519..e0a0b6a6762a 100644 --- a/drivers/video/fbdev/omap2/omapfb/vrfb.c +++ b/drivers/video/fbdev/omap2/omapfb/vrfb.c @@ -346,9 +346,7 @@ static int __init vrfb_probe(struct platform_device *pdev) num_ctxs = pdev->num_resources - 1; - ctxs = devm_kcalloc(&pdev->dev, - num_ctxs, sizeof(struct vrfb_ctx), - GFP_KERNEL); + ctxs = devm_kzalloc_objs(&pdev->dev, struct vrfb_ctx, num_ctxs); if (!ctxs) return -ENOMEM; diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c index fc5bd7e7aae6..052a6535cdb2 100644 --- a/drivers/video/fbdev/pxa3xx-gcu.c +++ b/drivers/video/fbdev/pxa3xx-gcu.c @@ -581,7 +581,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev) struct pxa3xx_gcu_priv *priv; struct device *dev = &pdev->dev; - priv = devm_kzalloc(dev, sizeof(struct pxa3xx_gcu_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct pxa3xx_gcu_priv); if (!priv) return -ENOMEM; diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c index 1682345fb9b0..ca90ebe60a76 100644 --- a/drivers/video/fbdev/pxafb.c +++ b/drivers/video/fbdev/pxafb.c @@ -2108,9 +2108,8 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp, return -EINVAL; ret = -ENOMEM; - info->modes = devm_kcalloc(dev, timings->num_timings, - sizeof(info->modes[0]), - GFP_KERNEL); + info->modes = devm_kzalloc_objs(dev, info->modes[0], + timings->num_timings); if (!info->modes) goto out; info->num_modes = timings->num_timings; @@ -2196,7 +2195,7 @@ static struct pxafb_mach_info *of_pxafb_of_mach_info(struct device *dev) if (!dev->of_node) return NULL; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(dev, *info); if (!info) return ERR_PTR(-ENOMEM); ret = of_get_pxafb_mode_info(dev, info); diff --git a/drivers/video/fbdev/s3c-fb.c b/drivers/video/fbdev/s3c-fb.c index 82a3bc9de433..fde78707d313 100644 --- a/drivers/video/fbdev/s3c-fb.c +++ b/drivers/video/fbdev/s3c-fb.c @@ -1375,7 +1375,7 @@ static int s3c_fb_probe(struct platform_device *pdev) return -EINVAL; } - sfb = devm_kzalloc(dev, sizeof(*sfb), GFP_KERNEL); + sfb = devm_kzalloc_obj(dev, *sfb); if (!sfb) return -ENOMEM; diff --git a/drivers/video/fbdev/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c index 8102ab7d51e6..7132dbb3d6d9 100644 --- a/drivers/video/fbdev/sa1100fb.c +++ b/drivers/video/fbdev/sa1100fb.c @@ -1038,7 +1038,7 @@ static struct sa1100fb_info *sa1100fb_init_fbinfo(struct device *dev) struct sa1100fb_info *fbi; unsigned i; - fbi = devm_kzalloc(dev, sizeof(struct sa1100fb_info), GFP_KERNEL); + fbi = devm_kzalloc_obj(dev, struct sa1100fb_info); if (!fbi) return NULL; diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index 60e5dcec201f..75284ebbe333 100644 --- a/drivers/video/fbdev/simplefb.c +++ b/drivers/video/fbdev/simplefb.c @@ -363,8 +363,8 @@ static int simplefb_regulators_get(struct simplefb_par *par, if (!count) return 0; - par->regulators = devm_kcalloc(&pdev->dev, count, - sizeof(struct regulator *), GFP_KERNEL); + par->regulators = devm_kzalloc_objs(&pdev->dev, struct regulator *, + count); if (!par->regulators) return -ENOMEM; @@ -479,14 +479,11 @@ static int simplefb_attach_genpds(struct simplefb_par *par, return 0; } - par->genpds = devm_kcalloc(dev, num_genpds, sizeof(*par->genpds), - GFP_KERNEL); + par->genpds = devm_kzalloc_objs(dev, *par->genpds, num_genpds); if (!par->genpds) return -ENOMEM; - par->genpd_links = devm_kcalloc(dev, num_genpds, - sizeof(*par->genpd_links), - GFP_KERNEL); + par->genpd_links = devm_kzalloc_objs(dev, *par->genpd_links, num_genpds); if (!par->genpd_links) return -ENOMEM; diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 0254a547182d..ef4bb920c6ff 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -741,8 +741,7 @@ static int ssd1307fb_probe(struct i2c_client *client) goto fb_alloc_error; } - ssd1307fb_defio = devm_kzalloc(dev, sizeof(*ssd1307fb_defio), - GFP_KERNEL); + ssd1307fb_defio = devm_kzalloc_obj(dev, *ssd1307fb_defio); if (!ssd1307fb_defio) { dev_err(dev, "Couldn't allocate deferred io.\n"); ret = -ENOMEM; diff --git a/drivers/video/fbdev/xilinxfb.c b/drivers/video/fbdev/xilinxfb.c index 462fe2e94d55..5f511c8cc614 100644 --- a/drivers/video/fbdev/xilinxfb.c +++ b/drivers/video/fbdev/xilinxfb.c @@ -415,7 +415,7 @@ static int xilinxfb_of_probe(struct platform_device *pdev) pdata = xilinx_fb_default_pdata; /* Allocate the driver data region */ - drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/virt/coco/sev-guest/sev-guest.c b/drivers/virt/coco/sev-guest/sev-guest.c index 935537a41469..5fade6cc1357 100644 --- a/drivers/virt/coco/sev-guest/sev-guest.c +++ b/drivers/virt/coco/sev-guest/sev-guest.c @@ -636,7 +636,7 @@ static int __init sev_guest_probe(struct platform_device *pdev) if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP)) return -ENODEV; - snp_dev = devm_kzalloc(&pdev->dev, sizeof(struct snp_guest_dev), GFP_KERNEL); + snp_dev = devm_kzalloc_obj(&pdev->dev, struct snp_guest_dev); if (!snp_dev) return -ENOMEM; diff --git a/drivers/virt/vboxguest/vboxguest_core.c b/drivers/virt/vboxguest/vboxguest_core.c index b5dc0d01facd..35de1f02212a 100644 --- a/drivers/virt/vboxguest/vboxguest_core.c +++ b/drivers/virt/vboxguest/vboxguest_core.c @@ -377,8 +377,8 @@ static void vbg_balloon_work(struct work_struct *work) */ if (!gdev->mem_balloon.max_chunks) { gdev->mem_balloon.pages = - devm_kcalloc(gdev->dev, req->phys_mem_chunks, - sizeof(struct page **), GFP_KERNEL); + devm_kzalloc_objs(gdev->dev, struct page **, + req->phys_mem_chunks); if (!gdev->mem_balloon.pages) return; diff --git a/drivers/virt/vboxguest/vboxguest_linux.c b/drivers/virt/vboxguest/vboxguest_linux.c index 8c92ea5b7305..7474bae2cd9a 100644 --- a/drivers/virt/vboxguest/vboxguest_linux.c +++ b/drivers/virt/vboxguest/vboxguest_linux.c @@ -292,7 +292,7 @@ static int vbg_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) struct vbg_dev *gdev; int ret; - gdev = devm_kzalloc(dev, sizeof(*gdev), GFP_KERNEL); + gdev = devm_kzalloc_obj(dev, *gdev); if (!gdev) return -ENOMEM; diff --git a/drivers/virt/vmgenid.c b/drivers/virt/vmgenid.c index ce957f5b1c31..9070bce5a19e 100644 --- a/drivers/virt/vmgenid.c +++ b/drivers/virt/vmgenid.c @@ -141,7 +141,7 @@ static int vmgenid_add(struct platform_device *pdev) struct vmgenid_state *state; int ret; - state = devm_kmalloc(dev, sizeof(*state), GFP_KERNEL); + state = devm_kmalloc_obj(dev, *state); if (!state) return -ENOMEM; diff --git a/drivers/virtio/virtio_rtc_class.c b/drivers/virtio/virtio_rtc_class.c index 05d6d28255cf..ec974aeacda8 100644 --- a/drivers/virtio/virtio_rtc_class.c +++ b/drivers/virtio/virtio_rtc_class.c @@ -238,8 +238,7 @@ struct viortc_class *viortc_class_init(struct viortc_dev *viortc, struct viortc_class *viortc_class; struct rtc_device *rtc; - viortc_class = - devm_kzalloc(parent_dev, sizeof(*viortc_class), GFP_KERNEL); + viortc_class = devm_kzalloc_obj(parent_dev, *viortc_class); if (!viortc_class) return ERR_PTR(-ENOMEM); diff --git a/drivers/virtio/virtio_rtc_driver.c b/drivers/virtio/virtio_rtc_driver.c index 74616ba5be11..b45a7abe13c9 100644 --- a/drivers/virtio/virtio_rtc_driver.c +++ b/drivers/virtio/virtio_rtc_driver.c @@ -163,7 +163,7 @@ static struct viortc_msg *viortc_msg_init(struct viortc_dev *viortc, struct virtio_rtc_req_head *req_head; struct viortc_msg *msg; - msg = devm_kzalloc(dev, sizeof(*msg), GFP_KERNEL); + msg = devm_kzalloc_obj(dev, *msg); if (!msg) return NULL; @@ -1099,8 +1099,8 @@ static int viortc_clocks_init(struct viortc_dev *viortc) viortc->num_clocks = num_clocks; viortc->clocks_to_unregister = - devm_kcalloc(&viortc->vdev->dev, num_clocks, - sizeof(*viortc->clocks_to_unregister), GFP_KERNEL); + devm_kzalloc_objs(&viortc->vdev->dev, + *viortc->clocks_to_unregister, num_clocks); if (!viortc->clocks_to_unregister) return -ENOMEM; @@ -1182,7 +1182,7 @@ static int viortc_alloc_vq_bufs(struct viortc_dev *viortc, unsigned int i; void *buf; - buf_list = devm_kcalloc(dev, num_elems, sizeof(*buf_list), GFP_KERNEL); + buf_list = devm_kzalloc_objs(dev, *buf_list, num_elems); if (!buf_list) return -ENOMEM; @@ -1282,7 +1282,7 @@ static int viortc_probe(struct virtio_device *vdev) bool notify; int ret; - viortc = devm_kzalloc(&vdev->dev, sizeof(*viortc), GFP_KERNEL); + viortc = devm_kzalloc_obj(&vdev->dev, *viortc); if (!viortc) return -ENOMEM; diff --git a/drivers/virtio/virtio_rtc_ptp.c b/drivers/virtio/virtio_rtc_ptp.c index ff8d834493dc..54d6efd41fd9 100644 --- a/drivers/virtio/virtio_rtc_ptp.c +++ b/drivers/virtio/virtio_rtc_ptp.c @@ -309,7 +309,7 @@ struct viortc_ptp_clock *viortc_ptp_register(struct viortc_dev *viortc, ssize_t len; int ret; - vio_ptp = devm_kzalloc(parent_dev, sizeof(*vio_ptp), GFP_KERNEL); + vio_ptp = devm_kzalloc_obj(parent_dev, *vio_ptp); if (!vio_ptp) return ERR_PTR(-ENOMEM); diff --git a/drivers/w1/masters/amd_axi_w1.c b/drivers/w1/masters/amd_axi_w1.c index 96d986e0f58d..31e7f0b3c88d 100644 --- a/drivers/w1/masters/amd_axi_w1.c +++ b/drivers/w1/masters/amd_axi_w1.c @@ -299,7 +299,7 @@ static int amd_axi_w1_probe(struct platform_device *pdev) u32 ver_major, ver_minor; int val, rc = 0; - lp = devm_kzalloc(dev, sizeof(*lp), GFP_KERNEL); + lp = devm_kzalloc_obj(dev, *lp); if (!lp) return -ENOMEM; diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c index cbd11bc61274..eee9df238f6a 100644 --- a/drivers/w1/masters/ds2482.c +++ b/drivers/w1/masters/ds2482.c @@ -457,7 +457,7 @@ static int ds2482_probe(struct i2c_client *client) I2C_FUNC_SMBUS_BYTE)) return -ENODEV; - data = devm_kzalloc(&client->dev, sizeof(struct ds2482_data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, struct ds2482_data); if (!data) return -ENOMEM; diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c index 761dcbdd732a..06be7bf0b715 100644 --- a/drivers/w1/masters/mxc_w1.c +++ b/drivers/w1/masters/mxc_w1.c @@ -94,8 +94,7 @@ static int mxc_w1_probe(struct platform_device *pdev) unsigned int clkdiv; int err; - mdev = devm_kzalloc(&pdev->dev, sizeof(struct mxc_w1_device), - GFP_KERNEL); + mdev = devm_kzalloc_obj(&pdev->dev, struct mxc_w1_device); if (!mdev) return -ENOMEM; diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c index d13db3396570..f3fffcf9828a 100644 --- a/drivers/w1/masters/omap_hdq.c +++ b/drivers/w1/masters/omap_hdq.c @@ -568,7 +568,7 @@ static int omap_hdq_probe(struct platform_device *pdev) u8 rev; const char *mode; - hdq_data = devm_kzalloc(dev, sizeof(*hdq_data), GFP_KERNEL); + hdq_data = devm_kzalloc_obj(dev, *hdq_data); if (!hdq_data) return -ENOMEM; diff --git a/drivers/w1/masters/sgi_w1.c b/drivers/w1/masters/sgi_w1.c index 48c10062022c..2bc2459b3605 100644 --- a/drivers/w1/masters/sgi_w1.c +++ b/drivers/w1/masters/sgi_w1.c @@ -77,8 +77,7 @@ static int sgi_w1_probe(struct platform_device *pdev) struct sgi_w1_device *sdev; struct sgi_w1_platform_data *pdata; - sdev = devm_kzalloc(&pdev->dev, sizeof(struct sgi_w1_device), - GFP_KERNEL); + sdev = devm_kzalloc_obj(&pdev->dev, struct sgi_w1_device); if (!sdev) return -ENOMEM; diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c index 184aea37bfaf..9c8b8fd38627 100644 --- a/drivers/w1/masters/w1-gpio.c +++ b/drivers/w1/masters/w1-gpio.c @@ -71,7 +71,7 @@ static int w1_gpio_probe(struct platform_device *pdev) enum gpiod_flags gflags = GPIOD_OUT_LOW_OPEN_DRAIN; int err; - ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(&pdev->dev, *ddata); if (!ddata) return -ENOMEM; @@ -84,7 +84,7 @@ static int w1_gpio_probe(struct platform_device *pdev) if (device_property_present(dev, "linux,open-drain")) gflags = GPIOD_OUT_LOW; - master = devm_kzalloc(dev, sizeof(*master), GFP_KERNEL); + master = devm_kzalloc_obj(dev, *master); if (!master) return -ENOMEM; diff --git a/drivers/w1/masters/w1-uart.c b/drivers/w1/masters/w1-uart.c index c87eea347806..6e46773167d9 100644 --- a/drivers/w1/masters/w1-uart.c +++ b/drivers/w1/masters/w1-uart.c @@ -361,7 +361,7 @@ static int w1_uart_probe(struct serdev_device *serdev) struct w1_uart_device *w1dev; int ret; - w1dev = devm_kzalloc(dev, sizeof(*w1dev), GFP_KERNEL); + w1dev = devm_kzalloc_obj(dev, *w1dev); if (!w1dev) return -ENOMEM; w1dev->bus.data = w1dev; diff --git a/drivers/w1/slaves/w1_ds250x.c b/drivers/w1/slaves/w1_ds250x.c index cb426f7dd23d..9c5e9033d14c 100644 --- a/drivers/w1/slaves/w1_ds250x.c +++ b/drivers/w1/slaves/w1_ds250x.c @@ -177,7 +177,7 @@ static int w1_eprom_add_slave(struct w1_slave *sl) .id = -1 }; - data = devm_kzalloc(&sl->dev, sizeof(struct w1_eprom_data), GFP_KERNEL); + data = devm_kzalloc_obj(&sl->dev, struct w1_eprom_data); if (!data) return -ENOMEM; diff --git a/drivers/w1/slaves/w1_ds28e17.c b/drivers/w1/slaves/w1_ds28e17.c index b638963d4b59..9b32d8245248 100644 --- a/drivers/w1/slaves/w1_ds28e17.c +++ b/drivers/w1/slaves/w1_ds28e17.c @@ -691,7 +691,7 @@ static int w1_f19_add_slave(struct w1_slave *sl) struct w1_f19_data *data = NULL; /* Allocate memory for slave specific data. */ - data = devm_kzalloc(&sl->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&sl->dev, *data); if (!data) return -ENOMEM; sl->family_data = data; diff --git a/drivers/watchdog/airoha_wdt.c b/drivers/watchdog/airoha_wdt.c index c535c48ab6a8..332677bd828a 100644 --- a/drivers/watchdog/airoha_wdt.c +++ b/drivers/watchdog/airoha_wdt.c @@ -133,7 +133,7 @@ static int airoha_wdt_probe(struct platform_device *pdev) struct clk *bus_clk; int ret; - airoha_wdt = devm_kzalloc(dev, sizeof(*airoha_wdt), GFP_KERNEL); + airoha_wdt = devm_kzalloc_obj(dev, *airoha_wdt); if (!airoha_wdt) return -ENOMEM; diff --git a/drivers/watchdog/apple_wdt.c b/drivers/watchdog/apple_wdt.c index f533953294f6..181b687d8601 100644 --- a/drivers/watchdog/apple_wdt.c +++ b/drivers/watchdog/apple_wdt.c @@ -161,7 +161,7 @@ static int apple_wdt_probe(struct platform_device *pdev) struct clk *clk; u32 wdt_ctrl; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/arm_smc_wdt.c b/drivers/watchdog/arm_smc_wdt.c index c73ed1dcdfcb..479863450a9c 100644 --- a/drivers/watchdog/arm_smc_wdt.c +++ b/drivers/watchdog/arm_smc_wdt.c @@ -118,7 +118,7 @@ static int smcwd_probe(struct platform_device *pdev) struct arm_smccc_res res; u32 smc_func_id; - wdd = devm_kzalloc(&pdev->dev, sizeof(*wdd), GFP_KERNEL); + wdd = devm_kzalloc_obj(&pdev->dev, *wdd); if (!wdd) return -ENOMEM; platform_set_drvdata(pdev, wdd); diff --git a/drivers/watchdog/armada_37xx_wdt.c b/drivers/watchdog/armada_37xx_wdt.c index d62b02c40b0e..3af8dd8bceb9 100644 --- a/drivers/watchdog/armada_37xx_wdt.c +++ b/drivers/watchdog/armada_37xx_wdt.c @@ -252,8 +252,7 @@ static int armada_37xx_wdt_probe(struct platform_device *pdev) struct regmap *regmap; int ret; - dev = devm_kzalloc(&pdev->dev, sizeof(struct armada_37xx_watchdog), - GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, struct armada_37xx_watchdog); if (!dev) return -ENOMEM; diff --git a/drivers/watchdog/asm9260_wdt.c b/drivers/watchdog/asm9260_wdt.c index 45047e514b8e..15c264ff3afc 100644 --- a/drivers/watchdog/asm9260_wdt.c +++ b/drivers/watchdog/asm9260_wdt.c @@ -290,7 +290,7 @@ static int asm9260_wdt_probe(struct platform_device *pdev) int ret; static const char * const mode_name[] = { "hw", "sw", "debug", }; - priv = devm_kzalloc(dev, sizeof(struct asm9260_wdt_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct asm9260_wdt_priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c index d4bd41cb801e..13e3b80f61b0 100644 --- a/drivers/watchdog/aspeed_wdt.c +++ b/drivers/watchdog/aspeed_wdt.c @@ -410,7 +410,7 @@ static int aspeed_wdt_probe(struct platform_device *pdev) u32 status; int ret; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c index f966da602011..fea975433890 100644 --- a/drivers/watchdog/at91sam9_wdt.c +++ b/drivers/watchdog/at91sam9_wdt.c @@ -330,7 +330,7 @@ static int at91wdt_probe(struct platform_device *pdev) int err; struct at91wdt *wdt; - wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(&pdev->dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/atcwdt200_wdt.c b/drivers/watchdog/atcwdt200_wdt.c index ceedc3f67632..9bfdece76afd 100644 --- a/drivers/watchdog/atcwdt200_wdt.c +++ b/drivers/watchdog/atcwdt200_wdt.c @@ -492,7 +492,7 @@ static int atcwdt_probe(struct platform_device *pdev) struct atcwdt_drv *drv_data; int ret; - drv_data = devm_kzalloc(dev, sizeof(*drv_data), GFP_KERNEL); + drv_data = devm_kzalloc_obj(dev, *drv_data); if (!drv_data) return -ENOMEM; diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c index 1a0fc66cc093..755954cbadee 100644 --- a/drivers/watchdog/bcm2835_wdt.c +++ b/drivers/watchdog/bcm2835_wdt.c @@ -177,7 +177,7 @@ static int bcm2835_wdt_probe(struct platform_device *pdev) struct bcm2835_wdt *wdt; int err; - wdt = devm_kzalloc(dev, sizeof(struct bcm2835_wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, struct bcm2835_wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/bcm7038_wdt.c b/drivers/watchdog/bcm7038_wdt.c index 1117026cf959..5bac9c330b60 100644 --- a/drivers/watchdog/bcm7038_wdt.c +++ b/drivers/watchdog/bcm7038_wdt.c @@ -136,7 +136,7 @@ static int bcm7038_wdt_probe(struct platform_device *pdev) const char *clk_name = NULL; int err; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c index 66bd0324fd68..d4f031deb254 100644 --- a/drivers/watchdog/bcm_kona_wdt.c +++ b/drivers/watchdog/bcm_kona_wdt.c @@ -271,7 +271,7 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev) struct bcm_kona_wdt *wdt; int ret; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/bd9576_wdt.c b/drivers/watchdog/bd9576_wdt.c index f00ea1b4e40b..f2171d87b166 100644 --- a/drivers/watchdog/bd9576_wdt.c +++ b/drivers/watchdog/bd9576_wdt.c @@ -204,7 +204,7 @@ static int bd9576_wdt_probe(struct platform_device *pdev) int count; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/bd96801_wdt.c b/drivers/watchdog/bd96801_wdt.c index e5a56f53b419..ce93a900b0be 100644 --- a/drivers/watchdog/bd96801_wdt.c +++ b/drivers/watchdog/bd96801_wdt.c @@ -337,7 +337,7 @@ static int bd96801_wdt_probe(struct platform_device *pdev) int ret, irq; unsigned int val; - w = devm_kzalloc(&pdev->dev, sizeof(*w), GFP_KERNEL); + w = devm_kzalloc_obj(&pdev->dev, *w); if (!w) return -ENOMEM; diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c index 55a7c08dc1c1..19e3f3f03cbe 100644 --- a/drivers/watchdog/cadence_wdt.c +++ b/drivers/watchdog/cadence_wdt.c @@ -292,7 +292,7 @@ static int cdns_wdt_probe(struct platform_device *pdev) struct cdns_wdt *wdt; struct watchdog_device *cdns_wdt_device; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/cgbc_wdt.c b/drivers/watchdog/cgbc_wdt.c index a90e6af13bed..f5e895921f3b 100644 --- a/drivers/watchdog/cgbc_wdt.c +++ b/drivers/watchdog/cgbc_wdt.c @@ -171,7 +171,7 @@ static int cgbc_wdt_probe(struct platform_device *pdev) struct cgbc_wdt_data *wdt_data; struct watchdog_device *wdd; - wdt_data = devm_kzalloc(dev, sizeof(*wdt_data), GFP_KERNEL); + wdt_data = devm_kzalloc_obj(dev, *wdt_data); if (!wdt_data) return -ENOMEM; diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c index 13a4d47e68cd..cf79437064a6 100644 --- a/drivers/watchdog/cpwd.c +++ b/drivers/watchdog/cpwd.c @@ -520,7 +520,7 @@ static int cpwd_probe(struct platform_device *op) if (cpwd_device) return -EINVAL; - p = devm_kzalloc(&op->dev, sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(&op->dev, *p); if (!p) return -ENOMEM; diff --git a/drivers/watchdog/cros_ec_wdt.c b/drivers/watchdog/cros_ec_wdt.c index 2283419d8b38..d051a5db3642 100644 --- a/drivers/watchdog/cros_ec_wdt.c +++ b/drivers/watchdog/cros_ec_wdt.c @@ -124,7 +124,7 @@ static int cros_ec_wdt_probe(struct platform_device *pdev) union cros_ec_wdt_data arg; int ret = 0; - wdd = devm_kzalloc(&pdev->dev, sizeof(*wdd), GFP_KERNEL); + wdd = devm_kzalloc_obj(&pdev->dev, *wdd); if (!wdd) return -ENOMEM; diff --git a/drivers/watchdog/da9052_wdt.c b/drivers/watchdog/da9052_wdt.c index 959cba0a8819..f725c24faef9 100644 --- a/drivers/watchdog/da9052_wdt.c +++ b/drivers/watchdog/da9052_wdt.c @@ -173,7 +173,7 @@ static int da9052_wdt_probe(struct platform_device *pdev) struct watchdog_device *da9052_wdt; int ret; - driver_data = devm_kzalloc(dev, sizeof(*driver_data), GFP_KERNEL); + driver_data = devm_kzalloc_obj(dev, *driver_data); if (!driver_data) return -ENOMEM; driver_data->da9052 = da9052; diff --git a/drivers/watchdog/da9055_wdt.c b/drivers/watchdog/da9055_wdt.c index cbb87855bd6a..abbfb19225e4 100644 --- a/drivers/watchdog/da9055_wdt.c +++ b/drivers/watchdog/da9055_wdt.c @@ -126,7 +126,7 @@ static int da9055_wdt_probe(struct platform_device *pdev) struct watchdog_device *da9055_wdt; int ret; - driver_data = devm_kzalloc(dev, sizeof(*driver_data), GFP_KERNEL); + driver_data = devm_kzalloc_obj(dev, *driver_data); if (!driver_data) return -ENOMEM; diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c index 3d7bf2f351db..4bb6f484527e 100644 --- a/drivers/watchdog/da9062_wdt.c +++ b/drivers/watchdog/da9062_wdt.c @@ -211,7 +211,7 @@ static int da9062_wdt_probe(struct platform_device *pdev) if (!chip) return -EINVAL; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c index 3703110e82fc..ca901a755b3a 100644 --- a/drivers/watchdog/da9063_wdt.c +++ b/drivers/watchdog/da9063_wdt.c @@ -225,7 +225,7 @@ static int da9063_wdt_probe(struct platform_device *pdev) if (!da9063) return -EINVAL; - wdd = devm_kzalloc(dev, sizeof(*wdd), GFP_KERNEL); + wdd = devm_kzalloc_obj(dev, *wdd); if (!wdd) return -ENOMEM; diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c index 074e95cf2fe7..8c9bbf179526 100644 --- a/drivers/watchdog/davinci_wdt.c +++ b/drivers/watchdog/davinci_wdt.c @@ -195,7 +195,7 @@ static int davinci_wdt_probe(struct platform_device *pdev) struct watchdog_device *wdd; struct davinci_wdt_device *davinci_wdt; - davinci_wdt = devm_kzalloc(dev, sizeof(*davinci_wdt), GFP_KERNEL); + davinci_wdt = devm_kzalloc_obj(dev, *davinci_wdt); if (!davinci_wdt) return -ENOMEM; diff --git a/drivers/watchdog/digicolor_wdt.c b/drivers/watchdog/digicolor_wdt.c index de1a3267a972..4f8faf7886d8 100644 --- a/drivers/watchdog/digicolor_wdt.c +++ b/drivers/watchdog/digicolor_wdt.c @@ -120,7 +120,7 @@ static int dc_wdt_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct dc_wdt *wdt; - wdt = devm_kzalloc(dev, sizeof(struct dc_wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, struct dc_wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c index c1d40d7b2165..389bcc846ff8 100644 --- a/drivers/watchdog/dw_wdt.c +++ b/drivers/watchdog/dw_wdt.c @@ -521,7 +521,7 @@ static void dw_wdt_dbgfs_init(struct dw_wdt *dw_wdt) struct device *dev = dw_wdt->wdd.parent; struct debugfs_regset32 *regset; - regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL); + regset = devm_kzalloc_obj(dev, *regset); if (!regset) return; @@ -553,7 +553,7 @@ static int dw_wdt_drv_probe(struct platform_device *pdev) struct dw_wdt *dw_wdt; int ret; - dw_wdt = devm_kzalloc(dev, sizeof(*dw_wdt), GFP_KERNEL); + dw_wdt = devm_kzalloc_obj(dev, *dw_wdt); if (!dw_wdt) return -ENOMEM; diff --git a/drivers/watchdog/ebc-c384_wdt.c b/drivers/watchdog/ebc-c384_wdt.c index 39cc1f7e1cdb..c80a28b09de0 100644 --- a/drivers/watchdog/ebc-c384_wdt.c +++ b/drivers/watchdog/ebc-c384_wdt.c @@ -98,7 +98,7 @@ static int ebc_c384_wdt_probe(struct device *dev, unsigned int id) return -EBUSY; } - wdd = devm_kzalloc(dev, sizeof(*wdd), GFP_KERNEL); + wdd = devm_kzalloc_obj(dev, *wdd); if (!wdd) return -ENOMEM; diff --git a/drivers/watchdog/ep93xx_wdt.c b/drivers/watchdog/ep93xx_wdt.c index 59dfd7f6bf0b..36c308b76fa1 100644 --- a/drivers/watchdog/ep93xx_wdt.c +++ b/drivers/watchdog/ep93xx_wdt.c @@ -92,7 +92,7 @@ static int ep93xx_wdt_probe(struct platform_device *pdev) unsigned long val; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c index 2790061a68f3..f61a53e64dcb 100644 --- a/drivers/watchdog/f71808e_wdt.c +++ b/drivers/watchdog/f71808e_wdt.c @@ -459,7 +459,7 @@ static int fintek_wdt_probe(struct platform_device *pdev) sioaddr = res->start; - wd = devm_kzalloc(dev, sizeof(*wd), GFP_KERNEL); + wd = devm_kzalloc_obj(dev, *wd); if (!wd) return -ENOMEM; diff --git a/drivers/watchdog/ftwdt010_wdt.c b/drivers/watchdog/ftwdt010_wdt.c index 67f16b34a25f..66f0768c22a2 100644 --- a/drivers/watchdog/ftwdt010_wdt.c +++ b/drivers/watchdog/ftwdt010_wdt.c @@ -140,7 +140,7 @@ static int ftwdt010_wdt_probe(struct platform_device *pdev) int irq; int ret; - gwdt = devm_kzalloc(dev, sizeof(*gwdt), GFP_KERNEL); + gwdt = devm_kzalloc_obj(dev, *gwdt); if (!gwdt) return -ENOMEM; diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c index 2cd79c8f60dc..ed4298807713 100644 --- a/drivers/watchdog/gpio_wdt.c +++ b/drivers/watchdog/gpio_wdt.c @@ -113,7 +113,7 @@ static int gpio_wdt_probe(struct platform_device *pdev) const char *algo; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/gunyah_wdt.c b/drivers/watchdog/gunyah_wdt.c index 557a78306d18..e3c2a2131624 100644 --- a/drivers/watchdog/gunyah_wdt.c +++ b/drivers/watchdog/gunyah_wdt.c @@ -178,7 +178,7 @@ static int gunyah_wdt_probe(struct platform_device *pdev) if (ret) return dev_err_probe(dev, ret, "status check failed\n"); - wdd = devm_kzalloc(dev, sizeof(*wdd), GFP_KERNEL); + wdd = devm_kzalloc_obj(dev, *wdd); if (!wdd) return -ENOMEM; diff --git a/drivers/watchdog/gxp-wdt.c b/drivers/watchdog/gxp-wdt.c index f2c236160266..173fdaa4f345 100644 --- a/drivers/watchdog/gxp-wdt.c +++ b/drivers/watchdog/gxp-wdt.c @@ -117,7 +117,7 @@ static int gxp_wdt_probe(struct platform_device *pdev) int err; u8 val; - drvdata = devm_kzalloc(dev, sizeof(struct gxp_wdt), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, struct gxp_wdt); if (!drvdata) return -ENOMEM; diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c index 7f08d6d2ca77..c93ea556eb6b 100644 --- a/drivers/watchdog/i6300esb.c +++ b/drivers/watchdog/i6300esb.c @@ -301,7 +301,7 @@ static int esb_probe(struct pci_dev *pdev, struct esb_dev *edev; int ret; - edev = devm_kzalloc(&pdev->dev, sizeof(*edev), GFP_KERNEL); + edev = devm_kzalloc_obj(&pdev->dev, *edev); if (!edev) return -ENOMEM; diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index 0a8bf28f5768..5281d6e15963 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c @@ -462,7 +462,7 @@ static int iTCO_wdt_probe(struct platform_device *pdev) if (!pdata) return -ENODEV; - p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(dev, *p); if (!p) return -ENOMEM; diff --git a/drivers/watchdog/imgpdc_wdt.c b/drivers/watchdog/imgpdc_wdt.c index bb6227c40de4..b409f6784b50 100644 --- a/drivers/watchdog/imgpdc_wdt.c +++ b/drivers/watchdog/imgpdc_wdt.c @@ -183,7 +183,7 @@ static int pdc_wdt_probe(struct platform_device *pdev) unsigned long clk_rate; struct pdc_wdt_dev *pdc_wdt; - pdc_wdt = devm_kzalloc(dev, sizeof(*pdc_wdt), GFP_KERNEL); + pdc_wdt = devm_kzalloc_obj(dev, *pdc_wdt); if (!pdc_wdt) return -ENOMEM; diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c index 58aa5f999f4f..4240732b2c34 100644 --- a/drivers/watchdog/imx2_wdt.c +++ b/drivers/watchdog/imx2_wdt.c @@ -274,7 +274,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev) int ret; u32 val; - wdev = devm_kzalloc(dev, sizeof(*wdev), GFP_KERNEL); + wdev = devm_kzalloc_obj(dev, *wdev); if (!wdev) return -ENOMEM; diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c index f61936194aea..7d675ca07aae 100644 --- a/drivers/watchdog/imx7ulp_wdt.c +++ b/drivers/watchdog/imx7ulp_wdt.c @@ -317,7 +317,7 @@ static int imx7ulp_wdt_probe(struct platform_device *pdev) struct watchdog_device *wdog; int ret; - imx7ulp_wdt = devm_kzalloc(dev, sizeof(*imx7ulp_wdt), GFP_KERNEL); + imx7ulp_wdt = devm_kzalloc_obj(dev, *imx7ulp_wdt); if (!imx7ulp_wdt) return -ENOMEM; diff --git a/drivers/watchdog/imx_sc_wdt.c b/drivers/watchdog/imx_sc_wdt.c index fc39f9db4c06..5da8f02c802f 100644 --- a/drivers/watchdog/imx_sc_wdt.c +++ b/drivers/watchdog/imx_sc_wdt.c @@ -183,7 +183,7 @@ static int imx_sc_wdt_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - imx_sc_wdd = devm_kzalloc(dev, sizeof(*imx_sc_wdd), GFP_KERNEL); + imx_sc_wdd = devm_kzalloc_obj(dev, *imx_sc_wdd); if (!imx_sc_wdd) return -ENOMEM; diff --git a/drivers/watchdog/intel-mid_wdt.c b/drivers/watchdog/intel-mid_wdt.c index b1e1b77ed190..e5afef4a03e7 100644 --- a/drivers/watchdog/intel-mid_wdt.c +++ b/drivers/watchdog/intel-mid_wdt.c @@ -141,7 +141,7 @@ static int mid_wdt_probe(struct platform_device *pdev) return ret; } - mid = devm_kzalloc(dev, sizeof(*mid), GFP_KERNEL); + mid = devm_kzalloc_obj(dev, *mid); if (!mid) return -ENOMEM; diff --git a/drivers/watchdog/intel_oc_wdt.c b/drivers/watchdog/intel_oc_wdt.c index d1e9a3f62369..0b012aeb18e1 100644 --- a/drivers/watchdog/intel_oc_wdt.c +++ b/drivers/watchdog/intel_oc_wdt.c @@ -172,7 +172,7 @@ static int intel_oc_wdt_probe(struct platform_device *pdev) struct watchdog_device *wdd; int ret; - oc_wdt = devm_kzalloc(&pdev->dev, sizeof(*oc_wdt), GFP_KERNEL); + oc_wdt = devm_kzalloc_obj(&pdev->dev, *oc_wdt); if (!oc_wdt) return -ENOMEM; diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c index ec0c08652ec2..29d913b1e8d1 100644 --- a/drivers/watchdog/ixp4xx_wdt.c +++ b/drivers/watchdog/ixp4xx_wdt.c @@ -146,7 +146,7 @@ static int ixp4xx_wdt_probe(struct platform_device *pdev) iwdt_ops = &ixp4xx_wdt_ops; } - iwdt = devm_kzalloc(dev, sizeof(*iwdt), GFP_KERNEL); + iwdt = devm_kzalloc_obj(dev, *iwdt); if (!iwdt) return -ENOMEM; iwdt->base = (void __iomem *)dev->platform_data; diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c index 9dec1b822410..a804875a06dd 100644 --- a/drivers/watchdog/jz4740_wdt.c +++ b/drivers/watchdog/jz4740_wdt.c @@ -143,8 +143,7 @@ static int jz4740_wdt_probe(struct platform_device *pdev) long rate; int ret; - drvdata = devm_kzalloc(dev, sizeof(struct jz4740_wdt_drvdata), - GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, struct jz4740_wdt_drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c index 76246a7714ca..9405ac8508aa 100644 --- a/drivers/watchdog/keembay_wdt.c +++ b/drivers/watchdog/keembay_wdt.c @@ -191,7 +191,7 @@ static int keembay_wdt_probe(struct platform_device *pdev) struct keembay_wdt *wdt; int ret; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c index b4cde48d2b10..2bf4baa18626 100644 --- a/drivers/watchdog/kempld_wdt.c +++ b/drivers/watchdog/kempld_wdt.c @@ -441,7 +441,7 @@ static int kempld_wdt_probe(struct platform_device *pdev) u8 status; int ret = 0; - wdt_data = devm_kzalloc(dev, sizeof(*wdt_data), GFP_KERNEL); + wdt_data = devm_kzalloc_obj(dev, *wdt_data); if (!wdt_data) return -ENOMEM; diff --git a/drivers/watchdog/lantiq_wdt.c b/drivers/watchdog/lantiq_wdt.c index a273b97ebcb4..5ea53c6f2131 100644 --- a/drivers/watchdog/lantiq_wdt.c +++ b/drivers/watchdog/lantiq_wdt.c @@ -207,7 +207,7 @@ static int ltq_wdt_probe(struct platform_device *pdev) int ret; u32 status; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/lenovo_se10_wdt.c b/drivers/watchdog/lenovo_se10_wdt.c index 1eaf86c85cc0..2007c7ee447a 100644 --- a/drivers/watchdog/lenovo_se10_wdt.c +++ b/drivers/watchdog/lenovo_se10_wdt.c @@ -190,7 +190,7 @@ static int se10_wdt_probe(struct platform_device *pdev) dev_info(dev, "Found Lenovo SE10 0x%x\n", chip_id); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/lenovo_se30_wdt.c b/drivers/watchdog/lenovo_se30_wdt.c index 127ea9a1933f..a8da482f4640 100644 --- a/drivers/watchdog/lenovo_se30_wdt.c +++ b/drivers/watchdog/lenovo_se30_wdt.c @@ -264,7 +264,7 @@ static int lenovo_se30_wdt_probe(struct platform_device *pdev) if (base_phys == 0xFFFFFFFF || base_phys == 0) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/lenovo_se30g2_se60_wdt.c b/drivers/watchdog/lenovo_se30g2_se60_wdt.c index c87abdb1a1b2..f79864b28550 100644 --- a/drivers/watchdog/lenovo_se30g2_se60_wdt.c +++ b/drivers/watchdog/lenovo_se30g2_se60_wdt.c @@ -188,7 +188,7 @@ static int se_30g2_60_wdt_probe(struct platform_device *pdev) release_region(CFG_PORT, CFG_SIZE); dev_info(dev, "Found Lenovo SE30G2 SE60 0x%x\n", chip_id); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/loongson1_wdt.c b/drivers/watchdog/loongson1_wdt.c index 7f8de11f1b4a..2811e7eab631 100644 --- a/drivers/watchdog/loongson1_wdt.c +++ b/drivers/watchdog/loongson1_wdt.c @@ -130,7 +130,7 @@ static int ls1x_wdt_probe(struct platform_device *pdev) struct watchdog_device *ls1x_wdt; unsigned long clk_rate; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; platform_set_drvdata(pdev, drvdata); diff --git a/drivers/watchdog/lpc18xx_wdt.c b/drivers/watchdog/lpc18xx_wdt.c index 633119e4b126..fc0fe30a8aa7 100644 --- a/drivers/watchdog/lpc18xx_wdt.c +++ b/drivers/watchdog/lpc18xx_wdt.c @@ -204,7 +204,7 @@ static int lpc18xx_wdt_probe(struct platform_device *pdev) struct lpc18xx_wdt_dev *lpc18xx_wdt; struct device *dev = &pdev->dev; - lpc18xx_wdt = devm_kzalloc(dev, sizeof(*lpc18xx_wdt), GFP_KERNEL); + lpc18xx_wdt = devm_kzalloc_obj(dev, *lpc18xx_wdt); if (!lpc18xx_wdt) return -ENOMEM; diff --git a/drivers/watchdog/ma35d1_wdt.c b/drivers/watchdog/ma35d1_wdt.c index ede4bee594f1..0ca3436be1cc 100644 --- a/drivers/watchdog/ma35d1_wdt.c +++ b/drivers/watchdog/ma35d1_wdt.c @@ -197,7 +197,7 @@ static int ma35d1_wdt_probe(struct platform_device *pdev) unsigned long clk_rate, val; int ret; - ma35d1_wdt = devm_kzalloc(dev, sizeof(*ma35d1_wdt), GFP_KERNEL); + ma35d1_wdt = devm_kzalloc_obj(dev, *ma35d1_wdt); if (!ma35d1_wdt) return -ENOMEM; diff --git a/drivers/watchdog/marvell_gti_wdt.c b/drivers/watchdog/marvell_gti_wdt.c index 31167034963c..03aae675a3d1 100644 --- a/drivers/watchdog/marvell_gti_wdt.c +++ b/drivers/watchdog/marvell_gti_wdt.c @@ -255,7 +255,7 @@ static int gti_wdt_probe(struct platform_device *pdev) int irq; int err; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/max63xx_wdt.c b/drivers/watchdog/max63xx_wdt.c index 17b19dfdad16..9e46b86b9b20 100644 --- a/drivers/watchdog/max63xx_wdt.c +++ b/drivers/watchdog/max63xx_wdt.c @@ -203,7 +203,7 @@ static int max63xx_wdt_probe(struct platform_device *pdev) const struct max63xx_timeout *table; int err; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/max77620_wdt.c b/drivers/watchdog/max77620_wdt.c index 79148cbad4f2..4fc8a858d221 100644 --- a/drivers/watchdog/max77620_wdt.c +++ b/drivers/watchdog/max77620_wdt.c @@ -163,7 +163,7 @@ static int max77620_wdt_probe(struct platform_device *pdev) unsigned int regval; int ret; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/mena21_wdt.c b/drivers/watchdog/mena21_wdt.c index a762462c25c5..775c27ef16ac 100644 --- a/drivers/watchdog/mena21_wdt.c +++ b/drivers/watchdog/mena21_wdt.c @@ -135,7 +135,7 @@ static int a21_wdt_probe(struct platform_device *pdev) int ret; int i; - drv = devm_kzalloc(dev, sizeof(struct a21_wdt_drv), GFP_KERNEL); + drv = devm_kzalloc_obj(dev, struct a21_wdt_drv); if (!drv) return -ENOMEM; diff --git a/drivers/watchdog/menf21bmc_wdt.c b/drivers/watchdog/menf21bmc_wdt.c index bb8eda18fbad..1aa7492abc90 100644 --- a/drivers/watchdog/menf21bmc_wdt.c +++ b/drivers/watchdog/menf21bmc_wdt.c @@ -119,7 +119,7 @@ static int menf21bmc_wdt_probe(struct platform_device *pdev) struct menf21bmc_wdt *drv_data; struct i2c_client *i2c_client = to_i2c_client(dev->parent); - drv_data = devm_kzalloc(dev, sizeof(struct menf21bmc_wdt), GFP_KERNEL); + drv_data = devm_kzalloc_obj(dev, struct menf21bmc_wdt); if (!drv_data) return -ENOMEM; diff --git a/drivers/watchdog/menz69_wdt.c b/drivers/watchdog/menz69_wdt.c index 962c6867bc07..61434604f902 100644 --- a/drivers/watchdog/menz69_wdt.c +++ b/drivers/watchdog/menz69_wdt.c @@ -105,7 +105,7 @@ static int men_z069_probe(struct mcb_device *dev, struct men_z069_drv *drv; struct resource *mem; - drv = devm_kzalloc(&dev->dev, sizeof(struct men_z069_drv), GFP_KERNEL); + drv = devm_kzalloc_obj(&dev->dev, struct men_z069_drv); if (!drv) return -ENOMEM; diff --git a/drivers/watchdog/meson_gxbb_wdt.c b/drivers/watchdog/meson_gxbb_wdt.c index fb276060e831..705f8c02b4ed 100644 --- a/drivers/watchdog/meson_gxbb_wdt.c +++ b/drivers/watchdog/meson_gxbb_wdt.c @@ -166,7 +166,7 @@ static int meson_gxbb_wdt_probe(struct platform_device *pdev) struct wdt_params *params; u32 ctrl_reg; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/watchdog/meson_wdt.c b/drivers/watchdog/meson_wdt.c index 80a4f8771335..b9ad8c0c63ab 100644 --- a/drivers/watchdog/meson_wdt.c +++ b/drivers/watchdog/meson_wdt.c @@ -164,7 +164,7 @@ static int meson_wdt_probe(struct platform_device *pdev) struct meson_wdt_dev *meson_wdt; int err; - meson_wdt = devm_kzalloc(dev, sizeof(*meson_wdt), GFP_KERNEL); + meson_wdt = devm_kzalloc_obj(dev, *meson_wdt); if (!meson_wdt) return -ENOMEM; diff --git a/drivers/watchdog/mlx_wdt.c b/drivers/watchdog/mlx_wdt.c index 5dc69363f06a..04b66a4b0fdb 100644 --- a/drivers/watchdog/mlx_wdt.c +++ b/drivers/watchdog/mlx_wdt.c @@ -287,7 +287,7 @@ static int mlxreg_wdt_probe(struct platform_device *pdev) dev_err(dev, "Failed to get platform data.\n"); return -EINVAL; } - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/moxart_wdt.c b/drivers/watchdog/moxart_wdt.c index 1b68a1917003..3b2682ac1c4d 100644 --- a/drivers/watchdog/moxart_wdt.c +++ b/drivers/watchdog/moxart_wdt.c @@ -93,7 +93,7 @@ static int moxart_wdt_probe(struct platform_device *pdev) unsigned int max_timeout; bool nowayout = WATCHDOG_NOWAYOUT; - moxart_wdt = devm_kzalloc(dev, sizeof(*moxart_wdt), GFP_KERNEL); + moxart_wdt = devm_kzalloc_obj(dev, *moxart_wdt); if (!moxart_wdt) return -ENOMEM; diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c index 0d5a360b5629..96faa525cd53 100644 --- a/drivers/watchdog/mpc8xxx_wdt.c +++ b/drivers/watchdog/mpc8xxx_wdt.c @@ -144,7 +144,7 @@ static int mpc8xxx_wdt_probe(struct platform_device *ofdev) if (!freq || freq == -1) return -EINVAL; - ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + ddata = devm_kzalloc_obj(dev, *ddata); if (!ddata) return -ENOMEM; diff --git a/drivers/watchdog/msc313e_wdt.c b/drivers/watchdog/msc313e_wdt.c index 0a68be7a217b..a88825a17034 100644 --- a/drivers/watchdog/msc313e_wdt.c +++ b/drivers/watchdog/msc313e_wdt.c @@ -126,7 +126,7 @@ static int msc313e_wdt_probe(struct platform_device *pdev) unsigned long rate; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/mt7621_wdt.c b/drivers/watchdog/mt7621_wdt.c index 9e0ebec43c88..212cea97e243 100644 --- a/drivers/watchdog/mt7621_wdt.c +++ b/drivers/watchdog/mt7621_wdt.c @@ -144,7 +144,7 @@ static int mt7621_wdt_probe(struct platform_device *pdev) struct mt7621_wdt_data *drvdata; int err; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c index 1630ab65d593..03d47bf4a94c 100644 --- a/drivers/watchdog/mtk_wdt.c +++ b/drivers/watchdog/mtk_wdt.c @@ -494,7 +494,7 @@ static int mtk_wdt_probe(struct platform_device *pdev) const struct mtk_wdt_data *wdt_data; int err, irq; - mtk_wdt = devm_kzalloc(dev, sizeof(*mtk_wdt), GFP_KERNEL); + mtk_wdt = devm_kzalloc_obj(dev, *mtk_wdt); if (!mtk_wdt) return -ENOMEM; diff --git a/drivers/watchdog/nct6694_wdt.c b/drivers/watchdog/nct6694_wdt.c index 169a6736e9ea..57bcc1299973 100644 --- a/drivers/watchdog/nct6694_wdt.c +++ b/drivers/watchdog/nct6694_wdt.c @@ -250,12 +250,11 @@ static int nct6694_wdt_probe(struct platform_device *pdev) struct watchdog_device *wdev; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; - data->msg = devm_kzalloc(dev, sizeof(union nct6694_wdt_msg), - GFP_KERNEL); + data->msg = devm_kzalloc_obj(dev, union nct6694_wdt_msg); if (!data->msg) return -ENOMEM; diff --git a/drivers/watchdog/ni903x_wdt.c b/drivers/watchdog/ni903x_wdt.c index 68b7c485726b..5dfa51dc3887 100644 --- a/drivers/watchdog/ni903x_wdt.c +++ b/drivers/watchdog/ni903x_wdt.c @@ -192,7 +192,7 @@ static int ni903x_acpi_probe(struct platform_device *pdev) if (!handle) return -ENODEV; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/nic7018_wdt.c b/drivers/watchdog/nic7018_wdt.c index 2b122ba8733a..eef5d178c0a9 100644 --- a/drivers/watchdog/nic7018_wdt.c +++ b/drivers/watchdog/nic7018_wdt.c @@ -174,7 +174,7 @@ static int nic7018_probe(struct platform_device *pdev) struct resource *io_rc; int ret; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c index 51348969bf49..4d8f21287144 100644 --- a/drivers/watchdog/npcm_wdt.c +++ b/drivers/watchdog/npcm_wdt.c @@ -396,7 +396,7 @@ static int npcm_wdt_probe(struct platform_device *pdev) int irq; int ret; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c index d6b1adfe31d1..d89f5593369e 100644 --- a/drivers/watchdog/of_xilinx_wdt.c +++ b/drivers/watchdog/of_xilinx_wdt.c @@ -161,7 +161,7 @@ static int xwdt_probe(struct platform_device *pdev) struct xwdt_device *xdev; struct watchdog_device *xilinx_wdt_wdd; - xdev = devm_kzalloc(dev, sizeof(*xdev), GFP_KERNEL); + xdev = devm_kzalloc_obj(dev, *xdev); if (!xdev) return -ENOMEM; diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 2a6de73e6f0b..669d9ad9cf25 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c @@ -232,7 +232,7 @@ static int omap_wdt_probe(struct platform_device *pdev) struct omap_wdt_dev *wdev; int ret; - wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL); + wdev = devm_kzalloc_obj(&pdev->dev, *wdev); if (!wdev) return -ENOMEM; diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c index 5d56e93f0406..828b4d7bfeb0 100644 --- a/drivers/watchdog/orion_wdt.c +++ b/drivers/watchdog/orion_wdt.c @@ -559,8 +559,7 @@ static int orion_wdt_probe(struct platform_device *pdev) unsigned int wdt_max_duration; /* (seconds) */ int ret, irq; - dev = devm_kzalloc(&pdev->dev, sizeof(struct orion_watchdog), - GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, struct orion_watchdog); if (!dev) return -ENOMEM; diff --git a/drivers/watchdog/pic32-dmt.c b/drivers/watchdog/pic32-dmt.c index 12e3a8f63589..8688b7bf5e3e 100644 --- a/drivers/watchdog/pic32-dmt.c +++ b/drivers/watchdog/pic32-dmt.c @@ -169,7 +169,7 @@ static int pic32_dmt_probe(struct platform_device *pdev) struct pic32_dmt *dmt; struct watchdog_device *wdd = &pic32_dmt_wdd; - dmt = devm_kzalloc(dev, sizeof(*dmt), GFP_KERNEL); + dmt = devm_kzalloc_obj(dev, *dmt); if (!dmt) return -ENOMEM; diff --git a/drivers/watchdog/pic32-wdt.c b/drivers/watchdog/pic32-wdt.c index 2e7186b85194..caa641014ed0 100644 --- a/drivers/watchdog/pic32-wdt.c +++ b/drivers/watchdog/pic32-wdt.c @@ -167,7 +167,7 @@ static int pic32_wdt_drv_probe(struct platform_device *pdev) struct watchdog_device *wdd = &pic32_wdd; struct pic32_wdt *wdt; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/pm8916_wdt.c b/drivers/watchdog/pm8916_wdt.c index a7ae57fb2453..16778c67d429 100644 --- a/drivers/watchdog/pm8916_wdt.c +++ b/drivers/watchdog/pm8916_wdt.c @@ -146,7 +146,7 @@ static int pm8916_wdt_probe(struct platform_device *pdev) int err, irq; u8 poff[2]; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/pseries-wdt.c b/drivers/watchdog/pseries-wdt.c index 5f531a03a0fc..4f8325b5021a 100644 --- a/drivers/watchdog/pseries-wdt.c +++ b/drivers/watchdog/pseries-wdt.c @@ -106,7 +106,7 @@ static int pseries_wdt_probe(struct platform_device *pdev) return -EIO; cap = ret[0]; - pw = devm_kzalloc(&pdev->dev, sizeof(*pw), GFP_KERNEL); + pw = devm_kzalloc_obj(&pdev->dev, *pw); if (!pw) return -ENOMEM; diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c index 4eb1bf979012..289e79d8943e 100644 --- a/drivers/watchdog/qcom-wdt.c +++ b/drivers/watchdog/qcom-wdt.c @@ -263,7 +263,7 @@ static int qcom_wdt_probe(struct platform_device *pdev) return -ENODEV; } - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/rave-sp-wdt.c b/drivers/watchdog/rave-sp-wdt.c index 5d1c2176d445..f06926460cbc 100644 --- a/drivers/watchdog/rave-sp-wdt.c +++ b/drivers/watchdog/rave-sp-wdt.c @@ -259,7 +259,7 @@ static int rave_sp_wdt_probe(struct platform_device *pdev) __le16 timeout = 0; int ret; - sp_wd = devm_kzalloc(dev, sizeof(*sp_wd), GFP_KERNEL); + sp_wd = devm_kzalloc_obj(dev, *sp_wd); if (!sp_wd) return -ENOMEM; diff --git a/drivers/watchdog/realtek_otto_wdt.c b/drivers/watchdog/realtek_otto_wdt.c index 35d34834ce04..462e8d0f4368 100644 --- a/drivers/watchdog/realtek_otto_wdt.c +++ b/drivers/watchdog/realtek_otto_wdt.c @@ -281,7 +281,7 @@ static int otto_wdt_probe(struct platform_device *pdev) void __iomem *base; int ret; - ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(dev, *ctrl); if (!ctrl) return -ENOMEM; diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c index 8c0041ce5552..d9760f2a3b23 100644 --- a/drivers/watchdog/renesas_wdt.c +++ b/drivers/watchdog/renesas_wdt.c @@ -221,7 +221,7 @@ static int rwdt_probe(struct platform_device *pdev) if (rwdt_blacklisted(dev)) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/renesas_wwdt.c b/drivers/watchdog/renesas_wwdt.c index b250913c349a..6204300e7785 100644 --- a/drivers/watchdog/renesas_wwdt.c +++ b/drivers/watchdog/renesas_wwdt.c @@ -80,7 +80,7 @@ static int wwdt_probe(struct platform_device *pdev) int ret; u8 val; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/retu_wdt.c b/drivers/watchdog/retu_wdt.c index 2b9017e1cd91..ea682e0abadc 100644 --- a/drivers/watchdog/retu_wdt.c +++ b/drivers/watchdog/retu_wdt.c @@ -107,11 +107,11 @@ static int retu_wdt_probe(struct platform_device *pdev) struct retu_wdt_dev *wdev; int ret; - retu_wdt = devm_kzalloc(&pdev->dev, sizeof(*retu_wdt), GFP_KERNEL); + retu_wdt = devm_kzalloc_obj(&pdev->dev, *retu_wdt); if (!retu_wdt) return -ENOMEM; - wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL); + wdev = devm_kzalloc_obj(&pdev->dev, *wdev); if (!wdev) return -ENOMEM; diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c index 83806ccf06d1..153a7b3f104a 100644 --- a/drivers/watchdog/riowd.c +++ b/drivers/watchdog/riowd.c @@ -182,7 +182,7 @@ static int riowd_probe(struct platform_device *op) goto out; err = -ENOMEM; - p = devm_kzalloc(&op->dev, sizeof(*p), GFP_KERNEL); + p = devm_kzalloc_obj(&op->dev, *p); if (!p) goto out; diff --git a/drivers/watchdog/rn5t618_wdt.c b/drivers/watchdog/rn5t618_wdt.c index 14056af36445..a0dcbf185c42 100644 --- a/drivers/watchdog/rn5t618_wdt.c +++ b/drivers/watchdog/rn5t618_wdt.c @@ -148,7 +148,7 @@ static int rn5t618_wdt_probe(struct platform_device *pdev) int ret; unsigned int val; - wdt = devm_kzalloc(dev, sizeof(struct rn5t618_wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, struct rn5t618_wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/rt2880_wdt.c b/drivers/watchdog/rt2880_wdt.c index 38f31d302a4b..4e3c22480646 100644 --- a/drivers/watchdog/rt2880_wdt.c +++ b/drivers/watchdog/rt2880_wdt.c @@ -144,7 +144,7 @@ static int rt288x_wdt_probe(struct platform_device *pdev) struct rt2880_wdt_data *drvdata; int ret; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return -ENOMEM; diff --git a/drivers/watchdog/rtd119x_wdt.c b/drivers/watchdog/rtd119x_wdt.c index 0bfadb58917b..4e0fd7d6f2a3 100644 --- a/drivers/watchdog/rtd119x_wdt.c +++ b/drivers/watchdog/rtd119x_wdt.c @@ -100,7 +100,7 @@ static int rtd119x_wdt_probe(struct platform_device *pdev) struct rtd119x_watchdog_device *data; unsigned long rate; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c index 6a64adbe1a8e..135367dbfd4b 100644 --- a/drivers/watchdog/rti_wdt.c +++ b/drivers/watchdog/rti_wdt.c @@ -233,7 +233,7 @@ static int rti_wdt_probe(struct platform_device *pdev) u32 *vaddr; u64 paddr; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/rza_wdt.c b/drivers/watchdog/rza_wdt.c index 9334255a37e9..a0cfd3b39c2e 100644 --- a/drivers/watchdog/rza_wdt.c +++ b/drivers/watchdog/rza_wdt.c @@ -170,7 +170,7 @@ static int rza_wdt_probe(struct platform_device *pdev) struct rza_wdt *priv; unsigned long rate; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c index 592ea7ce6d69..c224aee87502 100644 --- a/drivers/watchdog/rzg2l_wdt.c +++ b/drivers/watchdog/rzg2l_wdt.c @@ -254,7 +254,7 @@ static int rzg2l_wdt_probe(struct platform_device *pdev) unsigned long pclk_rate; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/rzn1_wdt.c b/drivers/watchdog/rzn1_wdt.c index 4fdc5363ba98..6cab69862805 100644 --- a/drivers/watchdog/rzn1_wdt.c +++ b/drivers/watchdog/rzn1_wdt.c @@ -98,7 +98,7 @@ static int rzn1_wdt_probe(struct platform_device *pdev) struct clk *clk; int ret; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c index a8db85e85c73..4353fa677778 100644 --- a/drivers/watchdog/rzv2h_wdt.c +++ b/drivers/watchdog/rzv2h_wdt.c @@ -282,7 +282,7 @@ static int rzv2h_wdt_probe(struct platform_device *pdev) unsigned long rate; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/s32g_wdt.c b/drivers/watchdog/s32g_wdt.c index bd8740153c17..8f491de71d5d 100644 --- a/drivers/watchdog/s32g_wdt.c +++ b/drivers/watchdog/s32g_wdt.c @@ -220,7 +220,7 @@ static int s32g_wdt_probe(struct platform_device *pdev) struct watchdog_device *wdog; int ret; - wdev = devm_kzalloc(dev, sizeof(*wdev), GFP_KERNEL); + wdev = devm_kzalloc_obj(dev, *wdev); if (!wdev) return -ENOMEM; diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 7053963fb0ac..d11cf2382bd9 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -773,7 +773,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev) int wdt_irq; int ret; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c index 85efe4db40f0..5d6a2d5512b3 100644 --- a/drivers/watchdog/sama5d4_wdt.c +++ b/drivers/watchdog/sama5d4_wdt.c @@ -249,7 +249,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev) u32 reg; int ret; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c index 3a5ff48a58f2..c6957184fe14 100644 --- a/drivers/watchdog/sbsa_gwdt.c +++ b/drivers/watchdog/sbsa_gwdt.c @@ -304,7 +304,7 @@ static int sbsa_gwdt_probe(struct platform_device *pdev) u32 status; bool early_action; - gwdt = devm_kzalloc(dev, sizeof(*gwdt), GFP_KERNEL); + gwdt = devm_kzalloc_obj(dev, *gwdt); if (!gwdt) return -ENOMEM; platform_set_drvdata(pdev, gwdt); diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c index 8adecf54b9bc..cb04b948063c 100644 --- a/drivers/watchdog/shwdt.c +++ b/drivers/watchdog/shwdt.c @@ -226,7 +226,7 @@ static int sh_wdt_probe(struct platform_device *pdev) if (pdev->id != -1) return -EINVAL; - wdt = devm_kzalloc(&pdev->dev, sizeof(struct sh_wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(&pdev->dev, struct sh_wdt); if (unlikely(!wdt)) return -ENOMEM; diff --git a/drivers/watchdog/sl28cpld_wdt.c b/drivers/watchdog/sl28cpld_wdt.c index e32b757372eb..ce8d942a8459 100644 --- a/drivers/watchdog/sl28cpld_wdt.c +++ b/drivers/watchdog/sl28cpld_wdt.c @@ -128,7 +128,7 @@ static int sl28cpld_wdt_probe(struct platform_device *pdev) if (!pdev->dev.parent) return -ENODEV; - wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(&pdev->dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c index 14d4bffface4..4c8c73cae2bd 100644 --- a/drivers/watchdog/sp5100_tco.c +++ b/drivers/watchdog/sp5100_tco.c @@ -575,7 +575,7 @@ static int sp5100_tco_probe(struct platform_device *pdev) struct sp5100_tco *tco; int ret; - tco = devm_kzalloc(dev, sizeof(*tco), GFP_KERNEL); + tco = devm_kzalloc_obj(dev, *tco); if (!tco) return -ENOMEM; diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c index 925f12157181..a14ff7ac0db4 100644 --- a/drivers/watchdog/sp805_wdt.c +++ b/drivers/watchdog/sp805_wdt.c @@ -236,7 +236,7 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id) u64 rate = 0; int ret = 0; - wdt = devm_kzalloc(&adev->dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(&adev->dev, *wdt); if (!wdt) { ret = -ENOMEM; goto err; diff --git a/drivers/watchdog/sprd_wdt.c b/drivers/watchdog/sprd_wdt.c index 616b4d7f21d7..913900bd05f5 100644 --- a/drivers/watchdog/sprd_wdt.c +++ b/drivers/watchdog/sprd_wdt.c @@ -267,7 +267,7 @@ static int sprd_wdt_probe(struct platform_device *pdev) struct sprd_wdt *wdt; int ret; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/st_lpc_wdt.c b/drivers/watchdog/st_lpc_wdt.c index d206452072ae..6d13a9c67550 100644 --- a/drivers/watchdog/st_lpc_wdt.c +++ b/drivers/watchdog/st_lpc_wdt.c @@ -167,7 +167,7 @@ static int st_wdog_probe(struct platform_device *pdev) if (mode != ST_LPC_MODE_WDT) return -ENODEV; - st_wdog = devm_kzalloc(dev, sizeof(*st_wdog), GFP_KERNEL); + st_wdog = devm_kzalloc_obj(dev, *st_wdog); if (!st_wdog) return -ENOMEM; diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c index 044b4fdb7350..60d93e651b01 100644 --- a/drivers/watchdog/starfive-wdt.c +++ b/drivers/watchdog/starfive-wdt.c @@ -431,7 +431,7 @@ static int starfive_wdt_probe(struct platform_device *pdev) struct starfive_wdt *wdt; int ret; - wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(&pdev->dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c index a8d2db2d3cf8..8a6f0b78a2b0 100644 --- a/drivers/watchdog/stm32_iwdg.c +++ b/drivers/watchdog/stm32_iwdg.c @@ -319,7 +319,7 @@ static int stm32_iwdg_probe(struct platform_device *pdev) struct stm32_iwdg *wdt; int ret; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/stpmic1_wdt.c b/drivers/watchdog/stpmic1_wdt.c index 17f0cdecd22c..d68cac4befa8 100644 --- a/drivers/watchdog/stpmic1_wdt.c +++ b/drivers/watchdog/stpmic1_wdt.c @@ -94,7 +94,7 @@ static int pmic_wdt_probe(struct platform_device *pdev) if (!pmic) return -EINVAL; - wdt = devm_kzalloc(dev, sizeof(struct stpmic1_wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, struct stpmic1_wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/sunplus_wdt.c b/drivers/watchdog/sunplus_wdt.c index f2e45907d882..158a0c4a258e 100644 --- a/drivers/watchdog/sunplus_wdt.c +++ b/drivers/watchdog/sunplus_wdt.c @@ -147,7 +147,7 @@ static int sp_wdt_probe(struct platform_device *pdev) struct sp_wdt_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/sunxi_wdt.c b/drivers/watchdog/sunxi_wdt.c index 1e55c5fd43b8..a6500ebf24ba 100644 --- a/drivers/watchdog/sunxi_wdt.c +++ b/drivers/watchdog/sunxi_wdt.c @@ -295,7 +295,7 @@ static int sunxi_wdt_probe(struct platform_device *pdev) unsigned int running_timeout; int err; - sunxi_wdt = devm_kzalloc(dev, sizeof(*sunxi_wdt), GFP_KERNEL); + sunxi_wdt = devm_kzalloc_obj(dev, *sunxi_wdt); if (!sunxi_wdt) return -ENOMEM; diff --git a/drivers/watchdog/tegra_wdt.c b/drivers/watchdog/tegra_wdt.c index 6b3f65c4d593..4bf673d94660 100644 --- a/drivers/watchdog/tegra_wdt.c +++ b/drivers/watchdog/tegra_wdt.c @@ -197,7 +197,7 @@ static int tegra_wdt_probe(struct platform_device *pdev) * Allocate our watchdog driver data, which has the * struct watchdog_device nested within it. */ - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/tqmx86_wdt.c b/drivers/watchdog/tqmx86_wdt.c index 1da45a3f8cf3..e285d8e1cc5d 100644 --- a/drivers/watchdog/tqmx86_wdt.c +++ b/drivers/watchdog/tqmx86_wdt.c @@ -76,7 +76,7 @@ static int tqmx86_wdt_probe(struct platform_device *pdev) struct resource *res; int err; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/ts4800_wdt.c b/drivers/watchdog/ts4800_wdt.c index 1bfc8db323c6..6e5eccfc58e6 100644 --- a/drivers/watchdog/ts4800_wdt.c +++ b/drivers/watchdog/ts4800_wdt.c @@ -129,7 +129,7 @@ static int ts4800_wdt_probe(struct platform_device *pdev) } /* allocate memory for watchdog struct */ - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) { of_node_put(syscon_np); return -ENOMEM; diff --git a/drivers/watchdog/ts72xx_wdt.c b/drivers/watchdog/ts72xx_wdt.c index ede46a442b94..d6b2d61000eb 100644 --- a/drivers/watchdog/ts72xx_wdt.c +++ b/drivers/watchdog/ts72xx_wdt.c @@ -125,7 +125,7 @@ static int ts72xx_wdt_probe(struct platform_device *pdev) struct watchdog_device *wdd; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/twl4030_wdt.c b/drivers/watchdog/twl4030_wdt.c index d5e06dcf74d9..377ac2a55f7d 100644 --- a/drivers/watchdog/twl4030_wdt.c +++ b/drivers/watchdog/twl4030_wdt.c @@ -61,7 +61,7 @@ static int twl4030_wdt_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct watchdog_device *wdt; - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc_obj(dev, *wdt); if (!wdt) return -ENOMEM; diff --git a/drivers/watchdog/uniphier_wdt.c b/drivers/watchdog/uniphier_wdt.c index d09fb2acfdde..3155dc0cc894 100644 --- a/drivers/watchdog/uniphier_wdt.c +++ b/drivers/watchdog/uniphier_wdt.c @@ -188,7 +188,7 @@ static int uniphier_wdt_probe(struct platform_device *pdev) struct device_node *parent; int ret; - wdev = devm_kzalloc(dev, sizeof(*wdev), GFP_KERNEL); + wdev = devm_kzalloc_obj(dev, *wdev); if (!wdev) return -ENOMEM; diff --git a/drivers/watchdog/visconti_wdt.c b/drivers/watchdog/visconti_wdt.c index fc4f0d4d3d55..3a3b5a5afce4 100644 --- a/drivers/watchdog/visconti_wdt.c +++ b/drivers/watchdog/visconti_wdt.c @@ -121,7 +121,7 @@ static int visconti_wdt_probe(struct platform_device *pdev) struct clk *clk; unsigned long clk_freq; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c index a418da46bda2..acf05cfb1bb6 100644 --- a/drivers/watchdog/wdat_wdt.c +++ b/drivers/watchdog/wdat_wdt.c @@ -351,14 +351,13 @@ static int wdat_wdt_probe(struct platform_device *pdev) if (ACPI_FAILURE(status)) return -ENODEV; - wdat = devm_kzalloc(dev, sizeof(*wdat), GFP_KERNEL); + wdat = devm_kzalloc_obj(dev, *wdat); if (!wdat) { ret = -ENOMEM; goto out_put_table; } - regs = devm_kcalloc(dev, pdev->num_resources, sizeof(*regs), - GFP_KERNEL); + regs = devm_kzalloc_objs(dev, *regs, pdev->num_resources); if (!regs) { ret = -ENOMEM; goto out_put_table; @@ -423,7 +422,7 @@ static int wdat_wdt_probe(struct platform_device *pdev) continue; } - instr = devm_kzalloc(dev, sizeof(*instr), GFP_KERNEL); + instr = devm_kzalloc_obj(dev, *instr); if (!instr) { ret = -ENOMEM; goto out_put_table; @@ -464,9 +463,7 @@ static int wdat_wdt_probe(struct platform_device *pdev) instructions = wdat->instructions[action]; if (!instructions) { - instructions = devm_kzalloc(dev, - sizeof(*instructions), - GFP_KERNEL); + instructions = devm_kzalloc_obj(dev, *instructions); if (!instructions) { ret = -ENOMEM; goto out_put_table; diff --git a/drivers/watchdog/wm831x_wdt.c b/drivers/watchdog/wm831x_wdt.c index 1aeb532dfeba..7d9272ea9a65 100644 --- a/drivers/watchdog/wm831x_wdt.c +++ b/drivers/watchdog/wm831x_wdt.c @@ -190,7 +190,7 @@ static int wm831x_wdt_probe(struct platform_device *pdev) if (reg & WM831X_WDOG_DEBUG) dev_warn(wm831x->dev, "Watchdog is paused\n"); - driver_data = devm_kzalloc(dev, sizeof(*driver_data), GFP_KERNEL); + driver_data = devm_kzalloc_obj(dev, *driver_data); if (!driver_data) return -ENOMEM; diff --git a/drivers/watchdog/xilinx_wwdt.c b/drivers/watchdog/xilinx_wwdt.c index b7cdf8140666..afdce49c08c3 100644 --- a/drivers/watchdog/xilinx_wwdt.c +++ b/drivers/watchdog/xilinx_wwdt.c @@ -144,7 +144,7 @@ static int xwwdt_probe(struct platform_device *pdev) u64 ms_count; int ret; - xdev = devm_kzalloc(dev, sizeof(*xdev), GFP_KERNEL); + xdev = devm_kzalloc_obj(dev, *xdev); if (!xdev) return -ENOMEM; diff --git a/drivers/watchdog/ziirave_wdt.c b/drivers/watchdog/ziirave_wdt.c index 10d4eaa8592a..9166d15cc8c4 100644 --- a/drivers/watchdog/ziirave_wdt.c +++ b/drivers/watchdog/ziirave_wdt.c @@ -609,7 +609,7 @@ static int ziirave_wdt_probe(struct i2c_client *client) I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)) return -ENODEV; - w_priv = devm_kzalloc(&client->dev, sizeof(*w_priv), GFP_KERNEL); + w_priv = devm_kzalloc_obj(&client->dev, *w_priv); if (!w_priv) return -ENOMEM; diff --git a/drivers/xen/grant-dma-iommu.c b/drivers/xen/grant-dma-iommu.c index 0965e2dd4edf..bfab770bcdc8 100644 --- a/drivers/xen/grant-dma-iommu.c +++ b/drivers/xen/grant-dma-iommu.c @@ -36,7 +36,7 @@ static int grant_dma_iommu_probe(struct platform_device *pdev) struct grant_dma_iommu_device *mmu; int ret; - mmu = devm_kzalloc(&pdev->dev, sizeof(*mmu), GFP_KERNEL); + mmu = devm_kzalloc_obj(&pdev->dev, *mmu); if (!mmu) return -ENOMEM; diff --git a/drivers/xen/grant-dma-ops.c b/drivers/xen/grant-dma-ops.c index 2aa1a772a0ff..5fcafa4c344f 100644 --- a/drivers/xen/grant-dma-ops.c +++ b/drivers/xen/grant-dma-ops.c @@ -385,7 +385,7 @@ static void xen_grant_setup_dma_ops(struct device *dev, domid_t backend_domid) return; } - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) goto err; diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 170feb75317f..32bf549e0adc 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -1362,7 +1362,7 @@ void debugfs_create_devm_seqfile(struct device *dev, const char *name, if (IS_ERR(parent)) return; - entry = devm_kzalloc(dev, sizeof(*entry), GFP_KERNEL); + entry = devm_kzalloc_obj(dev, *entry); if (!entry) return; diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index ba8d79c4bcac..e44539832a5c 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -1135,7 +1135,7 @@ static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs) dev_notice(&vdev->dev, "Cache len: 0x%llx @ 0x%llx\n", cache_reg.len, cache_reg.addr); - pgmap = devm_kzalloc(&vdev->dev, sizeof(*pgmap), GFP_KERNEL); + pgmap = devm_kzalloc_obj(&vdev->dev, *pgmap); if (!pgmap) return -ENOMEM; diff --git a/include/drm/drm_kunit_helpers.h b/include/drm/drm_kunit_helpers.h index e653bc7b1e40..97d35818f2ce 100644 --- a/include/drm/drm_kunit_helpers.h +++ b/include/drm/drm_kunit_helpers.h @@ -60,7 +60,7 @@ __drm_kunit_helper_alloc_drm_device(struct kunit *test, { struct drm_driver *driver; - driver = devm_kzalloc(dev, sizeof(*driver), GFP_KERNEL); + driver = devm_kzalloc_obj(dev, *driver); KUNIT_ASSERT_NOT_NULL(test, driver); driver->driver_features = features; diff --git a/include/sound/cs35l56.h b/include/sound/cs35l56.h index ce6383c2c60c..e1b098d1d146 100644 --- a/include/sound/cs35l56.h +++ b/include/sound/cs35l56.h @@ -386,9 +386,9 @@ static inline bool cs35l56_is_otp_register(unsigned int reg) static inline int cs35l56_init_config_for_spi(struct cs35l56_base *cs35l56, struct spi_device *spi) { - cs35l56->spi_payload_buf = devm_kzalloc(&spi->dev, - sizeof(*cs35l56->spi_payload_buf), - GFP_KERNEL | GFP_DMA); + cs35l56->spi_payload_buf = devm_kzalloc_obj(&spi->dev, + *cs35l56->spi_payload_buf, + GFP_KERNEL | GFP_DMA); if (!cs35l56->spi_payload_buf) return -ENOMEM; diff --git a/kernel/dma/map_benchmark.c b/kernel/dma/map_benchmark.c index 957707158ff6..04ec87c27de8 100644 --- a/kernel/dma/map_benchmark.c +++ b/kernel/dma/map_benchmark.c @@ -500,7 +500,7 @@ static int __map_benchmark_probe(struct device *dev) struct map_benchmark_data *map; int ret; - map = devm_kzalloc(dev, sizeof(*map), GFP_KERNEL); + map = devm_kzalloc_obj(dev, *map); if (!map) return -ENOMEM; map->dev = dev; diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c index b41188698622..1295e27a9bef 100644 --- a/kernel/irq/devres.c +++ b/kernel/irq/devres.c @@ -268,7 +268,7 @@ devm_irq_alloc_generic_chip(struct device *dev, const char *name, int num_ct, { struct irq_chip_generic *gc; - gc = devm_kzalloc(dev, struct_size(gc, chip_types, num_ct), GFP_KERNEL); + gc = devm_kzalloc_flex(dev, *gc, chip_types, num_ct); if (gc) irq_init_generic_chip(gc, name, num_ct, irq_base, reg_base, handler); diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c index d19a65461ae8..23bc3e798a93 100644 --- a/kernel/power/energy_model.c +++ b/kernel/power/energy_model.c @@ -156,8 +156,7 @@ static void em_debug_create_pd(struct device *dev) debugfs_create_file("id", 0444, d, dev->em_pd, &em_debug_id_fops); - em_dbg = devm_kcalloc(dev, dev->em_pd->nr_perf_states, - sizeof(*em_dbg), GFP_KERNEL); + em_dbg = devm_kzalloc_objs(dev, *em_dbg, dev->em_pd->nr_perf_states); if (!em_dbg) return; diff --git a/net/bluetooth/leds.c b/net/bluetooth/leds.c index 6e349704efe4..072240d08853 100644 --- a/net/bluetooth/leds.c +++ b/net/bluetooth/leds.c @@ -59,7 +59,7 @@ static struct led_trigger *led_allocate_basic(struct hci_dev *hdev, { struct hci_basic_led_trigger *htrig; - htrig = devm_kzalloc(&hdev->dev, sizeof(*htrig), GFP_KERNEL); + htrig = devm_kzalloc_obj(&hdev->dev, *htrig); if (!htrig) return NULL; diff --git a/net/dsa/conduit.c b/net/dsa/conduit.c index 8398d72d7e4d..1470885d5a5e 100644 --- a/net/dsa/conduit.c +++ b/net/dsa/conduit.c @@ -289,7 +289,7 @@ static int dsa_conduit_ethtool_setup(struct net_device *dev) if (netif_is_lag_master(dev)) return 0; - ops = devm_kzalloc(ds->dev, sizeof(*ops), GFP_KERNEL); + ops = devm_kzalloc_obj(ds->dev, *ops); if (!ops) return -ENOMEM; diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c index b0ab4f5acbce..02024c94237f 100644 --- a/net/nfc/nci/rsp.c +++ b/net/nfc/nci/rsp.c @@ -230,9 +230,8 @@ static void nci_rf_disc_rsp_packet(struct nci_dev *ndev, conn_info = ndev->rf_conn_info; if (!conn_info) { - conn_info = devm_kzalloc(&ndev->nfc_dev->dev, - sizeof(struct nci_conn_info), - GFP_KERNEL); + conn_info = devm_kzalloc_obj(&ndev->nfc_dev->dev, + struct nci_conn_info); if (!conn_info) { status = NCI_STATUS_REJECTED; goto exit; @@ -314,16 +313,14 @@ static void nci_core_conn_create_rsp_packet(struct nci_dev *ndev, if (status == NCI_STATUS_OK) { rsp = (struct nci_core_conn_create_rsp *)skb->data; - conn_info = devm_kzalloc(&ndev->nfc_dev->dev, - sizeof(*conn_info), GFP_KERNEL); + conn_info = devm_kzalloc_obj(&ndev->nfc_dev->dev, *conn_info); if (!conn_info) { status = NCI_STATUS_REJECTED; goto exit; } - conn_info->dest_params = devm_kzalloc(&ndev->nfc_dev->dev, - sizeof(struct dest_spec_params), - GFP_KERNEL); + conn_info->dest_params = devm_kzalloc_obj(&ndev->nfc_dev->dev, + struct dest_spec_params); if (!conn_info->dest_params) { status = NCI_STATUS_REJECTED; goto free_conn_info; diff --git a/net/nfc/nci/spi.c b/net/nfc/nci/spi.c index 6a93533c480e..b9c4120590f7 100644 --- a/net/nfc/nci/spi.c +++ b/net/nfc/nci/spi.c @@ -127,7 +127,7 @@ struct nci_spi *nci_spi_allocate_spi(struct spi_device *spi, { struct nci_spi *nspi; - nspi = devm_kzalloc(&spi->dev, sizeof(struct nci_spi), GFP_KERNEL); + nspi = devm_kzalloc_obj(&spi->dev, struct nci_spi); if (!nspi) return NULL; diff --git a/net/qrtr/mhi.c b/net/qrtr/mhi.c index e9a4bb92ce76..1040c3c8cfd6 100644 --- a/net/qrtr/mhi.c +++ b/net/qrtr/mhi.c @@ -112,7 +112,7 @@ static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev, struct qrtr_mhi_dev *qdev; int rc; - qdev = devm_kzalloc(&mhi_dev->dev, sizeof(*qdev), GFP_KERNEL); + qdev = devm_kzalloc_obj(&mhi_dev->dev, *qdev); if (!qdev) return -ENOMEM; diff --git a/net/qrtr/smd.c b/net/qrtr/smd.c index c91bf030fbc7..8b30b8275a2d 100644 --- a/net/qrtr/smd.c +++ b/net/qrtr/smd.c @@ -61,7 +61,7 @@ static int qcom_smd_qrtr_probe(struct rpmsg_device *rpdev) struct qrtr_smd_dev *qdev; int rc; - qdev = devm_kzalloc(&rpdev->dev, sizeof(*qdev), GFP_KERNEL); + qdev = devm_kzalloc_obj(&rpdev->dev, *qdev); if (!qdev) return -ENOMEM; diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index 9c5b695dba7c..20cb432dfb85 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c @@ -102,7 +102,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev) if (dmi_check_system(rfkill_gpio_deny_table)) return -ENODEV; - rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL); + rfkill = devm_kzalloc_obj(&pdev->dev, *rfkill); if (!rfkill) return -ENOMEM; diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index cc9c325df910..8f8bcbcdc879 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c @@ -746,7 +746,7 @@ static int snd_uart16550_create(struct snd_card *card, int err; - uart = devm_kzalloc(card->dev, sizeof(*uart), GFP_KERNEL); + uart = devm_kzalloc_obj(card->dev, *uart); if (!uart) return -ENOMEM; uart->adaptor = adaptor; diff --git a/sound/firewire/bebob/bebob_maudio.c b/sound/firewire/bebob/bebob_maudio.c index 8079a938a69b..4ca5e0421438 100644 --- a/sound/firewire/bebob/bebob_maudio.c +++ b/sound/firewire/bebob/bebob_maudio.c @@ -260,8 +260,7 @@ snd_bebob_maudio_special_discover(struct snd_bebob *bebob, bool is1814) struct special_params *params; int err; - params = devm_kzalloc(&bebob->card->card_dev, - sizeof(struct special_params), GFP_KERNEL); + params = devm_kzalloc_obj(&bebob->card->card_dev, struct special_params); if (!params) return -ENOMEM; diff --git a/sound/firewire/motu/motu-command-dsp-message-parser.c b/sound/firewire/motu/motu-command-dsp-message-parser.c index c6440e6e360b..8caeb1019dfc 100644 --- a/sound/firewire/motu/motu-command-dsp-message-parser.c +++ b/sound/firewire/motu/motu-command-dsp-message-parser.c @@ -37,7 +37,7 @@ int snd_motu_command_dsp_message_parser_new(struct snd_motu *motu) { struct msg_parser *parser; - parser = devm_kzalloc(&motu->card->card_dev, sizeof(*parser), GFP_KERNEL); + parser = devm_kzalloc_obj(&motu->card->card_dev, *parser); if (!parser) return -ENOMEM; spin_lock_init(&parser->lock); diff --git a/sound/firewire/motu/motu-register-dsp-message-parser.c b/sound/firewire/motu/motu-register-dsp-message-parser.c index 4ec23e6880d9..3541d540b8c9 100644 --- a/sound/firewire/motu/motu-register-dsp-message-parser.c +++ b/sound/firewire/motu/motu-register-dsp-message-parser.c @@ -101,7 +101,7 @@ struct msg_parser { int snd_motu_register_dsp_message_parser_new(struct snd_motu *motu) { struct msg_parser *parser; - parser = devm_kzalloc(&motu->card->card_dev, sizeof(*parser), GFP_KERNEL); + parser = devm_kzalloc_obj(&motu->card->card_dev, *parser); if (!parser) return -ENOMEM; spin_lock_init(&parser->lock); diff --git a/sound/firewire/oxfw/oxfw-scs1x.c b/sound/firewire/oxfw/oxfw-scs1x.c index 21412a3ca9f4..9a6e572af4fc 100644 --- a/sound/firewire/oxfw/oxfw-scs1x.c +++ b/sound/firewire/oxfw/oxfw-scs1x.c @@ -371,8 +371,7 @@ int snd_oxfw_scs1x_add(struct snd_oxfw *oxfw) struct fw_scs1x *scs; int err; - scs = devm_kzalloc(&oxfw->card->card_dev, sizeof(struct fw_scs1x), - GFP_KERNEL); + scs = devm_kzalloc_obj(&oxfw->card->card_dev, struct fw_scs1x); if (!scs) return -ENOMEM; scs->fw_dev = fw_parent_device(oxfw->unit); diff --git a/sound/firewire/oxfw/oxfw-spkr.c b/sound/firewire/oxfw/oxfw-spkr.c index f2767fb1965c..1bf19310f3a0 100644 --- a/sound/firewire/oxfw/oxfw-spkr.c +++ b/sound/firewire/oxfw/oxfw-spkr.c @@ -270,8 +270,7 @@ int snd_oxfw_add_spkr(struct snd_oxfw *oxfw, bool is_lacie) unsigned int i, first_ch; int err; - spkr = devm_kzalloc(&oxfw->card->card_dev, sizeof(struct fw_spkr), - GFP_KERNEL); + spkr = devm_kzalloc_obj(&oxfw->card->card_dev, struct fw_spkr); if (!spkr) return -ENOMEM; oxfw->spec = spkr; diff --git a/sound/hda/codecs/generic.c b/sound/hda/codecs/generic.c index 6120f797b45a..ca5ea1565a57 100644 --- a/sound/hda/codecs/generic.c +++ b/sound/hda/codecs/generic.c @@ -3910,7 +3910,7 @@ static int create_mute_led_cdev(struct hda_codec *codec, int idx = micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE; int err; - cdev = devm_kzalloc(&codec->core.dev, sizeof(*cdev), GFP_KERNEL); + cdev = devm_kzalloc_obj(&codec->core.dev, *cdev); if (!cdev) return -ENOMEM; diff --git a/sound/hda/codecs/side-codecs/aw88399_hda.c b/sound/hda/codecs/side-codecs/aw88399_hda.c index 1edb9b61df48..8774e7ade8ae 100644 --- a/sound/hda/codecs/side-codecs/aw88399_hda.c +++ b/sound/hda/codecs/side-codecs/aw88399_hda.c @@ -112,7 +112,7 @@ static int aw88399_hda_init(struct aw88399_hda *aw88399) struct aw88399 *core; int ret; - core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); + core = devm_kzalloc_obj(dev, *core); if (!core) return -ENOMEM; @@ -230,7 +230,7 @@ int aw88399_hda_probe(struct device *dev, struct regmap *regmap) struct aw88399_hda *aw88399; int ret; - aw88399 = devm_kzalloc(dev, sizeof(*aw88399), GFP_KERNEL); + aw88399 = devm_kzalloc_obj(dev, *aw88399); if (!aw88399) return -ENOMEM; diff --git a/sound/hda/codecs/side-codecs/cirrus_scodec_test.c b/sound/hda/codecs/side-codecs/cirrus_scodec_test.c index 50527c5fa374..078c876e93e2 100644 --- a/sound/hda/codecs/side-codecs/cirrus_scodec_test.c +++ b/sound/hda/codecs/side-codecs/cirrus_scodec_test.c @@ -101,7 +101,7 @@ static int cirrus_scodec_test_gpio_probe(struct faux_device *fdev) struct cirrus_scodec_test_gpio *gpio_priv; int ret; - gpio_priv = devm_kzalloc(&fdev->dev, sizeof(*gpio_priv), GFP_KERNEL); + gpio_priv = devm_kzalloc_obj(&fdev->dev, *gpio_priv); if (!gpio_priv) return -ENOMEM; diff --git a/sound/hda/codecs/side-codecs/cs35l41_hda.c b/sound/hda/codecs/side-codecs/cs35l41_hda.c index f879e3ffbb53..dd65674e7631 100644 --- a/sound/hda/codecs/side-codecs/cs35l41_hda.c +++ b/sound/hda/codecs/side-codecs/cs35l41_hda.c @@ -1971,7 +1971,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i if (IS_ERR(regmap)) return PTR_ERR(regmap); - cs35l41 = devm_kzalloc(dev, sizeof(*cs35l41), GFP_KERNEL); + cs35l41 = devm_kzalloc_obj(dev, *cs35l41); if (!cs35l41) return -ENOMEM; diff --git a/sound/hda/codecs/side-codecs/cs35l41_hda_property.c b/sound/hda/codecs/side-codecs/cs35l41_hda_property.c index c50c7e689533..38173c246ba1 100644 --- a/sound/hda/codecs/side-codecs/cs35l41_hda_property.c +++ b/sound/hda/codecs/side-codecs/cs35l41_hda_property.c @@ -188,16 +188,17 @@ static int cs35l41_add_gpios(struct cs35l41_hda *cs35l41, struct device *physdev /* must include termination entry */ num_entries++; - gpio_mapping = devm_kcalloc(physdev, num_entries, sizeof(struct acpi_gpio_mapping), - GFP_KERNEL); + gpio_mapping = devm_kzalloc_objs(physdev, struct acpi_gpio_mapping, + num_entries); if (!gpio_mapping) goto err; if (reset_gpio >= 0) { gpio_mapping[reset_index].name = "reset-gpios"; - reset_gpio_params = devm_kcalloc(physdev, num_amps, sizeof(struct acpi_gpio_params), - GFP_KERNEL); + reset_gpio_params = devm_kzalloc_objs(physdev, + struct acpi_gpio_params, + num_amps); if (!reset_gpio_params) goto err; @@ -210,8 +211,9 @@ static int cs35l41_add_gpios(struct cs35l41_hda *cs35l41, struct device *physdev if (spkid_gpio >= 0) { gpio_mapping[spkid_index].name = "spk-id-gpios"; - spkid_gpio_params = devm_kcalloc(physdev, num_amps, sizeof(struct acpi_gpio_params), - GFP_KERNEL); + spkid_gpio_params = devm_kzalloc_objs(physdev, + struct acpi_gpio_params, + num_amps); if (!spkid_gpio_params) goto err; @@ -225,7 +227,8 @@ static int cs35l41_add_gpios(struct cs35l41_hda *cs35l41, struct device *physdev if ((cs_gpio_index >= 0) && (num_amps == 2)) { gpio_mapping[csgpio_index].name = "cs-gpios"; /* only one GPIO CS is supported without using _DSD, obtained using index 0 */ - cs_gpio_params = devm_kzalloc(physdev, sizeof(struct acpi_gpio_params), GFP_KERNEL); + cs_gpio_params = devm_kzalloc_obj(physdev, + struct acpi_gpio_params); if (!cs_gpio_params) goto err; diff --git a/sound/hda/codecs/side-codecs/cs35l56_hda_i2c.c b/sound/hda/codecs/side-codecs/cs35l56_hda_i2c.c index e2f51612a73d..20ecc7a68946 100644 --- a/sound/hda/codecs/side-codecs/cs35l56_hda_i2c.c +++ b/sound/hda/codecs/side-codecs/cs35l56_hda_i2c.c @@ -17,7 +17,7 @@ static int cs35l56_hda_i2c_probe(struct i2c_client *clt) struct cs35l56_hda *cs35l56; int ret; - cs35l56 = devm_kzalloc(&clt->dev, sizeof(*cs35l56), GFP_KERNEL); + cs35l56 = devm_kzalloc_obj(&clt->dev, *cs35l56); if (!cs35l56) return -ENOMEM; diff --git a/sound/hda/codecs/side-codecs/cs35l56_hda_spi.c b/sound/hda/codecs/side-codecs/cs35l56_hda_spi.c index f802c83c57b4..6195ad1fd64e 100644 --- a/sound/hda/codecs/side-codecs/cs35l56_hda_spi.c +++ b/sound/hda/codecs/side-codecs/cs35l56_hda_spi.c @@ -17,7 +17,7 @@ static int cs35l56_hda_spi_probe(struct spi_device *spi) struct cs35l56_hda *cs35l56; int ret; - cs35l56 = devm_kzalloc(&spi->dev, sizeof(*cs35l56), GFP_KERNEL); + cs35l56 = devm_kzalloc_obj(&spi->dev, *cs35l56); if (!cs35l56) return -ENOMEM; diff --git a/sound/hda/codecs/side-codecs/hda_component.c b/sound/hda/codecs/side-codecs/hda_component.c index 8a2a200600a7..7ea4c98a1f31 100644 --- a/sound/hda/codecs/side-codecs/hda_component.c +++ b/sound/hda/codecs/side-codecs/hda_component.c @@ -165,7 +165,7 @@ int hda_component_manager_init(struct hda_codec *cdc, mutex_init(&parent->mutex); for (i = 0; i < count; i++) { - sm = devm_kmalloc(dev, sizeof(*sm), GFP_KERNEL); + sm = devm_kmalloc_obj(dev, *sm); if (!sm) return -ENOMEM; diff --git a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c index 0c8faa583baa..52b2a9540c37 100644 --- a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c +++ b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c @@ -609,11 +609,11 @@ static int tas2781_hda_i2c_probe(struct i2c_client *clt) const char *device_name; int ret; - tas_hda = devm_kzalloc(&clt->dev, sizeof(*tas_hda), GFP_KERNEL); + tas_hda = devm_kzalloc_obj(&clt->dev, *tas_hda); if (!tas_hda) return -ENOMEM; - hda_priv = devm_kzalloc(&clt->dev, sizeof(*hda_priv), GFP_KERNEL); + hda_priv = devm_kzalloc_obj(&clt->dev, *hda_priv); if (!hda_priv) return -ENOMEM; diff --git a/sound/hda/codecs/side-codecs/tas2781_hda_spi.c b/sound/hda/codecs/side-codecs/tas2781_hda_spi.c index f3ba7132d2b8..0951a950d585 100644 --- a/sound/hda/codecs/side-codecs/tas2781_hda_spi.c +++ b/sound/hda/codecs/side-codecs/tas2781_hda_spi.c @@ -772,18 +772,18 @@ static int tas2781_hda_spi_probe(struct spi_device *spi) const char *device_name; int ret = 0; - tas_hda = devm_kzalloc(&spi->dev, sizeof(*tas_hda), GFP_KERNEL); + tas_hda = devm_kzalloc_obj(&spi->dev, *tas_hda); if (!tas_hda) return -ENOMEM; - hda_priv = devm_kzalloc(&spi->dev, sizeof(*hda_priv), GFP_KERNEL); + hda_priv = devm_kzalloc_obj(&spi->dev, *hda_priv); if (!hda_priv) return -ENOMEM; tas_hda->hda_priv = hda_priv; spi->max_speed_hz = TAS2781_SPI_MAX_FREQ; - tas_priv = devm_kzalloc(&spi->dev, sizeof(*tas_priv), GFP_KERNEL); + tas_priv = devm_kzalloc_obj(&spi->dev, *tas_priv); if (!tas_priv) return -ENOMEM; tas_priv->dev = &spi->dev; diff --git a/sound/hda/controllers/acpi.c b/sound/hda/controllers/acpi.c index 04b261dde22e..8ec7728ae81e 100644 --- a/sound/hda/controllers/acpi.c +++ b/sound/hda/controllers/acpi.c @@ -210,7 +210,7 @@ static int hda_acpi_probe(struct platform_device *pdev) struct hda_acpi *hda; int err; - hda = devm_kzalloc(&pdev->dev, sizeof(*hda), GFP_KERNEL); + hda = devm_kzalloc_obj(&pdev->dev, *hda); if (!hda) return -ENOMEM; @@ -219,8 +219,7 @@ static int hda_acpi_probe(struct platform_device *pdev) /* Fall back to defaults if the table didn't have a *struct hda_data */ if (!hda->data) - hda->data = devm_kzalloc(&pdev->dev, sizeof(*hda->data), - GFP_KERNEL); + hda->data = devm_kzalloc_obj(&pdev->dev, *hda->data); if (!hda->data) return -ENOMEM; diff --git a/sound/hda/controllers/cix-ipbloq.c b/sound/hda/controllers/cix-ipbloq.c index c1084a915c13..f73d6216bce3 100644 --- a/sound/hda/controllers/cix-ipbloq.c +++ b/sound/hda/controllers/cix-ipbloq.c @@ -239,7 +239,7 @@ static int cix_ipbloq_hda_probe(struct platform_device *pdev) struct azx *chip; int err; - hda = devm_kzalloc(&pdev->dev, sizeof(*hda), GFP_KERNEL); + hda = devm_kzalloc_obj(&pdev->dev, *hda); if (!hda) return -ENOMEM; hda->dev = &pdev->dev; diff --git a/sound/hda/controllers/intel.c b/sound/hda/controllers/intel.c index 29679fe7f401..958b00f7e2e0 100644 --- a/sound/hda/controllers/intel.c +++ b/sound/hda/controllers/intel.c @@ -1801,7 +1801,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, if (err < 0) return err; - hda = devm_kzalloc(&pci->dev, sizeof(*hda), GFP_KERNEL); + hda = devm_kzalloc_obj(&pci->dev, *hda); if (!hda) return -ENOMEM; diff --git a/sound/hda/controllers/tegra.c b/sound/hda/controllers/tegra.c index 674cc0f79c3c..ae9c0d3d1afe 100644 --- a/sound/hda/controllers/tegra.c +++ b/sound/hda/controllers/tegra.c @@ -518,7 +518,7 @@ static int hda_tegra_probe(struct platform_device *pdev) struct hda_tegra *hda; int err; - hda = devm_kzalloc(&pdev->dev, sizeof(*hda), GFP_KERNEL); + hda = devm_kzalloc_obj(&pdev->dev, *hda); if (!hda) return -ENOMEM; hda->dev = &pdev->dev; diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c index 12c296ee34ec..72d77d0d1701 100644 --- a/sound/isa/sb/emu8000.c +++ b/sound/isa/sb/emu8000.c @@ -1046,7 +1046,7 @@ snd_emu8000_new(struct snd_card *card, int index, long port, int seq_ports, if (seq_ports <= 0) return 0; - hw = devm_kzalloc(card->dev, sizeof(*hw), GFP_KERNEL); + hw = devm_kzalloc_obj(card->dev, *hw); if (hw == NULL) return -ENOMEM; spin_lock_init(&hw->reg_lock); diff --git a/sound/isa/sb/sb_common.c b/sound/isa/sb/sb_common.c index f2848559e6da..dd2d10a77f98 100644 --- a/sound/isa/sb/sb_common.c +++ b/sound/isa/sb/sb_common.c @@ -179,7 +179,7 @@ int snd_sbdsp_create(struct snd_card *card, if (snd_BUG_ON(!r_chip)) return -EINVAL; *r_chip = NULL; - chip = devm_kzalloc(card->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(card->dev, *chip); if (!chip) return -ENOMEM; spin_lock_init(&chip->reg_lock); diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 6cf88625bbc3..5fa9c43d3d67 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -1663,7 +1663,7 @@ static int snd_wss_new(struct snd_card *card, struct snd_wss *chip; *rchip = NULL; - chip = devm_kzalloc(card->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(card->dev, *chip); if (chip == NULL) return -ENOMEM; chip->hardware = hardware; diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 797a5f09cade..8f7e1716f2ea 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c @@ -3901,10 +3901,8 @@ int snd_cs46xx_create(struct snd_card *card, snd_cs46xx_proc_init(card, chip); #ifdef CONFIG_PM_SLEEP - chip->saved_regs = devm_kmalloc_array(&pci->dev, - ARRAY_SIZE(saved_regs), - sizeof(*chip->saved_regs), - GFP_KERNEL); + chip->saved_regs = devm_kmalloc_objs(&pci->dev, *chip->saved_regs, + ARRAY_SIZE(saved_regs)); if (!chip->saved_regs) return -ENOMEM; #endif diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 2114f9f16a34..bdb825f539bd 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -2545,8 +2545,8 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, chip->is_omnibook = 1; chip->num_substreams = NR_DSPS; - chip->substreams = devm_kcalloc(&pci->dev, chip->num_substreams, - sizeof(struct m3_dma), GFP_KERNEL); + chip->substreams = devm_kzalloc_objs(&pci->dev, struct m3_dma, + chip->num_substreams); if (!chip->substreams) return -ENOMEM; diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index cc4cf43e5a5b..0c639a741627 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -6528,7 +6528,7 @@ static int snd_hdspm_create(struct snd_card *card, dev_dbg(card->dev, "kmalloc Mixer memory of %zd Bytes\n", sizeof(*hdspm->mixer)); - hdspm->mixer = devm_kzalloc(&pci->dev, sizeof(*hdspm->mixer), GFP_KERNEL); + hdspm->mixer = devm_kzalloc_obj(&pci->dev, *hdspm->mixer); if (!hdspm->mixer) return -ENOMEM; diff --git a/sound/soc/adi/axi-i2s.c b/sound/soc/adi/axi-i2s.c index 41f89384f8fd..2c4035ff6c2d 100644 --- a/sound/soc/adi/axi-i2s.c +++ b/sound/soc/adi/axi-i2s.c @@ -191,7 +191,7 @@ static int axi_i2s_probe(struct platform_device *pdev) void __iomem *base; int ret; - i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(&pdev->dev, *i2s); if (!i2s) return -ENOMEM; diff --git a/sound/soc/adi/axi-spdif.c b/sound/soc/adi/axi-spdif.c index 5581134201a3..faa1fc7cb973 100644 --- a/sound/soc/adi/axi-spdif.c +++ b/sound/soc/adi/axi-spdif.c @@ -184,7 +184,7 @@ static int axi_spdif_probe(struct platform_device *pdev) void __iomem *base; int ret; - spdif = devm_kzalloc(&pdev->dev, sizeof(*spdif), GFP_KERNEL); + spdif = devm_kzalloc_obj(&pdev->dev, *spdif); if (!spdif) return -ENOMEM; diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c index 1ac729a58bb4..cf39f6151394 100644 --- a/sound/soc/amd/acp-da7219-max98357a.c +++ b/sound/soc/amd/acp-da7219-max98357a.c @@ -787,8 +787,7 @@ static int cz_probe(struct platform_device *pdev) } } - machine = devm_kzalloc(&pdev->dev, sizeof(struct acp_platform_info), - GFP_KERNEL); + machine = devm_kzalloc_obj(&pdev->dev, struct acp_platform_info); if (!machine) return -ENOMEM; card->dev = &pdev->dev; diff --git a/sound/soc/amd/acp-es8336.c b/sound/soc/amd/acp-es8336.c index 0cb0ee76191d..f56fd3ae3482 100644 --- a/sound/soc/amd/acp-es8336.c +++ b/sound/soc/amd/acp-es8336.c @@ -269,7 +269,7 @@ static int st_es8336_probe(struct platform_device *pdev) struct snd_soc_card *card; struct acp_platform_info *machine; - machine = devm_kzalloc(&pdev->dev, sizeof(struct acp_platform_info), GFP_KERNEL); + machine = devm_kzalloc_obj(&pdev->dev, struct acp_platform_info); if (!machine) return -ENOMEM; diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index ee75737202dc..4d1ffee33b0e 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -1264,8 +1264,7 @@ static int acp_audio_probe(struct platform_device *pdev) return -ENODEV; } - audio_drv_data = devm_kzalloc(&pdev->dev, sizeof(struct audio_drv_data), - GFP_KERNEL); + audio_drv_data = devm_kzalloc_obj(&pdev->dev, struct audio_drv_data); if (!audio_drv_data) return -ENOMEM; diff --git a/sound/soc/amd/acp/acp-legacy-mach.c b/sound/soc/amd/acp/acp-legacy-mach.c index 235d6cc83fa9..731608c4c0bc 100644 --- a/sound/soc/amd/acp/acp-legacy-mach.c +++ b/sound/soc/amd/acp/acp-legacy-mach.c @@ -133,7 +133,7 @@ static int acp_asoc_probe(struct platform_device *pdev) goto out; } - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) { ret = -ENOMEM; goto out; diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index 01a0aaa60246..529f792e27c3 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -1415,7 +1415,7 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card) if (drv_data->dmic_cpu_id) num_links++; - links = devm_kcalloc(dev, num_links, sizeof(struct snd_soc_dai_link), GFP_KERNEL); + links = devm_kzalloc_objs(dev, struct snd_soc_dai_link, num_links); if (!links) return -ENOMEM; @@ -1623,7 +1623,7 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card) if (drv_data->dmic_cpu_id) num_links++; - links = devm_kcalloc(dev, num_links, sizeof(struct snd_soc_dai_link), GFP_KERNEL); + links = devm_kzalloc_objs(dev, struct snd_soc_dai_link, num_links); if (!links) return -ENOMEM; diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c index 98771323eace..aca6f44af1d1 100644 --- a/sound/soc/amd/acp/acp-pci.c +++ b/sound/soc/amd/acp/acp-pci.c @@ -63,7 +63,7 @@ static int create_acp_platform_devs(struct pci_dev *pci, struct acp_chip_info *c parent = &pci->dev; if (chip->is_i2s_config || chip->is_pdm_dev) { - chip->res = devm_kzalloc(&pci->dev, sizeof(struct resource), GFP_KERNEL); + chip->res = devm_kzalloc_obj(&pci->dev, struct resource); if (!chip->res) { ret = -ENOMEM; goto err; @@ -114,7 +114,7 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id if (flag != FLAG_AMD_LEGACY && flag != FLAG_AMD_LEGACY_ONLY_DMIC) return -ENODEV; - chip = devm_kzalloc(&pci->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&pci->dev, *chip); if (!chip) return -ENOMEM; diff --git a/sound/soc/amd/acp/acp-sdw-legacy-mach.c b/sound/soc/amd/acp/acp-sdw-legacy-mach.c index a8b62817b234..dac8da62fa94 100644 --- a/sound/soc/amd/acp/acp-sdw-legacy-mach.c +++ b/sound/soc/amd/acp/acp-sdw-legacy-mach.c @@ -249,15 +249,15 @@ static int create_sdw_dailink(struct snd_soc_card *card, if (!name) return -ENOMEM; - cpus = devm_kcalloc(dev, num_cpus, sizeof(*cpus), GFP_KERNEL); + cpus = devm_kzalloc_objs(dev, *cpus, num_cpus); if (!cpus) return -ENOMEM; - codecs = devm_kcalloc(dev, num_codecs, sizeof(*codecs), GFP_KERNEL); + codecs = devm_kzalloc_objs(dev, *codecs, num_codecs); if (!codecs) return -ENOMEM; - codec_maps = devm_kcalloc(dev, num_codecs, sizeof(*codec_maps), GFP_KERNEL); + codec_maps = devm_kzalloc_objs(dev, *codec_maps, num_codecs); if (!codec_maps) return -ENOMEM; @@ -331,8 +331,8 @@ static int create_sdw_dailinks(struct snd_soc_card *card, int i; int ret; - sdw_platform_component = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link_component), - GFP_KERNEL); + sdw_platform_component = devm_kzalloc_obj(dev, + struct snd_soc_dai_link_component); if (!sdw_platform_component) return -ENOMEM; @@ -376,11 +376,11 @@ static int create_dmic_dailinks(struct snd_soc_card *card, struct snd_soc_dai_link_component *pdm_platform; int ret; - pdm_cpu = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link_component), GFP_KERNEL); + pdm_cpu = devm_kzalloc_obj(dev, struct snd_soc_dai_link_component); if (!pdm_cpu) return -ENOMEM; - pdm_platform = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link_component), GFP_KERNEL); + pdm_platform = devm_kzalloc_obj(dev, struct snd_soc_dai_link_component); if (!pdm_platform) return -ENOMEM; @@ -446,7 +446,7 @@ static int soc_card_dai_links_create(struct snd_soc_card *card) if (!soc_ends) return -ENOMEM; - soc_aux = devm_kcalloc(dev, num_aux, sizeof(*soc_aux), GFP_KERNEL); + soc_aux = devm_kzalloc_objs(dev, *soc_aux, num_aux); if (!soc_aux) return -ENOMEM; @@ -486,13 +486,13 @@ static int soc_card_dai_links_create(struct snd_soc_card *card) dev_dbg(dev, "sdw %d, dmic %d", sdw_be_num, dmic_num); - codec_conf = devm_kcalloc(dev, num_confs, sizeof(*codec_conf), GFP_KERNEL); + codec_conf = devm_kzalloc_objs(dev, *codec_conf, num_confs); if (!codec_conf) return -ENOMEM; /* allocate BE dailinks */ num_links = sdw_be_num + dmic_num; - dai_links = devm_kcalloc(dev, num_links, sizeof(*dai_links), GFP_KERNEL); + dai_links = devm_kzalloc_objs(dev, *dai_links, num_links); if (!dai_links) return -ENOMEM; @@ -537,13 +537,13 @@ static int mc_probe(struct platform_device *pdev) int amp_num = 0, i; int ret; - amd_ctx = devm_kzalloc(&pdev->dev, sizeof(*amd_ctx), GFP_KERNEL); + amd_ctx = devm_kzalloc_obj(&pdev->dev, *amd_ctx); if (!amd_ctx) return -ENOMEM; amd_ctx->acp_rev = mach->mach_params.subsystem_rev; amd_ctx->max_sdw_links = ACP63_SDW_MAX_LINKS; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; ctx->codec_info_list_count = asoc_sdw_get_codec_info_list_count(); diff --git a/sound/soc/amd/acp/acp-sdw-sof-mach.c b/sound/soc/amd/acp/acp-sdw-sof-mach.c index ec3e1f5f1052..8336eb5c82ea 100644 --- a/sound/soc/amd/acp/acp-sdw-sof-mach.c +++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c @@ -164,15 +164,15 @@ static int create_sdw_dailink(struct snd_soc_card *card, if (!name) return -ENOMEM; - cpus = devm_kcalloc(dev, num_cpus, sizeof(*cpus), GFP_KERNEL); + cpus = devm_kzalloc_objs(dev, *cpus, num_cpus); if (!cpus) return -ENOMEM; - codecs = devm_kcalloc(dev, num_codecs, sizeof(*codecs), GFP_KERNEL); + codecs = devm_kzalloc_objs(dev, *codecs, num_codecs); if (!codecs) return -ENOMEM; - codec_maps = devm_kcalloc(dev, num_codecs, sizeof(*codec_maps), GFP_KERNEL); + codec_maps = devm_kzalloc_objs(dev, *codec_maps, num_codecs); if (!codec_maps) return -ENOMEM; @@ -310,7 +310,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) if (!sof_ends) return -ENOMEM; - sof_aux = devm_kcalloc(dev, num_aux, sizeof(*sof_aux), GFP_KERNEL); + sof_aux = devm_kzalloc_objs(dev, *sof_aux, num_aux); if (!sof_aux) return -ENOMEM; @@ -326,13 +326,13 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) dev_dbg(dev, "sdw %d, dmic %d", sdw_be_num, dmic_num); - codec_conf = devm_kcalloc(dev, num_confs, sizeof(*codec_conf), GFP_KERNEL); + codec_conf = devm_kzalloc_objs(dev, *codec_conf, num_confs); if (!codec_conf) return -ENOMEM; /* allocate BE dailinks */ num_links = sdw_be_num + dmic_num; - dai_links = devm_kcalloc(dev, num_links, sizeof(*dai_links), GFP_KERNEL); + dai_links = devm_kzalloc_objs(dev, *dai_links, num_links); if (!dai_links) return -ENOMEM; @@ -377,13 +377,13 @@ static int mc_probe(struct platform_device *pdev) int amp_num = 0, i; int ret; - amd_ctx = devm_kzalloc(&pdev->dev, sizeof(*amd_ctx), GFP_KERNEL); + amd_ctx = devm_kzalloc_obj(&pdev->dev, *amd_ctx); if (!amd_ctx) return -ENOMEM; amd_ctx->acp_rev = mach->mach_params.subsystem_rev; amd_ctx->max_sdw_links = ACP63_SDW_MAX_LINKS; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; ctx->codec_info_list_count = asoc_sdw_get_codec_info_list_count(); diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c index 8874151e159a..1e80294ce323 100644 --- a/sound/soc/amd/acp/acp-sof-mach.c +++ b/sound/soc/amd/acp/acp-sof-mach.c @@ -98,7 +98,7 @@ static int acp_sof_probe(struct platform_device *pdev) if (!pdev->id_entry) return -EINVAL; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; diff --git a/sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c b/sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c index eb0e9a6af6ef..38be8fd56205 100644 --- a/sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c +++ b/sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c @@ -441,7 +441,7 @@ static int acp3x_es83xx_probe(struct snd_soc_card *card) return -EPROBE_DEFER; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) { put_device(codec_dev); return -ENOMEM; diff --git a/sound/soc/amd/acp3x-rt5682-max9836.c b/sound/soc/amd/acp3x-rt5682-max9836.c index 4affb00bdc95..60e29a1cd7e0 100644 --- a/sound/soc/amd/acp3x-rt5682-max9836.c +++ b/sound/soc/amd/acp3x-rt5682-max9836.c @@ -509,7 +509,7 @@ static int acp3x_probe(struct platform_device *pdev) if (!card) return -ENODEV; - machine = devm_kzalloc(&pdev->dev, sizeof(*machine), GFP_KERNEL); + machine = devm_kzalloc_obj(&pdev->dev, *machine); if (!machine) return -ENOMEM; diff --git a/sound/soc/amd/acp7x/pci-acp7x.c b/sound/soc/amd/acp7x/pci-acp7x.c index d29a149cf175..0db749cd9fab 100644 --- a/sound/soc/amd/acp7x/pci-acp7x.c +++ b/sound/soc/amd/acp7x/pci-acp7x.c @@ -19,8 +19,7 @@ static int acp_hw_init_ops(struct acp7x_dev_data *adata, struct pci_dev *pci) { - adata->hw_ops = devm_kzalloc(&pci->dev, sizeof(struct acp_hw_ops), - GFP_KERNEL); + adata->hw_ops = devm_kzalloc_obj(&pci->dev, struct acp_hw_ops); if (!adata->hw_ops) return -ENOMEM; @@ -67,8 +66,7 @@ static int snd_acp7x_probe(struct pci_dev *pci, dev_err(&pci->dev, "pci_request_regions failed\n"); goto disable_pci; } - adata = devm_kzalloc(&pci->dev, sizeof(struct acp7x_dev_data), - GFP_KERNEL); + adata = devm_kzalloc_obj(&pci->dev, struct acp7x_dev_data); if (!adata) { ret = -ENOMEM; goto release_regions; diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c index b604db4942dd..f989ad2a13d2 100644 --- a/sound/soc/amd/ps/pci-ps.c +++ b/sound/soc/amd/ps/pci-ps.c @@ -480,7 +480,7 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data parent = &pci->dev; if (adata->is_sdw_dev || adata->is_pdm_dev) { - adata->res = devm_kzalloc(&pci->dev, sizeof(struct resource), GFP_KERNEL); + adata->res = devm_kzalloc_obj(&pci->dev, struct resource); if (!adata->res) { ret = -ENOMEM; goto de_init; @@ -550,8 +550,7 @@ de_init: static int acp_hw_init_ops(struct acp63_dev_data *adata, struct pci_dev *pci) { - adata->hw_ops = devm_kzalloc(&pci->dev, sizeof(struct acp_hw_ops), - GFP_KERNEL); + adata->hw_ops = devm_kzalloc_obj(&pci->dev, struct acp_hw_ops); if (!adata->hw_ops) return -ENOMEM; @@ -607,8 +606,7 @@ static int snd_acp63_probe(struct pci_dev *pci, dev_err(&pci->dev, "pci_request_regions failed\n"); goto disable_pci; } - adata = devm_kzalloc(&pci->dev, sizeof(struct acp63_dev_data), - GFP_KERNEL); + adata = devm_kzalloc_obj(&pci->dev, struct acp63_dev_data); if (!adata) { ret = -ENOMEM; goto release_regions; diff --git a/sound/soc/amd/ps/ps-pdm-dma.c b/sound/soc/amd/ps/ps-pdm-dma.c index 12c341e89bce..359ca10b9ba4 100644 --- a/sound/soc/amd/ps/ps-pdm-dma.c +++ b/sound/soc/amd/ps/ps-pdm-dma.c @@ -377,7 +377,7 @@ static int acp63_pdm_audio_probe(struct platform_device *pdev) return -ENODEV; } - adata = devm_kzalloc(&pdev->dev, sizeof(*adata), GFP_KERNEL); + adata = devm_kzalloc_obj(&pdev->dev, *adata); if (!adata) return -ENOMEM; diff --git a/sound/soc/amd/ps/ps-sdw-dma.c b/sound/soc/amd/ps/ps-sdw-dma.c index c2640985f54c..6c510e6d9a18 100644 --- a/sound/soc/amd/ps/ps-sdw-dma.c +++ b/sound/soc/amd/ps/ps-sdw-dma.c @@ -661,7 +661,7 @@ static int acp63_sdw_platform_probe(struct platform_device *pdev) return -ENODEV; } - sdw_data = devm_kzalloc(&pdev->dev, sizeof(*sdw_data), GFP_KERNEL); + sdw_data = devm_kzalloc_obj(&pdev->dev, *sdw_data); if (!sdw_data) return -ENOMEM; diff --git a/sound/soc/amd/raven/acp3x-i2s.c b/sound/soc/amd/raven/acp3x-i2s.c index b0147e88ba54..4a0b48cf9f15 100644 --- a/sound/soc/amd/raven/acp3x-i2s.c +++ b/sound/soc/amd/raven/acp3x-i2s.c @@ -296,8 +296,7 @@ static int acp3x_dai_probe(struct platform_device *pdev) struct i2s_dev_data *adata; int ret; - adata = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dev_data), - GFP_KERNEL); + adata = devm_kzalloc_obj(&pdev->dev, struct i2s_dev_data); if (!adata) return -ENOMEM; diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c index 0862a431b2d1..700c0ca20e18 100644 --- a/sound/soc/amd/raven/acp3x-pcm-dma.c +++ b/sound/soc/amd/raven/acp3x-pcm-dma.c @@ -393,7 +393,7 @@ static int acp3x_audio_probe(struct platform_device *pdev) return -ENODEV; } - adata = devm_kzalloc(&pdev->dev, sizeof(*adata), GFP_KERNEL); + adata = devm_kzalloc_obj(&pdev->dev, *adata); if (!adata) return -ENOMEM; diff --git a/sound/soc/amd/raven/pci-acp3x.c b/sound/soc/amd/raven/pci-acp3x.c index a013a607b3d4..76a717e5db3a 100644 --- a/sound/soc/amd/raven/pci-acp3x.c +++ b/sound/soc/amd/raven/pci-acp3x.c @@ -148,8 +148,7 @@ static int snd_acp3x_probe(struct pci_dev *pci, goto disable_pci; } - adata = devm_kzalloc(&pci->dev, sizeof(struct acp3x_dev_data), - GFP_KERNEL); + adata = devm_kzalloc_obj(&pci->dev, struct acp3x_dev_data); if (!adata) { ret = -ENOMEM; goto release_regions; diff --git a/sound/soc/amd/renoir/acp3x-pdm-dma.c b/sound/soc/amd/renoir/acp3x-pdm-dma.c index 89dc60849c06..bea1208f1702 100644 --- a/sound/soc/amd/renoir/acp3x-pdm-dma.c +++ b/sound/soc/amd/renoir/acp3x-pdm-dma.c @@ -405,7 +405,7 @@ static int acp_pdm_audio_probe(struct platform_device *pdev) return -ENODEV; } - adata = devm_kzalloc(&pdev->dev, sizeof(*adata), GFP_KERNEL); + adata = devm_kzalloc_obj(&pdev->dev, *adata); if (!adata) return -ENOMEM; diff --git a/sound/soc/amd/renoir/rn-pci-acp3x.c b/sound/soc/amd/renoir/rn-pci-acp3x.c index b3812b70f5f9..d8b418b69ed9 100644 --- a/sound/soc/amd/renoir/rn-pci-acp3x.c +++ b/sound/soc/amd/renoir/rn-pci-acp3x.c @@ -236,8 +236,7 @@ static int snd_rn_acp_probe(struct pci_dev *pci, goto disable_pci; } - adata = devm_kzalloc(&pci->dev, sizeof(struct acp_dev_data), - GFP_KERNEL); + adata = devm_kzalloc_obj(&pci->dev, struct acp_dev_data); if (!adata) { ret = -ENOMEM; goto release_regions; diff --git a/sound/soc/amd/vangogh/acp5x-i2s.c b/sound/soc/amd/vangogh/acp5x-i2s.c index dbfb87e2fe92..81678e654a68 100644 --- a/sound/soc/amd/vangogh/acp5x-i2s.c +++ b/sound/soc/amd/vangogh/acp5x-i2s.c @@ -383,8 +383,7 @@ static int acp5x_dai_probe(struct platform_device *pdev) struct i2s_dev_data *adata; int ret; - adata = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dev_data), - GFP_KERNEL); + adata = devm_kzalloc_obj(&pdev->dev, struct i2s_dev_data); if (!adata) return -ENOMEM; diff --git a/sound/soc/amd/vangogh/acp5x-mach.c b/sound/soc/amd/vangogh/acp5x-mach.c index 5454de24fbcc..8dcb5814d022 100644 --- a/sound/soc/amd/vangogh/acp5x-mach.c +++ b/sound/soc/amd/vangogh/acp5x-mach.c @@ -457,7 +457,7 @@ static int acp5x_probe(struct platform_device *pdev) if (!dmi_id || !dmi_id->driver_data) return -ENODEV; - machine = devm_kzalloc(dev, sizeof(*machine), GFP_KERNEL); + machine = devm_kzalloc_obj(dev, *machine); if (!machine) return -ENOMEM; diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c index 72050fa2de80..8b09e66610b5 100644 --- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c +++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c @@ -385,7 +385,7 @@ static int acp5x_audio_probe(struct platform_device *pdev) return -ENODEV; } - adata = devm_kzalloc(&pdev->dev, sizeof(*adata), GFP_KERNEL); + adata = devm_kzalloc_obj(&pdev->dev, *adata); if (!adata) return -ENOMEM; diff --git a/sound/soc/amd/vangogh/pci-acp5x.c b/sound/soc/amd/vangogh/pci-acp5x.c index af56ff09f02a..645120a00b0c 100644 --- a/sound/soc/amd/vangogh/pci-acp5x.c +++ b/sound/soc/amd/vangogh/pci-acp5x.c @@ -154,8 +154,7 @@ static int snd_acp5x_probe(struct pci_dev *pci, goto disable_pci; } - adata = devm_kzalloc(&pci->dev, sizeof(struct acp5x_dev_data), - GFP_KERNEL); + adata = devm_kzalloc_obj(&pci->dev, struct acp5x_dev_data); if (!adata) { ret = -ENOMEM; goto release_regions; diff --git a/sound/soc/amd/yc/acp6x-pdm-dma.c b/sound/soc/amd/yc/acp6x-pdm-dma.c index cba2509faaa1..3f8c73a1f182 100644 --- a/sound/soc/amd/yc/acp6x-pdm-dma.c +++ b/sound/soc/amd/yc/acp6x-pdm-dma.c @@ -370,7 +370,7 @@ static int acp6x_pdm_audio_probe(struct platform_device *pdev) return -ENODEV; } - adata = devm_kzalloc(&pdev->dev, sizeof(*adata), GFP_KERNEL); + adata = devm_kzalloc_obj(&pdev->dev, *adata); if (!adata) return -ENOMEM; diff --git a/sound/soc/amd/yc/pci-acp6x.c b/sound/soc/amd/yc/pci-acp6x.c index bacbfc55c598..baf2baeb9952 100644 --- a/sound/soc/amd/yc/pci-acp6x.c +++ b/sound/soc/amd/yc/pci-acp6x.c @@ -180,8 +180,7 @@ static int snd_acp6x_probe(struct pci_dev *pci, goto disable_pci; } - adata = devm_kzalloc(&pci->dev, sizeof(struct acp6x_dev_data), - GFP_KERNEL); + adata = devm_kzalloc_obj(&pci->dev, struct acp6x_dev_data); if (!adata) { ret = -ENOMEM; goto release_regions; @@ -221,9 +220,7 @@ static int snd_acp6x_probe(struct pci_dev *pci, } fallthrough; default: - adata->res = devm_kzalloc(&pci->dev, - sizeof(struct resource), - GFP_KERNEL); + adata->res = devm_kzalloc_obj(&pci->dev, struct resource); if (!adata->res) { ret = -ENOMEM; goto de_init; diff --git a/sound/soc/apple/mca.c b/sound/soc/apple/mca.c index 26022a42a95e..393274dea9b5 100644 --- a/sound/soc/apple/mca.c +++ b/sound/soc/apple/mca.c @@ -1182,8 +1182,7 @@ static int apple_mca_probe(struct platform_device *pdev) return -EINVAL; nclusters = (resource_size(res) - CLUSTER_STRIDE) / CLUSTER_STRIDE + 1; - mca = devm_kzalloc(&pdev->dev, struct_size(mca, clusters, nclusters), - GFP_KERNEL); + mca = devm_kzalloc_flex(&pdev->dev, *mca, clusters, nclusters); if (!mca) return -ENOMEM; mca->dev = &pdev->dev; diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c index 6693bdcbb8f5..746e6bbbf423 100644 --- a/sound/soc/atmel/atmel-classd.c +++ b/sound/soc/atmel/atmel-classd.c @@ -58,7 +58,7 @@ static struct atmel_classd_pdata *atmel_classd_dt_init(struct device *dev) return ERR_PTR(-EINVAL); } - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); @@ -473,7 +473,7 @@ static int atmel_classd_asoc_card_init(struct device *dev, struct atmel_classd *dd = snd_soc_card_get_drvdata(card); struct snd_soc_dai_link_component *comp; - dai_link = devm_kzalloc(dev, sizeof(*dai_link), GFP_KERNEL); + dai_link = devm_kzalloc_obj(dev, *dai_link); if (!dai_link) return -ENOMEM; @@ -536,7 +536,7 @@ static int atmel_classd_probe(struct platform_device *pdev) return PTR_ERR(pdata); } - dd = devm_kzalloc(dev, sizeof(*dd), GFP_KERNEL); + dd = devm_kzalloc_obj(dev, *dd); if (!dd) return -ENOMEM; @@ -592,7 +592,7 @@ static int atmel_classd_probe(struct platform_device *pdev) } /* register sound card */ - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) { ret = -ENOMEM; goto unregister_codec; diff --git a/sound/soc/atmel/atmel-i2s.c b/sound/soc/atmel/atmel-i2s.c index e1d8af056234..611bdad565d9 100644 --- a/sound/soc/atmel/atmel-i2s.c +++ b/sound/soc/atmel/atmel-i2s.c @@ -631,7 +631,7 @@ static int atmel_i2s_probe(struct platform_device *pdev) unsigned int version; /* Get memory for driver data. */ - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/sound/soc/atmel/atmel-pdmic.c b/sound/soc/atmel/atmel-pdmic.c index 4dfc7e5ca8ff..892bd7e3bcab 100644 --- a/sound/soc/atmel/atmel-pdmic.c +++ b/sound/soc/atmel/atmel-pdmic.c @@ -57,7 +57,7 @@ static struct atmel_pdmic_pdata *atmel_pdmic_dt_init(struct device *dev) return ERR_PTR(-EINVAL); } - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); @@ -492,11 +492,11 @@ static int atmel_pdmic_asoc_card_init(struct device *dev, struct atmel_pdmic *dd = snd_soc_card_get_drvdata(card); struct snd_soc_dai_link_component *comp; - dai_link = devm_kzalloc(dev, sizeof(*dai_link), GFP_KERNEL); + dai_link = devm_kzalloc_obj(dev, *dai_link); if (!dai_link) return -ENOMEM; - comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL); + comp = devm_kzalloc_obj(dev, *comp); if (!comp) return -ENOMEM; @@ -581,7 +581,7 @@ static int atmel_pdmic_probe(struct platform_device *pdev) if (IS_ERR(pdata)) return PTR_ERR(pdata); - dd = devm_kzalloc(dev, sizeof(*dd), GFP_KERNEL); + dd = devm_kzalloc_obj(dev, *dd); if (!dd) return -ENOMEM; @@ -661,7 +661,7 @@ static int atmel_pdmic_probe(struct platform_device *pdev) } /* register sound card */ - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) { ret = -ENOMEM; goto unregister_codec; diff --git a/sound/soc/atmel/mchp-i2s-mcc.c b/sound/soc/atmel/mchp-i2s-mcc.c index a832dee73ac7..cb0f3e55b05d 100644 --- a/sound/soc/atmel/mchp-i2s-mcc.c +++ b/sound/soc/atmel/mchp-i2s-mcc.c @@ -1042,7 +1042,7 @@ static int mchp_i2s_mcc_probe(struct platform_device *pdev) int irq; int err; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/sound/soc/atmel/mchp-pdmc.c b/sound/soc/atmel/mchp-pdmc.c index a6a9b5e6cd95..039b2eba0d9d 100644 --- a/sound/soc/atmel/mchp-pdmc.c +++ b/sound/soc/atmel/mchp-pdmc.c @@ -1022,7 +1022,7 @@ static int mchp_pdmc_probe(struct platform_device *pdev) int irq; int ret; - dd = devm_kzalloc(dev, sizeof(*dd), GFP_KERNEL); + dd = devm_kzalloc_obj(dev, *dd); if (!dd) return -ENOMEM; diff --git a/sound/soc/atmel/mchp-spdifrx.c b/sound/soc/atmel/mchp-spdifrx.c index 2c47aabdca95..63089ac3ebdc 100644 --- a/sound/soc/atmel/mchp-spdifrx.c +++ b/sound/soc/atmel/mchp-spdifrx.c @@ -1090,7 +1090,7 @@ static int mchp_spdifrx_probe(struct platform_device *pdev) u32 vers; /* Get memory for driver data. */ - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/sound/soc/atmel/mchp-spdiftx.c b/sound/soc/atmel/mchp-spdiftx.c index 245c0352c141..fc635ed6856e 100644 --- a/sound/soc/atmel/mchp-spdiftx.c +++ b/sound/soc/atmel/mchp-spdiftx.c @@ -789,7 +789,7 @@ static int mchp_spdiftx_probe(struct platform_device *pdev) int err; /* Get memory for driver data. */ - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/sound/soc/atmel/mikroe-proto.c b/sound/soc/atmel/mikroe-proto.c index 8341a6e06493..93c6a93b22be 100644 --- a/sound/soc/atmel/mikroe-proto.c +++ b/sound/soc/atmel/mikroe-proto.c @@ -81,7 +81,7 @@ static int snd_proto_probe(struct platform_device *pdev) if (ret) return ret; - dai = devm_kzalloc(&pdev->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(&pdev->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/atmel/sam9x5_wm8731.c b/sound/soc/atmel/sam9x5_wm8731.c index a603e4a57d50..9d168f408fab 100644 --- a/sound/soc/atmel/sam9x5_wm8731.c +++ b/sound/soc/atmel/sam9x5_wm8731.c @@ -84,9 +84,9 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev) return -EINVAL; } - card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL); - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); - dai = devm_kzalloc(&pdev->dev, sizeof(*dai), GFP_KERNEL); + card = devm_kzalloc_obj(&pdev->dev, *card); + priv = devm_kzalloc_obj(&pdev->dev, *priv); + dai = devm_kzalloc_obj(&pdev->dev, *dai); comp = devm_kzalloc(&pdev->dev, 3 * sizeof(*comp), GFP_KERNEL); if (!dai || !card || !priv || !comp) { ret = -ENOMEM; diff --git a/sound/soc/atmel/tse850-pcm5142.c b/sound/soc/atmel/tse850-pcm5142.c index 0b4927d07f25..169dd33ffc25 100644 --- a/sound/soc/atmel/tse850-pcm5142.c +++ b/sound/soc/atmel/tse850-pcm5142.c @@ -349,7 +349,7 @@ static int tse850_probe(struct platform_device *pdev) struct tse850_priv *tse850; int ret; - tse850 = devm_kzalloc(dev, sizeof(*tse850), GFP_KERNEL); + tse850 = devm_kzalloc_obj(dev, *tse850); if (!tse850) return -ENOMEM; diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c index f8ab936250dc..308b7f6d8c44 100644 --- a/sound/soc/au1x/ac97c.c +++ b/sound/soc/au1x/ac97c.c @@ -233,7 +233,7 @@ static int au1xac97c_drvprobe(struct platform_device *pdev) struct resource *iores, *dmares; struct au1xpsc_audio_data *ctx; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c index 3d10d6460472..2aba135a433b 100644 --- a/sound/soc/au1x/dbdma2.c +++ b/sound/soc/au1x/dbdma2.c @@ -326,9 +326,7 @@ static int au1xpsc_pcm_drvprobe(struct platform_device *pdev) { struct au1xpsc_audio_dmadata *dmadata; - dmadata = devm_kcalloc(&pdev->dev, - 2, sizeof(struct au1xpsc_audio_dmadata), - GFP_KERNEL); + dmadata = devm_kzalloc_objs(&pdev->dev, struct au1xpsc_audio_dmadata, 2); if (!dmadata) return -ENOMEM; diff --git a/sound/soc/au1x/dma.c b/sound/soc/au1x/dma.c index 026d9f36db10..55044b9d09ff 100644 --- a/sound/soc/au1x/dma.c +++ b/sound/soc/au1x/dma.c @@ -303,7 +303,7 @@ static int alchemy_pcm_drvprobe(struct platform_device *pdev) { struct alchemy_pcm_ctx *ctx; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/sound/soc/au1x/i2sc.c b/sound/soc/au1x/i2sc.c index 0e9c7eef9ee8..1afb3571a784 100644 --- a/sound/soc/au1x/i2sc.c +++ b/sound/soc/au1x/i2sc.c @@ -247,7 +247,7 @@ static int au1xi2s_drvprobe(struct platform_device *pdev) struct resource *iores, *dmares; struct au1xpsc_audio_data *ctx; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c index 0f9d80883116..b2836f7eb9b4 100644 --- a/sound/soc/au1x/psc-ac97.c +++ b/sound/soc/au1x/psc-ac97.c @@ -365,8 +365,7 @@ static int au1xpsc_ac97_drvprobe(struct platform_device *pdev) unsigned long sel; struct au1xpsc_audio_data *wd; - wd = devm_kzalloc(&pdev->dev, sizeof(struct au1xpsc_audio_data), - GFP_KERNEL); + wd = devm_kzalloc_obj(&pdev->dev, struct au1xpsc_audio_data); if (!wd) return -ENOMEM; diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c index 72aa5177147f..9f676c0ea75e 100644 --- a/sound/soc/au1x/psc-i2s.c +++ b/sound/soc/au1x/psc-i2s.c @@ -307,8 +307,7 @@ static int au1xpsc_i2s_drvprobe(struct platform_device *pdev) unsigned long sel; struct au1xpsc_audio_data *wd; - wd = devm_kzalloc(&pdev->dev, sizeof(struct au1xpsc_audio_data), - GFP_KERNEL); + wd = devm_kzalloc_obj(&pdev->dev, struct au1xpsc_audio_data); if (!wd) return -ENOMEM; diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c index 208977828254..8702f1d062df 100644 --- a/sound/soc/bcm/bcm2835-i2s.c +++ b/sound/soc/bcm/bcm2835-i2s.c @@ -846,8 +846,7 @@ static int bcm2835_i2s_probe(struct platform_device *pdev) const __be32 *addr; dma_addr_t dma_base; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), - GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/sound/soc/bcm/bcm63xx-i2s-whistler.c b/sound/soc/bcm/bcm63xx-i2s-whistler.c index 14d111fe29d8..247b5408c7ab 100644 --- a/sound/soc/bcm/bcm63xx-i2s-whistler.c +++ b/sound/soc/bcm/bcm63xx-i2s-whistler.c @@ -229,7 +229,7 @@ static int bcm63xx_i2s_dev_probe(struct platform_device *pdev) struct regmap *regmap_i2s; struct clk *i2s_clk; - i2s_priv = devm_kzalloc(&pdev->dev, sizeof(*i2s_priv), GFP_KERNEL); + i2s_priv = devm_kzalloc_obj(&pdev->dev, *i2s_priv); if (!i2s_priv) return -ENOMEM; diff --git a/sound/soc/bcm/cygnus-ssp.c b/sound/soc/bcm/cygnus-ssp.c index 753021789a52..3ef34daccd80 100644 --- a/sound/soc/bcm/cygnus-ssp.c +++ b/sound/soc/bcm/cygnus-ssp.c @@ -1310,7 +1310,7 @@ static int cygnus_ssp_probe(struct platform_device *pdev) int node_count; int active_port_count; - cygaud = devm_kzalloc(dev, sizeof(struct cygnus_audio), GFP_KERNEL); + cygaud = devm_kzalloc_obj(dev, struct cygnus_audio); if (!cygaud) return -ENOMEM; diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c index 8195ed7c6dd6..97816fb75368 100644 --- a/sound/soc/cirrus/ep93xx-i2s.c +++ b/sound/soc/cirrus/ep93xx-i2s.c @@ -452,7 +452,7 @@ static int ep93xx_i2s_probe(struct platform_device *pdev) struct ep93xx_i2s_info *info; int err; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index 7596227fbccf..7f3c198510d4 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c @@ -1361,8 +1361,7 @@ static int pm860x_codec_probe(struct platform_device *pdev) struct resource *res; int i, ret; - pm860x = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_priv), - GFP_KERNEL); + pm860x = devm_kzalloc_obj(&pdev->dev, struct pm860x_priv); if (pm860x == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c index 3e3ff9bfe00d..530f220490b3 100644 --- a/sound/soc/codecs/ab8500-codec.c +++ b/sound/soc/codecs/ab8500-codec.c @@ -2132,8 +2132,7 @@ static int ab8500_codec_driver_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "%s: Enter.\n", __func__); /* Create driver private-data struct */ - drvdata = devm_kzalloc(&pdev->dev, sizeof(struct ab8500_codec_drvdata), - GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, struct ab8500_codec_drvdata); if (!drvdata) return -ENOMEM; dev_set_drvdata(&pdev->dev, drvdata); diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c index dbea83bd49b6..c524abb456ba 100644 --- a/sound/soc/codecs/ad1836.c +++ b/sound/soc/codecs/ad1836.c @@ -372,8 +372,7 @@ static int ad1836_spi_probe(struct spi_device *spi) struct ad1836_priv *ad1836; int ret; - ad1836 = devm_kzalloc(&spi->dev, sizeof(struct ad1836_priv), - GFP_KERNEL); + ad1836 = devm_kzalloc_obj(&spi->dev, struct ad1836_priv); if (ad1836 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c index 9841c779b175..1c97ebbfb4ba 100644 --- a/sound/soc/codecs/ad193x.c +++ b/sound/soc/codecs/ad193x.c @@ -548,7 +548,7 @@ int ad193x_probe(struct device *dev, struct regmap *regmap, if (IS_ERR(regmap)) return PTR_ERR(regmap); - ad193x = devm_kzalloc(dev, sizeof(*ad193x), GFP_KERNEL); + ad193x = devm_kzalloc_obj(dev, *ad193x); if (ad193x == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/adau1372.c b/sound/soc/codecs/adau1372.c index 25d7b38c28ad..4c77de53aa36 100644 --- a/sound/soc/codecs/adau1372.c +++ b/sound/soc/codecs/adau1372.c @@ -953,7 +953,7 @@ int adau1372_probe(struct device *dev, struct regmap *regmap, if (IS_ERR(regmap)) return PTR_ERR(regmap); - adau1372 = devm_kzalloc(dev, sizeof(*adau1372), GFP_KERNEL); + adau1372 = devm_kzalloc_obj(dev, *adau1372); if (!adau1372) return -ENOMEM; diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c index aa7d3a4b9f58..47998a7e7730 100644 --- a/sound/soc/codecs/adau1373.c +++ b/sound/soc/codecs/adau1373.c @@ -1568,7 +1568,7 @@ static int adau1373_i2c_probe(struct i2c_client *client) struct gpio_desc *gpiod; int ret; - adau1373 = devm_kzalloc(&client->dev, sizeof(*adau1373), GFP_KERNEL); + adau1373 = devm_kzalloc_obj(&client->dev, *adau1373); if (!adau1373) return -ENOMEM; diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c index 4afbf46ffaa3..6cc89aa802d5 100644 --- a/sound/soc/codecs/adau1701.c +++ b/sound/soc/codecs/adau1701.c @@ -798,7 +798,7 @@ static int adau1701_i2c_probe(struct i2c_client *client) struct device *dev = &client->dev; int ret, i; - adau1701 = devm_kzalloc(dev, sizeof(*adau1701), GFP_KERNEL); + adau1701 = devm_kzalloc_obj(dev, *adau1701); if (!adau1701) return -ENOMEM; diff --git a/sound/soc/codecs/adau17x1.c b/sound/soc/codecs/adau17x1.c index 207189cfd3a6..22349685707b 100644 --- a/sound/soc/codecs/adau17x1.c +++ b/sound/soc/codecs/adau17x1.c @@ -1066,7 +1066,7 @@ int adau17x1_probe(struct device *dev, struct regmap *regmap, if (IS_ERR(regmap)) return PTR_ERR(regmap); - adau = devm_kzalloc(dev, sizeof(*adau), GFP_KERNEL); + adau = devm_kzalloc_obj(dev, *adau); if (!adau) return -ENOMEM; diff --git a/sound/soc/codecs/adau1977.c b/sound/soc/codecs/adau1977.c index b9d985393421..93c90019c3f9 100644 --- a/sound/soc/codecs/adau1977.c +++ b/sound/soc/codecs/adau1977.c @@ -919,7 +919,7 @@ int adau1977_probe(struct device *dev, struct regmap *regmap, if (IS_ERR(regmap)) return PTR_ERR(regmap); - adau1977 = devm_kzalloc(dev, sizeof(*adau1977), GFP_KERNEL); + adau1977 = devm_kzalloc_obj(dev, *adau1977); if (adau1977 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/adau7002.c b/sound/soc/codecs/adau7002.c index c9134e1de0b2..97f54bca1539 100644 --- a/sound/soc/codecs/adau7002.c +++ b/sound/soc/codecs/adau7002.c @@ -41,8 +41,7 @@ static int adau7002_component_probe(struct snd_soc_component *component) { struct adau7002_priv *adau7002; - adau7002 = devm_kzalloc(component->dev, sizeof(*adau7002), - GFP_KERNEL); + adau7002 = devm_kzalloc_obj(component->dev, *adau7002); if (!adau7002) return -ENOMEM; diff --git a/sound/soc/codecs/adau7118.c b/sound/soc/codecs/adau7118.c index 9749299bc7f2..51064b6217d8 100644 --- a/sound/soc/codecs/adau7118.c +++ b/sound/soc/codecs/adau7118.c @@ -546,7 +546,7 @@ int adau7118_probe(struct device *dev, struct regmap *map, bool hw_mode) struct adau7118_data *st; int ret; - st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); + st = devm_kzalloc_obj(dev, *st); if (!st) return -ENOMEM; diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c index e97c72ac9b2b..0f3fb682a2c2 100644 --- a/sound/soc/codecs/adav80x.c +++ b/sound/soc/codecs/adav80x.c @@ -859,7 +859,7 @@ int adav80x_bus_probe(struct device *dev, struct regmap *regmap) if (IS_ERR(regmap)) return PTR_ERR(regmap); - adav80x = devm_kzalloc(dev, sizeof(*adav80x), GFP_KERNEL); + adav80x = devm_kzalloc_obj(dev, *adav80x); if (!adav80x) return -ENOMEM; diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c index 5ebc3afccccf..e23b40e6ed93 100644 --- a/sound/soc/codecs/ak4104.c +++ b/sound/soc/codecs/ak4104.c @@ -280,8 +280,7 @@ static int ak4104_spi_probe(struct spi_device *spi) if (ret < 0) return ret; - ak4104 = devm_kzalloc(&spi->dev, sizeof(struct ak4104_private), - GFP_KERNEL); + ak4104 = devm_kzalloc_obj(&spi->dev, struct ak4104_private); if (ak4104 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/ak4118.c b/sound/soc/codecs/ak4118.c index 2b96b82d4e40..3f960256876b 100644 --- a/sound/soc/codecs/ak4118.c +++ b/sound/soc/codecs/ak4118.c @@ -359,8 +359,7 @@ static int ak4118_i2c_probe(struct i2c_client *i2c) struct ak4118_priv *ak4118; int ret; - ak4118 = devm_kzalloc(&i2c->dev, sizeof(struct ak4118_priv), - GFP_KERNEL); + ak4118 = devm_kzalloc_obj(&i2c->dev, struct ak4118_priv); if (ak4118 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/ak4375.c b/sound/soc/codecs/ak4375.c index 452559d8c97b..28cc41014bd9 100644 --- a/sound/soc/codecs/ak4375.c +++ b/sound/soc/codecs/ak4375.c @@ -501,7 +501,7 @@ static int ak4375_i2c_probe(struct i2c_client *i2c) unsigned int deviceid; int ret, i; - ak4375 = devm_kzalloc(&i2c->dev, sizeof(*ak4375), GFP_KERNEL); + ak4375 = devm_kzalloc_obj(&i2c->dev, *ak4375); if (!ak4375) return -ENOMEM; diff --git a/sound/soc/codecs/ak4458.c b/sound/soc/codecs/ak4458.c index a74be99e877d..11b5e4cc11f8 100644 --- a/sound/soc/codecs/ak4458.c +++ b/sound/soc/codecs/ak4458.c @@ -747,7 +747,7 @@ static int ak4458_i2c_probe(struct i2c_client *i2c) struct ak4458_priv *ak4458; int ret, i; - ak4458 = devm_kzalloc(&i2c->dev, sizeof(*ak4458), GFP_KERNEL); + ak4458 = devm_kzalloc_obj(&i2c->dev, *ak4458); if (!ak4458) return -ENOMEM; diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c index 6cabad4c9f74..66ca753e7651 100644 --- a/sound/soc/codecs/ak4535.c +++ b/sound/soc/codecs/ak4535.c @@ -415,8 +415,7 @@ static int ak4535_i2c_probe(struct i2c_client *i2c) struct ak4535_priv *ak4535; int ret; - ak4535 = devm_kzalloc(&i2c->dev, sizeof(struct ak4535_priv), - GFP_KERNEL); + ak4535 = devm_kzalloc_obj(&i2c->dev, struct ak4535_priv); if (ak4535 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c index be5306d07d40..c1af446ab582 100644 --- a/sound/soc/codecs/ak4613.c +++ b/sound/soc/codecs/ak4613.c @@ -880,7 +880,7 @@ static int ak4613_i2c_probe(struct i2c_client *i2c) if (!regmap_cfg) return -EINVAL; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/ak4619.c b/sound/soc/codecs/ak4619.c index bae8e8b6a430..890830d79aea 100644 --- a/sound/soc/codecs/ak4619.c +++ b/sound/soc/codecs/ak4619.c @@ -889,7 +889,7 @@ static int ak4619_i2c_probe(struct i2c_client *i2c) struct ak4619_priv *ak4619; int ret; - ak4619 = devm_kzalloc(dev, sizeof(*ak4619), GFP_KERNEL); + ak4619 = devm_kzalloc_obj(dev, *ak4619); if (!ak4619) return -ENOMEM; diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index a0de45660b00..b099fd7c9eb2 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -650,7 +650,7 @@ static int ak4642_i2c_probe(struct i2c_client *i2c) if (!drvdata) return dev_err_probe(dev, -EINVAL, "Unknown device type\n"); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/ak5386.c b/sound/soc/codecs/ak5386.c index 933ca90b7e28..e025b8e06961 100644 --- a/sound/soc/codecs/ak5386.c +++ b/sound/soc/codecs/ak5386.c @@ -169,7 +169,7 @@ static int ak5386_probe(struct platform_device *pdev) struct ak5386_priv *priv; int ret, i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/ak5558.c b/sound/soc/codecs/ak5558.c index 0c9cdf9a53bb..f4b3cb6f3c00 100644 --- a/sound/soc/codecs/ak5558.c +++ b/sound/soc/codecs/ak5558.c @@ -439,7 +439,7 @@ static int ak5558_i2c_probe(struct i2c_client *i2c) int dev_id; int i; - ak5558 = devm_kzalloc(&i2c->dev, sizeof(*ak5558), GFP_KERNEL); + ak5558 = devm_kzalloc_obj(&i2c->dev, *ak5558); if (!ak5558) return -ENOMEM; diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c index 96bb1d592772..87eccca3aee7 100644 --- a/sound/soc/codecs/alc5623.c +++ b/sound/soc/codecs/alc5623.c @@ -997,8 +997,7 @@ static int alc5623_i2c_probe(struct i2c_client *client) int ret; u32 val32; - alc5623 = devm_kzalloc(&client->dev, sizeof(struct alc5623_priv), - GFP_KERNEL); + alc5623 = devm_kzalloc_obj(&client->dev, struct alc5623_priv); if (alc5623 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index a5e95f3fc247..d179be43c33b 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -1123,8 +1123,7 @@ static int alc5632_i2c_probe(struct i2c_client *client) unsigned int vid1, vid2; unsigned int matched_id; - alc5632 = devm_kzalloc(&client->dev, - sizeof(struct alc5632_priv), GFP_KERNEL); + alc5632 = devm_kzalloc_obj(&client->dev, struct alc5632_priv); if (alc5632 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/arizona-jack.c b/sound/soc/codecs/arizona-jack.c index 9706c77d5a81..db60ea1aaec8 100644 --- a/sound/soc/codecs/arizona-jack.c +++ b/sound/soc/codecs/arizona-jack.c @@ -1159,8 +1159,7 @@ static int arizona_extcon_get_micd_configs(struct device *dev, goto out; nconfs /= entries_per_config; - micd_configs = devm_kcalloc(dev, nconfs, sizeof(*micd_configs), - GFP_KERNEL); + micd_configs = devm_kzalloc_objs(dev, *micd_configs, nconfs); if (!micd_configs) { ret = -ENOMEM; goto out; diff --git a/sound/soc/codecs/audio-iio-aux.c b/sound/soc/codecs/audio-iio-aux.c index 4ad45511a2a7..82dbba56ec61 100644 --- a/sound/soc/codecs/audio-iio-aux.c +++ b/sound/soc/codecs/audio-iio-aux.c @@ -237,7 +237,7 @@ static int audio_iio_aux_probe(struct platform_device *pdev) if (count < 0) return dev_err_probe(dev, count, "failed to count io-channel-names\n"); - iio_aux = devm_kzalloc(dev, struct_size(iio_aux, chans, count), GFP_KERNEL); + iio_aux = devm_kzalloc_flex(dev, *iio_aux, chans, count); if (!iio_aux) return -ENOMEM; diff --git a/sound/soc/codecs/aw8738.c b/sound/soc/codecs/aw8738.c index 0fe8af160319..5f931d3a0d5b 100644 --- a/sound/soc/codecs/aw8738.c +++ b/sound/soc/codecs/aw8738.c @@ -64,7 +64,7 @@ static int aw8738_probe(struct platform_device *pdev) struct aw8738_priv *aw; int ret; - aw = devm_kzalloc(dev, sizeof(*aw), GFP_KERNEL); + aw = devm_kzalloc_obj(dev, *aw); if (!aw) return -ENOMEM; platform_set_drvdata(pdev, aw); diff --git a/sound/soc/codecs/aw87390.c b/sound/soc/codecs/aw87390.c index 5555c45dffcc..56fc403670d0 100644 --- a/sound/soc/codecs/aw87390.c +++ b/sound/soc/codecs/aw87390.c @@ -261,8 +261,8 @@ static int aw87390_request_firmware_file(struct aw87390 *aw87390) dev_dbg(aw87390->aw_pa->dev, "loaded %s - size: %zu\n", AW87390_ACF_FILE, cont ? cont->size : 0); - aw87390->aw_cfg = devm_kzalloc(aw87390->aw_pa->dev, - struct_size(aw87390->aw_cfg, data, cont->size), GFP_KERNEL); + aw87390->aw_cfg = devm_kzalloc_flex(aw87390->aw_pa->dev, + *aw87390->aw_cfg, data, cont->size); if (!aw87390->aw_cfg) return -ENOMEM; @@ -488,7 +488,7 @@ static int aw87390_init(struct aw87390 *aw87390, struct i2c_client *i2c, struct unsigned int chip_id; int ret; - aw_dev = devm_kzalloc(&i2c->dev, sizeof(*aw_dev), GFP_KERNEL); + aw_dev = devm_kzalloc_obj(&i2c->dev, *aw_dev); if (!aw_dev) return -ENOMEM; @@ -540,7 +540,7 @@ static int aw87390_i2c_probe(struct i2c_client *i2c) if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C)) return dev_err_probe(&i2c->dev, -ENXIO, "check_functionality failed\n"); - aw87390 = devm_kzalloc(&i2c->dev, sizeof(*aw87390), GFP_KERNEL); + aw87390 = devm_kzalloc_obj(&i2c->dev, *aw87390); if (!aw87390) return -ENOMEM; diff --git a/sound/soc/codecs/aw88081.c b/sound/soc/codecs/aw88081.c index 3247ba5c71b8..3bb59ca701fa 100644 --- a/sound/soc/codecs/aw88081.c +++ b/sound/soc/codecs/aw88081.c @@ -1080,7 +1080,7 @@ static int aw88081_init(struct aw88081 *aw88081, struct i2c_client *i2c, struct return -ENXIO; } - aw_dev = devm_kzalloc(&i2c->dev, sizeof(*aw_dev), GFP_KERNEL); + aw_dev = devm_kzalloc_obj(&i2c->dev, *aw_dev); if (!aw_dev) return -ENOMEM; @@ -1146,7 +1146,8 @@ static int aw88081_request_firmware_file(struct aw88081 *aw88081) dev_dbg(aw88081->aw_pa->dev, "loaded %s - size: %zu\n", AW88081_ACF_FILE, cont ? cont->size : 0); - aw_cfg = devm_kzalloc(aw88081->aw_pa->dev, struct_size(aw_cfg, data, cont->size), GFP_KERNEL); + aw_cfg = devm_kzalloc_flex(aw88081->aw_pa->dev, *aw_cfg, data, + cont->size); if (!aw_cfg) return -ENOMEM; @@ -1251,7 +1252,7 @@ static int aw88081_i2c_probe(struct i2c_client *i2c) if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C)) return dev_err_probe(&i2c->dev, -ENXIO, "check_functionality failed"); - aw88081 = devm_kzalloc(&i2c->dev, sizeof(*aw88081), GFP_KERNEL); + aw88081 = devm_kzalloc_obj(&i2c->dev, *aw88081); if (!aw88081) return -ENOMEM; diff --git a/sound/soc/codecs/aw88166.c b/sound/soc/codecs/aw88166.c index d2a138211c59..a520c9089425 100644 --- a/sound/soc/codecs/aw88166.c +++ b/sound/soc/codecs/aw88166.c @@ -1588,8 +1588,8 @@ static int aw88166_request_firmware_file(struct aw88166 *aw88166) dev_dbg(aw88166->aw_pa->dev, "loaded %s - size: %zu\n", fw_name, cont ? cont->size : 0); - aw88166->aw_cfg = devm_kzalloc(aw88166->aw_pa->dev, - struct_size(aw88166->aw_cfg, data, cont->size), GFP_KERNEL); + aw88166->aw_cfg = devm_kzalloc_flex(aw88166->aw_pa->dev, + *aw88166->aw_cfg, data, cont->size); if (!aw88166->aw_cfg) return -ENOMEM; @@ -1731,7 +1731,7 @@ static int aw88166_init(struct aw88166 *aw88166, struct i2c_client *i2c, struct return ret; } - aw_dev = devm_kzalloc(&i2c->dev, sizeof(*aw_dev), GFP_KERNEL); + aw_dev = devm_kzalloc_obj(&i2c->dev, *aw_dev); if (!aw_dev) return -ENOMEM; aw88166->aw_pa = aw_dev; @@ -1765,7 +1765,7 @@ static int aw88166_i2c_probe(struct i2c_client *i2c) if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C)) return dev_err_probe(&i2c->dev, -ENXIO, "check_functionality failed\n"); - aw88166 = devm_kzalloc(&i2c->dev, sizeof(*aw88166), GFP_KERNEL); + aw88166 = devm_kzalloc_obj(&i2c->dev, *aw88166); if (!aw88166) return -ENOMEM; diff --git a/sound/soc/codecs/aw88261.c b/sound/soc/codecs/aw88261.c index 7303dc9eb4e0..e14df93e67f7 100644 --- a/sound/soc/codecs/aw88261.c +++ b/sound/soc/codecs/aw88261.c @@ -1197,7 +1197,8 @@ static int aw88261_request_firmware_file(struct aw88261 *aw88261) dev_info(aw88261->aw_pa->dev, "loaded %s - size: %zu\n", fw_name, cont ? cont->size : 0); - aw_cfg = devm_kzalloc(aw88261->aw_pa->dev, struct_size(aw_cfg, data, cont->size), GFP_KERNEL); + aw_cfg = devm_kzalloc_flex(aw88261->aw_pa->dev, *aw_cfg, data, + cont->size); if (!aw_cfg) return -ENOMEM; @@ -1290,7 +1291,7 @@ static int aw88261_init(struct aw88261 *aw88261, struct i2c_client *i2c, struct dev_info(&i2c->dev, "chip id = %x\n", chip_id); - aw_dev = devm_kzalloc(&i2c->dev, sizeof(*aw_dev), GFP_KERNEL); + aw_dev = devm_kzalloc_obj(&i2c->dev, *aw_dev); if (!aw_dev) return -ENOMEM; @@ -1320,7 +1321,7 @@ static int aw88261_i2c_probe(struct i2c_client *i2c) if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C)) return dev_err_probe(&i2c->dev, -ENXIO, "check_functionality failed"); - aw88261 = devm_kzalloc(&i2c->dev, sizeof(*aw88261), GFP_KERNEL); + aw88261 = devm_kzalloc_obj(&i2c->dev, *aw88261); if (!aw88261) return -ENOMEM; diff --git a/sound/soc/codecs/aw88395/aw88395.c b/sound/soc/codecs/aw88395/aw88395.c index 2f4108624d13..751908bf9291 100644 --- a/sound/soc/codecs/aw88395/aw88395.c +++ b/sound/soc/codecs/aw88395/aw88395.c @@ -435,8 +435,7 @@ static const struct snd_soc_component_driver soc_codec_dev_aw88395 = { static struct aw88395 *aw88395_malloc_init(struct i2c_client *i2c) { - struct aw88395 *aw88395 = devm_kzalloc(&i2c->dev, - sizeof(struct aw88395), GFP_KERNEL); + struct aw88395 *aw88395 = devm_kzalloc_obj(&i2c->dev, struct aw88395); if (!aw88395) return NULL; @@ -472,7 +471,8 @@ static int aw88395_request_firmware_file(struct aw88395 *aw88395) dev_info(aw88395->aw_pa->dev, "loaded %s - size: %zu\n", AW88395_ACF_FILE, cont ? cont->size : 0); - aw_cfg = devm_kzalloc(aw88395->aw_pa->dev, struct_size(aw_cfg, data, cont->size), GFP_KERNEL); + aw_cfg = devm_kzalloc_flex(aw88395->aw_pa->dev, *aw_cfg, data, + cont->size); if (!aw_cfg) return -ENOMEM; diff --git a/sound/soc/codecs/aw88395/aw88395_device.c b/sound/soc/codecs/aw88395/aw88395_device.c index 12d42d27560d..3ae418c8b34e 100644 --- a/sound/soc/codecs/aw88395/aw88395_device.c +++ b/sound/soc/codecs/aw88395/aw88395_device.c @@ -1674,7 +1674,7 @@ int aw88395_init(struct aw_device **aw_dev, struct i2c_client *i2c, struct regma if (*aw_dev) { dev_info(&i2c->dev, "it should be initialized here.\n"); } else { - *aw_dev = devm_kzalloc(&i2c->dev, sizeof(struct aw_device), GFP_KERNEL); + *aw_dev = devm_kzalloc_obj(&i2c->dev, struct aw_device); if (!(*aw_dev)) return -ENOMEM; } diff --git a/sound/soc/codecs/aw88395/aw88395_lib.c b/sound/soc/codecs/aw88395/aw88395_lib.c index 056adbcd1ce8..7d0cbd3574f1 100644 --- a/sound/soc/codecs/aw88395/aw88395_lib.c +++ b/sound/soc/codecs/aw88395/aw88395_lib.c @@ -579,9 +579,9 @@ static int aw_dev_cfg_get_reg_valid_prof(struct aw_device *aw_dev, return -EPERM; } - prof_info->prof_desc = devm_kcalloc(aw_dev->dev, - prof_info->count, sizeof(struct aw_prof_desc), - GFP_KERNEL); + prof_info->prof_desc = devm_kzalloc_objs(aw_dev->dev, + struct aw_prof_desc, + prof_info->count); if (!prof_info->prof_desc) return -ENOMEM; @@ -630,9 +630,9 @@ static int aw_dev_cfg_get_multiple_valid_prof(struct aw_device *aw_dev, return -EPERM; } - prof_info->prof_desc = devm_kcalloc(aw_dev->dev, - prof_info->count, sizeof(struct aw_prof_desc), - GFP_KERNEL); + prof_info->prof_desc = devm_kzalloc_objs(aw_dev->dev, + struct aw_prof_desc, + prof_info->count); if (!prof_info->prof_desc) return -ENOMEM; @@ -965,9 +965,9 @@ static int aw_dev_load_cfg_by_hdr_v1(struct aw_device *aw_dev, return ret; } - prof_info->prof_desc = devm_kcalloc(aw_dev->dev, - prof_info->count, sizeof(struct aw_prof_desc), - GFP_KERNEL); + prof_info->prof_desc = devm_kzalloc_objs(aw_dev->dev, + struct aw_prof_desc, + prof_info->count); if (!prof_info->prof_desc) return -ENOMEM; diff --git a/sound/soc/codecs/aw88399-lib.c b/sound/soc/codecs/aw88399-lib.c index b4e8aae56805..1b791c04c064 100644 --- a/sound/soc/codecs/aw88399-lib.c +++ b/sound/soc/codecs/aw88399-lib.c @@ -1300,8 +1300,8 @@ int aw88399_request_firmware_file(struct aw88399 *aw88399, const char *fw_name) dev_dbg(aw88399->aw_pa->dev, "loaded %s - size: %zu\n", fw_name, cont ? cont->size : 0); - aw88399->aw_cfg = devm_kzalloc(aw88399->aw_pa->dev, - struct_size(aw88399->aw_cfg, data, cont->size), GFP_KERNEL); + aw88399->aw_cfg = devm_kzalloc_flex(aw88399->aw_pa->dev, + *aw88399->aw_cfg, data, cont->size); if (!aw88399->aw_cfg) return -ENOMEM; @@ -1376,7 +1376,7 @@ int aw88399_init(struct aw88399 *aw88399, struct i2c_client *i2c, struct regmap } dev_dbg(&i2c->dev, "chip id = %x\n", chip_id); - aw_dev = devm_kzalloc(&i2c->dev, sizeof(*aw_dev), GFP_KERNEL); + aw_dev = devm_kzalloc_obj(&i2c->dev, *aw_dev); if (!aw_dev) return -ENOMEM; aw88399->aw_pa = aw_dev; diff --git a/sound/soc/codecs/aw88399.c b/sound/soc/codecs/aw88399.c index 320dc1b87841..4f162d3dc259 100644 --- a/sound/soc/codecs/aw88399.c +++ b/sound/soc/codecs/aw88399.c @@ -760,7 +760,7 @@ static int aw88399_i2c_probe(struct i2c_client *i2c) if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C)) return dev_err_probe(&i2c->dev, -ENXIO, "check_functionality failed"); - aw88399 = devm_kzalloc(&i2c->dev, sizeof(*aw88399), GFP_KERNEL); + aw88399 = devm_kzalloc_obj(&i2c->dev, *aw88399); if (!aw88399) return -ENOMEM; diff --git a/sound/soc/codecs/bd28623.c b/sound/soc/codecs/bd28623.c index 07e7bd79c8b0..2c454de1bfda 100644 --- a/sound/soc/codecs/bd28623.c +++ b/sound/soc/codecs/bd28623.c @@ -182,7 +182,7 @@ static int bd28623_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int i, ret; - bd = devm_kzalloc(&pdev->dev, sizeof(struct bd28623_priv), GFP_KERNEL); + bd = devm_kzalloc_obj(&pdev->dev, struct bd28623_priv); if (!bd) return -ENOMEM; diff --git a/sound/soc/codecs/cpcap.c b/sound/soc/codecs/cpcap.c index eaaf141dea57..d3348fee0aaa 100644 --- a/sound/soc/codecs/cpcap.c +++ b/sound/soc/codecs/cpcap.c @@ -1763,7 +1763,7 @@ static int cpcap_codec_probe(struct platform_device *pdev) pdev->dev.of_node = codec_node; - cpcap = devm_kzalloc(&pdev->dev, sizeof(*cpcap), GFP_KERNEL); + cpcap = devm_kzalloc_obj(&pdev->dev, *cpcap); if (!cpcap) return -ENOMEM; diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c index 1148e37e29ce..b6f7016a324a 100644 --- a/sound/soc/codecs/cros_ec_codec.c +++ b/sound/soc/codecs/cros_ec_codec.c @@ -971,7 +971,7 @@ static int cros_ec_codec_platform_probe(struct platform_device *pdev) const __be32 *regaddr_p; #endif - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/cs35l32.c b/sound/soc/codecs/cs35l32.c index 8288fb6d50be..bb2d1046cd7f 100644 --- a/sound/soc/codecs/cs35l32.c +++ b/sound/soc/codecs/cs35l32.c @@ -352,7 +352,7 @@ static int cs35l32_i2c_probe(struct i2c_client *i2c_client) int ret, i, devid; unsigned int reg; - cs35l32 = devm_kzalloc(&i2c_client->dev, sizeof(*cs35l32), GFP_KERNEL); + cs35l32 = devm_kzalloc_obj(&i2c_client->dev, *cs35l32); if (!cs35l32) return -ENOMEM; @@ -368,8 +368,7 @@ static int cs35l32_i2c_probe(struct i2c_client *i2c_client) if (pdata) { cs35l32->pdata = *pdata; } else { - pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), - GFP_KERNEL); + pdata = devm_kzalloc_obj(&i2c_client->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/sound/soc/codecs/cs35l33.c b/sound/soc/codecs/cs35l33.c index b8c19f175701..40a3a7449a66 100644 --- a/sound/soc/codecs/cs35l33.c +++ b/sound/soc/codecs/cs35l33.c @@ -1130,8 +1130,7 @@ static int cs35l33_i2c_probe(struct i2c_client *i2c_client) int ret, devid, i; unsigned int reg; - cs35l33 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs35l33_private), - GFP_KERNEL); + cs35l33 = devm_kzalloc_obj(&i2c_client->dev, struct cs35l33_private); if (!cs35l33) return -ENOMEM; diff --git a/sound/soc/codecs/cs35l34.c b/sound/soc/codecs/cs35l34.c index a72be629a31e..26ac3c2d6e9c 100644 --- a/sound/soc/codecs/cs35l34.c +++ b/sound/soc/codecs/cs35l34.c @@ -980,7 +980,7 @@ static int cs35l34_i2c_probe(struct i2c_client *i2c_client) int ret; unsigned int reg; - cs35l34 = devm_kzalloc(&i2c_client->dev, sizeof(*cs35l34), GFP_KERNEL); + cs35l34 = devm_kzalloc_obj(&i2c_client->dev, *cs35l34); if (!cs35l34) return -ENOMEM; @@ -1016,8 +1016,7 @@ static int cs35l34_i2c_probe(struct i2c_client *i2c_client) if (pdata) { cs35l34->pdata = *pdata; } else { - pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), - GFP_KERNEL); + pdata = devm_kzalloc_obj(&i2c_client->dev, *pdata); if (!pdata) { ret = -ENOMEM; goto err_regulator; diff --git a/sound/soc/codecs/cs35l35.c b/sound/soc/codecs/cs35l35.c index 302d838f4c44..33b6bca40723 100644 --- a/sound/soc/codecs/cs35l35.c +++ b/sound/soc/codecs/cs35l35.c @@ -1478,7 +1478,7 @@ static int cs35l35_i2c_probe(struct i2c_client *i2c_client) int ret; unsigned int reg; - cs35l35 = devm_kzalloc(dev, sizeof(struct cs35l35_private), GFP_KERNEL); + cs35l35 = devm_kzalloc_obj(dev, struct cs35l35_private); if (!cs35l35) return -ENOMEM; @@ -1507,8 +1507,7 @@ static int cs35l35_i2c_probe(struct i2c_client *i2c_client) if (pdata) { cs35l35->pdata = *pdata; } else { - pdata = devm_kzalloc(dev, sizeof(struct cs35l35_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, struct cs35l35_platform_data); if (!pdata) return -ENOMEM; if (i2c_client->dev.of_node) { diff --git a/sound/soc/codecs/cs35l36.c b/sound/soc/codecs/cs35l36.c index 5fc8ec292e3c..58a5c04e39a1 100644 --- a/sound/soc/codecs/cs35l36.c +++ b/sound/soc/codecs/cs35l36.c @@ -1751,7 +1751,7 @@ static int cs35l36_i2c_probe(struct i2c_client *i2c_client) int ret, irq_pol, chip_irq_pol, i; u32 reg_id, reg_revid, l37_id_reg; - cs35l36 = devm_kzalloc(dev, sizeof(struct cs35l36_private), GFP_KERNEL); + cs35l36 = devm_kzalloc_obj(dev, struct cs35l36_private); if (!cs35l36) return -ENOMEM; @@ -1779,8 +1779,7 @@ static int cs35l36_i2c_probe(struct i2c_client *i2c_client) if (pdata) { cs35l36->pdata = *pdata; } else { - pdata = devm_kzalloc(dev, sizeof(struct cs35l36_platform_data), - GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, struct cs35l36_platform_data); if (!pdata) return -ENOMEM; diff --git a/sound/soc/codecs/cs35l41-i2c.c b/sound/soc/codecs/cs35l41-i2c.c index 23f59f3025bd..4b19b3063ca4 100644 --- a/sound/soc/codecs/cs35l41-i2c.c +++ b/sound/soc/codecs/cs35l41-i2c.c @@ -36,7 +36,7 @@ static int cs35l41_i2c_probe(struct i2c_client *client) struct cs35l41_hw_cfg *hw_cfg = dev_get_platdata(dev); const struct regmap_config *regmap_config = &cs35l41_regmap_i2c; - cs35l41 = devm_kzalloc(dev, sizeof(struct cs35l41_private), GFP_KERNEL); + cs35l41 = devm_kzalloc_obj(dev, struct cs35l41_private); if (!cs35l41) return -ENOMEM; diff --git a/sound/soc/codecs/cs35l41-spi.c b/sound/soc/codecs/cs35l41-spi.c index f9b6bf7bea9c..b1be68441287 100644 --- a/sound/soc/codecs/cs35l41-spi.c +++ b/sound/soc/codecs/cs35l41-spi.c @@ -34,7 +34,7 @@ static int cs35l41_spi_probe(struct spi_device *spi) struct cs35l41_private *cs35l41; int ret; - cs35l41 = devm_kzalloc(&spi->dev, sizeof(struct cs35l41_private), GFP_KERNEL); + cs35l41 = devm_kzalloc_obj(&spi->dev, struct cs35l41_private); if (!cs35l41) return -ENOMEM; diff --git a/sound/soc/codecs/cs35l45-i2c.c b/sound/soc/codecs/cs35l45-i2c.c index 3eba61e107a5..24d9697f7788 100644 --- a/sound/soc/codecs/cs35l45-i2c.c +++ b/sound/soc/codecs/cs35l45-i2c.c @@ -19,7 +19,7 @@ static int cs35l45_i2c_probe(struct i2c_client *client) struct device *dev = &client->dev; int ret; - cs35l45 = devm_kzalloc(dev, sizeof(struct cs35l45_private), GFP_KERNEL); + cs35l45 = devm_kzalloc_obj(dev, struct cs35l45_private); if (!cs35l45) return -ENOMEM; diff --git a/sound/soc/codecs/cs35l45-spi.c b/sound/soc/codecs/cs35l45-spi.c index 5f91472c3fd2..76f46dc5ab2c 100644 --- a/sound/soc/codecs/cs35l45-spi.c +++ b/sound/soc/codecs/cs35l45-spi.c @@ -19,7 +19,7 @@ static int cs35l45_spi_probe(struct spi_device *spi) struct device *dev = &spi->dev; int ret; - cs35l45 = devm_kzalloc(dev, sizeof(struct cs35l45_private), GFP_KERNEL); + cs35l45 = devm_kzalloc_obj(dev, struct cs35l45_private); if (cs35l45 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/cs35l56-i2c.c b/sound/soc/codecs/cs35l56-i2c.c index 5e69ddbe342a..0fcba61321ec 100644 --- a/sound/soc/codecs/cs35l56-i2c.c +++ b/sound/soc/codecs/cs35l56-i2c.c @@ -23,7 +23,7 @@ static int cs35l56_i2c_probe(struct i2c_client *client) const struct regmap_config *regmap_config; int ret; - cs35l56 = devm_kzalloc(dev, sizeof(struct cs35l56_private), GFP_KERNEL); + cs35l56 = devm_kzalloc_obj(dev, struct cs35l56_private); if (!cs35l56) return -ENOMEM; diff --git a/sound/soc/codecs/cs35l56-sdw.c b/sound/soc/codecs/cs35l56-sdw.c index a49ad69644b5..770a5fcd843f 100644 --- a/sound/soc/codecs/cs35l56-sdw.c +++ b/sound/soc/codecs/cs35l56-sdw.c @@ -269,7 +269,7 @@ static int cs35l56_sdw_read_prop(struct sdw_slave *peripheral) if (ret == 0) prop->clk_stop_mode1 = !!clock_stop_1; - ports = devm_kcalloc(cs35l56->base.dev, 3, sizeof(*ports), GFP_KERNEL); + ports = devm_kzalloc_objs(cs35l56->base.dev, *ports, 3); if (!ports) return -ENOMEM; @@ -428,7 +428,7 @@ static int cs35l56_sdw_probe(struct sdw_slave *peripheral, const struct sdw_devi const struct regmap_config *regmap_config; int ret; - cs35l56 = devm_kzalloc(dev, sizeof(*cs35l56), GFP_KERNEL); + cs35l56 = devm_kzalloc_obj(dev, *cs35l56); if (!cs35l56) return -ENOMEM; diff --git a/sound/soc/codecs/cs35l56-shared-test.c b/sound/soc/codecs/cs35l56-shared-test.c index 34bb3d44b51f..f33b4c943ac8 100644 --- a/sound/soc/codecs/cs35l56-shared-test.c +++ b/sound/soc/codecs/cs35l56-shared-test.c @@ -91,7 +91,7 @@ static int cs35l56_shared_test_mock_gpio_probe(struct faux_device *fdev) struct device *dev = &fdev->dev; int ret; - gpio_priv = devm_kzalloc(dev, sizeof(*gpio_priv), GFP_KERNEL); + gpio_priv = devm_kzalloc_obj(dev, *gpio_priv); if (!gpio_priv) return -ENOMEM; diff --git a/sound/soc/codecs/cs35l56-spi.c b/sound/soc/codecs/cs35l56-spi.c index 21b18da9e73d..9be173184a9d 100644 --- a/sound/soc/codecs/cs35l56-spi.c +++ b/sound/soc/codecs/cs35l56-spi.c @@ -20,7 +20,7 @@ static int cs35l56_spi_probe(struct spi_device *spi) struct cs35l56_private *cs35l56; int ret; - cs35l56 = devm_kzalloc(&spi->dev, sizeof(struct cs35l56_private), GFP_KERNEL); + cs35l56 = devm_kzalloc_obj(&spi->dev, struct cs35l56_private); if (!cs35l56) return -ENOMEM; diff --git a/sound/soc/codecs/cs40l50-codec.c b/sound/soc/codecs/cs40l50-codec.c index 698aa59194f4..bae3a56684c3 100644 --- a/sound/soc/codecs/cs40l50-codec.c +++ b/sound/soc/codecs/cs40l50-codec.c @@ -285,7 +285,7 @@ static int cs40l50_codec_driver_probe(struct platform_device *pdev) struct cs40l50 *cs40l50 = dev_get_drvdata(pdev->dev.parent); struct cs40l50_codec *codec; - codec = devm_kzalloc(&pdev->dev, sizeof(*codec), GFP_KERNEL); + codec = devm_kzalloc_obj(&pdev->dev, *codec); if (!codec) return -ENOMEM; diff --git a/sound/soc/codecs/cs4234.c b/sound/soc/codecs/cs4234.c index a6ead1ee3708..64a19ae220ab 100644 --- a/sound/soc/codecs/cs4234.c +++ b/sound/soc/codecs/cs4234.c @@ -749,7 +749,7 @@ static int cs4234_i2c_probe(struct i2c_client *i2c_client) uint8_t ids[3]; int ret = 0, i; - cs4234 = devm_kzalloc(dev, sizeof(*cs4234), GFP_KERNEL); + cs4234 = devm_kzalloc_obj(dev, *cs4234); if (!cs4234) return -ENOMEM; i2c_set_clientdata(i2c_client, cs4234); diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c index 97e32e6ccb84..50a31770f893 100644 --- a/sound/soc/codecs/cs4265.c +++ b/sound/soc/codecs/cs4265.c @@ -586,8 +586,7 @@ static int cs4265_i2c_probe(struct i2c_client *i2c_client) unsigned int devid = 0; unsigned int reg; - cs4265 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs4265_private), - GFP_KERNEL); + cs4265 = devm_kzalloc_obj(&i2c_client->dev, struct cs4265_private); if (cs4265 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index aa3bbb951945..d1fe69670a7e 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c @@ -673,8 +673,7 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client) unsigned int val; int ret, i; - cs4270 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs4270_private), - GFP_KERNEL); + cs4270 = devm_kzalloc_obj(&i2c_client->dev, struct cs4270_private); if (!cs4270) return -ENOMEM; diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c index 398d8c24a9ce..06f1dd251aa1 100644 --- a/sound/soc/codecs/cs4271.c +++ b/sound/soc/codecs/cs4271.c @@ -672,7 +672,7 @@ static int cs4271_common_probe(struct device *dev, struct cs4271_private *cs4271; int i, ret; - cs4271 = devm_kzalloc(dev, sizeof(*cs4271), GFP_KERNEL); + cs4271 = devm_kzalloc_obj(dev, *cs4271); if (!cs4271) return -ENOMEM; diff --git a/sound/soc/codecs/cs42l42-i2c.c b/sound/soc/codecs/cs42l42-i2c.c index c0942f28723b..6210fa0f3e4b 100644 --- a/sound/soc/codecs/cs42l42-i2c.c +++ b/sound/soc/codecs/cs42l42-i2c.c @@ -20,7 +20,7 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client) struct regmap *regmap; int ret; - cs42l42 = devm_kzalloc(dev, sizeof(*cs42l42), GFP_KERNEL); + cs42l42 = devm_kzalloc_obj(dev, *cs42l42); if (!cs42l42) return -ENOMEM; diff --git a/sound/soc/codecs/cs42l42-sdw.c b/sound/soc/codecs/cs42l42-sdw.c index b61ca74dcf0b..58adba2cd431 100644 --- a/sound/soc/codecs/cs42l42-sdw.c +++ b/sound/soc/codecs/cs42l42-sdw.c @@ -312,7 +312,7 @@ static int cs42l42_sdw_read_prop(struct sdw_slave *peripheral) struct sdw_slave_prop *prop = &peripheral->prop; struct sdw_dpn_prop *ports; - ports = devm_kcalloc(cs42l42->dev, 2, sizeof(*ports), GFP_KERNEL); + ports = devm_kzalloc_objs(cs42l42->dev, *ports, 2); if (!ports) return -ENOMEM; @@ -528,7 +528,7 @@ static int cs42l42_sdw_probe(struct sdw_slave *peripheral, const struct sdw_devi struct regmap *regmap; int irq, ret; - cs42l42 = devm_kzalloc(dev, sizeof(*cs42l42), GFP_KERNEL); + cs42l42 = devm_kzalloc_obj(dev, *cs42l42); if (!cs42l42) return -ENOMEM; diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c index b6238f89c789..52f9dd4c906d 100644 --- a/sound/soc/codecs/cs42l43.c +++ b/sound/soc/codecs/cs42l43.c @@ -2783,7 +2783,7 @@ static int cs42l43_codec_probe(struct platform_device *pdev) unsigned int val; int i, ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index 4b964c713398..a0d872f14a54 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c @@ -723,8 +723,7 @@ int cs42l51_probe(struct device *dev, struct regmap *regmap) if (IS_ERR(regmap)) return PTR_ERR(regmap); - cs42l51 = devm_kzalloc(dev, sizeof(struct cs42l51_private), - GFP_KERNEL); + cs42l51 = devm_kzalloc_obj(dev, struct cs42l51_private); if (!cs42l51) return -ENOMEM; diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c index 1d3334886402..1a9e512f4da7 100644 --- a/sound/soc/codecs/cs42l52.c +++ b/sound/soc/codecs/cs42l52.c @@ -1132,7 +1132,7 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client) unsigned int reg; u32 val32; - cs42l52 = devm_kzalloc(&i2c_client->dev, sizeof(*cs42l52), GFP_KERNEL); + cs42l52 = devm_kzalloc_obj(&i2c_client->dev, *cs42l52); if (cs42l52 == NULL) return -ENOMEM; cs42l52->dev = &i2c_client->dev; @@ -1144,7 +1144,7 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client) return ret; } - pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&i2c_client->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/sound/soc/codecs/cs42l56.c b/sound/soc/codecs/cs42l56.c index ecce51985a11..b4a85e7fdd70 100644 --- a/sound/soc/codecs/cs42l56.c +++ b/sound/soc/codecs/cs42l56.c @@ -1225,7 +1225,7 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client) unsigned int alpha_rev, metal_rev; unsigned int reg; - cs42l56 = devm_kzalloc(&i2c_client->dev, sizeof(*cs42l56), GFP_KERNEL); + cs42l56 = devm_kzalloc_obj(&i2c_client->dev, *cs42l56); if (cs42l56 == NULL) return -ENOMEM; cs42l56->dev = &i2c_client->dev; diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 72c4213ed74b..a54d55a221af 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -1296,7 +1296,7 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client) unsigned int reg; u32 val32; - cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(*cs42l73), GFP_KERNEL); + cs42l73 = devm_kzalloc_obj(&i2c_client->dev, *cs42l73); if (!cs42l73) return -ENOMEM; @@ -1307,7 +1307,7 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client) return ret; } - pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&i2c_client->dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/sound/soc/codecs/cs42l83-i2c.c b/sound/soc/codecs/cs42l83-i2c.c index 53a7fe1ab3dd..3d52f42bf991 100644 --- a/sound/soc/codecs/cs42l83-i2c.c +++ b/sound/soc/codecs/cs42l83-i2c.c @@ -171,7 +171,7 @@ static int cs42l83_i2c_probe(struct i2c_client *i2c_client) struct regmap *regmap; int ret; - cs42l83 = devm_kzalloc(dev, sizeof(*cs42l83), GFP_KERNEL); + cs42l83 = devm_kzalloc_obj(dev, *cs42l83); if (!cs42l83) return -ENOMEM; diff --git a/sound/soc/codecs/cs42l84.c b/sound/soc/codecs/cs42l84.c index 77015590368b..45f6390dbd05 100644 --- a/sound/soc/codecs/cs42l84.c +++ b/sound/soc/codecs/cs42l84.c @@ -988,8 +988,7 @@ static int cs42l84_i2c_probe(struct i2c_client *i2c_client) int ret, devid; unsigned int reg; - cs42l84 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l84_private), - GFP_KERNEL); + cs42l84 = devm_kzalloc_obj(&i2c_client->dev, struct cs42l84_private); if (!cs42l84) return -ENOMEM; diff --git a/sound/soc/codecs/cs42xx8.c b/sound/soc/codecs/cs42xx8.c index fb9f4aff6bd8..94860e2802fe 100644 --- a/sound/soc/codecs/cs42xx8.c +++ b/sound/soc/codecs/cs42xx8.c @@ -551,7 +551,7 @@ int cs42xx8_probe(struct device *dev, struct regmap *regmap, struct cs42xx8_driv return ret; } - cs42xx8 = devm_kzalloc(dev, sizeof(*cs42xx8), GFP_KERNEL); + cs42xx8 = devm_kzalloc_obj(dev, *cs42xx8); if (cs42xx8 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c index 7bbb2e83a1ff..9ab4a497a3cc 100644 --- a/sound/soc/codecs/cs43130.c +++ b/sound/soc/codecs/cs43130.c @@ -2513,7 +2513,7 @@ static int cs43130_i2c_probe(struct i2c_client *client) unsigned int reg; int i, devid; - cs43130 = devm_kzalloc(&client->dev, sizeof(*cs43130), GFP_KERNEL); + cs43130 = devm_kzalloc_obj(&client->dev, *cs43130); if (!cs43130) return -ENOMEM; diff --git a/sound/soc/codecs/cs4341.c b/sound/soc/codecs/cs4341.c index 74544c58a415..e59f571c4b62 100644 --- a/sound/soc/codecs/cs4341.c +++ b/sound/soc/codecs/cs4341.c @@ -236,7 +236,7 @@ static int cs4341_i2c_probe(struct i2c_client *i2c) { struct cs4341_priv *cs4341; - cs4341 = devm_kzalloc(&i2c->dev, sizeof(*cs4341), GFP_KERNEL); + cs4341 = devm_kzalloc_obj(&i2c->dev, *cs4341); if (!cs4341) return -ENOMEM; @@ -282,7 +282,7 @@ static int cs4341_spi_probe(struct spi_device *spi) struct cs4341_priv *cs4341; int ret; - cs4341 = devm_kzalloc(&spi->dev, sizeof(*cs4341), GFP_KERNEL); + cs4341 = devm_kzalloc_obj(&spi->dev, *cs4341); if (!cs4341) return -ENOMEM; diff --git a/sound/soc/codecs/cs4349.c b/sound/soc/codecs/cs4349.c index 28320951e309..b56fb4a57c12 100644 --- a/sound/soc/codecs/cs4349.c +++ b/sound/soc/codecs/cs4349.c @@ -289,7 +289,7 @@ static int cs4349_i2c_probe(struct i2c_client *client) struct cs4349_private *cs4349; int ret; - cs4349 = devm_kzalloc(&client->dev, sizeof(*cs4349), GFP_KERNEL); + cs4349 = devm_kzalloc_obj(&client->dev, *cs4349); if (!cs4349) return -ENOMEM; diff --git a/sound/soc/codecs/cs47l15.c b/sound/soc/codecs/cs47l15.c index 2f30dd834709..399137424716 100644 --- a/sound/soc/codecs/cs47l15.c +++ b/sound/soc/codecs/cs47l15.c @@ -1374,8 +1374,7 @@ static int cs47l15_probe(struct platform_device *pdev) return -EPROBE_DEFER; } - cs47l15 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l15), - GFP_KERNEL); + cs47l15 = devm_kzalloc_obj(&pdev->dev, struct cs47l15); if (!cs47l15) return -ENOMEM; diff --git a/sound/soc/codecs/cs47l24.c b/sound/soc/codecs/cs47l24.c index 5100b1aac902..fa2d01ead30b 100644 --- a/sound/soc/codecs/cs47l24.c +++ b/sound/soc/codecs/cs47l24.c @@ -1217,8 +1217,7 @@ static int cs47l24_probe(struct platform_device *pdev) BUILD_BUG_ON(ARRAY_SIZE(cs47l24_dai) > ARIZONA_MAX_DAI); - cs47l24 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l24_priv), - GFP_KERNEL); + cs47l24 = devm_kzalloc_obj(&pdev->dev, struct cs47l24_priv); if (!cs47l24) return -ENOMEM; diff --git a/sound/soc/codecs/cs47l35.c b/sound/soc/codecs/cs47l35.c index e77ac7bc8466..46d8a6a7922b 100644 --- a/sound/soc/codecs/cs47l35.c +++ b/sound/soc/codecs/cs47l35.c @@ -1658,7 +1658,7 @@ static int cs47l35_probe(struct platform_device *pdev) return -EPROBE_DEFER; } - cs47l35 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l35), GFP_KERNEL); + cs47l35 = devm_kzalloc_obj(&pdev->dev, struct cs47l35); if (!cs47l35) return -ENOMEM; platform_set_drvdata(pdev, cs47l35); diff --git a/sound/soc/codecs/cs47l85.c b/sound/soc/codecs/cs47l85.c index 9ee60616c04c..46ed6beedfca 100644 --- a/sound/soc/codecs/cs47l85.c +++ b/sound/soc/codecs/cs47l85.c @@ -2602,8 +2602,7 @@ static int cs47l85_probe(struct platform_device *pdev) return -EPROBE_DEFER; } - cs47l85 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l85), - GFP_KERNEL); + cs47l85 = devm_kzalloc_obj(&pdev->dev, struct cs47l85); if (!cs47l85) return -ENOMEM; diff --git a/sound/soc/codecs/cs47l90.c b/sound/soc/codecs/cs47l90.c index 6ce603bfd500..8a381fd3083c 100644 --- a/sound/soc/codecs/cs47l90.c +++ b/sound/soc/codecs/cs47l90.c @@ -2517,8 +2517,7 @@ static int cs47l90_probe(struct platform_device *pdev) return -EPROBE_DEFER; } - cs47l90 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l90), - GFP_KERNEL); + cs47l90 = devm_kzalloc_obj(&pdev->dev, struct cs47l90); if (!cs47l90) return -ENOMEM; diff --git a/sound/soc/codecs/cs47l92.c b/sound/soc/codecs/cs47l92.c index 07bc303d9797..d4013a2e919c 100644 --- a/sound/soc/codecs/cs47l92.c +++ b/sound/soc/codecs/cs47l92.c @@ -1982,7 +1982,7 @@ static int cs47l92_probe(struct platform_device *pdev) return -EPROBE_DEFER; } - cs47l92 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l92), GFP_KERNEL); + cs47l92 = devm_kzalloc_obj(&pdev->dev, struct cs47l92); if (!cs47l92) return -ENOMEM; diff --git a/sound/soc/codecs/cs48l32.c b/sound/soc/codecs/cs48l32.c index c11fc1a588c4..72c4bf9e8be6 100644 --- a/sound/soc/codecs/cs48l32.c +++ b/sound/soc/codecs/cs48l32.c @@ -3910,7 +3910,7 @@ static int cs48l32_spi_probe(struct spi_device *spi) unsigned int hwid, rev, otp_rev; int i, ret; - cs48l32_codec = devm_kzalloc(&spi->dev, sizeof(*cs48l32_codec), GFP_KERNEL); + cs48l32_codec = devm_kzalloc_obj(&spi->dev, *cs48l32_codec); if (!cs48l32_codec) return -ENOMEM; diff --git a/sound/soc/codecs/cs530x-i2c.c b/sound/soc/codecs/cs530x-i2c.c index 98cb61dd88c1..ee5786704909 100644 --- a/sound/soc/codecs/cs530x-i2c.c +++ b/sound/soc/codecs/cs530x-i2c.c @@ -55,7 +55,7 @@ static int cs530x_i2c_probe(struct i2c_client *client) { struct cs530x_priv *cs530x; - cs530x = devm_kzalloc(&client->dev, sizeof(*cs530x), GFP_KERNEL); + cs530x = devm_kzalloc_obj(&client->dev, *cs530x); if (!cs530x) return -ENOMEM; diff --git a/sound/soc/codecs/cs530x-spi.c b/sound/soc/codecs/cs530x-spi.c index dbf1e7bbec19..2f6784b60b24 100644 --- a/sound/soc/codecs/cs530x-spi.c +++ b/sound/soc/codecs/cs530x-spi.c @@ -56,7 +56,7 @@ static int cs530x_spi_probe(struct spi_device *spi) struct device *dev = &spi->dev; int ret; - cs530x = devm_kzalloc(dev, sizeof(struct cs530x_priv), GFP_KERNEL); + cs530x = devm_kzalloc_obj(dev, struct cs530x_priv); if (cs530x == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/cs53l30.c b/sound/soc/codecs/cs53l30.c index c9c682a312c3..895282c575fd 100644 --- a/sound/soc/codecs/cs53l30.c +++ b/sound/soc/codecs/cs53l30.c @@ -916,7 +916,7 @@ static int cs53l30_i2c_probe(struct i2c_client *client) int ret = 0, i, devid; u8 val; - cs53l30 = devm_kzalloc(dev, sizeof(*cs53l30), GFP_KERNEL); + cs53l30 = devm_kzalloc_obj(dev, *cs53l30); if (!cs53l30) return -ENOMEM; diff --git a/sound/soc/codecs/cx2072x.c b/sound/soc/codecs/cx2072x.c index 5b9e9520ae01..ee6abe6eddca 100644 --- a/sound/soc/codecs/cx2072x.c +++ b/sound/soc/codecs/cx2072x.c @@ -1643,8 +1643,7 @@ static int cx2072x_i2c_probe(struct i2c_client *i2c) unsigned int ven_id, rev_id; int ret; - cx2072x = devm_kzalloc(&i2c->dev, sizeof(struct cx2072x_priv), - GFP_KERNEL); + cx2072x = devm_kzalloc_obj(&i2c->dev, struct cx2072x_priv); if (!cx2072x) return -ENOMEM; diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c index 40d759938edc..a1b9720bf36a 100644 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c @@ -1217,8 +1217,7 @@ static int da7210_i2c_probe(struct i2c_client *i2c) struct da7210_priv *da7210; int ret; - da7210 = devm_kzalloc(&i2c->dev, sizeof(struct da7210_priv), - GFP_KERNEL); + da7210 = devm_kzalloc_obj(&i2c->dev, struct da7210_priv); if (!da7210) return -ENOMEM; @@ -1304,8 +1303,7 @@ static int da7210_spi_probe(struct spi_device *spi) struct da7210_priv *da7210; int ret; - da7210 = devm_kzalloc(&spi->dev, sizeof(struct da7210_priv), - GFP_KERNEL); + da7210 = devm_kzalloc_obj(&spi->dev, struct da7210_priv); if (!da7210) return -ENOMEM; diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c index 4990feaa8259..b08e8ab6b421 100644 --- a/sound/soc/codecs/da7213.c +++ b/sound/soc/codecs/da7213.c @@ -1930,7 +1930,7 @@ static struct da7213_platform_data const char *fw_str; u32 fw_val32; - pdata = devm_kzalloc(component->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(component->dev, *pdata); if (!pdata) return NULL; @@ -2179,7 +2179,7 @@ static int da7213_i2c_probe(struct i2c_client *i2c) struct da7213_priv *da7213; int i, ret; - da7213 = devm_kzalloc(&i2c->dev, sizeof(*da7213), GFP_KERNEL); + da7213 = devm_kzalloc_obj(&i2c->dev, *da7213); if (!da7213) return -ENOMEM; diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c index a538b3dd1635..b333e842eec1 100644 --- a/sound/soc/codecs/da7218.c +++ b/sound/soc/codecs/da7218.c @@ -2452,7 +2452,7 @@ static struct da7218_pdata *da7218_of_to_pdata(struct device *dev, const char *of_str; u32 of_val32; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return NULL; @@ -2520,8 +2520,7 @@ static struct da7218_pdata *da7218_of_to_pdata(struct device *dev, if (!hpldet_np) return pdata; - hpldet_pdata = devm_kzalloc(dev, sizeof(*hpldet_pdata), - GFP_KERNEL); + hpldet_pdata = devm_kzalloc_obj(dev, *hpldet_pdata); if (!hpldet_pdata) { of_node_put(hpldet_np); return pdata; @@ -3240,7 +3239,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c) struct da7218_priv *da7218; int i, ret; - da7218 = devm_kzalloc(&i2c->dev, sizeof(*da7218), GFP_KERNEL); + da7218 = devm_kzalloc_obj(&i2c->dev, *da7218); if (!da7218) return -ENOMEM; diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c index 0b3b108aaeee..cdb42b5706c5 100644 --- a/sound/soc/codecs/da7219-aad.c +++ b/sound/soc/codecs/da7219-aad.c @@ -670,7 +670,7 @@ static struct da7219_aad_pdata *da7219_aad_fw_to_pdata(struct device *dev) if (!aad_np) return NULL; - aad_pdata = devm_kzalloc(dev, sizeof(*aad_pdata), GFP_KERNEL); + aad_pdata = devm_kzalloc_obj(dev, *aad_pdata); if (!aad_pdata) { fwnode_handle_put(aad_np); return NULL; @@ -1062,7 +1062,7 @@ int da7219_aad_probe(struct i2c_client *i2c) struct device *dev = &i2c->dev; struct da7219_aad_priv *da7219_aad; - da7219_aad = devm_kzalloc(dev, sizeof(*da7219_aad), GFP_KERNEL); + da7219_aad = devm_kzalloc_obj(dev, *da7219_aad); if (!da7219_aad) return -ENOMEM; diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c index 673285c3213b..e79bafd4ee24 100644 --- a/sound/soc/codecs/da7219.c +++ b/sound/soc/codecs/da7219.c @@ -1758,7 +1758,7 @@ static struct da7219_pdata *da7219_fw_to_pdata(struct device *dev) const char *of_str; u32 of_val32; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return NULL; @@ -2667,8 +2667,7 @@ static int da7219_i2c_probe(struct i2c_client *i2c) struct da7219_priv *da7219; int ret; - da7219 = devm_kzalloc(dev, sizeof(struct da7219_priv), - GFP_KERNEL); + da7219 = devm_kzalloc_obj(dev, struct da7219_priv); if (!da7219) return -ENOMEM; diff --git a/sound/soc/codecs/da732x.c b/sound/soc/codecs/da732x.c index e417c7ada237..62f93fd9083d 100644 --- a/sound/soc/codecs/da732x.c +++ b/sound/soc/codecs/da732x.c @@ -1529,8 +1529,7 @@ static int da732x_i2c_probe(struct i2c_client *i2c) unsigned int reg; int ret; - da732x = devm_kzalloc(&i2c->dev, sizeof(struct da732x_priv), - GFP_KERNEL); + da732x = devm_kzalloc_obj(&i2c->dev, struct da732x_priv); if (!da732x) return -ENOMEM; diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c index faff1535ab12..ff9c50b66b23 100644 --- a/sound/soc/codecs/da9055.c +++ b/sound/soc/codecs/da9055.c @@ -1487,8 +1487,7 @@ static int da9055_i2c_probe(struct i2c_client *i2c) struct da9055_platform_data *pdata = dev_get_platdata(&i2c->dev); int ret; - da9055 = devm_kzalloc(&i2c->dev, sizeof(struct da9055_priv), - GFP_KERNEL); + da9055 = devm_kzalloc_obj(&i2c->dev, struct da9055_priv); if (!da9055) return -ENOMEM; diff --git a/sound/soc/codecs/dmic.c b/sound/soc/codecs/dmic.c index cbed11136935..449e48b52ba3 100644 --- a/sound/soc/codecs/dmic.c +++ b/sound/soc/codecs/dmic.c @@ -108,7 +108,7 @@ static int dmic_component_probe(struct snd_soc_component *component) { struct dmic *dmic; - dmic = devm_kzalloc(component->dev, sizeof(*dmic), GFP_KERNEL); + dmic = devm_kzalloc_obj(component->dev, *dmic); if (!dmic) return -ENOMEM; @@ -179,7 +179,7 @@ static int dmic_dev_probe(struct platform_device *pdev) if (chans < 1 || chans > 8) return -EINVAL; - dai_drv = devm_kzalloc(&pdev->dev, sizeof(*dai_drv), GFP_KERNEL); + dai_drv = devm_kzalloc_obj(&pdev->dev, *dai_drv); if (!dai_drv) return -ENOMEM; diff --git a/sound/soc/codecs/es7134.c b/sound/soc/codecs/es7134.c index e3e6142ca028..f381a42ec423 100644 --- a/sound/soc/codecs/es7134.c +++ b/sound/soc/codecs/es7134.c @@ -281,7 +281,7 @@ static int es7134_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct es7134_data *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; platform_set_drvdata(pdev, priv); diff --git a/sound/soc/codecs/es7241.c b/sound/soc/codecs/es7241.c index a0bd5386387d..76dc2461dd60 100644 --- a/sound/soc/codecs/es7241.c +++ b/sound/soc/codecs/es7241.c @@ -262,7 +262,7 @@ static int es7241_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct es7241_data *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; platform_set_drvdata(pdev, priv); diff --git a/sound/soc/codecs/es8311.c b/sound/soc/codecs/es8311.c index ddbbfc2443b3..0d7cf5fce59c 100644 --- a/sound/soc/codecs/es8311.c +++ b/sound/soc/codecs/es8311.c @@ -950,7 +950,7 @@ static int es8311_i2c_probe(struct i2c_client *i2c_client) struct device *dev = &i2c_client->dev; - es8311 = devm_kzalloc(dev, sizeof(*es8311), GFP_KERNEL); + es8311 = devm_kzalloc_obj(dev, *es8311); if (es8311 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c index ded36a43065a..334ac9119c18 100644 --- a/sound/soc/codecs/es8316.c +++ b/sound/soc/codecs/es8316.c @@ -866,8 +866,7 @@ static int es8316_i2c_probe(struct i2c_client *i2c_client) struct es8316_priv *es8316; int ret; - es8316 = devm_kzalloc(&i2c_client->dev, sizeof(struct es8316_priv), - GFP_KERNEL); + es8316 = devm_kzalloc_obj(&i2c_client->dev, struct es8316_priv); if (es8316 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/es8323.c b/sound/soc/codecs/es8323.c index 6a8d3902af23..4cd9ddc48412 100644 --- a/sound/soc/codecs/es8323.c +++ b/sound/soc/codecs/es8323.c @@ -772,7 +772,7 @@ static int es8323_i2c_probe(struct i2c_client *i2c_client) struct es8323_priv *es8323; struct device *dev = &i2c_client->dev; - es8323 = devm_kzalloc(dev, sizeof(*es8323), GFP_KERNEL); + es8323 = devm_kzalloc_obj(dev, *es8323); if (!es8323) return -ENOMEM; diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c index a1b93f6fafd9..6c2a536dabc9 100644 --- a/sound/soc/codecs/es8326.c +++ b/sound/soc/codecs/es8326.c @@ -1427,7 +1427,7 @@ static int es8326_i2c_probe(struct i2c_client *i2c) struct es8326_priv *es8326; int ret; - es8326 = devm_kzalloc(&i2c->dev, sizeof(struct es8326_priv), GFP_KERNEL); + es8326 = devm_kzalloc_obj(&i2c->dev, struct es8326_priv); if (!es8326) return -ENOMEM; diff --git a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c index 37fda2f42b0c..a70922272ac6 100644 --- a/sound/soc/codecs/es8328.c +++ b/sound/soc/codecs/es8328.c @@ -892,7 +892,7 @@ int es8328_probe(struct device *dev, struct regmap *regmap) if (IS_ERR(regmap)) return PTR_ERR(regmap); - es8328 = devm_kzalloc(dev, sizeof(*es8328), GFP_KERNEL); + es8328 = devm_kzalloc_obj(dev, *es8328); if (es8328 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/es8375.c b/sound/soc/codecs/es8375.c index 501a3eda5a89..7bb6c8d3a778 100644 --- a/sound/soc/codecs/es8375.c +++ b/sound/soc/codecs/es8375.c @@ -708,7 +708,7 @@ static int es8375_i2c_probe(struct i2c_client *i2c_client) int ret; unsigned int val; - es8375 = devm_kzalloc(&i2c_client->dev, sizeof(*es8375), GFP_KERNEL); + es8375 = devm_kzalloc_obj(&i2c_client->dev, *es8375); if (!es8375) return -ENOMEM; diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c index 267806b72f87..d38557939c21 100644 --- a/sound/soc/codecs/es8389.c +++ b/sound/soc/codecs/es8389.c @@ -1165,7 +1165,7 @@ static int es8389_i2c_probe(struct i2c_client *i2c_client) struct es8389_private *es8389; int ret, i; - es8389 = devm_kzalloc(&i2c_client->dev, sizeof(*es8389), GFP_KERNEL); + es8389 = devm_kzalloc_obj(&i2c_client->dev, *es8389); if (es8389 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/es9039q2m.c b/sound/soc/codecs/es9039q2m.c index 4e9f86cb7860..2a451dfcc8de 100644 --- a/sound/soc/codecs/es9039q2m.c +++ b/sound/soc/codecs/es9039q2m.c @@ -1911,7 +1911,7 @@ static int es9039q2m_i2c_probe(struct i2c_client *i2c) unsigned int id; int i, ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/es9356.c b/sound/soc/codecs/es9356.c index 9c70ccd5b310..e0deb81afe34 100644 --- a/sound/soc/codecs/es9356.c +++ b/sound/soc/codecs/es9356.c @@ -966,9 +966,8 @@ static int es9356_sdw_read_prop(struct sdw_slave *slave) prop->sink_ports = BIT(3) | BIT(4); nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), - GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -984,9 +983,8 @@ static int es9356_sdw_read_prop(struct sdw_slave *slave) /* do this again for sink now */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), - GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; @@ -1087,7 +1085,7 @@ static int es9356_sdca_init(struct device *dev, struct regmap *regmap, struct sd struct es9356_sdw_priv *es9356; int ret; - es9356 = devm_kzalloc(dev, sizeof(*es9356), GFP_KERNEL); + es9356 = devm_kzalloc_obj(dev, *es9356); if (!es9356) return -ENOMEM; diff --git a/sound/soc/codecs/framer-codec.c b/sound/soc/codecs/framer-codec.c index a87a78390172..7d9a78d6f75e 100644 --- a/sound/soc/codecs/framer-codec.c +++ b/sound/soc/codecs/framer-codec.c @@ -381,7 +381,7 @@ static int framer_codec_probe(struct platform_device *pdev) { struct framer_codec *framer; - framer = devm_kzalloc(&pdev->dev, sizeof(*framer), GFP_KERNEL); + framer = devm_kzalloc_obj(&pdev->dev, *framer); if (!framer) return -ENOMEM; diff --git a/sound/soc/codecs/fs-amp-lib.c b/sound/soc/codecs/fs-amp-lib.c index a562c72fc524..1f0816e495c9 100644 --- a/sound/soc/codecs/fs-amp-lib.c +++ b/sound/soc/codecs/fs-amp-lib.c @@ -111,7 +111,7 @@ static int fs_parse_scene_tables(struct fs_amp_lib *amp_lib) if (count <= 0) return -EFAULT; - scene = devm_kcalloc(amp_lib->dev, count, sizeof(*scene), GFP_KERNEL); + scene = devm_kzalloc_objs(amp_lib->dev, *scene, count); if (!scene) return -ENOMEM; diff --git a/sound/soc/codecs/fs210x.c b/sound/soc/codecs/fs210x.c index 316f3fe80d93..534b5e36bc1e 100644 --- a/sound/soc/codecs/fs210x.c +++ b/sound/soc/codecs/fs210x.c @@ -1489,7 +1489,7 @@ static int fs210x_i2c_probe(struct i2c_client *client) struct fs210x_priv *fs210x; int ret; - fs210x = devm_kzalloc(&client->dev, sizeof(*fs210x), GFP_KERNEL); + fs210x = devm_kzalloc_obj(&client->dev, *fs210x); if (!fs210x) return -ENOMEM; diff --git a/sound/soc/codecs/hda.c b/sound/soc/codecs/hda.c index c481ef2dd789..e0056adf1e6b 100644 --- a/sound/soc/codecs/hda.c +++ b/sound/soc/codecs/hda.c @@ -21,7 +21,7 @@ static int hda_codec_create_dais(struct hda_codec *codec, int pcm_count, struct hda_pcm *pcm; int i; - drvs = devm_kcalloc(dev, pcm_count, sizeof(*drvs), GFP_KERNEL); + drvs = devm_kzalloc_objs(dev, *drvs, pcm_count); if (!drvs) return -ENOMEM; @@ -357,7 +357,7 @@ static int hda_hdev_attach(struct hdac_device *hdev) return -ENODEV; } - comp_drv = devm_kzalloc(&hdev->dev, sizeof(*comp_drv), GFP_KERNEL); + comp_drv = devm_kzalloc_obj(&hdev->dev, *comp_drv); if (!comp_drv) return -ENOMEM; diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c index 48eb95973b7a..de1481ce2487 100644 --- a/sound/soc/codecs/hdac_hda.c +++ b/sound/soc/codecs/hdac_hda.c @@ -646,7 +646,7 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev) struct hdac_ext_link *hlink; int ret; - hda_pvt = devm_kzalloc(&hdev->dev, sizeof(*hda_pvt), GFP_KERNEL); + hda_pvt = devm_kzalloc_obj(&hdev->dev, *hda_pvt); if (!hda_pvt) return -ENOMEM; diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index b3f677e7ddc9..f7922ffaad97 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -981,11 +981,11 @@ static int hdac_hdmi_create_pin_port_muxs(struct hdac_device *hdev, int i = 0; int num_items = hdmi->num_cvt + 1; - kc = devm_kzalloc(&hdev->dev, sizeof(*kc), GFP_KERNEL); + kc = devm_kzalloc_obj(&hdev->dev, *kc); if (!kc) return -ENOMEM; - se = devm_kzalloc(&hdev->dev, sizeof(*se), GFP_KERNEL); + se = devm_kzalloc_obj(&hdev->dev, *se); if (!se) return -ENOMEM; @@ -1213,7 +1213,7 @@ static int hdac_hdmi_add_cvt(struct hdac_device *hdev, hda_nid_t nid) struct hdac_hdmi_cvt *cvt; char name[NAME_SIZE]; - cvt = devm_kzalloc(&hdev->dev, sizeof(*cvt), GFP_KERNEL); + cvt = devm_kzalloc_obj(&hdev->dev, *cvt); if (!cvt) return -ENOMEM; @@ -1354,7 +1354,7 @@ static int hdac_hdmi_add_ports(struct hdac_device *hdev, * implemented. */ - ports = devm_kcalloc(&hdev->dev, max_ports, sizeof(*ports), GFP_KERNEL); + ports = devm_kzalloc_objs(&hdev->dev, *ports, max_ports); if (!ports) return -ENOMEM; @@ -1374,7 +1374,7 @@ static int hdac_hdmi_add_pin(struct hdac_device *hdev, hda_nid_t nid) struct hdac_hdmi_pin *pin; int ret; - pin = devm_kzalloc(&hdev->dev, sizeof(*pin), GFP_KERNEL); + pin = devm_kzalloc_obj(&hdev->dev, *pin); if (!pin) return -ENOMEM; @@ -1862,7 +1862,7 @@ static int hdac_hdmi_dev_probe(struct hdac_device *hdev) snd_hdac_ext_bus_link_get(hdev->bus, hlink); - hdmi_priv = devm_kzalloc(&hdev->dev, sizeof(*hdmi_priv), GFP_KERNEL); + hdmi_priv = devm_kzalloc_obj(&hdev->dev, *hdmi_priv); if (hdmi_priv == NULL) { snd_hdac_ext_bus_link_put(hdev->bus, hlink); return -ENOMEM; diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 0e1e532dfc63..bc59da295370 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -925,7 +925,7 @@ static int hdmi_dai_probe(struct snd_soc_dai *dai) return ret; } - daifmt = devm_kzalloc(dai->dev, sizeof(*daifmt), GFP_KERNEL); + daifmt = devm_kzalloc_obj(dai->dev, *daifmt); if (!daifmt) return -ENOMEM; @@ -1148,7 +1148,7 @@ static int hdmi_codec_probe(struct platform_device *pdev) return -EINVAL; } - hcp = devm_kzalloc(dev, sizeof(*hcp), GFP_KERNEL); + hcp = devm_kzalloc_obj(dev, *hcp); if (!hcp) return -ENOMEM; @@ -1160,7 +1160,7 @@ static int hdmi_codec_probe(struct platform_device *pdev) if (ret < 0) return ret; - daidrv = devm_kcalloc(dev, dai_count, sizeof(*daidrv), GFP_KERNEL); + daidrv = devm_kzalloc_objs(dev, *daidrv, dai_count); if (!daidrv) return -ENOMEM; diff --git a/sound/soc/codecs/idt821034.c b/sound/soc/codecs/idt821034.c index 387f17b5f7b3..bcbcf615cf40 100644 --- a/sound/soc/codecs/idt821034.c +++ b/sound/soc/codecs/idt821034.c @@ -1103,7 +1103,7 @@ static int idt821034_spi_probe(struct spi_device *spi) if (ret < 0) return ret; - idt821034 = devm_kzalloc(&spi->dev, sizeof(*idt821034), GFP_KERNEL); + idt821034 = devm_kzalloc_obj(&spi->dev, *idt821034); if (!idt821034) return -ENOMEM; diff --git a/sound/soc/codecs/inno_rk3036.c b/sound/soc/codecs/inno_rk3036.c index aaf03f228150..3e5383862ed1 100644 --- a/sound/soc/codecs/inno_rk3036.c +++ b/sound/soc/codecs/inno_rk3036.c @@ -418,7 +418,7 @@ static int rk3036_codec_platform_probe(struct platform_device *pdev) struct regmap *grf; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/jz4725b.c b/sound/soc/codecs/jz4725b.c index 8a7d26a08c03..33a120298f94 100644 --- a/sound/soc/codecs/jz4725b.c +++ b/sound/soc/codecs/jz4725b.c @@ -610,7 +610,7 @@ static int jz4725b_codec_probe(struct platform_device *pdev) struct clk *clk; int ret; - icdc = devm_kzalloc(dev, sizeof(*icdc), GFP_KERNEL); + icdc = devm_kzalloc_obj(dev, *icdc); if (!icdc) return -ENOMEM; diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c index d3d801d850a1..90d63408652f 100644 --- a/sound/soc/codecs/jz4740.c +++ b/sound/soc/codecs/jz4740.c @@ -311,8 +311,7 @@ static int jz4740_codec_probe(struct platform_device *pdev) struct jz4740_codec *jz4740_codec; void __iomem *base; - jz4740_codec = devm_kzalloc(&pdev->dev, sizeof(*jz4740_codec), - GFP_KERNEL); + jz4740_codec = devm_kzalloc_obj(&pdev->dev, *jz4740_codec); if (!jz4740_codec) return -ENOMEM; diff --git a/sound/soc/codecs/jz4760.c b/sound/soc/codecs/jz4760.c index 6846ace06415..3c34ff635d3c 100644 --- a/sound/soc/codecs/jz4760.c +++ b/sound/soc/codecs/jz4760.c @@ -808,7 +808,7 @@ static int jz4760_codec_probe(struct platform_device *pdev) struct clk *clk; int ret; - codec = devm_kzalloc(dev, sizeof(*codec), GFP_KERNEL); + codec = devm_kzalloc_obj(dev, *codec); if (!codec) return -ENOMEM; diff --git a/sound/soc/codecs/jz4770.c b/sound/soc/codecs/jz4770.c index be1ecdcc737b..19a8a8d4106b 100644 --- a/sound/soc/codecs/jz4770.c +++ b/sound/soc/codecs/jz4770.c @@ -855,7 +855,7 @@ static int jz4770_codec_probe(struct platform_device *pdev) struct clk *clk; int ret; - codec = devm_kzalloc(dev, sizeof(*codec), GFP_KERNEL); + codec = devm_kzalloc_obj(dev, *codec); if (!codec) return -ENOMEM; diff --git a/sound/soc/codecs/lm49453.c b/sound/soc/codecs/lm49453.c index 991555bec712..8c36298aa6eb 100644 --- a/sound/soc/codecs/lm49453.c +++ b/sound/soc/codecs/lm49453.c @@ -1432,8 +1432,7 @@ static int lm49453_i2c_probe(struct i2c_client *i2c) struct lm49453_priv *lm49453; int ret = 0; - lm49453 = devm_kzalloc(&i2c->dev, sizeof(struct lm49453_priv), - GFP_KERNEL); + lm49453 = devm_kzalloc_obj(&i2c->dev, struct lm49453_priv); if (lm49453 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/lochnagar-sc.c b/sound/soc/codecs/lochnagar-sc.c index dadb4a6c287f..3ba9a2c0ac11 100644 --- a/sound/soc/codecs/lochnagar-sc.c +++ b/sound/soc/codecs/lochnagar-sc.c @@ -233,7 +233,7 @@ static int lochnagar_sc_probe(struct platform_device *pdev) struct lochnagar_sc_priv *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/lpass-macro-common.c b/sound/soc/codecs/lpass-macro-common.c index 7e59616ed7bc..7f3c43763c97 100644 --- a/sound/soc/codecs/lpass-macro-common.c +++ b/sound/soc/codecs/lpass-macro-common.c @@ -23,7 +23,7 @@ struct lpass_macro *lpass_macro_pds_init(struct device *dev) if (!of_property_present(dev->of_node, "power-domains")) return NULL; - l_pds = devm_kzalloc(dev, sizeof(*l_pds), GFP_KERNEL); + l_pds = devm_kzalloc_obj(dev, *l_pds); if (!l_pds) return ERR_PTR(-ENOMEM); diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c index c41eb8de6160..d212a568c385 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -3776,7 +3776,7 @@ static int rx_macro_probe(struct platform_device *pdev) flags = (kernel_ulong_t)device_get_match_data(dev); - rx = devm_kzalloc(dev, sizeof(*rx), GFP_KERNEL); + rx = devm_kzalloc_obj(dev, *rx); if (!rx) return -ENOMEM; diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c index 6deaaabe43af..def7dcc2058d 100644 --- a/sound/soc/codecs/lpass-tx-macro.c +++ b/sound/soc/codecs/lpass-tx-macro.c @@ -2252,7 +2252,7 @@ static int tx_macro_probe(struct platform_device *pdev) void __iomem *base; int ret, reg; - tx = devm_kzalloc(dev, sizeof(*tx), GFP_KERNEL); + tx = devm_kzalloc_obj(dev, *tx); if (!tx) return -ENOMEM; diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c index 03d6434a4a12..61b24a1e4dde 100644 --- a/sound/soc/codecs/lpass-va-macro.c +++ b/sound/soc/codecs/lpass-va-macro.c @@ -1551,7 +1551,7 @@ static int va_macro_probe(struct platform_device *pdev) int ret; int rpm_ret; - va = devm_kzalloc(dev, sizeof(*va), GFP_KERNEL); + va = devm_kzalloc_obj(dev, *va); if (!va) return -ENOMEM; diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c index 899c8bee4645..e3fe8d0af8be 100644 --- a/sound/soc/codecs/lpass-wsa-macro.c +++ b/sound/soc/codecs/lpass-wsa-macro.c @@ -2697,7 +2697,7 @@ static int wsa_macro_probe(struct platform_device *pdev) flags = (kernel_ulong_t)device_get_match_data(dev); - wsa = devm_kzalloc(dev, sizeof(*wsa), GFP_KERNEL); + wsa = devm_kzalloc_obj(dev, *wsa); if (!wsa) return -ENOMEM; diff --git a/sound/soc/codecs/max9759.c b/sound/soc/codecs/max9759.c index 9760543f2922..1934bfe03b3a 100644 --- a/sound/soc/codecs/max9759.c +++ b/sound/soc/codecs/max9759.c @@ -142,7 +142,7 @@ static int max9759_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct max9759 *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/max9768.c b/sound/soc/codecs/max9768.c index 8621d9bdb9fd..706bb6f62cc2 100644 --- a/sound/soc/codecs/max9768.c +++ b/sound/soc/codecs/max9768.c @@ -179,7 +179,7 @@ static int max9768_i2c_probe(struct i2c_client *client) struct max9768 *max9768; struct max9768_pdata *pdata = client->dev.platform_data; - max9768 = devm_kzalloc(&client->dev, sizeof(*max9768), GFP_KERNEL); + max9768 = devm_kzalloc_obj(&client->dev, *max9768); if (!max9768) return -ENOMEM; diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 1dd7881c84aa..fa6f1055822c 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -1744,8 +1744,7 @@ static int max98088_i2c_probe(struct i2c_client *i2c) { struct max98088_priv *max98088; - max98088 = devm_kzalloc(&i2c->dev, sizeof(struct max98088_priv), - GFP_KERNEL); + max98088 = devm_kzalloc_obj(&i2c->dev, struct max98088_priv); if (max98088 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index 4bb5478f4642..a985853e48eb 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c @@ -2607,8 +2607,7 @@ static int max98090_i2c_probe(struct i2c_client *i2c) pr_debug("max98090_i2c_probe\n"); - max98090 = devm_kzalloc(&i2c->dev, sizeof(struct max98090_priv), - GFP_KERNEL); + max98090 = devm_kzalloc_obj(&i2c->dev, struct max98090_priv); if (max98090 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c index c827fd47a5b0..0d0e0d434ecf 100644 --- a/sound/soc/codecs/max98095.c +++ b/sound/soc/codecs/max98095.c @@ -2134,8 +2134,7 @@ static int max98095_i2c_probe(struct i2c_client *i2c) struct max98095_priv *max98095; int ret; - max98095 = devm_kzalloc(&i2c->dev, sizeof(struct max98095_priv), - GFP_KERNEL); + max98095 = devm_kzalloc_obj(&i2c->dev, struct max98095_priv); if (max98095 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/max98357a.c b/sound/soc/codecs/max98357a.c index b0f8043fb9e2..0510d47d50eb 100644 --- a/sound/soc/codecs/max98357a.c +++ b/sound/soc/codecs/max98357a.c @@ -124,7 +124,7 @@ static int max98357a_platform_probe(struct platform_device *pdev) struct max98357a_priv *max98357a; int ret; - max98357a = devm_kzalloc(&pdev->dev, sizeof(*max98357a), GFP_KERNEL); + max98357a = devm_kzalloc_obj(&pdev->dev, *max98357a); if (!max98357a) return -ENOMEM; diff --git a/sound/soc/codecs/max98363.c b/sound/soc/codecs/max98363.c index 4a6d7b163acf..87755234a865 100644 --- a/sound/soc/codecs/max98363.c +++ b/sound/soc/codecs/max98363.c @@ -130,9 +130,8 @@ static int max98363_read_prop(struct sdw_slave *slave) prop->clock_reg_supported = true; nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), - GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; @@ -386,7 +385,7 @@ static int max98363_init(struct sdw_slave *slave, struct regmap *regmap) struct device *dev = &slave->dev; /* Allocate and assign private driver data structure */ - max98363 = devm_kzalloc(dev, sizeof(*max98363), GFP_KERNEL); + max98363 = devm_kzalloc_obj(dev, *max98363); if (!max98363) return -ENOMEM; diff --git a/sound/soc/codecs/max98371.c b/sound/soc/codecs/max98371.c index 72bcdb0d1289..2711e833fa33 100644 --- a/sound/soc/codecs/max98371.c +++ b/sound/soc/codecs/max98371.c @@ -376,8 +376,7 @@ static int max98371_i2c_probe(struct i2c_client *i2c) struct max98371_priv *max98371; int ret, reg; - max98371 = devm_kzalloc(&i2c->dev, - sizeof(*max98371), GFP_KERNEL); + max98371 = devm_kzalloc_obj(&i2c->dev, *max98371); if (!max98371) return -ENOMEM; diff --git a/sound/soc/codecs/max98373-i2c.c b/sound/soc/codecs/max98373-i2c.c index 4e52282ace7f..c7c728f7983e 100644 --- a/sound/soc/codecs/max98373-i2c.c +++ b/sound/soc/codecs/max98373-i2c.c @@ -534,7 +534,7 @@ static int max98373_i2c_probe(struct i2c_client *i2c) int i; struct max98373_priv *max98373 = NULL; - max98373 = devm_kzalloc(&i2c->dev, sizeof(*max98373), GFP_KERNEL); + max98373 = devm_kzalloc_obj(&i2c->dev, *max98373); if (!max98373) { ret = -ENOMEM; @@ -558,9 +558,8 @@ static int max98373_i2c_probe(struct i2c_client *i2c) } max98373->cache_num = ARRAY_SIZE(max98373_i2c_cache_reg); - max98373->cache = devm_kcalloc(&i2c->dev, max98373->cache_num, - sizeof(*max98373->cache), - GFP_KERNEL); + max98373->cache = devm_kzalloc_objs(&i2c->dev, *max98373->cache, + max98373->cache_num); if (!max98373->cache) { ret = -ENOMEM; return ret; diff --git a/sound/soc/codecs/max98373-sdw.c b/sound/soc/codecs/max98373-sdw.c index 638ef343813b..331bbaf8d12e 100644 --- a/sound/soc/codecs/max98373-sdw.c +++ b/sound/soc/codecs/max98373-sdw.c @@ -310,9 +310,8 @@ static int max98373_read_prop(struct sdw_slave *slave) prop->clk_stop_timeout = 20; nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), - GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -329,9 +328,8 @@ static int max98373_read_prop(struct sdw_slave *slave) /* do this again for sink now */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), - GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; @@ -729,7 +727,7 @@ static int max98373_init(struct sdw_slave *slave, struct regmap *regmap) struct device *dev = &slave->dev; /* Allocate and assign private driver data structure */ - max98373 = devm_kzalloc(dev, sizeof(*max98373), GFP_KERNEL); + max98373 = devm_kzalloc_obj(dev, *max98373); if (!max98373) return -ENOMEM; @@ -740,9 +738,8 @@ static int max98373_init(struct sdw_slave *slave, struct regmap *regmap) regcache_cache_only(max98373->regmap, true); max98373->cache_num = ARRAY_SIZE(max98373_sdw_cache_reg); - max98373->cache = devm_kcalloc(dev, max98373->cache_num, - sizeof(*max98373->cache), - GFP_KERNEL); + max98373->cache = devm_kzalloc_objs(dev, *max98373->cache, + max98373->cache_num); if (!max98373->cache) return -ENOMEM; diff --git a/sound/soc/codecs/max98388.c b/sound/soc/codecs/max98388.c index a653e0a21899..7d465939423f 100644 --- a/sound/soc/codecs/max98388.c +++ b/sound/soc/codecs/max98388.c @@ -942,7 +942,7 @@ static int max98388_i2c_probe(struct i2c_client *i2c) struct max98388_priv *max98388 = NULL; - max98388 = devm_kzalloc(&i2c->dev, sizeof(*max98388), GFP_KERNEL); + max98388 = devm_kzalloc_obj(&i2c->dev, *max98388); if (!max98388) return -ENOMEM; diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c index b87cca2a5b43..537134bc6414 100644 --- a/sound/soc/codecs/max98390.c +++ b/sound/soc/codecs/max98390.c @@ -1033,7 +1033,7 @@ static int max98390_i2c_probe(struct i2c_client *i2c) return -ENXIO; } - max98390 = devm_kzalloc(&i2c->dev, sizeof(*max98390), GFP_KERNEL); + max98390 = devm_kzalloc_obj(&i2c->dev, *max98390); if (!max98390) { ret = -ENOMEM; return ret; diff --git a/sound/soc/codecs/max98396.c b/sound/soc/codecs/max98396.c index 935319fee41b..e8bbfc2667dd 100644 --- a/sound/soc/codecs/max98396.c +++ b/sound/soc/codecs/max98396.c @@ -1763,7 +1763,7 @@ static int max98396_i2c_probe(struct i2c_client *i2c) struct max98396_priv *max98396 = NULL; int i, ret, reg; - max98396 = devm_kzalloc(&i2c->dev, sizeof(*max98396), GFP_KERNEL); + max98396 = devm_kzalloc_obj(&i2c->dev, *max98396); if (!max98396) { ret = -ENOMEM; diff --git a/sound/soc/codecs/max9850.c b/sound/soc/codecs/max9850.c index c229b732121f..d9b881dfdab8 100644 --- a/sound/soc/codecs/max9850.c +++ b/sound/soc/codecs/max9850.c @@ -315,8 +315,7 @@ static int max9850_i2c_probe(struct i2c_client *i2c) struct max9850_priv *max9850; int ret; - max9850 = devm_kzalloc(&i2c->dev, sizeof(struct max9850_priv), - GFP_KERNEL); + max9850 = devm_kzalloc_obj(&i2c->dev, struct max9850_priv); if (max9850 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/max98504.c b/sound/soc/codecs/max98504.c index 8b2620eaf9b0..0cd1d26b1e9b 100644 --- a/sound/soc/codecs/max98504.c +++ b/sound/soc/codecs/max98504.c @@ -314,7 +314,7 @@ static int max98504_i2c_probe(struct i2c_client *client) struct max98504_priv *max98504; int i, ret; - max98504 = devm_kzalloc(dev, sizeof(*max98504), GFP_KERNEL); + max98504 = devm_kzalloc_obj(dev, *max98504); if (!max98504) return -ENOMEM; diff --git a/sound/soc/codecs/max98520.c b/sound/soc/codecs/max98520.c index 57759d85907b..56e559db88de 100644 --- a/sound/soc/codecs/max98520.c +++ b/sound/soc/codecs/max98520.c @@ -697,7 +697,7 @@ static int max98520_i2c_probe(struct i2c_client *i2c) return -ENXIO; } - max98520 = devm_kzalloc(&i2c->dev, sizeof(*max98520), GFP_KERNEL); + max98520 = devm_kzalloc_obj(&i2c->dev, *max98520); if (!max98520) return -ENOMEM; diff --git a/sound/soc/codecs/max9860.c b/sound/soc/codecs/max9860.c index 35265c2502fe..a25f6891fe2f 100644 --- a/sound/soc/codecs/max9860.c +++ b/sound/soc/codecs/max9860.c @@ -621,7 +621,7 @@ static int max9860_probe(struct i2c_client *i2c) int i; int intr; - max9860 = devm_kzalloc(dev, sizeof(struct max9860_priv), GFP_KERNEL); + max9860 = devm_kzalloc_obj(dev, struct max9860_priv); if (!max9860) return -ENOMEM; diff --git a/sound/soc/codecs/max9867.c b/sound/soc/codecs/max9867.c index f2214e3a19ce..1e99fbd8aca2 100644 --- a/sound/soc/codecs/max9867.c +++ b/sound/soc/codecs/max9867.c @@ -667,7 +667,7 @@ static int max9867_i2c_probe(struct i2c_client *i2c) struct max9867_priv *max9867; int ret, reg; - max9867 = devm_kzalloc(&i2c->dev, sizeof(*max9867), GFP_KERNEL); + max9867 = devm_kzalloc_obj(&i2c->dev, *max9867); if (!max9867) return -ENOMEM; diff --git a/sound/soc/codecs/max98925.c b/sound/soc/codecs/max98925.c index fe43ef99a0cb..fa22b2e4ed82 100644 --- a/sound/soc/codecs/max98925.c +++ b/sound/soc/codecs/max98925.c @@ -571,8 +571,7 @@ static int max98925_i2c_probe(struct i2c_client *i2c) u32 value; struct max98925_priv *max98925; - max98925 = devm_kzalloc(&i2c->dev, - sizeof(*max98925), GFP_KERNEL); + max98925 = devm_kzalloc_obj(&i2c->dev, *max98925); if (!max98925) return -ENOMEM; diff --git a/sound/soc/codecs/max98926.c b/sound/soc/codecs/max98926.c index 5b590a1f00de..14613e85e147 100644 --- a/sound/soc/codecs/max98926.c +++ b/sound/soc/codecs/max98926.c @@ -523,8 +523,7 @@ static int max98926_i2c_probe(struct i2c_client *i2c) u32 value; struct max98926_priv *max98926; - max98926 = devm_kzalloc(&i2c->dev, - sizeof(*max98926), GFP_KERNEL); + max98926 = devm_kzalloc_obj(&i2c->dev, *max98926); if (!max98926) return -ENOMEM; diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c index 285c9d1ea721..5a753500c556 100644 --- a/sound/soc/codecs/max98927.c +++ b/sound/soc/codecs/max98927.c @@ -818,7 +818,7 @@ static int max98927_i2c_probe(struct i2c_client *i2c) int reg = 0; struct max98927_priv *max98927 = NULL; - max98927 = devm_kzalloc(&i2c->dev, sizeof(*max98927), GFP_KERNEL); + max98927 = devm_kzalloc_obj(&i2c->dev, *max98927); if (!max98927) { ret = -ENOMEM; return ret; diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c index a6231a12a9b0..48c7e1f62ea2 100644 --- a/sound/soc/codecs/mc13783.c +++ b/sound/soc/codecs/mc13783.c @@ -748,7 +748,7 @@ static int __init mc13783_codec_probe(struct platform_device *pdev) struct device_node *np; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/ml26124.c b/sound/soc/codecs/ml26124.c index a94a3f9b8f90..7ee730b3a5df 100644 --- a/sound/soc/codecs/ml26124.c +++ b/sound/soc/codecs/ml26124.c @@ -563,7 +563,7 @@ static int ml26124_i2c_probe(struct i2c_client *i2c) struct ml26124_priv *priv; int ret; - priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&i2c->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c index 87f8a47cc293..b7ce8e9447de 100644 --- a/sound/soc/codecs/msm8916-wcd-analog.c +++ b/sound/soc/codecs/msm8916-wcd-analog.c @@ -1319,7 +1319,7 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret, i, irq; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c index cfadea2aa1f7..cffb7315ac2c 100644 --- a/sound/soc/codecs/msm8916-wcd-digital.c +++ b/sound/soc/codecs/msm8916-wcd-digital.c @@ -1171,7 +1171,7 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev) struct regmap *digital_map; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/mt6351.c b/sound/soc/codecs/mt6351.c index 3be0491a2588..7628c0420609 100644 --- a/sound/soc/codecs/mt6351.c +++ b/sound/soc/codecs/mt6351.c @@ -1451,9 +1451,7 @@ static int mt6351_codec_driver_probe(struct platform_device *pdev) { struct mt6351_priv *priv; - priv = devm_kzalloc(&pdev->dev, - sizeof(struct mt6351_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct mt6351_priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/mt6357.c b/sound/soc/codecs/mt6357.c index 3b07087e1cab..a08799f99437 100644 --- a/sound/soc/codecs/mt6357.c +++ b/sound/soc/codecs/mt6357.c @@ -1808,7 +1808,7 @@ static int mt6357_platform_driver_probe(struct platform_device *pdev) if (ret) return dev_err_probe(&pdev->dev, ret, "Failed to enable vaud28 regulator\n"); - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/mt6358.c b/sound/soc/codecs/mt6358.c index ed8cbc63fa77..42b131dc5107 100644 --- a/sound/soc/codecs/mt6358.c +++ b/sound/soc/codecs/mt6358.c @@ -2381,9 +2381,7 @@ static int mt6358_platform_driver_probe(struct platform_device *pdev) struct mt6358_priv *priv; struct mt6397_chip *mt6397 = dev_get_drvdata(pdev->dev.parent); - priv = devm_kzalloc(&pdev->dev, - sizeof(struct mt6358_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct mt6358_priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c index 54ec1c6bd64b..2ffff272487d 100644 --- a/sound/soc/codecs/mt6359-accdet.c +++ b/sound/soc/codecs/mt6359-accdet.c @@ -931,19 +931,16 @@ static int mt6359_accdet_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "%s(), dev name %s\n", __func__, dev_name(&pdev->dev)); - priv = devm_kzalloc(&pdev->dev, sizeof(struct mt6359_accdet), - GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct mt6359_accdet); if (!priv) return -ENOMEM; - priv->data = devm_kzalloc(&pdev->dev, sizeof(struct dts_data), - GFP_KERNEL); + priv->data = devm_kzalloc_obj(&pdev->dev, struct dts_data); if (!priv->data) return -ENOMEM; - priv->data->pwm_deb = devm_kzalloc(&pdev->dev, - sizeof(struct pwm_deb_settings), - GFP_KERNEL); + priv->data->pwm_deb = devm_kzalloc_obj(&pdev->dev, + struct pwm_deb_settings); if (!priv->data->pwm_deb) return -ENOMEM; diff --git a/sound/soc/codecs/mt6359.c b/sound/soc/codecs/mt6359.c index c51eae602ca0..dc1b2e9634b1 100644 --- a/sound/soc/codecs/mt6359.c +++ b/sound/soc/codecs/mt6359.c @@ -2921,7 +2921,7 @@ static int mt6359_platform_driver_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "%s(), dev name %s\n", __func__, dev_name(&pdev->dev)); - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/mt6660.c b/sound/soc/codecs/mt6660.c index 21741afc80ef..0d77e7ddc048 100644 --- a/sound/soc/codecs/mt6660.c +++ b/sound/soc/codecs/mt6660.c @@ -462,7 +462,7 @@ static int mt6660_i2c_probe(struct i2c_client *client) int ret; dev_dbg(&client->dev, "%s\n", __func__); - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(&client->dev, *chip); if (!chip) return -ENOMEM; chip->i2c = client; diff --git a/sound/soc/codecs/nau8315.c b/sound/soc/codecs/nau8315.c index 9ac2048ff0b0..a4f4ea23222c 100644 --- a/sound/soc/codecs/nau8315.c +++ b/sound/soc/codecs/nau8315.c @@ -117,7 +117,7 @@ static int nau8315_platform_probe(struct platform_device *pdev) { struct nau8315_priv *nau8315; - nau8315 = devm_kzalloc(&pdev->dev, sizeof(*nau8315), GFP_KERNEL); + nau8315 = devm_kzalloc_obj(&pdev->dev, *nau8315); if (!nau8315) return -ENOMEM; diff --git a/sound/soc/codecs/nau8325.c b/sound/soc/codecs/nau8325.c index 5ccf4c110567..016336b34596 100644 --- a/sound/soc/codecs/nau8325.c +++ b/sound/soc/codecs/nau8325.c @@ -863,7 +863,7 @@ static int nau8325_i2c_probe(struct i2c_client *i2c) int ret, value; if (!nau8325) { - nau8325 = devm_kzalloc(dev, sizeof(*nau8325), GFP_KERNEL); + nau8325 = devm_kzalloc_obj(dev, *nau8325); if (!nau8325) { ret = -ENOMEM; goto err; diff --git a/sound/soc/codecs/nau8360.c b/sound/soc/codecs/nau8360.c index f0942739d7ab..91256902729c 100644 --- a/sound/soc/codecs/nau8360.c +++ b/sound/soc/codecs/nau8360.c @@ -2227,7 +2227,7 @@ static int nau8360_i2c_probe(struct i2c_client *i2c) int num_total_regs; int ret, value; - nau8360 = devm_kzalloc(dev, sizeof(*nau8360), GFP_KERNEL); + nau8360 = devm_kzalloc_obj(dev, *nau8360); if (!nau8360) return -ENOMEM; diff --git a/sound/soc/codecs/nau8540.c b/sound/soc/codecs/nau8540.c index 09e7f31a904d..dc6338085cf5 100644 --- a/sound/soc/codecs/nau8540.c +++ b/sound/soc/codecs/nau8540.c @@ -959,7 +959,7 @@ static int nau8540_i2c_probe(struct i2c_client *i2c) int ret, value; if (!nau8540) { - nau8540 = devm_kzalloc(dev, sizeof(*nau8540), GFP_KERNEL); + nau8540 = devm_kzalloc_obj(dev, *nau8540); if (!nau8540) return -ENOMEM; } diff --git a/sound/soc/codecs/nau8810.c b/sound/soc/codecs/nau8810.c index eb3e93380678..e18439c2b0e1 100644 --- a/sound/soc/codecs/nau8810.c +++ b/sound/soc/codecs/nau8810.c @@ -890,7 +890,7 @@ static int nau8810_i2c_probe(struct i2c_client *i2c) struct nau8810 *nau8810 = dev_get_platdata(dev); if (!nau8810) { - nau8810 = devm_kzalloc(dev, sizeof(*nau8810), GFP_KERNEL); + nau8810 = devm_kzalloc_obj(dev, *nau8810); if (!nau8810) return -ENOMEM; } diff --git a/sound/soc/codecs/nau8821.c b/sound/soc/codecs/nau8821.c index 7b88ee3159d1..a208685f1fab 100644 --- a/sound/soc/codecs/nau8821.c +++ b/sound/soc/codecs/nau8821.c @@ -1947,7 +1947,7 @@ static int nau8821_i2c_probe(struct i2c_client *i2c) int ret, value; if (!nau8821) { - nau8821 = devm_kzalloc(dev, sizeof(*nau8821), GFP_KERNEL); + nau8821 = devm_kzalloc_obj(dev, *nau8821); if (!nau8821) return -ENOMEM; nau8821_read_device_properties(dev, nau8821); diff --git a/sound/soc/codecs/nau8822.c b/sound/soc/codecs/nau8822.c index d91a0bed2025..17b8ee0ab22c 100644 --- a/sound/soc/codecs/nau8822.c +++ b/sound/soc/codecs/nau8822.c @@ -1192,7 +1192,7 @@ static int nau8822_i2c_probe(struct i2c_client *i2c) int ret, i; if (!nau8822) { - nau8822 = devm_kzalloc(dev, sizeof(*nau8822), GFP_KERNEL); + nau8822 = devm_kzalloc_obj(dev, *nau8822); if (nau8822 == NULL) return -ENOMEM; } diff --git a/sound/soc/codecs/nau8824.c b/sound/soc/codecs/nau8824.c index 046cce9192b7..46cd57b7b867 100644 --- a/sound/soc/codecs/nau8824.c +++ b/sound/soc/codecs/nau8824.c @@ -2000,7 +2000,7 @@ static int nau8824_i2c_probe(struct i2c_client *i2c) int ret, value; if (!nau8824) { - nau8824 = devm_kzalloc(dev, sizeof(*nau8824), GFP_KERNEL); + nau8824 = devm_kzalloc_obj(dev, *nau8824); if (!nau8824) return -ENOMEM; ret = nau8824_read_device_properties(dev, nau8824); diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c index af2a49c893d3..02cbd4219908 100644 --- a/sound/soc/codecs/nau8825.c +++ b/sound/soc/codecs/nau8825.c @@ -2891,7 +2891,7 @@ static int nau8825_i2c_probe(struct i2c_client *i2c) int ret, value; if (!nau8825) { - nau8825 = devm_kzalloc(dev, sizeof(*nau8825), GFP_KERNEL); + nau8825 = devm_kzalloc_obj(dev, *nau8825); if (!nau8825) return -ENOMEM; ret = nau8825_read_device_properties(dev, nau8825); diff --git a/sound/soc/codecs/ntp8835.c b/sound/soc/codecs/ntp8835.c index 39620b84e214..983c40e4fc9c 100644 --- a/sound/soc/codecs/ntp8835.c +++ b/sound/soc/codecs/ntp8835.c @@ -422,7 +422,7 @@ static int ntp8835_i2c_probe(struct i2c_client *i2c) struct regmap *regmap; int ret; - ntp8835 = devm_kzalloc(&i2c->dev, sizeof(*ntp8835), GFP_KERNEL); + ntp8835 = devm_kzalloc_obj(&i2c->dev, *ntp8835); if (!ntp8835) return -ENOMEM; diff --git a/sound/soc/codecs/ntp8918.c b/sound/soc/codecs/ntp8918.c index eca34fafc4e6..3cb5d422e39d 100644 --- a/sound/soc/codecs/ntp8918.c +++ b/sound/soc/codecs/ntp8918.c @@ -344,7 +344,7 @@ static int ntp8918_i2c_probe(struct i2c_client *i2c) int ret; struct regmap *regmap; - ntp8918 = devm_kzalloc(&i2c->dev, sizeof(*ntp8918), GFP_KERNEL); + ntp8918 = devm_kzalloc_obj(&i2c->dev, *ntp8918); if (!ntp8918) return -ENOMEM; diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c index 6002da3a5666..2aae372389ad 100644 --- a/sound/soc/codecs/pcm1681.c +++ b/sound/soc/codecs/pcm1681.c @@ -348,7 +348,7 @@ static int pcm1681_i2c_probe(struct i2c_client *client) int ret; struct pcm1681_private *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/pcm1754.c b/sound/soc/codecs/pcm1754.c index bb15da1c24aa..3d0708b7566c 100644 --- a/sound/soc/codecs/pcm1754.c +++ b/sound/soc/codecs/pcm1754.c @@ -143,7 +143,7 @@ static int pcm1754_probe(struct platform_device *pdev) if (!dai_drv) return -ENOMEM; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/pcm1789.c b/sound/soc/codecs/pcm1789.c index f06e353743aa..2d7cd829f7d3 100644 --- a/sound/soc/codecs/pcm1789.c +++ b/sound/soc/codecs/pcm1789.c @@ -242,8 +242,7 @@ int pcm1789_common_init(struct device *dev, struct regmap *regmap) { struct pcm1789_private *pcm1789; - pcm1789 = devm_kzalloc(dev, sizeof(struct pcm1789_private), - GFP_KERNEL); + pcm1789 = devm_kzalloc_obj(dev, struct pcm1789_private); if (!pcm1789) return -ENOMEM; diff --git a/sound/soc/codecs/pcm179x.c b/sound/soc/codecs/pcm179x.c index cb70927872aa..c9c4cebf92cc 100644 --- a/sound/soc/codecs/pcm179x.c +++ b/sound/soc/codecs/pcm179x.c @@ -219,8 +219,7 @@ int pcm179x_common_init(struct device *dev, struct regmap *regmap) { struct pcm179x_private *pcm179x; - pcm179x = devm_kzalloc(dev, sizeof(struct pcm179x_private), - GFP_KERNEL); + pcm179x = devm_kzalloc_obj(dev, struct pcm179x_private); if (!pcm179x) return -ENOMEM; diff --git a/sound/soc/codecs/pcm186x.c b/sound/soc/codecs/pcm186x.c index 461ec74e8752..9b0d953c0337 100644 --- a/sound/soc/codecs/pcm186x.c +++ b/sound/soc/codecs/pcm186x.c @@ -650,7 +650,7 @@ int pcm186x_probe(struct device *dev, enum pcm186x_type type, int irq, struct pcm186x_priv *priv; int i, ret; - priv = devm_kzalloc(dev, sizeof(struct pcm186x_priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct pcm186x_priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/pcm3008.c b/sound/soc/codecs/pcm3008.c index d3d2e7f40170..c6d4d300bef6 100644 --- a/sound/soc/codecs/pcm3008.c +++ b/sound/soc/codecs/pcm3008.c @@ -114,7 +114,7 @@ static int pcm3008_codec_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct pcm3008 *pcm; - pcm = devm_kzalloc(dev, sizeof(*pcm), GFP_KERNEL); + pcm = devm_kzalloc_obj(dev, *pcm); if (!pcm) return -ENOMEM; platform_set_drvdata(pdev, pcm); diff --git a/sound/soc/codecs/pcm3060-i2c.c b/sound/soc/codecs/pcm3060-i2c.c index 3816b25a8ead..0d7ce3c35624 100644 --- a/sound/soc/codecs/pcm3060-i2c.c +++ b/sound/soc/codecs/pcm3060-i2c.c @@ -14,7 +14,7 @@ static int pcm3060_i2c_probe(struct i2c_client *i2c) { struct pcm3060_priv *priv; - priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&i2c->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/pcm3060-spi.c b/sound/soc/codecs/pcm3060-spi.c index 6095841f2f56..e9d04892bbd8 100644 --- a/sound/soc/codecs/pcm3060-spi.c +++ b/sound/soc/codecs/pcm3060-spi.c @@ -14,7 +14,7 @@ static int pcm3060_spi_probe(struct spi_device *spi) { struct pcm3060_priv *priv; - priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&spi->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/pcm3168a.c b/sound/soc/codecs/pcm3168a.c index 6f45ea4869a7..11fd948ecd27 100644 --- a/sound/soc/codecs/pcm3168a.c +++ b/sound/soc/codecs/pcm3168a.c @@ -718,7 +718,7 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap) struct pcm3168a_priv *pcm3168a; int ret, i; - pcm3168a = devm_kzalloc(dev, sizeof(*pcm3168a), GFP_KERNEL); + pcm3168a = devm_kzalloc_obj(dev, *pcm3168a); if (pcm3168a == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/pcm5102a.c b/sound/soc/codecs/pcm5102a.c index ed1e29e54ef8..9db9a0d40a0b 100644 --- a/sound/soc/codecs/pcm5102a.c +++ b/sound/soc/codecs/pcm5102a.c @@ -40,7 +40,7 @@ static int pcm5102a_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct pcm5102a_priv *pcm5102a; - pcm5102a = devm_kzalloc(dev, sizeof(*pcm5102a), GFP_KERNEL); + pcm5102a = devm_kzalloc_obj(dev, *pcm5102a); if (!pcm5102a) return -ENOMEM; diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c index f3e20919042b..5bc908f6785c 100644 --- a/sound/soc/codecs/pcm512x.c +++ b/sound/soc/codecs/pcm512x.c @@ -601,12 +601,11 @@ static int pcm512x_dai_startup_master(struct snd_pcm_substream *substream, SNDRV_PCM_HW_PARAM_FRAME_BITS, SNDRV_PCM_HW_PARAM_CHANNELS, -1); - constraints_no_pll = devm_kzalloc(dev, sizeof(*constraints_no_pll), - GFP_KERNEL); + constraints_no_pll = devm_kzalloc_obj(dev, *constraints_no_pll); if (!constraints_no_pll) return -ENOMEM; constraints_no_pll->nrats = 1; - rats_no_pll = devm_kzalloc(dev, sizeof(*rats_no_pll), GFP_KERNEL); + rats_no_pll = devm_kzalloc_obj(dev, *rats_no_pll); if (!rats_no_pll) return -ENOMEM; constraints_no_pll->rats = rats_no_pll; @@ -1574,7 +1573,7 @@ int pcm512x_probe(struct device *dev, struct regmap *regmap) struct pcm512x_priv *pcm512x; int i, ret; - pcm512x = devm_kzalloc(dev, sizeof(struct pcm512x_priv), GFP_KERNEL); + pcm512x = devm_kzalloc_obj(dev, struct pcm512x_priv); if (!pcm512x) return -ENOMEM; diff --git a/sound/soc/codecs/pcm6240.c b/sound/soc/codecs/pcm6240.c index db70a33d14b8..5c129b5c7814 100644 --- a/sound/soc/codecs/pcm6240.c +++ b/sound/soc/codecs/pcm6240.c @@ -1346,8 +1346,8 @@ static int pcmdev_gain_ctrl_add(struct pcmdevice_priv *pcm_dev, return 0; } - pcmdev_controls = devm_kcalloc(pcm_dev->dev, nr_chn, - sizeof(struct snd_kcontrol_new), GFP_KERNEL); + pcmdev_controls = devm_kzalloc_objs(pcm_dev->dev, + struct snd_kcontrol_new, nr_chn); if (!pcmdev_controls) return -ENOMEM; @@ -1407,8 +1407,7 @@ static int pcmdev_profile_ctrl_add(struct pcmdevice_priv *pcm_dev) char *name; int ret; - pcmdev_ctrl = devm_kzalloc(pcm_dev->dev, - sizeof(struct snd_kcontrol_new), GFP_KERNEL); + pcmdev_ctrl = devm_kzalloc_obj(pcm_dev->dev, struct snd_kcontrol_new); if (!pcmdev_ctrl) return -ENOMEM; @@ -2044,7 +2043,7 @@ static int pcmdevice_i2c_probe(struct i2c_client *i2c) unsigned int dev_addrs[PCMDEVICE_MAX_I2C_DEVICES]; int ret = 0, i = 0, ndev = 0; - pcm_dev = devm_kzalloc(&i2c->dev, sizeof(*pcm_dev), GFP_KERNEL); + pcm_dev = devm_kzalloc_obj(&i2c->dev, *pcm_dev); if (!pcm_dev) return -ENOMEM; diff --git a/sound/soc/codecs/peb2466.c b/sound/soc/codecs/peb2466.c index f1ded68c2d75..c9b8a459c795 100644 --- a/sound/soc/codecs/peb2466.c +++ b/sound/soc/codecs/peb2466.c @@ -1959,7 +1959,7 @@ static int peb2466_spi_probe(struct spi_device *spi) if (ret < 0) return ret; - peb2466 = devm_kzalloc(&spi->dev, sizeof(*peb2466), GFP_KERNEL); + peb2466 = devm_kzalloc_obj(&spi->dev, *peb2466); if (!peb2466) return -ENOMEM; diff --git a/sound/soc/codecs/pm4125-sdw.c b/sound/soc/codecs/pm4125-sdw.c index 182ff396301a..c279bf0a88b1 100644 --- a/sound/soc/codecs/pm4125-sdw.c +++ b/sound/soc/codecs/pm4125-sdw.c @@ -353,7 +353,7 @@ static int pm4125_probe(struct sdw_slave *pdev, const struct sdw_device_id *id) int master_ch_mask_size = 0; int ret, i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/pm4125.c b/sound/soc/codecs/pm4125.c index 674a2fbc4eda..22fada77b274 100644 --- a/sound/soc/codecs/pm4125.c +++ b/sound/soc/codecs/pm4125.c @@ -1650,7 +1650,7 @@ static int pm4125_probe(struct platform_device *pdev) struct wcd_mbhc_config *cfg; int ret; - pm4125 = devm_kzalloc(dev, sizeof(*pm4125), GFP_KERNEL); + pm4125 = devm_kzalloc_obj(dev, *pm4125); if (!pm4125) return -ENOMEM; diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c index a3d41cd8150d..9cb327f5155d 100644 --- a/sound/soc/codecs/rk3308_codec.c +++ b/sound/soc/codecs/rk3308_codec.c @@ -1012,7 +1012,7 @@ static int rk3308_codec_platform_probe(struct platform_device *pdev) void __iomem *base; int err; - rk3308 = devm_kzalloc(&pdev->dev, sizeof(*rk3308), GFP_KERNEL); + rk3308 = devm_kzalloc_obj(&pdev->dev, *rk3308); if (!rk3308) return -ENOMEM; diff --git a/sound/soc/codecs/rk3328_codec.c b/sound/soc/codecs/rk3328_codec.c index c2798ee94059..cc2e70a3a559 100644 --- a/sound/soc/codecs/rk3328_codec.c +++ b/sound/soc/codecs/rk3328_codec.c @@ -435,7 +435,7 @@ static int rk3328_platform_probe(struct platform_device *pdev) struct regmap *grf; void __iomem *base; - rk3328 = devm_kzalloc(&pdev->dev, sizeof(*rk3328), GFP_KERNEL); + rk3328 = devm_kzalloc_obj(&pdev->dev, *rk3328); if (!rk3328) return -ENOMEM; diff --git a/sound/soc/codecs/rk817_codec.c b/sound/soc/codecs/rk817_codec.c index 3c9957b00881..2c0fe1dfd842 100644 --- a/sound/soc/codecs/rk817_codec.c +++ b/sound/soc/codecs/rk817_codec.c @@ -475,9 +475,7 @@ static int rk817_platform_probe(struct platform_device *pdev) struct rk817_codec_priv *rk817_codec_data; int ret; - rk817_codec_data = devm_kzalloc(&pdev->dev, - sizeof(struct rk817_codec_priv), - GFP_KERNEL); + rk817_codec_data = devm_kzalloc_obj(&pdev->dev, struct rk817_codec_priv); if (!rk817_codec_data) return -ENOMEM; diff --git a/sound/soc/codecs/rt1011.c b/sound/soc/codecs/rt1011.c index 9bd4a56d34bf..a46c6bc3019b 100644 --- a/sound/soc/codecs/rt1011.c +++ b/sound/soc/codecs/rt1011.c @@ -2452,8 +2452,7 @@ static int rt1011_i2c_probe(struct i2c_client *i2c) int ret; unsigned int val; - rt1011 = devm_kzalloc(&i2c->dev, sizeof(struct rt1011_priv), - GFP_KERNEL); + rt1011 = devm_kzalloc_obj(&i2c->dev, struct rt1011_priv); if (!rt1011) return -ENOMEM; diff --git a/sound/soc/codecs/rt1015.c b/sound/soc/codecs/rt1015.c index 5d6be7cc67b4..8de8c6eb8b0e 100644 --- a/sound/soc/codecs/rt1015.c +++ b/sound/soc/codecs/rt1015.c @@ -1187,7 +1187,7 @@ static int rt1015_i2c_probe(struct i2c_client *i2c) int ret; unsigned int val; - rt1015 = devm_kzalloc(&i2c->dev, sizeof(*rt1015), GFP_KERNEL); + rt1015 = devm_kzalloc_obj(&i2c->dev, *rt1015); if (!rt1015) return -ENOMEM; diff --git a/sound/soc/codecs/rt1015p.c b/sound/soc/codecs/rt1015p.c index 44e7fe3c32da..3bd48b7c8b59 100644 --- a/sound/soc/codecs/rt1015p.c +++ b/sound/soc/codecs/rt1015p.c @@ -106,7 +106,7 @@ static int rt1015p_platform_probe(struct platform_device *pdev) { struct rt1015p_priv *rt1015p; - rt1015p = devm_kzalloc(&pdev->dev, sizeof(*rt1015p), GFP_KERNEL); + rt1015p = devm_kzalloc_obj(&pdev->dev, *rt1015p); if (!rt1015p) return -ENOMEM; diff --git a/sound/soc/codecs/rt1016.c b/sound/soc/codecs/rt1016.c index 1e97d9ffa352..fc92e6f29168 100644 --- a/sound/soc/codecs/rt1016.c +++ b/sound/soc/codecs/rt1016.c @@ -643,8 +643,7 @@ static int rt1016_i2c_probe(struct i2c_client *i2c) int ret; unsigned int val; - rt1016 = devm_kzalloc(&i2c->dev, sizeof(struct rt1016_priv), - GFP_KERNEL); + rt1016 = devm_kzalloc_obj(&i2c->dev, struct rt1016_priv); if (rt1016 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/rt1017-sdca-sdw.c b/sound/soc/codecs/rt1017-sdca-sdw.c index 01cc2511a7d0..78ad4a566865 100644 --- a/sound/soc/codecs/rt1017-sdca-sdw.c +++ b/sound/soc/codecs/rt1017-sdca-sdw.c @@ -276,8 +276,8 @@ static int rt1017_sdca_read_prop(struct sdw_slave *slave) prop->sink_ports = BIT(1); /* BITMAP: 00000010 */ nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -294,8 +294,8 @@ static int rt1017_sdca_read_prop(struct sdw_slave *slave) /* do this again for sink now */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; @@ -693,7 +693,7 @@ static int rt1017_sdca_init(struct device *dev, struct regmap *regmap, struct rt1017_sdca_priv *rt1017; int ret; - rt1017 = devm_kzalloc(dev, sizeof(*rt1017), GFP_KERNEL); + rt1017 = devm_kzalloc_obj(dev, *rt1017); if (!rt1017) return -ENOMEM; diff --git a/sound/soc/codecs/rt1019.c b/sound/soc/codecs/rt1019.c index 3998abccd93a..56605a018c0c 100644 --- a/sound/soc/codecs/rt1019.c +++ b/sound/soc/codecs/rt1019.c @@ -575,8 +575,7 @@ static int rt1019_i2c_probe(struct i2c_client *i2c) int ret; unsigned int val, val2, dev_id; - rt1019 = devm_kzalloc(&i2c->dev, sizeof(struct rt1019_priv), - GFP_KERNEL); + rt1019 = devm_kzalloc_obj(&i2c->dev, struct rt1019_priv); if (!rt1019) return -ENOMEM; diff --git a/sound/soc/codecs/rt1305.c b/sound/soc/codecs/rt1305.c index 0130ff9f050d..d219e5442ab9 100644 --- a/sound/soc/codecs/rt1305.c +++ b/sound/soc/codecs/rt1305.c @@ -1128,8 +1128,7 @@ static int rt1305_i2c_probe(struct i2c_client *i2c) int ret; unsigned int val; - rt1305 = devm_kzalloc(&i2c->dev, sizeof(struct rt1305_priv), - GFP_KERNEL); + rt1305 = devm_kzalloc_obj(&i2c->dev, struct rt1305_priv); if (rt1305 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c index 2f30497498c7..e8c85877b25d 100644 --- a/sound/soc/codecs/rt1308-sdw.c +++ b/sound/soc/codecs/rt1308-sdw.c @@ -138,9 +138,8 @@ static int rt1308_read_prop(struct sdw_slave *slave) /* for sink */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), - GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; @@ -681,7 +680,7 @@ static int rt1308_sdw_init(struct device *dev, struct regmap *regmap, struct rt1308_sdw_priv *rt1308; int ret; - rt1308 = devm_kzalloc(dev, sizeof(*rt1308), GFP_KERNEL); + rt1308 = devm_kzalloc_obj(dev, *rt1308); if (!rt1308) return -ENOMEM; diff --git a/sound/soc/codecs/rt1308.c b/sound/soc/codecs/rt1308.c index 3d4aadb91206..dd6665d477d6 100644 --- a/sound/soc/codecs/rt1308.c +++ b/sound/soc/codecs/rt1308.c @@ -825,8 +825,7 @@ static int rt1308_i2c_probe(struct i2c_client *i2c) int ret; unsigned int val; - rt1308 = devm_kzalloc(&i2c->dev, sizeof(struct rt1308_priv), - GFP_KERNEL); + rt1308 = devm_kzalloc_obj(&i2c->dev, struct rt1308_priv); if (rt1308 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/rt1316-sdw.c b/sound/soc/codecs/rt1316-sdw.c index 2ef47a82c984..1e33b6d38226 100644 --- a/sound/soc/codecs/rt1316-sdw.c +++ b/sound/soc/codecs/rt1316-sdw.c @@ -211,8 +211,8 @@ static int rt1316_read_prop(struct sdw_slave *slave) prop->sink_ports = 0x2; /* BITMAP: 00000010 */ nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -229,8 +229,8 @@ static int rt1316_read_prop(struct sdw_slave *slave) /* do this again for sink now */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; @@ -658,7 +658,7 @@ static int rt1316_sdw_init(struct device *dev, struct regmap *regmap, struct rt1316_sdw_priv *rt1316; int ret; - rt1316 = devm_kzalloc(dev, sizeof(*rt1316), GFP_KERNEL); + rt1316 = devm_kzalloc_obj(dev, *rt1316); if (!rt1316) return -ENOMEM; diff --git a/sound/soc/codecs/rt1318-sdw.c b/sound/soc/codecs/rt1318-sdw.c index f9ba16269817..f2b98eb16d63 100644 --- a/sound/soc/codecs/rt1318-sdw.c +++ b/sound/soc/codecs/rt1318-sdw.c @@ -361,8 +361,8 @@ static int rt1318_read_prop(struct sdw_slave *slave) prop->sink_ports = BIT(1); nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -379,8 +379,8 @@ static int rt1318_read_prop(struct sdw_slave *slave) /* do this again for sink now */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; @@ -725,7 +725,7 @@ static int rt1318_sdw_init(struct device *dev, struct regmap *regmap, struct rt1318_sdw_priv *rt1318; int ret; - rt1318 = devm_kzalloc(dev, sizeof(*rt1318), GFP_KERNEL); + rt1318 = devm_kzalloc_obj(dev, *rt1318); if (!rt1318) return -ENOMEM; diff --git a/sound/soc/codecs/rt1318.c b/sound/soc/codecs/rt1318.c index 5c80957b0f01..4f90c5a0ebde 100644 --- a/sound/soc/codecs/rt1318.c +++ b/sound/soc/codecs/rt1318.c @@ -1304,8 +1304,7 @@ static int rt1318_i2c_probe(struct i2c_client *i2c) struct rt1318_priv *rt1318; int ret, val, val2, dev_id; - rt1318 = devm_kzalloc(&i2c->dev, sizeof(struct rt1318_priv), - GFP_KERNEL); + rt1318 = devm_kzalloc_obj(&i2c->dev, struct rt1318_priv); if (!rt1318) return -ENOMEM; diff --git a/sound/soc/codecs/rt1320-sdw.c b/sound/soc/codecs/rt1320-sdw.c index fa89db096651..20288ea7a2ff 100644 --- a/sound/soc/codecs/rt1320-sdw.c +++ b/sound/soc/codecs/rt1320-sdw.c @@ -1094,8 +1094,8 @@ static int rt1320_read_prop(struct sdw_slave *slave) prop->sink_ports = BIT(1); nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -1112,8 +1112,8 @@ static int rt1320_read_prop(struct sdw_slave *slave) /* do this again for sink now */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; @@ -1128,7 +1128,7 @@ static int rt1320_read_prop(struct sdw_slave *slave) j++; } - prop->dp0_prop = devm_kzalloc(&slave->dev, sizeof(*prop->dp0_prop), GFP_KERNEL); + prop->dp0_prop = devm_kzalloc_obj(&slave->dev, *prop->dp0_prop); if (!prop->dp0_prop) return -ENOMEM; @@ -3535,7 +3535,7 @@ static int rt1320_sdw_init(struct device *dev, struct regmap *regmap, struct rt1320_sdw_priv *rt1320; int ret; - rt1320 = devm_kzalloc(dev, sizeof(*rt1320), GFP_KERNEL); + rt1320 = devm_kzalloc_obj(dev, *rt1320); if (!rt1320) return -ENOMEM; diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c index 5c67b1d210b2..202a3ee822d7 100644 --- a/sound/soc/codecs/rt274.c +++ b/sound/soc/codecs/rt274.c @@ -1129,8 +1129,7 @@ static int rt274_i2c_probe(struct i2c_client *i2c) int ret; unsigned int val; - rt274 = devm_kzalloc(&i2c->dev, sizeof(*rt274), - GFP_KERNEL); + rt274 = devm_kzalloc_obj(&i2c->dev, *rt274); if (rt274 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index c60e81ba87f3..b6d409e79b10 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c @@ -1146,8 +1146,7 @@ static int rt286_i2c_probe(struct i2c_client *i2c) struct rt286_priv *rt286; int i, ret, vendor_id; - rt286 = devm_kzalloc(&i2c->dev, sizeof(*rt286), - GFP_KERNEL); + rt286 = devm_kzalloc_obj(&i2c->dev, *rt286); if (NULL == rt286) return -ENOMEM; diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index 72407fec0f34..a879bb15c171 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c @@ -1193,8 +1193,7 @@ static int rt298_i2c_probe(struct i2c_client *i2c) const struct acpi_device_id *acpiid; int i, ret; - rt298 = devm_kzalloc(&i2c->dev, sizeof(*rt298), - GFP_KERNEL); + rt298 = devm_kzalloc_obj(&i2c->dev, *rt298); if (NULL == rt298) return -ENOMEM; diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c index a33fbc9fb047..90ac9a81ce03 100644 --- a/sound/soc/codecs/rt5514.c +++ b/sound/soc/codecs/rt5514.c @@ -1261,8 +1261,7 @@ static int rt5514_i2c_probe(struct i2c_client *i2c) int ret; unsigned int val = ~0; - rt5514 = devm_kzalloc(&i2c->dev, sizeof(struct rt5514_priv), - GFP_KERNEL); + rt5514 = devm_kzalloc_obj(&i2c->dev, struct rt5514_priv); if (rt5514 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/rt5575.c b/sound/soc/codecs/rt5575.c index 5c3e60eaa6a4..0fcdf85fb502 100644 --- a/sound/soc/codecs/rt5575.c +++ b/sound/soc/codecs/rt5575.c @@ -281,7 +281,7 @@ static int rt5575_i2c_probe(struct i2c_client *i2c) int ret, val, boot; struct device *dev = &i2c->dev; - rt5575 = devm_kzalloc(dev, sizeof(struct rt5575_priv), GFP_KERNEL); + rt5575 = devm_kzalloc_obj(dev, struct rt5575_priv); if (!rt5575) return -ENOMEM; diff --git a/sound/soc/codecs/rt5616.c b/sound/soc/codecs/rt5616.c index af6299baea7c..92383879e2d6 100644 --- a/sound/soc/codecs/rt5616.c +++ b/sound/soc/codecs/rt5616.c @@ -1344,8 +1344,7 @@ static int rt5616_i2c_probe(struct i2c_client *i2c) unsigned int val; int ret; - rt5616 = devm_kzalloc(&i2c->dev, sizeof(struct rt5616_priv), - GFP_KERNEL); + rt5616 = devm_kzalloc_obj(&i2c->dev, struct rt5616_priv); if (!rt5616) return -ENOMEM; diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c index f97fd24e4229..ad74caff315a 100644 --- a/sound/soc/codecs/rt5631.c +++ b/sound/soc/codecs/rt5631.c @@ -1715,8 +1715,7 @@ static int rt5631_i2c_probe(struct i2c_client *i2c) struct rt5631_priv *rt5631; int ret; - rt5631 = devm_kzalloc(&i2c->dev, sizeof(struct rt5631_priv), - GFP_KERNEL); + rt5631 = devm_kzalloc_obj(&i2c->dev, struct rt5631_priv); if (NULL == rt5631) return -ENOMEM; diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index d6068bb5cb4c..c3222068088a 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c @@ -3000,9 +3000,7 @@ static int rt5640_i2c_probe(struct i2c_client *i2c) int ret; unsigned int val; - rt5640 = devm_kzalloc(&i2c->dev, - sizeof(struct rt5640_priv), - GFP_KERNEL); + rt5640 = devm_kzalloc_obj(&i2c->dev, struct rt5640_priv); if (NULL == rt5640) return -ENOMEM; i2c_set_clientdata(i2c, rt5640); diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 90ec1102e1cc..e14b66d3118d 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -4023,8 +4023,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c) unsigned int val; struct regmap *regmap; - rt5645 = devm_kzalloc(&i2c->dev, sizeof(struct rt5645_priv), - GFP_KERNEL); + rt5645 = devm_kzalloc_obj(&i2c->dev, struct rt5645_priv); if (rt5645 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c index b911757376f5..1115a1b14d1d 100644 --- a/sound/soc/codecs/rt5651.c +++ b/sound/soc/codecs/rt5651.c @@ -2227,8 +2227,7 @@ static int rt5651_i2c_probe(struct i2c_client *i2c) int ret; int err; - rt5651 = devm_kzalloc(&i2c->dev, sizeof(*rt5651), - GFP_KERNEL); + rt5651 = devm_kzalloc_obj(&i2c->dev, *rt5651); if (NULL == rt5651) return -ENOMEM; diff --git a/sound/soc/codecs/rt5659.c b/sound/soc/codecs/rt5659.c index af8051fa69f8..7e3a9ac0e404 100644 --- a/sound/soc/codecs/rt5659.c +++ b/sound/soc/codecs/rt5659.c @@ -4105,8 +4105,7 @@ static int rt5659_i2c_probe(struct i2c_client *i2c) int ret; unsigned int val; - rt5659 = devm_kzalloc(&i2c->dev, sizeof(struct rt5659_priv), - GFP_KERNEL); + rt5659 = devm_kzalloc_obj(&i2c->dev, struct rt5659_priv); if (rt5659 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/rt5660.c b/sound/soc/codecs/rt5660.c index 2a3ecac12c07..bbc7a4580fc1 100644 --- a/sound/soc/codecs/rt5660.c +++ b/sound/soc/codecs/rt5660.c @@ -1276,8 +1276,7 @@ static int rt5660_i2c_probe(struct i2c_client *i2c) int ret; unsigned int val; - rt5660 = devm_kzalloc(&i2c->dev, sizeof(struct rt5660_priv), - GFP_KERNEL); + rt5660 = devm_kzalloc_obj(&i2c->dev, struct rt5660_priv); if (rt5660 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c index ec46e6180cc0..8657a79feaae 100644 --- a/sound/soc/codecs/rt5663.c +++ b/sound/soc/codecs/rt5663.c @@ -3517,8 +3517,7 @@ static int rt5663_i2c_probe(struct i2c_client *i2c) unsigned int val; struct regmap *regmap; - rt5663 = devm_kzalloc(&i2c->dev, sizeof(struct rt5663_priv), - GFP_KERNEL); + rt5663 = devm_kzalloc_obj(&i2c->dev, struct rt5663_priv); if (rt5663 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/rt5665.c b/sound/soc/codecs/rt5665.c index 62b21092e352..c867e6d40a74 100644 --- a/sound/soc/codecs/rt5665.c +++ b/sound/soc/codecs/rt5665.c @@ -4667,8 +4667,7 @@ static int rt5665_i2c_probe(struct i2c_client *i2c) int ret; unsigned int val; - rt5665 = devm_kzalloc(&i2c->dev, sizeof(struct rt5665_priv), - GFP_KERNEL); + rt5665 = devm_kzalloc_obj(&i2c->dev, struct rt5665_priv); if (rt5665 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/rt5668.c b/sound/soc/codecs/rt5668.c index cd6245d6b91a..834f83ad5f72 100644 --- a/sound/soc/codecs/rt5668.c +++ b/sound/soc/codecs/rt5668.c @@ -2430,8 +2430,7 @@ static int rt5668_i2c_probe(struct i2c_client *i2c) int i, ret; unsigned int val; - rt5668 = devm_kzalloc(&i2c->dev, sizeof(struct rt5668_priv), - GFP_KERNEL); + rt5668 = devm_kzalloc_obj(&i2c->dev, struct rt5668_priv); if (rt5668 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index 62d4e7cea5af..c34e7c590c85 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c @@ -3066,9 +3066,7 @@ static int rt5670_i2c_probe(struct i2c_client *i2c) int ret; unsigned int val; - rt5670 = devm_kzalloc(&i2c->dev, - sizeof(struct rt5670_priv), - GFP_KERNEL); + rt5670 = devm_kzalloc_obj(&i2c->dev, struct rt5670_priv); if (NULL == rt5670) return -ENOMEM; diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 7b80922236e5..9c9d9a5440dd 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -5569,8 +5569,7 @@ static int rt5677_i2c_probe(struct i2c_client *i2c) int ret; unsigned int val; - rt5677 = devm_kzalloc(&i2c->dev, sizeof(struct rt5677_priv), - GFP_KERNEL); + rt5677 = devm_kzalloc_obj(&i2c->dev, struct rt5677_priv); if (rt5677 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c index 286cf0d17968..43132943f6a7 100644 --- a/sound/soc/codecs/rt5682-i2c.c +++ b/sound/soc/codecs/rt5682-i2c.c @@ -123,8 +123,7 @@ static int rt5682_i2c_probe(struct i2c_client *i2c) int i, ret; unsigned int val; - rt5682 = devm_kzalloc(&i2c->dev, sizeof(struct rt5682_priv), - GFP_KERNEL); + rt5682 = devm_kzalloc_obj(&i2c->dev, struct rt5682_priv); if (!rt5682) return -ENOMEM; diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c index 5f2897c58ad7..ffcdce4d7b92 100644 --- a/sound/soc/codecs/rt5682-sdw.c +++ b/sound/soc/codecs/rt5682-sdw.c @@ -301,7 +301,7 @@ static int rt5682_sdw_init(struct device *dev, struct regmap *regmap, struct rt5682_priv *rt5682; int ret; - rt5682 = devm_kzalloc(dev, sizeof(*rt5682), GFP_KERNEL); + rt5682 = devm_kzalloc_obj(dev, *rt5682); if (!rt5682) return -ENOMEM; @@ -557,9 +557,8 @@ static int rt5682_read_prop(struct sdw_slave *slave) prop->sink_ports = 0x2; /* BITMAP: 00000010 */ nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), - GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -576,9 +575,8 @@ static int rt5682_read_prop(struct sdw_slave *slave) /* do this again for sink now */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), - GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; diff --git a/sound/soc/codecs/rt5682s.c b/sound/soc/codecs/rt5682s.c index 49ed7793d3a2..f72c5ea7225a 100644 --- a/sound/soc/codecs/rt5682s.c +++ b/sound/soc/codecs/rt5682s.c @@ -3127,7 +3127,7 @@ static int rt5682s_i2c_probe(struct i2c_client *i2c) int i, ret; unsigned int val; - rt5682s = devm_kzalloc(&i2c->dev, sizeof(struct rt5682s_priv), GFP_KERNEL); + rt5682s = devm_kzalloc_obj(&i2c->dev, struct rt5682s_priv); if (!rt5682s) return -ENOMEM; diff --git a/sound/soc/codecs/rt700-sdw.c b/sound/soc/codecs/rt700-sdw.c index 3ba0cc37acd9..48c098ab1233 100644 --- a/sound/soc/codecs/rt700-sdw.c +++ b/sound/soc/codecs/rt700-sdw.c @@ -348,9 +348,8 @@ static int rt700_read_prop(struct sdw_slave *slave) prop->sink_ports = 0xA; /* BITMAP: 00001010 */ nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), - GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -367,9 +366,8 @@ static int rt700_read_prop(struct sdw_slave *slave) /* do this again for sink now */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), - GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; diff --git a/sound/soc/codecs/rt700.c b/sound/soc/codecs/rt700.c index 21523d0a5f08..31fb62f6273b 100644 --- a/sound/soc/codecs/rt700.c +++ b/sound/soc/codecs/rt700.c @@ -1090,7 +1090,7 @@ int rt700_init(struct device *dev, struct regmap *sdw_regmap, struct rt700_priv *rt700; int ret; - rt700 = devm_kzalloc(dev, sizeof(*rt700), GFP_KERNEL); + rt700 = devm_kzalloc_obj(dev, *rt700); if (!rt700) return -ENOMEM; diff --git a/sound/soc/codecs/rt711-sdca-sdw.c b/sound/soc/codecs/rt711-sdca-sdw.c index f74b193c720d..bb8bd42d31c3 100644 --- a/sound/soc/codecs/rt711-sdca-sdw.c +++ b/sound/soc/codecs/rt711-sdca-sdw.c @@ -191,8 +191,8 @@ static int rt711_sdca_read_prop(struct sdw_slave *slave) prop->sink_ports = 0x8; /* BITMAP: 00001000 */ nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -209,8 +209,8 @@ static int rt711_sdca_read_prop(struct sdw_slave *slave) /* do this again for sink now */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; @@ -225,8 +225,7 @@ static int rt711_sdca_read_prop(struct sdw_slave *slave) j++; } - prop->dp0_prop = devm_kzalloc(&slave->dev, sizeof(*prop->dp0_prop), - GFP_KERNEL); + prop->dp0_prop = devm_kzalloc_obj(&slave->dev, *prop->dp0_prop); if (!prop->dp0_prop) return -ENOMEM; diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c index 9781f289f8ad..29c8e5fcba6e 100644 --- a/sound/soc/codecs/rt711-sdca.c +++ b/sound/soc/codecs/rt711-sdca.c @@ -1471,7 +1471,7 @@ int rt711_sdca_init(struct device *dev, struct regmap *regmap, struct rt711_sdca_priv *rt711; int ret; - rt711 = devm_kzalloc(dev, sizeof(*rt711), GFP_KERNEL); + rt711 = devm_kzalloc_obj(dev, *rt711); if (!rt711) return -ENOMEM; diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c index 798d181d5c90..006c09b8883a 100644 --- a/sound/soc/codecs/rt711-sdw.c +++ b/sound/soc/codecs/rt711-sdw.c @@ -355,9 +355,8 @@ static int rt711_read_prop(struct sdw_slave *slave) prop->sink_ports = 0x8; /* BITMAP: 00001000 */ nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), - GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -374,9 +373,8 @@ static int rt711_read_prop(struct sdw_slave *slave) /* do this again for sink now */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), - GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c index 3e49c3d0f25b..c22375d36b18 100644 --- a/sound/soc/codecs/rt711.c +++ b/sound/soc/codecs/rt711.c @@ -1172,7 +1172,7 @@ int rt711_init(struct device *dev, struct regmap *sdw_regmap, struct rt711_priv *rt711; int ret; - rt711 = devm_kzalloc(dev, sizeof(*rt711), GFP_KERNEL); + rt711 = devm_kzalloc_obj(dev, *rt711); if (!rt711) return -ENOMEM; diff --git a/sound/soc/codecs/rt712-sdca-dmic.c b/sound/soc/codecs/rt712-sdca-dmic.c index 882390890738..a3ebbd65d3fe 100644 --- a/sound/soc/codecs/rt712-sdca-dmic.c +++ b/sound/soc/codecs/rt712-sdca-dmic.c @@ -750,7 +750,7 @@ static int rt712_sdca_dmic_init(struct device *dev, struct regmap *regmap, struct rt712_sdca_dmic_priv *rt712; int ret; - rt712 = devm_kzalloc(dev, sizeof(*rt712), GFP_KERNEL); + rt712 = devm_kzalloc_obj(dev, *rt712); if (!rt712) return -ENOMEM; @@ -837,8 +837,8 @@ static int rt712_sdca_dmic_read_prop(struct sdw_slave *slave) prop->sink_ports = 0; nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; diff --git a/sound/soc/codecs/rt712-sdca-sdw.c b/sound/soc/codecs/rt712-sdca-sdw.c index 0f0447d1a05b..c0385644cd22 100644 --- a/sound/soc/codecs/rt712-sdca-sdw.c +++ b/sound/soc/codecs/rt712-sdca-sdw.c @@ -216,8 +216,8 @@ static int rt712_sdca_read_prop(struct sdw_slave *slave) prop->sink_ports = BIT(3) | BIT(1); /* BITMAP: 00001010 */ nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -234,8 +234,8 @@ static int rt712_sdca_read_prop(struct sdw_slave *slave) /* do this again for sink now */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; diff --git a/sound/soc/codecs/rt712-sdca.c b/sound/soc/codecs/rt712-sdca.c index 20961e5760c6..f1cb425a5a10 100644 --- a/sound/soc/codecs/rt712-sdca.c +++ b/sound/soc/codecs/rt712-sdca.c @@ -1838,7 +1838,7 @@ int rt712_sdca_init(struct device *dev, struct regmap *regmap, struct rt712_sdca_priv *rt712; int ret; - rt712 = devm_kzalloc(dev, sizeof(*rt712), GFP_KERNEL); + rt712 = devm_kzalloc_obj(dev, *rt712); if (!rt712) return -ENOMEM; diff --git a/sound/soc/codecs/rt715-sdca-sdw.c b/sound/soc/codecs/rt715-sdca-sdw.c index 1b183b21a4b8..49926c6d420d 100644 --- a/sound/soc/codecs/rt715-sdca-sdw.c +++ b/sound/soc/codecs/rt715-sdca-sdw.c @@ -146,9 +146,8 @@ static int rt715_sdca_read_prop(struct sdw_slave *slave) prop->sink_ports = 0x0; /* BITMAP: 00000000 */ nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), - GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; diff --git a/sound/soc/codecs/rt715-sdca.c b/sound/soc/codecs/rt715-sdca.c index b6a7a807a428..15f6a97044d9 100644 --- a/sound/soc/codecs/rt715-sdca.c +++ b/sound/soc/codecs/rt715-sdca.c @@ -961,7 +961,7 @@ int rt715_sdca_init(struct device *dev, struct regmap *mbq_regmap, struct rt715_sdca_priv *rt715; int ret; - rt715 = devm_kzalloc(dev, sizeof(*rt715), GFP_KERNEL); + rt715 = devm_kzalloc_obj(dev, *rt715); if (!rt715) return -ENOMEM; diff --git a/sound/soc/codecs/rt715-sdw.c b/sound/soc/codecs/rt715-sdw.c index f5ec348a9628..83a101fa1ded 100644 --- a/sound/soc/codecs/rt715-sdw.c +++ b/sound/soc/codecs/rt715-sdw.c @@ -406,9 +406,8 @@ static int rt715_read_prop(struct sdw_slave *slave) prop->sink_ports = 0x0; /* BITMAP: 00000000 */ nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), - GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; diff --git a/sound/soc/codecs/rt715.c b/sound/soc/codecs/rt715.c index 0881826de2f1..2a52ce3618de 100644 --- a/sound/soc/codecs/rt715.c +++ b/sound/soc/codecs/rt715.c @@ -1013,7 +1013,7 @@ int rt715_init(struct device *dev, struct regmap *sdw_regmap, struct rt715_priv *rt715; int ret; - rt715 = devm_kzalloc(dev, sizeof(*rt715), GFP_KERNEL); + rt715 = devm_kzalloc_obj(dev, *rt715); if (!rt715) return -ENOMEM; diff --git a/sound/soc/codecs/rt721-sdca-sdw.c b/sound/soc/codecs/rt721-sdca-sdw.c index 0c78799793bd..17c3a5b43426 100644 --- a/sound/soc/codecs/rt721-sdca-sdw.c +++ b/sound/soc/codecs/rt721-sdca-sdw.c @@ -279,8 +279,8 @@ static int rt721_sdca_read_prop(struct sdw_slave *slave) prop->sink_ports = BIT(3) | BIT(1); /* BITMAP: 00001010 */ nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -297,8 +297,8 @@ static int rt721_sdca_read_prop(struct sdw_slave *slave) /* do this again for sink now */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; diff --git a/sound/soc/codecs/rt721-sdca.c b/sound/soc/codecs/rt721-sdca.c index 9f567caecb70..86725b561235 100644 --- a/sound/soc/codecs/rt721-sdca.c +++ b/sound/soc/codecs/rt721-sdca.c @@ -1937,7 +1937,7 @@ int rt721_sdca_init(struct device *dev, struct regmap *regmap, { struct rt721_sdca_priv *rt721; - rt721 = devm_kzalloc(dev, sizeof(*rt721), GFP_KERNEL); + rt721 = devm_kzalloc_obj(dev, *rt721); if (!rt721) return -ENOMEM; diff --git a/sound/soc/codecs/rt722-sdca-sdw.c b/sound/soc/codecs/rt722-sdca-sdw.c index 078255fbe1fc..5c17426bc2fc 100644 --- a/sound/soc/codecs/rt722-sdca-sdw.c +++ b/sound/soc/codecs/rt722-sdca-sdw.c @@ -304,8 +304,8 @@ static int rt722_sdca_read_prop(struct sdw_slave *slave) prop->sink_ports = BIT(3) | BIT(1); /* BITMAP: 00001010 */ nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -322,8 +322,8 @@ static int rt722_sdca_read_prop(struct sdw_slave *slave) /* do this again for sink now */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; diff --git a/sound/soc/codecs/rt722-sdca.c b/sound/soc/codecs/rt722-sdca.c index 1dad8012d904..86a3e5b31dcf 100644 --- a/sound/soc/codecs/rt722-sdca.c +++ b/sound/soc/codecs/rt722-sdca.c @@ -1617,7 +1617,7 @@ int rt722_sdca_init(struct device *dev, struct regmap *regmap, struct sdw_slave { struct rt722_sdca_priv *rt722; - rt722 = devm_kzalloc(dev, sizeof(*rt722), GFP_KERNEL); + rt722 = devm_kzalloc_obj(dev, *rt722); if (!rt722) return -ENOMEM; diff --git a/sound/soc/codecs/rt766-sdca.c b/sound/soc/codecs/rt766-sdca.c index 2e891b99dc27..547c55e307ab 100644 --- a/sound/soc/codecs/rt766-sdca.c +++ b/sound/soc/codecs/rt766-sdca.c @@ -1153,7 +1153,7 @@ int rt766_sdca_init(struct device *dev, struct regmap *regmap, struct sdw_slave int ret; int i; - rt766 = devm_kzalloc(dev, sizeof(*rt766), GFP_KERNEL); + rt766 = devm_kzalloc_obj(dev, *rt766); if (!rt766) return -ENOMEM; @@ -1196,7 +1196,7 @@ int rt766_sdca_init(struct device *dev, struct regmap *regmap, struct sdw_slave /* get SDCA function data */ dev_dbg(dev, "SDCA functions found: %d", slave->sdca_data.num_functions); for (i = 0; i < slave->sdca_data.num_functions; i++) { - func_data_ptr = devm_kzalloc(dev, sizeof(*func_data_ptr), GFP_KERNEL); + func_data_ptr = devm_kzalloc_obj(dev, *func_data_ptr); if (!func_data_ptr) { dev_err(dev, "Failed to allocate memory for function data\n"); ret = -ENOMEM; diff --git a/sound/soc/codecs/rt9120.c b/sound/soc/codecs/rt9120.c index 1445e823c4ff..dbf12e270917 100644 --- a/sound/soc/codecs/rt9120.c +++ b/sound/soc/codecs/rt9120.c @@ -528,7 +528,7 @@ static int rt9120_probe(struct i2c_client *i2c) struct regulator *dvdd_supply; int dvdd_supply_volt, ret; - data = devm_kzalloc(&i2c->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&i2c->dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/codecs/rt9123.c b/sound/soc/codecs/rt9123.c index 251bad450ec8..f71742f8e5e7 100644 --- a/sound/soc/codecs/rt9123.c +++ b/sound/soc/codecs/rt9123.c @@ -395,7 +395,7 @@ static int rt9123_i2c_probe(struct i2c_client *i2c) u16 venid; int ret; - rt9123 = devm_kzalloc(dev, sizeof(*rt9123), GFP_KERNEL); + rt9123 = devm_kzalloc_obj(dev, *rt9123); if (!rt9123) return -ENOMEM; diff --git a/sound/soc/codecs/rt9123p.c b/sound/soc/codecs/rt9123p.c index 584fcb78cd3f..b4cde6531806 100644 --- a/sound/soc/codecs/rt9123p.c +++ b/sound/soc/codecs/rt9123p.c @@ -120,7 +120,7 @@ static int rt9123p_platform_probe(struct platform_device *pdev) struct rt9123p_priv *rt9123p; int ret; - rt9123p = devm_kzalloc(dev, sizeof(*rt9123p), GFP_KERNEL); + rt9123p = devm_kzalloc_obj(dev, *rt9123p); if (!rt9123p) return -ENOMEM; diff --git a/sound/soc/codecs/rtq9124.c b/sound/soc/codecs/rtq9124.c index cc1c68752fde..19ccca4738d0 100644 --- a/sound/soc/codecs/rtq9124.c +++ b/sound/soc/codecs/rtq9124.c @@ -442,7 +442,7 @@ static int rtq9124_probe(struct i2c_client *i2c) struct regmap *regmap; int ret; - rtq9124 = devm_kzalloc(dev, sizeof(*rtq9124), GFP_KERNEL); + rtq9124 = devm_kzalloc_obj(dev, *rtq9124); if (!rtq9124) return -ENOMEM; diff --git a/sound/soc/codecs/rtq9128.c b/sound/soc/codecs/rtq9128.c index 9567e90c0b62..a6d4a81ff181 100644 --- a/sound/soc/codecs/rtq9128.c +++ b/sound/soc/codecs/rtq9128.c @@ -778,7 +778,7 @@ static int rtq9128_probe(struct i2c_client *i2c) const struct snd_soc_component_driver *comp_drv; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/codecs/sdw-mockup.c b/sound/soc/codecs/sdw-mockup.c index 93f3fd1882a5..ff6917502138 100644 --- a/sound/soc/codecs/sdw-mockup.c +++ b/sound/soc/codecs/sdw-mockup.c @@ -151,9 +151,8 @@ static int sdw_mockup_read_prop(struct sdw_slave *slave) prop->sink_ports = BIT(1); nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), - GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; @@ -169,9 +168,8 @@ static int sdw_mockup_read_prop(struct sdw_slave *slave) /* do this again for sink now */ nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), - GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; @@ -219,7 +217,7 @@ static int sdw_mockup_sdw_probe(struct sdw_slave *slave, struct sdw_mockup_priv *sdw_mockup; int ret; - sdw_mockup = devm_kzalloc(dev, sizeof(*sdw_mockup), GFP_KERNEL); + sdw_mockup = devm_kzalloc_obj(dev, *sdw_mockup); if (!sdw_mockup) return -ENOMEM; diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 97bea75ed24f..c4f6c60bc5b5 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -1597,7 +1597,7 @@ static int sgtl5000_i2c_probe(struct i2c_client *client) u32 value; u16 ana_pwr; - sgtl5000 = devm_kzalloc(&client->dev, sizeof(*sgtl5000), GFP_KERNEL); + sgtl5000 = devm_kzalloc_obj(&client->dev, *sgtl5000); if (!sgtl5000) return -ENOMEM; diff --git a/sound/soc/codecs/simple-amplifier.c b/sound/soc/codecs/simple-amplifier.c index 07c040355c37..0df04c6cf386 100644 --- a/sound/soc/codecs/simple-amplifier.c +++ b/sound/soc/codecs/simple-amplifier.c @@ -682,9 +682,8 @@ static int simple_amp_parse_ranges(struct device *dev, if (ranges->nb_ranges > max_gpio_val + 1) return -EINVAL; - ranges->tab_ranges = devm_kcalloc(dev, ranges->nb_ranges, - sizeof(*ranges->tab_ranges), - GFP_KERNEL); + ranges->tab_ranges = devm_kzalloc_objs(dev, *ranges->tab_ranges, + ranges->nb_ranges); if (!ranges->tab_ranges) return -ENOMEM; @@ -798,9 +797,8 @@ static int simple_amp_parse_labels(struct device *dev, if (labels->nb_labels > (1 << multi->gpios->ndescs)) return -EINVAL; - labels->tab_labels = devm_kcalloc(dev, labels->nb_labels, - sizeof(*labels->tab_labels), - GFP_KERNEL); + labels->tab_labels = devm_kzalloc_objs(dev, *labels->tab_labels, + labels->nb_labels); if (!labels->tab_labels) return -ENOMEM; @@ -863,7 +861,7 @@ static int simple_amp_probe(struct platform_device *pdev) struct simple_amp *simple_amp; int ret; - simple_amp = devm_kzalloc(dev, sizeof(*simple_amp), GFP_KERNEL); + simple_amp = devm_kzalloc_obj(dev, *simple_amp); if (!simple_amp) return -ENOMEM; platform_set_drvdata(pdev, simple_amp); diff --git a/sound/soc/codecs/simple-mux.c b/sound/soc/codecs/simple-mux.c index c2f906a3f074..2a2722dbc3a3 100644 --- a/sound/soc/codecs/simple-mux.c +++ b/sound/soc/codecs/simple-mux.c @@ -124,7 +124,7 @@ static int simple_mux_probe(struct platform_device *pdev) struct simple_mux *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/sma1303.c b/sound/soc/codecs/sma1303.c index 0bff32559714..5768e7639031 100644 --- a/sound/soc/codecs/sma1303.c +++ b/sound/soc/codecs/sma1303.c @@ -1683,8 +1683,7 @@ static int sma1303_i2c_probe(struct i2c_client *client) int ret, i = 0; unsigned int device_info, status, otp_stat; - sma1303 = devm_kzalloc(&client->dev, - sizeof(struct sma1303_priv), GFP_KERNEL); + sma1303 = devm_kzalloc_obj(&client->dev, struct sma1303_priv); if (!sma1303) return -ENOMEM; sma1303->dev = &client->dev; diff --git a/sound/soc/codecs/sma1307.c b/sound/soc/codecs/sma1307.c index 57f34f2c5efb..8b6ba2d3d835 100644 --- a/sound/soc/codecs/sma1307.c +++ b/sound/soc/codecs/sma1307.c @@ -1956,8 +1956,7 @@ static int sma1307_i2c_probe(struct i2c_client *client) int ret = 0; unsigned int device_info; - sma1307 = devm_kzalloc(&client->dev, - sizeof(*sma1307), GFP_KERNEL); + sma1307 = devm_kzalloc_obj(&client->dev, *sma1307); if (!sma1307) return -ENOMEM; diff --git a/sound/soc/codecs/sn624x-sdca-sdw.c b/sound/soc/codecs/sn624x-sdca-sdw.c index c9e690482e8e..a20aa2cf844b 100644 --- a/sound/soc/codecs/sn624x-sdca-sdw.c +++ b/sound/soc/codecs/sn624x-sdca-sdw.c @@ -738,7 +738,7 @@ static int sn624x_parse_sdca_functions(struct sn624x_sdca_priv *sn624x) if (!is_jack && !is_mic && !is_amp) continue; - fn = devm_kzalloc(dev, sizeof(*fn), GFP_KERNEL); + fn = devm_kzalloc_obj(dev, *fn); if (!fn) return -ENOMEM; @@ -1259,8 +1259,8 @@ static int sn624x_sdca_read_prop(struct sdw_slave *slave) BIT(SN624X_PORT_SPEAKER_PLAYBACK); nval = hweight32(prop->source_ports); - prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->src_dpn_prop), GFP_KERNEL); + prop->src_dpn_prop = devm_kzalloc_objs(&slave->dev, *prop->src_dpn_prop, + nval); if (!prop->src_dpn_prop) return -ENOMEM; i = 0; @@ -1274,8 +1274,8 @@ static int sn624x_sdca_read_prop(struct sdw_slave *slave) i++; } nval = hweight32(prop->sink_ports); - prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, - sizeof(*prop->sink_dpn_prop), GFP_KERNEL); + prop->sink_dpn_prop = devm_kzalloc_objs(&slave->dev, + *prop->sink_dpn_prop, nval); if (!prop->sink_dpn_prop) return -ENOMEM; j = 0; @@ -1693,7 +1693,7 @@ int sn624x_sdca_init(struct device *dev, struct regmap *regmap, struct sn624x_sdca_priv *sn624x; int ret; - sn624x = devm_kzalloc(dev, sizeof(*sn624x), GFP_KERNEL); + sn624x = devm_kzalloc_obj(dev, *sn624x); if (!sn624x) return -ENOMEM; diff --git a/sound/soc/codecs/src4xxx.c b/sound/soc/codecs/src4xxx.c index 6e187c930372..373e5d86768c 100644 --- a/sound/soc/codecs/src4xxx.c +++ b/sound/soc/codecs/src4xxx.c @@ -429,7 +429,7 @@ int src4xxx_probe(struct device *dev, struct regmap *regmap, if (IS_ERR(regmap)) return PTR_ERR(regmap); - src4xxx = devm_kzalloc(dev, sizeof(*src4xxx), GFP_KERNEL); + src4xxx = devm_kzalloc_obj(dev, *src4xxx); if (!src4xxx) return -ENOMEM; diff --git a/sound/soc/codecs/ssm2305.c b/sound/soc/codecs/ssm2305.c index 1d022643c307..c71623078494 100644 --- a/sound/soc/codecs/ssm2305.c +++ b/sound/soc/codecs/ssm2305.c @@ -59,7 +59,7 @@ static int ssm2305_probe(struct platform_device *pdev) struct ssm2305 *priv; /* Allocate the private data */ - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/ssm2518.c b/sound/soc/codecs/ssm2518.c index 32e81b31479d..16d26baa440f 100644 --- a/sound/soc/codecs/ssm2518.c +++ b/sound/soc/codecs/ssm2518.c @@ -752,7 +752,7 @@ static int ssm2518_i2c_probe(struct i2c_client *i2c) struct ssm2518 *ssm2518; int ret; - ssm2518 = devm_kzalloc(&i2c->dev, sizeof(*ssm2518), GFP_KERNEL); + ssm2518 = devm_kzalloc_obj(&i2c->dev, *ssm2518); if (ssm2518 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index 92df44f86915..10fda1f99ed7 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c @@ -689,7 +689,7 @@ int ssm2602_probe(struct device *dev, enum ssm2602_type type, if (IS_ERR(regmap)) return PTR_ERR(regmap); - ssm2602 = devm_kzalloc(dev, sizeof(*ssm2602), GFP_KERNEL); + ssm2602 = devm_kzalloc_obj(dev, *ssm2602); if (ssm2602 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/ssm3515.c b/sound/soc/codecs/ssm3515.c index f71509237fca..8dafcaf30446 100644 --- a/sound/soc/codecs/ssm3515.c +++ b/sound/soc/codecs/ssm3515.c @@ -413,7 +413,7 @@ static int ssm3515_i2c_probe(struct i2c_client *client) struct ssm3515_data *data; int ret; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/codecs/ssm4567.c b/sound/soc/codecs/ssm4567.c index 181047b38d3d..2628e291a970 100644 --- a/sound/soc/codecs/ssm4567.c +++ b/sound/soc/codecs/ssm4567.c @@ -462,7 +462,7 @@ static int ssm4567_i2c_probe(struct i2c_client *i2c) struct ssm4567 *ssm4567; int ret; - ssm4567 = devm_kzalloc(&i2c->dev, sizeof(*ssm4567), GFP_KERNEL); + ssm4567 = devm_kzalloc_obj(&i2c->dev, *ssm4567); if (ssm4567 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index 773a9b203456..0d65912ecd10 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c @@ -1099,7 +1099,7 @@ static int sta32x_probe_dt(struct device *dev, struct sta32x_priv *sta32x) struct sta32x_platform_data *pdata; u32 tmp; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; @@ -1151,8 +1151,7 @@ static int sta32x_i2c_probe(struct i2c_client *i2c) struct sta32x_priv *sta32x; int ret, i; - sta32x = devm_kzalloc(&i2c->dev, sizeof(struct sta32x_priv), - GFP_KERNEL); + sta32x = devm_kzalloc_obj(&i2c->dev, struct sta32x_priv); if (!sta32x) return -ENOMEM; diff --git a/sound/soc/codecs/sta350.c b/sound/soc/codecs/sta350.c index acf5dc618398..a0afc199abe1 100644 --- a/sound/soc/codecs/sta350.c +++ b/sound/soc/codecs/sta350.c @@ -1099,7 +1099,7 @@ static int sta350_probe_dt(struct device *dev, struct sta350_priv *sta350) u32 tmp; u8 tmp8; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; @@ -1188,7 +1188,7 @@ static int sta350_i2c_probe(struct i2c_client *i2c) struct sta350_priv *sta350; int ret, i; - sta350 = devm_kzalloc(dev, sizeof(struct sta350_priv), GFP_KERNEL); + sta350 = devm_kzalloc_obj(dev, struct sta350_priv); if (!sta350) return -ENOMEM; diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c index 0faf439ffee9..d89a49ea9b9f 100644 --- a/sound/soc/codecs/sta529.c +++ b/sound/soc/codecs/sta529.c @@ -346,7 +346,7 @@ static int sta529_i2c_probe(struct i2c_client *i2c) struct sta529 *sta529; int ret; - sta529 = devm_kzalloc(&i2c->dev, sizeof(struct sta529), GFP_KERNEL); + sta529 = devm_kzalloc_obj(&i2c->dev, struct sta529); if (!sta529) return -ENOMEM; diff --git a/sound/soc/codecs/sti-sas.c b/sound/soc/codecs/sti-sas.c index b7eaf4795d8b..f9f0b681118f 100644 --- a/sound/soc/codecs/sti-sas.c +++ b/sound/soc/codecs/sti-sas.c @@ -406,8 +406,7 @@ static int sti_sas_driver_probe(struct platform_device *pdev) const struct of_device_id *of_id; /* Allocate device structure */ - drvdata = devm_kzalloc(&pdev->dev, sizeof(struct sti_sas_data), - GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, struct sti_sas_data); if (!drvdata) return -ENOMEM; diff --git a/sound/soc/codecs/tac5xx2-sdw.c b/sound/soc/codecs/tac5xx2-sdw.c index a5f654cde69f..43584bebdafe 100644 --- a/sound/soc/codecs/tac5xx2-sdw.c +++ b/sound/soc/codecs/tac5xx2-sdw.c @@ -1441,8 +1441,7 @@ static s32 tac_init(struct tac5xx2_prv *tac_dev) return -EINVAL; } - component_driver = devm_kzalloc(tac_dev->dev, sizeof(*component_driver), - GFP_KERNEL); + component_driver = devm_kzalloc_obj(tac_dev->dev, *component_driver); if (!component_driver) return -ENOMEM; @@ -1934,7 +1933,7 @@ static s32 tac_sdw_probe(struct sdw_slave *peripheral, struct regmap *regmap; int ret, i; - tac_dev = devm_kzalloc(dev, sizeof(*tac_dev), GFP_KERNEL); + tac_dev = devm_kzalloc_obj(dev, *tac_dev); if (!tac_dev) return dev_err_probe(dev, -ENOMEM, "Failed devm_kzalloc"); @@ -1968,8 +1967,7 @@ static s32 tac_sdw_probe(struct sdw_slave *peripheral, continue; } - function_data = devm_kzalloc(dev, sizeof(*function_data), - GFP_KERNEL); + function_data = devm_kzalloc_obj(dev, *function_data); if (!function_data) return dev_err_probe(dev, -ENOMEM, "failed to allocate %s function data", diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c index beb5654ac4b4..7fda383043ed 100644 --- a/sound/soc/codecs/tas2552.c +++ b/sound/soc/codecs/tas2552.c @@ -714,7 +714,7 @@ static int tas2552_probe(struct i2c_client *client) int i; dev = &client->dev; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (data == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c index 1fe17b0895fc..038e89bc708e 100644 --- a/sound/soc/codecs/tas2562.c +++ b/sound/soc/codecs/tas2562.c @@ -751,7 +751,7 @@ static int tas2562_probe(struct i2c_client *client) struct tas2562_data *data; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 6654100ac91d..17b993883185 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -998,8 +998,7 @@ static int tas2764_i2c_probe(struct i2c_client *client) struct tas2764_priv *tas2764; int result; - tas2764 = devm_kzalloc(&client->dev, sizeof(struct tas2764_priv), - GFP_KERNEL); + tas2764 = devm_kzalloc_obj(&client->dev, struct tas2764_priv); if (!tas2764) return -ENOMEM; diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c index 882e19857697..218e9630bed7 100644 --- a/sound/soc/codecs/tas2770.c +++ b/sound/soc/codecs/tas2770.c @@ -914,8 +914,7 @@ static int tas2770_i2c_probe(struct i2c_client *client) struct tas2770_priv *tas2770; int result; - tas2770 = devm_kzalloc(&client->dev, sizeof(struct tas2770_priv), - GFP_KERNEL); + tas2770 = devm_kzalloc_obj(&client->dev, struct tas2770_priv); if (!tas2770) return -ENOMEM; diff --git a/sound/soc/codecs/tas2780.c b/sound/soc/codecs/tas2780.c index 991d0c0efee2..ca6beb41375c 100644 --- a/sound/soc/codecs/tas2780.c +++ b/sound/soc/codecs/tas2780.c @@ -600,8 +600,7 @@ static int tas2780_i2c_probe(struct i2c_client *client) struct tas2780_priv *tas2780; int result; - tas2780 = devm_kzalloc(&client->dev, sizeof(struct tas2780_priv), - GFP_KERNEL); + tas2780 = devm_kzalloc_obj(&client->dev, struct tas2780_priv); if (!tas2780) return -ENOMEM; tas2780->dev = &client->dev; diff --git a/sound/soc/codecs/tas2781-comlib-i2c.c b/sound/soc/codecs/tas2781-comlib-i2c.c index 46777be765ef..9b37627a16af 100644 --- a/sound/soc/codecs/tas2781-comlib-i2c.c +++ b/sound/soc/codecs/tas2781-comlib-i2c.c @@ -147,7 +147,7 @@ struct tasdevice_priv *tasdevice_kzalloc(struct i2c_client *i2c) { struct tasdevice_priv *tas_priv; - tas_priv = devm_kzalloc(&i2c->dev, sizeof(*tas_priv), GFP_KERNEL); + tas_priv = devm_kzalloc_obj(&i2c->dev, *tas_priv); if (!tas_priv) return NULL; tas_priv->dev = &i2c->dev; diff --git a/sound/soc/codecs/tas2781-fmwlib.c b/sound/soc/codecs/tas2781-fmwlib.c index f309a57337b0..e6429b4c8dc5 100644 --- a/sound/soc/codecs/tas2781-fmwlib.c +++ b/sound/soc/codecs/tas2781-fmwlib.c @@ -2564,7 +2564,7 @@ static int tas2781_cali_preproc(struct tasdevice_priv *priv, int i) int re_org, re_cal, corrected_sin_gn, pg_id; unsigned char r0_deflt[4]; - spec = devm_kzalloc(priv->dev, sizeof(*spec), GFP_KERNEL); + spec = devm_kzalloc_obj(priv->dev, *spec); if (spec == NULL) return -ENOMEM; priv->tasdevice[i].cali_specific = spec; diff --git a/sound/soc/codecs/tas2781-i2c.c b/sound/soc/codecs/tas2781-i2c.c index 995bfd52f5fc..d780fd2533be 100644 --- a/sound/soc/codecs/tas2781-i2c.c +++ b/sound/soc/codecs/tas2781-i2c.c @@ -1237,8 +1237,8 @@ static int tasdevice_create_control(struct tasdevice_priv *tas_priv) int ret; char *name; - prof_ctrls = devm_kcalloc(tas_priv->dev, nr_controls, - sizeof(prof_ctrls[0]), GFP_KERNEL); + prof_ctrls = devm_kzalloc_objs(tas_priv->dev, prof_ctrls[0], + nr_controls); if (!prof_ctrls) { ret = -ENOMEM; goto out; @@ -1269,8 +1269,8 @@ static int tasdevice_create_control(struct tasdevice_priv *tas_priv) case TAS2573: case TAS2574: case TAS2781: - prof_ctrls = devm_kcalloc(tas_priv->dev, nr_controls, - sizeof(prof_ctrls[0]), GFP_KERNEL); + prof_ctrls = devm_kzalloc_objs(tas_priv->dev, prof_ctrls[0], + nr_controls); if (!prof_ctrls) { ret = -ENOMEM; goto out; @@ -1399,8 +1399,7 @@ static int tasdevice_dsp_create_ctrls(struct tasdevice_priv *tas_priv) /* Alloc kcontrol via devm_kzalloc, which don't manually * free the kcontrol */ - dsp_ctrls = devm_kcalloc(tas_priv->dev, nr_controls, - sizeof(dsp_ctrls[0]), GFP_KERNEL); + dsp_ctrls = devm_kzalloc_objs(tas_priv->dev, dsp_ctrls[0], nr_controls); if (!dsp_ctrls) return -ENOMEM; @@ -1514,8 +1513,7 @@ static int create_tas2781_cali_start_ktrl(struct tasdevice_priv struct soc_bytes_ext *ext_cali_start; char *cali_start_name; - ext_cali_start = devm_kzalloc(priv->dev, - sizeof(*ext_cali_start), GFP_KERNEL); + ext_cali_start = devm_kzalloc_obj(priv->dev, *ext_cali_start); if (!ext_cali_start) return -ENOMEM; @@ -1653,8 +1651,7 @@ static int create_tas2573_cali_status_ktrl(struct tasdevice_priv struct soc_bytes_ext *ext_cali_start; char *cali_start_name; - ext_cali_start = devm_kzalloc(priv->dev, - sizeof(*ext_cali_start), GFP_KERNEL); + ext_cali_start = devm_kzalloc_obj(priv->dev, *ext_cali_start); if (!ext_cali_start) return -ENOMEM; @@ -1690,8 +1687,7 @@ static int create_tas2573_cali_re_ktrl(struct tasdevice_priv struct soc_bytes_ext *ext_cali_start; char *cali_start_name; - ext_cali_start = devm_kzalloc(priv->dev, - sizeof(*ext_cali_start), GFP_KERNEL); + ext_cali_start = devm_kzalloc_obj(priv->dev, *ext_cali_start); if (!ext_cali_start) return -ENOMEM; @@ -1820,13 +1816,11 @@ static int tasdevice_create_cali_ctrls(struct tasdevice_priv *priv) * Alloc kcontrol via devm_kzalloc(), which don't manually * free the kcontrol. */ - cali_ctrls = devm_kcalloc(priv->dev, nctrls, - sizeof(cali_ctrls[0]), GFP_KERNEL); + cali_ctrls = devm_kzalloc_objs(priv->dev, cali_ctrls[0], nctrls); if (!cali_ctrls) return -ENOMEM; - ext_cali_data = devm_kzalloc(priv->dev, sizeof(*ext_cali_data), - GFP_KERNEL); + ext_cali_data = devm_kzalloc_obj(priv->dev, *ext_cali_data); if (!ext_cali_data) return -ENOMEM; diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c index a57230e01f75..3f217000f27d 100644 --- a/sound/soc/codecs/tas2783-sdw.c +++ b/sound/soc/codecs/tas2783-sdw.c @@ -1383,7 +1383,7 @@ static s32 tas_sdw_probe(struct sdw_slave *peripheral, return dev_err_probe(dev, ret, "slave property read failed"); - tas_dev = devm_kzalloc(dev, sizeof(*tas_dev), GFP_KERNEL); + tas_dev = devm_kzalloc_obj(dev, *tas_dev); if (!tas_dev) return dev_err_probe(dev, -ENOMEM, "Failed devm_kzalloc"); @@ -1405,8 +1405,7 @@ static s32 tas_sdw_probe(struct sdw_slave *peripheral, if (i >= 0 && i < peripheral->sdca_data.num_functions) { /* Allocate memory for function data */ - function_data = devm_kzalloc(dev, sizeof(*function_data), - GFP_KERNEL); + function_data = devm_kzalloc_obj(dev, *function_data); if (!function_data) return dev_err_probe(dev, -ENOMEM, "failed to parse sdca functions"); diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c index 1ab82ef1c41d..91ecb5977a79 100644 --- a/sound/soc/codecs/tas5086.c +++ b/sound/soc/codecs/tas5086.c @@ -923,7 +923,7 @@ static int tas5086_i2c_probe(struct i2c_client *i2c) struct device *dev = &i2c->dev; int i, ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c index 5e2560347461..d6c5a8874cd8 100644 --- a/sound/soc/codecs/tas571x.c +++ b/sound/soc/codecs/tas571x.c @@ -956,7 +956,7 @@ static int tas571x_i2c_probe(struct i2c_client *client) struct device *dev = &client->dev; int i, ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; i2c_set_clientdata(client, priv); diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c index 2539a097e743..e4528b9a4494 100644 --- a/sound/soc/codecs/tas5720.c +++ b/sound/soc/codecs/tas5720.c @@ -740,7 +740,7 @@ static int tas5720_probe(struct i2c_client *client) int ret; int i; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/codecs/tas5805m.c b/sound/soc/codecs/tas5805m.c index d32796a6fa75..39b219867e67 100644 --- a/sound/soc/codecs/tas5805m.c +++ b/sound/soc/codecs/tas5805m.c @@ -466,7 +466,7 @@ static int tas5805m_i2c_probe(struct i2c_client *i2c) return ret; } - tas5805m = devm_kzalloc(dev, sizeof(*tas5805m), GFP_KERNEL); + tas5805m = devm_kzalloc_obj(dev, *tas5805m); if (!tas5805m) return -ENOMEM; diff --git a/sound/soc/codecs/tas6424.c b/sound/soc/codecs/tas6424.c index 2718183e864c..5e42e0e3f194 100644 --- a/sound/soc/codecs/tas6424.c +++ b/sound/soc/codecs/tas6424.c @@ -698,7 +698,7 @@ static int tas6424_i2c_probe(struct i2c_client *client) int ret; int i; - tas6424 = devm_kzalloc(dev, sizeof(*tas6424), GFP_KERNEL); + tas6424 = devm_kzalloc_obj(dev, *tas6424); if (!tas6424) return -ENOMEM; dev_set_drvdata(dev, tas6424); diff --git a/sound/soc/codecs/tas675x.c b/sound/soc/codecs/tas675x.c index 82eeaceb1dac..e8bceecb0386 100644 --- a/sound/soc/codecs/tas675x.c +++ b/sound/soc/codecs/tas675x.c @@ -2035,7 +2035,7 @@ static int tas675x_i2c_probe(struct i2c_client *client) u32 val; int i, ret; - tas = devm_kzalloc(&client->dev, sizeof(*tas), GFP_KERNEL); + tas = devm_kzalloc_obj(&client->dev, *tas); if (!tas) return -ENOMEM; diff --git a/sound/soc/codecs/tda7419.c b/sound/soc/codecs/tda7419.c index 7ddea2fbe2d2..9e47dcfe68ce 100644 --- a/sound/soc/codecs/tda7419.c +++ b/sound/soc/codecs/tda7419.c @@ -576,9 +576,7 @@ static int tda7419_probe(struct i2c_client *i2c) struct tda7419_data *tda7419; int i, ret; - tda7419 = devm_kzalloc(&i2c->dev, - sizeof(struct tda7419_data), - GFP_KERNEL); + tda7419 = devm_kzalloc_obj(&i2c->dev, struct tda7419_data); if (tda7419 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/tfa9879.c b/sound/soc/codecs/tfa9879.c index 519103731768..70b306d8679e 100644 --- a/sound/soc/codecs/tfa9879.c +++ b/sound/soc/codecs/tfa9879.c @@ -285,7 +285,7 @@ static int tfa9879_i2c_probe(struct i2c_client *i2c) struct tfa9879_priv *tfa9879; int i; - tfa9879 = devm_kzalloc(&i2c->dev, sizeof(*tfa9879), GFP_KERNEL); + tfa9879 = devm_kzalloc_obj(&i2c->dev, *tfa9879); if (!tfa9879) return -ENOMEM; diff --git a/sound/soc/codecs/tfa989x.c b/sound/soc/codecs/tfa989x.c index 7204be155eb9..7258f185278e 100644 --- a/sound/soc/codecs/tfa989x.c +++ b/sound/soc/codecs/tfa989x.c @@ -329,7 +329,7 @@ static int tfa989x_i2c_probe(struct i2c_client *i2c) return -ENODEV; } - tfa989x = devm_kzalloc(dev, sizeof(*tfa989x), GFP_KERNEL); + tfa989x = devm_kzalloc_obj(dev, *tfa989x); if (!tfa989x) return -ENOMEM; diff --git a/sound/soc/codecs/tlv320adc3xxx.c b/sound/soc/codecs/tlv320adc3xxx.c index 79f4abc245dd..74051795dbe5 100644 --- a/sound/soc/codecs/tlv320adc3xxx.c +++ b/sound/soc/codecs/tlv320adc3xxx.c @@ -1417,7 +1417,7 @@ static int adc3xxx_i2c_probe(struct i2c_client *i2c) struct adc3xxx *adc3xxx = NULL; int ret; - adc3xxx = devm_kzalloc(dev, sizeof(struct adc3xxx), GFP_KERNEL); + adc3xxx = devm_kzalloc_obj(dev, struct adc3xxx); if (!adc3xxx) return -ENOMEM; adc3xxx->dev = dev; diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c index c29584d77649..3a22767b8316 100644 --- a/sound/soc/codecs/tlv320adcx140.c +++ b/sound/soc/codecs/tlv320adcx140.c @@ -1276,7 +1276,7 @@ static int adcx140_i2c_probe(struct i2c_client *i2c) struct adcx140_priv *adcx140; int ret; - adcx140 = devm_kzalloc(&i2c->dev, sizeof(*adcx140), GFP_KERNEL); + adcx140 = devm_kzalloc_obj(&i2c->dev, *adcx140); if (!adcx140) return -ENOMEM; diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index f31ffa189580..cbfd9930a0e8 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c @@ -604,7 +604,7 @@ int tlv320aic23_probe(struct device *dev, struct regmap *regmap) if (IS_ERR(regmap)) return PTR_ERR(regmap); - aic23 = devm_kzalloc(dev, sizeof(struct aic23), GFP_KERNEL); + aic23 = devm_kzalloc_obj(dev, struct aic23); if (aic23 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c index 7dcc960a0b9e..85434b9c3192 100644 --- a/sound/soc/codecs/tlv320aic26.c +++ b/sound/soc/codecs/tlv320aic26.c @@ -364,7 +364,7 @@ static int aic26_spi_probe(struct spi_device *spi) dev_dbg(&spi->dev, "probing tlv320aic26 spi device\n"); /* Allocate driver data */ - aic26 = devm_kzalloc(&spi->dev, sizeof *aic26, GFP_KERNEL); + aic26 = devm_kzalloc_obj(&spi->dev, *aic26); if (!aic26) return -ENOMEM; diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index e0a8db435d6a..c9fd93e26468 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c @@ -1732,7 +1732,7 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c) unsigned int micbias_value = MICBIAS_2_0V; int i, ret; - aic31xx = devm_kzalloc(&i2c->dev, sizeof(*aic31xx), GFP_KERNEL); + aic31xx = devm_kzalloc_obj(&i2c->dev, *aic31xx); if (!aic31xx) return -ENOMEM; diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c index 27d186c72315..9ab794de823f 100644 --- a/sound/soc/codecs/tlv320aic32x4-clk.c +++ b/sound/soc/codecs/tlv320aic32x4-clk.c @@ -467,7 +467,7 @@ static struct clk *aic32x4_register_clk(struct device *dev, init.num_parents = desc->num_parents; init.flags = 0; - priv = devm_kzalloc(dev, sizeof(struct clk_aic32x4), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, struct clk_aic32x4); if (!priv) return ERR_PTR(-ENOMEM); diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c index 2ee4a9d2abf2..875d934bb5c8 100644 --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c @@ -1299,7 +1299,7 @@ int aic32x4_probe(struct device *dev, struct regmap *regmap, struct device_node *np = dev->of_node; int ret; - aic32x4 = devm_kzalloc(dev, sizeof(struct aic32x4_priv), GFP_KERNEL); + aic32x4 = devm_kzalloc_obj(dev, struct aic32x4_priv); if (!aic32x4) return -ENOMEM; diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index be83111accaa..032f32097131 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c @@ -1765,7 +1765,7 @@ int aic3x_probe(struct device *dev, struct regmap *regmap, kernel_ulong_t driver int ret, i; u32 value; - aic3x = devm_kzalloc(dev, sizeof(struct aic3x_priv), GFP_KERNEL); + aic3x = devm_kzalloc_obj(dev, struct aic3x_priv); if (!aic3x) return -ENOMEM; @@ -1779,7 +1779,7 @@ int aic3x_probe(struct device *dev, struct regmap *regmap, kernel_ulong_t driver dev_set_drvdata(dev, aic3x); if (np) { - ai3x_setup = devm_kzalloc(dev, sizeof(*ai3x_setup), GFP_KERNEL); + ai3x_setup = devm_kzalloc_obj(dev, *ai3x_setup); if (!ai3x_setup) return -ENOMEM; diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index b91ab42882d1..75bda2cc8c71 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c @@ -1471,8 +1471,8 @@ static int dac33_i2c_probe(struct i2c_client *client) struct tlv320dac33_priv *dac33; int ret, i; - dac33 = devm_kzalloc(&client->dev, struct_size(dac33, reg_cache, ARRAY_SIZE(dac33_reg)), - GFP_KERNEL); + dac33 = devm_kzalloc_flex(&client->dev, *dac33, reg_cache, + ARRAY_SIZE(dac33_reg)); if (dac33 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index 38cc000891ea..ac9ef8fd67d7 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c @@ -215,7 +215,7 @@ static int tpa6130a2_probe(struct i2c_client *client) dev = &client->dev; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&client->dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/codecs/ts3a227e.c b/sound/soc/codecs/ts3a227e.c index 39284e4d420e..dfd16ac19469 100644 --- a/sound/soc/codecs/ts3a227e.c +++ b/sound/soc/codecs/ts3a227e.c @@ -354,7 +354,7 @@ static int ts3a227e_i2c_probe(struct i2c_client *i2c) int ret; unsigned int acc_reg; - ts3a227e = devm_kzalloc(&i2c->dev, sizeof(*ts3a227e), GFP_KERNEL); + ts3a227e = devm_kzalloc_obj(&i2c->dev, *ts3a227e); if (ts3a227e == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/tscs42xx.c b/sound/soc/codecs/tscs42xx.c index 02082ef790b4..993233b0fd1e 100644 --- a/sound/soc/codecs/tscs42xx.c +++ b/sound/soc/codecs/tscs42xx.c @@ -1389,7 +1389,7 @@ static int tscs42xx_i2c_probe(struct i2c_client *i2c) int src; int ret; - tscs42xx = devm_kzalloc(&i2c->dev, sizeof(*tscs42xx), GFP_KERNEL); + tscs42xx = devm_kzalloc_obj(&i2c->dev, *tscs42xx); if (!tscs42xx) { ret = -ENOMEM; dev_err(&i2c->dev, diff --git a/sound/soc/codecs/tscs454.c b/sound/soc/codecs/tscs454.c index e772dd39a849..494170746a1a 100644 --- a/sound/soc/codecs/tscs454.c +++ b/sound/soc/codecs/tscs454.c @@ -3395,7 +3395,7 @@ static int tscs454_i2c_probe(struct i2c_client *i2c) int src; int ret; - tscs454 = devm_kzalloc(&i2c->dev, sizeof(*tscs454), GFP_KERNEL); + tscs454 = devm_kzalloc_obj(&i2c->dev, *tscs454); if (!tscs454) return -ENOMEM; diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 7117af5a1a56..e207721b9941 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c @@ -221,9 +221,8 @@ twl4030_get_board_params(struct device *dev) "codec"); if (twl4030_codec_node) { - board_params = devm_kzalloc(dev, - sizeof(struct twl4030_board_params), - GFP_KERNEL); + board_params = devm_kzalloc_obj(dev, + struct twl4030_board_params); if (!board_params) { of_node_put(twl4030_codec_node); return ERR_PTR(-ENOMEM); @@ -2192,7 +2191,7 @@ static int twl4030_codec_probe(struct platform_device *pdev) struct twl4030_priv *twl4030; int ret; - twl4030 = devm_kzalloc(&pdev->dev, sizeof(*twl4030), GFP_KERNEL); + twl4030 = devm_kzalloc_obj(&pdev->dev, *twl4030); if (!twl4030) return -ENOMEM; diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 650836f9615f..4cc8253ac28a 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c @@ -1100,7 +1100,7 @@ static int twl6040_probe(struct snd_soc_component *component) struct platform_device *pdev = to_platform_device(component->dev); int ret = 0; - priv = devm_kzalloc(component->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(component->dev, *priv); if (priv == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/uda1334.c b/sound/soc/codecs/uda1334.c index 7ae6afdba38b..37a3b1edc90d 100644 --- a/sound/soc/codecs/uda1334.c +++ b/sound/soc/codecs/uda1334.c @@ -254,8 +254,7 @@ static int uda1334_codec_probe(struct platform_device *pdev) struct uda1334_priv *uda1334; int ret; - uda1334 = devm_kzalloc(&pdev->dev, sizeof(struct uda1334_priv), - GFP_KERNEL); + uda1334 = devm_kzalloc_obj(&pdev->dev, struct uda1334_priv); if (!uda1334) return -ENOMEM; diff --git a/sound/soc/codecs/uda1342.c b/sound/soc/codecs/uda1342.c index 63d087590ac9..b9031a884620 100644 --- a/sound/soc/codecs/uda1342.c +++ b/sound/soc/codecs/uda1342.c @@ -287,7 +287,7 @@ static int uda1342_i2c_probe(struct i2c_client *i2c) { struct uda1342_priv *uda1342; - uda1342 = devm_kzalloc(&i2c->dev, sizeof(*uda1342), GFP_KERNEL); + uda1342 = devm_kzalloc_obj(&i2c->dev, *uda1342); if (!uda1342) return -ENOMEM; diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index 02adc534dfb0..d2a64740d5df 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c @@ -778,9 +778,8 @@ static int uda1380_i2c_probe(struct i2c_client *i2c) struct uda1380_priv *uda1380; int ret; - uda1380 = devm_kzalloc(&i2c->dev, - struct_size(uda1380, reg_cache, ARRAY_SIZE(uda1380_reg)), - GFP_KERNEL); + uda1380 = devm_kzalloc_flex(&i2c->dev, *uda1380, reg_cache, + ARRAY_SIZE(uda1380_reg)); if (uda1380 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index fcce0afdce49..210b0ecdb6ef 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -5078,7 +5078,7 @@ static int wcd9335_slim_probe(struct slim_device *slim) struct wcd9335_codec *wcd; int ret; - wcd = devm_kzalloc(dev, sizeof(*wcd), GFP_KERNEL); + wcd = devm_kzalloc_obj(dev, *wcd); if (!wcd) return -ENOMEM; diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index 274f2e579ad8..5cd30a5ed69c 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -5839,7 +5839,7 @@ static int wcd934x_codec_probe(struct platform_device *pdev) struct wcd934x_codec *wcd; int ret, irq; - wcd = devm_kzalloc(dev, sizeof(*wcd), GFP_KERNEL); + wcd = devm_kzalloc_obj(dev, *wcd); if (!wcd) return -ENOMEM; diff --git a/sound/soc/codecs/wcd9378-sdca.c b/sound/soc/codecs/wcd9378-sdca.c index 7c15f885390c..efbbeb3dc721 100644 --- a/sound/soc/codecs/wcd9378-sdca.c +++ b/sound/soc/codecs/wcd9378-sdca.c @@ -892,7 +892,7 @@ int wcd9378_sdca_read_prop(struct sdw_slave *slave) /* Sink ports: DP6 (HPH audio), DP7 (HPH envelope), DP8 (optimisation RX). */ prop->sink_ports = BIT(6) | BIT(7) | BIT(8); - src = devm_kcalloc(dev, 2, sizeof(*src), GFP_KERNEL); + src = devm_kzalloc_objs(dev, *src, 2); if (!src) return -ENOMEM; @@ -912,7 +912,7 @@ int wcd9378_sdca_read_prop(struct sdw_slave *slave) prop->src_dpn_prop = src; - sink = devm_kcalloc(dev, 3, sizeof(*sink), GFP_KERNEL); + sink = devm_kzalloc_objs(dev, *sink, 3); if (!sink) return -ENOMEM; @@ -987,7 +987,7 @@ int wcd9378_sdca_probe(struct sdw_slave *slave, if (!device_property_read_bool(dev, "qcom,sdca-compliant")) return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/wcd937x-sdw.c b/sound/soc/codecs/wcd937x-sdw.c index 1ad75c226060..57549518767c 100644 --- a/sound/soc/codecs/wcd937x-sdw.c +++ b/sound/soc/codecs/wcd937x-sdw.c @@ -970,7 +970,7 @@ static int wcd9370_probe(struct sdw_slave *pdev, int master_ch_mask_size = 0; int ret, i; - wcd = devm_kzalloc(dev, sizeof(*wcd), GFP_KERNEL); + wcd = devm_kzalloc_obj(dev, *wcd); if (!wcd) return -ENOMEM; diff --git a/sound/soc/codecs/wcd937x.c b/sound/soc/codecs/wcd937x.c index 7ffbb445f8ac..b64fc16d5036 100644 --- a/sound/soc/codecs/wcd937x.c +++ b/sound/soc/codecs/wcd937x.c @@ -2909,7 +2909,7 @@ static int wcd937x_probe(struct platform_device *pdev) struct wcd_mbhc_config *cfg; int ret; - wcd937x = devm_kzalloc(dev, sizeof(*wcd937x), GFP_KERNEL); + wcd937x = devm_kzalloc_obj(dev, *wcd937x); if (!wcd937x) return -ENOMEM; diff --git a/sound/soc/codecs/wcd938x-sdw.c b/sound/soc/codecs/wcd938x-sdw.c index e5ad368418a2..d61ab5a6b059 100644 --- a/sound/soc/codecs/wcd938x-sdw.c +++ b/sound/soc/codecs/wcd938x-sdw.c @@ -1156,7 +1156,7 @@ static int wcd9380_probe(struct sdw_slave *pdev, struct wcd938x_sdw_priv *wcd; int ret; - wcd = devm_kzalloc(dev, sizeof(*wcd), GFP_KERNEL); + wcd = devm_kzalloc_obj(dev, *wcd); if (!wcd) return -ENOMEM; diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index 9a9ea37ecab3..1c4833584b5e 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -3476,8 +3476,7 @@ static int wcd938x_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - wcd938x = devm_kzalloc(dev, sizeof(struct wcd938x_priv), - GFP_KERNEL); + wcd938x = devm_kzalloc_obj(dev, struct wcd938x_priv); if (!wcd938x) return -ENOMEM; diff --git a/sound/soc/codecs/wcd939x-sdw.c b/sound/soc/codecs/wcd939x-sdw.c index 69b9b08118f0..495761e96bdd 100644 --- a/sound/soc/codecs/wcd939x-sdw.c +++ b/sound/soc/codecs/wcd939x-sdw.c @@ -1341,7 +1341,7 @@ static int wcd9390_probe(struct sdw_slave *pdev, const struct sdw_device_id *id) struct wcd939x_sdw_priv *wcd; int ret; - wcd = devm_kzalloc(dev, sizeof(*wcd), GFP_KERNEL); + wcd = devm_kzalloc_obj(dev, *wcd); if (!wcd) return -ENOMEM; diff --git a/sound/soc/codecs/wcd939x.c b/sound/soc/codecs/wcd939x.c index 2d463f062e6d..6461501993ec 100644 --- a/sound/soc/codecs/wcd939x.c +++ b/sound/soc/codecs/wcd939x.c @@ -3540,8 +3540,7 @@ static int wcd939x_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - wcd939x = devm_kzalloc(dev, sizeof(struct wcd939x_priv), - GFP_KERNEL); + wcd939x = devm_kzalloc_obj(dev, struct wcd939x_priv); if (!wcd939x) return -ENOMEM; diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c index c44abffe9b56..26ec2df66a80 100644 --- a/sound/soc/codecs/wm0010.c +++ b/sound/soc/codecs/wm0010.c @@ -837,8 +837,7 @@ static int wm0010_spi_probe(struct spi_device *spi) int irq; struct wm0010_priv *wm0010; - wm0010 = devm_kzalloc(&spi->dev, sizeof(*wm0010), - GFP_KERNEL); + wm0010 = devm_kzalloc_obj(&spi->dev, *wm0010); if (!wm0010) return -ENOMEM; diff --git a/sound/soc/codecs/wm1250-ev1.c b/sound/soc/codecs/wm1250-ev1.c index 5c1b00acb5bf..bce1487e0f23 100644 --- a/sound/soc/codecs/wm1250-ev1.c +++ b/sound/soc/codecs/wm1250-ev1.c @@ -133,7 +133,7 @@ static int wm1250_ev1_pdata(struct i2c_client *i2c) if (!pdata) return 0; - wm1250 = devm_kzalloc(&i2c->dev, sizeof(*wm1250), GFP_KERNEL); + wm1250 = devm_kzalloc_obj(&i2c->dev, *wm1250); if (!wm1250) return -ENOMEM; diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index 41c8cfb346c6..f01fbc6e6ea0 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c @@ -801,7 +801,7 @@ static int wm2000_i2c_probe(struct i2c_client *i2c) unsigned int reg; u16 id; - wm2000 = devm_kzalloc(&i2c->dev, sizeof(*wm2000), GFP_KERNEL); + wm2000 = devm_kzalloc_obj(&i2c->dev, *wm2000); if (!wm2000) return -ENOMEM; diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c index 692e933dba75..e07966ebc84c 100644 --- a/sound/soc/codecs/wm2200.c +++ b/sound/soc/codecs/wm2200.c @@ -2196,8 +2196,7 @@ static int wm2200_i2c_probe(struct i2c_client *i2c) int ret, i; int val; - wm2200 = devm_kzalloc(&i2c->dev, sizeof(struct wm2200_priv), - GFP_KERNEL); + wm2200 = devm_kzalloc_obj(&i2c->dev, struct wm2200_priv); if (wm2200 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index cdee1561d596..05e3f8a6bf99 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -2413,8 +2413,7 @@ static int wm5100_i2c_probe(struct i2c_client *i2c) unsigned int reg; int ret, i, irq_flags; - wm5100 = devm_kzalloc(&i2c->dev, sizeof(struct wm5100_priv), - GFP_KERNEL); + wm5100 = devm_kzalloc_obj(&i2c->dev, struct wm5100_priv); if (wm5100 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index 74b775b95bfd..762e81979cb8 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c @@ -2035,8 +2035,7 @@ static int wm5102_probe(struct platform_device *pdev) struct wm5102_priv *wm5102; int i, ret; - wm5102 = devm_kzalloc(&pdev->dev, sizeof(struct wm5102_priv), - GFP_KERNEL); + wm5102 = devm_kzalloc_obj(&pdev->dev, struct wm5102_priv); if (wm5102 == NULL) return -ENOMEM; platform_set_drvdata(pdev, wm5102); diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index 7a311c869bd3..faa85d88a489 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -2397,8 +2397,7 @@ static int wm5110_probe(struct platform_device *pdev) struct wm5110_priv *wm5110; int i, ret; - wm5110 = devm_kzalloc(&pdev->dev, sizeof(struct wm5110_priv), - GFP_KERNEL); + wm5110 = devm_kzalloc_obj(&pdev->dev, struct wm5110_priv); if (wm5110 == NULL) return -ENOMEM; platform_set_drvdata(pdev, wm5110); diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index 0e7c8a5fae72..aaa7edab0487 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c @@ -1492,8 +1492,7 @@ static int wm8350_component_probe(struct snd_soc_component *component) return -EINVAL; } - priv = devm_kzalloc(component->dev, sizeof(struct wm8350_data), - GFP_KERNEL); + priv = devm_kzalloc_obj(component->dev, struct wm8350_data); if (priv == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index 83e2d72a4a76..300729907264 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c @@ -1275,8 +1275,7 @@ static int wm8400_component_probe(struct snd_soc_component *component) int ret; u16 reg; - priv = devm_kzalloc(component->dev, sizeof(struct wm8400_priv), - GFP_KERNEL); + priv = devm_kzalloc_obj(component->dev, struct wm8400_priv); if (priv == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index 2d48bfffcebe..8f9177ed1a5d 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c @@ -630,8 +630,7 @@ static int wm8510_spi_probe(struct spi_device *spi) struct wm8510_priv *wm8510; int ret; - wm8510 = devm_kzalloc(&spi->dev, sizeof(struct wm8510_priv), - GFP_KERNEL); + wm8510 = devm_kzalloc_obj(&spi->dev, struct wm8510_priv); if (wm8510 == NULL) return -ENOMEM; @@ -662,8 +661,7 @@ static int wm8510_i2c_probe(struct i2c_client *i2c) struct wm8510_priv *wm8510; int ret; - wm8510 = devm_kzalloc(&i2c->dev, sizeof(struct wm8510_priv), - GFP_KERNEL); + wm8510 = devm_kzalloc_obj(&i2c->dev, struct wm8510_priv); if (wm8510 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c index 9972d6599002..610282765d57 100644 --- a/sound/soc/codecs/wm8523.c +++ b/sound/soc/codecs/wm8523.c @@ -461,8 +461,7 @@ static int wm8523_i2c_probe(struct i2c_client *i2c) unsigned int val; int ret, i; - wm8523 = devm_kzalloc(&i2c->dev, sizeof(struct wm8523_priv), - GFP_KERNEL); + wm8523 = devm_kzalloc_obj(&i2c->dev, struct wm8523_priv); if (wm8523 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8524.c b/sound/soc/codecs/wm8524.c index 8d0565b103cd..e2a5debc8385 100644 --- a/sound/soc/codecs/wm8524.c +++ b/sound/soc/codecs/wm8524.c @@ -250,8 +250,7 @@ static int wm8524_codec_probe(struct platform_device *pdev) struct wm8524_priv *wm8524; int ret; - wm8524 = devm_kzalloc(&pdev->dev, sizeof(struct wm8524_priv), - GFP_KERNEL); + wm8524 = devm_kzalloc_obj(&pdev->dev, struct wm8524_priv); if (wm8524 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index cee80da8f753..4df9b6620b58 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c @@ -1025,8 +1025,7 @@ static int wm8580_i2c_probe(struct i2c_client *i2c) struct wm8580_priv *wm8580; int ret, i; - wm8580 = devm_kzalloc(&i2c->dev, sizeof(struct wm8580_priv), - GFP_KERNEL); + wm8580 = devm_kzalloc_obj(&i2c->dev, struct wm8580_priv); if (wm8580 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c index 390af15a749a..eb515a8277c0 100644 --- a/sound/soc/codecs/wm8711.c +++ b/sound/soc/codecs/wm8711.c @@ -417,8 +417,7 @@ static int wm8711_spi_probe(struct spi_device *spi) struct wm8711_priv *wm8711; int ret; - wm8711 = devm_kzalloc(&spi->dev, sizeof(struct wm8711_priv), - GFP_KERNEL); + wm8711 = devm_kzalloc_obj(&spi->dev, struct wm8711_priv); if (wm8711 == NULL) return -ENOMEM; @@ -449,8 +448,7 @@ static int wm8711_i2c_probe(struct i2c_client *client) struct wm8711_priv *wm8711; int ret; - wm8711 = devm_kzalloc(&client->dev, sizeof(struct wm8711_priv), - GFP_KERNEL); + wm8711 = devm_kzalloc_obj(&client->dev, struct wm8711_priv); if (wm8711 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c index 7af5ce0fffe0..5ede2164374c 100644 --- a/sound/soc/codecs/wm8728.c +++ b/sound/soc/codecs/wm8728.c @@ -254,8 +254,7 @@ static int wm8728_spi_probe(struct spi_device *spi) struct wm8728_priv *wm8728; int ret; - wm8728 = devm_kzalloc(&spi->dev, sizeof(struct wm8728_priv), - GFP_KERNEL); + wm8728 = devm_kzalloc_obj(&spi->dev, struct wm8728_priv); if (wm8728 == NULL) return -ENOMEM; @@ -286,8 +285,7 @@ static int wm8728_i2c_probe(struct i2c_client *i2c) struct wm8728_priv *wm8728; int ret; - wm8728 = devm_kzalloc(&i2c->dev, sizeof(struct wm8728_priv), - GFP_KERNEL); + wm8728 = devm_kzalloc_obj(&i2c->dev, struct wm8728_priv); if (wm8728 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8731-i2c.c b/sound/soc/codecs/wm8731-i2c.c index f44f4d3d9394..52c326115046 100644 --- a/sound/soc/codecs/wm8731-i2c.c +++ b/sound/soc/codecs/wm8731-i2c.c @@ -27,8 +27,7 @@ static int wm8731_i2c_probe(struct i2c_client *i2c) struct wm8731_priv *wm8731; int ret; - wm8731 = devm_kzalloc(&i2c->dev, sizeof(struct wm8731_priv), - GFP_KERNEL); + wm8731 = devm_kzalloc_obj(&i2c->dev, struct wm8731_priv); if (wm8731 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8731-spi.c b/sound/soc/codecs/wm8731-spi.c index 29e58e1e6b79..fe18eac20b43 100644 --- a/sound/soc/codecs/wm8731-spi.c +++ b/sound/soc/codecs/wm8731-spi.c @@ -26,7 +26,7 @@ static int wm8731_spi_probe(struct spi_device *spi) struct wm8731_priv *wm8731; int ret; - wm8731 = devm_kzalloc(&spi->dev, sizeof(*wm8731), GFP_KERNEL); + wm8731 = devm_kzalloc_obj(&spi->dev, *wm8731); if (wm8731 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c index 7f59dc6c74c0..10489c557f83 100644 --- a/sound/soc/codecs/wm8737.c +++ b/sound/soc/codecs/wm8737.c @@ -622,8 +622,7 @@ static int wm8737_i2c_probe(struct i2c_client *i2c) struct wm8737_priv *wm8737; int ret, i; - wm8737 = devm_kzalloc(&i2c->dev, sizeof(struct wm8737_priv), - GFP_KERNEL); + wm8737 = devm_kzalloc_obj(&i2c->dev, struct wm8737_priv); if (wm8737 == NULL) return -ENOMEM; @@ -672,8 +671,7 @@ static int wm8737_spi_probe(struct spi_device *spi) struct wm8737_priv *wm8737; int ret, i; - wm8737 = devm_kzalloc(&spi->dev, sizeof(struct wm8737_priv), - GFP_KERNEL); + wm8737 = devm_kzalloc_obj(&spi->dev, struct wm8737_priv); if (wm8737 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c index e49adc9808b4..3fb02447f0f5 100644 --- a/sound/soc/codecs/wm8741.c +++ b/sound/soc/codecs/wm8741.c @@ -582,8 +582,7 @@ static int wm8741_i2c_probe(struct i2c_client *i2c) struct wm8741_priv *wm8741; int ret, i; - wm8741 = devm_kzalloc(&i2c->dev, sizeof(struct wm8741_priv), - GFP_KERNEL); + wm8741 = devm_kzalloc_obj(&i2c->dev, struct wm8741_priv); if (wm8741 == NULL) return -ENOMEM; @@ -640,8 +639,7 @@ static int wm8741_spi_probe(struct spi_device *spi) struct wm8741_priv *wm8741; int ret, i; - wm8741 = devm_kzalloc(&spi->dev, sizeof(struct wm8741_priv), - GFP_KERNEL); + wm8741 = devm_kzalloc_obj(&spi->dev, struct wm8741_priv); if (wm8741 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index e87b7d5e94e2..439763e3944e 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c @@ -759,8 +759,7 @@ static int wm8750_spi_probe(struct spi_device *spi) struct regmap *regmap; int ret; - wm8750 = devm_kzalloc(&spi->dev, sizeof(struct wm8750_priv), - GFP_KERNEL); + wm8750 = devm_kzalloc_obj(&spi->dev, struct wm8750_priv); if (wm8750 == NULL) return -ENOMEM; @@ -799,8 +798,7 @@ static int wm8750_i2c_probe(struct i2c_client *i2c) struct regmap *regmap; int ret; - wm8750 = devm_kzalloc(&i2c->dev, sizeof(struct wm8750_priv), - GFP_KERNEL); + wm8750 = devm_kzalloc_obj(&i2c->dev, struct wm8750_priv); if (wm8750 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index cbdf1e6aea5b..86b0477c738b 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c @@ -1538,8 +1538,7 @@ static int wm8753_spi_probe(struct spi_device *spi) struct wm8753_priv *wm8753; int ret; - wm8753 = devm_kzalloc(&spi->dev, sizeof(struct wm8753_priv), - GFP_KERNEL); + wm8753 = devm_kzalloc_obj(&spi->dev, struct wm8753_priv); if (wm8753 == NULL) return -ENOMEM; @@ -1576,8 +1575,7 @@ static int wm8753_i2c_probe(struct i2c_client *i2c) struct wm8753_priv *wm8753; int ret; - wm8753 = devm_kzalloc(&i2c->dev, sizeof(struct wm8753_priv), - GFP_KERNEL); + wm8753 = devm_kzalloc_obj(&i2c->dev, struct wm8753_priv); if (wm8753 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c index 1e485d2fe21a..6bc725547b24 100644 --- a/sound/soc/codecs/wm8770.c +++ b/sound/soc/codecs/wm8770.c @@ -653,8 +653,7 @@ static int wm8770_spi_probe(struct spi_device *spi) struct wm8770_priv *wm8770; int ret, i; - wm8770 = devm_kzalloc(&spi->dev, sizeof(struct wm8770_priv), - GFP_KERNEL); + wm8770 = devm_kzalloc_obj(&spi->dev, struct wm8770_priv); if (!wm8770) return -ENOMEM; diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index c633fe824356..8fcc720859a6 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c @@ -475,8 +475,7 @@ static int wm8776_spi_probe(struct spi_device *spi) struct wm8776_priv *wm8776; int ret; - wm8776 = devm_kzalloc(&spi->dev, sizeof(struct wm8776_priv), - GFP_KERNEL); + wm8776 = devm_kzalloc_obj(&spi->dev, struct wm8776_priv); if (wm8776 == NULL) return -ENOMEM; @@ -507,8 +506,7 @@ static int wm8776_i2c_probe(struct i2c_client *i2c) struct wm8776_priv *wm8776; int ret; - wm8776 = devm_kzalloc(&i2c->dev, sizeof(struct wm8776_priv), - GFP_KERNEL); + wm8776 = devm_kzalloc_obj(&i2c->dev, struct wm8776_priv); if (wm8776 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8782.c b/sound/soc/codecs/wm8782.c index cbf0c823c022..4df5835fc516 100644 --- a/sound/soc/codecs/wm8782.c +++ b/sound/soc/codecs/wm8782.c @@ -133,7 +133,7 @@ static int wm8782_probe(struct platform_device *pdev) struct wm8782_priv *priv; int ret, i, fsampen; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c index 2fc9634fe51f..d02911395d04 100644 --- a/sound/soc/codecs/wm8804.c +++ b/sound/soc/codecs/wm8804.c @@ -579,7 +579,7 @@ int wm8804_probe(struct device *dev, struct regmap *regmap) unsigned int id1, id2; int i, ret; - wm8804 = devm_kzalloc(dev, sizeof(*wm8804), GFP_KERNEL); + wm8804 = devm_kzalloc_obj(dev, *wm8804); if (!wm8804) return -ENOMEM; diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index dcda7a7be0b1..cb75b2387c70 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c @@ -1256,8 +1256,7 @@ static int wm8900_spi_probe(struct spi_device *spi) struct wm8900_priv *wm8900; int ret; - wm8900 = devm_kzalloc(&spi->dev, sizeof(struct wm8900_priv), - GFP_KERNEL); + wm8900 = devm_kzalloc_obj(&spi->dev, struct wm8900_priv); if (wm8900 == NULL) return -ENOMEM; @@ -1287,8 +1286,7 @@ static int wm8900_i2c_probe(struct i2c_client *i2c) struct wm8900_priv *wm8900; int ret; - wm8900 = devm_kzalloc(&i2c->dev, sizeof(struct wm8900_priv), - GFP_KERNEL); + wm8900 = devm_kzalloc_obj(&i2c->dev, struct wm8900_priv); if (wm8900 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 553f8d68a546..7a49b828c992 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -2009,7 +2009,7 @@ static int wm8903_i2c_probe(struct i2c_client *i2c) unsigned int val, irq_pol; int ret, i; - wm8903 = devm_kzalloc(&i2c->dev, sizeof(*wm8903), GFP_KERNEL); + wm8903 = devm_kzalloc_obj(&i2c->dev, *wm8903); if (wm8903 == NULL) return -ENOMEM; @@ -2030,8 +2030,7 @@ static int wm8903_i2c_probe(struct i2c_client *i2c) if (pdata) { wm8903->pdata = pdata; } else { - wm8903->pdata = devm_kzalloc(&i2c->dev, sizeof(*wm8903->pdata), - GFP_KERNEL); + wm8903->pdata = devm_kzalloc_obj(&i2c->dev, *wm8903->pdata); if (!wm8903->pdata) return -ENOMEM; diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index ea7eee742a33..eb3004942774 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c @@ -2447,7 +2447,7 @@ static int wm8904_set_pdata_from_of(struct i2c_client *i2c, struct wm8904_pdata *pdata; int ret, i; - pdata = devm_kzalloc(&i2c->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&i2c->dev, *pdata); if (!pdata) return -ENOMEM; @@ -2487,8 +2487,7 @@ static int wm8904_i2c_probe(struct i2c_client *i2c) unsigned int val; int ret, i; - wm8904 = devm_kzalloc(&i2c->dev, sizeof(struct wm8904_priv), - GFP_KERNEL); + wm8904 = devm_kzalloc_obj(&i2c->dev, struct wm8904_priv); if (wm8904 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index 012556215d12..43d08d3bd4a1 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c @@ -846,8 +846,7 @@ static int wm8940_i2c_probe(struct i2c_client *i2c) struct wm8940_priv *wm8940; int ret; - wm8940 = devm_kzalloc(&i2c->dev, sizeof(struct wm8940_priv), - GFP_KERNEL); + wm8940 = devm_kzalloc_obj(&i2c->dev, struct wm8940_priv); if (wm8940 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c index 70daf9e6433b..3189402a1003 100644 --- a/sound/soc/codecs/wm8955.c +++ b/sound/soc/codecs/wm8955.c @@ -982,8 +982,7 @@ static int wm8955_i2c_probe(struct i2c_client *i2c) struct wm8955_priv *wm8955; int i, ret; - wm8955 = devm_kzalloc(&i2c->dev, sizeof(struct wm8955_priv), - GFP_KERNEL); + wm8955 = devm_kzalloc_obj(&i2c->dev, struct wm8955_priv); if (wm8955 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 093530ae872b..7c24c992ffbe 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -1446,8 +1446,7 @@ static int wm8960_i2c_probe(struct i2c_client *i2c) int ret; u8 val; - wm8960 = devm_kzalloc(&i2c->dev, sizeof(struct wm8960_priv), - GFP_KERNEL); + wm8960 = devm_kzalloc_obj(&i2c->dev, struct wm8960_priv); if (wm8960 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index 55ccac7286c9..13716035a6e9 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c @@ -935,8 +935,7 @@ static int wm8961_i2c_probe(struct i2c_client *i2c) unsigned int val; int ret; - wm8961 = devm_kzalloc(&i2c->dev, sizeof(struct wm8961_priv), - GFP_KERNEL); + wm8961 = devm_kzalloc_obj(&i2c->dev, struct wm8961_priv); if (wm8961 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index db8b86d522ff..148480e4124f 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -3665,7 +3665,7 @@ static int wm8962_i2c_probe(struct i2c_client *i2c) unsigned int reg; int ret, i, irq_pol, trigger; - wm8962 = devm_kzalloc(&i2c->dev, sizeof(*wm8962), GFP_KERNEL); + wm8962 = devm_kzalloc_obj(&i2c->dev, *wm8962); if (wm8962 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index 388ee05d4520..865a5d7903c0 100644 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c @@ -689,8 +689,7 @@ static int wm8971_i2c_probe(struct i2c_client *i2c) { struct wm8971_priv *wm8971; - wm8971 = devm_kzalloc(&i2c->dev, sizeof(struct wm8971_priv), - GFP_KERNEL); + wm8971 = devm_kzalloc_obj(&i2c->dev, struct wm8971_priv); if (wm8971 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index 5e1737d455b1..0c5aab627ba1 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c @@ -712,7 +712,7 @@ static int wm8974_i2c_probe(struct i2c_client *i2c) struct regmap *regmap; int ret; - priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&i2c->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c index 258bc9f88f52..1f860261c305 100644 --- a/sound/soc/codecs/wm8978.c +++ b/sound/soc/codecs/wm8978.c @@ -1039,8 +1039,7 @@ static int wm8978_i2c_probe(struct i2c_client *i2c) struct wm8978_priv *wm8978; int ret; - wm8978 = devm_kzalloc(&i2c->dev, sizeof(struct wm8978_priv), - GFP_KERNEL); + wm8978 = devm_kzalloc_obj(&i2c->dev, struct wm8978_priv); if (wm8978 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8983.c b/sound/soc/codecs/wm8983.c index d4b0f8e141cd..336772f0676c 100644 --- a/sound/soc/codecs/wm8983.c +++ b/sound/soc/codecs/wm8983.c @@ -1020,7 +1020,7 @@ static int wm8983_spi_probe(struct spi_device *spi) struct wm8983_priv *wm8983; int ret; - wm8983 = devm_kzalloc(&spi->dev, sizeof *wm8983, GFP_KERNEL); + wm8983 = devm_kzalloc_obj(&spi->dev, *wm8983); if (!wm8983) return -ENOMEM; @@ -1052,7 +1052,7 @@ static int wm8983_i2c_probe(struct i2c_client *i2c) struct wm8983_priv *wm8983; int ret; - wm8983 = devm_kzalloc(&i2c->dev, sizeof *wm8983, GFP_KERNEL); + wm8983 = devm_kzalloc_obj(&i2c->dev, *wm8983); if (!wm8983) return -ENOMEM; diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c index 9264374bb8e4..44476126dced 100644 --- a/sound/soc/codecs/wm8985.c +++ b/sound/soc/codecs/wm8985.c @@ -1162,7 +1162,7 @@ static int wm8985_spi_probe(struct spi_device *spi) struct wm8985_priv *wm8985; int ret; - wm8985 = devm_kzalloc(&spi->dev, sizeof *wm8985, GFP_KERNEL); + wm8985 = devm_kzalloc_obj(&spi->dev, *wm8985); if (!wm8985) return -ENOMEM; @@ -1202,7 +1202,7 @@ static int wm8985_i2c_probe(struct i2c_client *i2c) struct wm8985_priv *wm8985; int ret; - wm8985 = devm_kzalloc(&i2c->dev, sizeof *wm8985, GFP_KERNEL); + wm8985 = devm_kzalloc_obj(&i2c->dev, *wm8985); if (!wm8985) return -ENOMEM; diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index 6f97c9aa453a..9835a78cd894 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c @@ -857,8 +857,7 @@ static int wm8988_spi_probe(struct spi_device *spi) struct wm8988_priv *wm8988; int ret; - wm8988 = devm_kzalloc(&spi->dev, sizeof(struct wm8988_priv), - GFP_KERNEL); + wm8988 = devm_kzalloc_obj(&spi->dev, struct wm8988_priv); if (wm8988 == NULL) return -ENOMEM; @@ -890,8 +889,7 @@ static int wm8988_i2c_probe(struct i2c_client *i2c) struct wm8988_priv *wm8988; int ret; - wm8988 = devm_kzalloc(&i2c->dev, sizeof(struct wm8988_priv), - GFP_KERNEL); + wm8988 = devm_kzalloc_obj(&i2c->dev, struct wm8988_priv); if (wm8988 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index a5e032a3f9f6..1e108fa8365e 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c @@ -1236,8 +1236,7 @@ static int wm8990_i2c_probe(struct i2c_client *i2c) struct wm8990_priv *wm8990; int ret; - wm8990 = devm_kzalloc(&i2c->dev, sizeof(struct wm8990_priv), - GFP_KERNEL); + wm8990 = devm_kzalloc_obj(&i2c->dev, struct wm8990_priv); if (wm8990 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c index 553022bcd666..e1b0b4487460 100644 --- a/sound/soc/codecs/wm8991.c +++ b/sound/soc/codecs/wm8991.c @@ -1272,7 +1272,7 @@ static int wm8991_i2c_probe(struct i2c_client *i2c) unsigned int val; int ret; - wm8991 = devm_kzalloc(&i2c->dev, sizeof(*wm8991), GFP_KERNEL); + wm8991 = devm_kzalloc_obj(&i2c->dev, *wm8991); if (!wm8991) return -ENOMEM; diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index 934fa41a53cf..fbadbb33b607 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c @@ -1650,8 +1650,7 @@ static int wm8993_i2c_probe(struct i2c_client *i2c) unsigned int reg; int ret, i; - wm8993 = devm_kzalloc(&i2c->dev, sizeof(struct wm8993_priv), - GFP_KERNEL); + wm8993 = devm_kzalloc_obj(&i2c->dev, struct wm8993_priv); if (wm8993 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 6b91e02f130b..59a5e7f9d4b8 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -4658,8 +4658,7 @@ static int wm8994_probe(struct platform_device *pdev) struct wm8994_priv *wm8994; int ret; - wm8994 = devm_kzalloc(&pdev->dev, sizeof(struct wm8994_priv), - GFP_KERNEL); + wm8994 = devm_kzalloc_obj(&pdev->dev, struct wm8994_priv); if (wm8994 == NULL) return -ENOMEM; platform_set_drvdata(pdev, wm8994); diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c index 7f01d203e058..b18d82389d70 100644 --- a/sound/soc/codecs/wm8995.c +++ b/sound/soc/codecs/wm8995.c @@ -2228,7 +2228,7 @@ static int wm8995_spi_probe(struct spi_device *spi) struct wm8995_priv *wm8995; int ret; - wm8995 = devm_kzalloc(&spi->dev, sizeof(*wm8995), GFP_KERNEL); + wm8995 = devm_kzalloc_obj(&spi->dev, *wm8995); if (!wm8995) return -ENOMEM; @@ -2265,7 +2265,7 @@ static int wm8995_i2c_probe(struct i2c_client *i2c) struct wm8995_priv *wm8995; int ret; - wm8995 = devm_kzalloc(&i2c->dev, sizeof(*wm8995), GFP_KERNEL); + wm8995 = devm_kzalloc_obj(&i2c->dev, *wm8995); if (!wm8995) return -ENOMEM; diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 9d8fb4ee4312..19e581cc08c0 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c @@ -2770,8 +2770,7 @@ static int wm8996_i2c_probe(struct i2c_client *i2c) int ret, i; unsigned int reg; - wm8996 = devm_kzalloc(&i2c->dev, sizeof(struct wm8996_priv), - GFP_KERNEL); + wm8996 = devm_kzalloc_obj(&i2c->dev, struct wm8996_priv); if (wm8996 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c index 83106523385a..f041dfc905a4 100644 --- a/sound/soc/codecs/wm8997.c +++ b/sound/soc/codecs/wm8997.c @@ -1113,8 +1113,7 @@ static int wm8997_probe(struct platform_device *pdev) struct wm8997_priv *wm8997; int i, ret; - wm8997 = devm_kzalloc(&pdev->dev, sizeof(struct wm8997_priv), - GFP_KERNEL); + wm8997 = devm_kzalloc_obj(&pdev->dev, struct wm8997_priv); if (wm8997 == NULL) return -ENOMEM; platform_set_drvdata(pdev, wm8997); diff --git a/sound/soc/codecs/wm8998.c b/sound/soc/codecs/wm8998.c index 8e6f03d00c71..1158e9ca40a1 100644 --- a/sound/soc/codecs/wm8998.c +++ b/sound/soc/codecs/wm8998.c @@ -1340,8 +1340,7 @@ static int wm8998_probe(struct platform_device *pdev) struct wm8998_priv *wm8998; int i, ret; - wm8998 = devm_kzalloc(&pdev->dev, sizeof(struct wm8998_priv), - GFP_KERNEL); + wm8998 = devm_kzalloc_obj(&pdev->dev, struct wm8998_priv); if (!wm8998) return -ENOMEM; platform_set_drvdata(pdev, wm8998); diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index 824e9c6b5f3e..63fe87d30ff8 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c @@ -1323,8 +1323,7 @@ static int wm9081_i2c_probe(struct i2c_client *i2c) unsigned int reg; int ret; - wm9081 = devm_kzalloc(&i2c->dev, sizeof(struct wm9081_priv), - GFP_KERNEL); + wm9081 = devm_kzalloc_obj(&i2c->dev, struct wm9081_priv); if (wm9081 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c index 8fc24b19313d..6ab47b08e73c 100644 --- a/sound/soc/codecs/wm9090.c +++ b/sound/soc/codecs/wm9090.c @@ -566,7 +566,7 @@ static int wm9090_i2c_probe(struct i2c_client *i2c) unsigned int reg; int ret; - wm9090 = devm_kzalloc(&i2c->dev, sizeof(*wm9090), GFP_KERNEL); + wm9090 = devm_kzalloc_obj(&i2c->dev, *wm9090); if (!wm9090) return -ENOMEM; diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index 5c6aebe29cf1..b4ec66ea8d39 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c @@ -374,7 +374,7 @@ static int wm9705_probe(struct platform_device *pdev) { struct wm9705_priv *wm9705; - wm9705 = devm_kzalloc(&pdev->dev, sizeof(*wm9705), GFP_KERNEL); + wm9705 = devm_kzalloc_obj(&pdev->dev, *wm9705); if (wm9705 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 3105b2e0556f..fcca8f5cc98c 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@ -694,7 +694,7 @@ static int wm9712_probe(struct platform_device *pdev) { struct wm9712_priv *wm9712; - wm9712 = devm_kzalloc(&pdev->dev, sizeof(*wm9712), GFP_KERNEL); + wm9712 = devm_kzalloc_obj(&pdev->dev, *wm9712); if (wm9712 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index 3cffdfbbf9dd..838565c15e1b 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c @@ -1272,7 +1272,7 @@ static int wm9713_probe(struct platform_device *pdev) { struct wm9713_priv *wm9713; - wm9713 = devm_kzalloc(&pdev->dev, sizeof(*wm9713), GFP_KERNEL); + wm9713 = devm_kzalloc_obj(&pdev->dev, *wm9713); if (wm9713 == NULL) return -ENOMEM; diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 7b77e9725385..92e97664c760 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c @@ -178,7 +178,7 @@ static void wm_hubs_dcs_cache_set(struct snd_soc_component *component, u16 dcs_c if (hubs->no_cache_dac_hp_direct) return; - cache = devm_kzalloc(component->dev, sizeof(*cache), GFP_KERNEL); + cache = devm_kzalloc_obj(component->dev, *cache); if (!cache) return; diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c index 4f3e6bc29c7e..f6cba55288e0 100644 --- a/sound/soc/codecs/wsa881x.c +++ b/sound/soc/codecs/wsa881x.c @@ -1111,7 +1111,7 @@ static int wsa881x_probe(struct sdw_slave *pdev, struct wsa881x_priv *wsa881x; struct device *dev = &pdev->dev; - wsa881x = devm_kzalloc(dev, sizeof(*wsa881x), GFP_KERNEL); + wsa881x = devm_kzalloc_obj(dev, *wsa881x); if (!wsa881x) return -ENOMEM; diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c index 17d8babc6123..64391d654a08 100644 --- a/sound/soc/codecs/wsa883x.c +++ b/sound/soc/codecs/wsa883x.c @@ -1602,7 +1602,7 @@ static int wsa883x_probe(struct sdw_slave *pdev, struct device *dev = &pdev->dev; int ret; - wsa883x = devm_kzalloc(dev, sizeof(*wsa883x), GFP_KERNEL); + wsa883x = devm_kzalloc_obj(dev, *wsa883x); if (!wsa883x) return -ENOMEM; diff --git a/sound/soc/codecs/wsa884x.c b/sound/soc/codecs/wsa884x.c index acf32af5aae3..f58ce92c46d4 100644 --- a/sound/soc/codecs/wsa884x.c +++ b/sound/soc/codecs/wsa884x.c @@ -2047,7 +2047,7 @@ static int wsa884x_probe(struct sdw_slave *pdev, unsigned int i; int ret; - wsa884x = devm_kzalloc(dev, sizeof(*wsa884x), GFP_KERNEL); + wsa884x = devm_kzalloc_obj(dev, *wsa884x); if (!wsa884x) return -ENOMEM; diff --git a/sound/soc/codecs/wsa885x.c b/sound/soc/codecs/wsa885x.c index 5ffbf9e89fd9..2582b4945a9b 100644 --- a/sound/soc/codecs/wsa885x.c +++ b/sound/soc/codecs/wsa885x.c @@ -1448,7 +1448,7 @@ static int wsa885x_probe(struct i2c_client *client) int ret; struct device *dev = &client->dev; - wsa885x = devm_kzalloc(dev, sizeof(*wsa885x), GFP_KERNEL); + wsa885x = devm_kzalloc_obj(dev, *wsa885x); if (!wsa885x) return -ENOMEM; diff --git a/sound/soc/codecs/zl38060.c b/sound/soc/codecs/zl38060.c index b7062860cca1..02757ae2b58b 100644 --- a/sound/soc/codecs/zl38060.c +++ b/sound/soc/codecs/zl38060.c @@ -572,7 +572,7 @@ static int zl38_spi_probe(struct spi_device *spi) usleep_range(3000, 10000); } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c index dbda943cfaf3..96d9b9963d98 100644 --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c @@ -933,11 +933,11 @@ static int dw_i2s_probe(struct platform_device *pdev) if (!pdata) pdata = dev_get_platdata(&pdev->dev); - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; - dw_i2s_dai = devm_kzalloc(&pdev->dev, sizeof(*dw_i2s_dai), GFP_KERNEL); + dw_i2s_dai = devm_kzalloc_obj(&pdev->dev, *dw_i2s_dai); if (!dw_i2s_dai) return -ENOMEM; diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 310ee4c282a1..80b809e14f7e 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -1094,7 +1094,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) u32 width; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; @@ -1141,7 +1141,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) * "DPCM Link Back-End": 1 cpus, 2 codecs * totally 10 components */ - dlc = devm_kcalloc(&pdev->dev, 10, sizeof(*dlc), GFP_KERNEL); + dlc = devm_kzalloc_objs(&pdev->dev, *dlc, 10); if (!dlc) { ret = -ENOMEM; goto asrc_fail; diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index faf348dd582d..be33ad3e00ae 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -1271,11 +1271,11 @@ static int fsl_asrc_probe(struct platform_device *pdev) char tmp[16]; u32 width; - asrc = devm_kzalloc(&pdev->dev, sizeof(*asrc), GFP_KERNEL); + asrc = devm_kzalloc_obj(&pdev->dev, *asrc); if (!asrc) return -ENOMEM; - asrc_priv = devm_kzalloc(&pdev->dev, sizeof(*asrc_priv), GFP_KERNEL); + asrc_priv = devm_kzalloc_obj(&pdev->dev, *asrc_priv); if (!asrc_priv) return -ENOMEM; diff --git a/sound/soc/fsl/fsl_asrc_m2m.c b/sound/soc/fsl/fsl_asrc_m2m.c index 58101ce07c9f..21e5cafaf823 100644 --- a/sound/soc/fsl/fsl_asrc_m2m.c +++ b/sound/soc/fsl/fsl_asrc_m2m.c @@ -702,7 +702,7 @@ int fsl_asrc_m2m_init(struct fsl_asrc *asrc) asrc->card = card; - compr = devm_kzalloc(dev, sizeof(*compr), GFP_KERNEL); + compr = devm_kzalloc_obj(dev, *compr); if (!compr) { ret = -ENOMEM; goto err; diff --git a/sound/soc/fsl/fsl_aud2htx.c b/sound/soc/fsl/fsl_aud2htx.c index 8f2aa8f7d4e8..06b25ced91bc 100644 --- a/sound/soc/fsl/fsl_aud2htx.c +++ b/sound/soc/fsl/fsl_aud2htx.c @@ -189,7 +189,7 @@ static int fsl_aud2htx_probe(struct platform_device *pdev) void __iomem *regs; int ret, irq; - aud2htx = devm_kzalloc(&pdev->dev, sizeof(*aud2htx), GFP_KERNEL); + aud2htx = devm_kzalloc_obj(&pdev->dev, *aud2htx); if (!aud2htx) return -ENOMEM; diff --git a/sound/soc/fsl/fsl_audmix.c b/sound/soc/fsl/fsl_audmix.c index d4140e170edf..bac2c7d0fe68 100644 --- a/sound/soc/fsl/fsl_audmix.c +++ b/sound/soc/fsl/fsl_audmix.c @@ -464,7 +464,7 @@ static int fsl_audmix_probe(struct platform_device *pdev) void __iomem *regs; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c index b1b341132dd6..876b35120fcc 100644 --- a/sound/soc/fsl/fsl_dma.c +++ b/sound/soc/fsl/fsl_dma.c @@ -835,7 +835,7 @@ static int fsl_soc_dma_probe(struct platform_device *pdev) if (irq < 0) return irq; - dma = devm_kzalloc(&pdev->dev, sizeof(*dma), GFP_KERNEL); + dma = devm_kzalloc_obj(&pdev->dev, *dma); if (!dma) return -ENOMEM; diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c index 5d715bc07357..5c5002537951 100644 --- a/sound/soc/fsl/fsl_easrc.c +++ b/sound/soc/fsl/fsl_easrc.c @@ -2211,11 +2211,11 @@ static int fsl_easrc_probe(struct platform_device *pdev) u32 asrc_fmt = 0; int ret, irq; - easrc = devm_kzalloc(dev, sizeof(*easrc), GFP_KERNEL); + easrc = devm_kzalloc_obj(dev, *easrc); if (!easrc) return -ENOMEM; - easrc_priv = devm_kzalloc(dev, sizeof(*easrc_priv), GFP_KERNEL); + easrc_priv = devm_kzalloc_obj(dev, *easrc_priv); if (!easrc_priv) return -ENOMEM; diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index 4a530a6c33f0..47bdf2115ec0 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c @@ -954,7 +954,7 @@ static int fsl_esai_probe(struct platform_device *pdev) void __iomem *regs; int irq, ret; - esai_priv = devm_kzalloc(&pdev->dev, sizeof(*esai_priv), GFP_KERNEL); + esai_priv = devm_kzalloc_obj(&pdev->dev, *esai_priv); if (!esai_priv) return -ENOMEM; diff --git a/sound/soc/fsl/fsl_micfil.c b/sound/soc/fsl/fsl_micfil.c index 5d8f0f76ab46..588b3b8b68c5 100644 --- a/sound/soc/fsl/fsl_micfil.c +++ b/sound/soc/fsl/fsl_micfil.c @@ -1510,7 +1510,7 @@ static int fsl_micfil_probe(struct platform_device *pdev) void __iomem *regs; int ret, i; - micfil = devm_kzalloc(&pdev->dev, sizeof(*micfil), GFP_KERNEL); + micfil = devm_kzalloc_obj(&pdev->dev, *micfil); if (!micfil) return -ENOMEM; diff --git a/sound/soc/fsl/fsl_mqs.c b/sound/soc/fsl/fsl_mqs.c index 5b00488253bb..fd4a5f4a56be 100644 --- a/sound/soc/fsl/fsl_mqs.c +++ b/sound/soc/fsl/fsl_mqs.c @@ -243,7 +243,7 @@ static int fsl_mqs_probe(struct platform_device *pdev) void __iomem *regs; int ret; - mqs_priv = devm_kzalloc(&pdev->dev, sizeof(*mqs_priv), GFP_KERNEL); + mqs_priv = devm_kzalloc_obj(&pdev->dev, *mqs_priv); if (!mqs_priv) return -ENOMEM; diff --git a/sound/soc/fsl/fsl_qmc_audio.c b/sound/soc/fsl/fsl_qmc_audio.c index f27934cf49da..bc1afa37137b 100644 --- a/sound/soc/fsl/fsl_qmc_audio.c +++ b/sound/soc/fsl/fsl_qmc_audio.c @@ -781,8 +781,8 @@ static int qmc_audio_dai_parse(struct qmc_audio *qmc_audio, struct device_node * return dev_err_probe(qmc_audio->dev, -EINVAL, "dai %d no QMC channel defined\n", qmc_dai->id); - qmc_dai->qmc_chans = devm_kcalloc(qmc_audio->dev, count, sizeof(*qmc_dai->qmc_chans), - GFP_KERNEL); + qmc_dai->qmc_chans = devm_kzalloc_objs(qmc_audio->dev, + *qmc_dai->qmc_chans, count); if (!qmc_dai->qmc_chans) return -ENOMEM; @@ -908,7 +908,7 @@ static int qmc_audio_probe(struct platform_device *pdev) unsigned int i; int ret; - qmc_audio = devm_kzalloc(&pdev->dev, sizeof(*qmc_audio), GFP_KERNEL); + qmc_audio = devm_kzalloc_obj(&pdev->dev, *qmc_audio); if (!qmc_audio) return -ENOMEM; @@ -916,15 +916,15 @@ static int qmc_audio_probe(struct platform_device *pdev) qmc_audio->num_dais = of_get_available_child_count(np); if (qmc_audio->num_dais) { - qmc_audio->dais = devm_kcalloc(&pdev->dev, qmc_audio->num_dais, - sizeof(*qmc_audio->dais), - GFP_KERNEL); + qmc_audio->dais = devm_kzalloc_objs(&pdev->dev, + *qmc_audio->dais, + qmc_audio->num_dais); if (!qmc_audio->dais) return -ENOMEM; - qmc_audio->dai_drivers = devm_kcalloc(&pdev->dev, qmc_audio->num_dais, - sizeof(*qmc_audio->dai_drivers), - GFP_KERNEL); + qmc_audio->dai_drivers = devm_kzalloc_objs(&pdev->dev, + *qmc_audio->dai_drivers, + qmc_audio->num_dais); if (!qmc_audio->dai_drivers) return -ENOMEM; } diff --git a/sound/soc/fsl/fsl_rpmsg.c b/sound/soc/fsl/fsl_rpmsg.c index 5708b3a9878d..7782c1e5d4e8 100644 --- a/sound/soc/fsl/fsl_rpmsg.c +++ b/sound/soc/fsl/fsl_rpmsg.c @@ -201,12 +201,12 @@ static int fsl_rpmsg_probe(struct platform_device *pdev) struct fsl_rpmsg *rpmsg; int ret; - dai_drv = devm_kzalloc(&pdev->dev, sizeof(struct snd_soc_dai_driver), GFP_KERNEL); + dai_drv = devm_kzalloc_obj(&pdev->dev, struct snd_soc_dai_driver); if (!dai_drv) return -ENOMEM; memcpy(dai_drv, &fsl_rpmsg_dai, sizeof(fsl_rpmsg_dai)); - rpmsg = devm_kzalloc(&pdev->dev, sizeof(struct fsl_rpmsg), GFP_KERNEL); + rpmsg = devm_kzalloc_obj(&pdev->dev, struct fsl_rpmsg); if (!rpmsg) return -ENOMEM; diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index d232c8f53061..5d8a3069724b 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -1470,7 +1470,7 @@ static int fsl_sai_read_dlcfg(struct fsl_sai *sai) num_cfg = elems / 3; /* Add one more for default value */ - cfg = devm_kcalloc(&pdev->dev, num_cfg + 1, sizeof(*cfg), GFP_KERNEL); + cfg = devm_kzalloc_objs(&pdev->dev, *cfg, num_cfg + 1); if (!cfg) return -ENOMEM; @@ -1549,7 +1549,7 @@ static int fsl_sai_probe(struct platform_device *pdev) u32 dmas[4]; u32 val; - sai = devm_kzalloc(dev, sizeof(*sai), GFP_KERNEL); + sai = devm_kzalloc_obj(dev, *sai); if (!sai) return -ENOMEM; diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index ad1206ed9882..d0ec2153bb29 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -1534,7 +1534,7 @@ static int fsl_spdif_probe(struct platform_device *pdev) int irq, ret, i; char tmp[16]; - spdif_priv = devm_kzalloc(&pdev->dev, sizeof(*spdif_priv), GFP_KERNEL); + spdif_priv = devm_kzalloc_obj(&pdev->dev, *spdif_priv); if (!spdif_priv) return -ENOMEM; diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index dc022976c982..0a10ab6ad8c7 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -1508,7 +1508,7 @@ static int fsl_ssi_probe(struct platform_device *pdev) void __iomem *iomem; int ret = 0; - ssi = devm_kzalloc(dev, sizeof(*ssi), GFP_KERNEL); + ssi = devm_kzalloc_obj(dev, *ssi); if (!ssi) return -ENOMEM; diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c index 29929dfcce2a..4c703157a25b 100644 --- a/sound/soc/fsl/fsl_xcvr.c +++ b/sound/soc/fsl/fsl_xcvr.c @@ -1621,7 +1621,7 @@ static int fsl_xcvr_probe(struct platform_device *pdev) void __iomem *regs; int ret; - xcvr = devm_kzalloc(dev, sizeof(*xcvr), GFP_KERNEL); + xcvr = devm_kzalloc_obj(dev, *xcvr); if (!xcvr) return -ENOMEM; diff --git a/sound/soc/fsl/imx-audio-rpmsg.c b/sound/soc/fsl/imx-audio-rpmsg.c index b55dfbdb4502..f544f2db41b3 100644 --- a/sound/soc/fsl/imx-audio-rpmsg.c +++ b/sound/soc/fsl/imx-audio-rpmsg.c @@ -79,7 +79,7 @@ static int imx_audio_rpmsg_probe(struct rpmsg_device *rpdev) dev_info(&rpdev->dev, "new channel: 0x%x -> 0x%x!\n", rpdev->src, rpdev->dst); - data = devm_kzalloc(&rpdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&rpdev->dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/fsl/imx-audmix.c b/sound/soc/fsl/imx-audmix.c index dac5d4ddacd6..2372cd26ee47 100644 --- a/sound/soc/fsl/imx-audmix.c +++ b/sound/soc/fsl/imx-audmix.c @@ -162,28 +162,28 @@ static int imx_audmix_probe(struct platform_device *pdev) return -EINVAL; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; num_dai += 1; priv->num_dai = 2 * num_dai; - priv->dai = devm_kcalloc(&pdev->dev, priv->num_dai, - sizeof(struct snd_soc_dai_link), GFP_KERNEL); + priv->dai = devm_kzalloc_objs(&pdev->dev, struct snd_soc_dai_link, + priv->num_dai); if (!priv->dai) return -ENOMEM; priv->num_dai_conf = num_dai; - priv->dai_conf = devm_kcalloc(&pdev->dev, priv->num_dai_conf, - sizeof(struct snd_soc_codec_conf), - GFP_KERNEL); + priv->dai_conf = devm_kzalloc_objs(&pdev->dev, + struct snd_soc_codec_conf, + priv->num_dai_conf); if (!priv->dai_conf) return -ENOMEM; priv->num_dapm_routes = num_dai; - priv->dapm_routes = devm_kcalloc(&pdev->dev, priv->num_dapm_routes, - sizeof(struct snd_soc_dapm_route), - GFP_KERNEL); + priv->dapm_routes = devm_kzalloc_objs(&pdev->dev, + struct snd_soc_dapm_route, + priv->num_dapm_routes); if (!priv->dapm_routes) return -ENOMEM; @@ -191,7 +191,7 @@ static int imx_audmix_probe(struct platform_device *pdev) struct snd_soc_dai_link_component *dlc; /* for CPU x 2 */ - dlc = devm_kcalloc(&pdev->dev, 2, sizeof(*dlc), GFP_KERNEL); + dlc = devm_kzalloc_objs(&pdev->dev, *dlc, 2); if (!dlc) return -ENOMEM; diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c index f8335a04595a..d0afee8ef92d 100644 --- a/sound/soc/fsl/imx-audmux.c +++ b/sound/soc/fsl/imx-audmux.c @@ -305,7 +305,7 @@ static int imx_audmux_probe(struct platform_device *pdev) return -EINVAL; } - regcache = devm_kcalloc(&pdev->dev, reg_max, sizeof(u32), GFP_KERNEL); + regcache = devm_kzalloc_objs(&pdev->dev, u32, reg_max); if (!regcache) return -ENOMEM; diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index e3cb1438e837..1f59b7e8892a 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -570,11 +570,11 @@ static int imx_card_parse_of(struct imx_card_data *data) num_links = of_get_child_count(dev->of_node); /* Allocate the DAI link array */ - card->dai_link = devm_kcalloc(dev, num_links, sizeof(*link), GFP_KERNEL); + card->dai_link = devm_kzalloc_objs(dev, *link, num_links); if (!card->dai_link) return -ENOMEM; - data->link_data = devm_kcalloc(dev, num_links, sizeof(*link_data), GFP_KERNEL); + data->link_data = devm_kzalloc_objs(dev, *link_data, num_links); if (!data->link_data) return -ENOMEM; @@ -769,11 +769,11 @@ static int imx_card_probe(struct platform_device *pdev) struct imx_card_data *data; int ret, i; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) return -ENOMEM; - plat_data = devm_kzalloc(&pdev->dev, sizeof(*plat_data), GFP_KERNEL); + plat_data = devm_kzalloc_obj(&pdev->dev, *plat_data); if (!plat_data) return -ENOMEM; @@ -788,9 +788,9 @@ static int imx_card_probe(struct platform_device *pdev) return ret; data->num_dapm_routes = plat_data->num_codecs + 1; - data->dapm_routes = devm_kcalloc(&pdev->dev, data->num_dapm_routes, - sizeof(struct snd_soc_dapm_route), - GFP_KERNEL); + data->dapm_routes = devm_kzalloc_objs(&pdev->dev, + struct snd_soc_dapm_route, + data->num_dapm_routes); if (!data->dapm_routes) return -ENOMEM; diff --git a/sound/soc/fsl/imx-es8328.c b/sound/soc/fsl/imx-es8328.c index 3ef92f6dfc6b..c1f5b0088519 100644 --- a/sound/soc/fsl/imx-es8328.c +++ b/sound/soc/fsl/imx-es8328.c @@ -158,7 +158,7 @@ static int imx_es8328_probe(struct platform_device *pdev) goto fail; } - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) { ret = -ENOMEM; goto put_device; diff --git a/sound/soc/fsl/imx-hdmi.c b/sound/soc/fsl/imx-hdmi.c index 1115189cc640..59bbab22d5d4 100644 --- a/sound/soc/fsl/imx-hdmi.c +++ b/sound/soc/fsl/imx-hdmi.c @@ -116,7 +116,7 @@ static int imx_hdmi_probe(struct platform_device *pdev) goto fail; } - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) { ret = -ENOMEM; goto fail; diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c index 4fa208d6a032..3c9ca1d4c4a2 100644 --- a/sound/soc/fsl/imx-pcm-dma.c +++ b/sound/soc/fsl/imx-pcm-dma.c @@ -38,8 +38,7 @@ int imx_pcm_dma_init(struct platform_device *pdev) { struct snd_dmaengine_pcm_config *config; - config = devm_kzalloc(&pdev->dev, - sizeof(struct snd_dmaengine_pcm_config), GFP_KERNEL); + config = devm_kzalloc_obj(&pdev->dev, struct snd_dmaengine_pcm_config); if (!config) return -ENOMEM; *config = imx_dmaengine_pcm_config; diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c index 6a0174d6c78d..6852f49a18ad 100644 --- a/sound/soc/fsl/imx-pcm-rpmsg.c +++ b/sound/soc/fsl/imx-pcm-rpmsg.c @@ -698,7 +698,7 @@ static int imx_rpmsg_pcm_probe(struct platform_device *pdev) struct rpmsg_info *info; int ret, i; - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; diff --git a/sound/soc/fsl/imx-rpmsg.c b/sound/soc/fsl/imx-rpmsg.c index 5f1af258caf2..f6a2633bb812 100644 --- a/sound/soc/fsl/imx-rpmsg.c +++ b/sound/soc/fsl/imx-rpmsg.c @@ -158,7 +158,7 @@ static int imx_rpmsg_probe(struct platform_device *pdev) if (!dlc) return -ENOMEM; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) { ret = -ENOMEM; goto fail; diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c index 8bcf54ef709e..2ef48ff92404 100644 --- a/sound/soc/fsl/imx-sgtl5000.c +++ b/sound/soc/fsl/imx-sgtl5000.c @@ -117,7 +117,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) goto fail; } - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(&pdev->dev, *data); if (!data) { ret = -ENOMEM; goto put_device; diff --git a/sound/soc/fsl/lpc3xxx-i2s.c b/sound/soc/fsl/lpc3xxx-i2s.c index c65c17dfa174..757e0619d368 100644 --- a/sound/soc/fsl/lpc3xxx-i2s.c +++ b/sound/soc/fsl/lpc3xxx-i2s.c @@ -306,7 +306,7 @@ static int lpc32xx_i2s_probe(struct platform_device *pdev) void __iomem *iomem; int ret; - i2s_info_p = devm_kzalloc(dev, sizeof(*i2s_info_p), GFP_KERNEL); + i2s_info_p = devm_kzalloc_obj(dev, *i2s_info_p); if (!i2s_info_p) return -ENOMEM; diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c index 8327fff3e1b5..bfd3576673a0 100644 --- a/sound/soc/fsl/mpc5200_dma.c +++ b/sound/soc/fsl/mpc5200_dma.c @@ -329,7 +329,7 @@ int mpc5200_audio_dma_create(struct platform_device *op) return irq; /* Allocate and initialize the driver private data */ - psc_dma = devm_kzalloc(&op->dev, sizeof(*psc_dma), GFP_KERNEL); + psc_dma = devm_kzalloc_obj(&op->dev, *psc_dma); if (!psc_dma) return -ENOMEM; diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c index a7a5dba83a2f..cbd851f9c676 100644 --- a/sound/soc/fsl/pcm030-audio-fabric.c +++ b/sound/soc/fsl/pcm030-audio-fabric.c @@ -63,8 +63,7 @@ static int pcm030_fabric_probe(struct platform_device *op) if (!of_machine_is_compatible("phytec,pcm030")) return -ENODEV; - pdata = devm_kzalloc(&op->dev, sizeof(struct pcm030_audio_data), - GFP_KERNEL); + pdata = devm_kzalloc_obj(&op->dev, struct pcm030_audio_data); if (!pdata) return -ENOMEM; diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 127c2e6b308e..1362f895cc61 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -621,7 +621,7 @@ static int graph_probe(struct platform_device *pdev) struct snd_soc_card *card; /* Allocate the private data and the DAI link array */ - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/generic/audio-graph-card2-custom-sample.c b/sound/soc/generic/audio-graph-card2-custom-sample.c index 14b212675240..9dbc22a5549d 100644 --- a/sound/soc/generic/audio-graph-card2-custom-sample.c +++ b/sound/soc/generic/audio-graph-card2-custom-sample.c @@ -144,7 +144,7 @@ static int custom_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - custom_priv = devm_kzalloc(dev, sizeof(*custom_priv), GFP_KERNEL); + custom_priv = devm_kzalloc_obj(dev, *custom_priv); if (!custom_priv) return -ENOMEM; diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 503170578cff..4708bbba1a3c 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -609,8 +609,9 @@ static int graph_parse_node_multi(struct simple_util_priv *priv, dai_link->num_cpus > 1 && dai_link->num_codecs > 1 && dai_link->num_cpus != dai_link->num_codecs) { - dai_link->ch_maps = devm_kcalloc(dev, nm_max, - sizeof(struct snd_soc_dai_link_ch_map), GFP_KERNEL); + dai_link->ch_maps = devm_kzalloc_objs(dev, + struct snd_soc_dai_link_ch_map, + nm_max); if (!dai_link->ch_maps) goto multi_err; } @@ -1004,7 +1005,7 @@ int audio_graph2_link_c2c(struct simple_util_priv *priv, struct device *dev = simple_priv_to_dev(priv); struct snd_soc_pcm_stream *c2c_conf; - c2c_conf = devm_kzalloc(dev, sizeof(*c2c_conf), GFP_KERNEL); + c2c_conf = devm_kzalloc_obj(dev, *c2c_conf); if (!c2c_conf) { /* * Clang doesn't allow to use "goto end" before calling __free(), @@ -1387,7 +1388,7 @@ static int graph_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; /* Allocate the private data and the DAI link array */ - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index de27163eeb0b..2316ab3e79f1 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -164,7 +164,7 @@ int simple_util_parse_tdm_width_map(struct simple_util_priv *priv, struct device } ret = -ENOMEM; - dai->tdm_width_map = devm_kcalloc(dev, n, sizeof(*dai->tdm_width_map), GFP_KERNEL); + dai->tdm_width_map = devm_kzalloc_objs(dev, *dai->tdm_width_map, n); if (!dai->tdm_width_map) return simple_ret(priv, ret); /* see NOTE */ @@ -674,7 +674,7 @@ static int simple_init_for_codec2codec(struct simple_util_priv *priv, } ret = -ENOMEM; - c2c_params = devm_kzalloc(rtd->dev, sizeof(*c2c_params), GFP_KERNEL); + c2c_params = devm_kzalloc_obj(rtd->dev, *c2c_params); if (!c2c_params) goto end; @@ -855,8 +855,7 @@ int simple_util_init_aux_jacks(struct snd_soc_card *card, char *prefix) if (num < 1) return 0; - priv->aux_jacks = devm_kcalloc(card->dev, num, - sizeof(struct snd_soc_jack), GFP_KERNEL); + priv->aux_jacks = devm_kzalloc_objs(card->dev, struct snd_soc_jack, num); if (!priv->aux_jacks) return simple_ret(priv, -ENOMEM); @@ -900,8 +899,8 @@ int simple_util_init_priv(struct simple_util_priv *priv, struct snd_soc_codec_conf *cconf = NULL; int i, dai_num = 0, dlc_num = 0, cnf_num = 0; - dai_props = devm_kcalloc(dev, li->link, sizeof(*dai_props), GFP_KERNEL); - dai_link = devm_kcalloc(dev, li->link, sizeof(*dai_link), GFP_KERNEL); + dai_props = devm_kzalloc_objs(dev, *dai_props, li->link); + dai_link = devm_kzalloc_objs(dev, *dai_link, li->link); if (!dai_props || !dai_link) return -ENOMEM; @@ -919,13 +918,13 @@ int simple_util_init_priv(struct simple_util_priv *priv, cnf_num += li->num[i].codecs; } - dais = devm_kcalloc(dev, dai_num, sizeof(*dais), GFP_KERNEL); - dlcs = devm_kcalloc(dev, dlc_num, sizeof(*dlcs), GFP_KERNEL); + dais = devm_kzalloc_objs(dev, *dais, dai_num); + dlcs = devm_kzalloc_objs(dev, *dlcs, dlc_num); if (!dais || !dlcs) return -ENOMEM; if (cnf_num) { - cconf = devm_kcalloc(dev, cnf_num, sizeof(*cconf), GFP_KERNEL); + cconf = devm_kzalloc_objs(dev, *cconf, cnf_num); if (!cconf) return -ENOMEM; } diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index b2fc91b8ab81..a033ab6e2377 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -756,7 +756,7 @@ static int simple_probe(struct platform_device *pdev) struct snd_soc_card *card; /* Allocate the private data and the DAI link array */ - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/generic/test-component.c b/sound/soc/generic/test-component.c index 6f9f498c4c5c..87d0f0cc12e1 100644 --- a/sound/soc/generic/test-component.c +++ b/sound/soc/generic/test-component.c @@ -538,10 +538,10 @@ static int test_driver_probe(struct platform_device *pdev) return -EINVAL; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); - cdriv = devm_kzalloc(dev, sizeof(*cdriv), GFP_KERNEL); - ddriv = devm_kcalloc(dev, num, sizeof(*ddriv), GFP_KERNEL); - dname = devm_kcalloc(dev, num, sizeof(*dname), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); + cdriv = devm_kzalloc_obj(dev, *cdriv); + ddriv = devm_kzalloc_objs(dev, *ddriv, num); + dname = devm_kzalloc_objs(dev, *dname, num); if (!priv || !cdriv || !ddriv || !dname || !adata) return -EINVAL; diff --git a/sound/soc/google/chv3-i2s.c b/sound/soc/google/chv3-i2s.c index fd12cedfe1c9..1d8ca57649a1 100644 --- a/sound/soc/google/chv3-i2s.c +++ b/sound/soc/google/chv3-i2s.c @@ -284,7 +284,7 @@ static int chv3_i2s_probe(struct platform_device *pdev) int res; int irq; - i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(&pdev->dev, *i2s); if (!i2s) return -ENOMEM; diff --git a/sound/soc/hisilicon/hi6210-i2s.c b/sound/soc/hisilicon/hi6210-i2s.c index 554356f060b0..d9fbf00b8c78 100644 --- a/sound/soc/hisilicon/hi6210-i2s.c +++ b/sound/soc/hisilicon/hi6210-i2s.c @@ -554,7 +554,7 @@ static int hi6210_i2s_probe(struct platform_device *pdev) struct resource *res; int ret; - i2s = devm_kzalloc(dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(dev, *i2s); if (!i2s) return -ENOMEM; diff --git a/sound/soc/img/img-i2s-in.c b/sound/soc/img/img-i2s-in.c index a0c87e2a9b30..9384e9fa10a7 100644 --- a/sound/soc/img/img-i2s-in.c +++ b/sound/soc/img/img-i2s-in.c @@ -436,7 +436,7 @@ static int img_i2s_in_probe(struct platform_device *pdev) unsigned int max_i2s_chan_pow_2; struct device *dev = &pdev->dev; - i2s = devm_kzalloc(dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(dev, *i2s); if (!i2s) return -ENOMEM; @@ -515,8 +515,8 @@ static int img_i2s_in_probe(struct platform_device *pdev) pm_runtime_put(&pdev->dev); - i2s->suspend_ch_ctl = devm_kcalloc(dev, - i2s->max_i2s_chan, sizeof(*i2s->suspend_ch_ctl), GFP_KERNEL); + i2s->suspend_ch_ctl = devm_kzalloc_objs(dev, *i2s->suspend_ch_ctl, + i2s->max_i2s_chan); if (!i2s->suspend_ch_ctl) { ret = -ENOMEM; goto err_suspend; diff --git a/sound/soc/img/img-i2s-out.c b/sound/soc/img/img-i2s-out.c index caa7870dbec6..061a1aad8b99 100644 --- a/sound/soc/img/img-i2s-out.c +++ b/sound/soc/img/img-i2s-out.c @@ -443,7 +443,7 @@ static int img_i2s_out_probe(struct platform_device *pdev) u32 reg; struct device *dev = &pdev->dev; - i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(&pdev->dev, *i2s); if (!i2s) return -ENOMEM; @@ -482,8 +482,8 @@ static int img_i2s_out_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(i2s->clk_ref), "Failed to acquire clock 'ref'\n"); - i2s->suspend_ch_ctl = devm_kcalloc(dev, - i2s->max_i2s_chan, sizeof(*i2s->suspend_ch_ctl), GFP_KERNEL); + i2s->suspend_ch_ctl = devm_kzalloc_objs(dev, *i2s->suspend_ch_ctl, + i2s->max_i2s_chan); if (!i2s->suspend_ch_ctl) return -ENOMEM; diff --git a/sound/soc/img/img-parallel-out.c b/sound/soc/img/img-parallel-out.c index 89270913ab35..344d900dc0bf 100644 --- a/sound/soc/img/img-parallel-out.c +++ b/sound/soc/img/img-parallel-out.c @@ -219,7 +219,7 @@ static int img_prl_out_probe(struct platform_device *pdev) int ret; struct device *dev = &pdev->dev; - prl = devm_kzalloc(&pdev->dev, sizeof(*prl), GFP_KERNEL); + prl = devm_kzalloc_obj(&pdev->dev, *prl); if (!prl) return -ENOMEM; diff --git a/sound/soc/img/img-spdif-in.c b/sound/soc/img/img-spdif-in.c index b630644f20cc..2860d3c493a6 100644 --- a/sound/soc/img/img-spdif-in.c +++ b/sound/soc/img/img-spdif-in.c @@ -689,7 +689,7 @@ static int img_spdif_in_probe(struct platform_device *pdev) u32 reg; struct device *dev = &pdev->dev; - spdif = devm_kzalloc(&pdev->dev, sizeof(*spdif), GFP_KERNEL); + spdif = devm_kzalloc_obj(&pdev->dev, *spdif); if (!spdif) return -ENOMEM; diff --git a/sound/soc/img/img-spdif-out.c b/sound/soc/img/img-spdif-out.c index 39a37e4830d8..5d48564ddcfa 100644 --- a/sound/soc/img/img-spdif-out.c +++ b/sound/soc/img/img-spdif-out.c @@ -320,7 +320,7 @@ static int img_spdif_out_probe(struct platform_device *pdev) int ret; struct device *dev = &pdev->dev; - spdif = devm_kzalloc(&pdev->dev, sizeof(*spdif), GFP_KERNEL); + spdif = devm_kzalloc_obj(&pdev->dev, *spdif); if (!spdif) return -ENOMEM; diff --git a/sound/soc/img/pistachio-internal-dac.c b/sound/soc/img/pistachio-internal-dac.c index ec4f891295c9..19fe71be482d 100644 --- a/sound/soc/img/pistachio-internal-dac.c +++ b/sound/soc/img/pistachio-internal-dac.c @@ -147,7 +147,7 @@ static int pistachio_internal_dac_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; u32 reg; - dac = devm_kzalloc(dev, sizeof(*dac), GFP_KERNEL); + dac = devm_kzalloc_obj(dev, *dac); if (!dac) return -ENOMEM; diff --git a/sound/soc/intel/atom/sst-atom-controls.c b/sound/soc/intel/atom/sst-atom-controls.c index 82df398237da..bac54c621126 100644 --- a/sound/soc/intel/atom/sst-atom-controls.c +++ b/sound/soc/intel/atom/sst-atom-controls.c @@ -1383,7 +1383,7 @@ static int sst_fill_module_list(struct snd_kcontrol *kctl, struct sst_ids *ids = w->priv; int ret = 0; - module = devm_kzalloc(c->dev, sizeof(*module), GFP_KERNEL); + module = devm_kzalloc_obj(c->dev, *module); if (!module) return -ENOMEM; diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c index 58681e007abf..8c0e4c1d0c0c 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c @@ -709,12 +709,12 @@ static int sst_platform_probe(struct platform_device *pdev) int ret; struct sst_platform_data *pdata; - drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(&pdev->dev, *drv); if (drv == NULL) { return -ENOMEM; } - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(&pdev->dev, *pdata); if (pdata == NULL) { return -ENOMEM; } diff --git a/sound/soc/intel/atom/sst/sst.c b/sound/soc/intel/atom/sst/sst.c index d9d695ed7cfb..c6f9e706be53 100644 --- a/sound/soc/intel/atom/sst/sst.c +++ b/sound/soc/intel/atom/sst/sst.c @@ -230,7 +230,7 @@ static void sst_init_locks(struct intel_sst_drv *ctx) int sst_alloc_drv_context(struct intel_sst_drv **ctx, struct device *dev, unsigned short dev_id) { - *ctx = devm_kzalloc(dev, sizeof(struct intel_sst_drv), GFP_KERNEL); + *ctx = devm_kzalloc_obj(dev, struct intel_sst_drv); if (!(*ctx)) return -ENOMEM; @@ -324,8 +324,7 @@ int sst_context_init(struct intel_sst_drv *ctx) /* default intr are unmasked so set this as masked */ sst_shim_write64(ctx->shim, SST_IMRX, 0xFFFF0038); - ctx->qos = devm_kzalloc(ctx->dev, - sizeof(struct pm_qos_request), GFP_KERNEL); + ctx->qos = devm_kzalloc_obj(ctx->dev, struct pm_qos_request); if (!ctx->qos) { ret = -ENOMEM; goto do_free_mem; diff --git a/sound/soc/intel/avs/board_selection.c b/sound/soc/intel/avs/board_selection.c index dd0e7cd5a7dd..556c13eab8a6 100644 --- a/sound/soc/intel/avs/board_selection.c +++ b/sound/soc/intel/avs/board_selection.c @@ -423,7 +423,7 @@ static struct platform_device *avs_register_board_pdata(struct avs_dev *adev, co { struct avs_mach_pdata *pdata; - pdata = devm_kzalloc(adev->dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(adev->dev, *pdata); if (!pdata) return ERR_PTR(-ENOMEM); @@ -482,7 +482,7 @@ static int avs_register_i2s_test_board(struct avs_dev *adev, int ssp_port, int t struct platform_device *pdev; unsigned long *tdms; - tdms = devm_kcalloc(adev->dev, ssp_port + 1, sizeof(*tdms), GFP_KERNEL); + tdms = devm_kzalloc_objs(adev->dev, *tdms, ssp_port + 1); mach.tplg_filename = devm_kasprintf(adev->dev, GFP_KERNEL, AVS_STRING_FMT("i2s", "-test-tplg.bin", ssp_port, tdm_slot)); diff --git a/sound/soc/intel/avs/boards/da7219.c b/sound/soc/intel/avs/boards/da7219.c index b7bdd8a690cf..970b94084cb5 100644 --- a/sound/soc/intel/avs/boards/da7219.c +++ b/sound/soc/intel/avs/boards/da7219.c @@ -170,15 +170,15 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->codecs = devm_kzalloc_obj(dev, *dl->codecs); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; @@ -230,8 +230,8 @@ static int avs_da7219_probe(struct platform_device *pdev) return ret; } - jack = devm_kzalloc(dev, sizeof(*jack), GFP_KERNEL); - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + jack = devm_kzalloc_obj(dev, *jack); + card = devm_kzalloc_obj(dev, *card); if (!jack || !card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/dmic.c b/sound/soc/intel/avs/boards/dmic.c index 8d36bc7ddf16..e09f91fec0cc 100644 --- a/sound/soc/intel/avs/boards/dmic.c +++ b/sound/soc/intel/avs/boards/dmic.c @@ -30,12 +30,12 @@ static int avs_create_dai_links(struct device *dev, const char *codec_name, struct snd_soc_dai_link *dl; const int num_dl = 2; - dl = devm_kcalloc(dev, num_dl, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_objs(dev, *dl, num_dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); + dl->codecs = devm_kzalloc_obj(dev, *dl->codecs); if (!dl->codecs) return -ENOMEM; @@ -78,7 +78,7 @@ static int avs_dmic_probe(struct platform_device *pdev) mach = dev_get_platdata(dev); pdata = mach->pdata; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/es8336.c b/sound/soc/intel/avs/boards/es8336.c index 36c13db3a272..e6d5aaaf1f60 100644 --- a/sound/soc/intel/avs/boards/es8336.c +++ b/sound/soc/intel/avs/boards/es8336.c @@ -203,15 +203,15 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->codecs = devm_kzalloc_obj(dev, *dl->codecs); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; @@ -279,8 +279,8 @@ static int avs_es8336_probe(struct platform_device *pdev) return ret; } - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); + card = devm_kzalloc_obj(dev, *card); if (!data || !card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/hdaudio.c b/sound/soc/intel/avs/boards/hdaudio.c index c1d2d0082b14..e0347b5fc9ab 100644 --- a/sound/soc/intel/avs/boards/hdaudio.c +++ b/sound/soc/intel/avs/boards/hdaudio.c @@ -40,8 +40,8 @@ static int avs_create_dai_links(struct device *dev, struct hda_codec *codec, int const char *cname = dev_name(&codec->core.dev); int i; - dl = devm_kcalloc(dev, pcm_count, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_objs(dev, *dl, pcm_count); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; @@ -61,8 +61,8 @@ static int avs_create_dai_links(struct device *dev, struct hda_codec *codec, int dl[i].ignore_pmdown_time = 1; dl[i].ops = &avs_link_ops; - dl[i].codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); - dl[i].cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); + dl[i].codecs = devm_kzalloc_obj(dev, *dl->codecs); + dl[i].cpus = devm_kzalloc_obj(dev, *dl->cpus); if (!dl[i].codecs || !dl[i].cpus) return -ENOMEM; @@ -203,8 +203,8 @@ static int avs_hdaudio_probe(struct platform_device *pdev) if (!binder) return -ENOMEM; - binder->platforms = devm_kzalloc(dev, sizeof(*binder->platforms), GFP_KERNEL); - binder->codecs = devm_kzalloc(dev, sizeof(*binder->codecs), GFP_KERNEL); + binder->platforms = devm_kzalloc_obj(dev, *binder->platforms); + binder->codecs = devm_kzalloc_obj(dev, *binder->codecs); if (!binder->platforms || !binder->codecs) return -ENOMEM; @@ -217,7 +217,7 @@ static int avs_hdaudio_probe(struct platform_device *pdev) binder->codecs->dai_name = "codec-probing-DAI"; binder->num_codecs = 1; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/i2s_test.c b/sound/soc/intel/avs/boards/i2s_test.c index 787d781ba1d9..643a308ff9ec 100644 --- a/sound/soc/intel/avs/boards/i2s_test.c +++ b/sound/soc/intel/avs/boards/i2s_test.c @@ -20,14 +20,14 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); if (!dl->name || !dl->cpus) return -ENOMEM; @@ -75,7 +75,7 @@ static int avs_i2s_test_probe(struct platform_device *pdev) } tdm_slot = avs_mach_ssp_tdm(mach, ssp_port); - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/max98357a.c b/sound/soc/intel/avs/boards/max98357a.c index 389a50923d3b..00d277e76432 100644 --- a/sound/soc/intel/avs/boards/max98357a.c +++ b/sound/soc/intel/avs/boards/max98357a.c @@ -52,15 +52,15 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->codecs = devm_kzalloc_obj(dev, *dl->codecs); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; @@ -110,7 +110,7 @@ static int avs_max98357a_probe(struct platform_device *pdev) return ret; } - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/max98373.c b/sound/soc/intel/avs/boards/max98373.c index b8231f71d3d6..260ef1e0977b 100644 --- a/sound/soc/intel/avs/boards/max98373.c +++ b/sound/soc/intel/avs/boards/max98373.c @@ -101,15 +101,15 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kcalloc(dev, 2, sizeof(*dl->codecs), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->codecs = devm_kzalloc_objs(dev, *dl->codecs, 2); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; @@ -163,7 +163,7 @@ static int avs_max98373_probe(struct platform_device *pdev) return ret; } - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/max98927.c b/sound/soc/intel/avs/boards/max98927.c index d657e7da1cc0..9069114cb66d 100644 --- a/sound/soc/intel/avs/boards/max98927.c +++ b/sound/soc/intel/avs/boards/max98927.c @@ -98,15 +98,15 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kcalloc(dev, 2, sizeof(*dl->codecs), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->codecs = devm_kzalloc_objs(dev, *dl->codecs, 2); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; @@ -160,7 +160,7 @@ static int avs_max98927_probe(struct platform_device *pdev) return ret; } - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/nau8825.c b/sound/soc/intel/avs/boards/nau8825.c index d7ea08bb27cd..9e74bf70211a 100644 --- a/sound/soc/intel/avs/boards/nau8825.c +++ b/sound/soc/intel/avs/boards/nau8825.c @@ -177,15 +177,15 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->codecs = devm_kzalloc_obj(dev, *dl->codecs); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; @@ -263,8 +263,8 @@ static int avs_nau8825_probe(struct platform_device *pdev) return ret; } - jack = devm_kzalloc(dev, sizeof(*jack), GFP_KERNEL); - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + jack = devm_kzalloc_obj(dev, *jack); + card = devm_kzalloc_obj(dev, *card); if (!jack || !card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/pcm3168a.c b/sound/soc/intel/avs/boards/pcm3168a.c index 9d415fd0499a..894655f3d313 100644 --- a/sound/soc/intel/avs/boards/pcm3168a.c +++ b/sound/soc/intel/avs/boards/pcm3168a.c @@ -67,8 +67,8 @@ static int avs_create_dai_links(struct device *dev, struct snd_soc_dai_link **li struct snd_soc_dai_link *dl; const int num_dl = 2; - dl = devm_kcalloc(dev, num_dl, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_objs(dev, *dl, num_dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; @@ -106,7 +106,7 @@ static int avs_pcm3168a_probe(struct platform_device *pdev) mach = dev_get_platdata(dev); pdata = mach->pdata; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/probe.c b/sound/soc/intel/avs/boards/probe.c index 4053d14289b9..b3ed44bc228c 100644 --- a/sound/soc/intel/avs/boards/probe.c +++ b/sound/soc/intel/avs/boards/probe.c @@ -14,12 +14,12 @@ static int avs_create_dai_links(struct device *dev, struct snd_soc_dai_link **li { struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); if (!dl) return -ENOMEM; - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->platforms = devm_kzalloc(dev, sizeof(*dl->platforms), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->platforms = devm_kzalloc_obj(dev, *dl->platforms); if (!dl->cpus || !dl->platforms) return -ENOMEM; @@ -43,7 +43,7 @@ static int avs_probe_mb_probe(struct platform_device *pdev) struct snd_soc_card *card; int ret; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/rt274.c b/sound/soc/intel/avs/boards/rt274.c index 289f1230851f..376b0859a88f 100644 --- a/sound/soc/intel/avs/boards/rt274.c +++ b/sound/soc/intel/avs/boards/rt274.c @@ -153,15 +153,15 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->codecs = devm_kzalloc_obj(dev, *dl->codecs); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; @@ -228,8 +228,8 @@ static int avs_rt274_probe(struct platform_device *pdev) return ret; } - jack = devm_kzalloc(dev, sizeof(*jack), GFP_KERNEL); - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + jack = devm_kzalloc_obj(dev, *jack); + card = devm_kzalloc_obj(dev, *card); if (!jack || !card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/rt286.c b/sound/soc/intel/avs/boards/rt286.c index 9364d60cfcc7..2931c36df7db 100644 --- a/sound/soc/intel/avs/boards/rt286.c +++ b/sound/soc/intel/avs/boards/rt286.c @@ -121,15 +121,15 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->codecs = devm_kzalloc_obj(dev, *dl->codecs); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; @@ -198,8 +198,8 @@ static int avs_rt286_probe(struct platform_device *pdev) return ret; } - jack = devm_kzalloc(dev, sizeof(*jack), GFP_KERNEL); - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + jack = devm_kzalloc_obj(dev, *jack); + card = devm_kzalloc_obj(dev, *card); if (!jack || !card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/rt298.c b/sound/soc/intel/avs/boards/rt298.c index 5d3b3cdc9564..ef6da3f3420f 100644 --- a/sound/soc/intel/avs/boards/rt298.c +++ b/sound/soc/intel/avs/boards/rt298.c @@ -138,15 +138,15 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->codecs = devm_kzalloc_obj(dev, *dl->codecs); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; @@ -217,8 +217,8 @@ static int avs_rt298_probe(struct platform_device *pdev) return ret; } - jack = devm_kzalloc(dev, sizeof(*jack), GFP_KERNEL); - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + jack = devm_kzalloc_obj(dev, *jack); + card = devm_kzalloc_obj(dev, *card); if (!jack || !card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/rt5514.c b/sound/soc/intel/avs/boards/rt5514.c index e448bc9fa5ad..c81c47e08991 100644 --- a/sound/soc/intel/avs/boards/rt5514.c +++ b/sound/soc/intel/avs/boards/rt5514.c @@ -91,15 +91,15 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->codecs = devm_kzalloc_obj(dev, *dl->codecs); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; @@ -151,7 +151,7 @@ static int avs_rt5514_probe(struct platform_device *pdev) return ret; } - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/rt5640.c b/sound/soc/intel/avs/boards/rt5640.c index c4e33d71e82f..267006a1e09c 100644 --- a/sound/soc/intel/avs/boards/rt5640.c +++ b/sound/soc/intel/avs/boards/rt5640.c @@ -144,15 +144,15 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, uid--; /* 0-based indexing. */ } - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->codecs = devm_kzalloc_obj(dev, *dl->codecs); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; @@ -218,8 +218,8 @@ static int avs_rt5640_probe(struct platform_device *pdev) return ret; } - jack = devm_kzalloc(dev, sizeof(*jack), GFP_KERNEL); - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + jack = devm_kzalloc_obj(dev, *jack); + card = devm_kzalloc_obj(dev, *card); if (!jack || !card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/rt5663.c b/sound/soc/intel/avs/boards/rt5663.c index aadbd3f2a1b2..de10d09616c6 100644 --- a/sound/soc/intel/avs/boards/rt5663.c +++ b/sound/soc/intel/avs/boards/rt5663.c @@ -140,15 +140,15 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->codecs = devm_kzalloc_obj(dev, *dl->codecs); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; @@ -216,8 +216,8 @@ static int avs_rt5663_probe(struct platform_device *pdev) return ret; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); + card = devm_kzalloc_obj(dev, *card); if (!priv || !card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/rt5682.c b/sound/soc/intel/avs/boards/rt5682.c index d33699cca595..9f47dc14ac64 100644 --- a/sound/soc/intel/avs/boards/rt5682.c +++ b/sound/soc/intel/avs/boards/rt5682.c @@ -210,15 +210,15 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->codecs = devm_kzalloc_obj(dev, *dl->codecs); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; @@ -292,8 +292,8 @@ static int avs_rt5682_probe(struct platform_device *pdev) return ret; } - jack = devm_kzalloc(dev, sizeof(*jack), GFP_KERNEL); - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + jack = devm_kzalloc_obj(dev, *jack); + card = devm_kzalloc_obj(dev, *card); if (!jack || !card) return -ENOMEM; diff --git a/sound/soc/intel/avs/boards/ssm4567.c b/sound/soc/intel/avs/boards/ssm4567.c index d7c9bff37556..53f8b6e2c513 100644 --- a/sound/soc/intel/avs/boards/ssm4567.c +++ b/sound/soc/intel/avs/boards/ssm4567.c @@ -87,15 +87,15 @@ static int avs_create_dai_link(struct device *dev, int ssp_port, int tdm_slot, struct snd_soc_dai_link_component *platform; struct snd_soc_dai_link *dl; - dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL); - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + dl = devm_kzalloc_obj(dev, *dl); + platform = devm_kzalloc_obj(dev, *platform); if (!dl || !platform) return -ENOMEM; dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); - dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); - dl->codecs = devm_kcalloc(dev, 2, sizeof(*dl->codecs), GFP_KERNEL); + dl->cpus = devm_kzalloc_obj(dev, *dl->cpus); + dl->codecs = devm_kzalloc_objs(dev, *dl->codecs, 2); if (!dl->name || !dl->cpus || !dl->codecs) return -ENOMEM; @@ -149,7 +149,7 @@ static int avs_ssm4567_probe(struct platform_device *pdev) return ret; } - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c index 611ae9f034d4..8cb2deb2b5d9 100644 --- a/sound/soc/intel/avs/core.c +++ b/sound/soc/intel/avs/core.c @@ -395,7 +395,7 @@ static int avs_bus_init(struct avs_dev *adev, struct pci_dev *pci, const struct struct device *dev = &pci->dev; int ret; - ipc = devm_kzalloc(dev, sizeof(*ipc), GFP_KERNEL); + ipc = devm_kzalloc_obj(dev, *ipc); if (!ipc) return -ENOMEM; @@ -456,7 +456,7 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) if (ret < 0) return ret; - adev = devm_kzalloc(dev, sizeof(*adev), GFP_KERNEL); + adev = devm_kzalloc_obj(dev, *adev); if (!adev) return -ENOMEM; bus = &adev->base.core; diff --git a/sound/soc/intel/avs/loader.c b/sound/soc/intel/avs/loader.c index 12144eccd8ec..607e7cb26227 100644 --- a/sound/soc/intel/avs/loader.c +++ b/sound/soc/intel/avs/loader.c @@ -704,10 +704,10 @@ static int avs_dsp_alloc_resources(struct avs_dev *adev) adev->hw_cfg.i2s_caps.ctrl_count = link->slcount; } - adev->core_refs = devm_kcalloc(adev->dev, adev->hw_cfg.dsp_cores, - sizeof(*adev->core_refs), GFP_KERNEL); - adev->lib_names = devm_kcalloc(adev->dev, adev->fw_cfg.max_libs_count, - sizeof(*adev->lib_names), GFP_KERNEL); + adev->core_refs = devm_kzalloc_objs(adev->dev, *adev->core_refs, + adev->hw_cfg.dsp_cores); + adev->lib_names = devm_kzalloc_objs(adev->dev, *adev->lib_names, + adev->fw_cfg.max_libs_count); if (!adev->core_refs || !adev->lib_names) return -ENOMEM; diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c index f17bbc2ba63d..fd4ab14bfe04 100644 --- a/sound/soc/intel/avs/pcm.c +++ b/sound/soc/intel/avs/pcm.c @@ -1397,7 +1397,7 @@ int avs_register_component(struct device *dev, const char *name, struct avs_soc_component *acomp; const char *comp_name; - acomp = devm_kzalloc(dev, sizeof(*acomp), GFP_KERNEL); + acomp = devm_kzalloc_obj(dev, *acomp); if (!acomp) return -ENOMEM; @@ -1507,7 +1507,7 @@ int avs_register_i2s_component(struct avs_dev *adev, const char *name, unsigned for_each_set_bit(i, &port_mask, ssp_count) cpu_count += hweight_long(tdms[i]); - cpus = devm_kcalloc(adev->dev, cpu_count, sizeof(*cpus), GFP_KERNEL); + cpus = devm_kzalloc_objs(adev->dev, *cpus, cpu_count); if (!cpus) return -ENOMEM; @@ -1627,8 +1627,7 @@ static int avs_component_hda_probe(struct snd_soc_component *component) if (!pcm_count) return -EINVAL; - dais = devm_kcalloc(component->dev, pcm_count, sizeof(*dais), - GFP_KERNEL); + dais = devm_kzalloc_objs(component->dev, *dais, pcm_count); if (!dais) return -ENOMEM; diff --git a/sound/soc/intel/avs/topology.c b/sound/soc/intel/avs/topology.c index e81401bb6dbd..71aaa25f083e 100644 --- a/sound/soc/intel/avs/topology.c +++ b/sound/soc/intel/avs/topology.c @@ -430,7 +430,7 @@ static int avs_parse_nhlt_config_size(struct snd_soc_component *comp, void *elem u32 size; size = le32_to_cpu(tuple->value); - *blob = devm_kzalloc(comp->card->dev, struct_size(*blob, capabilities, size), GFP_KERNEL); + *blob = devm_kzalloc_flex(comp->card->dev, **blob, capabilities, size); if (!*blob) return -ENOMEM; @@ -984,7 +984,7 @@ static int avs_tplg_parse_modcfg_ext(struct snd_soc_component *comp, if (!num_pins) return -EINVAL; - pins = devm_kcalloc(comp->card->dev, num_pins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(comp->card->dev, *pins, num_pins); if (!pins) return -ENOMEM; @@ -1229,7 +1229,8 @@ static int avs_tplg_module_init_configs(struct snd_soc_component *comp, if (!module->num_init_configs) return -EINVAL; - cfgs = devm_kcalloc(comp->card->dev, module->num_init_configs, sizeof(*cfgs), GFP_KERNEL); + cfgs = devm_kzalloc_objs(comp->card->dev, *cfgs, + module->num_init_configs); if (!cfgs) return -ENOMEM; @@ -1255,7 +1256,7 @@ avs_tplg_module_create(struct snd_soc_component *comp, struct avs_tplg_pipeline if (ret) return ERR_PTR(ret); - module = devm_kzalloc(comp->card->dev, sizeof(*module), GFP_KERNEL); + module = devm_kzalloc_obj(comp->card->dev, *module); if (!module) return ERR_PTR(-ENOMEM); @@ -1318,7 +1319,7 @@ avs_tplg_pipeline_create(struct snd_soc_component *comp, struct avs_tplg_path *o u32 modblk_size, offset; int ret; - pipeline = devm_kzalloc(comp->card->dev, sizeof(*pipeline), GFP_KERNEL); + pipeline = devm_kzalloc_obj(comp->card->dev, *pipeline); if (!pipeline) return ERR_PTR(-ENOMEM); @@ -1355,8 +1356,9 @@ avs_tplg_pipeline_create(struct snd_soc_component *comp, struct avs_tplg_path *o modblk_size = block_size; } else { - pipeline->bindings = devm_kcalloc(comp->card->dev, pipeline->num_bindings, - sizeof(*pipeline->bindings), GFP_KERNEL); + pipeline->bindings = devm_kzalloc_objs(comp->card->dev, + *pipeline->bindings, + pipeline->num_bindings); if (!pipeline->bindings) return ERR_PTR(-ENOMEM); @@ -1448,7 +1450,7 @@ avs_tplg_path_create(struct snd_soc_component *comp, struct avs_tplg_path_templa u32 offset; int ret; - path = devm_kzalloc(comp->card->dev, sizeof(*path), GFP_KERNEL); + path = devm_kzalloc_obj(comp->card->dev, *path); if (!path) return ERR_PTR(-ENOMEM); @@ -1591,7 +1593,7 @@ avs_tplg_path_template_create(struct snd_soc_component *comp, struct avs_tplg *o struct avs_tplg_path_template *template; int ret; - template = devm_kzalloc(comp->card->dev, sizeof(*template), GFP_KERNEL); + template = devm_kzalloc_obj(comp->card->dev, *template); if (!template) return ERR_PTR(-ENOMEM); @@ -2187,7 +2189,7 @@ avs_control_load(struct snd_soc_component *comp, int index, struct snd_kcontrol_ tuples = tmc->priv.array; block_size = le32_to_cpu(tmc->priv.size); - ctl_data = devm_kzalloc(comp->card->dev, sizeof(*ctl_data), GFP_KERNEL); + ctl_data = devm_kzalloc_obj(comp->card->dev, *ctl_data); if (!ctl_data) return -ENOMEM; @@ -2223,7 +2225,7 @@ struct avs_tplg *avs_tplg_new(struct snd_soc_component *comp) { struct avs_tplg *tplg; - tplg = devm_kzalloc(comp->card->dev, sizeof(*tplg), GFP_KERNEL); + tplg = devm_kzalloc_obj(comp->card->dev, *tplg); if (!tplg) return NULL; diff --git a/sound/soc/intel/boards/bdw-rt5650.c b/sound/soc/intel/boards/bdw-rt5650.c index d25a7188f603..1937cff25049 100644 --- a/sound/soc/intel/boards/bdw-rt5650.c +++ b/sound/soc/intel/boards/bdw-rt5650.c @@ -291,8 +291,7 @@ static int bdw_rt5650_probe(struct platform_device *pdev) bdw_rt5650_card.dev = &pdev->dev; /* Allocate driver private struct */ - bdw_rt5650 = devm_kzalloc(&pdev->dev, sizeof(struct bdw_rt5650_priv), - GFP_KERNEL); + bdw_rt5650 = devm_kzalloc_obj(&pdev->dev, struct bdw_rt5650_priv); if (!bdw_rt5650) return -ENOMEM; diff --git a/sound/soc/intel/boards/bdw-rt5677.c b/sound/soc/intel/boards/bdw-rt5677.c index 408d20ed8cee..98f0ca64be27 100644 --- a/sound/soc/intel/boards/bdw-rt5677.c +++ b/sound/soc/intel/boards/bdw-rt5677.c @@ -417,8 +417,7 @@ static int bdw_rt5677_probe(struct platform_device *pdev) bdw_rt5677_card.dev = &pdev->dev; /* Allocate driver private struct */ - bdw_rt5677 = devm_kzalloc(&pdev->dev, sizeof(struct bdw_rt5677_priv), - GFP_KERNEL); + bdw_rt5677 = devm_kzalloc_obj(&pdev->dev, struct bdw_rt5677_priv); if (!bdw_rt5677) return -ENOMEM; diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c index 4d8d1d176a49..dff8c25e5c14 100644 --- a/sound/soc/intel/boards/bytcht_es8316.c +++ b/sound/soc/intel/boards/bytcht_es8316.c @@ -576,7 +576,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) int i; int ret = 0; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c index c84b9a0fe65a..349493b6b9df 100644 --- a/sound/soc/intel/boards/bytcr_rt5640.c +++ b/sound/soc/intel/boards/bytcr_rt5640.c @@ -1715,7 +1715,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) int i, aif; is_bytcr = false; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c index fbfaf0b351c9..a307053fcfac 100644 --- a/sound/soc/intel/boards/bytcr_rt5651.c +++ b/sound/soc/intel/boards/bytcr_rt5651.c @@ -931,7 +931,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) int dai_index = 0; int i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/intel/boards/bytcr_wm5102.c b/sound/soc/intel/boards/bytcr_wm5102.c index 4aa0cf49b033..9bccaccd6a7b 100644 --- a/sound/soc/intel/boards/bytcr_wm5102.c +++ b/sound/soc/intel/boards/bytcr_wm5102.c @@ -531,7 +531,7 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev) bool sof_parent; int i, ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c index ad45b79d3e4b..0a4d3e3c5e90 100644 --- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c +++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c @@ -532,7 +532,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) const char *platform_name; bool sof_parent; - drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(dev, *drv); if (!drv) return -ENOMEM; diff --git a/sound/soc/intel/boards/cht_bsw_nau8824.c b/sound/soc/intel/boards/cht_bsw_nau8824.c index 4afb292d4f13..bd244557a160 100644 --- a/sound/soc/intel/boards/cht_bsw_nau8824.c +++ b/sound/soc/intel/boards/cht_bsw_nau8824.c @@ -248,7 +248,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) bool sof_parent; int ret_val; - drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(&pdev->dev, *drv); if (!drv) return -ENOMEM; snd_soc_card_set_drvdata(&snd_soc_card_cht, drv); diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c index 4f20928a3604..0fd879a5bbb0 100644 --- a/sound/soc/intel/boards/cht_bsw_rt5645.c +++ b/sound/soc/intel/boards/cht_bsw_rt5645.c @@ -537,7 +537,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) int i; const char *mclk_name; - drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(&pdev->dev, *drv); if (!drv) return -ENOMEM; diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c index eddb179eaa21..9a38e77cf59d 100644 --- a/sound/soc/intel/boards/cht_bsw_rt5672.c +++ b/sound/soc/intel/boards/cht_bsw_rt5672.c @@ -452,7 +452,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) int dai_index = 0; int i; - drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(dev, *drv); if (!drv) return -ENOMEM; diff --git a/sound/soc/intel/boards/cht_rt5677.c b/sound/soc/intel/boards/cht_rt5677.c index 0f5e169fe96f..48b563046896 100644 --- a/sound/soc/intel/boards/cht_rt5677.c +++ b/sound/soc/intel/boards/cht_rt5677.c @@ -336,7 +336,7 @@ static int cht_rt5677_headset_init(struct snd_soc_component *component) int jack_type; int ret; - jack = devm_kzalloc(card->dev, sizeof(*jack), GFP_KERNEL); + jack = devm_kzalloc_obj(card->dev, *jack); if (!jack) return -ENOMEM; @@ -531,7 +531,7 @@ static int snd_cht_rt5677_probe(struct platform_device *pdev) int ret; int i; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/sound/soc/intel/boards/ehl_rt5660.c b/sound/soc/intel/boards/ehl_rt5660.c index 7de39bc1e763..28b10d0b6f8b 100644 --- a/sound/soc/intel/boards/ehl_rt5660.c +++ b/sound/soc/intel/boards/ehl_rt5660.c @@ -75,7 +75,7 @@ static int hdmi_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_dai *dai = snd_soc_rtd_to_codec(rtd, 0); struct sof_hdmi_pcm *pcm; - pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); + pcm = devm_kzalloc_obj(rtd->card->dev, *pcm); if (!pcm) return -ENOMEM; @@ -274,7 +274,7 @@ static int snd_ehl_rt5660_probe(struct platform_device *pdev) card->dev = &pdev->dev; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; INIT_LIST_HEAD(&ctx->hdmi_pcm_list); diff --git a/sound/soc/intel/boards/skl_hda_dsp_generic.c b/sound/soc/intel/boards/skl_hda_dsp_generic.c index 519218385fdf..34c8b7fec3ae 100644 --- a/sound/soc/intel/boards/skl_hda_dsp_generic.c +++ b/sound/soc/intel/boards/skl_hda_dsp_generic.c @@ -105,7 +105,7 @@ static int skl_hda_audio_probe(struct platform_device *pdev) unsigned long board_quirk = skl_hda_get_board_quirk(&mach->mach_params); int ret; - card = devm_kzalloc(&pdev->dev, sizeof(struct snd_soc_card), GFP_KERNEL); + card = devm_kzalloc_obj(&pdev->dev, struct snd_soc_card); if (!card) return -ENOMEM; diff --git a/sound/soc/intel/boards/sof_board_helpers.c b/sound/soc/intel/boards/sof_board_helpers.c index f741a1e142be..671d85cae843 100644 --- a/sound/soc/intel/boards/sof_board_helpers.c +++ b/sound/soc/intel/boards/sof_board_helpers.c @@ -192,8 +192,7 @@ static int set_ssp_codec_link(struct device *dev, struct snd_soc_dai_link *link, return -ENOMEM; /* cpus */ - cpus = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link_component), - GFP_KERNEL); + cpus = devm_kzalloc_obj(dev, struct snd_soc_dai_link_component); if (!cpus) return -ENOMEM; @@ -229,8 +228,7 @@ static int set_dmic_link(struct device *dev, struct snd_soc_dai_link *link, struct snd_soc_dai_link_component *cpus; /* cpus */ - cpus = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link_component), - GFP_KERNEL); + cpus = devm_kzalloc_obj(dev, struct snd_soc_dai_link_component); if (!cpus) return -ENOMEM; @@ -287,8 +285,7 @@ static int set_idisp_hdmi_link(struct device *dev, struct snd_soc_dai_link *link return -ENOMEM; /* cpus */ - cpus = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link_component), - GFP_KERNEL); + cpus = devm_kzalloc_obj(dev, struct snd_soc_dai_link_component); if (!cpus) return -ENOMEM; @@ -301,9 +298,8 @@ static int set_idisp_hdmi_link(struct device *dev, struct snd_soc_dai_link *link /* codecs */ if (idisp_codec) { - codecs = devm_kzalloc(dev, - sizeof(struct snd_soc_dai_link_component), - GFP_KERNEL); + codecs = devm_kzalloc_obj(dev, + struct snd_soc_dai_link_component); if (!codecs) return -ENOMEM; @@ -346,8 +342,7 @@ static int set_ssp_amp_link(struct device *dev, struct snd_soc_dai_link *link, return -ENOMEM; /* cpus */ - cpus = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link_component), - GFP_KERNEL); + cpus = devm_kzalloc_obj(dev, struct snd_soc_dai_link_component); if (!cpus) return -ENOMEM; @@ -384,8 +379,7 @@ static int set_bt_offload_link(struct device *dev, struct snd_soc_dai_link *link return -ENOMEM; /* cpus */ - cpus = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link_component), - GFP_KERNEL); + cpus = devm_kzalloc_obj(dev, struct snd_soc_dai_link_component); if (!cpus) return -ENOMEM; @@ -423,8 +417,7 @@ static int set_hdmi_in_link(struct device *dev, struct snd_soc_dai_link *link, return -ENOMEM; /* cpus */ - cpus = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link_component), - GFP_KERNEL); + cpus = devm_kzalloc_obj(dev, struct snd_soc_dai_link_component); if (!cpus) return -ENOMEM; @@ -547,8 +540,7 @@ int sof_intel_board_set_dai_link(struct device *dev, struct snd_soc_card *card, num_links = calculate_num_links(ctx); - links = devm_kcalloc(dev, num_links, sizeof(struct snd_soc_dai_link), - GFP_KERNEL); + links = devm_kzalloc_objs(dev, struct snd_soc_dai_link, num_links); if (!links) return -ENOMEM; @@ -742,7 +734,7 @@ sof_intel_board_get_ctx(struct device *dev, unsigned long board_quirk) dev_dbg(dev, "create ctx, board_quirk 0x%lx\n", board_quirk); - ctx = devm_kzalloc(dev, sizeof(struct sof_card_private), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, struct sof_card_private); if (!ctx) return NULL; diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c index d40f10c6ae54..d86e4aa940ec 100644 --- a/sound/soc/intel/boards/sof_es8336.c +++ b/sound/soc/intel/boards/sof_es8336.c @@ -255,7 +255,7 @@ static int sof_hdmi_init(struct snd_soc_pcm_runtime *runtime) struct snd_soc_dai *dai = snd_soc_rtd_to_codec(runtime, 0); struct sof_hdmi_pcm *pcm; - pcm = devm_kzalloc(runtime->card->dev, sizeof(*pcm), GFP_KERNEL); + pcm = devm_kzalloc_obj(runtime->card->dev, *pcm); if (!pcm) return -ENOMEM; @@ -453,10 +453,10 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, int id = 0; int i; - links = devm_kcalloc(dev, sof_es8336_card.num_links, - sizeof(struct snd_soc_dai_link), GFP_KERNEL); - cpus = devm_kcalloc(dev, sof_es8336_card.num_links, - sizeof(struct snd_soc_dai_link_component), GFP_KERNEL); + links = devm_kzalloc_objs(dev, struct snd_soc_dai_link, + sof_es8336_card.num_links); + cpus = devm_kzalloc_objs(dev, struct snd_soc_dai_link_component, + sof_es8336_card.num_links); if (!links || !cpus) goto devm_err; @@ -522,10 +522,9 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, /* HDMI */ if (hdmi_num > 0) { - idisp_components = devm_kcalloc(dev, - hdmi_num, - sizeof(struct snd_soc_dai_link_component), - GFP_KERNEL); + idisp_components = devm_kzalloc_objs(dev, + struct snd_soc_dai_link_component, + hdmi_num); if (!idisp_components) goto devm_err; } @@ -622,7 +621,7 @@ static int sof_es8336_probe(struct platform_device *pdev) int hdmi_num = 3; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/intel/boards/sof_pcm512x.c b/sound/soc/intel/boards/sof_pcm512x.c index 359559b6175b..13ec19c3707b 100644 --- a/sound/soc/intel/boards/sof_pcm512x.c +++ b/sound/soc/intel/boards/sof_pcm512x.c @@ -74,7 +74,7 @@ static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_dai *dai = snd_soc_rtd_to_codec(rtd, 0); struct sof_hdmi_pcm *pcm; - pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); + pcm = devm_kzalloc_obj(rtd->card->dev, *pcm); if (!pcm) return -ENOMEM; @@ -227,10 +227,10 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, struct snd_soc_dai_link *links; int i, id = 0; - links = devm_kcalloc(dev, sof_audio_card_pcm512x.num_links, - sizeof(struct snd_soc_dai_link), GFP_KERNEL); - cpus = devm_kcalloc(dev, sof_audio_card_pcm512x.num_links, - sizeof(struct snd_soc_dai_link_component), GFP_KERNEL); + links = devm_kzalloc_objs(dev, struct snd_soc_dai_link, + sof_audio_card_pcm512x.num_links); + cpus = devm_kzalloc_objs(dev, struct snd_soc_dai_link_component, + sof_audio_card_pcm512x.num_links); if (!links || !cpus) goto devm_err; @@ -301,9 +301,9 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, /* HDMI */ if (hdmi_num > 0) { - idisp_components = devm_kcalloc(dev, hdmi_num, - sizeof(struct snd_soc_dai_link_component), - GFP_KERNEL); + idisp_components = devm_kzalloc_objs(dev, + struct snd_soc_dai_link_component, + hdmi_num); if (!idisp_components) goto devm_err; } @@ -359,7 +359,7 @@ static int sof_audio_probe(struct platform_device *pdev) int dmic_be_num, hdmi_num; int ret, ssp_codec; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 72fe013fffe8..64bcb3f04c95 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -956,19 +956,19 @@ static int create_sdw_dailink(struct snd_soc_card *card, if (!name) return -ENOMEM; - cpus = devm_kcalloc(dev, num_cpus, sizeof(*cpus), GFP_KERNEL); + cpus = devm_kzalloc_objs(dev, *cpus, num_cpus); if (!cpus) return -ENOMEM; - codecs = devm_kcalloc(dev, num_codecs, sizeof(*codecs), GFP_KERNEL); + codecs = devm_kzalloc_objs(dev, *codecs, num_codecs); if (!codecs) return -ENOMEM; - platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); + platform = devm_kzalloc_obj(dev, *platform); if (!platform) return -ENOMEM; - codec_maps = devm_kcalloc(dev, num_codecs, sizeof(*codec_maps), GFP_KERNEL); + codec_maps = devm_kzalloc_objs(dev, *codec_maps, num_codecs); if (!codec_maps) return -ENOMEM; @@ -1282,7 +1282,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) goto err_dai; } - sof_aux = devm_kcalloc(dev, num_aux, sizeof(*sof_aux), GFP_KERNEL); + sof_aux = devm_kzalloc_objs(dev, *sof_aux, num_aux); if (!sof_aux) { ret = -ENOMEM; goto err_dai; @@ -1336,7 +1336,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) sdw_be_num, ssp_num, dmic_num, intel_ctx->hdmi.idisp_codec ? hdmi_num : 0, bt_num); - codec_conf = devm_kcalloc(dev, num_confs, sizeof(*codec_conf), GFP_KERNEL); + codec_conf = devm_kzalloc_objs(dev, *codec_conf, num_confs); if (!codec_conf) { ret = -ENOMEM; goto err_end; @@ -1348,7 +1348,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) * and functional SOF topologies to support echo reference. */ num_links = sdw_be_num + ssp_num + dmic_num + hdmi_num + bt_num + 1; - dai_links = devm_kcalloc(dev, num_links, sizeof(*dai_links), GFP_KERNEL); + dai_links = devm_kzalloc_objs(dev, *dai_links, num_links); if (!dai_links) { ret = -ENOMEM; goto err_end; @@ -1454,11 +1454,11 @@ static int mc_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "Entry\n"); - intel_ctx = devm_kzalloc(&pdev->dev, sizeof(*intel_ctx), GFP_KERNEL); + intel_ctx = devm_kzalloc_obj(&pdev->dev, *intel_ctx); if (!intel_ctx) return -ENOMEM; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/sound/soc/intel/boards/sof_wm8804.c b/sound/soc/intel/boards/sof_wm8804.c index 51922347409f..17bcfd7306eb 100644 --- a/sound/soc/intel/boards/sof_wm8804.c +++ b/sound/soc/intel/boards/sof_wm8804.c @@ -212,7 +212,7 @@ static int sof_wm8804_probe(struct platform_device *pdev) int ret; int i; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(&pdev->dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/sound/soc/intel/catpt/device.c b/sound/soc/intel/catpt/device.c index e36eea8b5408..a78ae2294052 100644 --- a/sound/soc/intel/catpt/device.c +++ b/sound/soc/intel/catpt/device.c @@ -230,7 +230,7 @@ static int catpt_acpi_probe(struct platform_device *pdev) return -ENODEV; } - cdev = devm_kzalloc(dev, sizeof(*cdev), GFP_KERNEL); + cdev = devm_kzalloc_obj(dev, *cdev); if (!cdev) return -ENOMEM; diff --git a/sound/soc/intel/catpt/dsp.c b/sound/soc/intel/catpt/dsp.c index 960344991b11..13886083809c 100644 --- a/sound/soc/intel/catpt/dsp.c +++ b/sound/soc/intel/catpt/dsp.c @@ -117,7 +117,7 @@ int catpt_dmac_probe(struct catpt_dev *cdev) struct dw_dma_chip *dmac; int ret; - dmac = devm_kzalloc(cdev->dev, sizeof(*dmac), GFP_KERNEL); + dmac = devm_kzalloc_obj(cdev->dev, *dmac); if (!dmac) return -ENOMEM; diff --git a/sound/soc/intel/keembay/kmb_platform.c b/sound/soc/intel/keembay/kmb_platform.c index 48f132f01878..1ca8ef95d41e 100644 --- a/sound/soc/intel/keembay/kmb_platform.c +++ b/sound/soc/intel/keembay/kmb_platform.c @@ -826,7 +826,7 @@ static int kmb_plat_dai_probe(struct platform_device *pdev) int ret, irq; u32 comp1_reg; - kmb_i2s = devm_kzalloc(dev, sizeof(*kmb_i2s), GFP_KERNEL); + kmb_i2s = devm_kzalloc_obj(dev, *kmb_i2s); if (!kmb_i2s) return -ENOMEM; diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c index 7a1589cb775a..a31339a1a1b8 100644 --- a/sound/soc/jz4740/jz4740-i2s.c +++ b/sound/soc/jz4740/jz4740-i2s.c @@ -549,7 +549,7 @@ static int jz4740_i2s_dev_probe(struct platform_device *pdev) void __iomem *regs; int ret; - i2s = devm_kzalloc(dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(dev, *i2s); if (!i2s) return -ENOMEM; diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index 739a819d8494..63be42279a82 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c @@ -652,7 +652,7 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; int err; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/loongson/loongson1_ac97.c b/sound/soc/loongson/loongson1_ac97.c index 84901900ad43..8d8f9e1fdf86 100644 --- a/sound/soc/loongson/loongson1_ac97.c +++ b/sound/soc/loongson/loongson1_ac97.c @@ -293,7 +293,7 @@ static int ls1x_ac97_probe(struct platform_device *pdev) struct resource *res; int ret; - ac97 = devm_kzalloc(dev, sizeof(struct ls1x_ac97), GFP_KERNEL); + ac97 = devm_kzalloc_obj(dev, struct ls1x_ac97); if (!ac97) return -ENOMEM; ls1x_ac97 = ac97; diff --git a/sound/soc/loongson/loongson_card.c b/sound/soc/loongson/loongson_card.c index 9f3907278462..b06b596047b8 100644 --- a/sound/soc/loongson/loongson_card.c +++ b/sound/soc/loongson/loongson_card.c @@ -297,7 +297,7 @@ static int loongson_asoc_card_probe(struct platform_device *pdev) struct snd_soc_card *card; int ret; - ls_priv = devm_kzalloc(dev, sizeof(*ls_priv), GFP_KERNEL); + ls_priv = devm_kzalloc_obj(dev, *ls_priv); if (!ls_priv) return -ENOMEM; diff --git a/sound/soc/loongson/loongson_i2s_pci.c b/sound/soc/loongson/loongson_i2s_pci.c index f5b560465706..b26584445eb4 100644 --- a/sound/soc/loongson/loongson_i2s_pci.c +++ b/sound/soc/loongson/loongson_i2s_pci.c @@ -33,7 +33,7 @@ static int loongson_i2s_pci_probe(struct pci_dev *pdev, return -ENODEV; } - i2s = devm_kzalloc(dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(dev, *i2s); if (!i2s) return -ENOMEM; diff --git a/sound/soc/loongson/loongson_i2s_plat.c b/sound/soc/loongson/loongson_i2s_plat.c index 82d95c6644ef..1b12b325b87c 100644 --- a/sound/soc/loongson/loongson_i2s_plat.c +++ b/sound/soc/loongson/loongson_i2s_plat.c @@ -71,7 +71,7 @@ static int loongson_i2s_plat_probe(struct platform_device *pdev) struct clk *i2s_clk; int ret; - i2s = devm_kzalloc(dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(dev, *i2s); if (!i2s) return -ENOMEM; diff --git a/sound/soc/mediatek/an7581/an7581-afe-pcm.c b/sound/soc/mediatek/an7581/an7581-afe-pcm.c index d47edb630452..1b12655ab42a 100644 --- a/sound/soc/mediatek/an7581/an7581-afe-pcm.c +++ b/sound/soc/mediatek/an7581/an7581-afe-pcm.c @@ -345,7 +345,7 @@ static int an7581_dai_memif_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; @@ -377,25 +377,22 @@ static int an7581_afe_pcm_dev_probe(struct platform_device *pdev) int i, irq_id, ret; void __iomem *base; - afe = devm_kzalloc(dev, sizeof(*afe), GFP_KERNEL); + afe = devm_kzalloc_obj(dev, *afe); if (!afe) return -ENOMEM; platform_set_drvdata(pdev, afe); - afe->platform_priv = devm_kzalloc(dev, sizeof(*afe_priv), - GFP_KERNEL); + afe->platform_priv = devm_kzalloc_obj(dev, *afe_priv); if (!afe->platform_priv) return -ENOMEM; afe->irqs_size = AN7581_IRQ_NUM; - afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), - GFP_KERNEL); + afe->irqs = devm_kzalloc_objs(dev, *afe->irqs, afe->irqs_size); if (!afe->irqs) return -ENOMEM; afe->memif_size = AN7581_MEMIF_NUM; - afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), - GFP_KERNEL); + afe->memif = devm_kzalloc_objs(dev, *afe->memif, afe->memif_size); if (!afe->memif) return -ENOMEM; diff --git a/sound/soc/mediatek/an7581/an7581-dai-etdm.c b/sound/soc/mediatek/an7581/an7581-dai-etdm.c index 7fbfd8fe1836..bd6b37635ff0 100644 --- a/sound/soc/mediatek/an7581/an7581-dai-etdm.c +++ b/sound/soc/mediatek/an7581/an7581-dai-etdm.c @@ -317,8 +317,7 @@ static int mtk_dai_etdm_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) struct mtk_dai_etdm_priv *etdm_data; void *priv_data; - priv_data = devm_kzalloc(afe->dev, sizeof(struct mtk_dai_etdm_priv), - GFP_KERNEL); + priv_data = devm_kzalloc_obj(afe->dev, struct mtk_dai_etdm_priv); if (!priv_data) return -ENOMEM; @@ -415,7 +414,7 @@ int an7581_dai_etdm_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c index ec99bc4a5d5e..54d760a0b9e3 100644 --- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c +++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c @@ -332,8 +332,8 @@ int mtk_afe_suspend(struct snd_soc_component *component) if (!afe->reg_back_up) afe->reg_back_up = - devm_kcalloc(dev, afe->reg_back_up_list_num, - sizeof(unsigned int), GFP_KERNEL); + devm_kzalloc_objs(dev, unsigned int, + afe->reg_back_up_list_num); if (afe->reg_back_up) { for (i = 0; i < afe->reg_back_up_list_num; i++) diff --git a/sound/soc/mediatek/common/mtk-afe-platform-driver.c b/sound/soc/mediatek/common/mtk-afe-platform-driver.c index 477284e12396..7dd93d42ccde 100644 --- a/sound/soc/mediatek/common/mtk-afe-platform-driver.c +++ b/sound/soc/mediatek/common/mtk-afe-platform-driver.c @@ -27,10 +27,9 @@ int mtk_afe_combine_sub_dai(struct mtk_base_afe *afe) /* combine sub_dais */ afe->num_dai_drivers = num_dai_drivers; - afe->dai_drivers = devm_kcalloc(afe->dev, - num_dai_drivers, - sizeof(struct snd_soc_dai_driver), - GFP_KERNEL); + afe->dai_drivers = devm_kzalloc_objs(afe->dev, + struct snd_soc_dai_driver, + num_dai_drivers); if (!afe->dai_drivers) return -ENOMEM; diff --git a/sound/soc/mediatek/common/mtk-btcvsd.c b/sound/soc/mediatek/common/mtk-btcvsd.c index 85cfc602dfd3..19329dd7c0d7 100644 --- a/sound/soc/mediatek/common/mtk-btcvsd.c +++ b/sound/soc/mediatek/common/mtk-btcvsd.c @@ -1268,18 +1268,18 @@ static int mtk_btcvsd_snd_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; /* init btcvsd private data */ - btcvsd = devm_kzalloc(dev, sizeof(*btcvsd), GFP_KERNEL); + btcvsd = devm_kzalloc_obj(dev, *btcvsd); if (!btcvsd) return -ENOMEM; platform_set_drvdata(pdev, btcvsd); btcvsd->dev = dev; /* init tx/rx */ - btcvsd->rx = devm_kzalloc(btcvsd->dev, sizeof(*btcvsd->rx), GFP_KERNEL); + btcvsd->rx = devm_kzalloc_obj(btcvsd->dev, *btcvsd->rx); if (!btcvsd->rx) return -ENOMEM; - btcvsd->tx = devm_kzalloc(btcvsd->dev, sizeof(*btcvsd->tx), GFP_KERNEL); + btcvsd->tx = devm_kzalloc_obj(btcvsd->dev, *btcvsd->tx); if (!btcvsd->tx) return -ENOMEM; diff --git a/sound/soc/mediatek/common/mtk-dsp-sof-common.c b/sound/soc/mediatek/common/mtk-dsp-sof-common.c index adefbed5bbe7..9610f5430e75 100644 --- a/sound/soc/mediatek/common/mtk-dsp-sof-common.c +++ b/sound/soc/mediatek/common/mtk-dsp-sof-common.c @@ -164,9 +164,8 @@ int mtk_sof_card_late_probe(struct snd_soc_card *card) /* 2. overwrite all BE fixups, and backup the existing fixup */ for_each_card_prelinks(card, i, dai_link) { if (dai_link->be_hw_params_fixup) { - mtk_dai_link = devm_kzalloc(card->dev, - sizeof(*mtk_dai_link), - GFP_KERNEL); + mtk_dai_link = devm_kzalloc_obj(card->dev, + *mtk_dai_link); if (!mtk_dai_link) return -ENOMEM; @@ -243,7 +242,7 @@ int mtk_sof_dailink_parse_of(struct device *dev, struct snd_soc_card *card, return -EINVAL; } - parsed_dai_link = devm_kcalloc(dev, num_links, sizeof(*parsed_dai_link), GFP_KERNEL); + parsed_dai_link = devm_kzalloc_objs(dev, *parsed_dai_link, num_links); if (!parsed_dai_link) return -ENOMEM; diff --git a/sound/soc/mediatek/common/mtk-soundcard-driver.c b/sound/soc/mediatek/common/mtk-soundcard-driver.c index a84f4ab4488b..d0a7dd619feb 100644 --- a/sound/soc/mediatek/common/mtk-soundcard-driver.c +++ b/sound/soc/mediatek/common/mtk-soundcard-driver.c @@ -209,7 +209,7 @@ static int mtk_soundcard_set_topology_name(struct device *dev, { struct mtk_soundcard_name *saved; - saved = devm_kzalloc(dev, sizeof(*saved), GFP_KERNEL); + saved = devm_kzalloc_obj(dev, *saved); if (!saved) return -ENOMEM; @@ -271,14 +271,14 @@ int mtk_soundcard_common_probe(struct platform_device *pdev) return ret; } - soc_card_data = devm_kzalloc(&pdev->dev, sizeof(*soc_card_data), GFP_KERNEL); + soc_card_data = devm_kzalloc_obj(&pdev->dev, *soc_card_data); if (!soc_card_data) return -ENOMEM; soc_card_data->card_data = pdata->card_data; - jacks = devm_kcalloc(card->dev, soc_card_data->card_data->num_jacks, - sizeof(*jacks), GFP_KERNEL); + jacks = devm_kzalloc_objs(card->dev, *jacks, + soc_card_data->card_data->num_jacks); if (!jacks) return -ENOMEM; diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c index 3c5a76591ea7..087f7cc1e96d 100644 --- a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c +++ b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c @@ -1599,14 +1599,13 @@ static int mt2701_afe_pcm_dev_probe(struct platform_device *pdev) struct device *dev; int i, irq_id, ret; - afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL); + afe = devm_kzalloc_obj(&pdev->dev, *afe); if (!afe) return -ENOMEM; soc = of_device_get_match_data(&pdev->dev); - afe_priv = devm_kzalloc(&pdev->dev, - struct_size(afe_priv, i2s_path, soc->i2s_num), - GFP_KERNEL); + afe_priv = devm_kzalloc_flex(&pdev->dev, *afe_priv, i2s_path, + soc->i2s_num); if (!afe_priv) return -ENOMEM; @@ -1635,8 +1634,7 @@ static int mt2701_afe_pcm_dev_probe(struct platform_device *pdev) /* memif initialize */ afe->memif_size = MT2701_MEMIF_NUM; - afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), - GFP_KERNEL); + afe->memif = devm_kzalloc_objs(dev, *afe->memif, afe->memif_size); if (!afe->memif) return -ENOMEM; @@ -1647,8 +1645,7 @@ static int mt2701_afe_pcm_dev_probe(struct platform_device *pdev) /* irq initialize */ afe->irqs_size = MT2701_IRQ_ASYS_END; - afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), - GFP_KERNEL); + afe->irqs = devm_kzalloc_objs(dev, *afe->irqs, afe->irqs_size); if (!afe->irqs) return -ENOMEM; diff --git a/sound/soc/mediatek/mt2701/mt2701-cs42448.c b/sound/soc/mediatek/mt2701/mt2701-cs42448.c index af833a8daa2a..ff7a1bac848c 100644 --- a/sound/soc/mediatek/mt2701/mt2701-cs42448.c +++ b/sound/soc/mediatek/mt2701/mt2701-cs42448.c @@ -321,8 +321,7 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev) struct device_node *platform_node, *codec_node, *codec_node_bt_mrg; struct device *dev = &pdev->dev; struct mt2701_cs42448_private *priv = - devm_kzalloc(dev, sizeof(struct mt2701_cs42448_private), - GFP_KERNEL); + devm_kzalloc_obj(dev, struct mt2701_cs42448_private); struct snd_soc_dai_link *dai_link; if (!priv) diff --git a/sound/soc/mediatek/mt6797/mt6797-afe-clk.c b/sound/soc/mediatek/mt6797/mt6797-afe-clk.c index 2326496f8b27..bd128df16e02 100644 --- a/sound/soc/mediatek/mt6797/mt6797-afe-clk.c +++ b/sound/soc/mediatek/mt6797/mt6797-afe-clk.c @@ -36,8 +36,7 @@ int mt6797_init_clock(struct mtk_base_afe *afe) struct mt6797_afe_private *afe_priv = afe->platform_priv; int i; - afe_priv->clk = devm_kcalloc(afe->dev, CLK_NUM, sizeof(*afe_priv->clk), - GFP_KERNEL); + afe_priv->clk = devm_kzalloc_objs(afe->dev, *afe_priv->clk, CLK_NUM); if (!afe_priv->clk) return -ENOMEM; diff --git a/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c b/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c index dfe67727fe47..2069c340ca39 100644 --- a/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c +++ b/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c @@ -708,7 +708,7 @@ static int mt6797_dai_memif_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; @@ -739,12 +739,11 @@ static int mt6797_afe_pcm_dev_probe(struct platform_device *pdev) struct device *dev; int i, irq_id, ret; - afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL); + afe = devm_kzalloc_obj(&pdev->dev, *afe); if (!afe) return -ENOMEM; - afe->platform_priv = devm_kzalloc(&pdev->dev, sizeof(*afe_priv), - GFP_KERNEL); + afe->platform_priv = devm_kzalloc_obj(&pdev->dev, *afe_priv); if (!afe->platform_priv) return -ENOMEM; @@ -769,8 +768,7 @@ static int mt6797_afe_pcm_dev_probe(struct platform_device *pdev) /* init memif */ afe->memif_size = MT6797_MEMIF_NUM; - afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), - GFP_KERNEL); + afe->memif = devm_kzalloc_objs(dev, *afe->memif, afe->memif_size); if (!afe->memif) return -ENOMEM; @@ -783,8 +781,7 @@ static int mt6797_afe_pcm_dev_probe(struct platform_device *pdev) /* irq initialize */ afe->irqs_size = MT6797_IRQ_NUM; - afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), - GFP_KERNEL); + afe->irqs = devm_kzalloc_objs(dev, *afe->irqs, afe->irqs_size); if (!afe->irqs) return -ENOMEM; diff --git a/sound/soc/mediatek/mt6797/mt6797-dai-adda.c b/sound/soc/mediatek/mt6797/mt6797-dai-adda.c index 78f3ad758c12..cc64ee8eda2d 100644 --- a/sound/soc/mediatek/mt6797/mt6797-dai-adda.c +++ b/sound/soc/mediatek/mt6797/mt6797-dai-adda.c @@ -306,7 +306,7 @@ int mt6797_dai_adda_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt6797/mt6797-dai-hostless.c b/sound/soc/mediatek/mt6797/mt6797-dai-hostless.c index ed23e6a53b08..d7f4c1924408 100644 --- a/sound/soc/mediatek/mt6797/mt6797-dai-hostless.c +++ b/sound/soc/mediatek/mt6797/mt6797-dai-hostless.c @@ -102,7 +102,7 @@ int mt6797_dai_hostless_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt6797/mt6797-dai-pcm.c b/sound/soc/mediatek/mt6797/mt6797-dai-pcm.c index 8a309b0734f7..3539f8a1bf95 100644 --- a/sound/soc/mediatek/mt6797/mt6797-dai-pcm.c +++ b/sound/soc/mediatek/mt6797/mt6797-dai-pcm.c @@ -302,7 +302,7 @@ int mt6797_dai_pcm_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt7986/mt7986-afe-pcm.c b/sound/soc/mediatek/mt7986/mt7986-afe-pcm.c index e7ecb2761b4d..062ec7fb04e2 100644 --- a/sound/soc/mediatek/mt7986/mt7986-afe-pcm.c +++ b/sound/soc/mediatek/mt7986/mt7986-afe-pcm.c @@ -323,8 +323,7 @@ static int mt7986_init_clock(struct mtk_base_afe *afe) struct mt7986_afe_private *afe_priv = afe->platform_priv; int ret, i; - afe_priv->clks = devm_kcalloc(afe->dev, CLK_NUM, - sizeof(*afe_priv->clks), GFP_KERNEL); + afe_priv->clks = devm_kzalloc_objs(afe->dev, *afe_priv->clks, CLK_NUM); if (!afe_priv->clks) return -ENOMEM; afe_priv->num_clks = CLK_NUM; @@ -433,7 +432,7 @@ static int mt7986_dai_memif_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; @@ -463,13 +462,12 @@ static int mt7986_afe_pcm_dev_probe(struct platform_device *pdev) struct device *dev; int i, irq_id, ret; - afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL); + afe = devm_kzalloc_obj(&pdev->dev, *afe); if (!afe) return -ENOMEM; platform_set_drvdata(pdev, afe); - afe->platform_priv = devm_kzalloc(&pdev->dev, sizeof(*afe_priv), - GFP_KERNEL); + afe->platform_priv = devm_kzalloc_obj(&pdev->dev, *afe_priv); if (!afe->platform_priv) return -ENOMEM; @@ -505,8 +503,7 @@ static int mt7986_afe_pcm_dev_probe(struct platform_device *pdev) /* init memif */ afe->memif_size = MT7986_MEMIF_NUM; - afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), - GFP_KERNEL); + afe->memif = devm_kzalloc_objs(dev, *afe->memif, afe->memif_size); if (!afe->memif) return -ENOMEM; @@ -519,8 +516,7 @@ static int mt7986_afe_pcm_dev_probe(struct platform_device *pdev) /* irq initialize */ afe->irqs_size = MT7986_IRQ_NUM; - afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), - GFP_KERNEL); + afe->irqs = devm_kzalloc_objs(dev, *afe->irqs, afe->irqs_size); if (!afe->irqs) return -ENOMEM; diff --git a/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c index 49f5b2bf565f..39606682839d 100644 --- a/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c +++ b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c @@ -304,8 +304,7 @@ static int mtk_dai_etdm_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) return -EINVAL; } - priv_data = devm_kzalloc(afe->dev, sizeof(struct mtk_dai_etdm_priv), - GFP_KERNEL); + priv_data = devm_kzalloc_obj(afe->dev, struct mtk_dai_etdm_priv); if (!priv_data) return -ENOMEM; @@ -408,7 +407,7 @@ int mt7986_dai_etdm_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c index c95699f84191..855ecf8ca21d 100644 --- a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c +++ b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c @@ -1059,11 +1059,11 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev) if (ret) return ret; - afe = devm_kzalloc(dev, sizeof(*afe), GFP_KERNEL); + afe = devm_kzalloc_obj(dev, *afe); if (!afe) return -ENOMEM; - afe->platform_priv = devm_kzalloc(dev, sizeof(*afe_priv), GFP_KERNEL); + afe->platform_priv = devm_kzalloc_obj(dev, *afe_priv); afe_priv = afe->platform_priv; if (!afe_priv) return -ENOMEM; @@ -1096,14 +1096,12 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev) /* memif % irq initialize*/ afe->memif_size = MT8173_AFE_MEMIF_NUM; - afe->memif = devm_kcalloc(dev, afe->memif_size, - sizeof(*afe->memif), GFP_KERNEL); + afe->memif = devm_kzalloc_objs(dev, *afe->memif, afe->memif_size); if (!afe->memif) return -ENOMEM; afe->irqs_size = MT8173_AFE_IRQ_NUM; - afe->irqs = devm_kcalloc(dev, afe->irqs_size, - sizeof(*afe->irqs), GFP_KERNEL); + afe->irqs = devm_kzalloc_objs(dev, *afe->irqs, afe->irqs_size); if (!afe->irqs) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8183/mt8183-afe-clk.c b/sound/soc/mediatek/mt8183/mt8183-afe-clk.c index 40f9afcdaa16..8b98a2770688 100644 --- a/sound/soc/mediatek/mt8183/mt8183-afe-clk.c +++ b/sound/soc/mediatek/mt8183/mt8183-afe-clk.c @@ -94,8 +94,7 @@ int mt8183_init_clock(struct mtk_base_afe *afe) struct mt8183_afe_private *afe_priv = afe->platform_priv; int i; - afe_priv->clk = devm_kcalloc(afe->dev, CLK_NUM, sizeof(*afe_priv->clk), - GFP_KERNEL); + afe_priv->clk = devm_kzalloc_objs(afe->dev, *afe_priv->clk, CLK_NUM); if (!afe_priv->clk) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c index d8938542b828..978fb4ac4759 100644 --- a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c +++ b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c @@ -740,7 +740,7 @@ static int mt8183_dai_memif_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; @@ -778,12 +778,12 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev) if (ret) return ret; - afe = devm_kzalloc(dev, sizeof(*afe), GFP_KERNEL); + afe = devm_kzalloc_obj(dev, *afe); if (!afe) return -ENOMEM; platform_set_drvdata(pdev, afe); - afe->platform_priv = devm_kzalloc(dev, sizeof(*afe_priv), GFP_KERNEL); + afe->platform_priv = devm_kzalloc_obj(dev, *afe_priv); if (!afe->platform_priv) return -ENOMEM; @@ -851,8 +851,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev) /* init memif */ afe->memif_size = MT8183_MEMIF_NUM; - afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), - GFP_KERNEL); + afe->memif = devm_kzalloc_objs(dev, *afe->memif, afe->memif_size); if (!afe->memif) { ret = -ENOMEM; goto err_pm_disable; @@ -871,8 +870,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev) /* init memif */ /* irq initialize */ afe->irqs_size = MT8183_IRQ_NUM; - afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), - GFP_KERNEL); + afe->irqs = devm_kzalloc_objs(dev, *afe->irqs, afe->irqs_size); if (!afe->irqs) { ret = -ENOMEM; goto err_pm_disable; diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c index aa3d1a588479..fdcfd7cf8759 100644 --- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -822,7 +822,7 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) goto put_hdmi_codec; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) { ret = -ENOMEM; goto put_hdmi_codec; diff --git a/sound/soc/mediatek/mt8183/mt8183-dai-adda.c b/sound/soc/mediatek/mt8183/mt8183-dai-adda.c index 1f55d9e342ba..f7ab18f80e18 100644 --- a/sound/soc/mediatek/mt8183/mt8183-dai-adda.c +++ b/sound/soc/mediatek/mt8183/mt8183-dai-adda.c @@ -407,7 +407,7 @@ int mt8183_dai_adda_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8183/mt8183-dai-hostless.c b/sound/soc/mediatek/mt8183/mt8183-dai-hostless.c index 1667ad352d34..4d72a43c4f76 100644 --- a/sound/soc/mediatek/mt8183/mt8183-dai-hostless.c +++ b/sound/soc/mediatek/mt8183/mt8183-dai-hostless.c @@ -102,7 +102,7 @@ int mt8183_dai_hostless_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c b/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c index 3709100a8865..2e60921d572b 100644 --- a/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c +++ b/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c @@ -1018,9 +1018,7 @@ static int mt8183_dai_i2s_set_priv(struct mtk_base_afe *afe) int i; for (i = 0; i < DAI_I2S_NUM; i++) { - i2s_priv = devm_kzalloc(afe->dev, - sizeof(struct mtk_afe_i2s_priv), - GFP_KERNEL); + i2s_priv = devm_kzalloc_obj(afe->dev, struct mtk_afe_i2s_priv); if (!i2s_priv) return -ENOMEM; @@ -1037,7 +1035,7 @@ int mt8183_dai_i2s_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8183/mt8183-dai-pcm.c b/sound/soc/mediatek/mt8183/mt8183-dai-pcm.c index 4e25287fc0e4..5049411e8f79 100644 --- a/sound/soc/mediatek/mt8183/mt8183-dai-pcm.c +++ b/sound/soc/mediatek/mt8183/mt8183-dai-pcm.c @@ -301,7 +301,7 @@ int mt8183_dai_pcm_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8183/mt8183-dai-tdm.c b/sound/soc/mediatek/mt8183/mt8183-dai-tdm.c index 0d69cf440407..594ca12c4f5a 100644 --- a/sound/soc/mediatek/mt8183/mt8183-dai-tdm.c +++ b/sound/soc/mediatek/mt8183/mt8183-dai-tdm.c @@ -720,7 +720,7 @@ int mt8183_dai_tdm_register(struct mtk_base_afe *afe) struct mtk_afe_tdm_priv *tdm_priv; struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; @@ -734,8 +734,7 @@ int mt8183_dai_tdm_register(struct mtk_base_afe *afe) dai->dapm_routes = mtk_dai_tdm_routes; dai->num_dapm_routes = ARRAY_SIZE(mtk_dai_tdm_routes); - tdm_priv = devm_kzalloc(afe->dev, sizeof(struct mtk_afe_tdm_priv), - GFP_KERNEL); + tdm_priv = devm_kzalloc_obj(afe->dev, struct mtk_afe_tdm_priv); if (!tdm_priv) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c index dea7ad167a49..e46f832cd60c 100644 --- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -803,7 +803,7 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) card->num_aux_devs = 1; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) { ret = -ENOMEM; goto out; diff --git a/sound/soc/mediatek/mt8186/mt8186-afe-clk.c b/sound/soc/mediatek/mt8186/mt8186-afe-clk.c index 62b008b7caca..c4c0b5543c8d 100644 --- a/sound/soc/mediatek/mt8186/mt8186-afe-clk.c +++ b/sound/soc/mediatek/mt8186/mt8186-afe-clk.c @@ -577,8 +577,7 @@ int mt8186_init_clock(struct mtk_base_afe *afe) mt8186_audsys_clk_register(afe); - afe_priv->clk = devm_kcalloc(afe->dev, CLK_NUM, sizeof(*afe_priv->clk), - GFP_KERNEL); + afe_priv->clk = devm_kzalloc_objs(afe->dev, *afe_priv->clk, CLK_NUM); if (!afe_priv->clk) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8186/mt8186-afe-pcm.c b/sound/soc/mediatek/mt8186/mt8186-afe-pcm.c index 2f50f78a6f8c..59e71d9d6f1e 100644 --- a/sound/soc/mediatek/mt8186/mt8186-afe-pcm.c +++ b/sound/soc/mediatek/mt8186/mt8186-afe-pcm.c @@ -2786,7 +2786,7 @@ static int mt8186_dai_memif_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; @@ -2828,12 +2828,12 @@ static int mt8186_afe_pcm_dev_probe(struct platform_device *pdev) if (ret) return ret; - afe = devm_kzalloc(dev, sizeof(*afe), GFP_KERNEL); + afe = devm_kzalloc_obj(dev, *afe); if (!afe) return -ENOMEM; platform_set_drvdata(pdev, afe); - afe->platform_priv = devm_kzalloc(dev, sizeof(*afe_priv), GFP_KERNEL); + afe->platform_priv = devm_kzalloc_obj(dev, *afe_priv); if (!afe->platform_priv) return -ENOMEM; @@ -2858,7 +2858,7 @@ static int mt8186_afe_pcm_dev_probe(struct platform_device *pdev) /* init memif */ afe->memif_32bit_supported = 0; afe->memif_size = MT8186_MEMIF_NUM; - afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), GFP_KERNEL); + afe->memif = devm_kzalloc_objs(dev, *afe->memif, afe->memif_size); if (!afe->memif) return -ENOMEM; @@ -2872,8 +2872,7 @@ static int mt8186_afe_pcm_dev_probe(struct platform_device *pdev) /* init irq */ afe->irqs_size = MT8186_IRQ_NUM; - afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), - GFP_KERNEL); + afe->irqs = devm_kzalloc_objs(dev, *afe->irqs, afe->irqs_size); if (!afe->irqs) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8186/mt8186-audsys-clk.c b/sound/soc/mediatek/mt8186/mt8186-audsys-clk.c index 642f4fb55ca6..8af815ac2fb8 100644 --- a/sound/soc/mediatek/mt8186/mt8186-audsys-clk.c +++ b/sound/soc/mediatek/mt8186/mt8186-audsys-clk.c @@ -114,9 +114,8 @@ int mt8186_audsys_clk_register(struct mtk_base_afe *afe) struct clk_lookup *cl; int i; - afe_priv->lookup = devm_kcalloc(afe->dev, CLK_AUD_NR_CLK, - sizeof(*afe_priv->lookup), - GFP_KERNEL); + afe_priv->lookup = devm_kzalloc_objs(afe->dev, *afe_priv->lookup, + CLK_AUD_NR_CLK); if (!afe_priv->lookup) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-adda.c b/sound/soc/mediatek/mt8186/mt8186-dai-adda.c index e74174ae8873..15bedc21c1fe 100644 --- a/sound/soc/mediatek/mt8186/mt8186-dai-adda.c +++ b/sound/soc/mediatek/mt8186/mt8186-dai-adda.c @@ -746,7 +746,7 @@ int mt8186_dai_adda_register(struct mtk_base_afe *afe) struct mt8186_afe_private *afe_priv = afe->platform_priv; int ret; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-hostless.c b/sound/soc/mediatek/mt8186/mt8186-dai-hostless.c index bf0d83840cf4..c7de6d1b3121 100644 --- a/sound/soc/mediatek/mt8186/mt8186-dai-hostless.c +++ b/sound/soc/mediatek/mt8186/mt8186-dai-hostless.c @@ -282,7 +282,7 @@ int mt8186_dai_hostless_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-hw-gain.c b/sound/soc/mediatek/mt8186/mt8186-dai-hw-gain.c index 75cb30790b1b..dd82591ac9ac 100644 --- a/sound/soc/mediatek/mt8186/mt8186-dai-hw-gain.c +++ b/sound/soc/mediatek/mt8186/mt8186-dai-hw-gain.c @@ -217,7 +217,7 @@ int mt8186_dai_hw_gain_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c b/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c index f890e9173a07..cf2b076e89d3 100644 --- a/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c +++ b/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c @@ -1206,7 +1206,7 @@ int mt8186_dai_i2s_register(struct mtk_base_afe *afe) struct mtk_base_afe_dai *dai; int ret; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-pcm.c b/sound/soc/mediatek/mt8186/mt8186-dai-pcm.c index a50aa294960b..7d1bf3c50f19 100644 --- a/sound/soc/mediatek/mt8186/mt8186-dai-pcm.c +++ b/sound/soc/mediatek/mt8186/mt8186-dai-pcm.c @@ -376,8 +376,7 @@ static struct mtk_afe_pcm_priv *init_pcm_priv_data(struct mtk_base_afe *afe) { struct mtk_afe_pcm_priv *pcm_priv; - pcm_priv = devm_kzalloc(afe->dev, sizeof(struct mtk_afe_pcm_priv), - GFP_KERNEL); + pcm_priv = devm_kzalloc_obj(afe->dev, struct mtk_afe_pcm_priv); if (!pcm_priv) return NULL; @@ -395,7 +394,7 @@ int mt8186_dai_pcm_register(struct mtk_base_afe *afe) struct mtk_afe_pcm_priv *pcm_priv; struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-src.c b/sound/soc/mediatek/mt8186/mt8186-dai-src.c index e475f4591aef..c60c7e6dbfab 100644 --- a/sound/soc/mediatek/mt8186/mt8186-dai-src.c +++ b/sound/soc/mediatek/mt8186/mt8186-dai-src.c @@ -666,7 +666,7 @@ int mt8186_dai_src_register(struct mtk_base_afe *afe) struct mtk_base_afe_dai *dai; int ret; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-tdm.c b/sound/soc/mediatek/mt8186/mt8186-dai-tdm.c index 7a8890d7122f..147a8b1a73bc 100644 --- a/sound/soc/mediatek/mt8186/mt8186-dai-tdm.c +++ b/sound/soc/mediatek/mt8186/mt8186-dai-tdm.c @@ -599,8 +599,7 @@ static struct mtk_afe_tdm_priv *init_tdm_priv_data(struct mtk_base_afe *afe) { struct mtk_afe_tdm_priv *tdm_priv; - tdm_priv = devm_kzalloc(afe->dev, sizeof(struct mtk_afe_tdm_priv), - GFP_KERNEL); + tdm_priv = devm_kzalloc_obj(afe->dev, struct mtk_afe_tdm_priv); if (!tdm_priv) return NULL; @@ -617,7 +616,7 @@ int mt8186_dai_tdm_register(struct mtk_base_afe *afe) struct mtk_afe_tdm_priv *tdm_priv; struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8186/mt8186-mt6366.c b/sound/soc/mediatek/mt8186/mt8186-mt6366.c index b68f474b63f4..540063bcada9 100644 --- a/sound/soc/mediatek/mt8186/mt8186-mt6366.c +++ b/sound/soc/mediatek/mt8186/mt8186-mt6366.c @@ -1214,7 +1214,7 @@ static int mt8186_mt6366_soc_card_probe(struct mtk_soc_card_data *soc_card_data, struct device *dev = card->dev; int i, ret; - mach_priv = devm_kzalloc(dev, sizeof(*mach_priv), GFP_KERNEL); + mach_priv = devm_kzalloc_obj(dev, *mach_priv); if (!mach_priv) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8188/mt8188-afe-clk.c b/sound/soc/mediatek/mt8188/mt8188-afe-clk.c index 8b6dca22c8ed..5b3022d7f253 100644 --- a/sound/soc/mediatek/mt8188/mt8188-afe-clk.c +++ b/sound/soc/mediatek/mt8188/mt8188-afe-clk.c @@ -422,8 +422,7 @@ int mt8188_afe_init_clock(struct mtk_base_afe *afe) } afe_priv->clk = - devm_kcalloc(afe->dev, MT8188_CLK_NUM, sizeof(*afe_priv->clk), - GFP_KERNEL); + devm_kzalloc_objs(afe->dev, *afe_priv->clk, MT8188_CLK_NUM); if (!afe_priv->clk) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c b/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c index 87d6098caf99..eab006db7675 100644 --- a/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c +++ b/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c @@ -3069,9 +3069,8 @@ static int init_memif_priv_data(struct mtk_base_afe *afe) int i; for (i = MT8188_AFE_MEMIF_START; i < MT8188_AFE_MEMIF_END; i++) { - memif_priv = devm_kzalloc(afe->dev, - sizeof(struct mtk_dai_memif_priv), - GFP_KERNEL); + memif_priv = devm_kzalloc_obj(afe->dev, + struct mtk_dai_memif_priv); if (!memif_priv) return -ENOMEM; @@ -3085,7 +3084,7 @@ static int mt8188_dai_memif_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; @@ -3221,12 +3220,11 @@ static int mt8188_afe_pcm_dev_probe(struct platform_device *pdev) if (ret) return ret; - afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL); + afe = devm_kzalloc_obj(&pdev->dev, *afe); if (!afe) return -ENOMEM; - afe->platform_priv = devm_kzalloc(&pdev->dev, sizeof(*afe_priv), - GFP_KERNEL); + afe->platform_priv = devm_kzalloc_obj(&pdev->dev, *afe_priv); if (!afe->platform_priv) return -ENOMEM; @@ -3279,8 +3277,7 @@ static int mt8188_afe_pcm_dev_probe(struct platform_device *pdev) /* irq initialize */ afe->irqs_size = MT8188_AFE_IRQ_NUM; - afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), - GFP_KERNEL); + afe->irqs = devm_kzalloc_objs(dev, *afe->irqs, afe->irqs_size); if (!afe->irqs) return -ENOMEM; @@ -3289,8 +3286,7 @@ static int mt8188_afe_pcm_dev_probe(struct platform_device *pdev) /* init memif */ afe->memif_size = MT8188_AFE_MEMIF_NUM; - afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), - GFP_KERNEL); + afe->memif = devm_kzalloc_objs(dev, *afe->memif, afe->memif_size); if (!afe->memif) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c b/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c index 9f3b3a777577..0f6296bfe79f 100644 --- a/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c +++ b/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c @@ -172,9 +172,8 @@ int mt8188_audsys_clk_register(struct mtk_base_afe *afe) struct clk_lookup *cl; int i, ret; - afe_priv->lookup = devm_kcalloc(afe->dev, CLK_AUD_NR_CLK, - sizeof(*afe_priv->lookup), - GFP_KERNEL); + afe_priv->lookup = devm_kzalloc_objs(afe->dev, *afe_priv->lookup, + CLK_AUD_NR_CLK); if (!afe_priv->lookup) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8188/mt8188-dai-adda.c b/sound/soc/mediatek/mt8188/mt8188-dai-adda.c index 395f4ab972f8..1ea05ce73999 100644 --- a/sound/soc/mediatek/mt8188/mt8188-dai-adda.c +++ b/sound/soc/mediatek/mt8188/mt8188-dai-adda.c @@ -473,9 +473,7 @@ static int init_adda_priv_data(struct mtk_base_afe *afe) int i; for (i = 0; i < ARRAY_SIZE(adda_dai_list); i++) { - adda_priv = devm_kzalloc(afe->dev, - sizeof(struct mtk_dai_adda_priv), - GFP_KERNEL); + adda_priv = devm_kzalloc_obj(afe->dev, struct mtk_dai_adda_priv); if (!adda_priv) return -ENOMEM; @@ -489,7 +487,7 @@ int mt8188_dai_adda_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8188/mt8188-dai-dmic.c b/sound/soc/mediatek/mt8188/mt8188-dai-dmic.c index 7ac847a5925c..6e2ce472aaa7 100644 --- a/sound/soc/mediatek/mt8188/mt8188-dai-dmic.c +++ b/sound/soc/mediatek/mt8188/mt8188-dai-dmic.c @@ -645,8 +645,7 @@ static int init_dmic_priv_data(struct mtk_base_afe *afe) struct mt8188_afe_private *afe_priv = afe->platform_priv; struct mtk_dai_dmic_priv *dmic_priv; - dmic_priv = devm_kzalloc(afe->dev, sizeof(struct mtk_dai_dmic_priv), - GFP_KERNEL); + dmic_priv = devm_kzalloc_obj(afe->dev, struct mtk_dai_dmic_priv); if (!dmic_priv) return -ENOMEM; @@ -658,7 +657,7 @@ int mt8188_dai_dmic_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c b/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c index 4dfaa761f9f7..7c9f8c6cc090 100644 --- a/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c +++ b/sound/soc/mediatek/mt8188/mt8188-dai-etdm.c @@ -2672,9 +2672,7 @@ static int init_etdm_priv_data(struct mtk_base_afe *afe) int i; for (i = MT8188_AFE_IO_ETDM_START; i < MT8188_AFE_IO_ETDM_END; i++) { - etdm_priv = devm_kzalloc(afe->dev, - sizeof(struct mtk_dai_etdm_priv), - GFP_KERNEL); + etdm_priv = devm_kzalloc_obj(afe->dev, struct mtk_dai_etdm_priv); if (!etdm_priv) return -ENOMEM; @@ -2692,7 +2690,7 @@ int mt8188_dai_etdm_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8188/mt8188-dai-pcm.c b/sound/soc/mediatek/mt8188/mt8188-dai-pcm.c index 8ca7cc75e21d..f7a1de4c541d 100644 --- a/sound/soc/mediatek/mt8188/mt8188-dai-pcm.c +++ b/sound/soc/mediatek/mt8188/mt8188-dai-pcm.c @@ -337,8 +337,7 @@ static int init_pcmif_priv_data(struct mtk_base_afe *afe) struct mt8188_afe_private *afe_priv = afe->platform_priv; struct mtk_dai_pcmif_priv *pcmif_priv; - pcmif_priv = devm_kzalloc(afe->dev, sizeof(struct mtk_dai_pcmif_priv), - GFP_KERNEL); + pcmif_priv = devm_kzalloc_obj(afe->dev, struct mtk_dai_pcmif_priv); if (!pcmif_priv) return -ENOMEM; @@ -350,7 +349,7 @@ int mt8188_dai_pcm_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8189/mt8189-afe-clk.c b/sound/soc/mediatek/mt8189/mt8189-afe-clk.c index 594c214fa697..6fb9f861385e 100644 --- a/sound/soc/mediatek/mt8189/mt8189-afe-clk.c +++ b/sound/soc/mediatek/mt8189/mt8189-afe-clk.c @@ -786,8 +786,8 @@ int mt8189_init_clock(struct mtk_base_afe *afe) int ret; int i; - afe_priv->clk = devm_kcalloc(afe->dev, MT8189_CLK_NUM, sizeof(*afe_priv->clk), - GFP_KERNEL); + afe_priv->clk = devm_kzalloc_objs(afe->dev, *afe_priv->clk, + MT8189_CLK_NUM); if (!afe_priv->clk) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c b/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c index eefa96b701a5..f39b01590f71 100644 --- a/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c +++ b/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c @@ -2414,7 +2414,7 @@ static int mt8189_dai_memif_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; @@ -2460,14 +2460,13 @@ static int mt8189_afe_pcm_dev_probe(struct platform_device *pdev) if (ret) dev_warn(dev, "failed to assign memory region: %d\n", ret); - afe = devm_kzalloc(dev, sizeof(*afe), GFP_KERNEL); + afe = devm_kzalloc_obj(dev, *afe); if (!afe) return -ENOMEM; platform_set_drvdata(pdev, afe); - afe->platform_priv = devm_kzalloc(dev, sizeof(*afe_priv), - GFP_KERNEL); + afe->platform_priv = devm_kzalloc_obj(dev, *afe_priv); if (!afe->platform_priv) return -ENOMEM; @@ -2487,8 +2486,7 @@ static int mt8189_afe_pcm_dev_probe(struct platform_device *pdev) /* IPM2.0 no need banding */ afe->memif_32bit_supported = 1; afe->memif_size = MT8189_MEMIF_NUM; - afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), - GFP_KERNEL); + afe->memif = devm_kzalloc_objs(dev, *afe->memif, afe->memif_size); if (!afe->memif) return -ENOMEM; @@ -2503,8 +2501,7 @@ static int mt8189_afe_pcm_dev_probe(struct platform_device *pdev) /* init irq */ afe->irqs_size = MT8189_IRQ_NUM; - afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), - GFP_KERNEL); + afe->irqs = devm_kzalloc_objs(dev, *afe->irqs, afe->irqs_size); if (!afe->irqs) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8189/mt8189-dai-adda.c b/sound/soc/mediatek/mt8189/mt8189-dai-adda.c index 5c41a6386204..70bedcdef179 100644 --- a/sound/soc/mediatek/mt8189/mt8189-dai-adda.c +++ b/sound/soc/mediatek/mt8189/mt8189-dai-adda.c @@ -1180,9 +1180,7 @@ static int init_adda_priv_data(struct mtk_base_afe *afe) }; for (int i = 0; i < ARRAY_SIZE(adda_dai_list); i++) { - adda_priv = devm_kzalloc(afe->dev, - sizeof(struct mtk_afe_adda_priv), - GFP_KERNEL); + adda_priv = devm_kzalloc_obj(afe->dev, struct mtk_afe_adda_priv); if (!adda_priv) return -ENOMEM; @@ -1203,7 +1201,7 @@ int mt8189_dai_adda_register(struct mtk_base_afe *afe) struct mtk_base_afe_dai *dai; int ret; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8189/mt8189-dai-i2s.c b/sound/soc/mediatek/mt8189/mt8189-dai-i2s.c index c9e80ef42f60..4744b76f3172 100644 --- a/sound/soc/mediatek/mt8189/mt8189-dai-i2s.c +++ b/sound/soc/mediatek/mt8189/mt8189-dai-i2s.c @@ -1441,7 +1441,7 @@ int mt8189_dai_i2s_register(struct mtk_base_afe *afe) struct mtk_base_afe_dai *dai; int ret; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8189/mt8189-dai-pcm.c b/sound/soc/mediatek/mt8189/mt8189-dai-pcm.c index 21317c0413e5..ee259ec773db 100644 --- a/sound/soc/mediatek/mt8189/mt8189-dai-pcm.c +++ b/sound/soc/mediatek/mt8189/mt8189-dai-pcm.c @@ -315,7 +315,7 @@ int mt8189_dai_pcm_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8189/mt8189-dai-tdm.c b/sound/soc/mediatek/mt8189/mt8189-dai-tdm.c index e113c52fe06a..dab930ab8646 100644 --- a/sound/soc/mediatek/mt8189/mt8189-dai-tdm.c +++ b/sound/soc/mediatek/mt8189/mt8189-dai-tdm.c @@ -627,8 +627,7 @@ static struct mtk_afe_tdm_priv *init_tdm_priv_data(struct mtk_base_afe *afe, { struct mtk_afe_tdm_priv *tdm_priv; - tdm_priv = devm_kzalloc(afe->dev, sizeof(struct mtk_afe_tdm_priv), - GFP_KERNEL); + tdm_priv = devm_kzalloc_obj(afe->dev, struct mtk_afe_tdm_priv); if (!tdm_priv) return NULL; @@ -649,7 +648,7 @@ int mt8189_dai_tdm_register(struct mtk_base_afe *afe) struct mtk_afe_tdm_priv *tdm_priv, *tdm_dptx_priv; struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8192/mt8192-afe-clk.c b/sound/soc/mediatek/mt8192/mt8192-afe-clk.c index c6ca4fe7fb19..583ea4c48332 100644 --- a/sound/soc/mediatek/mt8192/mt8192-afe-clk.c +++ b/sound/soc/mediatek/mt8192/mt8192-afe-clk.c @@ -666,8 +666,7 @@ int mt8192_init_clock(struct mtk_base_afe *afe) struct device_node *of_node = afe->dev->of_node; int i = 0; - afe_priv->clk = devm_kcalloc(afe->dev, CLK_NUM, sizeof(*afe_priv->clk), - GFP_KERNEL); + afe_priv->clk = devm_kzalloc_objs(afe->dev, *afe_priv->clk, CLK_NUM); if (!afe_priv->clk) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c b/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c index 45addf9f3790..d8d75b0b8bdc 100644 --- a/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c +++ b/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c @@ -2134,7 +2134,7 @@ static int mt8192_dai_memif_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; @@ -2171,13 +2171,12 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) if (ret) return ret; - afe = devm_kzalloc(dev, sizeof(*afe), GFP_KERNEL); + afe = devm_kzalloc_obj(dev, *afe); if (!afe) return -ENOMEM; platform_set_drvdata(pdev, afe); - afe->platform_priv = devm_kzalloc(dev, sizeof(*afe_priv), - GFP_KERNEL); + afe->platform_priv = devm_kzalloc_obj(dev, *afe_priv); if (!afe->platform_priv) return -ENOMEM; afe_priv = afe->platform_priv; @@ -2238,8 +2237,7 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) /* init memif */ afe->memif_size = MT8192_MEMIF_NUM; - afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), - GFP_KERNEL); + afe->memif = devm_kzalloc_objs(dev, *afe->memif, afe->memif_size); if (!afe->memif) return -ENOMEM; @@ -2253,8 +2251,7 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) /* init irq */ afe->irqs_size = MT8192_IRQ_NUM; - afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), - GFP_KERNEL); + afe->irqs = devm_kzalloc_objs(dev, *afe->irqs, afe->irqs_size); if (!afe->irqs) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8192/mt8192-dai-adda.c b/sound/soc/mediatek/mt8192/mt8192-dai-adda.c index c5c726a6e423..d4074e9142b5 100644 --- a/sound/soc/mediatek/mt8192/mt8192-dai-adda.c +++ b/sound/soc/mediatek/mt8192/mt8192-dai-adda.c @@ -1359,7 +1359,7 @@ int mt8192_dai_adda_register(struct mtk_base_afe *afe) struct mtk_base_afe_dai *dai; struct mt8192_afe_private *afe_priv = afe->platform_priv; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8192/mt8192-dai-i2s.c b/sound/soc/mediatek/mt8192/mt8192-dai-i2s.c index 5608b534af0d..179816830e1f 100644 --- a/sound/soc/mediatek/mt8192/mt8192-dai-i2s.c +++ b/sound/soc/mediatek/mt8192/mt8192-dai-i2s.c @@ -2084,7 +2084,7 @@ int mt8192_dai_i2s_register(struct mtk_base_afe *afe) dev_dbg(afe->dev, "%s()\n", __func__); - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8192/mt8192-dai-pcm.c b/sound/soc/mediatek/mt8192/mt8192-dai-pcm.c index 2847a2e747be..1084c16a88bc 100644 --- a/sound/soc/mediatek/mt8192/mt8192-dai-pcm.c +++ b/sound/soc/mediatek/mt8192/mt8192-dai-pcm.c @@ -394,7 +394,7 @@ int mt8192_dai_pcm_register(struct mtk_base_afe *afe) dev_info(afe->dev, "%s()\n", __func__); - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c b/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c index 36fa0f32ed1c..8867389b2f7f 100644 --- a/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c +++ b/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c @@ -743,8 +743,7 @@ static struct mtk_afe_tdm_priv *init_tdm_priv_data(struct mtk_base_afe *afe) { struct mtk_afe_tdm_priv *tdm_priv; - tdm_priv = devm_kzalloc(afe->dev, sizeof(struct mtk_afe_tdm_priv), - GFP_KERNEL); + tdm_priv = devm_kzalloc_obj(afe->dev, struct mtk_afe_tdm_priv); if (!tdm_priv) return NULL; @@ -762,7 +761,7 @@ int mt8192_dai_tdm_register(struct mtk_base_afe *afe) struct mtk_afe_tdm_priv *tdm_priv; struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8195/mt8195-afe-clk.c b/sound/soc/mediatek/mt8195/mt8195-afe-clk.c index 44cddc2b1564..54827ffe5c43 100644 --- a/sound/soc/mediatek/mt8195/mt8195-afe-clk.c +++ b/sound/soc/mediatek/mt8195/mt8195-afe-clk.c @@ -390,8 +390,7 @@ int mt8195_afe_init_clock(struct mtk_base_afe *afe) mt8195_audsys_clk_register(afe); afe_priv->clk = - devm_kcalloc(afe->dev, MT8195_CLK_NUM, sizeof(*afe_priv->clk), - GFP_KERNEL); + devm_kzalloc_objs(afe->dev, *afe_priv->clk, MT8195_CLK_NUM); if (!afe_priv->clk) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c index 13e5bc02fac5..110c54df7e7c 100644 --- a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c +++ b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c @@ -2999,9 +2999,8 @@ static int init_memif_priv_data(struct mtk_base_afe *afe) int i; for (i = MT8195_AFE_MEMIF_START; i < MT8195_AFE_MEMIF_END; i++) { - memif_priv = devm_kzalloc(afe->dev, - sizeof(struct mtk_dai_memif_priv), - GFP_KERNEL); + memif_priv = devm_kzalloc_obj(afe->dev, + struct mtk_dai_memif_priv); if (!memif_priv) return -ENOMEM; @@ -3015,7 +3014,7 @@ static int mt8195_dai_memif_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; @@ -3071,12 +3070,11 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev) if (ret) return ret; - afe = devm_kzalloc(dev, sizeof(*afe), GFP_KERNEL); + afe = devm_kzalloc_obj(dev, *afe); if (!afe) return -ENOMEM; - afe->platform_priv = devm_kzalloc(dev, sizeof(*afe_priv), - GFP_KERNEL); + afe->platform_priv = devm_kzalloc_obj(dev, *afe_priv); if (!afe->platform_priv) return -ENOMEM; @@ -3107,8 +3105,7 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev) /* irq initialize */ afe->irqs_size = MT8195_AFE_IRQ_NUM; - afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), - GFP_KERNEL); + afe->irqs = devm_kzalloc_objs(dev, *afe->irqs, afe->irqs_size); if (!afe->irqs) return -ENOMEM; @@ -3117,8 +3114,7 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev) /* init memif */ afe->memif_size = MT8195_AFE_MEMIF_NUM; - afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), - GFP_KERNEL); + afe->memif = devm_kzalloc_objs(dev, *afe->memif, afe->memif_size); if (!afe->memif) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8195/mt8195-audsys-clk.c b/sound/soc/mediatek/mt8195/mt8195-audsys-clk.c index e6fefc320443..5343ecc56853 100644 --- a/sound/soc/mediatek/mt8195/mt8195-audsys-clk.c +++ b/sound/soc/mediatek/mt8195/mt8195-audsys-clk.c @@ -178,9 +178,8 @@ int mt8195_audsys_clk_register(struct mtk_base_afe *afe) struct clk_lookup *cl; int i; - afe_priv->lookup = devm_kcalloc(afe->dev, CLK_AUD_NR_CLK, - sizeof(*afe_priv->lookup), - GFP_KERNEL); + afe_priv->lookup = devm_kzalloc_objs(afe->dev, *afe_priv->lookup, + CLK_AUD_NR_CLK); if (!afe_priv->lookup) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8195/mt8195-dai-adda.c b/sound/soc/mediatek/mt8195/mt8195-dai-adda.c index 8a58a142064d..ce12520850c7 100644 --- a/sound/soc/mediatek/mt8195/mt8195-dai-adda.c +++ b/sound/soc/mediatek/mt8195/mt8195-dai-adda.c @@ -716,9 +716,7 @@ static int init_adda_priv_data(struct mtk_base_afe *afe) int i; for (i = 0; i < ARRAY_SIZE(adda_dai_list); i++) { - adda_priv = devm_kzalloc(afe->dev, - sizeof(struct mtk_dai_adda_priv), - GFP_KERNEL); + adda_priv = devm_kzalloc_obj(afe->dev, struct mtk_dai_adda_priv); if (!adda_priv) return -ENOMEM; @@ -732,7 +730,7 @@ int mt8195_dai_adda_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8195/mt8195-dai-etdm.c b/sound/soc/mediatek/mt8195/mt8195-dai-etdm.c index 8fa830a57502..5fe40299ec80 100644 --- a/sound/soc/mediatek/mt8195/mt8195-dai-etdm.c +++ b/sound/soc/mediatek/mt8195/mt8195-dai-etdm.c @@ -2763,9 +2763,7 @@ static int init_etdm_priv_data(struct mtk_base_afe *afe) int i; for (i = MT8195_AFE_IO_ETDM_START; i < MT8195_AFE_IO_ETDM_END; i++) { - etdm_priv = devm_kzalloc(afe->dev, - sizeof(struct mtk_dai_etdm_priv), - GFP_KERNEL); + etdm_priv = devm_kzalloc_obj(afe->dev, struct mtk_dai_etdm_priv); if (!etdm_priv) return -ENOMEM; @@ -2783,7 +2781,7 @@ int mt8195_dai_etdm_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c b/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c index cdc16057d50e..113b7d073240 100644 --- a/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c +++ b/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c @@ -338,8 +338,7 @@ static int init_pcmif_priv_data(struct mtk_base_afe *afe) struct mt8195_afe_private *afe_priv = afe->platform_priv; struct mtk_dai_pcmif_priv *pcmif_priv; - pcmif_priv = devm_kzalloc(afe->dev, sizeof(struct mtk_dai_pcmif_priv), - GFP_KERNEL); + pcmif_priv = devm_kzalloc_obj(afe->dev, struct mtk_dai_pcmif_priv); if (!pcmif_priv) return -ENOMEM; @@ -351,7 +350,7 @@ int mt8195_dai_pcm_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359.c b/sound/soc/mediatek/mt8195/mt8195-mt6359.c index fc293ca71502..0040787df22f 100644 --- a/sound/soc/mediatek/mt8195/mt8195-mt6359.c +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359.c @@ -1381,7 +1381,7 @@ static int mt8195_mt6359_soc_card_probe(struct mtk_soc_card_data *soc_card_data, u8 codec_init = 0; int i; - mach_priv = devm_kzalloc(card->dev, sizeof(*mach_priv), GFP_KERNEL); + mach_priv = devm_kzalloc_obj(card->dev, *mach_priv); if (!mach_priv) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8196/mt8196-afe-clk.c b/sound/soc/mediatek/mt8196/mt8196-afe-clk.c index 91a05ea6b8b6..f7099880b3b3 100644 --- a/sound/soc/mediatek/mt8196/mt8196-afe-clk.c +++ b/sound/soc/mediatek/mt8196/mt8196-afe-clk.c @@ -611,8 +611,8 @@ int mt8196_init_clock(struct mtk_base_afe *afe) struct mt8196_afe_private *afe_priv = afe->platform_priv; int i; - afe_priv->clk = devm_kcalloc(afe->dev, MT8196_CLK_NUM, sizeof(*afe_priv->clk), - GFP_KERNEL); + afe_priv->clk = devm_kzalloc_objs(afe->dev, *afe_priv->clk, + MT8196_CLK_NUM); if (!afe_priv->clk) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8196/mt8196-afe-pcm.c b/sound/soc/mediatek/mt8196/mt8196-afe-pcm.c index fbeba01b086c..638b3672212b 100644 --- a/sound/soc/mediatek/mt8196/mt8196-afe-pcm.c +++ b/sound/soc/mediatek/mt8196/mt8196-afe-pcm.c @@ -2294,7 +2294,7 @@ static int mt8196_dai_memif_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; @@ -2338,14 +2338,13 @@ static int mt8196_afe_pcm_dev_probe(struct platform_device *pdev) if (ret) dev_err(dev, "failed to assign memory region: %d\n", ret); - afe = devm_kzalloc(dev, sizeof(*afe), GFP_KERNEL); + afe = devm_kzalloc_obj(dev, *afe); if (!afe) return -ENOMEM; platform_set_drvdata(pdev, afe); - afe->platform_priv = devm_kzalloc(dev, sizeof(*afe_priv), - GFP_KERNEL); + afe->platform_priv = devm_kzalloc_obj(dev, *afe_priv); if (!afe->platform_priv) return -ENOMEM; @@ -2366,8 +2365,7 @@ static int mt8196_afe_pcm_dev_probe(struct platform_device *pdev) /* IPM2.0 no need banding */ afe->memif_32bit_supported = 1; afe->memif_size = MT8196_MEMIF_NUM; - afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), - GFP_KERNEL); + afe->memif = devm_kzalloc_objs(dev, *afe->memif, afe->memif_size); if (!afe->memif) return -ENOMEM; @@ -2382,8 +2380,7 @@ static int mt8196_afe_pcm_dev_probe(struct platform_device *pdev) /* init irq */ afe->irqs_size = MT8196_IRQ_NUM; - afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), - GFP_KERNEL); + afe->irqs = devm_kzalloc_objs(dev, *afe->irqs, afe->irqs_size); if (!afe->irqs) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8196/mt8196-dai-adda.c b/sound/soc/mediatek/mt8196/mt8196-dai-adda.c index 9a91db4e79ae..4046202c1dee 100644 --- a/sound/soc/mediatek/mt8196/mt8196-dai-adda.c +++ b/sound/soc/mediatek/mt8196/mt8196-dai-adda.c @@ -800,9 +800,7 @@ static int init_adda_priv_data(struct mtk_base_afe *afe) int i; for (i = 0; i < ARRAY_SIZE(adda_dai_list); i++) { - adda_priv = devm_kzalloc(afe->dev, - sizeof(struct mtk_afe_adda_priv), - GFP_KERNEL); + adda_priv = devm_kzalloc_obj(afe->dev, struct mtk_afe_adda_priv); if (!adda_priv) return -ENOMEM; @@ -823,7 +821,7 @@ int mt8196_dai_adda_register(struct mtk_base_afe *afe) struct mtk_base_afe_dai *dai; int ret; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8196/mt8196-dai-i2s.c b/sound/soc/mediatek/mt8196/mt8196-dai-i2s.c index adebf75629be..74c244101dfb 100644 --- a/sound/soc/mediatek/mt8196/mt8196-dai-i2s.c +++ b/sound/soc/mediatek/mt8196/mt8196-dai-i2s.c @@ -2588,7 +2588,7 @@ int mt8196_dai_i2s_register(struct mtk_base_afe *afe) struct mtk_base_afe_dai *dai; int ret; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8196/mt8196-dai-tdm.c b/sound/soc/mediatek/mt8196/mt8196-dai-tdm.c index 44bd08f5c1fb..5cbb029c0707 100644 --- a/sound/soc/mediatek/mt8196/mt8196-dai-tdm.c +++ b/sound/soc/mediatek/mt8196/mt8196-dai-tdm.c @@ -626,8 +626,7 @@ static struct mtk_afe_tdm_priv *init_tdm_priv_data(struct mtk_base_afe *afe, { struct mtk_afe_tdm_priv *tdm_priv; - tdm_priv = devm_kzalloc(afe->dev, sizeof(struct mtk_afe_tdm_priv), - GFP_KERNEL); + tdm_priv = devm_kzalloc_obj(afe->dev, struct mtk_afe_tdm_priv); if (!tdm_priv) return NULL; @@ -648,7 +647,7 @@ int mt8196_dai_tdm_register(struct mtk_base_afe *afe) struct mtk_afe_tdm_priv *tdm_priv, *tdm_dptx_priv; struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8365/mt8365-afe-pcm.c b/sound/soc/mediatek/mt8365/mt8365-afe-pcm.c index 314235557fdf..7e5c9ffb8314 100644 --- a/sound/soc/mediatek/mt8365/mt8365-afe-pcm.c +++ b/sound/soc/mediatek/mt8365/mt8365-afe-pcm.c @@ -1979,8 +1979,8 @@ static int mt8365_afe_suspend(struct device *dev) if (!afe->reg_back_up) { afe->reg_back_up = - devm_kcalloc(dev, afe->reg_back_up_list_num, - sizeof(unsigned int), GFP_KERNEL); + devm_kzalloc_objs(dev, unsigned int, + afe->reg_back_up_list_num); if (!afe->reg_back_up) { mt8365_afe_disable_main_clk(afe); return -ENOMEM; @@ -2072,7 +2072,7 @@ static int mt8365_dai_memif_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; @@ -2106,13 +2106,12 @@ static int mt8365_afe_pcm_dev_probe(struct platform_device *pdev) unsigned int irq_id; struct resource *res; - afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL); + afe = devm_kzalloc_obj(&pdev->dev, *afe); if (!afe) return -ENOMEM; platform_set_drvdata(pdev, afe); - afe->platform_priv = devm_kzalloc(&pdev->dev, sizeof(*afe_priv), - GFP_KERNEL); + afe->platform_priv = devm_kzalloc_obj(&pdev->dev, *afe_priv); if (!afe->platform_priv) return -ENOMEM; @@ -2147,14 +2146,12 @@ static int mt8365_afe_pcm_dev_probe(struct platform_device *pdev) /* memif % irq initialize*/ afe->memif_size = MT8365_AFE_MEMIF_NUM; - afe->memif = devm_kcalloc(afe->dev, afe->memif_size, - sizeof(*afe->memif), GFP_KERNEL); + afe->memif = devm_kzalloc_objs(afe->dev, *afe->memif, afe->memif_size); if (!afe->memif) return -ENOMEM; afe->irqs_size = MT8365_AFE_IRQ_NUM; - afe->irqs = devm_kcalloc(afe->dev, afe->irqs_size, - sizeof(*afe->irqs), GFP_KERNEL); + afe->irqs = devm_kzalloc_objs(afe->dev, *afe->irqs, afe->irqs_size); if (!afe->irqs) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8365/mt8365-dai-adda.c b/sound/soc/mediatek/mt8365/mt8365-dai-adda.c index d8eda9e17eb8..a0dbd1d7bd8d 100644 --- a/sound/soc/mediatek/mt8365/mt8365-dai-adda.c +++ b/sound/soc/mediatek/mt8365/mt8365-dai-adda.c @@ -291,7 +291,7 @@ int mt8365_dai_adda_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; list_add(&dai->list, &afe->sub_dais); diff --git a/sound/soc/mediatek/mt8365/mt8365-dai-dmic.c b/sound/soc/mediatek/mt8365/mt8365-dai-dmic.c index 0bac143b48bf..7f247cbfc64c 100644 --- a/sound/soc/mediatek/mt8365/mt8365-dai-dmic.c +++ b/sound/soc/mediatek/mt8365/mt8365-dai-dmic.c @@ -270,7 +270,7 @@ static int init_dmic_priv_data(struct mtk_base_afe *afe) unsigned int temps[4]; int ret; - dmic_priv = devm_kzalloc(afe->dev, sizeof(*dmic_priv), GFP_KERNEL); + dmic_priv = devm_kzalloc_obj(afe->dev, *dmic_priv); if (!dmic_priv) return -ENOMEM; @@ -293,7 +293,7 @@ int mt8365_dai_dmic_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8365/mt8365-dai-i2s.c b/sound/soc/mediatek/mt8365/mt8365-dai-i2s.c index 2e678f4aa4b1..0ca90a3a5941 100644 --- a/sound/soc/mediatek/mt8365/mt8365-dai-i2s.c +++ b/sound/soc/mediatek/mt8365/mt8365-dai-i2s.c @@ -824,7 +824,7 @@ int mt8365_dai_i2s_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8365/mt8365-dai-pcm.c b/sound/soc/mediatek/mt8365/mt8365-dai-pcm.c index 0ec114a566ad..65ecf678c530 100644 --- a/sound/soc/mediatek/mt8365/mt8365-dai-pcm.c +++ b/sound/soc/mediatek/mt8365/mt8365-dai-pcm.c @@ -265,8 +265,7 @@ static int init_pcmif_priv_data(struct mtk_base_afe *afe) struct mt8365_afe_private *afe_priv = afe->platform_priv; struct mt8365_pcm_intf_data *pcmif_priv; - pcmif_priv = devm_kzalloc(afe->dev, sizeof(struct mt8365_pcm_intf_data), - GFP_KERNEL); + pcmif_priv = devm_kzalloc_obj(afe->dev, struct mt8365_pcm_intf_data); if (!pcmif_priv) return -ENOMEM; @@ -278,7 +277,7 @@ int mt8365_dai_pcm_register(struct mtk_base_afe *afe) { struct mtk_base_afe_dai *dai; - dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(afe->dev, *dai); if (!dai) return -ENOMEM; diff --git a/sound/soc/mediatek/mt8365/mt8365-mt6357.c b/sound/soc/mediatek/mt8365/mt8365-mt6357.c index dceee837c67d..d8efbfd229e0 100644 --- a/sound/soc/mediatek/mt8365/mt8365-mt6357.c +++ b/sound/soc/mediatek/mt8365/mt8365-mt6357.c @@ -301,8 +301,7 @@ static int mt8365_mt6357_dev_probe(struct mtk_soc_card_data *soc_card_data, bool if (ret) goto err; - mach_priv = devm_kzalloc(dev, sizeof(*mach_priv), - GFP_KERNEL); + mach_priv = devm_kzalloc_obj(dev, *mach_priv); if (!mach_priv) return -ENOMEM; soc_card_data->mach_priv = mach_priv; diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c index 535fbf7c1639..cc890579487a 100644 --- a/sound/soc/meson/aiu.c +++ b/sound/soc/meson/aiu.c @@ -195,7 +195,7 @@ static int aiu_clk_bulk_get(struct device *dev, struct clk_bulk_data *clks; int i, ret; - clks = devm_kcalloc(dev, num, sizeof(*clks), GFP_KERNEL); + clks = devm_kzalloc_objs(dev, *clks, num); if (!clks) return -ENOMEM; @@ -260,7 +260,7 @@ static int aiu_probe(struct platform_device *pdev) struct aiu *aiu; int ret; - aiu = devm_kzalloc(dev, sizeof(*aiu), GFP_KERNEL); + aiu = devm_kzalloc_obj(dev, *aiu); if (!aiu) return -ENOMEM; diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c index c36f727af4ba..540dd51fd898 100644 --- a/sound/soc/meson/axg-card.c +++ b/sound/soc/meson/axg-card.c @@ -122,7 +122,7 @@ static int axg_card_add_tdm_loopback(struct snd_soc_card *card, if (!lb->name) return -ENOMEM; - dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL); + dlc = devm_kzalloc_obj(dev, *dlc); if (!dlc) return -ENOMEM; @@ -164,10 +164,8 @@ static int axg_card_parse_cpu_tdm_slots(struct snd_soc_card *card, u32 tx, rx; int i; - be->tx_mask = devm_kcalloc(dev, AXG_TDM_NUM_LANES, - sizeof(*be->tx_mask), GFP_KERNEL); - be->rx_mask = devm_kcalloc(dev, AXG_TDM_NUM_LANES, - sizeof(*be->rx_mask), GFP_KERNEL); + be->tx_mask = devm_kzalloc_objs(dev, *be->tx_mask, AXG_TDM_NUM_LANES); + be->rx_mask = devm_kzalloc_objs(dev, *be->rx_mask, AXG_TDM_NUM_LANES); if (!be->tx_mask || !be->rx_mask) return -ENOMEM; @@ -226,8 +224,7 @@ static int axg_card_parse_codecs_masks(struct snd_soc_card *card, struct axg_dai_link_tdm_mask *codec_mask; struct device *dev = card->dev; - codec_mask = devm_kcalloc(dev, link->num_codecs, - sizeof(*codec_mask), GFP_KERNEL); + codec_mask = devm_kzalloc_objs(dev, *codec_mask, link->num_codecs); if (!codec_mask) return -ENOMEM; @@ -256,7 +253,7 @@ static int axg_card_parse_tdm(struct snd_soc_card *card, int ret; /* Allocate tdm link parameters */ - be = devm_kzalloc(dev, sizeof(*be), GFP_KERNEL); + be = devm_kzalloc_obj(dev, *be); if (!be) return -ENOMEM; priv->link_data[*index] = be; @@ -317,7 +314,7 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np, struct device *dev = card->dev; int ret; - cpu = devm_kzalloc(dev, sizeof(*cpu), GFP_KERNEL); + cpu = devm_kzalloc_obj(dev, *cpu); if (!cpu) return -ENOMEM; diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c index 75909196b769..4eb5f6a28d36 100644 --- a/sound/soc/meson/axg-fifo.c +++ b/sound/soc/meson/axg-fifo.c @@ -338,7 +338,7 @@ int axg_fifo_probe(struct platform_device *pdev) return -ENODEV; } - fifo = devm_kzalloc(dev, sizeof(*fifo), GFP_KERNEL); + fifo = devm_kzalloc_obj(dev, *fifo); if (!fifo) return -ENOMEM; platform_set_drvdata(pdev, fifo); diff --git a/sound/soc/meson/axg-pdm.c b/sound/soc/meson/axg-pdm.c index d59050914d3c..7e54bbb05b3a 100644 --- a/sound/soc/meson/axg-pdm.c +++ b/sound/soc/meson/axg-pdm.c @@ -589,7 +589,7 @@ static int axg_pdm_probe(struct platform_device *pdev) struct axg_pdm *priv; void __iomem *regs; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; platform_set_drvdata(pdev, priv); diff --git a/sound/soc/meson/axg-spdifin.c b/sound/soc/meson/axg-spdifin.c index e721f579321e..b9c3c6ff59ab 100644 --- a/sound/soc/meson/axg-spdifin.c +++ b/sound/soc/meson/axg-spdifin.c @@ -410,7 +410,7 @@ axg_spdifin_get_dai_drv(struct device *dev, struct axg_spdifin *priv) struct snd_soc_dai_driver *drv; int i; - drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(dev, *drv); if (!drv) return ERR_PTR(-ENOMEM); @@ -441,7 +441,7 @@ static int axg_spdifin_probe(struct platform_device *pdev) struct snd_soc_dai_driver *dai_drv; void __iomem *regs; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; platform_set_drvdata(pdev, priv); diff --git a/sound/soc/meson/axg-spdifout.c b/sound/soc/meson/axg-spdifout.c index 84868fe574e0..e2374ea16ffc 100644 --- a/sound/soc/meson/axg-spdifout.c +++ b/sound/soc/meson/axg-spdifout.c @@ -405,7 +405,7 @@ static int axg_spdifout_probe(struct platform_device *pdev) struct axg_spdifout *priv; void __iomem *regs; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; platform_set_drvdata(pdev, priv); diff --git a/sound/soc/meson/axg-tdm-formatter.c b/sound/soc/meson/axg-tdm-formatter.c index a6ba401104d5..744c08f41952 100644 --- a/sound/soc/meson/axg-tdm-formatter.c +++ b/sound/soc/meson/axg-tdm-formatter.c @@ -270,7 +270,7 @@ int axg_tdm_formatter_probe(struct platform_device *pdev) return -ENODEV; } - formatter = devm_kzalloc(dev, sizeof(*formatter), GFP_KERNEL); + formatter = devm_kzalloc_obj(dev, *formatter); if (!formatter) return -ENOMEM; platform_set_drvdata(pdev, formatter); diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-interface.c index d5287d78f53b..9617bad0b572 100644 --- a/sound/soc/meson/axg-tdm-interface.c +++ b/sound/soc/meson/axg-tdm-interface.c @@ -530,7 +530,7 @@ static int axg_tdm_iface_probe(struct platform_device *pdev) struct snd_soc_dai_driver *dai_drv; struct axg_tdm_iface *iface; - iface = devm_kzalloc(dev, sizeof(*iface), GFP_KERNEL); + iface = devm_kzalloc_obj(dev, *iface); if (!iface) return -ENOMEM; platform_set_drvdata(pdev, iface); diff --git a/sound/soc/meson/g12a-toacodec.c b/sound/soc/meson/g12a-toacodec.c index 21941ee552c5..b3d74419e56e 100644 --- a/sound/soc/meson/g12a-toacodec.c +++ b/sound/soc/meson/g12a-toacodec.c @@ -304,7 +304,7 @@ static int g12a_toacodec_probe(struct platform_device *pdev) return -ENODEV; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/meson/gx-card.c b/sound/soc/meson/gx-card.c index 932be0a09306..026f8e9fb680 100644 --- a/sound/soc/meson/gx-card.c +++ b/sound/soc/meson/gx-card.c @@ -51,7 +51,7 @@ static int gx_card_parse_i2s(struct snd_soc_card *card, struct device *dev = card->dev; /* Allocate i2s link parameters */ - be = devm_kzalloc(dev, sizeof(*be), GFP_KERNEL); + be = devm_kzalloc_obj(dev, *be); if (!be) return -ENOMEM; priv->link_data[*index] = be; @@ -85,7 +85,7 @@ static int gx_card_add_link(struct snd_soc_card *card, struct device_node *np, struct device *dev = card->dev; int ret; - cpu = devm_kzalloc(dev, sizeof(*cpu), GFP_KERNEL); + cpu = devm_kzalloc_obj(dev, *cpu); if (!cpu) return -ENOMEM; diff --git a/sound/soc/meson/gx-formatter.c b/sound/soc/meson/gx-formatter.c index 2d3218cce426..12690fc12893 100644 --- a/sound/soc/meson/gx-formatter.c +++ b/sound/soc/meson/gx-formatter.c @@ -167,7 +167,7 @@ int gx_formatter_probe(struct platform_device *pdev) return -ENODEV; } - formatter = devm_kzalloc(dev, sizeof(*formatter), GFP_KERNEL); + formatter = devm_kzalloc_obj(dev, *formatter); if (!formatter) return -ENOMEM; platform_set_drvdata(pdev, formatter); @@ -196,7 +196,7 @@ int gx_formatter_create(struct device *dev, { struct gx_formatter *formatter; - formatter = devm_kzalloc(dev, sizeof(*formatter), GFP_KERNEL); + formatter = devm_kzalloc_obj(dev, *formatter); if (!formatter) return -ENOMEM; diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c index f2796dc84fa5..6ca77a8d05b2 100644 --- a/sound/soc/meson/meson-card-utils.c +++ b/sound/soc/meson/meson-card-utils.c @@ -144,7 +144,7 @@ int meson_card_set_be_link(struct snd_soc_card *card, return -EINVAL; } - codec = devm_kcalloc(dev, num_codecs, sizeof(*codec), GFP_KERNEL); + codec = devm_kzalloc_objs(dev, *codec, num_codecs); if (!codec) return -ENOMEM; @@ -272,7 +272,7 @@ int meson_card_probe(struct platform_device *pdev) return -ENODEV; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/meson/t9015.c b/sound/soc/meson/t9015.c index 68b5323ca9c8..8665dc82a113 100644 --- a/sound/soc/meson/t9015.c +++ b/sound/soc/meson/t9015.c @@ -257,7 +257,7 @@ static int t9015_probe(struct platform_device *pdev) struct clk *pclk; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; platform_set_drvdata(pdev, priv); diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index e46896ac9669..abdead349a4d 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c @@ -796,7 +796,7 @@ static int mxs_saif_probe(struct platform_device *pdev) int irq, ret; struct device_node *master; - saif = devm_kzalloc(&pdev->dev, sizeof(*saif), GFP_KERNEL); + saif = devm_kzalloc_obj(&pdev->dev, *saif); if (!saif) return -ENOMEM; diff --git a/sound/soc/pxa/mmp-sspa.c b/sound/soc/pxa/mmp-sspa.c index f9066fbdd571..8219464e4384 100644 --- a/sound/soc/pxa/mmp-sspa.c +++ b/sound/soc/pxa/mmp-sspa.c @@ -474,8 +474,7 @@ static int asoc_mmp_sspa_probe(struct platform_device *pdev) struct sspa_priv *sspa; int ret; - sspa = devm_kzalloc(&pdev->dev, - sizeof(struct sspa_priv), GFP_KERNEL); + sspa = devm_kzalloc_obj(&pdev->dev, struct sspa_priv); if (!sspa) return -ENOMEM; diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c index 3023cf180a75..c12b699f9752 100644 --- a/sound/soc/qcom/apq8016_sbc.c +++ b/sound/soc/qcom/apq8016_sbc.c @@ -296,7 +296,7 @@ static int apq8016_sbc_platform_probe(struct platform_device *pdev) if (!add_ops) return -EINVAL; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/qcom/apq8096.c b/sound/soc/qcom/apq8096.c index cfd6438dbcb3..9a7cdf02f883 100644 --- a/sound/soc/qcom/apq8096.c +++ b/sound/soc/qcom/apq8096.c @@ -108,7 +108,7 @@ static int apq8096_platform_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c index 83b745f617a8..5dc954dc1cb2 100644 --- a/sound/soc/qcom/common.c +++ b/sound/soc/qcom/common.c @@ -226,7 +226,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card) num_links = of_get_available_child_count(dev->of_node); /* Allocate the DAI link array */ - card->dai_link = devm_kcalloc(dev, num_links, sizeof(*link), GFP_KERNEL); + card->dai_link = devm_kzalloc_objs(dev, *link, num_links); if (!card->dai_link) return -ENOMEM; @@ -234,7 +234,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card) link = card->dai_link; for_each_available_child_of_node_scoped(dev->of_node, np) { - dlc = devm_kcalloc(dev, 2, sizeof(*dlc), GFP_KERNEL); + dlc = devm_kzalloc_objs(dev, *dlc, 2); if (!dlc) return -ENOMEM; diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c index b8f23414eb77..d07ef2bb382a 100644 --- a/sound/soc/qcom/lpass-apq8016.c +++ b/sound/soc/qcom/lpass-apq8016.c @@ -162,8 +162,8 @@ static int apq8016_lpass_init(struct platform_device *pdev) int ret, i; - drvdata->clks = devm_kcalloc(dev, variant->num_clks, - sizeof(*drvdata->clks), GFP_KERNEL); + drvdata->clks = devm_kzalloc_objs(dev, *drvdata->clks, + variant->num_clks); if (!drvdata->clks) return -ENOMEM; drvdata->num_clks = variant->num_clks; diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index ee187eeb7392..81eebfabcc9f 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -605,7 +605,7 @@ static int lpass_hdmi_init_bitfields(struct device *dev, struct regmap *map) struct lpass_hdmitx_dmactl *tx_dmactl; int rval; - tx_ctl = devm_kzalloc(dev, sizeof(*tx_ctl), GFP_KERNEL); + tx_ctl = devm_kzalloc_obj(dev, *tx_ctl); if (!tx_ctl) return -ENOMEM; @@ -616,7 +616,7 @@ static int lpass_hdmi_init_bitfields(struct device *dev, struct regmap *map) QCOM_REGMAP_FIELD_ALLOC(dev, map, v->legacy_en, legacy_en); drvdata->hdmitx_legacy_en = legacy_en; - vbit_ctl = devm_kzalloc(dev, sizeof(*vbit_ctl), GFP_KERNEL); + vbit_ctl = devm_kzalloc_obj(dev, *vbit_ctl); if (!vbit_ctl) return -ENOMEM; @@ -628,7 +628,7 @@ static int lpass_hdmi_init_bitfields(struct device *dev, struct regmap *map) QCOM_REGMAP_FIELD_ALLOC(dev, map, v->calc_en, tx_parity); drvdata->hdmitx_parity_calc_en = tx_parity; - meta_ctl = devm_kzalloc(dev, sizeof(*meta_ctl), GFP_KERNEL); + meta_ctl = devm_kzalloc_obj(dev, *meta_ctl); if (!meta_ctl) return -ENOMEM; @@ -637,7 +637,7 @@ static int lpass_hdmi_init_bitfields(struct device *dev, struct regmap *map) return rval; drvdata->meta_ctl = meta_ctl; - sstream_ctl = devm_kzalloc(dev, sizeof(*sstream_ctl), GFP_KERNEL); + sstream_ctl = devm_kzalloc_obj(dev, *sstream_ctl); if (!sstream_ctl) return -ENOMEM; @@ -654,7 +654,7 @@ static int lpass_hdmi_init_bitfields(struct device *dev, struct regmap *map) QCOM_REGMAP_FIELD_ALLOC(dev, map, v->lsb_bits, ch_lsb); drvdata->hdmitx_ch_lsb[i] = ch_lsb; - tx_dmactl = devm_kzalloc(dev, sizeof(*tx_dmactl), GFP_KERNEL); + tx_dmactl = devm_kzalloc_obj(dev, *tx_dmactl); if (!tx_dmactl) return -ENOMEM; @@ -1094,7 +1094,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) return -EBUSY; } - drvdata = devm_kzalloc(dev, sizeof(struct lpass_data), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, struct lpass_data); if (!drvdata) return -ENOMEM; platform_set_drvdata(pdev, drvdata); @@ -1219,8 +1219,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) } /* Allocation for i2sctl regmap fields */ - drvdata->i2sctl = devm_kzalloc(&pdev->dev, sizeof(struct lpaif_i2sctl), - GFP_KERNEL); + drvdata->i2sctl = devm_kzalloc_obj(&pdev->dev, struct lpaif_i2sctl); if (!drvdata->i2sctl) return -ENOMEM; diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c index e162627d6f86..dad4becf7579 100644 --- a/sound/soc/qcom/lpass-platform.c +++ b/sound/soc/qcom/lpass-platform.c @@ -105,11 +105,11 @@ static int lpass_platform_alloc_rxtx_dmactl_fields(struct device *dev, struct lpaif_dmactl *rd_dmactl, *wr_dmactl; int rval; - rd_dmactl = devm_kzalloc(dev, sizeof(*rd_dmactl), GFP_KERNEL); + rd_dmactl = devm_kzalloc_obj(dev, *rd_dmactl); if (!rd_dmactl) return -ENOMEM; - wr_dmactl = devm_kzalloc(dev, sizeof(*wr_dmactl), GFP_KERNEL); + wr_dmactl = devm_kzalloc_obj(dev, *wr_dmactl); if (!wr_dmactl) return -ENOMEM; @@ -132,7 +132,7 @@ static int lpass_platform_alloc_va_dmactl_fields(struct device *dev, const struct lpass_variant *v = drvdata->variant; struct lpaif_dmactl *wr_dmactl; - wr_dmactl = devm_kzalloc(dev, sizeof(*wr_dmactl), GFP_KERNEL); + wr_dmactl = devm_kzalloc_obj(dev, *wr_dmactl); if (!wr_dmactl) return -ENOMEM; @@ -150,13 +150,11 @@ static int lpass_platform_alloc_dmactl_fields(struct device *dev, struct lpaif_dmactl *rd_dmactl, *wr_dmactl; int rval; - drvdata->rd_dmactl = devm_kzalloc(dev, sizeof(struct lpaif_dmactl), - GFP_KERNEL); + drvdata->rd_dmactl = devm_kzalloc_obj(dev, struct lpaif_dmactl); if (drvdata->rd_dmactl == NULL) return -ENOMEM; - drvdata->wr_dmactl = devm_kzalloc(dev, sizeof(struct lpaif_dmactl), - GFP_KERNEL); + drvdata->wr_dmactl = devm_kzalloc_obj(dev, struct lpaif_dmactl); if (drvdata->wr_dmactl == NULL) return -ENOMEM; @@ -179,7 +177,7 @@ static int lpass_platform_alloc_hdmidmactl_fields(struct device *dev, const struct lpass_variant *v = drvdata->variant; struct lpaif_dmactl *rd_dmactl; - rd_dmactl = devm_kzalloc(dev, sizeof(struct lpaif_dmactl), GFP_KERNEL); + rd_dmactl = devm_kzalloc_obj(dev, struct lpaif_dmactl); if (rd_dmactl == NULL) return -ENOMEM; diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c index 7c6a9b0fda89..e623aee74499 100644 --- a/sound/soc/qcom/lpass-sc7180.c +++ b/sound/soc/qcom/lpass-sc7180.c @@ -127,8 +127,8 @@ static int sc7180_lpass_init(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret, i; - drvdata->clks = devm_kcalloc(dev, variant->num_clks, - sizeof(*drvdata->clks), GFP_KERNEL); + drvdata->clks = devm_kzalloc_objs(dev, *drvdata->clks, + variant->num_clks); if (!drvdata->clks) return -ENOMEM; diff --git a/sound/soc/qcom/lpass-sc7280.c b/sound/soc/qcom/lpass-sc7280.c index 817c824f9179..ffcfc0e2a515 100644 --- a/sound/soc/qcom/lpass-sc7280.c +++ b/sound/soc/qcom/lpass-sc7280.c @@ -200,8 +200,8 @@ static int sc7280_lpass_init(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret, i; - drvdata->clks = devm_kcalloc(dev, variant->num_clks, - sizeof(*drvdata->clks), GFP_KERNEL); + drvdata->clks = devm_kzalloc_objs(dev, *drvdata->clks, + variant->num_clks); if (!drvdata->clks) return -ENOMEM; diff --git a/sound/soc/qcom/qaif-cpu.c b/sound/soc/qcom/qaif-cpu.c index d34b8df83f94..c1909e7da628 100644 --- a/sound/soc/qcom/qaif-cpu.c +++ b/sound/soc/qcom/qaif-cpu.c @@ -771,7 +771,7 @@ int asoc_qcom_qaif_cpu_platform_probe(struct platform_device *pdev) const struct of_device_id *match; int ret, i, dai_id, idx; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(dev, *drvdata); if (!drvdata) return dev_err_probe(dev, -ENOMEM, "Failed to allocate driver data\n"); platform_set_drvdata(pdev, drvdata); @@ -836,8 +836,8 @@ int asoc_qcom_qaif_cpu_platform_probe(struct platform_device *pdev) } drvdata->num_clks = variant->num_clks; - drvdata->clks = devm_kcalloc(dev, drvdata->num_clks, - sizeof(*drvdata->clks), GFP_KERNEL); + drvdata->clks = devm_kzalloc_objs(dev, *drvdata->clks, + drvdata->num_clks); if (!drvdata->clks) return dev_err_probe(dev, -ENOMEM, "Failed to allocate clocks\n"); diff --git a/sound/soc/qcom/qdsp6/q6adm.c b/sound/soc/qcom/qdsp6/q6adm.c index db0ae71f2983..235bcbcb1af5 100644 --- a/sound/soc/qcom/qdsp6/q6adm.c +++ b/sound/soc/qcom/qdsp6/q6adm.c @@ -570,7 +570,7 @@ static int q6adm_probe(struct apr_device *adev) struct device *dev = &adev->dev; struct q6adm *adm; - adm = devm_kzalloc(dev, sizeof(*adm), GFP_KERNEL); + adm = devm_kzalloc_obj(dev, *adm); if (!adm) return -ENOMEM; diff --git a/sound/soc/qcom/qdsp6/q6afe-dai.c b/sound/soc/qcom/qdsp6/q6afe-dai.c index 920345609d2c..ddcae0c382fe 100644 --- a/sound/soc/qcom/qdsp6/q6afe-dai.c +++ b/sound/soc/qcom/qdsp6/q6afe-dai.c @@ -1162,7 +1162,7 @@ static int q6afe_dai_dev_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int num_dais; - dai_data = devm_kzalloc(dev, sizeof(*dai_data), GFP_KERNEL); + dai_data = devm_kzalloc_obj(dev, *dai_data); if (!dai_data) return -ENOMEM; diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c index 80c2cca89f23..4f7b706c77b5 100644 --- a/sound/soc/qcom/qdsp6/q6afe.c +++ b/sound/soc/qcom/qdsp6/q6afe.c @@ -1971,7 +1971,7 @@ static int q6afe_probe(struct apr_device *adev) struct q6afe *afe; struct device *dev = &adev->dev; - afe = devm_kzalloc(dev, sizeof(*afe), GFP_KERNEL); + afe = devm_kzalloc_obj(dev, *afe); if (!afe) return -ENOMEM; diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c index 58beaf906b9f..dc092ec8a274 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -1193,7 +1193,7 @@ static int q6apm_dai_probe(struct platform_device *pdev) struct of_phandle_args args; int rc; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c index 83f2711bceea..fb9a0d7c5c1c 100644 --- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c +++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c @@ -523,7 +523,7 @@ static int q6apm_lpass_dai_dev_probe(struct platform_device *pdev) int num_dais; int ret; - dai_data = devm_kzalloc(dev, sizeof(*dai_data), GFP_KERNEL); + dai_data = devm_kzalloc_obj(dev, *dai_data); if (!dai_data) return -ENOMEM; diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c index bed3b64e8310..cd14133f6817 100644 --- a/sound/soc/qcom/qdsp6/q6apm.c +++ b/sound/soc/qcom/qdsp6/q6apm.c @@ -886,7 +886,7 @@ static int apm_probe(gpr_device_t *gdev) struct q6apm *apm; int ret; - apm = devm_kzalloc(dev, sizeof(*apm), GFP_KERNEL); + apm = devm_kzalloc_obj(dev, *apm); if (!apm) return -ENOMEM; diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c index 4261c3048c36..dc5230f13a97 100644 --- a/sound/soc/qcom/qdsp6/q6asm-dai.c +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c @@ -1262,8 +1262,7 @@ static int of_q6asm_parse_dai_data(struct device *dev, return -EINVAL; } - pdata->dais = devm_kcalloc(dev, pdata->num_dais, sizeof(*dai_drv), - GFP_KERNEL); + pdata->dais = devm_kzalloc_objs(dev, *dai_drv, pdata->num_dais); if (!pdata->dais) return -ENOMEM; @@ -1303,7 +1302,7 @@ static int q6asm_dai_probe(struct platform_device *pdev) struct q6asm_dai_data *pdata; int rc; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (!pdata) return -ENOMEM; diff --git a/sound/soc/qcom/qdsp6/q6asm.c b/sound/soc/qcom/qdsp6/q6asm.c index de0bd8fd08ee..3f9f2448eb32 100644 --- a/sound/soc/qcom/qdsp6/q6asm.c +++ b/sound/soc/qcom/qdsp6/q6asm.c @@ -1650,7 +1650,7 @@ static int q6asm_probe(struct apr_device *adev) struct device *dev = &adev->dev; struct q6asm *q6asm; - q6asm = devm_kzalloc(dev, sizeof(*q6asm), GFP_KERNEL); + q6asm = devm_kzalloc_obj(dev, *q6asm); if (!q6asm) return -ENOMEM; diff --git a/sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c b/sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c index ab7d20580638..94d96130245e 100644 --- a/sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c +++ b/sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c @@ -134,7 +134,7 @@ int q6dsp_clock_dev_probe(struct platform_device *pdev) const struct q6dsp_clk_desc *desc; int i, ret; - cc = devm_kzalloc(dev, sizeof(*cc), GFP_KERNEL); + cc = devm_kzalloc_obj(dev, *cc); if (!cc) return -ENOMEM; @@ -153,7 +153,7 @@ int q6dsp_clock_dev_probe(struct platform_device *pdev) }; struct q6dsp_clk *clk; - clk = devm_kzalloc(dev, sizeof(*clk), GFP_KERNEL); + clk = devm_kzalloc_obj(dev, *clk); if (!clk) return -ENOMEM; diff --git a/sound/soc/qcom/qdsp6/q6prm.c b/sound/soc/qcom/qdsp6/q6prm.c index 2042ff1e8ff1..86501342cf3f 100644 --- a/sound/soc/qcom/qdsp6/q6prm.c +++ b/sound/soc/qcom/qdsp6/q6prm.c @@ -214,7 +214,7 @@ static int prm_probe(gpr_device_t *gdev) struct device *dev = &gdev->dev; struct q6prm *cc; - cc = devm_kzalloc(dev, sizeof(*cc), GFP_KERNEL); + cc = devm_kzalloc_obj(dev, *cc); if (!cc) return -ENOMEM; diff --git a/sound/soc/qcom/qdsp6/q6usb.c b/sound/soc/qcom/qdsp6/q6usb.c index 6381b289c55c..c777c57b06a5 100644 --- a/sound/soc/qcom/qdsp6/q6usb.c +++ b/sound/soc/qcom/qdsp6/q6usb.c @@ -370,7 +370,7 @@ static int q6usb_dai_dev_probe(struct platform_device *pdev) struct of_phandle_args args; int ret; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/qcom/sc7180.c b/sound/soc/qcom/sc7180.c index bc5a18883479..3b34e11d5dc6 100644 --- a/sound/soc/qcom/sc7180.c +++ b/sound/soc/qcom/sc7180.c @@ -500,7 +500,7 @@ static int sc7180_snd_platform_probe(struct platform_device *pdev) bool qdsp = false, no_headphone = false; /* Allocate the private data */ - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/qcom/sc7280.c b/sound/soc/qcom/sc7280.c index d3d8a6e83268..b17285bf66fe 100644 --- a/sound/soc/qcom/sc7280.c +++ b/sound/soc/qcom/sc7280.c @@ -349,7 +349,7 @@ static int sc7280_snd_platform_probe(struct platform_device *pdev) struct snd_soc_dai_link *link; int ret, i; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c index 9aae6aadd43d..e136407c56bf 100644 --- a/sound/soc/qcom/sc8280xp.c +++ b/sound/soc/qcom/sc8280xp.c @@ -529,12 +529,12 @@ static int sc8280xp_platform_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; /* Allocate the private data */ - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c index 85951397cb2b..0fa2fa6201e2 100644 --- a/sound/soc/qcom/sdm845.c +++ b/sound/soc/qcom/sdm845.c @@ -582,12 +582,12 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; /* Allocate the private data */ - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c index d776a17f1fd3..d0015e5f5257 100644 --- a/sound/soc/qcom/sm8250.c +++ b/sound/soc/qcom/sm8250.c @@ -200,13 +200,13 @@ static int sm8250_platform_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; card->owner = THIS_MODULE; /* Allocate the private data */ - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/qcom/storm.c b/sound/soc/qcom/storm.c index 6b42fbfd27ca..cf3a88c3c498 100644 --- a/sound/soc/qcom/storm.c +++ b/sound/soc/qcom/storm.c @@ -90,7 +90,7 @@ static int storm_platform_probe(struct platform_device *pdev) struct snd_soc_card *card; int ret; - card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(&pdev->dev, *card); if (!card) return -ENOMEM; diff --git a/sound/soc/qcom/x1e80100.c b/sound/soc/qcom/x1e80100.c index c81df41ace88..7eeb32ada7fa 100644 --- a/sound/soc/qcom/x1e80100.c +++ b/sound/soc/qcom/x1e80100.c @@ -185,11 +185,11 @@ static int x1e80100_platform_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; /* Allocate the private data */ - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc_obj(dev, *data); if (!data) return -ENOMEM; diff --git a/sound/soc/renesas/fsi.c b/sound/soc/renesas/fsi.c index 74e2ea002fbb..060f3d07c235 100644 --- a/sound/soc/renesas/fsi.c +++ b/sound/soc/renesas/fsi.c @@ -2023,7 +2023,7 @@ static int fsi_probe(struct platform_device *pdev) if (irq < 0) return irq; - master = devm_kzalloc(&pdev->dev, sizeof(*master), GFP_KERNEL); + master = devm_kzalloc_obj(&pdev->dev, *master); if (!master) return -ENOMEM; diff --git a/sound/soc/renesas/rcar/adg.c b/sound/soc/renesas/rcar/adg.c index 2a74d89ba39d..f0605daf6a21 100644 --- a/sound/soc/renesas/rcar/adg.c +++ b/sound/soc/renesas/rcar/adg.c @@ -930,7 +930,7 @@ int rsnd_adg_probe(struct rsnd_priv *priv) struct device *dev = rsnd_priv_to_dev(priv); int ret; - adg = devm_kzalloc(dev, sizeof(*adg), GFP_KERNEL); + adg = devm_kzalloc_obj(dev, *adg); if (!adg) return -ENOMEM; diff --git a/sound/soc/renesas/rcar/cmd.c b/sound/soc/renesas/rcar/cmd.c index 13beef389797..e840afb9ab9f 100644 --- a/sound/soc/renesas/rcar/cmd.c +++ b/sound/soc/renesas/rcar/cmd.c @@ -162,7 +162,7 @@ int rsnd_cmd_probe(struct rsnd_priv *priv) if (!nr) return 0; - cmd = devm_kcalloc(dev, nr, sizeof(*cmd), GFP_KERNEL); + cmd = devm_kzalloc_objs(dev, *cmd, nr); if (!cmd) return -ENOMEM; diff --git a/sound/soc/renesas/rcar/core.c b/sound/soc/renesas/rcar/core.c index b7954746e953..4b9e55bd3a64 100644 --- a/sound/soc/renesas/rcar/core.c +++ b/sound/soc/renesas/rcar/core.c @@ -1595,8 +1595,8 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) if (!nr) return 0; - rdrv = devm_kcalloc(dev, nr, sizeof(*rdrv), GFP_KERNEL); - rdai = devm_kcalloc(dev, nr, sizeof(*rdai), GFP_KERNEL); + rdrv = devm_kzalloc_objs(dev, *rdrv, nr); + rdai = devm_kzalloc_objs(dev, *rdai, nr); if (!rdrv || !rdai) return -ENOMEM; @@ -2062,7 +2062,7 @@ static int rsnd_probe(struct platform_device *pdev) /* * init priv data */ - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENODEV; diff --git a/sound/soc/renesas/rcar/ctu.c b/sound/soc/renesas/rcar/ctu.c index 7db0fb3612bc..6e636f6c3abb 100644 --- a/sound/soc/renesas/rcar/ctu.c +++ b/sound/soc/renesas/rcar/ctu.c @@ -330,7 +330,7 @@ int rsnd_ctu_probe(struct rsnd_priv *priv) goto rsnd_ctu_probe_done; } - ctu = devm_kcalloc(dev, nr, sizeof(*ctu), GFP_KERNEL); + ctu = devm_kzalloc_objs(dev, *ctu, nr); if (!ctu) { ret = -ENOMEM; goto rsnd_ctu_probe_done; diff --git a/sound/soc/renesas/rcar/dma.c b/sound/soc/renesas/rcar/dma.c index 793dd4adbe5c..e0b7e97e764a 100644 --- a/sound/soc/renesas/rcar/dma.c +++ b/sound/soc/renesas/rcar/dma.c @@ -932,7 +932,7 @@ static int rsnd_dma_alloc(struct rsnd_dai_stream *io, struct rsnd_mod *mod, type = RSND_MOD_AUDMA; } - dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL); + dma = devm_kzalloc_obj(dev, *dma); if (!dma) return -ENOMEM; @@ -989,7 +989,7 @@ int rsnd_dma_probe(struct rsnd_priv *priv) /* * for Gen2 or later */ - dmac = devm_kzalloc(dev, sizeof(*dmac), GFP_KERNEL); + dmac = devm_kzalloc_obj(dev, *dmac); if (!dmac) { dev_err(dev, "dma allocate failed\n"); return 0; /* it will be PIO mode */ diff --git a/sound/soc/renesas/rcar/dvc.c b/sound/soc/renesas/rcar/dvc.c index 7601dfb0810a..2c8ce1c316f5 100644 --- a/sound/soc/renesas/rcar/dvc.c +++ b/sound/soc/renesas/rcar/dvc.c @@ -338,7 +338,7 @@ int rsnd_dvc_probe(struct rsnd_priv *priv) goto rsnd_dvc_probe_done; } - dvc = devm_kcalloc(dev, nr, sizeof(*dvc), GFP_KERNEL); + dvc = devm_kzalloc_objs(dev, *dvc, nr); if (!dvc) { ret = -ENOMEM; goto rsnd_dvc_probe_done; diff --git a/sound/soc/renesas/rcar/gen.c b/sound/soc/renesas/rcar/gen.c index 05d5f656fb01..f6d5044fd240 100644 --- a/sound/soc/renesas/rcar/gen.c +++ b/sound/soc/renesas/rcar/gen.c @@ -651,7 +651,7 @@ int rsnd_gen_probe(struct rsnd_priv *priv) struct rsnd_gen *gen; int ret; - gen = devm_kzalloc(dev, sizeof(*gen), GFP_KERNEL); + gen = devm_kzalloc_obj(dev, *gen); if (!gen) return -ENOMEM; diff --git a/sound/soc/renesas/rcar/mix.c b/sound/soc/renesas/rcar/mix.c index c4da4c4bedb3..94141d28ab4a 100644 --- a/sound/soc/renesas/rcar/mix.c +++ b/sound/soc/renesas/rcar/mix.c @@ -302,7 +302,7 @@ int rsnd_mix_probe(struct rsnd_priv *priv) goto rsnd_mix_probe_done; } - mix = devm_kcalloc(dev, nr, sizeof(*mix), GFP_KERNEL); + mix = devm_kzalloc_objs(dev, *mix, nr); if (!mix) { ret = -ENOMEM; goto rsnd_mix_probe_done; diff --git a/sound/soc/renesas/rcar/msiof.c b/sound/soc/renesas/rcar/msiof.c index 11a6f22ec0ad..42049a9a2349 100644 --- a/sound/soc/renesas/rcar/msiof.c +++ b/sound/soc/renesas/rcar/msiof.c @@ -567,7 +567,7 @@ static int msiof_probe(struct platform_device *pdev) if (irq <= 0) return irq; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/renesas/rcar/src.c b/sound/soc/renesas/rcar/src.c index 2cdb39e898af..f7f4c35bd969 100644 --- a/sound/soc/renesas/rcar/src.c +++ b/sound/soc/renesas/rcar/src.c @@ -736,13 +736,13 @@ int rsnd_src_probe(struct rsnd_priv *priv) goto rsnd_src_probe_done; } - src_ctrl = devm_kzalloc(dev, sizeof(*src_ctrl), GFP_KERNEL); + src_ctrl = devm_kzalloc_obj(dev, *src_ctrl); if (!src_ctrl) { ret = -ENOMEM; goto rsnd_src_probe_done; } - src = devm_kcalloc(dev, nr, sizeof(*src), GFP_KERNEL); + src = devm_kzalloc_objs(dev, *src, nr); if (!src) { ret = -ENOMEM; goto rsnd_src_probe_done; diff --git a/sound/soc/renesas/rcar/ssi.c b/sound/soc/renesas/rcar/ssi.c index 2fa76a079982..cf87a8ee2405 100644 --- a/sound/soc/renesas/rcar/ssi.c +++ b/sound/soc/renesas/rcar/ssi.c @@ -1175,7 +1175,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv) goto rsnd_ssi_probe_done; } - ssi = devm_kcalloc(dev, nr, sizeof(*ssi), GFP_KERNEL); + ssi = devm_kzalloc_objs(dev, *ssi, nr); if (!ssi) { ret = -ENOMEM; goto rsnd_ssi_probe_done; diff --git a/sound/soc/renesas/rcar/ssiu.c b/sound/soc/renesas/rcar/ssiu.c index 2a8593a5d4a6..58c01d2f01df 100644 --- a/sound/soc/renesas/rcar/ssiu.c +++ b/sound/soc/renesas/rcar/ssiu.c @@ -540,11 +540,11 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv) if (!nr) return -EINVAL; - ssiu = devm_kcalloc(dev, nr, sizeof(*ssiu), GFP_KERNEL); + ssiu = devm_kzalloc_objs(dev, *ssiu, nr); if (!ssiu) return -ENOMEM; - ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + ctrl = devm_kzalloc_obj(dev, *ctrl); if (!ctrl) return -ENOMEM; diff --git a/sound/soc/renesas/rz-ssi.c b/sound/soc/renesas/rz-ssi.c index 9a0781bb072d..b9ce2a8c4885 100644 --- a/sound/soc/renesas/rz-ssi.c +++ b/sound/soc/renesas/rz-ssi.c @@ -1023,7 +1023,7 @@ static int rz_ssi_probe(struct platform_device *pdev) struct resource *res; int ret; - ssi = devm_kzalloc(dev, sizeof(*ssi), GFP_KERNEL); + ssi = devm_kzalloc_obj(dev, *ssi); if (!ssi) return -ENOMEM; @@ -1062,7 +1062,7 @@ static int rz_ssi_probe(struct platform_device *pdev) struct snd_dmaengine_pcm_config *config; unsigned int flags = 0; - config = devm_kzalloc(dev, sizeof(*config), GFP_KERNEL); + config = devm_kzalloc_obj(dev, *config); if (!config) return -ENOMEM; diff --git a/sound/soc/renesas/siu_dai.c b/sound/soc/renesas/siu_dai.c index fff6ef870f0d..a8a24bd74116 100644 --- a/sound/soc/renesas/siu_dai.c +++ b/sound/soc/renesas/siu_dai.c @@ -725,7 +725,7 @@ static int siu_probe(struct platform_device *pdev) struct siu_info *info; int ret; - info = devm_kmalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info = devm_kmalloc_obj(&pdev->dev, *info); if (!info) return -ENOMEM; siu_i2s_data = info; diff --git a/sound/soc/rockchip/rk3288_hdmi_analog.c b/sound/soc/rockchip/rk3288_hdmi_analog.c index 9bb02d41d901..c6b0218a6b6a 100644 --- a/sound/soc/rockchip/rk3288_hdmi_analog.c +++ b/sound/soc/rockchip/rk3288_hdmi_analog.c @@ -172,8 +172,7 @@ static int snd_rk_mc_probe(struct platform_device *pdev) struct rk_drvdata *machine; struct of_phandle_args args; - machine = devm_kzalloc(&pdev->dev, sizeof(struct rk_drvdata), - GFP_KERNEL); + machine = devm_kzalloc_obj(&pdev->dev, struct rk_drvdata); if (!machine) return -ENOMEM; diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index d4a0daabfb42..fe95620a1e73 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -515,16 +515,15 @@ static int rockchip_sound_of_parse_dais(struct device *dev, int i, index; int num_routes; - card->dai_link = devm_kcalloc(dev, ARRAY_SIZE(rockchip_dais), - sizeof(*card->dai_link), GFP_KERNEL); + card->dai_link = devm_kzalloc_objs(dev, *card->dai_link, + ARRAY_SIZE(rockchip_dais)); if (!card->dai_link) return -ENOMEM; num_routes = 0; for (i = 0; i < ARRAY_SIZE(rockchip_routes); i++) num_routes += rockchip_routes[i].num_routes; - routes = devm_kcalloc(dev, num_routes, sizeof(*routes), - GFP_KERNEL); + routes = devm_kzalloc_objs(dev, *routes, num_routes); if (!routes) return -ENOMEM; card->dapm_routes = routes; diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index 0a67632e68ed..32f10b1d0d22 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -765,7 +765,7 @@ static int rockchip_i2s_probe(struct platform_device *pdev) void __iomem *regs; int ret; - i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(&pdev->dev, *i2s); if (!i2s) return -ENOMEM; diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c index 983319a538b1..16e85e62b276 100644 --- a/sound/soc/rockchip/rockchip_i2s_tdm.c +++ b/sound/soc/rockchip/rockchip_i2s_tdm.c @@ -1247,7 +1247,7 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev) void __iomem *regs; int ret; - i2s_tdm = devm_kzalloc(&pdev->dev, sizeof(*i2s_tdm), GFP_KERNEL); + i2s_tdm = devm_kzalloc_obj(&pdev->dev, *i2s_tdm); if (!i2s_tdm) return -ENOMEM; diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c index 0720748c7c8d..a0a89f5bddd9 100644 --- a/sound/soc/rockchip/rockchip_pdm.c +++ b/sound/soc/rockchip/rockchip_pdm.c @@ -586,7 +586,7 @@ static int rockchip_pdm_probe(struct platform_device *pdev) void __iomem *regs; int ret; - pdm = devm_kzalloc(&pdev->dev, sizeof(*pdm), GFP_KERNEL); + pdm = devm_kzalloc_obj(&pdev->dev, *pdm); if (!pdm) return -ENOMEM; diff --git a/sound/soc/rockchip/rockchip_sai.c b/sound/soc/rockchip/rockchip_sai.c index dab96df8bf96..b625d69f76c8 100644 --- a/sound/soc/rockchip/rockchip_sai.c +++ b/sound/soc/rockchip/rockchip_sai.c @@ -1409,7 +1409,7 @@ static int rockchip_sai_probe(struct platform_device *pdev) void __iomem *regs; int ret, irq; - sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL); + sai = devm_kzalloc_obj(&pdev->dev, *sai); if (!sai) return -ENOMEM; diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c index 2d53efd5dd2e..969cc95410d2 100644 --- a/sound/soc/rockchip/rockchip_spdif.c +++ b/sound/soc/rockchip/rockchip_spdif.c @@ -354,7 +354,7 @@ static int rk_spdif_probe(struct platform_device *pdev) regmap_write(grf, RK3288_GRF_SOC_CON2, BIT(1) << 16); } - spdif = devm_kzalloc(&pdev->dev, sizeof(*spdif), GFP_KERNEL); + spdif = devm_kzalloc_obj(&pdev->dev, *spdif); if (!spdif) return -ENOMEM; diff --git a/sound/soc/samsung/aries_wm8994.c b/sound/soc/samsung/aries_wm8994.c index 1a5b53f47571..4f383f977fb8 100644 --- a/sound/soc/samsung/aries_wm8994.c +++ b/sound/soc/samsung/aries_wm8994.c @@ -549,7 +549,7 @@ static int aries_audio_probe(struct platform_device *pdev) card->dev = dev; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/samsung/dmaengine.c b/sound/soc/samsung/dmaengine.c index 2802789a323e..26badd429d94 100644 --- a/sound/soc/samsung/dmaengine.c +++ b/sound/soc/samsung/dmaengine.c @@ -20,7 +20,7 @@ int samsung_asoc_dma_platform_register(struct device *dev, dma_filter_fn filter, { struct snd_dmaengine_pcm_config *pcm_conf; - pcm_conf = devm_kzalloc(dev, sizeof(*pcm_conf), GFP_KERNEL); + pcm_conf = devm_kzalloc_obj(dev, *pcm_conf); if (!pcm_conf) return -ENOMEM; diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 442e70b107da..7b9f1493b88f 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1166,13 +1166,12 @@ static int i2s_alloc_dais(struct samsung_i2s_priv *priv, struct snd_soc_dai_driver *dai_drv; int i; - priv->dai = devm_kcalloc(&priv->pdev->dev, num_dais, - sizeof(struct i2s_dai), GFP_KERNEL); + priv->dai = devm_kzalloc_objs(&priv->pdev->dev, struct i2s_dai, + num_dais); if (!priv->dai) return -ENOMEM; - priv->dai_drv = devm_kcalloc(&priv->pdev->dev, num_dais, - sizeof(*dai_drv), GFP_KERNEL); + priv->dai_drv = devm_kzalloc_objs(&priv->pdev->dev, *dai_drv, num_dais); if (!priv->dai_drv) return -ENOMEM; @@ -1405,7 +1404,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) i2s_dai_data = (struct samsung_i2s_dai_data *)id->driver_data; } - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/samsung/midas_wm1811.c b/sound/soc/samsung/midas_wm1811.c index 11466dd3539e..d84e10de4991 100644 --- a/sound/soc/samsung/midas_wm1811.c +++ b/sound/soc/samsung/midas_wm1811.c @@ -588,7 +588,7 @@ static int midas_probe(struct platform_device *pdev) struct midas_priv *priv; int ret, i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/samsung/odroid.c b/sound/soc/samsung/odroid.c index 5c5ecbea5331..1ca87f16887a 100644 --- a/sound/soc/samsung/odroid.c +++ b/sound/soc/samsung/odroid.c @@ -194,7 +194,7 @@ static int odroid_audio_probe(struct platform_device *pdev) struct snd_soc_dai_link *link, *codec_link; int num_pcms, ret, i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/samsung/snow.c b/sound/soc/samsung/snow.c index 66ef49dff1ba..0c74775d9d46 100644 --- a/sound/soc/samsung/snow.c +++ b/sound/soc/samsung/snow.c @@ -130,7 +130,7 @@ static int snow_probe(struct platform_device *pdev) struct snow_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/samsung/tm2_wm5110.c b/sound/soc/samsung/tm2_wm5110.c index f4912826dfd4..076c8bfc119c 100644 --- a/sound/soc/samsung/tm2_wm5110.c +++ b/sound/soc/samsung/tm2_wm5110.c @@ -504,7 +504,7 @@ static int tm2_probe(struct platform_device *pdev) struct snd_soc_dai_link *dai_link; int num_codecs, ret, i; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/sdca/sdca_asoc.c b/sound/soc/sdca/sdca_asoc.c index ccc579f878ff..cadfa29630f4 100644 --- a/sound/soc/sdca/sdca_asoc.c +++ b/sound/soc/sdca/sdca_asoc.c @@ -217,19 +217,19 @@ static int entity_early_parse_ge(struct device *dev, if (!control_name) return -ENOMEM; - kctl = devm_kzalloc(dev, sizeof(*kctl), GFP_KERNEL); + kctl = devm_kzalloc_obj(dev, *kctl); if (!kctl) return -ENOMEM; - soc_enum = devm_kzalloc(dev, sizeof(*soc_enum), GFP_KERNEL); + soc_enum = devm_kzalloc_obj(dev, *soc_enum); if (!soc_enum) return -ENOMEM; - texts = devm_kcalloc(dev, range->rows + 3, sizeof(*texts), GFP_KERNEL); + texts = devm_kzalloc_objs(dev, *texts, range->rows + 3); if (!texts) return -ENOMEM; - values = devm_kcalloc(dev, range->rows + 3, sizeof(*values), GFP_KERNEL); + values = devm_kzalloc_objs(dev, *values, range->rows + 3); if (!values) return -ENOMEM; @@ -587,15 +587,15 @@ static int entity_parse_su_class(struct device *dev, const char **texts; int i; - kctl = devm_kzalloc(dev, sizeof(*kctl), GFP_KERNEL); + kctl = devm_kzalloc_obj(dev, *kctl); if (!kctl) return -ENOMEM; - soc_enum = devm_kzalloc(dev, sizeof(*soc_enum), GFP_KERNEL); + soc_enum = devm_kzalloc_obj(dev, *soc_enum); if (!soc_enum) return -ENOMEM; - texts = devm_kcalloc(dev, entity->num_sources + 1, sizeof(*texts), GFP_KERNEL); + texts = devm_kzalloc_objs(dev, *texts, entity->num_sources + 1); if (!texts) return -ENOMEM; @@ -677,7 +677,7 @@ static int entity_parse_mu(struct device *dev, dev_warn(dev, "%s: unexpected access layer: %x\n", entity->label, control->layers); - kctl = devm_kcalloc(dev, entity->num_sources, sizeof(*kctl), GFP_KERNEL); + kctl = devm_kzalloc_objs(dev, *kctl, entity->num_sources); if (!kctl) return -ENOMEM; @@ -690,7 +690,7 @@ static int entity_parse_mu(struct device *dev, if (!control_name) return -ENOMEM; - mc = devm_kzalloc(dev, sizeof(*mc), GFP_KERNEL); + mc = devm_kzalloc_obj(dev, *mc); if (!mc) return -ENOMEM; @@ -946,7 +946,7 @@ static int control_limit_kctl(struct device *dev, min = sign_extend32(min, control->nbits - 1); max = sign_extend32(max, control->nbits - 1); - tlv = devm_kcalloc(dev, 4, sizeof(*tlv), GFP_KERNEL); + tlv = devm_kzalloc_objs(dev, *tlv, 4); if (!tlv) return -ENOMEM; @@ -1034,7 +1034,7 @@ static int populate_control(struct device *dev, if (!control_name) return -ENOMEM; - mc = devm_kzalloc(dev, sizeof(*mc), GFP_KERNEL); + mc = devm_kzalloc_obj(dev, *mc); if (!mc) return -ENOMEM; @@ -1392,19 +1392,19 @@ int sdca_asoc_populate_component(struct device *dev, if (ret) return ret; - widgets = devm_kcalloc(dev, num_widgets, sizeof(*widgets), GFP_KERNEL); + widgets = devm_kzalloc_objs(dev, *widgets, num_widgets); if (!widgets) return -ENOMEM; - routes = devm_kcalloc(dev, num_routes, sizeof(*routes), GFP_KERNEL); + routes = devm_kzalloc_objs(dev, *routes, num_routes); if (!routes) return -ENOMEM; - controls = devm_kcalloc(dev, num_controls, sizeof(*controls), GFP_KERNEL); + controls = devm_kzalloc_objs(dev, *controls, num_controls); if (!controls) return -ENOMEM; - dais = devm_kcalloc(dev, num_dais, sizeof(*dais), GFP_KERNEL); + dais = devm_kzalloc_objs(dev, *dais, num_dais); if (!dais) return -ENOMEM; diff --git a/sound/soc/sdca/sdca_class.c b/sound/soc/sdca/sdca_class.c index ee61c983dc57..7676c9624349 100644 --- a/sound/soc/sdca/sdca_class.c +++ b/sound/soc/sdca/sdca_class.c @@ -217,7 +217,7 @@ static int class_sdw_probe(struct sdw_slave *sdw, const struct sdw_device_id *id * bare sdca_class_drv here and stash it in drvdata for the * built-in PM ops to fetch. */ - drv = devm_kzalloc(&sdw->dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(&sdw->dev, *drv); if (!drv) return -ENOMEM; diff --git a/sound/soc/sdca/sdca_class_function.c b/sound/soc/sdca/sdca_class_function.c index 13b70f0f0dbf..d0b8662133fa 100644 --- a/sound/soc/sdca/sdca_class_function.c +++ b/sound/soc/sdca/sdca_class_function.c @@ -340,7 +340,7 @@ static int class_function_probe(struct auxiliary_device *auxdev, int num_dais; int ret; - drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL); + drv = devm_kzalloc_obj(dev, *drv); if (!drv) return -ENOMEM; @@ -378,7 +378,7 @@ static int class_function_probe(struct auxiliary_device *auxdev, if (ndefaults < 0) return ndefaults; - defaults = devm_kcalloc(dev, ndefaults, sizeof(*defaults), GFP_KERNEL); + defaults = devm_kzalloc_objs(dev, *defaults, ndefaults); if (!defaults) return -ENOMEM; diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c index 1eb6418e132d..4f529216000e 100644 --- a/sound/soc/sdca/sdca_functions.c +++ b/sound/soc/sdca/sdca_functions.c @@ -240,7 +240,7 @@ static int find_sdca_init_table(struct device *dev, num_init_writes /= sizeof(*raw); - init_write = devm_kcalloc(dev, num_init_writes, sizeof(*init_write), GFP_KERNEL); + init_write = devm_kzalloc_objs(dev, *init_write, num_init_writes); if (!init_write) return -ENOMEM; @@ -988,8 +988,8 @@ static int find_sdca_entity_control(struct device *dev, struct sdca_entity *enti return ret; } - control->values = devm_kcalloc(dev, hweight64(control->cn_list), - sizeof(*control->values), GFP_KERNEL); + control->values = devm_kzalloc_objs(dev, *control->values, + hweight64(control->cn_list)); if (!control->values) return -ENOMEM; @@ -1085,7 +1085,7 @@ static int find_sdca_entity_controls(struct device *dev, } num_controls = hweight64(control_list); - controls = devm_kcalloc(dev, num_controls, sizeof(*controls), GFP_KERNEL); + controls = devm_kzalloc_objs(dev, *controls, num_controls); if (!controls) return -ENOMEM; @@ -1259,7 +1259,7 @@ static int find_sdca_entity_pde(struct device *dev, num_delays /= mult_delay; - delays = devm_kcalloc(dev, num_delays, sizeof(*delays), GFP_KERNEL); + delays = devm_kzalloc_objs(dev, *delays, num_delays); if (!delays) return -ENOMEM; @@ -1324,8 +1324,7 @@ static int find_sdca_entity_ge(struct device *dev, group->num_modes = *affected_list; affected_iter = affected_list + 1; - group->modes = devm_kcalloc(dev, group->num_modes, sizeof(*group->modes), - GFP_KERNEL); + group->modes = devm_kzalloc_objs(dev, *group->modes, group->num_modes); if (!group->modes) return -ENOMEM; @@ -1344,8 +1343,8 @@ static int find_sdca_entity_ge(struct device *dev, if (affected_iter > affected_list + num_affected) goto bad_list; - mode->controls = devm_kcalloc(dev, mode->num_controls, - sizeof(*mode->controls), GFP_KERNEL); + mode->controls = devm_kzalloc_objs(dev, *mode->controls, + mode->num_controls); if (!mode->controls) return -ENOMEM; @@ -1386,8 +1385,8 @@ static int find_sdca_entity_hide(struct device *dev, return num_reports; } else if (num_reports > 0) { hide->num_hidtx_ids = num_reports; - hide->hidtx_ids = devm_kcalloc(dev, hide->num_hidtx_ids, - sizeof(*hide->hidtx_ids), GFP_KERNEL); + hide->hidtx_ids = devm_kzalloc_objs(dev, *hide->hidtx_ids, + hide->num_hidtx_ids); if (!hide->hidtx_ids) return -ENOMEM; @@ -1404,8 +1403,8 @@ static int find_sdca_entity_hide(struct device *dev, return num_reports; } else if (num_reports > 0) { hide->num_hidrx_ids = num_reports; - hide->hidrx_ids = devm_kcalloc(dev, hide->num_hidrx_ids, - sizeof(*hide->hidrx_ids), GFP_KERNEL); + hide->hidrx_ids = devm_kzalloc_objs(dev, *hide->hidrx_ids, + hide->num_hidrx_ids); if (!hide->hidrx_ids) return -ENOMEM; @@ -1547,7 +1546,7 @@ static int find_sdca_entities(struct device *dev, struct fwnode_handle *function } /* Add 1 to make space for Entity 0 */ - entities = devm_kcalloc(dev, num_entities + 1, sizeof(*entities), GFP_KERNEL); + entities = devm_kzalloc_objs(dev, *entities, num_entities + 1); if (!entities) return -ENOMEM; @@ -1710,7 +1709,7 @@ static int find_sdca_entity_connection_pde(struct device *dev, return -EINVAL; } - managed = devm_kcalloc(dev, num_managed, sizeof(*managed), GFP_KERNEL); + managed = devm_kzalloc_objs(dev, *managed, num_managed); if (!managed) return -ENOMEM; @@ -1827,7 +1826,7 @@ static int find_sdca_entity_connection(struct device *dev, } num_pins = hweight64(pin_list); - pins = devm_kcalloc(dev, num_pins, sizeof(*pins), GFP_KERNEL); + pins = devm_kzalloc_objs(dev, *pins, num_pins); if (!pins) return -ENOMEM; @@ -1977,7 +1976,7 @@ static int find_sdca_cluster_channels(struct device *dev, return -EINVAL; } - channels = devm_kcalloc(dev, num_channels, sizeof(*channels), GFP_KERNEL); + channels = devm_kzalloc_objs(dev, *channels, num_channels); if (!channels) return -ENOMEM; @@ -2027,7 +2026,7 @@ static int find_sdca_clusters(struct device *dev, return -EINVAL; } - clusters = devm_kcalloc(dev, num_clusters, sizeof(*clusters), GFP_KERNEL); + clusters = devm_kzalloc_objs(dev, *clusters, num_clusters); if (!clusters) return -ENOMEM; @@ -2098,7 +2097,7 @@ static int find_sdca_filesets(struct device *dev, struct fwnode_handle *function fwnode_property_read_u32_array(function_node, "mipi-sdca-file-set-id-list", filesets_list, num_sets); - sets = devm_kcalloc(dev, num_sets, sizeof(*sets), GFP_KERNEL); + sets = devm_kzalloc_objs(dev, *sets, num_sets); if (!sets) return -ENOMEM; @@ -2123,8 +2122,8 @@ static int find_sdca_filesets(struct device *dev, struct fwnode_handle *function dev_dbg(dev, "fileset: %#x\n", filesets_list[i]); - files = devm_kcalloc(dev, num_entries / mult_fileset, - sizeof(*files), GFP_KERNEL); + files = devm_kzalloc_objs(dev, *files, + num_entries / mult_fileset); if (!files) return -ENOMEM; diff --git a/sound/soc/sdca/sdca_interrupts.c b/sound/soc/sdca/sdca_interrupts.c index 7aebc721a847..2c3f16093969 100644 --- a/sound/soc/sdca/sdca_interrupts.c +++ b/sound/soc/sdca/sdca_interrupts.c @@ -642,7 +642,7 @@ struct sdca_interrupt_info *devm_sdca_irq_allocate(struct device *sdev, struct sdca_interrupt_info *info; int ret, i; - info = devm_kzalloc(sdev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc_obj(sdev, *info); if (!info) return ERR_PTR(-ENOMEM); diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c index 7a19de75f32b..00788bf31d92 100644 --- a/sound/soc/sdw_utils/soc_sdw_utils.c +++ b/sound/soc/sdw_utils/soc_sdw_utils.c @@ -2199,7 +2199,7 @@ int asoc_sdw_init_simple_dai_link(struct device *dev, struct snd_soc_dai_link *d struct snd_soc_dai_link_component *dlc; /* Allocate three DLCs one for the CPU, one for platform and one for the CODEC */ - dlc = devm_kcalloc(dev, 3, sizeof(*dlc), GFP_KERNEL); + dlc = devm_kzalloc_objs(dev, *dlc, 3); if (!dlc || !name || !cpu_dai_name || !platform_comp_name || !codec_name || !codec_dai_name) return -ENOMEM; diff --git a/sound/soc/soc-ac97.c b/sound/soc/soc-ac97.c index 9d38b38d88df..8d2e66885c3f 100644 --- a/sound/soc/soc-ac97.c +++ b/sound/soc/soc-ac97.c @@ -135,7 +135,7 @@ static int snd_soc_ac97_init_gpio(struct snd_ac97 *ac97, struct snd_ac97_gpio_priv *gpio_priv; int ret; - gpio_priv = devm_kzalloc(component->dev, sizeof(*gpio_priv), GFP_KERNEL); + gpio_priv = devm_kzalloc_obj(component->dev, *gpio_priv); if (!gpio_priv) return -ENOMEM; ac97->gpio_priv = gpio_priv; diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index a941ed0908c6..afaaac454594 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -774,12 +774,11 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd) else direction = SND_COMPRESS_CAPTURE; - compr = devm_kzalloc(rtd->card->dev, sizeof(*compr), GFP_KERNEL); + compr = devm_kzalloc_obj(rtd->card->dev, *compr); if (!compr) return -ENOMEM; - compr->ops = devm_kzalloc(rtd->card->dev, sizeof(soc_compr_ops), - GFP_KERNEL); + compr->ops = devm_kzalloc_obj(rtd->card->dev, soc_compr_ops); if (!compr->ops) return -ENOMEM; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 97269b4ee4ca..68b54e509b65 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -381,12 +381,8 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( /* * for rtd */ - rtd = devm_kzalloc(dev, - struct_size(rtd, components, - dai_link->num_cpus + - dai_link->num_codecs + - dai_link->num_platforms), - GFP_KERNEL); + rtd = devm_kzalloc_flex(dev, *rtd, components, + dai_link->num_cpus + dai_link->num_codecs + dai_link->num_platforms); if (!rtd) { device_unregister(dev); return NULL; @@ -409,9 +405,8 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( /* * for rtd->dais */ - rtd->dais = devm_kcalloc(dev, dai_link->num_cpus + dai_link->num_codecs, - sizeof(struct snd_soc_dai *), - GFP_KERNEL); + rtd->dais = devm_kzalloc_objs(dev, struct snd_soc_dai *, + dai_link->num_cpus + dai_link->num_codecs); if (!rtd->dais) goto free_rtd; @@ -687,7 +682,7 @@ static inline void soc_resume_init(struct snd_soc_card *card) { } struct of_phandle_args *snd_soc_copy_dai_args(struct device *dev, const struct of_phandle_args *args) { - struct of_phandle_args *ret = devm_kzalloc(dev, sizeof(*ret), GFP_KERNEL); + struct of_phandle_args *ret = devm_kzalloc_obj(dev, *ret); if (!ret) return NULL; @@ -2282,7 +2277,7 @@ struct snd_soc_component *snd_soc_component_new(struct device *dev, const char * { struct snd_soc_component *component; - component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL); + component = devm_kzalloc_obj(dev, *component); if (!component) return ERR_PTR(-ENOMEM); @@ -2464,8 +2459,7 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card, num_widgets /= 2; - widgets = devm_kcalloc(card->dev, num_widgets, sizeof(*widgets), - GFP_KERNEL); + widgets = devm_kzalloc_objs(card->dev, *widgets, num_widgets); if (!widgets) { dev_err(card->dev, "ASoC: Could not allocate memory for widgets\n"); @@ -2529,8 +2523,7 @@ int snd_soc_of_parse_pin_switches(struct snd_soc_card *card, const char *prop) if (!of_property_present(dev->of_node, prop)) return 0; - strings = devm_kcalloc(dev, nb_controls_max, - sizeof(*strings), GFP_KERNEL); + strings = devm_kzalloc_objs(dev, *strings, nb_controls_max); if (!strings) return -ENOMEM; @@ -2541,8 +2534,7 @@ int snd_soc_of_parse_pin_switches(struct snd_soc_card *card, const char *prop) nb_controls = (unsigned int)ret; - controls = devm_kcalloc(dev, nb_controls, - sizeof(*controls), GFP_KERNEL); + controls = devm_kzalloc_objs(dev, *controls, nb_controls); if (!controls) return -ENOMEM; @@ -2693,8 +2685,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, } num_routes /= 2; - routes = devm_kcalloc(card->dev, num_routes, sizeof(*routes), - GFP_KERNEL); + routes = devm_kzalloc_objs(card->dev, *routes, num_routes); if (!routes) { dev_err(card->dev, "ASoC: Could not allocate DAPM route table\n"); @@ -2742,7 +2733,7 @@ int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname) return num; } - aux = devm_kcalloc(card->dev, num, sizeof(*aux), GFP_KERNEL); + aux = devm_kzalloc_objs(card->dev, *aux, num); if (!aux) return -ENOMEM; card->aux_dev = aux; @@ -3180,7 +3171,7 @@ static int __snd_soc_of_get_dai_link_component_alloc( dev_err(dev, "Bad phandle in 'sound-dai'\n"); return num; } - component = devm_kcalloc(dev, num, sizeof(*component), GFP_KERNEL); + component = devm_kzalloc_objs(dev, *component, num); if (!component) return -ENOMEM; diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index d124b6afb1b8..9e34f34eac3d 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -1235,7 +1235,7 @@ struct snd_soc_dai *snd_soc_dai_register(struct snd_soc_component *component, lockdep_assert_held(&client_mutex); - dai = devm_kzalloc(dev, sizeof(*dai), GFP_KERNEL); + dai = devm_kzalloc_obj(dev, *dai); if (dai == NULL) return NULL; diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 7455160b11fe..ce2e92d4d599 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -193,7 +193,7 @@ static void dapm_pop_dbg(struct device *dev, const char *fmt, ...) struct snd_soc_dapm_context *snd_soc_dapm_alloc(struct device *dev) { - return devm_kzalloc(dev, sizeof(struct snd_soc_dapm_context), GFP_KERNEL); + return devm_kzalloc_obj(dev, struct snd_soc_dapm_context); } struct device *snd_soc_dapm_to_dev(struct snd_soc_dapm_context *dapm) diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 35cbe29d2275..4024a3899e0b 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -650,7 +650,7 @@ static int soc_tplg_control_dmixer_create(struct soc_tplg *tplg, struct snd_kcon if (strnlen(mc->hdr.name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == SNDRV_CTL_ELEM_ID_NAME_MAXLEN) return -EINVAL; - sm = devm_kzalloc(tplg->dev, sizeof(*sm), GFP_KERNEL); + sm = devm_kzalloc_obj(tplg->dev, *sm); if (!sm) return -ENOMEM; @@ -746,9 +746,9 @@ static int soc_tplg_denum_create_values(struct soc_tplg *tplg, struct soc_enum * if (le32_to_cpu(ec->items) > SND_SOC_TPLG_NUM_TEXTS) return -EINVAL; - se->dobj.control.dvalues = devm_kcalloc(tplg->dev, le32_to_cpu(ec->items), - sizeof(*se->dobj.control.dvalues), - GFP_KERNEL); + se->dobj.control.dvalues = devm_kzalloc_objs(tplg->dev, + *se->dobj.control.dvalues, + le32_to_cpu(ec->items)); if (!se->dobj.control.dvalues) return -ENOMEM; @@ -774,7 +774,7 @@ static int soc_tplg_control_denum_create(struct soc_tplg *tplg, struct snd_kcont if (strnlen(ec->hdr.name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == SNDRV_CTL_ELEM_ID_NAME_MAXLEN) return -EINVAL; - se = devm_kzalloc(tplg->dev, sizeof(*se), GFP_KERNEL); + se = devm_kzalloc_obj(tplg->dev, *se); if (!se) return -ENOMEM; @@ -843,7 +843,7 @@ static int soc_tplg_control_dbytes_create(struct soc_tplg *tplg, struct snd_kcon if (strnlen(be->hdr.name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == SNDRV_CTL_ELEM_ID_NAME_MAXLEN) return -EINVAL; - sbe = devm_kzalloc(tplg->dev, sizeof(*sbe), GFP_KERNEL); + sbe = devm_kzalloc_obj(tplg->dev, *sbe); if (!sbe) return -ENOMEM; @@ -1048,7 +1048,7 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg, le32_to_cpu(hdr->index)); for (i = 0; i < count; i++) { - route = devm_kzalloc(tplg->dev, sizeof(*route), GFP_KERNEL); + route = devm_kzalloc_obj(tplg->dev, *route); if (!route) return -ENOMEM; elem = (struct snd_soc_tplg_dapm_graph_elem *)tplg->pos; @@ -1159,14 +1159,14 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg, } template.num_kcontrols = le32_to_cpu(w->num_kcontrols); - kc = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(*kc), GFP_KERNEL); + kc = devm_kzalloc_objs(tplg->dev, *kc, le32_to_cpu(w->num_kcontrols)); if (!kc) { ret = -ENOMEM; goto hdr_err; } - kcontrol_type = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(unsigned int), - GFP_KERNEL); + kcontrol_type = devm_kzalloc_objs(tplg->dev, unsigned int, + le32_to_cpu(w->num_kcontrols)); if (!kcontrol_type) { ret = -ENOMEM; goto hdr_err; @@ -1391,7 +1391,7 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg, struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(tplg->comp); int ret; - dai_drv = devm_kzalloc(tplg->dev, sizeof(struct snd_soc_dai_driver), GFP_KERNEL); + dai_drv = devm_kzalloc_obj(tplg->dev, struct snd_soc_dai_driver); if (dai_drv == NULL) return -ENOMEM; diff --git a/sound/soc/sof/amd/acp-common.c b/sound/soc/sof/amd/acp-common.c index 3bb1de8c0376..8bd45932a110 100644 --- a/sound/soc/sof/amd/acp-common.c +++ b/sound/soc/sof/amd/acp-common.c @@ -164,9 +164,8 @@ static struct snd_soc_acpi_mach *amd_sof_sdw_machine_select(struct snd_sof_dev * mach->mach_params.platform = dev_name(sdev->dev); if (acp_data->pdm_sel) { - pdm_pdata = devm_kzalloc(sdev->dev, - sizeof(*pdm_pdata), - GFP_KERNEL); + pdm_pdata = devm_kzalloc_obj(sdev->dev, + *pdm_pdata); if (!pdm_pdata) return NULL; pdm_pdata->pdm_sel = acp_data->pdm_sel; @@ -216,7 +215,7 @@ struct snd_soc_acpi_mach *amd_sof_machine_select(struct snd_sof_dev *sdev) mach->mach_params.subsystem_rev = acp_data->pci_rev; if (acp_data->pdm_sel) { - pdm_pdata = devm_kzalloc(sdev->dev, sizeof(*pdm_pdata), GFP_KERNEL); + pdm_pdata = devm_kzalloc_obj(sdev->dev, *pdm_pdata); if (!pdm_pdata) return NULL; pdm_pdata->pdm_sel = acp_data->pdm_sel; diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c index 86e2402b8ffd..6dfed95d5512 100644 --- a/sound/soc/sof/amd/acp.c +++ b/sound/soc/sof/amd/acp.c @@ -1226,8 +1226,7 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev) dev_err(sdev->dev, "no such device supported, chip id:%x\n", pci->device); return -EIO; } - adata = devm_kzalloc(sdev->dev, sizeof(struct acp_dev_data), - GFP_KERNEL); + adata = devm_kzalloc_obj(sdev->dev, struct acp_dev_data); if (!adata) return -ENOMEM; @@ -1366,7 +1365,7 @@ int amd_sof_acp7x_probe(struct snd_sof_dev *sdev) dev_err(sdev->dev, "no such device supported, chip id:%x\n", pci->device); return -EIO; } - adata = devm_kzalloc(sdev->dev, sizeof(struct acp_dev_data), GFP_KERNEL); + adata = devm_kzalloc_obj(sdev->dev, struct acp_dev_data); if (!adata) return -ENOMEM; diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index 41747ef0e432..79e63f3fbce9 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -248,7 +248,7 @@ static int sof_machine_check(struct snd_sof_dev *sdev) nocodec: /* select nocodec mode */ dev_warn(sdev->dev, "Using nocodec machine driver\n"); - mach = devm_kzalloc(sdev->dev, sizeof(*mach), GFP_KERNEL); + mach = devm_kzalloc_obj(sdev->dev, *mach); if (!mach) return -ENOMEM; @@ -636,7 +636,7 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data) struct snd_sof_dev *sdev; int ret; - sdev = devm_kzalloc(dev, sizeof(*sdev), GFP_KERNEL); + sdev = devm_kzalloc_obj(dev, *sdev); if (!sdev) return -ENOMEM; diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c index 6b9e1f1ee657..c648b9b22d4d 100644 --- a/sound/soc/sof/debug.c +++ b/sound/soc/sof/debug.c @@ -121,7 +121,7 @@ static int snd_sof_debugfs_io_item(struct snd_sof_dev *sdev, if (!sdev) return -EINVAL; - dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); + dfse = devm_kzalloc_obj(sdev->dev, *dfse); if (!dfse) return -ENOMEM; @@ -177,7 +177,7 @@ int snd_sof_debugfs_buf_item(struct snd_sof_dev *sdev, if (!sdev) return -EINVAL; - dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); + dfse = devm_kzalloc_obj(sdev->dev, *dfse); if (!dfse) return -ENOMEM; @@ -297,7 +297,7 @@ int snd_sof_dbg_memory_info_init(struct snd_sof_dev *sdev) { struct snd_sof_dfsentry *dfse; - dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); + dfse = devm_kzalloc_obj(sdev->dev, *dfse); if (!dfse) return -ENOMEM; diff --git a/sound/soc/sof/imx/imx-common.c b/sound/soc/sof/imx/imx-common.c index 436fe49246ba..0d113955b432 100644 --- a/sound/soc/sof/imx/imx-common.c +++ b/sound/soc/sof/imx/imx-common.c @@ -349,7 +349,7 @@ static int imx_probe(struct snd_sof_dev *sdev) pdev = to_platform_device(sdev->dev); - common = devm_kzalloc(sdev->dev, sizeof(*common), GFP_KERNEL); + common = devm_kzalloc_obj(sdev->dev, *common); if (!common) return -ENOMEM; diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c index 0820724dbb34..5cd3f44c90d2 100644 --- a/sound/soc/sof/imx/imx8.c +++ b/sound/soc/sof/imx/imx8.c @@ -181,7 +181,7 @@ static int imx8m_probe(struct snd_sof_dev *sdev) common = sdev->pdata->hw_pdata; - chip = devm_kzalloc(sdev->dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(sdev->dev, *chip); if (!chip) return -ENOMEM; diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c index c8729b6d82bd..7d920d43ef2a 100644 --- a/sound/soc/sof/intel/hda-dai.c +++ b/sound/soc/sof/intel/hda-dai.c @@ -762,7 +762,7 @@ void hda_set_dai_drv_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *ops) struct sof_ipc4_fw_data *ipc4_data = sdev->private; struct snd_ipc4_nhlt *entry; - entry = devm_kzalloc(sdev->dev, sizeof(*entry), GFP_KERNEL); + entry = devm_kzalloc_obj(sdev->dev, *entry); if (!entry) return; diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c index bdd4831e050c..e2da0d4d1a5f 100644 --- a/sound/soc/sof/intel/hda-stream.c +++ b/sound/soc/sof/intel/hda-stream.c @@ -995,8 +995,7 @@ int hda_dsp_stream_init(struct snd_sof_dev *sdev) for (i = 0; i < num_total; i++) { struct sof_intel_hda_stream *hda_stream; - hda_stream = devm_kzalloc(sdev->dev, sizeof(*hda_stream), - GFP_KERNEL); + hda_stream = devm_kzalloc_obj(sdev->dev, *hda_stream); if (!hda_stream) return -ENOMEM; diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 2a40cb9bf24d..9fc95806697e 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -788,7 +788,7 @@ int hda_dsp_probe_early(struct snd_sof_dev *sdev) sdev->num_cores = chip->cores_num; - hdev = devm_kzalloc(sdev->dev, sizeof(*hdev), GFP_KERNEL); + hdev = devm_kzalloc_obj(sdev->dev, *hdev); if (!hdev) return -ENOMEM; sdev->pdata->hw_pdata = hdev; @@ -1179,7 +1179,7 @@ static struct snd_soc_acpi_adr_device *find_acpi_adr_device(struct device *dev, link->mask = BIT(sdw_device->bus->link_id); /* index is 0 based, we need allocate index + 1 for the array size */ if (!index) - adr_dev = devm_kzalloc(dev, sizeof(*adr_dev), GFP_KERNEL); + adr_dev = devm_kzalloc_obj(dev, *adr_dev); else adr_dev = devm_krealloc(dev, (struct snd_soc_acpi_adr_device *)link->adr_d, (index + 1) * sizeof(*adr_dev), GFP_KERNEL); @@ -1197,8 +1197,8 @@ static struct snd_soc_acpi_adr_device *find_acpi_adr_device(struct device *dev, if (sdw_device->id.part_id != codec_info_list[i].part_id) continue; - endpoints = devm_kcalloc(dev, codec_info_list[i].dai_num, - sizeof(struct snd_soc_acpi_endpoint), GFP_KERNEL); + endpoints = devm_kzalloc_objs(dev, struct snd_soc_acpi_endpoint, + codec_info_list[i].dai_num); if (!endpoints) return NULL; @@ -1405,7 +1405,7 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev return NULL; /* Create default SDW mach */ - mach = devm_kzalloc(sdev->dev, sizeof(*mach), GFP_KERNEL); + mach = devm_kzalloc_obj(sdev->dev, *mach); if (!mach) return NULL; @@ -1415,7 +1415,7 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev link_num = hweight32(link_mask); /* An empty adr_link is needed to terminate the adr_link loop */ - links = devm_kcalloc(sdev->dev, link_num + 1, sizeof(*links), GFP_KERNEL); + links = devm_kzalloc_objs(sdev->dev, *links, link_num + 1); if (!links) return NULL; diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index e6d8894b8ef6..8c6c1f71d7cc 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -148,7 +148,7 @@ struct snd_sof_ipc *snd_sof_ipc_init(struct snd_sof_dev *sdev) struct snd_sof_ipc_msg *msg; const struct sof_ipc_ops *ops; - ipc = devm_kzalloc(sdev->dev, sizeof(*ipc), GFP_KERNEL); + ipc = devm_kzalloc_obj(sdev->dev, *ipc); if (!ipc) return NULL; diff --git a/sound/soc/sof/ipc3-dtrace.c b/sound/soc/sof/ipc3-dtrace.c index e8c998c09dc3..71a3ae19a5bb 100644 --- a/sound/soc/sof/ipc3-dtrace.c +++ b/sound/soc/sof/ipc3-dtrace.c @@ -232,7 +232,7 @@ static int debugfs_create_trace_filter(struct snd_sof_dev *sdev) { struct snd_sof_dfsentry *dfse; - dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); + dfse = devm_kzalloc_obj(sdev->dev, *dfse); if (!dfse) return -ENOMEM; @@ -409,7 +409,7 @@ static int debugfs_create_dtrace(struct snd_sof_dev *sdev) if (ret < 0) dev_warn(sdev->dev, "failed to create filter debugfs file: %d", ret); - dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); + dfse = devm_kzalloc_obj(sdev->dev, *dfse); if (!dfse) return -ENOMEM; @@ -506,7 +506,7 @@ static int ipc3_dtrace_init(struct snd_sof_dev *sdev) return -EBUSY; } - priv = devm_kzalloc(sdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(sdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/sof/ipc4-loader.c b/sound/soc/sof/ipc4-loader.c index 2dff394f4128..341938b6a57f 100644 --- a/sound/soc/sof/ipc4-loader.c +++ b/sound/soc/sof/ipc4-loader.c @@ -88,8 +88,8 @@ static ssize_t sof_ipc4_fw_parse_ext_man(struct snd_sof_dev *sdev, sdev->fw_version.build = fw_header->build_version; } - fw_lib->modules = devm_kmalloc_array(sdev->dev, fw_header->num_module_entries, - sizeof(*fw_module), GFP_KERNEL); + fw_lib->modules = devm_kmalloc_objs(sdev->dev, *fw_module, + fw_header->num_module_entries); if (!fw_lib->modules) return -ENOMEM; @@ -149,7 +149,7 @@ static size_t sof_ipc4_fw_parse_basefw_ext_man(struct snd_sof_dev *sdev) ssize_t payload_offset; int ret; - fw_lib = devm_kzalloc(sdev->dev, sizeof(*fw_lib), GFP_KERNEL); + fw_lib = devm_kzalloc_obj(sdev->dev, *fw_lib); if (!fw_lib) return -ENOMEM; @@ -182,7 +182,7 @@ static int sof_ipc4_load_library(struct snd_sof_dev *sdev, unsigned long lib_id, return -EOPNOTSUPP; } - fw_lib = devm_kzalloc(sdev->dev, sizeof(*fw_lib), GFP_KERNEL); + fw_lib = devm_kzalloc_obj(sdev->dev, *fw_lib); if (!fw_lib) return -ENOMEM; diff --git a/sound/soc/sof/ipc4-mtrace.c b/sound/soc/sof/ipc4-mtrace.c index cfd999b42458..064291e26974 100644 --- a/sound/soc/sof/ipc4-mtrace.c +++ b/sound/soc/sof/ipc4-mtrace.c @@ -547,8 +547,7 @@ static int ipc4_mtrace_init(struct snd_sof_dev *sdev) return 0; } - priv = devm_kzalloc(sdev->dev, struct_size(priv, cores, sdev->num_cores), - GFP_KERNEL); + priv = devm_kzalloc_flex(sdev->dev, *priv, cores, sdev->num_cores); if (!priv) return -ENOMEM; diff --git a/sound/soc/sof/ipc4-telemetry.c b/sound/soc/sof/ipc4-telemetry.c index ddc3bc494ffe..66f45954cb91 100644 --- a/sound/soc/sof/ipc4-telemetry.c +++ b/sound/soc/sof/ipc4-telemetry.c @@ -80,7 +80,7 @@ void sof_ipc4_create_exception_debugfs_node(struct snd_sof_dev *sdev) { struct snd_sof_dfsentry *dfse; - dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); + dfse = devm_kzalloc_obj(sdev->dev, *dfse); if (!dfse) return; diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c index 8b13c97b3480..c2b729186743 100644 --- a/sound/soc/sof/ipc4-topology.c +++ b/sound/soc/sof/ipc4-topology.c @@ -4162,7 +4162,7 @@ static int sof_ipc4_parse_manifest(struct snd_soc_component *scomp, int index, switch (le32_to_cpu(manifest_tlv->type)) { case SOF_MANIFEST_DATA_TYPE_NHLT: /* Get the nhlt from topology manifest */ - tplg_nhlt = devm_kzalloc(sdev->dev, sizeof(*tplg_nhlt), GFP_KERNEL); + tplg_nhlt = devm_kzalloc_obj(sdev->dev, *tplg_nhlt); if (!tplg_nhlt) return -ENOMEM; diff --git a/sound/soc/sof/mediatek/mt8186/mt8186-clk.c b/sound/soc/sof/mediatek/mt8186/mt8186-clk.c index cb2ab5884b8c..4b82637fc582 100644 --- a/sound/soc/sof/mediatek/mt8186/mt8186-clk.c +++ b/sound/soc/sof/mediatek/mt8186/mt8186-clk.c @@ -27,7 +27,7 @@ int mt8186_adsp_init_clock(struct snd_sof_dev *sdev) struct device *dev = sdev->dev; int i; - priv->clk = devm_kcalloc(dev, ADSP_CLK_MAX, sizeof(*priv->clk), GFP_KERNEL); + priv->clk = devm_kzalloc_objs(dev, *priv->clk, ADSP_CLK_MAX); if (!priv->clk) return -ENOMEM; diff --git a/sound/soc/sof/mediatek/mt8186/mt8186.c b/sound/soc/sof/mediatek/mt8186/mt8186.c index a5ccee87e684..5d3b8bf766d5 100644 --- a/sound/soc/sof/mediatek/mt8186/mt8186.c +++ b/sound/soc/sof/mediatek/mt8186/mt8186.c @@ -188,7 +188,7 @@ static int mt8186_dsp_probe(struct snd_sof_dev *sdev) struct adsp_priv *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; @@ -196,7 +196,7 @@ static int mt8186_dsp_probe(struct snd_sof_dev *sdev) priv->dev = sdev->dev; priv->sdev = sdev; - priv->adsp = devm_kzalloc(&pdev->dev, sizeof(struct mtk_adsp_chip_info), GFP_KERNEL); + priv->adsp = devm_kzalloc_obj(&pdev->dev, struct mtk_adsp_chip_info); if (!priv->adsp) return -ENOMEM; diff --git a/sound/soc/sof/mediatek/mt8195/mt8195-clk.c b/sound/soc/sof/mediatek/mt8195/mt8195-clk.c index 2c2c4cd323fc..e1965f2ad033 100644 --- a/sound/soc/sof/mediatek/mt8195/mt8195-clk.c +++ b/sound/soc/sof/mediatek/mt8195/mt8195-clk.c @@ -29,7 +29,7 @@ int mt8195_adsp_init_clock(struct snd_sof_dev *sdev) struct adsp_priv *priv = sdev->pdata->hw_pdata; int i; - priv->clk = devm_kcalloc(dev, ADSP_CLK_MAX, sizeof(*priv->clk), GFP_KERNEL); + priv->clk = devm_kzalloc_objs(dev, *priv->clk, ADSP_CLK_MAX); if (!priv->clk) return -ENOMEM; diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c index e4b6b6c18e02..ee9be49014f1 100644 --- a/sound/soc/sof/mediatek/mt8195/mt8195.c +++ b/sound/soc/sof/mediatek/mt8195/mt8195.c @@ -178,7 +178,7 @@ static int mt8195_dsp_probe(struct snd_sof_dev *sdev) struct adsp_priv *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; @@ -186,7 +186,7 @@ static int mt8195_dsp_probe(struct snd_sof_dev *sdev) priv->dev = sdev->dev; priv->sdev = sdev; - priv->adsp = devm_kzalloc(&pdev->dev, sizeof(struct mtk_adsp_chip_info), GFP_KERNEL); + priv->adsp = devm_kzalloc_obj(&pdev->dev, struct mtk_adsp_chip_info); if (!priv->adsp) return -ENOMEM; diff --git a/sound/soc/sof/nocodec.c b/sound/soc/sof/nocodec.c index 34744f8ae34a..ab0cd0a24d75 100644 --- a/sound/soc/sof/nocodec.c +++ b/sound/soc/sof/nocodec.c @@ -32,7 +32,7 @@ static int sof_nocodec_bes_setup(struct device *dev, /* set up BE dai_links */ for (i = 0; i < link_num; i++) { - dlc = devm_kcalloc(dev, 2, sizeof(*dlc), GFP_KERNEL); + dlc = devm_kzalloc_objs(dev, *dlc, 2); if (!dlc) return -ENOMEM; @@ -75,7 +75,7 @@ static int sof_nocodec_setup(struct device *dev, struct snd_soc_acpi_mach *mach) struct snd_soc_dai_link *links; /* create dummy BE dai_links */ - links = devm_kcalloc(dev, num_dai_drivers, sizeof(struct snd_soc_dai_link), GFP_KERNEL); + links = devm_kzalloc_objs(dev, struct snd_soc_dai_link, num_dai_drivers); if (!links) return -ENOMEM; diff --git a/sound/soc/sof/sof-acpi-dev.c b/sound/soc/sof/sof-acpi-dev.c index 68bf1b57093e..f84aa3ec3039 100644 --- a/sound/soc/sof/sof-acpi-dev.c +++ b/sound/soc/sof/sof-acpi-dev.c @@ -62,7 +62,7 @@ int sof_acpi_probe(struct platform_device *pdev, const struct sof_dev_desc *desc dev_dbg(dev, "ACPI DSP detected"); - sof_pdata = devm_kzalloc(dev, sizeof(*sof_pdata), GFP_KERNEL); + sof_pdata = devm_kzalloc_obj(dev, *sof_pdata); if (!sof_pdata) return -ENOMEM; diff --git a/sound/soc/sof/sof-client-ipc-flood-test.c b/sound/soc/sof/sof-client-ipc-flood-test.c index 2396cc35489a..0e8a0262b795 100644 --- a/sound/soc/sof/sof-client-ipc-flood-test.c +++ b/sound/soc/sof/sof-client-ipc-flood-test.c @@ -290,7 +290,7 @@ static int sof_ipc_flood_probe(struct auxiliary_device *auxdev, struct sof_ipc_flood_priv *priv; /* allocate memory for client data */ - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/sof/sof-client-ipc-kernel-injector.c b/sound/soc/sof/sof-client-ipc-kernel-injector.c index 02d0d97ad1a0..b5bca9258f42 100644 --- a/sound/soc/sof/sof-client-ipc-kernel-injector.c +++ b/sound/soc/sof/sof-client-ipc-kernel-injector.c @@ -98,7 +98,7 @@ static int sof_msg_inject_probe(struct auxiliary_device *auxdev, size_t alloc_size; /* allocate memory for client data */ - priv = devm_kzalloc(&auxdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&auxdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/sof/sof-client-ipc-msg-injector.c b/sound/soc/sof/sof-client-ipc-msg-injector.c index 932ab459c079..c98307cf7eee 100644 --- a/sound/soc/sof/sof-client-ipc-msg-injector.c +++ b/sound/soc/sof/sof-client-ipc-msg-injector.c @@ -261,7 +261,7 @@ static int sof_msg_inject_probe(struct auxiliary_device *auxdev, size_t alloc_size; /* allocate memory for client data */ - priv = devm_kzalloc(&auxdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&auxdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/sof/sof-client-probes.c b/sound/soc/sof/sof-client-probes.c index 124f55508159..286486945abd 100644 --- a/sound/soc/sof/sof-client-probes.c +++ b/sound/soc/sof/sof-client-probes.c @@ -461,7 +461,7 @@ static int sof_probes_client_probe(struct auxiliary_device *auxdev, return -ENODEV; } - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; @@ -510,8 +510,8 @@ static int sof_probes_client_probe(struct auxiliary_device *auxdev, priv->dfs_points = debugfs_create_file("probe_points_available", 0644, dfsroot, cdev, &sof_probes_available_points_fops); - links = devm_kcalloc(dev, SOF_PROBES_NUM_DAI_LINKS, sizeof(*links), GFP_KERNEL); - cpus = devm_kcalloc(dev, SOF_PROBES_NUM_DAI_LINKS, sizeof(*cpus), GFP_KERNEL); + links = devm_kzalloc_objs(dev, *links, SOF_PROBES_NUM_DAI_LINKS); + cpus = devm_kzalloc_objs(dev, *cpus, SOF_PROBES_NUM_DAI_LINKS); if (!links || !cpus) { debugfs_remove(priv->dfs_points); debugfs_remove(priv->dfs_points_remove); diff --git a/sound/soc/sof/sof-of-dev.c b/sound/soc/sof/sof-of-dev.c index 3ccfcfb142b7..7a7be615e1d9 100644 --- a/sound/soc/sof/sof-of-dev.c +++ b/sound/soc/sof/sof-of-dev.c @@ -55,7 +55,7 @@ int sof_of_probe(struct platform_device *pdev) dev_info(&pdev->dev, "DT DSP detected"); - sof_pdata = devm_kzalloc(dev, sizeof(*sof_pdata), GFP_KERNEL); + sof_pdata = devm_kzalloc_obj(dev, *sof_pdata); if (!sof_pdata) return -ENOMEM; diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c index c50249aadea9..12c7ff389ba0 100644 --- a/sound/soc/sof/sof-pci-dev.c +++ b/sound/soc/sof/sof-pci-dev.c @@ -208,7 +208,7 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) return -ENODEV; } - sof_pdata = devm_kzalloc(dev, sizeof(*sof_pdata), GFP_KERNEL); + sof_pdata = devm_kzalloc_obj(dev, *sof_pdata); if (!sof_pdata) return -ENOMEM; diff --git a/sound/soc/sophgo/cv1800b-sound-adc.c b/sound/soc/sophgo/cv1800b-sound-adc.c index bd93e261bdd1..5ad4ff52e2c8 100644 --- a/sound/soc/sophgo/cv1800b-sound-adc.c +++ b/sound/soc/sophgo/cv1800b-sound-adc.c @@ -288,7 +288,7 @@ static int cv1800b_adc_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct cv1800b_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/sophgo/cv1800b-sound-dac.c b/sound/soc/sophgo/cv1800b-sound-dac.c index 135322bcf6ad..014a37d971f1 100644 --- a/sound/soc/sophgo/cv1800b-sound-dac.c +++ b/sound/soc/sophgo/cv1800b-sound-dac.c @@ -173,7 +173,7 @@ static int cv1800b_dac_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct cv1800b_priv *priv; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/sophgo/cv1800b-tdm.c b/sound/soc/sophgo/cv1800b-tdm.c index 4badb6e3e08b..a70b7281b015 100644 --- a/sound/soc/sophgo/cv1800b-tdm.c +++ b/sound/soc/sophgo/cv1800b-tdm.c @@ -638,7 +638,7 @@ static int cv1800b_i2s_probe(struct platform_device *pdev) void __iomem *regs; int ret; - i2s = devm_kzalloc(dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(dev, *i2s); if (!i2s) return -ENOMEM; diff --git a/sound/soc/spacemit/k1_i2s.c b/sound/soc/spacemit/k1_i2s.c index 28a762769253..6e68decd0c27 100644 --- a/sound/soc/spacemit/k1_i2s.c +++ b/sound/soc/spacemit/k1_i2s.c @@ -425,7 +425,7 @@ static int spacemit_i2s_probe(struct platform_device *pdev) struct clk *clk; int ret; - i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(&pdev->dev, *i2s); if (!i2s) return -ENOMEM; diff --git a/sound/soc/spear/spdif_in.c b/sound/soc/spear/spdif_in.c index dd1e176193af..5d4c908ca4d0 100644 --- a/sound/soc/spear/spdif_in.c +++ b/sound/soc/spear/spdif_in.c @@ -212,7 +212,7 @@ static int spdif_in_probe(struct platform_device *pdev) if (!res_fifo) return -EINVAL; - host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(&pdev->dev, *host); if (!host) return -ENOMEM; diff --git a/sound/soc/spear/spdif_out.c b/sound/soc/spear/spdif_out.c index 01dc2cef7448..bddd49fc7b32 100644 --- a/sound/soc/spear/spdif_out.c +++ b/sound/soc/spear/spdif_out.c @@ -282,7 +282,7 @@ static int spdif_out_probe(struct platform_device *pdev) struct resource *res; int ret; - host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(&pdev->dev, *host); if (!host) return -ENOMEM; diff --git a/sound/soc/sprd/sprd-mcdt.c b/sound/soc/sprd/sprd-mcdt.c index d9a7bbd6c0b6..289e95ce15ab 100644 --- a/sound/soc/sprd/sprd-mcdt.c +++ b/sound/soc/sprd/sprd-mcdt.c @@ -913,7 +913,7 @@ static int sprd_mcdt_probe(struct platform_device *pdev) struct resource *res; int ret, irq; - mcdt = devm_kzalloc(&pdev->dev, sizeof(*mcdt), GFP_KERNEL); + mcdt = devm_kzalloc_obj(&pdev->dev, *mcdt); if (!mcdt) return -ENOMEM; diff --git a/sound/soc/sprd/sprd-pcm-compress.c b/sound/soc/sprd/sprd-pcm-compress.c index f790b959cd4e..69f920c6ecda 100644 --- a/sound/soc/sprd/sprd-pcm-compress.c +++ b/sound/soc/sprd/sprd-pcm-compress.c @@ -341,7 +341,7 @@ static int sprd_platform_compr_open(struct snd_soc_component *component, if (ret) return ret; - stream = devm_kzalloc(dev, sizeof(*stream), GFP_KERNEL); + stream = devm_kzalloc_obj(dev, *stream); if (!stream) return -ENOMEM; diff --git a/sound/soc/sprd/sprd-pcm-dma.c b/sound/soc/sprd/sprd-pcm-dma.c index bbd7516f8195..9bc1fe956c89 100644 --- a/sound/soc/sprd/sprd-pcm-dma.c +++ b/sound/soc/sprd/sprd-pcm-dma.c @@ -74,7 +74,7 @@ static int sprd_pcm_open(struct snd_soc_component *component, if (ret < 0) return ret; - dma_private = devm_kzalloc(dev, sizeof(*dma_private), GFP_KERNEL); + dma_private = devm_kzalloc_obj(dev, *dma_private); if (!dma_private) return -ENOMEM; @@ -219,7 +219,7 @@ static int sprd_pcm_hw_params(struct snd_soc_component *component, sg_num = totsize / period; dma_private->dma_addr_offset = totsize / channels; - sg = devm_kcalloc(component->dev, sg_num, sizeof(*sg), GFP_KERNEL); + sg = devm_kzalloc_objs(component->dev, *sg, sg_num); if (!sg) { ret = -ENOMEM; goto sg_err; diff --git a/sound/soc/starfive/jh7110_pwmdac.c b/sound/soc/starfive/jh7110_pwmdac.c index 5953c3a4e373..329932b1997c 100644 --- a/sound/soc/starfive/jh7110_pwmdac.c +++ b/sound/soc/starfive/jh7110_pwmdac.c @@ -446,7 +446,7 @@ static int jh7110_pwmdac_probe(struct platform_device *pdev) struct resource *res; int ret; - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, *dev); if (!dev) return -ENOMEM; diff --git a/sound/soc/starfive/jh7110_tdm.c b/sound/soc/starfive/jh7110_tdm.c index f7522bfbe8e6..44971cf99446 100644 --- a/sound/soc/starfive/jh7110_tdm.c +++ b/sound/soc/starfive/jh7110_tdm.c @@ -576,7 +576,7 @@ static int jh7110_tdm_probe(struct platform_device *pdev) struct jh7110_tdm_dev *tdm; int ret; - tdm = devm_kzalloc(&pdev->dev, sizeof(*tdm), GFP_KERNEL); + tdm = devm_kzalloc_obj(&pdev->dev, *tdm); if (!tdm) return -ENOMEM; diff --git a/sound/soc/sti/sti_uniperif.c b/sound/soc/sti/sti_uniperif.c index a7956e5a4ee5..3fbd9fee94ac 100644 --- a/sound/soc/sti/sti_uniperif.c +++ b/sound/soc/sti/sti_uniperif.c @@ -405,7 +405,7 @@ static int sti_uniperiph_cpu_dai_of(struct device_node *node, } dev_data = (struct sti_uniperiph_dev_data *)of_id->data; - uni = devm_kzalloc(dev, sizeof(*uni), GFP_KERNEL); + uni = devm_kzalloc_obj(dev, *uni); if (!uni) return -ENOMEM; @@ -468,10 +468,10 @@ static int sti_uniperiph_probe(struct platform_device *pdev) int ret; /* Allocate the private data and the CPU_DAI array */ - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; - priv->dai = devm_kzalloc(&pdev->dev, sizeof(*priv->dai), GFP_KERNEL); + priv->dai = devm_kzalloc_obj(&pdev->dev, *priv->dai); if (!priv->dai) return -ENOMEM; diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c index 018f775f36bb..a9917475e969 100644 --- a/sound/soc/stm/stm32_adfsdm.c +++ b/sound/soc/stm/stm32_adfsdm.c @@ -326,7 +326,7 @@ static int stm32_adfsdm_probe(struct platform_device *pdev) struct stm32_adfsdm_priv *priv; int ret; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/stm/stm32_i2s.c b/sound/soc/stm/stm32_i2s.c index 22196f789ae4..79465be82cb8 100644 --- a/sound/soc/stm/stm32_i2s.c +++ b/sound/soc/stm/stm32_i2s.c @@ -545,7 +545,7 @@ static int stm32_i2s_add_mclk_provider(struct stm32_i2s_data *i2s) char *mclk_name, *p, *s = (char *)pname; int ret, i = 0; - mclk = devm_kzalloc(dev, sizeof(*mclk), GFP_KERNEL); + mclk = devm_kzalloc_obj(dev, *mclk); if (!mclk) return -ENOMEM; @@ -1147,8 +1147,7 @@ static int stm32_i2s_dais_init(struct platform_device *pdev, { struct snd_soc_dai_driver *dai_ptr; - dai_ptr = devm_kzalloc(&pdev->dev, sizeof(struct snd_soc_dai_driver), - GFP_KERNEL); + dai_ptr = devm_kzalloc_obj(&pdev->dev, struct snd_soc_dai_driver); if (!dai_ptr) return -ENOMEM; @@ -1269,7 +1268,7 @@ static int stm32_i2s_probe(struct platform_device *pdev) u32 val; int irq, ret; - i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(&pdev->dev, *i2s); if (!i2s) return -ENOMEM; diff --git a/sound/soc/stm/stm32_sai.c b/sound/soc/stm/stm32_sai.c index 00cf24ceca2d..c5d092d07b82 100644 --- a/sound/soc/stm/stm32_sai.c +++ b/sound/soc/stm/stm32_sai.c @@ -183,7 +183,7 @@ static int stm32_sai_probe(struct platform_device *pdev) u32 val; int ret; - sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL); + sai = devm_kzalloc_obj(&pdev->dev, *sai); if (!sai) return -ENOMEM; diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c index d00377efe3f9..5d88507b4d0f 100644 --- a/sound/soc/stm/stm32_sai_sub.c +++ b/sound/soc/stm/stm32_sai_sub.c @@ -571,7 +571,7 @@ static int stm32_sai_add_mclk_provider(struct stm32_sai_sub_data *sai) char *mclk_name, *p, *s = (char *)pname; int ret, i = 0; - mclk = devm_kzalloc(dev, sizeof(*mclk), GFP_KERNEL); + mclk = devm_kzalloc_obj(dev, *mclk); if (!mclk) return -ENOMEM; @@ -1675,7 +1675,7 @@ static int stm32_sai_sub_probe(struct platform_device *pdev) const struct snd_dmaengine_pcm_config *conf = &stm32_sai_pcm_config; int ret; - sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL); + sai = devm_kzalloc_obj(&pdev->dev, *sai); if (!sai) return -ENOMEM; diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c index 88863dbd05d9..a743bf06fa54 100644 --- a/sound/soc/stm/stm32_spdifrx.c +++ b/sound/soc/stm/stm32_spdifrx.c @@ -402,8 +402,7 @@ static int stm32_spdifrx_dma_ctrl_register(struct device *dev, return dev_err_probe(dev, PTR_ERR(spdifrx->ctrl_chan), "dma_request_chan error\n"); - spdifrx->dmab = devm_kzalloc(dev, sizeof(struct snd_dma_buffer), - GFP_KERNEL); + spdifrx->dmab = devm_kzalloc_obj(dev, struct snd_dma_buffer); if (!spdifrx->dmab) return -ENOMEM; @@ -946,7 +945,7 @@ static int stm32_spdifrx_probe(struct platform_device *pdev) u32 ver, idr; int ret; - spdifrx = devm_kzalloc(&pdev->dev, sizeof(*spdifrx), GFP_KERNEL); + spdifrx = devm_kzalloc_obj(&pdev->dev, *spdifrx); if (!spdifrx) return -ENOMEM; diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index ff56700a9fe9..9d5bc3d7b4df 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c @@ -1631,8 +1631,7 @@ static int sun4i_codec_machine_init(struct snd_soc_pcm_runtime *rtd) static struct snd_soc_dai_link *sun4i_codec_create_link(struct device *dev, int *num_links) { - struct snd_soc_dai_link *link = devm_kzalloc(dev, sizeof(*link), - GFP_KERNEL); + struct snd_soc_dai_link *link = devm_kzalloc_obj(dev, *link); struct snd_soc_dai_link_component *dlc = devm_kzalloc(dev, 3 * sizeof(*dlc), GFP_KERNEL); if (!link || !dlc) @@ -1694,7 +1693,7 @@ static struct snd_soc_card *sun4i_codec_create_card(struct device *dev) { struct snd_soc_card *card; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return ERR_PTR(-ENOMEM); @@ -1727,7 +1726,7 @@ static struct snd_soc_card *sun6i_codec_create_card(struct device *dev) struct snd_soc_card *card; int ret; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return ERR_PTR(-ENOMEM); @@ -1773,7 +1772,7 @@ static struct snd_soc_card *sun8i_a23_codec_create_card(struct device *dev) struct snd_soc_card *card; int ret; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return ERR_PTR(-ENOMEM); @@ -1812,7 +1811,7 @@ static struct snd_soc_card *sun8i_h3_codec_create_card(struct device *dev) struct snd_soc_card *card; int ret; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return ERR_PTR(-ENOMEM); @@ -1851,7 +1850,7 @@ static struct snd_soc_card *sun8i_v3s_codec_create_card(struct device *dev) struct snd_soc_card *card; int ret; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return ERR_PTR(-ENOMEM); @@ -2000,7 +1999,7 @@ static struct snd_soc_card *sun50i_h616_codec_create_card(struct device *dev) struct snd_soc_card *card; int ret; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return ERR_PTR(-ENOMEM); @@ -2058,7 +2057,7 @@ static struct snd_soc_card *suniv_codec_create_card(struct device *dev) struct snd_soc_card *card; int ret; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return ERR_PTR(-ENOMEM); @@ -2299,7 +2298,7 @@ static int sun4i_codec_probe(struct platform_device *pdev) void __iomem *base; int ret; - scodec = devm_kzalloc(&pdev->dev, sizeof(*scodec), GFP_KERNEL); + scodec = devm_kzalloc_obj(&pdev->dev, *scodec); if (!scodec) return -ENOMEM; diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index 43e6ea2563fe..83ed04b7216e 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -1543,7 +1543,7 @@ static int sun4i_i2s_probe(struct platform_device *pdev) void __iomem *regs; int irq, ret; - i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(&pdev->dev, *i2s); if (!i2s) return -ENOMEM; platform_set_drvdata(pdev, i2s); diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c index d979bb00312f..423423797f47 100644 --- a/sound/soc/sunxi/sun4i-spdif.c +++ b/sound/soc/sunxi/sun4i-spdif.c @@ -659,7 +659,7 @@ static int sun4i_spdif_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "Entered %s\n", __func__); - host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(&pdev->dev, *host); if (!host) return -ENOMEM; diff --git a/sound/soc/sunxi/sun50i-dmic.c b/sound/soc/sunxi/sun50i-dmic.c index 5c784b1f6846..c27f1458563d 100644 --- a/sound/soc/sunxi/sun50i-dmic.c +++ b/sound/soc/sunxi/sun50i-dmic.c @@ -345,7 +345,7 @@ static int sun50i_dmic_probe(struct platform_device *pdev) int ret; void __iomem *base; - host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); + host = devm_kzalloc_obj(&pdev->dev, *host); if (!host) return -ENOMEM; diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c index 2e4a205e4e56..ae146495e43c 100644 --- a/sound/soc/sunxi/sun8i-codec.c +++ b/sound/soc/sunxi/sun8i-codec.c @@ -1621,7 +1621,7 @@ static int sun8i_codec_probe(struct platform_device *pdev) void __iomem *base; int ret; - scodec = devm_kzalloc(&pdev->dev, sizeof(*scodec), GFP_KERNEL); + scodec = devm_kzalloc_obj(&pdev->dev, *scodec); if (!scodec) return -ENOMEM; diff --git a/sound/soc/tegra/tegra186_asrc.c b/sound/soc/tegra/tegra186_asrc.c index d8ae5d997615..e7e9dba79504 100644 --- a/sound/soc/tegra/tegra186_asrc.c +++ b/sound/soc/tegra/tegra186_asrc.c @@ -976,7 +976,7 @@ static int tegra186_asrc_platform_probe(struct platform_device *pdev) unsigned int i; int err; - asrc = devm_kzalloc(dev, sizeof(*asrc), GFP_KERNEL); + asrc = devm_kzalloc_obj(dev, *asrc); if (!asrc) return -ENOMEM; diff --git a/sound/soc/tegra/tegra186_dspk.c b/sound/soc/tegra/tegra186_dspk.c index 0d3807b231f3..8896f4f937f6 100644 --- a/sound/soc/tegra/tegra186_dspk.c +++ b/sound/soc/tegra/tegra186_dspk.c @@ -483,7 +483,7 @@ static int tegra186_dspk_platform_probe(struct platform_device *pdev) void __iomem *regs; int err; - dspk = devm_kzalloc(dev, sizeof(*dspk), GFP_KERNEL); + dspk = devm_kzalloc_obj(dev, *dspk); if (!dspk) return -ENOMEM; diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c index 0df1fc64f532..e48157d8e092 100644 --- a/sound/soc/tegra/tegra20_ac97.c +++ b/sound/soc/tegra/tegra20_ac97.c @@ -305,8 +305,7 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) void __iomem *regs; int ret = 0; - ac97 = devm_kzalloc(&pdev->dev, sizeof(struct tegra20_ac97), - GFP_KERNEL); + ac97 = devm_kzalloc_obj(&pdev->dev, struct tegra20_ac97); if (!ac97) { ret = -ENOMEM; goto err; diff --git a/sound/soc/tegra/tegra20_das.c b/sound/soc/tegra/tegra20_das.c index ea8bc9bcfa67..0fdd65d1cac3 100644 --- a/sound/soc/tegra/tegra20_das.c +++ b/sound/soc/tegra/tegra20_das.c @@ -157,7 +157,7 @@ static int tegra20_das_probe(struct platform_device *pdev) void __iomem *regs; struct tegra20_das *das; - das = devm_kzalloc(&pdev->dev, sizeof(struct tegra20_das), GFP_KERNEL); + das = devm_kzalloc_obj(&pdev->dev, struct tegra20_das); if (!das) return -ENOMEM; diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c index b31f9477cb2e..2978c9d6f483 100644 --- a/sound/soc/tegra/tegra20_i2s.c +++ b/sound/soc/tegra/tegra20_i2s.c @@ -413,7 +413,7 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev) void __iomem *regs; int ret; - i2s = devm_kzalloc(&pdev->dev, sizeof(struct tegra20_i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(&pdev->dev, struct tegra20_i2s); if (!i2s) { ret = -ENOMEM; goto err; diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdif.c index 5eefcf149ae3..b6cb41ef57bc 100644 --- a/sound/soc/tegra/tegra20_spdif.c +++ b/sound/soc/tegra/tegra20_spdif.c @@ -346,8 +346,7 @@ static int tegra20_spdif_platform_probe(struct platform_device *pdev) void __iomem *regs; int ret; - spdif = devm_kzalloc(&pdev->dev, sizeof(struct tegra20_spdif), - GFP_KERNEL); + spdif = devm_kzalloc_obj(&pdev->dev, struct tegra20_spdif); if (!spdif) return -ENOMEM; diff --git a/sound/soc/tegra/tegra210_admaif.c b/sound/soc/tegra/tegra210_admaif.c index 87e898cc35e4..73be3a67db85 100644 --- a/sound/soc/tegra/tegra210_admaif.c +++ b/sound/soc/tegra/tegra210_admaif.c @@ -1003,14 +1003,14 @@ static int tegra_admaif_probe(struct platform_device *pdev) for (i = 0; i < ADMAIF_PATHS; i++) { admaif->mono_to_stereo[i] = - devm_kcalloc(&pdev->dev, admaif->soc_data->num_ch, - sizeof(unsigned int), GFP_KERNEL); + devm_kzalloc_objs(&pdev->dev, unsigned int, + admaif->soc_data->num_ch); if (!admaif->mono_to_stereo[i]) return -ENOMEM; admaif->stereo_to_mono[i] = - devm_kcalloc(&pdev->dev, admaif->soc_data->num_ch, - sizeof(unsigned int), GFP_KERNEL); + devm_kzalloc_objs(&pdev->dev, unsigned int, + admaif->soc_data->num_ch); if (!admaif->stereo_to_mono[i]) return -ENOMEM; } diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c index f2adf1c6e37e..9b2d9f1db511 100644 --- a/sound/soc/tegra/tegra210_adx.c +++ b/sound/soc/tegra/tegra210_adx.c @@ -677,9 +677,8 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev) int err, i; soc_data = of_device_get_match_data(dev); - adx = devm_kzalloc(dev, - struct_size(adx, map, soc_data->ram_depth * TEGRA_ADX_SLOTS_PER_WORD), - GFP_KERNEL); + adx = devm_kzalloc_flex(dev, *adx, map, + soc_data->ram_depth * TEGRA_ADX_SLOTS_PER_WORD); if (!adx) return -ENOMEM; @@ -699,8 +698,8 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev) regcache_cache_only(adx->regmap, true); - adx->byte_mask = devm_kcalloc(dev, soc_data->byte_mask_size, - sizeof(*adx->byte_mask), GFP_KERNEL); + adx->byte_mask = devm_kzalloc_objs(dev, *adx->byte_mask, + soc_data->byte_mask_size); if (!adx->byte_mask) return -ENOMEM; diff --git a/sound/soc/tegra/tegra210_ahub.c b/sound/soc/tegra/tegra210_ahub.c index efc8f3388668..1b65b8e7b1ce 100644 --- a/sound/soc/tegra/tegra210_ahub.c +++ b/sound/soc/tegra/tegra210_ahub.c @@ -2258,7 +2258,7 @@ static int tegra_ahub_probe(struct platform_device *pdev) void __iomem *regs; int err; - ahub = devm_kzalloc(&pdev->dev, sizeof(*ahub), GFP_KERNEL); + ahub = devm_kzalloc_obj(&pdev->dev, *ahub); if (!ahub) return -ENOMEM; diff --git a/sound/soc/tegra/tegra210_amx.c b/sound/soc/tegra/tegra210_amx.c index 6a67ce6128b4..2288656a3278 100644 --- a/sound/soc/tegra/tegra210_amx.c +++ b/sound/soc/tegra/tegra210_amx.c @@ -726,7 +726,7 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev) void __iomem *regs; int err, i; - amx = devm_kzalloc(dev, sizeof(*amx), GFP_KERNEL); + amx = devm_kzalloc_obj(dev, *amx); if (!amx) return -ENOMEM; @@ -746,14 +746,13 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev) regcache_cache_only(amx->regmap, true); - amx->map = devm_kcalloc(dev, - amx->soc_data->ram_depth * TEGRA_AMX_SLOTS_PER_WORD, - sizeof(*amx->map), GFP_KERNEL); + amx->map = devm_kzalloc_objs(dev, *amx->map, + amx->soc_data->ram_depth * TEGRA_AMX_SLOTS_PER_WORD); if (!amx->map) return -ENOMEM; - amx->byte_mask = devm_kcalloc(dev, amx->soc_data->byte_mask_size, - sizeof(*amx->byte_mask), GFP_KERNEL); + amx->byte_mask = devm_kzalloc_objs(dev, *amx->byte_mask, + amx->soc_data->byte_mask_size); if (!amx->byte_mask) return -ENOMEM; diff --git a/sound/soc/tegra/tegra210_dmic.c b/sound/soc/tegra/tegra210_dmic.c index 6098ad056ba9..3123057abfe8 100644 --- a/sound/soc/tegra/tegra210_dmic.c +++ b/sound/soc/tegra/tegra210_dmic.c @@ -493,7 +493,7 @@ static int tegra210_dmic_probe(struct platform_device *pdev) void __iomem *regs; int err; - dmic = devm_kzalloc(dev, sizeof(*dmic), GFP_KERNEL); + dmic = devm_kzalloc_obj(dev, *dmic); if (!dmic) return -ENOMEM; diff --git a/sound/soc/tegra/tegra210_i2s.c b/sound/soc/tegra/tegra210_i2s.c index f2cfe3b5ccce..72e3cb0ab3c0 100644 --- a/sound/soc/tegra/tegra210_i2s.c +++ b/sound/soc/tegra/tegra210_i2s.c @@ -1084,7 +1084,7 @@ static int tegra210_i2s_probe(struct platform_device *pdev) void __iomem *regs; int err, id; - i2s = devm_kzalloc(dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(dev, *i2s); if (!i2s) return -ENOMEM; diff --git a/sound/soc/tegra/tegra210_mixer.c b/sound/soc/tegra/tegra210_mixer.c index 96259a6cbc59..1c19c8c35466 100644 --- a/sound/soc/tegra/tegra210_mixer.c +++ b/sound/soc/tegra/tegra210_mixer.c @@ -899,7 +899,7 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev) void __iomem *regs; int err, i; - mixer = devm_kzalloc(dev, sizeof(*mixer), GFP_KERNEL); + mixer = devm_kzalloc_obj(dev, *mixer); if (!mixer) return -ENOMEM; diff --git a/sound/soc/tegra/tegra210_mvc.c b/sound/soc/tegra/tegra210_mvc.c index ac04350107c4..a3f8aeb94cef 100644 --- a/sound/soc/tegra/tegra210_mvc.c +++ b/sound/soc/tegra/tegra210_mvc.c @@ -718,7 +718,7 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev) void __iomem *regs; int err; - mvc = devm_kzalloc(dev, sizeof(*mvc), GFP_KERNEL); + mvc = devm_kzalloc_obj(dev, *mvc); if (!mvc) return -ENOMEM; diff --git a/sound/soc/tegra/tegra210_ope.c b/sound/soc/tegra/tegra210_ope.c index 30a54b1222d9..fe7ce939aae0 100644 --- a/sound/soc/tegra/tegra210_ope.c +++ b/sound/soc/tegra/tegra210_ope.c @@ -307,7 +307,7 @@ static int tegra210_ope_probe(struct platform_device *pdev) void __iomem *regs; int err; - ope = devm_kzalloc(dev, sizeof(*ope), GFP_KERNEL); + ope = devm_kzalloc_obj(dev, *ope); if (!ope) return -ENOMEM; diff --git a/sound/soc/tegra/tegra210_sfc.c b/sound/soc/tegra/tegra210_sfc.c index a4b96445f1da..d86cb2276630 100644 --- a/sound/soc/tegra/tegra210_sfc.c +++ b/sound/soc/tegra/tegra210_sfc.c @@ -3586,7 +3586,7 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev) void __iomem *regs; int err; - sfc = devm_kzalloc(dev, sizeof(*sfc), GFP_KERNEL); + sfc = devm_kzalloc_obj(dev, *sfc); if (!sfc) return -ENOMEM; diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index ee68f28852c4..a542716eb66c 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c @@ -522,8 +522,7 @@ static int tegra30_ahub_probe(struct platform_device *pdev) if (!soc_data) return -EINVAL; - ahub = devm_kzalloc(&pdev->dev, sizeof(struct tegra30_ahub), - GFP_KERNEL); + ahub = devm_kzalloc_obj(&pdev->dev, struct tegra30_ahub); if (!ahub) return -ENOMEM; dev_set_drvdata(&pdev->dev, ahub); diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 69acff73f68a..e5e648d00621 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -422,7 +422,7 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev) void __iomem *regs; int ret; - i2s = devm_kzalloc(&pdev->dev, sizeof(struct tegra30_i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(&pdev->dev, struct tegra30_i2s); if (!i2s) { ret = -ENOMEM; goto err; diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c index e2d0e5947339..c4e62e2b7fd0 100644 --- a/sound/soc/tegra/tegra_asoc_machine.c +++ b/sound/soc/tegra/tegra_asoc_machine.c @@ -455,7 +455,7 @@ int tegra_asoc_machine_probe(struct platform_device *pdev) struct gpio_desc *gpiod; int err; - machine = devm_kzalloc(dev, sizeof(*machine), GFP_KERNEL); + machine = devm_kzalloc_obj(dev, *machine); if (!machine) return -ENOMEM; diff --git a/sound/soc/tegra/tegra_audio_graph_card.c b/sound/soc/tegra/tegra_audio_graph_card.c index b93a61db9ed0..5cd3e30be94b 100644 --- a/sound/soc/tegra/tegra_audio_graph_card.c +++ b/sound/soc/tegra/tegra_audio_graph_card.c @@ -199,7 +199,7 @@ static int tegra_audio_graph_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct snd_soc_card *card; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc_obj(dev, *priv); if (!priv) return -ENOMEM; diff --git a/sound/soc/tegra/tegra_isomgr_bw.c b/sound/soc/tegra/tegra_isomgr_bw.c index 1c007f870759..bc6782638ced 100644 --- a/sound/soc/tegra/tegra_isomgr_bw.c +++ b/sound/soc/tegra/tegra_isomgr_bw.c @@ -82,7 +82,7 @@ int tegra_isomgr_adma_register(struct device *dev) struct tegra_adma_isomgr *adma_isomgr; int i; - adma_isomgr = devm_kzalloc(dev, sizeof(struct tegra_adma_isomgr), GFP_KERNEL); + adma_isomgr = devm_kzalloc_obj(dev, struct tegra_adma_isomgr); if (!adma_isomgr) return -ENOMEM; diff --git a/sound/soc/ti/davinci-evm.c b/sound/soc/ti/davinci-evm.c index 3156d87a3a12..c1c2cd51d6f6 100644 --- a/sound/soc/ti/davinci-evm.c +++ b/sound/soc/ti/davinci-evm.c @@ -215,7 +215,7 @@ static int davinci_evm_probe(struct platform_device *pdev) mclk = NULL; } - drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, *drvdata); if (!drvdata) { ret = -ENOMEM; goto err_put; diff --git a/sound/soc/ti/davinci-i2s.c b/sound/soc/ti/davinci-i2s.c index 3614f614117d..287e4c0ea7e9 100644 --- a/sound/soc/ti/davinci-i2s.c +++ b/sound/soc/ti/davinci-i2s.c @@ -813,8 +813,7 @@ static int davinci_i2s_probe(struct platform_device *pdev) if (IS_ERR(io_base)) return PTR_ERR(io_base); - dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_mcbsp_dev), - GFP_KERNEL); + dev = devm_kzalloc_obj(&pdev->dev, struct davinci_mcbsp_dev); if (!dev) return -ENOMEM; diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c index 481d1042ddb6..edec913cfe50 100644 --- a/sound/soc/ti/davinci-mcasp.c +++ b/sound/soc/ti/davinci-mcasp.c @@ -2452,9 +2452,8 @@ out: mcasp->num_serializer = pdata->num_serializer; #ifdef CONFIG_PM - mcasp->context.xrsr_regs = devm_kcalloc(&pdev->dev, - mcasp->num_serializer, sizeof(u32), - GFP_KERNEL); + mcasp->context.xrsr_regs = devm_kzalloc_objs(&pdev->dev, u32, + mcasp->num_serializer); if (!mcasp->context.xrsr_regs) return -ENOMEM; #endif @@ -2710,8 +2709,7 @@ static int davinci_mcasp_register_component(struct davinci_mcasp *mcasp, &davinci_mcasp_component, &davinci_mcasp_dai[mcasp->op_mode], 1); - dais = devm_kcalloc(&pdev->dev, mcasp->num_dais, sizeof(*dais), - GFP_KERNEL); + dais = devm_kzalloc_objs(&pdev->dev, *dais, mcasp->num_dais); if (!dais) return -ENOMEM; @@ -2760,8 +2758,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) return -EINVAL; } - mcasp = devm_kzalloc(&pdev->dev, sizeof(struct davinci_mcasp), - GFP_KERNEL); + mcasp = devm_kzalloc_obj(&pdev->dev, struct davinci_mcasp); if (!mcasp) return -ENOMEM; @@ -2902,16 +2899,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev) * bytes. */ mcasp->chconstr[SNDRV_PCM_STREAM_PLAYBACK].list = - devm_kcalloc(mcasp->dev, - 32 + mcasp->num_serializer - 1, - sizeof(unsigned int), - GFP_KERNEL); + devm_kzalloc_objs(mcasp->dev, unsigned int, + 32 + mcasp->num_serializer - 1); mcasp->chconstr[SNDRV_PCM_STREAM_CAPTURE].list = - devm_kcalloc(mcasp->dev, - 32 + mcasp->num_serializer - 1, - sizeof(unsigned int), - GFP_KERNEL); + devm_kzalloc_objs(mcasp->dev, unsigned int, + 32 + mcasp->num_serializer - 1); if (!mcasp->chconstr[SNDRV_PCM_STREAM_PLAYBACK].list || !mcasp->chconstr[SNDRV_PCM_STREAM_CAPTURE].list) { diff --git a/sound/soc/ti/edma-pcm.c b/sound/soc/ti/edma-pcm.c index 634b040b65f0..8133c665b933 100644 --- a/sound/soc/ti/edma-pcm.c +++ b/sound/soc/ti/edma-pcm.c @@ -45,7 +45,7 @@ int edma_pcm_platform_register(struct device *dev) return devm_snd_dmaengine_pcm_register(dev, &edma_dmaengine_pcm_config, 0); - config = devm_kzalloc(dev, sizeof(*config), GFP_KERNEL); + config = devm_kzalloc_obj(dev, *config); if (!config) return -ENOMEM; diff --git a/sound/soc/ti/j721e-evm.c b/sound/soc/ti/j721e-evm.c index 600897a3e1c5..78d73dbed653 100644 --- a/sound/soc/ti/j721e-evm.c +++ b/sound/soc/ti/j721e-evm.c @@ -646,8 +646,7 @@ static int j721e_soc_probe_cpb(struct j721e_priv *priv, int *link_idx, * Link 2: McASP10 <- pcm3168a_1 ADC */ comp_count = 6; - compnent = devm_kcalloc(priv->dev, comp_count, sizeof(*compnent), - GFP_KERNEL); + compnent = devm_kzalloc_objs(priv->dev, *compnent, comp_count); if (!compnent) { ret = -ENOMEM; goto put_codec_node; @@ -760,8 +759,7 @@ static int j721e_soc_probe_ivi(struct j721e_priv *priv, int *link_idx, * \ pcm3168a_b ADC */ comp_count = 8; - compnent = devm_kcalloc(priv->dev, comp_count, sizeof(*compnent), - GFP_KERNEL); + compnent = devm_kzalloc_objs(priv->dev, *compnent, comp_count); if (!compnent) { ret = -ENOMEM; goto put_codecb_node; @@ -850,8 +848,7 @@ static int j721e_soc_probe(struct platform_device *pdev) return -ENODEV; } - priv = devm_kzalloc(&pdev->dev, - struct_size(priv, dai_links, match->num_links), GFP_KERNEL); + priv = devm_kzalloc_flex(&pdev->dev, *priv, dai_links, match->num_links); if (!priv) return -ENOMEM; diff --git a/sound/soc/ti/omap-abe-twl6040.c b/sound/soc/ti/omap-abe-twl6040.c index 05239ccc1f41..8004dd428b08 100644 --- a/sound/soc/ti/omap-abe-twl6040.c +++ b/sound/soc/ti/omap-abe-twl6040.c @@ -222,7 +222,7 @@ static int omap_abe_probe(struct platform_device *pdev) return -ENODEV; } - priv = devm_kzalloc(&pdev->dev, sizeof(struct abe_twl6040), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct abe_twl6040); if (priv == NULL) return -ENOMEM; diff --git a/sound/soc/ti/omap-dmic.c b/sound/soc/ti/omap-dmic.c index c8d791f05ae4..dc54162f2d6b 100644 --- a/sound/soc/ti/omap-dmic.c +++ b/sound/soc/ti/omap-dmic.c @@ -454,7 +454,7 @@ static int asoc_dmic_probe(struct platform_device *pdev) struct resource *res; int ret; - dmic = devm_kzalloc(&pdev->dev, sizeof(struct omap_dmic), GFP_KERNEL); + dmic = devm_kzalloc_obj(&pdev->dev, struct omap_dmic); if (!dmic) return -ENOMEM; diff --git a/sound/soc/ti/omap-hdmi.c b/sound/soc/ti/omap-hdmi.c index 2cabd4cc5b0b..33536bf7c063 100644 --- a/sound/soc/ti/omap-hdmi.c +++ b/sound/soc/ti/omap-hdmi.c @@ -346,7 +346,7 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev) return -EINVAL; } - ad = devm_kzalloc(dev, sizeof(*ad), GFP_KERNEL); + ad = devm_kzalloc_obj(dev, *ad); if (!ad) return -ENOMEM; ad->dssdev = ha->dev; @@ -375,14 +375,14 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev) if (ret) return ret; - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + card = devm_kzalloc_obj(dev, *card); if (!card) return -ENOMEM; card->name = "HDMI"; card->owner = THIS_MODULE; card->dai_link = - devm_kzalloc(dev, sizeof(*(card->dai_link)), GFP_KERNEL); + devm_kzalloc_obj(dev, *(card->dai_link)); if (!card->dai_link) return -ENOMEM; diff --git a/sound/soc/ti/omap-mcbsp-st.c b/sound/soc/ti/omap-mcbsp-st.c index b762d5d3e33b..7c0c23296ec4 100644 --- a/sound/soc/ti/omap-mcbsp-st.c +++ b/sound/soc/ti/omap-mcbsp-st.c @@ -332,7 +332,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev) if (!res) return 0; - st_data = devm_kzalloc(mcbsp->dev, sizeof(*mcbsp->st_data), GFP_KERNEL); + st_data = devm_kzalloc_obj(mcbsp->dev, *mcbsp->st_data); if (!st_data) return -ENOMEM; diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c index 889e357b64d0..6e0c7d7359f4 100644 --- a/sound/soc/ti/omap-mcbsp.c +++ b/sound/soc/ti/omap-mcbsp.c @@ -1389,7 +1389,7 @@ static int asoc_mcbsp_probe(struct platform_device *pdev) dev_err(&pdev->dev, "missing platform data.\n"); return -EINVAL; } - mcbsp = devm_kzalloc(&pdev->dev, sizeof(struct omap_mcbsp), GFP_KERNEL); + mcbsp = devm_kzalloc_obj(&pdev->dev, struct omap_mcbsp); if (!mcbsp) return -ENOMEM; diff --git a/sound/soc/ti/omap-mcpdm.c b/sound/soc/ti/omap-mcpdm.c index 5698d2f26973..85892f8730cb 100644 --- a/sound/soc/ti/omap-mcpdm.c +++ b/sound/soc/ti/omap-mcpdm.c @@ -540,7 +540,7 @@ static int asoc_mcpdm_probe(struct platform_device *pdev) struct resource *res; int ret; - mcpdm = devm_kzalloc(&pdev->dev, sizeof(struct omap_mcpdm), GFP_KERNEL); + mcpdm = devm_kzalloc_obj(&pdev->dev, struct omap_mcpdm); if (!mcpdm) return -ENOMEM; diff --git a/sound/soc/ti/omap-twl4030.c b/sound/soc/ti/omap-twl4030.c index a3ab52b2b64e..b52466dacbcf 100644 --- a/sound/soc/ti/omap-twl4030.c +++ b/sound/soc/ti/omap-twl4030.c @@ -212,7 +212,7 @@ static int omap_twl4030_probe(struct platform_device *pdev) card->dev = &pdev->dev; - priv = devm_kzalloc(&pdev->dev, sizeof(struct omap_twl4030), GFP_KERNEL); + priv = devm_kzalloc_obj(&pdev->dev, struct omap_twl4030); if (priv == NULL) return -ENOMEM; diff --git a/sound/soc/ti/rx51.c b/sound/soc/ti/rx51.c index b4b26cb0cac5..7a626c11fa98 100644 --- a/sound/soc/ti/rx51.c +++ b/sound/soc/ti/rx51.c @@ -410,7 +410,7 @@ static int rx51_soc_probe(struct platform_device *pdev) rx51_codec_conf[1].dlc.of_node = dai_node; } - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc_obj(dev, *pdata); if (pdata == NULL) return -ENOMEM; diff --git a/sound/soc/ti/sdma-pcm.c b/sound/soc/ti/sdma-pcm.c index 9e7691103f05..98474dd6dd66 100644 --- a/sound/soc/ti/sdma-pcm.c +++ b/sound/soc/ti/sdma-pcm.c @@ -44,7 +44,7 @@ int sdma_pcm_platform_register(struct device *dev, return devm_snd_dmaengine_pcm_register(dev, &sdma_dmaengine_pcm_config, 0); - config = devm_kzalloc(dev, sizeof(*config), GFP_KERNEL); + config = devm_kzalloc_obj(dev, *config); if (!config) return -ENOMEM; diff --git a/sound/soc/uniphier/aio-cpu.c b/sound/soc/uniphier/aio-cpu.c index b263526f1990..1d65d9f3b39e 100644 --- a/sound/soc/uniphier/aio-cpu.c +++ b/sound/soc/uniphier/aio-cpu.c @@ -738,7 +738,7 @@ int uniphier_aio_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret, i, j; - chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc_obj(dev, *chip); if (!chip) return -ENOMEM; @@ -764,9 +764,7 @@ int uniphier_aio_probe(struct platform_device *pdev) chip->num_aios = chip->chip_spec->num_dais; chip->num_wup_aios = chip->num_aios; - chip->aios = devm_kcalloc(dev, - chip->num_aios, sizeof(struct uniphier_aio), - GFP_KERNEL); + chip->aios = devm_kzalloc_objs(dev, struct uniphier_aio, chip->num_aios); if (!chip->aios) return -ENOMEM; diff --git a/sound/soc/uniphier/evea.c b/sound/soc/uniphier/evea.c index 7def3e7e0619..d5f29737b945 100644 --- a/sound/soc/uniphier/evea.c +++ b/sound/soc/uniphier/evea.c @@ -453,7 +453,7 @@ static int evea_probe(struct platform_device *pdev) void __iomem *preg; int ret; - evea = devm_kzalloc(&pdev->dev, sizeof(struct evea_priv), GFP_KERNEL); + evea = devm_kzalloc_obj(&pdev->dev, struct evea_priv); if (!evea) return -ENOMEM; diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index c135a77766ca..20466be6f859 100644 --- a/sound/soc/ux500/ux500_msp_dai.c +++ b/sound/soc/ux500/ux500_msp_dai.c @@ -621,15 +621,11 @@ static int ux500_msp_dai_of_probe(struct snd_soc_dai *dai) struct snd_dmaengine_dai_dma_data *playback_dma_data; struct snd_dmaengine_dai_dma_data *capture_dma_data; - playback_dma_data = devm_kzalloc(dai->dev, - sizeof(*playback_dma_data), - GFP_KERNEL); + playback_dma_data = devm_kzalloc_obj(dai->dev, *playback_dma_data); if (!playback_dma_data) return -ENOMEM; - capture_dma_data = devm_kzalloc(dai->dev, - sizeof(*capture_dma_data), - GFP_KERNEL); + capture_dma_data = devm_kzalloc_obj(dai->dev, *capture_dma_data); if (!capture_dma_data) return -ENOMEM; @@ -689,9 +685,7 @@ static int ux500_msp_drv_probe(struct platform_device *pdev) struct reset_control *reset; int ret = 0; - drvdata = devm_kzalloc(&pdev->dev, - sizeof(struct ux500_msp_i2s_drvdata), - GFP_KERNEL); + drvdata = devm_kzalloc_obj(&pdev->dev, struct ux500_msp_i2s_drvdata); if (!drvdata) return -ENOMEM; diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index bd2cfc618290..978bb5e743bf 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -738,7 +738,7 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, struct resource *res; struct ux500_msp *msp; - *msp_p = devm_kzalloc(&pdev->dev, sizeof(struct ux500_msp), GFP_KERNEL); + *msp_p = devm_kzalloc_obj(&pdev->dev, struct ux500_msp); msp = *msp_p; if (!msp) return -ENOMEM; diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c index 781508aef885..2699bef216b1 100644 --- a/sound/soc/xilinx/xlnx_formatter_pcm.c +++ b/sound/soc/xilinx/xlnx_formatter_pcm.c @@ -602,7 +602,7 @@ static int xlnx_formatter_pcm_probe(struct platform_device *pdev) if (IS_ERR(axi_clk)) return dev_err_probe(dev, PTR_ERR(axi_clk), "failed to get s_axi_lite_aclk"); - aud_drv_data = devm_kzalloc(dev, sizeof(*aud_drv_data), GFP_KERNEL); + aud_drv_data = devm_kzalloc_obj(dev, *aud_drv_data); if (!aud_drv_data) return -ENOMEM; diff --git a/sound/soc/xilinx/xlnx_i2s.c b/sound/soc/xilinx/xlnx_i2s.c index 273258125497..090d59c0781d 100644 --- a/sound/soc/xilinx/xlnx_i2s.c +++ b/sound/soc/xilinx/xlnx_i2s.c @@ -174,7 +174,7 @@ static int xlnx_i2s_probe(struct platform_device *pdev) u32 format; struct device *dev = &pdev->dev; - drv_data = devm_kzalloc(&pdev->dev, sizeof(*drv_data), GFP_KERNEL); + drv_data = devm_kzalloc_obj(&pdev->dev, *drv_data); if (!drv_data) return -ENOMEM; diff --git a/sound/soc/xilinx/xlnx_spdif.c b/sound/soc/xilinx/xlnx_spdif.c index a70ca6beb646..9fdafd45c381 100644 --- a/sound/soc/xilinx/xlnx_spdif.c +++ b/sound/soc/xilinx/xlnx_spdif.c @@ -242,7 +242,7 @@ static int xlnx_spdif_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; - ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc_obj(dev, *ctx); if (!ctx) return -ENOMEM; diff --git a/sound/soc/xtensa/xtfpga-i2s.c b/sound/soc/xtensa/xtfpga-i2s.c index e5e8b72fd817..15ebda17e578 100644 --- a/sound/soc/xtensa/xtfpga-i2s.c +++ b/sound/soc/xtensa/xtfpga-i2s.c @@ -538,7 +538,7 @@ static int xtfpga_i2s_probe(struct platform_device *pdev) struct xtfpga_i2s *i2s; int err, irq; - i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL); + i2s = devm_kzalloc_obj(&pdev->dev, *i2s); if (!i2s) return -ENOMEM; diff --git a/sound/virtio/virtio_card.c b/sound/virtio/virtio_card.c index 6f35276416fe..06eefe612f4d 100644 --- a/sound/virtio/virtio_card.c +++ b/sound/virtio/virtio_card.c @@ -305,7 +305,7 @@ static int virtsnd_probe(struct virtio_device *vdev) unsigned int i; int rc; - snd = devm_kzalloc(&vdev->dev, sizeof(*snd), GFP_KERNEL); + snd = devm_kzalloc_obj(&vdev->dev, *snd); if (!snd) return -ENOMEM; diff --git a/sound/virtio/virtio_chmap.c b/sound/virtio/virtio_chmap.c index 5bc924933a59..847c8947a753 100644 --- a/sound/virtio/virtio_chmap.c +++ b/sound/virtio/virtio_chmap.c @@ -67,8 +67,7 @@ int virtsnd_chmap_parse_cfg(struct virtio_snd *snd) if (!snd->nchmaps) return 0; - snd->chmaps = devm_kcalloc(&vdev->dev, snd->nchmaps, - sizeof(*snd->chmaps), GFP_KERNEL); + snd->chmaps = devm_kzalloc_objs(&vdev->dev, *snd->chmaps, snd->nchmaps); if (!snd->chmaps) return -ENOMEM; @@ -155,9 +154,8 @@ int virtsnd_chmap_build_devs(struct virtio_snd *snd) if (!vs->nchmaps) continue; - vs->chmaps = devm_kcalloc(&vdev->dev, vs->nchmaps + 1, - sizeof(*vs->chmaps), - GFP_KERNEL); + vs->chmaps = devm_kzalloc_objs(&vdev->dev, *vs->chmaps, + vs->nchmaps + 1); if (!vs->chmaps) return -ENOMEM; diff --git a/sound/virtio/virtio_jack.c b/sound/virtio/virtio_jack.c index 68e40c7f5039..1565e07104a0 100644 --- a/sound/virtio/virtio_jack.c +++ b/sound/virtio/virtio_jack.c @@ -139,8 +139,7 @@ int virtsnd_jack_parse_cfg(struct virtio_snd *snd) if (!snd->njacks) return 0; - snd->jacks = devm_kcalloc(&vdev->dev, snd->njacks, sizeof(*snd->jacks), - GFP_KERNEL); + snd->jacks = devm_kzalloc_objs(&vdev->dev, *snd->jacks, snd->njacks); if (!snd->jacks) return -ENOMEM; diff --git a/sound/virtio/virtio_kctl.c b/sound/virtio/virtio_kctl.c index 45f7b6a5b308..ed8031b91eab 100644 --- a/sound/virtio/virtio_kctl.c +++ b/sound/virtio/virtio_kctl.c @@ -376,8 +376,7 @@ static int virtsnd_kctl_get_enum_items(struct virtio_snd *snd, unsigned int cid) if (!msg) return -ENOMEM; - kctl->items = devm_kcalloc(&vdev->dev, n, sizeof(*kctl->items), - GFP_KERNEL); + kctl->items = devm_kzalloc_objs(&vdev->dev, *kctl->items, n); if (!kctl->items) { virtsnd_ctl_msg_unref(msg); return -ENOMEM; @@ -412,13 +411,12 @@ int virtsnd_kctl_parse_cfg(struct virtio_snd *snd) if (!snd->nkctls) return 0; - snd->kctl_infos = devm_kcalloc(&vdev->dev, snd->nkctls, - sizeof(*snd->kctl_infos), GFP_KERNEL); + snd->kctl_infos = devm_kzalloc_objs(&vdev->dev, *snd->kctl_infos, + snd->nkctls); if (!snd->kctl_infos) return -ENOMEM; - snd->kctls = devm_kcalloc(&vdev->dev, snd->nkctls, sizeof(*snd->kctls), - GFP_KERNEL); + snd->kctls = devm_kzalloc_objs(&vdev->dev, *snd->kctls, snd->nkctls); if (!snd->kctls) return -ENOMEM; diff --git a/sound/virtio/virtio_pcm.c b/sound/virtio/virtio_pcm.c index be3893de40a5..ec2a0a883b2b 100644 --- a/sound/virtio/virtio_pcm.c +++ b/sound/virtio/virtio_pcm.c @@ -245,7 +245,7 @@ struct virtio_pcm *virtsnd_pcm_find_or_create(struct virtio_snd *snd, u32 nid) if (!IS_ERR(vpcm)) return vpcm; - vpcm = devm_kzalloc(&vdev->dev, sizeof(*vpcm), GFP_KERNEL); + vpcm = devm_kzalloc_obj(&vdev->dev, *vpcm); if (!vpcm) return ERR_PTR(-ENOMEM); @@ -335,8 +335,8 @@ int virtsnd_pcm_parse_cfg(struct virtio_snd *snd) if (!snd->nsubstreams) return 0; - snd->substreams = devm_kcalloc(&vdev->dev, snd->nsubstreams, - sizeof(*snd->substreams), GFP_KERNEL); + snd->substreams = devm_kzalloc_objs(&vdev->dev, *snd->substreams, + snd->nsubstreams); if (!snd->substreams) return -ENOMEM; @@ -449,9 +449,9 @@ int virtsnd_pcm_build_devs(struct virtio_snd *snd) continue; stream->substreams = - devm_kcalloc(&vdev->dev, stream->nsubstreams, - sizeof(*stream->substreams), - GFP_KERNEL); + devm_kzalloc_objs(&vdev->dev, + *stream->substreams, + stream->nsubstreams); if (!stream->substreams) return -ENOMEM; diff --git a/sound/xen/xen_snd_front.c b/sound/xen/xen_snd_front.c index c56d17479f05..4cb22d160fc7 100644 --- a/sound/xen/xen_snd_front.c +++ b/sound/xen/xen_snd_front.c @@ -294,8 +294,7 @@ static int xen_drv_probe(struct xenbus_device *xb_dev, { struct xen_snd_front_info *front_info; - front_info = devm_kzalloc(&xb_dev->dev, - sizeof(*front_info), GFP_KERNEL); + front_info = devm_kzalloc_obj(&xb_dev->dev, *front_info); if (!front_info) return -ENOMEM; diff --git a/sound/xen/xen_snd_front_alsa.c b/sound/xen/xen_snd_front_alsa.c index a6dd196f73d6..50e4990505d8 100644 --- a/sound/xen/xen_snd_front_alsa.c +++ b/sound/xen/xen_snd_front_alsa.c @@ -701,20 +701,18 @@ static int new_pcm_instance(struct xen_snd_front_card_info *card_info, if (instance_cfg->num_streams_pb) { pcm_instance_info->streams_pb = - devm_kcalloc(&card_info->card->card_dev, - instance_cfg->num_streams_pb, - sizeof(struct xen_snd_front_pcm_stream_info), - GFP_KERNEL); + devm_kzalloc_objs(&card_info->card->card_dev, + struct xen_snd_front_pcm_stream_info, + instance_cfg->num_streams_pb); if (!pcm_instance_info->streams_pb) return -ENOMEM; } if (instance_cfg->num_streams_cap) { pcm_instance_info->streams_cap = - devm_kcalloc(&card_info->card->card_dev, - instance_cfg->num_streams_cap, - sizeof(struct xen_snd_front_pcm_stream_info), - GFP_KERNEL); + devm_kzalloc_objs(&card_info->card->card_dev, + struct xen_snd_front_pcm_stream_info, + instance_cfg->num_streams_cap); if (!pcm_instance_info->streams_cap) return -ENOMEM; } @@ -784,9 +782,9 @@ int xen_snd_front_alsa_init(struct xen_snd_front_info *front_info) front_info->card_info = card_info; card_info->card = card; card_info->pcm_instances = - devm_kcalloc(dev, cfg->num_pcm_instances, - sizeof(struct xen_snd_front_pcm_instance_info), - GFP_KERNEL); + devm_kzalloc_objs(dev, + struct xen_snd_front_pcm_instance_info, + cfg->num_pcm_instances); if (!card_info->pcm_instances) { ret = -ENOMEM; goto fail; diff --git a/sound/xen/xen_snd_front_cfg.c b/sound/xen/xen_snd_front_cfg.c index 55ecf766ca67..745e3dbf219a 100644 --- a/sound/xen/xen_snd_front_cfg.c +++ b/sound/xen/xen_snd_front_cfg.c @@ -435,10 +435,9 @@ static int cfg_device(struct xen_snd_front_info *front_info, if (pcm_instance->num_streams_pb) { pcm_instance->streams_pb = - devm_kcalloc(&front_info->xb_dev->dev, - pcm_instance->num_streams_pb, - sizeof(struct xen_front_cfg_stream), - GFP_KERNEL); + devm_kzalloc_objs(&front_info->xb_dev->dev, + struct xen_front_cfg_stream, + pcm_instance->num_streams_pb); if (!pcm_instance->streams_pb) { ret = -ENOMEM; goto fail; @@ -447,10 +446,9 @@ static int cfg_device(struct xen_snd_front_info *front_info, if (pcm_instance->num_streams_cap) { pcm_instance->streams_cap = - devm_kcalloc(&front_info->xb_dev->dev, - pcm_instance->num_streams_cap, - sizeof(struct xen_front_cfg_stream), - GFP_KERNEL); + devm_kzalloc_objs(&front_info->xb_dev->dev, + struct xen_front_cfg_stream, + pcm_instance->num_streams_cap); if (!pcm_instance->streams_cap) { ret = -ENOMEM; goto fail; @@ -501,9 +499,9 @@ int xen_snd_front_cfg_card(struct xen_snd_front_info *front_info, cfg_read_pcm_hw(xb_dev->nodename, NULL, &cfg->pcm_hw); cfg->pcm_instances = - devm_kcalloc(&front_info->xb_dev->dev, num_devices, - sizeof(struct xen_front_cfg_pcm_instance), - GFP_KERNEL); + devm_kzalloc_objs(&front_info->xb_dev->dev, + struct xen_front_cfg_pcm_instance, + num_devices); if (!cfg->pcm_instances) return -ENOMEM;