Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2461611lqo; Mon, 13 May 2024 21:51:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXlCF0OxLOwK6f4cwiPWQjO/k3uDquktlsG8ZuVlD+v/DmGNd7puwykMcbP9KMz3m77geRYytHljQAuneHjQ18ky6ATS5x+AZYAxhyZkQ== X-Google-Smtp-Source: AGHT+IEM/Yfi9dDFY5RV5fz96s3kahvwAjg1Ux9i1/RbjNd/VuCjd6FwAeSx+p0ITeVGNVz4jXIC X-Received: by 2002:a50:8e4d:0:b0:572:4faf:ed67 with SMTP id 4fb4d7f45d1cf-5734d5cecb4mr6960217a12.24.1715662313516; Mon, 13 May 2024 21:51:53 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c2d55eesi6219430a12.271.2024.05.13.21.51.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 21:51:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178315-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="r8mepDf/"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-178315-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178315-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 1A7821F241D4 for ; Tue, 14 May 2024 04:51:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DBC2A171A5; Tue, 14 May 2024 04:51:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="r8mepDf/" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2088.outbound.protection.outlook.com [40.107.94.88]) (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 EFD0D21A06; Tue, 14 May 2024 04:51:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.88 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715662286; cv=fail; b=pvoevyOFnSxEYcuqj5TQ4ajj4GQr3BFhfNNWpOzFmNLtWIXnSpuExSw5iUpHtK5Vybjny++Iptg5hf71f0AnX3Tqg2frkaPGRGCT2XnHbMjsZEOSEZQNWLCyH5XszUHxu8gi8HSF37r9duqP184Ta2oL5xOPT67EnSJDmDbQLr8= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715662286; c=relaxed/simple; bh=cNqCMquICXFhjfiJqUSLd+6IeqRvcup5PmbQX2YuKQ4=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=sfkqLqSiOS+Oq+FRyFFkXLvhZeNtBAVOYhNKZtiWKllkX2+mynMWES22O8D+C1glRU+FRua3qC2Fzff+vmNHHI6EyaNXuZ0fhWCmPDY6c5V3/pZFuBJQD29Xlo39IBHWpDVhKXPFnxcTkf3WUcyaKvtUh3wHL4nV6PUasB7RFiU= 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=r8mepDf/; arc=fail smtp.client-ip=40.107.94.88 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=ad0sqldqFj954lwLYl6up1cCf5zXergjrpEmJSqlovnKhy5D0s/jrE8svmmhtfRWeILJqYitmmnOIaOdj6NVygZqLXke/5l8JelVFYdus3eYdhzV92u/871p6Ec+15vpFZeXoWh9endIqVH2WneMg4ALF4gH5GealaPepSzQuA0UzaXv7wM0l7DI4kKCIwsYokHM4/5G2aUnvj9/QR9uREHTbttU2p98PvGPuxoVEy1+lqbegxWz/vmgMfPPWm/6yTSrFEznKe7eg/v464w64NKd2z5QEIZQur/vSi5INIj7oTQYZgX0tWRb2ezyUTSDAxmhnFbX3msGTowzr+P9Rg== 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=jpoaguosjx/I6AiqYUo+Ne18Krsl9rldqKKZzp+l6QI=; b=nsKrHpfsNriXUzwKivEtMKXY0+ydX7tsbkiKE68Iw/VDDtlmz8EHAtnaEMOy9hLP55n8aQzIpBbcyri8BvhPT1Cf+ZIv/YigVig47D2HoeQltuFW0IJxh2rL3I7tRHrFMblOnAQPWexRJdvOyDebWLW66U6iISTzwuhajlXVjw59/3eg3EaKGzHhKmMH4l+gqIwx5vypX7T49Bef2zj13lDTMnDYwGNc0AJq4o7BYOQ54o6UN6HXsD3saKAZx1Zv8pDxCecZlDfo3HM60Q2FGLx3aod7NhEhBOaQ1B9l3MhYl52M7pIiaRa/3ZL0TNvw1LcJU9F6apTulm/Ek3yCaw== 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=jpoaguosjx/I6AiqYUo+Ne18Krsl9rldqKKZzp+l6QI=; b=r8mepDf/jALXzKH29cb71umtccoFGB1Ak47Yz69SUYF0cMSopGeltrOJ/lDJI0djyxr37RJYLrImdV7IR/3mdKCAvkp/WuBQfMvbp0N9SXK18xXCIsVtIzTsPeo48WBwmznCsr7XppNOW7zUq9vEIfPpvFN0DhPxJIdOlQogQbw= Received: from CYYPR12MB8655.namprd12.prod.outlook.com (2603:10b6:930:c4::19) by BY5PR12MB4081.namprd12.prod.outlook.com (2603:10b6:a03:20e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Tue, 14 May 2024 04:51:22 +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.7544.052; Tue, 14 May 2024 04:51:22 +0000 From: "Yuan, Perry" To: "zhida312@outlook.com" , "rafael@kernel.org" , "viresh.kumar@linaro.org" , "Shenoy, Gautham Ranjal" CC: Peng Ma , "Huang, Ray" , "Limonciello, Mario" , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] cpufreq: amd-pstate: fix the memory to free after epp exist Thread-Topic: [PATCH] cpufreq: amd-pstate: fix the memory to free after epp exist Thread-Index: AQHapa1Z4XqJT3sZK0GM9Z2m2rVaLrGWJ85w Date: Tue, 14 May 2024 04:51:22 +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=d5bd71e9-67cc-457b-8e8d-d162339b58b6;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-14T04:45:44Z;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_|BY5PR12MB4081:EE_ x-ms-office365-filtering-correlation-id: a3c4a4dd-b02f-4073-1aa6-08dc73d18098 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230031|376005|366007|1800799015|38070700009; x-microsoft-antispam-message-info: =?us-ascii?Q?+JcrV86P00/C0dtNoIiQIW9CO/69OQwREpf8AFguKkLg4mTvTDLXIkLIahOT?= =?us-ascii?Q?z/F+LF3nfvQSRpEV2iHZXy3NkUOoTA/sUYmAv9/GLHNp0fwWZqI+uG6PhhWa?= =?us-ascii?Q?fEEGSnlm/H6OU26gRbi4Hiy9YDOSSxdba3+Eff+x8jMuGW1ttk2zsTZkTiho?= =?us-ascii?Q?E0EAw9wl300E920EEkexRIJPq4r8hF5xmb4iXbE5+lqMA/iNfqWdTtlkpdX9?= =?us-ascii?Q?YZECxNPzDdkz1NZ0Dv/CMXrGfc4oIzRIOhu/5qm7pugtiFTVNiSz9UjPHdPl?= =?us-ascii?Q?ffao/PymETnm6idJjxoId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EMUoZwLatS?= =?us-ascii?Q?QqDn2yUpbQqp5TFaWL81j6KyFS64DiMxlgDepaya3kYfgJzu1pYrw9RklN5f?= =?us-ascii?Q?yD7TcCsvCa0/LkdF22C/K2cepiVXXMx3KKCDFazmu2J9caToBVZimlDj5w+G?= =?us-ascii?Q?zG0CvXEC6jR0SLEFB18aeO9RC4ThStfM8QYAGie1YKokOQ=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)(376005)(366007)(1800799015)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?7fm+4xGuBXiTWqJjJPGm1pDQtuGRsaBsTLOkC2NzOcL16xEakucPydy/R8BN?= =?us-ascii?Q?A8DGL4SPe8Bg4TkRSCfBAqRK2P87ejJI6SAcREEnn9ZlMKNepkhJTFLPLxTq?= =?us-ascii?Q?K5AhVFX/88wUP67vmJIcqJXaRDehpnq7VvzvTTrQF2nFitgElcW8HIM3QMfp?= =?us-ascii?Q?Kxds2/ZiXLTuD7tFtH1B/F1EEAY4gc05MIAciCRLJrPnrmZgg8D9zFJ3jNh6?= =?us-ascii?Q?PArVAeJSE4AMuD3oWCn17Kh4OQ0vjNasfjTFKKUIL+uiv5rGjB9mfE+xt49/?= =?us-ascii?Q?EVgrbMzbRvmYPeP3GSbaae2ELRNKlTFopjsEmZSbLidxD+dfX9rQRF4/usv/?= =?us-ascii?Q?Uj0wU1NJMJADc81u43czt+3UdCsF9nL0AT9Zl6KDgL1kaCBR932aT5XKyqle?= =?us-ascii?Q?Pd8YZQZETkFsOj4Cf9HBXfjhdgxcgqdoVAVmVN9Ocx7a5LGWF2t5iw+fF7Tu?= =?us-ascii?Q?iyCYUX1swIQnz1IdHPH9D6cv7xDYxfSG+DfhVR/zxIEvD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NQXTcbBr4BqOZ9HxfgwzUoeoXsF45YxO6cML?= =?us-ascii?Q?j9QRPV79ADLou2MPgIPjPyIsaqa2bs5BolRy3qxJCwqmJM3rafynkpyG7pl6?= =?us-ascii?Q?OGoyR2+5cde0olMgGqtFn1wGjhqKX31BWiVgl733Apu2pl3IxboV1VkuNUBK?= =?us-ascii?Q?UMQvIF7rgOQrEuVDRlM=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: a3c4a4dd-b02f-4073-1aa6-08dc73d18098 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2024 04:51:22.2213 (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: CwyZk7gg96x0Y7hIDq8BCQl9vm70akN3zCKiR3+v1MHsk2AB6G5s/3bPj/anPir2DFS7pffO1ppXeXk80xKPcA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4081 [AMD Official Use Only - AMD Internal Distribution Only] Hi Peng, > -----Original Message----- > From: zhida312@outlook.com > Sent: Tuesday, May 14, 2024 11:17 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: [PATCH] cpufreq: amd-pstate: fix the memory to free after epp ex= ist > > 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 > --- > drivers/cpufreq/amd-pstate.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c = index > 2db095867d03..96a323f59a93 100644 > --- a/drivers/cpufreq/amd-pstate.c > +++ b/drivers/cpufreq/amd-pstate.c > @@ -1425,6 +1425,9 @@ 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; > + > + kfree(cpudata); > pr_debug("CPU %d exiting\n", policy->cpu); > return 0; > } > -- > 2.33.0 Thanks for the patch, how about change to be like below? if (cpudata) { kfree(cpudata); policy->driver_data =3D NULL; } Perry.