summaryrefslogtreecommitdiff
path: root/drivers/base/core.c
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2008-09-03 18:26:41 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2008-10-16 09:24:49 -0700
commit286661b3777897220ecfcd774bccc68a34667f39 (patch)
treef8f456ee144eab991f1c7569c1f44cb9a220bccc /drivers/base/core.c
parent5739411acbaa63a6c22c91e340fdcdbcc7d82a51 (diff)
downloadlwn-286661b3777897220ecfcd774bccc68a34667f39.tar.gz
lwn-286661b3777897220ecfcd774bccc68a34667f39.zip
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 <cornelia.huck@de.ibm.com> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r--drivers/base/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index aac91e89d6af..9649d1c422a4 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);