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

Commit 1fd7c3b4 authored by Tobin C. Harding's avatar Tobin C. Harding Committed by Greg Kroah-Hartman
Browse files

kobject: Improve doc clarity kobject_init_and_add()



Function kobject_init_and_add() is currently misused in a number of
places in the kernel.  On error return kobject_put() must be called but
is at times not.

Make the function documentation more explicit about calling
kobject_put() in the error path.

Signed-off-by: default avatarTobin C. Harding <tobin@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 92067f84
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -450,9 +450,12 @@ EXPORT_SYMBOL(kobject_add);
 * @parent: pointer to the parent of this kobject.
 * @parent: pointer to the parent of this kobject.
 * @fmt: the name of the kobject.
 * @fmt: the name of the kobject.
 *
 *
 * This function combines the call to kobject_init() and
 * This function combines the call to kobject_init() and kobject_add().
 * kobject_add().  The same type of error handling after a call to
 *
 * kobject_add() and kobject lifetime rules are the same here.
 * If this function returns an error, kobject_put() must be called to
 * properly clean up the memory associated with the object.  This is the
 * same type of error handling after a call to kobject_add() and kobject
 * lifetime rules are the same here.
 */
 */
int kobject_init_and_add(struct kobject *kobj, struct kobj_type *ktype,
int kobject_init_and_add(struct kobject *kobj, struct kobj_type *ktype,
			 struct kobject *parent, const char *fmt, ...)
			 struct kobject *parent, const char *fmt, ...)