Skip to content

Commit 9454714

Browse files
iqbalcodes6602rafaeljw
authored andcommitted
thermal: devfreq_cooling: avoid unnecessary kfree of freq_table
dfc->freq_table is only allocated in the non-EM path via devfreq_cooling_gen_tables(). In the EM path, it remains NULL. Avoid calling kfree() unnecessarily when freq_table was never allocated. This resolves a Smatch warning: calling kfree() when 'dfc->freq_table' is always NULL. Signed-off-by: Anas Iqbal <mohd.abd.6602@gmail.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Link: https://patch.msgid.link/20260323094018.2264-1-mohd.abd.6602@gmail.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 2dc1b0d commit 9454714

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/thermal/devfreq_cooling.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,8 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
472472
remove_qos_req:
473473
dev_pm_qos_remove_request(&dfc->req_max_freq);
474474
free_table:
475-
kfree(dfc->freq_table);
475+
if (!dfc->em_pd)
476+
kfree(dfc->freq_table);
476477
free_dfc:
477478
kfree(dfc);
478479

0 commit comments

Comments
 (0)