[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1456574615-32003-2-git-send-email-sudipm.mukherjee@gmail.com>
Date: Sat, 27 Feb 2016 17:33:33 +0530
From: Sudip Mukherjee <sudipm.mukherjee@...il.com>
To: Lidza Louina <lidza.louina@...il.com>,
Mark Hounschell <markh@...pro.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org,
driverdev-devel@...uxdriverproject.org, devel@...verdev.osuosl.org,
Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: [PATCH 2/4] staging: dgnc: remove pci_unregister_driver
If pci_register_driver() fails then dgnc_NumBoards can never be more
than zero. dgnc_NumBoards is incremented only at the end of a successful
probe. And moreover if the pci driver has failed to register then we
never need to unregister it. Lets just print the warning, perform the
cleanup and exit with the error code.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@...ethink.co.uk>
---
drivers/staging/dgnc/dgnc_driver.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
index c32f208..1d1d5c8 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -181,23 +181,14 @@ static int __init dgnc_init_module(void)
* Find and configure all the cards
*/
rc = pci_register_driver(&dgnc_driver);
-
- /*
- * If something went wrong in the scan, bail out of driver.
- */
- if (rc < 0) {
- /* Only unregister if it was actually registered. */
- if (dgnc_NumBoards)
- pci_unregister_driver(&dgnc_driver);
- else
- pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n");
-
+ if (rc) {
+ pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n");
dgnc_cleanup_module();
- } else {
- dgnc_create_driver_sysfiles(&dgnc_driver);
+ return rc;
}
+ dgnc_create_driver_sysfiles(&dgnc_driver);
- return rc;
+ return 0;
}
module_init(dgnc_init_module);
--
1.9.1
Powered by blists - more mailing lists