Patchwork [01/14] usb-linux: Set usb_auto_timer to NULL after deleting it

login
register
mail settings
Submitter Hans de Goede
Date May 31, 2011, 9:35 a.m.
Message ID <1306834530-12763-2-git-send-email-hdegoede@redhat.com>
Download mbox | patch
Permalink /patch/97984/
State New
Headers show

Comments

Hans de Goede - May 31, 2011, 9:35 a.m.
We might check for it being NULL later, if the device gets unplugged.
---
 usb-linux.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Gerd Hoffmann - June 1, 2011, 10:48 a.m.
On 05/31/11 11:35, Hans de Goede wrote:
> We might check for it being NULL later, if the device gets unplugged.
> ---
>   usb-linux.c |    1 +
>   1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/usb-linux.c b/usb-linux.c
> index 4d7a31a..ea3ab5f 100644
> --- a/usb-linux.c
> +++ b/usb-linux.c
> @@ -1675,6 +1675,7 @@ static void usb_host_auto_check(void *unused)
>           /* nothing to watch */
>           if (usb_auto_timer) {
>               qemu_del_timer(usb_auto_timer);
> +            usb_auto_timer = NULL;

This is wrong.

qemu_del_timer just removes the scheduled timer event, not the timer 
structure itself.  qemu_free_timer does the later.

cheers,
   Gerd
Hans de Goede - June 1, 2011, 2:24 p.m.
Hi,

On 06/01/2011 12:48 PM, Gerd Hoffmann wrote:
> On 05/31/11 11:35, Hans de Goede wrote:
>> We might check for it being NULL later, if the device gets unplugged.
>> ---
>> usb-linux.c | 1 +
>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/usb-linux.c b/usb-linux.c
>> index 4d7a31a..ea3ab5f 100644
>> --- a/usb-linux.c
>> +++ b/usb-linux.c
>> @@ -1675,6 +1675,7 @@ static void usb_host_auto_check(void *unused)
>> /* nothing to watch */
>> if (usb_auto_timer) {
>> qemu_del_timer(usb_auto_timer);
>> + usb_auto_timer = NULL;
>
> This is wrong.
>
> qemu_del_timer just removes the scheduled timer event, not the timer structure itself. qemu_free_timer does the later.
>

Ok, I stand corrected :)

Regards,

Hans

Patch

diff --git a/usb-linux.c b/usb-linux.c
index 4d7a31a..ea3ab5f 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1675,6 +1675,7 @@  static void usb_host_auto_check(void *unused)
         /* nothing to watch */
         if (usb_auto_timer) {
             qemu_del_timer(usb_auto_timer);
+            usb_auto_timer = NULL;
         }
         return;
     }