EDAC: Use kcalloc()
Borislav Petkov
maintainerPATCH 1/1 EDAC: Use kcalloc()
From: Borislav Petkov <[email protected]>
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
5684 120 4 5808 16b0 edac_device.o.before 5684 120 4 5808 16b0 edac_device.o.after
md5:
811325c80acb5a1d6df7b290df3e1636 edac_device.o.before.asm 811325c80acb5a1d6df7b290df3e1636 edac_device.o.after.asm
No functional changes.
--- drivers/edac/edac_device.c | 9 +++------ drivers/edac/edac_mc.c | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-)
drivers/edac/edac_device.c +3 -6
@@ -70,9 +70,7 @@ edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instanceif (!dev_ctl)return NULL ; - dev_inst =kmalloc_array (nr_instances, -sizeof (struct edac_device_instance ), -GFP_KERNEL | __GFP_ZERO); + dev_inst =kcalloc (nr_instances,sizeof (struct edac_device_instance ),GFP_KERNEL );if (!dev_inst) goto free;
@@ -87,9 +85,8 @@ edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instance dev_ctl->blocks = dev_blk;if (nr_attrib) { - dev_attrib =kmalloc_array (nr_attrib, -sizeof (struct edac_dev_sysfs_block_attribute ), -GFP_KERNEL | __GFP_ZERO); + dev_attrib =kcalloc (nr_attrib,sizeof (struct edac_dev_sysfs_block_attribute ), +GFP_KERNEL );if (!dev_attrib) goto free;
drivers/edac/edac_mc.c +1 -1
@@ -366,7 +366,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num,if (!mci)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) goto error;
Signature · 1 line
2.35.1
Borislav Petkov
maintainerPATCH v2 1/1 EDAC: Use kcalloc()
On Tue, Apr 12, 2022 at 11:19:57PM +0200, Borislav Petkov wrote:
v2 with one forgotten instance converted:
---
From: Borislav Petkov <[email protected]>
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.
--- drivers/edac/edac_device.c | 13 ++++--------- drivers/edac/edac_mc.c | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-)
drivers/edac/edac_device.c +4 -9
@@ -70,26 +70,21 @@ edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instanceif (!dev_ctl)return NULL ; - dev_inst =kmalloc_array (nr_instances, -sizeof (struct edac_device_instance ), -GFP_KERNEL | __GFP_ZERO); + dev_inst =kcalloc (nr_instances,sizeof (struct edac_device_instance ),GFP_KERNEL );if (!dev_inst) goto free; dev_ctl->instances = dev_inst; - dev_blk =kmalloc_array (nr_instances * nr_blocks, -sizeof (struct edac_device_block ), -GFP_KERNEL | __GFP_ZERO); + dev_blk =kcalloc (nr_instances * nr_blocks,sizeof (struct edac_device_block ),GFP_KERNEL );if (!dev_blk) goto free; dev_ctl->blocks = dev_blk;if (nr_attrib) { - dev_attrib =kmalloc_array (nr_attrib, -sizeof (struct edac_dev_sysfs_block_attribute ), -GFP_KERNEL | __GFP_ZERO); + dev_attrib =kcalloc (nr_attrib,sizeof (struct edac_dev_sysfs_block_attribute ), +GFP_KERNEL );if (!dev_attrib) goto free;
drivers/edac/edac_mc.c +1 -1
@@ -366,7 +366,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num,if (!mci)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) goto error;
Signature · 8 lines
2.35.1
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette