From: Cornelia Huck Date: Wed, 3 Sep 2008 16:26:41 +0000 (+0200) Subject: Driver core: Fix cleanup in device_create_vargs(). X-Git-Tag: v2.6.28-rc1~284^2~18 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=286661b3777897220ecfcd774bccc68a34667f39;p=linux-2.6-omap-h63xx.git Driver core: Fix cleanup in device_create_vargs(). 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 Cc: stable Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/base/core.c b/drivers/base/core.c index aac91e89d6a..9649d1c422a 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);