Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Daniel Lezcano and committed by
Rafael J. Wysocki
761fdf4c 49c7db1f

+2 -3
+2 -3
drivers/thermal/thermal_core.c
··· 1063 1063 { 1064 1064 struct thermal_cooling_device *cdev; 1065 1065 unsigned long current_state; 1066 - int id, ret; 1066 + int ret; 1067 1067 1068 1068 if (!ops || !ops->get_max_state || !ops->get_cur_state || 1069 1069 !ops->set_cur_state) ··· 1080 1080 if (ret < 0) 1081 1081 goto out_kfree_cdev; 1082 1082 cdev->id = ret; 1083 - id = ret; 1084 1083 1085 1084 cdev->type = kstrdup_const(type ? type : "", GFP_KERNEL); 1086 1085 if (!cdev->type) { ··· 1136 1137 out_cdev_type: 1137 1138 kfree_const(cdev->type); 1138 1139 out_ida_remove: 1139 - ida_free(&thermal_cdev_ida, id); 1140 + ida_free(&thermal_cdev_ida, cdev->id); 1140 1141 out_kfree_cdev: 1141 1142 kfree(cdev); 1142 1143 return ERR_PTR(ret);