drivers/thermal/thermal_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
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);
--
2.43.0
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>
On Thu, Apr 2, 2026 at 1:03 PM Lukasz Luba <lukasz.luba@arm.com> wrote:
>
>
>
> 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>
Applied as 7.1 material, thanks!
© 2016 - 2026 Red Hat, Inc.