Commit 002de0ba authored by Mark Hounschell's avatar Mark Hounschell Committed by Greg Kroah-Hartman

staging: dgap: Simplify and cleanup dgap_init_module function

This patch simplifies and cleans up the dgap_init_module function. It also fixes
a possible double free condition as a result pci_unregister_driver possibly
being called twice.
Signed-off-by: default avatarMark Hounschell <markh@compro.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 434b679b
...@@ -519,37 +519,25 @@ static int dgap_init_module(void) ...@@ -519,37 +519,25 @@ static int dgap_init_module(void)
dgap_driver_state = DRIVER_NEED_CONFIG_LOAD; dgap_driver_state = DRIVER_NEED_CONFIG_LOAD;
/*
* Initialize global stuff
*/
rc = dgap_start(); rc = dgap_start();
if (rc)
if (rc < 0)
return rc; return rc;
/*
* Find and configure all the cards
*/
rc = dgap_init_pci(); rc = dgap_init_pci();
if (rc)
goto err_cleanup;
/* rc = dgap_create_driver_sysfiles(&dgap_driver);
* If something went wrong in the scan, bail out of driver. if (rc)
*/ goto err_cleanup;
if (rc < 0) {
/* Only unregister the pci driver if it was actually registered. */
if (dgap_NumBoards)
pci_unregister_driver(&dgap_driver);
else
pr_err("dgap: driver load failed. No boards found.\n");
dgap_cleanup_module(); dgap_driver_state = DRIVER_READY;
} else {
rc = dgap_create_driver_sysfiles(&dgap_driver); return 0;
if (rc)
dgap_cleanup_module(); err_cleanup:
else
dgap_driver_state = DRIVER_READY; dgap_cleanup_module();
}
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment