Commit 0ba137e2 authored by Maciej W. Rozycki's avatar Maciej W. Rozycki Committed by Linus Torvalds

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: default avatarMaciej W. Rozycki <macro@linux-mips.org>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent dbab8128
...@@ -794,18 +794,28 @@ static int __init dz_init(void) ...@@ -794,18 +794,28 @@ static int __init dz_init(void)
dz_reset(&dz_ports[0]); dz_reset(&dz_ports[0]);
#endif #endif
if (request_irq(dz_ports[0].port.irq, dz_interrupt,
IRQF_DISABLED, "DZ", &dz_ports[0]))
panic("Unable to register DZ interrupt");
ret = uart_register_driver(&dz_reg); ret = uart_register_driver(&dz_reg);
if (ret != 0) if (ret != 0)
return ret; goto out;
ret = request_irq(dz_ports[0].port.irq, dz_interrupt, IRQF_DISABLED,
"DZ", &dz_ports[0]);
if (ret != 0) {
printk(KERN_ERR "dz: Cannot get IRQ %d!\n",
dz_ports[0].port.irq);
goto out_unregister;
}
for (i = 0; i < DZ_NB_PORT; i++) for (i = 0; i < DZ_NB_PORT; i++)
uart_add_one_port(&dz_reg, &dz_ports[i].port); uart_add_one_port(&dz_reg, &dz_ports[i].port);
return ret; return ret;
out_unregister:
uart_unregister_driver(&dz_reg);
out:
return ret;
} }
module_init(dz_init); module_init(dz_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment