Commit 286661b3 authored by Cornelia Huck's avatar Cornelia Huck Committed by Greg Kroah-Hartman

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: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5739411a
...@@ -1256,7 +1256,7 @@ struct device *device_create_vargs(struct class *class, struct device *parent, ...@@ -1256,7 +1256,7 @@ struct device *device_create_vargs(struct class *class, struct device *parent,
return dev; return dev;
error: error:
kfree(dev); put_device(dev);
return ERR_PTR(retval); return ERR_PTR(retval);
} }
EXPORT_SYMBOL_GPL(device_create_vargs); EXPORT_SYMBOL_GPL(device_create_vargs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment