Re: [PATCH 1/4] staging: dgap: fix error path
On Fri, Jul 17, 2015 at 03:57:21PM +0530, Sudip Mukherjee wrote: > On Fri, Jul 17, 2015 at 01:05:55PM +0300, Dan Carpenter wrote: > > On Fri, Jul 17, 2015 at 03:21:28PM +0530, Sudip Mukherjee wrote: > > > On Fri, Jul 17, 2015 at 12:30:03PM +0300, Dan Carpenter wrote: > > > > I don't think I like these at all. remove_one has always been buggy in > > > > that it removes everything. We should fix it to only remove one instead > > > > of formalizing the currect terrible behavior. > > > Its already applied. > > > I thought after the full series the code became a little better than the > > > original one. > > > > It looks nicer but it's wrong. > > > > > > > Now dgap_stop() is being called from dgap_remove_one(). How do you suggest > > > it should be? > > > > dgap_remove_one() should mirror dgap_init_one(). dgap_stop() should > > only be called from dgap_cleanup_module(). dgap_cleanup_module() should > > mirror dgap_init_module(). > But if dgap_stop() is only called from dgap_cleanup_module() then what > will happen if the pci device is suddenly removed? > Currently if the pci device is removed then the remove callback will be > executed and it will stop and unregister everything properly. It shouldn't be unregistering everything when one thing is removed, it should only unregister the stuff that is removed. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/4] staging: dgap: fix error path
On Fri, Jul 17, 2015 at 01:05:55PM +0300, Dan Carpenter wrote: > On Fri, Jul 17, 2015 at 03:21:28PM +0530, Sudip Mukherjee wrote: > > On Fri, Jul 17, 2015 at 12:30:03PM +0300, Dan Carpenter wrote: > > > I don't think I like these at all. remove_one has always been buggy in > > > that it removes everything. We should fix it to only remove one instead > > > of formalizing the currect terrible behavior. > > Its already applied. > > I thought after the full series the code became a little better than the > > original one. > > It looks nicer but it's wrong. > > > > Now dgap_stop() is being called from dgap_remove_one(). How do you suggest > > it should be? > > dgap_remove_one() should mirror dgap_init_one(). dgap_stop() should > only be called from dgap_cleanup_module(). dgap_cleanup_module() should > mirror dgap_init_module(). But if dgap_stop() is only called from dgap_cleanup_module() then what will happen if the pci device is suddenly removed? Currently if the pci device is removed then the remove callback will be executed and it will stop and unregister everything properly. regards sudip -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/4] staging: dgap: fix error path
On Fri, Jul 17, 2015 at 03:21:28PM +0530, Sudip Mukherjee wrote: > On Fri, Jul 17, 2015 at 12:30:03PM +0300, Dan Carpenter wrote: > > I don't think I like these at all. remove_one has always been buggy in > > that it removes everything. We should fix it to only remove one instead > > of formalizing the currect terrible behavior. > Its already applied. > I thought after the full series the code became a little better than the > original one. It looks nicer but it's wrong. > Now dgap_stop() is being called from dgap_remove_one(). How do you suggest > it should be? dgap_remove_one() should mirror dgap_init_one(). dgap_stop() should only be called from dgap_cleanup_module(). dgap_cleanup_module() should mirror dgap_init_module(). regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/4] staging: dgap: fix error path
On Fri, Jul 17, 2015 at 12:30:03PM +0300, Dan Carpenter wrote: > I don't think I like these at all. remove_one has always been buggy in > that it removes everything. We should fix it to only remove one instead > of formalizing the currect terrible behavior. Its already applied. I thought after the full series the code became a little better than the original one. Now dgap_stop() is being called from dgap_remove_one(). How do you suggest it should be? regards sudip -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/4] staging: dgap: fix error path
I don't think I like these at all. remove_one has always been buggy in that it removes everything. We should fix it to only remove one instead of formalizing the currect terrible behavior. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/4] staging: dgap: fix error path
On Fri, Jul 17, 2015 at 03:21:28PM +0530, Sudip Mukherjee wrote: On Fri, Jul 17, 2015 at 12:30:03PM +0300, Dan Carpenter wrote: I don't think I like these at all. remove_one has always been buggy in that it removes everything. We should fix it to only remove one instead of formalizing the currect terrible behavior. Its already applied. I thought after the full series the code became a little better than the original one. It looks nicer but it's wrong. Now dgap_stop() is being called from dgap_remove_one(). How do you suggest it should be? dgap_remove_one() should mirror dgap_init_one(). dgap_stop() should only be called from dgap_cleanup_module(). dgap_cleanup_module() should mirror dgap_init_module(). regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/4] staging: dgap: fix error path
I don't think I like these at all. remove_one has always been buggy in that it removes everything. We should fix it to only remove one instead of formalizing the currect terrible behavior. regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/4] staging: dgap: fix error path
On Fri, Jul 17, 2015 at 12:30:03PM +0300, Dan Carpenter wrote: I don't think I like these at all. remove_one has always been buggy in that it removes everything. We should fix it to only remove one instead of formalizing the currect terrible behavior. Its already applied. I thought after the full series the code became a little better than the original one. Now dgap_stop() is being called from dgap_remove_one(). How do you suggest it should be? regards sudip -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/4] staging: dgap: fix error path
On Fri, Jul 17, 2015 at 01:05:55PM +0300, Dan Carpenter wrote: On Fri, Jul 17, 2015 at 03:21:28PM +0530, Sudip Mukherjee wrote: On Fri, Jul 17, 2015 at 12:30:03PM +0300, Dan Carpenter wrote: I don't think I like these at all. remove_one has always been buggy in that it removes everything. We should fix it to only remove one instead of formalizing the currect terrible behavior. Its already applied. I thought after the full series the code became a little better than the original one. It looks nicer but it's wrong. Now dgap_stop() is being called from dgap_remove_one(). How do you suggest it should be? dgap_remove_one() should mirror dgap_init_one(). dgap_stop() should only be called from dgap_cleanup_module(). dgap_cleanup_module() should mirror dgap_init_module(). But if dgap_stop() is only called from dgap_cleanup_module() then what will happen if the pci device is suddenly removed? Currently if the pci device is removed then the remove callback will be executed and it will stop and unregister everything properly. regards sudip -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/4] staging: dgap: fix error path
On Fri, Jul 17, 2015 at 03:57:21PM +0530, Sudip Mukherjee wrote: On Fri, Jul 17, 2015 at 01:05:55PM +0300, Dan Carpenter wrote: On Fri, Jul 17, 2015 at 03:21:28PM +0530, Sudip Mukherjee wrote: On Fri, Jul 17, 2015 at 12:30:03PM +0300, Dan Carpenter wrote: I don't think I like these at all. remove_one has always been buggy in that it removes everything. We should fix it to only remove one instead of formalizing the currect terrible behavior. Its already applied. I thought after the full series the code became a little better than the original one. It looks nicer but it's wrong. Now dgap_stop() is being called from dgap_remove_one(). How do you suggest it should be? dgap_remove_one() should mirror dgap_init_one(). dgap_stop() should only be called from dgap_cleanup_module(). dgap_cleanup_module() should mirror dgap_init_module(). But if dgap_stop() is only called from dgap_cleanup_module() then what will happen if the pci device is suddenly removed? Currently if the pci device is removed then the remove callback will be executed and it will stop and unregister everything properly. It shouldn't be unregistering everything when one thing is removed, it should only unregister the stuff that is removed. regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/4] staging: dgap: fix error path
The code in dgap_stop() is almost a duplicate of the code that will be executed on pci_unregister_driver(). So the error code was stopping and unregistering everything twice. Signed-off-by: Sudip Mukherjee --- we had a discussion about the init and error path few months back when another patch was sent. I am not able to find that discussion in lkml.org drivers/staging/dgap/dgap.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index 26b0446..3a783bf 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(_driver); - if (rc) - goto err_stop; + if (rc) { + dgap_stop(); + return rc; + } rc = dgap_create_driver_sysfiles(_driver); if (rc) @@ -7146,9 +7148,6 @@ static int dgap_init_module(void) err_unregister: pci_unregister_driver(_driver); -err_stop: - dgap_stop(); - return rc; } -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/4] staging: dgap: fix error path
The code in dgap_stop() is almost a duplicate of the code that will be executed on pci_unregister_driver(). So the error code was stopping and unregistering everything twice. Signed-off-by: Sudip Mukherjee su...@vectorindia.org --- we had a discussion about the init and error path few months back when another patch was sent. I am not able to find that discussion in lkml.org drivers/staging/dgap/dgap.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index 26b0446..3a783bf 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,9 +7148,6 @@ static int dgap_init_module(void) err_unregister: pci_unregister_driver(dgap_driver); -err_stop: - dgap_stop(); - return rc; } -- 1.8.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/