Commit 10188012daa586ae7fcbef272e4db4f404741adf

Authored by Randy Dunlap
Committed by Greg Kroah-Hartman
1 parent 2589f1887b

kobject: must_check fixes

Check all __must_check warnings in lib/kobject.c

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Showing 1 changed file with 8 additions and 1 deletions Side-by-side Diff

... ... @@ -407,6 +407,7 @@
407 407 struct kobject *kobject_add_dir(struct kobject *parent, const char *name)
408 408 {
409 409 struct kobject *k;
  410 + int ret;
410 411  
411 412 if (!parent)
412 413 return NULL;
... ... @@ -418,7 +419,13 @@
418 419 k->parent = parent;
419 420 k->ktype = &dir_ktype;
420 421 kobject_set_name(k, name);
421   - kobject_register(k);
  422 + ret = kobject_register(k);
  423 + if (ret < 0) {
  424 + printk(KERN_WARNING "kobject_add_dir: "
  425 + "kobject_register error: %d\n", ret);
  426 + kobject_del(k);
  427 + return NULL;
  428 + }
422 429  
423 430 return k;
424 431 }