staging: dgap: fix error path
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Thu, 16 Jul 2015 12:58:17 +0000 (18:28 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Jul 2015 17:19:55 +0000 (10:19 -0700)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/dgap/dgap.c

index 26b0446d943af6c7134821732d47fe3ea9ede20a..3a783bff112d334c05587620cfab45b8a67f798c 100644 (file)
@@ -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;
 }