[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100711.181300.58435799.davem@davemloft.net>
Date: Sun, 11 Jul 2010 18:13:00 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: segooon@...il.com
Cc: kernel-janitors@...r.kernel.org, jpirko@...hat.com,
joe@...ches.com, shemminger@...tta.com, eric.dumazet@...il.com,
netdev@...r.kernel.org
Subject: Re: [PATCH] depca: fix leaks
From: Kulikov Vasiliy <segooon@...il.com>
Date: Fri, 9 Jul 2010 16:36:25 +0400
> Since some of xxx_register_driver() can return error we must continue
> with already registered drivers. If any of xxx_register_driver()
> succeeded or depca_platform_probe() found any device then
> depca_module_init() returns ok. In depca_module_exit() we must
> unregister only registered drivers.
>
> Signed-off-by: Kulikov Vasiliy <segooon@...il.com>
Driver registry should succeed except in cases that would indicate a
serious driver bug, such as trying to register the same driver twice.
Therefore if any registry fails, we should fail the entire probe.
This is the scheme used in just about any driver I've had any
involvement in, see for example drivers/net/niu.c:
--------------------
#ifdef CONFIG_SPARC64
err = of_register_driver(&niu_of_driver, &of_bus_type);
#endif
if (!err) {
err = pci_register_driver(&niu_pci_driver);
#ifdef CONFIG_SPARC64
if (err)
of_unregister_driver(&niu_of_driver);
#endif
}
return err;
--------------------
Please do something similar here in depca, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists