Skip to content

Commit 761fdf4

Browse files
Daniel Lezcanorafaeljw
authored andcommitted
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>
1 parent 49c7db1 commit 761fdf4

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/thermal/thermal_core.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ __thermal_cooling_device_register(struct device_node *np,
10631063
{
10641064
struct thermal_cooling_device *cdev;
10651065
unsigned long current_state;
1066-
int id, ret;
1066+
int ret;
10671067

10681068
if (!ops || !ops->get_max_state || !ops->get_cur_state ||
10691069
!ops->set_cur_state)
@@ -1080,7 +1080,6 @@ __thermal_cooling_device_register(struct device_node *np,
10801080
if (ret < 0)
10811081
goto out_kfree_cdev;
10821082
cdev->id = ret;
1083-
id = ret;
10841083

10851084
cdev->type = kstrdup_const(type ? type : "", GFP_KERNEL);
10861085
if (!cdev->type) {
@@ -1137,7 +1136,7 @@ __thermal_cooling_device_register(struct device_node *np,
11371136
out_cdev_type:
11381137
kfree_const(cdev->type);
11391138
out_ida_remove:
1140-
ida_free(&thermal_cdev_ida, id);
1139+
ida_free(&thermal_cdev_ida, cdev->id);
11411140
out_kfree_cdev:
11421141
kfree(cdev);
11431142
return ERR_PTR(ret);

0 commit comments

Comments
 (0)