diff options
author | Fengguang Wu <fengguang.wu@intel.com> | 2012-08-24 11:27:35 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-09-24 04: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 788115b72b2..ddf094e7d0a 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) | |||
462 | * Allocate the dynamic array first and then allocate individual | 462 | * Allocate the dynamic array first and then allocate individual |
463 | * commands. | 463 | * commands. |
464 | */ | 464 | */ |
465 | fusion->cmd_list = kmalloc(sizeof(struct megasas_cmd_fusion *) | 465 | fusion->cmd_list = kzalloc(sizeof(struct megasas_cmd_fusion *) |
466 | *max_cmd, GFP_KERNEL); | 466 | * max_cmd, GFP_KERNEL); |
467 | 467 | ||
468 | if (!fusion->cmd_list) { | 468 | if (!fusion->cmd_list) { |
469 | printk(KERN_DEBUG "megasas: out of memory. Could not alloc " | 469 | printk(KERN_DEBUG "megasas: out of memory. Could not alloc " |
@@ -471,9 +471,6 @@ megasas_alloc_cmds_fusion(struct megasas_instance *instance) | |||
471 | goto fail_cmd_list; | 471 | goto fail_cmd_list; |
472 | } | 472 | } |
473 | 473 | ||
474 | memset(fusion->cmd_list, 0, sizeof(struct megasas_cmd_fusion *) | ||
475 | *max_cmd); | ||
476 | |||
477 | max_cmd = instance->max_fw_cmds; | 474 | max_cmd = instance->max_fw_cmds; |
478 | for (i = 0; i < max_cmd; i++) { | 475 | for (i = 0; i < max_cmd; i++) { |
479 | fusion->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd_fusion), | 476 | fusion->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd_fusion), |