[lkml]   [2018]   [Aug]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH V5] thermal: Add cooling device's statistics in sysfs
On 13 August 2018 at 21:36, Dmitry Osipenko <> wrote:

> I'm working on adding support of OPP and cooling for NVIDIA Tegra20/30 CPUFreq driver and stumbled upon a bug that is introduced by this patch. It is triggered on the driver module unload.

The problem is that device_unregister() will end up freeing the cdev as well, so
the current sequence is surely wrong.

> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index 6ab982309e6a..de53c821a282 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -1102,8 +1102,8 @@ void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev)
> mutex_unlock(&thermal_list_lock);
> ida_simple_remove(&thermal_cdev_ida, cdev->id);
> - device_unregister(&cdev->device);
> thermal_cooling_device_destroy_sysfs(cdev);
> + device_unregister(&cdev->device);

But this looks wrong as well, as the device is still around while
memory of its sysfs data is gone.

Maybe something like this is what we need:



 \ /
  Last update: 2018-08-13 18:22    [W:0.055 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site