diff options
author | Fengguang Wu | 2012-08-24 23:27:35 +0800 |
---|---|---|
committer | James Bottomley | 2012-09-24 12:10:58 +0400 |
commit | 7731e6bb312ec8bb7892c465401dbc7119aea785 (patch) | |
tree | 4143ed26e37fe135106926aa6330026ede39cabc /drivers/scsi/megaraid | |
parent | 9728686f17304bd682038664d9a1ad28b7409af8 (diff) |
[SCSI] megaraid_sas: combine kmalloc+memset into kzalloc
Use kzalloc rather than kmalloc followed by memset with 0.
Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/megaraid')
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas_fusion.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 788115b72b22..ddf094e7d0ac 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -462,8 +462,8 @@ megasas_alloc_cmds_fusion(struct megasas_instance *instance) * Allocate the dynamic array first and then allocate individual * commands. */ - fusion->cmd_list = kmalloc(sizeof(struct megasas_cmd_fusion *) - *max_cmd, GFP_KERNEL); + fusion->cmd_list = kzalloc(sizeof(struct megasas_cmd_fusion *) + * max_cmd, GFP_KERNEL); if (!fusion->cmd_list) { printk(KERN_DEBUG "megasas: out of memory. Could not alloc " @@ -471,9 +471,6 @@ megasas_alloc_cmds_fusion(struct megasas_instance *instance) goto fail_cmd_list; } - memset(fusion->cmd_list, 0, sizeof(struct megasas_cmd_fusion *) - *max_cmd); - max_cmd = instance->max_fw_cmds; for (i = 0; i < max_cmd; i++) { fusion->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd_fusion), |