diff options
author | Fenghua Yu <fenghua.yu@intel.com> | 2009-08-11 17:52:11 -0400 |
---|---|---|
committer | Fenghua Yu <fenghua.yu@intel.com> | 2009-08-11 17:52:11 -0400 |
commit | 5359dffd4396f281c5b77de1acbee6fb1b333b23 (patch) | |
tree | 2f54bb01bc9c721636788a9ff5d4f47ee7c8fc9e /arch | |
parent | bf2a4c7270b9a22243a91ab5efcc47aaf997c66b (diff) |
ia64/topology.c: exit cache_add_dev when kobject_init_and_add fails
Make cache_add_dev exit sysfs when kobject_init_and_add returns an error.
Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ia64/kernel/topology.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c index bc80dff1df7a..8f060352e129 100644 --- a/arch/ia64/kernel/topology.c +++ b/arch/ia64/kernel/topology.c | |||
@@ -372,6 +372,10 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) | |||
372 | retval = kobject_init_and_add(&all_cpu_cache_info[cpu].kobj, | 372 | retval = kobject_init_and_add(&all_cpu_cache_info[cpu].kobj, |
373 | &cache_ktype_percpu_entry, &sys_dev->kobj, | 373 | &cache_ktype_percpu_entry, &sys_dev->kobj, |
374 | "%s", "cache"); | 374 | "%s", "cache"); |
375 | if (unlikely(retval < 0)) { | ||
376 | cpu_cache_sysfs_exit(cpu); | ||
377 | return retval; | ||
378 | } | ||
375 | 379 | ||
376 | for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++) { | 380 | for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++) { |
377 | this_object = LEAF_KOBJECT_PTR(cpu,i); | 381 | this_object = LEAF_KOBJECT_PTR(cpu,i); |
@@ -385,7 +389,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) | |||
385 | } | 389 | } |
386 | kobject_put(&all_cpu_cache_info[cpu].kobj); | 390 | kobject_put(&all_cpu_cache_info[cpu].kobj); |
387 | cpu_cache_sysfs_exit(cpu); | 391 | cpu_cache_sysfs_exit(cpu); |
388 | break; | 392 | return retval; |
389 | } | 393 | } |
390 | kobject_uevent(&(this_object->kobj), KOBJ_ADD); | 394 | kobject_uevent(&(this_object->kobj), KOBJ_ADD); |
391 | } | 395 | } |