From patchwork Wed Jun 1 15:10:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 9147557 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 D6ABD60761 for ; Wed, 1 Jun 2016 15:10:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C823120410 for ; Wed, 1 Jun 2016 15:10:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD06426B39; Wed, 1 Jun 2016 15:10:17 +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 1F5F020410 for ; Wed, 1 Jun 2016 15:10:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 696A56E1E6; Wed, 1 Jun 2016 15:10:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-x241.google.com (mail-qt0-x241.google.com [IPv6:2607:f8b0:400d:c0d::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8328D6E1E6 for ; Wed, 1 Jun 2016 15:10:13 +0000 (UTC) Received: by mail-qt0-x241.google.com with SMTP id k6so267711qta.0 for ; Wed, 01 Jun 2016 08:10:13 -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; bh=WDRGxBJlrKR7o5E/YNICAxdzQnx8UqnNd1ycxhtA3vE=; b=Ir9fykPzHmvlYvgjGZS6QrAaM7DAFVRkVAm5ESoPrCliQ6EVnIZ0MT1fo30wQ6Plfj lY+ZLhmlu4u3BlF8GFyEeVvec+F5UquFwza1xB5Z8QYKsK/ry63RSXQmkPxB63wkYrDS /nFgsdc15xBn44slGNRSsLDZ4lmMRbEEe9EUuPhJpXMvsHbUc+2bI9E3okx9KFWQiBet 0cbLs69dan04RGjn/83X3pHeC7DWt8Tr8IDgblY8hEzeg0x1LAB3Hev/Ut1VUBZC7AOq NGsCJ9AQImuUHzwPu85zWkw/Ue/rydbtwxs/n6oE257TzufeQHXXQoobHfqY2p/tWfJa GCbg== 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; bh=WDRGxBJlrKR7o5E/YNICAxdzQnx8UqnNd1ycxhtA3vE=; b=kjB28nZBeEb04wCkf9UaIJcrKSIVJApslYbTm54Hko8mxu2r2PS6lt36vqgEsa/Jky CED5zRd4hNH6ogSRKTwrNGWsBpmLUPNNrAoX0Iog5ushenCc5VvqQhK9Pmi1m/FUJskn tMnmTgBaUyTCDhzUo/evqtl5mgAg4LbstqlKOkJjKTFBM7LQrlfvV7+KyyJk+CfkJqc5 uOhzLTM0Je2l2AhRNk+3TuDPmiLcHtTB7bjTDVw24LUvMErsCOfVIImBjl2YZ3RjNkQF 7DtfSbV5QSnRY1khbtgoHJJO8sKoLjtF8mjwCBQ7WslFOV5SNCSm35lFFDykY4/labjl j5Fg== X-Gm-Message-State: ALyK8tLI9u6iPyJA3yG4597bj3klF5lybfoKlYf2xHeFNMEtZbpYHvbqNBgsYwRp+N2EgQ== X-Received: by 10.200.56.53 with SMTP id q50mr3961884qtb.22.1464793812135; Wed, 01 Jun 2016 08:10:12 -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 z92sm9846206qge.18.2016.06.01.08.10.11 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Jun 2016 08:10:11 -0700 (PDT) From: Alex Deucher X-Google-Original-From: Alex Deucher To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/amdgpu: fix fw leak in non-powerplay dpm code Date: Wed, 1 Jun 2016 11:10:06 -0400 Message-Id: <1464793806-30875-1-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 2.5.5 Cc: Alex Deucher 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP We need to release the firmware on driver tear down. Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 3 +++ drivers/gpu/drm/amd/amdgpu/fiji_dpm.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/iceland_dpm.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/tonga_dpm.c | 5 +++++ 4 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c index 671d032..523ddbfc 100644 --- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c @@ -6225,6 +6225,9 @@ static int ci_dpm_sw_fini(void *handle) ci_dpm_fini(adev); mutex_unlock(&adev->pm.mutex); + release_firmware(adev->pm.fw); + adev->pm.fw = NULL; + return 0; } diff --git a/drivers/gpu/drm/amd/amdgpu/fiji_dpm.c b/drivers/gpu/drm/amd/amdgpu/fiji_dpm.c index 245cabf..ed03b75 100644 --- a/drivers/gpu/drm/amd/amdgpu/fiji_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/fiji_dpm.c @@ -72,6 +72,11 @@ static int fiji_dpm_sw_init(void *handle) static int fiji_dpm_sw_fini(void *handle) { + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + release_firmware(adev->pm.fw); + adev->pm.fw = NULL; + return 0; } diff --git a/drivers/gpu/drm/amd/amdgpu/iceland_dpm.c b/drivers/gpu/drm/amd/amdgpu/iceland_dpm.c index 460bc8a..825ccd6 100644 --- a/drivers/gpu/drm/amd/amdgpu/iceland_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/iceland_dpm.c @@ -72,6 +72,11 @@ static int iceland_dpm_sw_init(void *handle) static int iceland_dpm_sw_fini(void *handle) { + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + release_firmware(adev->pm.fw); + adev->pm.fw = NULL; + return 0; } diff --git a/drivers/gpu/drm/amd/amdgpu/tonga_dpm.c b/drivers/gpu/drm/amd/amdgpu/tonga_dpm.c index b7615ce..f06f6f4 100644 --- a/drivers/gpu/drm/amd/amdgpu/tonga_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/tonga_dpm.c @@ -71,6 +71,11 @@ static int tonga_dpm_sw_init(void *handle) static int tonga_dpm_sw_fini(void *handle) { + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + release_firmware(adev->pm.fw); + adev->pm.fw = NULL; + return 0; }