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.

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

+10 -3
+10 -3
drivers/thermal/thermal_core.c
··· 909 909 cdev->devdata = devdata; 910 910 911 911 ret = cdev->ops->get_max_state(cdev, &cdev->max_state); 912 - if (ret) 913 - goto out_kfree_type; 912 + if (ret) { 913 + kfree(cdev->type); 914 + goto out_ida_remove; 915 + } 914 916 915 917 thermal_cooling_device_setup_sysfs(cdev); 918 + 916 919 ret = dev_set_name(&cdev->device, "cooling_device%d", cdev->id); 917 920 if (ret) { 921 + kfree(cdev->type); 918 922 thermal_cooling_device_destroy_sysfs(cdev); 919 - goto out_kfree_type; 923 + goto out_ida_remove; 920 924 } 925 + 921 926 ret = device_register(&cdev->device); 922 927 if (ret) 923 928 goto out_kfree_type; ··· 948 943 thermal_cooling_device_destroy_sysfs(cdev); 949 944 kfree(cdev->type); 950 945 put_device(&cdev->device); 946 + 947 + /* thermal_release() takes care of the rest */ 951 948 cdev = NULL; 952 949 out_ida_remove: 953 950 ida_free(&thermal_cdev_ida, id);