Commit 761fdf4c authored by Daniel Lezcano's avatar Daniel Lezcano Committed by Rafael J. Wysocki
Browse files

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: default avatarDaniel Lezcano <daniel.lezcano@oss.qualcomm.com>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@kernel.org>
Reviewed-by: default avatarLukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/20260402084426.1360086-1-daniel.lezcano@kernel.org


Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 49c7db1f
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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 @@ __thermal_cooling_device_register(struct device_node *np,
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);