* [RFC PATCH 1/2] PM: EM: Export em_table_alloc/free
@ 2026-07-10 8:24 Xuewen Yan
2026-07-10 8:24 ` [RFC PATCH 2/2] PM: EM: Validate new_table in em_dev_update_perf_domain() Xuewen Yan
2026-07-10 8:34 ` [RFC PATCH 1/2] PM: EM: Export em_table_alloc/free Lukasz Luba
0 siblings, 2 replies; 4+ messages in thread
From: Xuewen Yan @ 2026-07-10 8:24 UTC (permalink / raw)
To: lukasz.luba, rafael, pavel, lenb
Cc: linux-pm, linux-kernel, xuewen.yan94, ke.wang
When drivers wants to alloc a new em_perf_table to update
their em_perf_table, they need to use em_table_alloc and
em_table_free.
So export the two func.
Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
---
kernel/power/energy_model.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
index e610cf8e9a06..277aaf1b19da 100644
--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -201,6 +201,7 @@ void em_table_free(struct em_perf_table *table)
{
kref_put(&table->kref, em_release_table_kref);
}
+EXPORT_SYMBOL_GPL(em_table_free);
/**
* em_table_alloc() - Allocate a new EM table
@@ -225,6 +226,7 @@ struct em_perf_table *em_table_alloc(struct em_perf_domain *pd)
return table;
}
+EXPORT_SYMBOL_GPL(em_table_alloc);
static void em_init_performance(struct device *dev, struct em_perf_domain *pd,
struct em_perf_state *table, int nr_states)
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [RFC PATCH 2/2] PM: EM: Validate new_table in em_dev_update_perf_domain()
2026-07-10 8:24 [RFC PATCH 1/2] PM: EM: Export em_table_alloc/free Xuewen Yan
@ 2026-07-10 8:24 ` Xuewen Yan
2026-07-10 8:36 ` Lukasz Luba
2026-07-10 8:34 ` [RFC PATCH 1/2] PM: EM: Export em_table_alloc/free Lukasz Luba
1 sibling, 1 reply; 4+ messages in thread
From: Xuewen Yan @ 2026-07-10 8:24 UTC (permalink / raw)
To: lukasz.luba, rafael, pavel, lenb
Cc: linux-pm, linux-kernel, xuewen.yan94, ke.wang
Add an explicit check for the new_table parameter in
em_dev_update_perf_domain() to ensure it is not NULL or an
ERR_PTR before proceeding with the update.
Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.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 277aaf1b19da..4d75e1b3c20e 100644
--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -331,7 +331,7 @@ int em_dev_update_perf_domain(struct device *dev,
struct em_perf_table *old_table;
struct em_perf_domain *pd;
- if (!dev)
+ if (!dev || IS_ERR_OR_NULL(new_table))
return -EINVAL;
/* Serialize update/unregister or concurrent updates */
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC PATCH 1/2] PM: EM: Export em_table_alloc/free
2026-07-10 8:24 [RFC PATCH 1/2] PM: EM: Export em_table_alloc/free Xuewen Yan
2026-07-10 8:24 ` [RFC PATCH 2/2] PM: EM: Validate new_table in em_dev_update_perf_domain() Xuewen Yan
@ 2026-07-10 8:34 ` Lukasz Luba
1 sibling, 0 replies; 4+ messages in thread
From: Lukasz Luba @ 2026-07-10 8:34 UTC (permalink / raw)
To: Xuewen Yan
Cc: linux-pm, rafael, lenb, pavel, linux-kernel, xuewen.yan94,
ke.wang
On 7/10/26 09:24, Xuewen Yan wrote:
> When drivers wants to alloc a new em_perf_table to update
> their em_perf_table, they need to use em_table_alloc and
> em_table_free.
> So export the two func.
>
> Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
> ---
> kernel/power/energy_model.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
> index e610cf8e9a06..277aaf1b19da 100644
> --- a/kernel/power/energy_model.c
> +++ b/kernel/power/energy_model.c
> @@ -201,6 +201,7 @@ void em_table_free(struct em_perf_table *table)
> {
> kref_put(&table->kref, em_release_table_kref);
> }
> +EXPORT_SYMBOL_GPL(em_table_free);
>
> /**
> * em_table_alloc() - Allocate a new EM table
> @@ -225,6 +226,7 @@ struct em_perf_table *em_table_alloc(struct em_perf_domain *pd)
>
> return table;
> }
> +EXPORT_SYMBOL_GPL(em_table_alloc);
>
> static void em_init_performance(struct device *dev, struct em_perf_domain *pd,
> struct em_perf_state *table, int nr_states)
LGTM,
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH 2/2] PM: EM: Validate new_table in em_dev_update_perf_domain()
2026-07-10 8:24 ` [RFC PATCH 2/2] PM: EM: Validate new_table in em_dev_update_perf_domain() Xuewen Yan
@ 2026-07-10 8:36 ` Lukasz Luba
0 siblings, 0 replies; 4+ messages in thread
From: Lukasz Luba @ 2026-07-10 8:36 UTC (permalink / raw)
To: Xuewen Yan
Cc: linux-pm, rafael, lenb, pavel, linux-kernel, xuewen.yan94,
ke.wang
On 7/10/26 09:24, Xuewen Yan wrote:
> Add an explicit check for the new_table parameter in
> em_dev_update_perf_domain() to ensure it is not NULL or an
> ERR_PTR before proceeding with the update.
>
> Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.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 277aaf1b19da..4d75e1b3c20e 100644
> --- a/kernel/power/energy_model.c
> +++ b/kernel/power/energy_model.c
> @@ -331,7 +331,7 @@ int em_dev_update_perf_domain(struct device *dev,
> struct em_perf_table *old_table;
> struct em_perf_domain *pd;
>
> - if (!dev)
> + if (!dev || IS_ERR_OR_NULL(new_table))
> return -EINVAL;
>
> /* Serialize update/unregister or concurrent updates */
Make sense to check that and catch possible issue this way.
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-10 8:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10 8:24 [RFC PATCH 1/2] PM: EM: Export em_table_alloc/free Xuewen Yan
2026-07-10 8:24 ` [RFC PATCH 2/2] PM: EM: Validate new_table in em_dev_update_perf_domain() Xuewen Yan
2026-07-10 8:36 ` Lukasz Luba
2026-07-10 8:34 ` [RFC PATCH 1/2] PM: EM: Export em_table_alloc/free Lukasz Luba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox