Merge tag 'devm_kmalloc_obj-v7.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

Pull devm_kmalloc_obj conversion from Kees Cook:

 - treewide refresh of kmalloc_obj() conversions

 - devm_kmalloc_obj conversion rules added to Coccinelle scripting

 - treewide conversion of devm_kmalloc() family to devm_kmalloc_obj()

* tag 'devm_kmalloc_obj-v7.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() family
  coccinelle: kmalloc_obj: Include devm_kmalloc_obj conversion rules
  treewide: refresh kmalloc_obj() conversions
This commit is contained in:
Linus Torvalds
2026-11-08 14:55:54 -08:00
6431 changed files with 11142 additions and 13497 deletions
+10 -7
View File
@@ -672,18 +672,21 @@ static void arc_pmu_add_raw_event_attr(int j, char *str)
static int arc_pmu_raw_alloc(struct device *dev)
{
arc_pmu->attr = devm_kmalloc_array(dev, arc_pmu->n_events + 1,
sizeof(*arc_pmu->attr), GFP_KERNEL | __GFP_ZERO);
arc_pmu->attr = devm_kmalloc_objs(dev, *arc_pmu->attr,
arc_pmu->n_events + 1,
GFP_KERNEL | __GFP_ZERO);
if (!arc_pmu->attr)
return -ENOMEM;
arc_pmu->attrs = devm_kmalloc_array(dev, arc_pmu->n_events + 1,
sizeof(*arc_pmu->attrs), GFP_KERNEL | __GFP_ZERO);
arc_pmu->attrs = devm_kmalloc_objs(dev, *arc_pmu->attrs,
arc_pmu->n_events + 1,
GFP_KERNEL | __GFP_ZERO);
if (!arc_pmu->attrs)
return -ENOMEM;
arc_pmu->raw_entry = devm_kmalloc_array(dev, arc_pmu->n_events,
sizeof(*arc_pmu->raw_entry), GFP_KERNEL | __GFP_ZERO);
arc_pmu->raw_entry = devm_kmalloc_objs(dev, *arc_pmu->raw_entry,
arc_pmu->n_events,
GFP_KERNEL | __GFP_ZERO);
if (!arc_pmu->raw_entry)
return -ENOMEM;
@@ -747,7 +750,7 @@ static int arc_pmu_device_probe(struct platform_device *pdev)
if (WARN(!cc_bcr.v, "Counters exist but No countable conditions?"))
return -EINVAL;
arc_pmu = devm_kzalloc(&pdev->dev, sizeof(struct arc_pmu), GFP_KERNEL);
arc_pmu = devm_kzalloc_obj(&pdev->dev, struct arc_pmu);
if (!arc_pmu)
return -ENOMEM;
+1 -2
View File
@@ -1101,8 +1101,7 @@ static void fill_ill_insn(void *area, unsigned int size)
/* Piece of memory that can be allocated at the beginning of jit_prepare(). */
static int jit_prepare_early_mem_alloc(struct jit_context *ctx)
{
ctx->bpf2insn = kcalloc(ctx->prog->len, sizeof(ctx->jit.len),
GFP_KERNEL);
ctx->bpf2insn = kzalloc_objs(ctx->jit.len, ctx->prog->len);
if (!ctx->bpf2insn) {
pr_err("bpf-jit: could not allocate memory for "
+1 -1
View File
@@ -800,7 +800,7 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq)
if (!pd)
return -EINVAL;
sachip = devm_kzalloc(me, sizeof(struct sa1111), GFP_KERNEL);
sachip = devm_kzalloc_obj(me, struct sa1111);
if (!sachip)
return -ENOMEM;
+1 -2
View File
@@ -92,8 +92,7 @@ static void __init parse_dt_topology(void)
unsigned long capacity = 0;
int cpu = 0;
__cpu_capacity = kcalloc(nr_cpu_ids, sizeof(*__cpu_capacity),
GFP_NOWAIT);
__cpu_capacity = kzalloc_objs(*__cpu_capacity, nr_cpu_ids, GFP_NOWAIT);
for_each_possible_cpu(cpu) {
const __be32 *rate;
+1 -1
View File
@@ -219,7 +219,7 @@ static int imx_src_probe(struct platform_device *pdev)
{
struct reset_controller_dev *rcdev;
rcdev = devm_kzalloc(&pdev->dev, sizeof(*rcdev), GFP_KERNEL);
rcdev = devm_kzalloc_obj(&pdev->dev, *rcdev);
if (!rcdev)
return -ENOMEM;
+1 -2
View File
@@ -770,8 +770,7 @@ static int omap_system_dma_probe(struct platform_device *pdev)
dma_chan_count = dma_lch_count;
enable_1510_mode = d->dev_caps & ENABLE_1510_MODE;
dma_chan = devm_kcalloc(&pdev->dev, dma_lch_count,
sizeof(*dma_chan), GFP_KERNEL);
dma_chan = devm_kzalloc_objs(&pdev->dev, *dma_chan, dma_lch_count);
if (!dma_chan)
return -ENOMEM;
+1 -3
View File
@@ -102,9 +102,7 @@ static int __init pxa_pm_init(void)
return -EINVAL;
}
sleep_save = kmalloc_array(pxa_cpu_pm_fns->save_count,
sizeof(*sleep_save),
GFP_KERNEL);
sleep_save = kmalloc_objs(*sleep_save, pxa_cpu_pm_fns->save_count);
if (!sleep_save)
return -ENOMEM;
+1 -1
View File
@@ -2199,7 +2199,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr
ctx.idx += ctx.imm_count;
if (ctx.imm_count) {
ctx.imms = kcalloc(ctx.imm_count, sizeof(u32), GFP_KERNEL);
ctx.imms = kzalloc_objs(u32, ctx.imm_count);
if (ctx.imms == NULL)
goto out_off;
}
+1 -2
View File
@@ -170,8 +170,7 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
static int __init cpu_suspend_init(void)
{
/* ctx_ptr is an array of physical addresses */
sleep_save_stash = kcalloc(mpidr_hash_size(), sizeof(*sleep_save_stash),
GFP_KERNEL);
sleep_save_stash = kzalloc_objs(*sleep_save_stash, mpidr_hash_size());
if (WARN_ON(!sleep_save_stash))
return -ENOMEM;
+1 -1
View File
@@ -506,7 +506,7 @@ static int set_ccsidr(struct kvm_vcpu *vcpu, u32 csselr, u32 val)
if (val == get_ccsidr(vcpu, csselr))
return 0;
ccsidr = kmalloc_array(CSSELR_MAX, sizeof(u32), GFP_KERNEL_ACCOUNT);
ccsidr = kmalloc_objs(u32, CSSELR_MAX, GFP_KERNEL_ACCOUNT);
if (!ccsidr)
return -ENOMEM;
+2 -2
View File
@@ -1000,8 +1000,8 @@ int kvm_vgic_v5_irs_init(struct kvm *kvm, unsigned int nr_spis)
* provide at least 32 SPIs, so we always meet alignment requirements.
*/
if (nr_spis) {
dist->spis = kcalloc(nr_spis, sizeof(struct vgic_irq),
GFP_KERNEL_ACCOUNT);
dist->spis = kzalloc_objs(struct vgic_irq, nr_spis,
GFP_KERNEL_ACCOUNT);
if (!dist->spis)
return -ENOMEM;
+3 -4
View File
@@ -198,8 +198,7 @@ static int vgic_v5_alloc_vmt_two_level(unsigned int num_entries)
return -ENOMEM;
vmt_info->l2.l2ptrs = kzalloc_objs(*vmt_info->l2.l2ptrs,
vmt_info->l2.num_l1_ents,
GFP_KERNEL);
vmt_info->l2.num_l1_ents);
if (!vmt_info->l2.l2ptrs) {
kfree(vmt_info->l2.vmt_base);
return -ENOMEM;
@@ -296,7 +295,7 @@ int vgic_v5_vmt_allocate(unsigned int max_vpes)
int ret;
/* Allocate the tracking structure */
vmt_info = kzalloc_obj(*vmt_info, GFP_KERNEL);
vmt_info = kzalloc_obj(*vmt_info);
if (!vmt_info)
return -ENOMEM;
@@ -1598,7 +1597,7 @@ static int vgic_v5_track_pending_irq(struct list_head *pending_irqs, u32 intid,
{
struct vgic_v5_pending_irq *pirq;
pirq = kzalloc_obj(*pirq, GFP_KERNEL);
pirq = kzalloc_obj(*pirq);
if (!pirq)
return -ENOMEM;
+1 -1
View File
@@ -2301,7 +2301,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr
ctx.user_vm_start = bpf_arena_get_user_vm_start(prog->aux->arena);
}
ctx.offset = kvcalloc(prog->len + 1, sizeof(u32), GFP_KERNEL);
ctx.offset = kvzalloc_objs(u32, prog->len + 1);
if (ctx.offset == NULL)
goto out_offset;
+1 -1
View File
@@ -361,7 +361,7 @@ static void *cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)
};
/* Allocate a buffer to hold the generated code */
p = buf = kcalloc(max_instrs, sizeof(u32), GFP_KERNEL);
p = buf = kzalloc_objs(u32, max_instrs);
if (!buf)
return NULL;
+1 -2
View File
@@ -959,8 +959,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr
* Not able to allocate memory for descriptors[], then
* we must fall back to the interpreter
*/
ctx.descriptors = kcalloc(prog->len + 1, sizeof(*ctx.descriptors),
GFP_KERNEL);
ctx.descriptors = kzalloc_objs(*ctx.descriptors, prog->len + 1);
if (ctx.descriptors == NULL)
goto out_err;
+1 -1
View File
@@ -413,7 +413,7 @@ static int ar2315_pci_probe(struct platform_device *pdev)
struct resource *res;
int irq, err;
apc = devm_kzalloc(dev, sizeof(*apc), GFP_KERNEL);
apc = devm_kzalloc_obj(dev, *apc);
if (!apc)
return -ENOMEM;
+1 -2
View File
@@ -331,8 +331,7 @@ static int ar71xx_pci_probe(struct platform_device *pdev)
struct resource *res;
u32 t;
apc = devm_kzalloc(&pdev->dev, sizeof(struct ar71xx_pci_controller),
GFP_KERNEL);
apc = devm_kzalloc_obj(&pdev->dev, struct ar71xx_pci_controller);
if (!apc)
return -ENOMEM;
+1 -2
View File
@@ -367,8 +367,7 @@ static int ar724x_pci_probe(struct platform_device *pdev)
if (id == -1)
id = 0;
apc = devm_kzalloc(&pdev->dev, sizeof(struct ar724x_pci_controller),
GFP_KERNEL);
apc = devm_kzalloc_obj(&pdev->dev, struct ar724x_pci_controller);
if (!apc)
return -ENOMEM;
+1 -1
View File
@@ -410,7 +410,7 @@ static int rt3883_pci_probe(struct platform_device *pdev)
int err;
int mode;
rpc = devm_kzalloc(dev, sizeof(*rpc), GFP_KERNEL);
rpc = devm_kzalloc_obj(dev, *rpc);
if (!rpc)
return -ENOMEM;
+1 -1
View File
@@ -102,7 +102,7 @@ static int rt_timer_probe(struct platform_device *pdev)
struct rt_timer *rt;
struct clk *clk;
rt = devm_kzalloc(&pdev->dev, sizeof(*rt), GFP_KERNEL);
rt = devm_kzalloc_obj(&pdev->dev, *rt);
if (!rt) {
dev_err(&pdev->dev, "failed to allocate memory\n");
return -ENOMEM;
+1 -1
View File
@@ -824,7 +824,7 @@ static int parse_thread_groups(struct device_node *dn,
int i = 0;
count = of_property_count_u32_elems(dn, "ibm,thread-groups");
thread_group_array = kcalloc(count, sizeof(u32), GFP_KERNEL);
thread_group_array = kzalloc_objs(u32, count);
if (!thread_group_array)
return -ENOMEM;
ret = of_property_read_u32_array(dn, "ibm,thread-groups",
+3 -6
View File
@@ -804,9 +804,7 @@ int kvm_vcpu_ioctl_config_tlb(struct kvm_vcpu *vcpu,
goto free_privs_first;
}
g2h_bitmap = kcalloc(params.tlb_sizes[1],
sizeof(*g2h_bitmap),
GFP_KERNEL);
g2h_bitmap = kzalloc_objs(*g2h_bitmap, params.tlb_sizes[1]);
if (!g2h_bitmap) {
ret = -ENOMEM;
goto free_privs_second;
@@ -930,9 +928,8 @@ int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 *vcpu_e500)
if (!vcpu_e500->gtlb_priv[1])
goto free_vcpu;
vcpu_e500->g2h_tlb1_map = kcalloc(vcpu_e500->gtlb_params[1].entries,
sizeof(*vcpu_e500->g2h_tlb1_map),
GFP_KERNEL);
vcpu_e500->g2h_tlb1_map = kzalloc_objs(*vcpu_e500->g2h_tlb1_map,
vcpu_e500->gtlb_params[1].entries);
if (!vcpu_e500->g2h_tlb1_map)
goto free_vcpu;
+2 -3
View File
@@ -741,9 +741,8 @@ int e500_mmu_host_init(struct kvmppc_vcpu_e500 *vcpu_e500)
host_tlb_params[0].sets =
host_tlb_params[0].entries / host_tlb_params[0].ways;
host_tlb_params[1].sets = 1;
vcpu_e500->h2g_tlb1_rmap = kcalloc(host_tlb_params[1].entries,
sizeof(*vcpu_e500->h2g_tlb1_rmap),
GFP_KERNEL);
vcpu_e500->h2g_tlb1_rmap = kzalloc_objs(*vcpu_e500->h2g_tlb1_rmap,
host_tlb_params[1].entries);
if (!vcpu_e500->h2g_tlb1_rmap)
return -EINVAL;
+2 -2
View File
@@ -258,7 +258,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr
goto skip_init_ctx;
}
addrs = kcalloc(flen + 1, sizeof(*addrs), GFP_KERNEL);
addrs = kzalloc_objs(*addrs, flen + 1);
if (addrs == NULL)
goto out_err;
@@ -1104,7 +1104,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im
}
if (fmod_ret->nr_nodes) {
branches = kcalloc(fmod_ret->nr_nodes, sizeof(u32), GFP_KERNEL);
branches = kzalloc_objs(u32, fmod_ret->nr_nodes);
if (!branches)
return -ENOMEM;
@@ -382,8 +382,8 @@ static int get_cs_ranges(struct device *dev)
of_range_parser_init(&parser, lb_node);
lpbfifo.cs_n = of_range_count(&parser);
lpbfifo.cs_ranges = devm_kcalloc(dev, lpbfifo.cs_n,
sizeof(struct cs_range), GFP_KERNEL);
lpbfifo.cs_ranges = devm_kzalloc_objs(dev, struct cs_range,
lpbfifo.cs_n);
if (!lpbfifo.cs_ranges)
goto end;
+1 -1
View File
@@ -713,7 +713,7 @@ static int mpc52xx_gpt_probe(struct platform_device *ofdev)
{
struct mpc52xx_gpt_priv *gpt;
gpt = devm_kzalloc(&ofdev->dev, sizeof *gpt, GFP_KERNEL);
gpt = devm_kzalloc_obj(&ofdev->dev, *gpt);
if (!gpt)
return -ENOMEM;
+1 -1
View File
@@ -91,7 +91,7 @@ static int cpm_pic_probe(struct platform_device *pdev)
if (!res)
return -ENODEV;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
data = devm_kzalloc_obj(dev, *data);
if (!data)
return -ENOMEM;
+2 -2
View File
@@ -491,7 +491,7 @@ int cpm1_gpiochip_add16(struct device *dev)
struct gpio_chip *gc;
u32 mask;
cpm1_gc = devm_kzalloc(dev, sizeof(*cpm1_gc), GFP_KERNEL);
cpm1_gc = devm_kzalloc_obj(dev, *cpm1_gc);
if (!cpm1_gc)
return -ENOMEM;
@@ -635,7 +635,7 @@ int cpm1_gpiochip_add32(struct device *dev)
struct cpm1_gpio32_chip *cpm1_gc;
struct gpio_chip *gc;
cpm1_gc = devm_kzalloc(dev, sizeof(*cpm1_gc), GFP_KERNEL);
cpm1_gc = devm_kzalloc_obj(dev, *cpm1_gc);
if (!cpm1_gc)
return -ENOMEM;
+2 -2
View File
@@ -1338,8 +1338,8 @@ static int __init pnv_parse_cpuidle_dt(void)
"ibm,cpu-idle-state-flags");
pnv_idle_states = kzalloc_objs(*pnv_idle_states, nr_idle_states);
temp_u32 = kcalloc(nr_idle_states, sizeof(u32), GFP_KERNEL);
temp_u64 = kcalloc(nr_idle_states, sizeof(u64), GFP_KERNEL);
temp_u32 = kzalloc_objs(u32, nr_idle_states);
temp_u64 = kzalloc_objs(u64, nr_idle_states);
temp_string = kcalloc(nr_idle_states, sizeof(char *), GFP_KERNEL);
if (!(pnv_idle_states && temp_u32 && temp_u64 && temp_string)) {
+2 -2
View File
@@ -91,11 +91,11 @@ static int imc_get_mem_addr_nest(struct device_node *node,
if (nr_chips <= 0)
return -ENODEV;
base_addr_arr = kcalloc(nr_chips, sizeof(*base_addr_arr), GFP_KERNEL);
base_addr_arr = kzalloc_objs(*base_addr_arr, nr_chips);
if (!base_addr_arr)
return -ENOMEM;
chipid_arr = kcalloc(nr_chips, sizeof(*chipid_arr), GFP_KERNEL);
chipid_arr = kzalloc_objs(*chipid_arr, nr_chips);
if (!chipid_arr) {
kfree(base_addr_arr);
return -ENOMEM;
@@ -185,14 +185,14 @@ void __init opal_sys_param_init(void)
goto out_param_buf;
}
id = kcalloc(count, sizeof(*id), GFP_KERNEL);
id = kzalloc_objs(*id, count);
if (!id) {
pr_err("SYSPARAM: Failed to allocate memory to read parameter "
"id\n");
goto out_param_buf;
}
size = kcalloc(count, sizeof(*size), GFP_KERNEL);
size = kzalloc_objs(*size, count);
if (!size) {
pr_err("SYSPARAM: Failed to allocate memory to read parameter "
"size\n");
+1 -1
View File
@@ -199,7 +199,7 @@ int cpm2_gpiochip_add32(struct device *dev)
struct cpm2_gpio32_chip *cpm2_gc;
struct gpio_chip *gc;
cpm2_gc = devm_kzalloc(dev, sizeof(*cpm2_gc), GFP_KERNEL);
cpm2_gc = devm_kzalloc_obj(dev, *cpm2_gc);
if (!cpm2_gc)
return -ENOMEM;
+1 -1
View File
@@ -254,7 +254,7 @@ void *uv_alloc_stor_var(unsigned long size)
area = get_vm_area(size, VM_SPARSE);
if (!area)
return NULL;
pages = kvcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL_ACCOUNT);
pages = kvzalloc_objs(struct page *, nr_pages, GFP_KERNEL_ACCOUNT);
if (!pages)
goto free_area;
for (i = 0; i < nr_pages; i++) {
+1 -1
View File
@@ -2397,7 +2397,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr
}
memset(&jit, 0, sizeof(jit));
jit.addrs = kvcalloc(fp->len + 1, sizeof(*jit.addrs), GFP_KERNEL);
jit.addrs = kvzalloc_objs(*jit.addrs, fp->len + 1);
if (jit.addrs == NULL)
goto out_err;
/*
+2 -2
View File
@@ -1079,8 +1079,8 @@ static int zpci_mem_init(void)
if (!zpci_iomap_start)
goto error_iomap;
zpci_iomap_bitmap = kcalloc(BITS_TO_LONGS(ZPCI_IOMAP_ENTRIES),
sizeof(*zpci_iomap_bitmap), GFP_KERNEL);
zpci_iomap_bitmap = kzalloc_objs(*zpci_iomap_bitmap,
BITS_TO_LONGS(ZPCI_IOMAP_ENTRIES));
if (!zpci_iomap_bitmap)
goto error_iomap_bitmap;
+1 -1
View File
@@ -528,7 +528,7 @@ static int grpci1_of_probe(struct platform_device *ofdev)
return -EIO;
}
priv = devm_kzalloc(&ofdev->dev, sizeof(*priv), GFP_KERNEL);
priv = devm_kzalloc_obj(&ofdev->dev, *priv);
if (!priv) {
dev_err(&ofdev->dev, "memory allocation failed\n");
return -ENOMEM;
+1 -2
View File
@@ -172,8 +172,7 @@ static int __init check_nmi_watchdog(void)
if (!atomic_read(&nmi_active))
return 0;
prev_nmi_count = kmalloc_array(nr_cpu_ids, sizeof(unsigned int),
GFP_KERNEL);
prev_nmi_count = kmalloc_objs(unsigned int, nr_cpu_ids);
if (!prev_nmi_count) {
err = -ENOMEM;
goto error;
+1 -1
View File
@@ -335,7 +335,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
if (!bpf_jit_enable)
return;
addrs = kmalloc_array(flen, sizeof(*addrs), GFP_KERNEL);
addrs = kmalloc_objs(*addrs, flen);
if (addrs == NULL)
return;
+1 -1
View File
@@ -1511,7 +1511,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr
memset(&ctx, 0, sizeof(ctx));
ctx.prog = prog;
ctx.offset = kmalloc_array(prog->len, sizeof(unsigned int), GFP_KERNEL);
ctx.offset = kmalloc_objs(unsigned int, prog->len);
if (ctx.offset == NULL)
goto out_err;
+1 -1
View File
@@ -1196,7 +1196,7 @@ virtio_uml_create_pdata(struct platform_device *pdev)
if (!np)
return ERR_PTR(-EINVAL);
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
pdata = devm_kzalloc_obj(&pdev->dev, *pdata);
if (!pdata)
return ERR_PTR(-ENOMEM);
+1 -2
View File
@@ -394,8 +394,7 @@ static bool uncore_discovery_msr(struct uncore_discovery_domain *domain)
int cpu, die;
u64 base;
die_mask = kcalloc(BITS_TO_LONGS(uncore_max_dies()),
sizeof(unsigned long), GFP_KERNEL);
die_mask = kzalloc_objs(unsigned long, BITS_TO_LONGS(uncore_max_dies()));
if (!die_mask)
return false;
+1 -1
View File
@@ -228,7 +228,7 @@ static void amd_cache_gart(void)
if (!amd_nb_has_feature(AMD_NB_GART))
return;
flush_words = kmalloc_array(amd_northbridges.num, sizeof(u32), GFP_KERNEL);
flush_words = kmalloc_objs(u32, amd_northbridges.num);
if (!flush_words) {
amd_northbridges.flags &= ~AMD_NB_GART;
pr_notice("Cannot initialize GART flush words, GART support disabled\n");
+1 -1
View File
@@ -209,7 +209,7 @@ static int x2apic_cluster_probe(void)
return 0;
slots = max_t(u32, L1_CACHE_BYTES/sizeof(u32), nr_cpu_ids);
x86_cpu_to_logical_apicid = kcalloc(slots, sizeof(u32), GFP_KERNEL);
x86_cpu_to_logical_apicid = kzalloc_objs(u32, slots);
if (!x86_cpu_to_logical_apicid)
return 0;
+1 -1
View File
@@ -43,7 +43,7 @@ mtrr_file_add(unsigned long base, unsigned long size,
max = num_var_ranges;
if (fcount == NULL) {
fcount = kcalloc(max, sizeof(*fcount), GFP_KERNEL);
fcount = kzalloc_objs(*fcount, max);
if (!fcount)
return -ENOMEM;
FILE_FCOUNT(file) = fcount;
+1 -2
View File
@@ -408,8 +408,7 @@ static int domain_setup_ctrlval(struct rdt_resource *r, struct rdt_ctrl_domain *
struct msr_param m;
u32 *dc;
dc = kmalloc_array(hw_res->num_closid, sizeof(*hw_dom->ctrl_val),
GFP_KERNEL);
dc = kmalloc_objs(*hw_dom->ctrl_val, hw_res->num_closid);
if (!dc)
return -ENOMEM;
+1 -1
View File
@@ -103,7 +103,7 @@ static int kvm_mmu_rmaps_stat_show(struct seq_file *m, void *v)
ret = -ENOMEM;
memset(log, 0, sizeof(log));
for (i = 0; i < KVM_NR_PAGE_SIZES; i++) {
log[i] = kcalloc(RMAP_LOG_SIZE, sizeof(unsigned int), GFP_KERNEL);
log[i] = kzalloc_objs(unsigned int, RMAP_LOG_SIZE);
if (!log[i])
goto out;
}
+3 -2
View File
@@ -3024,8 +3024,9 @@ static int tdx_td_vcpu_init(struct kvm_vcpu *vcpu, u64 vcpu_rcx)
*/
tdx->vp.tdvpr_pa = page_to_phys(tdx->vp.tdvpr_page);
tdx->vp.tdcx_pages = kcalloc(kvm_tdx->td.tdcx_nr_pages, sizeof(*tdx->vp.tdcx_pages),
GFP_KERNEL_ACCOUNT);
tdx->vp.tdcx_pages = kzalloc_objs(*tdx->vp.tdcx_pages,
kvm_tdx->td.tdcx_nr_pages,
GFP_KERNEL_ACCOUNT);
if (!tdx->vp.tdcx_pages) {
ret = -ENOMEM;
goto free_tdvpr;
+1 -1
View File
@@ -358,7 +358,7 @@ static int mid_pwr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
return ret;
}
pwr = devm_kzalloc(dev, sizeof(*pwr), GFP_KERNEL);
pwr = devm_kzalloc_obj(dev, *pwr);
if (!pwr)
return -ENOMEM;
+1 -1
View File
@@ -272,7 +272,7 @@ static int pefile_digest_pe_contents(const void *pebuf, unsigned int pelen,
if (ret < 0)
return ret;
canon = kcalloc(ctx->n_sections, sizeof(unsigned), GFP_KERNEL);
canon = kzalloc_objs(unsigned, ctx->n_sections);
if (!canon)
return -ENOMEM;
+1 -1
View File
@@ -439,7 +439,7 @@ struct crypto_engine *crypto_engine_alloc_init_and_set(struct device *dev,
if (!dev)
return NULL;
engine = devm_kzalloc(dev, sizeof(*engine), GFP_KERNEL);
engine = devm_kzalloc_obj(dev, *engine);
if (!engine)
return NULL;
+1 -1
View File
@@ -566,7 +566,7 @@ static int aie2_hwctx_col_list(struct amdxdna_hwctx *hwctx)
return -EINVAL;
}
hwctx->col_list = kmalloc_array(entries, sizeof(*hwctx->col_list), GFP_KERNEL);
hwctx->col_list = kmalloc_objs(*hwctx->col_list, entries);
if (!hwctx->col_list)
return -ENOMEM;
+1 -1
View File
@@ -712,7 +712,7 @@ static int amdxdna_drm_submit_execbuf(struct amdxdna_client *client,
cmd_bo_hdl = (u32)args->cmd_handles;
if (args->arg_count) {
arg_bo_hdls = kcalloc(args->arg_count, sizeof(u32), GFP_KERNEL);
arg_bo_hdls = kzalloc_objs(u32, args->arg_count);
if (!arg_bo_hdls)
return -ENOMEM;
ret = copy_from_user(arg_bo_hdls, u64_to_user_ptr(args->args),
@@ -947,11 +947,12 @@ static int allocate_cs(struct hl_device *hdev, struct hl_ctx *ctx,
goto free_cs;
}
cs->jobs_in_queue_cnt = kcalloc(hdev->asic_prop.max_queues,
sizeof(*cs->jobs_in_queue_cnt), GFP_ATOMIC);
cs->jobs_in_queue_cnt = kzalloc_objs(*cs->jobs_in_queue_cnt,
hdev->asic_prop.max_queues,
GFP_ATOMIC);
if (!cs->jobs_in_queue_cnt)
cs->jobs_in_queue_cnt = kcalloc(hdev->asic_prop.max_queues,
sizeof(*cs->jobs_in_queue_cnt), GFP_KERNEL);
cs->jobs_in_queue_cnt = kzalloc_objs(*cs->jobs_in_queue_cnt,
hdev->asic_prop.max_queues);
if (!cs->jobs_in_queue_cnt) {
atomic64_inc(&ctx->cs_counters.out_of_mem_drop_cnt);
@@ -1899,13 +1900,11 @@ static int cs_ioctl_extract_signal_seq(struct hl_device *hdev,
return -EINVAL;
}
signal_seq_arr = kmalloc_array(signal_seq_arr_len,
sizeof(*signal_seq_arr),
GFP_ATOMIC);
signal_seq_arr = kmalloc_objs(*signal_seq_arr, signal_seq_arr_len,
GFP_ATOMIC);
if (!signal_seq_arr)
signal_seq_arr = kmalloc_array(signal_seq_arr_len,
sizeof(*signal_seq_arr),
GFP_KERNEL);
signal_seq_arr = kmalloc_objs(*signal_seq_arr,
signal_seq_arr_len);
if (!signal_seq_arr) {
atomic64_inc(&ctx->cs_counters.out_of_mem_drop_cnt);
atomic64_inc(&hdev->aggregated_cs_counters.out_of_mem_drop_cnt);
@@ -2479,7 +2478,7 @@ static int cs_ioctl_engine_cores(struct hl_fpriv *hpriv, u64 engine_cores,
}
engine_cores_arr = (void __user *) (uintptr_t) engine_cores;
cores = kmalloc_array(num_engine_cores, sizeof(u32), GFP_KERNEL);
cores = kmalloc_objs(u32, num_engine_cores);
if (!cores)
return -ENOMEM;
@@ -2521,7 +2520,7 @@ static int cs_ioctl_engines(struct hl_fpriv *hpriv, u64 engines_arr_user_addr,
}
engines_arr = (void __user *) (uintptr_t) engines_arr_user_addr;
engines = kmalloc_array(num_engines, sizeof(u32), GFP_KERNEL);
engines = kmalloc_objs(u32, num_engines);
if (!engines)
return -ENOMEM;
@@ -3037,7 +3036,7 @@ static int hl_multi_cs_wait_ioctl(struct hl_fpriv *hpriv, void *data)
/* allocate memory for sequence array */
cs_seq_arr =
kmalloc_array(seq_arr_len, sizeof(*cs_seq_arr), GFP_KERNEL);
kmalloc_objs(*cs_seq_arr, seq_arr_len);
if (!cs_seq_arr)
return -ENOMEM;
+1 -1
View File
@@ -178,7 +178,7 @@ int hl_build_hwmon_channel_info(struct hl_device *hdev, struct cpucp_sensor *sen
num_sensors_for_type = counts[i] + 1;
dev_dbg(hdev->dev, "num_sensors_for_type %d = %d\n", i, num_sensors_for_type);
curr_arr = kcalloc(num_sensors_for_type, sizeof(*curr_arr), GFP_KERNEL);
curr_arr = kzalloc_objs(*curr_arr, num_sensors_for_type);
if (!curr_arr) {
rc = -ENOMEM;
goto sensors_type_err;
+2 -3
View File
@@ -139,7 +139,7 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,
phys_pg_pack->flags = args->flags;
phys_pg_pack->contiguous = contiguous;
phys_pg_pack->pages = kvmalloc_array(num_pgs, sizeof(u64), GFP_KERNEL);
phys_pg_pack->pages = kvmalloc_objs(u64, num_pgs);
if (ZERO_OR_NULL_PTR(phys_pg_pack->pages)) {
rc = -ENOMEM;
goto pages_arr_err;
@@ -885,8 +885,7 @@ static int init_phys_pg_pack_from_userptr(struct hl_ctx *ctx,
page_mask = ~(((u64) page_size) - 1);
phys_pg_pack->pages = kvmalloc_array(total_npages, sizeof(u64),
GFP_KERNEL);
phys_pg_pack->pages = kvmalloc_objs(u64, total_npages);
if (ZERO_OR_NULL_PTR(phys_pg_pack->pages)) {
rc = -ENOMEM;
goto page_pack_arr_mem_err;
+3 -5
View File
@@ -8989,14 +8989,12 @@ static int gaudi_print_fences_single_engine(
int rc = -ENOMEM, i;
u32 *statuses, *fences;
statuses = kcalloc(sds->props[SP_ENGINE_NUM_OF_QUEUES],
sizeof(*statuses), GFP_KERNEL);
statuses = kzalloc_objs(*statuses, sds->props[SP_ENGINE_NUM_OF_QUEUES]);
if (!statuses)
goto out;
fences = kcalloc(sds->props[SP_ENGINE_NUM_OF_FENCES] *
sds->props[SP_ENGINE_NUM_OF_QUEUES],
sizeof(*fences), GFP_KERNEL);
fences = kzalloc_objs(*fences,
sds->props[SP_ENGINE_NUM_OF_FENCES] * sds->props[SP_ENGINE_NUM_OF_QUEUES]);
if (!fences)
goto free_status;
@@ -2717,7 +2717,7 @@ static int gaudi2_init_pb_sm_objs(struct hl_device *hdev)
array_base = gaudi2_pb_dcr0_sm_objs.mm_block_base_addr +
gaudi2_pb_dcr0_sm_objs.glbl_sec_offset;
sec_array = kcalloc(glbl_sec_array_len, sizeof(u32), GFP_KERNEL);
sec_array = kzalloc_objs(u32, glbl_sec_array_len);
if (!sec_array)
return -ENOMEM;
+1 -1
View File
@@ -914,7 +914,7 @@ static int ivpu_submit(struct drm_file *file, struct ivpu_file_priv *file_priv,
u32 *buf_handles;
int idx, ret;
buf_handles = kcalloc(buffer_count, sizeof(u32), GFP_KERNEL);
buf_handles = kzalloc_objs(u32, buffer_count);
if (!buf_handles)
return -ENOMEM;
+2 -2
View File
@@ -1011,7 +1011,7 @@ struct mhi_controller *qaic_mhi_register_controller(struct pci_dev *pci_dev, voi
struct mhi_controller *mhi_cntrl;
int ret;
mhi_cntrl = devm_kzalloc(&pci_dev->dev, sizeof(*mhi_cntrl), GFP_KERNEL);
mhi_cntrl = devm_kzalloc_obj(&pci_dev->dev, *mhi_cntrl);
if (!mhi_cntrl)
return ERR_PTR(-ENOMEM);
@@ -1032,7 +1032,7 @@ struct mhi_controller *qaic_mhi_register_controller(struct pci_dev *pci_dev, voi
mhi_cntrl->regs = mhi_bar;
mhi_cntrl->reg_len = SZ_4K;
mhi_cntrl->nr_irqs = 1;
mhi_cntrl->irq = devm_kmalloc(&pci_dev->dev, sizeof(*mhi_cntrl->irq), GFP_KERNEL);
mhi_cntrl->irq = devm_kmalloc_obj(&pci_dev->dev, *mhi_cntrl->irq);
if (!mhi_cntrl->irq)
return ERR_PTR(-ENOMEM);
+1 -1
View File
@@ -221,7 +221,7 @@ static int qaic_bootlog_mhi_probe(struct mhi_device *mhi_dev, const struct mhi_d
qdev->bootlog_ch = mhi_dev;
for (i = 0; i < BOOTLOG_POOL_SIZE; i++) {
msg = devm_kzalloc(&qdev->pdev->dev, sizeof(*msg), GFP_KERNEL);
msg = devm_kzalloc_obj(&qdev->pdev->dev, *msg);
if (!msg) {
ret = -ENOMEM;
goto mhi_unprepare;
+1 -1
View File
@@ -415,7 +415,7 @@ static struct qaic_device *create_qdev(struct pci_dev *pdev,
struct drm_device *drm;
int i, ret;
qdev = devm_kzalloc(dev, struct_size(qdev, dbc, DBC_NUM), GFP_KERNEL);
qdev = devm_kzalloc_flex(dev, *qdev, dbc, DBC_NUM);
if (!qdev)
return NULL;
+1 -1
View File
@@ -800,7 +800,7 @@ static int sahara_mhi_probe(struct mhi_device *mhi_dev, const struct mhi_device_
int ret;
int i;
context = devm_kzalloc(&mhi_dev->dev, sizeof(*context), GFP_KERNEL);
context = devm_kzalloc_obj(&mhi_dev->dev, *context);
if (!context)
return -ENOMEM;
+1 -1
View File
@@ -33,7 +33,7 @@ struct rocket_device *rocket_device_init(struct platform_device *pdev,
rdev->max_cores = num_cores;
rdev->cores = devm_kcalloc(dev, num_cores, sizeof(*rdev->cores), GFP_KERNEL);
rdev->cores = devm_kzalloc_objs(dev, *rdev->cores, num_cores);
if (!rdev->cores)
return ERR_PTR(-ENOMEM);
+1 -1
View File
@@ -202,7 +202,7 @@ static int acpi_ac_probe(struct platform_device *pdev)
if (!adev)
return -ENODEV;
ac = devm_kzalloc(dev, sizeof(*ac), GFP_KERNEL);
ac = devm_kzalloc_obj(dev, *ac);
if (!ac)
return -ENOMEM;
+1 -1
View File
@@ -72,7 +72,7 @@ static int fch_misc_setup(struct apd_private_data *pdata)
struct list_head resource_list;
int ret;
clk_data = devm_kzalloc(&adev->dev, sizeof(*clk_data), GFP_KERNEL);
clk_data = devm_kzalloc_obj(&adev->dev, *clk_data);
if (!clk_data)
return -ENOMEM;
+1 -1
View File
@@ -853,7 +853,7 @@ static int acpi_tad_probe(struct platform_device *pdev)
if (!(caps & ACPI_TAD_AC_WAKE))
caps &= ~ACPI_TAD_DC_WAKE;
dd = devm_kzalloc(dev, sizeof(*dd), GFP_KERNEL);
dd = devm_kzalloc_obj(dev, *dd);
if (!dd)
return -ENOMEM;
+1 -2
View File
@@ -543,8 +543,7 @@ retry:
pr_warn(FW_WARN "too many record IDs!\n");
return 0;
}
new_entries = kvmalloc_array(new_size, sizeof(entries[0]),
GFP_KERNEL);
new_entries = kvmalloc_objs(entries[0], new_size);
if (!new_entries)
return -ENOMEM;
memcpy(new_entries, entries,
+1 -1
View File
@@ -112,7 +112,7 @@ static int nvidia_ghes_probe(struct platform_device *pdev)
struct nvidia_ghes_private *priv;
int ret;
priv = devm_kmalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
priv = devm_kmalloc_obj(&pdev->dev, *priv);
if (!priv)
return -ENOMEM;
+1 -1
View File
@@ -1476,7 +1476,7 @@ static int acpi_battery_probe(struct platform_device *pdev)
if (device->dep_unmet)
return -EPROBE_DEFER;
battery = devm_kzalloc(dev, sizeof(*battery), GFP_KERNEL);
battery = devm_kzalloc_obj(dev, *battery);
if (!battery)
return -ENOMEM;
+1 -1
View File
@@ -687,7 +687,7 @@ static int acpi_button_probe(struct platform_device *pdev)
lid_init_state == ACPI_BUTTON_LID_INIT_DISABLED)
return -ENODEV;
button = devm_kzalloc(dev, sizeof(*button), GFP_KERNEL);
button = devm_kzalloc_obj(dev, *button);
if (!button)
return -ENOMEM;
+3 -6
View File
@@ -913,9 +913,8 @@ static int cpc_register_non_mmio_desc(struct cpc_desc *cpc_desc)
if (!found)
return 0;
cpc_desc->non_mmio_nodes = kcalloc(nr_regs,
sizeof(*cpc_desc->non_mmio_nodes),
GFP_KERNEL);
cpc_desc->non_mmio_nodes = kzalloc_objs(*cpc_desc->non_mmio_nodes,
nr_regs);
if (!cpc_desc->non_mmio_nodes)
return -ENOMEM;
@@ -1254,9 +1253,7 @@ static int cpc_register_sysmem_desc(struct cpc_desc *cpc_desc)
if (!found)
return 0;
cpc_desc->sysmem_nodes = kcalloc(nr_regs,
sizeof(*cpc_desc->sysmem_nodes),
GFP_KERNEL);
cpc_desc->sysmem_nodes = kzalloc_objs(*cpc_desc->sysmem_nodes, nr_regs);
if (!cpc_desc->sysmem_nodes)
return -ENOMEM;
+2 -2
View File
@@ -115,7 +115,7 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
return AE_ERROR;
}
event = devm_kzalloc(dev, sizeof(*event), GFP_KERNEL);
event = devm_kzalloc_obj(dev, *event);
if (!event)
return AE_ERROR;
@@ -143,7 +143,7 @@ static int ged_probe(struct platform_device *pdev)
struct acpi_ged_device *geddev;
acpi_status acpi_ret;
geddev = devm_kzalloc(&pdev->dev, sizeof(*geddev), GFP_KERNEL);
geddev = devm_kzalloc_obj(&pdev->dev, *geddev);
if (!geddev)
return -ENOMEM;
+2 -2
View File
@@ -287,7 +287,7 @@ static int acpi_fan_get_fps(struct device *dev, struct acpi_device *device)
}
fan->fps_count = obj->package.count - 1; /* minus revision field */
fan->fps = devm_kcalloc(dev, fan->fps_count, sizeof(*fan->fps), GFP_KERNEL);
fan->fps = devm_kzalloc_objs(dev, *fan->fps, fan->fps_count);
if (!fan->fps)
return -ENOMEM;
@@ -475,7 +475,7 @@ static int acpi_fan_probe(struct platform_device *pdev)
if (!device)
return -ENODEV;
fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL);
fan = devm_kzalloc_obj(&pdev->dev, *fan);
if (!fan) {
dev_err(&device->dev, "No memory for fan\n");
return -ENOMEM;
+8 -10
View File
@@ -1060,8 +1060,7 @@ static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc,
if (found)
nfit_mem = found;
else {
nfit_mem = devm_kzalloc(acpi_desc->dev,
sizeof(*nfit_mem), GFP_KERNEL);
nfit_mem = devm_kzalloc_obj(acpi_desc->dev, *nfit_mem);
if (!nfit_mem)
return -ENOMEM;
INIT_LIST_HEAD(&nfit_mem->list);
@@ -1095,10 +1094,9 @@ static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc,
continue;
nfit_mem->nfit_flush = nfit_flush;
flush = nfit_flush->flush;
nfit_mem->flush_wpq = devm_kcalloc(acpi_desc->dev,
flush->hint_count,
sizeof(struct resource),
GFP_KERNEL);
nfit_mem->flush_wpq = devm_kzalloc_objs(acpi_desc->dev,
struct resource,
flush->hint_count);
if (!nfit_mem->flush_wpq)
return -ENOMEM;
for (i = 0; i < flush->hint_count; i++) {
@@ -2287,7 +2285,7 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
if (!info || !info2)
return -ENOMEM;
nd_set = devm_kzalloc(dev, sizeof(*nd_set), GFP_KERNEL);
nd_set = devm_kzalloc_obj(dev, *nd_set);
if (!nd_set)
return -ENOMEM;
import_guid(&nd_set->type_guid, spa->range_guid);
@@ -2541,7 +2539,7 @@ static int acpi_nfit_insert_resource(struct acpi_nfit_desc *acpi_desc,
if (is_pmem == REGION_INTERSECTS)
return 0;
res = devm_kzalloc(acpi_desc->dev, sizeof(*res), GFP_KERNEL);
res = devm_kzalloc_obj(acpi_desc->dev, *res);
if (!res)
return -ENOMEM;
@@ -3391,7 +3389,7 @@ static int acpi_nfit_probe(struct platform_device *pdev)
return rc;
sz = tbl->length;
acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL);
acpi_desc = devm_kzalloc_obj(dev, *acpi_desc);
if (!acpi_desc)
return -ENOMEM;
acpi_nfit_desc_init(acpi_desc, dev);
@@ -3456,7 +3454,7 @@ static void acpi_nfit_update_notify(struct device *dev, acpi_handle handle)
}
if (!acpi_desc) {
acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL);
acpi_desc = devm_kzalloc_obj(dev, *acpi_desc);
if (!acpi_desc)
return;
acpi_nfit_desc_init(acpi_desc, dev);
+1 -1
View File
@@ -373,7 +373,7 @@ static int acpi_pfrt_log_probe(struct platform_device *pdev)
return -ENODEV;
}
pfrt_log_dev = devm_kzalloc(&pdev->dev, sizeof(*pfrt_log_dev), GFP_KERNEL);
pfrt_log_dev = devm_kzalloc_obj(&pdev->dev, *pfrt_log_dev);
if (!pfrt_log_dev)
return -ENOMEM;
+1 -1
View File
@@ -554,7 +554,7 @@ static int acpi_pfru_probe(struct platform_device *pdev)
return -ENODEV;
}
pfru_dev = devm_kzalloc(&pdev->dev, sizeof(*pfru_dev), GFP_KERNEL);
pfru_dev = devm_kzalloc_obj(&pdev->dev, *pfru_dev);
if (!pfru_dev)
return -ENOMEM;
+1 -1
View File
@@ -262,7 +262,7 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
if (!handle)
return -ENODEV;
opregion = devm_kzalloc(dev, sizeof(*opregion), GFP_KERNEL);
opregion = devm_kzalloc_obj(dev, *opregion);
if (!opregion)
return -ENOMEM;
+1 -1
View File
@@ -384,7 +384,7 @@ static int tps68470_pmic_opregion_probe(struct platform_device *pdev)
return -ENODEV;
}
opregion = devm_kzalloc(dev, sizeof(*opregion), GFP_KERNEL);
opregion = devm_kzalloc_obj(dev, *opregion);
if (!opregion)
return -ENOMEM;
+2 -2
View File
@@ -281,7 +281,7 @@ static int acard_ahci_port_start(struct ata_port *ap)
dma_addr_t mem_dma;
size_t dma_sz, rx_fis_sz;
pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
pp = devm_kzalloc_obj(dev, *pp);
if (!pp)
return -ENOMEM;
@@ -378,7 +378,7 @@ static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id
if (rc)
return rc;
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
hpriv = devm_kzalloc_obj(dev, *hpriv);
if (!hpriv)
return -ENOMEM;
+1 -1
View File
@@ -2931,7 +2931,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc)
return rc;
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
hpriv = devm_kzalloc_obj(dev, *hpriv);
if (!hpriv)
return -ENOMEM;
hpriv->flags |= (unsigned long)pi.private_data;
+1 -1
View File
@@ -443,7 +443,7 @@ static int brcm_ahci_probe(struct platform_device *pdev)
struct ahci_host_priv *hpriv;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
priv = devm_kzalloc_obj(dev, *priv);
if (!priv)
return -ENOMEM;
+1 -1
View File
@@ -268,7 +268,7 @@ static int ceva_ahci_probe(struct platform_device *pdev)
enum dev_dma_attr attr;
int rc;
cevapriv = devm_kzalloc(dev, sizeof(*cevapriv), GFP_KERNEL);
cevapriv = devm_kzalloc_obj(dev, *cevapriv);
if (!cevapriv)
return -ENOMEM;
+1 -1
View File
@@ -178,7 +178,7 @@ static int ahci_da850_probe(struct platform_device *pdev)
* getting procedure with the explicitly specified ids.
*/
if (hpriv->n_clks < 2) {
hpriv->clks = devm_kcalloc(dev, 2, sizeof(*hpriv->clks), GFP_KERNEL);
hpriv->clks = devm_kzalloc_objs(dev, *hpriv->clks, 2);
if (!hpriv->clks)
return -ENOMEM;
+1 -1
View File
@@ -111,7 +111,7 @@ static struct ahci_host_priv *ahci_dwc_get_resources(struct platform_device *pde
struct ahci_dwc_host_priv *dpriv;
struct ahci_host_priv *hpriv;
dpriv = devm_kzalloc(&pdev->dev, sizeof(*dpriv), GFP_KERNEL);
dpriv = devm_kzalloc_obj(&pdev->dev, *dpriv);
if (!dpriv)
return ERR_PTR(-ENOMEM);
+1 -1
View File
@@ -863,7 +863,7 @@ static int imx_ahci_probe(struct platform_device *pdev)
unsigned int reg_val;
int ret;
imxpriv = devm_kzalloc(dev, sizeof(*imxpriv), GFP_KERNEL);
imxpriv = devm_kzalloc_obj(dev, *imxpriv);
if (!imxpriv)
return -ENOMEM;
+1 -1
View File
@@ -129,7 +129,7 @@ static int mtk_ahci_probe(struct platform_device *pdev)
struct ahci_host_priv *hpriv;
int err;
plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL);
plat = devm_kzalloc_obj(dev, *plat);
if (!plat)
return -ENOMEM;
+1 -1
View File
@@ -274,7 +274,7 @@ static int ahci_qoriq_probe(struct platform_device *pdev)
if (!(of_id || acpi_id))
return -ENODEV;
qoriq_priv = devm_kzalloc(dev, sizeof(*qoriq_priv), GFP_KERNEL);
qoriq_priv = devm_kzalloc_obj(dev, *qoriq_priv);
if (!qoriq_priv)
return -ENOMEM;
+1 -1
View File
@@ -127,7 +127,7 @@ static const struct ata_port_info *ahci_seattle_get_port_info(
struct seattle_plat_data *plat_data;
u32 val;
plat_data = devm_kzalloc(dev, sizeof(*plat_data), GFP_KERNEL);
plat_data = devm_kzalloc_obj(dev, *plat_data);
if (!plat_data)
return &ahci_port_info;
+1 -1
View File
@@ -153,7 +153,7 @@ static int st_ahci_probe(struct platform_device *pdev)
struct ahci_host_priv *hpriv;
int err;
drv_data = devm_kzalloc(&pdev->dev, sizeof(*drv_data), GFP_KERNEL);
drv_data = devm_kzalloc_obj(&pdev->dev, *drv_data);
if (!drv_data)
return -ENOMEM;
+3 -4
View File
@@ -523,7 +523,7 @@ static int tegra_ahci_probe(struct platform_device *pdev)
if (IS_ERR(hpriv))
return PTR_ERR(hpriv);
tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL);
tegra = devm_kzalloc_obj(&pdev->dev, *tegra);
if (!tegra)
return -ENOMEM;
@@ -578,9 +578,8 @@ static int tegra_ahci_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, PTR_ERR(tegra->pmc),
"failed to get PMC\n");
tegra->supplies = devm_kcalloc(&pdev->dev,
tegra->soc->num_supplies,
sizeof(*tegra->supplies), GFP_KERNEL);
tegra->supplies = devm_kzalloc_objs(&pdev->dev, *tegra->supplies,
tegra->soc->num_supplies);
if (!tegra->supplies)
return -ENOMEM;
+1 -1
View File
@@ -739,7 +739,7 @@ static int xgene_ahci_probe(struct platform_device *pdev)
if (IS_ERR(hpriv))
return PTR_ERR(hpriv);
ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
ctx = devm_kzalloc_obj(dev, *ctx);
if (!ctx)
return -ENOMEM;
+1 -1
View File
@@ -1855,7 +1855,7 @@ static int piix_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc)
return rc;
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
hpriv = devm_kzalloc_obj(dev, *hpriv);
if (!hpriv)
return -ENOMEM;
+1 -1
View File
@@ -2514,7 +2514,7 @@ static int ahci_port_start(struct ata_port *ap)
dma_addr_t mem_dma;
size_t dma_sz, rx_fis_sz;
pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
pp = devm_kzalloc_obj(dev, *pp);
if (!pp)
return -ENOMEM;
+1 -1
View File
@@ -539,7 +539,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
* No clock bulk found: fallback to manually getting
* the optional clock.
*/
hpriv->clks = devm_kzalloc(dev, sizeof(*hpriv->clks), GFP_KERNEL);
hpriv->clks = devm_kzalloc_obj(dev, *hpriv->clks);
if (!hpriv->clks) {
rc = -ENOMEM;
goto err_out;
+1 -1
View File
@@ -197,7 +197,7 @@ static int pacpi_port_start(struct ata_port *ap)
if (ACPI_HANDLE(&ap->tdev) == NULL)
return -ENODEV;
acpi = ap->private_data = devm_kzalloc(&pdev->dev, sizeof(struct pata_acpi), GFP_KERNEL);
acpi = ap->private_data = devm_kzalloc_obj(&pdev->dev, struct pata_acpi);
if (ap->private_data == NULL)
return -ENOMEM;
acpi->mask[0] = pacpi_discover_modes(ap, &ap->link.device[0]);
+1 -1
View File
@@ -804,7 +804,7 @@ static int arasan_cf_probe(struct platform_device *pdev)
irq_handler_t irq_handler = NULL;
int ret;
acdev = devm_kzalloc(&pdev->dev, sizeof(*acdev), GFP_KERNEL);
acdev = devm_kzalloc_obj(&pdev->dev, *acdev);
if (!acdev)
return -ENOMEM;
+1 -1
View File
@@ -340,7 +340,7 @@ static int atp867x_set_priv(struct ata_port *ap)
int port = ap->port_no;
dp = ap->private_data =
devm_kzalloc(&pdev->dev, sizeof(*dp), GFP_KERNEL);
devm_kzalloc_obj(&pdev->dev, *dp);
if (dp == NULL)
return -ENOMEM;
+1 -1
View File
@@ -153,7 +153,7 @@ static int cmd640_port_start(struct ata_port *ap)
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
struct cmd640_reg *timing;
timing = devm_kzalloc(&pdev->dev, sizeof(struct cmd640_reg), GFP_KERNEL);
timing = devm_kzalloc_obj(&pdev->dev, struct cmd640_reg);
if (timing == NULL)
return -ENOMEM;
timing->last = -1; /* Force a load */
+1 -1
View File
@@ -945,7 +945,7 @@ static int ep93xx_pata_probe(struct platform_device *pdev)
if (IS_ERR(ide_base))
return PTR_ERR(ide_base);
drv_data = devm_kzalloc(&pdev->dev, sizeof(*drv_data), GFP_KERNEL);
drv_data = devm_kzalloc_obj(&pdev->dev, *drv_data);
if (!drv_data)
return -ENOMEM;
+1 -1
View File
@@ -460,7 +460,7 @@ static int pata_ftide010_probe(struct platform_device *pdev)
int ret;
int i;
ftide = devm_kzalloc(dev, sizeof(*ftide), GFP_KERNEL);
ftide = devm_kzalloc_obj(dev, *ftide);
if (!ftide)
return -ENOMEM;
ftide->dev = dev;

Some files were not shown because too many files have changed in this diff Show More