public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: Daniel Lezcano <daniel.lezcano@kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>,
	rafael@kernel.org, Zhang Rui <rui.zhang@intel.com>,
	"open list:THERMAL" <linux-pm@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] thermal/core: Remove pointless variable when registering a cooling device
Date: Thu, 2 Apr 2026 12:03:23 +0100	[thread overview]
Message-ID: <bdd8684b-9ce8-4c7a-b27c-a2d67b29367c@arm.com> (raw)
In-Reply-To: <20260402084426.1360086-1-daniel.lezcano@kernel.org>



On 4/2/26 09:44, Daniel Lezcano wrote:
> From: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
> 
> The 'id' variable is set to store the ida_alloc() value which is
> already stored into cdev->id. It is pointless to use it because
> cdev->id can be used instead.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
> ---
>   drivers/thermal/thermal_core.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index b7d706ed7ed9..02ce58223f9f 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -1061,7 +1061,7 @@ __thermal_cooling_device_register(struct device_node *np,
>   {
>   	struct thermal_cooling_device *cdev;
>   	unsigned long current_state;
> -	int id, ret;
> +	int ret;
>   
>   	if (!ops || !ops->get_max_state || !ops->get_cur_state ||
>   	    !ops->set_cur_state)
> @@ -1078,7 +1078,6 @@ __thermal_cooling_device_register(struct device_node *np,
>   	if (ret < 0)
>   		goto out_kfree_cdev;
>   	cdev->id = ret;
> -	id = ret;
>   
>   	cdev->type = kstrdup_const(type ? type : "", GFP_KERNEL);
>   	if (!cdev->type) {
> @@ -1135,7 +1134,7 @@ __thermal_cooling_device_register(struct device_node *np,
>   out_cdev_type:
>   	kfree_const(cdev->type);
>   out_ida_remove:
> -	ida_free(&thermal_cdev_ida, id);
> +	ida_free(&thermal_cdev_ida, cdev->id);
>   out_kfree_cdev:
>   	kfree(cdev);
>   	return ERR_PTR(ret);


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

  reply	other threads:[~2026-04-02 11:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02  8:44 [PATCH] thermal/core: Remove pointless variable when registering a cooling device Daniel Lezcano
2026-04-02 11:03 ` Lukasz Luba [this message]
2026-04-04 13:07   ` 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=bdd8684b-9ce8-4c7a-b27c-a2d67b29367c@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=daniel.lezcano@kernel.org \
    --cc=daniel.lezcano@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --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