提交 84c3b972 编写于 作者: K Kulikov Vasiliy 提交者: David S. Miller

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: NKulikov Vasiliy <segooon@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9e34a5b5
......@@ -2061,18 +2061,35 @@ static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
static int __init depca_module_init (void)
{
int err = 0;
int err = 0;
#ifdef CONFIG_MCA
err = mca_register_driver (&depca_mca_driver);
err = mca_register_driver(&depca_mca_driver);
if (err)
goto err;
#endif
#ifdef CONFIG_EISA
err |= eisa_driver_register (&depca_eisa_driver);
err = eisa_driver_register(&depca_eisa_driver);
if (err)
goto err_mca;
#endif
err |= platform_driver_register (&depca_isa_driver);
depca_platform_probe ();
err = platform_driver_register(&depca_isa_driver);
if (err)
goto err_eisa;
return err;
depca_platform_probe();
return 0;
err_eisa:
#ifdef CONFIG_EISA
eisa_driver_unregister(&depca_eisa_driver);
err_mca:
#endif
#ifdef CONFIG_MCA
mca_unregister_driver(&depca_mca_driver);
err:
#endif
return err;
}
static void __exit depca_module_exit (void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册