* [PATCH] PM: energy_model: Replace kfree() with em_table_free()
@ 2025-10-13 9:16 Kaushlendra Kumar
2025-10-14 11:01 ` Christian Loehle
0 siblings, 1 reply; 3+ messages in thread
From: Kaushlendra Kumar @ 2025-10-13 9:16 UTC (permalink / raw)
To: lukasz.luba, rafael, pavel; +Cc: linux-pm, Kaushlendra Kumar
Replace kfree() with em_table_free() for error path of em_create_pd()
to ensure proper cleanup of energy model tables. The em_table_free()
function provides the correct deallocation mechanism for energy model
table structures, ensuring consistent memory management throughout the
energy model subsystem.
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
---
kernel/power/energy_model.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
index 5f17d2e8e954..e8ae1f518b8a 100644
--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -441,7 +441,7 @@ static int em_create_pd(struct device *dev, int nr_states,
return 0;
free_pd_table:
- kfree(em_table);
+ em_table_free(em_table);
free_pd:
kfree(pd);
return -EINVAL;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] PM: energy_model: Replace kfree() with em_table_free()
2025-10-13 9:16 [PATCH] PM: energy_model: Replace kfree() with em_table_free() Kaushlendra Kumar
@ 2025-10-14 11:01 ` Christian Loehle
2025-10-14 12:43 ` Lukasz Luba
0 siblings, 1 reply; 3+ messages in thread
From: Christian Loehle @ 2025-10-14 11:01 UTC (permalink / raw)
To: Kaushlendra Kumar, lukasz.luba, rafael, pavel; +Cc: linux-pm
On 10/13/25 10:16, Kaushlendra Kumar wrote:
> Replace kfree() with em_table_free() for error path of em_create_pd()
> to ensure proper cleanup of energy model tables. The em_table_free()
> function provides the correct deallocation mechanism for energy model
> table structures, ensuring consistent memory management throughout the
> energy model subsystem.
>
> Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
> ---
> kernel/power/energy_model.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
> index 5f17d2e8e954..e8ae1f518b8a 100644
> --- a/kernel/power/energy_model.c
> +++ b/kernel/power/energy_model.c
> @@ -441,7 +441,7 @@ static int em_create_pd(struct device *dev, int nr_states,
> return 0;
>
> free_pd_table:
> - kfree(em_table);
> + em_table_free(em_table);
> free_pd:
> kfree(pd);
> return -EINVAL;
I guess this could carry the fixes tag as well.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PM: energy_model: Replace kfree() with em_table_free()
2025-10-14 11:01 ` Christian Loehle
@ 2025-10-14 12:43 ` Lukasz Luba
0 siblings, 0 replies; 3+ messages in thread
From: Lukasz Luba @ 2025-10-14 12:43 UTC (permalink / raw)
To: Christian Loehle, Kaushlendra Kumar; +Cc: linux-pm, rafael, pavel
On 10/14/25 12:01, Christian Loehle wrote:
> On 10/13/25 10:16, Kaushlendra Kumar wrote:
>> Replace kfree() with em_table_free() for error path of em_create_pd()
>> to ensure proper cleanup of energy model tables. The em_table_free()
>> function provides the correct deallocation mechanism for energy model
>> table structures, ensuring consistent memory management throughout the
>> energy model subsystem.
>>
>> Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
>> ---
>> kernel/power/energy_model.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
>> index 5f17d2e8e954..e8ae1f518b8a 100644
>> --- a/kernel/power/energy_model.c
>> +++ b/kernel/power/energy_model.c
>> @@ -441,7 +441,7 @@ static int em_create_pd(struct device *dev, int nr_states,
>> return 0;
>>
>> free_pd_table:
>> - kfree(em_table);
>> + em_table_free(em_table);
>> free_pd:
>> kfree(pd);
>> return -EINVAL;
>
> I guess this could carry the fixes tag as well.
It was already discussed with NACK, which still holds.
https://lore.kernel.org/lkml/7778df43-5169-4d1c-9fe6-44bee39edfc1@arm.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-14 12:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-13 9:16 [PATCH] PM: energy_model: Replace kfree() with em_table_free() Kaushlendra Kumar
2025-10-14 11:01 ` Christian Loehle
2025-10-14 12:43 ` Lukasz Luba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).