Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp136805lqo; Thu, 16 May 2024 01:24:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXFsEv70E+hi1xTjuq/TRQH5RKef+EUMhzIXY8gg2VWfea2vy8Bfp4dp8IRkFSe1N7V2i4uYmXlYWps/ZWPU8RuKX6DT66oOO6xqi2W7g== X-Google-Smtp-Source: AGHT+IHeI+RPe4isx/oi77Y4MCd0x2cLpLzwYYO0rCwz/wS1YPOqQBlGcntAf6Z5OX+6bJzj+LQq X-Received: by 2002:a17:906:ee86:b0:a59:aae5:5840 with SMTP id a640c23a62f3a-a5a2d6759e5mr1573447266b.75.1715847851988; Thu, 16 May 2024 01:24:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715847851; cv=pass; d=google.com; s=arc-20160816; b=qjji5S8P/ajiYqI3//anYNsVhMa99sIGlAp2VvvsLrT0R9A4e+OgkAQnrwb54nWUnk //ZNrDvZqLxjRIsx7jRsGFsP6LuiGZZWtECCar746OCzYmJMfbTcT5emF4+Sx7lmzOor bjnVT2IGAExHlXg3WsrXBZ5Q7d6fogGHZXoOuS1YLQlo/LLkPrSSch8JQzFw1CSnPmYO eXso4DjW3I9TY2OSf/vQJsIrB7jR4Fs1Z+85bPbbeqjkVH4zRVA+A0lu7h46tRK5/vLQ DxBgwsEAOzGP395I4b1qkj4sUR11Ly5yNRuMCsgE0UhiRMe6CXBgM6ew3VdMT0hpPFZK xmDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=pq1ERgKcXmT5a5uKbeUBAviBwml6WDYwC1LoS51aJfw=; fh=zYRAMkcye4G/S2gP3cGdDxXBMyQMc/n/AkhrpO8cy94=; b=z6UrD95t3E4gPLjX9TllvS/T/iCNFq4tRWA4irXS7ochgzonVqwhJyAL6SrlAUPnt4 F51j1H9R1u9RcYR4AXXK/HHgTYat2IP+w+1nofRgM1S4YwXjq5mDOmSWo+ErMOi+Kk7q nLk/HJ4aUAbdCqvGpFtvcMQUBqj2iDzmzAD1acfpnhvarOLcnAKnSeZ2xkZ/GBQzokcc B/g16agCGebIXWkFPchN5uTPH6jbQYDJEfoyGFIXYc8HJh0K8m2IBhlEb6kZp5VOFPGB YCzyen70QFpibrD2UXhvMp+gQMQVqhRevksZ6vsEoO9aqVczEPGCALFqga34XHzdpRu+ uYzg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lXe5xgEv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-180755-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180755-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17946323si822283466b.144.2024.05.16.01.24.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 01:24:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180755-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lXe5xgEv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-180755-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180755-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7EFC31F228C7 for ; Thu, 16 May 2024 08:24:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3A291292F3; Thu, 16 May 2024 08:24:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lXe5xgEv" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 223CC27269; Thu, 16 May 2024 08:24:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715847843; cv=none; b=PSvYTztF436tqUHS0hiZ2VRGUftT2R2Lju1cDFw9oPaQ6po3NY+EtTDhxT4aKkEug/xkH3c210sxsuJk16mkYkgXeebPsCk2S1UeK2mHpNWBnHGRguZmZQoDOC0mWdovT+L339B9+qfcnU7JvWxB8mTqgfSMlBhOpP/6x1q/lks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715847843; c=relaxed/simple; bh=hyQRYxU63IRWE515n+lMY3Cdi+hKZmN00P0ekqCBH88=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=eSPBgL0XXDdyAzqLYLFHMm+VAvsIbpNP1j4AA/6E6bTWdGRXu5bEz8EkLmnQI7ksB7epj5D0HwNX8bralDSpJ1aCS0PT4ZOWFMOGCIVGt172bd4VIrhLyqyItMz1h6zzLC1AusC4Govyu7L2doTNqFw3jtWxM6tAN5sidFnwri8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lXe5xgEv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4FE8C4AF0A; Thu, 16 May 2024 08:24:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715847841; bh=hyQRYxU63IRWE515n+lMY3Cdi+hKZmN00P0ekqCBH88=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=lXe5xgEvnEx8z6PUz2pL5ixMNeh9XpCBd+ztAAPImIBffjdluWJbOGot6MJJHYgon i7tkaVASeISGC99mWPn56DIyzlkyByDSJULcIBTgSjX1czoKnLFIN0ktsRgvjhz95b ROSwAFfAUMXgtEbjc8nWee5UTGzLg3yLF7iVaVov4UGpqzJkRNnzvSkq6WtUTjUNLN 6ZsfYyEGu/j3bXLdpWIoeoqswVPpiRUOglZwZ9PyZC15dYyGiQ2B6Uf+nX5yfLLbJO 7BK+U80vECPNxhZCf2vvym/S/Xa9kEl/ZM2Qesv3jNBSj7xnnFo3EZAQ0HnYCGeg4q X1UeTKCzJ1G9Q== Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-3c998b36c6bso1280551b6e.3; Thu, 16 May 2024 01:24:01 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUml9uCrp2ruRN3U1TosrCUDW+Pe/Ei7+P5Aj0xvi2qs7fIsLqC9gNxQwy7x5jsJzgCL2vSqUq/0PzNO6ZvzJ/RWHshBXbyYs4kIbt0/Sw9T3t0K338dcOW5Odo7ixo1kGFedTl9Zc= X-Gm-Message-State: AOJu0YzB2ayi9ix3Hdc0IE9qBiLSPOnl9CdN1MJi4PR5gcK4B8zTl8TP CmQTlwHOQ9E3YSwOE65YGnyKl+cJ7b/kWj/T3Te0y0MKx6pYva3O9y4pxeqODoPEylz1tc1Fylc Ron06IK/7x5hHWtwoVI372wuENiM= X-Received: by 2002:a05:6870:d0c6:b0:22d:fb4b:9d11 with SMTP id 586e51a60fabf-24172fc0c29mr20760363fac.4.1715847841119; Thu, 16 May 2024 01:24:01 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: "Rafael J. Wysocki" Date: Thu, 16 May 2024 10:23:48 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4] cpufreq: amd-pstate: fix the memory to free after epp exist To: "Limonciello, Mario" Cc: zhida312@outlook.com, rafael@kernel.org, viresh.kumar@linaro.org, Peng Ma , Huang Rui , "Gautham R. Shenoy" , Perry Yuan , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 16, 2024 at 9:47=E2=80=AFAM Limonciello, Mario wrote: > > > > On 5/16/2024 1:30 AM, zhida312@outlook.com wrote: > > From: andypma > > > > the cpudata memory from kzmalloc in epp init function is > > not free after epp exist, so we should free it. > > > > Signed-off-by: Peng Ma > > > > Changes from v3 to v4: > > update subject used git command "git format-patch -1 -v x" > > > > Changes from v2 to v3: > > update Signed-off-by to Peng Ma . > > set a space between if and "(". > > > > Changes from v1 to v2: > > check whether it is empty before releasing > > set driver_data is NULL after free > > --- > > Thanks for your submission! > > I would prefer the change list below the cut list, but otherwise this is > fine. Maybe Rafael can modify that while committing. I can do that no problem. > Acked-by: Mario Limonciello Thanks! > > drivers/cpufreq/amd-pstate.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.= c > > index 6a342b0c0140..1b7e82a0ad2e 100644 > > --- a/drivers/cpufreq/amd-pstate.c > > +++ b/drivers/cpufreq/amd-pstate.c > > @@ -1441,6 +1441,13 @@ static int amd_pstate_epp_cpu_init(struct cpufre= q_policy *policy) > > > > static int amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy) > > { > > + struct amd_cpudata *cpudata =3D policy->driver_data; > > + > > + if (cpudata) { > > + kfree(cpudata); > > + policy->driver_data =3D NULL; > > + } > > + > > pr_debug("CPU %d exiting\n", policy->cpu); > > return 0; > > }