switch (what) {
case sa_rootdomain:
- free_rootdomain(&d->rd->rcu); /* fall through */
+ if (!atomic_read(&d->rd->refcount))
+ free_rootdomain(&d->rd->rcu); /* fall through */
case sa_sd:
free_percpu(d->sd); /* fall through */
case sa_sd_storage:
enum s_alloc alloc_state = sa_none;
struct sched_domain *sd;
struct s_data d;
- int i;
+ int i, ret = -ENOMEM;
alloc_state = __visit_domain_allocation_hell(&d, cpu_map);
if (alloc_state != sa_rootdomain)
}
rcu_read_unlock();
- __free_domain_allocs(&d, sa_sd, cpu_map);
- return 0;
-
+ ret = 0;
error:
__free_domain_allocs(&d, alloc_state, cpu_map);
- return -ENOMEM;
+ return ret;
}
static cpumask_var_t *doms_cur; /* current sched domains */