From: Julia Lawall Date: Tue, 6 Apr 2010 21:34:46 +0000 (-0700) Subject: drivers/char/amiserial.c: add missing local_irq_restore X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c70c036f04b7b74282477d6a51bbcc8bb8897e03;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git 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/) // @r exists@ expression E1; identifier f; @@ f (...) { <+... * local_irq_save (E1,...); ... when != E1 * return ...; ...+> } // [akpm@linux-foundation.org: reimplement the fix] Signed-off-by: Julia Lawall Cc: Thadeu Lima de Souza Cascardo Cc: Greg KH Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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) state->baud_base = amiga_colorclock; state->xmit_fifo_size = 1; - local_irq_save(flags); - /* set ISRs, and then disable the rx interrupts */ error = request_irq(IRQ_AMIGA_TBE, ser_tx_int, 0, "serial TX", state); if (error) @@ -2033,6 +2031,8 @@ static int __init rs_init(void) if (error) goto fail_free_irq; + local_irq_save(flags); + /* turn off Rx and Tx interrupts */ custom.intena = IF_RBF | IF_TBE; mb();