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 <>
parent d5cc31f3
......@@ -793,6 +793,8 @@ static gboolean charging_fallback(gpointer 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)
current_mode.mode = strdup(MODE_ASK); = NULL;
charging_timeout = 0;
log_info("Falling back on charging mode.\n");
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