diff options
author | Julia Lawall <julia@diku.dk> | 2010-04-06 17:34:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-04-07 11:38:02 -0400 |
commit | c70c036f04b7b74282477d6a51bbcc8bb8897e03 (patch) | |
tree | 9a5a42056298ef700f06c1608c7670982bb0aa87 /drivers/char | |
parent | a8557dc71949e80c298ec298b902ac6ebbc5d9dd (diff) |
drivers/char/amiserial.c: add missing local_irq_restore
rs_init() is failing to restore interrupts on two error paths, and is
incorrectly calling tty_unregister_driver() with local interrupts
disabled.
Fix these things by disabling interrupts later, after the reauest_irq()
calls.
A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r exists@
expression E1;
identifier f;
@@
f (...) { <+...
* local_irq_save (E1,...);
... when != E1
* return ...;
...+> }
// </smpl>
[akpm@linux-foundation.org: reimplement the fix]
Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/amiserial.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index 6c32fbf0716..56b27671adc 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c | |||
@@ -2021,8 +2021,6 @@ static int __init rs_init(void) | |||
2021 | state->baud_base = amiga_colorclock; | 2021 | state->baud_base = amiga_colorclock; |
2022 | state->xmit_fifo_size = 1; | 2022 | state->xmit_fifo_size = 1; |
2023 | 2023 | ||
2024 | local_irq_save(flags); | ||
2025 | |||
2026 | /* set ISRs, and then disable the rx interrupts */ | 2024 | /* set ISRs, and then disable the rx interrupts */ |
2027 | error = request_irq(IRQ_AMIGA_TBE, ser_tx_int, 0, "serial TX", state); | 2025 | error = request_irq(IRQ_AMIGA_TBE, ser_tx_int, 0, "serial TX", state); |
2028 | if (error) | 2026 | if (error) |
@@ -2033,6 +2031,8 @@ static int __init rs_init(void) | |||
2033 | if (error) | 2031 | if (error) |
2034 | goto fail_free_irq; | 2032 | goto fail_free_irq; |
2035 | 2033 | ||
2034 | local_irq_save(flags); | ||
2035 | |||
2036 | /* turn off Rx and Tx interrupts */ | 2036 | /* turn off Rx and Tx interrupts */ |
2037 | custom.intena = IF_RBF | IF_TBE; | 2037 | custom.intena = IF_RBF | IF_TBE; |
2038 | mb(); | 2038 | mb(); |