summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-02 06:22:24 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-03 02:26:51 -0400
commit70e16a620e075cb916644e06012766639b58b2fb (patch)
treea2a0b7b2a61d990148b832b653f5f4801efefddb
parented856349dc0886a97e91fd4ce6ba5ff5312fc0f1 (diff)
kobject: clean up the kobject add documentation a bit more
Commit 1fd7c3b438a2 ("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 <tobin@kernel.org> Fixes: 1fd7c3b438a2 ("kobject: Improve doc clarity kobject_init_and_add()") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--lib/kobject.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index 3f4b7e95b0c2..f2ccdbac8ed9 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -416,8 +416,12 @@ static __printf(3, 0) int kobject_add_varg(struct kobject *kobj,
416 * to this function be directly freed with a call to kfree(), 416 * to this function be directly freed with a call to kfree(),
417 * that can leak memory. 417 * that can leak memory.
418 * 418 *
419 * If this call returns successfully and you later need to unwind 419 * If this function returns success, kobject_put() must also be called
420 * kobject_add() for the error path you should call kobject_del(). 420 * in order to properly clean up the memory associated with the object.
421 *
422 * In short, once this function is called, kobject_put() MUST be called
423 * when the use of the object is finished in order to properly free
424 * everything.
421 */ 425 */
422int kobject_add(struct kobject *kobj, struct kobject *parent, 426int kobject_add(struct kobject *kobj, struct kobject *parent,
423 const char *fmt, ...) 427 const char *fmt, ...)