提交 7731e6bb 编写于 作者: F Fengguang Wu 提交者: James Bottomley

[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: NFengguang Wu <fengguang.wu@intel.com>
Acked-by: NAdam Radford <aradford@gmail.com>
Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
上级 9728686f
......@@ -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),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册