2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-26 22:24:09 +08:00

[PATCH] drivers/char/esp.c spinlock fix

There's incorrect spinlock usage in espserial_init(): autoconfig() uses
info->lock before it's initialized.  The fix is to initialize the spinlock
earlier.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Ingo Molnar 2006-01-16 22:14:00 -08:00 committed by Linus Torvalds
parent fd279197b1
commit 8f56a31ad6

View File

@ -2492,6 +2492,7 @@ static int __init espserial_init(void)
} }
memset((void *)info, 0, sizeof(struct esp_struct)); memset((void *)info, 0, sizeof(struct esp_struct));
spin_lock_init(&info->lock);
/* rx_trigger, tx_trigger are needed by autoconfig */ /* rx_trigger, tx_trigger are needed by autoconfig */
info->config.rx_trigger = rx_trigger; info->config.rx_trigger = rx_trigger;
info->config.tx_trigger = tx_trigger; info->config.tx_trigger = tx_trigger;
@ -2528,7 +2529,6 @@ static int __init espserial_init(void)
init_waitqueue_head(&info->close_wait); init_waitqueue_head(&info->close_wait);
init_waitqueue_head(&info->delta_msr_wait); init_waitqueue_head(&info->delta_msr_wait);
init_waitqueue_head(&info->break_wait); init_waitqueue_head(&info->break_wait);
spin_lock_init(&info->lock);
ports = info; ports = info;
printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ", printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ",
info->line, info->port, info->irq); info->line, info->port, info->irq);