aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2007-12-04 21:49:31 -0500
committerArnd Bergmann <arnd@arndb.de>2007-12-18 19:00:06 -0500
commit1e7710390f95b7efb3f74fd2f8b5fc28656b458c (patch)
tree5e5ed23235a313164bf45b249d55bb2c496bbce7
parent684bd614015188561197342fd336292e9e2ce196 (diff)
[POWERPC] cell: catch errors from sysfs_create_group()
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>
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index ee37e0e39b6b..f73263ba9841 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -574,13 +574,27 @@ EXPORT_SYMBOL_GPL(spu_add_sysdev_attr);
574int spu_add_sysdev_attr_group(struct attribute_group *attrs) 574int spu_add_sysdev_attr_group(struct attribute_group *attrs)
575{ 575{
576 struct spu *spu; 576 struct spu *spu;
577 int rc = 0;
577 578
578 mutex_lock(&spu_full_list_mutex); 579 mutex_lock(&spu_full_list_mutex);
579 list_for_each_entry(spu, &spu_full_list, full_list) 580 list_for_each_entry(spu, &spu_full_list, full_list) {
580 sysfs_create_group(&spu->sysdev.kobj, attrs); 581 rc = sysfs_create_group(&spu->sysdev.kobj, attrs);
582
583 /* we're in trouble here, but try unwinding anyway */
584 if (rc) {
585 printk(KERN_ERR "%s: can't create sysfs group '%s'\n",
586 __func__, attrs->name);
587
588 list_for_each_entry_continue_reverse(spu,
589 &spu_full_list, full_list)
590 sysfs_remove_group(&spu->sysdev.kobj, attrs);
591 break;
592 }
593 }
594
581 mutex_unlock(&spu_full_list_mutex); 595 mutex_unlock(&spu_full_list_mutex);
582 596
583 return 0; 597 return rc;
584} 598}
585EXPORT_SYMBOL_GPL(spu_add_sysdev_attr_group); 599EXPORT_SYMBOL_GPL(spu_add_sysdev_attr_group);
586 600