Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp139473lqo; Thu, 16 May 2024 01:31:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWKRMxuW9g4bN6XjmBgVJtE1Enn9qT5YA7+KkO+Q0mqQzm5hYFydHWcFYKHGncnW/ulyKo24Bh1r7esXteaf9G6yqTmHeXbIoKxEfbH4A== X-Google-Smtp-Source: AGHT+IG/tzE/2OA2Q1hXqhrJdlx3PmmNkS0GRnT61gwF8zAebW08kAHwwsx5N4x2yVVyuGy3o0N0 X-Received: by 2002:a05:6a21:2709:b0:1af:ceb8:221e with SMTP id adf61e73a8af0-1afd1483b5fmr27397693637.29.1715848287409; Thu, 16 May 2024 01:31:27 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-65713cc4c2esi2149031a12.813.2024.05.16.01.31.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 01:31:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180766-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="tAlw/lTu"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-180766-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180766-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 0D709B22D18 for ; Thu, 16 May 2024 08:29:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 043C7137929; Thu, 16 May 2024 08:28:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="tAlw/lTu" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2050.outbound.protection.outlook.com [40.107.243.50]) (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 58F08135A6E; Thu, 16 May 2024 08:28:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.50 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715848090; cv=fail; b=GtOVDqvgSdOXoNTiBU/FnTlKehklaIqMtqEPHgxJI5RkHyIGAZCWWx+rQNXCXHN8sCORdBFi+zkjfwGKthaljc5EJhQkvGem5M+FzN/tgNuV17iynyjLgexwSlfWY//Bippa6JcRWTUYewwhinZnfuWfiHtqanFWXoiTVNISMgA= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715848090; c=relaxed/simple; bh=NyO7wvFC2EU1hQxK7+1Bk3YUdGd/WlTiVE6ggAnojFc=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=il4CnE/3gDoSviwb8a5ynVZWIiu/domo6lAH7LVnqGs4Uf3qW9gEn7elvKqoYBqIjs+dDZ8CDAgJ/UPuGf7iOJbCSOOrM5LFplTCnEaJ5OdC+r7g/viX8N74YwS3Q9UP7mvs9ajhEsw9//1hdw/fOW9QKRUBc5dWnnIjQRheUm4= 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=tAlw/lTu; arc=fail smtp.client-ip=40.107.243.50 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=NmGtpaKrJmVirgPlZSZnSrXw6eZWe1NvKIegMW+AacGdiauMaMJm7sC/RfpHNU7U56MFVnVA0mxMg2jzQamG/uiBR5+tjBKsZrwPHQNCk9r5aE/2Yqrocp9R8D3Z4WDhVzEVf6ltqWpi5QCxx43Y/Cv+/Vr6meM5y6pmxx0toqCHaB06698bWmpJV8QpGzrMLJWwjQZ6LTZM+/0nWis8+U7dOt16ucuSx3PfwmEdiukwKW8QKJfoG0ZVUVq+WkY2sthp1BlTYTOlTN1FHR+p8G5jMEn5uBpwRHh/E5p/JiQ7vu9M/qiWx/569yVp20E+85aaX101b8mtrNsT+2L0Yw== 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=p7Fu+tU5Pt9PnhwDSVrKMUpY5OTWe+nRtuogto8/wOo=; b=GFEwNNpy98UTMf3fT+h9YB6czPPcALj6RGzdB5HyrB37SMDL4u2X/dJPRWhcXlh2vayUAJ6fK9NPtvXIGWnsvwhQ48phQC1j/AmQsikrA97Q7ZgCVhEHbGqC/FZ3XOifyf3SC4pEemw5Zt3ZXKJk7LTW2NWw21t8FHTxKtLeugtTmD83VO+hXlRnHDDIdprQ+1U9gY4icCG5HXU1LGCz/xYL+fMYbi7IHiOqYFo18JOA8GWG9srK+eX2s1isZwxxGH4nsjoCoMQInt2j5oWt1CQeF65GFF38uUGNttYNCdcZ2eM7wTmwCK1nMsmHt0fJ4QQTD6BLy/5tRjCCr4QypA== 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=p7Fu+tU5Pt9PnhwDSVrKMUpY5OTWe+nRtuogto8/wOo=; b=tAlw/lTu0pVhL1aPiuKofbyX6f1Cj1asUlZ7hgRRZdgTpp5eHEpgGfd12OgItF3Mqeo1r6ce0D/pFL74QMHDsDjo3g64L7dwd9XgDqx+qfsWYoz6JKo2vdYdc/QknW4BdbQ44Q6R6yWjWNlJJBXTR69jcS8aTKVuiw85+2dVJvg= Received: from CYYPR12MB8655.namprd12.prod.outlook.com (2603:10b6:930:c4::19) by SN7PR12MB7936.namprd12.prod.outlook.com (2603:10b6:806:347::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Thu, 16 May 2024 08:28:06 +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 08:28:06 +0000 From: "Yuan, Perry" To: "zhida312@outlook.com" , "rafael@kernel.org" , "viresh.kumar@linaro.org" CC: Peng Ma , "Huang, Ray" , "Shenoy, Gautham Ranjal" , "Limonciello, Mario" , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v4] cpufreq: amd-pstate: fix the memory to free after epp exist Thread-Topic: [PATCH v4] cpufreq: amd-pstate: fix the memory to free after epp exist Thread-Index: AQHap1qvGXuCaEUBIUasGUJvhQIt37GZhtuw Date: Thu, 16 May 2024 08:28:06 +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=b373d80b-64e5-4a0a-8ea3-79a498f9ee7c;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-16T08:26:42Z;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_|SN7PR12MB7936:EE_ x-ms-office365-filtering-correlation-id: 9fb43a62-2411-4ffe-c968-08dc75821c9f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230031|376005|1800799015|366007|38070700009; x-microsoft-antispam-message-info: =?us-ascii?Q?YP6WZMw2XaSs3hdsukfYhYhwySpiJG1gboWSAbfyRJuXi/dDPXqnJZqxjNEp?= =?us-ascii?Q?bTby1oJ31PcWVEchNxdWJv8Rt2uePGQrGBt2MX2VaJN4FBe4AACSfYl9iUra?= =?us-ascii?Q?hfaW9wHwsk0WlA1IH2OD4b2ukeS/x0Bm9TLyaiX6idhFkmVjWZjNNCVvvcjv?= =?us-ascii?Q?syiB2I4gcSlxtyxVjSzCkM6CXslL+UL//APC24jmscpcPX+K8lE9HJR5S9Mm?= =?us-ascii?Q?zExrk4jGNIsC2wZPF+Jenm1P5pI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/CfcEjRu5DmIfcnkBpqpgi8vI20WtnXhix4dJycEpztw+0EDLOUWSo?= =?us-ascii?Q?I0uElz0gIJD3gucgOE37a/uMPRWnmrPugN0+KbkHkf2CT+MtwK/ec4wFQH6T?= =?us-ascii?Q?xM9R1/W12RhDm4lPv3ONjU8x6Hz9aoOe0hgcUcLIY+gzGaYmZMh72dd8IDT9?= =?us-ascii?Q?4Hu8bkFbJnYlISB4g++Ke1el6PrYBB2GC2uPrHgsQvwkJg=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)(1800799015)(366007)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?bpi9rJwIYQxiE+fHvD5pX/ep4UGZGHi/SxsUu1VUuMi+gliOBC6Kw17GYaV7?= =?us-ascii?Q?GyDqS3EgKXGF0TUGKYrFQC9SBtQ/E1Hh+tPQP7Lw6WUW5Slf/rVx4FraEeNq?= =?us-ascii?Q?tLRQGCri/cbLdJcFcfKHBHV+XHN5aFijcgA/djRdgzEzxRiz8Rx/E0mVPZIK?= =?us-ascii?Q?0c07cmHju4RCCtPQ/LxVbVD0htqz4PIais2Ksy+wmbb82poUPKgzZdI59yz5?= =?us-ascii?Q?13p6N+MmoxmS14u/hzKR9egKninmhuyE2dEQBbs8gngJlrtGfjjnvAWulmsO?= =?us-ascii?Q?7R6wpUGm9F1cHIuJKWmF/zryewB5YNCBt/SOofsgmfg2hHUaUbLukVbViHS9?= =?us-ascii?Q?nsVAYxAIRDGRa03EBiYu9BrIlQa1FB4QP4XNfyoYs0grtpRSPd9AaA9xCsVx?= =?us-ascii?Q?rUq6MnKL6dCMCJMy5r0iwaT06uW5OW8+0299gyKWpUKAjqPeDjqwVghLD93V?= =?us-ascii?Q?wBK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VE6KF+dFYG8H?= =?us-ascii?Q?LlfetgHWPW8f2HJ66HYPQ3BUPcEnJ7zenja/uustCTcjs1dgTJpUUo2zuJAn?= =?us-ascii?Q?8IyZBTf2oWkmgDs6tXjYzWj1Xr7mn/rfPQz/4zqA2wCJa4Xgz1wW7evb9Wzw?= =?us-ascii?Q?7NBG1lOIjqQ43b0v6tHich110wkgKCDYtwEGKW4YMrzXxktzB2e6nIOL8olI?= =?us-ascii?Q?WoJ7oJGq+uAEqeGxjd4=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: 9fb43a62-2411-4ffe-c968-08dc75821c9f X-MS-Exchange-CrossTenant-originalarrivaltime: 16 May 2024 08:28:06.5752 (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: 6JYgam9pVE2UzAHIO6+sMioI+b/bnNyRTjHmNbYs3pscZu6Rpq09507qY+uebY/B/X8DyJicvMoLkjzbqc8pLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7936 [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 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 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; > + } > + > pr_debug("CPU %d exiting\n", policy->cpu); > return 0; > } > -- > 2.41.0 Looks good now Reviewed-by: Perry Yuan Thanks Regards. Perry