From patchwork Tue Jun 7 15:18:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Zhi A" X-Patchwork-Id: 9161611 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A5ADE60467 for ; Tue, 7 Jun 2016 15:20:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 982E821C9A for ; Tue, 7 Jun 2016 15:20:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D1151FF81; Tue, 7 Jun 2016 15:20:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E7AB1FF81 for ; Tue, 7 Jun 2016 15:20:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BD4716E7C7; Tue, 7 Jun 2016 15:20:26 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E5236E7BC for ; Tue, 7 Jun 2016 15:20:24 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP; 07 Jun 2016 08:20:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,433,1459839600"; d="scan'208";a="823397245" Received: from zhiwang1-mobl4.ccr.corp.intel.com (HELO inno-VirtualBox.fi.intel.com) ([10.237.66.159]) by orsmga003.jf.intel.com with ESMTP; 07 Jun 2016 08:20:22 -0700 From: Zhi Wang To: chris@chris-wilson.co.uk, zhiyuan.lv@intel.com, kevin.tian@intel.com, tvrtko.ursulin@linux.intel.com, intel-gfx@lists.freedesktop.org Date: Tue, 7 Jun 2016 11:18:40 -0400 Message-Id: <1465312727-2211-5-git-send-email-zhi.a.wang@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465312727-2211-1-git-send-email-zhi.a.wang@intel.com> References: <1465312727-2211-1-git-send-email-zhi.a.wang@intel.com> Subject: [Intel-gfx] [PATCH v7 04/11] drm/i915: Add teardown path in intel_vgt_ballon() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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) Signed-off-by: Zhi Wang --- 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]); + } return ret; }