From patchwork Thu Jun 2 14:39:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 9150501 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 5C3266074E for ; Thu, 2 Jun 2016 14:39:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D98028047 for ; Thu, 2 Jun 2016 14:39:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 42B1728304; Thu, 2 Jun 2016 14:39:36 +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.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 0708728047 for ; Thu, 2 Jun 2016 14:39:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C5A436EBBD; Thu, 2 Jun 2016 14:39:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-x242.google.com (mail-qt0-x242.google.com [IPv6:2607:f8b0:400d:c0d::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id EECE06EBF6 for ; Thu, 2 Jun 2016 14:39:23 +0000 (UTC) Received: by mail-qt0-x242.google.com with SMTP id d51so1224928qte.1 for ; Thu, 02 Jun 2016 07:39:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bIW8ITw+pCqBjZSjgh+DtQd8WKc6YIrOXuHvaz/myk4=; b=aIwsfsEsn3YYEhdiCv0Q0S82pBhsSmPJjKsi4zr9pX/QBvvqGaDRL68x8vy8RCULQF UHb7jcGwe/ZttO6GUaiurRGZqKOZdtADOc4hII/jQ+dWS45w3ZcxT4teQaQ924BIO6A/ yG9EggnuUdwJT2NmuASfv3rfxuPUyrfMoz1Q3D4we7H7SNa9xjr7hw1WPi/rLcCS0raJ GGb7d6GxLlG0oTYX2E26cCMCWNqeYHZf4ZcAhy/aHJIXLKq1LF4o+CT++JaoOx9uG54E Ooai4vAEZ+tqCIgIWZDcUySvHMuG3rFnC6k6g0jEG96Pcxm/4hSaB55N57RkftDzZJ+H /d0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bIW8ITw+pCqBjZSjgh+DtQd8WKc6YIrOXuHvaz/myk4=; b=UsYcIfRQnb/OWq6WJ82JAYkIo9Yd+ArYrzoy8j0Q5xUxC/ZoQaD8RCZN8Rm5L0SY10 uzT/noOMrIf44y5sJiY1/P312QZ38i6OvbC5f3gIgcww6cO+rkk32dfv/4wB1SXCd6cI eAqHGydfsyb/2wAVPINK/2AXY8B/JE7AoSVCd9LJIKAaSvHUPIUlk/tGQA/t/5w+2OjF h87a/C2SMvHsR6bdjZPjbfsGSq/xfW8yehyZhn5DoZzrWx+zJKs4JFzmofeBeggGRrJa Yx6o+sAFaCnl4pw5A7H+CMJZ5UtrfyjqWCWV1JdtxuAluIu4rPwuvoFN8HFzxew+7VKY 7a3w== X-Gm-Message-State: ALyK8tIgzNAIv/puENSAa2gbfnjhi/k4sU9nNXrTuw3/3PUfBzaW1c6ApOC15FBTchO9BQ== X-Received: by 10.200.55.181 with SMTP id d50mr9459851qtc.32.1464878362699; Thu, 02 Jun 2016 07:39:22 -0700 (PDT) Received: from cm.localdomain (static-74-96-105-49.washdc.fios.verizon.net. [74.96.105.49]) by smtp.gmail.com with ESMTPSA id 188sm220362qhf.44.2016.06.02.07.39.22 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 02 Jun 2016 07:39:22 -0700 (PDT) From: Alex Deucher X-Google-Original-From: Alex Deucher To: dri-devel@lists.freedesktop.org Subject: [PATCH 06/13] drm/amdgpu: fix gfx8 ucode mem leak Date: Thu, 2 Jun 2016 10:39:06 -0400 Message-Id: <1464878353-16836-7-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1464878353-16836-1-git-send-email-alexander.deucher@amd.com> References: <1464878353-16836-1-git-send-email-alexander.deucher@amd.com> MIME-Version: 1.0 Cc: Alex Deucher , Monk Liu X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Monk Liu Signed-off-by: Monk Liu Reviewed-by: Christian König Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 4d747ba..9f6f866 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c @@ -836,6 +836,26 @@ err1: return r; } + +static void gfx_v8_0_free_microcode(struct amdgpu_device *adev) { + release_firmware(adev->gfx.pfp_fw); + adev->gfx.pfp_fw = NULL; + release_firmware(adev->gfx.me_fw); + adev->gfx.me_fw = NULL; + release_firmware(adev->gfx.ce_fw); + adev->gfx.ce_fw = NULL; + release_firmware(adev->gfx.rlc_fw); + adev->gfx.rlc_fw = NULL; + release_firmware(adev->gfx.mec_fw); + adev->gfx.mec_fw = NULL; + if ((adev->asic_type != CHIP_STONEY) && + (adev->asic_type != CHIP_TOPAZ)) + release_firmware(adev->gfx.mec2_fw); + adev->gfx.mec2_fw = NULL; + + kfree(adev->gfx.rlc.register_list_format); +} + static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) { const char *chip_name; @@ -1983,7 +2003,7 @@ static int gfx_v8_0_sw_fini(void *handle) gfx_v8_0_rlc_fini(adev); - kfree(adev->gfx.rlc.register_list_format); + gfx_v8_0_free_microcode(adev); return 0; }