Skip to content

Commit

Permalink
[POWERPC] cell: catch errors from sysfs_create_group()
Browse files Browse the repository at this point in the history
We're currently getting a warning from not checking the result of
sysfs_create_group, which is declared as __must_check.

This change introduces appropriate error-handling for
spu_add_sysdev_attr_group()

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Jeremy Kerr authored and Arnd Bergmann committed Dec 19, 2007
1 parent 684bd61 commit 1e77103
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions arch/powerpc/platforms/cell/spu_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,13 +574,27 @@ EXPORT_SYMBOL_GPL(spu_add_sysdev_attr);
int spu_add_sysdev_attr_group(struct attribute_group *attrs)
{
struct spu *spu;
int rc = 0;

mutex_lock(&spu_full_list_mutex);
list_for_each_entry(spu, &spu_full_list, full_list)
sysfs_create_group(&spu->sysdev.kobj, attrs);
list_for_each_entry(spu, &spu_full_list, full_list) {
rc = sysfs_create_group(&spu->sysdev.kobj, attrs);

/* we're in trouble here, but try unwinding anyway */
if (rc) {
printk(KERN_ERR "%s: can't create sysfs group '%s'\n",
__func__, attrs->name);

list_for_each_entry_continue_reverse(spu,
&spu_full_list, full_list)
sysfs_remove_group(&spu->sysdev.kobj, attrs);
break;
}
}

mutex_unlock(&spu_full_list_mutex);

return 0;
return rc;
}
EXPORT_SYMBOL_GPL(spu_add_sysdev_attr_group);

Expand Down

0 comments on commit 1e77103

Please sign in to comment.