Skip to content

Commit

Permalink
usb modules might not unload if the clean-up has been skipped, so imp…
Browse files Browse the repository at this point in the history
…rove the failure mode clean-up by calling the clean-up after module unloading failure

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Jan 25, 2013
1 parent c8f85ed commit 3e2d439
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/usb_moded-modules.c
Expand Up @@ -266,9 +266,15 @@ int usb_moded_module_cleanup(const char *module)
if(failure && !strcmp(MODULE_MASS_STORAGE, module))
failure = usb_moded_unload_module(MODULE_FILE_STORAGE);

/* if it still failed it might be the mode has not been cleaned-up correctly,
so we clean up the mode to be sure */
if(failure)
{
usb_moded_mode_cleanup(usb_moded_find_module());
}

while(failure)
{
// SP: up to 2 second sleep -> worth a warning log?
/* module did not get unloaded. We will wait a bit and try again */
sleep(1);
/* send the REALLY disconnect message */
Expand Down

0 comments on commit 3e2d439

Please sign in to comment.