diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2008-02-07 03:15:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 11:42:24 -0500 |
commit | 0ba137e23e8d8f5cb15778b44be281c5687afc49 (patch) | |
tree | 0ee61cee68b30e114b121967ac523e288417a56d /drivers | |
parent | dbab81281d3227af3d8a04aa748c5f41befa5d43 (diff) |
dz: don't panic() when request_irq() fails
Well, panic() is a little bit undue if request_irq() fails; there is probably
no need to justify it any further. Handle the case gracefully, by
unregistering the driver.
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/serial/dz.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c index e1a2e413eb7d..fb6f27302935 100644 --- a/drivers/serial/dz.c +++ b/drivers/serial/dz.c | |||
@@ -794,18 +794,28 @@ static int __init dz_init(void) | |||
794 | dz_reset(&dz_ports[0]); | 794 | dz_reset(&dz_ports[0]); |
795 | #endif | 795 | #endif |
796 | 796 | ||
797 | if (request_irq(dz_ports[0].port.irq, dz_interrupt, | ||
798 | IRQF_DISABLED, "DZ", &dz_ports[0])) | ||
799 | panic("Unable to register DZ interrupt"); | ||
800 | |||
801 | ret = uart_register_driver(&dz_reg); | 797 | ret = uart_register_driver(&dz_reg); |
802 | if (ret != 0) | 798 | if (ret != 0) |
803 | return ret; | 799 | goto out; |
800 | |||
801 | ret = request_irq(dz_ports[0].port.irq, dz_interrupt, IRQF_DISABLED, | ||
802 | "DZ", &dz_ports[0]); | ||
803 | if (ret != 0) { | ||
804 | printk(KERN_ERR "dz: Cannot get IRQ %d!\n", | ||
805 | dz_ports[0].port.irq); | ||
806 | goto out_unregister; | ||
807 | } | ||
804 | 808 | ||
805 | for (i = 0; i < DZ_NB_PORT; i++) | 809 | for (i = 0; i < DZ_NB_PORT; i++) |
806 | uart_add_one_port(&dz_reg, &dz_ports[i].port); | 810 | uart_add_one_port(&dz_reg, &dz_ports[i].port); |
807 | 811 | ||
808 | return ret; | 812 | return ret; |
813 | |||
814 | out_unregister: | ||
815 | uart_unregister_driver(&dz_reg); | ||
816 | |||
817 | out: | ||
818 | return ret; | ||
809 | } | 819 | } |
810 | 820 | ||
811 | module_init(dz_init); | 821 | module_init(dz_init); |