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>
This commit is contained in:
parent
bf2a4c7270
commit
5359dffd43
@ -372,6 +372,10 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
|
|||||||
retval = kobject_init_and_add(&all_cpu_cache_info[cpu].kobj,
|
retval = kobject_init_and_add(&all_cpu_cache_info[cpu].kobj,
|
||||||
&cache_ktype_percpu_entry, &sys_dev->kobj,
|
&cache_ktype_percpu_entry, &sys_dev->kobj,
|
||||||
"%s", "cache");
|
"%s", "cache");
|
||||||
|
if (unlikely(retval < 0)) {
|
||||||
|
cpu_cache_sysfs_exit(cpu);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++) {
|
for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++) {
|
||||||
this_object = LEAF_KOBJECT_PTR(cpu,i);
|
this_object = LEAF_KOBJECT_PTR(cpu,i);
|
||||||
@ -385,7 +389,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
|
|||||||
}
|
}
|
||||||
kobject_put(&all_cpu_cache_info[cpu].kobj);
|
kobject_put(&all_cpu_cache_info[cpu].kobj);
|
||||||
cpu_cache_sysfs_exit(cpu);
|
cpu_cache_sysfs_exit(cpu);
|
||||||
break;
|
return retval;
|
||||||
}
|
}
|
||||||
kobject_uevent(&(this_object->kobj), KOBJ_ADD);
|
kobject_uevent(&(this_object->kobj), KOBJ_ADD);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user