Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp29863lqo; Wed, 15 May 2024 19:49:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVu+QucjsifyW+cpVmVD63aIiEmyzdCFbB4LgMi39niwHRaD3nQHN1/OFXRk8qG4fkAAPlVnpaoWfbCEOROUylDeqj4DFbbmhWTHOTZ/g== X-Google-Smtp-Source: AGHT+IFuEepixCsi6YL2fAWsRN1zSua0CI1/R0QD2Hmjrdx7N5fepdRE3hSmj9jZq7Hoy7go0BlV X-Received: by 2002:a50:9b06:0:b0:572:727f:d0db with SMTP id 4fb4d7f45d1cf-5734d5c13dfmr11659654a12.15.1715827747442; Wed, 15 May 2024 19:49:07 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-574f4b15db0si1629844a12.288.2024.05.15.19.49.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 19:49:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180579-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=@amd.com header.s=selector1 header.b=OKow7QuE; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-180579-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180579-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com 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 075F31F21CD2 for ; Thu, 16 May 2024 02:49:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 238FC441D; Thu, 16 May 2024 02:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="OKow7QuE" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2058.outbound.protection.outlook.com [40.107.92.58]) (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 C5B3615C3; Thu, 16 May 2024 02:48:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.58 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715827737; cv=fail; b=aAlU0BNrrSzmWhWZ5jqBZbpdiz3FAau2GERXpQhazEEiI4DJr2RHXoiznQGuWscqGxR4KVexiHxub+KoshoHu20wwy5SBvgZ8bqblIRm4hIs9qrGBzcQWWiAo6+EBa05wJX7qOjKhILNu2zcxAkcsj1Hw6X4WEJ5aiYK9VpA4RM= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715827737; c=relaxed/simple; bh=lrEUrlK3p1Tn/cQAKjnPvj8azfKq3gbHd6Fsc97fbn8=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=R5p8xXp631dVk3TVx2WCf8k/LoGHhlcSuCa7dDRPeTZuAfXZjGbyPuF4hOczcORdkaO8oKis+qeMpCtRbhZMp48HhxYEOuPMmCclGCwHE4ziBaYC5Jb7pa1SSMaRCVWJarnzOz72WQMefPdKl5bly+mCcgYO704rpdD6bXqSAsQ= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=OKow7QuE; arc=fail smtp.client-ip=40.107.92.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G1PWncP0IIA8FMjar2vjicjKoZBa2oRhWqbc0a3XWuhMmRhAxOEOG0gkngFXnfZ3QssSUVqP1bTo7X+zIUR0AV3en5RaxaKOmARpMh0usxyyNtmanrCza0iVGcMBMX5WRzJuFVSEUhXZtCws9a74oSWGm7JeI/4C92DaEcaQFc9TSLxTHb8SkWiTV5bEHMq1J/wjqM4wJaNFSwPG1zR2HDBW7t9RiUFXQbWrqa5FfbWQTW4kL1uKp00xxgvRbHuut1+rtMP2/4WmfiUgo3EHsdwtuR62sjUWTdF8fwnvy91nV9N80/z0UTg0S4q5NECqwU2Tcb+01kMgW3UmQYHDZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iTgMbSuOfuxNZlHaK5zI34o191wJaZ0UmSiwowf9Cqs=; b=d1aReMAp65/U22zgvma5IOl/748BPrV4/cD4LQmcnQ5XF2DFUa3t079QmM396r98WugOFSNz0l1vyHk5gNruPo57cYGG+ih5GFjcyAEVAwpwN7ofljrR08caQUTRZsGj7kB7ekOvz+dybr9f0rOLZok92RDG+C75pKYF2T6WEalV7iazlgQcqCsY5MOlCZAV5BgJOvWj6jERIuZH+mrZK0M9epg1bxswOmNDXXx3Xf+RXxQwwPBG2/H5xFrY7sAPnoCnDzeQqTl5om0xlI0s4leyE+hvp/eP+K4qJaHyuSG0EtvVtTu/ecdh/rM+cjRDa51D/9auIdOp58tk30nA0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iTgMbSuOfuxNZlHaK5zI34o191wJaZ0UmSiwowf9Cqs=; b=OKow7QuEe9dVKmSju57h+9QuLLzlHwt9Lp97M9Iwofr+xwtgsOB0JKi03cJUlbrn/ZmTwfgJbeTkOpyITJEPOdzMic5E9SP1FcPmWIvCU2b7znzVHFxbKVT65E1jlLb0uzX0x4aDK6ldvTR2zO2fK4YEd10dV1ZwUO6Tr9YQZZI= Received: from CYYPR12MB8655.namprd12.prod.outlook.com (2603:10b6:930:c4::19) by SJ0PR12MB7005.namprd12.prod.outlook.com (2603:10b6:a03:486::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.28; Thu, 16 May 2024 02:48:49 +0000 Received: from CYYPR12MB8655.namprd12.prod.outlook.com ([fe80::7fa2:65b3:1c73:cdbf]) by CYYPR12MB8655.namprd12.prod.outlook.com ([fe80::7fa2:65b3:1c73:cdbf%6]) with mapi id 15.20.7587.026; Thu, 16 May 2024 02:48:48 +0000 From: "Yuan, Perry" To: "zhida312@outlook.com" CC: Peng Ma , "Huang, Ray" , "Shenoy, Gautham Ranjal" , "Limonciello, Mario" , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "viresh.kumar@linaro.org" , "rafael@kernel.org" Subject: RE: [v3] cpufreq: amd-pstate: fix the memory to free after epp exist Thread-Topic: [v3] cpufreq: amd-pstate: fix the memory to free after epp exist Thread-Index: AQHapnNS2Fs0k0Uj1kCoPfk5W0R3R7GZKPvg Date: Thu, 16 May 2024 02:48:48 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_ActionId=48993ae2-5ef3-4cc1-9a62-e1f708bf4b65;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_ContentBits=0;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Enabled=true;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Method=Standard;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Name=AMD Internal Distribution Only;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_SetDate=2024-05-16T02:44:15Z;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CYYPR12MB8655:EE_|SJ0PR12MB7005:EE_ x-ms-office365-filtering-correlation-id: 8363829d-ddc5-4582-e752-08dc7552b675 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230031|1800799015|376005|366007|38070700009; x-microsoft-antispam-message-info: =?us-ascii?Q?PcT4bxsds4pnVSSPmkznSJkGWj0y8Dl0d6TYKJ5ojh1JzKjBREfAcQV+XEAX?= =?us-ascii?Q?79P8ZogZ6LHukATbuOn/Ul8O/l9NRQsPse3SPls62rv7BXZfA0V8UivuDIvo?= =?us-ascii?Q?Juyk8PmokqTbNfC3Igo9RTc2SLc2xqOnuSexXOfnLzhVU5e0MNDMBEtue9My?= =?us-ascii?Q?mUFpsKb94Yng6cHzYQehuC7113BQtIVNsnKFtoNVrw76P6diOTjHAk8/zy5V?= =?us-ascii?Q?jVuyo44cTRbrQr1+pubZZeFIDeV0/8ehCNBd8E1+E+FukI3VUj5enMmEbvA6?= =?us-ascii?Q?KRab2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bGHqextBhePyR32JrsCY?= =?us-ascii?Q?K0Acrlj+eYqFgoRJ3VxT5VxTnBITwJqVgRitaeaStEPIgCT8o6UpozsXdRZC?= =?us-ascii?Q?4KMOZP+AWOnyQsPTjAB+nRQdwJMYnFG8/S2OwKxhuyQO+89WOMTEbnWLgou7?= =?us-ascii?Q?88Q/tXHVjPRejxHwJK4zE1cp/h9XEPgHS7vhrxItIehW9Q=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CYYPR12MB8655.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(366007)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?xo4TRhvJIVXdVK3ciNGfDLKN3p4+L/Ex+JKhN9VTIW7IeLW77P2ftxOMQU1N?= =?us-ascii?Q?Q2qdEbKSYqAA3V3VL/SDRKJsbEfsYJOdxB93rJ03+z7r8SeOrX0+ivuab7Vl?= =?us-ascii?Q?lBYvPppILAkAnGxU3YxbhwA2HCkukxOzb6wSsUvpUevlhHBf91YXYqdY9QIG?= =?us-ascii?Q?CKyPUVe6QLEIrQgz4hBxWDvdzyQ1JUmQdP1JZVhp3WggKJeBPN+EZykHF63+?= =?us-ascii?Q?sSnu6w2FLZlYUw4CEEryjWorEODW535yn+QHbi5C/krDKs4DHfmR7UwTlHDL?= =?us-ascii?Q?NIDPCQ2a9Cu3gNajzUUM3DWrCxF/s5VvDSQvbDj93BeoIS8/qvwi2DDtdQIc?= =?us-ascii?Q?yX/eO1Gbd75OMUs25luDPTOcoeyr1e0xvLajBqj8doIiZOmHWWFpyj17Vsdw?= =?us-ascii?Q?DV1Hcb1R+7ZAIwr2c3gR/1cY9Eg+InKhRNYO+91nPR1a+fleG4+jcJdgL5Ih?= =?us-ascii?Q?asGZWTAA33QkWxPlw4irKBStOrgx90r+5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buXRfZwJxpjFU+U4dKyuVDomllzSM4xmNR1BgyGyehcTWSZOn5HM+?= =?us-ascii?Q?jCNrOC4NOkdHqVkeeSjdftvmjZkAdmNjdyt7wOP8MQfnNe+5Kkw6MlVZflru?= =?us-ascii?Q?Y4txUybkqN8Zhduo7lyDT9eDG5wMGF+Lnekcltp2uiWwW6V/nWGeZAU4Jr/k?= =?us-ascii?Q?nC/tC3gRJ/VTv/jsv3w=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CYYPR12MB8655.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8363829d-ddc5-4582-e752-08dc7552b675 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 May 2024 02:48:48.8399 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: UoTQ+vQ6X0549PbdxD0nbaZezg9b8A4hZ8CVaCP9knD93kflR0QijHkg3hGpvFr9iYXlVF0DQBvI7N4DqpI74w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB7005 [AMD Official Use Only - AMD Internal Distribution Only] Hi Peng, > -----Original Message----- > From: zhida312@outlook.com > Sent: Wednesday, May 15, 2024 10:54 AM > 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: [v3] cpufreq: amd-pstate: fix the memory to free after epp exist The subject need to be update as below. " git format-patch -1 -v 3" [PATCH v3] cpufreq: amd-pstate: fix the memory to free after epp exist > > From: andypma > > the cpudata memory from kzmalloc in epp init function is not free after e= pp exist, > so we should free it. > > Signed-off-by: Peng Ma > > Changes since v2: > update Signed-off-by to Peng Ma . > set a space between if and "(". > > Changes since v1: > 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; > + } > + > pr_debug("CPU %d exiting\n", policy->cpu); > return 0; > } > -- > 2.41.0