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>
This commit is contained in:
parent
5739411acb
commit
286661b377
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue