mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: takis@issaris.org
To: linux-kernel@vger.kernel.org
Cc: axboe@suse.de
Subject: [PATCH] block: Conversions from kmalloc+memset to k(z|c)alloc
Date: Fri, 21 Jul 2006 13:32:10 +0200	[thread overview]
Message-ID: <20060721113210.GB11822@issaris.org> (raw)

From: Panagiotis Issaris <takis@issaris.org>

block: Conversions from kmalloc+memset to kzalloc

Signed-off-by: Panagiotis Issaris <takis@issaris.org>
---
 block/cfq-iosched.c |    4 +---
 block/elevator.c    |    3 +--
 block/scsi_ioctl.c  |    4 +---
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 102ebc2..d3d095f 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2231,12 +2231,10 @@ static void *cfq_init_queue(request_queu
 	struct cfq_data *cfqd;
 	int i;
 
-	cfqd = kmalloc(sizeof(*cfqd), GFP_KERNEL);
+	cfqd = kzalloc(sizeof(*cfqd), GFP_KERNEL);
 	if (!cfqd)
 		return NULL;
 
-	memset(cfqd, 0, sizeof(*cfqd));
-
 	for (i = 0; i < CFQ_PRIO_LISTS; i++)
 		INIT_LIST_HEAD(&cfqd->rr_list[i]);
 
diff --git a/block/elevator.c b/block/elevator.c
index bc7baee..e51febf 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -153,9 +153,8 @@ static struct kobj_type elv_ktype;
 
 static elevator_t *elevator_alloc(struct elevator_type *e)
 {
-	elevator_t *eq = kmalloc(sizeof(elevator_t), GFP_KERNEL);
+	elevator_t *eq = kzalloc(sizeof(elevator_t), GFP_KERNEL);
 	if (eq) {
-		memset(eq, 0, sizeof(*eq));
 		eq->ops = &e->ops;
 		eq->elevator_type = e;
 		kobject_init(&eq->kobj);
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index b33eda2..f6a8bea 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -409,11 +409,9 @@ int sg_scsi_ioctl(struct file *file, str
 
 	bytes = max(in_len, out_len);
 	if (bytes) {
-		buffer = kmalloc(bytes, q->bounce_gfp | GFP_USER| __GFP_NOWARN);
+		buffer = kzalloc(bytes, q->bounce_gfp | GFP_USER| __GFP_NOWARN);
 		if (!buffer)
 			return -ENOMEM;
-
-		memset(buffer, 0, bytes);
 	}
 
 	rq = blk_get_request(q, in_len ? WRITE : READ, __GFP_WAIT);
-- 
1.4.2.rc1.ge7a0-dirty


             reply	other threads:[~2006-07-21 11:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-21 11:32 takis [this message]
2006-07-21 12:13 ` Jens Axboe
2006-07-21 12:32   ` Panagiotis Issaris
2006-07-21 12:38     ` Jens Axboe
2006-07-21 12:58       ` Panagiotis Issaris

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=20060721113210.GB11822@issaris.org \
    --to=takis@issaris.org \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®