Linux Power Management development
 help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: Anas Iqbal <mohd.abd.6602@gmail.com>
Cc: rui.zhang@intel.com, daniel.lezcano@kernel.org,
	linux-pm@vger.kernel.org, rafael@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] thermal: devfreq_cooling: avoid unnecessary kfree of freq_table
Date: Mon, 23 Mar 2026 10:44:09 +0000	[thread overview]
Message-ID: <d46ef894-ff62-4493-bd17-660004640eca@arm.com> (raw)
In-Reply-To: <20260323094018.2264-1-mohd.abd.6602@gmail.com>



On 3/23/26 09:40, Anas Iqbal wrote:
> 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>
> ---
>   drivers/thermal/devfreq_cooling.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c
> index 597e86d16a4e..1c7dffc8d45f 100644
> --- a/drivers/thermal/devfreq_cooling.c
> +++ b/drivers/thermal/devfreq_cooling.c
> @@ -472,7 +472,8 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
>   remove_qos_req:
>   	dev_pm_qos_remove_request(&dfc->req_max_freq);
>   free_table:
> -	kfree(dfc->freq_table);
> +	if (!dfc->em_pd)
> +		kfree(dfc->freq_table);
>   free_dfc:
>   	kfree(dfc);
>   

LGTM, let's calm down that warning.

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

  reply	other threads:[~2026-03-23 10:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23  9:40 [PATCH] thermal: devfreq_cooling: avoid unnecessary kfree of freq_table Anas Iqbal
2026-03-23 10:44 ` Lukasz Luba [this message]
2026-03-23 13:52   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d46ef894-ff62-4493-bd17-660004640eca@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=daniel.lezcano@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mohd.abd.6602@gmail.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox