Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp254848imn; Wed, 3 Aug 2022 02:27:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR5rB6ihK5jqy86EnUpHflytg5Y5BVVOC/ggqfafd8hgtZ56iFCo39hmtciyHIsnPReqJggX X-Received: by 2002:a17:902:b08a:b0:16c:68b6:311 with SMTP id p10-20020a170902b08a00b0016c68b60311mr23993764plr.166.1659518872716; Wed, 03 Aug 2022 02:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659518872; cv=none; d=google.com; s=arc-20160816; b=jhGB4S5GeJEJupPdJEAyHOajJeAqkcG4DieawFeOofl4E38wYpHCUlDFbNmL2QGDgk 4DypVJedFKm8DSw8+/veSRe3mzU88DCl6r+4KSNYisA/rWsN2cFMGPBWGseP+Tg8BdxZ Eqy5iX/cZ/nFdqti74L503AU0MsGdAYdm88LbHBueP28JI2n4UFpr2nzYBQojpKDTzfL SPJHL0S0t8xeRpTN9ebXldiUHAWZ0sXzn+7TR4Hxox8RwGB/PLN78nN7tfqU1jMyuxZH N3elu7Ii2kI+sPpZ1zNT+/Si6C7hOuMFGfn6Z6KUl9cdjVqAPVY7j7NfGDCcU0dTIsrf bSZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=3MC7U8Cccj7a90gwRu7XKYxcoa/fXGa+ZzjB3merGKk=; b=pSiQnXyWjt9oYpYUBeGeW4Cst/UNBjHh67PLUVlOJeTZCRwH9VqhiP1gTspwaEFML9 rACZJCy/17JzbV40swfcTANty7gvn5Ue2MsfG6Dx1Jc404OSce42Dj5nrZGHuNr/tOfV Q61D8I5J7+zc0pNPyroPghNER3rOswwZTYpB2+sqxcKf8kqs588elorRbNgz1UZfMsj5 wHCSZ1ZkgL+k4ZNLfOzL1pwc4314dc0HJeJhfgEwCX0RFB3LkjAsFE/CaXR/2efPxsu0 UD2OhsspAOj4gHmm7wulo2pD7VJgnlGpfauXkr0ysMd3pwXkLU+WZBLuxvcxTuADR0Gg UNxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me8-20020a17090b17c800b001f25fb2a0b6si1595884pjb.120.2022.08.03.02.27.37; Wed, 03 Aug 2022 02:27:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237046AbiHCJUz (ORCPT + 99 others); Wed, 3 Aug 2022 05:20:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236468AbiHCJUr (ORCPT ); Wed, 3 Aug 2022 05:20:47 -0400 Received: from smtpbgjp3.qq.com (smtpbgjp3.qq.com [54.92.39.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AAD14E613 for ; Wed, 3 Aug 2022 02:20:45 -0700 (PDT) X-QQ-mid: bizesmtp66t1659518435tcy4ogi5 Received: from localhost.localdomain ( [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 03 Aug 2022 17:20:25 +0800 (CST) X-QQ-SSF: 01400000002000C0K000B00C0000000 X-QQ-FEAT: W+onFc5Tw4Oqh24lEr6B3ZCNdcvNCXFqy6OaiwkY2QHg01q4ATXn1a1pNwxZ9 Y6Gu1Bpl97AUGZvxhHIP+g7kk06IUPlPHByajYAGo06oAZOf1moP64qya5i8AF+rMvwTu0c fOiF7LF6TFeHqp+KAC/DwjxbHnXlHsfeM5syB9KMliraFdhiGM9Tryw9TMLvT0n1LmM5cWo 23KPdWlp/YqFVsqcCp5wGN6eh/syehFN1+ay2w5I6hAcda9xZdaoJatO6SiGOAHTQ8matE2 BhF9NJQo+x2dRjc4/lMjyudv3erE6bwhSpvvS1Do4eFwxkwuwWecFGnCk8wOYVoufGLLQve Qf47s0f8g1mOZzxk+lnDamh+3YLdyEmyY1Q9vTDrEeAqUsEiROmPTN0msvW8CRyH39ixVez lVSqgX7xUN15830BtoV87w== X-QQ-GoodBg: 2 From: Zhen Ni To: airlied@linux.ie, daniel@ffwll.ch, evan.quan@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Zhen Ni Subject: [PATCH 2/2] drm/amd/pm: Fix a potential gpu_metrics_table memory leak Date: Wed, 3 Aug 2022 17:19:59 +0800 Message-Id: <20220803091959.10030-2-nizhen@uniontech.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220803091959.10030-1-nizhen@uniontech.com> References: <20220803091959.10030-1-nizhen@uniontech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign9 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Memory is allocated for gpu_metrics_table in smu_v13_0_5_init_smc_tables(), but not freed in smu_v13_0_5_fini_smc_tables(). This may cause memory leaks, fix it. Signed-off-by: Zhen Ni --- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c index b81711c4ff33..267c9c43a010 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c @@ -167,6 +167,9 @@ static int smu_v13_0_5_fini_smc_tables(struct smu_context *smu) kfree(smu_table->watermarks_table); smu_table->watermarks_table = NULL; + kfree(smu_table->gpu_metrics_table); + smu_table->gpu_metrics_table = NULL; + return 0; } -- 2.20.1