From patchwork Fri Feb 15 19:35:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sripada, Radhakrishna" X-Patchwork-Id: 10815767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF04514E1 for ; Fri, 15 Feb 2019 19:34:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6752289EC for ; Fri, 15 Feb 2019 19:34:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA90B3016C; Fri, 15 Feb 2019 19:34:51 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9FBD13001D for ; Fri, 15 Feb 2019 19:34:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 82B306E023; Fri, 15 Feb 2019 19:34:48 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7E7C16E0FB for ; Fri, 15 Feb 2019 19:34:41 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Feb 2019 11:34:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,373,1544515200"; d="scan'208";a="138983864" Received: from invictus.jf.intel.com ([10.54.75.159]) by orsmga001.jf.intel.com with ESMTP; 15 Feb 2019 11:34:40 -0800 From: Radhakrishna Sripada To: intel-gfx@lists.freedesktop.org Date: Fri, 15 Feb 2019 11:35:54 -0800 Message-Id: <20190215193554.24579-1-radhakrishna.sripada@intel.com> X-Mailer: git-send-email 2.20.0.rc2.7.g965798d1f299 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/i915/selftests: Fix resource leak in __sseu_prepare X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Fix the resource leak reported by static code checker. Cc: Tvrtko Ursulin Signed-off-by: Radhakrishna Sripada --- drivers/gpu/drm/i915/selftests/i915_gem_context.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c index d00d0bb07784..0d821a679f74 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c @@ -726,14 +726,13 @@ __sseu_prepare(struct drm_i915_private *i915, ret = igt_spinner_init(spin, i915); if (ret) - return ret; + goto clean; rq = igt_spinner_create_request(spin, ctx, engine, MI_NOOP); if (IS_ERR(rq)) { ret = PTR_ERR(rq); igt_spinner_fini(spin); - kfree(spin); - goto out; + goto clean; } i915_request_add(rq); @@ -742,14 +741,16 @@ __sseu_prepare(struct drm_i915_private *i915, pr_err("%s: Spinner failed to start!\n", name); igt_spinner_end(spin); igt_spinner_fini(spin); - kfree(spin); ret = -ETIMEDOUT; - goto out; + goto clean; } *spin_out = spin; + goto out; } +clean: + kfree(spin); out: return ret; }