All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] minor dm.c cleanup
@ 2008-04-18 15:40 Frederik Deweerdt
  2008-04-18 15:55 ` Alasdair G Kergon
  0 siblings, 1 reply; 2+ messages in thread
From: Frederik Deweerdt @ 2008-04-18 15:40 UTC (permalink / raw)
  To: agk; +Cc: dm-devel

Hello Alasdair,

The small patch below:
- Removes the unused md argument from both specific_minor() and next_free_minor()
- Folds kmalloc + memset(0) into a single kzalloc call in alloc_dev()

This has been compile tested on x86.

Regards,
Frederik

Signed-off-by: Frederik Deweerdt <frederik.deweerdt@gmail.com>

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 11f4ffe..a4b217e 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -924,7 +924,7 @@ static void free_minor(int minor)
 /*
  * See if the device with a specific minor # is free.
  */
-static int specific_minor(struct mapped_device *md, int minor)
+static int specific_minor(int minor)
 {
 	int r, m;
 
@@ -957,7 +957,7 @@ out:
 	return r;
 }
 
-static int next_free_minor(struct mapped_device *md, int *minor)
+static int next_free_minor(int *minor)
 {
 	int r, m;
 
@@ -993,7 +993,7 @@ static struct block_device_operations dm_blk_dops;
 static struct mapped_device *alloc_dev(int minor)
 {
 	int r;
-	struct mapped_device *md = kmalloc(sizeof(*md), GFP_KERNEL);
+	struct mapped_device *md = kzalloc(sizeof(*md), GFP_KERNEL);
 	void *old_md;
 
 	if (!md) {
@@ -1006,13 +1006,12 @@ static struct mapped_device *alloc_dev(int minor)
 
 	/* get a minor number for the dev */
 	if (minor == DM_ANY_MINOR)
-		r = next_free_minor(md, &minor);
+		r = next_free_minor(&minor);
 	else
-		r = specific_minor(md, minor);
+		r = specific_minor(minor);
 	if (r < 0)
 		goto bad_minor;
 
-	memset(md, 0, sizeof(*md));
 	init_rwsem(&md->io_lock);
 	mutex_init(&md->suspend_lock);
 	spin_lock_init(&md->pushback_lock);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] minor dm.c cleanup
  2008-04-18 15:40 [patch] minor dm.c cleanup Frederik Deweerdt
@ 2008-04-18 15:55 ` Alasdair G Kergon
  0 siblings, 0 replies; 2+ messages in thread
From: Alasdair G Kergon @ 2008-04-18 15:55 UTC (permalink / raw)
  To: Frederik Deweerdt; +Cc: dm-devel

On Fri, Apr 18, 2008 at 05:40:45PM +0200, Frederik Deweerdt wrote:
> - Removes the unused md argument from both specific_minor() and next_free_minor()
> - Folds kmalloc + memset(0) into a single kzalloc call in alloc_dev()
 
Added to the batch for 2.6.26, thanks.

Alasdair
-- 
agk@redhat.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-18 15:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-18 15:40 [patch] minor dm.c cleanup Frederik Deweerdt
2008-04-18 15:55 ` Alasdair G Kergon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.