[v8,6/9] vfio/common: cleanup in vfio_region_finalize

Submitted by Gerd Hoffmann on March 6, 2018, 11:34 a.m.

Details

Message ID 20180306113442.15295-7-kraxel@redhat.com
State New
Headers show
Series "vfio: add display support" ( rev: 4 ) in Intel GVT devel

Not browsing as part of any series.

Commit Message

Gerd Hoffmann March 6, 2018, 11:34 a.m.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/vfio/common.c | 7 +++++++
 1 file changed, 7 insertions(+)

Patch hide | download patch | download mbox

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index f895e3c335..6a8203a532 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -858,6 +858,13 @@  void vfio_region_finalize(VFIORegion *region)
     g_free(region->mmaps);
 
     trace_vfio_region_finalize(region->vbasedev->name, region->nr);
+
+    region->mem = NULL;
+    region->mmaps = NULL;
+    region->nr_mmaps = 0;
+    region->size = 0;
+    region->flags = 0;
+    region->nr = 0;
 }
 
 void vfio_region_mmaps_set_enabled(VFIORegion *region, bool enabled)

Comments

Looks good.

Reviewed by: Kirti Wankhede <kwankhede@nvidia.com>

Thanks,
Kirti

On 3/6/2018 5:04 PM, Gerd Hoffmann wrote:
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/vfio/common.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
> index f895e3c335..6a8203a532 100644
> --- a/hw/vfio/common.c
> +++ b/hw/vfio/common.c
> @@ -858,6 +858,13 @@ void vfio_region_finalize(VFIORegion *region)
>      g_free(region->mmaps);
>  
>      trace_vfio_region_finalize(region->vbasedev->name, region->nr);
> +
> +    region->mem = NULL;
> +    region->mmaps = NULL;
> +    region->nr_mmaps = 0;
> +    region->size = 0;
> +    region->flags = 0;
> +    region->nr = 0;
>  }
>  
>  void vfio_region_mmaps_set_enabled(VFIORegion *region, bool enabled)
>