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>
This commit is contained in:
Kulikov Vasiliy 2010-07-12 04:52:33 +00:00 committed by David S. Miller
parent 9e34a5b516
commit 84c3b972f3

View file

@ -2065,13 +2065,30 @@ static int __init depca_module_init (void)
#ifdef CONFIG_MCA
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;
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;
}