mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
Merge tag 'thermal-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull thermal control fix from Rafael Wysocki: "Modify __thermal_cooling_device_register() to make it call put_device() after invoking device_register() and fix up a few error paths calling thermal_cooling_device_destroy_sysfs() unnecessarily (Viresh Kumar)" * tag 'thermal-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: thermal: core: call put_device() only after device_register() fails
This commit is contained in:
@@ -909,15 +909,20 @@ __thermal_cooling_device_register(struct device_node *np,
|
||||
cdev->devdata = devdata;
|
||||
|
||||
ret = cdev->ops->get_max_state(cdev, &cdev->max_state);
|
||||
if (ret)
|
||||
goto out_kfree_type;
|
||||
if (ret) {
|
||||
kfree(cdev->type);
|
||||
goto out_ida_remove;
|
||||
}
|
||||
|
||||
thermal_cooling_device_setup_sysfs(cdev);
|
||||
|
||||
ret = dev_set_name(&cdev->device, "cooling_device%d", cdev->id);
|
||||
if (ret) {
|
||||
kfree(cdev->type);
|
||||
thermal_cooling_device_destroy_sysfs(cdev);
|
||||
goto out_kfree_type;
|
||||
goto out_ida_remove;
|
||||
}
|
||||
|
||||
ret = device_register(&cdev->device);
|
||||
if (ret)
|
||||
goto out_kfree_type;
|
||||
@@ -943,6 +948,8 @@ out_kfree_type:
|
||||
thermal_cooling_device_destroy_sysfs(cdev);
|
||||
kfree(cdev->type);
|
||||
put_device(&cdev->device);
|
||||
|
||||
/* thermal_release() takes care of the rest */
|
||||
cdev = NULL;
|
||||
out_ida_remove:
|
||||
ida_free(&thermal_cdev_ida, id);
|
||||
|
||||
Reference in New Issue
Block a user