Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp143407lqo; Thu, 16 May 2024 01:42:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVSyKFX9EaZPv6VQ6TXiSMmslmh1+0kPKhJEaTcH4IlDQ9n4I8TigSt4aPFbijqSPGyyf34GGMdxOERrbmWtknHz5pPemveUeJcZei01A== X-Google-Smtp-Source: AGHT+IGtBZ/GPuczYHoZysQSsfT7FfxR8c2bWcc9AKZhL40E0CMyTQZum8YxP/UVMAxyyp/zvy8d X-Received: by 2002:a17:902:d586:b0:1ef:44d9:4183 with SMTP id d9443c01a7336-1ef44d941b6mr224722485ad.63.1715848959005; Thu, 16 May 2024 01:42:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715848958; cv=pass; d=google.com; s=arc-20160816; b=VE1/9eiqNnJ3OLIb5JgLcgZXAoeMbqXgiS1Yx7AJMHepyEaLBY0/miZeQUWw6Ycl// Mp4fg/eT8usnPmC+W6MfukgpoC8x+gNpxmQSldlgglry54u+HrMu9QhTQJ0iWTJ2Gx57 SAMdfiUlbELqyJGbGr8JCgpOXRkGoAPdbcv6NgX2QrIpoLx9em3hliQFmcNqHNr5P5Lp Ay1RiuG+Kc6spXkOAGE1HFLHaYMJIsCDdFa/jEE0gU3aLN8oJ1rW6zskwcXrrHXZA4kY XFA9T/ot9X51vnHu4MUN4jir97lCHAiy8MU34OYKB5CyX7odqQuVAAQN8WMBXyJd0sBF HErA== 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=Xb8JNdsqNXoeK/SfyCkaMbSsj57NY/9YQfV/Q+QzePg=; fh=DmnjhOwu6FiS3Qyss0kyFPL/EQS6BoNfn9yU0FPUh6M=; b=zEAk/6Ws6DirMY7JUpepCRVP5vQmbbVFOmVd44Do7ZQDGNQn109N57l3MxhZKrZ6FH 3RjYQrvNEkmxsz9k4tzTy20xj00Hwf7k3AcW4h85ABo9cMk/lkwg1FCH75s+y0xuBfoz RnVHLoeMNpWpb/fhNTF/QGR2/oMy6qNpU62dqaqsgao6Ni0vzRueMfN7HN/n1bzUHIsl rHwOusijbipVC4PkrSsQnbQyBlMxyvatJfKsftgd9c6dH2pdJAJYOe1khuoXBA7dS1J1 Eoe5odM1TKsMiFVNJWxRfqINFZGiDL+QNwbdOcOXixIGpgBgS/ORbTZjZ7nxdzmo8/XS kb/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GbFaGmCI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-180787-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180787-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0b9cf2a1si157046875ad.69.2024.05.16.01.42.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 01:42:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180787-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GbFaGmCI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-180787-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180787-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 382BD2819D1 for ; Thu, 16 May 2024 08:42:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A29F3142E8B; Thu, 16 May 2024 08:42:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GbFaGmCI" 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 C96941420BB; Thu, 16 May 2024 08:42:30 +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=1715848950; cv=none; b=Wa8pVH/byg4/P1cJc3Vk6tiRvf5dggoq538bGMNq/eWe3Mf+QtB2cS2nESOU0zuWpuOIi46fWygE7lVMQQ6k/iiUd+MNxbSEHpCzusxXuLHRQM1AYIHi2kJipzJCB9CxwgUMVda2oszGb+UPGnGhZJrPPuJlWUIqlDoI9miY+VQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715848950; c=relaxed/simple; bh=3ZpZsR6/16+tn0TZWLuuwEPsrm0WVS4oOlmAnDVesfg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=dr290ScjjIiS2z9yRnR8R3Lkva8lvtJd8gRF+QUNQK4pv32LvBBhxUQjZMd5XuctIOD38kfeahH+RsM1x9UoLk8Wgeix472kdMlC0PjMZFcV7ovfhWNQPw+/pK38pB2pbqs63lKTOI8uzSkoOvt4M/DCrxqOQ8tF+w0qrapJAtI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GbFaGmCI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BE4BC4AF07; Thu, 16 May 2024 08:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715848950; bh=3ZpZsR6/16+tn0TZWLuuwEPsrm0WVS4oOlmAnDVesfg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=GbFaGmCIjgOPOkG9toXL3AQ6m2KofRDe2JjF+zw3SS9ZFffhRJ2Q2QBy6LWz+oBGd UeOFPH6SFG8s8t/RuyJtn9hF8+D80pEhuLqWNv6V/9yXK0aLj7u12Cis74jBiGFthM OErxTztBFxC6WP7+9DnaWpGJ3nr0aPozlz8XBWGbtHdh4PfECI1eWW3ZKT4R+Lrr6i ymvQJ2dueGHXZU4hkVdCjniNxS8KcL3JpzxjcDsPkFFQvOAZCKNPGYPzu2bZ/029Jc 54R+ZLm7XWA9ZAHMHLrIPOiHYDM5pcN6f+Hie96I5zMZzQxPfH68cXr8dfbK7cO5Qi YQsz/0VxSXtfg== Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5ac970dded6so784451eaf.0; Thu, 16 May 2024 01:42:30 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCXZS+7xWu+7eMEKgCRZTYZGlRTWveTzQmpuHnwRkOgVpKAzD5icKrM6rnWI2XBVVBvKgP9gElbOlvpK6Ceus/j8VQ+Ye35Dlu6zWqvW8GCmDfWcF7r0BYDQTORZ3qaMeAYqjVe1CY0= X-Gm-Message-State: AOJu0Yy2pL1fV7RcAqAglW1Vg80PB/Yo3l6a/g+Xq7j4gV6EoCwGdF7y j/Ty+CL9To3vrqErnrYZfI0A+ZsIeEhDpzsnTosRuiqlltXOidVH170Sfctuy17zbzul2PUbuCP XrtMsRCBzn/+qIQS61Sm58jx/DJU= X-Received: by 2002:a05:6871:5b18:b0:23e:5301:4348 with SMTP id 586e51a60fabf-241732f6ca1mr20444031fac.5.1715848949574; Thu, 16 May 2024 01:42:29 -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:42:17 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4] cpufreq: amd-pstate: fix the memory to free after epp exist To: "Yuan, Perry" , "zhida312@outlook.com" Cc: "rafael@kernel.org" , "viresh.kumar@linaro.org" , Peng Ma , "Huang, Ray" , "Shenoy, Gautham Ranjal" , "Limonciello, Mario" , "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 10:28=E2=80=AFAM Yuan, Perry w= rote: > > [AMD Official Use Only - AMD Internal Distribution Only] > > > -----Original Message----- > > From: zhida312@outlook.com > > Sent: Thursday, May 16, 2024 2:31 PM > > To: rafael@kernel.org; viresh.kumar@linaro.org > > Cc: Peng Ma ; Huang, Ray ; > > Shenoy, Gautham Ranjal ; Limonciello, Mario > > ; Yuan, Perry ; linux- > > pm@vger.kernel.org; linux-kernel@vger.kernel.org > > Subject: [PATCH v4] cpufreq: amd-pstate: fix the memory to free after e= pp > > exist > > > > From: andypma The name and e-mail address in the From: header must be the same as in the Signed-off-by tag, so I've fixed that up. > > 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 > > --- > > 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 > > cpufreq_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; > > + } This does not need to be conditional, because you can pass NULL to kfree(), but it is correct and since Mario has ACKed it -> > > + > > pr_debug("CPU %d exiting\n", policy->cpu); > > return 0; > > } > > -- > > 2.41.0 > > Looks good now > > Reviewed-by: Perry Yuan -> applied as 6.10 material (with edited subject and changelog). Thanks!