From c552cad06920b6dc20bb0b41bbb37b60f194e46a Mon Sep 17 00:00:00 2001 From: Cornelia Huck Date: Thu, 16 Oct 2008 22:05:05 +0000 Subject: Driver core: Fix cleanup in device_create_vargs(). commit 286661b3777897220ecfcd774bccc68a34667f39 upstream 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 Signed-off-by: Greg Kroah-Hartman --- drivers/base/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index d021c98605b3..94aee9d68a03 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1243,7 +1243,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); -- cgit v1.2.3