diff options
author | Milton Miller <miltonm@bga.com> | 2011-05-10 15:29:02 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-05-19 00:30:45 -0400 |
commit | 2a116f3dd07cbb55b440d3841fc24a0b3fd99ccd (patch) | |
tree | 7a3ffe0e98aed791f4622dfebb21e197bceb9fef /arch/powerpc/sysdev | |
parent | ebc04215108c124cb4f519d687a8e27a0d16a4aa (diff) |
powerpc/mpic: Break cpumask abstraction earlier
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>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/mpic.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index a93da805435f..116695b7a5cb 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c | |||
@@ -821,16 +821,12 @@ int mpic_set_affinity(struct irq_data *d, const struct cpumask *cpumask, | |||
821 | 821 | ||
822 | mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid); | 822 | mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid); |
823 | } else { | 823 | } else { |
824 | cpumask_var_t tmp; | 824 | u32 mask = cpumask_bits(cpumask)[0]; |
825 | 825 | ||
826 | alloc_cpumask_var(&tmp, GFP_KERNEL); | 826 | mask &= cpumask_bits(cpu_online_mask)[0]; |
827 | |||
828 | cpumask_and(tmp, cpumask, cpu_online_mask); | ||
829 | 827 | ||
830 | mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), | 828 | mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), |
831 | mpic_physmask(cpumask_bits(tmp)[0])); | 829 | mpic_physmask(mask)); |
832 | |||
833 | free_cpumask_var(tmp); | ||
834 | } | 830 | } |
835 | 831 | ||
836 | return 0; | 832 | return 0; |