Skip to content

Commit

Permalink
kobject: must_check fixes
Browse files Browse the repository at this point in the history
Check all __must_check warnings in lib/kobject.c

Signed-off-by: Randy Dunlap <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
rddunlap authored and gregkh committed Sep 26, 2006
1 parent 2589f18 commit 1018801
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/kobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ static struct kobj_type dir_ktype = {
struct kobject *kobject_add_dir(struct kobject *parent, const char *name)
{
struct kobject *k;
int ret;

if (!parent)
return NULL;
Expand All @@ -418,7 +419,13 @@ struct kobject *kobject_add_dir(struct kobject *parent, const char *name)
k->parent = parent;
k->ktype = &dir_ktype;
kobject_set_name(k, name);
kobject_register(k);
ret = kobject_register(k);
if (ret < 0) {
printk(KERN_WARNING "kobject_add_dir: "
"kobject_register error: %d\n", ret);
kobject_del(k);
return NULL;
}

return k;
}
Expand Down

0 comments on commit 1018801

Please sign in to comment.