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
66 struct crypto_aes_ctx *rk;66 struct crypto_aes_ctx *rk;
67 int err;67 int err;
68 68
69 rk = kmalloc(sizeof(*rk), GFP_KERNEL);69 rk = kmalloc_obj(*rk);
70 if (!rk)70 if (!rk)
71 return -ENOMEM;71 return -ENOMEM;
72 72
@@ -128,7 +128,7 @@ static int aesbs_cbc_ctr_setkey(struct crypto_skcipher *tfm, const u8 *in_key, · 55 unmodified lines
128 struct crypto_aes_ctx *rk;128 struct crypto_aes_ctx *rk;
129 int err;129 int err;
130 130
131 rk = kmalloc(sizeof(*rk), GFP_KERNEL);131 rk = kmalloc_obj(*rk);
132 if (!rk)132 if (!rk)
133 return -ENOMEM;133 return -ENOMEM;
134 134
arch/arm64/kvm/nested.c+1−1
@@ -93,7 +93,7 @@ int kvm_vcpu_init_nested(struct kvm_vcpu *vcpu) · 92 unmodified lines
93 num_mmus = atomic_read(&kvm->online_vcpus) * S2_MMU_PER_VCPU;93 num_mmus = atomic_read(&kvm->online_vcpus) * S2_MMU_PER_VCPU;
94 94
95 if (num_mmus > kvm->arch.nested_mmus_size) {95 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);
97 if (!tmp)97 if (!tmp)
98 return -ENOMEM;98 return -ENOMEM;
99 99
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
149 return -EINVAL;149 return -EINVAL;
150 }150 }
151 151
152 s = kzalloc(sizeof(struct loongarch_dmsintc), GFP_KERNEL);152 s = kzalloc_obj(struct loongarch_dmsintc);
153 if (!s)153 if (!s)
154 return -ENOMEM;154 return -ENOMEM;
155 155
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
523 523
524 /* 1 node for gpio-keys device, 1 node for each button, 1 terminator */524 /* 1 node for gpio-keys device, 1 node for each button, 1 terminator */
525 const struct software_node **node_group __free(kfree) =525 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);
527 if (!node_group)527 if (!node_group)
528 return -ENOMEM;528 return -ENOMEM;
529 529
530 /* 1 code property, 1 gpio property, 1 terminator */530 /* 1 code property, 1 gpio property, 1 terminator */
531 struct property_entry *props __free(kfree) =531 struct property_entry *props __free(kfree) =
532 kcalloc(nbuttons * 3, sizeof(*props), GFP_KERNEL);532 kzalloc_objs(*props, nbuttons * 3);
533 if (!props)533 if (!props)
534 return -ENOMEM;534 return -ENOMEM;
535 535
536 /* 1 node for gpio-keys device, 1 node for each button */536 /* 1 node for gpio-keys device, 1 node for each button */
537 struct software_node *nodes __free(kfree) =537 struct software_node *nodes __free(kfree) =
538 kcalloc(1 + nbuttons, sizeof(*nodes), GFP_KERNEL);538 kzalloc_objs(*nodes, 1 + nbuttons);
539 if (!nodes)539 if (!nodes)
540 return -ENOMEM;540 return -ENOMEM;
541 541
542 struct software_node_ref_args *ref_args __free(kfree) =542 struct software_node_ref_args *ref_args __free(kfree) =
543 kcalloc(nbuttons, sizeof(*ref_args), GFP_KERNEL);543 kzalloc_objs(*ref_args, nbuttons);
544 if (!ref_args)544 if (!ref_args)
545 return -ENOMEM;545 return -ENOMEM;
546 546
arch/powerpc/sysdev/xive/common.c+1−1
@@ -1134,7 +1134,7 @@ static int __init xive_init_ipis(void) · 1133 unmodified lines
1134 if (!ipi_domain)1134 if (!ipi_domain)
1135 goto out_free_fwnode;1135 goto out_free_fwnode;
1136 1136
1137 xive_ipis = kzalloc_objs(*xive_ipis, nr_node_ids, GFP_KERNEL);1137 xive_ipis = kzalloc_objs(*xive_ipis, nr_node_ids);
1138 if (!xive_ipis)1138 if (!xive_ipis)
1139 goto out_free_domain;1139 goto out_free_domain;
1140 1140
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
503 }503 }
504 }504 }
505 505
506 einfo = kvcalloc(num_events, sizeof(*einfo),506 einfo = kvzalloc_objs(*einfo, num_events,
507 GFP_KERNEL_ACCOUNT | __GFP_NOWARN);507 GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
508 if (!einfo) {508 if (!einfo) {
509 ret = SBI_ERR_FAILURE;509 ret = SBI_ERR_FAILURE;
510 goto out;510 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
2168 if (args->count < 1 || args->count > KVM_S390_SKEYS_MAX)2168 if (args->count < 1 || args->count > KVM_S390_SKEYS_MAX)
2169 return -EINVAL;2169 return -EINVAL;
2170 2170
2171 keys = kvmalloc_array(args->count, sizeof(*keys), GFP_KERNEL_ACCOUNT);2171 keys = kvmalloc_objs(*keys, args->count, GFP_KERNEL_ACCOUNT);
2172 if (!keys)2172 if (!keys)
2173 return -ENOMEM;2173 return -ENOMEM;
2174 2174
@@ -2205,7 +2205,7 @@ static int kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) · 30 unmodified lines
2205 if (args->count < 1 || args->count > KVM_S390_SKEYS_MAX)2205 if (args->count < 1 || args->count > KVM_S390_SKEYS_MAX)
2206 return -EINVAL;2206 return -EINVAL;
2207 2207
2208 keys = kvmalloc_array(args->count, sizeof(*keys), GFP_KERNEL_ACCOUNT);2208 keys = kvmalloc_objs(*keys, args->count, GFP_KERNEL_ACCOUNT);
2209 if (!keys)2209 if (!keys)
2210 return -ENOMEM;2210 return -ENOMEM;
2211 2211
drivers/accel/rocket/rocket_job.c+1−1
@@ -196,7 +196,7 @@ static int rocket_job_push(struct rocket_job *job) · 195 unmodified lines
196 if (check_add_overflow(job->in_bo_count, job->out_bo_count, &bo_count))196 if (check_add_overflow(job->in_bo_count, job->out_bo_count, &bo_count))
197 return -EINVAL;197 return -EINVAL;
198 198
199 bos = kvmalloc_array(bo_count, sizeof(*bos), GFP_KERNEL);199 bos = kvmalloc_objs(*bos, bo_count);
200 if (!bos)200 if (!bos)
201 return -ENOMEM;201 return -ENOMEM;
202 memcpy(bos, job->in_bos, job->in_bo_count * sizeof(void *));202 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
486 if (ACPI_FAILURE(status))486 if (ACPI_FAILURE(status))
487 continue;487 continue;
488 dep_devices.count = 1;488 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);
490 if (!dep_devices.handles) {491 if (!dep_devices.handles) {
491 acpi_handle_err(handle, "failed to allocate memory\n");492 acpi_handle_err(handle, "failed to allocate memory\n");
492 continue;493 continue;
@@ -499,7 +500,8 @@ static u32 acpi_add_prt_dep(acpi_handle handle) · 6 unmodified lines
499 if (!gsi_handle)500 if (!gsi_handle)
500 continue;501 continue;
501 dep_devices.count = 1;502 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);
503 if (!dep_devices.handles) {505 if (!dep_devices.handles) {
504 acpi_handle_err(handle, "failed to allocate memory\n");506 acpi_handle_err(handle, "failed to allocate memory\n");
505 continue;507 continue;
@@ -526,7 +528,7 @@ static u32 acpi_add_irq_dep(acpi_handle handle) · 20 unmodified lines
526 continue;528 continue;
527 529
528 dep_devices.count = 1;530 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);
530 if (!dep_devices.handles) {532 if (!dep_devices.handles) {
531 acpi_handle_err(handle, "failed to allocate memory\n");533 acpi_handle_err(handle, "failed to allocate memory\n");
532 continue;534 continue;
drivers/base/property.c+1−1
@@ -526,7 +526,7 @@ int fwnode_property_match_string(const struct fwnode_handle *fwnode, · 525 unmodified lines
526 if (nval == 0)526 if (nval == 0)
527 return -ENODATA;527 return -ENODATA;
528 528
529 const char **values __free(kfree) = kcalloc(nval, sizeof(*values), GFP_KERNEL);529 const char **values __free(kfree) = kzalloc_objs(*values, nval);
530 if (!values)530 if (!values)
531 return -ENOMEM;531 return -ENOMEM;
532 532
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
656 *ret_nested_attribute_table = NULL;656 *ret_nested_attribute_table = NULL;
657 if (!tla)657 if (!tla)
658 return -ENOMSG;658 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);
660 if (!ntb)660 if (!ntb)
661 return -ENOMEM;661 return -ENOMEM;
662 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_drbd_cfg_context_nl_policy, NULL);662 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
714 *ret_nested_attribute_table = NULL;714 *ret_nested_attribute_table = NULL;
715 if (!tla)715 if (!tla)
716 return -ENOMSG;716 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);
718 if (!ntb)718 if (!ntb)
719 return -ENOMEM;719 return -ENOMEM;
720 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_disk_conf_nl_policy, NULL);720 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
871 *ret_nested_attribute_table = NULL;871 *ret_nested_attribute_table = NULL;
872 if (!tla)872 if (!tla)
873 return -ENOMSG;873 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);
875 if (!ntb)875 if (!ntb)
876 return -ENOMEM;876 return -ENOMEM;
877 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_res_opts_nl_policy, NULL);877 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
921 *ret_nested_attribute_table = NULL;921 *ret_nested_attribute_table = NULL;
922 if (!tla)922 if (!tla)
923 return -ENOMSG;923 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);
925 if (!ntb)925 if (!ntb)
926 return -ENOMEM;926 return -ENOMEM;
927 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_net_conf_nl_policy, NULL);927 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
1087 *ret_nested_attribute_table = NULL;1087 *ret_nested_attribute_table = NULL;
1088 if (!tla)1088 if (!tla)
1089 return -ENOMSG;1089 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);
1091 if (!ntb)1091 if (!ntb)
1092 return -ENOMEM;1092 return -ENOMEM;
1093 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_set_role_parms_nl_policy, NULL);1093 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
1133 *ret_nested_attribute_table = NULL;1133 *ret_nested_attribute_table = NULL;
1134 if (!tla)1134 if (!tla)
1135 return -ENOMSG;1135 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);
1137 if (!ntb)1137 if (!ntb)
1138 return -ENOMEM;1138 return -ENOMEM;
1139 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_resize_parms_nl_policy, NULL);1139 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
1195 *ret_nested_attribute_table = NULL;1195 *ret_nested_attribute_table = NULL;
1196 if (!tla)1196 if (!tla)
1197 return -ENOMSG;1197 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);
1199 if (!ntb)1199 if (!ntb)
1200 return -ENOMEM;1200 return -ENOMEM;
1201 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_start_ov_parms_nl_policy, NULL);1201 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
1245 *ret_nested_attribute_table = NULL;1245 *ret_nested_attribute_table = NULL;
1246 if (!tla)1246 if (!tla)
1247 return -ENOMSG;1247 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);
1249 if (!ntb)1249 if (!ntb)
1250 return -ENOMEM;1250 return -ENOMEM;
1251 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_new_c_uuid_parms_nl_policy, NULL);1251 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
1291 *ret_nested_attribute_table = NULL;1291 *ret_nested_attribute_table = NULL;
1292 if (!tla)1292 if (!tla)
1293 return -ENOMSG;1293 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);
1295 if (!ntb)1295 if (!ntb)
1296 return -ENOMEM;1296 return -ENOMEM;
1297 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_disconnect_parms_nl_policy, NULL);1297 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
1337 *ret_nested_attribute_table = NULL;1337 *ret_nested_attribute_table = NULL;
1338 if (!tla)1338 if (!tla)
1339 return -ENOMSG;1339 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);
1341 if (!ntb)1341 if (!ntb)
1342 return -ENOMEM;1342 return -ENOMEM;
1343 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_detach_parms_nl_policy, NULL);1343 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
1383 *ret_nested_attribute_table = NULL;1383 *ret_nested_attribute_table = NULL;
1384 if (!tla)1384 if (!tla)
1385 return -ENOMSG;1385 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);
1387 if (!ntb)1387 if (!ntb)
1388 return -ENOMEM;1388 return -ENOMEM;
1389 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_resource_info_nl_policy, NULL);1389 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
1441 *ret_nested_attribute_table = NULL;1441 *ret_nested_attribute_table = NULL;
1442 if (!tla)1442 if (!tla)
1443 return -ENOMSG;1443 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);
1445 if (!ntb)1445 if (!ntb)
1446 return -ENOMEM;1446 return -ENOMEM;
1447 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_device_info_nl_policy, NULL);1447 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
1487 *ret_nested_attribute_table = NULL;1487 *ret_nested_attribute_table = NULL;
1488 if (!tla)1488 if (!tla)
1489 return -ENOMSG;1489 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);
1491 if (!ntb)1491 if (!ntb)
1492 return -ENOMEM;1492 return -ENOMEM;
1493 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_connection_info_nl_policy, NULL);1493 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
1537 *ret_nested_attribute_table = NULL;1537 *ret_nested_attribute_table = NULL;
1538 if (!tla)1538 if (!tla)
1539 return -ENOMSG;1539 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);
1541 if (!ntb)1542 if (!ntb)
1542 return -ENOMEM;1543 return -ENOMEM;
1543 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_peer_device_info_nl_policy, NULL);1544 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
1599 *ret_nested_attribute_table = NULL;1600 *ret_nested_attribute_table = NULL;
1600 if (!tla)1601 if (!tla)
1601 return -ENOMSG;1602 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);
1603 if (!ntb)1605 if (!ntb)
1604 return -ENOMEM;1606 return -ENOMEM;
1605 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_resource_statistics_nl_policy, NULL);1607 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
1645 *ret_nested_attribute_table = NULL;1647 *ret_nested_attribute_table = NULL;
1646 if (!tla)1648 if (!tla)
1647 return -ENOMSG;1649 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);
1649 if (!ntb)1651 if (!ntb)
1650 return -ENOMEM;1652 return -ENOMEM;
1651 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_device_statistics_nl_policy, NULL);1653 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
1743 *ret_nested_attribute_table = NULL;1745 *ret_nested_attribute_table = NULL;
1744 if (!tla)1746 if (!tla)
1745 return -ENOMSG;1747 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);
1747 if (!ntb)1750 if (!ntb)
1748 return -ENOMEM;1751 return -ENOMEM;
1749 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_connection_statistics_nl_policy, NULL);1752 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
1789 *ret_nested_attribute_table = NULL;1792 *ret_nested_attribute_table = NULL;
1790 if (!tla)1793 if (!tla)
1791 return -ENOMSG;1794 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);
1793 if (!ntb)1797 if (!ntb)
1794 return -ENOMEM;1798 return -ENOMEM;
1795 err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_peer_device_statistics_nl_policy, NULL);1799 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
5390 page_to_pfn(pages[i + 1]) == pfn + (i - start) + 1)5390 page_to_pfn(pages[i + 1]) == pfn + (i - start) + 1)
5391 i++;5391 i++;
5392 5392
5393 range = kzalloc(sizeof(*range), GFP_KERNEL);5393 range = kzalloc_obj(*range);
5394 if (!range) {5394 if (!range) {
5395 ret = -ENOMEM;5395 ret = -ENOMEM;
5396 goto unwind;5396 goto unwind;
@@ -5453,7 +5453,7 @@ static int ublk_ctrl_reg_buf(struct ublk_device *ub, · 56 unmodified lines
5453 nr_pages = buf_reg.len >> PAGE_SHIFT;5453 nr_pages = buf_reg.len >> PAGE_SHIFT;
5454 5454
5455 /* Pin pages before any locks (may sleep) */5455 /* Pin pages before any locks (may sleep) */
5456 pages = kvmalloc_array(nr_pages, sizeof(*pages), GFP_KERNEL);5456 pages = kvmalloc_objs(*pages, nr_pages);
5457 if (!pages)5457 if (!pages)
5458 return -ENOMEM;5458 return -ENOMEM;
5459 5459
drivers/block/zram/backend_lz4.c+1−1
@@ -42,7 +42,7 @@ static int lz4_setup_params(struct zcomp_params *params) · 41 unmodified lines
42 if (!params->dict || !params->dict_sz)42 if (!params->dict || !params->dict_sz)
43 return 0;43 return 0;
44 44
45 dict_stream = kzalloc_obj(*dict_stream, GFP_KERNEL);45 dict_stream = kzalloc_obj(*dict_stream);
46 if (!dict_stream)46 if (!dict_stream)
47 return -ENOMEM;47 return -ENOMEM;
48 48
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
248 return -EINVAL;248 return -EINVAL;
249 }249 }
250 250
251 parent_data = kcalloc(num_parents, sizeof(*parent_data), GFP_KERNEL);251 parent_data = kzalloc_objs(*parent_data, num_parents);
252 if (!parent_data)252 if (!parent_data)
253 return -ENOMEM;253 return -ENOMEM;
254 254
drivers/clk/ti/mux.c+1−1
@@ -181,7 +181,7 @@ static void of_mux_clk_setup(struct device_node *node) · 180 unmodified lines
181 pr_err("mux-clock %pOFn must have parents\n", node);181 pr_err("mux-clock %pOFn must have parents\n", node);
182 return;182 return;
183 }183 }
184 parent_data = kcalloc(num_parents, sizeof(*parent_data), GFP_KERNEL);184 parent_data = kzalloc_objs(*parent_data, num_parents);
185 if (!parent_data)185 if (!parent_data)
186 return;186 return;
187 187
drivers/cpufreq/amd-pstate.c+1−1
@@ -1624,7 +1624,7 @@ static struct freq_attr **get_freq_attrs(void) · 1623 unmodified lines
1624 /* amd_pstate_{max_freq, lowest_nonlinear_freq, highest_perf} should always be visible */1624 /* amd_pstate_{max_freq, lowest_nonlinear_freq, highest_perf} should always be visible */
1625 BUG_ON(!count);1625 BUG_ON(!count);
1626 1626
1627 attrs = kcalloc(count + 1, sizeof(struct freq_attr *), GFP_KERNEL);1627 attrs = kzalloc_objs(struct freq_attr *, count + 1);
1628 if (!attrs)1628 if (!attrs)
1629 return ERR_PTR(-ENOMEM);1629 return ERR_PTR(-ENOMEM);
1630 1630
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
533 533
534 memcpy(iv, reqiv, rctx->ivsize);534 memcpy(iv, reqiv, rctx->ivsize);
535 535
536 rctx->sa_state = kzalloc(sizeof(*rctx->sa_state), GFP_KERNEL);536 rctx->sa_state = kzalloc_obj(*rctx->sa_state);
537 if (!rctx->sa_state)537 if (!rctx->sa_state)
538 return -ENOMEM;538 return -ENOMEM;
539 539
@@ -561,8 +561,7 @@ int eip93_send_req(struct crypto_async_request *async, · 21 unmodified lines
561 iv[3] = 0xffffffff;561 iv[3] = 0xffffffff;
562 crypto_inc((u8 *)iv, AES_BLOCK_SIZE);562 crypto_inc((u8 *)iv, AES_BLOCK_SIZE);
563 563
564 rctx->sa_state_ctr = kzalloc(sizeof(*rctx->sa_state_ctr),564 rctx->sa_state_ctr = kzalloc_obj(*rctx->sa_state_ctr);
565 GFP_KERNEL);
566 if (!rctx->sa_state_ctr) {565 if (!rctx->sa_state_ctr) {
567 err = -ENOMEM;566 err = -ENOMEM;
568 goto free_sa_state;567 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
59 if (!scratch->literals)59 if (!scratch->literals)
60 goto error;60 goto error;
61 61
62 scratch->out_seqs = kvcalloc(QAT_MAX_SEQUENCES, sizeof(ZSTD_Sequence),62 scratch->out_seqs = kvzalloc_objs(ZSTD_Sequence, QAT_MAX_SEQUENCES);
63 GFP_KERNEL);
64 if (!scratch->out_seqs)63 if (!scratch->out_seqs)
65 goto error;64 goto error;
66 65
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
387 src_nents++;387 src_nents++;
388 dst_nents++;388 dst_nents++;
389 389
390 src = kmalloc_array(src_nents, sizeof(*src), GFP_ATOMIC);390 src = kmalloc_objs(*src, src_nents, GFP_ATOMIC);
391 if (!src) {391 if (!src) {
392 ret = -ENOMEM;392 ret = -ENOMEM;
393 goto aes_ctr_src_alloc_err;393 goto aes_ctr_src_alloc_err;
@@ -399,7 +399,7 @@ static int dthe_aes_run(struct crypto_engine *engine, void *areq) · 5 unmodified lines
399 sg_set_buf(sg, pad_buf, pad_size);399 sg_set_buf(sg, pad_buf, pad_size);
400 400
401 if (diff_dst) {401 if (diff_dst) {
402 dst = kmalloc_array(dst_nents, sizeof(*dst), GFP_ATOMIC);402 dst = kmalloc_objs(*dst, dst_nents, GFP_ATOMIC);
403 if (!dst) {403 if (!dst) {
404 ret = -ENOMEM;404 ret = -ENOMEM;
405 goto aes_ctr_dst_alloc_err;405 goto aes_ctr_dst_alloc_err;
@@ -624,7 +624,7 @@ static struct scatterlist *dthe_aead_prep_aad(struct scatterlist *sg, · 218 unmodified lines
624 if (assoclen % AES_BLOCK_SIZE)624 if (assoclen % AES_BLOCK_SIZE)
625 aad_nents++;625 aad_nents++;
626 626
627 aad_sg = kmalloc_array(aad_nents, sizeof(struct scatterlist), GFP_ATOMIC);627 aad_sg = kmalloc_objs(struct scatterlist, aad_nents, GFP_ATOMIC);
628 if (!aad_sg)628 if (!aad_sg)
629 return ERR_PTR(-ENOMEM);629 return ERR_PTR(-ENOMEM);
630 630
@@ -680,7 +680,7 @@ static struct scatterlist *dthe_aead_prep_crypt(struct scatterlist *sg, · 49 unmodified lines
680 if (cryptlen % AES_BLOCK_SIZE)680 if (cryptlen % AES_BLOCK_SIZE)
681 crypt_nents++;681 crypt_nents++;
682 682
683 crypt_sg = kmalloc_array(crypt_nents, sizeof(struct scatterlist), GFP_ATOMIC);683 crypt_sg = kmalloc_objs(struct scatterlist, crypt_nents, GFP_ATOMIC);
684 if (!crypt_sg) {684 if (!crypt_sg) {
685 err = -ENOMEM;685 err = -ENOMEM;
686 goto dthe_aead_prep_crypt_mem_err;686 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
474 return -EINVAL;474 return -EINVAL;
475 475
476 len = rc;476 len = rc;
477 u32 *num __free(kfree) = kcalloc(len, sizeof(*num), GFP_KERNEL);477 u32 *num __free(kfree) = kzalloc_objs(*num, len);
478 if (!num)478 if (!num)
479 return -ENOMEM;479 return -ENOMEM;
480 480
drivers/dma-buf/st-dma-fence.c+1−1
@@ -27,7 +27,7 @@ static struct dma_fence *mock_fence(void) · 26 unmodified lines
27{27{
28 struct dma_fence *f;28 struct dma_fence *f;
29 29
30 f = kmalloc(sizeof(*f), GFP_KERNEL);30 f = kmalloc_obj(*f);
31 if (!f)31 if (!f)
32 return NULL;32 return NULL;
33 33
drivers/dma-buf/udmabuf.c+2−2
@@ -359,7 +359,7 @@ static long udmabuf_create(struct miscdevice *device, · 358 unmodified lines
359 long ret = -EINVAL;359 long ret = -EINVAL;
360 u32 i, flags;360 u32 i, flags;
361 361
362 ubuf = kzalloc(sizeof(*ubuf), GFP_KERNEL);362 ubuf = kzalloc_obj(*ubuf);
363 if (!ubuf)363 if (!ubuf)
364 return -ENOMEM;364 return -ENOMEM;
365 365
@@ -387,7 +387,7 @@ static long udmabuf_create(struct miscdevice *device, · 21 unmodified lines
387 if (ret)387 if (ret)
388 goto err;388 goto err;
389 389
390 folios = kvmalloc_array(max_nr_folios, sizeof(*folios), GFP_KERNEL);390 folios = kvmalloc_objs(*folios, max_nr_folios);
391 if (!folios) {391 if (!folios) {
392 ret = -ENOMEM;392 ret = -ENOMEM;
393 goto err;393 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
1056 int se_buf_len, irq, rc;1056 int se_buf_len, irq, rc;
1057 struct dma_chan *chan;1057 struct dma_chan *chan;
1058 1058
1059 swdma_chan = kzalloc_obj(*swdma_chan, GFP_KERNEL);1059 swdma_chan = kzalloc_obj(*swdma_chan);
1060 if (!swdma_chan)1060 if (!swdma_chan)
1061 return -ENOMEM;1061 return -ENOMEM;
1062 1062
@@ -1162,8 +1162,7 @@ static int switchtec_dma_chans_enumerate(struct switchtec_dma_dev *swdma_dev, · 99 unmodified lines
1162 struct dma_device *dma = &swdma_dev->dma_dev;1162 struct dma_device *dma = &swdma_dev->dma_dev;
1163 int base, cnt, rc, i;1163 int base, cnt, rc, i;
1164 1164
1165 swdma_dev->swdma_chans = kcalloc(chan_cnt, sizeof(*swdma_dev->swdma_chans),1165 swdma_dev->swdma_chans = kzalloc_objs(*swdma_dev->swdma_chans, chan_cnt);
1166 GFP_KERNEL);
1167 1166
1168 if (!swdma_dev->swdma_chans)1167 if (!swdma_dev->swdma_chans)
1169 return -ENOMEM;1168 return -ENOMEM;
@@ -1222,7 +1221,7 @@ static int switchtec_dma_create(struct pci_dev *pdev) · 52 unmodified lines
1222 /*1221 /*
1223 * Create the switchtec dma device1222 * Create the switchtec dma device
1224 */1223 */
1225 swdma_dev = kzalloc_obj(*swdma_dev, GFP_KERNEL);1224 swdma_dev = kzalloc_obj(*swdma_dev);
1226 if (!swdma_dev)1225 if (!swdma_dev)
1227 return -ENOMEM;1226 return -ENOMEM;
1228 1227
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
813 layers[1].is_virt_csrow = false;813 layers[1].is_virt_csrow = false;
814 814
815 rc = -ENOMEM;815 rc = -ENOMEM;
816 dev = kzalloc(sizeof(*dev), GFP_KERNEL);816 dev = kzalloc_obj(*dev);
817 if (!dev)817 if (!dev)
818 return rc;818 return rc;
819 819
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
1792{1792{
1793 int ret;1793 int ret;
1794 1794
1795 struct scmi_iterator *i __free(kfree) = kzalloc(sizeof(*i), GFP_KERNEL);1795 struct scmi_iterator *i __free(kfree) = kzalloc_obj(*i);
1796 if (!i)1796 if (!i)
1797 return ERR_PTR(-ENOMEM);1797 return ERR_PTR(-ENOMEM);
1798 1798
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
169{169{
170 int ret;170 int ret;
171 171
172 u64 *handle __free(kfree) = kzalloc(sizeof(*handle), GFP_KERNEL);172 u64 *handle __free(kfree) = kzalloc_obj(*handle);
173 if (!handle)173 if (!handle)
174 return -ENOMEM;174 return -ENOMEM;
175 175
@@ -197,8 +197,7 @@ static int qcom_tzmem_pool_add_memory(struct qcom_tzmem_pool *pool, · 21 unmodified lines
197{197{
198 int ret;198 int ret;
199 199
200 struct qcom_tzmem_area *area __free(kfree) = kzalloc(sizeof(*area),200 struct qcom_tzmem_area *area __free(kfree) = kzalloc_obj(*area, gfp);
201 gfp);
202 if (!area)201 if (!area)
203 return -ENOMEM;202 return -ENOMEM;
204 203
@@ -415,8 +414,7 @@ void *qcom_tzmem_alloc(struct qcom_tzmem_pool *pool, size_t size, gfp_t gfp) · 210 unmodified lines
415 414
416 size = PAGE_ALIGN(size);415 size = PAGE_ALIGN(size);
417 416
418 struct qcom_tzmem_chunk *chunk __free(kfree) = kzalloc(sizeof(*chunk),417 struct qcom_tzmem_chunk *chunk __free(kfree) = kzalloc_obj(*chunk, gfp);
419 gfp);
420 if (!chunk)418 if (!chunk)
421 return NULL;419 return NULL;
422 420
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
2386 if (ret || !(info->fw_caps & MSG_FLAG_CAPS_LPM_IRQ_CONTEXT_LOST))2386 if (ret || !(info->fw_caps & MSG_FLAG_CAPS_LPM_IRQ_CONTEXT_LOST))
2387 goto end;2387 goto end;
2388 2388
2389 irq = kzalloc_obj(*irq, GFP_KERNEL);2389 irq = kzalloc_obj(*irq);
2390 if (!irq) {2390 if (!irq) {
2391 ti_sci_manage_irq(handle, valid_params, src_id, src_index,2391 ti_sci_manage_irq(handle, valid_params, src_id, src_index,
2392 dst_id, dst_host_irq, ia_id, vint,2392 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
316 if (user_addr + length < user_addr)316 if (user_addr + length < user_addr)
317 return -EINVAL;317 return -EINVAL;
318 318
319 region = kzalloc(sizeof(*region), GFP_KERNEL);319 region = kzalloc_obj(*region);
320 if (!region)320 if (!region)
321 return -ENOMEM;321 return -ENOMEM;
322 322
drivers/gpio/gpio-aggregator.c+2−2
@@ -886,8 +886,8 @@ gpio_aggregator_make_device_sw_node(struct gpio_aggregator *aggr) · 885 unmodified lines
886 if (num_lines == 0)886 if (num_lines == 0)
887 return NULL;887 return NULL;
888 888
889 const char **line_names __free(kfree) = kcalloc(889 const char **line_names __free(kfree) = kzalloc_objs(*line_names,
890 num_lines, sizeof(*line_names), GFP_KERNEL);890 num_lines);
891 if (!line_names)891 if (!line_names)
892 return ERR_PTR(-ENOMEM);892 return ERR_PTR(-ENOMEM);
893 893
drivers/gpio/gpio-mpsse.c+1−1
@@ -518,7 +518,7 @@ static void gpio_mpsse_irq_enable(struct irq_data *irqd) · 517 unmodified lines
518 * Can't be devm because it uses a non-raw spinlock (illegal in518 * Can't be devm because it uses a non-raw spinlock (illegal in
519 * this context, where a raw spinlock is held by our caller)519 * this context, where a raw spinlock is held by our caller)
520 */520 */
521 worker = kzalloc(sizeof(*worker), GFP_NOWAIT);521 worker = kzalloc_obj(*worker, GFP_NOWAIT);
522 if (!worker)522 if (!worker)
523 return;523 return;
524 524
drivers/gpio/gpio-sim.c+1−2
@@ -790,8 +790,7 @@ gpio_sim_make_bank_swnode(struct gpio_sim_bank *bank, · 789 unmodified lines
790 790
791 line_names_size = gpio_sim_get_line_names_size(bank);791 line_names_size = gpio_sim_get_line_names_size(bank);
792 if (line_names_size) {792 if (line_names_size) {
793 line_names = kcalloc(line_names_size, sizeof(*line_names),793 line_names = kzalloc_objs(*line_names, line_names_size);
794 GFP_KERNEL);
795 if (!line_names)794 if (!line_names)
796 return ERR_PTR(-ENOMEM);795 return ERR_PTR(-ENOMEM);
797 796
drivers/gpio/gpio-virtuser.c+1−2
@@ -1429,8 +1429,7 @@ gpio_virtuser_make_device_swnode(struct gpio_virtuser_device *dev) · 1428 unmodified lines
1429 memset(properties, 0, sizeof(properties));1429 memset(properties, 0, sizeof(properties));
1430 1430
1431 num_ids = list_count_nodes(&dev->lookup_list);1431 num_ids = list_count_nodes(&dev->lookup_list);
1432 char **ids __free(kfree) = kcalloc(num_ids + 1, sizeof(*ids),1432 char **ids __free(kfree) = kzalloc_objs(*ids, num_ids + 1);
1433 GFP_KERNEL);
1434 if (!ids)1433 if (!ids)
1435 return ERR_PTR(-ENOMEM);1434 return ERR_PTR(-ENOMEM);
1436 1435
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
2653 struct gpio_chardev_data *cdev;2653 struct gpio_chardev_data *cdev;
2654 int ret = -ENOMEM;2654 int ret = -ENOMEM;
2655 2655
2656 cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);2656 cdev = kzalloc_obj(*cdev);
2657 if (!cdev)2657 if (!cdev)
2658 return -ENOMEM;2658 return -ENOMEM;
2659 2659
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
1178 int base = 0;1178 int base = 0;
1179 int ret;1179 int ret;
1180 1180
1181 gdev = kzalloc(sizeof(*gdev), GFP_KERNEL);1181 gdev = kzalloc_obj(*gdev);
1182 if (!gdev)1182 if (!gdev)
1183 return -ENOMEM;1183 return -ENOMEM;
1184 gc->gpiodev = gdev;1184 gc->gpiodev = gdev;
@@ -1218,7 +1218,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, · 33 unmodified lines
1218 goto err_put_device;1218 goto err_put_device;
1219 gdev->ngpio = gc->ngpio;1219 gdev->ngpio = gc->ngpio;
1220 1220
1221 gdev->descs = kcalloc(gc->ngpio, sizeof(*gdev->descs), GFP_KERNEL);1221 gdev->descs = kzalloc_objs(*gdev->descs, gc->ngpio);
1222 if (!gdev->descs) {1222 if (!gdev->descs) {
1223 ret = -ENOMEM;1223 ret = -ENOMEM;
1224 goto err_put_device;1224 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
411 if (!mm->used_scoreboard)411 if (!mm->used_scoreboard)
412 goto out_free_free_scoreboard;412 goto out_free_free_scoreboard;
413 413
414 mm->free_trees = kmalloc_array(GPU_BUDDY_MAX_FREE_TREES,414 mm->free_trees = kmalloc_objs(*mm->free_trees, GPU_BUDDY_MAX_FREE_TREES);
415 sizeof(*mm->free_trees),
416 GFP_KERNEL);
417 if (!mm->free_trees)415 if (!mm->free_trees)
418 goto out_free_used_scoreboard;416 goto out_free_used_scoreboard;
419 417
420 for_each_free_tree(i) {418 for_each_free_tree(i) {
421 mm->free_trees[i] = kmalloc_array(mm->max_order + 1,419 mm->free_trees[i] = kmalloc_objs(struct rb_root,
422 sizeof(struct rb_root),420 mm->max_order + 1);
423 GFP_KERNEL);
424 if (!mm->free_trees[i])421 if (!mm->free_trees[i])
425 goto out_free_tree;422 goto out_free_tree;
426 423
@@ -430,9 +427,7 @@ int gpu_buddy_init(struct gpu_buddy *mm, u64 size, u64 chunk_size) · 3 unmodified lines
430 427
431 mm->n_roots = hweight64(size);428 mm->n_roots = hweight64(size);
432 429
433 mm->roots = kmalloc_array(mm->n_roots,430 mm->roots = kmalloc_objs(struct gpu_buddy_block *, mm->n_roots);
434 sizeof(struct gpu_buddy_block *),
435 GFP_KERNEL);
436 if (!mm->roots)431 if (!mm->roots)
437 goto out_free_tree;432 goto out_free_tree;
438 433
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
603 ring_count++;603 ring_count++;
604 }604 }
605 if (ring_count)605 if (ring_count)
606 coredump->rings = kvcalloc(ring_count,606 coredump->rings = kvzalloc_objs(struct amdgpu_coredump_ring,
607 sizeof(struct amdgpu_coredump_ring),607 ring_count, GFP_NOWAIT);
608 GFP_NOWAIT);
609 if (coredump->rings) {608 if (coredump->rings) {
610 for (i = 0, idx = 0; i < adev->num_rings && idx < ring_count; i++) {609 for (i = 0, idx = 0; i < adev->num_rings && idx < ring_count; i++) {
611 struct amdgpu_coredump_ring *cdump_ring;610 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
1608 1608
1609 discovery_bin = adev->discovery.bin;1609 discovery_bin = adev->discovery.bin;
1610 1610
1611 early_entry = kzalloc(sizeof(*early_entry), GFP_KERNEL);1611 early_entry = kzalloc_obj(*early_entry);
1612 if (!early_entry)1612 if (!early_entry)
1613 return -ENOMEM;1613 return -ENOMEM;
1614 1614
1615 ip_top = kzalloc(sizeof(*ip_top), GFP_KERNEL);1615 ip_top = kzalloc_obj(*ip_top);
1616 if (!ip_top) {1616 if (!ip_top) {
1617 kfree(early_entry);1617 kfree(early_entry);
1618 return -ENOMEM;1618 return -ENOMEM;
drivers/gpu/drm/amd/amdgpu/amdgpu_lockdep.c+1−1
@@ -98,7 +98,7 @@ int amdgpu_lockdep_init(void) · 97 unmodified lines
98 struct amdgpu_lockdep_dummy_locks *locks;98 struct amdgpu_lockdep_dummy_locks *locks;
99 unsigned long flags;99 unsigned long flags;
100 100
101 locks = kzalloc(sizeof(*locks), GFP_KERNEL);101 locks = kzalloc_obj(*locks);
102 if (!locks)102 if (!locks)
103 return -ENOMEM;103 return -ENOMEM;
104 104
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
1293 return -ENOMEM;1293 return -ENOMEM;
1294 1294
1295 if (num_recs) {1295 if (num_recs) {
1296 records = kvcalloc(num_recs, sizeof(*records), GFP_KERNEL);1296 records = kvzalloc_objs(*records, num_recs);
1297 if (!records) {1297 if (!records) {
1298 res = -ENOMEM;1298 res = -ENOMEM;
1299 goto out;1299 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
2361 num_clear_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES);2361 num_clear_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES);
2362 num_move_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES);2362 num_move_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES);
2363 2363
2364 adev->mman.clear_entities = kcalloc(num_clear_entities,2364 adev->mman.clear_entities = kzalloc_objs(struct amdgpu_ttm_buffer_entity,
2365 sizeof(struct amdgpu_ttm_buffer_entity),2365 num_clear_entities);
2366 GFP_KERNEL);
2367 atomic_set(&adev->mman.next_clear_entity, 0);2366 atomic_set(&adev->mman.next_clear_entity, 0);
2368 if (!adev->mman.clear_entities)2367 if (!adev->mman.clear_entities)
2369 goto error_free_default_entity;2368 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
159 adev->umc.ras->ecc_info_query_ras_error_address &&159 adev->umc.ras->ecc_info_query_ras_error_address &&
160 adev->umc.max_ras_err_cnt_per_query) {160 adev->umc.max_ras_err_cnt_per_query) {
161 err_data->err_addr =161 err_data->err_addr =
162 kcalloc(adev->umc.max_ras_err_cnt_per_query,162 kzalloc_objs(struct eeprom_table_record,
163 sizeof(struct eeprom_table_record), GFP_KERNEL);163 adev->umc.max_ras_err_cnt_per_query);
164 164
165 /* still call query_ras_error_address to clear error status165 /* still call query_ras_error_address to clear error status
166 * even NOMEM error is encountered166 * 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
227 struct amdgpu_userq_fence *userq_fence;227 struct amdgpu_userq_fence *userq_fence;
228 void *entry;228 void *entry;
229 229
230 userq_fence = kmalloc(sizeof(*userq_fence), GFP_KERNEL);230 userq_fence = kmalloc_obj(*userq_fence);
231 if (!userq_fence)231 if (!userq_fence)
232 return -ENOMEM;232 return -ENOMEM;
233 233
@@ -244,9 +244,7 @@ static int amdgpu_userq_fence_alloc(struct amdgpu_usermode_queue *userq, · 10 unmodified lines
244 } while (xas_retry(&xas, entry));244 } while (xas_retry(&xas, entry));
245 rcu_read_unlock();245 rcu_read_unlock();
246 246
247 userq_fence->fence_drv_array = kvmalloc_array(xas.xa_index,247 userq_fence->fence_drv_array = kvmalloc_objs(fence_drv, xas.xa_index);
248 sizeof(fence_drv),
249 GFP_KERNEL);
250 if (!userq_fence->fence_drv_array) {248 if (!userq_fence->fence_drv_array) {
251 mutex_unlock(&userq->fence_drv_lock);249 mutex_unlock(&userq->fence_drv_lock);
252 kfree(userq_fence);250 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
316 if (align_space > AMDGPU_VIRT_RAS_BAD_PAGE_TABLE_MAX_CAPACITY)316 if (align_space > AMDGPU_VIRT_RAS_BAD_PAGE_TABLE_MAX_CAPACITY)
317 return -ENOMEM;317 return -ENOMEM;
318 318
319 new_bps = kmalloc_array(align_space, sizeof(*data->bps), GFP_KERNEL);319 new_bps = kmalloc_objs(*data->bps, align_space);
320 new_bo = kcalloc(align_space, sizeof(*data->bps_bo), GFP_KERNEL);320 new_bo = kzalloc_objs(*data->bps_bo, align_space);
321 if (!new_bps || !new_bo) {321 if (!new_bps || !new_bo) {
322 kfree(new_bps);322 kfree(new_bps);
323 kfree(new_bo);323 kfree(new_bo);
@@ -355,7 +355,7 @@ static int amdgpu_virt_init_ras_err_handler_data(struct amdgpu_device *adev) · 31 unmodified lines
355 if (!bps)355 if (!bps)
356 goto bps_failure;356 goto bps_failure;
357 357
358 bps_bo = kcalloc(align_space, sizeof(*(*data)->bps_bo), GFP_KERNEL);358 bps_bo = kzalloc_objs(*(*data)->bps_bo, align_space);
359 if (!bps_bo)359 if (!bps_bo)
360 goto bps_bo_failure;360 goto bps_bo_failure;
361 361
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
1921 struct kfd_criu_device_bucket *device_buckets = NULL;1921 struct kfd_criu_device_bucket *device_buckets = NULL;
1922 int ret = 0, i;1922 int ret = 0, i;
1923 1923
1924 device_buckets = kvcalloc(num_devices, sizeof(*device_buckets), GFP_KERNEL);1924 device_buckets = kvzalloc_objs(*device_buckets, num_devices);
1925 if (!device_buckets) {1925 if (!device_buckets) {
1926 ret = -ENOMEM;1926 ret = -ENOMEM;
1927 goto exit;1927 goto exit;
1928 }1928 }
1929 1929
1930 device_priv = kvcalloc(num_devices, sizeof(*device_priv), GFP_KERNEL);1930 device_priv = kvzalloc_objs(*device_priv, num_devices);
1931 if (!device_priv) {1931 if (!device_priv) {
1932 ret = -ENOMEM;1932 ret = -ENOMEM;
1933 goto exit;1933 goto exit;
@@ -2047,17 +2047,17 @@ static int criu_checkpoint_bos(struct kfd_process *p, · 113 unmodified lines
2047 int ret = 0, pdd_index, bo_index = 0, id;2047 int ret = 0, pdd_index, bo_index = 0, id;
2048 void *mem;2048 void *mem;
2049 2049
2050 bo_buckets = kvcalloc(num_bos, sizeof(*bo_buckets), GFP_KERNEL);2050 bo_buckets = kvzalloc_objs(*bo_buckets, num_bos);
2051 if (!bo_buckets)2051 if (!bo_buckets)
2052 return -ENOMEM;2052 return -ENOMEM;
2053 2053
2054 bo_privs = kvcalloc(num_bos, sizeof(*bo_privs), GFP_KERNEL);2054 bo_privs = kvzalloc_objs(*bo_privs, num_bos);
2055 if (!bo_privs) {2055 if (!bo_privs) {
2056 ret = -ENOMEM;2056 ret = -ENOMEM;
2057 goto exit;2057 goto exit;
2058 }2058 }
2059 2059
2060 files = kvcalloc(num_bos, sizeof(struct file *), GFP_KERNEL);2060 files = kvzalloc_objs(struct file *, num_bos);
2061 if (!files) {2061 if (!files) {
2062 ret = -ENOMEM;2062 ret = -ENOMEM;
2063 goto exit;2063 goto exit;
@@ -2588,7 +2588,7 @@ static int criu_restore_bos(struct kfd_process *p, · 524 unmodified lines
2588 if (!bo_buckets)2588 if (!bo_buckets)
2589 return -ENOMEM;2589 return -ENOMEM;
2590 2590
2591 files = kvcalloc(args->num_bos, sizeof(struct file *), GFP_KERNEL);2591 files = kvzalloc_objs(struct file *, args->num_bos);
2592 if (!files) {2592 if (!files) {
2593 ret = -ENOMEM;2593 ret = -ENOMEM;
2594 goto exit;2594 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
4180{4180{
4181 struct amdgpu_dm_connector *aconnector;4181 struct amdgpu_dm_connector *aconnector;
4182 4182
4183 aconnector = kzalloc(sizeof(*aconnector), GFP_KERNEL);4183 aconnector = kzalloc_obj(*aconnector);
4184 KUNIT_ASSERT_NOT_NULL(test, aconnector);4184 KUNIT_ASSERT_NOT_NULL(test, aconnector);
4185 4185
4186 KUNIT_ASSERT_EQ(test,4186 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
1445 struct dm_crtc_state *dm_state;1445 struct dm_crtc_state *dm_state;
1446 1446
1447 /* destroy_state kfree()s the state, so use a plain (unmanaged) alloc. */1447 /* 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);
1449 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dm_state);1449 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dm_state);
1450 1450
1451 amdgpu_dm_crtc_destroy_state(NULL, &dm_state->base);1451 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
1475 kref_get(&stream->refcount);1475 kref_get(&stream->refcount);
1476 1476
1477 /* destroy_state kfree()s the state, so use a plain (unmanaged) alloc. */1477 /* 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);
1479 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dm_state);1479 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dm_state);
1480 dm_state->stream = stream;1480 dm_state->stream = stream;
1481 1481
@@ -1569,7 +1569,7 @@ static void dm_test_crtc_handle_vblank_completes_cursor_only(struct kunit *test) · 87 unmodified lines
1569 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, acrtc);1569 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, acrtc);
1570 1570
1571 /* drm_crtc_send_vblank_event() consumes (kfree()s) the event. */1571 /* drm_crtc_send_vblank_event() consumes (kfree()s) the event. */
1572 event = kzalloc_obj(*event, GFP_KERNEL);1572 event = kzalloc_obj(*event);
1573 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, event);1573 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, event);
1574 1574
1575 acrtc->base.dev = &adev->ddev;1575 acrtc->base.dev = &adev->ddev;
@@ -1628,7 +1628,7 @@ dm_test_vblank_control_worker_setup(struct kunit *test, bool enable, · 52 unmodified lines
1628 kref_get(&stream->refcount);1628 kref_get(&stream->refcount);
1629 1629
1630 /* Worker kfree()s the work item, so it must be a plain allocation. */1630 /* 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);
1632 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, work);1632 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, work);
1633 work->dm = &adev->dm;1633 work->dm = &adev->dm;
1634 work->acrtc = acrtc;1634 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
103 */103 */
104static struct dc_sink *dm_test_sink_create(struct dc_link *link)104static struct dc_sink *dm_test_sink_create(struct dc_link *link)
105{105{
106 struct dc_sink *sink = kzalloc(sizeof(*sink), GFP_KERNEL);106 struct dc_sink *sink = kzalloc_obj(*sink);
107 107
108 if (!sink)108 if (!sink)
109 return NULL;109 return NULL;
@@ -2131,7 +2131,7 @@ static void dm_test_hpd_rx_offload_work_no_connector(struct kunit *test) · 2021 unmodified lines
2131 offload_wq = kunit_kzalloc(test, sizeof(*offload_wq), GFP_KERNEL);2131 offload_wq = kunit_kzalloc(test, sizeof(*offload_wq), GFP_KERNEL);
2132 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_wq);2132 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_wq);
2133 2133
2134 offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL);2134 offload_work = kzalloc_obj(*offload_work);
2135 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);2135 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);
2136 offload_work->offload_wq = offload_wq;2136 offload_work->offload_wq = offload_wq;
2137 offload_work->adev = adev;2137 offload_work->adev = adev;
@@ -2177,7 +2177,7 @@ static void dm_test_hpd_rx_offload_work_no_connection(struct kunit *test) · 39 unmodified lines
2177 link->dc = dc;2177 link->dc = dc;
2178 aconn->dc_link = link;2178 aconn->dc_link = link;
2179 2179
2180 offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL);2180 offload_work = kzalloc_obj(*offload_work);
2181 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);2181 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);
2182 offload_work->offload_wq = offload_wq;2182 offload_work->offload_wq = offload_wq;
2183 offload_work->adev = adev;2183 offload_work->adev = adev;
@@ -2244,7 +2244,7 @@ static void dm_test_hpd_rx_offload_work_automated_test(struct kunit *test) · 60 unmodified lines
2244 link->connector_signal = SIGNAL_TYPE_DISPLAY_PORT;2244 link->connector_signal = SIGNAL_TYPE_DISPLAY_PORT;
2245 aconn->dc_link = link;2245 aconn->dc_link = link;
2246 2246
2247 offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL);2247 offload_work = kzalloc_obj(*offload_work);
2248 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);2248 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);
2249 offload_work->offload_wq = offload_wq;2249 offload_work->offload_wq = offload_wq;
2250 offload_work->adev = adev;2250 offload_work->adev = adev;
@@ -2315,7 +2315,7 @@ static void dm_test_hpd_rx_offload_work_link_loss(struct kunit *test) · 64 unmodified lines
2315 link->connector_signal = SIGNAL_TYPE_DISPLAY_PORT;2315 link->connector_signal = SIGNAL_TYPE_DISPLAY_PORT;
2316 aconn->dc_link = link;2316 aconn->dc_link = link;
2317 2317
2318 offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL);2318 offload_work = kzalloc_obj(*offload_work);
2319 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);2319 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work);
2320 offload_work->offload_wq = offload_wq;2320 offload_work->offload_wq = offload_wq;
2321 offload_work->adev = adev;2321 offload_work->adev = adev;
@@ -3452,9 +3452,9 @@ static void dm_test_handle_hpd_work_out_of_range(struct kunit *test) · 1130 unmodified lines
3452 struct amdgpu_device *adev;3452 struct amdgpu_device *adev;
3453 3453
3454 adev = dm_kunit_alloc_adev(test);3454 adev = dm_kunit_alloc_adev(test);
3455 hpd_work = kzalloc(sizeof(*hpd_work), GFP_KERNEL);3455 hpd_work = kzalloc_obj(*hpd_work);
3456 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hpd_work);3456 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);
3458 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hpd_work->dmub_notify);3458 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hpd_work->dmub_notify);
3459 hpd_work->dmub_notify->type =3459 hpd_work->dmub_notify->type =
3460 (enum dmub_notification_type)ARRAY_SIZE(adev->dm.dmub_callback);3460 (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
3899 kref_get(&stream->refcount);3899 kref_get(&stream->refcount);
3900 3900
3901 /* The worker kfree()s both, so they must come from the slab. */3901 /* The worker kfree()s both, so they must come from the slab. */
3902 work = kzalloc(sizeof(*work), GFP_KERNEL);3902 work = kzalloc_obj(*work);
3903 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, work);3903 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, work);
3904 adjust = kzalloc(sizeof(*adjust), GFP_KERNEL);3904 adjust = kzalloc_obj(*adjust);
3905 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adjust);3905 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adjust);
3906 3906
3907 work->adev = adev;3907 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
2945 * destroy-existing-state path. The destroy hook frees this state, so it2945 * destroy-existing-state path. The destroy hook frees this state, so it
2946 * must be a plain (non-KUnit-managed) allocation.2946 * must be a plain (non-KUnit-managed) allocation.
2947 */2947 */
2948 old_state = kzalloc(sizeof(*old_state), GFP_KERNEL);2948 old_state = kzalloc_obj(*old_state);
2949 KUNIT_ASSERT_NOT_NULL(test, old_state);2949 KUNIT_ASSERT_NOT_NULL(test, old_state);
2950 plane->funcs = &dm_test_plane_reset_funcs;2950 plane->funcs = &dm_test_plane_reset_funcs;
2951 plane->state = &old_state->base;2951 plane->state = &old_state->base;
@@ -3018,7 +3018,7 @@ static void dm_test_plane_destroy_state_minimal(struct kunit *test) · 66 unmodified lines
3018 KUNIT_ASSERT_NOT_NULL(test, plane);3018 KUNIT_ASSERT_NOT_NULL(test, plane);
3019 3019
3020 /* destroy_state frees the state itself, so use a plain allocation. */3020 /* 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);
3022 KUNIT_ASSERT_NOT_NULL(test, dm_plane_state);3022 KUNIT_ASSERT_NOT_NULL(test, dm_plane_state);
3023 3023
3024 amdgpu_dm_plane_drm_plane_destroy_state(plane, &dm_plane_state->base);3024 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
239 * Use kzalloc(), not kunit_kzalloc(): dm_atomic_destroy_state() frees239 * Use kzalloc(), not kunit_kzalloc(): dm_atomic_destroy_state() frees
240 * the state itself, so KUnit-managed memory would be double-freed.240 * the state itself, so KUnit-managed memory would be double-freed.
241 */241 */
242 dm_state = kzalloc(sizeof(*dm_state), GFP_KERNEL);242 dm_state = kzalloc_obj(*dm_state);
243 KUNIT_ASSERT_NOT_NULL(test, dm_state);243 KUNIT_ASSERT_NOT_NULL(test, dm_state);
244 244
245 /* context == NULL: dc_state_release() is skipped and the state is freed. */245 /* 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
377 }377 }
378 break;378 break;
379 case AMDGPU_FAMILY_GC_11_5_4: {379 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);
381 381
382 if (clk_mgr == NULL) {382 if (clk_mgr == NULL) {
383 BREAK_TO_DEBUGGER();383 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
1595 struct dccg *dccg)1595 struct dccg *dccg)
1596{1596{
1597 struct clk_log_info log_info = {0};1597 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);
1599 struct clk_mgr_internal *clk_mgr;1599 struct clk_mgr_internal *clk_mgr;
1600 1600
1601 if (!clk_mgr60)1601 if (!clk_mgr60)
@@ -1644,7 +1644,7 @@ struct clk_mgr_internal *dcn60_clk_mgr_construct( · 42 unmodified lines
1644 1644
1645 clk_mgr->smu_present = false;1645 clk_mgr->smu_present = false;
1646 1646
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);
1648 if (!clk_mgr->base.bw_params)1648 if (!clk_mgr->base.bw_params)
1649 goto fail;1649 goto fail;
1650 1650
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
914 unsigned int i;914 unsigned int i;
915 915
916 for (i = 0; i < ARRAY_SIZE(dc->update_scratch_pool); i++) {916 for (i = 0; i < ARRAY_SIZE(dc->update_scratch_pool); i++) {
917 dc->update_scratch_pool[i] = kzalloc(917 dc->update_scratch_pool[i] = kzalloc_obj(struct dc_update_scratch_space);
918 sizeof(struct dc_update_scratch_space), GFP_KERNEL);
919 if (!dc->update_scratch_pool[i])918 if (!dc->update_scratch_pool[i])
920 return false;919 return false;
921 dc->update_scratch_in_use[i] = false;920 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
290 290
291struct dc_plane_cm *dc_plane_cm_create(void)291struct dc_plane_cm *dc_plane_cm_create(void)
292{292{
293 struct dc_plane_cm *cm = kvzalloc(sizeof(*cm), GFP_KERNEL);293 struct dc_plane_cm *cm = kvzalloc_obj(*cm);
294 294
295 if (cm == NULL)295 if (cm == NULL)
296 goto alloc_fail;296 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
358 const struct dccg_shift *dccg_shift,358 const struct dccg_shift *dccg_shift,
359 const struct dccg_mask *dccg_mask)359 const struct dccg_mask *dccg_mask)
360{360{
361 struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL);361 struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn);
362 struct dccg *base;362 struct dccg *base;
363 363
364 if (dccg_dcn == NULL) {364 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
167 const struct dccg_shift *dccg_shift,167 const struct dccg_shift *dccg_shift,
168 const struct dccg_mask *dccg_mask)168 const struct dccg_mask *dccg_mask)
169{169{
170 struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL);170 struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn);
171 struct dccg *base;171 struct dccg *base;
172 172
173 if (dccg_dcn == NULL) {173 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
542 *hw_ddc = NULL;542 *hw_ddc = NULL;
543 }543 }
544 544
545 *hw_ddc = kzalloc(sizeof(struct hw_ddc), GFP_KERNEL);545 *hw_ddc = kzalloc_obj(struct hw_ddc);
546 if (!*hw_ddc) {546 if (!*hw_ddc) {
547 ASSERT_CRITICAL(false);547 ASSERT_CRITICAL(false);
548 return;548 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
405 405
406struct irq_service *dal_irq_service_dcn42_create(struct irq_service_init_data *init_data)406struct irq_service *dal_irq_service_dcn42_create(struct irq_service_init_data *init_data)
407{407{
408 struct irq_service *irq_service = kzalloc(sizeof(*irq_service), GFP_KERNEL);408 struct irq_service *irq_service = kzalloc_obj(*irq_service);
409 409
410 if (!irq_service)410 if (!irq_service)
411 return NULL;411 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
406struct irq_service *dal_irq_service_dcn60_create(406struct irq_service *dal_irq_service_dcn60_create(
407 struct irq_service_init_data *init_data)407 struct irq_service_init_data *init_data)
408{408{
409 struct irq_service *irq_service = kzalloc(sizeof(*irq_service),409 struct irq_service *irq_service = kzalloc_obj(*irq_service);
410 GFP_KERNEL);
411 410
412 if (!irq_service)411 if (!irq_service)
413 return NULL;412 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
615 const struct pg_cntl_shift *pg_cntl_shift,615 const struct pg_cntl_shift *pg_cntl_shift,
616 const struct pg_cntl_mask *pg_cntl_mask)616 const struct pg_cntl_mask *pg_cntl_mask)
617{617{
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);
619 struct pg_cntl *base;619 struct pg_cntl *base;
620 620
621 if (pg_cntl_dcn == NULL) {621 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
1135 }1135 }
1136 1136
1137 /* allocate HPO stream encoder and create VPG sub-block */1137 /* 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);
1139 vpg = dcn30_vpg_create(ctx, vpg_inst);1139 vpg = dcn30_vpg_create(ctx, vpg_inst);
1140 afmt = dcn30_afmt_create(ctx, afmt_inst);1140 afmt = dcn30_afmt_create(ctx, afmt_inst);
1141 1141
@@ -1166,7 +1166,7 @@ static struct hpo_frl_link_encoder *dcn30_hpo_frl_link_encoder_create(enum engin · 24 unmodified lines
1166 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));1166 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
1167 1167
1168 /* allocate HPO link encoder */1168 /* 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);
1170 if (!hpo_enc3)1170 if (!hpo_enc3)
1171 return NULL; /* out of memory */1171 return NULL; /* out of memory */
1172 1172
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
492 return NULL;492 return NULL;
493 493
494 /* allocate HPO stream encoder and create VPG sub-block */494 /* 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);
496 vpg = dcn302_vpg_create(ctx, vpg_inst);496 vpg = dcn302_vpg_create(ctx, vpg_inst);
497 afmt = dcn302_afmt_create(ctx, afmt_inst);497 afmt = dcn302_afmt_create(ctx, afmt_inst);
498 498
@@ -531,7 +531,7 @@ static struct hpo_frl_link_encoder *dcn302_hpo_frl_link_encoder_create(enum engi · 32 unmodified lines
531 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));531 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
532 532
533 /* allocate HPO link encoder */533 /* 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);
535 if (!hpo_enc3)535 if (!hpo_enc3)
536 return NULL; /* out of memory */536 return NULL; /* out of memory */
537 537
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
479 return NULL;479 return NULL;
480 480
481 /* allocate HPO stream encoder and create VPG sub-block */481 /* 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);
483 vpg = dcn303_vpg_create(ctx, vpg_inst);483 vpg = dcn303_vpg_create(ctx, vpg_inst);
484 afmt = dcn303_afmt_create(ctx, afmt_inst);484 afmt = dcn303_afmt_create(ctx, afmt_inst);
485 485
@@ -518,7 +518,7 @@ static struct hpo_frl_link_encoder *dcn303_hpo_frl_link_encoder_create(enum engi · 32 unmodified lines
518 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));518 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
519 519
520 /* allocate HPO link encoder */520 /* 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);
522 if (!hpo_enc3)522 if (!hpo_enc3)
523 return NULL; /* out of memory */523 return NULL; /* out of memory */
524 524
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
1346 }1346 }
1347 1347
1348 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */1348 /* 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);
1350 vpg = dcn31_vpg_create(ctx, vpg_inst);1350 vpg = dcn31_vpg_create(ctx, vpg_inst);
1351 afmt = dcn31_afmt_create(ctx, afmt_inst);1351 afmt = dcn31_afmt_create(ctx, afmt_inst);
1352 1352
@@ -1377,7 +1377,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin · 24 unmodified lines
1377 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));1377 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
1378 1378
1379 /* allocate HPO link encoder */1379 /* 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);
1381 if (!hpo_enc3)1381 if (!hpo_enc3)
1382 return NULL; /* out of memory */1382 return NULL; /* out of memory */
1383 1383
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
1404 }1404 }
1405 1405
1406 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */1406 /* 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);
1408 vpg = dcn31_vpg_create(ctx, vpg_inst);1408 vpg = dcn31_vpg_create(ctx, vpg_inst);
1409 afmt = dcn31_afmt_create(ctx, afmt_inst);1409 afmt = dcn31_afmt_create(ctx, afmt_inst);
1410 1410
@@ -1436,7 +1436,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin · 25 unmodified lines
1436 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));1436 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
1437 1437
1438 /* allocate HPO link encoder */1438 /* 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);
1440 if (!hpo_enc3)1440 if (!hpo_enc3)
1441 return NULL; /* out of memory */1441 return NULL; /* out of memory */
1442 1442
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
1347 }1347 }
1348 1348
1349 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */1349 /* 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);
1351 vpg = dcn31_vpg_create(ctx, vpg_inst);1351 vpg = dcn31_vpg_create(ctx, vpg_inst);
1352 afmt = dcn31_afmt_create(ctx, afmt_inst);1352 afmt = dcn31_afmt_create(ctx, afmt_inst);
1353 1353
@@ -1379,7 +1379,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin · 25 unmodified lines
1379 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));1379 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
1380 1380
1381 /* allocate HPO link encoder */1381 /* 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);
1383 if (!hpo_enc3)1383 if (!hpo_enc3)
1384 return NULL; /* out of memory */1384 return NULL; /* out of memory */
1385 1385
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
1340 }1340 }
1341 1341
1342 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */1342 /* 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);
1344 vpg = dcn31_vpg_create(ctx, vpg_inst);1344 vpg = dcn31_vpg_create(ctx, vpg_inst);
1345 afmt = dcn31_afmt_create(ctx, afmt_inst);1345 afmt = dcn31_afmt_create(ctx, afmt_inst);
1346 1346
@@ -1372,7 +1372,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin · 25 unmodified lines
1372 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));1372 ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1));
1373 1373
1374 /* allocate HPO link encoder */1374 /* 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);
1376 if (!hpo_enc3)1376 if (!hpo_enc3)
1377 return NULL; /* out of memory */1377 return NULL; /* out of memory */
1378 1378
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
1339 }1339 }
1340 1340
1341 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */1341 /* 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);
1343 vpg = dcn32_vpg_create(ctx, vpg_inst);1343 vpg = dcn32_vpg_create(ctx, vpg_inst);
1344 afmt = dcn32_afmt_create(ctx, afmt_inst);1344 afmt = dcn32_afmt_create(ctx, afmt_inst);
1345 1345
@@ -1375,7 +1375,7 @@ static struct hpo_frl_link_encoder *dcn32_hpo_frl_link_encoder_create(enum engin · 29 unmodified lines
1375 hpo_frl_link_encoder_reg_list(0);1375 hpo_frl_link_encoder_reg_list(0);
1376 1376
1377 /* allocate HPO link encoder */1377 /* 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);
1379 if (!hpo_enc3)1379 if (!hpo_enc3)
1380 return NULL; /* out of memory */1380 return NULL; /* out of memory */
1381 1381
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
1314 }1314 }
1315 1315
1316 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */1316 /* 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);
1318 vpg = dcn321_vpg_create(ctx, vpg_inst);1318 vpg = dcn321_vpg_create(ctx, vpg_inst);
1319 afmt = dcn321_afmt_create(ctx, afmt_inst);1319 afmt = dcn321_afmt_create(ctx, afmt_inst);
1320 1320
@@ -1350,7 +1350,7 @@ static struct hpo_frl_link_encoder *dcn321_hpo_frl_link_encoder_create(enum engi · 29 unmodified lines
1350 hpo_frl_link_encoder_reg_list(0);1350 hpo_frl_link_encoder_reg_list(0);
1351 1351
1352 /* allocate HPO link encoder */1352 /* 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);
1354 if (!hpo_enc3)1354 if (!hpo_enc3)
1355 return NULL; /* out of memory */1355 return NULL; /* out of memory */
1356 1356
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
1398 return NULL;1398 return NULL;
1399 1399
1400 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */1400 /* 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);
1402 vpg = dcn31_vpg_create(ctx, vpg_inst);1402 vpg = dcn31_vpg_create(ctx, vpg_inst);
1403 afmt = dcn31_afmt_create(ctx, afmt_inst);1403 afmt = dcn31_afmt_create(ctx, afmt_inst);
1404 1404
@@ -1430,7 +1430,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create( · 25 unmodified lines
1430 hpo_frl_link_encoder_reg_list(0);1430 hpo_frl_link_encoder_reg_list(0);
1431 1431
1432 /* allocate HPO link encoder */1432 /* 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);
1434 if (!hpo_enc3)1434 if (!hpo_enc3)
1435 return NULL; /* out of memory */1435 return NULL; /* out of memory */
1436 1436
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
1378 return NULL;1378 return NULL;
1379 1379
1380 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */1380 /* 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);
1382 vpg = dcn31_vpg_create(ctx, vpg_inst);1382 vpg = dcn31_vpg_create(ctx, vpg_inst);
1383 afmt = dcn31_afmt_create(ctx, afmt_inst);1383 afmt = dcn31_afmt_create(ctx, afmt_inst);
1384 1384
@@ -1410,7 +1410,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create( · 25 unmodified lines
1410 hpo_frl_link_encoder_reg_list(0);1410 hpo_frl_link_encoder_reg_list(0);
1411 1411
1412 /* allocate HPO link encoder */1412 /* 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);
1414 if (!hpo_enc3)1414 if (!hpo_enc3)
1415 return NULL; /* out of memory */1415 return NULL; /* out of memory */
1416 1416
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
1385 return NULL;1385 return NULL;
1386 1386
1387 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */1387 /* 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);
1389 vpg = dcn31_vpg_create(ctx, vpg_inst);1389 vpg = dcn31_vpg_create(ctx, vpg_inst);
1390 afmt = dcn31_afmt_create(ctx, afmt_inst);1390 afmt = dcn31_afmt_create(ctx, afmt_inst);
1391 1391
@@ -1417,7 +1417,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create( · 25 unmodified lines
1417 hpo_frl_link_encoder_reg_list(0);1417 hpo_frl_link_encoder_reg_list(0);
1418 1418
1419 /* allocate HPO link encoder */1419 /* 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);
1421 if (!hpo_enc3)1421 if (!hpo_enc3)
1422 return NULL; /* out of memory */1422 return NULL; /* out of memory */
1423 1423
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
1322 return NULL;1322 return NULL;
1323 1323
1324 /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */1324 /* 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);
1326 vpg = dcn401_vpg_create(ctx, vpg_inst);1326 vpg = dcn401_vpg_create(ctx, vpg_inst);
1327 afmt = dcn401_afmt_create(ctx, afmt_inst);1327 afmt = dcn401_afmt_create(ctx, afmt_inst);
1328 1328
@@ -1353,7 +1353,7 @@ static struct hpo_frl_link_encoder *dcn401_hpo_frl_link_encoder_create( · 24 unmodified lines
1353 hpo_frl_link_encoder_reg_list(0);1353 hpo_frl_link_encoder_reg_list(0);
1354 1354
1355 /* allocate HPO link encoder */1355 /* 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);
1357 if (!hpo_link_enc)1357 if (!hpo_link_enc)
1358 return NULL; /* out of memory */1358 return NULL; /* out of memory */
1359 1359
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
818 uint32_t inst)818 uint32_t inst)
819{819{
820 struct aux_engine_dce110 *aux_engine =820 struct aux_engine_dce110 *aux_engine =
821 kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL);821 kzalloc_obj(struct aux_engine_dce110);
822 822
823 if (!aux_engine)823 if (!aux_engine)
824 return NULL;824 return NULL;
@@ -884,7 +884,7 @@ static struct dce_i2c_hw *dcn42_i2c_hw_create( · 59 unmodified lines
884 uint32_t inst)884 uint32_t inst)
885{885{
886 struct dce_i2c_hw *dce_i2c_hw =886 struct dce_i2c_hw *dce_i2c_hw =
887 kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL);887 kzalloc_obj(struct dce_i2c_hw);
888 888
889 if (!dce_i2c_hw)889 if (!dce_i2c_hw)
890 return NULL;890 return NULL;
@@ -910,7 +910,7 @@ static struct clock_source *dcn42_clock_source_create( · 19 unmodified lines
910 bool dp_clk_src)910 bool dp_clk_src)
911{911{
912 struct dce110_clk_src *clk_src =912 struct dce110_clk_src *clk_src =
913 kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);913 kzalloc_obj(struct dce110_clk_src);
914 914
915 if (!clk_src)915 if (!clk_src)
916 return NULL;916 return NULL;
@@ -929,8 +929,7 @@ static struct hubbub *dcn42_hubbub_create(struct dc_context *ctx) · 12 unmodified lines
929{929{
930 int i;930 int i;
931 931
932 struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub),932 struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub);
933 GFP_KERNEL);
934 933
935 if (!hubbub3)934 if (!hubbub3)
936 return NULL;935 return NULL;
@@ -983,7 +982,7 @@ static struct hubp *dcn42_hubp_create( · 46 unmodified lines
983 uint32_t inst)982 uint32_t inst)
984{983{
985 struct dcn20_hubp *hubp2 =984 struct dcn20_hubp *hubp2 =
986 kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL);985 kzalloc_obj(struct dcn20_hubp);
987 986
988 if (!hubp2)987 if (!hubp2)
989 return NULL;988 return NULL;
@@ -1025,7 +1024,7 @@ static struct dpp *dcn42_dpp_create( · 35 unmodified lines
1025 uint32_t inst)1024 uint32_t inst)
1026{1025{
1027 struct dcn42_dpp *dpp42 =1026 struct dcn42_dpp *dpp42 =
1028 kzalloc(sizeof(struct dcn42_dpp), GFP_KERNEL);1027 kzalloc_obj(struct dcn42_dpp);
1029 1028
1030 if (!dpp42)1029 if (!dpp42)
1031 return NULL;1030 return NULL;
@@ -1051,8 +1050,7 @@ static struct mpc *dcn42_mpc_create( · 19 unmodified lines
1051 int num_mpcc,1050 int num_mpcc,
1052 int num_rmu)1051 int num_rmu)
1053{1052{
1054 struct dcn42_mpc *mpc401 = kzalloc(sizeof(struct dcn42_mpc),1053 struct dcn42_mpc *mpc401 = kzalloc_obj(struct dcn42_mpc);
1055 GFP_KERNEL);
1056 1054
1057 if (!mpc401)1055 if (!mpc401)
1058 return NULL;1056 return NULL;
@@ -1075,7 +1073,7 @@ static struct output_pixel_processor *dcn42_opp_create( · 16 unmodified lines
1075 struct dc_context *ctx, uint32_t inst)1073 struct dc_context *ctx, uint32_t inst)
1076{1074{
1077 struct dcn20_opp *opp4 =1075 struct dcn20_opp *opp4 =
1078 kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL);1076 kzalloc_obj(struct dcn20_opp);
1079 1077
1080 if (!opp4) {1078 if (!opp4) {
1081 BREAK_TO_DEBUGGER();1079 BREAK_TO_DEBUGGER();
@@ -1098,7 +1096,7 @@ static struct timing_generator *dcn42_timing_generator_create( · 16 unmodified lines
1098 uint32_t instance)1096 uint32_t instance)
1099{1097{
1100 struct optc *tgn10 =1098 struct optc *tgn10 =
1101 kzalloc(sizeof(struct optc), GFP_KERNEL);1099 kzalloc_obj(struct optc);
1102 1100
1103 if (!tgn10)1101 if (!tgn10)
1104 return NULL;1102 return NULL;
@@ -1136,7 +1134,7 @@ static struct link_encoder *dcn42_link_encoder_create( · 31 unmodified lines
1136 const struct encoder_init_data *enc_init_data)1134 const struct encoder_init_data *enc_init_data)
1137{1135{
1138 struct dcn20_link_encoder *enc20 =1136 struct dcn20_link_encoder *enc20 =
1139 kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);1137 kzalloc_obj(struct dcn20_link_encoder);
1140 1138
1141 if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs))1139 if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs))
1142 return NULL;1140 return NULL;
@@ -1202,7 +1200,7 @@ static struct vpg *dcn42_vpg_create( · 59 unmodified lines
1202 struct dc_context *ctx,1200 struct dc_context *ctx,
1203 uint32_t inst)1201 uint32_t inst)
1204{1202{
1205 struct dcn31_vpg *vpg4 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL);1203 struct dcn31_vpg *vpg4 = kzalloc_obj(struct dcn31_vpg);
1206 1204
1207 if (!vpg4)1205 if (!vpg4)
1208 return NULL;1206 return NULL;
@@ -1231,7 +1229,7 @@ static struct apg *dcn42_apg_create( · 22 unmodified lines
1231 struct dc_context *ctx,1229 struct dc_context *ctx,
1232 uint32_t inst)1230 uint32_t inst)
1233{1231{
1234 struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL);1232 struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg);
1235 1233
1236 if (!apg31)1234 if (!apg31)
1237 return NULL;1235 return NULL;
@@ -1275,7 +1273,7 @@ static struct stream_encoder *dcn42_stream_encoder_create( · 37 unmodified lines
1275 } else1273 } else
1276 return NULL;1274 return NULL;
1277 1275
1278 enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL);1276 enc1 = kzalloc_obj(struct dcn10_stream_encoder);
1279 vpg = dcn42_vpg_create(ctx, vpg_inst);1277 vpg = dcn42_vpg_create(ctx, vpg_inst);
1280 apg = dcn42_apg_create(ctx, apg_inst);1278 apg = dcn42_apg_create(ctx, apg_inst);
1281 1279
@@ -1325,7 +1323,7 @@ static struct hpo_frl_stream_encoder *dcn42_hpo_frl_stream_encoder_create( · 43 unmodified lines
1325 return NULL;1323 return NULL;
1326 1324
1327 /* allocate HPO stream encoder and create VPG sub-block */1325 /* 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);
1329 vpg = dcn42_vpg_create(ctx, vpg_inst);1327 vpg = dcn42_vpg_create(ctx, vpg_inst);
1330 apg = dcn42_apg_create(ctx, apg_inst);1328 apg = dcn42_apg_create(ctx, apg_inst);
1331 1329
@@ -1357,7 +1355,7 @@ static struct hpo_frl_link_encoder *dcn42_hpo_frl_link_encoder_create( · 25 unmodified lines
1357 hpo_frl_link_encoder_reg_list(0);1355 hpo_frl_link_encoder_reg_list(0);
1358 1356
1359 /* allocate HPO link encoder */1357 /* 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);
1361 if (!hpo_link_enc)1359 if (!hpo_link_enc)
1362 return NULL; /* out of memory */1360 return NULL; /* out of memory */
1363 1361
@@ -1399,7 +1397,7 @@ static struct hpo_dp_stream_encoder *dcn42_hpo_dp_stream_encoder_create( · 35 unmodified lines
1399 apg_inst = hpo_dp_inst + 5;1397 apg_inst = hpo_dp_inst + 5;
1400 1398
1401 /* allocate HPO stream encoder and create VPG sub-block */1399 /* 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);
1403 vpg = dcn42_vpg_create(ctx, vpg_inst);1401 vpg = dcn42_vpg_create(ctx, vpg_inst);
1404 apg = dcn42_apg_create(ctx, apg_inst);1402 apg = dcn42_apg_create(ctx, apg_inst);
1405 1403
@@ -1432,7 +1430,7 @@ static struct hpo_dp_link_encoder *dcn42_hpo_dp_link_encoder_create( · 26 unmodified lines
1432 struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31;1430 struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31;
1433 1431
1434 /* allocate HPO link encoder */1432 /* 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);
1436 if (!hpo_dp_enc31)1434 if (!hpo_dp_enc31)
1437 return NULL; /* out of memory */1435 return NULL; /* out of memory */
1438 1436
@@ -1453,7 +1451,7 @@ static struct hpo_dp_link_encoder *dcn42_hpo_dp_link_encoder_create( · 14 unmodified lines
1453static struct dce_hwseq *dcn42_hwseq_create(1451static struct dce_hwseq *dcn42_hwseq_create(
1454 struct dc_context *ctx)1452 struct dc_context *ctx)
1455{1453{
1456 struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);1454 struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq);
1457 1455
1458#undef REG_STRUCT1456#undef REG_STRUCT
1459#define REG_STRUCT hwseq_reg1457#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
1727 uint32_t dwb_count = pool->res_cap->num_dwb;1725 uint32_t dwb_count = pool->res_cap->num_dwb;
1728 1726
1729 for (i = 0; i < dwb_count; i++) {1727 for (i = 0; i < dwb_count; i++) {
1730 struct dcn30_dwbc *dwbc42 = kzalloc(sizeof(struct dcn30_dwbc),1728 struct dcn30_dwbc *dwbc42 = kzalloc_obj(struct dcn30_dwbc);
1731 GFP_KERNEL);
1732 1729
1733 if (!dwbc42) {1730 if (!dwbc42) {
1734 dm_error("DC: failed to create dwbc42!\n");1731 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
1764 uint32_t pipe_count = pool->res_cap->num_dwb;1761 uint32_t pipe_count = pool->res_cap->num_dwb;
1765 1762
1766 for (i = 0; i < pipe_count; i++) {1763 for (i = 0; i < pipe_count; i++) {
1767 struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub),1764 struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub);
1768 GFP_KERNEL);
1769 1765
1770 if (!mcif_wb30) {1766 if (!mcif_wb30) {
1771 dm_error("DC: failed to create mcif_wb30!\n");1767 dm_error("DC: failed to create mcif_wb30!\n");
@@ -1793,7 +1789,7 @@ static struct display_stream_compressor *dcn42_dsc_create( · 21 unmodified lines
1793 struct dc_context *ctx, uint32_t inst)1789 struct dc_context *ctx, uint32_t inst)
1794{1790{
1795 struct dcn401_dsc *dsc =1791 struct dcn401_dsc *dsc =
1796 kzalloc(sizeof(struct dcn401_dsc), GFP_KERNEL);1792 kzalloc_obj(struct dcn401_dsc);
1797 1793
1798 if (!dsc) {1794 if (!dsc) {
1799 BREAK_TO_DEBUGGER();1795 BREAK_TO_DEBUGGER();
@@ -1890,7 +1886,7 @@ static struct link_encoder *dcn42_link_enc_create_minimal( · 90 unmodified lines
1890 if ((unsigned int)(eng_id - ENGINE_ID_DIGA) >= ctx->dc->res_pool->res_cap->num_dig_link_enc)1886 if ((unsigned int)(eng_id - ENGINE_ID_DIGA) >= ctx->dc->res_pool->res_cap->num_dig_link_enc)
1891 return NULL;1887 return NULL;
1892 1888
1893 enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);1889 enc20 = kzalloc_obj(struct dcn20_link_encoder);
1894 if (!enc20)1890 if (!enc20)
1895 return NULL;1891 return NULL;
1896 1892
@@ -2441,7 +2437,7 @@ struct resource_pool *dcn42_create_resource_pool( · 544 unmodified lines
2441 struct dc *dc)2437 struct dc *dc)
2442{2438{
2443 struct dcn42_resource_pool *pool =2439 struct dcn42_resource_pool *pool =
2444 kzalloc(sizeof(struct dcn42_resource_pool), GFP_KERNEL);2440 kzalloc_obj(struct dcn42_resource_pool);
2445 2441
2446 if (!pool)2442 if (!pool)
2447 return NULL;2443 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
870 uint32_t inst)870 uint32_t inst)
871{871{
872 struct aux_engine_dce110 *aux_engine =872 struct aux_engine_dce110 *aux_engine =
873 kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL);873 kzalloc_obj(struct aux_engine_dce110);
874 874
875 if (!aux_engine)875 if (!aux_engine)
876 return NULL;876 return NULL;
@@ -940,7 +940,7 @@ static struct dce_i2c_hw *dcn42b_i2c_hw_create( · 63 unmodified lines
940 uint32_t inst)940 uint32_t inst)
941{941{
942 struct dce_i2c_hw *dce_i2c_hw =942 struct dce_i2c_hw *dce_i2c_hw =
943 kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL);943 kzalloc_obj(struct dce_i2c_hw);
944 944
945 if (!dce_i2c_hw)945 if (!dce_i2c_hw)
946 return NULL;946 return NULL;
@@ -968,7 +968,7 @@ static struct clock_source *dcn42b_clock_source_create( · 21 unmodified lines
968 bool dp_clk_src)968 bool dp_clk_src)
969{969{
970 struct dce110_clk_src *clk_src =970 struct dce110_clk_src *clk_src =
971 kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);971 kzalloc_obj(struct dce110_clk_src);
972 972
973 if (!clk_src)973 if (!clk_src)
974 return NULL;974 return NULL;
@@ -988,8 +988,7 @@ static struct hubbub *dcn42b_hubbub_create(struct dc_context *ctx) · 13 unmodified lines
988{988{
989 int i;989 int i;
990 990
991 struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub),991 struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub);
992 GFP_KERNEL);
993 992
994 if (!hubbub3)993 if (!hubbub3)
995 return NULL;994 return NULL;
@@ -1042,7 +1041,7 @@ static struct hubp *dcn42b_hubp_create( · 46 unmodified lines
1042 uint32_t inst)1041 uint32_t inst)
1043{1042{
1044 struct dcn20_hubp *hubp2 =1043 struct dcn20_hubp *hubp2 =
1045 kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL);1044 kzalloc_obj(struct dcn20_hubp);
1046 1045
1047 if (!hubp2)1046 if (!hubp2)
1048 return NULL;1047 return NULL;
@@ -1084,7 +1083,7 @@ static struct dpp *dcn42b_dpp_create( · 35 unmodified lines
1084 uint32_t inst)1083 uint32_t inst)
1085{1084{
1086 struct dcn42_dpp *dpp42b =1085 struct dcn42_dpp *dpp42b =
1087 kzalloc(sizeof(struct dcn42_dpp), GFP_KERNEL);1086 kzalloc_obj(struct dcn42_dpp);
1088 1087
1089 if (!dpp42b)1088 if (!dpp42b)
1090 return NULL;1089 return NULL;
@@ -1110,8 +1109,7 @@ static struct mpc *dcn42b_mpc_create( · 19 unmodified lines
1110 int num_mpcc,1109 int num_mpcc,
1111 int num_rmu)1110 int num_rmu)
1112{1111{
1113 struct dcn42_mpc *mpc42b = kzalloc(sizeof(struct dcn42_mpc),1112 struct dcn42_mpc *mpc42b = kzalloc_obj(struct dcn42_mpc);
1114 GFP_KERNEL);
1115 1113
1116 if (!mpc42b)1114 if (!mpc42b)
1117 return NULL;1115 return NULL;
@@ -1134,7 +1132,7 @@ static struct output_pixel_processor *dcn42b_opp_create( · 16 unmodified lines
1134 struct dc_context *ctx, uint32_t inst)1132 struct dc_context *ctx, uint32_t inst)
1135{1133{
1136 struct dcn20_opp *opp4 =1134 struct dcn20_opp *opp4 =
1137 kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL);1135 kzalloc_obj(struct dcn20_opp);
1138 1136
1139 if (!opp4) {1137 if (!opp4) {
1140 BREAK_TO_DEBUGGER();1138 BREAK_TO_DEBUGGER();
@@ -1158,7 +1156,7 @@ static struct timing_generator *dcn42b_timing_generator_create( · 17 unmodified lines
1158 uint32_t instance)1156 uint32_t instance)
1159{1157{
1160 struct optc *tgn10 =1158 struct optc *tgn10 =
1161 kzalloc(sizeof(struct optc), GFP_KERNEL);1159 kzalloc_obj(struct optc);
1162 1160
1163 if (!tgn10)1161 if (!tgn10)
1164 return NULL;1162 return NULL;
@@ -1196,7 +1194,7 @@ static struct link_encoder *dcn42b_link_encoder_create( · 31 unmodified lines
1196 const struct encoder_init_data *enc_init_data)1194 const struct encoder_init_data *enc_init_data)
1197{1195{
1198 struct dcn20_link_encoder *enc20 =1196 struct dcn20_link_encoder *enc20 =
1199 kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);1197 kzalloc_obj(struct dcn20_link_encoder);
1200 1198
1201 if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs))1199 if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs))
1202 return NULL;1200 return NULL;
@@ -1271,7 +1269,7 @@ static struct vpg *dcn42b_vpg_create( · 68 unmodified lines
1271 struct dc_context *ctx,1269 struct dc_context *ctx,
1272 uint32_t inst)1270 uint32_t inst)
1273{1271{
1274 struct dcn31_vpg *vpg4 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL);1272 struct dcn31_vpg *vpg4 = kzalloc_obj(struct dcn31_vpg);
1275 1273
1276 if (!vpg4)1274 if (!vpg4)
1277 return NULL;1275 return NULL;
@@ -1300,7 +1298,7 @@ static struct apg *dcn42b_apg_create( · 22 unmodified lines
1300 struct dc_context *ctx,1298 struct dc_context *ctx,
1301 uint32_t inst)1299 uint32_t inst)
1302{1300{
1303 struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL);1301 struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg);
1304 1302
1305 if (!apg31)1303 if (!apg31)
1306 return NULL;1304 return NULL;
@@ -1344,7 +1342,7 @@ static struct stream_encoder *dcn42b_stream_encoder_create( · 37 unmodified lines
1344 } else1342 } else
1345 return NULL;1343 return NULL;
1346 1344
1347 enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL);1345 enc1 = kzalloc_obj(struct dcn10_stream_encoder);
1348 vpg = dcn42b_vpg_create(ctx, vpg_inst);1346 vpg = dcn42b_vpg_create(ctx, vpg_inst);
1349 apg = dcn42b_apg_create(ctx, apg_inst);1347 apg = dcn42b_apg_create(ctx, apg_inst);
1350 1348
@@ -1404,7 +1402,7 @@ static struct hpo_dp_stream_encoder *dcn42b_hpo_dp_stream_encoder_create( · 53 unmodified lines
1404 apg_inst = hpo_dp_inst + 6;1402 apg_inst = hpo_dp_inst + 6;
1405 1403
1406 /* allocate HPO stream encoder and create VPG sub-block */1404 /* 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);
1408 vpg = dcn42b_vpg_create(ctx, vpg_inst);1406 vpg = dcn42b_vpg_create(ctx, vpg_inst);
1409 apg = dcn42b_apg_create(ctx, apg_inst);1407 apg = dcn42b_apg_create(ctx, apg_inst);
1410 1408
@@ -1437,7 +1435,7 @@ static struct hpo_dp_link_encoder *dcn42b_hpo_dp_link_encoder_create( · 26 unmodified lines
1437 struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31;1435 struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31;
1438 1436
1439 /* allocate HPO link encoder */1437 /* 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);
1441 if (!hpo_dp_enc31)1439 if (!hpo_dp_enc31)
1442 return NULL; /* out of memory */1440 return NULL; /* out of memory */
1443 1441
@@ -1457,7 +1455,7 @@ static struct hpo_dp_link_encoder *dcn42b_hpo_dp_link_encoder_create( · 13 unmodified lines
1457static struct dce_hwseq *dcn42b_hwseq_create(1455static struct dce_hwseq *dcn42b_hwseq_create(
1458 struct dc_context *ctx)1456 struct dc_context *ctx)
1459{1457{
1460 struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);1458 struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq);
1461 1459
1462#undef REG_STRUCT1460#undef REG_STRUCT
1463#define REG_STRUCT hwseq_reg1461#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
1716 uint32_t dwb_count = pool->res_cap->num_dwb;1714 uint32_t dwb_count = pool->res_cap->num_dwb;
1717 1715
1718 for (i = 0; i < dwb_count; i++) {1716 for (i = 0; i < dwb_count; i++) {
1719 struct dcn30_dwbc *dwbc42 = kzalloc(sizeof(struct dcn30_dwbc),1717 struct dcn30_dwbc *dwbc42 = kzalloc_obj(struct dcn30_dwbc);
1720 GFP_KERNEL);
1721 1718
1722 if (!dwbc42) {1719 if (!dwbc42) {
1723 dm_error("DC: failed to create dwbc42!\n");1720 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
1753 uint32_t pipe_count = pool->res_cap->num_dwb;1750 uint32_t pipe_count = pool->res_cap->num_dwb;
1754 1751
1755 for (i = 0; i < pipe_count; i++) {1752 for (i = 0; i < pipe_count; i++) {
1756 struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub),1753 struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub);
1757 GFP_KERNEL);
1758 1754
1759 if (!mcif_wb30) {1755 if (!mcif_wb30) {
1760 dm_error("DC: failed to create mcif_wb30!\n");1756 dm_error("DC: failed to create mcif_wb30!\n");
@@ -1782,7 +1778,7 @@ static struct display_stream_compressor *dcn42b_dsc_create( · 21 unmodified lines
1782 struct dc_context *ctx, uint32_t inst)1778 struct dc_context *ctx, uint32_t inst)
1783{1779{
1784 struct dcn401_dsc *dsc =1780 struct dcn401_dsc *dsc =
1785 kzalloc(sizeof(struct dcn401_dsc), GFP_KERNEL);1781 kzalloc_obj(struct dcn401_dsc);
1786 1782
1787 if (!dsc) {1783 if (!dsc) {
1788 BREAK_TO_DEBUGGER();1784 BREAK_TO_DEBUGGER();
@@ -1875,7 +1871,7 @@ static struct link_encoder *dcn42b_link_enc_create_minimal( · 86 unmodified lines
1875 if ((unsigned int)(eng_id - ENGINE_ID_DIGA) >= ctx->dc->res_pool->res_cap->num_dig_link_enc)1871 if ((unsigned int)(eng_id - ENGINE_ID_DIGA) >= ctx->dc->res_pool->res_cap->num_dig_link_enc)
1876 return NULL;1872 return NULL;
1877 1873
1878 enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);1874 enc20 = kzalloc_obj(struct dcn20_link_encoder);
1879 if (!enc20)1875 if (!enc20)
1880 return NULL;1876 return NULL;
1881 1877
@@ -2439,7 +2435,7 @@ struct resource_pool *dcn42b_create_resource_pool( · 557 unmodified lines
2439 struct dc *dc)2435 struct dc *dc)
2440{2436{
2441 struct dcn42b_resource_pool *pool =2437 struct dcn42b_resource_pool *pool =
2442 kzalloc(sizeof(struct dcn42b_resource_pool), GFP_KERNEL);2438 kzalloc_obj(struct dcn42b_resource_pool);
2443 2439
2444 if (!pool)2440 if (!pool)
2445 return NULL;2441 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
998 uint32_t inst)998 uint32_t inst)
999{999{
1000 struct aux_engine_dce110 *aux_engine =1000 struct aux_engine_dce110 *aux_engine =
1001 kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL);1001 kzalloc_obj(struct aux_engine_dce110);
1002 1002
1003 if (!aux_engine)1003 if (!aux_engine)
1004 return NULL;1004 return NULL;
@@ -1037,7 +1037,7 @@ static struct dce_i2c_hw *dcn60_i2c_hw_create( · 32 unmodified lines
1037 uint32_t inst)1037 uint32_t inst)
1038{1038{
1039 struct dce_i2c_hw *dce_i2c_hw =1039 struct dce_i2c_hw *dce_i2c_hw =
1040 kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL);1040 kzalloc_obj(struct dce_i2c_hw);
1041 1041
1042 if (!dce_i2c_hw)1042 if (!dce_i2c_hw)
1043 return NULL;1043 return NULL;
@@ -1061,7 +1061,7 @@ static struct clock_source *dcn60_clock_source_create( · 17 unmodified lines
1061 bool dp_clk_src)1061 bool dp_clk_src)
1062{1062{
1063 struct dce110_clk_src *clk_src =1063 struct dce110_clk_src *clk_src =
1064 kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);1064 kzalloc_obj(struct dce110_clk_src);
1065 1065
1066 if (!clk_src)1066 if (!clk_src)
1067 return NULL;1067 return NULL;
@@ -1081,8 +1081,7 @@ static struct hubbub *dcn60_hubbub_create(struct dc_context *ctx) · 13 unmodified lines
1081{1081{
1082 int i;1082 int i;
1083 1083
1084 struct dcn20_hubbub *hubbub2 = kzalloc(sizeof(struct dcn20_hubbub),1084 struct dcn20_hubbub *hubbub2 = kzalloc_obj(struct dcn20_hubbub);
1085 GFP_KERNEL);
1086 1085
1087 if (!hubbub2)1086 if (!hubbub2)
1088 return NULL;1087 return NULL;
@@ -1136,7 +1135,7 @@ static struct hubp *dcn60_hubp_create( · 47 unmodified lines
1136 uint32_t inst)1135 uint32_t inst)
1137{1136{
1138 struct dcn20_hubp *hubp2 =1137 struct dcn20_hubp *hubp2 =
1139 kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL);1138 kzalloc_obj(struct dcn20_hubp);
1140 1139
1141 if (!hubp2)1140 if (!hubp2)
1142 return NULL;1141 return NULL;
@@ -1168,7 +1167,7 @@ static struct dpp *dcn60_dpp_create( · 25 unmodified lines
1168 uint32_t inst)1167 uint32_t inst)
1169{1168{
1170 struct dcn60_dpp *dpp60 =1169 struct dcn60_dpp *dpp60 =
1171 kzalloc(sizeof(struct dcn60_dpp), GFP_KERNEL);1170 kzalloc_obj(struct dcn60_dpp);
1172 1171
1173 if (!dpp60)1172 if (!dpp60)
1174 return NULL;1173 return NULL;
@@ -1194,8 +1193,7 @@ static struct mpc *dcn60_mpc_create( · 19 unmodified lines
1194 int num_mpcc,1193 int num_mpcc,
1195 int num_rmu)1194 int num_rmu)
1196{1195{
1197 struct dcn60_mpc *mpc60 = kzalloc(sizeof(struct dcn60_mpc),1196 struct dcn60_mpc *mpc60 = kzalloc_obj(struct dcn60_mpc);
1198 GFP_KERNEL);
1199 1197
1200 if (!mpc60)1198 if (!mpc60)
1201 return NULL;1199 return NULL;
@@ -1218,7 +1216,7 @@ static struct output_pixel_processor *dcn60_opp_create( · 16 unmodified lines
1218 struct dc_context *ctx, uint32_t inst)1216 struct dc_context *ctx, uint32_t inst)
1219{1217{
1220 struct dcn20_opp *opp2 =1218 struct dcn20_opp *opp2 =
1221 kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL);1219 kzalloc_obj(struct dcn20_opp);
1222 1220
1223 if (!opp2) {1221 if (!opp2) {
1224 BREAK_TO_DEBUGGER();1222 BREAK_TO_DEBUGGER();
@@ -1242,7 +1240,7 @@ static struct timing_generator *dcn60_timing_generator_create( · 17 unmodified lines
1242 uint32_t instance)1240 uint32_t instance)
1243{1241{
1244 struct optc *tgn10 =1242 struct optc *tgn10 =
1245 kzalloc(sizeof(struct optc), GFP_KERNEL);1243 kzalloc_obj(struct optc);
1246 1244
1247 if (!tgn10)1245 if (!tgn10)
1248 return NULL;1246 return NULL;
@@ -1282,7 +1280,7 @@ static struct link_encoder *dcn60_link_encoder_create( · 33 unmodified lines
1282 const struct encoder_init_data *enc_init_data)1280 const struct encoder_init_data *enc_init_data)
1283{1281{
1284 struct dcn20_link_encoder *enc20 =1282 struct dcn20_link_encoder *enc20 =
1285 kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);1283 kzalloc_obj(struct dcn20_link_encoder);
1286 1284
1287 if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) {1285 if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) {
1288 kfree(enc20);1286 kfree(enc20);
@@ -1349,7 +1347,7 @@ static struct vpg *dcn60_vpg_create( · 60 unmodified lines
1349 struct dc_context *ctx,1347 struct dc_context *ctx,
1350 uint32_t inst)1348 uint32_t inst)
1351{1349{
1352 struct dcn31_vpg *vpg6 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL);1350 struct dcn31_vpg *vpg6 = kzalloc_obj(struct dcn31_vpg);
1353 1351
1354 if (!vpg6)1352 if (!vpg6)
1355 return NULL;1353 return NULL;
@@ -1378,7 +1376,7 @@ static struct apg *dcn60_apg_create( · 22 unmodified lines
1378 struct dc_context *ctx,1376 struct dc_context *ctx,
1379 uint32_t inst)1377 uint32_t inst)
1380{1378{
1381 struct dcn31_apg *apg60 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL);1379 struct dcn31_apg *apg60 = kzalloc_obj(struct dcn31_apg);
1382 1380
1383 if (!apg60)1381 if (!apg60)
1384 return NULL;1382 return NULL;
@@ -1415,7 +1413,7 @@ static struct stream_encoder *dcn60_stream_encoder_create( · 30 unmodified lines
1415 } else1413 } else
1416 return NULL;1414 return NULL;
1417 1415
1418 enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL);1416 enc1 = kzalloc_obj(struct dcn10_stream_encoder);
1419 vpg = dcn60_vpg_create(ctx, vpg_inst);1417 vpg = dcn60_vpg_create(ctx, vpg_inst);
1420 apg = dcn60_apg_create(ctx, apg_inst);1418 apg = dcn60_apg_create(ctx, apg_inst);
1421 1419
@@ -1462,7 +1460,7 @@ static struct hpo_frl_stream_encoder *dcn60_hpo_frl_stream_encoder_create( · 40 unmodified lines
1462 return NULL;1460 return NULL;
1463 1461
1464 /* allocate HPO stream encoder and create VPG, APG sub-blocks */1462 /* 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);
1466 vpg = dcn60_vpg_create(ctx, vpg_inst);1464 vpg = dcn60_vpg_create(ctx, vpg_inst);
1467 apg = dcn60_apg_create(ctx, apg_inst);1465 apg = dcn60_apg_create(ctx, apg_inst);
1468 1466
@@ -1493,7 +1491,7 @@ static struct hpo_frl_link_encoder *dcn60_hpo_frl_link_encoder_create( · 24 unmodified lines
1493 hpo_frl_link_encoder_reg_list(0);1491 hpo_frl_link_encoder_reg_list(0);
1494 1492
1495 /* allocate HPO link encoder */1493 /* 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);
1497 if (!hpo_link_enc)1495 if (!hpo_link_enc)
1498 return NULL; /* out of memory */1496 return NULL; /* out of memory */
1499 1497
@@ -1535,7 +1533,7 @@ static struct hpo_dp_stream_encoder *dcn60_hpo_dp_stream_encoder_create( · 35 unmodified lines
1535 apg_inst = hpo_dp_inst;1533 apg_inst = hpo_dp_inst;
1536 1534
1537 /* allocate HPO stream encoder and create VPG sub-block */1535 /* 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);
1539 vpg = dcn60_vpg_create(ctx, vpg_inst);1537 vpg = dcn60_vpg_create(ctx, vpg_inst);
1540 apg = dcn60_apg_create(ctx, apg_inst);1538 apg = dcn60_apg_create(ctx, apg_inst);
1541 1539
@@ -1568,7 +1566,7 @@ static struct hpo_dp_link_encoder *dcn60_hpo_dp_link_encoder_create( · 26 unmodified lines
1568 struct dcn31_hpo_dp_link_encoder *hpo_dp_enc60;1566 struct dcn31_hpo_dp_link_encoder *hpo_dp_enc60;
1569 1567
1570 /* allocate HPO link encoder */1568 /* 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);
1572 if (!hpo_dp_enc60)1570 if (!hpo_dp_enc60)
1573 return NULL; /* out of memory */1571 return NULL; /* out of memory */
1574 1572
@@ -1589,7 +1587,7 @@ static struct hpo_dp_link_encoder *dcn60_hpo_dp_link_encoder_create( · 14 unmodified lines
1589static struct dce_hwseq *dcn60_hwseq_create(1587static struct dce_hwseq *dcn60_hwseq_create(
1590 struct dc_context *ctx)1588 struct dc_context *ctx)
1591{1589{
1592 struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);1590 struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq);
1593 1591
1594#undef REG_STRUCT1592#undef REG_STRUCT
1595#define REG_STRUCT hwseq_reg1593#define REG_STRUCT hwseq_reg
@@ -1784,7 +1782,7 @@ static struct display_stream_compressor *dcn60_dsc_create( · 188 unmodified lines
1784 struct dc_context *ctx, uint32_t inst)1782 struct dc_context *ctx, uint32_t inst)
1785{1783{
1786 struct dcn60_dsc *dsc =1784 struct dcn60_dsc *dsc =
1787 kzalloc(sizeof(struct dcn60_dsc), GFP_KERNEL);1785 kzalloc_obj(struct dcn60_dsc);
1788 1786
1789 if (!dsc) {1787 if (!dsc) {
1790 BREAK_TO_DEBUGGER();1788 BREAK_TO_DEBUGGER();
@@ -2363,7 +2361,7 @@ struct resource_pool *dcn60_create_resource_pool( · 572 unmodified lines
2363 struct dc *dc)2361 struct dc *dc)
2364{2362{
2365 struct dcn60_resource_pool *pool =2363 struct dcn60_resource_pool *pool =
2366 kzalloc(sizeof(struct dcn60_resource_pool), GFP_KERNEL);2364 kzalloc_obj(struct dcn60_resource_pool);
2367 2365
2368 if (!pool)2366 if (!pool)
2369 return NULL;2367 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
111 if (dc == NULL)111 if (dc == NULL)
112 goto fail_dc_null;112 goto fail_dc_null;
113 113
114 core_power = kzalloc(sizeof(struct core_power), GFP_KERNEL);114 core_power = kzalloc_obj(struct core_power);
115 115
116 if (core_power == NULL)116 if (core_power == NULL)
117 goto fail_alloc_context;117 goto fail_alloc_context;
@@ -129,8 +129,7 @@ struct mod_power *mod_power_create(struct dc *dc, · 11 unmodified lines
129 129
130 for (i = 0; i < MOD_POWER_MAX_CONCURRENT_STREAMS; i++) {130 for (i = 0; i < MOD_POWER_MAX_CONCURRENT_STREAMS; i++) {
131 core_power->map[i].psr_context =131 core_power->map[i].psr_context =
132 kzalloc(sizeof(struct mod_power_psr_context),132 kzalloc_obj(struct mod_power_psr_context);
133 GFP_KERNEL);
134 if (core_power->map[i].psr_context == NULL)133 if (core_power->map[i].psr_context == NULL)
135 goto fail_construct;134 goto fail_construct;
136 }135 }
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
705 * (do not want to use 256 bytes on the stack)705 * (do not want to use 256 bytes on the stack)
706 */706 */
707 ext_backlight_caps = (struct dm_acpi_atif_backlight_caps *)707 ext_backlight_caps = (struct dm_acpi_atif_backlight_caps *)
708 (kzalloc(sizeof(struct dm_acpi_atif_backlight_caps),708 (kzalloc_obj(struct dm_acpi_atif_backlight_caps));
709 GFP_KERNEL));
710 709
711 if (ext_backlight_caps == NULL)710 if (ext_backlight_caps == NULL)
712 return;711 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
2988 if (!amdgpu_device_ip_get_ip_block(hwmgr->adev, AMD_IP_BLOCK_TYPE_DCE))2988 if (!amdgpu_device_ip_get_ip_block(hwmgr->adev, AMD_IP_BLOCK_TYPE_DCE))
2989 return 0;2989 return 0;
2990 2990
2991 table = kzalloc(struct_size(table, entries, 4), GFP_KERNEL);2991 table = kzalloc_flex(*table, entries, 4);
2992 if (!table)2992 if (!table)
2993 return -ENOMEM;2993 return -ENOMEM;
2994 2994
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
222 222
223 smu_table->metrics_time = 0;223 smu_table->metrics_time = 0;
224 224
225 driver_pptable = kzalloc(sizeof(PPTable_t), GFP_KERNEL);225 driver_pptable = kzalloc_obj(PPTable_t);
226 if (!driver_pptable)226 if (!driver_pptable)
227 return -ENOMEM;227 return -ENOMEM;
228 228
@@ -1026,7 +1026,7 @@ static int smu_v15_0_8_fru_get_product_info(struct smu_context *smu, · 797 unmodified lines
1026 struct amdgpu_device *adev = smu->adev;1026 struct amdgpu_device *adev = smu->adev;
1027 1027
1028 if (!adev->fru_info) {1028 if (!adev->fru_info) {
1029 adev->fru_info = kzalloc(sizeof(*adev->fru_info), GFP_KERNEL);1029 adev->fru_info = kzalloc_obj(*adev->fru_info);
1030 if (!adev->fru_info)1030 if (!adev->fru_info)
1031 return -ENOMEM;1031 return -ENOMEM;
1032 }1032 }
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
222 if (!buffer)222 if (!buffer)
223 return RAS_CMD__ERROR_GENERIC;223 return RAS_CMD__ERROR_GENERIC;
224 224
225 trace = kcalloc(trace_count, sizeof(*trace), GFP_KERNEL);225 trace = kzalloc_objs(*trace, trace_count);
226 if (!trace) {226 if (!trace) {
227 ret = RAS_CMD__ERROR_GENERIC;227 ret = RAS_CMD__ERROR_GENERIC;
228 goto out;228 goto out;
@@ -316,7 +316,7 @@ static int ras_cmd_get_batch_trace_records(struct ras_core_context *ras_core, · 87 unmodified lines
316 (input_data->start_batch_id >= overview.last_batch_id))316 (input_data->start_batch_id >= overview.last_batch_id))
317 return RAS_CMD__ERROR_INVALID_INPUT_SIZE;317 return RAS_CMD__ERROR_INVALID_INPUT_SIZE;
318 318
319 trace_arry = kcalloc(trace_count, sizeof(*trace_arry), GFP_KERNEL);319 trace_arry = kzalloc_objs(*trace_arry, trace_count);
320 if (!trace_arry)320 if (!trace_arry)
321 return RAS_CMD__ERROR_GENERIC;321 return RAS_CMD__ERROR_GENERIC;
322 322
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
79 nr = PAGE_SIZE / sizeof(void *);79 nr = PAGE_SIZE / sizeof(void *);
80 80
81 exec->flags = flags;81 exec->flags = flags;
82 exec->objects = kvmalloc_objs(*exec->objects, nr, GFP_KERNEL);82 exec->objects = kvmalloc_objs(*exec->objects, nr);
83 83
84 /* If allocation here fails, just delay that till the first use */84 /* If allocation here fails, just delay that till the first use */
85 exec->max_objects = exec->objects ? nr : 0;85 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
1619 goto err_points;1619 goto err_points;
1620 }1620 }
1621 1621
1622 chains = kmalloc_objs(*chains, args->count_handles, GFP_KERNEL);1622 chains = kmalloc_objs(*chains, args->count_handles);
1623 if (!chains) {1623 if (!chains) {
1624 ret = -ENOMEM;1624 ret = -ENOMEM;
1625 goto err_points;1625 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
981 return ERR_PTR(-EINVAL);981 return ERR_PTR(-EINVAL);
982 }982 }
983 983
984 plane = kzalloc(sizeof(*plane), GFP_KERNEL);984 plane = kzalloc_obj(*plane);
985 if (!plane)985 if (!plane)
986 return ERR_PTR(-ENOMEM);986 return ERR_PTR(-ENOMEM);
987 987
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
22{22{
23 struct property *prop;23 struct property *prop;
24 24
25 prop = kzalloc(sizeof(*prop), GFP_KERNEL);25 prop = kzalloc_obj(*prop);
26 if (!prop)26 if (!prop)
27 return -ENOMEM;27 return -ENOMEM;
28 28
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
136 136
137 vs_state_old = to_vs_plane_state(plane->state);137 vs_state_old = to_vs_plane_state(plane->state);
138 138
139 vs_state = kzalloc_obj(*vs_state, GFP_KERNEL);139 vs_state = kzalloc_obj(*vs_state);
140 if (!vs_state)140 if (!vs_state)
141 return NULL;141 return NULL;
142 142
@@ -166,7 +166,7 @@ void vs_plane_reset(struct drm_plane *plane) · 23 unmodified lines
166 plane->state = NULL;166 plane->state = NULL;
167 }167 }
168 168
169 vs_state = kzalloc_obj(*vs_state, GFP_KERNEL);169 vs_state = kzalloc_obj(*vs_state);
170 if (!vs_state)170 if (!vs_state)
171 return;171 return;
172 172
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
293 return -ENOMEM;293 return -ENOMEM;
294 }294 }
295 295
296 ents = kvmalloc_array(bo->sgt->nents,296 ents = kvmalloc_objs(struct virtio_gpu_mem_entry, bo->sgt->nents);
297 sizeof(struct virtio_gpu_mem_entry),
298 GFP_KERNEL);
299 if (!ents) {297 if (!ents) {
300 DRM_ERROR("failed to allocate ent list\n");298 DRM_ERROR("failed to allocate ent list\n");
301 return -ENOMEM;299 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
212 if (dev->enabled)212 if (dev->enabled)
213 return ERR_PTR(-EBUSY);213 return ERR_PTR(-EBUSY);
214 214
215 crtc = kzalloc(sizeof(*crtc), GFP_KERNEL);215 crtc = kzalloc_obj(*crtc);
216 if (!crtc)216 if (!crtc)
217 return ERR_PTR(-ENOMEM);217 return ERR_PTR(-ENOMEM);
218 218
@@ -368,7 +368,7 @@ static struct config_group *make_plane_group(struct config_group *group, · 149 unmodified lines
368 if (dev->enabled)368 if (dev->enabled)
369 return ERR_PTR(-EBUSY);369 return ERR_PTR(-EBUSY);
370 370
371 plane = kzalloc(sizeof(*plane), GFP_KERNEL);371 plane = kzalloc_obj(*plane);
372 if (!plane)372 if (!plane)
373 return ERR_PTR(-ENOMEM);373 return ERR_PTR(-ENOMEM);
374 374
@@ -484,7 +484,7 @@ static struct config_group *make_encoder_group(struct config_group *group, · 109 unmodified lines
484 if (dev->enabled)484 if (dev->enabled)
485 return ERR_PTR(-EBUSY);485 return ERR_PTR(-EBUSY);
486 486
487 encoder = kzalloc(sizeof(*encoder), GFP_KERNEL);487 encoder = kzalloc_obj(*encoder);
488 if (!encoder)488 if (!encoder)
489 return ERR_PTR(-ENOMEM);489 return ERR_PTR(-ENOMEM);
490 490
@@ -651,7 +651,7 @@ static struct config_group *make_connector_group(struct config_group *group, · 160 unmodified lines
651 if (dev->enabled)651 if (dev->enabled)
652 return ERR_PTR(-EBUSY);652 return ERR_PTR(-EBUSY);
653 653
654 connector = kzalloc(sizeof(*connector), GFP_KERNEL);654 connector = kzalloc_obj(*connector);
655 if (!connector)655 if (!connector)
656 return ERR_PTR(-ENOMEM);656 return ERR_PTR(-ENOMEM);
657 657
drivers/gpu/drm/xe/xe_amc.c+1−1
@@ -177,7 +177,7 @@ int xe_amc_init(struct xe_i2c *i2c) · 176 unmodified lines
177{177{
178 struct xe_amc *amc;178 struct xe_amc *amc;
179 179
180 amc = kzalloc(sizeof(*amc), GFP_KERNEL);180 amc = kzalloc_obj(*amc);
181 if (!amc)181 if (!amc)
182 return -ENOMEM;182 return -ENOMEM;
183 183
drivers/gpu/drm/xe/xe_vm.c+1−1
@@ -4148,7 +4148,7 @@ static int fill_faults(struct xe_vm *vm, · 4147 unmodified lines
4148 entry_size = sizeof(struct xe_vm_fault);4148 entry_size = sizeof(struct xe_vm_fault);
4149 count = args->size / entry_size;4149 count = args->size / entry_size;
4150 4150
4151 fault_list = kcalloc(count, sizeof(struct xe_vm_fault), GFP_KERNEL);4151 fault_list = kzalloc_objs(struct xe_vm_fault, count);
4152 if (!fault_list)4152 if (!fault_list)
4153 return -ENOMEM;4153 return -ENOMEM;
4154 4154
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
406 struct asus_work_action *action;406 struct asus_work_action *action;
407 unsigned long flags;407 unsigned long flags;
408 408
409 action = kzalloc(sizeof(struct asus_work_action), GFP_ATOMIC);409 action = kzalloc_obj(struct asus_work_action, GFP_ATOMIC);
410 if (!action)410 if (!action)
411 return -ENOMEM;411 return -ENOMEM;
412 412
@@ -433,7 +433,7 @@ static int asus_kbd_wmi_fan_send(struct asus_drvdata *drvdata, u8 *report_data, · 20 unmodified lines
433 return -EINVAL;433 return -EINVAL;
434 }434 }
435 435
436 action = kzalloc(sizeof(struct asus_work_action), GFP_NOWAIT);436 action = kzalloc_obj(struct asus_work_action, GFP_NOWAIT);
437 if (!action)437 if (!action)
438 return -ENOMEM;438 return -ENOMEM;
439 439
@@ -746,7 +746,7 @@ static void asus_kbd_backlight_set(struct asus_hid_listener *listener, int brigh · 306 unmodified lines
746 746
747 drvdata->kbd_backlight_brightness = brightness;747 drvdata->kbd_backlight_brightness = brightness;
748 748
749 action = kzalloc(sizeof(struct asus_work_action), GFP_NOWAIT);749 action = kzalloc_obj(struct asus_work_action, GFP_NOWAIT);
750 if (!action)750 if (!action)
751 return;751 return;
752 752
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
759 759
760 if (steam->quirks & STEAM_QUIRK_IBEX) {760 if (steam->quirks & STEAM_QUIRK_IBEX) {
761 struct steam_ibex_output_report *report =761 struct steam_ibex_output_report *report =
762 kzalloc(sizeof(struct steam_ibex_output_report), GFP_KERNEL);762 kzalloc_obj(struct steam_ibex_output_report);
763 763
764 if (!report)764 if (!report)
765 return -ENOMEM;765 return -ENOMEM;
@@ -798,7 +798,7 @@ static inline int steam_haptic_rumble(struct steam_device *steam, · 32 unmodified lines
798 798
799 if (steam->quirks & STEAM_QUIRK_IBEX) {799 if (steam->quirks & STEAM_QUIRK_IBEX) {
800 struct steam_ibex_output_report *report =800 struct steam_ibex_output_report *report =
801 kzalloc(sizeof(struct steam_ibex_output_report), GFP_KERNEL);801 kzalloc_obj(struct steam_ibex_output_report);
802 802
803 if (!report)803 if (!report)
804 return -ENOMEM;804 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
469 return hid_hw_start(hdev, HID_CONNECT_DEFAULT);469 return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
470 470
471 if (interface_num == info->sync_interface) {471 if (interface_num == info->sync_interface) {
472 sd = kzalloc_obj(*sd, GFP_KERNEL);472 sd = kzalloc_obj(*sd);
473 if (!sd)473 if (!sd)
474 return -ENOMEM;474 return -ENOMEM;
475 475
drivers/hv/channel.c+2−3
@@ -694,12 +694,11 @@ void *vmbus_alloc_buffer(struct vmbus_channel *channel, · 693 unmodified lines
694 return vzalloc(nr_pages << PAGE_SHIFT);694 return vzalloc(nr_pages << PAGE_SHIFT);
695 695
696 /* Worst case: every chunk is a single page. */696 /* Worst case: every chunk is a single page. */
697 chunks = kvmalloc_array(nr_pages, sizeof(*chunks),697 chunks = kvmalloc_objs(*chunks, nr_pages, GFP_KERNEL | __GFP_ZERO);
698 GFP_KERNEL | __GFP_ZERO);
699 if (!chunks)698 if (!chunks)
700 goto err;699 goto err;
701 700
702 pages = kvmalloc_array(nr_pages, sizeof(*pages), GFP_KERNEL);701 pages = kvmalloc_objs(*pages, nr_pages);
703 if (!pages)702 if (!pages)
704 goto err;703 goto err;
705 704
drivers/hv/hv_balloon.c+1−1
@@ -939,7 +939,7 @@ static unsigned long process_hot_add(unsigned long pg_start, · 938 unmodified lines
939 */939 */
940 940
941 if (rg_size != 0) {941 if (rg_size != 0) {
942 ha_region = kzalloc(sizeof(struct hv_hotadd_state), GFP_KERNEL);942 ha_region = kzalloc_obj(struct hv_hotadd_state);
943 if (!ha_region)943 if (!ha_region)
944 return 0;944 return 0;
945 945
drivers/hwmon/applesmc.c+8−9
@@ -1476,9 +1476,9 @@ static int __init applesmc_init(void) · 1475 unmodified lines
1476 applesmc_fan_config[smcreg.fan_count] = 0;1476 applesmc_fan_config[smcreg.fan_count] = 0;
1477 applesmc_pwm_config[smcreg.fan_count] = 0;1477 applesmc_pwm_config[smcreg.fan_count] = 0;
1478 1478
1479 applesmc_info_temp = kzalloc_obj(*applesmc_info_temp, GFP_KERNEL);1479 applesmc_info_temp = kzalloc_obj(*applesmc_info_temp);
1480 applesmc_info_fan = kzalloc_obj(*applesmc_info_fan, GFP_KERNEL);1480 applesmc_info_fan = kzalloc_obj(*applesmc_info_fan);
1481 applesmc_info_pwm = kzalloc_obj(*applesmc_info_pwm, GFP_KERNEL);1481 applesmc_info_pwm = kzalloc_obj(*applesmc_info_pwm);
1482 if (!applesmc_info_temp || !applesmc_info_fan || !applesmc_info_pwm) {1482 if (!applesmc_info_temp || !applesmc_info_fan || !applesmc_info_pwm) {
1483 ret = -ENOMEM;1483 ret = -ENOMEM;
1484 goto out_info;1484 goto out_info;
@@ -1493,7 +1493,7 @@ static int __init applesmc_init(void) · 8 unmodified lines
1493 applesmc_info_pwm->type = hwmon_pwm;1493 applesmc_info_pwm->type = hwmon_pwm;
1494 applesmc_info_pwm->config = applesmc_pwm_config;1494 applesmc_info_pwm->config = applesmc_pwm_config;
1495 1495
1496 applesmc_info_arr = kcalloc(4, sizeof(*applesmc_info_arr), GFP_KERNEL);1496 applesmc_info_arr = kzalloc_objs(*applesmc_info_arr, 4);
1497 if (!applesmc_info_arr) {1497 if (!applesmc_info_arr) {
1498 ret = -ENOMEM;1498 ret = -ENOMEM;
1499 goto out_info;1499 goto out_info;
@@ -1504,7 +1504,7 @@ static int __init applesmc_init(void) · 4 unmodified lines
1504 applesmc_info_arr[2] = applesmc_info_pwm;1504 applesmc_info_arr[2] = applesmc_info_pwm;
1505 applesmc_info_arr[3] = NULL;1505 applesmc_info_arr[3] = NULL;
1506 1506
1507 applesmc_chip = kzalloc_obj(*applesmc_chip, GFP_KERNEL);1507 applesmc_chip = kzalloc_obj(*applesmc_chip);
1508 if (!applesmc_chip) {1508 if (!applesmc_chip) {
1509 ret = -ENOMEM;1509 ret = -ENOMEM;
1510 goto out_info;1510 goto out_info;
@@ -1514,10 +1514,9 @@ static int __init applesmc_init(void) · 3 unmodified lines
1514 applesmc_chip->info = applesmc_info_arr;1514 applesmc_chip->info = applesmc_info_arr;
1515 1515
1516 /* Create non-standard fanX_safe attributes group */1516 /* Create non-standard fanX_safe attributes group */
1517 fan_safe_attrs = kcalloc(smcreg.fan_count,1517 fan_safe_attrs = kzalloc_objs(*fan_safe_attrs, smcreg.fan_count);
1518 sizeof(*fan_safe_attrs), GFP_KERNEL);1518 fan_safe_attr_list = kzalloc_objs(*fan_safe_attr_list,
1519 fan_safe_attr_list = kcalloc(smcreg.fan_count + 1,1519 smcreg.fan_count + 1);
1520 sizeof(*fan_safe_attr_list), GFP_KERNEL);
1521 if (!fan_safe_attrs || !fan_safe_attr_list) {1520 if (!fan_safe_attrs || !fan_safe_attr_list) {
1522 ret = -ENOMEM;1521 ret = -ENOMEM;
1523 goto out_info;1522 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
1679 return list;1679 return list;
1680 }1680 }
1681 1681
1682 list = kzalloc(sizeof(*list), GFP_KERNEL);1682 list = kzalloc_obj(*list);
1683 if (!list)1683 if (!list)
1684 return NULL;1684 return NULL;
1685 1685
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
418 }418 }
419 }419 }
420 420
421 scl = kzalloc(sizeof(*scl), GFP_KERNEL);421 scl = kzalloc_obj(*scl);
422 if (!scl) {422 if (!scl) {
423 if (sharable)423 if (sharable)
424 fwnode_handle_put(args.fwnode);424 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
376{376{
377 struct xi3c_xfer *xfer;377 struct xi3c_xfer *xfer;
378 378
379 xfer = kzalloc_flex(*xfer, cmds, ncmds, GFP_KERNEL);379 xfer = kzalloc_flex(*xfer, cmds, ncmds);
380 if (!xfer)380 if (!xfer)
381 return NULL;381 return NULL;
382 382
@@ -735,7 +735,7 @@ static int xi3c_master_send_bdcast_ccc_cmd(struct xi3c_master *master, · 352 unmodified lines
735 if (!xfer)735 if (!xfer)
736 return -ENOMEM;736 return -ENOMEM;
737 737
738 buf = kmalloc_objs(*buf, xfer_len, GFP_KERNEL);738 buf = kmalloc_objs(*buf, xfer_len);
739 if (!buf)739 if (!buf)
740 return -ENOMEM;740 return -ENOMEM;
741 741
drivers/iio/adc/ad7280a.c+2−2
@@ -796,8 +796,8 @@ static irqreturn_t ad7280_event_handler(int irq, void *private) · 795 unmodified lines
796 struct ad7280_state *st = iio_priv(indio_dev);796 struct ad7280_state *st = iio_priv(indio_dev);
797 int i, ret;797 int i, ret;
798 798
799 unsigned int *channels __free(kfree) = kcalloc(st->scan_cnt, sizeof(*channels),799 unsigned int *channels __free(kfree) = kzalloc_objs(*channels,
800 GFP_KERNEL);800 st->scan_cnt);
801 if (!channels)801 if (!channels)
802 return IRQ_HANDLED;802 return IRQ_HANDLED;
803 803
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
109 if (nents < 0)109 if (nents < 0)
110 return nents;110 return nents;
111 111
112 vecs = kmalloc_array(nents, sizeof(*vecs), GFP_ATOMIC);112 vecs = kmalloc_objs(*vecs, nents, GFP_ATOMIC);
113 if (!vecs)113 if (!vecs)
114 return -ENOMEM;114 return -ENOMEM;
115 115
drivers/iio/inkern.c+1−1
@@ -345,7 +345,7 @@ static struct iio_channel *iio_channel_get_sys(const char *name, · 344 unmodified lines
345 return ERR_PTR(-ENODEV);345 return ERR_PTR(-ENODEV);
346 346
347 struct iio_channel *channel __free(kfree) =347 struct iio_channel *channel __free(kfree) =
348 kzalloc(sizeof(*channel), GFP_KERNEL);348 kzalloc_obj(*channel);
349 if (!channel) {349 if (!channel) {
350 err = -ENOMEM;350 err = -ENOMEM;
351 goto error_no_mem;351 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
2943 u32 aging_period;2943 u32 aging_period;
2944 int err;2944 int err;
2945 2945
2946 tb = kzalloc_objs(*tb, RDMA_NLDEV_ATTR_MAX, GFP_KERNEL);2946 tb = kzalloc_objs(*tb, RDMA_NLDEV_ATTR_MAX);
2947 if (!tb)2947 if (!tb)
2948 return -ENOMEM;2948 return -ENOMEM;
2949 2949
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
267 struct hns_roce_scc_param *scc_param;267 struct hns_roce_scc_param *scc_param;
268 int i;268 int i;
269 269
270 scc_param = kvcalloc(HNS_ROCE_SCC_ALGO_TOTAL, sizeof(*scc_param),270 scc_param = kvzalloc_objs(*scc_param, HNS_ROCE_SCC_ALGO_TOTAL);
271 GFP_KERNEL);
272 if (!scc_param)271 if (!scc_param)
273 return -ENOMEM;272 return -ENOMEM;
274 273
drivers/input/input.c+1−1
@@ -2344,7 +2344,7 @@ static int input_device_tune_vals(struct input_dev *dev) · 2343 unmodified lines
2344 if (dev->max_vals >= max_vals)2344 if (dev->max_vals >= max_vals)
2345 return 0;2345 return 0;
2346 2346
2347 vals = kcalloc(max_vals, sizeof(*vals), GFP_KERNEL);2347 vals = kzalloc_objs(*vals, max_vals);
2348 if (!vals)2348 if (!vals)
2349 return -ENOMEM;2349 return -ENOMEM;
2350 2350
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
115 "Too many keypad pins (%d) defined (max=%d)\n",115 "Too many keypad pins (%d) defined (max=%d)\n",
116 n_pins, adp5585->n_pins);116 n_pins, adp5585->n_pins);
117 117
118 unsigned int *keypad_pins __free(kfree) = kcalloc(n_pins, sizeof(*keypad_pins),118 unsigned int *keypad_pins __free(kfree) = kzalloc_objs(*keypad_pins,
119 GFP_KERNEL);119 n_pins);
120 if (!keypad_pins)120 if (!keypad_pins)
121 return -ENOMEM;121 return -ENOMEM;
122 122
drivers/input/keyboard/atkbd.c+1−1
@@ -1070,7 +1070,7 @@ static int atkbd_get_keymap_from_fwnode(struct atkbd *atkbd) · 1069 unmodified lines
1070 if (n <= 0 || n > ATKBD_KEYMAP_SIZE)1070 if (n <= 0 || n > ATKBD_KEYMAP_SIZE)
1071 return -ENXIO;1071 return -ENXIO;
1072 1072
1073 u32 *ptr __free(kfree) = kcalloc(n, sizeof(*ptr), GFP_KERNEL);1073 u32 *ptr __free(kfree) = kzalloc_objs(*ptr, n);
1074 if (!ptr)1074 if (!ptr)
1075 return -ENOMEM;1075 return -ENOMEM;
1076 1076
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
1844{1844{
1845 struct usb_host_interface *interface = pcu->ctrl_intf->cur_altsetting;1845 struct usb_host_interface *interface = pcu->ctrl_intf->cur_altsetting;
1846 struct usb_cdc_line_coding *line __free(kfree) =1846 struct usb_cdc_line_coding *line __free(kfree) =
1847 kmalloc(sizeof(*line), GFP_KERNEL);1847 kmalloc_obj(*line);
1848 int error;1848 int error;
1849 1849
1850 if (!line)1850 if (!line)
drivers/input/mouse/psmouse-smbus.c+1−1
@@ -232,7 +232,7 @@ int psmouse_smbus_init(struct psmouse *psmouse, · 231 unmodified lines
232 struct psmouse_smbus_dev *smbdev;232 struct psmouse_smbus_dev *smbdev;
233 int error;233 int error;
234 234
235 smbdev = kzalloc(sizeof(*smbdev), GFP_KERNEL);235 smbdev = kzalloc_obj(*smbdev);
236 if (!smbdev)236 if (!smbdev)
237 return -ENOMEM;237 return -ENOMEM;
238 238
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
84 if (serio_raw->dead)84 if (serio_raw->dead)
85 return -ENODEV;85 return -ENODEV;
86 86
87 client = kzalloc(sizeof(*client), GFP_KERNEL);87 client = kzalloc_obj(*client);
88 if (!client)88 if (!client)
89 return -ENOMEM;89 return -ENOMEM;
90 90
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
796{796{
797 struct arm_smmu_invs *new_invs;797 struct arm_smmu_invs *new_invs;
798 798
799 new_invs = kzalloc(struct_size(new_invs, inv, num_invs), GFP_KERNEL);799 new_invs = kzalloc_flex(*new_invs, inv, num_invs);
800 if (!new_invs)800 if (!new_invs)
801 return NULL;801 return NULL;
802 new_invs->max_invs = num_invs;802 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
76{76{
77 struct iommufd_group *new_igroup;77 struct iommufd_group *new_igroup;
78 78
79 new_igroup = kzalloc_obj(*new_igroup, GFP_KERNEL);79 new_igroup = kzalloc_obj(*new_igroup);
80 if (!new_igroup)80 if (!new_igroup)
81 return ERR_PTR(-ENOMEM);81 return ERR_PTR(-ENOMEM);
82 82
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
49 if (!length || !PAGE_ALIGNED(length))49 if (!length || !PAGE_ALIGNED(length))
50 return -EINVAL;50 return -EINVAL;
51 51
52 immap = kzalloc(sizeof(*immap), GFP_KERNEL);52 immap = kzalloc_obj(*immap);
53 if (!immap)53 if (!immap)
54 return -ENOMEM;54 return -ENOMEM;
55 immap->owner = owner;55 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
54 (BIT(PT_FEAT_DYNAMIC_TOP) | BIT(PT_FEAT_AMDV1_ENCRYPT_TABLES) |54 (BIT(PT_FEAT_DYNAMIC_TOP) | BIT(PT_FEAT_AMDV1_ENCRYPT_TABLES) |
55 BIT(PT_FEAT_AMDV1_FORCE_COHERENCE));55 BIT(PT_FEAT_AMDV1_FORCE_COHERENCE));
56 56
57 dom = kzalloc(sizeof(*dom), GFP_KERNEL);57 dom = kzalloc_obj(*dom);
58 if (!dom)58 if (!dom)
59 return ERR_PTR(-ENOMEM);59 return ERR_PTR(-ENOMEM);
60 60
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
231 struct vsi_iommu *iommu = dev_iommu_priv_get(dev);231 struct vsi_iommu *iommu = dev_iommu_priv_get(dev);
232 struct vsi_iommu_domain *vsi_domain;232 struct vsi_iommu_domain *vsi_domain;
233 233
234 vsi_domain = kzalloc(sizeof(*vsi_domain), GFP_KERNEL);234 vsi_domain = kzalloc_obj(*vsi_domain);
235 if (!vsi_domain)235 if (!vsi_domain)
236 return NULL;236 return NULL;
237 237
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
618 if (niaffids != ncpus)618 if (niaffids != ncpus)
619 return -EINVAL;619 return -EINVAL;
620 620
621 u16 *iaffids __free(kfree) = kcalloc(niaffids, sizeof(*iaffids), GFP_KERNEL);621 u16 *iaffids __free(kfree) = kzalloc_objs(*iaffids, niaffids);
622 if (!iaffids)622 if (!iaffids)
623 return -ENOMEM;623 return -ENOMEM;
624 624
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
331 struct irq_data *irq_data = irq_domain_get_irq_data(domain, virq + i);331 struct irq_data *irq_data = irq_domain_get_irq_data(domain, virq + i);
332 struct redirect_item *item;332 struct redirect_item *item;
333 333
334 item = kzalloc(sizeof(*item), GFP_KERNEL);334 item = kzalloc_obj(*item);
335 if (!item) {335 if (!item) {
336 pr_err("Alloc redirect descriptor failed\n");336 pr_err("Alloc redirect descriptor failed\n");
337 goto out_free_resources;337 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
188 struct irq_domain *domain;188 struct irq_domain *domain;
189 189
190 cnt = max(1, num_parents);190 cnt = max(1, num_parents);
191 output = kcalloc(cnt, sizeof(*output), GFP_KERNEL);191 output = kzalloc_objs(*output, cnt);
192 if (!output)192 if (!output)
193 return -ENOMEM;193 return -ENOMEM;
194 194
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
783 return dev_err_probe(mbox->dev, -ENODEV, "no MPXY channels available\n");783 return dev_err_probe(mbox->dev, -ENODEV, "no MPXY channels available\n");
784 784
785 /* Allocate and fetch all channel IDs */785 /* 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);
787 if (!channel_ids)787 if (!channel_ids)
788 return -ENOMEM;788 return -ENOMEM;
789 rc = mpxy_get_channel_ids(mbox->channel_count, channel_ids);789 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
322 return -EINVAL;322 return -EINVAL;
323 }323 }
324 324
325 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);325 ctx = kzalloc_obj(*ctx);
326 if (!ctx) {326 if (!ctx) {
327 ti->error = "Out of memory";327 ti->error = "Out of memory";
328 return -ENOMEM;328 return -ENOMEM;
drivers/md/md-llbitmap.c+2−2
@@ -810,7 +810,7 @@ static int llbitmap_expand_pages(struct llbitmap *llbitmap, · 809 unmodified lines
810 if (nr_pages <= old_nr_pages)810 if (nr_pages <= old_nr_pages)
811 return 0;811 return 0;
812 812
813 pctl = kcalloc(nr_pages, sizeof(*pctl), GFP_NOIO);813 pctl = kzalloc_objs(*pctl, nr_pages, GFP_NOIO);
814 if (!pctl)814 if (!pctl)
815 return -ENOMEM;815 return -ENOMEM;
816 816
@@ -846,7 +846,7 @@ static int llbitmap_alloc_pages(struct llbitmap *llbitmap) · 29 unmodified lines
846 unsigned int nr_pages = max(used_pages, llbitmap_reserved_pages(llbitmap));846 unsigned int nr_pages = max(used_pages, llbitmap_reserved_pages(llbitmap));
847 int i;847 int i;
848 848
849 llbitmap->pctl = kcalloc(nr_pages, sizeof(*llbitmap->pctl), GFP_NOIO);849 llbitmap->pctl = kzalloc_objs(*llbitmap->pctl, nr_pages, GFP_NOIO);
850 if (!llbitmap->pctl)850 if (!llbitmap->pctl)
851 return -ENOMEM;851 return -ENOMEM;
852 852
drivers/media/platform/allegro-dvt/allegro-core.c+1−1
@@ -3105,7 +3105,7 @@ static int allegro_open(struct file *file) · 3104 unmodified lines
3105 unsigned int cpb_size_max;3105 unsigned int cpb_size_max;
3106 unsigned int cpb_size_def;3106 unsigned int cpb_size_def;
3107 3107
3108 channel = kzalloc(sizeof(*channel), GFP_KERNEL);3108 channel = kzalloc_obj(*channel);
3109 if (!channel)3109 if (!channel)
3110 return -ENOMEM;3110 return -ENOMEM;
3111 3111
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
127 struct device *dev = ispif->dev;127 struct device *dev = ispif->dev;
128 int ret;128 int ret;
129 129
130 mem_info = kmalloc_obj(*mem_info, GFP_KERNEL);130 mem_info = kmalloc_obj(*mem_info);
131 if (!mem_info)131 if (!mem_info)
132 return NULL;132 return NULL;
133 133
@@ -368,7 +368,7 @@ static int isp4if_send_fw_cmd(struct isp4_interface *ispif, u32 cmd_id, · 234 unmodified lines
368 368
369 /* Allocate the sync command object early and outside of the lock */369 /* Allocate the sync command object early and outside of the lock */
370 if (sync) {370 if (sync) {
371 ele = kmalloc_obj(*ele, GFP_KERNEL);371 ele = kmalloc_obj(*ele);
372 if (!ele)372 if (!ele)
373 return -ENOMEM;373 return -ENOMEM;
374 374
@@ -738,7 +738,7 @@ isp4if_alloc_buffer_node(struct isp4if_img_buf_info *buf_info) · 363 unmodified lines
738{738{
739 struct isp4if_img_buf_node *node;739 struct isp4if_img_buf_node *node;
740 740
741 node = kmalloc_obj(*node, GFP_KERNEL);741 node = kmalloc_obj(*node);
742 if (node)742 if (node)
743 node->buf_info = *buf_info;743 node->buf_info = *buf_info;
744 744
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
232 }232 }
233 233
234 /* Memory is released when the job is consumed. */234 /* Memory is released when the job is consumed. */
235 job = kzalloc(sizeof(*job), GFP_KERNEL);235 job = kzalloc_obj(*job);
236 if (!job)236 if (!job)
237 return -ENOMEM;237 return -ENOMEM;
238 238
drivers/media/rc/igorplugusb.c+1−1
@@ -164,7 +164,7 @@ static int igorplugusb_probe(struct usb_interface *intf, · 163 unmodified lines
164 if (!ir)164 if (!ir)
165 return -ENOMEM;165 return -ENOMEM;
166 166
167 ir->request = kzalloc_obj(*ir->request, GFP_KERNEL);167 ir->request = kzalloc_obj(*ir->request);
168 if (!ir->request)168 if (!ir->request)
169 goto fail;169 goto fail;
170 170
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
135 return -EAGAIN;135 return -EAGAIN;
136 136
137allocate_of_node:137allocate_of_node:
138 of_entry = kzalloc(sizeof(*of_entry), GFP_KERNEL);138 of_entry = kzalloc_obj(*of_entry);
139 if (!of_entry)139 if (!of_entry)
140 return -ENOMEM;140 return -ENOMEM;
141 141
@@ -174,7 +174,7 @@ static int mfd_add_device(struct device *parent, int id, · 32 unmodified lines
174 if (!pdev->mfd_cell)174 if (!pdev->mfd_cell)
175 goto fail_device;175 goto fail_device;
176 176
177 res = kcalloc(cell->num_resources, sizeof(*res), GFP_KERNEL);177 res = kzalloc_objs(*res, cell->num_resources);
178 if (!res)178 if (!res)
179 goto fail_device;179 goto fail_device;
180 180
drivers/mfd/ucb1x00-assabet.c+1−1
@@ -96,7 +96,7 @@ static int ucb1x00_assabet_add(struct ucb1x00_dev *dev) · 95 unmodified lines
96 96
97 struct ucb1x00_assabet_priv *priv;97 struct ucb1x00_assabet_priv *priv;
98 98
99 priv = kzalloc_obj(*priv, GFP_KERNEL);99 priv = kzalloc_obj(*priv);
100 if (!priv)100 if (!priv)
101 return -ENOMEM;101 return -ENOMEM;
102 102
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
166 return 0;166 return 0;
167 }167 }
168 168
169 item = kzalloc_flex(*item, nodes, count, GFP_KERNEL);169 item = kzalloc_flex(*item, nodes, count);
170 if (!item)170 if (!item)
171 return -ENOMEM;171 return -ENOMEM;
172 172
@@ -182,7 +182,7 @@ static int mtd_virt_concat_create_item(struct device_node *parts, · 9 unmodified lines
182 for (i = 1; i < count; i++)182 for (i = 1; i < count; i++)
183 item->nodes[i] = of_parse_phandle(parts, CONCAT_PROP, (i - 1));183 item->nodes[i] = of_parse_phandle(parts, CONCAT_PROP, (i - 1));
184 184
185 concat = kzalloc_flex(*concat, subdev, count, GFP_KERNEL);185 concat = kzalloc_flex(*concat, subdev, count);
186 if (!concat) {186 if (!concat) {
187 kfree(item);187 kfree(item);
188 return -ENOMEM;188 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
639 printk(KERN_NOTICE "into device \"%s\"\n", name);639 printk(KERN_NOTICE "into device \"%s\"\n", name);
640 640
641 /* allocate the device structure */641 /* allocate the device structure */
642 concat = kzalloc_flex(*concat, subdev, num_devs, GFP_KERNEL);642 concat = kzalloc_flex(*concat, subdev, num_devs);
643 if (!concat) {643 if (!concat) {
644 printk644 printk
645 ("memory allocation error while creating concatenated device \"%s\"\n",645 ("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
97 goto err_unlock;97 goto err_unlock;
98 }98 }
99 99
100 entry = kzalloc(sizeof(*entry), GFP_KERNEL);100 entry = kzalloc_obj(*entry);
101 if (!entry) {101 if (!entry) {
102 err = -ENOMEM;102 err = -ENOMEM;
103 goto err_unlock;103 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
439 q_num = enet->cfg.rx_ring_num + enet->cfg.tx_ring_num + 1;439 q_num = enet->cfg.rx_ring_num + enet->cfg.tx_ring_num + 1;
440 io_num = enet->cfg.rx_ring_num + enet->cfg.tx_ring_num;440 io_num = enet->cfg.rx_ring_num + enet->cfg.tx_ring_num;
441 441
442 req = kcalloc(q_num, sizeof(struct eea_aq_queue_drv_status),442 req = kzalloc_objs(struct eea_aq_queue_drv_status, q_num);
443 GFP_KERNEL);
444 if (!req)443 if (!req)
445 return -ENOMEM;444 return -ENOMEM;
446 445
@@ -486,11 +485,11 @@ void eea_adminq_config_host_info(struct eea_net *enet) · 39 unmodified lines
486 struct eea_aq_host_info_rep *rep;485 struct eea_aq_host_info_rep *rep;
487 int rc = -ENOMEM;486 int rc = -ENOMEM;
488 487
489 cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);488 cfg = kzalloc_obj(*cfg);
490 if (!cfg)489 if (!cfg)
491 return;490 return;
492 491
493 rep = kzalloc(sizeof(*rep), GFP_KERNEL);492 rep = kzalloc_obj(*rep);
494 if (!rep)493 if (!rep)
495 goto err_free_cfg;494 goto err_free_cfg;
496 495
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
62 62
63 num = enet->edev->rx_num;63 num = enet->edev->rx_num;
64 64
65 irq_blks = kvcalloc(num, sizeof(*blk), GFP_KERNEL);65 irq_blks = kvzalloc_objs(*blk, num);
66 if (!irq_blks)66 if (!irq_blks)
67 return -ENOMEM;67 return -ENOMEM;
68 68
@@ -194,11 +194,11 @@ static int eea_alloc_rxtx_q_mem(struct eea_net_init_ctx *ctx) · 125 unmodified lines
194 struct eea_net_tx *tx;194 struct eea_net_tx *tx;
195 int err, i;195 int err, i;
196 196
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);
198 if (!ctx->tx)198 if (!ctx->tx)
199 return -ENOMEM;199 return -ENOMEM;
200 200
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);
202 if (!ctx->rx)202 if (!ctx->rx)
203 goto err_free_tx;203 goto err_free_tx;
204 204
@@ -601,7 +601,7 @@ static int eea_netdev_init_features(struct net_device *netdev, · 396 unmodified lines
601 int err;601 int err;
602 u32 mtu;602 u32 mtu;
603 603
604 cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);604 cfg = kzalloc_obj(*cfg);
605 if (!cfg)605 if (!cfg)
606 return -ENOMEM;606 return -ENOMEM;
607 607
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
651 struct eea_device *edev;651 struct eea_device *edev;
652 int err;652 int err;
653 653
654 ep_dev = kzalloc(sizeof(*ep_dev), GFP_KERNEL);654 ep_dev = kzalloc_obj(*ep_dev);
655 if (!ep_dev)655 if (!ep_dev)
656 return -ENOMEM;656 return -ENOMEM;
657 657
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
217 if (!cq_desc_size || !is_power_of_2(cq_desc_size))217 if (!cq_desc_size || !is_power_of_2(cq_desc_size))
218 return NULL;218 return NULL;
219 219
220 ering = kzalloc(sizeof(*ering), GFP_KERNEL);220 ering = kzalloc_obj(*ering);
221 if (!ering)221 if (!ering)
222 return NULL;222 return NULL;
223 223
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
764 struct eea_net_rx *rx;764 struct eea_net_rx *rx;
765 int err;765 int err;
766 766
767 rx = kzalloc(sizeof(*rx), GFP_KERNEL);767 rx = kzalloc_obj(*rx);
768 if (!rx)768 if (!rx)
769 return rx;769 return rx;
770 770
@@ -786,8 +786,7 @@ struct eea_net_rx *eea_alloc_rx(struct eea_net_init_ctx *ctx, u32 idx) · 15 unmodified lines
786 rx->dma_dev = ctx->edev->dma_dev;786 rx->dma_dev = ctx->edev->dma_dev;
787 787
788 /* meta */788 /* meta */
789 rx->meta = kvcalloc(ctx->cfg.rx_ring_depth,789 rx->meta = kvzalloc_objs(*rx->meta, ctx->cfg.rx_ring_depth);
790 sizeof(*rx->meta), GFP_KERNEL);
791 if (!rx->meta)790 if (!rx->meta)
792 goto err_free_rx;791 goto err_free_rx;
793 792
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
480 tx->dma_dev = ctx->edev->dma_dev;480 tx->dma_dev = ctx->edev->dma_dev;
481 481
482 /* meta */482 /* meta */
483 tx->meta = kvcalloc(ctx->cfg.tx_ring_depth,483 tx->meta = kvzalloc_objs(*tx->meta, ctx->cfg.tx_ring_depth);
484 sizeof(*tx->meta), GFP_KERNEL);
485 if (!tx->meta)484 if (!tx->meta)
486 goto err_free_tx;485 goto err_free_tx;
487 486
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
810 if (count == 0)810 if (count == 0)
811 return;811 return;
812 812
813 pdsc->host_mem_reqs = kzalloc_objs(*pdsc->host_mem_reqs, count,813 pdsc->host_mem_reqs = kzalloc_objs(*pdsc->host_mem_reqs, count);
814 GFP_KERNEL);
815 if (!pdsc->host_mem_reqs) {814 if (!pdsc->host_mem_reqs) {
816 dev_err(pdsc->dev, "failed to alloc host_mem_reqs array\n");815 dev_err(pdsc->dev, "failed to alloc host_mem_reqs array\n");
817 return;816 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
382 if (!length)382 if (!length)
383 return 0;383 return 0;
384 384
385 deferred = kmalloc_obj(*deferred, GFP_KERNEL);385 deferred = kmalloc_obj(*deferred);
386 if (!deferred)386 if (!deferred)
387 return -ENOMEM;387 return -ENOMEM;
388 388
@@ -505,7 +505,7 @@ static int pdsc_send_component_table(struct pldmfw *context, · 116 unmodified lines
505 component->version_string, component->index,505 component->version_string, component->index,
506 component->component_size, transfer_flag);506 component->component_size, transfer_flag);
507 507
508 component_priv = kzalloc_obj(*component_priv, GFP_KERNEL);508 component_priv = kzalloc_obj(*component_priv);
509 if (!component_priv)509 if (!component_priv)
510 return -ENOMEM;510 return -ENOMEM;
511 511
@@ -710,7 +710,7 @@ static int pdsc_flash_component_chunk(struct pdsc *pdsc, struct device *dev, · 198 unmodified lines
710 u8 *component_data;710 u8 *component_data;
711 int err;711 int err;
712 712
713 deferred = kmalloc_obj(*deferred, GFP_KERNEL);713 deferred = kmalloc_obj(*deferred);
714 if (!deferred)714 if (!deferred)
715 return -ENOMEM;715 return -ENOMEM;
716 716
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
4334 return -EINVAL;4334 return -EINVAL;
4335 }4335 }
4336 4336
4337 enst_queue = kcalloc(conf->num_entries, sizeof(*enst_queue), GFP_KERNEL);4337 enst_queue = kzalloc_objs(*enst_queue, conf->num_entries);
4338 if (unlikely(!enst_queue))4338 if (unlikely(!enst_queue))
4339 return -ENOMEM;4339 return -ENOMEM;
4340 4340
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
137{137{
138 struct enic_admin_msg *msg;138 struct enic_admin_msg *msg;
139 139
140 msg = kmalloc(struct_size(msg, data, len), GFP_KERNEL);140 msg = kmalloc_flex(*msg, data, len);
141 if (!msg)141 if (!msg)
142 return;142 return;
143 143
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
2858 return -EOPNOTSUPP;2858 return -EOPNOTSUPP;
2859 }2859 }
2860 2860
2861 enic->vf_state = kcalloc(num_vfs, sizeof(*enic->vf_state), GFP_KERNEL);2861 enic->vf_state = kzalloc_objs(*enic->vf_state, num_vfs);
2862 if (!enic->vf_state)2862 if (!enic->vf_state)
2863 return -ENOMEM;2863 return -ENOMEM;
2864 2864
@@ -2946,7 +2946,7 @@ enic_sriov_configure(struct pci_dev *pdev, int num_vfs) · 81 unmodified lines
2946 if (enic->vf_type == ENIC_VF_TYPE_V2)2946 if (enic->vf_type == ENIC_VF_TYPE_V2)
2947 return enic_sriov_v2_enable(enic, num_vfs);2947 return enic_sriov_v2_enable(enic, num_vfs);
2948 2948
2949 pp = kcalloc(num_vfs, sizeof(*pp), GFP_KERNEL);2949 pp = kzalloc_objs(*pp, num_vfs);
2950 if (!pp)2950 if (!pp)
2951 return -ENOMEM;2951 return -ENOMEM;
2952 2952
@@ -2971,7 +2971,7 @@ enic_sriov_configure(struct pci_dev *pdev, int num_vfs) · 18 unmodified lines
2971 return 0;2971 return 0;
2972 }2972 }
2973 2973
2974 pp = kzalloc_obj(*enic->pp, GFP_KERNEL);2974 pp = kzalloc_obj(*enic->pp);
2975 if (!pp)2975 if (!pp)
2976 return -ENOMEM;2976 return -ENOMEM;
2977 2977
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
616 goto out;616 goto out;
617 }617 }
618 618
619 a = kzalloc(sizeof(*a), GFP_KERNEL);619 a = kzalloc_obj(*a);
620 if (!a) {620 if (!a) {
621 err = -ENOMEM;621 err = -ENOMEM;
622 goto out;622 goto out;
@@ -4131,8 +4131,7 @@ static int dpaa2_switch_probe(struct fsl_mc_device *sw_dev) · 3508 unmodified lines
4131 goto err_free_fdbs;4131 goto err_free_fdbs;
4132 }4132 }
4133 4133
4134 ethsw->lags = kcalloc(ethsw->sw_attr.num_ifs, sizeof(*ethsw->lags),4134 ethsw->lags = kzalloc_objs(*ethsw->lags, ethsw->sw_attr.num_ifs);
4135 GFP_KERNEL);
4136 if (!ethsw->lags) {4135 if (!ethsw->lags) {
4137 err = -ENOMEM;4136 err = -ENOMEM;
4138 goto err_free_filter;4137 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
157 */157 */
158static int libie_ctlq_alloc_tx_msgs(struct libie_ctlq_info *ctlq)158static int libie_ctlq_alloc_tx_msgs(struct libie_ctlq_info *ctlq)
159{159{
160 ctlq->tx_msg = kvzalloc_objs(*ctlq->tx_msg, ctlq->ring_len,160 ctlq->tx_msg = kvzalloc_objs(*ctlq->tx_msg, ctlq->ring_len);
161 GFP_KERNEL);
162 if (!ctlq->tx_msg)161 if (!ctlq->tx_msg)
163 return -ENOMEM;162 return -ENOMEM;
164 163
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
3647{3647{
3648 struct npc_defrag_show_node *node;3648 struct npc_defrag_show_node *node;
3649 3649
3650 node = kcalloc(1, sizeof(*node), GFP_KERNEL);3650 node = kzalloc_objs(*node, 1);
3651 if (!node)3651 if (!node)
3652 return -ENOMEM;3652 return -ENOMEM;
3653 3653
@@ -4082,7 +4082,7 @@ int npc_cn20k_defrag(struct rvu *rvu) · 428 unmodified lines
4082 INIT_LIST_HEAD(&x4lh);4082 INIT_LIST_HEAD(&x4lh);
4083 INIT_LIST_HEAD(&x2lh);4083 INIT_LIST_HEAD(&x2lh);
4084 4084
4085 node = kcalloc(npc_priv->num_subbanks, sizeof(*node), GFP_KERNEL);4085 node = kzalloc_objs(*node, npc_priv->num_subbanks);
4086 if (!node)4086 if (!node)
4087 return -ENOMEM;4087 return -ENOMEM;
4088 4088
@@ -4711,7 +4711,7 @@ static int npc_priv_init(struct rvu *rvu) · 622 unmodified lines
4711 return -EINVAL;4711 return -EINVAL;
4712 }4712 }
4713 4713
4714 npc_priv = kcalloc(1, sizeof(*npc_priv), GFP_KERNEL);4714 npc_priv = kzalloc_objs(*npc_priv, 1);
4715 if (!npc_priv)4715 if (!npc_priv)
4716 return -ENOMEM;4716 return -ENOMEM;
4717 4717
@@ -4729,8 +4729,7 @@ static int npc_priv_init(struct rvu *rvu) · 11 unmodified lines
4729 num_banks, bank_depth, num_subbanks, subbank_depth,4729 num_banks, bank_depth, num_subbanks, subbank_depth,
4730 npc_kw_name[npc_priv->kw]);4730 npc_kw_name[npc_priv->kw]);
4731 4731
4732 npc_priv->sb = kcalloc(num_subbanks, sizeof(struct npc_subbank),4732 npc_priv->sb = kzalloc_objs(struct npc_subbank, num_subbanks);
4733 GFP_KERNEL);
4734 if (!npc_priv->sb)4733 if (!npc_priv->sb)
4735 goto fail1;4734 goto fail1;
4736 4735
@@ -4757,9 +4756,7 @@ static int npc_priv_init(struct rvu *rvu) · 20 unmodified lines
4757 4756
4758 /* Get number of pcifuncs in the system */4757 /* Get number of pcifuncs in the system */
4759 npc_priv->pf_cnt = npc_pcifunc_map_create(rvu);4758 npc_priv->pf_cnt = npc_pcifunc_map_create(rvu);
4760 npc_priv->xa_pf2idx_map = kcalloc(npc_priv->pf_cnt,4759 npc_priv->xa_pf2idx_map = kzalloc_objs(struct xarray, npc_priv->pf_cnt);
4761 sizeof(struct xarray),
4762 GFP_KERNEL);
4763 if (!npc_priv->xa_pf2idx_map) {4760 if (!npc_priv->xa_pf2idx_map) {
4764 ret = -ENOMEM;4761 ret = -ENOMEM;
4765 goto fail3;4762 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
2288 if (!num_entries)2288 if (!num_entries)
2289 goto out_free;2289 goto out_free;
2290 2290
2291 esw_funcs->spfs = kcalloc(num_entries, sizeof(*esw_funcs->spfs),2291 esw_funcs->spfs = kzalloc_objs(*esw_funcs->spfs, num_entries);
2292 GFP_KERNEL);
2293 if (!esw_funcs->spfs) {2292 if (!esw_funcs->spfs) {
2294 err = -ENOMEM;2293 err = -ENOMEM;
2295 goto out_free;2294 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
1524mlx5_esw_lag_demux_rule_create(struct mlx5_eswitch *esw, u16 vport_num,1524mlx5_esw_lag_demux_rule_create(struct mlx5_eswitch *esw, u16 vport_num,
1525 struct mlx5_flow_table *lag_ft)1525 struct mlx5_flow_table *lag_ft)
1526{1526{
1527 struct mlx5_flow_spec *spec = kvzalloc(sizeof(*spec), GFP_KERNEL);1527 struct mlx5_flow_spec *spec = kvzalloc_obj(*spec);
1528 struct mlx5_flow_destination dest = {};1528 struct mlx5_flow_destination dest = {};
1529 struct mlx5_flow_act flow_act = {};1529 struct mlx5_flow_act flow_act = {};
1530 struct mlx5_flow_handle *ret;1530 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
317 317
318 num_spfs = mlx5_esw_get_num_spfs(dev);318 num_spfs = mlx5_esw_get_num_spfs(dev);
319 num_hwc = MLX5_SF_HWC_FIRST_SPF + num_spfs;319 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);
321 if (!table->hwc) {321 if (!table->hwc) {
322 err = -ENOMEM;322 err = -ENOMEM;
323 goto hwc_alloc_err;323 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
239 if (!buddy->hw_ste_arr)239 if (!buddy->hw_ste_arr)
240 goto free_ste_arr;240 goto free_ste_arr;
241 241
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);
243 if (!buddy->miss_list)243 if (!buddy->miss_list)
244 goto free_hw_ste_arr;244 goto free_hw_ste_arr;
245 245
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
282 int i;282 int i;
283 283
284 /* Allocate bitmap and IRQ vector table */284 /* Allocate bitmap and IRQ vector table */
285 test_data = kzalloc_obj(*test_data, GFP_KERNEL);285 test_data = kzalloc_obj(*test_data);
286 286
287 /* memory allocation failure */287 /* memory allocation failure */
288 if (!test_data)288 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
429 /* length is a power of 2 above PAGE_SIZE, so this divides exactly. */429 /* length is a power of 2 above PAGE_SIZE, so this divides exactly. */
430 npages = length / PAGE_SIZE;430 npages = length / PAGE_SIZE;
431 431
432 gmi->pages_va = kvcalloc(npages, sizeof(*gmi->pages_va), GFP_KERNEL);432 gmi->pages_va = kvzalloc_objs(*gmi->pages_va, npages);
433 if (!gmi->pages_va)433 if (!gmi->pages_va)
434 return -ENOMEM;434 return -ENOMEM;
435 435
436 gmi->pages_dma = kvcalloc(npages, sizeof(*gmi->pages_dma), GFP_KERNEL);436 gmi->pages_dma = kvzalloc_objs(*gmi->pages_dma, npages);
437 if (!gmi->pages_dma)437 if (!gmi->pages_dma)
438 goto free_va;438 goto free_va;
439 439
@@ -825,7 +825,7 @@ int mana_schedule_serv_work(struct gdma_context *gc, enum gdma_eqe_type type) · 385 unmodified lines
825 return -ENODEV;825 return -ENODEV;
826 }826 }
827 827
828 mns_wk = kzalloc(sizeof(*mns_wk), GFP_ATOMIC);828 mns_wk = kzalloc_obj(*mns_wk, GFP_ATOMIC);
829 if (!mns_wk) {829 if (!mns_wk) {
830 module_put(THIS_MODULE);830 module_put(THIS_MODULE);
831 clear_bit(GC_IN_SERVICE, &gc->flags);831 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
1991 *msi_requested = msi;1991 *msi_requested = msi;
1992 }1992 }
1993 1993
1994 gic = kzalloc(sizeof(*gic), GFP_KERNEL);1994 gic = kzalloc_obj(*gic);
1995 if (!gic) {1995 if (!gic) {
1996 gic = ERR_PTR(-ENOMEM);1996 gic = ERR_PTR(-ENOMEM);
1997 if (irq_map.virq)1997 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
659 dev->client_dev = client_dev;659 dev->client_dev = client_dev;
660 dev->num_queues = 0;660 dev->num_queues = 0;
661 661
662 dev->queues = kzalloc_objs(*dev->queues, NTB_NETDEV_MAX_QUEUES,662 dev->queues = kzalloc_objs(*dev->queues, NTB_NETDEV_MAX_QUEUES);
663 GFP_KERNEL);
664 if (!dev->queues) {663 if (!dev->queues) {
665 rc = -ENOMEM;664 rc = -ENOMEM;
666 goto err_free_netdev;665 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
870 870
871 lockdep_assert_held(&ath12k_rproc_info_lock);871 lockdep_assert_held(&ath12k_rproc_info_lock);
872 872
873 rproc_info = kzalloc_obj(*rproc_info, GFP_KERNEL);873 rproc_info = kzalloc_obj(*rproc_info);
874 if (!rproc_info)874 if (!rproc_info)
875 return NULL;875 return NULL;
876 876
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
514 return;514 return;
515 515
516 if (iwl_fw_lookup_cmd_ver(mld->fw, cmd.id, 1) == 1) {516 if (iwl_fw_lookup_cmd_ver(mld->fw, cmd.id, 1) == 1) {
517 struct iwl_mcc_allowed_ap_type_cmd_v1 *cmd_v1 =517 struct iwl_mcc_allowed_ap_type_cmd_v1 *cmd_v1 = kzalloc_obj(*cmd_v1);
518 kzalloc(sizeof(*cmd_v1), GFP_KERNEL);
519 518
520 if (!cmd_v1)519 if (!cmd_v1)
521 return;520 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
289 goto err;289 goto err;
290 }290 }
291 291
292 regd = kzalloc(struct_size(regd, reg_rules, num_of_rules), GFP_KERNEL);292 regd = kzalloc_flex(*regd, reg_rules, num_of_rules);
293 if (!regd) {293 if (!regd) {
294 ret = -ENOMEM;294 ret = -ENOMEM;
295 goto err;295 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
1105 mlink = &msta->deflink;1105 mlink = &msta->deflink;
1106 is_deflink = true;1106 is_deflink = true;
1107 } else {1107 } else {
1108 mlink = kzalloc(sizeof(*mlink), GFP_KERNEL);1108 mlink = kzalloc_obj(*mlink);
1109 if (!mlink) {1109 if (!mlink) {
1110 err = -ENOMEM;1110 err = -ENOMEM;
1111 break;1111 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
336 goto err;336 goto err;
337 }337 }
338 338
339 regd = kzalloc(struct_size(regd, reg_rules, num_of_rules), GFP_KERNEL);339 regd = kzalloc_flex(*regd, reg_rules, num_of_rules);
340 if (!regd) {340 if (!regd) {
341 ret = -ENOMEM;341 ret = -ENOMEM;
342 goto err;342 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
706 706
707 params->num_chans = 0;707 params->num_chans = 0;
708 params->allocated_chans = 0;708 params->allocated_chans = 0;
709 params->channels = kcalloc(chans_to_allocate, sizeof(*params->channels),709 params->channels = kzalloc_objs(*params->channels, chans_to_allocate);
710 GFP_KERNEL);
711 if (!params->channels)710 if (!params->channels)
712 return -ENOMEM;711 return -ENOMEM;
713 712
@@ -728,8 +727,8 @@ static int mm81x_hw_scan_h_init_chan_list(struct mm81x_hw_scan_params *params, · 14 unmodified lines
728 }727 }
729 }728 }
730 729
731 params->powers_qdbm = kmalloc_array(730 params->powers_qdbm = kmalloc_objs(*params->powers_qdbm,
732 num_pwrs_coarse, sizeof(*params->powers_qdbm), GFP_KERNEL);731 num_pwrs_coarse);
733 if (!params->powers_qdbm)732 if (!params->powers_qdbm)
734 return -ENOMEM;733 return -ENOMEM;
735 734
@@ -822,7 +821,7 @@ __mm81x_hw_scan_h_init_params(struct mm81x *mors) · 86 unmodified lines
822 struct mm81x_hw_scan_params *params = mors->hw_scan.params;821 struct mm81x_hw_scan_params *params = mors->hw_scan.params;
823 822
824 if (!params) {823 if (!params) {
825 params = kzalloc_obj(*params, GFP_KERNEL);824 params = kzalloc_obj(*params);
826 if (params)825 if (params)
827 mors->hw_scan.params = params;826 mors->hw_scan.params = params;
828 } else {827 } else {
drivers/net/wireless/morsemicro/mm81x/yaps.c+4−6
@@ -22,15 +22,13 @@ · 21 unmodified lines
22 22
23static int mm81x_yaps_alloc_pkt_buffers(struct mm81x_yaps *yaps)23static int mm81x_yaps_alloc_pkt_buffers(struct mm81x_yaps *yaps)
24{24{
25 yaps->hw.to_chip_pkts = kcalloc(MAX_PKTS_PER_TX_TXN,25 yaps->hw.to_chip_pkts = kzalloc_objs(*yaps->hw.to_chip_pkts,
26 sizeof(*yaps->hw.to_chip_pkts),26 MAX_PKTS_PER_TX_TXN);
27 GFP_KERNEL);
28 if (!yaps->hw.to_chip_pkts)27 if (!yaps->hw.to_chip_pkts)
29 return -ENOMEM;28 return -ENOMEM;
30 29
31 yaps->hw.from_chip_pkts = kcalloc(MAX_PKTS_PER_RX_TXN,30 yaps->hw.from_chip_pkts = kzalloc_objs(*yaps->hw.from_chip_pkts,
32 sizeof(*yaps->hw.from_chip_pkts),31 MAX_PKTS_PER_RX_TXN);
33 GFP_KERNEL);
34 if (!yaps->hw.from_chip_pkts) {32 if (!yaps->hw.from_chip_pkts) {
35 kfree(yaps->hw.to_chip_pkts);33 kfree(yaps->hw.to_chip_pkts);
36 yaps->hw.to_chip_pkts = NULL;34 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
641 641
642 switch (priv->bss_role) {642 switch (priv->bss_role) {
643 case NXPWIFI_BSS_ROLE_UAP:643 case NXPWIFI_BSS_ROLE_UAP:
644 bss_cfg = kzalloc_obj(*bss_cfg, GFP_KERNEL);644 bss_cfg = kzalloc_obj(*bss_cfg);
645 if (!bss_cfg) {645 if (!bss_cfg) {
646 ret = -ENOMEM;646 ret = -ENOMEM;
647 break;647 break;
@@ -1713,7 +1713,7 @@ static int nxpwifi_cfg80211_start_ap(struct wiphy *wiphy, · 1065 unmodified lines
1713 if (!nxpwifi_is_channel_setting_allowable(priv, params->chandef.chan))1713 if (!nxpwifi_is_channel_setting_allowable(priv, params->chandef.chan))
1714 return -EOPNOTSUPP;1714 return -EOPNOTSUPP;
1715 1715
1716 bss_cfg = kzalloc_obj(*bss_cfg, GFP_KERNEL);1716 bss_cfg = kzalloc_obj(*bss_cfg);
1717 if (!bss_cfg)1717 if (!bss_cfg)
1718 return -ENOMEM;1718 return -ENOMEM;
1719 1719
@@ -1866,7 +1866,7 @@ nxpwifi_cfg80211_scan(struct wiphy *wiphy, · 146 unmodified lines
1866 if (!nxpwifi_stop_bg_scan(priv))1866 if (!nxpwifi_stop_bg_scan(priv))
1867 cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0);1867 cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0);
1868 1868
1869 user_scan_cfg = kzalloc_obj(*user_scan_cfg, GFP_KERNEL);1869 user_scan_cfg = kzalloc_obj(*user_scan_cfg);
1870 if (!user_scan_cfg)1870 if (!user_scan_cfg)
1871 return -ENOMEM;1871 return -ENOMEM;
1872 1872
@@ -1973,7 +1973,7 @@ nxpwifi_cfg80211_sched_scan_start(struct wiphy *wiphy, · 100 unmodified lines
1973 request->n_channels, request->scan_plans->interval,1973 request->n_channels, request->scan_plans->interval,
1974 (int)request->ie_len);1974 (int)request->ie_len);
1975 1975
1976 bgscan_cfg = kzalloc_obj(*bgscan_cfg, GFP_KERNEL);1976 bgscan_cfg = kzalloc_obj(*bgscan_cfg);
1977 if (!bgscan_cfg)1977 if (!bgscan_cfg)
1978 return -ENOMEM;1978 return -ENOMEM;
1979 1979
@@ -2304,7 +2304,7 @@ nxpwifi_setup_he_caps(struct nxpwifi_private *priv, · 324 unmodified lines
2304 if (!hw_he_cap_len)2304 if (!hw_he_cap_len)
2305 return;2305 return;
2306 2306
2307 iftype_data = kmalloc_obj(*iftype_data, GFP_KERNEL);2307 iftype_data = kmalloc_obj(*iftype_data);
2308 if (!iftype_data)2308 if (!iftype_data)
2309 return;2309 return;
2310 memset(iftype_data, 0, sizeof(*iftype_data));2310 memset(iftype_data, 0, sizeof(*iftype_data));
@@ -2759,7 +2759,7 @@ static int nxpwifi_set_mef_filter(struct nxpwifi_private *priv, · 448 unmodified lines
2759 if (wowlan->n_patterns || wowlan->magic_pkt)2759 if (wowlan->n_patterns || wowlan->magic_pkt)
2760 num_entries++;2760 num_entries++;
2761 2761
2762 mef_entry = kzalloc_objs(*mef_entry, num_entries, GFP_KERNEL);2762 mef_entry = kzalloc_objs(*mef_entry, num_entries);
2763 if (!mef_entry)2763 if (!mef_entry)
2764 return -ENOMEM;2764 return -ENOMEM;
2765 2765
@@ -3227,7 +3227,7 @@ static int nxpwifi_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev, · 461 unmodified lines
3227 if (!tb[NXPWIFI_TM_ATTR_DATA])3227 if (!tb[NXPWIFI_TM_ATTR_DATA])
3228 return -EINVAL;3228 return -EINVAL;
3229 3229
3230 hostcmd = kzalloc_obj(*hostcmd, GFP_KERNEL);3230 hostcmd = kzalloc_obj(*hostcmd);
3231 if (!hostcmd)3231 if (!hostcmd)
3232 return -ENOMEM;3232 return -ENOMEM;
3233 3233
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
302 302
303 /* Allocate and initialize struct cmd_ctrl_node */303 /* Allocate and initialize struct cmd_ctrl_node */
304 cmd_array = kzalloc_objs(struct cmd_ctrl_node,304 cmd_array = kzalloc_objs(struct cmd_ctrl_node,
305 NXPWIFI_NUM_OF_CMD_BUFFER, GFP_KERNEL);305 NXPWIFI_NUM_OF_CMD_BUFFER);
306 if (!cmd_array)306 if (!cmd_array)
307 return -ENOMEM;307 return -ENOMEM;
308 308
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
143 u16 len;143 u16 len;
144 int ret;144 int ret;
145 145
146 ap_custom_ie = kzalloc_obj(*ap_custom_ie, GFP_KERNEL);146 ap_custom_ie = kzalloc_obj(*ap_custom_ie);
147 if (!ap_custom_ie)147 if (!ap_custom_ie)
148 return -ENOMEM;148 return -ENOMEM;
149 149
@@ -209,7 +209,7 @@ static int nxpwifi_update_vs_ie(const u8 *ies, int ies_len, · 59 unmodified lines
209 vendor_ie = cfg80211_find_vendor_ie(oui, oui_type, ies, ies_len);209 vendor_ie = cfg80211_find_vendor_ie(oui, oui_type, ies, ies_len);
210 if (vendor_ie) {210 if (vendor_ie) {
211 if (!*ie_ptr) {211 if (!*ie_ptr) {
212 *ie_ptr = kzalloc_obj(struct nxpwifi_ie, GFP_KERNEL);212 *ie_ptr = kzalloc_obj(struct nxpwifi_ie);
213 if (!*ie_ptr)213 if (!*ie_ptr)
214 return -ENOMEM;214 return -ENOMEM;
215 ie = *ie_ptr;215 ie = *ie_ptr;
@@ -309,7 +309,7 @@ static int nxpwifi_uap_parse_tail_ies(struct nxpwifi_private *priv, · 93 unmodified lines
309 if (!info->tail || !info->tail_len)309 if (!info->tail || !info->tail_len)
310 return 0;310 return 0;
311 311
312 gen_ie = kzalloc_obj(*gen_ie, GFP_KERNEL);312 gen_ie = kzalloc_obj(*gen_ie);
313 if (!gen_ie)313 if (!gen_ie)
314 return -ENOMEM;314 return -ENOMEM;
315 315
@@ -417,7 +417,7 @@ int nxpwifi_del_mgmt_ies(struct nxpwifi_private *priv) · 101 unmodified lines
417 int ret = 0;417 int ret = 0;
418 418
419 if (priv->gen_idx != NXPWIFI_AUTO_IDX_MASK) {419 if (priv->gen_idx != NXPWIFI_AUTO_IDX_MASK) {
420 gen_ie = kmalloc_obj(*gen_ie, GFP_KERNEL);420 gen_ie = kmalloc_obj(*gen_ie);
421 if (!gen_ie)421 if (!gen_ie)
422 return -ENOMEM;422 return -ENOMEM;
423 423
@@ -434,7 +434,7 @@ int nxpwifi_del_mgmt_ies(struct nxpwifi_private *priv) · 10 unmodified lines
434 }434 }
435 435
436 if (priv->beacon_idx != NXPWIFI_AUTO_IDX_MASK) {436 if (priv->beacon_idx != NXPWIFI_AUTO_IDX_MASK) {
437 beacon_ie = kmalloc_obj(*beacon_ie, GFP_KERNEL);437 beacon_ie = kmalloc_obj(*beacon_ie);
438 if (!beacon_ie) {438 if (!beacon_ie) {
439 ret = -ENOMEM;439 ret = -ENOMEM;
440 goto done;440 goto done;
@@ -444,7 +444,7 @@ int nxpwifi_del_mgmt_ies(struct nxpwifi_private *priv) · 3 unmodified lines
444 beacon_ie->ie_length = 0;444 beacon_ie->ie_length = 0;
445 }445 }
446 if (priv->proberesp_idx != NXPWIFI_AUTO_IDX_MASK) {446 if (priv->proberesp_idx != NXPWIFI_AUTO_IDX_MASK) {
447 pr_ie = kmalloc_obj(*pr_ie, GFP_KERNEL);447 pr_ie = kmalloc_obj(*pr_ie);
448 if (!pr_ie) {448 if (!pr_ie) {
449 ret = -ENOMEM;449 ret = -ENOMEM;
450 goto done;450 goto done;
@@ -454,7 +454,7 @@ int nxpwifi_del_mgmt_ies(struct nxpwifi_private *priv) · 3 unmodified lines
454 pr_ie->ie_length = 0;454 pr_ie->ie_length = 0;
455 }455 }
456 if (priv->assocresp_idx != NXPWIFI_AUTO_IDX_MASK) {456 if (priv->assocresp_idx != NXPWIFI_AUTO_IDX_MASK) {
457 ar_ie = kmalloc_obj(*ar_ie, GFP_KERNEL);457 ar_ie = kmalloc_obj(*ar_ie);
458 if (!ar_ie) {458 if (!ar_ie) {
459 ret = -ENOMEM;459 ret = -ENOMEM;
460 goto done;460 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
20 struct nxpwifi_bss_prio_node *bss_prio;20 struct nxpwifi_bss_prio_node *bss_prio;
21 struct nxpwifi_bss_prio_tbl *tbl = adapter->bss_prio_tbl;21 struct nxpwifi_bss_prio_tbl *tbl = adapter->bss_prio_tbl;
22 22
23 bss_prio = kzalloc_obj(*bss_prio, GFP_KERNEL);23 bss_prio = kzalloc_obj(*bss_prio);
24 if (!bss_prio)24 if (!bss_prio)
25 return -ENOMEM;25 return -ENOMEM;
26 26
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
32 int ret = 0;32 int ret = 0;
33 int i;33 int i;
34 34
35 adapter = kzalloc_obj(*adapter, GFP_KERNEL);35 adapter = kzalloc_obj(*adapter);
36 if (!adapter)36 if (!adapter)
37 return ERR_PTR(-ENOMEM);37 return ERR_PTR(-ENOMEM);
38 38
@@ -55,7 +55,7 @@ static struct nxpwifi_adapter *nxpwifi_register(void *card, struct device *dev, · 16 unmodified lines
55 for (i = 0; i < NXPWIFI_MAX_BSS_NUM; i++) {55 for (i = 0; i < NXPWIFI_MAX_BSS_NUM; i++) {
56 /* Allocate memory for private structure */56 /* Allocate memory for private structure */
57 adapter->priv[i] =57 adapter->priv[i] =
58 kzalloc_obj(struct nxpwifi_private, GFP_KERNEL);58 kzalloc_obj(struct nxpwifi_private);
59 if (!adapter->priv[i]) {59 if (!adapter->priv[i]) {
60 ret = -ENOMEM;60 ret = -ENOMEM;
61 goto error;61 goto error;
@@ -1106,7 +1106,7 @@ void nxpwifi_drv_info_dump(struct nxpwifi_adapter *adapter) · 1044 unmodified lines
1106 p += adapter->if_ops.reg_dump(adapter, p);1106 p += adapter->if_ops.reg_dump(adapter, p);
1107 }1107 }
1108 p += sprintf(p, "\n=== more debug information\n");1108 p += sprintf(p, "\n=== more debug information\n");
1109 debug_info = kzalloc_obj(*debug_info, GFP_KERNEL);1109 debug_info = kzalloc_obj(*debug_info);
1110 if (debug_info) {1110 if (debug_info) {
1111 for (i = 0; i < adapter->priv_num; i++) {1111 for (i = 0; i < adapter->priv_num; i++) {
1112 if (!adapter->priv[i]->netdev)1112 if (!adapter->priv[i]->netdev)
@@ -1242,7 +1242,7 @@ void nxpwifi_init_priv_params(struct nxpwifi_private *priv, · 129 unmodified lines
1242 1242
1243 if (GET_BSS_ROLE(priv) == NXPWIFI_BSS_ROLE_STA ||1243 if (GET_BSS_ROLE(priv) == NXPWIFI_BSS_ROLE_STA ||
1244 GET_BSS_ROLE(priv) == NXPWIFI_BSS_ROLE_UAP) {1244 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);
1246 if (priv->hist_data)1246 if (priv->hist_data)
1247 nxpwifi_hist_data_reset(priv);1247 nxpwifi_hist_data_reset(priv);
1248 }1248 }
drivers/net/wireless/nxp/nxpwifi/scan.c+6−7
@@ -1341,15 +1341,14 @@ int nxpwifi_scan_networks(struct nxpwifi_private *priv, · 1340 unmodified lines
1341 adapter->scan_processing = true;1341 adapter->scan_processing = true;
1342 spin_unlock_bh(&adapter->nxpwifi_cmd_lock);1342 spin_unlock_bh(&adapter->nxpwifi_cmd_lock);
1343 1343
1344 scan_cfg_out = kzalloc_obj(union nxpwifi_scan_cmd_config_tlv,1344 scan_cfg_out = kzalloc_obj(union nxpwifi_scan_cmd_config_tlv);
1345 GFP_KERNEL);
1346 if (!scan_cfg_out) {1345 if (!scan_cfg_out) {
1347 ret = -ENOMEM;1346 ret = -ENOMEM;
1348 goto done;1347 goto done;
1349 }1348 }
1350 1349
1351 scan_chan_list = kzalloc_objs(struct nxpwifi_chan_scan_param_set,1350 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);
1353 if (!scan_chan_list) {1352 if (!scan_chan_list) {
1354 kfree(scan_cfg_out);1353 kfree(scan_cfg_out);
1355 ret = -ENOMEM;1354 ret = -ENOMEM;
@@ -1471,7 +1470,7 @@ static int nxpwifi_save_hidden_ssid_channels(struct nxpwifi_private *priv, · 115 unmodified lines
1471 int chid;1470 int chid;
1472 1471
1473 /* Allocate and fill new bss descriptor */1472 /* Allocate and fill new bss descriptor */
1474 bss_desc = kzalloc_obj(*bss_desc, GFP_KERNEL);1473 bss_desc = kzalloc_obj(*bss_desc);
1475 if (!bss_desc)1474 if (!bss_desc)
1476 return -ENOMEM;1475 return -ENOMEM;
1477 1476
@@ -1512,7 +1511,7 @@ static int nxpwifi_update_curr_bss_params(struct nxpwifi_private *priv, · 34 unmodified lines
1512 int ret;1511 int ret;
1513 1512
1514 /* Allocate and fill new bss descriptor */1513 /* Allocate and fill new bss descriptor */
1515 bss_desc = kzalloc_obj(*bss_desc, GFP_KERNEL);1514 bss_desc = kzalloc_obj(*bss_desc);
1516 if (!bss_desc)1515 if (!bss_desc)
1517 return -ENOMEM;1516 return -ENOMEM;
1518 1517
@@ -1751,7 +1750,7 @@ nxpwifi_active_scan_req_for_passive_chan(struct nxpwifi_private *priv) · 232 unmodified lines
1751 nxpwifi_dbg(adapter, INFO, "No BSS with hidden SSID found on DFS channels\n");1750 nxpwifi_dbg(adapter, INFO, "No BSS with hidden SSID found on DFS channels\n");
1752 return 0;1751 return 0;
1753 }1752 }
1754 user_scan_cfg = kzalloc_obj(*user_scan_cfg, GFP_KERNEL);1753 user_scan_cfg = kzalloc_obj(*user_scan_cfg);
1755 1754
1756 if (!user_scan_cfg)1755 if (!user_scan_cfg)
1757 return -ENOMEM;1756 return -ENOMEM;
@@ -2258,7 +2257,7 @@ int nxpwifi_stop_bg_scan(struct nxpwifi_private *priv) · 500 unmodified lines
2258 return 0;2257 return 0;
2259 }2258 }
2260 2259
2261 bgscan_cfg = kzalloc_obj(*bgscan_cfg, GFP_KERNEL);2260 bgscan_cfg = kzalloc_obj(*bgscan_cfg);
2262 if (!bgscan_cfg)2261 if (!bgscan_cfg)
2263 return -ENOMEM;2262 return -ENOMEM;
2264 2263
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
245 return -EINVAL;245 return -EINVAL;
246 246
247 /* Allocate and fill new bss descriptor */247 /* Allocate and fill new bss descriptor */
248 bss_desc = kzalloc_obj(*bss_desc, GFP_KERNEL);248 bss_desc = kzalloc_obj(*bss_desc);
249 if (!bss_desc)249 if (!bss_desc)
250 return -ENOMEM;250 return -ENOMEM;
251 251
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
2822 if (WARN_ON_ONCE(num_chan > NL80211_MAX_SUPP_REG_RULES))2822 if (WARN_ON_ONCE(num_chan > NL80211_MAX_SUPP_REG_RULES))
2823 return ERR_PTR(-EINVAL);2823 return ERR_PTR(-EINVAL);
2824 2824
2825 regd = kzalloc_flex(*regd, reg_rules, num_chan, GFP_KERNEL);2825 regd = kzalloc_flex(*regd, reg_rules, num_chan);
2826 if (!regd)2826 if (!regd)
2827 return ERR_PTR(-ENOMEM);2827 return ERR_PTR(-ENOMEM);
2828 2828
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
88 struct nxpwifi_sta_node *node;88 struct nxpwifi_sta_node *node;
89 int len, i;89 int len, i;
90 90
91 sinfo = kzalloc_obj(*sinfo, GFP_KERNEL);91 sinfo = kzalloc_obj(*sinfo);
92 if (!sinfo)92 if (!sinfo)
93 return -ENOMEM;93 return -ENOMEM;
94 94
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
1002 nd_region->num_lanes = ndr_desc->num_lanes;1002 nd_region->num_lanes = ndr_desc->num_lanes;
1003 if (!nd_region->num_lanes)1003 if (!nd_region->num_lanes)
1004 goto err_percpu;1004 goto err_percpu;
1005 nd_region->lane = kcalloc(nd_region->num_lanes,1005 nd_region->lane = kzalloc_objs(*nd_region->lane, nd_region->num_lanes);
1006 sizeof(*nd_region->lane), GFP_KERNEL);
1007 if (!nd_region->lane)1006 if (!nd_region->lane)
1008 goto err_percpu;1007 goto err_percpu;
1009 1008
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
2382 if (!head->nr_plids)2382 if (!head->nr_plids)
2383 goto free;2383 goto free;
2384 2384
2385 head->plids = kcalloc(head->nr_plids, sizeof(*head->plids),2385 head->plids = kzalloc_objs(*head->plids, head->nr_plids);
2386 GFP_KERNEL);
2387 if (!head->plids) {2386 if (!head->plids) {
2388 dev_warn(ctrl->device,2387 dev_warn(ctrl->device,
2389 "failed to allocate %u FDP placement IDs\n",2388 "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
201 count++;201 count++;
202 }202 }
203 203
204 qlist = kcalloc(count, sizeof(*qlist), GFP_KERNEL);204 qlist = kzalloc_objs(*qlist, count);
205 if (!qlist) {205 if (!qlist) {
206 err = -ENOMEM;206 err = -ENOMEM;
207 goto out_free_val;207 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
348 348
349 count = opp_table->regulator_count;349 count = opp_table->regulator_count;
350 350
351 uV = kmalloc_array(count, sizeof(*uV), GFP_KERNEL);351 uV = kmalloc_objs(*uV, count);
352 if (!uV)352 if (!uV)
353 return 0;353 return 0;
354 354
@@ -1505,7 +1505,7 @@ struct opp_device *_add_opp_dev(const struct device *dev, · 1150 unmodified lines
1505{1505{
1506 struct opp_device *opp_dev;1506 struct opp_device *opp_dev;
1507 1507
1508 opp_dev = kzalloc(sizeof(*opp_dev), GFP_KERNEL);1508 opp_dev = kzalloc_obj(*opp_dev);
1509 if (!opp_dev)1509 if (!opp_dev)
1510 return NULL;1510 return NULL;
1511 1511
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
57 return -ENODEV;57 return -ENODEV;
58 58
59 struct pci_epc_aux_resource *res __free(kfree) =59 struct pci_epc_aux_resource *res __free(kfree) =
60 kcalloc(count, sizeof(*res), GFP_KERNEL);60 kzalloc_objs(*res, count);
61 if (!res)61 if (!res)
62 return -ENOMEM;62 return -ENOMEM;
63 63
@@ -98,7 +98,7 @@ static int pci_epf_alloc_doorbell_embedded(struct pci_epf *epf, u16 num_db) · 34 unmodified lines
98 addr = iova_base + off;98 addr = iova_base + off;
99 }99 }
100 100
101 msg = kcalloc(num_db, sizeof(*msg), GFP_KERNEL);101 msg = kzalloc_objs(*msg, num_db);
102 if (!msg) {102 if (!msg) {
103 ret = -ENOMEM;103 ret = -ENOMEM;
104 goto err_unmap;104 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
720 return -ENODEV;720 return -ENODEV;
721 }721 }
722 722
723 hsmp_pdev->sock = kcalloc(hsmp_pdev->num_sockets,723 hsmp_pdev->sock = kzalloc_objs(*hsmp_pdev->sock,
724 sizeof(*hsmp_pdev->sock),724 hsmp_pdev->num_sockets);
725 GFP_KERNEL);
726 if (!hsmp_pdev->sock)725 if (!hsmp_pdev->sock)
727 return -ENOMEM;726 return -ENOMEM;
728 727
drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c+2−2
@@ -96,8 +96,8 @@ int hp_alloc_enumeration_data(void) · 95 unmodified lines
96 96
97 if (!bioscfg_drv.enumeration_instances_count)97 if (!bioscfg_drv.enumeration_instances_count)
98 return -EINVAL;98 return -EINVAL;
99 bioscfg_drv.enumeration_data = kvcalloc(bioscfg_drv.enumeration_instances_count,99 bioscfg_drv.enumeration_data = kvzalloc_objs(*bioscfg_drv.enumeration_data,
100 sizeof(*bioscfg_drv.enumeration_data), GFP_KERNEL);100 bioscfg_drv.enumeration_instances_count);
101 101
102 if (!bioscfg_drv.enumeration_data) {102 if (!bioscfg_drv.enumeration_data) {
103 bioscfg_drv.enumeration_instances_count = 0;103 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
93 if (header->num_entries != num_regions)93 if (header->num_entries != num_regions)
94 return ERR_PTR(-EINVAL);94 return ERR_PTR(-EINVAL);
95 95
96 acpi_disc_t disc __free(kfree) = kmalloc_array(num_regions, sizeof(*disc),96 acpi_disc_t disc __free(kfree) = kmalloc_objs(*disc, num_regions);
97 GFP_KERNEL);
98 if (!disc)97 if (!disc)
99 return ERR_PTR(-ENOMEM);98 return ERR_PTR(-ENOMEM);
100 99
drivers/pmdomain/core.c+1−1
@@ -2962,7 +2962,7 @@ int of_genpd_add_child_ids(struct device_node *np, · 2961 unmodified lines
2962 return -EINVAL;2962 return -EINVAL;
2963 2963
2964 /* Allocate tracking array for error unwind (parent/child pairs) */2964 /* 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);
2966 if (!pairs)2966 if (!pairs)
2967 return -ENOMEM;2967 return -ENOMEM;
2968 2968
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
122 struct mode_info *info;122 struct mode_info *info;
123 int ret;123 int ret;
124 124
125 priv = kzalloc_obj(*priv, GFP_KERNEL);125 priv = kzalloc_obj(*priv);
126 if (!priv)126 if (!priv)
127 return -ENOMEM;127 return -ENOMEM;
128 128
129 INIT_LIST_HEAD(&priv->head);129 INIT_LIST_HEAD(&priv->head);
130 130
131 list_for_each_entry(info, &reboot->head, list) {131 list_for_each_entry(info, &reboot->head, list) {
132 sysfs_info = kzalloc_obj(*sysfs_info, GFP_KERNEL);132 sysfs_info = kzalloc_obj(*sysfs_info);
133 if (!sysfs_info) {133 if (!sysfs_info) {
134 ret = -ENOMEM;134 ret = -ENOMEM;
135 goto error;135 goto error;
@@ -188,7 +188,7 @@ int reboot_mode_register(struct reboot_mode_driver *reboot) · 52 unmodified lines
188 continue;188 continue;
189 }189 }
190 190
191 info = kzalloc_obj(*info, GFP_KERNEL);191 info = kzalloc_obj(*info);
192 if (!info) {192 if (!info) {
193 ret = -ENOMEM;193 ret = -ENOMEM;
194 goto error;194 goto error;
drivers/power/sequencing/core.c+1−1
@@ -480,7 +480,7 @@ pwrseq_device_register(const struct pwrseq_config *config) · 479 unmodified lines
480 !config->targets[0])480 !config->targets[0])
481 return ERR_PTR(-EINVAL);481 return ERR_PTR(-EINVAL);
482 482
483 pwrseq = kzalloc(sizeof(*pwrseq), GFP_KERNEL);483 pwrseq = kzalloc_obj(*pwrseq);
484 if (!pwrseq)484 if (!pwrseq)
485 return ERR_PTR(-ENOMEM);485 return ERR_PTR(-ENOMEM);
486 486
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
291 }291 }
292 }292 }
293 293
294 pci_dev = kzalloc(sizeof(*pci_dev), GFP_KERNEL);294 pci_dev = kzalloc_obj(*pci_dev);
295 if (!pci_dev) {295 if (!pci_dev) {
296 ret = -ENOMEM;296 ret = -ENOMEM;
297 goto err_put_ctrl;297 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
904 goto out_put_node;904 goto out_put_node;
905 }905 }
906 906
907 u32 *propdata __free(kfree) = kcalloc(proplen, sizeof(*propdata), GFP_KERNEL);907 u32 *propdata __free(kfree) = kzalloc_objs(*propdata, proplen);
908 if (!propdata) {908 if (!propdata) {
909 power_supply_put_battery_info(psy, info);909 power_supply_put_battery_info(psy, info);
910 err = -EINVAL;910 err = -EINVAL;
@@ -944,7 +944,7 @@ int power_supply_get_battery_info(struct power_supply *psy, · 33 unmodified lines
944 goto out_put_node;944 goto out_put_node;
945 }945 }
946 946
947 propdata = kcalloc(proplen, sizeof(*propdata), GFP_KERNEL);947 propdata = kzalloc_objs(*propdata, proplen);
948 if (!propdata) {948 if (!propdata) {
949 power_supply_put_battery_info(psy, info);949 power_supply_put_battery_info(psy, info);
950 err = -ENOMEM;950 err = -ENOMEM;
@@ -1726,7 +1726,7 @@ __power_supply_register(struct device *parent, · 775 unmodified lines
1726 pr_warn("%s: Expected proper parent device for '%s'\n",1726 pr_warn("%s: Expected proper parent device for '%s'\n",
1727 __func__, desc->name);1727 __func__, desc->name);
1728 1728
1729 psy = kzalloc(sizeof(*psy), GFP_KERNEL);1729 psy = kzalloc_obj(*psy);
1730 if (!psy)1730 if (!psy)
1731 return ERR_PTR(-ENOMEM);1731 return ERR_PTR(-ENOMEM);
1732 1732
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
136 struct timestamp_event_queue *queue;136 struct timestamp_event_queue *queue;
137 char debugfsname[32];137 char debugfsname[32];
138 138
139 queue = kzalloc(sizeof(*queue), GFP_KERNEL);139 queue = kzalloc_obj(*queue);
140 if (!queue)140 if (!queue)
141 return -EINVAL;141 return -EINVAL;
142 queue->mask = bitmap_alloc(PTP_MAX_CHANNELS, GFP_KERNEL);142 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
87{87{
88 struct dasd_device *device;88 struct dasd_device *device;
89 89
90 device = kzalloc_obj(struct dasd_device, GFP_KERNEL);90 device = kzalloc_obj(struct dasd_device);
91 if (!device)91 if (!device)
92 return ERR_PTR(-ENOMEM);92 return ERR_PTR(-ENOMEM);
93 93
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
767 struct fnic_nvmef_info *info;767 struct fnic_nvmef_info *info;
768 int buf_size = 2 * PAGE_SIZE;768 int buf_size = 2 * PAGE_SIZE;
769 769
770 info = kzalloc_obj(struct fnic_nvmef_info, GFP_KERNEL);770 info = kzalloc_obj(struct fnic_nvmef_info);
771 if (!info)771 if (!info)
772 return -ENOMEM;772 return -ENOMEM;
773 773
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
2984 2984
2985static struct leapraid_fw_evt_work *leapraid_alloc_fw_evt_work(void)2985static struct leapraid_fw_evt_work *leapraid_alloc_fw_evt_work(void)
2986{2986{
2987 struct leapraid_fw_evt_work *fw_evt =2987 struct leapraid_fw_evt_work *fw_evt = kzalloc_obj(*fw_evt, GFP_ATOMIC);
2988 kzalloc(sizeof(*fw_evt), GFP_ATOMIC);
2989 2988
2990 if (fw_evt)2989 if (fw_evt)
2991 kref_init(&fw_evt->refcnt);2990 kref_init(&fw_evt->refcnt);
@@ -3644,8 +3643,7 @@ static void leapraid_sas_host_add(struct leapraid_adapter *adapter, · 652 unmodified lines
3644 return;3643 return;
3645 3644
3646 adapter->dev_topo.card.card_phy =3645 adapter->dev_topo.card.card_phy =
3647 kcalloc(phys_num,3646 kzalloc_objs(struct leapraid_card_phy, phys_num);
3648 sizeof(struct leapraid_card_phy), GFP_KERNEL);
3649 if (!adapter->dev_topo.card.card_phy)3647 if (!adapter->dev_topo.card.card_phy)
3650 return;3648 return;
3651 3649
@@ -3763,8 +3761,7 @@ static int leapraid_internal_exp_add(struct leapraid_adapter *adapter, · 111 unmodified lines
3763 }3761 }
3764 3762
3765 topo_node_exp->card_phy =3763 topo_node_exp->card_phy =
3766 kcalloc(topo_node_exp->phys_num,3764 kzalloc_objs(struct leapraid_card_phy, topo_node_exp->phys_num);
3767 sizeof(struct leapraid_card_phy), GFP_KERNEL);
3768 if (!topo_node_exp->card_phy) {3765 if (!topo_node_exp->card_phy) {
3769 dev_err(&adapter->pdev->dev,3766 dev_err(&adapter->pdev->dev,
3770 "%s: Failed to alloc expander phy array, count=%u\n",3767 "%s: Failed to alloc expander phy array, count=%u\n",
@@ -4352,7 +4349,7 @@ static void leapraid_sas_volume_add( · 581 unmodified lines
4352 return;4349 return;
4353 }4350 }
4354 4351
4355 raid_volume = kzalloc(sizeof(*raid_volume), GFP_KERNEL);4352 raid_volume = kzalloc_obj(*raid_volume);
4356 if (!raid_volume)4353 if (!raid_volume)
4357 return;4354 return;
4358 4355
@@ -6090,17 +6087,15 @@ static void leapraid_update_card_port_after_reset( · 1731 unmodified lines
6090 6087
6091 if (!adapter->dev_topo.card.card_phy) {6088 if (!adapter->dev_topo.card.card_phy) {
6092 adapter->dev_topo.card.card_phy =6089 adapter->dev_topo.card.card_phy =
6093 kcalloc(nr_phys, sizeof(struct leapraid_card_phy),6090 kzalloc_objs(struct leapraid_card_phy, nr_phys);
6094 GFP_KERNEL);
6095 if (!adapter->dev_topo.card.card_phy)6091 if (!adapter->dev_topo.card.card_phy)
6096 return;6092 return;
6097 }6093 }
6098 6094
6099 adapter->dev_topo.card.phys_num = nr_phys;6095 adapter->dev_topo.card.phys_num = nr_phys;
6100 6096
6101 new_card_port_table = kcalloc(adapter->dev_topo.card.phys_num,6097 new_card_port_table = kzalloc_objs(struct leapraid_card_port,
6102 sizeof(struct leapraid_card_port),6098 adapter->dev_topo.card.phys_num);
6103 GFP_KERNEL);
6104 if (!new_card_port_table)6099 if (!new_card_port_table)
6105 return;6100 return;
6106 6101
@@ -7224,8 +7219,8 @@ static int leapraid_set_legacy_int(struct leapraid_adapter *adapter) · 1117 unmodified lines
7224 adapter->notification_desc.iopoll_qdex,7219 adapter->notification_desc.iopoll_qdex,
7225 adapter->notification_desc.iopoll_qcnt);7220 adapter->notification_desc.iopoll_qcnt);
7226 adapter->notification_desc.int_rqs =7221 adapter->notification_desc.int_rqs =
7227 kcalloc(adapter->notification_desc.iopoll_qdex,7222 kzalloc_objs(struct leapraid_int_rq,
7228 sizeof(struct leapraid_int_rq), GFP_KERNEL);7223 adapter->notification_desc.iopoll_qdex);
7229 if (!adapter->notification_desc.int_rqs)7224 if (!adapter->notification_desc.int_rqs)
7230 return -ENOMEM;7225 return -ENOMEM;
7231 7226
@@ -7268,9 +7263,8 @@ static int leapraid_set_msix(struct leapraid_adapter *adapter) · 36 unmodified lines
7268 }7263 }
7269 if (iopoll_qcnt) {7264 if (iopoll_qcnt) {
7270 adapter->notification_desc.blk_mq_poll_rqs =7265 adapter->notification_desc.blk_mq_poll_rqs =
7271 kcalloc(iopoll_qcnt,7266 kzalloc_objs(struct leapraid_blk_mq_poll_rq,
7272 sizeof(struct leapraid_blk_mq_poll_rq),7267 iopoll_qcnt);
7273 GFP_KERNEL);
7274 if (!adapter->notification_desc.blk_mq_poll_rqs)7268 if (!adapter->notification_desc.blk_mq_poll_rqs)
7275 return -ENOMEM;7269 return -ENOMEM;
7276 adapter->adapter_attr.rq_cnt =7270 adapter->adapter_attr.rq_cnt =
@@ -7289,8 +7283,8 @@ static int leapraid_set_msix(struct leapraid_adapter *adapter) · 12 unmodified lines
7289 adapter->notification_desc.iopoll_qcnt);7283 adapter->notification_desc.iopoll_qcnt);
7290 7284
7291 adapter->notification_desc.int_rqs =7285 adapter->notification_desc.int_rqs =
7292 kcalloc(adapter->notification_desc.iopoll_qdex,7286 kzalloc_objs(struct leapraid_int_rq,
7293 sizeof(struct leapraid_int_rq), GFP_KERNEL);7287 adapter->notification_desc.iopoll_qdex);
7294 if (!adapter->notification_desc.int_rqs)7288 if (!adapter->notification_desc.int_rqs)
7295 return -ENOMEM;7289 return -ENOMEM;
7296 7290
@@ -7365,9 +7359,8 @@ static int leapraid_set_msi(struct leapraid_adapter *adapter) · 68 unmodified lines
7365 7359
7366 if (iopoll_qcnt) {7360 if (iopoll_qcnt) {
7367 adapter->notification_desc.blk_mq_poll_rqs =7361 adapter->notification_desc.blk_mq_poll_rqs =
7368 kcalloc(iopoll_qcnt,7362 kzalloc_objs(struct leapraid_blk_mq_poll_rq,
7369 sizeof(struct leapraid_blk_mq_poll_rq),7363 iopoll_qcnt);
7370 GFP_KERNEL);
7371 if (!adapter->notification_desc.blk_mq_poll_rqs)7364 if (!adapter->notification_desc.blk_mq_poll_rqs)
7372 return -ENOMEM;7365 return -ENOMEM;
7373 7366
@@ -7404,9 +7397,8 @@ static int leapraid_set_msi(struct leapraid_adapter *adapter) · 30 unmodified lines
7404 adapter->notification_desc.iopoll_qcnt);7397 adapter->notification_desc.iopoll_qcnt);
7405 7398
7406 adapter->notification_desc.int_rqs =7399 adapter->notification_desc.int_rqs =
7407 kcalloc(adapter->notification_desc.iopoll_qdex,7400 kzalloc_objs(struct leapraid_int_rq,
7408 sizeof(struct leapraid_int_rq),7401 adapter->notification_desc.iopoll_qdex);
7409 GFP_KERNEL);
7410 if (!adapter->notification_desc.int_rqs)7402 if (!adapter->notification_desc.int_rqs)
7411 return -ENOMEM;7403 return -ENOMEM;
7412 7404
@@ -7958,18 +7950,16 @@ try_again: · 545 unmodified lines
7958 DIV_ROUND_UP(adapter->adapter_attr.rq_cnt,7950 DIV_ROUND_UP(adapter->adapter_attr.rq_cnt,
7959 LEAPRAID_REP_DESC_CHUNK_SIZE);7951 LEAPRAID_REP_DESC_CHUNK_SIZE);
7960 adapter->mem_desc.rep_desc_seg_maint =7952 adapter->mem_desc.rep_desc_seg_maint =
7961 kcalloc(adapter->adapter_attr.rep_desc_q_seg_cnt,7953 kzalloc_objs(struct leapraid_rep_desc_seg_maint,
7962 sizeof(struct leapraid_rep_desc_seg_maint),7954 adapter->adapter_attr.rep_desc_q_seg_cnt);
7963 GFP_KERNEL);
7964 if (!adapter->mem_desc.rep_desc_seg_maint)7955 if (!adapter->mem_desc.rep_desc_seg_maint)
7965 return -ENOMEM;7956 return -ENOMEM;
7966 7957
7967 rep_desc_q_cnt_allocated = 0;7958 rep_desc_q_cnt_allocated = 0;
7968 for (i = 0; i < adapter->adapter_attr.rep_desc_q_seg_cnt; i++) {7959 for (i = 0; i < adapter->adapter_attr.rep_desc_q_seg_cnt; i++) {
7969 adapter->mem_desc.rep_desc_seg_maint[i].rep_desc_maint =7960 adapter->mem_desc.rep_desc_seg_maint[i].rep_desc_maint =
7970 kcalloc(LEAPRAID_REP_DESC_CHUNK_SIZE,7961 kzalloc_objs(struct leapraid_rep_desc_maint,
7971 sizeof(struct leapraid_rep_desc_maint),7962 LEAPRAID_REP_DESC_CHUNK_SIZE);
7972 GFP_KERNEL);
7973 if (!adapter->mem_desc.rep_desc_seg_maint[i].rep_desc_maint)7963 if (!adapter->mem_desc.rep_desc_seg_maint[i].rep_desc_maint)
7974 return -ENOMEM;7964 return -ENOMEM;
7975 7965
drivers/scsi/scsi_scan.c+1−1
@@ -158,7 +158,7 @@ int scsi_complete_async_scans(void) · 157 unmodified lines
158 * sleep a little. Even if we never get memory, the async158 * sleep a little. Even if we never get memory, the async
159 * scans will finish eventually.159 * scans will finish eventually.
160 */160 */
161 data = kmalloc(sizeof(*data), GFP_KERNEL);161 data = kmalloc_obj(*data);
162 if (!data)162 if (!data)
163 msleep(1);163 msleep(1);
164 } while (!data);164 } 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
65 goto out_put_node;65 goto out_put_node;
66 }66 }
67 67
68 soc_info = kzalloc(sizeof(*soc_info), GFP_KERNEL);68 soc_info = kzalloc_obj(*soc_info);
69 if (!soc_info) {69 if (!soc_info) {
70 ret = -ENOMEM;70 ret = -ENOMEM;
71 goto out_unmap;71 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
434 if (!info->fwnode || !info->ops || !info->ops->match)434 if (!info->fwnode || !info->ops || !info->ops->match)
435 return -EINVAL;435 return -EINVAL;
436 436
437 trigger = kzalloc(sizeof(*trigger), GFP_KERNEL);437 trigger = kzalloc_obj(*trigger);
438 if (!trigger)438 if (!trigger)
439 return -ENOMEM;439 return -ENOMEM;
440 440
drivers/staging/greybus/raw.c+1−1
@@ -178,7 +178,7 @@ static int gb_raw_probe(struct gb_bundle *bundle, · 177 unmodified lines
178 if (minor < 0)178 if (minor < 0)
179 return minor;179 return minor;
180 180
181 raw = kzalloc_obj(*raw, GFP_KERNEL);181 raw = kzalloc_obj(*raw);
182 if (!raw) {182 if (!raw) {
183 ida_free(&minors, minor);183 ida_free(&minors, minor);
184 return -ENOMEM;184 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
5820 }5820 }
5821 5821
5822 descr->in_info = kmalloc_objs(*descr->in_info,5822 descr->in_info = kmalloc_objs(*descr->in_info,
5823 descr->num_stage,5823 descr->num_stage);
5824 GFP_KERNEL);
5825 if (!descr->in_info) {5824 if (!descr->in_info) {
5826 err = -ENOMEM;5825 err = -ENOMEM;
5827 goto ERR;5826 goto ERR;
5828 }5827 }
5829 descr->internal_out_info = kmalloc_objs(*descr->internal_out_info,5828 descr->internal_out_info = kmalloc_objs(*descr->internal_out_info,
5830 descr->num_stage,5829 descr->num_stage);
5831 GFP_KERNEL);
5832 if (!descr->internal_out_info) {5830 if (!descr->internal_out_info) {
5833 err = -ENOMEM;5831 err = -ENOMEM;
5834 goto ERR;5832 goto ERR;
5835 }5833 }
5836 descr->out_info = kmalloc_objs(*descr->out_info,5834 descr->out_info = kmalloc_objs(*descr->out_info,
5837 descr->num_stage,5835 descr->num_stage);
5838 GFP_KERNEL);
5839 if (!descr->out_info) {5836 if (!descr->out_info) {
5840 err = -ENOMEM;5837 err = -ENOMEM;
5841 goto ERR;5838 goto ERR;
5842 }5839 }
5843 descr->vf_info = kmalloc_objs(*descr->vf_info,5840 descr->vf_info = kmalloc_objs(*descr->vf_info,
5844 descr->num_stage,5841 descr->num_stage);
5845 GFP_KERNEL);
5846 if (!descr->vf_info) {5842 if (!descr->vf_info) {
5847 err = -ENOMEM;5843 err = -ENOMEM;
5848 goto ERR;5844 goto ERR;
5849 }5845 }
5850 descr->is_output_stage = kmalloc_objs(*descr->is_output_stage,5846 descr->is_output_stage = kmalloc_objs(*descr->is_output_stage,
5851 descr->num_stage,5847 descr->num_stage);
5852 GFP_KERNEL);
5853 if (!descr->is_output_stage) {5848 if (!descr->is_output_stage) {
5854 err = -ENOMEM;5849 err = -ENOMEM;
5855 goto ERR;5850 goto ERR;
@@ -5970,36 +5965,31 @@ ia_css_pipe_create_cas_scaler_desc(struct ia_css_pipe *pipe, · 114 unmodified lines
5970 descr->num_stage = num_stages;5965 descr->num_stage = num_stages;
5971 5966
5972 descr->in_info = kmalloc_objs(*descr->in_info,5967 descr->in_info = kmalloc_objs(*descr->in_info,
5973 descr->num_stage,5968 descr->num_stage);
5974 GFP_KERNEL);
5975 if (!descr->in_info) {5969 if (!descr->in_info) {
5976 err = -ENOMEM;5970 err = -ENOMEM;
5977 goto ERR;5971 goto ERR;
5978 }5972 }
5979 descr->internal_out_info = kmalloc_objs(*descr->internal_out_info,5973 descr->internal_out_info = kmalloc_objs(*descr->internal_out_info,
5980 descr->num_stage,5974 descr->num_stage);
5981 GFP_KERNEL);
5982 if (!descr->internal_out_info) {5975 if (!descr->internal_out_info) {
5983 err = -ENOMEM;5976 err = -ENOMEM;
5984 goto ERR;5977 goto ERR;
5985 }5978 }
5986 descr->out_info = kmalloc_objs(*descr->out_info,5979 descr->out_info = kmalloc_objs(*descr->out_info,
5987 descr->num_stage,5980 descr->num_stage);
5988 GFP_KERNEL);
5989 if (!descr->out_info) {5981 if (!descr->out_info) {
5990 err = -ENOMEM;5982 err = -ENOMEM;
5991 goto ERR;5983 goto ERR;
5992 }5984 }
5993 descr->vf_info = kmalloc_objs(*descr->vf_info,5985 descr->vf_info = kmalloc_objs(*descr->vf_info,
5994 descr->num_stage,5986 descr->num_stage);
5995 GFP_KERNEL);
5996 if (!descr->vf_info) {5987 if (!descr->vf_info) {
5997 err = -ENOMEM;5988 err = -ENOMEM;
5998 goto ERR;5989 goto ERR;
5999 }5990 }
6000 descr->is_output_stage = kmalloc_objs(*descr->is_output_stage,5991 descr->is_output_stage = kmalloc_objs(*descr->is_output_stage,
6001 descr->num_stage,5992 descr->num_stage);
6002 GFP_KERNEL);
6003 if (!descr->is_output_stage) {5993 if (!descr->is_output_stage) {
6004 err = -ENOMEM;5994 err = -ENOMEM;
6005 goto ERR;5995 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
254 /* Only allocate memory for ISP blob info */254 /* Only allocate memory for ISP blob info */
255 if (sh_css_num_binaries > NUM_OF_SPS) {255 if (sh_css_num_binaries > NUM_OF_SPS) {
256 sh_css_blob_info =256 sh_css_blob_info =
257 kmalloc_array(sh_css_num_binaries - NUM_OF_SPS,257 kmalloc_objs(*sh_css_blob_info,
258 sizeof(*sh_css_blob_info), GFP_KERNEL);258 sh_css_num_binaries - NUM_OF_SPS);
259 if (!sh_css_blob_info)259 if (!sh_css_blob_info)
260 return -ENOMEM;260 return -ENOMEM;
261 } else {261 } 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
230 struct qcomtee_context_data *ctxdata = uo->ctx->data;230 struct qcomtee_context_data *ctxdata = uo->ctx->data;
231 int errno;231 int errno;
232 232
233 struct qcomtee_ureq *ureq __free(kfree) = kzalloc(sizeof(*ureq),233 struct qcomtee_ureq *ureq __free(kfree) = kzalloc_obj(*ureq);
234 GFP_KERNEL);
235 if (!ureq)234 if (!ureq)
236 return -ENOMEM;235 return -ENOMEM;
237 236
drivers/thunderbolt/stream.c+5−7
@@ -408,8 +408,7 @@ static int tbstream_dev_alloc_rx_buffers(struct tbstream_dev *sdev) · 407 unmodified lines
408 size_t ring_size = tb_ring_size(sdev->rx_ring.ring);408 size_t ring_size = tb_ring_size(sdev->rx_ring.ring);
409 int i;409 int i;
410 410
411 sdev->rx_ring.frames = kcalloc(ring_size, sizeof(struct tbstream_frame),411 sdev->rx_ring.frames = kzalloc_objs(struct tbstream_frame, ring_size);
412 GFP_KERNEL);
413 if (!sdev->rx_ring.frames)412 if (!sdev->rx_ring.frames)
414 return -ENOMEM;413 return -ENOMEM;
415 414
@@ -463,8 +462,7 @@ static int tbstream_dev_alloc_tx_buffers(struct tbstream_dev *sdev) · 47 unmodified lines
463 size_t ring_size = tb_ring_size(sdev->tx_ring.ring);462 size_t ring_size = tb_ring_size(sdev->tx_ring.ring);
464 int i;463 int i;
465 464
466 sdev->tx_ring.frames = kcalloc(ring_size, sizeof(struct tbstream_frame),465 sdev->tx_ring.frames = kzalloc_objs(struct tbstream_frame, ring_size);
467 GFP_KERNEL);
468 if (!sdev->tx_ring.frames)466 if (!sdev->tx_ring.frames)
469 return -ENOMEM;467 return -ENOMEM;
470 468
@@ -1498,7 +1496,7 @@ tbstream_dev_make_group(struct config_group *group, const char *name) · 1027 unmodified lines
1498 if (strlen(name) > TB_PROPERTY_KEY_SIZE)1496 if (strlen(name) > TB_PROPERTY_KEY_SIZE)
1499 return ERR_PTR(-ENAMETOOLONG);1497 return ERR_PTR(-ENAMETOOLONG);
1500 1498
1501 sdev = kzalloc_obj(*sdev, GFP_KERNEL);1499 sdev = kzalloc_obj(*sdev);
1502 if (!sdev)1500 if (!sdev)
1503 return ERR_PTR(-ENOMEM);1501 return ERR_PTR(-ENOMEM);
1504 1502
@@ -1592,7 +1590,7 @@ tbstream_make_group(struct config_group *group, const char *name) · 87 unmodified lines
1592 if (sscanf(name, "%u-%llx.%u", &domain, &route, &index) != 3)1590 if (sscanf(name, "%u-%llx.%u", &domain, &route, &index) != 3)
1593 return ERR_PTR(-EINVAL);1591 return ERR_PTR(-EINVAL);
1594 1592
1595 sg = kzalloc_obj(*sg, GFP_KERNEL);1593 sg = kzalloc_obj(*sg);
1596 if (!sg)1594 if (!sg)
1597 return ERR_PTR(-ENOMEM);1595 return ERR_PTR(-ENOMEM);
1598 1596
@@ -1698,7 +1696,7 @@ static int tbstream_probe(struct tb_service *svc) · 99 unmodified lines
1698{1696{
1699 struct tbstream *stream;1697 struct tbstream *stream;
1700 1698
1701 stream = kzalloc_obj(*stream, GFP_KERNEL);1699 stream = kzalloc_obj(*stream);
1702 if (!stream)1700 if (!stream)
1703 return -ENOMEM;1701 return -ENOMEM;
1704 1702
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
954 unsigned int i, first_idx;954 unsigned int i, first_idx;
955 int ret;955 int ret;
956 956
957 brd->ports = kcalloc(MAX_PORTS_PER_BOARD, sizeof(*brd->ports),957 brd->ports = kzalloc_objs(*brd->ports, MAX_PORTS_PER_BOARD);
958 GFP_KERNEL);
959 if (brd->ports == NULL) {958 if (brd->ports == NULL) {
960 printk(KERN_ERR "cannot allocate memory for ports\n");959 printk(KERN_ERR "cannot allocate memory for ports\n");
961 ret = -ENOMEM;960 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
776 struct uni_pagedict *dict;776 struct uni_pagedict *dict;
777 unsigned int d, r, g;777 unsigned int d, r, g;
778 778
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);
780 if (!unilist)781 if (!unilist)
781 return -ENOMEM;782 return -ENOMEM;
782 783
drivers/ufs/core/ufs-txeq.c+1−1
@@ -1073,7 +1073,7 @@ static int __ufshcd_tx_eqtr(struct ufs_hba *hba, · 1072 unmodified lines
1073 struct ufs_pa_layer_attr *pwr_mode)1073 struct ufs_pa_layer_attr *pwr_mode)
1074{1074{
1075 struct ufshcd_tx_eqtr_data *eqtr_data __free(kfree) =1075 struct ufshcd_tx_eqtr_data *eqtr_data __free(kfree) =
1076 kzalloc(sizeof(*eqtr_data), GFP_KERNEL);1076 kzalloc_obj(*eqtr_data);
1077 struct tx_eqtr_iter h_iter = {};1077 struct tx_eqtr_iter h_iter = {};
1078 struct tx_eqtr_iter d_iter = {};1078 struct tx_eqtr_iter d_iter = {};
1079 u32 gear = pwr_mode->gear_tx;1079 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
2761 struct tx_eqtr_iter *d_iter)2761 struct tx_eqtr_iter *d_iter)
2762{2762{
2763 struct ufshcd_tx_eq_params *params __free(kfree) =2763 struct ufshcd_tx_eq_params *params __free(kfree) =
2764 kzalloc(sizeof(*params), GFP_KERNEL);2764 kzalloc_obj(*params);
2765 struct ufs_qcom_host *host = ufshcd_get_variant(hba);2765 struct ufs_qcom_host *host = ufshcd_get_variant(hba);
2766 struct ufs_pa_layer_attr old_pwr_info;2766 struct ufs_pa_layer_attr old_pwr_info;
2767 u32 fom[PA_MAXDATALANES] = { 0 };2767 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
1766 int status;1766 int status;
1767 1767
1768 /* allocate and initialize one new instance */1768 /* allocate and initialize one new instance */
1769 ncm = kzalloc(sizeof(*ncm), GFP_KERNEL);1769 ncm = kzalloc_obj(*ncm);
1770 if (!ncm)1770 if (!ncm)
1771 return ERR_PTR(-ENOMEM);1771 return ERR_PTR(-ENOMEM);
1772 1772
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
696 696
697 size = np * sizeof(*iso);697 size = np * sizeof(*iso);
698 698
699 buff = kcalloc(np, sizeof(*iso), GFP_KERNEL);699 buff = kzalloc_objs(*iso, np);
700 if (!buff)700 if (!buff)
701 return -ENOMEM;701 return -ENOMEM;
702 702
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
1478 /* No need for kzalloc as it is initialized in following hypercall1478 /* No need for kzalloc as it is initialized in following hypercall
1479 * GNTTABOP_setup_table.1479 * GNTTABOP_setup_table.
1480 */1480 */
1481 frames = kmalloc_array(nr_gframes, sizeof(*frames), GFP_ATOMIC);1481 frames = kmalloc_objs(*frames, nr_gframes, GFP_ATOMIC);
1482 if (!frames)1482 if (!frames)
1483 return -ENOMEM;1483 return -ENOMEM;
1484 1484
fs/9p/vfs_dentry.c+1−2
@@ -113,8 +113,7 @@ void v9fs_dentry_fid_remove(struct dentry *dentry) · 112 unmodified lines
113 */113 */
114static int v9fs_dentry_init(struct dentry *dentry)114static int v9fs_dentry_init(struct dentry *dentry)
115{115{
116 struct v9fs_dentry *v9fs_dentry = kzalloc(sizeof(*v9fs_dentry),116 struct v9fs_dentry *v9fs_dentry = kzalloc_obj(*v9fs_dentry);
117 GFP_KERNEL);
118 117
119 if (!v9fs_dentry)118 if (!v9fs_dentry)
120 return -ENOMEM;119 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
1801 goto error;1801 goto error;
1802 1802
1803 ret = -ENOMEM;1803 ret = -ENOMEM;
1804 symlink = kmalloc_flex(struct afs_symlink, content, clen + 1, GFP_KERNEL);1804 symlink = kmalloc_flex(struct afs_symlink, content, clen + 1);
1805 if (!symlink)1805 if (!symlink)
1806 goto error;1806 goto error;
1807 refcount_set(&symlink->ref, 1);1807 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
119 vnode->directory_size = i_size;119 vnode->directory_size = i_size;
120 120
121 /* Copy the symlink. */121 /* Copy the symlink. */
122 symlink = kmalloc_flex(struct afs_symlink, content, i_size + 1,122 symlink = kmalloc_flex(struct afs_symlink, content, i_size + 1);
123 GFP_KERNEL);
124 if (!symlink)123 if (!symlink)
125 return -ENOMEM;124 return -ENOMEM;
126 125
fs/binfmt_misc.c+3−4
@@ -331,8 +331,8 @@ static int entry_attach_interpreter(struct binfmt_misc_entry *e, · 330 unmodified lines
331 return -ENOSPC;331 return -ENOSPC;
332 332
333 /* One allocation, both strings in it, like the entry's own buffer. */333 /* One allocation, both strings in it, like the entry's own buffer. */
334 interp = kmalloc(struct_size(interp, name, nlen + plen + 2),334 interp = kmalloc_flex(*interp, name, nlen + plen + 2,
335 GFP_KERNEL_ACCOUNT);335 GFP_KERNEL_ACCOUNT);
336 if (!interp) {336 if (!interp) {
337 dec_ucount(ucounts, UCOUNT_BINFMT_MISC_INTERPRETERS);337 dec_ucount(ucounts, UCOUNT_BINFMT_MISC_INTERPRETERS);
338 return -ENOMEM;338 return -ENOMEM;
@@ -858,8 +858,7 @@ static struct binfmt_misc_entry *create_entry(const char __user *buffer, · 519 unmodified lines
858 if ((count < 11) || (count > MAX_REGISTER_LENGTH))858 if ((count < 11) || (count > MAX_REGISTER_LENGTH))
859 return ERR_PTR(-EINVAL);859 return ERR_PTR(-EINVAL);
860 860
861 e = kmalloc(struct_size(e, buf, count + MISC_DELIM_PAD),861 e = kmalloc_flex(*e, buf, count + MISC_DELIM_PAD, GFP_KERNEL_ACCOUNT);
862 GFP_KERNEL_ACCOUNT);
863 if (!e)862 if (!e)
864 return ERR_PTR(-ENOMEM);863 return ERR_PTR(-ENOMEM);
865 864
fs/ceph/addr.c+1−1
@@ -2546,7 +2546,7 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci, · 2545 unmodified lines
2546 }2546 }
2547 2547
2548 pool_ns_len = pool_ns ? pool_ns->len : 0;2548 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);
2550 if (!perm) {2550 if (!perm) {
2551 err = -ENOMEM;2551 err = -ENOMEM;
2552 goto out_unlock;2552 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
5492 goto out_complete;5492 goto out_complete;
5493 }5493 }
5494 5494
5495 sessions = kcalloc(max_sessions, sizeof(*sessions), GFP_KERNEL);5495 sessions = kzalloc_objs(*sessions, max_sessions);
5496 if (!sessions) {5496 if (!sessions) {
5497 mutex_unlock(&mdsc->mutex);5497 mutex_unlock(&mdsc->mutex);
5498 ret = -ENOMEM;5498 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
245 return 0;245 return 0;
246 }246 }
247 247
248 snap = kcalloc(count, sizeof(*snap), GFP_NOFS);248 snap = kzalloc_objs(*snap, count, GFP_NOFS);
249 if (!snap) {249 if (!snap) {
250 atomic64_inc(&tracker->snapshot_failures);250 atomic64_inc(&tracker->snapshot_failures);
251 return -ENOMEM;251 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
1000 return false;1000 return false;
1001 }1001 }
1002 1002
1003 helper_argv = kmalloc_array(argc + 1, sizeof(*helper_argv), GFP_KERNEL);1003 helper_argv = kmalloc_objs(*helper_argv, argc + 1);
1004 if (!helper_argv) {1004 if (!helper_argv) {
1005 coredump_report_failure("%s failed to allocate memory", __func__);1005 coredump_report_failure("%s failed to allocate memory", __func__);
1006 return false;1006 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
1116 else if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE)1116 else if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE)
1117 inode_len += ei->i_extra_isize;1117 inode_len += ei->i_extra_isize;
1118 1118
1119 snap = kmalloc(struct_size(snap, inode_buf, inode_len), GFP_NOFS);1119 snap = kmalloc_flex(*snap, inode_buf, inode_len, GFP_NOFS);
1120 if (!snap) {1120 if (!snap) {
1121 atomic64_inc(&stats->snap_fail_nomem);1121 atomic64_inc(&stats->snap_fail_nomem);
1122 ext4_fc_set_snap_err(snap_err, EXT4_FC_SNAP_ERR_NOMEM);1122 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
1522 if (nr_inodes > EXT4_FC_SNAPSHOT_MAX_INODES)1522 if (nr_inodes > EXT4_FC_SNAPSHOT_MAX_INODES)
1523 return -E2BIG;1523 return -E2BIG;
1524 1524
1525 inodes = kvcalloc(nr_inodes, sizeof(*inodes), GFP_NOFS);1525 inodes = kvzalloc_objs(*inodes, nr_inodes, GFP_NOFS);
1526 if (!inodes)1526 if (!inodes)
1527 return -ENOMEM;1527 return -ENOMEM;
1528 1528
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
1597 * manually extract pages using iov_iter_extract_pages() and then1597 * manually extract pages using iov_iter_extract_pages() and then
1598 * copy that to a folios array.1598 * copy that to a folios array.
1599 */1599 */
1600 struct page **pages = kcalloc(max_pages, sizeof(struct page *),1600 struct page **pages = kzalloc_objs(struct page *, max_pages);
1601 GFP_KERNEL);
1602 if (!pages) {1601 if (!pages) {
1603 ret = -ENOMEM;1602 ret = -ENOMEM;
1604 goto out;1603 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
336static struct page **fuse_readdir_alloc_buf(struct fuse_args_pages *ap, size_t *bufsize)336static struct page **fuse_readdir_alloc_buf(struct fuse_args_pages *ap, size_t *bufsize)
337{337{
338 unsigned int i, nr_alloc, nr_pages = DIV_ROUND_UP(*bufsize, PAGE_SIZE);338 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);
340 340
341 if (!pages)341 if (!pages)
342 return NULL;342 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
312 return NULL;312 return NULL;
313 }313 }
314 314
315 node = kzalloc_flex(*node, page, tree->pages_per_bnode, GFP_KERNEL);315 node = kzalloc_flex(*node, page, tree->pages_per_bnode);
316 if (!node)316 if (!node)
317 return NULL;317 return NULL;
318 node->tree = tree;318 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
5999 return -EPERM;5999 return -EPERM;
6000 }6000 }
6001 6001
6002 ks = kmalloc(sizeof(*ks), GFP_KERNEL_ACCOUNT);6002 ks = kmalloc_obj(*ks, GFP_KERNEL_ACCOUNT);
6003 if (!ks)6003 if (!ks)
6004 return -ENOMEM;6004 return -ENOMEM;
6005 6005
fs/nfsd/export.c+3−4
@@ -358,7 +358,7 @@ int nfsd_nl_expkey_get_reqs_dumpit(struct sk_buff *skb, · 357 unmodified lines
358 goto out_unlock;358 goto out_unlock;
359 }359 }
360 360
361 items = kcalloc(cnt, sizeof(*items), GFP_KERNEL);361 items = kzalloc_objs(*items, cnt);
362 seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);362 seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);
363 if (!items || !seqnos) {363 if (!items || !seqnos) {
364 ret = -ENOMEM;364 ret = -ENOMEM;
@@ -685,7 +685,7 @@ int nfsd_nl_svc_export_get_reqs_dumpit(struct sk_buff *skb, · 320 unmodified lines
685 goto out_unlock;685 goto out_unlock;
686 }686 }
687 687
688 items = kcalloc(cnt, sizeof(*items), GFP_KERNEL);688 items = kzalloc_objs(*items, cnt);
689 seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);689 seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);
690 pathbuf = kmalloc(PATH_MAX, GFP_KERNEL);690 pathbuf = kmalloc(PATH_MAX, GFP_KERNEL);
691 if (!items || !seqnos || !pathbuf) {691 if (!items || !seqnos || !pathbuf) {
@@ -786,8 +786,7 @@ static int nfsd_nl_parse_fslocations(struct nlattr *attr, · 94 unmodified lines
786 if (!count)786 if (!count)
787 return 0;787 return 0;
788 788
789 fsloc->locations = kcalloc(count, sizeof(struct nfsd4_fs_location),789 fsloc->locations = kzalloc_objs(struct nfsd4_fs_location, count);
790 GFP_KERNEL);
791 if (!fsloc->locations)790 if (!fsloc->locations)
792 return -ENOMEM;791 return -ENOMEM;
793 792
fs/nfsd/nfs4callback.c+2−2
@@ -1981,12 +1981,12 @@ int nfsd_net_cb_init(struct nfsd_net *nn) · 1980 unmodified lines
1981{1981{
1982 struct nfsd_net_cb *cb;1982 struct nfsd_net_cb *cb;
1983 1983
1984 cb = kzalloc(sizeof(*cb), GFP_KERNEL);1984 cb = kzalloc_obj(*cb);
1985 if (!cb)1985 if (!cb)
1986 return -ENOMEM;1986 return -ENOMEM;
1987 1987
1988 cb->version4.counts = kzalloc_objs(unsigned int,1988 cb->version4.counts = kzalloc_objs(unsigned int,
1989 ARRAY_SIZE(nfs4_cb_procedures), GFP_KERNEL);1989 ARRAY_SIZE(nfs4_cb_procedures));
1990 if (!cb->version4.counts) {1990 if (!cb->version4.counts) {
1991 kfree(cb);1991 kfree(cb);
1992 return -ENOMEM;1992 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
1341 return NULL;1341 return NULL;
1342 }1342 }
1343 1343
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);
1345 if (!ncn->ncn_nf) {1345 if (!ncn->ncn_nf) {
1346 nfs4_put_stid(&dp->dl_stid);1346 nfs4_put_stid(&dp->dl_stid);
1347 return NULL;1347 return NULL;
@@ -10419,8 +10419,9 @@ alloc_nfsd_notify_event(u32 mask, const struct qstr *q, struct dentry *dentry, · 9071 unmodified lines
10419 newnamelen = newname.name.len;10419 newnamelen = newname.name.len;
10420 }10420 }
10421 10421
10422 ne = kmalloc(struct_size(ne, ne_name, q->len + 1 +10422 ne = kmalloc_flex(*ne, ne_name,
10423 (newnamelen ? newnamelen + 1 : 0)), GFP_NOFS);10423 q->len + 1 + (newnamelen ? newnamelen + 1 : 0),
10424 GFP_NOFS);
10424 if (!ne)10425 if (!ne)
10425 goto out;10426 goto out;
10426 10427
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
1647 k1 = get_unaligned_le64(nla_data(attr) + 8);1647 k1 = get_unaligned_le64(nla_data(attr) + 8);
1648 1648
1649 if (!fh_key) {1649 if (!fh_key) {
1650 fh_key = kmalloc(sizeof(siphash_key_t), GFP_KERNEL);1650 fh_key = kmalloc_obj(siphash_key_t);
1651 if (!fh_key) {1651 if (!fh_key) {
1652 trace_nfsd_ctl_fh_key_set(false, -ENOMEM);1652 trace_nfsd_ctl_fh_key_set(false, -ENOMEM);
1653 return -ENOMEM;1653 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
40 end_cluster = vol->nr_clusters;40 end_cluster = vol->nr_clusters;
41 }41 }
42 42
43 ra = kzalloc(sizeof(*ra), GFP_NOFS);43 ra = kzalloc_obj(*ra, GFP_NOFS);
44 if (!ra)44 if (!ra)
45 return -ENOMEM;45 return -ENOMEM;
46 46
fs/ntfs/compress.c+4−4
@@ -514,8 +514,8 @@ int ntfs_read_compressed_block(struct folio *folio) · 513 unmodified lines
514 return -EIO;514 return -EIO;
515 }515 }
516 516
517 pages = kmalloc_array(nr_pages, sizeof(struct page *), GFP_NOFS);517 pages = kmalloc_objs(struct page *, nr_pages, GFP_NOFS);
518 completed_pages = kmalloc_array(nr_pages + 1, sizeof(int), GFP_NOFS);518 completed_pages = kmalloc_objs(int, nr_pages + 1, GFP_NOFS);
519 519
520 if (unlikely(!pages || !completed_pages)) {520 if (unlikely(!pages || !completed_pages)) {
521 kfree(pages);521 kfree(pages);
@@ -1262,7 +1262,7 @@ static int ntfs_compress_workspace_init(struct ntfs_inode *ni, · 740 unmodified lines
1262 size = ni->itype.compressed.block_size + 2 *1262 size = ni->itype.compressed.block_size + 2 *
1263 (ni->itype.compressed.block_size / NTFS_SB_SIZE) + 2;1263 (ni->itype.compressed.block_size / NTFS_SB_SIZE) + 2;
1264 ws->nr_pages = DIV_ROUND_UP(size, PAGE_SIZE);1264 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);
1266 if (!ws->pages)1266 if (!ws->pages)
1267 return -ENOMEM;1267 return -ENOMEM;
1268 1268
@@ -1483,7 +1483,7 @@ int ntfs_compress_write(struct ntfs_inode *ni, loff_t pos, size_t count, · 214 unmodified lines
1483 pages_per_cb = DIV_ROUND_UP(offset_in_page(pos & ~(cb_size - 1)) +1483 pages_per_cb = DIV_ROUND_UP(offset_in_page(pos & ~(cb_size - 1)) +
1484 cb_size, PAGE_SIZE);1484 cb_size, PAGE_SIZE);
1485 1485
1486 pages = kmalloc_array(pages_per_cb, sizeof(struct page *), GFP_NOFS);1486 pages = kmalloc_objs(struct page *, pages_per_cb, GFP_NOFS);
1487 if (!pages)1487 if (!pages)
1488 return -ENOMEM;1488 return -ENOMEM;
1489 ctx = kvzalloc_obj(*ctx, GFP_NOFS);1489 ctx = kvzalloc_obj(*ctx, GFP_NOFS);
fs/ntfs/dir.c+8−8
@@ -166,8 +166,8 @@ found_it: · 165 unmodified lines
166 */166 */
167 if (ie->key.file_name.file_name_type == FILE_NAME_DOS) {167 if (ie->key.file_name.file_name_type == FILE_NAME_DOS) {
168 if (!name) {168 if (!name) {
169 name = kmalloc(sizeof(struct ntfs_name),169 name = kmalloc_obj(struct ntfs_name,
170 GFP_NOFS);170 GFP_NOFS);
171 if (!name) {171 if (!name) {
172 err = -ENOMEM;172 err = -ENOMEM;
173 goto err_out;173 goto err_out;
@@ -401,8 +401,8 @@ found_it2: · 227 unmodified lines
401 */401 */
402 if (ie->key.file_name.file_name_type == FILE_NAME_DOS) {402 if (ie->key.file_name.file_name_type == FILE_NAME_DOS) {
403 if (!name) {403 if (!name) {
404 name = kmalloc(sizeof(struct ntfs_name),404 name = kmalloc_obj(struct ntfs_name,
405 GFP_NOFS);405 GFP_NOFS);
406 if (!name) {406 if (!name) {
407 err = -ENOMEM;407 err = -ENOMEM;
408 goto unm_err_out;408 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
700 if (dir_start_index >= dir_end_index)700 if (dir_start_index >= dir_end_index)
701 return 0;701 return 0;
702 702
703 dir_ra = kzalloc(sizeof(*dir_ra), GFP_NOFS);703 dir_ra = kzalloc_obj(*dir_ra, GFP_NOFS);
704 if (!dir_ra)704 if (!dir_ra)
705 return -ENOMEM;705 return -ENOMEM;
706 706
@@ -777,7 +777,7 @@ static int ntfs_readdir(struct file *file, struct dir_context *actor) · 70 unmodified lines
777 return -ENOMEM;777 return -ENOMEM;
778 }778 }
779 779
780 ra = kzalloc(sizeof(struct file_ra_state), GFP_NOFS);780 ra = kzalloc_obj(struct file_ra_state, GFP_NOFS);
781 if (!ra) {781 if (!ra) {
782 kfree(name);782 kfree(name);
783 ntfs_index_ctx_put(ictx);783 ntfs_index_ctx_put(ictx);
@@ -813,7 +813,7 @@ static int ntfs_readdir(struct file *file, struct dir_context *actor) · 29 unmodified lines
813 goto out;813 goto out;
814 }814 }
815 } else if (!private) {815 } else if (!private) {
816 private = kzalloc(sizeof(struct ntfs_file_private), GFP_KERNEL);816 private = kzalloc_obj(struct ntfs_file_private);
817 if (!private) {817 if (!private) {
818 err = -ENOMEM;818 err = -ENOMEM;
819 goto out;819 goto out;
@@ -949,7 +949,7 @@ nextdir: · 129 unmodified lines
949 }949 }
950 950
951 if (!nir) {951 if (!nir) {
952 nir = kzalloc(sizeof(struct ntfs_index_ra), GFP_KERNEL);952 nir = kzalloc_obj(struct ntfs_index_ra);
953 if (nir) {953 if (nir) {
954 nir->start_index = index;954 nir->start_index = index;
955 nir->count = 1;955 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
235 ea_info_qsize = le32_to_cpu(p_ea_info->ea_query_length);235 ea_info_qsize = le32_to_cpu(p_ea_info->ea_query_length);
236 } else {236 } else {
237create_ea_info:237create_ea_info:
238 p_ea_info = kzalloc(sizeof(struct ea_information), GFP_NOFS);238 p_ea_info = kzalloc_obj(struct ea_information, GFP_NOFS);
239 if (!p_ea_info)239 if (!p_ea_info)
240 return -ENOMEM;240 return -ENOMEM;
241 241
fs/ntfs/index.c+1−1
@@ -1660,7 +1660,7 @@ resplit: · 1659 unmodified lines
1660 goto out;1660 goto out;
1661 }1661 }
1662 } else {1662 } else {
1663 si = kzalloc(sizeof(struct split_info), GFP_NOFS);1663 si = kzalloc_obj(struct split_info, GFP_NOFS);
1664 if (!si) {1664 if (!si) {
1665 ntfs_ibm_clear(icx, new_vcn);1665 ntfs_ibm_clear(icx, new_vcn);
1666 ret = -ENOMEM;1666 ret = -ENOMEM;
fs/ntfs/logfile.c+1−1
@@ -691,7 +691,7 @@ map_vcn: · 690 unmodified lines
691 691
692 memset(empty_buf, 0xff, vol->cluster_size);692 memset(empty_buf, 0xff, vol->cluster_size);
693 693
694 ra = kzalloc(sizeof(*ra), GFP_NOFS);694 ra = kzalloc_obj(*ra, GFP_NOFS);
695 if (!ra)695 if (!ra)
696 goto err;696 goto err;
697 697
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
2635 struct ntfs_inode *ni = NTFS_I(vi);2635 struct ntfs_inode *ni = NTFS_I(vi);
2636 struct ntfs_volume *vol = ni->vol;2636 struct ntfs_volume *vol = ni->vol;
2637 u8 *kaddr;2637 u8 *kaddr;
2638 struct ntfs_inode **locked_nis __free(kfree) = kmalloc_array(PAGE_SIZE / NTFS_BLOCK_SIZE,2638 struct ntfs_inode **locked_nis __free(kfree) = kmalloc_objs(struct ntfs_inode *,
2639 sizeof(struct ntfs_inode *), GFP_NOFS);2639 PAGE_SIZE / NTFS_BLOCK_SIZE,
2640 GFP_NOFS);
2640 int nr_locked_nis = 0, err = 0, mft_ofs, prev_mft_ofs;2641 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 struct inode **ref_inos __free(kfree) = kmalloc_objs(struct inode *,
2642 sizeof(struct inode *), GFP_NOFS);2643 PAGE_SIZE / NTFS_BLOCK_SIZE,
2644 GFP_NOFS);
2643 int nr_ref_inos = 0;2645 int nr_ref_inos = 0;
2644 struct bio *bio = NULL;2646 struct bio *bio = NULL;
2645 u64 mft_no;2647 u64 mft_no;
fs/ntfs/runlist.c+7−7
@@ -1804,7 +1804,7 @@ merge_src_rle: · 1803 unmodified lines
1804 new_2nd_cnt = src_cnt;1804 new_2nd_cnt = src_cnt;
1805 new_cnt = new_1st_cnt + new_2nd_cnt + new_3rd_cnt;1805 new_cnt = new_1st_cnt + new_2nd_cnt + new_3rd_cnt;
1806 new_cnt += dst_rl_split.lcn >= LCN_HOLE ? 1 : 0;1806 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);
1808 if (!new_rl)1808 if (!new_rl)
1809 return ERR_PTR(-ENOMEM);1809 return ERR_PTR(-ENOMEM);
1810 1810
@@ -1888,13 +1888,13 @@ struct runlist_element *ntfs_rl_punch_hole(struct runlist_element *dst_rl, int d · 77 unmodified lines
1888 1888
1889 punch_cnt = (int)(e_rl - s_rl) + 1;1889 punch_cnt = (int)(e_rl - s_rl) + 1;
1890 1890
1891 *punch_rl = kvcalloc(punch_cnt + 1, sizeof(struct runlist_element),1891 *punch_rl = kvzalloc_objs(struct runlist_element, punch_cnt + 1,
1892 GFP_NOFS);1892 GFP_NOFS);
1893 if (!*punch_rl)1893 if (!*punch_rl)
1894 return ERR_PTR(-ENOMEM);1894 return ERR_PTR(-ENOMEM);
1895 1895
1896 new_cnt = dst_cnt - (int)(e_rl - s_rl + 1) + 3;1896 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);
1898 if (!new_rl) {1898 if (!new_rl) {
1899 kvfree(*punch_rl);1899 kvfree(*punch_rl);
1900 *punch_rl = NULL;1900 *punch_rl = NULL;
@@ -2038,13 +2038,13 @@ struct runlist_element *ntfs_rl_collapse_range(struct runlist_element *dst_rl, i · 137 unmodified lines
2038 one_split_3 = e_rl == s_rl && begin_split && end_split;2038 one_split_3 = e_rl == s_rl && begin_split && end_split;
2039 2039
2040 punch_cnt = (int)(e_rl - s_rl) + 1;2040 punch_cnt = (int)(e_rl - s_rl) + 1;
2041 *punch_rl = kvcalloc(punch_cnt + 1, sizeof(struct runlist_element),2041 *punch_rl = kvzalloc_objs(struct runlist_element, punch_cnt + 1,
2042 GFP_NOFS);2042 GFP_NOFS);
2043 if (!*punch_rl)2043 if (!*punch_rl)
2044 return ERR_PTR(-ENOMEM);2044 return ERR_PTR(-ENOMEM);
2045 2045
2046 new_cnt = dst_cnt - (int)(e_rl - s_rl + 1) + 3;2046 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);
2048 if (!new_rl) {2048 if (!new_rl) {
2049 kvfree(*punch_rl);2049 kvfree(*punch_rl);
2050 *punch_rl = NULL;2050 *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
2539 struct ntfs_volume *vol;2539 struct ntfs_volume *vol;
2540 2540
2541 /* Allocate a new struct ntfs_volume and place it in sb->s_fs_info. */2541 /* 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);
2543 if (!vol)2543 if (!vol)
2544 return -ENOMEM;2544 return -ENOMEM;
2545 2545
fs/overlayfs/readdir.c+1−1
@@ -1044,7 +1044,7 @@ static int ovl_dir_open(struct inode *inode, struct file *file) · 1043 unmodified lines
1044 struct ovl_dir_file *od;1044 struct ovl_dir_file *od;
1045 enum ovl_path_type type;1045 enum ovl_path_type type;
1046 1046
1047 od = kzalloc(sizeof(struct ovl_dir_file), GFP_KERNEL);1047 od = kzalloc_obj(struct ovl_dir_file);
1048 if (!od)1048 if (!od)
1049 return -ENOMEM;1049 return -ENOMEM;
1050 1050
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
443 goto unlock;443 goto unlock;
444 }444 }
445 445
446 reg = kmalloc_obj(struct cifs_swn_reg, GFP_KERNEL);446 reg = kmalloc_obj(struct cifs_swn_reg);
447 if (reg == NULL) {447 if (reg == NULL) {
448 ret = -ENOMEM;448 ret = -ENOMEM;
449 goto fail_unlock;449 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
365{365{
366 struct cache_dfs_tgt *t;366 struct cache_dfs_tgt *t;
367 367
368 t = kmalloc_obj(*t, GFP_KERNEL);368 t = kmalloc_obj(*t);
369 if (!t)369 if (!t)
370 return ERR_PTR(-ENOMEM);370 return ERR_PTR(-ENOMEM);
371 t->name = kstrdup(name, GFP_KERNEL);371 t->name = kstrdup(name, GFP_KERNEL);
fs/smb/client/smb2inode.c+1−1
@@ -237,7 +237,7 @@ replay_again: · 236 unmodified lines
237 num_rqst = 0;237 num_rqst = 0;
238 server = cifs_pick_channel(ses);238 server = cifs_pick_channel(ses);
239 239
240 vars = kzalloc_obj(*vars, GFP_KERNEL);240 vars = kzalloc_obj(*vars);
241 if (vars == NULL) {241 if (vars == NULL) {
242 rc = -ENOMEM;242 rc = -ENOMEM;
243 goto out;243 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
30 } while (new_alloc_cnt < work->iov_cnt + need_iov_cnt);30 } while (new_alloc_cnt < work->iov_cnt + need_iov_cnt);
31 31
32 if (work->iov == work->iov_inline) {32 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);
34 if (!new)34 if (!new)
35 return -ENOMEM;35 return -ENOMEM;
36 36
fs/smb/server/smb2pdu.c+1−1
@@ -11820,7 +11820,7 @@ static void smb2_notify_cancel_fn(void **argv) · 11819 unmodified lines
11820 return;11820 return;
11821 conn = in_work->conn;11821 conn = in_work->conn;
11822 11822
11823 ctx = kmalloc(sizeof(*ctx), GFP_ATOMIC);11823 ctx = kmalloc_obj(*ctx, GFP_ATOMIC);
11824 if (!ctx) {11824 if (!ctx) {
11825 /* Can't defer the response -- free without sending one. */11825 /* Can't defer the response -- free without sending one. */
11826 list_del_init(&in_work->async_request_entry);11826 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
2746 * larger one that needs to be free by the caller.2746 * larger one that needs to be free by the caller.
2747 */2747 */
2748 if (nirecs > 1) {2748 if (nirecs > 1) {
2749 map = kcalloc(nirecs, sizeof(struct xfs_buf_map),2749 map = kzalloc_objs(struct xfs_buf_map, nirecs,
2750 GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);2750 GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
2751 *mapp = map;2751 *mapp = map;
2752 }2752 }
2753 2753
init/initramfs_test.c+1−1
@@ -514,7 +514,7 @@ static void __init initramfs_test_hdr_hex(struct kunit *test) · 513 unmodified lines
514 char fdata[] = "this file data will not be unpacked";514 char fdata[] = "this file data will not be unpacked";
515 struct initramfs_test_bufs {515 struct initramfs_test_bufs {
516 char cpio_src[(CPIO_HDRLEN + PATH_MAX + 3 + sizeof(fdata)) * 2];516 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);
518 struct initramfs_test_cpio c[] = { {518 struct initramfs_test_cpio c[] = { {
519 .magic = "070701",519 .magic = "070701",
520 .ino = 1,520 .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
58 }58 }
59 }59 }
60 60
61 e = kmalloc(sizeof(*e), GFP_NOWAIT);61 e = kmalloc_obj(*e, GFP_NOWAIT);
62 if (!e)62 if (!e)
63 return -ENOMEM;63 return -ENOMEM;
64 64
io_uring/zcrx.c+2−2
@@ -483,8 +483,8 @@ static int io_zcrx_append_area(struct io_zcrx_ifq *ifq, · 482 unmodified lines
483 old_areas = ifq->areas;483 old_areas = ifq->areas;
484 old_nr = ifq->nr_areas;484 old_nr = ifq->nr_areas;
485 485
486 areas = kmalloc_array(old_nr + 1, sizeof(areas[0]),486 areas = kmalloc_objs(areas[0], old_nr + 1,
487 GFP_KERNEL_ACCOUNT | __GFP_ZERO);487 GFP_KERNEL_ACCOUNT | __GFP_ZERO);
488 if (!areas)488 if (!areas)
489 return -ENOMEM;489 return -ENOMEM;
490 if (old_areas)490 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
266 }266 }
267 267
268 capacity = max_t(size_t, BPF_DIAG_FMT_CHUNK_SIZE, size);268 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);
270 if (!chunk)270 if (!chunk)
271 return NULL;271 return NULL;
272 272
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
511 if (IS_ERR_OR_NULL(map->record))511 if (IS_ERR_OR_NULL(map->record))
512 return 0;512 return 0;
513 513
514 hrec = kzalloc(sizeof(*hrec), GFP_KERNEL);514 hrec = kzalloc_obj(*hrec);
515 if (!hrec)515 if (!hrec)
516 return -ENOMEM;516 return -ENOMEM;
517 hrec->key_size = map->key_size;517 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
85 if (f)85 if (f)
86 return f;86 return f;
87 87
88 f = kvzalloc(sizeof(*f), GFP_KERNEL_ACCOUNT);88 f = kvzalloc_obj(*f, GFP_KERNEL_ACCOUNT);
89 if (!f)89 if (!f)
90 return ERR_PTR(-ENOMEM);90 return ERR_PTR(-ENOMEM);
91 f->callsite = lookup_key;91 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
862 if (!size)862 if (!size)
863 return NULL;863 return NULL;
864 864
865 log = kzalloc_obj(*log, GFP_KERNEL);865 log = kzalloc_obj(*log);
866 if (!log)866 if (!log)
867 return ERR_PTR(-ENOMEM);867 return ERR_PTR(-ENOMEM);
868 868
kernel/bpf/verifier.c+2−3
@@ -5483,7 +5483,7 @@ static int check_max_stack_depth(struct bpf_verifier_env *env) · 5482 unmodified lines
5483 bool priv_stack_supported;5483 bool priv_stack_supported;
5484 int ret;5484 int ret;
5485 5485
5486 dinfo = kvcalloc(env->subprog_cnt, sizeof(*dinfo), GFP_KERNEL_ACCOUNT);5486 dinfo = kvzalloc_objs(*dinfo, env->subprog_cnt, GFP_KERNEL_ACCOUNT);
5487 if (!dinfo)5487 if (!dinfo)
5488 return -ENOMEM;5488 return -ENOMEM;
5489 5489
@@ -20536,8 +20536,7 @@ static int process_fd_array_continuous(struct bpf_verifier_env *env, · 15046 unmodified lines
20536 return -E2BIG;20536 return -E2BIG;
20537 }20537 }
20538 20538
20539 env->fd_array = kvcalloc(cnt, sizeof(*env->fd_array),20539 env->fd_array = kvzalloc_objs(*env->fd_array, cnt, GFP_KERNEL_ACCOUNT);
20540 GFP_KERNEL_ACCOUNT);
20541 if (!env->fd_array)20540 if (!env->fd_array)
20542 return -ENOMEM;20541 return -ENOMEM;
20543 env->fd_array_cnt = cnt;20542 env->fd_array_cnt = cnt;
kernel/dma/map_benchmark.c+1−2
@@ -51,8 +51,7 @@ struct dma_single_map_param { · 50 unmodified lines
51 51
52static void *dma_single_map_benchmark_prepare(struct map_benchmark_data *map)52static void *dma_single_map_benchmark_prepare(struct map_benchmark_data *map)
53{53{
54 struct dma_single_map_param *params __free(kfree) = kzalloc(sizeof(*params),54 struct dma_single_map_param *params __free(kfree) = kzalloc_obj(*params);
55 GFP_KERNEL);
56 if (!params)55 if (!params)
57 return NULL;56 return NULL;
58 57
kernel/events/core.c+2−3
@@ -13558,9 +13558,8 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, · 13557 unmodified lines
13558 return ERR_PTR(err);13558 return ERR_PTR(err);
13559 13559
13560 if (has_addr_filter(event)) {13560 if (has_addr_filter(event)) {
13561 event->addr_filter_ranges = kcalloc(pmu->nr_addr_filters,13561 event->addr_filter_ranges = kzalloc_objs(struct perf_addr_filter_range,
13562 sizeof(struct perf_addr_filter_range),13562 pmu->nr_addr_filters);
13563 GFP_KERNEL);
13564 if (!event->addr_filter_ranges)13563 if (!event->addr_filter_ranges)
13565 return ERR_PTR(-ENOMEM);13564 return ERR_PTR(-ENOMEM);
13566 13565
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
1874 free_percpu(ref);1874 free_percpu(ref);
1875 }1875 }
1876 1876
1877 fph = kvzalloc(struct_size(fph, queues, hash_slots),1877 fph = kvzalloc_flex(*fph, queues, hash_slots,
1878 GFP_KERNEL_ACCOUNT | __GFP_NOWARN);1878 GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
1879 if (!fph)1879 if (!fph)
1880 return -ENOMEM;1880 return -ENOMEM;
1881 1881
@@ -2103,7 +2103,7 @@ static int __init futex_init(void) · 221 unmodified lines
2103 size = sizeof(struct futex_hash_bucket) * hashsize;2103 size = sizeof(struct futex_hash_bucket) * hashsize;
2104 order = get_order(size);2104 order = get_order(size);
2105 2105
2106 __futex_queues = kcalloc(nr_node_ids, sizeof(*__futex_queues), GFP_KERNEL);2106 __futex_queues = kzalloc_objs(*__futex_queues, nr_node_ids);
2107 kmemleak_not_leak(__futex_queues);2107 kmemleak_not_leak(__futex_queues);
2108 2108
2109 runtime_const_init(shift, __futex_shift);2109 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
2306 !irq_supports_nmi(desc))2306 !irq_supports_nmi(desc))
2307 return -EINVAL;2307 return -EINVAL;
2308 2308
2309 action = kzalloc(sizeof(struct irqaction), GFP_KERNEL);2309 action = kzalloc_obj(struct irqaction);
2310 if (!action)2310 if (!action)
2311 return -ENOMEM;2311 return -ENOMEM;
2312 2312
kernel/jump_label.c+2−3
@@ -726,12 +726,11 @@ static int jump_label_add_module(struct module *mod) · 725 unmodified lines
726 if (static_key_sealed(key))726 if (static_key_sealed(key))
727 goto do_poke;727 goto do_poke;
728 728
729 jlm = kzalloc(sizeof(struct static_key_mod), GFP_KERNEL);729 jlm = kzalloc_obj(struct static_key_mod);
730 if (!jlm)730 if (!jlm)
731 return -ENOMEM;731 return -ENOMEM;
732 if (!static_key_linked(key)) {732 if (!static_key_linked(key)) {
733 jlm2 = kzalloc(sizeof(struct static_key_mod),733 jlm2 = kzalloc_obj(struct static_key_mod);
734 GFP_KERNEL);
735 if (!jlm2) {734 if (!jlm2) {
736 kfree(jlm);735 kfree(jlm);
737 return -ENOMEM;736 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
852 if (!zalloc_cpumask_var(&affinity, GFP_KERNEL))852 if (!zalloc_cpumask_var(&affinity, GFP_KERNEL))
853 return -ENOMEM;853 return -ENOMEM;
854 854
855 kthread->preferred_affinity = kzalloc(sizeof(struct cpumask), GFP_KERNEL);855 kthread->preferred_affinity = kzalloc_obj(struct cpumask);
856 if (!kthread->preferred_affinity) {856 if (!kthread->preferred_affinity) {
857 ret = -ENOMEM;857 ret = -ENOMEM;
858 goto out;858 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
98 u32 npossible = num_possible_cpus();98 u32 npossible = num_possible_cpus();
99 struct scx_cid_tables *tbls;99 struct scx_cid_tables *tbls;
100 100
101 tbls = kzalloc_obj(*tbls, GFP_KERNEL);101 tbls = kzalloc_obj(*tbls);
102 if (!tbls)102 if (!tbls)
103 return NULL;103 return NULL;
104 104
105 tbls->cid_to_cpu = kvcalloc(npossible, sizeof(*tbls->cid_to_cpu), GFP_KERNEL);105 tbls->cid_to_cpu = kvzalloc_objs(*tbls->cid_to_cpu, npossible);
106 tbls->cpu_to_cid = kvcalloc(nr_cpu_ids, sizeof(*tbls->cpu_to_cid), GFP_KERNEL);106 tbls->cpu_to_cid = kvzalloc_objs(*tbls->cpu_to_cid, nr_cpu_ids);
107 tbls->cid_to_shard = kvcalloc(npossible, sizeof(*tbls->cid_to_shard), GFP_KERNEL);107 tbls->cid_to_shard = kvzalloc_objs(*tbls->cid_to_shard, npossible);
108 tbls->shard_node = kvcalloc(npossible, sizeof(*tbls->shard_node), GFP_KERNEL);108 tbls->shard_node = kvzalloc_objs(*tbls->shard_node, npossible);
109 tbls->shard_ranges = kvcalloc(npossible, sizeof(*tbls->shard_ranges), GFP_KERNEL);109 tbls->shard_ranges = kvzalloc_objs(*tbls->shard_ranges, npossible);
110 tbls->topo = kvcalloc(npossible, sizeof(*tbls->topo), GFP_KERNEL);110 tbls->topo = kvzalloc_objs(*tbls->topo, npossible);
111 111
112 if (!tbls->cid_to_cpu || !tbls->cpu_to_cid || !tbls->cid_to_shard ||112 if (!tbls->cid_to_cpu || !tbls->cpu_to_cid || !tbls->cid_to_shard ||
113 !tbls->shard_node || !tbls->shard_ranges || !tbls->topo) {113 !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
490 * region that arena fault recovery covers.490 * region that arena fault recovery covers.
491 */491 */
492 alloced = zalloc_cpumask_var(&seen, GFP_KERNEL);492 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);
494 if (cpu_to_cid_cnt == nr_cpu_ids)494 if (cpu_to_cid_cnt == nr_cpu_ids)
495 cpu_to_cid = kmemdup(cpu_to_cid__arena, cpu_to_cid_cnt * sizeof(s32),495 cpu_to_cid = kmemdup(cpu_to_cid__arena, cpu_to_cid_cnt * sizeof(s32),
496 GFP_KERNEL);496 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
5449 struct scx_sched *sch = container_of(kobj, struct scx_sched, kobj);5449 struct scx_sched *sch = container_of(kobj, struct scx_sched, kobj);
5450 u32 npossible = num_possible_cpus();5450 u32 npossible = num_possible_cpus();
5451 struct scx_cmask *agg __free(kfree) =5451 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));
5453 unsigned long *agg_bm __free(bitmap) = bitmap_zalloc(npossible, GFP_KERNEL);5453 unsigned long *agg_bm __free(bitmap) = bitmap_zalloc(npossible, GFP_KERNEL);
5454 ssize_t count = 0;5454 ssize_t count = 0;
5455 s32 cap, si;5455 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
194 shard_node = rcu_dereference_protected(scx_shard_node,194 shard_node = rcu_dereference_protected(scx_shard_node,
195 lockdep_is_held(&scx_enable_mutex));195 lockdep_is_held(&scx_enable_mutex));
196 196
197 pshard = kzalloc_objs(pshard[0], scx_nr_cid_shards, GFP_KERNEL);197 pshard = kzalloc_objs(pshard[0], scx_nr_cid_shards);
198 if (!pshard)198 if (!pshard)
199 return -ENOMEM;199 return -ENOMEM;
200 200
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
945 if (num < 0)945 if (num < 0)
946 return num;946 return num;
947 947
948 addrs = kcalloc(num, sizeof(*addrs), GFP_KERNEL);948 addrs = kzalloc_objs(*addrs, num);
949 if (!addrs)949 if (!addrs)
950 return -ENOMEM;950 return -ENOMEM;
951 951
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
2600 cpu_buffer->remote = buffer->remote;2600 cpu_buffer->remote = buffer->remote;
2601 cpu_buffer->meta_page = (struct trace_buffer_meta *)(void *)desc->meta_va;2601 cpu_buffer->meta_page = (struct trace_buffer_meta *)(void *)desc->meta_va;
2602 cpu_buffer->nr_pages = nr_pages;2602 cpu_buffer->nr_pages = nr_pages;
2603 cpu_buffer->subbuf_ids = kcalloc(cpu_buffer->nr_pages + 1,2603 cpu_buffer->subbuf_ids = kzalloc_objs(*cpu_buffer->subbuf_ids,
2604 sizeof(*cpu_buffer->subbuf_ids), GFP_KERNEL);2604 cpu_buffer->nr_pages + 1);
2605 if (!cpu_buffer->subbuf_ids)2605 if (!cpu_buffer->subbuf_ids)
2606 goto fail_free_reader;2606 goto fail_free_reader;
2607 2607
kernel/trace/trace_eprobe.c+1−1
@@ -930,7 +930,7 @@ static int __trace_eprobe_create(int argc, const char *argv[]) · 929 unmodified lines
930 } else930 } else
931 ep->filter_str = NULL;931 ep->filter_str = NULL;
932 932
933 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);933 ctx = kzalloc_obj(*ctx);
934 if (!ctx)934 if (!ctx)
935 return -ENOMEM;935 return -ENOMEM;
936 ctx->event = ep->event;936 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
251 if (cpu != RING_BUFFER_ALL_CPUS && !remote->pcpu_reader_locks) {251 if (cpu != RING_BUFFER_ALL_CPUS && !remote->pcpu_reader_locks) {
252 int lock_cpu;252 int lock_cpu;
253 253
254 remote->pcpu_reader_locks = kcalloc(nr_cpu_ids, sizeof(*remote->pcpu_reader_locks),254 remote->pcpu_reader_locks = kzalloc_objs(*remote->pcpu_reader_locks,
255 GFP_KERNEL);255 nr_cpu_ids);
256 if (!remote->pcpu_reader_locks) {256 if (!remote->pcpu_reader_locks) {
257 trace_remote_try_unload(remote);257 trace_remote_try_unload(remote);
258 return -ENOMEM;258 return -ENOMEM;
@@ -324,7 +324,7 @@ static int __alloc_ring_buffer_iter(struct trace_remote_iterator *iter, int cpu) · 65 unmodified lines
324 return iter->rb_iter ? 0 : -ENOMEM;324 return iter->rb_iter ? 0 : -ENOMEM;
325 }325 }
326 326
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);
328 if (!iter->rb_iters)328 if (!iter->rb_iters)
329 return -ENOMEM;329 return -ENOMEM;
330 330
@@ -1204,7 +1204,7 @@ remote_events_dir_header_page_read(struct file *filp, char __user *ubuf, size_t · 873 unmodified lines
1204 struct trace_seq *s;1204 struct trace_seq *s;
1205 int ret;1205 int ret;
1206 1206
1207 s = kmalloc(sizeof(*s), GFP_KERNEL);1207 s = kmalloc_obj(*s);
1208 if (!s)1208 if (!s)
1209 return -ENOMEM;1209 return -ENOMEM;
1210 1210
@@ -1227,7 +1227,7 @@ remote_events_dir_header_event_read(struct file *filp, char __user *ubuf, size_t · 16 unmodified lines
1227 struct trace_seq *s;1227 struct trace_seq *s;
1228 int ret;1228 int ret;
1229 1229
1230 s = kmalloc(sizeof(*s), GFP_KERNEL);1230 s = kmalloc_obj(*s);
1231 if (!s)1231 if (!s)
1232 return -ENOMEM;1232 return -ENOMEM;
1233 1233
lib/test_rhashtable.c+1−1
@@ -696,7 +696,7 @@ static int __init test_rhashtable_next_key(void) · 695 unmodified lines
696 if (err)696 if (err)
697 return err;697 return err;
698 698
699 objs = kcalloc(n, sizeof(*objs), GFP_KERNEL);699 objs = kzalloc_objs(*objs, n);
700 if (!objs) {700 if (!objs) {
701 rhashtable_destroy(&ht);701 rhashtable_destroy(&ht);
702 return -ENOMEM;702 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
149 if (ret)149 if (ret)
150 return ret;150 return ret;
151 151
152 ctxs = kcalloc(n_threads, sizeof(*ctxs), GFP_KERNEL);152 ctxs = kzalloc_objs(*ctxs, n_threads);
153 if (!ctxs)153 if (!ctxs)
154 return -ENOMEM;154 return -ENOMEM;
155 155
156 tasks = kcalloc(n_threads, sizeof(*tasks), GFP_KERNEL);156 tasks = kzalloc_objs(*tasks, n_threads);
157 if (!tasks) {157 if (!tasks) {
158 kfree(ctxs);158 kfree(ctxs);
159 return -ENOMEM;159 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
57 void *buffer;57 void *buffer;
58 unsigned int i;58 unsigned int i;
59 59
60 pages = kzalloc_objs(struct page *, npages, GFP_KERNEL);60 pages = kzalloc_objs(struct page *, npages);
61 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pages);61 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pages);
62 *ppages = pages;62 *ppages = pages;
63 63
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
136 if (!t)136 if (!t)
137 kunit_skip(test, "target alloc fail");137 kunit_skip(test, "target alloc fail");
138 138
139 ranges = kmalloc_array(nr_regions / 2, sizeof(*ranges), GFP_KERNEL);139 ranges = kmalloc_objs(*ranges, nr_regions / 2);
140 if (!ranges) {140 if (!ranges) {
141 damon_destroy_target(t, NULL);141 damon_destroy_target(t, NULL);
142 kunit_skip(test, "ranges alloc fail");142 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
981 981
982 ASSERT_RTNL();982 ASSERT_RTNL();
983 983
984 device_state = kzalloc_obj(*device_state, GFP_KERNEL);984 device_state = kzalloc_obj(*device_state);
985 if (!device_state)985 if (!device_state)
986 return -ENOMEM;986 return -ENOMEM;
987 987
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
6423 goto update_scan;6423 goto update_scan;
6424 }6424 }
6425 6425
6426 accept_list = kmalloc_array(num_entries, sizeof(*accept_list),6426 accept_list = kmalloc_objs(*accept_list, num_entries);
6427 GFP_KERNEL);
6428 if (!accept_list) {6427 if (!accept_list) {
6429 hci_dev_unlock(hdev);6428 hci_dev_unlock(hdev);
6430 return -ENOMEM;6429 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
251 if (!attrs[DEVLINK_ATTR_PARENT_DEV])251 if (!attrs[DEVLINK_ATTR_PARENT_DEV])
252 return ERR_PTR(-EINVAL);252 return ERR_PTR(-EINVAL);
253 253
254 tb = kcalloc(maxtype + 1, sizeof(*tb), GFP_KERNEL);254 tb = kzalloc_objs(*tb, maxtype + 1);
255 if (!tb)255 if (!tb)
256 return ERR_PTR(-ENOMEM);256 return ERR_PTR(-ENOMEM);
257 257
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
330 int err;330 int err;
331 int i;331 int i;
332 332
333 default_value = kcalloc(DEVLINK_PARAM_CMODE_MAX + 1,333 default_value = kzalloc_objs(*default_value,
334 sizeof(*default_value), GFP_KERNEL);334 DEVLINK_PARAM_CMODE_MAX + 1);
335 if (!default_value)335 if (!default_value)
336 return -ENOMEM;336 return -ENOMEM;
337 337
338 param_value = kcalloc(DEVLINK_PARAM_CMODE_MAX + 1,338 param_value = kzalloc_objs(*param_value, DEVLINK_PARAM_CMODE_MAX + 1);
339 sizeof(*param_value), GFP_KERNEL);
340 if (!param_value) {339 if (!param_value) {
341 kfree(default_value);340 kfree(default_value);
342 return -ENOMEM;341 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
2931{2931{
2932 union bpf_tcp_iter_batch_item *new_batch;2932 union bpf_tcp_iter_batch_item *new_batch;
2933 2933
2934 new_batch = kvmalloc_array(new_batch_sz, sizeof(*new_batch),2934 new_batch = kvmalloc_objs(*new_batch, new_batch_sz,
2935 flags | __GFP_NOWARN);2935 flags | __GFP_NOWARN);
2936 if (!new_batch)2936 if (!new_batch)
2937 return -ENOMEM;2937 return -ENOMEM;
2938 2938
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
659 if (!sta)659 if (!sta)
660 return -ENOENT;660 return -ENOENT;
661 661
662 new_sched = kzalloc(struct_size(new_sched, channels, sched->n_channels),662 new_sched = kzalloc_flex(*new_sched, channels, sched->n_channels);
663 GFP_KERNEL);
664 if (!new_sched)663 if (!new_sched)
665 return -ENOMEM;664 return -ENOMEM;
666 665
net/mctp/test/route-test.c+1−1
@@ -193,7 +193,7 @@ static void __mctp_route_test_init(struct kunit *test, · 192 unmodified lines
193 if (netid != MCTP_NET_ANY)193 if (netid != MCTP_NET_ANY)
194 WRITE_ONCE(dev->mdev->net, netid);194 WRITE_ONCE(dev->mdev->net, netid);
195 195
196 dev->mdev->addrs = kmalloc_objs(u8, 1, GFP_KERNEL);196 dev->mdev->addrs = kmalloc_objs(u8, 1);
197 dev->mdev->num_addrs = 1;197 dev->mdev->num_addrs = 1;
198 dev->mdev->addrs[0] = 8;198 dev->mdev->addrs[0] = 8;
199 199
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
88 if (!dev)88 if (!dev)
89 return NULL;89 return NULL;
90 90
91 dev->mdev->addrs = kmalloc_objs(u8, 1, GFP_KERNEL);91 dev->mdev->addrs = kmalloc_objs(u8, 1);
92 if (!dev->mdev->addrs) {92 if (!dev->mdev->addrs) {
93 mctp_test_destroy_dev(dev);93 mctp_test_destroy_dev(dev);
94 return NULL;94 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
3215{3215{
3216 struct nft_trans_hook *trans_hook;3216 struct nft_trans_hook *trans_hook;
3217 3217
3218 trans_hook = kmalloc_obj(*trans_hook, GFP_KERNEL);3218 trans_hook = kmalloc_obj(*trans_hook);
3219 if (!trans_hook)3219 if (!trans_hook)
3220 return -ENOMEM;3220 return -ENOMEM;
3221 3221
net/netfilter/nfnetlink_cttimeout.c+1−1
@@ -150,7 +150,7 @@ static int cttimeout_new_timeout(struct sk_buff *skb, · 149 unmodified lines
150 goto err_proto_put;150 goto err_proto_put;
151 }151 }
152 152
153 timeout = kzalloc(sizeof(*timeout), GFP_KERNEL);153 timeout = kzalloc_obj(*timeout);
154 if (timeout == NULL) {154 if (timeout == NULL) {
155 ret = -ENOMEM;155 ret = -ENOMEM;
156 goto err_proto_put;156 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
205 * iterator code to allocate and hand it back.205 * iterator code to allocate and hand it back.
206 */206 */
207 npages = iov_iter_npages(&opt->iter_out, INT_MAX);207 npages = iov_iter_npages(&opt->iter_out, INT_MAX);
208 pages = kvmalloc_array(npages, sizeof(*pages), GFP_KERNEL);208 pages = kvmalloc_objs(*pages, npages);
209 if (!pages) {209 if (!pages) {
210 ret = -ENOMEM;210 ret = -ENOMEM;
211 goto out;211 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
210 if (!token)210 if (!token)
211 goto nomem;211 goto nomem;
212 212
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);
214 if (!token->rxgk)214 if (!token->rxgk)
215 goto nomem_token;215 goto nomem_token;
216 216
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
240 list_for_each_entry(entry, &src->entries, list) {240 list_for_each_entry(entry, &src->entries, list) {
241 struct tcfg_gate_entry *new;241 struct tcfg_gate_entry *new;
242 242
243 new = kzalloc(sizeof(*new), GFP_ATOMIC);243 new = kzalloc_obj(*new, GFP_ATOMIC);
244 if (!new) {244 if (!new) {
245 NL_SET_ERR_MSG(extack, "Not enough memory for entry");245 NL_SET_ERR_MSG(extack, "Not enough memory for entry");
246 return -ENOMEM;246 return -ENOMEM;
@@ -415,7 +415,7 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla, · 168 unmodified lines
415 if (err < 0)415 if (err < 0)
416 goto release_idr;416 goto release_idr;
417 417
418 p = kzalloc(sizeof(*p), GFP_KERNEL);418 p = kzalloc_obj(*p);
419 if (!p) {419 if (!p) {
420 err = -ENOMEM;420 err = -ENOMEM;
421 goto chain_put;421 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
526 }526 }
527 t = to_tunnel_key(*a);527 t = to_tunnel_key(*a);
528 528
529 params_new = kzalloc(sizeof(*params_new), GFP_KERNEL);529 params_new = kzalloc_obj(*params_new);
530 if (unlikely(!params_new)) {530 if (unlikely(!params_new)) {
531 NL_SET_ERR_MSG(extack, "Cannot allocate tunnel key parameters");531 NL_SET_ERR_MSG(extack, "Cannot allocate tunnel key parameters");
532 ret = -ENOMEM;532 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
282 unsigned int overflow_nents =282 unsigned int overflow_nents =
283 nsg - XDR_BUF_TO_SG_NENTS + 1;283 nsg - XDR_BUF_TO_SG_NENTS + 1;
284 284
285 *sg_overflow = kmalloc_array(overflow_nents,285 *sg_overflow = kmalloc_objs(**sg_overflow, overflow_nents,
286 sizeof(**sg_overflow),286 GFP_NOFS);
287 GFP_NOFS);
288 if (!*sg_overflow)287 if (!*sg_overflow)
289 return -ENOMEM;288 return -ENOMEM;
290 289
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
625 if (!cnt)625 if (!cnt)
626 return 0;626 return 0;
627 627
628 items = kcalloc(cnt, sizeof(*items), GFP_KERNEL);628 items = kzalloc_objs(*items, cnt);
629 seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);629 seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);
630 if (!items || !seqnos) {630 if (!items || !seqnos) {
631 ret = -ENOMEM;631 ret = -ENOMEM;
@@ -1326,7 +1326,7 @@ int sunrpc_nl_ip_map_get_reqs_dumpit(struct sk_buff *skb, · 694 unmodified lines
1326 if (!cnt)1326 if (!cnt)
1327 return 0;1327 return 0;
1328 1328
1329 items = kcalloc(cnt, sizeof(*items), GFP_KERNEL);1329 items = kzalloc_objs(*items, cnt);
1330 seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);1330 seqnos = kcalloc(cnt, sizeof(*seqnos), GFP_KERNEL);
1331 if (!items || !seqnos) {1331 if (!items || !seqnos) {
1332 ret = -ENOMEM;1332 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
371 unsigned int overflow_nents = nsg - sg_head_nents + 1;371 unsigned int overflow_nents = nsg - sg_head_nents + 1;
372 struct scatterlist *overflow;372 struct scatterlist *overflow;
373 373
374 overflow = kmalloc_array(overflow_nents, sizeof(*overflow),374 overflow = kmalloc_objs(*overflow, overflow_nents, gfp);
375 gfp);
376 if (!overflow)375 if (!overflow)
377 return -ENOMEM;376 return -ENOMEM;
378 377
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
3667{3667{
3668 struct sock **new_batch;3668 struct sock **new_batch;
3669 3669
3670 new_batch = kvmalloc_array(new_batch_sz, sizeof(*new_batch),3670 new_batch = kvmalloc_objs(*new_batch, new_batch_sz,
3671 GFP_USER | __GFP_NOWARN);3671 GFP_USER | __GFP_NOWARN);
3672 if (!new_batch)3672 if (!new_batch)
3673 return -ENOMEM;3673 return -ENOMEM;
3674 3674
net/wireless/core.c+2−3
@@ -311,9 +311,8 @@ int cfg80211_nan_set_local_schedule(struct cfg80211_registered_device *rdev, · 310 unmodified lines
311 if (!sched->n_channels)311 if (!sched->n_channels)
312 return 0;312 return 0;
313 313
314 wdev->u.nan.chandefs = kcalloc(sched->n_channels,314 wdev->u.nan.chandefs = kzalloc_objs(*wdev->u.nan.chandefs,
315 sizeof(*wdev->u.nan.chandefs),315 sched->n_channels);
316 GFP_KERNEL);
317 if (!wdev->u.nan.chandefs)316 if (!wdev->u.nan.chandefs)
318 return -ENOMEM;317 return -ENOMEM;
319 318
net/wireless/nl80211.c+3−6
@@ -17330,8 +17330,7 @@ static int nl80211_parse_nan_channel(struct cfg80211_registered_device *rdev, · 17329 unmodified lines
17330 u8 n_rx_nss;17330 u8 n_rx_nss;
17331 int ret;17331 int ret;
17332 17332
17333 channel_parsed = kcalloc(NL80211_ATTR_MAX + 1, sizeof(*channel_parsed),17333 channel_parsed = kzalloc_objs(*channel_parsed, NL80211_ATTR_MAX + 1);
17334 GFP_KERNEL);
17335 if (!channel_parsed)17334 if (!channel_parsed)
17336 return -ENOMEM;17335 return -ENOMEM;
17337 17336
@@ -17554,8 +17553,7 @@ static int nl80211_nan_set_peer_sched(struct sk_buff *skb, · 216 unmodified lines
17554 }17553 }
17555 17554
17556 if (n_channels) {17555 if (n_channels) {
17557 nan_channels = kcalloc(n_channels, sizeof(*nan_channels),17556 nan_channels = kzalloc_objs(*nan_channels, n_channels);
17558 GFP_KERNEL);
17559 if (!nan_channels)17557 if (!nan_channels)
17560 return -ENOMEM;17558 return -ENOMEM;
17561 }17559 }
@@ -17693,8 +17691,7 @@ static int nl80211_nan_set_local_sched(struct sk_buff *skb, · 131 unmodified lines
17693 info->nlhdr, GENL_HDRLEN, rem)17691 info->nlhdr, GENL_HDRLEN, rem)
17694 n_channels++;17692 n_channels++;
17695 17693
17696 sched = kzalloc(struct_size(sched, nan_channels, n_channels),17694 sched = kzalloc_flex(*sched, nan_channels, n_channels);
17697 GFP_KERNEL);
17698 if (!sched)17695 if (!sched)
17699 return -ENOMEM;17696 return -ENOMEM;
17700 17697
security/integrity/ima/ima_queue.c+1−2
@@ -75,8 +75,7 @@ static struct hlist_head *ima_alloc_replace_htable(void) · 74 unmodified lines
75 struct hlist_head *old_htable, *new_htable;75 struct hlist_head *old_htable, *new_htable;
76 76
77 /* Initializing to zeros is equivalent to call HLIST_HEAD_INIT. */77 /* Initializing to zeros is equivalent to call HLIST_HEAD_INIT. */
78 new_htable = kcalloc(IMA_MEASURE_HTABLE_SIZE, sizeof(struct hlist_head),78 new_htable = kzalloc_objs(struct hlist_head, IMA_MEASURE_HTABLE_SIZE);
79 GFP_KERNEL);
80 if (!new_htable)79 if (!new_htable)
81 return ERR_PTR(-ENOMEM);80 return ERR_PTR(-ENOMEM);
82 81
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
107 return -EINVAL;107 return -EINVAL;
108 }108 }
109 109
110 data = kzalloc(sizeof(*data), GFP_KERNEL);110 data = kzalloc_obj(*data);
111 if (!data) {111 if (!data) {
112 snd_card_unref(compr->card);112 snd_card_unref(compr->card);
113 return -ENOMEM;113 return -ENOMEM;
@@ -119,7 +119,7 @@ static int snd_compr_open(struct inode *inode, struct file *f) · 5 unmodified lines
119 data->stream.direction = dirn;119 data->stream.direction = dirn;
120 data->stream.private_data = compr->private_data;120 data->stream.private_data = compr->private_data;
121 data->stream.device = compr;121 data->stream.device = compr;
122 runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);122 runtime = kzalloc_obj(*runtime);
123 if (!runtime) {123 if (!runtime) {
124 kfree(data);124 kfree(data);
125 snd_card_unref(compr->card);125 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
69 err = -ENODEV;69 err = -ENODEV;
70 goto __error2;70 goto __error2;
71 }71 }
72 ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);72 ctl = kzalloc_obj(*ctl);
73 if (ctl == NULL) {73 if (ctl == NULL) {
74 err = -ENOMEM;74 err = -ENOMEM;
75 goto __error;75 goto __error;
@@ -174,7 +174,7 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, · 98 unmodified lines
174 goto _found;174 goto _found;
175 }175 }
176 }176 }
177 ev = kzalloc(sizeof(*ev), GFP_ATOMIC);177 ev = kzalloc_obj(*ev, GFP_ATOMIC);
178 if (ev) {178 if (ev) {
179 ev->id = *id;179 ev->id = *id;
180 ev->mask = mask;180 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
871 unsigned int cmd, void __user *arg)871 unsigned int cmd, void __user *arg)
872{872{
873 struct snd_ctl_card_info *info __free(kfree) =873 struct snd_ctl_card_info *info __free(kfree) =
874 kzalloc(sizeof(*info), GFP_KERNEL);874 kzalloc_obj(*info);
875 ssize_t n;875 ssize_t n;
876 876
877 if (! info)877 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
158 UPDATE_ROUTE(route, snd_ctl_led_get(lctl));158 UPDATE_ROUTE(route, snd_ctl_led_get(lctl));
159 }159 }
160 if (!found && kctl && card) {160 if (!found && kctl && card) {
161 lctl = kzalloc(sizeof(*lctl), GFP_KERNEL);161 lctl = kzalloc_obj(*lctl);
162 if (lctl) {162 if (lctl) {
163 lctl->card = card;163 lctl->card = card;
164 lctl->access = access;164 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
364 sound_debugfs_root);364 sound_debugfs_root);
365#endif365#endif
366#ifdef CONFIG_SND_CTL_DEBUG366#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);
368 if (!card->value_buf)368 if (!card->value_buf)
369 return -ENOMEM;369 return -ENOMEM;
370#endif370#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
125 struct snd_fasync *fasync = NULL;125 struct snd_fasync *fasync = NULL;
126 126
127 if (on) {127 if (on) {
128 fasync = kzalloc(sizeof(*fasync), GFP_KERNEL);128 fasync = kzalloc_obj(*fasync);
129 if (!fasync)129 if (!fasync)
130 return -ENOMEM;130 return -ENOMEM;
131 INIT_LIST_HEAD(&fasync->list);131 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
890 int err;890 int err;
891 891
892 struct snd_ctl_elem_info *info __free(kfree) =892 struct snd_ctl_elem_info *info __free(kfree) =
893 kmalloc(sizeof(*info), GFP_KERNEL);893 kmalloc_obj(*info);
894 if (!info)894 if (!info)
895 return -ENOMEM;895 return -ENOMEM;
896 scoped_guard(rwsem_read, &card->controls_rwsem) {896 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
2330 return -EINVAL;2330 return -EINVAL;
2331 2331
2332 struct snd_pcm_group *group __free(kfree) =2332 struct snd_pcm_group *group __free(kfree) =
2333 kzalloc(sizeof(*group), GFP_KERNEL);2333 kzalloc_obj(*group);
2334 if (!group)2334 if (!group)
2335 return -ENOMEM;2335 return -ENOMEM;
2336 snd_pcm_group_init(group);2336 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
86 struct seq_oss_synth *rec;86 struct seq_oss_synth *rec;
87 struct snd_seq_oss_reg *reg = SNDRV_SEQ_DEVICE_ARGPTR(dev);87 struct snd_seq_oss_reg *reg = SNDRV_SEQ_DEVICE_ARGPTR(dev);
88 88
89 rec = kzalloc(sizeof(*rec), GFP_KERNEL);89 rec = kzalloc_obj(*rec);
90 if (!rec)90 if (!rec)
91 return -ENOMEM;91 return -ENOMEM;
92 rec->seq_device = -1;92 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
210 struct snd_seq_client *client;210 struct snd_seq_client *client;
211 211
212 /* init client data */212 /* init client data */
213 client = kzalloc(sizeof(*client), GFP_KERNEL);213 client = kzalloc_obj(*client);
214 if (client == NULL)214 if (client == NULL)
215 return NULL;215 return NULL;
216 client->pool = snd_seq_pool_new(poolsize);216 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
188 struct snd_rawmidi_runtime *runtime = substream->runtime;188 struct snd_rawmidi_runtime *runtime = substream->runtime;
189 struct snd_virmidi *vmidi;189 struct snd_virmidi *vmidi;
190 190
191 vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);191 vmidi = kzalloc_obj(*vmidi);
192 if (vmidi == NULL)192 if (vmidi == NULL)
193 return -ENOMEM;193 return -ENOMEM;
194 vmidi->substream = substream;194 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
1855 return -EBADFD;1855 return -EBADFD;
1856 1856
1857 struct snd_timer_info *info __free(kfree) =1857 struct snd_timer_info *info __free(kfree) =
1858 kzalloc(sizeof(*info), GFP_KERNEL);1858 kzalloc_obj(*info);
1859 if (! info)1859 if (! info)
1860 return -ENOMEM;1860 return -ENOMEM;
1861 info->card = t->card ? t->card->number : -1;1861 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
1365 int dev = get_cable_index(substream);1365 int dev = get_cable_index(substream);
1366 1366
1367 guard(mutex)(&loopback->cable_lock);1367 guard(mutex)(&loopback->cable_lock);
1368 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);1368 dpcm = kzalloc_obj(*dpcm);
1369 if (!dpcm)1369 if (!dpcm)
1370 return -ENOMEM;1370 return -ENOMEM;
1371 dpcm->loopback = loopback;1371 dpcm->loopback = loopback;
@@ -1373,7 +1373,7 @@ static int loopback_open(struct snd_pcm_substream *substream) · 1 unmodified line
1373 1373
1374 cable = loopback->cables[substream->number][dev];1374 cable = loopback->cables[substream->number][dev];
1375 if (!cable) {1375 if (!cable) {
1376 cable = kzalloc(sizeof(*cable), GFP_KERNEL);1376 cable = kzalloc_obj(*cable);
1377 if (!cable) {1377 if (!cable) {
1378 err = -ENOMEM;1378 err = -ENOMEM;
1379 goto unlock;1379 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
214 struct snd_gf1_dma_block *block;214 struct snd_gf1_dma_block *block;
215 struct snd_gf1_dma_block *free_block = NULL;215 struct snd_gf1_dma_block *free_block = NULL;
216 216
217 block = kmalloc(sizeof(*block), atomic ? GFP_ATOMIC : GFP_KERNEL);217 block = kmalloc_obj(*block, atomic ? GFP_ATOMIC : GFP_KERNEL);
218 if (!block)218 if (!block)
219 return -ENOMEM;219 return -ENOMEM;
220 220
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
1444 struct snd_cs46xx_pcm * cpcm;1444 struct snd_cs46xx_pcm * cpcm;
1445 struct snd_pcm_runtime *runtime = substream->runtime;1445 struct snd_pcm_runtime *runtime = substream->runtime;
1446 1446
1447 cpcm = kzalloc(sizeof(*cpcm), GFP_KERNEL);1447 cpcm = kzalloc_obj(*cpcm);
1448 if (cpcm == NULL)1448 if (cpcm == NULL)
1449 return -ENOMEM;1449 return -ENOMEM;
1450 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,1450 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
236 *ramixer = NULL;236 *ramixer = NULL;
237 237
238 /* Allocate mem for amixer resource */238 /* Allocate mem for amixer resource */
239 amixer = kzalloc(sizeof(*amixer), GFP_KERNEL);239 amixer = kzalloc_obj(*amixer);
240 if (!amixer)240 if (!amixer)
241 return -ENOMEM;241 return -ENOMEM;
242 242
@@ -390,7 +390,7 @@ static int get_sum_rsc(struct sum_mgr *mgr, · 147 unmodified lines
390 *rsum = NULL;390 *rsum = NULL;
391 391
392 /* Allocate mem for sum resource */392 /* Allocate mem for sum resource */
393 sum = kzalloc(sizeof(*sum), GFP_KERNEL);393 sum = kzalloc_obj(*sum);
394 if (!sum)394 if (!sum)
395 return -ENOMEM;395 return -ENOMEM;
396 396
sound/pci/ctxfi/ctdaio.c+2−2
@@ -540,7 +540,7 @@ static int get_daio_rsc(struct daio_mgr *mgr, · 539 unmodified lines
540 err = -ENOMEM;540 err = -ENOMEM;
541 /* Allocate mem for daio resource */541 /* Allocate mem for daio resource */
542 if (desc->output) {542 if (desc->output) {
543 struct dao *dao = kzalloc(sizeof(*dao), GFP_KERNEL);543 struct dao *dao = kzalloc_obj(*dao);
544 if (!dao)544 if (!dao)
545 goto error;545 goto error;
546 546
@@ -552,7 +552,7 @@ static int get_daio_rsc(struct daio_mgr *mgr, · 5 unmodified lines
552 552
553 *rdaio = &dao->daio;553 *rdaio = &dao->daio;
554 } else {554 } else {
555 struct dai *dai = kzalloc(sizeof(*dai), GFP_KERNEL);555 struct dai *dai = kzalloc_obj(*dai);
556 if (!dai)556 if (!dai)
557 goto error;557 goto error;
558 558
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
432 432
433 /* Allocate mem for master src resource */433 /* Allocate mem for master src resource */
434 if (MEMRD == desc->mode)434 if (MEMRD == desc->mode)
435 src = kcalloc(desc->multi, sizeof(*src), GFP_KERNEL);435 src = kzalloc_objs(*src, desc->multi);
436 else436 else
437 src = kzalloc(sizeof(*src), GFP_KERNEL);437 src = kzalloc_obj(*src);
438 438
439 if (!src) {439 if (!src) {
440 err = -ENOMEM;440 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
318{318{
319 struct ct_timer_instance *ti;319 struct ct_timer_instance *ti;
320 320
321 ti = kzalloc(sizeof(*ti), GFP_KERNEL);321 ti = kzalloc_obj(*ti);
322 if (!ti)322 if (!ti)
323 return NULL;323 return NULL;
324 spin_lock_init(&ti->lock);324 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
2470 emu->support_tlv = 1;2470 emu->support_tlv = 1;
2471 return put_user(SNDRV_EMU10K1_VERSION, (int __user *)argp);2471 return put_user(SNDRV_EMU10K1_VERSION, (int __user *)argp);
2472 case SNDRV_EMU10K1_IOCTL_INFO:2472 case SNDRV_EMU10K1_IOCTL_INFO:
2473 info = kzalloc(sizeof(*info), GFP_KERNEL);2473 info = kzalloc_obj(*info, GFP_KERNEL);
2474 if (!info)2474 if (!info)
2475 return -ENOMEM;2475 return -ENOMEM;
2476 snd_emu10k1_fx8010_info(emu, info);2476 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
371 unsigned int *t;371 unsigned int *t;
372 unsigned int i;372 unsigned int i;
373 373
374 tlv = kzalloc_objs(*tlv, 2 + ranges->nb_ranges * 6, GFP_KERNEL);374 tlv = kzalloc_objs(*tlv, 2 + ranges->nb_ranges * 6);
375 if (!tlv)375 if (!tlv)
376 return NULL;376 return NULL;
377 377
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
168 if (!dai->tdm_width_map)168 if (!dai->tdm_width_map)
169 return simple_ret(priv, ret); /* see NOTE */169 return simple_ret(priv, ret); /* see NOTE */
170 170
171 u32 *array_values __free(kfree) = kcalloc(n, sizeof(*array_values), GFP_KERNEL);171 u32 *array_values __free(kfree) = kzalloc_objs(*array_values, n);
172 if (!array_values)172 if (!array_values)
173 goto end;173 goto end;
174 174
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
253{253{
254 struct gx_stream *ts;254 struct gx_stream *ts;
255 255
256 ts = kzalloc(sizeof(*ts), GFP_KERNEL);256 ts = kzalloc_obj(*ts);
257 if (ts) {257 if (ts) {
258 INIT_LIST_HEAD(&ts->formatter_list);258 INIT_LIST_HEAD(&ts->formatter_list);
259 mutex_init(&ts->lock);259 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
1857 return ERR_PTR(-EINVAL);1857 return ERR_PTR(-EINVAL);
1858 }1858 }
1859 1859
1860 port = kzalloc(sizeof(*port), GFP_KERNEL);1860 port = kzalloc_obj(*port, GFP_KERNEL);
1861 if (!port)1861 if (!port)
1862 return ERR_PTR(-ENOMEM);1862 return ERR_PTR(-ENOMEM);
1863 1863
sound/soc/sdca/sdca_functions.c+9−10
@@ -1249,8 +1249,7 @@ static int find_sdca_entity_pde(struct device *dev, · 1248 unmodified lines
1249 return -EINVAL;1249 return -EINVAL;
1250 }1250 }
1251 1251
1252 u32 *delay_list __free(kfree) = kcalloc(num_delays, sizeof(*delay_list),1252 u32 *delay_list __free(kfree) = kzalloc_objs(*delay_list, num_delays);
1253 GFP_KERNEL);
1254 if (!delay_list)1253 if (!delay_list)
1255 return -ENOMEM;1254 return -ENOMEM;
1256 1255
@@ -1313,8 +1312,8 @@ static int find_sdca_entity_ge(struct device *dev, · 56 unmodified lines
1313 return -EINVAL;1312 return -EINVAL;
1314 }1313 }
1315 1314
1316 u8 *affected_list __free(kfree) = kcalloc(num_affected, sizeof(*affected_list),1315 u8 *affected_list __free(kfree) = kzalloc_objs(*affected_list,
1317 GFP_KERNEL);1316 num_affected);
1318 if (!affected_list)1317 if (!affected_list)
1319 return -ENOMEM;1318 return -ENOMEM;
1320 1319
@@ -1552,8 +1551,8 @@ static int find_sdca_entities(struct device *dev, struct fwnode_handle *function · 231 unmodified lines
1552 if (!entities)1551 if (!entities)
1553 return -ENOMEM;1552 return -ENOMEM;
1554 1553
1555 u32 *entity_list __free(kfree) = kcalloc(num_entities, sizeof(*entity_list),1554 u32 *entity_list __free(kfree) = kzalloc_objs(*entity_list,
1556 GFP_KERNEL);1555 num_entities);
1557 if (!entity_list)1556 if (!entity_list)
1558 return -ENOMEM;1557 return -ENOMEM;
1559 1558
@@ -1715,8 +1714,8 @@ static int find_sdca_entity_connection_pde(struct device *dev, · 155 unmodified lines
1715 if (!managed)1714 if (!managed)
1716 return -ENOMEM;1715 return -ENOMEM;
1717 1716
1718 u32 *managed_list __free(kfree) = kcalloc(num_managed, sizeof(*managed_list),1717 u32 *managed_list __free(kfree) = kzalloc_objs(*managed_list,
1719 GFP_KERNEL);1718 num_managed);
1720 if (!managed_list)1719 if (!managed_list)
1721 return -ENOMEM;1720 return -ENOMEM;
1722 1721
@@ -2033,8 +2032,8 @@ static int find_sdca_clusters(struct device *dev, · 310 unmodified lines
2033 if (!clusters)2032 if (!clusters)
2034 return -ENOMEM;2033 return -ENOMEM;
2035 2034
2036 u32 *cluster_list __free(kfree) = kcalloc(num_clusters, sizeof(*cluster_list),2035 u32 *cluster_list __free(kfree) = kzalloc_objs(*cluster_list,
2037 GFP_KERNEL);2036 num_clusters);
2038 if (!cluster_list)2037 if (!cluster_list)
2039 return -ENOMEM;2038 return -ENOMEM;
2040 2039
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
260 *num_desc = info->num_elems;260 *num_desc = info->num_elems;
261 dev_dbg(dev, "%s: got %zu probe points", __func__, *num_desc);261 dev_dbg(dev, "%s: got %zu probe points", __func__, *num_desc);
262 262
263 *desc = kcalloc(*num_desc, sizeof(**desc), GFP_KERNEL);263 *desc = kzalloc_objs(**desc, *num_desc);
264 if (!*desc) {264 if (!*desc) {
265 kfree(msg.data_ptr);265 kfree(msg.data_ptr);
266 return -ENOMEM;266 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
230 struct sof_client_dev *cdev;230 struct sof_client_dev *cdev;
231 int ret;231 int ret;
232 232
233 centry = kzalloc(sizeof(*centry), GFP_KERNEL);233 centry = kzalloc_obj(*centry);
234 if (!centry)234 if (!centry)
235 return -ENOMEM;235 return -ENOMEM;
236 236
sound/sparc/amd7930.c+1−1
@@ -903,7 +903,7 @@ static int snd_amd7930_create(struct snd_card *card, · 902 unmodified lines
903 int err;903 int err;
904 904
905 *ramd = NULL;905 *ramd = NULL;
906 amd = kzalloc(sizeof(*amd), GFP_KERNEL);906 amd = kzalloc_obj(*amd);
907 if (amd == NULL)907 if (amd == NULL)
908 return -ENOMEM;908 return -ENOMEM;
909 909