summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@oss.qualcomm.com>2026-04-02 10:44:25 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2026-04-04 15:05:18 +0200
commit761fdf4c8c1c0bd8427f8226be3a3eb5cf896386 (patch)
tree9ca33c6c7124fc4c47023bbcf517623bdaddfcc4 /drivers/thermal
parent49c7db1f0b4fbc52435c0f042d95c62a56e9be14 (diff)
thermal/core: Remove pointless variable when registering a cooling device
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> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Link: https://patch.msgid.link/20260402084426.1360086-1-daniel.lezcano@kernel.org Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/thermal_core.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 267594b96832..b6b651cb2331 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1063,7 +1063,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)
@@ -1080,7 +1080,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) {
@@ -1137,7 +1136,7 @@ out_cooling_dev:
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);