From: Fengguang Wu <fengguang.wu@intel.com>
To: James Bottomley <James.Bottomley@hansenpartnership.com>
Cc: adam radford <aradford@gmail.com>,
Neela Syam Kolli <megaraidlinux@lsi.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] megaraid_sas: combine kmalloc+memset into kzalloc
Date: Fri, 24 Aug 2012 23:27:35 +0800 [thread overview]
Message-ID: <20120824152735.GA7897@localhost> (raw)
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>
---
drivers/scsi/megaraid/megaraid_sas_fusion.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
--- linux.orig/drivers/scsi/megaraid/megaraid_sas_fusion.c 2012-06-07 05:39:57.418846382 +0800
+++ linux/drivers/scsi/megaraid/megaraid_sas_fusion.c 2012-08-24 23:25:02.261560445 +0800
@@ -461,8 +461,8 @@ megasas_alloc_cmds_fusion(struct megasas
* 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 "
@@ -470,9 +470,6 @@ megasas_alloc_cmds_fusion(struct megasas
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),
next reply other threads:[~2012-08-24 15:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-24 15:27 Fengguang Wu [this message]
2012-08-24 16:30 ` [PATCH] megaraid_sas: combine kmalloc+memset into kzalloc adam radford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120824152735.GA7897@localhost \
--to=fengguang.wu@intel.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=aradford@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=megaraidlinux@lsi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox