From: Daniel Lezcano Date: Thu, 2 Apr 2026 08:44:25 +0000 (+0200) Subject: thermal/core: Remove pointless variable when registering a cooling device X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=761fdf4c8c1c0bd8427f8226be3a3eb5cf896386;p=thirdparty%2Fkernel%2Fstable.git 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 Signed-off-by: Daniel Lezcano Reviewed-by: Lukasz Luba Link: https://patch.msgid.link/20260402084426.1360086-1-daniel.lezcano@kernel.org Signed-off-by: Rafael J. Wysocki --- 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);