Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);