]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
thermal/core: Remove pointless variable when registering a cooling device
authorDaniel Lezcano <daniel.lezcano@oss.qualcomm.com>
Thu, 2 Apr 2026 08:44:25 +0000 (10:44 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 4 Apr 2026 13:05:18 +0000 (15:05 +0200)
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>
drivers/thermal/thermal_core.c

index 267594b9683251829f6e40ef17504ca9e45677d4..b6b651cb233173ba520a8462382c096183b5bbd6 100644 (file)
@@ -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);