Skip to content

Commit

Permalink
kobject: clean up the kobject add documentation a bit more
Browse files Browse the repository at this point in the history
Commit 1fd7c3b ("kobject: Improve doc clarity kobject_init_and_add()")
tried to provide more clarity, but the reference to kobject_del() was
incorrect.  Fix that up by removing that line, and hopefully be more explicit
as to exactly what needs to happen here once you register a kobject with the
kobject core.

Acked-by: Tobin C. Harding <[email protected]>
Fixes: 1fd7c3b ("kobject: Improve doc clarity kobject_init_and_add()")
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
gregkh committed May 3, 2019
1 parent ed85634 commit 70e16a6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/kobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,12 @@ static __printf(3, 0) int kobject_add_varg(struct kobject *kobj,
* to this function be directly freed with a call to kfree(),
* that can leak memory.
*
* If this call returns successfully and you later need to unwind
* kobject_add() for the error path you should call kobject_del().
* If this function returns success, kobject_put() must also be called
* in order to properly clean up the memory associated with the object.
*
* In short, once this function is called, kobject_put() MUST be called
* when the use of the object is finished in order to properly free
* everything.
*/
int kobject_add(struct kobject *kobj, struct kobject *parent,
const char *fmt, ...)
Expand Down

0 comments on commit 70e16a6

Please sign in to comment.