init maxcpus before use
[urcu.git] / urcu-call-rcu-impl.h
index 700d1289192a31a5f2693cf79e4efd99be993220..e0a8fd883ee4a24782b3464a970f20be645b5fdc 100644 (file)
@@ -386,6 +386,7 @@ int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp)
        static int warned = 0;
 
        call_rcu_lock(&call_rcu_mutex);
+       alloc_cpu_call_rcu_data();
        if (cpu < 0 || maxcpus <= cpu) {
                if (!warned) {
                        fprintf(stderr, "[error] liburcu: set CPU # out of range\n");
@@ -395,7 +396,6 @@ int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp)
                errno = EINVAL;
                return -EINVAL;
        }
-       alloc_cpu_call_rcu_data();
        call_rcu_unlock(&call_rcu_mutex);
        if (per_cpu_call_rcu_data == NULL) {
                errno = ENOMEM;
This page took 0.022983 seconds and 4 git commands to generate.