[Intel-gfx] [PATCH v7 04/11] drm/i915: Add teardown path in intel_vgt_ballon()
Joonas Lahtinen
joonas.lahtinen at linux.intel.com
Wed Jun 8 08:12:11 UTC 2016
Patch title s/ballon/balloon/.
On ti, 2016-06-07 at 11:18 -0400, Zhi Wang wrote:
> This function needs to be changed to have a proper goto teardown path.
> Destructors/fini functions are only expected to be called after a
> successful initialization, so calling it at random phase in init function
> is bad. (Joonas)
>
Cc: and Suggested-by: help to track where the patch appeared from.
> Signed-off-by: Zhi Wang <zhi.a.wang at intel.com>
> ---
> drivers/gpu/drm/i915/i915_vgpu.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
> index c9800d4..d41a29e 100644
> --- a/drivers/gpu/drm/i915/i915_vgpu.c
> +++ b/drivers/gpu/drm/i915/i915_vgpu.c
> @@ -187,7 +187,7 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv)
>
> unsigned long mappable_base, mappable_size, mappable_end;
> unsigned long unmappable_base, unmappable_size, unmappable_end;
> - int ret;
> + int ret, i;
>
> if (!intel_vgpu_active(dev_priv))
> return 0;
> @@ -263,6 +263,9 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv)
>
> err:
> DRM_ERROR("VGT balloon fail\n");
> - intel_vgt_deballoon(dev_priv);
> + for (i = 0; i < ARRAY_SIZE(bl_info.space); i++) {
> + if (bl_info.space[i].allocated)
> + drm_mm_remove_node(&bl_info.space[i]);
> + }
Maybe add a counterpart vgt_deballoon_space for vgt_balloon_space and
use it in intel_vgt_deballoon and here. That way the code will be more
readable.
Regards, Joonas
> return ret;
> }
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
More information about the Intel-gfx
mailing list