History

treewide: refresh kmalloc_obj() conversions

This is another run of the Coccinelle script for converting kmalloc() family of allocations to kmalloc_obj() via the existing rules in scripts/coccinelle/api/kmalloc_objs.cocci This catches both the set of kmalloc() uses added since the first kmalloc_obj() conversions in v7.0 and adds a large group missed in the first pass due to Coccinelle not interacting well with the cleanup.h scoped_...() family of macros[1]. I worked around this with spatch's "--macro-file" argument to a file with all the scoped_...() macros mapped to Coccinelle's YACFE_ITERATOR[2] as that was the closest viable control flow indicator I could find. Build tested allmodconfig on x86, arm64, arm, loongarch, mips, powerpc, riscv, and s390 with no new warnings.

Kees Cook committed 2 months ago

Commit 3a2c4d51 parent 90feea3304 files · +637 −726Browse files

Unified · Split

304 files
  1. arch/arm64/crypto/aes-neonbs-glue.c +2 −2
  2. arch/arm64/kvm/nested.c +1 −1
  3. arch/loongarch/kvm/intc/dmsintc.c +1 −1
  4. arch/mips/bcm47xx/buttons.c +4 −4
  5. arch/powerpc/sysdev/xive/common.c +1 −1
  6. arch/riscv/kvm/vcpu_pmu.c +2 −2
  7. arch/s390/kvm/s390/s390.c +2 −2
  8. drivers/accel/rocket/rocket_job.c +1 −1
  9. drivers/acpi/irq.c +5 −3
  10. drivers/base/property.c +1 −1
  11. drivers/block/drbd/drbd_nl_gen.c +22 −18
  12. drivers/block/ublk_drv.c +2 −2
  13. drivers/block/zram/backend_lz4.c +1 −1
  14. drivers/clk/ti/composite.c +1 −1
  15. drivers/clk/ti/mux.c +1 −1
  16. drivers/cpufreq/amd-pstate.c +1 −1
  17. drivers/crypto/inside-secure/eip93/eip93-common.c +2 −3
  18. drivers/crypto/intel/qat/qat_common/qat_comp_algs.c +1 −2
  19. drivers/crypto/ti/dthev2-aes.c +4 −4
  20. drivers/devfreq/hisi_uncore_freq.c +1 −1
  21. drivers/dma-buf/st-dma-fence.c +1 −1
  22. drivers/dma-buf/udmabuf.c +2 −2
  23. drivers/dma/switchtec_dma.c +3 −4
  24. drivers/edac/versalnet_edac.c +1 −1
  25. drivers/firmware/arm_scmi/driver.c +1 −1
  26. drivers/firmware/qcom/qcom_tzmem.c +3 −5
  27. drivers/firmware/ti_sci.c +1 −1
  28. drivers/fpga/dfl-afu-dma-region.c +1 −1
  29. drivers/gpio/gpio-aggregator.c +2 −2
  30. drivers/gpio/gpio-mpsse.c +1 −1
  31. drivers/gpio/gpio-sim.c +1 −2
  32. drivers/gpio/gpio-virtuser.c +1 −2
  33. drivers/gpio/gpiolib-cdev.c +1 −1
  34. drivers/gpio/gpiolib.c +2 −2
  35. drivers/gpu/buddy.c +4 −9
  36. drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +2 −3
  37. drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +2 −2
  38. drivers/gpu/drm/amd/amdgpu/amdgpu_lockdep.c +1 −1
  39. drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +1 −1
  40. drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 −3
  41. drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +2 −2
  42. drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c +2 −4
  43. drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +3 −3
  44. drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +6 −6
  45. drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +1 −1
  46. drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c +4 −4
  47. drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +9 −9
  48. drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +2 −2
  49. drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +1 −1
  50. drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +1 −1
  51. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c +2 −2
  52. drivers/gpu/drm/amd/display/dc/core/dc.c +1 −2
  53. drivers/gpu/drm/amd/display/dc/core/dc_surface.c +1 −1
  54. drivers/gpu/drm/amd/display/dc/dccg/dcn42/dcn42_dccg.c +1 −1
  55. drivers/gpu/drm/amd/display/dc/dccg/dcn60/dcn60_dccg.c +1 −1
  56. drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c +1 −1
  57. drivers/gpu/drm/amd/display/dc/irq/dcn42/irq_service_dcn42.c +1 −1
  58. drivers/gpu/drm/amd/display/dc/irq/dcn60/irq_service_dcn60.c +1 −2
  59. drivers/gpu/drm/amd/display/dc/pg/dcn42/dcn42_pg_cntl.c +1 −1
  60. drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c +2 −2
  61. drivers/gpu/drm/amd/display/dc/resource/dcn302/dcn302_resource.c +2 −2
  62. drivers/gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c +2 −2
  63. drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c +2 −2
  64. drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c +2 −2
  65. drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c +2 −2
  66. drivers/gpu/drm/amd/display/dc/resource/dcn316/dcn316_resource.c +2 −2
  67. drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c +2 −2
  68. drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c +2 −2
  69. drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c +2 −2
  70. drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c +2 −2
  71. drivers/gpu/drm/amd/display/dc/resource/dcn36/dcn36_resource.c +2 −2
  72. drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c +2 −2
  73. drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c +23 −27
  74. drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c +21 −25
  75. drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c +20 −22
  76. drivers/gpu/drm/amd/display/modules/power/power.c +2 −3
  77. drivers/gpu/drm/amd/display/modules/power/power_abm.c +1 −2
  78. drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +1 −1
  79. drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c +2 −2
  80. drivers/gpu/drm/amd/ras/core/cmd.c +2 −2
  81. drivers/gpu/drm/drm_exec.c +1 −1
  82. drivers/gpu/drm/drm_syncobj.c +1 −1
  83. drivers/gpu/drm/qxl/qxl_display.c +1 −1
  84. drivers/gpu/drm/tilcdc/tilcdc_panel_legacy.c +1 −1
  85. drivers/gpu/drm/verisilicon/vs_plane.c +2 −2
  86. drivers/gpu/drm/virtio/virtgpu_prime.c +1 −3
  87. drivers/gpu/drm/vkms/vkms_configfs.c +4 −4
  88. drivers/gpu/drm/xe/xe_amc.c +1 −1
  89. drivers/gpu/drm/xe/xe_vm.c +1 −1
  90. drivers/hid/hid-asus.c +3 −3
  91. drivers/hid/hid-steam.c +2 −2
  92. drivers/hid/hid-steelseries-arctis.c +1 −1
  93. drivers/hv/channel.c +2 −3
  94. drivers/hv/hv_balloon.c +1 −1
  95. drivers/hwmon/applesmc.c +8 −9
  96. drivers/hwtracing/coresight/coresight-core.c +1 −1
  97. drivers/i2c/busses/i2c-gpio.c +1 −1
  98. drivers/i3c/master/amd-i3c-master.c +2 −2
  99. drivers/iio/adc/ad7280a.c +2 −2
  100. drivers/iio/buffer/industrialio-buffer-dmaengine.c +1 −1
  101. drivers/iio/inkern.c +1 −1
  102. drivers/infiniband/core/nldev.c +1 −1
  103. drivers/infiniband/hw/hns/hns_roce_debugfs.c +1 −2
  104. drivers/input/input.c +1 −1
  105. drivers/input/keyboard/adp5585-keys.c +2 −2
  106. drivers/input/keyboard/atkbd.c +1 −1
  107. drivers/input/misc/ims-pcu.c +1 −1
  108. drivers/input/mouse/psmouse-smbus.c +1 −1
  109. drivers/input/serio/serio_raw.c +1 −1
  110. drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h +1 −1
  111. drivers/iommu/iommufd/device.c +1 −1
  112. drivers/iommu/iommufd/driver.c +1 −1
  113. drivers/iommu/iommufd/hwpt_noiommu.c +1 −1
  114. drivers/iommu/vsi-iommu.c +1 −1
  115. drivers/irqchip/irq-gic-v5-irs.c +1 −1
  116. drivers/irqchip/irq-loongarch-ir.c +1 −1
  117. drivers/irqchip/irq-realtek-rtl.c +1 −1
  118. drivers/mailbox/riscv-sbi-mpxy-mbox.c +1 −1
  119. drivers/md/dm-inlinecrypt.c +1 −1
  120. drivers/md/md-llbitmap.c +2 −2
  121. drivers/media/platform/allegro-dvt/allegro-core.c +1 −1
  122. drivers/media/platform/amd/isp4/isp4_interface.c +3 −3
  123. drivers/media/platform/renesas/rcar-isp/core.c +1 −1
  124. drivers/media/rc/igorplugusb.c +1 −1
  125. drivers/mfd/mfd-core.c +2 −2
  126. drivers/mfd/ucb1x00-assabet.c +1 −1
  127. drivers/mtd/mtd_virt_concat.c +2 −2
  128. drivers/mtd/mtdconcat.c +1 −1
  129. drivers/net/dsa/mv88e6xxx/tcflower.c +1 −1
  130. drivers/net/ethernet/alibaba/eea/eea_adminq.c +3 −4
  131. drivers/net/ethernet/alibaba/eea/eea_net.c +4 −4
  132. drivers/net/ethernet/alibaba/eea/eea_pci.c +1 −1
  133. drivers/net/ethernet/alibaba/eea/eea_ring.c +1 −1
  134. drivers/net/ethernet/alibaba/eea/eea_rx.c +2 −3
  135. drivers/net/ethernet/alibaba/eea/eea_tx.c +1 −2
  136. drivers/net/ethernet/amd/pds_core/core.c +1 −2
  137. drivers/net/ethernet/amd/pds_core/fw.c +3 −3
  138. drivers/net/ethernet/cadence/macb_main.c +1 −1
  139. drivers/net/ethernet/cisco/enic/enic_admin.c +1 −1
  140. drivers/net/ethernet/cisco/enic/enic_main.c +3 −3
  141. drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +2 −3
  142. drivers/net/ethernet/intel/libie/controlq.c +1 −2
  143. drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c +5 −8
  144. drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +1 −2
  145. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +1 −1
  146. drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c +1 −1
  147. drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_icm_pool.c +1 −1
  148. drivers/net/ethernet/meta/fbnic/fbnic_irq.c +1 −1
  149. drivers/net/ethernet/microsoft/mana/gdma_main.c +4 −4
  150. drivers/net/ntb_netdev.c +1 −2
  151. drivers/net/wireless/ath/ath12k/ahb.c +1 −1
  152. drivers/net/wireless/intel/iwlwifi/mld/regulatory.c +1 −2
  153. drivers/net/wireless/mediatek/mt76/mt7921/regd.c +1 −1
  154. drivers/net/wireless/mediatek/mt76/mt7925/main.c +1 −1
  155. drivers/net/wireless/mediatek/mt76/mt7925/regd.c +1 −1
  156. drivers/net/wireless/morsemicro/mm81x/mac.c +4 −5
  157. drivers/net/wireless/morsemicro/mm81x/yaps.c +4 −6
  158. drivers/net/wireless/nxp/nxpwifi/cfg80211.c +7 −7
  159. drivers/net/wireless/nxp/nxpwifi/cmdevt.c +1 −1
  160. drivers/net/wireless/nxp/nxpwifi/ie.c +7 −7
  161. drivers/net/wireless/nxp/nxpwifi/init.c +1 −1
  162. drivers/net/wireless/nxp/nxpwifi/main.c +4 −4
  163. drivers/net/wireless/nxp/nxpwifi/scan.c +6 −7
  164. drivers/net/wireless/nxp/nxpwifi/sta_cfg.c +1 −1
  165. drivers/net/wireless/nxp/nxpwifi/sta_cmd.c +1 −1
  166. drivers/net/wireless/nxp/nxpwifi/uap_event.c +1 −1
  167. drivers/nvdimm/region_devs.c +1 −2
  168. drivers/nvme/host/core.c +1 −2
  169. drivers/nvme/host/pci.c +1 −1
  170. drivers/opp/core.c +2 −2
  171. drivers/pci/endpoint/pci-ep-msi.c +2 −2
  172. drivers/platform/x86/amd/hsmp/acpi.c +2 −3
  173. drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c +2 −2
  174. drivers/platform/x86/intel/pmc/pwrm_telemetry.c +1 −2
  175. drivers/pmdomain/core.c +1 −1
  176. drivers/power/reset/reboot-mode.c +3 −3
  177. drivers/power/sequencing/core.c +1 −1
  178. drivers/power/sequencing/pwrseq-pcie-m2.c +1 −1
  179. drivers/power/supply/power_supply_core.c +3 −3
  180. drivers/ptp/ptp_chardev.c +1 −1
  181. drivers/s390/block/dasd.c +1 −1
  182. drivers/scsi/fnic/fnic_debugfs.c +1 −1
  183. drivers/scsi/leapraid/leapraid_func.c +21 −31
  184. drivers/scsi/scsi_scan.c +1 −1
  185. drivers/soc/bcm/brcmstb/common.c +1 −1
  186. drivers/spi/spi-offload.c +1 −1
  187. drivers/staging/greybus/raw.c +1 −1
  188. drivers/staging/media/atomisp/pci/sh_css.c +10 −20
  189. drivers/staging/media/atomisp/pci/sh_css_firmware.c +2 −2
  190. drivers/tee/qcomtee/user_obj.c +1 −2
  191. drivers/thunderbolt/stream.c +5 −7
  192. drivers/tty/moxa.c +1 −2
  193. drivers/tty/vt/consolemap.c +2 −1
  194. drivers/ufs/core/ufs-txeq.c +1 −1
  195. drivers/ufs/host/ufs-qcom.c +1 −1
  196. drivers/usb/gadget/function/f_ncm.c +1 −1
  197. drivers/usb/usbip/usbip_common.c +1 −1
  198. drivers/xen/grant-table.c +1 −1
  199. fs/9p/vfs_dentry.c +1 −2
  200. fs/afs/dir.c +1 −1
  201. fs/afs/symlink.c +1 −2
  202. fs/binfmt_misc.c +3 −4
  203. fs/ceph/addr.c +1 −1
  204. fs/ceph/mds_client.c +1 −1
  205. fs/ceph/subvolume_metrics.c +1 −1
  206. fs/coredump.c +1 −1
  207. fs/ext4/fast_commit.c +2 −2
  208. fs/fuse/file.c +1 −2
  209. fs/fuse/readdir.c +1 −1
  210. fs/hfs/bnode.c +1 −1
  211. fs/namespace.c +1 −1
  212. fs/nfsd/export.c +3 −4
  213. fs/nfsd/nfs4callback.c +2 −2
  214. fs/nfsd/nfs4state.c +4 −3
  215. fs/nfsd/nfsctl.c +1 −1
  216. fs/ntfs/bitmap.c +1 −1
  217. fs/ntfs/compress.c +4 −4
  218. fs/ntfs/dir.c +8 −8
  219. fs/ntfs/ea.c +1 −1
  220. fs/ntfs/index.c +1 −1
  221. fs/ntfs/logfile.c +1 −1
  222. fs/ntfs/mft.c +6 −4
  223. fs/ntfs/runlist.c +7 −7
  224. fs/ntfs/super.c +1 −1
  225. fs/overlayfs/readdir.c +1 −1
  226. fs/smb/client/cifs_swn.c +1 −1
  227. fs/smb/client/dfs_cache.c +1 −1
  228. fs/smb/client/smb2inode.c +1 −1
  229. fs/smb/server/ksmbd_work.c +1 −1
  230. fs/smb/server/smb2pdu.c +1 −1
  231. fs/xfs/libxfs/xfs_da_btree.c +2 −2
  232. init/initramfs_test.c +1 −1
  233. io_uring/napi.c +1 −1
  234. io_uring/zcrx.c +2 −2
  235. kernel/bpf/diagnostics.c +1 −1
  236. kernel/bpf/hashtab.c +1 −1
  237. kernel/bpf/liveness.c +1 −1
  238. kernel/bpf/log.c +1 −1
  239. kernel/bpf/verifier.c +2 −3
  240. kernel/dma/map_benchmark.c +1 −2
  241. kernel/events/core.c +2 −3
  242. kernel/futex/core.c +3 −3
  243. kernel/irq/manage.c +1 −1
  244. kernel/jump_label.c +2 −3
  245. kernel/kthread.c +1 −1
  246. kernel/sched/ext/cid.c +8 −8
  247. kernel/sched/ext/ext.c +1 −1
  248. kernel/sched/ext/sub.c +1 −1
  249. kernel/trace/fprobe.c +1 −1
  250. kernel/trace/ring_buffer.c +2 −2
  251. kernel/trace/trace_eprobe.c +1 −1
  252. kernel/trace/trace_remote.c +5 −5
  253. lib/test_rhashtable.c +1 −1
  254. lib/test_workqueue.c +2 −2
  255. lib/tests/kunit_iov_iter.c +1 −1
  256. mm/damon/tests/vaddr-kunit.h +1 −1
  257. net/batman-adv/hard-interface.c +1 −1
  258. net/bluetooth/hci_sync.c +1 −2
  259. net/devlink/netlink.c +1 −1
  260. net/devlink/param.c +3 −4
  261. net/ipv4/tcp_ipv4.c +2 −2
  262. net/mac80211/nan.c +1 −2
  263. net/mctp/test/route-test.c +1 −1
  264. net/mctp/test/utils.c +1 −1
  265. net/netfilter/nf_tables_api.c +1 −1
  266. net/netfilter/nfnetlink_cttimeout.c +1 −1
  267. net/rds/info.c +1 −1
  268. net/rxrpc/key.c +1 −1
  269. net/sched/act_gate.c +2 −2
  270. net/sched/act_tunnel_key.c +1 −1
  271. net/sunrpc/auth_gss/gss_krb5_crypto.c +2 −3
  272. net/sunrpc/svcauth_unix.c +2 −2
  273. net/sunrpc/xdr.c +1 −2
  274. net/unix/af_unix.c +2 −2
  275. net/wireless/core.c +2 −3
  276. net/wireless/nl80211.c +3 −6
  277. security/integrity/ima/ima_queue.c +1 −2
  278. sound/core/compress_offload.c +2 −2
  279. sound/core/control.c +3 −3
  280. sound/core/control_led.c +1 −1
  281. sound/core/init.c +1 −1
  282. sound/core/misc.c +1 −1
  283. sound/core/oss/mixer_oss.c +1 −1
  284. sound/core/pcm_native.c +1 −1
  285. sound/core/seq/oss/seq_oss_synth.c +1 −1
  286. sound/core/seq/seq_clientmgr.c +1 −1
  287. sound/core/seq/seq_virmidi.c +1 −1
  288. sound/core/timer.c +1 −1
  289. sound/drivers/aloop.c +2 −2
  290. sound/isa/gus/gus_dma.c +1 −1
  291. sound/pci/cs46xx/cs46xx_lib.c +1 −1
  292. sound/pci/ctxfi/ctamixer.c +2 −2
  293. sound/pci/ctxfi/ctdaio.c +2 −2
  294. sound/pci/ctxfi/ctsrc.c +2 −2
  295. sound/pci/ctxfi/cttimer.c +1 −1
  296. sound/pci/emu10k1/emufx.c +1 −1
  297. sound/soc/codecs/simple-amplifier.c +1 −1
  298. sound/soc/generic/simple-card-utils.c +1 −1
  299. sound/soc/meson/gx-formatter.c +1 −1
  300. sound/soc/qcom/qdsp6/q6afe.c +1 −1
  301. sound/soc/sdca/sdca_functions.c +9 −10
  302. sound/soc/sof/sof-client-probes-ipc4.c +1 −1
  303. sound/soc/sof/sof-client.c +1 −1
  304. sound/sparc/amd7930.c +1 −1
arch/arm64/crypto/aes-neonbs-glue.c+2−2
@@ -66,7 +66,7 @@ static int aesbs_setkey(struct crypto_skcipher *tfm, const u8 *in_key, · 65 unmodified lines
6666 struct crypto_aes_ctx *rk;
6767 int err;
6868
69− rk = kmalloc(sizeof(*rk), GFP_KERNEL);
69+ rk = kmalloc_obj(*rk);
7070 if (!rk)
7171 return -ENOMEM;
7272
@@ -128,7 +128,7 @@ static int aesbs_cbc_ctr_setkey(struct crypto_skcipher *tfm, const u8 *in_key, · 55 unmodified lines
128128 struct crypto_aes_ctx *rk;
129129 int err;
130130
131− rk = kmalloc(sizeof(*rk), GFP_KERNEL);
131+ rk = kmalloc_obj(*rk);
132132 if (!rk)
133133 return -ENOMEM;
134134
arch/arm64/kvm/nested.c+1−1
@@ -93,7 +93,7 @@ int kvm_vcpu_init_nested(struct kvm_vcpu *vcpu) · 92 unmodified lines
9393 num_mmus = atomic_read(&kvm->online_vcpus) * S2_MMU_PER_VCPU;
9494
9595 if (num_mmus > kvm->arch.nested_mmus_size) {
96− tmp = kvcalloc(num_mmus, sizeof(*tmp), GFP_KERNEL_ACCOUNT);
96+ tmp = kvzalloc_objs(*tmp, num_mmus, GFP_KERNEL_ACCOUNT);
9797 if (!tmp)
9898 return -ENOMEM;
9999
arch/loongarch/kvm/intc/dmsintc.c+1−1
@@ -149,7 +149,7 @@ static int kvm_dmsintc_create(struct kvm_device *dev, u32 type) · 148 unmodified lines
149149 return -EINVAL;
150150 }
151151
152− s = kzalloc(sizeof(struct loongarch_dmsintc), GFP_KERNEL);
152+ s = kzalloc_obj(struct loongarch_dmsintc);
153153 if (!s)
154154 return -ENOMEM;
155155
arch/mips/bcm47xx/buttons.c+4−4
@@ -523,24 +523,24 @@ bcm47xx_buttons_add(const struct bcm47xx_gpio_key *buttons, int nbuttons) · 522 unmodified lines
523523
524524 /* 1 node for gpio-keys device, 1 node for each button, 1 terminator */
525525 const struct software_node **node_group __free(kfree) =
526− kcalloc(1 + nbuttons + 1, sizeof(*node_group), GFP_KERNEL);
526+ kzalloc_objs(*node_group, 1 + nbuttons + 1);
527527 if (!node_group)
528528 return -ENOMEM;
529529
530530 /* 1 code property, 1 gpio property, 1 terminator */
531531 struct property_entry *props __free(kfree) =
532− kcalloc(nbuttons * 3, sizeof(*props), GFP_KERNEL);
532+ kzalloc_objs(*props, nbuttons * 3);
533533 if (!props)
534534 return -ENOMEM;
535535
536536 /* 1 node for gpio-keys device, 1 node for each button */
537537 struct software_node *nodes __free(kfree) =
538− kcalloc(1 + nbuttons, sizeof(*nodes), GFP_KERNEL);
538+ kzalloc_objs(*nodes, 1 + nbuttons);
539539 if (!nodes)
540540 return -ENOMEM;
541541
542542 struct software_node_ref_args *ref_args __free(kfree) =
543− kcalloc(nbuttons, sizeof(*ref_args), GFP_KERNEL);
543+ kzalloc_objs(*ref_args, nbuttons);
544544 if (!ref_args)
545545 return -ENOMEM;
546546
arch/powerpc/sysdev/xive/common.c+1−1
@@ -1134,7 +1134,7 @@ static int __init xive_init_ipis(void) · 1133 unmodified lines
11341134 if (!ipi_domain)
11351135 goto out_free_fwnode;
11361136
1137− xive_ipis = kzalloc_objs(*xive_ipis, nr_node_ids, GFP_KERNEL);
1137+ xive_ipis = kzalloc_objs(*xive_ipis, nr_node_ids);
11381138 if (!xive_ipis)
11391139 goto out_free_domain;
11401140
arch/riscv/kvm/vcpu_pmu.c+2−2
@@ -503,8 +503,8 @@ int kvm_riscv_vcpu_pmu_event_info(struct kvm_vcpu *vcpu, unsigned long saddr_low · 502 unmodified lines
503503 }
504504 }
505505
506− einfo = kvcalloc(num_events, sizeof(*einfo),
507− GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
506+ einfo = kvzalloc_objs(*einfo, num_events,
507+ GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
508508 if (!einfo) {
509509 ret = SBI_ERR_FAILURE;
510510 goto out;
arch/s390/kvm/s390/s390.c+2−2
@@ -2168,7 +2168,7 @@ static int kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) · 2167 unmodified lines
21682168 if (args->count < 1 || args->count > KVM_S390_SKEYS_MAX)
21692169 return -EINVAL;
21702170
2171− keys = kvmalloc_array(args->count, sizeof(*keys), GFP_KERNEL_ACCOUNT);
2171+ keys = kvmalloc_objs(*keys, args->count, GFP_KERNEL_ACCOUNT);
21722172 if (!keys)
21732173 return -ENOMEM;
21742174
@@ -2205,7 +2205,7 @@ static int kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) · 30 unmodified lines
22052205 if (args->count < 1 || args->count > KVM_S390_SKEYS_MAX)
22062206 return -EINVAL;
22072207
2208− keys = kvmalloc_array(args->count, sizeof(*keys), GFP_KERNEL_ACCOUNT);
2208+ keys = kvmalloc_objs(*keys, args->count, GFP_KERNEL_ACCOUNT);
22092209 if (!keys)
22102210 return -ENOMEM;
22112211
drivers/accel/rocket/rocket_job.c+1−1
@@ -196,7 +196,7 @@ static int rocket_job_push(struct rocket_job *job) · 195 unmodified lines
196196 if (check_add_overflow(job->in_bo_count, job->out_bo_count, &bo_count))
197197 return -EINVAL;
198198
199− bos = kvmalloc_array(bo_count, sizeof(*bos), GFP_KERNEL);
199+ bos = kvmalloc_objs(*bos, bo_count);
200200 if (!bos)
201201 return -ENOMEM;
202202 memcpy(bos, job->in_bos, job->in_bo_count * sizeof(void *));
drivers/acpi/irq.c+5−3
@@ -486,7 +486,8 @@ static u32 acpi_add_prt_dep(acpi_handle handle) · 485 unmodified lines
486486 if (ACPI_FAILURE(status))
487487 continue;
488488 dep_devices.count = 1;
489− dep_devices.handles = kcalloc(1, sizeof(*dep_devices.handles), GFP_KERNEL);
489+ dep_devices.handles = kzalloc_objs(*dep_devices.handles,
490+ 1);
490491 if (!dep_devices.handles) {
491492 acpi_handle_err(handle, "failed to allocate memory\n");
492493 continue;
@@ -499,7 +500,8 @@ static u32 acpi_add_prt_dep(acpi_handle handle) · 6 unmodified lines
499500 if (!gsi_handle)
500501 continue;
501502 dep_devices.count = 1;
502− dep_devices.handles = kcalloc(1, sizeof(*dep_devices.handles), GFP_KERNEL);
503+ dep_devices.handles = kzalloc_objs(*dep_devices.handles,
504+ 1);
503505 if (!dep_devices.handles) {
504506 acpi_handle_err(handle, "failed to allocate memory\n");
505507 continue;
@@ -526,7 +528,7 @@ static u32 acpi_add_irq_dep(acpi_handle handle) · 20 unmodified lines
526528 continue;
527529
528530 dep_devices.count = 1;
529− dep_devices.handles = kcalloc(1, sizeof(*dep_devices.handles), GFP_KERNEL);
531+ dep_devices.handles = kzalloc_objs(*dep_devices.handles, 1);
530532 if (!dep_devices.handles) {
531533 acpi_handle_err(handle, "failed to allocate memory\n");
532534 continue;
drivers/base/property.c+1−1
@@ -526,7 +526,7 @@ int fwnode_property_match_string(const struct fwnode_handle *fwnode, · 525 unmodified lines
526526 if (nval == 0)
527527 return -ENODATA;
528528
529− const char **values __free(kfree) = kcalloc(nval, sizeof(*values), GFP_KERNEL);
529+ const char **values __free(kfree) = kzalloc_objs(*values, nval);
530530 if (!values)
531531 return -ENOMEM;
532532
drivers/block/drbd/drbd_nl_gen.c+22−18
@@ -656,7 +656,7 @@ static int __drbd_cfg_context_from_attrs(struct drbd_cfg_context *s, · 655 unmodified lines
656656 *ret_nested_attribute_table = NULL;
657657 if (!tla)
658658 return -ENOMSG;
659− ntb = kcalloc(DRBD_A_DRBD_CFG_CONTEXT_CTX_PEER_ADDR + 1, sizeof(*ntb), GFP_KERNEL);
659+ ntb = kzalloc_objs(*ntb, DRBD_A_DRBD_CFG_CONTEXT_CTX_PEER_ADDR + 1);
660660 if (!ntb)
661661 return -ENOMEM;
662662 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_drbd_cfg_context_nl_policy, NULL);
@@ -714,7 +714,7 @@ static int __disk_conf_from_attrs(struct disk_conf *s, · 51 unmodified lines
714714 *ret_nested_attribute_table = NULL;
715715 if (!tla)
716716 return -ENOMSG;
717− ntb = kcalloc(DRBD_A_DISK_CONF_DISABLE_WRITE_SAME + 1, sizeof(*ntb), GFP_KERNEL);
717+ ntb = kzalloc_objs(*ntb, DRBD_A_DISK_CONF_DISABLE_WRITE_SAME + 1);
718718 if (!ntb)
719719 return -ENOMEM;
720720 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_disk_conf_nl_policy, NULL);
@@ -871,7 +871,7 @@ static int __res_opts_from_attrs(struct res_opts *s, · 150 unmodified lines
871871 *ret_nested_attribute_table = NULL;
872872 if (!tla)
873873 return -ENOMSG;
874− ntb = kcalloc(DRBD_A_RES_OPTS_ON_NO_DATA + 1, sizeof(*ntb), GFP_KERNEL);
874+ ntb = kzalloc_objs(*ntb, DRBD_A_RES_OPTS_ON_NO_DATA + 1);
875875 if (!ntb)
876876 return -ENOMEM;
877877 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_res_opts_nl_policy, NULL);
@@ -921,7 +921,7 @@ static int __net_conf_from_attrs(struct net_conf *s, · 43 unmodified lines
921921 *ret_nested_attribute_table = NULL;
922922 if (!tla)
923923 return -ENOMSG;
924− ntb = kcalloc(DRBD_A_NET_CONF_SOCK_CHECK_TIMEO + 1, sizeof(*ntb), GFP_KERNEL);
924+ ntb = kzalloc_objs(*ntb, DRBD_A_NET_CONF_SOCK_CHECK_TIMEO + 1);
925925 if (!ntb)
926926 return -ENOMEM;
927927 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_net_conf_nl_policy, NULL);
@@ -1087,7 +1087,7 @@ static int __set_role_parms_from_attrs(struct set_role_parms *s, · 159 unmodified lines
10871087 *ret_nested_attribute_table = NULL;
10881088 if (!tla)
10891089 return -ENOMSG;
1090− ntb = kcalloc(DRBD_A_SET_ROLE_PARMS_ASSUME_UPTODATE + 1, sizeof(*ntb), GFP_KERNEL);
1090+ ntb = kzalloc_objs(*ntb, DRBD_A_SET_ROLE_PARMS_ASSUME_UPTODATE + 1);
10911091 if (!ntb)
10921092 return -ENOMEM;
10931093 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_set_role_parms_nl_policy, NULL);
@@ -1133,7 +1133,7 @@ static int __resize_parms_from_attrs(struct resize_parms *s, · 39 unmodified lines
11331133 *ret_nested_attribute_table = NULL;
11341134 if (!tla)
11351135 return -ENOMSG;
1136− ntb = kcalloc(DRBD_A_RESIZE_PARMS_AL_STRIPE_SIZE + 1, sizeof(*ntb), GFP_KERNEL);
1136+ ntb = kzalloc_objs(*ntb, DRBD_A_RESIZE_PARMS_AL_STRIPE_SIZE + 1);
11371137 if (!ntb)
11381138 return -ENOMEM;
11391139 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_resize_parms_nl_policy, NULL);
@@ -1195,7 +1195,7 @@ static int __start_ov_parms_from_attrs(struct start_ov_parms *s, · 55 unmodified lines
11951195 *ret_nested_attribute_table = NULL;
11961196 if (!tla)
11971197 return -ENOMSG;
1198− ntb = kcalloc(DRBD_A_START_OV_PARMS_OV_STOP_SECTOR + 1, sizeof(*ntb), GFP_KERNEL);
1198+ ntb = kzalloc_objs(*ntb, DRBD_A_START_OV_PARMS_OV_STOP_SECTOR + 1);
11991199 if (!ntb)
12001200 return -ENOMEM;
12011201 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_start_ov_parms_nl_policy, NULL);
@@ -1245,7 +1245,7 @@ static int __new_c_uuid_parms_from_attrs(struct new_c_uuid_parms *s, · 43 unmodified lines
12451245 *ret_nested_attribute_table = NULL;
12461246 if (!tla)
12471247 return -ENOMSG;
1248− ntb = kcalloc(DRBD_A_NEW_C_UUID_PARMS_CLEAR_BM + 1, sizeof(*ntb), GFP_KERNEL);
1248+ ntb = kzalloc_objs(*ntb, DRBD_A_NEW_C_UUID_PARMS_CLEAR_BM + 1);
12491249 if (!ntb)
12501250 return -ENOMEM;
12511251 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_new_c_uuid_parms_nl_policy, NULL);
@@ -1291,7 +1291,7 @@ static int __disconnect_parms_from_attrs(struct disconnect_parms *s, · 39 unmodified lines
12911291 *ret_nested_attribute_table = NULL;
12921292 if (!tla)
12931293 return -ENOMSG;
1294− ntb = kcalloc(DRBD_A_DISCONNECT_PARMS_FORCE_DISCONNECT + 1, sizeof(*ntb), GFP_KERNEL);
1294+ ntb = kzalloc_objs(*ntb, DRBD_A_DISCONNECT_PARMS_FORCE_DISCONNECT + 1);
12951295 if (!ntb)
12961296 return -ENOMEM;
12971297 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_disconnect_parms_nl_policy, NULL);
@@ -1337,7 +1337,7 @@ static int __detach_parms_from_attrs(struct detach_parms *s, · 39 unmodified lines
13371337 *ret_nested_attribute_table = NULL;
13381338 if (!tla)
13391339 return -ENOMSG;
1340− ntb = kcalloc(DRBD_A_DETACH_PARMS_FORCE_DETACH + 1, sizeof(*ntb), GFP_KERNEL);
1340+ ntb = kzalloc_objs(*ntb, DRBD_A_DETACH_PARMS_FORCE_DETACH + 1);
13411341 if (!ntb)
13421342 return -ENOMEM;
13431343 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_detach_parms_nl_policy, NULL);
@@ -1383,7 +1383,7 @@ static int __resource_info_from_attrs(struct resource_info *s, · 39 unmodified lines
13831383 *ret_nested_attribute_table = NULL;
13841384 if (!tla)
13851385 return -ENOMSG;
1386− ntb = kcalloc(DRBD_A_RESOURCE_INFO_RES_SUSP_FEN + 1, sizeof(*ntb), GFP_KERNEL);
1386+ ntb = kzalloc_objs(*ntb, DRBD_A_RESOURCE_INFO_RES_SUSP_FEN + 1);
13871387 if (!ntb)
13881388 return -ENOMEM;
13891389 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_resource_info_nl_policy, NULL);
@@ -1441,7 +1441,7 @@ static int __device_info_from_attrs(struct device_info *s, · 51 unmodified lines
14411441 *ret_nested_attribute_table = NULL;
14421442 if (!tla)
14431443 return -ENOMSG;
1444− ntb = kcalloc(DRBD_A_DEVICE_INFO_DEV_DISK_STATE + 1, sizeof(*ntb), GFP_KERNEL);
1444+ ntb = kzalloc_objs(*ntb, DRBD_A_DEVICE_INFO_DEV_DISK_STATE + 1);
14451445 if (!ntb)
14461446 return -ENOMEM;
14471447 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_device_info_nl_policy, NULL);
@@ -1487,7 +1487,7 @@ static int __connection_info_from_attrs(struct connection_info *s, · 39 unmodified lines
14871487 *ret_nested_attribute_table = NULL;
14881488 if (!tla)
14891489 return -ENOMSG;
1490− ntb = kcalloc(DRBD_A_CONNECTION_INFO_CONN_ROLE + 1, sizeof(*ntb), GFP_KERNEL);
1490+ ntb = kzalloc_objs(*ntb, DRBD_A_CONNECTION_INFO_CONN_ROLE + 1);
14911491 if (!ntb)
14921492 return -ENOMEM;
14931493 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_connection_info_nl_policy, NULL);
@@ -1537,7 +1537,8 @@ static int __peer_device_info_from_attrs(struct peer_device_info *s, · 43 unmodified lines
15371537 *ret_nested_attribute_table = NULL;
15381538 if (!tla)
15391539 return -ENOMSG;
1540− ntb = kcalloc(DRBD_A_PEER_DEVICE_INFO_PEER_RESYNC_SUSP_DEPENDENCY + 1, sizeof(*ntb), GFP_KERNEL);
1540+ ntb = kzalloc_objs(*ntb,
1541+ DRBD_A_PEER_DEVICE_INFO_PEER_RESYNC_SUSP_DEPENDENCY + 1);
15411542 if (!ntb)
15421543 return -ENOMEM;
15431544 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_peer_device_info_nl_policy, NULL);
@@ -1599,7 +1600,8 @@ static int __resource_statistics_from_attrs(struct resource_statistics *s, · 55 unmodified lines
15991600 *ret_nested_attribute_table = NULL;
16001601 if (!tla)
16011602 return -ENOMSG;
1602− ntb = kcalloc(DRBD_A_RESOURCE_STATISTICS_RES_STAT_WRITE_ORDERING + 1, sizeof(*ntb), GFP_KERNEL);
1603+ ntb = kzalloc_objs(*ntb,
1604+ DRBD_A_RESOURCE_STATISTICS_RES_STAT_WRITE_ORDERING + 1);
16031605 if (!ntb)
16041606 return -ENOMEM;
16051607 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_resource_statistics_nl_policy, NULL);
@@ -1645,7 +1647,7 @@ static int __device_statistics_from_attrs(struct device_statistics *s, · 39 unmodified lines
16451647 *ret_nested_attribute_table = NULL;
16461648 if (!tla)
16471649 return -ENOMSG;
1648− ntb = kcalloc(DRBD_A_DEVICE_STATISTICS_HISTORY_UUIDS + 1, sizeof(*ntb), GFP_KERNEL);
1650+ ntb = kzalloc_objs(*ntb, DRBD_A_DEVICE_STATISTICS_HISTORY_UUIDS + 1);
16491651 if (!ntb)
16501652 return -ENOMEM;
16511653 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_device_statistics_nl_policy, NULL);
@@ -1743,7 +1745,8 @@ static int __connection_statistics_from_attrs(struct connection_statistics *s, · 91 unmodified lines
17431745 *ret_nested_attribute_table = NULL;
17441746 if (!tla)
17451747 return -ENOMSG;
1746− ntb = kcalloc(DRBD_A_CONNECTION_STATISTICS_CONN_CONGESTED + 1, sizeof(*ntb), GFP_KERNEL);
1748+ ntb = kzalloc_objs(*ntb,
1749+ DRBD_A_CONNECTION_STATISTICS_CONN_CONGESTED + 1);
17471750 if (!ntb)
17481751 return -ENOMEM;
17491752 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_connection_statistics_nl_policy, NULL);
@@ -1789,7 +1792,8 @@ static int __peer_device_statistics_from_attrs(struct peer_device_statistics *s, · 39 unmodified lines
17891792 *ret_nested_attribute_table = NULL;
17901793 if (!tla)
17911794 return -ENOMSG;
1792− ntb = kcalloc(DRBD_A_PEER_DEVICE_STATISTICS_PEER_DEV_FLAGS + 1, sizeof(*ntb), GFP_KERNEL);
1795+ ntb = kzalloc_objs(*ntb,
1796+ DRBD_A_PEER_DEVICE_STATISTICS_PEER_DEV_FLAGS + 1);
17931797 if (!ntb)
17941798 return -ENOMEM;
17951799 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_peer_device_statistics_nl_policy, NULL);
drivers/block/ublk_drv.c+2−2
@@ -5390,7 +5390,7 @@ static int __ublk_ctrl_reg_buf(struct ublk_device *ub, · 5389 unmodified lines
53905390 page_to_pfn(pages[i + 1]) == pfn + (i - start) + 1)
53915391 i++;
53925392
5393− range = kzalloc(sizeof(*range), GFP_KERNEL);
5393+ range = kzalloc_obj(*range);
53945394 if (!range) {
53955395 ret = -ENOMEM;
53965396 goto unwind;
@@ -5453,7 +5453,7 @@ static int ublk_ctrl_reg_buf(struct ublk_device *ub, · 56 unmodified lines
54535453 nr_pages = buf_reg.len >> PAGE_SHIFT;
54545454
54555455 /* Pin pages before any locks (may sleep) */
5456− pages = kvmalloc_array(nr_pages, sizeof(*pages), GFP_KERNEL);
5456+ pages = kvmalloc_objs(*pages, nr_pages);
54575457 if (!pages)
54585458 return -ENOMEM;
54595459
drivers/block/zram/backend_lz4.c+1−1
@@ -42,7 +42,7 @@ static int lz4_setup_params(struct zcomp_params *params) · 41 unmodified lines
4242 if (!params->dict || !params->dict_sz)
4343 return 0;
4444
45− dict_stream = kzalloc_obj(*dict_stream, GFP_KERNEL);
45+ dict_stream = kzalloc_obj(*dict_stream);
4646 if (!dict_stream)
4747 return -ENOMEM;
4848
drivers/clk/ti/composite.c+1−1
@@ -248,7 +248,7 @@ int __init ti_clk_add_component(struct device_node *node, struct clk_hw *hw, · 247 unmodified lines
248248 return -EINVAL;
249249 }
250250
251− parent_data = kcalloc(num_parents, sizeof(*parent_data), GFP_KERNEL);
251+ parent_data = kzalloc_objs(*parent_data, num_parents);
252252 if (!parent_data)
253253 return -ENOMEM;
254254
drivers/clk/ti/mux.c+1−1
@@ -181,7 +181,7 @@ static void of_mux_clk_setup(struct device_node *node) · 180 unmodified lines
181181 pr_err("mux-clock %pOFn must have parents\n", node);
182182 return;
183183 }
184− parent_data = kcalloc(num_parents, sizeof(*parent_data), GFP_KERNEL);
184+ parent_data = kzalloc_objs(*parent_data, num_parents);
185185 if (!parent_data)
186186 return;
187187
drivers/cpufreq/amd-pstate.c+1−1
@@ -1624,7 +1624,7 @@ static struct freq_attr **get_freq_attrs(void) · 1623 unmodified lines
16241624 /* amd_pstate_{max_freq, lowest_nonlinear_freq, highest_perf} should always be visible */
16251625 BUG_ON(!count);
16261626
1627− attrs = kcalloc(count + 1, sizeof(struct freq_attr *), GFP_KERNEL);
1627+ attrs = kzalloc_objs(struct freq_attr *, count + 1);
16281628 if (!attrs)
16291629 return ERR_PTR(-ENOMEM);
16301630
drivers/crypto/inside-secure/eip93/eip93-common.c+2−3
@@ -533,7 +533,7 @@ int eip93_send_req(struct crypto_async_request *async, · 532 unmodified lines
533533
534534 memcpy(iv, reqiv, rctx->ivsize);
535535
536− rctx->sa_state = kzalloc(sizeof(*rctx->sa_state), GFP_KERNEL);
536+ rctx->sa_state = kzalloc_obj(*rctx->sa_state);
537537 if (!rctx->sa_state)
538538 return -ENOMEM;
539539
@@ -561,8 +561,7 @@ int eip93_send_req(struct crypto_async_request *async, · 21 unmodified lines
561561 iv[3] = 0xffffffff;
562562 crypto_inc((u8 *)iv, AES_BLOCK_SIZE);
563563
564− rctx->sa_state_ctr = kzalloc(sizeof(*rctx->sa_state_ctr),
565− GFP_KERNEL);
564+ rctx->sa_state_ctr = kzalloc_obj(*rctx->sa_state_ctr);
566565 if (!rctx->sa_state_ctr) {
567566 err = -ENOMEM;
568567 goto free_sa_state;
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c+1−2
@@ -59,8 +59,7 @@ static void *qat_zstd_alloc_scratch(void) · 58 unmodified lines
5959 if (!scratch->literals)
6060 goto error;
6161
62− scratch->out_seqs = kvcalloc(QAT_MAX_SEQUENCES, sizeof(ZSTD_Sequence),
63− GFP_KERNEL);
62+ scratch->out_seqs = kvzalloc_objs(ZSTD_Sequence, QAT_MAX_SEQUENCES);
6463 if (!scratch->out_seqs)
6564 goto error;
6665
drivers/crypto/ti/dthev2-aes.c+4−4
@@ -387,7 +387,7 @@ static int dthe_aes_run(struct crypto_engine *engine, void *areq) · 386 unmodified lines
387387 src_nents++;
388388 dst_nents++;
389389
390− src = kmalloc_array(src_nents, sizeof(*src), GFP_ATOMIC);
390+ src = kmalloc_objs(*src, src_nents, GFP_ATOMIC);
391391 if (!src) {
392392 ret = -ENOMEM;
393393 goto aes_ctr_src_alloc_err;
@@ -399,7 +399,7 @@ static int dthe_aes_run(struct crypto_engine *engine, void *areq) · 5 unmodified lines
399399 sg_set_buf(sg, pad_buf, pad_size);
400400
401401 if (diff_dst) {
402− dst = kmalloc_array(dst_nents, sizeof(*dst), GFP_ATOMIC);
402+ dst = kmalloc_objs(*dst, dst_nents, GFP_ATOMIC);
403403 if (!dst) {
404404 ret = -ENOMEM;
405405 goto aes_ctr_dst_alloc_err;
@@ -624,7 +624,7 @@ static struct scatterlist *dthe_aead_prep_aad(struct scatterlist *sg, · 218 unmodified lines
624624 if (assoclen % AES_BLOCK_SIZE)
625625 aad_nents++;
626626
627− aad_sg = kmalloc_array(aad_nents, sizeof(struct scatterlist), GFP_ATOMIC);
627+ aad_sg = kmalloc_objs(struct scatterlist, aad_nents, GFP_ATOMIC);
628628 if (!aad_sg)
629629 return ERR_PTR(-ENOMEM);
630630
@@ -680,7 +680,7 @@ static struct scatterlist *dthe_aead_prep_crypt(struct scatterlist *sg, · 49 unmodified lines
680680 if (cryptlen % AES_BLOCK_SIZE)
681681 crypt_nents++;
682682
683− crypt_sg = kmalloc_array(crypt_nents, sizeof(struct scatterlist), GFP_ATOMIC);
683+ crypt_sg = kmalloc_objs(struct scatterlist, crypt_nents, GFP_ATOMIC);
684684 if (!crypt_sg) {
685685 err = -ENOMEM;
686686 goto dthe_aead_prep_crypt_mem_err;
drivers/devfreq/hisi_uncore_freq.c+1−1
@@ -474,7 +474,7 @@ static int hisi_uncore_mark_related_cpus(struct hisi_uncore_freq *uncore, · 473 unmodified lines
474474 return -EINVAL;
475475
476476 len = rc;
477− u32 *num __free(kfree) = kcalloc(len, sizeof(*num), GFP_KERNEL);
477+ u32 *num __free(kfree) = kzalloc_objs(*num, len);
478478 if (!num)
479479 return -ENOMEM;
480480
drivers/dma-buf/st-dma-fence.c+1−1
@@ -27,7 +27,7 @@ static struct dma_fence *mock_fence(void) · 26 unmodified lines
2727 {
2828 struct dma_fence *f;
2929
30− f = kmalloc(sizeof(*f), GFP_KERNEL);
30+ f = kmalloc_obj(*f);
3131 if (!f)
3232 return NULL;
3333
drivers/dma-buf/udmabuf.c+2−2
@@ -359,7 +359,7 @@ static long udmabuf_create(struct miscdevice *device, · 358 unmodified lines
359359 long ret = -EINVAL;
360360 u32 i, flags;
361361
362− ubuf = kzalloc(sizeof(*ubuf), GFP_KERNEL);
362+ ubuf = kzalloc_obj(*ubuf);
363363 if (!ubuf)
364364 return -ENOMEM;
365365
@@ -387,7 +387,7 @@ static long udmabuf_create(struct miscdevice *device, · 21 unmodified lines
387387 if (ret)
388388 goto err;
389389
390− folios = kvmalloc_array(max_nr_folios, sizeof(*folios), GFP_KERNEL);
390+ folios = kvmalloc_objs(*folios, max_nr_folios);
391391 if (!folios) {
392392 ret = -ENOMEM;
393393 goto err;
drivers/dma/switchtec_dma.c+3−4
@@ -1056,7 +1056,7 @@ static int switchtec_dma_chan_init(struct switchtec_dma_dev *swdma_dev, · 1055 unmodified lines
10561056 int se_buf_len, irq, rc;
10571057 struct dma_chan *chan;
10581058
1059− swdma_chan = kzalloc_obj(*swdma_chan, GFP_KERNEL);
1059+ swdma_chan = kzalloc_obj(*swdma_chan);
10601060 if (!swdma_chan)
10611061 return -ENOMEM;
10621062
@@ -1162,8 +1162,7 @@ static int switchtec_dma_chans_enumerate(struct switchtec_dma_dev *swdma_dev, · 99 unmodified lines
11621162 struct dma_device *dma = &swdma_dev->dma_dev;
11631163 int base, cnt, rc, i;
11641164
1165− swdma_dev->swdma_chans = kcalloc(chan_cnt, sizeof(*swdma_dev->swdma_chans),
1166− GFP_KERNEL);
1165+ swdma_dev->swdma_chans = kzalloc_objs(*swdma_dev->swdma_chans, chan_cnt);
11671166
11681167 if (!swdma_dev->swdma_chans)
11691168 return -ENOMEM;
@@ -1222,7 +1221,7 @@ static int switchtec_dma_create(struct pci_dev *pdev) · 52 unmodified lines
12221221 /*
12231222 * Create the switchtec dma device
12241223 */
1225− swdma_dev = kzalloc_obj(*swdma_dev, GFP_KERNEL);
1224+ swdma_dev = kzalloc_obj(*swdma_dev);
12261225 if (!swdma_dev)
12271226 return -ENOMEM;
12281227
drivers/edac/versalnet_edac.c+1−1
@@ -813,7 +813,7 @@ static int init_one_mc(struct mc_priv *priv, struct platform_device *pdev, int i · 812 unmodified lines
813813 layers[1].is_virt_csrow = false;
814814
815815 rc = -ENOMEM;
816− dev = kzalloc(sizeof(*dev), GFP_KERNEL);
816+ dev = kzalloc_obj(*dev);
817817 if (!dev)
818818 return rc;
819819
drivers/firmware/arm_scmi/driver.c+1−1
@@ -1792,7 +1792,7 @@ static void *scmi_iterator_init(const struct scmi_protocol_handle *ph, · 1791 unmodified lines
17921792 {
17931793 int ret;
17941794
1795− struct scmi_iterator *i __free(kfree) = kzalloc(sizeof(*i), GFP_KERNEL);
1795+ struct scmi_iterator *i __free(kfree) = kzalloc_obj(*i);
17961796 if (!i)
17971797 return ERR_PTR(-ENOMEM);
17981798
drivers/firmware/qcom/qcom_tzmem.c+3−5
@@ -169,7 +169,7 @@ static int qcom_tzmem_init_area(struct qcom_tzmem_area *area) · 168 unmodified lines
169169 {
170170 int ret;
171171
172− u64 *handle __free(kfree) = kzalloc(sizeof(*handle), GFP_KERNEL);
172+ u64 *handle __free(kfree) = kzalloc_obj(*handle);
173173 if (!handle)
174174 return -ENOMEM;
175175
@@ -197,8 +197,7 @@ static int qcom_tzmem_pool_add_memory(struct qcom_tzmem_pool *pool, · 21 unmodified lines
197197 {
198198 int ret;
199199
200− struct qcom_tzmem_area *area __free(kfree) = kzalloc(sizeof(*area),
201− gfp);
200+ struct qcom_tzmem_area *area __free(kfree) = kzalloc_obj(*area, gfp);
202201 if (!area)
203202 return -ENOMEM;
204203
@@ -415,8 +414,7 @@ void *qcom_tzmem_alloc(struct qcom_tzmem_pool *pool, size_t size, gfp_t gfp) · 210 unmodified lines
415414
416415 size = PAGE_ALIGN(size);
417416
418− struct qcom_tzmem_chunk *chunk __free(kfree) = kzalloc(sizeof(*chunk),
419− gfp);
417+ struct qcom_tzmem_chunk *chunk __free(kfree) = kzalloc_obj(*chunk, gfp);
420418 if (!chunk)
421419 return NULL;
422420
drivers/firmware/ti_sci.c+1−1
@@ -2386,7 +2386,7 @@ static int ti_sci_set_irq(const struct ti_sci_handle *handle, u32 valid_params, · 2385 unmodified lines
23862386 if (ret || !(info->fw_caps & MSG_FLAG_CAPS_LPM_IRQ_CONTEXT_LOST))
23872387 goto end;
23882388
2389− irq = kzalloc_obj(*irq, GFP_KERNEL);
2389+ irq = kzalloc_obj(*irq);
23902390 if (!irq) {
23912391 ti_sci_manage_irq(handle, valid_params, src_id, src_index,
23922392 dst_id, dst_host_irq, ia_id, vint,
drivers/fpga/dfl-afu-dma-region.c+1−1
@@ -316,7 +316,7 @@ int afu_dma_map_region(struct dfl_feature_dev_data *fdata, · 315 unmodified lines
316316 if (user_addr + length < user_addr)
317317 return -EINVAL;
318318
319− region = kzalloc(sizeof(*region), GFP_KERNEL);
319+ region = kzalloc_obj(*region);
320320 if (!region)
321321 return -ENOMEM;
322322
drivers/gpio/gpio-aggregator.c+2−2
@@ -886,8 +886,8 @@ gpio_aggregator_make_device_sw_node(struct gpio_aggregator *aggr) · 885 unmodified lines
886886 if (num_lines == 0)
887887 return NULL;
888888
889− const char **line_names __free(kfree) = kcalloc(
890− num_lines, sizeof(*line_names), GFP_KERNEL);
889+ const char **line_names __free(kfree) = kzalloc_objs(*line_names,
890+ num_lines);
891891 if (!line_names)
892892 return ERR_PTR(-ENOMEM);
893893
drivers/gpio/gpio-mpsse.c+1−1
@@ -518,7 +518,7 @@ static void gpio_mpsse_irq_enable(struct irq_data *irqd) · 517 unmodified lines
518518 * Can't be devm because it uses a non-raw spinlock (illegal in
519519 * this context, where a raw spinlock is held by our caller)
520520 */
521− worker = kzalloc(sizeof(*worker), GFP_NOWAIT);
521+ worker = kzalloc_obj(*worker, GFP_NOWAIT);
522522 if (!worker)
523523 return;
524524
drivers/gpio/gpio-sim.c+1−2
@@ -790,8 +790,7 @@ gpio_sim_make_bank_swnode(struct gpio_sim_bank *bank, · 789 unmodified lines
790790
791791 line_names_size = gpio_sim_get_line_names_size(bank);
792792 if (line_names_size) {
793− line_names = kcalloc(line_names_size, sizeof(*line_names),
794− GFP_KERNEL);
793+ line_names = kzalloc_objs(*line_names, line_names_size);
795794 if (!line_names)
796795 return ERR_PTR(-ENOMEM);
797796
drivers/gpio/gpio-virtuser.c+1−2
@@ -1429,8 +1429,7 @@ gpio_virtuser_make_device_swnode(struct gpio_virtuser_device *dev) · 1428 unmodified lines
14291429 memset(properties, 0, sizeof(properties));
14301430
14311431 num_ids = list_count_nodes(&dev->lookup_list);
1432− char **ids __free(kfree) = kcalloc(num_ids + 1, sizeof(*ids),
1433− GFP_KERNEL);
1432+ char **ids __free(kfree) = kzalloc_objs(*ids, num_ids + 1);
14341433 if (!ids)
14351434 return ERR_PTR(-ENOMEM);
14361435
drivers/gpio/gpiolib-cdev.c+1−1
@@ -2653,7 +2653,7 @@ static int gpio_chrdev_open(struct inode *inode, struct file *file) · 2652 unmodified lines
26532653 struct gpio_chardev_data *cdev;
26542654 int ret = -ENOMEM;
26552655
2656− cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
2656+ cdev = kzalloc_obj(*cdev);
26572657 if (!cdev)
26582658 return -ENOMEM;
26592659
drivers/gpio/gpiolib.c+2−2
@@ -1178,7 +1178,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, · 1177 unmodified lines
11781178 int base = 0;
11791179 int ret;
11801180
1181− gdev = kzalloc(sizeof(*gdev), GFP_KERNEL);
1181+ gdev = kzalloc_obj(*gdev);
11821182 if (!gdev)
11831183 return -ENOMEM;
11841184 gc->gpiodev = gdev;
@@ -1218,7 +1218,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, · 33 unmodified lines
12181218 goto err_put_device;
12191219 gdev->ngpio = gc->ngpio;
12201220
1221− gdev->descs = kcalloc(gc->ngpio, sizeof(*gdev->descs), GFP_KERNEL);
1221+ gdev->descs = kzalloc_objs(*gdev->descs, gc->ngpio);
12221222 if (!gdev->descs) {
12231223 ret = -ENOMEM;
12241224 goto err_put_device;
drivers/gpu/buddy.c+4−9
@@ -411,16 +411,13 @@ int gpu_buddy_init(struct gpu_buddy *mm, u64 size, u64 chunk_size) · 410 unmodified lines
411411 if (!mm->used_scoreboard)
412412 goto out_free_free_scoreboard;
413413
414− mm->free_trees = kmalloc_array(GPU_BUDDY_MAX_FREE_TREES,
415− sizeof(*mm->free_trees),
416− GFP_KERNEL);
414+ mm->free_trees = kmalloc_objs(*mm->free_trees, GPU_BUDDY_MAX_FREE_TREES);
417415 if (!mm->free_trees)
418416 goto out_free_used_scoreboard;
419417
420418 for_each_free_tree(i) {
421− mm->free_trees[i] = kmalloc_array(mm->max_order + 1,
422− sizeof(struct rb_root),
423− GFP_KERNEL);
419+ mm->free_trees[i] = kmalloc_objs(struct rb_root,
420+ mm->max_order + 1);
424421 if (!mm->free_trees[i])
425422 goto out_free_tree;
426423
@@ -430,9 +427,7 @@ int gpu_buddy_init(struct gpu_buddy *mm, u64 size, u64 chunk_size) · 3 unmodified lines
430427
431428 mm->n_roots = hweight64(size);
432429
433− mm->roots = kmalloc_array(mm->n_roots,
434− sizeof(struct gpu_buddy_block *),
435− GFP_KERNEL);
430+ mm->roots = kmalloc_objs(struct gpu_buddy_block *, mm->n_roots);
436431 if (!mm->roots)
437432 goto out_free_tree;
438433
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c+2−3
@@ -603,9 +603,8 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool skip_vram_check, · 602 unmodified lines
603603 ring_count++;
604604 }
605605 if (ring_count)
606− coredump->rings = kvcalloc(ring_count,
607− sizeof(struct amdgpu_coredump_ring),
608− GFP_NOWAIT);
606+ coredump->rings = kvzalloc_objs(struct amdgpu_coredump_ring,
607+ ring_count, GFP_NOWAIT);
609608 if (coredump->rings) {
610609 for (i = 0, idx = 0; i < adev->num_rings && idx < ring_count; i++) {
611610 struct amdgpu_coredump_ring *cdump_ring;
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c+2−2
@@ -1608,11 +1608,11 @@ int amdgpu_discovery_sysfs_early_init(struct amdgpu_device *adev, struct pci_dev · 1607 unmodified lines
16081608
16091609 discovery_bin = adev->discovery.bin;
16101610
1611− early_entry = kzalloc(sizeof(*early_entry), GFP_KERNEL);
1611+ early_entry = kzalloc_obj(*early_entry);
16121612 if (!early_entry)
16131613 return -ENOMEM;
16141614
1615− ip_top = kzalloc(sizeof(*ip_top), GFP_KERNEL);
1615+ ip_top = kzalloc_obj(*ip_top);
16161616 if (!ip_top) {
16171617 kfree(early_entry);
16181618 return -ENOMEM;
drivers/gpu/drm/amd/amdgpu/amdgpu_lockdep.c+1−1
@@ -98,7 +98,7 @@ int amdgpu_lockdep_init(void) · 97 unmodified lines
9898 struct amdgpu_lockdep_dummy_locks *locks;
9999 unsigned long flags;
100100
101− locks = kzalloc(sizeof(*locks), GFP_KERNEL);
101+ locks = kzalloc_obj(*locks);
102102 if (!locks)
103103 return -ENOMEM;
104104
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c+1−1
@@ -1293,7 +1293,7 @@ amdgpu_ras_debugfs_table_read_uniras(struct amdgpu_device *adev, · 1292 unmodified lines
12931293 return -ENOMEM;
12941294
12951295 if (num_recs) {
1296− records = kvcalloc(num_recs, sizeof(*records), GFP_KERNEL);
1296+ records = kvzalloc_objs(*records, num_recs);
12971297 if (!records) {
12981298 res = -ENOMEM;
12991299 goto out;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c+2−3
@@ -2361,9 +2361,8 @@ void amdgpu_ttm_enable_buffer_funcs(struct amdgpu_device *adev) · 2360 unmodified lines
23612361 num_clear_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES);
23622362 num_move_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES);
23632363
2364− adev->mman.clear_entities = kcalloc(num_clear_entities,
2365− sizeof(struct amdgpu_ttm_buffer_entity),
2366− GFP_KERNEL);
2364+ adev->mman.clear_entities = kzalloc_objs(struct amdgpu_ttm_buffer_entity,
2365+ num_clear_entities);
23672366 atomic_set(&adev->mman.next_clear_entity, 0);
23682367 if (!adev->mman.clear_entities)
23692368 goto error_free_default_entity;
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c+2−2
@@ -159,8 +159,8 @@ void amdgpu_umc_handle_bad_pages(struct amdgpu_device *adev, · 158 unmodified lines
159159 adev->umc.ras->ecc_info_query_ras_error_address &&
160160 adev->umc.max_ras_err_cnt_per_query) {
161161 err_data->err_addr =
162− kcalloc(adev->umc.max_ras_err_cnt_per_query,
163− sizeof(struct eeprom_table_record), GFP_KERNEL);
162+ kzalloc_objs(struct eeprom_table_record,
163+ adev->umc.max_ras_err_cnt_per_query);
164164
165165 /* still call query_ras_error_address to clear error status
166166 * even NOMEM error is encountered
drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c+2−4
@@ -227,7 +227,7 @@ static int amdgpu_userq_fence_alloc(struct amdgpu_usermode_queue *userq, · 226 unmodified lines
227227 struct amdgpu_userq_fence *userq_fence;
228228 void *entry;
229229
230− userq_fence = kmalloc(sizeof(*userq_fence), GFP_KERNEL);
230+ userq_fence = kmalloc_obj(*userq_fence);
231231 if (!userq_fence)
232232 return -ENOMEM;
233233
@@ -244,9 +244,7 @@ static int amdgpu_userq_fence_alloc(struct amdgpu_usermode_queue *userq, · 10 unmodified lines
244244 } while (xas_retry(&xas, entry));
245245 rcu_read_unlock();
246246
247− userq_fence->fence_drv_array = kvmalloc_array(xas.xa_index,
248− sizeof(fence_drv),
249− GFP_KERNEL);
247+ userq_fence->fence_drv_array = kvmalloc_objs(fence_drv, xas.xa_index);
250248 if (!userq_fence->fence_drv_array) {
251249 mutex_unlock(&userq->fence_drv_lock);
252250 kfree(userq_fence);
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c+3−3
@@ -316,8 +316,8 @@ static int amdgpu_virt_ras_realloc_eh_data_space(struct amdgpu_device *adev, · 315 unmodified lines
316316 if (align_space > AMDGPU_VIRT_RAS_BAD_PAGE_TABLE_MAX_CAPACITY)
317317 return -ENOMEM;
318318
319− new_bps = kmalloc_array(align_space, sizeof(*data->bps), GFP_KERNEL);
320− new_bo = kcalloc(align_space, sizeof(*data->bps_bo), GFP_KERNEL);
319+ new_bps = kmalloc_objs(*data->bps, align_space);
320+ new_bo = kzalloc_objs(*data->bps_bo, align_space);
321321 if (!new_bps || !new_bo) {
322322 kfree(new_bps);
323323 kfree(new_bo);
@@ -355,7 +355,7 @@ static int amdgpu_virt_init_ras_err_handler_data(struct amdgpu_device *adev) · 31 unmodified lines
355355 if (!bps)
356356 goto bps_failure;
357357
358− bps_bo = kcalloc(align_space, sizeof(*(*data)->bps_bo), GFP_KERNEL);
358+ bps_bo = kzalloc_objs(*(*data)->bps_bo, align_space);
359359 if (!bps_bo)
360360 goto bps_bo_failure;
361361
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c+6−6
@@ -1921,13 +1921,13 @@ static int criu_checkpoint_devices(struct kfd_process *p, · 1920 unmodified lines
19211921 struct kfd_criu_device_bucket *device_buckets = NULL;
19221922 int ret = 0, i;
19231923
1924− device_buckets = kvcalloc(num_devices, sizeof(*device_buckets), GFP_KERNEL);
1924+ device_buckets = kvzalloc_objs(*device_buckets, num_devices);
19251925 if (!device_buckets) {
19261926 ret = -ENOMEM;
19271927 goto exit;
19281928 }
19291929
1930− device_priv = kvcalloc(num_devices, sizeof(*device_priv), GFP_KERNEL);
1930+ device_priv = kvzalloc_objs(*device_priv, num_devices);
19311931 if (!device_priv) {
19321932 ret = -ENOMEM;
19331933 goto exit;
@@ -2047,17 +2047,17 @@ static int criu_checkpoint_bos(struct kfd_process *p, · 113 unmodified lines
20472047 int ret = 0, pdd_index, bo_index = 0, id;
20482048 void *mem;
20492049
2050− bo_buckets = kvcalloc(num_bos, sizeof(*bo_buckets), GFP_KERNEL);
2050+ bo_buckets = kvzalloc_objs(*bo_buckets, num_bos);
20512051 if (!bo_buckets)
20522052 return -ENOMEM;
20532053
2054− bo_privs = kvcalloc(num_bos, sizeof(*bo_privs), GFP_KERNEL);
2054+ bo_privs = kvzalloc_objs(*bo_privs, num_bos);
20552055 if (!bo_privs) {
20562056 ret = -ENOMEM;
20572057 goto exit;
20582058 }
20592059
2060− files = kvcalloc(num_bos, sizeof(struct file *), GFP_KERNEL);
2060+ files = kvzalloc_objs(struct file *, num_bos);
20612061 if (!files) {
20622062 ret = -ENOMEM;
20632063 goto exit;
@@ -2588,7 +2588,7 @@ static int criu_restore_bos(struct kfd_process *p, · 524 unmodified lines
25882588 if (!bo_buckets)
25892589 return -ENOMEM;
25902590
2591− files = kvcalloc(args->num_bos, sizeof(struct file *), GFP_KERNEL);
2591+ files = kvzalloc_objs(struct file *, args->num_bos);
25922592 if (!files) {
25932593 ret = -ENOMEM;
25942594 goto exit;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c+1−1
@@ -4180,7 +4180,7 @@ dm_test_destroy_connector(struct kunit *test, struct drm_device *drm) · 4179 unmodified lines
41804180 {
41814181 struct amdgpu_dm_connector *aconnector;
41824182
4183− aconnector = kzalloc(sizeof(*aconnector), GFP_KERNEL);
4183+ aconnector = kzalloc_obj(*aconnector);
41844184 KUNIT_ASSERT_NOT_NULL(test, aconnector);
41854185
41864186 KUNIT_ASSERT_EQ(test,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c+4−4
@@ -1445,7 +1445,7 @@ static void dm_test_crtc_destroy_state_no_stream(struct kunit *test) · 1444 unmodified lines
14451445 struct dm_crtc_state *dm_state;
14461446
14471447 /* destroy_state kfree()s the state, so use a plain (unmanaged) alloc. */
1448− dm_state = kzalloc_obj(*dm_state, GFP_KERNEL);
1448+ dm_state = kzalloc_obj(*dm_state);
14491449 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dm_state);
14501450
14511451 amdgpu_dm_crtc_destroy_state(NULL, &dm_state->base);
@@ -1475,7 +1475,7 @@ static void dm_test_crtc_destroy_state_releases_stream(struct kunit *test) · 23 unmodified lines
14751475 kref_get(&stream->refcount);
14761476
14771477 /* destroy_state kfree()s the state, so use a plain (unmanaged) alloc. */
1478− dm_state = kzalloc_obj(*dm_state, GFP_KERNEL);
1478+ dm_state = kzalloc_obj(*dm_state);
14791479 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dm_state);
14801480 dm_state->stream = stream;
14811481
@@ -1569,7 +1569,7 @@ static void dm_test_crtc_handle_vblank_completes_cursor_only(struct kunit *test) · 87 unmodified lines
15691569 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, acrtc);
15701570
15711571 /* drm_crtc_send_vblank_event() consumes (kfree()s) the event. */
1572− event = kzalloc_obj(*event, GFP_KERNEL);
1572+ event = kzalloc_obj(*event);
15731573 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, event);
15741574
15751575 acrtc->base.dev = &adev->ddev;
@@ -1628,7 +1628,7 @@ dm_test_vblank_control_worker_setup(struct kunit *test, bool enable, · 52 unmodified lines
16281628 kref_get(&stream->refcount);
16291629
16301630 /* Worker kfree()s the work item, so it must be a plain allocation. */
1631− work = kzalloc_obj(*work, GFP_KERNEL);
1631+ work = kzalloc_obj(*work);
16321632 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, work);
16331633 work->dm = &adev->dm;
16341634 work->acrtc = acrtc;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c+9−9
@@ -103,7 +103,7 @@ static enum dc_status dm_test_dp_read_hpd_rx_irq_data_ok(struct dc_link *link, · 102 unmodified lines
103103 */
104104 static struct dc_sink *dm_test_sink_create(struct dc_link *link)
105105 {
106− struct dc_sink *sink = kzalloc(sizeof(*sink), GFP_KERNEL);
106+ struct dc_sink *sink = kzalloc_obj(*sink);
107107
108108 if (!sink)
109109 return NULL;
@@ -2131,7 +2131,7 @@ static void dm_test_hpd_rx_offload_work_no_connector(struct kunit *test) · 2021 unmodified lines
21312131 offload_wq = kunit_kzalloc(test, sizeof(*offload_wq), GFP_KERNEL);
21322132 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_wq);
21332133
2134− offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL);
2134+ offload_work = kzalloc_obj(*offload_work);
21352135 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);
21362136 offload_work->offload_wq = offload_wq;
21372137 offload_work->adev = adev;
@@ -2177,7 +2177,7 @@ static void dm_test_hpd_rx_offload_work_no_connection(struct kunit *test) · 39 unmodified lines
21772177 link->dc = dc;
21782178 aconn->dc_link = link;
21792179
2180− offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL);
2180+ offload_work = kzalloc_obj(*offload_work);
21812181 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);
21822182 offload_work->offload_wq = offload_wq;
21832183 offload_work->adev = adev;
@@ -2244,7 +2244,7 @@ static void dm_test_hpd_rx_offload_work_automated_test(struct kunit *test) · 60 unmodified lines
22442244 link->connector_signal = SIGNAL_TYPE_DISPLAY_PORT;
22452245 aconn->dc_link = link;
22462246
2247− offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL);
2247+ offload_work = kzalloc_obj(*offload_work);
22482248 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);
22492249 offload_work->offload_wq = offload_wq;
22502250 offload_work->adev = adev;
@@ -2315,7 +2315,7 @@ static void dm_test_hpd_rx_offload_work_link_loss(struct kunit *test) · 64 unmodified lines
23152315 link->connector_signal = SIGNAL_TYPE_DISPLAY_PORT;
23162316 aconn->dc_link = link;
23172317
2318− offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL);
2318+ offload_work = kzalloc_obj(*offload_work);
23192319 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);
23202320 offload_work->offload_wq = offload_wq;
23212321 offload_work->adev = adev;
@@ -3452,9 +3452,9 @@ static void dm_test_handle_hpd_work_out_of_range(struct kunit *test) · 1130 unmodified lines
34523452 struct amdgpu_device *adev;
34533453
34543454 adev = dm_kunit_alloc_adev(test);
3455− hpd_work = kzalloc(sizeof(*hpd_work), GFP_KERNEL);
3455+ hpd_work = kzalloc_obj(*hpd_work);
34563456 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hpd_work);
3457− hpd_work->dmub_notify = kzalloc(sizeof(*hpd_work->dmub_notify), GFP_KERNEL);
3457+ hpd_work->dmub_notify = kzalloc_obj(*hpd_work->dmub_notify);
34583458 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hpd_work->dmub_notify);
34593459 hpd_work->dmub_notify->type =
34603460 (enum dmub_notification_type)ARRAY_SIZE(adev->dm.dmub_callback);
@@ -3899,9 +3899,9 @@ static void dm_test_handle_vmin_vmax_update(struct kunit *test) · 438 unmodified lines
38993899 kref_get(&stream->refcount);
39003900
39013901 /* The worker kfree()s both, so they must come from the slab. */
3902− work = kzalloc(sizeof(*work), GFP_KERNEL);
3902+ work = kzalloc_obj(*work);
39033903 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, work);
3904− adjust = kzalloc(sizeof(*adjust), GFP_KERNEL);
3904+ adjust = kzalloc_obj(*adjust);
39053905 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adjust);
39063906
39073907 work->adev = adev;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c+2−2
@@ -2945,7 +2945,7 @@ static void dm_test_plane_reset_initializes_state(struct kunit *test) · 2944 unmodified lines
29452945 * destroy-existing-state path. The destroy hook frees this state, so it
29462946 * must be a plain (non-KUnit-managed) allocation.
29472947 */
2948− old_state = kzalloc(sizeof(*old_state), GFP_KERNEL);
2948+ old_state = kzalloc_obj(*old_state);
29492949 KUNIT_ASSERT_NOT_NULL(test, old_state);
29502950 plane->funcs = &dm_test_plane_reset_funcs;
29512951 plane->state = &old_state->base;
@@ -3018,7 +3018,7 @@ static void dm_test_plane_destroy_state_minimal(struct kunit *test) · 66 unmodified lines
30183018 KUNIT_ASSERT_NOT_NULL(test, plane);
30193019
30203020 /* destroy_state frees the state itself, so use a plain allocation. */
3021− dm_plane_state = kzalloc(sizeof(*dm_plane_state), GFP_KERNEL);
3021+ dm_plane_state = kzalloc_obj(*dm_plane_state);
30223022 KUNIT_ASSERT_NOT_NULL(test, dm_plane_state);
30233023
30243024 amdgpu_dm_plane_drm_plane_destroy_state(plane, &dm_plane_state->base);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c+1−1
@@ -239,7 +239,7 @@ static void dm_test_atomic_destroy_state_no_context(struct kunit *test) · 238 unmodified lines
239239 * Use kzalloc(), not kunit_kzalloc(): dm_atomic_destroy_state() frees
240240 * the state itself, so KUnit-managed memory would be double-freed.
241241 */
242− dm_state = kzalloc(sizeof(*dm_state), GFP_KERNEL);
242+ dm_state = kzalloc_obj(*dm_state);
243243 KUNIT_ASSERT_NOT_NULL(test, dm_state);
244244
245245 /* context == NULL: dc_state_release() is skipped and the state is freed. */
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c+1−1
@@ -377,7 +377,7 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p · 376 unmodified lines
377377 }
378378 break;
379379 case AMDGPU_FAMILY_GC_11_5_4: {
380− struct clk_mgr_dcn42 *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL);
380+ struct clk_mgr_dcn42 *clk_mgr = kzalloc_obj(*clk_mgr);
381381
382382 if (clk_mgr == NULL) {
383383 BREAK_TO_DEBUGGER();
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c+2−2
@@ -1595,7 +1595,7 @@ struct clk_mgr_internal *dcn60_clk_mgr_construct( · 1594 unmodified lines
15951595 struct dccg *dccg)
15961596 {
15971597 struct clk_log_info log_info = {0};
1598− struct dcn60_clk_mgr *clk_mgr60 = kzalloc(sizeof(struct dcn60_clk_mgr), GFP_KERNEL);
1598+ struct dcn60_clk_mgr *clk_mgr60 = kzalloc_obj(struct dcn60_clk_mgr);
15991599 struct clk_mgr_internal *clk_mgr;
16001600
16011601 if (!clk_mgr60)
@@ -1644,7 +1644,7 @@ struct clk_mgr_internal *dcn60_clk_mgr_construct( · 42 unmodified lines
16441644
16451645 clk_mgr->smu_present = false;
16461646
1647− clk_mgr->base.bw_params = kzalloc(sizeof(*clk_mgr->base.bw_params), GFP_KERNEL);
1647+ clk_mgr->base.bw_params = kzalloc_obj(*clk_mgr->base.bw_params);
16481648 if (!clk_mgr->base.bw_params)
16491649 goto fail;
16501650
drivers/gpu/drm/amd/display/dc/core/dc.c+1−2
@@ -914,8 +914,7 @@ static bool dc_construct_update_scratch_pool(struct dc *dc) · 913 unmodified lines
914914 unsigned int i;
915915
916916 for (i = 0; i < ARRAY_SIZE(dc->update_scratch_pool); i++) {
917− dc->update_scratch_pool[i] = kzalloc(
918− sizeof(struct dc_update_scratch_space), GFP_KERNEL);
917+ dc->update_scratch_pool[i] = kzalloc_obj(struct dc_update_scratch_space);
919918 if (!dc->update_scratch_pool[i])
920919 return false;
921920 dc->update_scratch_in_use[i] = false;
drivers/gpu/drm/amd/display/dc/core/dc_surface.c+1−1
@@ -290,7 +290,7 @@ static void dc_plane_cm_free(struct kref *kref) · 289 unmodified lines
290290
291291 struct dc_plane_cm *dc_plane_cm_create(void)
292292 {
293− struct dc_plane_cm *cm = kvzalloc(sizeof(*cm), GFP_KERNEL);
293+ struct dc_plane_cm *cm = kvzalloc_obj(*cm);
294294
295295 if (cm == NULL)
296296 goto alloc_fail;
drivers/gpu/drm/amd/display/dc/dccg/dcn42/dcn42_dccg.c+1−1
@@ -358,7 +358,7 @@ struct dccg *dccg42_create( · 357 unmodified lines
358358 const struct dccg_shift *dccg_shift,
359359 const struct dccg_mask *dccg_mask)
360360 {
361− struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL);
361+ struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn);
362362 struct dccg *base;
363363
364364 if (dccg_dcn == NULL) {
drivers/gpu/drm/amd/display/dc/dccg/dcn60/dcn60_dccg.c+1−1
@@ -167,7 +167,7 @@ struct dccg *dccg60_create( · 166 unmodified lines
167167 const struct dccg_shift *dccg_shift,
168168 const struct dccg_mask *dccg_mask)
169169 {
170− struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL);
170+ struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn);
171171 struct dccg *base;
172172
173173 if (dccg_dcn == NULL) {
drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c+1−1
@@ -542,7 +542,7 @@ void dal_hw_ddc_init_i3cpad( · 541 unmodified lines
542542 *hw_ddc = NULL;
543543 }
544544
545− *hw_ddc = kzalloc(sizeof(struct hw_ddc), GFP_KERNEL);
545+ *hw_ddc = kzalloc_obj(struct hw_ddc);
546546 if (!*hw_ddc) {
547547 ASSERT_CRITICAL(false);
548548 return;
drivers/gpu/drm/amd/display/dc/irq/dcn42/irq_service_dcn42.c+1−1
@@ -405,7 +405,7 @@ static void dcn42_irq_construct(struct irq_service *irq_service, · 404 unmodified lines
405405
406406 struct irq_service *dal_irq_service_dcn42_create(struct irq_service_init_data *init_data)
407407 {
408− struct irq_service *irq_service = kzalloc(sizeof(*irq_service), GFP_KERNEL);
408+ struct irq_service *irq_service = kzalloc_obj(*irq_service);
409409
410410 if (!irq_service)
411411 return NULL;
drivers/gpu/drm/amd/display/dc/irq/dcn60/irq_service_dcn60.c+1−2
@@ -406,8 +406,7 @@ static void dcn60_irq_construct( · 405 unmodified lines
406406 struct irq_service *dal_irq_service_dcn60_create(
407407 struct irq_service_init_data *init_data)
408408 {
409− struct irq_service *irq_service = kzalloc(sizeof(*irq_service),
410− GFP_KERNEL);
409+ struct irq_service *irq_service = kzalloc_obj(*irq_service);
411410
412411 if (!irq_service)
413412 return NULL;
drivers/gpu/drm/amd/display/dc/pg/dcn42/dcn42_pg_cntl.c+1−1
@@ -615,7 +615,7 @@ struct pg_cntl *pg_cntl42_create( · 614 unmodified lines
615615 const struct pg_cntl_shift *pg_cntl_shift,
616616 const struct pg_cntl_mask *pg_cntl_mask)
617617 {
618− struct dcn_pg_cntl *pg_cntl_dcn = kzalloc(sizeof(*pg_cntl_dcn), GFP_KERNEL);
618+ struct dcn_pg_cntl *pg_cntl_dcn = kzalloc_obj(*pg_cntl_dcn);
619619 struct pg_cntl *base;
620620
621621 if (pg_cntl_dcn == NULL) {
drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c+2−2
@@ -1135,7 +1135,7 @@ static struct hpo_frl_stream_encoder *dcn30_hpo_frl_stream_encoder_create(enum e · 1134 unmodified lines
11351135 }
11361136
11371137 /* allocate HPO stream encoder and create VPG sub-block */
1138− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
1138+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
11391139 vpg = dcn30_vpg_create(ctx, vpg_inst);
11401140 afmt = dcn30_afmt_create(ctx, afmt_inst);
11411141
@@ -1166,7 +1166,7 @@ static struct hpo_frl_link_encoder *dcn30_hpo_frl_link_encoder_create(enum engin · 24 unmodified lines
11661166 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
11671167
11681168 /* allocate HPO link encoder */
1169− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
1169+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
11701170 if (!hpo_enc3)
11711171 return NULL; /* out of memory */
11721172
drivers/gpu/drm/amd/display/dc/resource/dcn302/dcn302_resource.c+2−2
@@ -492,7 +492,7 @@ static struct hpo_frl_stream_encoder *dcn302_hpo_frl_stream_encoder_create(enum · 491 unmodified lines
492492 return NULL;
493493
494494 /* allocate HPO stream encoder and create VPG sub-block */
495− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
495+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
496496 vpg = dcn302_vpg_create(ctx, vpg_inst);
497497 afmt = dcn302_afmt_create(ctx, afmt_inst);
498498
@@ -531,7 +531,7 @@ static struct hpo_frl_link_encoder *dcn302_hpo_frl_link_encoder_create(enum engi · 32 unmodified lines
531531 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
532532
533533 /* allocate HPO link encoder */
534− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
534+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
535535 if (!hpo_enc3)
536536 return NULL; /* out of memory */
537537
drivers/gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c+2−2
@@ -479,7 +479,7 @@ static struct hpo_frl_stream_encoder *dcn303_hpo_frl_stream_encoder_create(enum · 478 unmodified lines
479479 return NULL;
480480
481481 /* allocate HPO stream encoder and create VPG sub-block */
482− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
482+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
483483 vpg = dcn303_vpg_create(ctx, vpg_inst);
484484 afmt = dcn303_afmt_create(ctx, afmt_inst);
485485
@@ -518,7 +518,7 @@ static struct hpo_frl_link_encoder *dcn303_hpo_frl_link_encoder_create(enum engi · 32 unmodified lines
518518 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
519519
520520 /* allocate HPO link encoder */
521− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
521+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
522522 if (!hpo_enc3)
523523 return NULL; /* out of memory */
524524
drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c+2−2
@@ -1346,7 +1346,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(enum e · 1345 unmodified lines
13461346 }
13471347
13481348 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
1349− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
1349+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
13501350 vpg = dcn31_vpg_create(ctx, vpg_inst);
13511351 afmt = dcn31_afmt_create(ctx, afmt_inst);
13521352
@@ -1377,7 +1377,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin · 24 unmodified lines
13771377 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
13781378
13791379 /* allocate HPO link encoder */
1380− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
1380+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
13811381 if (!hpo_enc3)
13821382 return NULL; /* out of memory */
13831383
drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c+2−2
@@ -1404,7 +1404,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(enum e · 1403 unmodified lines
14041404 }
14051405
14061406 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
1407− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
1407+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
14081408 vpg = dcn31_vpg_create(ctx, vpg_inst);
14091409 afmt = dcn31_afmt_create(ctx, afmt_inst);
14101410
@@ -1436,7 +1436,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin · 25 unmodified lines
14361436 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
14371437
14381438 /* allocate HPO link encoder */
1439− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
1439+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
14401440 if (!hpo_enc3)
14411441 return NULL; /* out of memory */
14421442
drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c+2−2
@@ -1347,7 +1347,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(enum e · 1346 unmodified lines
13471347 }
13481348
13491349 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
1350− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
1350+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
13511351 vpg = dcn31_vpg_create(ctx, vpg_inst);
13521352 afmt = dcn31_afmt_create(ctx, afmt_inst);
13531353
@@ -1379,7 +1379,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin · 25 unmodified lines
13791379 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
13801380
13811381 /* allocate HPO link encoder */
1382− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
1382+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
13831383 if (!hpo_enc3)
13841384 return NULL; /* out of memory */
13851385
drivers/gpu/drm/amd/display/dc/resource/dcn316/dcn316_resource.c+2−2
@@ -1340,7 +1340,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(enum e · 1339 unmodified lines
13401340 }
13411341
13421342 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
1343− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
1343+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
13441344 vpg = dcn31_vpg_create(ctx, vpg_inst);
13451345 afmt = dcn31_afmt_create(ctx, afmt_inst);
13461346
@@ -1372,7 +1372,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin · 25 unmodified lines
13721372 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
13731373
13741374 /* allocate HPO link encoder */
1375− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
1375+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
13761376 if (!hpo_enc3)
13771377 return NULL; /* out of memory */
13781378
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c+2−2
@@ -1339,7 +1339,7 @@ static struct hpo_frl_stream_encoder *dcn32_hpo_frl_stream_encoder_create(enum e · 1338 unmodified lines
13391339 }
13401340
13411341 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
1342− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
1342+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
13431343 vpg = dcn32_vpg_create(ctx, vpg_inst);
13441344 afmt = dcn32_afmt_create(ctx, afmt_inst);
13451345
@@ -1375,7 +1375,7 @@ static struct hpo_frl_link_encoder *dcn32_hpo_frl_link_encoder_create(enum engin · 29 unmodified lines
13751375 hpo_frl_link_encoder_reg_list(0);
13761376
13771377 /* allocate HPO link encoder */
1378− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
1378+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
13791379 if (!hpo_enc3)
13801380 return NULL; /* out of memory */
13811381
drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c+2−2
@@ -1314,7 +1314,7 @@ static struct hpo_frl_stream_encoder *dcn321_hpo_frl_stream_encoder_create(enum · 1313 unmodified lines
13141314 }
13151315
13161316 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
1317− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
1317+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
13181318 vpg = dcn321_vpg_create(ctx, vpg_inst);
13191319 afmt = dcn321_afmt_create(ctx, afmt_inst);
13201320
@@ -1350,7 +1350,7 @@ static struct hpo_frl_link_encoder *dcn321_hpo_frl_link_encoder_create(enum engi · 29 unmodified lines
13501350 hpo_frl_link_encoder_reg_list(0);
13511351
13521352 /* allocate HPO link encoder */
1353− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
1353+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
13541354 if (!hpo_enc3)
13551355 return NULL; /* out of memory */
13561356
drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c+2−2
@@ -1398,7 +1398,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create( · 1397 unmodified lines
13981398 return NULL;
13991399
14001400 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
1401− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
1401+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
14021402 vpg = dcn31_vpg_create(ctx, vpg_inst);
14031403 afmt = dcn31_afmt_create(ctx, afmt_inst);
14041404
@@ -1430,7 +1430,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create( · 25 unmodified lines
14301430 hpo_frl_link_encoder_reg_list(0);
14311431
14321432 /* allocate HPO link encoder */
1433− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
1433+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
14341434 if (!hpo_enc3)
14351435 return NULL; /* out of memory */
14361436
drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c+2−2
@@ -1378,7 +1378,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create( · 1377 unmodified lines
13781378 return NULL;
13791379
13801380 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
1381− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
1381+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
13821382 vpg = dcn31_vpg_create(ctx, vpg_inst);
13831383 afmt = dcn31_afmt_create(ctx, afmt_inst);
13841384
@@ -1410,7 +1410,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create( · 25 unmodified lines
14101410 hpo_frl_link_encoder_reg_list(0);
14111411
14121412 /* allocate HPO link encoder */
1413− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
1413+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
14141414 if (!hpo_enc3)
14151415 return NULL; /* out of memory */
14161416
drivers/gpu/drm/amd/display/dc/resource/dcn36/dcn36_resource.c+2−2
@@ -1385,7 +1385,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create( · 1384 unmodified lines
13851385 return NULL;
13861386
13871387 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
1388− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL);
1388+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder);
13891389 vpg = dcn31_vpg_create(ctx, vpg_inst);
13901390 afmt = dcn31_afmt_create(ctx, afmt_inst);
13911391
@@ -1417,7 +1417,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create( · 25 unmodified lines
14171417 hpo_frl_link_encoder_reg_list(0);
14181418
14191419 /* allocate HPO link encoder */
1420− hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
1420+ hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
14211421 if (!hpo_enc3)
14221422 return NULL; /* out of memory */
14231423
drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c+2−2
@@ -1322,7 +1322,7 @@ static struct hpo_frl_stream_encoder *dcn401_hpo_frl_stream_encoder_create( · 1321 unmodified lines
13221322 return NULL;
13231323
13241324 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */
1325− hpo_enc401 = kzalloc(sizeof(struct dcn401_hpo_frl_stream_encoder), GFP_KERNEL);
1325+ hpo_enc401 = kzalloc_obj(struct dcn401_hpo_frl_stream_encoder);
13261326 vpg = dcn401_vpg_create(ctx, vpg_inst);
13271327 afmt = dcn401_afmt_create(ctx, afmt_inst);
13281328
@@ -1353,7 +1353,7 @@ static struct hpo_frl_link_encoder *dcn401_hpo_frl_link_encoder_create( · 24 unmodified lines
13531353 hpo_frl_link_encoder_reg_list(0);
13541354
13551355 /* allocate HPO link encoder */
1356− hpo_link_enc = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
1356+ hpo_link_enc = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
13571357 if (!hpo_link_enc)
13581358 return NULL; /* out of memory */
13591359
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c+23−27
@@ -818,7 +818,7 @@ static struct dce_aux *dcn42_aux_engine_create( · 817 unmodified lines
818818 uint32_t inst)
819819 {
820820 struct aux_engine_dce110 *aux_engine =
821− kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL);
821+ kzalloc_obj(struct aux_engine_dce110);
822822
823823 if (!aux_engine)
824824 return NULL;
@@ -884,7 +884,7 @@ static struct dce_i2c_hw *dcn42_i2c_hw_create( · 59 unmodified lines
884884 uint32_t inst)
885885 {
886886 struct dce_i2c_hw *dce_i2c_hw =
887− kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL);
887+ kzalloc_obj(struct dce_i2c_hw);
888888
889889 if (!dce_i2c_hw)
890890 return NULL;
@@ -910,7 +910,7 @@ static struct clock_source *dcn42_clock_source_create( · 19 unmodified lines
910910 bool dp_clk_src)
911911 {
912912 struct dce110_clk_src *clk_src =
913− kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
913+ kzalloc_obj(struct dce110_clk_src);
914914
915915 if (!clk_src)
916916 return NULL;
@@ -929,8 +929,7 @@ static struct hubbub *dcn42_hubbub_create(struct dc_context *ctx) · 12 unmodified lines
929929 {
930930 int i;
931931
932− struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub),
933− GFP_KERNEL);
932+ struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub);
934933
935934 if (!hubbub3)
936935 return NULL;
@@ -983,7 +982,7 @@ static struct hubp *dcn42_hubp_create( · 46 unmodified lines
983982 uint32_t inst)
984983 {
985984 struct dcn20_hubp *hubp2 =
986− kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL);
985+ kzalloc_obj(struct dcn20_hubp);
987986
988987 if (!hubp2)
989988 return NULL;
@@ -1025,7 +1024,7 @@ static struct dpp *dcn42_dpp_create( · 35 unmodified lines
10251024 uint32_t inst)
10261025 {
10271026 struct dcn42_dpp *dpp42 =
1028− kzalloc(sizeof(struct dcn42_dpp), GFP_KERNEL);
1027+ kzalloc_obj(struct dcn42_dpp);
10291028
10301029 if (!dpp42)
10311030 return NULL;
@@ -1051,8 +1050,7 @@ static struct mpc *dcn42_mpc_create( · 19 unmodified lines
10511050 int num_mpcc,
10521051 int num_rmu)
10531052 {
1054− struct dcn42_mpc *mpc401 = kzalloc(sizeof(struct dcn42_mpc),
1055− GFP_KERNEL);
1053+ struct dcn42_mpc *mpc401 = kzalloc_obj(struct dcn42_mpc);
10561054
10571055 if (!mpc401)
10581056 return NULL;
@@ -1075,7 +1073,7 @@ static struct output_pixel_processor *dcn42_opp_create( · 16 unmodified lines
10751073 struct dc_context *ctx, uint32_t inst)
10761074 {
10771075 struct dcn20_opp *opp4 =
1078− kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL);
1076+ kzalloc_obj(struct dcn20_opp);
10791077
10801078 if (!opp4) {
10811079 BREAK_TO_DEBUGGER();
@@ -1098,7 +1096,7 @@ static struct timing_generator *dcn42_timing_generator_create( · 16 unmodified lines
10981096 uint32_t instance)
10991097 {
11001098 struct optc *tgn10 =
1101− kzalloc(sizeof(struct optc), GFP_KERNEL);
1099+ kzalloc_obj(struct optc);
11021100
11031101 if (!tgn10)
11041102 return NULL;
@@ -1136,7 +1134,7 @@ static struct link_encoder *dcn42_link_encoder_create( · 31 unmodified lines
11361134 const struct encoder_init_data *enc_init_data)
11371135 {
11381136 struct dcn20_link_encoder *enc20 =
1139− kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);
1137+ kzalloc_obj(struct dcn20_link_encoder);
11401138
11411139 if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs))
11421140 return NULL;
@@ -1202,7 +1200,7 @@ static struct vpg *dcn42_vpg_create( · 59 unmodified lines
12021200 struct dc_context *ctx,
12031201 uint32_t inst)
12041202 {
1205− struct dcn31_vpg *vpg4 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL);
1203+ struct dcn31_vpg *vpg4 = kzalloc_obj(struct dcn31_vpg);
12061204
12071205 if (!vpg4)
12081206 return NULL;
@@ -1231,7 +1229,7 @@ static struct apg *dcn42_apg_create( · 22 unmodified lines
12311229 struct dc_context *ctx,
12321230 uint32_t inst)
12331231 {
1234− struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL);
1232+ struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg);
12351233
12361234 if (!apg31)
12371235 return NULL;
@@ -1275,7 +1273,7 @@ static struct stream_encoder *dcn42_stream_encoder_create( · 37 unmodified lines
12751273 } else
12761274 return NULL;
12771275
1278− enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL);
1276+ enc1 = kzalloc_obj(struct dcn10_stream_encoder);
12791277 vpg = dcn42_vpg_create(ctx, vpg_inst);
12801278 apg = dcn42_apg_create(ctx, apg_inst);
12811279
@@ -1325,7 +1323,7 @@ static struct hpo_frl_stream_encoder *dcn42_hpo_frl_stream_encoder_create( · 43 unmodified lines
13251323 return NULL;
13261324
13271325 /* allocate HPO stream encoder and create VPG sub-block */
1328− hpo_enc42 = kzalloc(sizeof(struct dcn42_hpo_frl_stream_encoder), GFP_KERNEL);
1326+ hpo_enc42 = kzalloc_obj(struct dcn42_hpo_frl_stream_encoder);
13291327 vpg = dcn42_vpg_create(ctx, vpg_inst);
13301328 apg = dcn42_apg_create(ctx, apg_inst);
13311329
@@ -1357,7 +1355,7 @@ static struct hpo_frl_link_encoder *dcn42_hpo_frl_link_encoder_create( · 25 unmodified lines
13571355 hpo_frl_link_encoder_reg_list(0);
13581356
13591357 /* allocate HPO link encoder */
1360− hpo_link_enc = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
1358+ hpo_link_enc = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
13611359 if (!hpo_link_enc)
13621360 return NULL; /* out of memory */
13631361
@@ -1399,7 +1397,7 @@ static struct hpo_dp_stream_encoder *dcn42_hpo_dp_stream_encoder_create( · 35 unmodified lines
13991397 apg_inst = hpo_dp_inst + 5;
14001398
14011399 /* allocate HPO stream encoder and create VPG sub-block */
1402− hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL);
1400+ hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder);
14031401 vpg = dcn42_vpg_create(ctx, vpg_inst);
14041402 apg = dcn42_apg_create(ctx, apg_inst);
14051403
@@ -1432,7 +1430,7 @@ static struct hpo_dp_link_encoder *dcn42_hpo_dp_link_encoder_create( · 26 unmodified lines
14321430 struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31;
14331431
14341432 /* allocate HPO link encoder */
1435− hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL);
1433+ hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder);
14361434 if (!hpo_dp_enc31)
14371435 return NULL; /* out of memory */
14381436
@@ -1453,7 +1451,7 @@ static struct hpo_dp_link_encoder *dcn42_hpo_dp_link_encoder_create( · 14 unmodified lines
14531451 static struct dce_hwseq *dcn42_hwseq_create(
14541452 struct dc_context *ctx)
14551453 {
1456− struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
1454+ struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq);
14571455
14581456 #undef REG_STRUCT
14591457 #define REG_STRUCT hwseq_reg
@@ -1727,8 +1725,7 @@ static bool dcn42_dwbc_create(struct dc_context *ctx, struct resource_pool *pool · 267 unmodified lines
17271725 uint32_t dwb_count = pool->res_cap->num_dwb;
17281726
17291727 for (i = 0; i < dwb_count; i++) {
1730− struct dcn30_dwbc *dwbc42 = kzalloc(sizeof(struct dcn30_dwbc),
1731− GFP_KERNEL);
1728+ struct dcn30_dwbc *dwbc42 = kzalloc_obj(struct dcn30_dwbc);
17321729
17331730 if (!dwbc42) {
17341731 dm_error("DC: failed to create dwbc42!\n");
@@ -1764,8 +1761,7 @@ static bool dcn42_mmhubbub_create(struct dc_context *ctx, struct resource_pool * · 29 unmodified lines
17641761 uint32_t pipe_count = pool->res_cap->num_dwb;
17651762
17661763 for (i = 0; i < pipe_count; i++) {
1767− struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub),
1768− GFP_KERNEL);
1764+ struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub);
17691765
17701766 if (!mcif_wb30) {
17711767 dm_error("DC: failed to create mcif_wb30!\n");
@@ -1793,7 +1789,7 @@ static struct display_stream_compressor *dcn42_dsc_create( · 21 unmodified lines
17931789 struct dc_context *ctx, uint32_t inst)
17941790 {
17951791 struct dcn401_dsc *dsc =
1796− kzalloc(sizeof(struct dcn401_dsc), GFP_KERNEL);
1792+ kzalloc_obj(struct dcn401_dsc);
17971793
17981794 if (!dsc) {
17991795 BREAK_TO_DEBUGGER();
@@ -1890,7 +1886,7 @@ static struct link_encoder *dcn42_link_enc_create_minimal( · 90 unmodified lines
18901886 if ((unsigned int)(eng_id - ENGINE_ID_DIGA) >= ctx->dc->res_pool->res_cap->num_dig_link_enc)
18911887 return NULL;
18921888
1893− enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);
1889+ enc20 = kzalloc_obj(struct dcn20_link_encoder);
18941890 if (!enc20)
18951891 return NULL;
18961892
@@ -2441,7 +2437,7 @@ struct resource_pool *dcn42_create_resource_pool( · 544 unmodified lines
24412437 struct dc *dc)
24422438 {
24432439 struct dcn42_resource_pool *pool =
2444− kzalloc(sizeof(struct dcn42_resource_pool), GFP_KERNEL);
2440+ kzalloc_obj(struct dcn42_resource_pool);
24452441
24462442 if (!pool)
24472443 return NULL;
drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c+21−25
@@ -870,7 +870,7 @@ static struct dce_aux *dcn42b_aux_engine_create( · 869 unmodified lines
870870 uint32_t inst)
871871 {
872872 struct aux_engine_dce110 *aux_engine =
873− kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL);
873+ kzalloc_obj(struct aux_engine_dce110);
874874
875875 if (!aux_engine)
876876 return NULL;
@@ -940,7 +940,7 @@ static struct dce_i2c_hw *dcn42b_i2c_hw_create( · 63 unmodified lines
940940 uint32_t inst)
941941 {
942942 struct dce_i2c_hw *dce_i2c_hw =
943− kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL);
943+ kzalloc_obj(struct dce_i2c_hw);
944944
945945 if (!dce_i2c_hw)
946946 return NULL;
@@ -968,7 +968,7 @@ static struct clock_source *dcn42b_clock_source_create( · 21 unmodified lines
968968 bool dp_clk_src)
969969 {
970970 struct dce110_clk_src *clk_src =
971− kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
971+ kzalloc_obj(struct dce110_clk_src);
972972
973973 if (!clk_src)
974974 return NULL;
@@ -988,8 +988,7 @@ static struct hubbub *dcn42b_hubbub_create(struct dc_context *ctx) · 13 unmodified lines
988988 {
989989 int i;
990990
991− struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub),
992− GFP_KERNEL);
991+ struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub);
993992
994993 if (!hubbub3)
995994 return NULL;
@@ -1042,7 +1041,7 @@ static struct hubp *dcn42b_hubp_create( · 46 unmodified lines
10421041 uint32_t inst)
10431042 {
10441043 struct dcn20_hubp *hubp2 =
1045− kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL);
1044+ kzalloc_obj(struct dcn20_hubp);
10461045
10471046 if (!hubp2)
10481047 return NULL;
@@ -1084,7 +1083,7 @@ static struct dpp *dcn42b_dpp_create( · 35 unmodified lines
10841083 uint32_t inst)
10851084 {
10861085 struct dcn42_dpp *dpp42b =
1087− kzalloc(sizeof(struct dcn42_dpp), GFP_KERNEL);
1086+ kzalloc_obj(struct dcn42_dpp);
10881087
10891088 if (!dpp42b)
10901089 return NULL;
@@ -1110,8 +1109,7 @@ static struct mpc *dcn42b_mpc_create( · 19 unmodified lines
11101109 int num_mpcc,
11111110 int num_rmu)
11121111 {
1113− struct dcn42_mpc *mpc42b = kzalloc(sizeof(struct dcn42_mpc),
1114− GFP_KERNEL);
1112+ struct dcn42_mpc *mpc42b = kzalloc_obj(struct dcn42_mpc);
11151113
11161114 if (!mpc42b)
11171115 return NULL;
@@ -1134,7 +1132,7 @@ static struct output_pixel_processor *dcn42b_opp_create( · 16 unmodified lines
11341132 struct dc_context *ctx, uint32_t inst)
11351133 {
11361134 struct dcn20_opp *opp4 =
1137− kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL);
1135+ kzalloc_obj(struct dcn20_opp);
11381136
11391137 if (!opp4) {
11401138 BREAK_TO_DEBUGGER();
@@ -1158,7 +1156,7 @@ static struct timing_generator *dcn42b_timing_generator_create( · 17 unmodified lines
11581156 uint32_t instance)
11591157 {
11601158 struct optc *tgn10 =
1161− kzalloc(sizeof(struct optc), GFP_KERNEL);
1159+ kzalloc_obj(struct optc);
11621160
11631161 if (!tgn10)
11641162 return NULL;
@@ -1196,7 +1194,7 @@ static struct link_encoder *dcn42b_link_encoder_create( · 31 unmodified lines
11961194 const struct encoder_init_data *enc_init_data)
11971195 {
11981196 struct dcn20_link_encoder *enc20 =
1199− kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);
1197+ kzalloc_obj(struct dcn20_link_encoder);
12001198
12011199 if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs))
12021200 return NULL;
@@ -1271,7 +1269,7 @@ static struct vpg *dcn42b_vpg_create( · 68 unmodified lines
12711269 struct dc_context *ctx,
12721270 uint32_t inst)
12731271 {
1274− struct dcn31_vpg *vpg4 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL);
1272+ struct dcn31_vpg *vpg4 = kzalloc_obj(struct dcn31_vpg);
12751273
12761274 if (!vpg4)
12771275 return NULL;
@@ -1300,7 +1298,7 @@ static struct apg *dcn42b_apg_create( · 22 unmodified lines
13001298 struct dc_context *ctx,
13011299 uint32_t inst)
13021300 {
1303− struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL);
1301+ struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg);
13041302
13051303 if (!apg31)
13061304 return NULL;
@@ -1344,7 +1342,7 @@ static struct stream_encoder *dcn42b_stream_encoder_create( · 37 unmodified lines
13441342 } else
13451343 return NULL;
13461344
1347− enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL);
1345+ enc1 = kzalloc_obj(struct dcn10_stream_encoder);
13481346 vpg = dcn42b_vpg_create(ctx, vpg_inst);
13491347 apg = dcn42b_apg_create(ctx, apg_inst);
13501348
@@ -1404,7 +1402,7 @@ static struct hpo_dp_stream_encoder *dcn42b_hpo_dp_stream_encoder_create( · 53 unmodified lines
14041402 apg_inst = hpo_dp_inst + 6;
14051403
14061404 /* allocate HPO stream encoder and create VPG sub-block */
1407− hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL);
1405+ hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder);
14081406 vpg = dcn42b_vpg_create(ctx, vpg_inst);
14091407 apg = dcn42b_apg_create(ctx, apg_inst);
14101408
@@ -1437,7 +1435,7 @@ static struct hpo_dp_link_encoder *dcn42b_hpo_dp_link_encoder_create( · 26 unmodified lines
14371435 struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31;
14381436
14391437 /* allocate HPO link encoder */
1440− hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL);
1438+ hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder);
14411439 if (!hpo_dp_enc31)
14421440 return NULL; /* out of memory */
14431441
@@ -1457,7 +1455,7 @@ static struct hpo_dp_link_encoder *dcn42b_hpo_dp_link_encoder_create( · 13 unmodified lines
14571455 static struct dce_hwseq *dcn42b_hwseq_create(
14581456 struct dc_context *ctx)
14591457 {
1460− struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
1458+ struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq);
14611459
14621460 #undef REG_STRUCT
14631461 #define REG_STRUCT hwseq_reg
@@ -1716,8 +1714,7 @@ static bool dcn42b_dwbc_create(struct dc_context *ctx, struct resource_pool *poo · 252 unmodified lines
17161714 uint32_t dwb_count = pool->res_cap->num_dwb;
17171715
17181716 for (i = 0; i < dwb_count; i++) {
1719− struct dcn30_dwbc *dwbc42 = kzalloc(sizeof(struct dcn30_dwbc),
1720− GFP_KERNEL);
1717+ struct dcn30_dwbc *dwbc42 = kzalloc_obj(struct dcn30_dwbc);
17211718
17221719 if (!dwbc42) {
17231720 dm_error("DC: failed to create dwbc42!\n");
@@ -1753,8 +1750,7 @@ static bool dcn42b_mmhubbub_create(struct dc_context *ctx, struct resource_pool · 29 unmodified lines
17531750 uint32_t pipe_count = pool->res_cap->num_dwb;
17541751
17551752 for (i = 0; i < pipe_count; i++) {
1756− struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub),
1757− GFP_KERNEL);
1753+ struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub);
17581754
17591755 if (!mcif_wb30) {
17601756 dm_error("DC: failed to create mcif_wb30!\n");
@@ -1782,7 +1778,7 @@ static struct display_stream_compressor *dcn42b_dsc_create( · 21 unmodified lines
17821778 struct dc_context *ctx, uint32_t inst)
17831779 {
17841780 struct dcn401_dsc *dsc =
1785− kzalloc(sizeof(struct dcn401_dsc), GFP_KERNEL);
1781+ kzalloc_obj(struct dcn401_dsc);
17861782
17871783 if (!dsc) {
17881784 BREAK_TO_DEBUGGER();
@@ -1875,7 +1871,7 @@ static struct link_encoder *dcn42b_link_enc_create_minimal( · 86 unmodified lines
18751871 if ((unsigned int)(eng_id - ENGINE_ID_DIGA) >= ctx->dc->res_pool->res_cap->num_dig_link_enc)
18761872 return NULL;
18771873
1878− enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);
1874+ enc20 = kzalloc_obj(struct dcn20_link_encoder);
18791875 if (!enc20)
18801876 return NULL;
18811877
@@ -2439,7 +2435,7 @@ struct resource_pool *dcn42b_create_resource_pool( · 557 unmodified lines
24392435 struct dc *dc)
24402436 {
24412437 struct dcn42b_resource_pool *pool =
2442− kzalloc(sizeof(struct dcn42b_resource_pool), GFP_KERNEL);
2438+ kzalloc_obj(struct dcn42b_resource_pool);
24432439
24442440 if (!pool)
24452441 return NULL;
drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c+20−22
@@ -998,7 +998,7 @@ static struct dce_aux *dcn60_aux_engine_create( · 997 unmodified lines
998998 uint32_t inst)
999999 {
10001000 struct aux_engine_dce110 *aux_engine =
1001− kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL);
1001+ kzalloc_obj(struct aux_engine_dce110);
10021002
10031003 if (!aux_engine)
10041004 return NULL;
@@ -1037,7 +1037,7 @@ static struct dce_i2c_hw *dcn60_i2c_hw_create( · 32 unmodified lines
10371037 uint32_t inst)
10381038 {
10391039 struct dce_i2c_hw *dce_i2c_hw =
1040− kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL);
1040+ kzalloc_obj(struct dce_i2c_hw);
10411041
10421042 if (!dce_i2c_hw)
10431043 return NULL;
@@ -1061,7 +1061,7 @@ static struct clock_source *dcn60_clock_source_create( · 17 unmodified lines
10611061 bool dp_clk_src)
10621062 {
10631063 struct dce110_clk_src *clk_src =
1064− kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
1064+ kzalloc_obj(struct dce110_clk_src);
10651065
10661066 if (!clk_src)
10671067 return NULL;
@@ -1081,8 +1081,7 @@ static struct hubbub *dcn60_hubbub_create(struct dc_context *ctx) · 13 unmodified lines
10811081 {
10821082 int i;
10831083
1084− struct dcn20_hubbub *hubbub2 = kzalloc(sizeof(struct dcn20_hubbub),
1085− GFP_KERNEL);
1084+ struct dcn20_hubbub *hubbub2 = kzalloc_obj(struct dcn20_hubbub);
10861085
10871086 if (!hubbub2)
10881087 return NULL;
@@ -1136,7 +1135,7 @@ static struct hubp *dcn60_hubp_create( · 47 unmodified lines
11361135 uint32_t inst)
11371136 {
11381137 struct dcn20_hubp *hubp2 =
1139− kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL);
1138+ kzalloc_obj(struct dcn20_hubp);
11401139
11411140 if (!hubp2)
11421141 return NULL;
@@ -1168,7 +1167,7 @@ static struct dpp *dcn60_dpp_create( · 25 unmodified lines
11681167 uint32_t inst)
11691168 {
11701169 struct dcn60_dpp *dpp60 =
1171− kzalloc(sizeof(struct dcn60_dpp), GFP_KERNEL);
1170+ kzalloc_obj(struct dcn60_dpp);
11721171
11731172 if (!dpp60)
11741173 return NULL;
@@ -1194,8 +1193,7 @@ static struct mpc *dcn60_mpc_create( · 19 unmodified lines
11941193 int num_mpcc,
11951194 int num_rmu)
11961195 {
1197− struct dcn60_mpc *mpc60 = kzalloc(sizeof(struct dcn60_mpc),
1198− GFP_KERNEL);
1196+ struct dcn60_mpc *mpc60 = kzalloc_obj(struct dcn60_mpc);
11991197
12001198 if (!mpc60)
12011199 return NULL;
@@ -1218,7 +1216,7 @@ static struct output_pixel_processor *dcn60_opp_create( · 16 unmodified lines
12181216 struct dc_context *ctx, uint32_t inst)
12191217 {
12201218 struct dcn20_opp *opp2 =
1221− kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL);
1219+ kzalloc_obj(struct dcn20_opp);
12221220
12231221 if (!opp2) {
12241222 BREAK_TO_DEBUGGER();
@@ -1242,7 +1240,7 @@ static struct timing_generator *dcn60_timing_generator_create( · 17 unmodified lines
12421240 uint32_t instance)
12431241 {
12441242 struct optc *tgn10 =
1245− kzalloc(sizeof(struct optc), GFP_KERNEL);
1243+ kzalloc_obj(struct optc);
12461244
12471245 if (!tgn10)
12481246 return NULL;
@@ -1282,7 +1280,7 @@ static struct link_encoder *dcn60_link_encoder_create( · 33 unmodified lines
12821280 const struct encoder_init_data *enc_init_data)
12831281 {
12841282 struct dcn20_link_encoder *enc20 =
1285− kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);
1283+ kzalloc_obj(struct dcn20_link_encoder);
12861284
12871285 if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) {
12881286 kfree(enc20);
@@ -1349,7 +1347,7 @@ static struct vpg *dcn60_vpg_create( · 60 unmodified lines
13491347 struct dc_context *ctx,
13501348 uint32_t inst)
13511349 {
1352− struct dcn31_vpg *vpg6 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL);
1350+ struct dcn31_vpg *vpg6 = kzalloc_obj(struct dcn31_vpg);
13531351
13541352 if (!vpg6)
13551353 return NULL;
@@ -1378,7 +1376,7 @@ static struct apg *dcn60_apg_create( · 22 unmodified lines
13781376 struct dc_context *ctx,
13791377 uint32_t inst)
13801378 {
1381− struct dcn31_apg *apg60 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL);
1379+ struct dcn31_apg *apg60 = kzalloc_obj(struct dcn31_apg);
13821380
13831381 if (!apg60)
13841382 return NULL;
@@ -1415,7 +1413,7 @@ static struct stream_encoder *dcn60_stream_encoder_create( · 30 unmodified lines
14151413 } else
14161414 return NULL;
14171415
1418− enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL);
1416+ enc1 = kzalloc_obj(struct dcn10_stream_encoder);
14191417 vpg = dcn60_vpg_create(ctx, vpg_inst);
14201418 apg = dcn60_apg_create(ctx, apg_inst);
14211419
@@ -1462,7 +1460,7 @@ static struct hpo_frl_stream_encoder *dcn60_hpo_frl_stream_encoder_create( · 40 unmodified lines
14621460 return NULL;
14631461
14641462 /* allocate HPO stream encoder and create VPG, APG sub-blocks */
1465− hpo_enc60 = kzalloc(sizeof(struct dcn401_hpo_frl_stream_encoder), GFP_KERNEL);
1463+ hpo_enc60 = kzalloc_obj(struct dcn401_hpo_frl_stream_encoder);
14661464 vpg = dcn60_vpg_create(ctx, vpg_inst);
14671465 apg = dcn60_apg_create(ctx, apg_inst);
14681466
@@ -1493,7 +1491,7 @@ static struct hpo_frl_link_encoder *dcn60_hpo_frl_link_encoder_create( · 24 unmodified lines
14931491 hpo_frl_link_encoder_reg_list(0);
14941492
14951493 /* allocate HPO link encoder */
1496− hpo_link_enc = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL);
1494+ hpo_link_enc = kzalloc_obj(struct dcn30_hpo_frl_link_encoder);
14971495 if (!hpo_link_enc)
14981496 return NULL; /* out of memory */
14991497
@@ -1535,7 +1533,7 @@ static struct hpo_dp_stream_encoder *dcn60_hpo_dp_stream_encoder_create( · 35 unmodified lines
15351533 apg_inst = hpo_dp_inst;
15361534
15371535 /* allocate HPO stream encoder and create VPG sub-block */
1538− hpo_dp_enc60 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL);
1536+ hpo_dp_enc60 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder);
15391537 vpg = dcn60_vpg_create(ctx, vpg_inst);
15401538 apg = dcn60_apg_create(ctx, apg_inst);
15411539
@@ -1568,7 +1566,7 @@ static struct hpo_dp_link_encoder *dcn60_hpo_dp_link_encoder_create( · 26 unmodified lines
15681566 struct dcn31_hpo_dp_link_encoder *hpo_dp_enc60;
15691567
15701568 /* allocate HPO link encoder */
1571− hpo_dp_enc60 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL);
1569+ hpo_dp_enc60 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder);
15721570 if (!hpo_dp_enc60)
15731571 return NULL; /* out of memory */
15741572
@@ -1589,7 +1587,7 @@ static struct hpo_dp_link_encoder *dcn60_hpo_dp_link_encoder_create( · 14 unmodified lines
15891587 static struct dce_hwseq *dcn60_hwseq_create(
15901588 struct dc_context *ctx)
15911589 {
1592− struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
1590+ struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq);
15931591
15941592 #undef REG_STRUCT
15951593 #define REG_STRUCT hwseq_reg
@@ -1784,7 +1782,7 @@ static struct display_stream_compressor *dcn60_dsc_create( · 188 unmodified lines
17841782 struct dc_context *ctx, uint32_t inst)
17851783 {
17861784 struct dcn60_dsc *dsc =
1787− kzalloc(sizeof(struct dcn60_dsc), GFP_KERNEL);
1785+ kzalloc_obj(struct dcn60_dsc);
17881786
17891787 if (!dsc) {
17901788 BREAK_TO_DEBUGGER();
@@ -2363,7 +2361,7 @@ struct resource_pool *dcn60_create_resource_pool( · 572 unmodified lines
23632361 struct dc *dc)
23642362 {
23652363 struct dcn60_resource_pool *pool =
2366− kzalloc(sizeof(struct dcn60_resource_pool), GFP_KERNEL);
2364+ kzalloc_obj(struct dcn60_resource_pool);
23672365
23682366 if (!pool)
23692367 return NULL;
drivers/gpu/drm/amd/display/modules/power/power.c+2−3
@@ -111,7 +111,7 @@ struct mod_power *mod_power_create(struct dc *dc, · 110 unmodified lines
111111 if (dc == NULL)
112112 goto fail_dc_null;
113113
114− core_power = kzalloc(sizeof(struct core_power), GFP_KERNEL);
114+ core_power = kzalloc_obj(struct core_power);
115115
116116 if (core_power == NULL)
117117 goto fail_alloc_context;
@@ -129,8 +129,7 @@ struct mod_power *mod_power_create(struct dc *dc, · 11 unmodified lines
129129
130130 for (i = 0; i < MOD_POWER_MAX_CONCURRENT_STREAMS; i++) {
131131 core_power->map[i].psr_context =
132− kzalloc(sizeof(struct mod_power_psr_context),
133− GFP_KERNEL);
132+ kzalloc_obj(struct mod_power_psr_context);
134133 if (core_power->map[i].psr_context == NULL)
135134 goto fail_construct;
136135 }
drivers/gpu/drm/amd/display/modules/power/power_abm.c+1−2
@@ -705,8 +705,7 @@ void initialize_backlight_caps(struct core_power *core_power, unsigned int inst) · 704 unmodified lines
705705 * (do not want to use 256 bytes on the stack)
706706 */
707707 ext_backlight_caps = (struct dm_acpi_atif_backlight_caps *)
708− (kzalloc(sizeof(struct dm_acpi_atif_backlight_caps),
709− GFP_KERNEL));
708+ (kzalloc_obj(struct dm_acpi_atif_backlight_caps));
710709
711710 if (ext_backlight_caps == NULL)
712711 return;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c+1−1
@@ -2988,7 +2988,7 @@ static int smu7_init_voltage_dependency_on_display_clock_table(struct pp_hwmgr * · 2987 unmodified lines
29882988 if (!amdgpu_device_ip_get_ip_block(hwmgr->adev, AMD_IP_BLOCK_TYPE_DCE))
29892989 return 0;
29902990
2991− table = kzalloc(struct_size(table, entries, 4), GFP_KERNEL);
2991+ table = kzalloc_flex(*table, entries, 4);
29922992 if (!table)
29932993 return -ENOMEM;
29942994
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c+2−2
@@ -222,7 +222,7 @@ static int smu_v15_0_8_tables_init(struct smu_context *smu) · 221 unmodified lines
222222
223223 smu_table->metrics_time = 0;
224224
225− driver_pptable = kzalloc(sizeof(PPTable_t), GFP_KERNEL);
225+ driver_pptable = kzalloc_obj(PPTable_t);
226226 if (!driver_pptable)
227227 return -ENOMEM;
228228
@@ -1026,7 +1026,7 @@ static int smu_v15_0_8_fru_get_product_info(struct smu_context *smu, · 797 unmodified lines
10261026 struct amdgpu_device *adev = smu->adev;
10271027
10281028 if (!adev->fru_info) {
1029− adev->fru_info = kzalloc(sizeof(*adev->fru_info), GFP_KERNEL);
1029+ adev->fru_info = kzalloc_obj(*adev->fru_info);
10301030 if (!adev->fru_info)
10311031 return -ENOMEM;
10321032 }
drivers/gpu/drm/amd/ras/core/cmd.c+2−2
@@ -222,7 +222,7 @@ static int ras_cmd_get_cper_records(struct ras_core_context *ras_core, · 221 unmodified lines
222222 if (!buffer)
223223 return RAS_CMD__ERROR_GENERIC;
224224
225− trace = kcalloc(trace_count, sizeof(*trace), GFP_KERNEL);
225+ trace = kzalloc_objs(*trace, trace_count);
226226 if (!trace) {
227227 ret = RAS_CMD__ERROR_GENERIC;
228228 goto out;
@@ -316,7 +316,7 @@ static int ras_cmd_get_batch_trace_records(struct ras_core_context *ras_core, · 87 unmodified lines
316316 (input_data->start_batch_id >= overview.last_batch_id))
317317 return RAS_CMD__ERROR_INVALID_INPUT_SIZE;
318318
319− trace_arry = kcalloc(trace_count, sizeof(*trace_arry), GFP_KERNEL);
319+ trace_arry = kzalloc_objs(*trace_arry, trace_count);
320320 if (!trace_arry)
321321 return RAS_CMD__ERROR_GENERIC;
322322
drivers/gpu/drm/drm_exec.c+1−1
@@ -79,7 +79,7 @@ void drm_exec_init(struct drm_exec *exec, u32 flags, unsigned nr) · 78 unmodified lines
7979 nr = PAGE_SIZE / sizeof(void *);
8080
8181 exec->flags = flags;
82− exec->objects = kvmalloc_objs(*exec->objects, nr, GFP_KERNEL);
82+ exec->objects = kvmalloc_objs(*exec->objects, nr);
8383
8484 /* If allocation here fails, just delay that till the first use */
8585 exec->max_objects = exec->objects ? nr : 0;
drivers/gpu/drm/drm_syncobj.c+1−1
@@ -1619,7 +1619,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data, · 1618 unmodified lines
16191619 goto err_points;
16201620 }
16211621
1622− chains = kmalloc_objs(*chains, args->count_handles, GFP_KERNEL);
1622+ chains = kmalloc_objs(*chains, args->count_handles);
16231623 if (!chains) {
16241624 ret = -ENOMEM;
16251625 goto err_points;
drivers/gpu/drm/qxl/qxl_display.c+1−1
@@ -981,7 +981,7 @@ static struct drm_plane *qxl_create_plane(struct qxl_device *qdev, · 980 unmodified lines
981981 return ERR_PTR(-EINVAL);
982982 }
983983
984− plane = kzalloc(sizeof(*plane), GFP_KERNEL);
984+ plane = kzalloc_obj(*plane);
985985 if (!plane)
986986 return ERR_PTR(-ENOMEM);
987987
drivers/gpu/drm/tilcdc/tilcdc_panel_legacy.c+1−1
@@ -22,7 +22,7 @@ tilcdc_panel_update_prop(struct of_changeset *ocs, struct device_node *node, · 21 unmodified lines
2222 {
2323 struct property *prop;
2424
25− prop = kzalloc(sizeof(*prop), GFP_KERNEL);
25+ prop = kzalloc_obj(*prop);
2626 if (!prop)
2727 return -ENOMEM;
2828
drivers/gpu/drm/verisilicon/vs_plane.c+2−2
@@ -136,7 +136,7 @@ struct drm_plane_state *vs_plane_duplicate_state(struct drm_plane *plane) · 135 unmodified lines
136136
137137 vs_state_old = to_vs_plane_state(plane->state);
138138
139− vs_state = kzalloc_obj(*vs_state, GFP_KERNEL);
139+ vs_state = kzalloc_obj(*vs_state);
140140 if (!vs_state)
141141 return NULL;
142142
@@ -166,7 +166,7 @@ void vs_plane_reset(struct drm_plane *plane) · 23 unmodified lines
166166 plane->state = NULL;
167167 }
168168
169− vs_state = kzalloc_obj(*vs_state, GFP_KERNEL);
169+ vs_state = kzalloc_obj(*vs_state);
170170 if (!vs_state)
171171 return;
172172
drivers/gpu/drm/virtio/virtgpu_prime.c+1−3
@@ -293,9 +293,7 @@ int virtgpu_dma_buf_obj_resubmit(struct virtio_gpu_device *vgdev, · 292 unmodified lines
293293 return -ENOMEM;
294294 }
295295
296− ents = kvmalloc_array(bo->sgt->nents,
297− sizeof(struct virtio_gpu_mem_entry),
298− GFP_KERNEL);
296+ ents = kvmalloc_objs(struct virtio_gpu_mem_entry, bo->sgt->nents);
299297 if (!ents) {
300298 DRM_ERROR("failed to allocate ent list\n");
301299 return -ENOMEM;
drivers/gpu/drm/vkms/vkms_configfs.c+4−4
@@ -212,7 +212,7 @@ static struct config_group *make_crtc_group(struct config_group *group, · 211 unmodified lines
212212 if (dev->enabled)
213213 return ERR_PTR(-EBUSY);
214214
215− crtc = kzalloc(sizeof(*crtc), GFP_KERNEL);
215+ crtc = kzalloc_obj(*crtc);
216216 if (!crtc)
217217 return ERR_PTR(-ENOMEM);
218218
@@ -368,7 +368,7 @@ static struct config_group *make_plane_group(struct config_group *group, · 149 unmodified lines
368368 if (dev->enabled)
369369 return ERR_PTR(-EBUSY);
370370
371− plane = kzalloc(sizeof(*plane), GFP_KERNEL);
371+ plane = kzalloc_obj(*plane);
372372 if (!plane)
373373 return ERR_PTR(-ENOMEM);
374374
@@ -484,7 +484,7 @@ static struct config_group *make_encoder_group(struct config_group *group, · 109 unmodified lines
484484 if (dev->enabled)
485485 return ERR_PTR(-EBUSY);
486486
487− encoder = kzalloc(sizeof(*encoder), GFP_KERNEL);
487+ encoder = kzalloc_obj(*encoder);
488488 if (!encoder)
489489 return ERR_PTR(-ENOMEM);
490490
@@ -651,7 +651,7 @@ static struct config_group *make_connector_group(struct config_group *group, · 160 unmodified lines
651651 if (dev->enabled)
652652 return ERR_PTR(-EBUSY);
653653
654− connector = kzalloc(sizeof(*connector), GFP_KERNEL);
654+ connector = kzalloc_obj(*connector);
655655 if (!connector)
656656 return ERR_PTR(-ENOMEM);
657657
drivers/gpu/drm/xe/xe_amc.c+1−1
@@ -177,7 +177,7 @@ int xe_amc_init(struct xe_i2c *i2c) · 176 unmodified lines
177177 {
178178 struct xe_amc *amc;
179179
180− amc = kzalloc(sizeof(*amc), GFP_KERNEL);
180+ amc = kzalloc_obj(*amc);
181181 if (!amc)
182182 return -ENOMEM;
183183
drivers/gpu/drm/xe/xe_vm.c+1−1
@@ -4148,7 +4148,7 @@ static int fill_faults(struct xe_vm *vm, · 4147 unmodified lines
41484148 entry_size = sizeof(struct xe_vm_fault);
41494149 count = args->size / entry_size;
41504150
4151− fault_list = kcalloc(count, sizeof(struct xe_vm_fault), GFP_KERNEL);
4151+ fault_list = kzalloc_objs(struct xe_vm_fault, count);
41524152 if (!fault_list)
41534153 return -ENOMEM;
41544154
drivers/hid/hid-asus.c+3−3
@@ -406,7 +406,7 @@ static int asus_kbd_fn_lock_set(struct asus_drvdata *drvdata, bool enabled) · 405 unmodified lines
406406 struct asus_work_action *action;
407407 unsigned long flags;
408408
409− action = kzalloc(sizeof(struct asus_work_action), GFP_ATOMIC);
409+ action = kzalloc_obj(struct asus_work_action, GFP_ATOMIC);
410410 if (!action)
411411 return -ENOMEM;
412412
@@ -433,7 +433,7 @@ static int asus_kbd_wmi_fan_send(struct asus_drvdata *drvdata, u8 *report_data, · 20 unmodified lines
433433 return -EINVAL;
434434 }
435435
436− action = kzalloc(sizeof(struct asus_work_action), GFP_NOWAIT);
436+ action = kzalloc_obj(struct asus_work_action, GFP_NOWAIT);
437437 if (!action)
438438 return -ENOMEM;
439439
@@ -746,7 +746,7 @@ static void asus_kbd_backlight_set(struct asus_hid_listener *listener, int brigh · 306 unmodified lines
746746
747747 drvdata->kbd_backlight_brightness = brightness;
748748
749− action = kzalloc(sizeof(struct asus_work_action), GFP_NOWAIT);
749+ action = kzalloc_obj(struct asus_work_action, GFP_NOWAIT);
750750 if (!action)
751751 return;
752752
drivers/hid/hid-steam.c+2−2
@@ -759,7 +759,7 @@ static inline int steam_haptic_pulse(struct steam_device *steam, u8 pad, · 758 unmodified lines
759759
760760 if (steam->quirks & STEAM_QUIRK_IBEX) {
761761 struct steam_ibex_output_report *report =
762− kzalloc(sizeof(struct steam_ibex_output_report), GFP_KERNEL);
762+ kzalloc_obj(struct steam_ibex_output_report);
763763
764764 if (!report)
765765 return -ENOMEM;
@@ -798,7 +798,7 @@ static inline int steam_haptic_rumble(struct steam_device *steam, · 32 unmodified lines
798798
799799 if (steam->quirks & STEAM_QUIRK_IBEX) {
800800 struct steam_ibex_output_report *report =
801− kzalloc(sizeof(struct steam_ibex_output_report), GFP_KERNEL);
801+ kzalloc_obj(struct steam_ibex_output_report);
802802
803803 if (!report)
804804 return -ENOMEM;
drivers/hid/hid-steelseries-arctis.c+1−1
@@ -469,7 +469,7 @@ static int steelseries_arctis_probe(struct hid_device *hdev, · 468 unmodified lines
469469 return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
470470
471471 if (interface_num == info->sync_interface) {
472− sd = kzalloc_obj(*sd, GFP_KERNEL);
472+ sd = kzalloc_obj(*sd);
473473 if (!sd)
474474 return -ENOMEM;
475475
drivers/hv/channel.c+2−3
@@ -694,12 +694,11 @@ void *vmbus_alloc_buffer(struct vmbus_channel *channel, · 693 unmodified lines
694694 return vzalloc(nr_pages << PAGE_SHIFT);
695695
696696 /* Worst case: every chunk is a single page. */
697− chunks = kvmalloc_array(nr_pages, sizeof(*chunks),
698− GFP_KERNEL | __GFP_ZERO);
697+ chunks = kvmalloc_objs(*chunks, nr_pages, GFP_KERNEL | __GFP_ZERO);
699698 if (!chunks)
700699 goto err;
701700
702− pages = kvmalloc_array(nr_pages, sizeof(*pages), GFP_KERNEL);
701+ pages = kvmalloc_objs(*pages, nr_pages);
703702 if (!pages)
704703 goto err;
705704
drivers/hv/hv_balloon.c+1−1
@@ -939,7 +939,7 @@ static unsigned long process_hot_add(unsigned long pg_start, · 938 unmodified lines
939939 */
940940
941941 if (rg_size != 0) {
942− ha_region = kzalloc(sizeof(struct hv_hotadd_state), GFP_KERNEL);
942+ ha_region = kzalloc_obj(struct hv_hotadd_state);
943943 if (!ha_region)
944944 return 0;
945945
drivers/hwmon/applesmc.c+8−9
@@ -1476,9 +1476,9 @@ static int __init applesmc_init(void) · 1475 unmodified lines
14761476 applesmc_fan_config[smcreg.fan_count] = 0;
14771477 applesmc_pwm_config[smcreg.fan_count] = 0;
14781478
1479− applesmc_info_temp = kzalloc_obj(*applesmc_info_temp, GFP_KERNEL);
1480− applesmc_info_fan = kzalloc_obj(*applesmc_info_fan, GFP_KERNEL);
1481− applesmc_info_pwm = kzalloc_obj(*applesmc_info_pwm, GFP_KERNEL);
1479+ applesmc_info_temp = kzalloc_obj(*applesmc_info_temp);
1480+ applesmc_info_fan = kzalloc_obj(*applesmc_info_fan);
1481+ applesmc_info_pwm = kzalloc_obj(*applesmc_info_pwm);
14821482 if (!applesmc_info_temp || !applesmc_info_fan || !applesmc_info_pwm) {
14831483 ret = -ENOMEM;
14841484 goto out_info;
@@ -1493,7 +1493,7 @@ static int __init applesmc_init(void) · 8 unmodified lines
14931493 applesmc_info_pwm->type = hwmon_pwm;
14941494 applesmc_info_pwm->config = applesmc_pwm_config;
14951495
1496− applesmc_info_arr = kcalloc(4, sizeof(*applesmc_info_arr), GFP_KERNEL);
1496+ applesmc_info_arr = kzalloc_objs(*applesmc_info_arr, 4);
14971497 if (!applesmc_info_arr) {
14981498 ret = -ENOMEM;
14991499 goto out_info;
@@ -1504,7 +1504,7 @@ static int __init applesmc_init(void) · 4 unmodified lines
15041504 applesmc_info_arr[2] = applesmc_info_pwm;
15051505 applesmc_info_arr[3] = NULL;
15061506
1507− applesmc_chip = kzalloc_obj(*applesmc_chip, GFP_KERNEL);
1507+ applesmc_chip = kzalloc_obj(*applesmc_chip);
15081508 if (!applesmc_chip) {
15091509 ret = -ENOMEM;
15101510 goto out_info;
@@ -1514,10 +1514,9 @@ static int __init applesmc_init(void) · 3 unmodified lines
15141514 applesmc_chip->info = applesmc_info_arr;
15151515
15161516 /* Create non-standard fanX_safe attributes group */
1517− fan_safe_attrs = kcalloc(smcreg.fan_count,
1518− sizeof(*fan_safe_attrs), GFP_KERNEL);
1519− fan_safe_attr_list = kcalloc(smcreg.fan_count + 1,
1520− sizeof(*fan_safe_attr_list), GFP_KERNEL);
1517+ fan_safe_attrs = kzalloc_objs(*fan_safe_attrs, smcreg.fan_count);
1518+ fan_safe_attr_list = kzalloc_objs(*fan_safe_attr_list,
1519+ smcreg.fan_count + 1);
15211520 if (!fan_safe_attrs || !fan_safe_attr_list) {
15221521 ret = -ENOMEM;
15231522 goto out_info;
drivers/hwtracing/coresight/coresight-core.c+1−1
@@ -1679,7 +1679,7 @@ coresight_allocate_device_list(const char *prefix) · 1678 unmodified lines
16791679 return list;
16801680 }
16811681
1682− list = kzalloc(sizeof(*list), GFP_KERNEL);
1682+ list = kzalloc_obj(*list);
16831683 if (!list)
16841684 return NULL;
16851685
drivers/i2c/busses/i2c-gpio.c+1−1
@@ -418,7 +418,7 @@ static struct i2c_gpio_scl_data *i2c_gpio_create_scl(struct device *dev) · 417 unmodified lines
418418 }
419419 }
420420
421− scl = kzalloc(sizeof(*scl), GFP_KERNEL);
421+ scl = kzalloc_obj(*scl);
422422 if (!scl) {
423423 if (sharable)
424424 fwnode_handle_put(args.fwnode);
drivers/i3c/master/amd-i3c-master.c+2−2
@@ -376,7 +376,7 @@ static struct xi3c_xfer *xi3c_master_alloc_xfer(unsigned int ncmds) · 375 unmodified lines
376376 {
377377 struct xi3c_xfer *xfer;
378378
379− xfer = kzalloc_flex(*xfer, cmds, ncmds, GFP_KERNEL);
379+ xfer = kzalloc_flex(*xfer, cmds, ncmds);
380380 if (!xfer)
381381 return NULL;
382382
@@ -735,7 +735,7 @@ static int xi3c_master_send_bdcast_ccc_cmd(struct xi3c_master *master, · 352 unmodified lines
735735 if (!xfer)
736736 return -ENOMEM;
737737
738− buf = kmalloc_objs(*buf, xfer_len, GFP_KERNEL);
738+ buf = kmalloc_objs(*buf, xfer_len);
739739 if (!buf)
740740 return -ENOMEM;
741741
drivers/iio/adc/ad7280a.c+2−2
@@ -796,8 +796,8 @@ static irqreturn_t ad7280_event_handler(int irq, void *private) · 795 unmodified lines
796796 struct ad7280_state *st = iio_priv(indio_dev);
797797 int i, ret;
798798
799− unsigned int *channels __free(kfree) = kcalloc(st->scan_cnt, sizeof(*channels),
800− GFP_KERNEL);
799+ unsigned int *channels __free(kfree) = kzalloc_objs(*channels,
800+ st->scan_cnt);
801801 if (!channels)
802802 return IRQ_HANDLED;
803803
drivers/iio/buffer/industrialio-buffer-dmaengine.c+1−1
@@ -109,7 +109,7 @@ static int iio_dmaengine_buffer_submit_block(struct iio_dma_buffer_queue *queue, · 108 unmodified lines
109109 if (nents < 0)
110110 return nents;
111111
112− vecs = kmalloc_array(nents, sizeof(*vecs), GFP_ATOMIC);
112+ vecs = kmalloc_objs(*vecs, nents, GFP_ATOMIC);
113113 if (!vecs)
114114 return -ENOMEM;
115115
drivers/iio/inkern.c+1−1
@@ -345,7 +345,7 @@ static struct iio_channel *iio_channel_get_sys(const char *name, · 344 unmodified lines
345345 return ERR_PTR(-ENODEV);
346346
347347 struct iio_channel *channel __free(kfree) =
348− kzalloc(sizeof(*channel), GFP_KERNEL);
348+ kzalloc_obj(*channel);
349349 if (!channel) {
350350 err = -ENOMEM;
351351 goto error_no_mem;
drivers/infiniband/core/nldev.c+1−1
@@ -2943,7 +2943,7 @@ static int nldev_frmr_pools_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh, · 2942 unmodified lines
29432943 u32 aging_period;
29442944 int err;
29452945
2946− tb = kzalloc_objs(*tb, RDMA_NLDEV_ATTR_MAX, GFP_KERNEL);
2946+ tb = kzalloc_objs(*tb, RDMA_NLDEV_ATTR_MAX);
29472947 if (!tb)
29482948 return -ENOMEM;
29492949
drivers/infiniband/hw/hns/hns_roce_debugfs.c+1−2
@@ -267,8 +267,7 @@ static int hns_roce_alloc_scc_param(struct hns_roce_dev *hr_dev) · 266 unmodified lines
267267 struct hns_roce_scc_param *scc_param;
268268 int i;
269269
270− scc_param = kvcalloc(HNS_ROCE_SCC_ALGO_TOTAL, sizeof(*scc_param),
271− GFP_KERNEL);
270+ scc_param = kvzalloc_objs(*scc_param, HNS_ROCE_SCC_ALGO_TOTAL);
272271 if (!scc_param)
273272 return -ENOMEM;
274273
drivers/input/input.c+1−1
@@ -2344,7 +2344,7 @@ static int input_device_tune_vals(struct input_dev *dev) · 2343 unmodified lines
23442344 if (dev->max_vals >= max_vals)
23452345 return 0;
23462346
2347− vals = kcalloc(max_vals, sizeof(*vals), GFP_KERNEL);
2347+ vals = kzalloc_objs(*vals, max_vals);
23482348 if (!vals)
23492349 return -ENOMEM;
23502350
drivers/input/keyboard/adp5585-keys.c+2−2
@@ -115,8 +115,8 @@ static int adp5585_keys_parse_fw(const struct adp5585_dev *adp5585, · 114 unmodified lines
115115 "Too many keypad pins (%d) defined (max=%d)\n",
116116 n_pins, adp5585->n_pins);
117117
118− unsigned int *keypad_pins __free(kfree) = kcalloc(n_pins, sizeof(*keypad_pins),
119− GFP_KERNEL);
118+ unsigned int *keypad_pins __free(kfree) = kzalloc_objs(*keypad_pins,
119+ n_pins);
120120 if (!keypad_pins)
121121 return -ENOMEM;
122122
drivers/input/keyboard/atkbd.c+1−1
@@ -1070,7 +1070,7 @@ static int atkbd_get_keymap_from_fwnode(struct atkbd *atkbd) · 1069 unmodified lines
10701070 if (n <= 0 || n > ATKBD_KEYMAP_SIZE)
10711071 return -ENXIO;
10721072
1073− u32 *ptr __free(kfree) = kcalloc(n, sizeof(*ptr), GFP_KERNEL);
1073+ u32 *ptr __free(kfree) = kzalloc_objs(*ptr, n);
10741074 if (!ptr)
10751075 return -ENOMEM;
10761076
drivers/input/misc/ims-pcu.c+1−1
@@ -1844,7 +1844,7 @@ static int ims_pcu_line_setup(struct ims_pcu *pcu) · 1843 unmodified lines
18441844 {
18451845 struct usb_host_interface *interface = pcu->ctrl_intf->cur_altsetting;
18461846 struct usb_cdc_line_coding *line __free(kfree) =
1847− kmalloc(sizeof(*line), GFP_KERNEL);
1847+ kmalloc_obj(*line);
18481848 int error;
18491849
18501850 if (!line)
drivers/input/mouse/psmouse-smbus.c+1−1
@@ -232,7 +232,7 @@ int psmouse_smbus_init(struct psmouse *psmouse, · 231 unmodified lines
232232 struct psmouse_smbus_dev *smbdev;
233233 int error;
234234
235− smbdev = kzalloc(sizeof(*smbdev), GFP_KERNEL);
235+ smbdev = kzalloc_obj(*smbdev);
236236 if (!smbdev)
237237 return -ENOMEM;
238238
drivers/input/serio/serio_raw.c+1−1
@@ -84,7 +84,7 @@ static int serio_raw_open(struct inode *inode, struct file *file) · 83 unmodified lines
8484 if (serio_raw->dead)
8585 return -ENODEV;
8686
87− client = kzalloc(sizeof(*client), GFP_KERNEL);
87+ client = kzalloc_obj(*client);
8888 if (!client)
8989 return -ENOMEM;
9090
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h+1−1
@@ -796,7 +796,7 @@ static inline struct arm_smmu_invs *arm_smmu_invs_alloc(size_t num_invs) · 795 unmodified lines
796796 {
797797 struct arm_smmu_invs *new_invs;
798798
799− new_invs = kzalloc(struct_size(new_invs, inv, num_invs), GFP_KERNEL);
799+ new_invs = kzalloc_flex(*new_invs, inv, num_invs);
800800 if (!new_invs)
801801 return NULL;
802802 new_invs->max_invs = num_invs;
drivers/iommu/iommufd/device.c+1−1
@@ -76,7 +76,7 @@ static struct iommufd_group *iommufd_alloc_group(struct iommufd_ctx *ictx, · 75 unmodified lines
7676 {
7777 struct iommufd_group *new_igroup;
7878
79− new_igroup = kzalloc_obj(*new_igroup, GFP_KERNEL);
79+ new_igroup = kzalloc_obj(*new_igroup);
8080 if (!new_igroup)
8181 return ERR_PTR(-ENOMEM);
8282
drivers/iommu/iommufd/driver.c+1−1
@@ -49,7 +49,7 @@ int _iommufd_alloc_mmap(struct iommufd_ctx *ictx, struct iommufd_object *owner, · 48 unmodified lines
4949 if (!length || !PAGE_ALIGNED(length))
5050 return -EINVAL;
5151
52− immap = kzalloc(sizeof(*immap), GFP_KERNEL);
52+ immap = kzalloc_obj(*immap);
5353 if (!immap)
5454 return -ENOMEM;
5555 immap->owner = owner;
drivers/iommu/iommufd/hwpt_noiommu.c+1−1
@@ -54,7 +54,7 @@ noiommu_alloc_paging_flags(struct device *dev, u32 flags, · 53 unmodified lines
5454 (BIT(PT_FEAT_DYNAMIC_TOP) | BIT(PT_FEAT_AMDV1_ENCRYPT_TABLES) |
5555 BIT(PT_FEAT_AMDV1_FORCE_COHERENCE));
5656
57− dom = kzalloc(sizeof(*dom), GFP_KERNEL);
57+ dom = kzalloc_obj(*dom);
5858 if (!dom)
5959 return ERR_PTR(-ENOMEM);
6060
drivers/iommu/vsi-iommu.c+1−1
@@ -231,7 +231,7 @@ static struct iommu_domain *vsi_iommu_domain_alloc_paging(struct device *dev) · 230 unmodified lines
231231 struct vsi_iommu *iommu = dev_iommu_priv_get(dev);
232232 struct vsi_iommu_domain *vsi_domain;
233233
234− vsi_domain = kzalloc(sizeof(*vsi_domain), GFP_KERNEL);
234+ vsi_domain = kzalloc_obj(*vsi_domain);
235235 if (!vsi_domain)
236236 return NULL;
237237
drivers/irqchip/irq-gic-v5-irs.c+1−1
@@ -618,7 +618,7 @@ static int __init gicv5_irs_of_init_affinity(struct device_node *node, · 617 unmodified lines
618618 if (niaffids != ncpus)
619619 return -EINVAL;
620620
621− u16 *iaffids __free(kfree) = kcalloc(niaffids, sizeof(*iaffids), GFP_KERNEL);
621+ u16 *iaffids __free(kfree) = kzalloc_objs(*iaffids, niaffids);
622622 if (!iaffids)
623623 return -ENOMEM;
624624
drivers/irqchip/irq-loongarch-ir.c+1−1
@@ -331,7 +331,7 @@ static int redirect_domain_alloc(struct irq_domain *domain, unsigned int virq, · 330 unmodified lines
331331 struct irq_data *irq_data = irq_domain_get_irq_data(domain, virq + i);
332332 struct redirect_item *item;
333333
334− item = kzalloc(sizeof(*item), GFP_KERNEL);
334+ item = kzalloc_obj(*item);
335335 if (!item) {
336336 pr_err("Alloc redirect descriptor failed\n");
337337 goto out_free_resources;
drivers/irqchip/irq-realtek-rtl.c+1−1
@@ -188,7 +188,7 @@ static int __init realtek_setup_parents(struct device_node *node) · 187 unmodified lines
188188 struct irq_domain *domain;
189189
190190 cnt = max(1, num_parents);
191− output = kcalloc(cnt, sizeof(*output), GFP_KERNEL);
191+ output = kzalloc_objs(*output, cnt);
192192 if (!output)
193193 return -ENOMEM;
194194
drivers/mailbox/riscv-sbi-mpxy-mbox.c+1−1
@@ -783,7 +783,7 @@ static int mpxy_mbox_populate_channels(struct mpxy_mbox *mbox) · 782 unmodified lines
783783 return dev_err_probe(mbox->dev, -ENODEV, "no MPXY channels available\n");
784784
785785 /* Allocate and fetch all channel IDs */
786− channel_ids = kcalloc(mbox->channel_count, sizeof(*channel_ids), GFP_KERNEL);
786+ channel_ids = kzalloc_objs(*channel_ids, mbox->channel_count);
787787 if (!channel_ids)
788788 return -ENOMEM;
789789 rc = mpxy_get_channel_ids(mbox->channel_count, channel_ids);
drivers/md/dm-inlinecrypt.c+1−1
@@ -322,7 +322,7 @@ static int inlinecrypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 321 unmodified lines
322322 return -EINVAL;
323323 }
324324
325− ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
325+ ctx = kzalloc_obj(*ctx);
326326 if (!ctx) {
327327 ti->error = "Out of memory";
328328 return -ENOMEM;
drivers/md/md-llbitmap.c+2−2
@@ -810,7 +810,7 @@ static int llbitmap_expand_pages(struct llbitmap *llbitmap, · 809 unmodified lines
810810 if (nr_pages <= old_nr_pages)
811811 return 0;
812812
813− pctl = kcalloc(nr_pages, sizeof(*pctl), GFP_NOIO);
813+ pctl = kzalloc_objs(*pctl, nr_pages, GFP_NOIO);
814814 if (!pctl)
815815 return -ENOMEM;
816816
@@ -846,7 +846,7 @@ static int llbitmap_alloc_pages(struct llbitmap *llbitmap) · 29 unmodified lines
846846 unsigned int nr_pages = max(used_pages, llbitmap_reserved_pages(llbitmap));
847847 int i;
848848
849− llbitmap->pctl = kcalloc(nr_pages, sizeof(*llbitmap->pctl), GFP_NOIO);
849+ llbitmap->pctl = kzalloc_objs(*llbitmap->pctl, nr_pages, GFP_NOIO);
850850 if (!llbitmap->pctl)
851851 return -ENOMEM;
852852
drivers/media/platform/allegro-dvt/allegro-core.c+1−1
@@ -3105,7 +3105,7 @@ static int allegro_open(struct file *file) · 3104 unmodified lines
31053105 unsigned int cpb_size_max;
31063106 unsigned int cpb_size_def;
31073107
3108− channel = kzalloc(sizeof(*channel), GFP_KERNEL);
3108+ channel = kzalloc_obj(*channel);
31093109 if (!channel)
31103110 return -ENOMEM;
31113111
drivers/media/platform/amd/isp4/isp4_interface.c+3−3
@@ -127,7 +127,7 @@ isp4if_gpu_mem_alloc(struct isp4_interface *ispif, u32 mem_size) · 126 unmodified lines
127127 struct device *dev = ispif->dev;
128128 int ret;
129129
130− mem_info = kmalloc_obj(*mem_info, GFP_KERNEL);
130+ mem_info = kmalloc_obj(*mem_info);
131131 if (!mem_info)
132132 return NULL;
133133
@@ -368,7 +368,7 @@ static int isp4if_send_fw_cmd(struct isp4_interface *ispif, u32 cmd_id, · 234 unmodified lines
368368
369369 /* Allocate the sync command object early and outside of the lock */
370370 if (sync) {
371− ele = kmalloc_obj(*ele, GFP_KERNEL);
371+ ele = kmalloc_obj(*ele);
372372 if (!ele)
373373 return -ENOMEM;
374374
@@ -738,7 +738,7 @@ isp4if_alloc_buffer_node(struct isp4if_img_buf_info *buf_info) · 363 unmodified lines
738738 {
739739 struct isp4if_img_buf_node *node;
740740
741− node = kmalloc_obj(*node, GFP_KERNEL);
741+ node = kmalloc_obj(*node);
742742 if (node)
743743 node->buf_info = *buf_info;
744744
drivers/media/platform/renesas/rcar-isp/core.c+1−1
@@ -232,7 +232,7 @@ int risp_core_job_prepare(struct rcar_isp_core *core) · 231 unmodified lines
232232 }
233233
234234 /* Memory is released when the job is consumed. */
235− job = kzalloc(sizeof(*job), GFP_KERNEL);
235+ job = kzalloc_obj(*job);
236236 if (!job)
237237 return -ENOMEM;
238238
drivers/media/rc/igorplugusb.c+1−1
@@ -164,7 +164,7 @@ static int igorplugusb_probe(struct usb_interface *intf, · 163 unmodified lines
164164 if (!ir)
165165 return -ENOMEM;
166166
167− ir->request = kzalloc_obj(*ir->request, GFP_KERNEL);
167+ ir->request = kzalloc_obj(*ir->request);
168168 if (!ir->request)
169169 goto fail;
170170
drivers/mfd/mfd-core.c+2−2
@@ -135,7 +135,7 @@ static int mfd_match_of_node_to_dev(struct platform_device *pdev, · 134 unmodified lines
135135 return -EAGAIN;
136136
137137 allocate_of_node:
138− of_entry = kzalloc(sizeof(*of_entry), GFP_KERNEL);
138+ of_entry = kzalloc_obj(*of_entry);
139139 if (!of_entry)
140140 return -ENOMEM;
141141
@@ -174,7 +174,7 @@ static int mfd_add_device(struct device *parent, int id, · 32 unmodified lines
174174 if (!pdev->mfd_cell)
175175 goto fail_device;
176176
177− res = kcalloc(cell->num_resources, sizeof(*res), GFP_KERNEL);
177+ res = kzalloc_objs(*res, cell->num_resources);
178178 if (!res)
179179 goto fail_device;
180180
drivers/mfd/ucb1x00-assabet.c+1−1
@@ -96,7 +96,7 @@ static int ucb1x00_assabet_add(struct ucb1x00_dev *dev) · 95 unmodified lines
9696
9797 struct ucb1x00_assabet_priv *priv;
9898
99− priv = kzalloc_obj(*priv, GFP_KERNEL);
99+ priv = kzalloc_obj(*priv);
100100 if (!priv)
101101 return -ENOMEM;
102102
drivers/mtd/mtd_virt_concat.c+2−2
@@ -166,7 +166,7 @@ static int mtd_virt_concat_create_item(struct device_node *parts, · 165 unmodified lines
166166 return 0;
167167 }
168168
169− item = kzalloc_flex(*item, nodes, count, GFP_KERNEL);
169+ item = kzalloc_flex(*item, nodes, count);
170170 if (!item)
171171 return -ENOMEM;
172172
@@ -182,7 +182,7 @@ static int mtd_virt_concat_create_item(struct device_node *parts, · 9 unmodified lines
182182 for (i = 1; i < count; i++)
183183 item->nodes[i] = of_parse_phandle(parts, CONCAT_PROP, (i - 1));
184184
185− concat = kzalloc_flex(*concat, subdev, count, GFP_KERNEL);
185+ concat = kzalloc_flex(*concat, subdev, count);
186186 if (!concat) {
187187 kfree(item);
188188 return -ENOMEM;
drivers/mtd/mtdconcat.c+1−1
@@ -639,7 +639,7 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c · 638 unmodified lines
639639 printk(KERN_NOTICE "into device \"%s\"\n", name);
640640
641641 /* allocate the device structure */
642− concat = kzalloc_flex(*concat, subdev, num_devs, GFP_KERNEL);
642+ concat = kzalloc_flex(*concat, subdev, num_devs);
643643 if (!concat) {
644644 printk
645645 ("memory allocation error while creating concatenated device \"%s\"\n",
drivers/net/dsa/mv88e6xxx/tcflower.c+1−1
@@ -97,7 +97,7 @@ int mv88e6xxx_cls_flower_add(struct dsa_switch *ds, int port, · 96 unmodified lines
9797 goto err_unlock;
9898 }
9999
100− entry = kzalloc(sizeof(*entry), GFP_KERNEL);
100+ entry = kzalloc_obj(*entry);
101101 if (!entry) {
102102 err = -ENOMEM;
103103 goto err_unlock;
drivers/net/ethernet/alibaba/eea/eea_adminq.c+3−4
@@ -439,8 +439,7 @@ int eea_adminq_dev_status(struct eea_net *enet, · 438 unmodified lines
439439 q_num = enet->cfg.rx_ring_num + enet->cfg.tx_ring_num + 1;
440440 io_num = enet->cfg.rx_ring_num + enet->cfg.tx_ring_num;
441441
442− req = kcalloc(q_num, sizeof(struct eea_aq_queue_drv_status),
443− GFP_KERNEL);
442+ req = kzalloc_objs(struct eea_aq_queue_drv_status, q_num);
444443 if (!req)
445444 return -ENOMEM;
446445
@@ -486,11 +485,11 @@ void eea_adminq_config_host_info(struct eea_net *enet) · 39 unmodified lines
486485 struct eea_aq_host_info_rep *rep;
487486 int rc = -ENOMEM;
488487
489− cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
488+ cfg = kzalloc_obj(*cfg);
490489 if (!cfg)
491490 return;
492491
493− rep = kzalloc(sizeof(*rep), GFP_KERNEL);
492+ rep = kzalloc_obj(*rep);
494493 if (!rep)
495494 goto err_free_cfg;
496495
drivers/net/ethernet/alibaba/eea/eea_net.c+4−4
@@ -62,7 +62,7 @@ static int eea_alloc_irq_blks(struct eea_net *enet) · 61 unmodified lines
6262
6363 num = enet->edev->rx_num;
6464
65− irq_blks = kvcalloc(num, sizeof(*blk), GFP_KERNEL);
65+ irq_blks = kvzalloc_objs(*blk, num);
6666 if (!irq_blks)
6767 return -ENOMEM;
6868
@@ -194,11 +194,11 @@ static int eea_alloc_rxtx_q_mem(struct eea_net_init_ctx *ctx) · 125 unmodified lines
194194 struct eea_net_tx *tx;
195195 int err, i;
196196
197− ctx->tx = kvcalloc(ctx->cfg.tx_ring_num, sizeof(*ctx->tx), GFP_KERNEL);
197+ ctx->tx = kvzalloc_objs(*ctx->tx, ctx->cfg.tx_ring_num);
198198 if (!ctx->tx)
199199 return -ENOMEM;
200200
201− ctx->rx = kvcalloc(ctx->cfg.rx_ring_num, sizeof(*ctx->rx), GFP_KERNEL);
201+ ctx->rx = kvzalloc_objs(*ctx->rx, ctx->cfg.rx_ring_num);
202202 if (!ctx->rx)
203203 goto err_free_tx;
204204
@@ -601,7 +601,7 @@ static int eea_netdev_init_features(struct net_device *netdev, · 396 unmodified lines
601601 int err;
602602 u32 mtu;
603603
604− cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
604+ cfg = kzalloc_obj(*cfg);
605605 if (!cfg)
606606 return -ENOMEM;
607607
drivers/net/ethernet/alibaba/eea/eea_pci.c+1−1
@@ -651,7 +651,7 @@ static int eea_pci_probe(struct pci_dev *pci_dev, · 650 unmodified lines
651651 struct eea_device *edev;
652652 int err;
653653
654− ep_dev = kzalloc(sizeof(*ep_dev), GFP_KERNEL);
654+ ep_dev = kzalloc_obj(*ep_dev);
655655 if (!ep_dev)
656656 return -ENOMEM;
657657
drivers/net/ethernet/alibaba/eea/eea_ring.c+1−1
@@ -217,7 +217,7 @@ struct eea_ring *eea_ering_alloc(u32 index, u32 num, struct eea_device *edev, · 216 unmodified lines
217217 if (!cq_desc_size || !is_power_of_2(cq_desc_size))
218218 return NULL;
219219
220− ering = kzalloc(sizeof(*ering), GFP_KERNEL);
220+ ering = kzalloc_obj(*ering);
221221 if (!ering)
222222 return NULL;
223223
drivers/net/ethernet/alibaba/eea/eea_rx.c+2−3
@@ -764,7 +764,7 @@ struct eea_net_rx *eea_alloc_rx(struct eea_net_init_ctx *ctx, u32 idx) · 763 unmodified lines
764764 struct eea_net_rx *rx;
765765 int err;
766766
767− rx = kzalloc(sizeof(*rx), GFP_KERNEL);
767+ rx = kzalloc_obj(*rx);
768768 if (!rx)
769769 return rx;
770770
@@ -786,8 +786,7 @@ struct eea_net_rx *eea_alloc_rx(struct eea_net_init_ctx *ctx, u32 idx) · 15 unmodified lines
786786 rx->dma_dev = ctx->edev->dma_dev;
787787
788788 /* meta */
789− rx->meta = kvcalloc(ctx->cfg.rx_ring_depth,
790− sizeof(*rx->meta), GFP_KERNEL);
789+ rx->meta = kvzalloc_objs(*rx->meta, ctx->cfg.rx_ring_depth);
791790 if (!rx->meta)
792791 goto err_free_rx;
793792
drivers/net/ethernet/alibaba/eea/eea_tx.c+1−2
@@ -480,8 +480,7 @@ int eea_alloc_tx(struct eea_net_init_ctx *ctx, struct eea_net_tx *tx, u32 idx) · 479 unmodified lines
480480 tx->dma_dev = ctx->edev->dma_dev;
481481
482482 /* meta */
483− tx->meta = kvcalloc(ctx->cfg.tx_ring_depth,
484− sizeof(*tx->meta), GFP_KERNEL);
483+ tx->meta = kvzalloc_objs(*tx->meta, ctx->cfg.tx_ring_depth);
485484 if (!tx->meta)
486485 goto err_free_tx;
487486
drivers/net/ethernet/amd/pds_core/core.c+1−2
@@ -810,8 +810,7 @@ void pdsc_host_mem_add(struct pdsc *pdsc) · 809 unmodified lines
810810 if (count == 0)
811811 return;
812812
813− pdsc->host_mem_reqs = kzalloc_objs(*pdsc->host_mem_reqs, count,
814− GFP_KERNEL);
813+ pdsc->host_mem_reqs = kzalloc_objs(*pdsc->host_mem_reqs, count);
815814 if (!pdsc->host_mem_reqs) {
816815 dev_err(pdsc->dev, "failed to alloc host_mem_reqs array\n");
817816 return;
drivers/net/ethernet/amd/pds_core/fw.c+3−3
@@ -382,7 +382,7 @@ static int pdsc_send_package_data(struct pldmfw *context, const u8 *data, · 381 unmodified lines
382382 if (!length)
383383 return 0;
384384
385− deferred = kmalloc_obj(*deferred, GFP_KERNEL);
385+ deferred = kmalloc_obj(*deferred);
386386 if (!deferred)
387387 return -ENOMEM;
388388
@@ -505,7 +505,7 @@ static int pdsc_send_component_table(struct pldmfw *context, · 116 unmodified lines
505505 component->version_string, component->index,
506506 component->component_size, transfer_flag);
507507
508− component_priv = kzalloc_obj(*component_priv, GFP_KERNEL);
508+ component_priv = kzalloc_obj(*component_priv);
509509 if (!component_priv)
510510 return -ENOMEM;
511511
@@ -710,7 +710,7 @@ static int pdsc_flash_component_chunk(struct pdsc *pdsc, struct device *dev, · 198 unmodified lines
710710 u8 *component_data;
711711 int err;
712712
713− deferred = kmalloc_obj(*deferred, GFP_KERNEL);
713+ deferred = kmalloc_obj(*deferred);
714714 if (!deferred)
715715 return -ENOMEM;
716716
drivers/net/ethernet/cadence/macb_main.c+1−1
@@ -4334,7 +4334,7 @@ static int macb_taprio_setup_replace(struct net_device *netdev, · 4333 unmodified lines
43344334 return -EINVAL;
43354335 }
43364336
4337− enst_queue = kcalloc(conf->num_entries, sizeof(*enst_queue), GFP_KERNEL);
4337+ enst_queue = kzalloc_objs(*enst_queue, conf->num_entries);
43384338 if (unlikely(!enst_queue))
43394339 return -ENOMEM;
43404340
drivers/net/ethernet/cisco/enic/enic_admin.c+1−1
@@ -137,7 +137,7 @@ static void enic_admin_msg_enqueue(struct enic *enic, void *buf, · 136 unmodified lines
137137 {
138138 struct enic_admin_msg *msg;
139139
140− msg = kmalloc(struct_size(msg, data, len), GFP_KERNEL);
140+ msg = kmalloc_flex(*msg, data, len);
141141 if (!msg)
142142 return;
143143
drivers/net/ethernet/cisco/enic/enic_main.c+3−3
@@ -2858,7 +2858,7 @@ enic_sriov_v2_enable(struct enic *enic, int num_vfs) · 2857 unmodified lines
28582858 return -EOPNOTSUPP;
28592859 }
28602860
2861− enic->vf_state = kcalloc(num_vfs, sizeof(*enic->vf_state), GFP_KERNEL);
2861+ enic->vf_state = kzalloc_objs(*enic->vf_state, num_vfs);
28622862 if (!enic->vf_state)
28632863 return -ENOMEM;
28642864
@@ -2946,7 +2946,7 @@ enic_sriov_configure(struct pci_dev *pdev, int num_vfs) · 81 unmodified lines
29462946 if (enic->vf_type == ENIC_VF_TYPE_V2)
29472947 return enic_sriov_v2_enable(enic, num_vfs);
29482948
2949− pp = kcalloc(num_vfs, sizeof(*pp), GFP_KERNEL);
2949+ pp = kzalloc_objs(*pp, num_vfs);
29502950 if (!pp)
29512951 return -ENOMEM;
29522952
@@ -2971,7 +2971,7 @@ enic_sriov_configure(struct pci_dev *pdev, int num_vfs) · 18 unmodified lines
29712971 return 0;
29722972 }
29732973
2974− pp = kzalloc_obj(*enic->pp, GFP_KERNEL);
2974+ pp = kzalloc_obj(*enic->pp);
29752975 if (!pp)
29762976 return -ENOMEM;
29772977
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c+2−3
@@ -616,7 +616,7 @@ static int dpaa2_switch_lag_fdb_add(struct dpaa2_switch_lag *lag, · 615 unmodified lines
616616 goto out;
617617 }
618618
619− a = kzalloc(sizeof(*a), GFP_KERNEL);
619+ a = kzalloc_obj(*a);
620620 if (!a) {
621621 err = -ENOMEM;
622622 goto out;
@@ -4131,8 +4131,7 @@ static int dpaa2_switch_probe(struct fsl_mc_device *sw_dev) · 3508 unmodified lines
41314131 goto err_free_fdbs;
41324132 }
41334133
4134− ethsw->lags = kcalloc(ethsw->sw_attr.num_ifs, sizeof(*ethsw->lags),
4135− GFP_KERNEL);
4134+ ethsw->lags = kzalloc_objs(*ethsw->lags, ethsw->sw_attr.num_ifs);
41364135 if (!ethsw->lags) {
41374136 err = -ENOMEM;
41384137 goto err_free_filter;
drivers/net/ethernet/intel/libie/controlq.c+1−2
@@ -157,8 +157,7 @@ static void libie_ctlq_free_tx_msgs(struct libie_ctlq_info *ctlq, · 156 unmodified lines
157157 */
158158 static int libie_ctlq_alloc_tx_msgs(struct libie_ctlq_info *ctlq)
159159 {
160− ctlq->tx_msg = kvzalloc_objs(*ctlq->tx_msg, ctlq->ring_len,
161− GFP_KERNEL);
160+ ctlq->tx_msg = kvzalloc_objs(*ctlq->tx_msg, ctlq->ring_len);
162161 if (!ctlq->tx_msg)
163162 return -ENOMEM;
164163
drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c+5−8
@@ -3647,7 +3647,7 @@ static int npc_defrag_add_2_show_list(struct rvu *rvu, u16 old_midx, · 3646 unmodified lines
36473647 {
36483648 struct npc_defrag_show_node *node;
36493649
3650− node = kcalloc(1, sizeof(*node), GFP_KERNEL);
3650+ node = kzalloc_objs(*node, 1);
36513651 if (!node)
36523652 return -ENOMEM;
36533653
@@ -4082,7 +4082,7 @@ int npc_cn20k_defrag(struct rvu *rvu) · 428 unmodified lines
40824082 INIT_LIST_HEAD(&x4lh);
40834083 INIT_LIST_HEAD(&x2lh);
40844084
4085− node = kcalloc(npc_priv->num_subbanks, sizeof(*node), GFP_KERNEL);
4085+ node = kzalloc_objs(*node, npc_priv->num_subbanks);
40864086 if (!node)
40874087 return -ENOMEM;
40884088
@@ -4711,7 +4711,7 @@ static int npc_priv_init(struct rvu *rvu) · 622 unmodified lines
47114711 return -EINVAL;
47124712 }
47134713
4714− npc_priv = kcalloc(1, sizeof(*npc_priv), GFP_KERNEL);
4714+ npc_priv = kzalloc_objs(*npc_priv, 1);
47154715 if (!npc_priv)
47164716 return -ENOMEM;
47174717
@@ -4729,8 +4729,7 @@ static int npc_priv_init(struct rvu *rvu) · 11 unmodified lines
47294729 num_banks, bank_depth, num_subbanks, subbank_depth,
47304730 npc_kw_name[npc_priv->kw]);
47314731
4732− npc_priv->sb = kcalloc(num_subbanks, sizeof(struct npc_subbank),
4733− GFP_KERNEL);
4732+ npc_priv->sb = kzalloc_objs(struct npc_subbank, num_subbanks);
47344733 if (!npc_priv->sb)
47354734 goto fail1;
47364735
@@ -4757,9 +4756,7 @@ static int npc_priv_init(struct rvu *rvu) · 20 unmodified lines
47574756
47584757 /* Get number of pcifuncs in the system */
47594758 npc_priv->pf_cnt = npc_pcifunc_map_create(rvu);
4760− npc_priv->xa_pf2idx_map = kcalloc(npc_priv->pf_cnt,
4761− sizeof(struct xarray),
4762− GFP_KERNEL);
4759+ npc_priv->xa_pf2idx_map = kzalloc_objs(struct xarray, npc_priv->pf_cnt);
47634760 if (!npc_priv->xa_pf2idx_map) {
47644761 ret = -ENOMEM;
47654762 goto fail3;
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c+1−2
@@ -2288,8 +2288,7 @@ static int mlx5_esw_spfs_init(struct mlx5_eswitch *esw) · 2287 unmodified lines
22882288 if (!num_entries)
22892289 goto out_free;
22902290
2291− esw_funcs->spfs = kcalloc(num_entries, sizeof(*esw_funcs->spfs),
2292− GFP_KERNEL);
2291+ esw_funcs->spfs = kzalloc_objs(*esw_funcs->spfs, num_entries);
22932292 if (!esw_funcs->spfs) {
22942293 err = -ENOMEM;
22952294 goto out_free;
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+1−1
@@ -1524,7 +1524,7 @@ struct mlx5_flow_handle * · 1523 unmodified lines
15241524 mlx5_esw_lag_demux_rule_create(struct mlx5_eswitch *esw, u16 vport_num,
15251525 struct mlx5_flow_table *lag_ft)
15261526 {
1527− struct mlx5_flow_spec *spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
1527+ struct mlx5_flow_spec *spec = kvzalloc_obj(*spec);
15281528 struct mlx5_flow_destination dest = {};
15291529 struct mlx5_flow_act flow_act = {};
15301530 struct mlx5_flow_handle *ret;
drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c+1−1
@@ -317,7 +317,7 @@ int mlx5_sf_hw_table_init(struct mlx5_core_dev *dev) · 316 unmodified lines
317317
318318 num_spfs = mlx5_esw_get_num_spfs(dev);
319319 num_hwc = MLX5_SF_HWC_FIRST_SPF + num_spfs;
320− table->hwc = kcalloc(num_hwc, sizeof(*table->hwc), GFP_KERNEL);
320+ table->hwc = kzalloc_objs(*table->hwc, num_hwc);
321321 if (!table->hwc) {
322322 err = -ENOMEM;
323323 goto hwc_alloc_err;
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_icm_pool.c+1−1
@@ -239,7 +239,7 @@ static int dr_icm_buddy_init_ste_cache(struct mlx5dr_icm_buddy_mem *buddy) · 238 unmodified lines
239239 if (!buddy->hw_ste_arr)
240240 goto free_ste_arr;
241241
242− buddy->miss_list = kvmalloc_array(num_of_entries, sizeof(struct list_head), GFP_KERNEL);
242+ buddy->miss_list = kvmalloc_objs(struct list_head, num_of_entries);
243243 if (!buddy->miss_list)
244244 goto free_hw_ste_arr;
245245
drivers/net/ethernet/meta/fbnic/fbnic_irq.c+1−1
@@ -282,7 +282,7 @@ enum fbnic_msix_self_test_codes fbnic_msix_test(struct fbnic_dev *fbd) · 281 unmodified lines
282282 int i;
283283
284284 /* Allocate bitmap and IRQ vector table */
285− test_data = kzalloc_obj(*test_data, GFP_KERNEL);
285+ test_data = kzalloc_obj(*test_data);
286286
287287 /* memory allocation failure */
288288 if (!test_data)
drivers/net/ethernet/microsoft/mana/gdma_main.c+4−4
@@ -429,11 +429,11 @@ int mana_gd_alloc_memory(struct gdma_context *gc, unsigned int length, · 428 unmodified lines
429429 /* length is a power of 2 above PAGE_SIZE, so this divides exactly. */
430430 npages = length / PAGE_SIZE;
431431
432− gmi->pages_va = kvcalloc(npages, sizeof(*gmi->pages_va), GFP_KERNEL);
432+ gmi->pages_va = kvzalloc_objs(*gmi->pages_va, npages);
433433 if (!gmi->pages_va)
434434 return -ENOMEM;
435435
436− gmi->pages_dma = kvcalloc(npages, sizeof(*gmi->pages_dma), GFP_KERNEL);
436+ gmi->pages_dma = kvzalloc_objs(*gmi->pages_dma, npages);
437437 if (!gmi->pages_dma)
438438 goto free_va;
439439
@@ -825,7 +825,7 @@ int mana_schedule_serv_work(struct gdma_context *gc, enum gdma_eqe_type type) · 385 unmodified lines
825825 return -ENODEV;
826826 }
827827
828− mns_wk = kzalloc(sizeof(*mns_wk), GFP_ATOMIC);
828+ mns_wk = kzalloc_obj(*mns_wk, GFP_ATOMIC);
829829 if (!mns_wk) {
830830 module_put(THIS_MODULE);
831831 clear_bit(GC_IN_SERVICE, &gc->flags);
@@ -1991,7 +1991,7 @@ struct gdma_irq_context *mana_gd_get_gic(struct gdma_context *gc, · 1159 unmodified lines
19911991 *msi_requested = msi;
19921992 }
19931993
1994− gic = kzalloc(sizeof(*gic), GFP_KERNEL);
1994+ gic = kzalloc_obj(*gic);
19951995 if (!gic) {
19961996 gic = ERR_PTR(-ENOMEM);
19971997 if (irq_map.virq)
drivers/net/ntb_netdev.c+1−2
@@ -659,8 +659,7 @@ static int ntb_netdev_probe(struct device *client_dev) · 658 unmodified lines
659659 dev->client_dev = client_dev;
660660 dev->num_queues = 0;
661661
662− dev->queues = kzalloc_objs(*dev->queues, NTB_NETDEV_MAX_QUEUES,
663− GFP_KERNEL);
662+ dev->queues = kzalloc_objs(*dev->queues, NTB_NETDEV_MAX_QUEUES);
664663 if (!dev->queues) {
665664 rc = -ENOMEM;
666665 goto err_free_netdev;
drivers/net/wireless/ath/ath12k/ahb.c+1−1
@@ -870,7 +870,7 @@ static struct ath12k_ahb_rproc_info *ath12k_ahb_rproc_info_alloc(struct ath12k_b · 869 unmodified lines
870870
871871 lockdep_assert_held(&ath12k_rproc_info_lock);
872872
873− rproc_info = kzalloc_obj(*rproc_info, GFP_KERNEL);
873+ rproc_info = kzalloc_obj(*rproc_info);
874874 if (!rproc_info)
875875 return NULL;
876876
drivers/net/wireless/intel/iwlwifi/mld/regulatory.c+1−2
@@ -514,8 +514,7 @@ void iwl_mld_init_ap_type_tables(struct iwl_mld *mld) · 513 unmodified lines
514514 return;
515515
516516 if (iwl_fw_lookup_cmd_ver(mld->fw, cmd.id, 1) == 1) {
517− struct iwl_mcc_allowed_ap_type_cmd_v1 *cmd_v1 =
518− kzalloc(sizeof(*cmd_v1), GFP_KERNEL);
517+ struct iwl_mcc_allowed_ap_type_cmd_v1 *cmd_v1 = kzalloc_obj(*cmd_v1);
519518
520519 if (!cmd_v1)
521520 return;
drivers/net/wireless/mediatek/mt76/mt7921/regd.c+1−1
@@ -289,7 +289,7 @@ int mt7921_regd_update(struct mt792x_phy *phy, char *alpha2) · 288 unmodified lines
289289 goto err;
290290 }
291291
292− regd = kzalloc(struct_size(regd, reg_rules, num_of_rules), GFP_KERNEL);
292+ regd = kzalloc_flex(*regd, reg_rules, num_of_rules);
293293 if (!regd) {
294294 ret = -ENOMEM;
295295 goto err;
drivers/net/wireless/mediatek/mt76/mt7925/main.c+1−1
@@ -1105,7 +1105,7 @@ mt7925_mac_sta_add_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, · 1104 unmodified lines
11051105 mlink = &msta->deflink;
11061106 is_deflink = true;
11071107 } else {
1108− mlink = kzalloc(sizeof(*mlink), GFP_KERNEL);
1108+ mlink = kzalloc_obj(*mlink);
11091109 if (!mlink) {
11101110 err = -ENOMEM;
11111111 break;
drivers/net/wireless/mediatek/mt76/mt7925/regd.c+1−1
@@ -336,7 +336,7 @@ int mt7925_regd_update(struct mt792x_phy *phy, char *alpha2) · 335 unmodified lines
336336 goto err;
337337 }
338338
339− regd = kzalloc(struct_size(regd, reg_rules, num_of_rules), GFP_KERNEL);
339+ regd = kzalloc_flex(*regd, reg_rules, num_of_rules);
340340 if (!regd) {
341341 ret = -ENOMEM;
342342 goto err;
drivers/net/wireless/morsemicro/mm81x/mac.c+4−5
@@ -706,8 +706,7 @@ static int mm81x_hw_scan_h_init_chan_list(struct mm81x_hw_scan_params *params, · 705 unmodified lines
706706
707707 params->num_chans = 0;
708708 params->allocated_chans = 0;
709− params->channels = kcalloc(chans_to_allocate, sizeof(*params->channels),
710− GFP_KERNEL);
709+ params->channels = kzalloc_objs(*params->channels, chans_to_allocate);
711710 if (!params->channels)
712711 return -ENOMEM;
713712
@@ -728,8 +727,8 @@ static int mm81x_hw_scan_h_init_chan_list(struct mm81x_hw_scan_params *params, · 14 unmodified lines
728727 }
729728 }
730729
731− params->powers_qdbm = kmalloc_array(
732− num_pwrs_coarse, sizeof(*params->powers_qdbm), GFP_KERNEL);
730+ params->powers_qdbm = kmalloc_objs(*params->powers_qdbm,
731+ num_pwrs_coarse);
733732 if (!params->powers_qdbm)
734733 return -ENOMEM;
735734
@@ -822,7 +821,7 @@ __mm81x_hw_scan_h_init_params(struct mm81x *mors) · 86 unmodified lines
822821 struct mm81x_hw_scan_params *params = mors->hw_scan.params;
823822
824823 if (!params) {
825− params = kzalloc_obj(*params, GFP_KERNEL);
824+ params = kzalloc_obj(*params);
826825 if (params)
827826 mors->hw_scan.params = params;
828827 } else {
drivers/net/wireless/morsemicro/mm81x/yaps.c+4−6
@@ -22,15 +22,13 @@ · 21 unmodified lines
2222
2323 static int mm81x_yaps_alloc_pkt_buffers(struct mm81x_yaps *yaps)
2424 {
25− yaps->hw.to_chip_pkts = kcalloc(MAX_PKTS_PER_TX_TXN,
26− sizeof(*yaps->hw.to_chip_pkts),
27− GFP_KERNEL);
25+ yaps->hw.to_chip_pkts = kzalloc_objs(*yaps->hw.to_chip_pkts,
26+ MAX_PKTS_PER_TX_TXN);
2827 if (!yaps->hw.to_chip_pkts)
2928 return -ENOMEM;
3029
31− yaps->hw.from_chip_pkts = kcalloc(MAX_PKTS_PER_RX_TXN,
32− sizeof(*yaps->hw.from_chip_pkts),
33− GFP_KERNEL);
30+ yaps->hw.from_chip_pkts = kzalloc_objs(*yaps->hw.from_chip_pkts,
31+ MAX_PKTS_PER_RX_TXN);
3432 if (!yaps->hw.from_chip_pkts) {
3533 kfree(yaps->hw.to_chip_pkts);
3634 yaps->hw.to_chip_pkts = NULL;
drivers/net/wireless/nxp/nxpwifi/cfg80211.c+7−7
@@ -641,7 +641,7 @@ nxpwifi_cfg80211_set_wiphy_params(struct wiphy *wiphy, int radio_idx, u32 change · 640 unmodified lines
641641
642642 switch (priv->bss_role) {
643643 case NXPWIFI_BSS_ROLE_UAP:
644− bss_cfg = kzalloc_obj(*bss_cfg, GFP_KERNEL);
644+ bss_cfg = kzalloc_obj(*bss_cfg);
645645 if (!bss_cfg) {
646646 ret = -ENOMEM;
647647 break;
@@ -1713,7 +1713,7 @@ static int nxpwifi_cfg80211_start_ap(struct wiphy *wiphy, · 1065 unmodified lines
17131713 if (!nxpwifi_is_channel_setting_allowable(priv, params->chandef.chan))
17141714 return -EOPNOTSUPP;
17151715
1716− bss_cfg = kzalloc_obj(*bss_cfg, GFP_KERNEL);
1716+ bss_cfg = kzalloc_obj(*bss_cfg);
17171717 if (!bss_cfg)
17181718 return -ENOMEM;
17191719
@@ -1866,7 +1866,7 @@ nxpwifi_cfg80211_scan(struct wiphy *wiphy, · 146 unmodified lines
18661866 if (!nxpwifi_stop_bg_scan(priv))
18671867 cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0);
18681868
1869− user_scan_cfg = kzalloc_obj(*user_scan_cfg, GFP_KERNEL);
1869+ user_scan_cfg = kzalloc_obj(*user_scan_cfg);
18701870 if (!user_scan_cfg)
18711871 return -ENOMEM;
18721872
@@ -1973,7 +1973,7 @@ nxpwifi_cfg80211_sched_scan_start(struct wiphy *wiphy, · 100 unmodified lines
19731973 request->n_channels, request->scan_plans->interval,
19741974 (int)request->ie_len);
19751975
1976− bgscan_cfg = kzalloc_obj(*bgscan_cfg, GFP_KERNEL);
1976+ bgscan_cfg = kzalloc_obj(*bgscan_cfg);
19771977 if (!bgscan_cfg)
19781978 return -ENOMEM;
19791979
@@ -2304,7 +2304,7 @@ nxpwifi_setup_he_caps(struct nxpwifi_private *priv, · 324 unmodified lines
23042304 if (!hw_he_cap_len)
23052305 return;
23062306
2307− iftype_data = kmalloc_obj(*iftype_data, GFP_KERNEL);
2307+ iftype_data = kmalloc_obj(*iftype_data);
23082308 if (!iftype_data)
23092309 return;
23102310 memset(iftype_data, 0, sizeof(*iftype_data));
@@ -2759,7 +2759,7 @@ static int nxpwifi_set_mef_filter(struct nxpwifi_private *priv, · 448 unmodified lines
27592759 if (wowlan->n_patterns || wowlan->magic_pkt)
27602760 num_entries++;
27612761
2762− mef_entry = kzalloc_objs(*mef_entry, num_entries, GFP_KERNEL);
2762+ mef_entry = kzalloc_objs(*mef_entry, num_entries);
27632763 if (!mef_entry)
27642764 return -ENOMEM;
27652765
@@ -3227,7 +3227,7 @@ static int nxpwifi_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev, · 461 unmodified lines
32273227 if (!tb[NXPWIFI_TM_ATTR_DATA])
32283228 return -EINVAL;
32293229
3230− hostcmd = kzalloc_obj(*hostcmd, GFP_KERNEL);
3230+ hostcmd = kzalloc_obj(*hostcmd);
32313231 if (!hostcmd)
32323232 return -ENOMEM;
32333233
drivers/net/wireless/nxp/nxpwifi/cmdevt.c+1−1
@@ -302,7 +302,7 @@ int nxpwifi_alloc_cmd_buffer(struct nxpwifi_adapter *adapter) · 301 unmodified lines
302302
303303 /* Allocate and initialize struct cmd_ctrl_node */
304304 cmd_array = kzalloc_objs(struct cmd_ctrl_node,
305− NXPWIFI_NUM_OF_CMD_BUFFER, GFP_KERNEL);
305+ NXPWIFI_NUM_OF_CMD_BUFFER);
306306 if (!cmd_array)
307307 return -ENOMEM;
308308
drivers/net/wireless/nxp/nxpwifi/ie.c+7−7
@@ -143,7 +143,7 @@ nxpwifi_update_uap_custom_ie(struct nxpwifi_private *priv, · 142 unmodified lines
143143 u16 len;
144144 int ret;
145145
146− ap_custom_ie = kzalloc_obj(*ap_custom_ie, GFP_KERNEL);
146+ ap_custom_ie = kzalloc_obj(*ap_custom_ie);
147147 if (!ap_custom_ie)
148148 return -ENOMEM;
149149
@@ -209,7 +209,7 @@ static int nxpwifi_update_vs_ie(const u8 *ies, int ies_len, · 59 unmodified lines
209209 vendor_ie = cfg80211_find_vendor_ie(oui, oui_type, ies, ies_len);
210210 if (vendor_ie) {
211211 if (!*ie_ptr) {
212− *ie_ptr = kzalloc_obj(struct nxpwifi_ie, GFP_KERNEL);
212+ *ie_ptr = kzalloc_obj(struct nxpwifi_ie);
213213 if (!*ie_ptr)
214214 return -ENOMEM;
215215 ie = *ie_ptr;
@@ -309,7 +309,7 @@ static int nxpwifi_uap_parse_tail_ies(struct nxpwifi_private *priv, · 93 unmodified lines
309309 if (!info->tail || !info->tail_len)
310310 return 0;
311311
312− gen_ie = kzalloc_obj(*gen_ie, GFP_KERNEL);
312+ gen_ie = kzalloc_obj(*gen_ie);
313313 if (!gen_ie)
314314 return -ENOMEM;
315315
@@ -417,7 +417,7 @@ int nxpwifi_del_mgmt_ies(struct nxpwifi_private *priv) · 101 unmodified lines
417417 int ret = 0;
418418
419419 if (priv->gen_idx != NXPWIFI_AUTO_IDX_MASK) {
420− gen_ie = kmalloc_obj(*gen_ie, GFP_KERNEL);
420+ gen_ie = kmalloc_obj(*gen_ie);
421421 if (!gen_ie)
422422 return -ENOMEM;
423423
@@ -434,7 +434,7 @@ int nxpwifi_del_mgmt_ies(struct nxpwifi_private *priv) · 10 unmodified lines
434434 }
435435
436436 if (priv->beacon_idx != NXPWIFI_AUTO_IDX_MASK) {
437− beacon_ie = kmalloc_obj(*beacon_ie, GFP_KERNEL);
437+ beacon_ie = kmalloc_obj(*beacon_ie);
438438 if (!beacon_ie) {
439439 ret = -ENOMEM;
440440 goto done;
@@ -444,7 +444,7 @@ int nxpwifi_del_mgmt_ies(struct nxpwifi_private *priv) · 3 unmodified lines
444444 beacon_ie->ie_length = 0;
445445 }
446446 if (priv->proberesp_idx != NXPWIFI_AUTO_IDX_MASK) {
447− pr_ie = kmalloc_obj(*pr_ie, GFP_KERNEL);
447+ pr_ie = kmalloc_obj(*pr_ie);
448448 if (!pr_ie) {
449449 ret = -ENOMEM;
450450 goto done;
@@ -454,7 +454,7 @@ int nxpwifi_del_mgmt_ies(struct nxpwifi_private *priv) · 3 unmodified lines
454454 pr_ie->ie_length = 0;
455455 }
456456 if (priv->assocresp_idx != NXPWIFI_AUTO_IDX_MASK) {
457− ar_ie = kmalloc_obj(*ar_ie, GFP_KERNEL);
457+ ar_ie = kmalloc_obj(*ar_ie);
458458 if (!ar_ie) {
459459 ret = -ENOMEM;
460460 goto done;
drivers/net/wireless/nxp/nxpwifi/init.c+1−1
@@ -20,7 +20,7 @@ static int nxpwifi_add_bss_prio_tbl(struct nxpwifi_private *priv) · 19 unmodified lines
2020 struct nxpwifi_bss_prio_node *bss_prio;
2121 struct nxpwifi_bss_prio_tbl *tbl = adapter->bss_prio_tbl;
2222
23− bss_prio = kzalloc_obj(*bss_prio, GFP_KERNEL);
23+ bss_prio = kzalloc_obj(*bss_prio);
2424 if (!bss_prio)
2525 return -ENOMEM;
2626
drivers/net/wireless/nxp/nxpwifi/main.c+4−4
@@ -32,7 +32,7 @@ static struct nxpwifi_adapter *nxpwifi_register(void *card, struct device *dev, · 31 unmodified lines
3232 int ret = 0;
3333 int i;
3434
35− adapter = kzalloc_obj(*adapter, GFP_KERNEL);
35+ adapter = kzalloc_obj(*adapter);
3636 if (!adapter)
3737 return ERR_PTR(-ENOMEM);
3838
@@ -55,7 +55,7 @@ static struct nxpwifi_adapter *nxpwifi_register(void *card, struct device *dev, · 16 unmodified lines
5555 for (i = 0; i < NXPWIFI_MAX_BSS_NUM; i++) {
5656 /* Allocate memory for private structure */
5757 adapter->priv[i] =
58− kzalloc_obj(struct nxpwifi_private, GFP_KERNEL);
58+ kzalloc_obj(struct nxpwifi_private);
5959 if (!adapter->priv[i]) {
6060 ret = -ENOMEM;
6161 goto error;
@@ -1106,7 +1106,7 @@ void nxpwifi_drv_info_dump(struct nxpwifi_adapter *adapter) · 1044 unmodified lines
11061106 p += adapter->if_ops.reg_dump(adapter, p);
11071107 }
11081108 p += sprintf(p, "\n=== more debug information\n");
1109− debug_info = kzalloc_obj(*debug_info, GFP_KERNEL);
1109+ debug_info = kzalloc_obj(*debug_info);
11101110 if (debug_info) {
11111111 for (i = 0; i < adapter->priv_num; i++) {
11121112 if (!adapter->priv[i]->netdev)
@@ -1242,7 +1242,7 @@ void nxpwifi_init_priv_params(struct nxpwifi_private *priv, · 129 unmodified lines
12421242
12431243 if (GET_BSS_ROLE(priv) == NXPWIFI_BSS_ROLE_STA ||
12441244 GET_BSS_ROLE(priv) == NXPWIFI_BSS_ROLE_UAP) {
1245− priv->hist_data = kmalloc_obj(*priv->hist_data, GFP_KERNEL);
1245+ priv->hist_data = kmalloc_obj(*priv->hist_data);
12461246 if (priv->hist_data)
12471247 nxpwifi_hist_data_reset(priv);
12481248 }
drivers/net/wireless/nxp/nxpwifi/scan.c+6−7
@@ -1341,15 +1341,14 @@ int nxpwifi_scan_networks(struct nxpwifi_private *priv, · 1340 unmodified lines
13411341 adapter->scan_processing = true;
13421342 spin_unlock_bh(&adapter->nxpwifi_cmd_lock);
13431343
1344− scan_cfg_out = kzalloc_obj(union nxpwifi_scan_cmd_config_tlv,
1345− GFP_KERNEL);
1344+ scan_cfg_out = kzalloc_obj(union nxpwifi_scan_cmd_config_tlv);
13461345 if (!scan_cfg_out) {
13471346 ret = -ENOMEM;
13481347 goto done;
13491348 }
13501349
13511350 scan_chan_list = kzalloc_objs(struct nxpwifi_chan_scan_param_set,
1352− NXPWIFI_USER_SCAN_CHAN_MAX, GFP_KERNEL);
1351+ NXPWIFI_USER_SCAN_CHAN_MAX);
13531352 if (!scan_chan_list) {
13541353 kfree(scan_cfg_out);
13551354 ret = -ENOMEM;
@@ -1471,7 +1470,7 @@ static int nxpwifi_save_hidden_ssid_channels(struct nxpwifi_private *priv, · 115 unmodified lines
14711470 int chid;
14721471
14731472 /* Allocate and fill new bss descriptor */
1474− bss_desc = kzalloc_obj(*bss_desc, GFP_KERNEL);
1473+ bss_desc = kzalloc_obj(*bss_desc);
14751474 if (!bss_desc)
14761475 return -ENOMEM;
14771476
@@ -1512,7 +1511,7 @@ static int nxpwifi_update_curr_bss_params(struct nxpwifi_private *priv, · 34 unmodified lines
15121511 int ret;
15131512
15141513 /* Allocate and fill new bss descriptor */
1515− bss_desc = kzalloc_obj(*bss_desc, GFP_KERNEL);
1514+ bss_desc = kzalloc_obj(*bss_desc);
15161515 if (!bss_desc)
15171516 return -ENOMEM;
15181517
@@ -1751,7 +1750,7 @@ nxpwifi_active_scan_req_for_passive_chan(struct nxpwifi_private *priv) · 232 unmodified lines
17511750 nxpwifi_dbg(adapter, INFO, "No BSS with hidden SSID found on DFS channels\n");
17521751 return 0;
17531752 }
1754− user_scan_cfg = kzalloc_obj(*user_scan_cfg, GFP_KERNEL);
1753+ user_scan_cfg = kzalloc_obj(*user_scan_cfg);
17551754
17561755 if (!user_scan_cfg)
17571756 return -ENOMEM;
@@ -2258,7 +2257,7 @@ int nxpwifi_stop_bg_scan(struct nxpwifi_private *priv) · 500 unmodified lines
22582257 return 0;
22592258 }
22602259
2261− bgscan_cfg = kzalloc_obj(*bgscan_cfg, GFP_KERNEL);
2260+ bgscan_cfg = kzalloc_obj(*bgscan_cfg);
22622261 if (!bgscan_cfg)
22632262 return -ENOMEM;
22642263
drivers/net/wireless/nxp/nxpwifi/sta_cfg.c+1−1
@@ -245,7 +245,7 @@ int nxpwifi_bss_start(struct nxpwifi_private *priv, struct cfg80211_bss *bss, · 244 unmodified lines
245245 return -EINVAL;
246246
247247 /* Allocate and fill new bss descriptor */
248− bss_desc = kzalloc_obj(*bss_desc, GFP_KERNEL);
248+ bss_desc = kzalloc_obj(*bss_desc);
249249 if (!bss_desc)
250250 return -ENOMEM;
251251
drivers/net/wireless/nxp/nxpwifi/sta_cmd.c+1−1
@@ -2822,7 +2822,7 @@ nxpwifi_create_custom_regdomain(struct nxpwifi_private *priv, · 2821 unmodified lines
28222822 if (WARN_ON_ONCE(num_chan > NL80211_MAX_SUPP_REG_RULES))
28232823 return ERR_PTR(-EINVAL);
28242824
2825− regd = kzalloc_flex(*regd, reg_rules, num_chan, GFP_KERNEL);
2825+ regd = kzalloc_flex(*regd, reg_rules, num_chan);
28262826 if (!regd)
28272827 return ERR_PTR(-ENOMEM);
28282828
drivers/net/wireless/nxp/nxpwifi/uap_event.c+1−1
@@ -88,7 +88,7 @@ nxpwifi_uap_event_sta_assoc(struct nxpwifi_private *priv) · 87 unmodified lines
8888 struct nxpwifi_sta_node *node;
8989 int len, i;
9090
91− sinfo = kzalloc_obj(*sinfo, GFP_KERNEL);
91+ sinfo = kzalloc_obj(*sinfo);
9292 if (!sinfo)
9393 return -ENOMEM;
9494
drivers/nvdimm/region_devs.c+1−2
@@ -1002,8 +1002,7 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus, · 1001 unmodified lines
10021002 nd_region->num_lanes = ndr_desc->num_lanes;
10031003 if (!nd_region->num_lanes)
10041004 goto err_percpu;
1005− nd_region->lane = kcalloc(nd_region->num_lanes,
1006− sizeof(*nd_region->lane), GFP_KERNEL);
1005+ nd_region->lane = kzalloc_objs(*nd_region->lane, nd_region->num_lanes);
10071006 if (!nd_region->lane)
10081007 goto err_percpu;
10091008
drivers/nvme/host/core.c+1−2
@@ -2382,8 +2382,7 @@ static int nvme_query_fdp_info(struct nvme_ns *ns, struct nvme_ns_info *info) · 2381 unmodified lines
23822382 if (!head->nr_plids)
23832383 goto free;
23842384
2385− head->plids = kcalloc(head->nr_plids, sizeof(*head->plids),
2386− GFP_KERNEL);
2385+ head->plids = kzalloc_objs(*head->plids, head->nr_plids);
23872386 if (!head->plids) {
23882387 dev_warn(ctrl->device,
23892388 "failed to allocate %u FDP placement IDs\n",
drivers/nvme/host/pci.c+1−1
@@ -201,7 +201,7 @@ static int quirks_param_set(const char *value, const struct kernel_param *kp) · 200 unmodified lines
201201 count++;
202202 }
203203
204− qlist = kcalloc(count, sizeof(*qlist), GFP_KERNEL);
204+ qlist = kzalloc_objs(*qlist, count);
205205 if (!qlist) {
206206 err = -ENOMEM;
207207 goto out_free_val;
drivers/opp/core.c+2−2
@@ -348,7 +348,7 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev) · 347 unmodified lines
348348
349349 count = opp_table->regulator_count;
350350
351− uV = kmalloc_array(count, sizeof(*uV), GFP_KERNEL);
351+ uV = kmalloc_objs(*uV, count);
352352 if (!uV)
353353 return 0;
354354
@@ -1505,7 +1505,7 @@ struct opp_device *_add_opp_dev(const struct device *dev, · 1150 unmodified lines
15051505 {
15061506 struct opp_device *opp_dev;
15071507
1508− opp_dev = kzalloc(sizeof(*opp_dev), GFP_KERNEL);
1508+ opp_dev = kzalloc_obj(*opp_dev);
15091509 if (!opp_dev)
15101510 return NULL;
15111511
drivers/pci/endpoint/pci-ep-msi.c+2−2
@@ -57,7 +57,7 @@ static int pci_epf_alloc_doorbell_embedded(struct pci_epf *epf, u16 num_db) · 56 unmodified lines
5757 return -ENODEV;
5858
5959 struct pci_epc_aux_resource *res __free(kfree) =
60− kcalloc(count, sizeof(*res), GFP_KERNEL);
60+ kzalloc_objs(*res, count);
6161 if (!res)
6262 return -ENOMEM;
6363
@@ -98,7 +98,7 @@ static int pci_epf_alloc_doorbell_embedded(struct pci_epf *epf, u16 num_db) · 34 unmodified lines
9898 addr = iova_base + off;
9999 }
100100
101− msg = kcalloc(num_db, sizeof(*msg), GFP_KERNEL);
101+ msg = kzalloc_objs(*msg, num_db);
102102 if (!msg) {
103103 ret = -ENOMEM;
104104 goto err_unmap;
drivers/platform/x86/amd/hsmp/acpi.c+2−3
@@ -720,9 +720,8 @@ static int hsmp_acpi_probe(struct platform_device *pdev) · 719 unmodified lines
720720 return -ENODEV;
721721 }
722722
723− hsmp_pdev->sock = kcalloc(hsmp_pdev->num_sockets,
724− sizeof(*hsmp_pdev->sock),
725− GFP_KERNEL);
723+ hsmp_pdev->sock = kzalloc_objs(*hsmp_pdev->sock,
724+ hsmp_pdev->num_sockets);
726725 if (!hsmp_pdev->sock)
727726 return -ENOMEM;
728727
drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c+2−2
@@ -96,8 +96,8 @@ int hp_alloc_enumeration_data(void) · 95 unmodified lines
9696
9797 if (!bioscfg_drv.enumeration_instances_count)
9898 return -EINVAL;
99− bioscfg_drv.enumeration_data = kvcalloc(bioscfg_drv.enumeration_instances_count,
100− sizeof(*bioscfg_drv.enumeration_data), GFP_KERNEL);
99+ bioscfg_drv.enumeration_data = kvzalloc_objs(*bioscfg_drv.enumeration_data,
100+ bioscfg_drv.enumeration_instances_count);
101101
102102 if (!bioscfg_drv.enumeration_data) {
103103 bioscfg_drv.enumeration_instances_count = 0;
drivers/platform/x86/intel/pmc/pwrm_telemetry.c+1−2
@@ -93,8 +93,7 @@ acpi_disc_t pmc_parse_telem_dsd(union acpi_object *obj, · 92 unmodified lines
9393 if (header->num_entries != num_regions)
9494 return ERR_PTR(-EINVAL);
9595
96− acpi_disc_t disc __free(kfree) = kmalloc_array(num_regions, sizeof(*disc),
97− GFP_KERNEL);
96+ acpi_disc_t disc __free(kfree) = kmalloc_objs(*disc, num_regions);
9897 if (!disc)
9998 return ERR_PTR(-ENOMEM);
10099
drivers/pmdomain/core.c+1−1
@@ -2962,7 +2962,7 @@ int of_genpd_add_child_ids(struct device_node *np, · 2961 unmodified lines
29622962 return -EINVAL;
29632963
29642964 /* Allocate tracking array for error unwind (parent/child pairs) */
2965− pairs = kmalloc_array(count * 2, sizeof(*pairs), GFP_KERNEL);
2965+ pairs = kmalloc_objs(*pairs, count * 2);
29662966 if (!pairs)
29672967 return -ENOMEM;
29682968
drivers/power/reset/reboot-mode.c+3−3
@@ -122,14 +122,14 @@ static int reboot_mode_create_device(struct reboot_mode_driver *reboot) · 121 unmodified lines
122122 struct mode_info *info;
123123 int ret;
124124
125− priv = kzalloc_obj(*priv, GFP_KERNEL);
125+ priv = kzalloc_obj(*priv);
126126 if (!priv)
127127 return -ENOMEM;
128128
129129 INIT_LIST_HEAD(&priv->head);
130130
131131 list_for_each_entry(info, &reboot->head, list) {
132− sysfs_info = kzalloc_obj(*sysfs_info, GFP_KERNEL);
132+ sysfs_info = kzalloc_obj(*sysfs_info);
133133 if (!sysfs_info) {
134134 ret = -ENOMEM;
135135 goto error;
@@ -188,7 +188,7 @@ int reboot_mode_register(struct reboot_mode_driver *reboot) · 52 unmodified lines
188188 continue;
189189 }
190190
191− info = kzalloc_obj(*info, GFP_KERNEL);
191+ info = kzalloc_obj(*info);
192192 if (!info) {
193193 ret = -ENOMEM;
194194 goto error;
drivers/power/sequencing/core.c+1−1
@@ -480,7 +480,7 @@ pwrseq_device_register(const struct pwrseq_config *config) · 479 unmodified lines
480480 !config->targets[0])
481481 return ERR_PTR(-EINVAL);
482482
483− pwrseq = kzalloc(sizeof(*pwrseq), GFP_KERNEL);
483+ pwrseq = kzalloc_obj(*pwrseq);
484484 if (!pwrseq)
485485 return ERR_PTR(-ENOMEM);
486486
drivers/power/sequencing/pwrseq-pcie-m2.c+1−1
@@ -291,7 +291,7 @@ static int pwrseq_pcie_m2_create_serdev_one(struct pwrseq_pcie_m2_ctx *ctx, · 290 unmodified lines
291291 }
292292 }
293293
294− pci_dev = kzalloc(sizeof(*pci_dev), GFP_KERNEL);
294+ pci_dev = kzalloc_obj(*pci_dev);
295295 if (!pci_dev) {
296296 ret = -ENOMEM;
297297 goto err_put_ctrl;
drivers/power/supply/power_supply_core.c+3−3
@@ -904,7 +904,7 @@ int power_supply_get_battery_info(struct power_supply *psy, · 903 unmodified lines
904904 goto out_put_node;
905905 }
906906
907− u32 *propdata __free(kfree) = kcalloc(proplen, sizeof(*propdata), GFP_KERNEL);
907+ u32 *propdata __free(kfree) = kzalloc_objs(*propdata, proplen);
908908 if (!propdata) {
909909 power_supply_put_battery_info(psy, info);
910910 err = -EINVAL;
@@ -944,7 +944,7 @@ int power_supply_get_battery_info(struct power_supply *psy, · 33 unmodified lines
944944 goto out_put_node;
945945 }
946946
947− propdata = kcalloc(proplen, sizeof(*propdata), GFP_KERNEL);
947+ propdata = kzalloc_objs(*propdata, proplen);
948948 if (!propdata) {
949949 power_supply_put_battery_info(psy, info);
950950 err = -ENOMEM;
@@ -1726,7 +1726,7 @@ __power_supply_register(struct device *parent, · 775 unmodified lines
17261726 pr_warn("%s: Expected proper parent device for '%s'\n",
17271727 __func__, desc->name);
17281728
1729− psy = kzalloc(sizeof(*psy), GFP_KERNEL);
1729+ psy = kzalloc_obj(*psy);
17301730 if (!psy)
17311731 return ERR_PTR(-ENOMEM);
17321732
drivers/ptp/ptp_chardev.c+1−1
@@ -136,7 +136,7 @@ int ptp_open(struct posix_clock_context *pccontext, fmode_t fmode) · 135 unmodified lines
136136 struct timestamp_event_queue *queue;
137137 char debugfsname[32];
138138
139− queue = kzalloc(sizeof(*queue), GFP_KERNEL);
139+ queue = kzalloc_obj(*queue);
140140 if (!queue)
141141 return -EINVAL;
142142 queue->mask = bitmap_alloc(PTP_MAX_CHANNELS, GFP_KERNEL);
drivers/s390/block/dasd.c+1−1
@@ -87,7 +87,7 @@ struct dasd_device *dasd_alloc_device(void) · 86 unmodified lines
8787 {
8888 struct dasd_device *device;
8989
90− device = kzalloc_obj(struct dasd_device, GFP_KERNEL);
90+ device = kzalloc_obj(struct dasd_device);
9191 if (!device)
9292 return ERR_PTR(-ENOMEM);
9393
drivers/scsi/fnic/fnic_debugfs.c+1−1
@@ -767,7 +767,7 @@ static int fnic_nvmef_debugfs_open(struct inode *inode, struct file *file) · 766 unmodified lines
767767 struct fnic_nvmef_info *info;
768768 int buf_size = 2 * PAGE_SIZE;
769769
770− info = kzalloc_obj(struct fnic_nvmef_info, GFP_KERNEL);
770+ info = kzalloc_obj(struct fnic_nvmef_info);
771771 if (!info)
772772 return -ENOMEM;
773773
drivers/scsi/leapraid/leapraid_func.c+21−31
@@ -2984,8 +2984,7 @@ static void leapraid_fw_evt_put(struct leapraid_fw_evt_work *fw_work) · 2983 unmodified lines
29842984
29852985 static struct leapraid_fw_evt_work *leapraid_alloc_fw_evt_work(void)
29862986 {
2987− struct leapraid_fw_evt_work *fw_evt =
2988− kzalloc(sizeof(*fw_evt), GFP_ATOMIC);
2987+ struct leapraid_fw_evt_work *fw_evt = kzalloc_obj(*fw_evt, GFP_ATOMIC);
29892988
29902989 if (fw_evt)
29912990 kref_init(&fw_evt->refcnt);
@@ -3644,8 +3643,7 @@ static void leapraid_sas_host_add(struct leapraid_adapter *adapter, · 652 unmodified lines
36443643 return;
36453644
36463645 adapter->dev_topo.card.card_phy =
3647− kcalloc(phys_num,
3648− sizeof(struct leapraid_card_phy), GFP_KERNEL);
3646+ kzalloc_objs(struct leapraid_card_phy, phys_num);
36493647 if (!adapter->dev_topo.card.card_phy)
36503648 return;
36513649
@@ -3763,8 +3761,7 @@ static int leapraid_internal_exp_add(struct leapraid_adapter *adapter, · 111 unmodified lines
37633761 }
37643762
37653763 topo_node_exp->card_phy =
3766− kcalloc(topo_node_exp->phys_num,
3767− sizeof(struct leapraid_card_phy), GFP_KERNEL);
3764+ kzalloc_objs(struct leapraid_card_phy, topo_node_exp->phys_num);
37683765 if (!topo_node_exp->card_phy) {
37693766 dev_err(&adapter->pdev->dev,
37703767 "%s: Failed to alloc expander phy array, count=%u\n",
@@ -4352,7 +4349,7 @@ static void leapraid_sas_volume_add( · 581 unmodified lines
43524349 return;
43534350 }
43544351
4355− raid_volume = kzalloc(sizeof(*raid_volume), GFP_KERNEL);
4352+ raid_volume = kzalloc_obj(*raid_volume);
43564353 if (!raid_volume)
43574354 return;
43584355
@@ -6090,17 +6087,15 @@ static void leapraid_update_card_port_after_reset( · 1731 unmodified lines
60906087
60916088 if (!adapter->dev_topo.card.card_phy) {
60926089 adapter->dev_topo.card.card_phy =
6093− kcalloc(nr_phys, sizeof(struct leapraid_card_phy),
6094− GFP_KERNEL);
6090+ kzalloc_objs(struct leapraid_card_phy, nr_phys);
60956091 if (!adapter->dev_topo.card.card_phy)
60966092 return;
60976093 }
60986094
60996095 adapter->dev_topo.card.phys_num = nr_phys;
61006096
6101− new_card_port_table = kcalloc(adapter->dev_topo.card.phys_num,
6102− sizeof(struct leapraid_card_port),
6103− GFP_KERNEL);
6097+ new_card_port_table = kzalloc_objs(struct leapraid_card_port,
6098+ adapter->dev_topo.card.phys_num);
61046099 if (!new_card_port_table)
61056100 return;
61066101
@@ -7224,8 +7219,8 @@ static int leapraid_set_legacy_int(struct leapraid_adapter *adapter) · 1117 unmodified lines
72247219 adapter->notification_desc.iopoll_qdex,
72257220 adapter->notification_desc.iopoll_qcnt);
72267221 adapter->notification_desc.int_rqs =
7227− kcalloc(adapter->notification_desc.iopoll_qdex,
7228− sizeof(struct leapraid_int_rq), GFP_KERNEL);
7222+ kzalloc_objs(struct leapraid_int_rq,
7223+ adapter->notification_desc.iopoll_qdex);
72297224 if (!adapter->notification_desc.int_rqs)
72307225 return -ENOMEM;
72317226
@@ -7268,9 +7263,8 @@ static int leapraid_set_msix(struct leapraid_adapter *adapter) · 36 unmodified lines
72687263 }
72697264 if (iopoll_qcnt) {
72707265 adapter->notification_desc.blk_mq_poll_rqs =
7271− kcalloc(iopoll_qcnt,
7272− sizeof(struct leapraid_blk_mq_poll_rq),
7273− GFP_KERNEL);
7266+ kzalloc_objs(struct leapraid_blk_mq_poll_rq,
7267+ iopoll_qcnt);
72747268 if (!adapter->notification_desc.blk_mq_poll_rqs)
72757269 return -ENOMEM;
72767270 adapter->adapter_attr.rq_cnt =
@@ -7289,8 +7283,8 @@ static int leapraid_set_msix(struct leapraid_adapter *adapter) · 12 unmodified lines
72897283 adapter->notification_desc.iopoll_qcnt);
72907284
72917285 adapter->notification_desc.int_rqs =
7292− kcalloc(adapter->notification_desc.iopoll_qdex,
7293− sizeof(struct leapraid_int_rq), GFP_KERNEL);
7286+ kzalloc_objs(struct leapraid_int_rq,
7287+ adapter->notification_desc.iopoll_qdex);
72947288 if (!adapter->notification_desc.int_rqs)
72957289 return -ENOMEM;
72967290
@@ -7365,9 +7359,8 @@ static int leapraid_set_msi(struct leapraid_adapter *adapter) · 68 unmodified lines
73657359
73667360 if (iopoll_qcnt) {
73677361 adapter->notification_desc.blk_mq_poll_rqs =
7368− kcalloc(iopoll_qcnt,
7369− sizeof(struct leapraid_blk_mq_poll_rq),
7370− GFP_KERNEL);
7362+ kzalloc_objs(struct leapraid_blk_mq_poll_rq,
7363+ iopoll_qcnt);
73717364 if (!adapter->notification_desc.blk_mq_poll_rqs)
73727365 return -ENOMEM;
73737366
@@ -7404,9 +7397,8 @@ static int leapraid_set_msi(struct leapraid_adapter *adapter) · 30 unmodified lines
74047397 adapter->notification_desc.iopoll_qcnt);
74057398
74067399 adapter->notification_desc.int_rqs =
7407− kcalloc(adapter->notification_desc.iopoll_qdex,
7408− sizeof(struct leapraid_int_rq),
7409− GFP_KERNEL);
7400+ kzalloc_objs(struct leapraid_int_rq,
7401+ adapter->notification_desc.iopoll_qdex);
74107402 if (!adapter->notification_desc.int_rqs)
74117403 return -ENOMEM;
74127404
@@ -7958,18 +7950,16 @@ try_again: · 545 unmodified lines
79587950 DIV_ROUND_UP(adapter->adapter_attr.rq_cnt,
79597951 LEAPRAID_REP_DESC_CHUNK_SIZE);
79607952 adapter->mem_desc.rep_desc_seg_maint =
7961− kcalloc(adapter->adapter_attr.rep_desc_q_seg_cnt,
7962− sizeof(struct leapraid_rep_desc_seg_maint),
7963− GFP_KERNEL);
7953+ kzalloc_objs(struct leapraid_rep_desc_seg_maint,
7954+ adapter->adapter_attr.rep_desc_q_seg_cnt);
79647955 if (!adapter->mem_desc.rep_desc_seg_maint)
79657956 return -ENOMEM;
79667957
79677958 rep_desc_q_cnt_allocated = 0;
79687959 for (i = 0; i < adapter->adapter_attr.rep_desc_q_seg_cnt; i++) {
79697960 adapter->mem_desc.rep_desc_seg_maint[i].rep_desc_maint =
7970− kcalloc(LEAPRAID_REP_DESC_CHUNK_SIZE,
7971− sizeof(struct leapraid_rep_desc_maint),
7972− GFP_KERNEL);
7961+ kzalloc_objs(struct leapraid_rep_desc_maint,
7962+ LEAPRAID_REP_DESC_CHUNK_SIZE);
79737963 if (!adapter->mem_desc.rep_desc_seg_maint[i].rep_desc_maint)
79747964 return -ENOMEM;
79757965
drivers/scsi/scsi_scan.c+1−1
@@ -158,7 +158,7 @@ int scsi_complete_async_scans(void) · 157 unmodified lines
158158 * sleep a little. Even if we never get memory, the async
159159 * scans will finish eventually.
160160 */
161− data = kmalloc(sizeof(*data), GFP_KERNEL);
161+ data = kmalloc_obj(*data);
162162 if (!data)
163163 msleep(1);
164164 } while (!data);
drivers/soc/bcm/brcmstb/common.c+1−1
@@ -65,7 +65,7 @@ static int __init brcmstb_soc_device_init(void) · 64 unmodified lines
6565 goto out_put_node;
6666 }
6767
68− soc_info = kzalloc(sizeof(*soc_info), GFP_KERNEL);
68+ soc_info = kzalloc_obj(*soc_info);
6969 if (!soc_info) {
7070 ret = -ENOMEM;
7171 goto out_unmap;
drivers/spi/spi-offload.c+1−1
@@ -434,7 +434,7 @@ int devm_spi_offload_trigger_register(struct device *dev, · 433 unmodified lines
434434 if (!info->fwnode || !info->ops || !info->ops->match)
435435 return -EINVAL;
436436
437− trigger = kzalloc(sizeof(*trigger), GFP_KERNEL);
437+ trigger = kzalloc_obj(*trigger);
438438 if (!trigger)
439439 return -ENOMEM;
440440
drivers/staging/greybus/raw.c+1−1
@@ -178,7 +178,7 @@ static int gb_raw_probe(struct gb_bundle *bundle, · 177 unmodified lines
178178 if (minor < 0)
179179 return minor;
180180
181− raw = kzalloc_obj(*raw, GFP_KERNEL);
181+ raw = kzalloc_obj(*raw);
182182 if (!raw) {
183183 ida_free(&minors, minor);
184184 return -ENOMEM;
drivers/staging/media/atomisp/pci/sh_css.c+10−20
@@ -5820,36 +5820,31 @@ static int ia_css_pipe_create_cas_scaler_desc_single_output( · 5819 unmodified lines
58205820 }
58215821
58225822 descr->in_info = kmalloc_objs(*descr->in_info,
5823− descr->num_stage,
5824− GFP_KERNEL);
5823+ descr->num_stage);
58255824 if (!descr->in_info) {
58265825 err = -ENOMEM;
58275826 goto ERR;
58285827 }
58295828 descr->internal_out_info = kmalloc_objs(*descr->internal_out_info,
5830− descr->num_stage,
5831− GFP_KERNEL);
5829+ descr->num_stage);
58325830 if (!descr->internal_out_info) {
58335831 err = -ENOMEM;
58345832 goto ERR;
58355833 }
58365834 descr->out_info = kmalloc_objs(*descr->out_info,
5837− descr->num_stage,
5838− GFP_KERNEL);
5835+ descr->num_stage);
58395836 if (!descr->out_info) {
58405837 err = -ENOMEM;
58415838 goto ERR;
58425839 }
58435840 descr->vf_info = kmalloc_objs(*descr->vf_info,
5844− descr->num_stage,
5845− GFP_KERNEL);
5841+ descr->num_stage);
58465842 if (!descr->vf_info) {
58475843 err = -ENOMEM;
58485844 goto ERR;
58495845 }
58505846 descr->is_output_stage = kmalloc_objs(*descr->is_output_stage,
5851− descr->num_stage,
5852− GFP_KERNEL);
5847+ descr->num_stage);
58535848 if (!descr->is_output_stage) {
58545849 err = -ENOMEM;
58555850 goto ERR;
@@ -5970,36 +5965,31 @@ ia_css_pipe_create_cas_scaler_desc(struct ia_css_pipe *pipe, · 114 unmodified lines
59705965 descr->num_stage = num_stages;
59715966
59725967 descr->in_info = kmalloc_objs(*descr->in_info,
5973− descr->num_stage,
5974− GFP_KERNEL);
5968+ descr->num_stage);
59755969 if (!descr->in_info) {
59765970 err = -ENOMEM;
59775971 goto ERR;
59785972 }
59795973 descr->internal_out_info = kmalloc_objs(*descr->internal_out_info,
5980− descr->num_stage,
5981− GFP_KERNEL);
5974+ descr->num_stage);
59825975 if (!descr->internal_out_info) {
59835976 err = -ENOMEM;
59845977 goto ERR;
59855978 }
59865979 descr->out_info = kmalloc_objs(*descr->out_info,
5987− descr->num_stage,
5988− GFP_KERNEL);
5980+ descr->num_stage);
59895981 if (!descr->out_info) {
59905982 err = -ENOMEM;
59915983 goto ERR;
59925984 }
59935985 descr->vf_info = kmalloc_objs(*descr->vf_info,
5994− descr->num_stage,
5995− GFP_KERNEL);
5986+ descr->num_stage);
59965987 if (!descr->vf_info) {
59975988 err = -ENOMEM;
59985989 goto ERR;
59995990 }
60005991 descr->is_output_stage = kmalloc_objs(*descr->is_output_stage,
6001− descr->num_stage,
6002− GFP_KERNEL);
5992+ descr->num_stage);
60035993 if (!descr->is_output_stage) {
60045994 err = -ENOMEM;
60055995 goto ERR;
drivers/staging/media/atomisp/pci/sh_css_firmware.c+2−2
@@ -254,8 +254,8 @@ sh_css_load_firmware(struct device *dev, const char *fw_data, · 253 unmodified lines
254254 /* Only allocate memory for ISP blob info */
255255 if (sh_css_num_binaries > NUM_OF_SPS) {
256256 sh_css_blob_info =
257− kmalloc_array(sh_css_num_binaries - NUM_OF_SPS,
258− sizeof(*sh_css_blob_info), GFP_KERNEL);
257+ kmalloc_objs(*sh_css_blob_info,
258+ sh_css_num_binaries - NUM_OF_SPS);
259259 if (!sh_css_blob_info)
260260 return -ENOMEM;
261261 } else {
drivers/tee/qcomtee/user_obj.c+1−2
@@ -230,8 +230,7 @@ static int qcomtee_user_object_dispatch(struct qcomtee_object_invoke_ctx *oic, · 229 unmodified lines
230230 struct qcomtee_context_data *ctxdata = uo->ctx->data;
231231 int errno;
232232
233− struct qcomtee_ureq *ureq __free(kfree) = kzalloc(sizeof(*ureq),
234− GFP_KERNEL);
233+ struct qcomtee_ureq *ureq __free(kfree) = kzalloc_obj(*ureq);
235234 if (!ureq)
236235 return -ENOMEM;
237236
drivers/thunderbolt/stream.c+5−7
@@ -408,8 +408,7 @@ static int tbstream_dev_alloc_rx_buffers(struct tbstream_dev *sdev) · 407 unmodified lines
408408 size_t ring_size = tb_ring_size(sdev->rx_ring.ring);
409409 int i;
410410
411− sdev->rx_ring.frames = kcalloc(ring_size, sizeof(struct tbstream_frame),
412− GFP_KERNEL);
411+ sdev->rx_ring.frames = kzalloc_objs(struct tbstream_frame, ring_size);
413412 if (!sdev->rx_ring.frames)
414413 return -ENOMEM;
415414
@@ -463,8 +462,7 @@ static int tbstream_dev_alloc_tx_buffers(struct tbstream_dev *sdev) · 47 unmodified lines
463462 size_t ring_size = tb_ring_size(sdev->tx_ring.ring);
464463 int i;
465464
466− sdev->tx_ring.frames = kcalloc(ring_size, sizeof(struct tbstream_frame),
467− GFP_KERNEL);
465+ sdev->tx_ring.frames = kzalloc_objs(struct tbstream_frame, ring_size);
468466 if (!sdev->tx_ring.frames)
469467 return -ENOMEM;
470468
@@ -1498,7 +1496,7 @@ tbstream_dev_make_group(struct config_group *group, const char *name) · 1027 unmodified lines
14981496 if (strlen(name) > TB_PROPERTY_KEY_SIZE)
14991497 return ERR_PTR(-ENAMETOOLONG);
15001498
1501− sdev = kzalloc_obj(*sdev, GFP_KERNEL);
1499+ sdev = kzalloc_obj(*sdev);
15021500 if (!sdev)
15031501 return ERR_PTR(-ENOMEM);
15041502
@@ -1592,7 +1590,7 @@ tbstream_make_group(struct config_group *group, const char *name) · 87 unmodified lines
15921590 if (sscanf(name, "%u-%llx.%u", &domain, &route, &index) != 3)
15931591 return ERR_PTR(-EINVAL);
15941592
1595− sg = kzalloc_obj(*sg, GFP_KERNEL);
1593+ sg = kzalloc_obj(*sg);
15961594 if (!sg)
15971595 return ERR_PTR(-ENOMEM);
15981596
@@ -1698,7 +1696,7 @@ static int tbstream_probe(struct tb_service *svc) · 99 unmodified lines
16981696 {
16991697 struct tbstream *stream;
17001698
1701− stream = kzalloc_obj(*stream, GFP_KERNEL);
1699+ stream = kzalloc_obj(*stream);
17021700 if (!stream)
17031701 return -ENOMEM;
17041702
drivers/tty/moxa.c+1−2
@@ -954,8 +954,7 @@ static int moxa_init_board(struct moxa_board_conf *brd, struct device *dev) · 953 unmodified lines
954954 unsigned int i, first_idx;
955955 int ret;
956956
957− brd->ports = kcalloc(MAX_PORTS_PER_BOARD, sizeof(*brd->ports),
958− GFP_KERNEL);
957+ brd->ports = kzalloc_objs(*brd->ports, MAX_PORTS_PER_BOARD);
959958 if (brd->ports == NULL) {
960959 printk(KERN_ERR "cannot allocate memory for ports\n");
961960 ret = -ENOMEM;
drivers/tty/vt/consolemap.c+2−1
@@ -776,7 +776,8 @@ int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, · 775 unmodified lines
776776 struct uni_pagedict *dict;
777777 unsigned int d, r, g;
778778
779− struct unipair *unilist __free(kvfree) = kvmalloc_array(ct, sizeof(*unilist), GFP_KERNEL);
779+ struct unipair *unilist __free(kvfree) = kvmalloc_objs(*unilist, ct,
780+ GFP_KERNEL);
780781 if (!unilist)
781782 return -ENOMEM;
782783
drivers/ufs/core/ufs-txeq.c+1−1
@@ -1073,7 +1073,7 @@ static int __ufshcd_tx_eqtr(struct ufs_hba *hba, · 1072 unmodified lines
10731073 struct ufs_pa_layer_attr *pwr_mode)
10741074 {
10751075 struct ufshcd_tx_eqtr_data *eqtr_data __free(kfree) =
1076− kzalloc(sizeof(*eqtr_data), GFP_KERNEL);
1076+ kzalloc_obj(*eqtr_data);
10771077 struct tx_eqtr_iter h_iter = {};
10781078 struct tx_eqtr_iter d_iter = {};
10791079 u32 gear = pwr_mode->gear_tx;
drivers/ufs/host/ufs-qcom.c+1−1
@@ -2761,7 +2761,7 @@ static int ufs_qcom_get_rx_fom(struct ufs_hba *hba, · 2760 unmodified lines
27612761 struct tx_eqtr_iter *d_iter)
27622762 {
27632763 struct ufshcd_tx_eq_params *params __free(kfree) =
2764− kzalloc(sizeof(*params), GFP_KERNEL);
2764+ kzalloc_obj(*params);
27652765 struct ufs_qcom_host *host = ufshcd_get_variant(hba);
27662766 struct ufs_pa_layer_attr old_pwr_info;
27672767 u32 fom[PA_MAXDATALANES] = { 0 };
drivers/usb/gadget/function/f_ncm.c+1−1
@@ -1766,7 +1766,7 @@ static struct usb_function *ncm_alloc(struct usb_function_instance *fi) · 1765 unmodified lines
17661766 int status;
17671767
17681768 /* allocate and initialize one new instance */
1769− ncm = kzalloc(sizeof(*ncm), GFP_KERNEL);
1769+ ncm = kzalloc_obj(*ncm);
17701770 if (!ncm)
17711771 return ERR_PTR(-ENOMEM);
17721772
drivers/usb/usbip/usbip_common.c+1−1
@@ -696,7 +696,7 @@ int usbip_recv_iso(struct usbip_device *ud, struct urb *urb) · 695 unmodified lines
696696
697697 size = np * sizeof(*iso);
698698
699− buff = kcalloc(np, sizeof(*iso), GFP_KERNEL);
699+ buff = kzalloc_objs(*iso, np);
700700 if (!buff)
701701 return -ENOMEM;
702702
drivers/xen/grant-table.c+1−1
@@ -1478,7 +1478,7 @@ static int gnttab_map(unsigned int start_idx, unsigned int end_idx) · 1477 unmodified lines
14781478 /* No need for kzalloc as it is initialized in following hypercall
14791479 * GNTTABOP_setup_table.
14801480 */
1481− frames = kmalloc_array(nr_gframes, sizeof(*frames), GFP_ATOMIC);
1481+ frames = kmalloc_objs(*frames, nr_gframes, GFP_ATOMIC);
14821482 if (!frames)
14831483 return -ENOMEM;
14841484
fs/9p/vfs_dentry.c+1−2
@@ -113,8 +113,7 @@ void v9fs_dentry_fid_remove(struct dentry *dentry) · 112 unmodified lines
113113 */
114114 static int v9fs_dentry_init(struct dentry *dentry)
115115 {
116− struct v9fs_dentry *v9fs_dentry = kzalloc(sizeof(*v9fs_dentry),
117− GFP_KERNEL);
116+ struct v9fs_dentry *v9fs_dentry = kzalloc_obj(*v9fs_dentry);
118117
119118 if (!v9fs_dentry)
120119 return -ENOMEM;
fs/afs/dir.c+1−1
@@ -1801,7 +1801,7 @@ static int afs_symlink(struct mnt_idmap *idmap, struct inode *dir, · 1800 unmodified lines
18011801 goto error;
18021802
18031803 ret = -ENOMEM;
1804− symlink = kmalloc_flex(struct afs_symlink, content, clen + 1, GFP_KERNEL);
1804+ symlink = kmalloc_flex(struct afs_symlink, content, clen + 1);
18051805 if (!symlink)
18061806 goto error;
18071807 refcount_set(&symlink->ref, 1);
fs/afs/symlink.c+1−2
@@ -119,8 +119,7 @@ static ssize_t afs_do_read_symlink(struct afs_vnode *vnode) · 118 unmodified lines
119119 vnode->directory_size = i_size;
120120
121121 /* Copy the symlink. */
122− symlink = kmalloc_flex(struct afs_symlink, content, i_size + 1,
123− GFP_KERNEL);
122+ symlink = kmalloc_flex(struct afs_symlink, content, i_size + 1);
124123 if (!symlink)
125124 return -ENOMEM;
126125
fs/binfmt_misc.c+3−4
@@ -331,8 +331,8 @@ static int entry_attach_interpreter(struct binfmt_misc_entry *e, · 330 unmodified lines
331331 return -ENOSPC;
332332
333333 /* One allocation, both strings in it, like the entry's own buffer. */
334− interp = kmalloc(struct_size(interp, name, nlen + plen + 2),
335− GFP_KERNEL_ACCOUNT);
334+ interp = kmalloc_flex(*interp, name, nlen + plen + 2,
335+ GFP_KERNEL_ACCOUNT);
336336 if (!interp) {
337337 dec_ucount(ucounts, UCOUNT_BINFMT_MISC_INTERPRETERS);
338338 return -ENOMEM;
@@ -858,8 +858,7 @@ static struct binfmt_misc_entry *create_entry(const char __user *buffer, · 519 unmodified lines
858858 if ((count < 11) || (count > MAX_REGISTER_LENGTH))
859859 return ERR_PTR(-EINVAL);
860860
861− e = kmalloc(struct_size(e, buf, count + MISC_DELIM_PAD),
862− GFP_KERNEL_ACCOUNT);
861+ e = kmalloc_flex(*e, buf, count + MISC_DELIM_PAD, GFP_KERNEL_ACCOUNT);
863862 if (!e)
864863 return ERR_PTR(-ENOMEM);
865864
fs/ceph/addr.c+1−1
@@ -2546,7 +2546,7 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci, · 2545 unmodified lines
25462546 }
25472547
25482548 pool_ns_len = pool_ns ? pool_ns->len : 0;
2549− perm = kmalloc_flex(*perm, pool_ns, pool_ns_len + 1, GFP_KERNEL);
2549+ perm = kmalloc_flex(*perm, pool_ns, pool_ns_len + 1);
25502550 if (!perm) {
25512551 err = -ENOMEM;
25522552 goto out_unlock;
fs/ceph/mds_client.c+1−1
@@ -5492,7 +5492,7 @@ static void ceph_mdsc_reset_workfn(struct work_struct *work) · 5491 unmodified lines
54925492 goto out_complete;
54935493 }
54945494
5495− sessions = kcalloc(max_sessions, sizeof(*sessions), GFP_KERNEL);
5495+ sessions = kzalloc_objs(*sessions, max_sessions);
54965496 if (!sessions) {
54975497 mutex_unlock(&mdsc->mutex);
54985498 ret = -ENOMEM;
fs/ceph/subvolume_metrics.c+1−1
@@ -245,7 +245,7 @@ int ceph_subvolume_metrics_snapshot(struct ceph_subvolume_metrics_tracker *track · 244 unmodified lines
245245 return 0;
246246 }
247247
248− snap = kcalloc(count, sizeof(*snap), GFP_NOFS);
248+ snap = kzalloc_objs(*snap, count, GFP_NOFS);
249249 if (!snap) {
250250 atomic64_inc(&tracker->snapshot_failures);
251251 return -ENOMEM;
fs/coredump.c+1−1
@@ -1000,7 +1000,7 @@ static bool coredump_pipe(struct core_name *cn, struct coredump_params *cprm, · 999 unmodified lines
10001000 return false;
10011001 }
10021002
1003− helper_argv = kmalloc_array(argc + 1, sizeof(*helper_argv), GFP_KERNEL);
1003+ helper_argv = kmalloc_objs(*helper_argv, argc + 1);
10041004 if (!helper_argv) {
10051005 coredump_report_failure("%s failed to allocate memory", __func__);
10061006 return false;
fs/ext4/fast_commit.c+2−2
@@ -1116,7 +1116,7 @@ static int ext4_fc_snapshot_inode(struct inode *inode, · 1115 unmodified lines
11161116 else if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE)
11171117 inode_len += ei->i_extra_isize;
11181118
1119− snap = kmalloc(struct_size(snap, inode_buf, inode_len), GFP_NOFS);
1119+ snap = kmalloc_flex(*snap, inode_buf, inode_len, GFP_NOFS);
11201120 if (!snap) {
11211121 atomic64_inc(&stats->snap_fail_nomem);
11221122 ext4_fc_set_snap_err(snap_err, EXT4_FC_SNAP_ERR_NOMEM);
@@ -1522,7 +1522,7 @@ static int ext4_fc_alloc_snapshot_inodes(struct super_block *sb, · 399 unmodified lines
15221522 if (nr_inodes > EXT4_FC_SNAPSHOT_MAX_INODES)
15231523 return -E2BIG;
15241524
1525− inodes = kvcalloc(nr_inodes, sizeof(*inodes), GFP_NOFS);
1525+ inodes = kvzalloc_objs(*inodes, nr_inodes, GFP_NOFS);
15261526 if (!inodes)
15271527 return -ENOMEM;
15281528
fs/fuse/file.c+1−2
@@ -1597,8 +1597,7 @@ static int fuse_get_user_pages(struct fuse_args_pages *ap, struct iov_iter *ii, · 1596 unmodified lines
15971597 * manually extract pages using iov_iter_extract_pages() and then
15981598 * copy that to a folios array.
15991599 */
1600− struct page **pages = kcalloc(max_pages, sizeof(struct page *),
1601− GFP_KERNEL);
1600+ struct page **pages = kzalloc_objs(struct page *, max_pages);
16021601 if (!pages) {
16031602 ret = -ENOMEM;
16041603 goto out;
fs/fuse/readdir.c+1−1
@@ -336,7 +336,7 @@ static int parse_dirplusfile(char *buf, size_t nbytes, struct file *file, · 335 unmodified lines
336336 static struct page **fuse_readdir_alloc_buf(struct fuse_args_pages *ap, size_t *bufsize)
337337 {
338338 unsigned int i, nr_alloc, nr_pages = DIV_ROUND_UP(*bufsize, PAGE_SIZE);
339− struct page **pages = kcalloc(nr_pages, sizeof(*pages), GFP_KERNEL);
339+ struct page **pages = kzalloc_objs(*pages, nr_pages);
340340
341341 if (!pages)
342342 return NULL;
fs/hfs/bnode.c+1−1
@@ -312,7 +312,7 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) · 311 unmodified lines
312312 return NULL;
313313 }
314314
315− node = kzalloc_flex(*node, page, tree->pages_per_bnode, GFP_KERNEL);
315+ node = kzalloc_flex(*node, page, tree->pages_per_bnode);
316316 if (!node)
317317 return NULL;
318318 node->tree = tree;
fs/namespace.c+1−1
@@ -5999,7 +5999,7 @@ SYSCALL_DEFINE4(statmount, const struct mnt_id_req __user *, req, · 5998 unmodified lines
59995999 return -EPERM;
60006000 }
60016001
6002− ks = kmalloc(sizeof(*ks), GFP_KERNEL_ACCOUNT);
6002+ ks = kmalloc_obj(*ks, GFP_KERNEL_ACCOUNT);
60036003 if (!ks)
60046004 return -ENOMEM;
60056005
fs/nfsd/export.c+3−4
@@ -358,7 +358,7 @@ int nfsd_nl_expkey_get_reqs_dumpit(struct sk_buff *skb, · 357 unmodified lines
358358 goto out_unlock;
359359 }
360360
361− items = kcalloc(cnt, sizeof(*items), GFP_KERNEL);
361+ items = kzalloc_objs(*items, cnt);
362362 seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);
363363 if (!items || !seqnos) {
364364 ret = -ENOMEM;
@@ -685,7 +685,7 @@ int nfsd_nl_svc_export_get_reqs_dumpit(struct sk_buff *skb, · 320 unmodified lines
685685 goto out_unlock;
686686 }
687687
688− items = kcalloc(cnt, sizeof(*items), GFP_KERNEL);
688+ items = kzalloc_objs(*items, cnt);
689689 seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);
690690 pathbuf = kmalloc(PATH_MAX, GFP_KERNEL);
691691 if (!items || !seqnos || !pathbuf) {
@@ -786,8 +786,7 @@ static int nfsd_nl_parse_fslocations(struct nlattr *attr, · 94 unmodified lines
786786 if (!count)
787787 return 0;
788788
789− fsloc->locations = kcalloc(count, sizeof(struct nfsd4_fs_location),
790− GFP_KERNEL);
789+ fsloc->locations = kzalloc_objs(struct nfsd4_fs_location, count);
791790 if (!fsloc->locations)
792791 return -ENOMEM;
793792
fs/nfsd/nfs4callback.c+2−2
@@ -1981,12 +1981,12 @@ int nfsd_net_cb_init(struct nfsd_net *nn) · 1980 unmodified lines
19811981 {
19821982 struct nfsd_net_cb *cb;
19831983
1984− cb = kzalloc(sizeof(*cb), GFP_KERNEL);
1984+ cb = kzalloc_obj(*cb);
19851985 if (!cb)
19861986 return -ENOMEM;
19871987
19881988 cb->version4.counts = kzalloc_objs(unsigned int,
1989− ARRAY_SIZE(nfs4_cb_procedures), GFP_KERNEL);
1989+ ARRAY_SIZE(nfs4_cb_procedures));
19901990 if (!cb->version4.counts) {
19911991 kfree(cb);
19921992 return -ENOMEM;
fs/nfsd/nfs4state.c+4−3
@@ -1341,7 +1341,7 @@ alloc_init_dir_deleg(struct nfs4_client *clp, struct nfs4_file *fp) · 1340 unmodified lines
13411341 return NULL;
13421342 }
13431343
1344− ncn->ncn_nf = kcalloc(NOTIFY4_EVENT_QUEUE_SIZE, sizeof(*ncn->ncn_nf), GFP_KERNEL);
1344+ ncn->ncn_nf = kzalloc_objs(*ncn->ncn_nf, NOTIFY4_EVENT_QUEUE_SIZE);
13451345 if (!ncn->ncn_nf) {
13461346 nfs4_put_stid(&dp->dl_stid);
13471347 return NULL;
@@ -10419,8 +10419,9 @@ alloc_nfsd_notify_event(u32 mask, const struct qstr *q, struct dentry *dentry, · 9071 unmodified lines
1041910419 newnamelen = newname.name.len;
1042010420 }
1042110421
10422− ne = kmalloc(struct_size(ne, ne_name, q->len + 1 +
10423− (newnamelen ? newnamelen + 1 : 0)), GFP_NOFS);
10422+ ne = kmalloc_flex(*ne, ne_name,
10423+ q->len + 1 + (newnamelen ? newnamelen + 1 : 0),
10424+ GFP_NOFS);
1042410425 if (!ne)
1042510426 goto out;
1042610427
fs/nfsd/nfsctl.c+1−1
@@ -1647,7 +1647,7 @@ static int nfsd_nl_fh_key_set(const struct nlattr *attr, struct nfsd_net *nn) · 1646 unmodified lines
16471647 k1 = get_unaligned_le64(nla_data(attr) + 8);
16481648
16491649 if (!fh_key) {
1650− fh_key = kmalloc(sizeof(siphash_key_t), GFP_KERNEL);
1650+ fh_key = kmalloc_obj(siphash_key_t);
16511651 if (!fh_key) {
16521652 trace_nfsd_ctl_fh_key_set(false, -ENOMEM);
16531653 return -ENOMEM;
fs/ntfs/bitmap.c+1−1
@@ -40,7 +40,7 @@ int ntfs_trim_fs(struct ntfs_volume *vol, struct fstrim_range *range) · 39 unmodified lines
4040 end_cluster = vol->nr_clusters;
4141 }
4242
43− ra = kzalloc(sizeof(*ra), GFP_NOFS);
43+ ra = kzalloc_obj(*ra, GFP_NOFS);
4444 if (!ra)
4545 return -ENOMEM;
4646
fs/ntfs/compress.c+4−4
@@ -514,8 +514,8 @@ int ntfs_read_compressed_block(struct folio *folio) · 513 unmodified lines
514514 return -EIO;
515515 }
516516
517− pages = kmalloc_array(nr_pages, sizeof(struct page *), GFP_NOFS);
518− completed_pages = kmalloc_array(nr_pages + 1, sizeof(int), GFP_NOFS);
517+ pages = kmalloc_objs(struct page *, nr_pages, GFP_NOFS);
518+ completed_pages = kmalloc_objs(int, nr_pages + 1, GFP_NOFS);
519519
520520 if (unlikely(!pages || !completed_pages)) {
521521 kfree(pages);
@@ -1262,7 +1262,7 @@ static int ntfs_compress_workspace_init(struct ntfs_inode *ni, · 740 unmodified lines
12621262 size = ni->itype.compressed.block_size + 2 *
12631263 (ni->itype.compressed.block_size / NTFS_SB_SIZE) + 2;
12641264 ws->nr_pages = DIV_ROUND_UP(size, PAGE_SIZE);
1265− ws->pages = kcalloc(ws->nr_pages, sizeof(*ws->pages), GFP_NOFS);
1265+ ws->pages = kzalloc_objs(*ws->pages, ws->nr_pages, GFP_NOFS);
12661266 if (!ws->pages)
12671267 return -ENOMEM;
12681268
@@ -1483,7 +1483,7 @@ int ntfs_compress_write(struct ntfs_inode *ni, loff_t pos, size_t count, · 214 unmodified lines
14831483 pages_per_cb = DIV_ROUND_UP(offset_in_page(pos & ~(cb_size - 1)) +
14841484 cb_size, PAGE_SIZE);
14851485
1486− pages = kmalloc_array(pages_per_cb, sizeof(struct page *), GFP_NOFS);
1486+ pages = kmalloc_objs(struct page *, pages_per_cb, GFP_NOFS);
14871487 if (!pages)
14881488 return -ENOMEM;
14891489 ctx = kvzalloc_obj(*ctx, GFP_NOFS);
fs/ntfs/dir.c+8−8
@@ -166,8 +166,8 @@ found_it: · 165 unmodified lines
166166 */
167167 if (ie->key.file_name.file_name_type == FILE_NAME_DOS) {
168168 if (!name) {
169− name = kmalloc(sizeof(struct ntfs_name),
170− GFP_NOFS);
169+ name = kmalloc_obj(struct ntfs_name,
170+ GFP_NOFS);
171171 if (!name) {
172172 err = -ENOMEM;
173173 goto err_out;
@@ -401,8 +401,8 @@ found_it2: · 227 unmodified lines
401401 */
402402 if (ie->key.file_name.file_name_type == FILE_NAME_DOS) {
403403 if (!name) {
404− name = kmalloc(sizeof(struct ntfs_name),
405− GFP_NOFS);
404+ name = kmalloc_obj(struct ntfs_name,
405+ GFP_NOFS);
406406 if (!name) {
407407 err = -ENOMEM;
408408 goto unm_err_out;
@@ -700,7 +700,7 @@ static int ntfs_ia_blocks_readahead(struct ntfs_inode *ia_ni, loff_t pos) · 291 unmodified lines
700700 if (dir_start_index >= dir_end_index)
701701 return 0;
702702
703− dir_ra = kzalloc(sizeof(*dir_ra), GFP_NOFS);
703+ dir_ra = kzalloc_obj(*dir_ra, GFP_NOFS);
704704 if (!dir_ra)
705705 return -ENOMEM;
706706
@@ -777,7 +777,7 @@ static int ntfs_readdir(struct file *file, struct dir_context *actor) · 70 unmodified lines
777777 return -ENOMEM;
778778 }
779779
780− ra = kzalloc(sizeof(struct file_ra_state), GFP_NOFS);
780+ ra = kzalloc_obj(struct file_ra_state, GFP_NOFS);
781781 if (!ra) {
782782 kfree(name);
783783 ntfs_index_ctx_put(ictx);
@@ -813,7 +813,7 @@ static int ntfs_readdir(struct file *file, struct dir_context *actor) · 29 unmodified lines
813813 goto out;
814814 }
815815 } else if (!private) {
816− private = kzalloc(sizeof(struct ntfs_file_private), GFP_KERNEL);
816+ private = kzalloc_obj(struct ntfs_file_private);
817817 if (!private) {
818818 err = -ENOMEM;
819819 goto out;
@@ -949,7 +949,7 @@ nextdir: · 129 unmodified lines
949949 }
950950
951951 if (!nir) {
952− nir = kzalloc(sizeof(struct ntfs_index_ra), GFP_KERNEL);
952+ nir = kzalloc_obj(struct ntfs_index_ra);
953953 if (nir) {
954954 nir->start_index = index;
955955 nir->count = 1;
fs/ntfs/ea.c+1−1
@@ -235,7 +235,7 @@ static int ntfs_set_ea(struct inode *inode, const char *name, size_t name_len, · 234 unmodified lines
235235 ea_info_qsize = le32_to_cpu(p_ea_info->ea_query_length);
236236 } else {
237237 create_ea_info:
238− p_ea_info = kzalloc(sizeof(struct ea_information), GFP_NOFS);
238+ p_ea_info = kzalloc_obj(struct ea_information, GFP_NOFS);
239239 if (!p_ea_info)
240240 return -ENOMEM;
241241
fs/ntfs/index.c+1−1
@@ -1660,7 +1660,7 @@ resplit: · 1659 unmodified lines
16601660 goto out;
16611661 }
16621662 } else {
1663− si = kzalloc(sizeof(struct split_info), GFP_NOFS);
1663+ si = kzalloc_obj(struct split_info, GFP_NOFS);
16641664 if (!si) {
16651665 ntfs_ibm_clear(icx, new_vcn);
16661666 ret = -ENOMEM;
fs/ntfs/logfile.c+1−1
@@ -691,7 +691,7 @@ map_vcn: · 690 unmodified lines
691691
692692 memset(empty_buf, 0xff, vol->cluster_size);
693693
694− ra = kzalloc(sizeof(*ra), GFP_NOFS);
694+ ra = kzalloc_obj(*ra, GFP_NOFS);
695695 if (!ra)
696696 goto err;
697697
fs/ntfs/mft.c+6−4
@@ -2635,11 +2635,13 @@ static int ntfs_write_mft_block(struct folio *folio, struct writeback_control *w · 2634 unmodified lines
26352635 struct ntfs_inode *ni = NTFS_I(vi);
26362636 struct ntfs_volume *vol = ni->vol;
26372637 u8 *kaddr;
2638− struct ntfs_inode **locked_nis __free(kfree) = kmalloc_array(PAGE_SIZE / NTFS_BLOCK_SIZE,
2639− sizeof(struct ntfs_inode *), GFP_NOFS);
2638+ struct ntfs_inode **locked_nis __free(kfree) = kmalloc_objs(struct ntfs_inode *,
2639+ PAGE_SIZE / NTFS_BLOCK_SIZE,
2640+ GFP_NOFS);
26402641 int nr_locked_nis = 0, err = 0, mft_ofs, prev_mft_ofs;
2641− struct inode **ref_inos __free(kfree) = kmalloc_array(PAGE_SIZE / NTFS_BLOCK_SIZE,
2642− sizeof(struct inode *), GFP_NOFS);
2642+ struct inode **ref_inos __free(kfree) = kmalloc_objs(struct inode *,
2643+ PAGE_SIZE / NTFS_BLOCK_SIZE,
2644+ GFP_NOFS);
26432645 int nr_ref_inos = 0;
26442646 struct bio *bio = NULL;
26452647 u64 mft_no;
fs/ntfs/runlist.c+7−7
@@ -1804,7 +1804,7 @@ merge_src_rle: · 1803 unmodified lines
18041804 new_2nd_cnt = src_cnt;
18051805 new_cnt = new_1st_cnt + new_2nd_cnt + new_3rd_cnt;
18061806 new_cnt += dst_rl_split.lcn >= LCN_HOLE ? 1 : 0;
1807− new_rl = kvcalloc(new_cnt, sizeof(*new_rl), GFP_NOFS);
1807+ new_rl = kvzalloc_objs(*new_rl, new_cnt, GFP_NOFS);
18081808 if (!new_rl)
18091809 return ERR_PTR(-ENOMEM);
18101810
@@ -1888,13 +1888,13 @@ struct runlist_element *ntfs_rl_punch_hole(struct runlist_element *dst_rl, int d · 77 unmodified lines
18881888
18891889 punch_cnt = (int)(e_rl - s_rl) + 1;
18901890
1891− *punch_rl = kvcalloc(punch_cnt + 1, sizeof(struct runlist_element),
1892− GFP_NOFS);
1891+ *punch_rl = kvzalloc_objs(struct runlist_element, punch_cnt + 1,
1892+ GFP_NOFS);
18931893 if (!*punch_rl)
18941894 return ERR_PTR(-ENOMEM);
18951895
18961896 new_cnt = dst_cnt - (int)(e_rl - s_rl + 1) + 3;
1897− new_rl = kvcalloc(new_cnt, sizeof(struct runlist_element), GFP_NOFS);
1897+ new_rl = kvzalloc_objs(struct runlist_element, new_cnt, GFP_NOFS);
18981898 if (!new_rl) {
18991899 kvfree(*punch_rl);
19001900 *punch_rl = NULL;
@@ -2038,13 +2038,13 @@ struct runlist_element *ntfs_rl_collapse_range(struct runlist_element *dst_rl, i · 137 unmodified lines
20382038 one_split_3 = e_rl == s_rl && begin_split && end_split;
20392039
20402040 punch_cnt = (int)(e_rl - s_rl) + 1;
2041− *punch_rl = kvcalloc(punch_cnt + 1, sizeof(struct runlist_element),
2042− GFP_NOFS);
2041+ *punch_rl = kvzalloc_objs(struct runlist_element, punch_cnt + 1,
2042+ GFP_NOFS);
20432043 if (!*punch_rl)
20442044 return ERR_PTR(-ENOMEM);
20452045
20462046 new_cnt = dst_cnt - (int)(e_rl - s_rl + 1) + 3;
2047− new_rl = kvcalloc(new_cnt, sizeof(struct runlist_element), GFP_NOFS);
2047+ new_rl = kvzalloc_objs(struct runlist_element, new_cnt, GFP_NOFS);
20482048 if (!new_rl) {
20492049 kvfree(*punch_rl);
20502050 *punch_rl = NULL;
fs/ntfs/super.c+1−1
@@ -2539,7 +2539,7 @@ static int ntfs_init_fs_context(struct fs_context *fc) · 2538 unmodified lines
25392539 struct ntfs_volume *vol;
25402540
25412541 /* Allocate a new struct ntfs_volume and place it in sb->s_fs_info. */
2542− vol = kmalloc(sizeof(struct ntfs_volume), GFP_NOFS);
2542+ vol = kmalloc_obj(struct ntfs_volume, GFP_NOFS);
25432543 if (!vol)
25442544 return -ENOMEM;
25452545
fs/overlayfs/readdir.c+1−1
@@ -1044,7 +1044,7 @@ static int ovl_dir_open(struct inode *inode, struct file *file) · 1043 unmodified lines
10441044 struct ovl_dir_file *od;
10451045 enum ovl_path_type type;
10461046
1047− od = kzalloc(sizeof(struct ovl_dir_file), GFP_KERNEL);
1047+ od = kzalloc_obj(struct ovl_dir_file);
10481048 if (!od)
10491049 return -ENOMEM;
10501050
fs/smb/client/cifs_swn.c+1−1
@@ -443,7 +443,7 @@ static struct cifs_swn_reg *cifs_get_swn_reg(struct cifs_tcon *tcon) · 442 unmodified lines
443443 goto unlock;
444444 }
445445
446− reg = kmalloc_obj(struct cifs_swn_reg, GFP_KERNEL);
446+ reg = kmalloc_obj(struct cifs_swn_reg);
447447 if (reg == NULL) {
448448 ret = -ENOMEM;
449449 goto fail_unlock;
fs/smb/client/dfs_cache.c+1−1
@@ -365,7 +365,7 @@ static struct cache_dfs_tgt *alloc_target(const char *name, int path_consumed) · 364 unmodified lines
365365 {
366366 struct cache_dfs_tgt *t;
367367
368− t = kmalloc_obj(*t, GFP_KERNEL);
368+ t = kmalloc_obj(*t);
369369 if (!t)
370370 return ERR_PTR(-ENOMEM);
371371 t->name = kstrdup(name, GFP_KERNEL);
fs/smb/client/smb2inode.c+1−1
@@ -237,7 +237,7 @@ replay_again: · 236 unmodified lines
237237 num_rqst = 0;
238238 server = cifs_pick_channel(ses);
239239
240− vars = kzalloc_obj(*vars, GFP_KERNEL);
240+ vars = kzalloc_obj(*vars);
241241 if (vars == NULL) {
242242 rc = -ENOMEM;
243243 goto out;
fs/smb/server/ksmbd_work.c+1−1
@@ -30,7 +30,7 @@ static int ksmbd_reserve_iov(struct ksmbd_work *work, int need_iov_cnt) · 29 unmodified lines
3030 } while (new_alloc_cnt < work->iov_cnt + need_iov_cnt);
3131
3232 if (work->iov == work->iov_inline) {
33− new = kcalloc(new_alloc_cnt, sizeof(*new), KSMBD_DEFAULT_GFP);
33+ new = kzalloc_objs(*new, new_alloc_cnt, KSMBD_DEFAULT_GFP);
3434 if (!new)
3535 return -ENOMEM;
3636
fs/smb/server/smb2pdu.c+1−1
@@ -11820,7 +11820,7 @@ static void smb2_notify_cancel_fn(void **argv) · 11819 unmodified lines
1182011820 return;
1182111821 conn = in_work->conn;
1182211822
11823− ctx = kmalloc(sizeof(*ctx), GFP_ATOMIC);
11823+ ctx = kmalloc_obj(*ctx, GFP_ATOMIC);
1182411824 if (!ctx) {
1182511825 /* Can't defer the response -- free without sending one. */
1182611826 list_del_init(&in_work->async_request_entry);
fs/xfs/libxfs/xfs_da_btree.c+2−2
@@ -2746,8 +2746,8 @@ xfs_dabuf_map( · 2745 unmodified lines
27462746 * larger one that needs to be free by the caller.
27472747 */
27482748 if (nirecs > 1) {
2749− map = kcalloc(nirecs, sizeof(struct xfs_buf_map),
2750− GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
2749+ map = kzalloc_objs(struct xfs_buf_map, nirecs,
2750+ GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
27512751 *mapp = map;
27522752 }
27532753
init/initramfs_test.c+1−1
@@ -514,7 +514,7 @@ static void __init initramfs_test_hdr_hex(struct kunit *test) · 513 unmodified lines
514514 char fdata[] = "this file data will not be unpacked";
515515 struct initramfs_test_bufs {
516516 char cpio_src[(CPIO_HDRLEN + PATH_MAX + 3 + sizeof(fdata)) * 2];
517− } *tbufs = kzalloc(sizeof(struct initramfs_test_bufs), GFP_KERNEL);
517+ } *tbufs = kzalloc_obj(struct initramfs_test_bufs);
518518 struct initramfs_test_cpio c[] = { {
519519 .magic = "070701",
520520 .ino = 1,
io_uring/napi.c+1−1
@@ -58,7 +58,7 @@ int __io_napi_add_id(struct io_ring_ctx *ctx, unsigned int napi_id, · 57 unmodified lines
5858 }
5959 }
6060
61− e = kmalloc(sizeof(*e), GFP_NOWAIT);
61+ e = kmalloc_obj(*e, GFP_NOWAIT);
6262 if (!e)
6363 return -ENOMEM;
6464
io_uring/zcrx.c+2−2
@@ -483,8 +483,8 @@ static int io_zcrx_append_area(struct io_zcrx_ifq *ifq, · 482 unmodified lines
483483 old_areas = ifq->areas;
484484 old_nr = ifq->nr_areas;
485485
486− areas = kmalloc_array(old_nr + 1, sizeof(areas[0]),
487− GFP_KERNEL_ACCOUNT | __GFP_ZERO);
486+ areas = kmalloc_objs(areas[0], old_nr + 1,
487+ GFP_KERNEL_ACCOUNT | __GFP_ZERO);
488488 if (!areas)
489489 return -ENOMEM;
490490 if (old_areas)
kernel/bpf/diagnostics.c+1−1
@@ -266,7 +266,7 @@ static char *diag_fmt_alloc(struct bpf_verifier_env *env, size_t size) · 265 unmodified lines
266266 }
267267
268268 capacity = max_t(size_t, BPF_DIAG_FMT_CHUNK_SIZE, size);
269− chunk = kmalloc(struct_size(chunk, data, capacity), GFP_KERNEL_ACCOUNT);
269+ chunk = kmalloc_flex(*chunk, data, capacity, GFP_KERNEL_ACCOUNT);
270270 if (!chunk)
271271 return NULL;
272272
kernel/bpf/hashtab.c+1−1
@@ -511,7 +511,7 @@ static int bpf_ma_set_dtor(struct bpf_map *map, struct bpf_mem_alloc *ma, · 510 unmodified lines
511511 if (IS_ERR_OR_NULL(map->record))
512512 return 0;
513513
514− hrec = kzalloc(sizeof(*hrec), GFP_KERNEL);
514+ hrec = kzalloc_obj(*hrec);
515515 if (!hrec)
516516 return -ENOMEM;
517517 hrec->key_size = map->key_size;
kernel/bpf/liveness.c+1−1
@@ -85,7 +85,7 @@ static struct func_instance *call_instance(struct bpf_verifier_env *env, · 84 unmodified lines
8585 if (f)
8686 return f;
8787
88− f = kvzalloc(sizeof(*f), GFP_KERNEL_ACCOUNT);
88+ f = kvzalloc_obj(*f, GFP_KERNEL_ACCOUNT);
8989 if (!f)
9090 return ERR_PTR(-ENOMEM);
9191 f->callsite = lookup_key;
kernel/bpf/log.c+1−1
@@ -862,7 +862,7 @@ struct bpf_verifier_log *bpf_log_attr_create_vlog(struct bpf_log_attr *attr_log, · 861 unmodified lines
862862 if (!size)
863863 return NULL;
864864
865− log = kzalloc_obj(*log, GFP_KERNEL);
865+ log = kzalloc_obj(*log);
866866 if (!log)
867867 return ERR_PTR(-ENOMEM);
868868
kernel/bpf/verifier.c+2−3
@@ -5483,7 +5483,7 @@ static int check_max_stack_depth(struct bpf_verifier_env *env) · 5482 unmodified lines
54835483 bool priv_stack_supported;
54845484 int ret;
54855485
5486− dinfo = kvcalloc(env->subprog_cnt, sizeof(*dinfo), GFP_KERNEL_ACCOUNT);
5486+ dinfo = kvzalloc_objs(*dinfo, env->subprog_cnt, GFP_KERNEL_ACCOUNT);
54875487 if (!dinfo)
54885488 return -ENOMEM;
54895489
@@ -20536,8 +20536,7 @@ static int process_fd_array_continuous(struct bpf_verifier_env *env, · 15046 unmodified lines
2053620536 return -E2BIG;
2053720537 }
2053820538
20539− env->fd_array = kvcalloc(cnt, sizeof(*env->fd_array),
20540− GFP_KERNEL_ACCOUNT);
20539+ env->fd_array = kvzalloc_objs(*env->fd_array, cnt, GFP_KERNEL_ACCOUNT);
2054120540 if (!env->fd_array)
2054220541 return -ENOMEM;
2054320542 env->fd_array_cnt = cnt;
kernel/dma/map_benchmark.c+1−2
@@ -51,8 +51,7 @@ struct dma_single_map_param { · 50 unmodified lines
5151
5252 static void *dma_single_map_benchmark_prepare(struct map_benchmark_data *map)
5353 {
54− struct dma_single_map_param *params __free(kfree) = kzalloc(sizeof(*params),
55− GFP_KERNEL);
54+ struct dma_single_map_param *params __free(kfree) = kzalloc_obj(*params);
5655 if (!params)
5756 return NULL;
5857
kernel/events/core.c+2−3
@@ -13558,9 +13558,8 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, · 13557 unmodified lines
1355813558 return ERR_PTR(err);
1355913559
1356013560 if (has_addr_filter(event)) {
13561− event->addr_filter_ranges = kcalloc(pmu->nr_addr_filters,
13562− sizeof(struct perf_addr_filter_range),
13563− GFP_KERNEL);
13561+ event->addr_filter_ranges = kzalloc_objs(struct perf_addr_filter_range,
13562+ pmu->nr_addr_filters);
1356413563 if (!event->addr_filter_ranges)
1356513564 return ERR_PTR(-ENOMEM);
1356613565
kernel/futex/core.c+3−3
@@ -1874,8 +1874,8 @@ static int futex_hash_allocate(unsigned int hash_slots, unsigned int flags) · 1873 unmodified lines
18741874 free_percpu(ref);
18751875 }
18761876
1877− fph = kvzalloc(struct_size(fph, queues, hash_slots),
1878− GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
1877+ fph = kvzalloc_flex(*fph, queues, hash_slots,
1878+ GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
18791879 if (!fph)
18801880 return -ENOMEM;
18811881
@@ -2103,7 +2103,7 @@ static int __init futex_init(void) · 221 unmodified lines
21032103 size = sizeof(struct futex_hash_bucket) * hashsize;
21042104 order = get_order(size);
21052105
2106− __futex_queues = kcalloc(nr_node_ids, sizeof(*__futex_queues), GFP_KERNEL);
2106+ __futex_queues = kzalloc_objs(*__futex_queues, nr_node_ids);
21072107 kmemleak_not_leak(__futex_queues);
21082108
21092109 runtime_const_init(shift, __futex_shift);
kernel/irq/manage.c+1−1
@@ -2306,7 +2306,7 @@ int request_nmi(unsigned int irq, irq_handler_t handler, · 2305 unmodified lines
23062306 !irq_supports_nmi(desc))
23072307 return -EINVAL;
23082308
2309− action = kzalloc(sizeof(struct irqaction), GFP_KERNEL);
2309+ action = kzalloc_obj(struct irqaction);
23102310 if (!action)
23112311 return -ENOMEM;
23122312
kernel/jump_label.c+2−3
@@ -726,12 +726,11 @@ static int jump_label_add_module(struct module *mod) · 725 unmodified lines
726726 if (static_key_sealed(key))
727727 goto do_poke;
728728
729− jlm = kzalloc(sizeof(struct static_key_mod), GFP_KERNEL);
729+ jlm = kzalloc_obj(struct static_key_mod);
730730 if (!jlm)
731731 return -ENOMEM;
732732 if (!static_key_linked(key)) {
733− jlm2 = kzalloc(sizeof(struct static_key_mod),
734− GFP_KERNEL);
733+ jlm2 = kzalloc_obj(struct static_key_mod);
735734 if (!jlm2) {
736735 kfree(jlm);
737736 return -ENOMEM;
kernel/kthread.c+1−1
@@ -852,7 +852,7 @@ int kthread_affine_preferred(struct task_struct *p, const struct cpumask *mask) · 851 unmodified lines
852852 if (!zalloc_cpumask_var(&affinity, GFP_KERNEL))
853853 return -ENOMEM;
854854
855− kthread->preferred_affinity = kzalloc(sizeof(struct cpumask), GFP_KERNEL);
855+ kthread->preferred_affinity = kzalloc_obj(struct cpumask);
856856 if (!kthread->preferred_affinity) {
857857 ret = -ENOMEM;
858858 goto out;
kernel/sched/ext/cid.c+8−8
@@ -98,16 +98,16 @@ static struct scx_cid_tables *scx_cid_alloc_tables(void) · 97 unmodified lines
9898 u32 npossible = num_possible_cpus();
9999 struct scx_cid_tables *tbls;
100100
101− tbls = kzalloc_obj(*tbls, GFP_KERNEL);
101+ tbls = kzalloc_obj(*tbls);
102102 if (!tbls)
103103 return NULL;
104104
105− tbls->cid_to_cpu = kvcalloc(npossible, sizeof(*tbls->cid_to_cpu), GFP_KERNEL);
106− tbls->cpu_to_cid = kvcalloc(nr_cpu_ids, sizeof(*tbls->cpu_to_cid), GFP_KERNEL);
107− tbls->cid_to_shard = kvcalloc(npossible, sizeof(*tbls->cid_to_shard), GFP_KERNEL);
108− tbls->shard_node = kvcalloc(npossible, sizeof(*tbls->shard_node), GFP_KERNEL);
109− tbls->shard_ranges = kvcalloc(npossible, sizeof(*tbls->shard_ranges), GFP_KERNEL);
110− tbls->topo = kvcalloc(npossible, sizeof(*tbls->topo), GFP_KERNEL);
105+ tbls->cid_to_cpu = kvzalloc_objs(*tbls->cid_to_cpu, npossible);
106+ tbls->cpu_to_cid = kvzalloc_objs(*tbls->cpu_to_cid, nr_cpu_ids);
107+ tbls->cid_to_shard = kvzalloc_objs(*tbls->cid_to_shard, npossible);
108+ tbls->shard_node = kvzalloc_objs(*tbls->shard_node, npossible);
109+ tbls->shard_ranges = kvzalloc_objs(*tbls->shard_ranges, npossible);
110+ tbls->topo = kvzalloc_objs(*tbls->topo, npossible);
111111
112112 if (!tbls->cid_to_cpu || !tbls->cpu_to_cid || !tbls->cid_to_shard ||
113113 !tbls->shard_node || !tbls->shard_ranges || !tbls->topo) {
@@ -490,7 +490,7 @@ __bpf_kfunc void scx_bpf_cid_override(const s32 *cpu_to_cid__arena, u32 cpu_to_c · 376 unmodified lines
490490 * region that arena fault recovery covers.
491491 */
492492 alloced = zalloc_cpumask_var(&seen, GFP_KERNEL);
493− node_counts = kcalloc(nr_node_ids, sizeof(*node_counts), GFP_KERNEL);
493+ node_counts = kzalloc_objs(*node_counts, nr_node_ids);
494494 if (cpu_to_cid_cnt == nr_cpu_ids)
495495 cpu_to_cid = kmemdup(cpu_to_cid__arena, cpu_to_cid_cnt * sizeof(s32),
496496 GFP_KERNEL);
kernel/sched/ext/ext.c+1−1
@@ -5449,7 +5449,7 @@ static ssize_t scx_attr_caps_show(struct kobject *kobj, · 5448 unmodified lines
54495449 struct scx_sched *sch = container_of(kobj, struct scx_sched, kobj);
54505450 u32 npossible = num_possible_cpus();
54515451 struct scx_cmask *agg __free(kfree) =
5452− kzalloc(struct_size(agg, bits, SCX_CMASK_NR_WORDS(npossible)), GFP_KERNEL);
5452+ kzalloc_flex(*agg, bits, SCX_CMASK_NR_WORDS(npossible));
54535453 unsigned long *agg_bm __free(bitmap) = bitmap_zalloc(npossible, GFP_KERNEL);
54545454 ssize_t count = 0;
54555455 s32 cap, si;
kernel/sched/ext/sub.c+1−1
@@ -194,7 +194,7 @@ s32 scx_alloc_pshards(struct scx_sched *sch) · 193 unmodified lines
194194 shard_node = rcu_dereference_protected(scx_shard_node,
195195 lockdep_is_held(&scx_enable_mutex));
196196
197− pshard = kzalloc_objs(pshard[0], scx_nr_cid_shards, GFP_KERNEL);
197+ pshard = kzalloc_objs(pshard[0], scx_nr_cid_shards);
198198 if (!pshard)
199199 return -ENOMEM;
200200
kernel/trace/fprobe.c+1−1
@@ -945,7 +945,7 @@ int register_fprobe(struct fprobe *fp, const char *filter, const char *notfilter · 944 unmodified lines
945945 if (num < 0)
946946 return num;
947947
948− addrs = kcalloc(num, sizeof(*addrs), GFP_KERNEL);
948+ addrs = kzalloc_objs(*addrs, num);
949949 if (!addrs)
950950 return -ENOMEM;
951951
kernel/trace/ring_buffer.c+2−2
@@ -2600,8 +2600,8 @@ rb_allocate_cpu_buffer(struct trace_buffer *buffer, long nr_pages, int cpu) · 2599 unmodified lines
26002600 cpu_buffer->remote = buffer->remote;
26012601 cpu_buffer->meta_page = (struct trace_buffer_meta *)(void *)desc->meta_va;
26022602 cpu_buffer->nr_pages = nr_pages;
2603− cpu_buffer->subbuf_ids = kcalloc(cpu_buffer->nr_pages + 1,
2604− sizeof(*cpu_buffer->subbuf_ids), GFP_KERNEL);
2603+ cpu_buffer->subbuf_ids = kzalloc_objs(*cpu_buffer->subbuf_ids,
2604+ cpu_buffer->nr_pages + 1);
26052605 if (!cpu_buffer->subbuf_ids)
26062606 goto fail_free_reader;
26072607
kernel/trace/trace_eprobe.c+1−1
@@ -930,7 +930,7 @@ static int __trace_eprobe_create(int argc, const char *argv[]) · 929 unmodified lines
930930 } else
931931 ep->filter_str = NULL;
932932
933− ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
933+ ctx = kzalloc_obj(*ctx);
934934 if (!ctx)
935935 return -ENOMEM;
936936 ctx->event = ep->event;
kernel/trace/trace_remote.c+5−5
@@ -251,8 +251,8 @@ static int trace_remote_get(struct trace_remote *remote, int cpu) · 250 unmodified lines
251251 if (cpu != RING_BUFFER_ALL_CPUS && !remote->pcpu_reader_locks) {
252252 int lock_cpu;
253253
254− remote->pcpu_reader_locks = kcalloc(nr_cpu_ids, sizeof(*remote->pcpu_reader_locks),
255− GFP_KERNEL);
254+ remote->pcpu_reader_locks = kzalloc_objs(*remote->pcpu_reader_locks,
255+ nr_cpu_ids);
256256 if (!remote->pcpu_reader_locks) {
257257 trace_remote_try_unload(remote);
258258 return -ENOMEM;
@@ -324,7 +324,7 @@ static int __alloc_ring_buffer_iter(struct trace_remote_iterator *iter, int cpu) · 65 unmodified lines
324324 return iter->rb_iter ? 0 : -ENOMEM;
325325 }
326326
327− iter->rb_iters = kcalloc(nr_cpu_ids, sizeof(*iter->rb_iters), GFP_KERNEL);
327+ iter->rb_iters = kzalloc_objs(*iter->rb_iters, nr_cpu_ids);
328328 if (!iter->rb_iters)
329329 return -ENOMEM;
330330
@@ -1204,7 +1204,7 @@ remote_events_dir_header_page_read(struct file *filp, char __user *ubuf, size_t · 873 unmodified lines
12041204 struct trace_seq *s;
12051205 int ret;
12061206
1207− s = kmalloc(sizeof(*s), GFP_KERNEL);
1207+ s = kmalloc_obj(*s);
12081208 if (!s)
12091209 return -ENOMEM;
12101210
@@ -1227,7 +1227,7 @@ remote_events_dir_header_event_read(struct file *filp, char __user *ubuf, size_t · 16 unmodified lines
12271227 struct trace_seq *s;
12281228 int ret;
12291229
1230− s = kmalloc(sizeof(*s), GFP_KERNEL);
1230+ s = kmalloc_obj(*s);
12311231 if (!s)
12321232 return -ENOMEM;
12331233
lib/test_rhashtable.c+1−1
@@ -696,7 +696,7 @@ static int __init test_rhashtable_next_key(void) · 695 unmodified lines
696696 if (err)
697697 return err;
698698
699− objs = kcalloc(n, sizeof(*objs), GFP_KERNEL);
699+ objs = kzalloc_objs(*objs, n);
700700 if (!objs) {
701701 rhashtable_destroy(&ht);
702702 return -ENOMEM;
lib/test_workqueue.c+2−2
@@ -149,11 +149,11 @@ static int __init run_bench(int n_threads, const char *scope, const char *label) · 148 unmodified lines
149149 if (ret)
150150 return ret;
151151
152− ctxs = kcalloc(n_threads, sizeof(*ctxs), GFP_KERNEL);
152+ ctxs = kzalloc_objs(*ctxs, n_threads);
153153 if (!ctxs)
154154 return -ENOMEM;
155155
156− tasks = kcalloc(n_threads, sizeof(*tasks), GFP_KERNEL);
156+ tasks = kzalloc_objs(*tasks, n_threads);
157157 if (!tasks) {
158158 kfree(ctxs);
159159 return -ENOMEM;
lib/tests/kunit_iov_iter.c+1−1
@@ -57,7 +57,7 @@ static void *__init iov_kunit_create_buffer(struct kunit *test, · 56 unmodified lines
5757 void *buffer;
5858 unsigned int i;
5959
60− pages = kzalloc_objs(struct page *, npages, GFP_KERNEL);
60+ pages = kzalloc_objs(struct page *, npages);
6161 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pages);
6262 *ppages = pages;
6363
mm/damon/tests/vaddr-kunit.h+1−1
@@ -136,7 +136,7 @@ static void damon_do_test_apply_three_regions(struct kunit *test, · 135 unmodified lines
136136 if (!t)
137137 kunit_skip(test, "target alloc fail");
138138
139− ranges = kmalloc_array(nr_regions / 2, sizeof(*ranges), GFP_KERNEL);
139+ ranges = kmalloc_objs(*ranges, nr_regions / 2);
140140 if (!ranges) {
141141 damon_destroy_target(t, NULL);
142142 kunit_skip(test, "ranges alloc fail");
net/batman-adv/hard-interface.c+1−1
@@ -981,7 +981,7 @@ batadv_wifi_net_device_insert(struct net_device *net_dev, u32 wifi_flags) · 980 unmodified lines
981981
982982 ASSERT_RTNL();
983983
984− device_state = kzalloc_obj(*device_state, GFP_KERNEL);
984+ device_state = kzalloc_obj(*device_state);
985985 if (!device_state)
986986 return -ENOMEM;
987987
net/bluetooth/hci_sync.c+1−2
@@ -6423,8 +6423,7 @@ static int hci_update_event_filter_sync(struct hci_dev *hdev) · 6422 unmodified lines
64236423 goto update_scan;
64246424 }
64256425
6426− accept_list = kmalloc_array(num_entries, sizeof(*accept_list),
6427− GFP_KERNEL);
6426+ accept_list = kmalloc_objs(*accept_list, num_entries);
64286427 if (!accept_list) {
64296428 hci_dev_unlock(hdev);
64306429 return -ENOMEM;
net/devlink/netlink.c+1−1
@@ -251,7 +251,7 @@ devlink_get_parent_from_attrs_lock(struct net *net, struct nlattr **attrs) · 250 unmodified lines
251251 if (!attrs[DEVLINK_ATTR_PARENT_DEV])
252252 return ERR_PTR(-EINVAL);
253253
254− tb = kcalloc(maxtype + 1, sizeof(*tb), GFP_KERNEL);
254+ tb = kzalloc_objs(*tb, maxtype + 1);
255255 if (!tb)
256256 return ERR_PTR(-ENOMEM);
257257
net/devlink/param.c+3−4
@@ -330,13 +330,12 @@ static int devlink_nl_param_fill(struct sk_buff *msg, struct devlink *devlink, · 329 unmodified lines
330330 int err;
331331 int i;
332332
333− default_value = kcalloc(DEVLINK_PARAM_CMODE_MAX + 1,
334− sizeof(*default_value), GFP_KERNEL);
333+ default_value = kzalloc_objs(*default_value,
334+ DEVLINK_PARAM_CMODE_MAX + 1);
335335 if (!default_value)
336336 return -ENOMEM;
337337
338− param_value = kcalloc(DEVLINK_PARAM_CMODE_MAX + 1,
339− sizeof(*param_value), GFP_KERNEL);
338+ param_value = kzalloc_objs(*param_value, DEVLINK_PARAM_CMODE_MAX + 1);
340339 if (!param_value) {
341340 kfree(default_value);
342341 return -ENOMEM;
net/ipv4/tcp_ipv4.c+2−2
@@ -2931,8 +2931,8 @@ static int bpf_iter_tcp_realloc_batch(struct bpf_tcp_iter_state *iter, · 2930 unmodified lines
29312931 {
29322932 union bpf_tcp_iter_batch_item *new_batch;
29332933
2934− new_batch = kvmalloc_array(new_batch_sz, sizeof(*new_batch),
2935− flags | __GFP_NOWARN);
2934+ new_batch = kvmalloc_objs(*new_batch, new_batch_sz,
2935+ flags | __GFP_NOWARN);
29362936 if (!new_batch)
29372937 return -ENOMEM;
29382938
net/mac80211/nan.c+1−2
@@ -659,8 +659,7 @@ int ieee80211_nan_set_peer_sched(struct ieee80211_sub_if_data *sdata, · 658 unmodified lines
659659 if (!sta)
660660 return -ENOENT;
661661
662− new_sched = kzalloc(struct_size(new_sched, channels, sched->n_channels),
663− GFP_KERNEL);
662+ new_sched = kzalloc_flex(*new_sched, channels, sched->n_channels);
664663 if (!new_sched)
665664 return -ENOMEM;
666665
net/mctp/test/route-test.c+1−1
@@ -193,7 +193,7 @@ static void __mctp_route_test_init(struct kunit *test, · 192 unmodified lines
193193 if (netid != MCTP_NET_ANY)
194194 WRITE_ONCE(dev->mdev->net, netid);
195195
196− dev->mdev->addrs = kmalloc_objs(u8, 1, GFP_KERNEL);
196+ dev->mdev->addrs = kmalloc_objs(u8, 1);
197197 dev->mdev->num_addrs = 1;
198198 dev->mdev->addrs[0] = 8;
199199
net/mctp/test/utils.c+1−1
@@ -88,7 +88,7 @@ struct mctp_test_dev *mctp_test_create_dev_with_addr(mctp_eid_t addr) · 87 unmodified lines
8888 if (!dev)
8989 return NULL;
9090
91− dev->mdev->addrs = kmalloc_objs(u8, 1, GFP_KERNEL);
91+ dev->mdev->addrs = kmalloc_objs(u8, 1);
9292 if (!dev->mdev->addrs) {
9393 mctp_test_destroy_dev(dev);
9494 return NULL;
net/netfilter/nf_tables_api.c+1−1
@@ -3215,7 +3215,7 @@ static int nft_trans_delhook(struct nft_hook *hook, · 3214 unmodified lines
32153215 {
32163216 struct nft_trans_hook *trans_hook;
32173217
3218− trans_hook = kmalloc_obj(*trans_hook, GFP_KERNEL);
3218+ trans_hook = kmalloc_obj(*trans_hook);
32193219 if (!trans_hook)
32203220 return -ENOMEM;
32213221
net/netfilter/nfnetlink_cttimeout.c+1−1
@@ -150,7 +150,7 @@ static int cttimeout_new_timeout(struct sk_buff *skb, · 149 unmodified lines
150150 goto err_proto_put;
151151 }
152152
153− timeout = kzalloc(sizeof(*timeout), GFP_KERNEL);
153+ timeout = kzalloc_obj(*timeout);
154154 if (timeout == NULL) {
155155 ret = -ENOMEM;
156156 goto err_proto_put;
net/rds/info.c+1−1
@@ -205,7 +205,7 @@ int rds_info_getsockopt(struct socket *sock, int optname, sockopt_t *opt) · 204 unmodified lines
205205 * iterator code to allocate and hand it back.
206206 */
207207 npages = iov_iter_npages(&opt->iter_out, INT_MAX);
208− pages = kvmalloc_array(npages, sizeof(*pages), GFP_KERNEL);
208+ pages = kvmalloc_objs(*pages, npages);
209209 if (!pages) {
210210 ret = -ENOMEM;
211211 goto out;
net/rxrpc/key.c+1−1
@@ -210,7 +210,7 @@ static int rxrpc_preparse_xdr_yfs_rxgk(struct key_preparsed_payload *prep, · 209 unmodified lines
210210 if (!token)
211211 goto nomem;
212212
213− token->rxgk = kzalloc(struct_size_t(struct rxgk_key, _key, raw_keylen), GFP_KERNEL);
213+ token->rxgk = kzalloc_flex(struct rxgk_key, _key, raw_keylen);
214214 if (!token->rxgk)
215215 goto nomem_token;
216216
net/sched/act_gate.c+2−2
@@ -240,7 +240,7 @@ static int tcf_gate_copy_entries(struct tcf_gate_params *dst, · 239 unmodified lines
240240 list_for_each_entry(entry, &src->entries, list) {
241241 struct tcfg_gate_entry *new;
242242
243− new = kzalloc(sizeof(*new), GFP_ATOMIC);
243+ new = kzalloc_obj(*new, GFP_ATOMIC);
244244 if (!new) {
245245 NL_SET_ERR_MSG(extack, "Not enough memory for entry");
246246 return -ENOMEM;
@@ -415,7 +415,7 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla, · 168 unmodified lines
415415 if (err < 0)
416416 goto release_idr;
417417
418− p = kzalloc(sizeof(*p), GFP_KERNEL);
418+ p = kzalloc_obj(*p);
419419 if (!p) {
420420 err = -ENOMEM;
421421 goto chain_put;
net/sched/act_tunnel_key.c+1−1
@@ -526,7 +526,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla, · 525 unmodified lines
526526 }
527527 t = to_tunnel_key(*a);
528528
529− params_new = kzalloc(sizeof(*params_new), GFP_KERNEL);
529+ params_new = kzalloc_obj(*params_new);
530530 if (unlikely(!params_new)) {
531531 NL_SET_ERR_MSG(extack, "Cannot allocate tunnel key parameters");
532532 ret = -ENOMEM;
net/sunrpc/auth_gss/gss_krb5_crypto.c+2−3
@@ -282,9 +282,8 @@ int gss_krb5_mic_build_sg(const struct xdr_buf *body, · 281 unmodified lines
282282 unsigned int overflow_nents =
283283 nsg - XDR_BUF_TO_SG_NENTS + 1;
284284
285− *sg_overflow = kmalloc_array(overflow_nents,
286− sizeof(**sg_overflow),
287− GFP_NOFS);
285+ *sg_overflow = kmalloc_objs(**sg_overflow, overflow_nents,
286+ GFP_NOFS);
288287 if (!*sg_overflow)
289288 return -ENOMEM;
290289
net/sunrpc/svcauth_unix.c+2−2
@@ -625,7 +625,7 @@ int sunrpc_nl_unix_gid_get_reqs_dumpit(struct sk_buff *skb, · 624 unmodified lines
625625 if (!cnt)
626626 return 0;
627627
628− items = kcalloc(cnt, sizeof(*items), GFP_KERNEL);
628+ items = kzalloc_objs(*items, cnt);
629629 seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);
630630 if (!items || !seqnos) {
631631 ret = -ENOMEM;
@@ -1326,7 +1326,7 @@ int sunrpc_nl_ip_map_get_reqs_dumpit(struct sk_buff *skb, · 694 unmodified lines
13261326 if (!cnt)
13271327 return 0;
13281328
1329− items = kcalloc(cnt, sizeof(*items), GFP_KERNEL);
1329+ items = kzalloc_objs(*items, cnt);
13301330 seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);
13311331 if (!items || !seqnos) {
13321332 ret = -ENOMEM;
net/sunrpc/xdr.c+1−2
@@ -371,8 +371,7 @@ int xdr_buf_to_sg_alloc(const struct xdr_buf *buf, unsigned int offset, · 370 unmodified lines
371371 unsigned int overflow_nents = nsg - sg_head_nents + 1;
372372 struct scatterlist *overflow;
373373
374− overflow = kmalloc_array(overflow_nents, sizeof(*overflow),
375− gfp);
374+ overflow = kmalloc_objs(*overflow, overflow_nents, gfp);
376375 if (!overflow)
377376 return -ENOMEM;
378377
net/unix/af_unix.c+2−2
@@ -3667,8 +3667,8 @@ static int bpf_iter_unix_realloc_batch(struct bpf_unix_iter_state *iter, · 3666 unmodified lines
36673667 {
36683668 struct sock **new_batch;
36693669
3670− new_batch = kvmalloc_array(new_batch_sz, sizeof(*new_batch),
3671− GFP_USER | __GFP_NOWARN);
3670+ new_batch = kvmalloc_objs(*new_batch, new_batch_sz,
3671+ GFP_USER | __GFP_NOWARN);
36723672 if (!new_batch)
36733673 return -ENOMEM;
36743674
net/wireless/core.c+2−3
@@ -311,9 +311,8 @@ int cfg80211_nan_set_local_schedule(struct cfg80211_registered_device *rdev, · 310 unmodified lines
311311 if (!sched->n_channels)
312312 return 0;
313313
314− wdev->u.nan.chandefs = kcalloc(sched->n_channels,
315− sizeof(*wdev->u.nan.chandefs),
316− GFP_KERNEL);
314+ wdev->u.nan.chandefs = kzalloc_objs(*wdev->u.nan.chandefs,
315+ sched->n_channels);
317316 if (!wdev->u.nan.chandefs)
318317 return -ENOMEM;
319318
net/wireless/nl80211.c+3−6
@@ -17330,8 +17330,7 @@ static int nl80211_parse_nan_channel(struct cfg80211_registered_device *rdev, · 17329 unmodified lines
1733017330 u8 n_rx_nss;
1733117331 int ret;
1733217332
17333− channel_parsed = kcalloc(NL80211_ATTR_MAX + 1, sizeof(*channel_parsed),
17334− GFP_KERNEL);
17333+ channel_parsed = kzalloc_objs(*channel_parsed, NL80211_ATTR_MAX + 1);
1733517334 if (!channel_parsed)
1733617335 return -ENOMEM;
1733717336
@@ -17554,8 +17553,7 @@ static int nl80211_nan_set_peer_sched(struct sk_buff *skb, · 216 unmodified lines
1755417553 }
1755517554
1755617555 if (n_channels) {
17557− nan_channels = kcalloc(n_channels, sizeof(*nan_channels),
17558− GFP_KERNEL);
17556+ nan_channels = kzalloc_objs(*nan_channels, n_channels);
1755917557 if (!nan_channels)
1756017558 return -ENOMEM;
1756117559 }
@@ -17693,8 +17691,7 @@ static int nl80211_nan_set_local_sched(struct sk_buff *skb, · 131 unmodified lines
1769317691 info->nlhdr, GENL_HDRLEN, rem)
1769417692 n_channels++;
1769517693
17696− sched = kzalloc(struct_size(sched, nan_channels, n_channels),
17697− GFP_KERNEL);
17694+ sched = kzalloc_flex(*sched, nan_channels, n_channels);
1769817695 if (!sched)
1769917696 return -ENOMEM;
1770017697
security/integrity/ima/ima_queue.c+1−2
@@ -75,8 +75,7 @@ static struct hlist_head *ima_alloc_replace_htable(void) · 74 unmodified lines
7575 struct hlist_head *old_htable, *new_htable;
7676
7777 /* Initializing to zeros is equivalent to call HLIST_HEAD_INIT. */
78− new_htable = kcalloc(IMA_MEASURE_HTABLE_SIZE, sizeof(struct hlist_head),
79− GFP_KERNEL);
78+ new_htable = kzalloc_objs(struct hlist_head, IMA_MEASURE_HTABLE_SIZE);
8079 if (!new_htable)
8180 return ERR_PTR(-ENOMEM);
8281
sound/core/compress_offload.c+2−2
@@ -107,7 +107,7 @@ static int snd_compr_open(struct inode *inode, struct file *f) · 106 unmodified lines
107107 return -EINVAL;
108108 }
109109
110− data = kzalloc(sizeof(*data), GFP_KERNEL);
110+ data = kzalloc_obj(*data);
111111 if (!data) {
112112 snd_card_unref(compr->card);
113113 return -ENOMEM;
@@ -119,7 +119,7 @@ static int snd_compr_open(struct inode *inode, struct file *f) · 5 unmodified lines
119119 data->stream.direction = dirn;
120120 data->stream.private_data = compr->private_data;
121121 data->stream.device = compr;
122− runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
122+ runtime = kzalloc_obj(*runtime);
123123 if (!runtime) {
124124 kfree(data);
125125 snd_card_unref(compr->card);
sound/core/control.c+3−3
@@ -69,7 +69,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file) · 68 unmodified lines
6969 err = -ENODEV;
7070 goto __error2;
7171 }
72− ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
72+ ctl = kzalloc_obj(*ctl);
7373 if (ctl == NULL) {
7474 err = -ENOMEM;
7575 goto __error;
@@ -174,7 +174,7 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, · 98 unmodified lines
174174 goto _found;
175175 }
176176 }
177− ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
177+ ev = kzalloc_obj(*ev, GFP_ATOMIC);
178178 if (ev) {
179179 ev->id = *id;
180180 ev->mask = mask;
@@ -871,7 +871,7 @@ static int snd_ctl_card_info(struct snd_card *card, struct snd_ctl_file * ctl, · 690 unmodified lines
871871 unsigned int cmd, void __user *arg)
872872 {
873873 struct snd_ctl_card_info *info __free(kfree) =
874− kzalloc(sizeof(*info), GFP_KERNEL);
874+ kzalloc_obj(*info);
875875 ssize_t n;
876876
877877 if (! info)
sound/core/control_led.c+1−1
@@ -158,7 +158,7 @@ static void snd_ctl_led_set_state(struct snd_card *card, unsigned int access, · 157 unmodified lines
158158 UPDATE_ROUTE(route, snd_ctl_led_get(lctl));
159159 }
160160 if (!found && kctl && card) {
161− lctl = kzalloc(sizeof(*lctl), GFP_KERNEL);
161+ lctl = kzalloc_obj(*lctl);
162162 if (lctl) {
163163 lctl->card = card;
164164 lctl->access = access;
sound/core/init.c+1−1
@@ -364,7 +364,7 @@ static int snd_card_init(struct snd_card *card, struct device *parent, · 363 unmodified lines
364364 sound_debugfs_root);
365365 #endif
366366 #ifdef CONFIG_SND_CTL_DEBUG
367− card->value_buf = kmalloc(sizeof(*card->value_buf), GFP_KERNEL);
367+ card->value_buf = kmalloc_obj(*card->value_buf);
368368 if (!card->value_buf)
369369 return -ENOMEM;
370370 #endif
sound/core/misc.c+1−1
@@ -125,7 +125,7 @@ int snd_fasync_helper(int fd, struct file *file, int on, · 124 unmodified lines
125125 struct snd_fasync *fasync = NULL;
126126
127127 if (on) {
128− fasync = kzalloc(sizeof(*fasync), GFP_KERNEL);
128+ fasync = kzalloc_obj(*fasync);
129129 if (!fasync)
130130 return -ENOMEM;
131131 INIT_LIST_HEAD(&fasync->list);
sound/core/oss/mixer_oss.c+1−1
@@ -890,7 +890,7 @@ static int snd_mixer_oss_build_test(struct snd_mixer_oss *mixer, struct slot *sl · 889 unmodified lines
890890 int err;
891891
892892 struct snd_ctl_elem_info *info __free(kfree) =
893− kmalloc(sizeof(*info), GFP_KERNEL);
893+ kmalloc_obj(*info);
894894 if (!info)
895895 return -ENOMEM;
896896 scoped_guard(rwsem_read, &card->controls_rwsem) {
sound/core/pcm_native.c+1−1
@@ -2330,7 +2330,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) · 2329 unmodified lines
23302330 return -EINVAL;
23312331
23322332 struct snd_pcm_group *group __free(kfree) =
2333− kzalloc(sizeof(*group), GFP_KERNEL);
2333+ kzalloc_obj(*group);
23342334 if (!group)
23352335 return -ENOMEM;
23362336 snd_pcm_group_init(group);
sound/core/seq/oss/seq_oss_synth.c+1−1
@@ -86,7 +86,7 @@ snd_seq_oss_synth_probe(struct snd_seq_device *dev) · 85 unmodified lines
8686 struct seq_oss_synth *rec;
8787 struct snd_seq_oss_reg *reg = SNDRV_SEQ_DEVICE_ARGPTR(dev);
8888
89− rec = kzalloc(sizeof(*rec), GFP_KERNEL);
89+ rec = kzalloc_obj(*rec);
9090 if (!rec)
9191 return -ENOMEM;
9292 rec->seq_device = -1;
sound/core/seq/seq_clientmgr.c+1−1
@@ -210,7 +210,7 @@ static struct snd_seq_client *seq_create_client1(int client_index, int poolsize) · 209 unmodified lines
210210 struct snd_seq_client *client;
211211
212212 /* init client data */
213− client = kzalloc(sizeof(*client), GFP_KERNEL);
213+ client = kzalloc_obj(*client);
214214 if (client == NULL)
215215 return NULL;
216216 client->pool = snd_seq_pool_new(poolsize);
sound/core/seq/seq_virmidi.c+1−1
@@ -188,7 +188,7 @@ static int snd_virmidi_input_open(struct snd_rawmidi_substream *substream) · 187 unmodified lines
188188 struct snd_rawmidi_runtime *runtime = substream->runtime;
189189 struct snd_virmidi *vmidi;
190190
191− vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
191+ vmidi = kzalloc_obj(*vmidi);
192192 if (vmidi == NULL)
193193 return -ENOMEM;
194194 vmidi->substream = substream;
sound/core/timer.c+1−1
@@ -1855,7 +1855,7 @@ static int snd_timer_user_info(struct file *file, · 1854 unmodified lines
18551855 return -EBADFD;
18561856
18571857 struct snd_timer_info *info __free(kfree) =
1858− kzalloc(sizeof(*info), GFP_KERNEL);
1858+ kzalloc_obj(*info);
18591859 if (! info)
18601860 return -ENOMEM;
18611861 info->card = t->card ? t->card->number : -1;
sound/drivers/aloop.c+2−2
@@ -1365,7 +1365,7 @@ static int loopback_open(struct snd_pcm_substream *substream) · 1364 unmodified lines
13651365 int dev = get_cable_index(substream);
13661366
13671367 guard(mutex)(&loopback->cable_lock);
1368− dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
1368+ dpcm = kzalloc_obj(*dpcm);
13691369 if (!dpcm)
13701370 return -ENOMEM;
13711371 dpcm->loopback = loopback;
@@ -1373,7 +1373,7 @@ static int loopback_open(struct snd_pcm_substream *substream) · 1 unmodified line
13731373
13741374 cable = loopback->cables[substream->number][dev];
13751375 if (!cable) {
1376− cable = kzalloc(sizeof(*cable), GFP_KERNEL);
1376+ cable = kzalloc_obj(*cable);
13771377 if (!cable) {
13781378 err = -ENOMEM;
13791379 goto unlock;
sound/isa/gus/gus_dma.c+1−1
@@ -214,7 +214,7 @@ int snd_gf1_dma_transfer_block(struct snd_gus_card * gus, · 213 unmodified lines
214214 struct snd_gf1_dma_block *block;
215215 struct snd_gf1_dma_block *free_block = NULL;
216216
217− block = kmalloc(sizeof(*block), atomic ? GFP_ATOMIC : GFP_KERNEL);
217+ block = kmalloc_obj(*block, atomic ? GFP_ATOMIC : GFP_KERNEL);
218218 if (!block)
219219 return -ENOMEM;
220220
sound/pci/cs46xx/cs46xx_lib.c+1−1
@@ -1444,7 +1444,7 @@ static int _cs46xx_playback_open_channel (struct snd_pcm_substream *substream,in · 1443 unmodified lines
14441444 struct snd_cs46xx_pcm * cpcm;
14451445 struct snd_pcm_runtime *runtime = substream->runtime;
14461446
1447− cpcm = kzalloc(sizeof(*cpcm), GFP_KERNEL);
1447+ cpcm = kzalloc_obj(*cpcm);
14481448 if (cpcm == NULL)
14491449 return -ENOMEM;
14501450 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
sound/pci/ctxfi/ctamixer.c+2−2
@@ -236,7 +236,7 @@ static int get_amixer_rsc(struct amixer_mgr *mgr, · 235 unmodified lines
236236 *ramixer = NULL;
237237
238238 /* Allocate mem for amixer resource */
239− amixer = kzalloc(sizeof(*amixer), GFP_KERNEL);
239+ amixer = kzalloc_obj(*amixer);
240240 if (!amixer)
241241 return -ENOMEM;
242242
@@ -390,7 +390,7 @@ static int get_sum_rsc(struct sum_mgr *mgr, · 147 unmodified lines
390390 *rsum = NULL;
391391
392392 /* Allocate mem for sum resource */
393− sum = kzalloc(sizeof(*sum), GFP_KERNEL);
393+ sum = kzalloc_obj(*sum);
394394 if (!sum)
395395 return -ENOMEM;
396396
sound/pci/ctxfi/ctdaio.c+2−2
@@ -540,7 +540,7 @@ static int get_daio_rsc(struct daio_mgr *mgr, · 539 unmodified lines
540540 err = -ENOMEM;
541541 /* Allocate mem for daio resource */
542542 if (desc->output) {
543− struct dao *dao = kzalloc(sizeof(*dao), GFP_KERNEL);
543+ struct dao *dao = kzalloc_obj(*dao);
544544 if (!dao)
545545 goto error;
546546
@@ -552,7 +552,7 @@ static int get_daio_rsc(struct daio_mgr *mgr, · 5 unmodified lines
552552
553553 *rdaio = &dao->daio;
554554 } else {
555− struct dai *dai = kzalloc(sizeof(*dai), GFP_KERNEL);
555+ struct dai *dai = kzalloc_obj(*dai);
556556 if (!dai)
557557 goto error;
558558
sound/pci/ctxfi/ctsrc.c+2−2
@@ -432,9 +432,9 @@ get_src_rsc(struct src_mgr *mgr, const struct src_desc *desc, struct src **rsrc) · 431 unmodified lines
432432
433433 /* Allocate mem for master src resource */
434434 if (MEMRD == desc->mode)
435− src = kcalloc(desc->multi, sizeof(*src), GFP_KERNEL);
435+ src = kzalloc_objs(*src, desc->multi);
436436 else
437− src = kzalloc(sizeof(*src), GFP_KERNEL);
437+ src = kzalloc_obj(*src);
438438
439439 if (!src) {
440440 err = -ENOMEM;
sound/pci/ctxfi/cttimer.c+1−1
@@ -318,7 +318,7 @@ ct_timer_instance_new(struct ct_timer *atimer, struct ct_atc_pcm *apcm) · 317 unmodified lines
318318 {
319319 struct ct_timer_instance *ti;
320320
321− ti = kzalloc(sizeof(*ti), GFP_KERNEL);
321+ ti = kzalloc_obj(*ti);
322322 if (!ti)
323323 return NULL;
324324 spin_lock_init(&ti->lock);
sound/pci/emu10k1/emufx.c+1−1
@@ -2470,7 +2470,7 @@ static int snd_emu10k1_fx8010_ioctl(struct snd_hwdep * hw, struct file *file, un · 2469 unmodified lines
24702470 emu->support_tlv = 1;
24712471 return put_user(SNDRV_EMU10K1_VERSION, (int __user *)argp);
24722472 case SNDRV_EMU10K1_IOCTL_INFO:
2473− info = kzalloc(sizeof(*info), GFP_KERNEL);
2473+ info = kzalloc_obj(*info, GFP_KERNEL);
24742474 if (!info)
24752475 return -ENOMEM;
24762476 snd_emu10k1_fx8010_info(emu, info);
sound/soc/codecs/simple-amplifier.c+1−1
@@ -371,7 +371,7 @@ static unsigned int *simple_amp_alloc_tlv_ranges(const struct simple_amp_ranges · 370 unmodified lines
371371 unsigned int *t;
372372 unsigned int i;
373373
374− tlv = kzalloc_objs(*tlv, 2 + ranges->nb_ranges * 6, GFP_KERNEL);
374+ tlv = kzalloc_objs(*tlv, 2 + ranges->nb_ranges * 6);
375375 if (!tlv)
376376 return NULL;
377377
sound/soc/generic/simple-card-utils.c+1−1
@@ -168,7 +168,7 @@ int simple_util_parse_tdm_width_map(struct simple_util_priv *priv, struct device · 167 unmodified lines
168168 if (!dai->tdm_width_map)
169169 return simple_ret(priv, ret); /* see NOTE */
170170
171− u32 *array_values __free(kfree) = kcalloc(n, sizeof(*array_values), GFP_KERNEL);
171+ u32 *array_values __free(kfree) = kzalloc_objs(*array_values, n);
172172 if (!array_values)
173173 goto end;
174174
sound/soc/meson/gx-formatter.c+1−1
@@ -253,7 +253,7 @@ struct gx_stream *gx_stream_alloc(struct gx_iface *iface) · 252 unmodified lines
253253 {
254254 struct gx_stream *ts;
255255
256− ts = kzalloc(sizeof(*ts), GFP_KERNEL);
256+ ts = kzalloc_obj(*ts);
257257 if (ts) {
258258 INIT_LIST_HEAD(&ts->formatter_list);
259259 mutex_init(&ts->lock);
sound/soc/qcom/qdsp6/q6afe.c+1−1
@@ -1857,7 +1857,7 @@ struct q6afe_port *q6afe_port_get_from_id(struct device *dev, int id) · 1856 unmodified lines
18571857 return ERR_PTR(-EINVAL);
18581858 }
18591859
1860− port = kzalloc(sizeof(*port), GFP_KERNEL);
1860+ port = kzalloc_obj(*port, GFP_KERNEL);
18611861 if (!port)
18621862 return ERR_PTR(-ENOMEM);
18631863
sound/soc/sdca/sdca_functions.c+9−10
@@ -1249,8 +1249,7 @@ static int find_sdca_entity_pde(struct device *dev, · 1248 unmodified lines
12491249 return -EINVAL;
12501250 }
12511251
1252− u32 *delay_list __free(kfree) = kcalloc(num_delays, sizeof(*delay_list),
1253− GFP_KERNEL);
1252+ u32 *delay_list __free(kfree) = kzalloc_objs(*delay_list, num_delays);
12541253 if (!delay_list)
12551254 return -ENOMEM;
12561255
@@ -1313,8 +1312,8 @@ static int find_sdca_entity_ge(struct device *dev, · 56 unmodified lines
13131312 return -EINVAL;
13141313 }
13151314
1316− u8 *affected_list __free(kfree) = kcalloc(num_affected, sizeof(*affected_list),
1317− GFP_KERNEL);
1315+ u8 *affected_list __free(kfree) = kzalloc_objs(*affected_list,
1316+ num_affected);
13181317 if (!affected_list)
13191318 return -ENOMEM;
13201319
@@ -1552,8 +1551,8 @@ static int find_sdca_entities(struct device *dev, struct fwnode_handle *function · 231 unmodified lines
15521551 if (!entities)
15531552 return -ENOMEM;
15541553
1555− u32 *entity_list __free(kfree) = kcalloc(num_entities, sizeof(*entity_list),
1556− GFP_KERNEL);
1554+ u32 *entity_list __free(kfree) = kzalloc_objs(*entity_list,
1555+ num_entities);
15571556 if (!entity_list)
15581557 return -ENOMEM;
15591558
@@ -1715,8 +1714,8 @@ static int find_sdca_entity_connection_pde(struct device *dev, · 155 unmodified lines
17151714 if (!managed)
17161715 return -ENOMEM;
17171716
1718− u32 *managed_list __free(kfree) = kcalloc(num_managed, sizeof(*managed_list),
1719− GFP_KERNEL);
1717+ u32 *managed_list __free(kfree) = kzalloc_objs(*managed_list,
1718+ num_managed);
17201719 if (!managed_list)
17211720 return -ENOMEM;
17221721
@@ -2033,8 +2032,8 @@ static int find_sdca_clusters(struct device *dev, · 310 unmodified lines
20332032 if (!clusters)
20342033 return -ENOMEM;
20352034
2036− u32 *cluster_list __free(kfree) = kcalloc(num_clusters, sizeof(*cluster_list),
2037− GFP_KERNEL);
2035+ u32 *cluster_list __free(kfree) = kzalloc_objs(*cluster_list,
2036+ num_clusters);
20382037 if (!cluster_list)
20392038 return -ENOMEM;
20402039
sound/soc/sof/sof-client-probes-ipc4.c+1−1
@@ -260,7 +260,7 @@ static int ipc4_probes_points_info(struct sof_client_dev *cdev, · 259 unmodified lines
260260 *num_desc = info->num_elems;
261261 dev_dbg(dev, "%s: got %zu probe points", __func__, *num_desc);
262262
263− *desc = kcalloc(*num_desc, sizeof(**desc), GFP_KERNEL);
263+ *desc = kzalloc_objs(**desc, *num_desc);
264264 if (!*desc) {
265265 kfree(msg.data_ptr);
266266 return -ENOMEM;
sound/soc/sof/sof-client.c+1−1
@@ -230,7 +230,7 @@ int sof_client_dev_register(struct snd_sof_dev *sdev, const char *name, u32 id, · 229 unmodified lines
230230 struct sof_client_dev *cdev;
231231 int ret;
232232
233− centry = kzalloc(sizeof(*centry), GFP_KERNEL);
233+ centry = kzalloc_obj(*centry);
234234 if (!centry)
235235 return -ENOMEM;
236236
sound/sparc/amd7930.c+1−1
@@ -903,7 +903,7 @@ static int snd_amd7930_create(struct snd_card *card, · 902 unmodified lines
903903 int err;
904904
905905 *ramd = NULL;
906− amd = kzalloc(sizeof(*amd), GFP_KERNEL);
906+ amd = kzalloc_obj(*amd);
907907 if (amd == NULL)
908908 return -ENOMEM;
909909