Commit 13088b65 authored by Borislav Petkov's avatar Borislav Petkov

EDAC: Use kcalloc()

It is syntactic sugar anyway:

  # drivers/edac/edac_mc.o:

   text    data     bss     dec     hex filename
  13378     324       8   13710    358e edac_mc.o.before
  13378     324       8   13710    358e edac_mc.o.after

md5:
   70a53ee3ac7f867730e35c2be9110748  edac_mc.o.before.asm
   70a53ee3ac7f867730e35c2be9110748  edac_mc.o.after.asm

  # drivers/edac/edac_device.o:

   text    data     bss     dec     hex filename
   5704     120       4    5828    16c4 edac_device.o.before
   5704     120       4    5828    16c4 edac_device.o.after

md5:
   880563c859da6eb9aca85ec431fdbaeb  edac_device.o.before.asm
   880563c859da6eb9aca85ec431fdbaeb  edac_device.o.after.asm

No functional changes.
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220412211957.28899-1-bp@alien8.de
parent 713c4ff8
...@@ -70,26 +70,21 @@ edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instance ...@@ -70,26 +70,21 @@ edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instance
if (!dev_ctl) if (!dev_ctl)
return NULL; return NULL;
dev_inst = kmalloc_array(nr_instances, dev_inst = kcalloc(nr_instances, sizeof(struct edac_device_instance), GFP_KERNEL);
sizeof(struct edac_device_instance),
GFP_KERNEL | __GFP_ZERO);
if (!dev_inst) if (!dev_inst)
goto free; goto free;
dev_ctl->instances = dev_inst; dev_ctl->instances = dev_inst;
dev_blk = kmalloc_array(nr_instances * nr_blocks, dev_blk = kcalloc(nr_instances * nr_blocks, sizeof(struct edac_device_block), GFP_KERNEL);
sizeof(struct edac_device_block),
GFP_KERNEL | __GFP_ZERO);
if (!dev_blk) if (!dev_blk)
goto free; goto free;
dev_ctl->blocks = dev_blk; dev_ctl->blocks = dev_blk;
if (nr_attrib) { if (nr_attrib) {
dev_attrib = kmalloc_array(nr_attrib, dev_attrib = kcalloc(nr_attrib, sizeof(struct edac_dev_sysfs_block_attribute),
sizeof(struct edac_dev_sysfs_block_attribute), GFP_KERNEL);
GFP_KERNEL | __GFP_ZERO);
if (!dev_attrib) if (!dev_attrib)
goto free; goto free;
......
...@@ -366,7 +366,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num, ...@@ -366,7 +366,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num,
if (!mci) if (!mci)
return NULL; return NULL;
mci->layers = kmalloc_array(n_layers, sizeof(struct edac_mc_layer), GFP_KERNEL | __GFP_ZERO); mci->layers = kcalloc(n_layers, sizeof(struct edac_mc_layer), GFP_KERNEL);
if (!mci->layers) if (!mci->layers)
goto error; goto error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment