Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0ba137e23e8d8f5cb15778b44be281c5687afc49
Commit:     0ba137e23e8d8f5cb15778b44be281c5687afc49
Parent:     dbab81281d3227af3d8a04aa748c5f41befa5d43
Author:     Maciej W. Rozycki <[EMAIL PROTECTED]>
AuthorDate: Thu Feb 7 00:15:08 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Feb 7 08:42:24 2008 -0800

    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 <[EMAIL PROTECTED]>
    Cc: Jiri Slaby <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 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 e1a2e41..fb6f273 100644
--- a/drivers/serial/dz.c
+++ b/drivers/serial/dz.c
@@ -794,18 +794,28 @@ static int __init dz_init(void)
        dz_reset(&dz_ports[0]);
 #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);
        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++)
                uart_add_one_port(&dz_reg, &dz_ports[i].port);
 
        return ret;
+
+out_unregister:
+       uart_unregister_driver(&dz_reg);
+
+out:
+       return ret;
 }
 
 module_init(dz_init);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to