diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2023-01-23 21:44:03 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2023-01-25 16:51:19 +0100 |
commit | 9e0a9be24bdd61a160631227ee995b579be566a5 (patch) | |
tree | f50e89f0baff57015e23a4e0af154bfb254b5abe /virt | |
parent | 5b8de18ee9027c647db4c1905f7fd0550d17d67a (diff) | |
download | linux-9e0a9be24bdd61a160631227ee995b579be566a5.tar.gz linux-9e0a9be24bdd61a160631227ee995b579be566a5.tar.bz2 linux-9e0a9be24bdd61a160631227ee995b579be566a5.zip |
thermal: Fail object registration if thermal class is not registered
If thermal_class is not registered with the driver core, there is no way
to expose the interfaces used by the thermal control framework, so
prevent thermal zones and cooling devices from being registered in
that case by returning an error from object registration functions.
For this purpose, use a thermal_class pointer that will be NULL if the
class is not registered. To avoid wasting memory in that case, allocate
the thermal class object dynamically and if it fails to register, free
it and clear the thermal_class pointer to NULL.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'virt')
0 files changed, 0 insertions, 0 deletions