aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/depca.c
diff options
context:
space:
mode:
authorKulikov Vasiliy <segooon@gmail.com>2010-07-12 00:52:33 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-12 23:21:40 -0400
commit84c3b972f37a735dafc25c4c0d5fb98f99e1157a (patch)
tree0d0cee22f554ec4d402d67e5560ac1dcfaf284b4 /drivers/net/depca.c
parent9e34a5b51684bc90ac827ec4ba339f3892632eac (diff)
depca: fix leaks in depca_module_init()
Since some of xxx_register_driver() can return error we must unregister already registered drivers. Signed-off-by: Kulikov Vasiliy <segooon@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/depca.c')
-rw-r--r--drivers/net/depca.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/drivers/net/depca.c b/drivers/net/depca.c
index bf66e9b3b19e..44c0694c1f4e 100644
--- a/drivers/net/depca.c
+++ b/drivers/net/depca.c
@@ -2061,18 +2061,35 @@ static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2061 2061
2062static int __init depca_module_init (void) 2062static int __init depca_module_init (void)
2063{ 2063{
2064 int err = 0; 2064 int err = 0;
2065 2065
2066#ifdef CONFIG_MCA 2066#ifdef CONFIG_MCA
2067 err = mca_register_driver (&depca_mca_driver); 2067 err = mca_register_driver(&depca_mca_driver);
2068 if (err)
2069 goto err;
2068#endif 2070#endif
2069#ifdef CONFIG_EISA 2071#ifdef CONFIG_EISA
2070 err |= eisa_driver_register (&depca_eisa_driver); 2072 err = eisa_driver_register(&depca_eisa_driver);
2073 if (err)
2074 goto err_mca;
2071#endif 2075#endif
2072 err |= platform_driver_register (&depca_isa_driver); 2076 err = platform_driver_register(&depca_isa_driver);
2073 depca_platform_probe (); 2077 if (err)
2078 goto err_eisa;
2074 2079
2075 return err; 2080 depca_platform_probe();
2081 return 0;
2082
2083err_eisa:
2084#ifdef CONFIG_EISA
2085 eisa_driver_unregister(&depca_eisa_driver);
2086err_mca:
2087#endif
2088#ifdef CONFIG_MCA
2089 mca_unregister_driver(&depca_mca_driver);
2090err:
2091#endif
2092 return err;
2076} 2093}
2077 2094
2078static void __exit depca_module_exit (void) 2095static void __exit depca_module_exit (void)