Patchwork [3/4] virtio-rng: disable timer on device removal

login
register
mail settings
Submitter Amit Shah
Date Nov. 20, 2012, 2:26 p.m.
Message ID <4174418d72ef8966c94434a814c2a67d5d33f646.1353421334.git.amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/200347/
State New
Headers show

Comments

Amit Shah - Nov. 20, 2012, 2:26 p.m.
Disable the rate-limit timer on device remove (e.g. hot-unplug).

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 hw/virtio-rng.c | 2 ++
 1 file changed, 2 insertions(+)
Anthony Liguori - Nov. 21, 2012, 1:41 a.m.
Amit Shah <amit.shah@redhat.com> writes:

> Disable the rate-limit timer on device remove (e.g. hot-unplug).
>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>

Nice catch.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

> ---
>  hw/virtio-rng.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/hw/virtio-rng.c b/hw/virtio-rng.c
> index cf5a8ff..c8a6da7 100644
> --- a/hw/virtio-rng.c
> +++ b/hw/virtio-rng.c
> @@ -194,6 +194,8 @@ void virtio_rng_exit(VirtIODevice *vdev)
>  {
>      VirtIORNG *vrng = DO_UPCAST(VirtIORNG, vdev, vdev);
>  
> +    qemu_del_timer(vrng->rate_limit_timer);
> +    qemu_free_timer(vrng->rate_limit_timer);
>      unregister_savevm(vrng->qdev, "virtio-rng", vrng);
>      virtio_cleanup(vdev);
>  }
> -- 
> 1.8.0

Patch

diff --git a/hw/virtio-rng.c b/hw/virtio-rng.c
index cf5a8ff..c8a6da7 100644
--- a/hw/virtio-rng.c
+++ b/hw/virtio-rng.c
@@ -194,6 +194,8 @@  void virtio_rng_exit(VirtIODevice *vdev)
 {
     VirtIORNG *vrng = DO_UPCAST(VirtIORNG, vdev, vdev);
 
+    qemu_del_timer(vrng->rate_limit_timer);
+    qemu_free_timer(vrng->rate_limit_timer);
     unregister_savevm(vrng->qdev, "virtio-rng", vrng);
     virtio_cleanup(vdev);
 }