On Tue, Jun 09, 2015 at 10:54:02AM +0000, Gujulan Elango, Hari Prasath (H.)
wrote:
> On Tue, Jun 09, 2015 at 03:32:20PM +0530, Sudip Mukherjee wrote:
> > On Tue, Jun 09, 2015 at 09:27:22AM +0000, Gujulan Elango, Hari Prasath (H.)
> > wrote:
> > > From: Hari Prasath Gujulan Elango <[email protected]>
> > No. this is wrong. The same thing what dgap_stop() does is being done in
> > dgap_remove_one() which is the remove callback. So your patch is trying
> > to destroy and unregister something which does not exist at the time
> > dgap_stop()
> > will be called.
>
> sudip,thanks for your comments.while I agree that my patch does the
> same thing twice,I see that a similar thing is being done in the
> failure path of the dgap_init_module().I am referring to the
> goto err_unregister path where the pci_unregister_driver() and
> dgap_stop() are invoked in succession.Going by your argument,should we
> remove the redundant cleanup done in the dgap_stop() function.
yes, better. But you just can not remove that as dgap_stop() has to be
called if pci_register_driver() fails. maybe something like this:
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 26b0446..cbb971d 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -7133,8 +7133,10 @@ static int dgap_init_module(void)
return rc;
rc = pci_register_driver(&dgap_driver);
- if (rc)
- goto err_stop;
+ if (rc) {
+ dgap_stop();
+ return rc;
+ }
rc = dgap_create_driver_sysfiles(&dgap_driver);
if (rc)
@@ -7146,8 +7148,6 @@ static int dgap_init_module(void)
err_unregister:
pci_unregister_driver(&dgap_driver);
-err_stop:
- dgap_stop();
return rc;
}
regards
sudip
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel