powerpc/mpic: Break cpumask abstraction earlier
authorMilton Miller <miltonm@bga.com>
Tue, 10 May 2011 19:29:02 +0000 (19:29 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 19 May 2011 04:30:45 +0000 (14:30 +1000)
mpic_set_affinity is allocating and freeing a cpumask var even though
it was breaking the cpumask abstraction when passing the mask to
mpic_physmask.  It also didn't have any check for allocatin failure.

Break the cpumask abstraction earlier and use simple bitwise and of the
bits from the mask with the bits of cpu_online_mask.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/sysdev/mpic.c

index a93da805435ff2dbf41fee1c545da329b75490bb..116695b7a5cb6983f747e500fcdbfde7dd7ea2b7 100644 (file)
@@ -821,16 +821,12 @@ int mpic_set_affinity(struct irq_data *d, const struct cpumask *cpumask,
 
                mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid);
        } else {
-               cpumask_var_t tmp;
+               u32 mask = cpumask_bits(cpumask)[0];
 
-               alloc_cpumask_var(&tmp, GFP_KERNEL);
-
-               cpumask_and(tmp, cpumask, cpu_online_mask);
+               mask &= cpumask_bits(cpu_online_mask)[0];
 
                mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION),
-                              mpic_physmask(cpumask_bits(tmp)[0]));
-
-               free_cpumask_var(tmp);
+                              mpic_physmask(mask));
        }
 
        return 0;