lkml.org 
[lkml]   [2008]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 28/46] Driver core: Fix cleanup in device_create_vargs().
Date
From: Cornelia Huck <cornelia.huck@de.ibm.com>

If device_register() in device_create_vargs() fails, the device
must be cleaned up with put_device() (which is also fine on NULL)
instead of kfree().

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index aac91e8..9649d1c 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1256,7 +1256,7 @@ struct device *device_create_vargs(struct class *class, struct device *parent,
return dev;

error:
- kfree(dev);
+ put_device(dev);
return ERR_PTR(retval);
}
EXPORT_SYMBOL_GPL(device_create_vargs);
--
1.6.0.2


\
 
 \ /
  Last update: 2008-10-16 19:27    [W:0.131 / U:2.204 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site