public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] staging: dgap: fix error path
@ 2015-07-16 12:58 Sudip Mukherjee
  2015-07-16 12:58 ` [PATCH 2/4] staging: dgap: rearrange function Sudip Mukherjee
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Sudip Mukherjee @ 2015-07-16 12:58 UTC (permalink / raw)
  To: Lidza Louina, Mark Hounschell, Daeseok Youn, Greg Kroah-Hartman
  Cc: linux-kernel, driverdev-devel, devel, Sudip Mukherjee

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 <sudip@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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-07-17 10:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-16 12:58 [PATCH 1/4] staging: dgap: fix error path Sudip Mukherjee
2015-07-16 12:58 ` [PATCH 2/4] staging: dgap: rearrange function Sudip Mukherjee
2015-07-16 12:58 ` [PATCH 3/4] staging: dgap: new arguments to dgap_stop Sudip Mukherjee
2015-07-16 12:58 ` [PATCH 4/4] staging: dgap: remove duplicate code Sudip Mukherjee
2015-07-17  9:30 ` [PATCH 1/4] staging: dgap: fix error path Dan Carpenter
2015-07-17  9:51   ` Sudip Mukherjee
2015-07-17 10:05     ` Dan Carpenter
2015-07-17 10:27       ` Sudip Mukherjee
2015-07-17 10:52         ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox