Commit 00e66881 authored by spiiroin's avatar spiiroin

[usb-moded] Forget stale timer id

The charging_fallback() function has multiple return paths and does
not always clear timer id variable "charging_timeout". This can later
on lead to attempts to remove stale timer id - which causes glib to
emit warnings.

Clear the bookkeeping variable on entry to callback rather than just
one of the possible return points.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent d5cc31f3
......@@ -793,6 +793,8 @@ static gboolean charging_fallback(gpointer data)
{
(void)data;
charging_timeout = 0;
/* if a mode has been set we don't want it changed to charging
* after 5 seconds. We set it to ask, so anything different
* means a mode has been set */
......@@ -806,7 +808,6 @@ static gboolean charging_fallback(gpointer data)
free(current_mode.mode);
current_mode.mode = strdup(MODE_ASK);
current_mode.data = NULL;
charging_timeout = 0;
log_info("Falling back on charging mode.\n");
return(FALSE);
......
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