From: Jean Delvare Date: Tue, 15 Dec 2009 02:00:28 +0000 (-0800) Subject: ioc3/ioc4: fix error path on driver registration X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9385565e20c4acf97cd8e2fd7155750e578edcc4;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git ioc3/ioc4: fix error path on driver registration Two IOC3 and IOC4 drivers have broken error paths on registration. Fix them. Signed-off-by: Jean Delvare Cc: Pat Gefre Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c index 902b067d7e9c..836d9ab4f729 100644 --- a/drivers/serial/ioc4_serial.c +++ b/drivers/serial/ioc4_serial.c @@ -2913,17 +2913,27 @@ static int __init ioc4_serial_init(void) printk(KERN_WARNING "%s: Couldn't register rs232 IOC4 serial driver\n", __func__); - return ret; + goto out; } if ((ret = uart_register_driver(&ioc4_uart_rs422)) < 0) { printk(KERN_WARNING "%s: Couldn't register rs422 IOC4 serial driver\n", __func__); - return ret; + goto out_uart_rs232; } /* register with IOC4 main module */ - return ioc4_register_submodule(&ioc4_serial_submodule); + ret = ioc4_register_submodule(&ioc4_serial_submodule); + if (ret) + goto out_uart_rs422; + return 0; + +out_uart_rs422: + uart_unregister_driver(&ioc4_uart_rs422); +out_uart_rs232: + uart_unregister_driver(&ioc4_uart_rs232); +out: + return ret; } static void __exit ioc4_serial_exit(void) diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c index 354e9f17e35a..66802a4390cc 100644 --- a/drivers/sn/ioc3.c +++ b/drivers/sn/ioc3.c @@ -820,7 +820,7 @@ static int __init ioc3_init(void) { if (ia64_platform_is("sn2")) return pci_register_driver(&ioc3_driver); - return 0; + return -ENODEV; } /* Module unload */