]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
sparseirq: fix desc->lock init
authorIngo Molnar <mingo@elte.hu>
Fri, 26 Dec 2008 18:02:20 +0000 (19:02 +0100)
committerIngo Molnar <mingo@elte.hu>
Sat, 27 Dec 2008 08:29:22 +0000 (09:29 +0100)
Impact: cleanup

init_one_irq_desc() does not initialize the desc->lock properly -
you cannot init a lock by memcpying some other lock on it.

This happens to work right now (because irq_desc_init is never in use),
but it's a dangerous construct nevertheless, so fix it.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/irq/handle.c
kernel/irq/numa_migrate.c

index 06b05a4d30078dc173d10bd6ead90bc52101f8e8..893da67b7781b0dd46cadc59dc33a32b1d516595 100644 (file)
@@ -93,6 +93,8 @@ void __attribute__((weak)) arch_init_chip_data(struct irq_desc *desc, int cpu)
 static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu)
 {
        memcpy(desc, &irq_desc_init, sizeof(struct irq_desc));
+
+       spin_lock_init(&desc->lock);
        desc->irq = irq;
 #ifdef CONFIG_SMP
        desc->cpu = cpu;
index a565ce3a4fb5760e767114af6fe2d86b780ce5d4..ecf765c6a77ac8276b73cc551af07de1c4302f23 100644 (file)
@@ -42,6 +42,7 @@ static void init_copy_one_irq_desc(int irq, struct irq_desc *old_desc,
                 struct irq_desc *desc, int cpu)
 {
        memcpy(desc, old_desc, sizeof(struct irq_desc));
+       spin_lock_init(&desc->lock);
        desc->cpu = cpu;
        lockdep_set_class(&desc->lock, &irq_desc_lock_class);
        init_copy_kstat_irqs(old_desc, desc, cpu, nr_cpu_ids);