[PATCH v1 0/2] driver core/thermal: Fail registration of thermal object when thermal_class is not registered

From: Rafael J. Wysocki
Date: Fri Jan 20 2023 - 14:49:03 EST


Hi All,

If thermal_class is not registered, the whole thermal framework is basically
unusable, because the governors are not there and its sysfs interface is not
present.

In that case it doesn't make sense to register thermal zones and cooling
devices, because they cannot be used as expected anyway, so make it possible
to fail the registration of these things if the registration of thermal_class
has failed.

To that end, make sure that the private pointer of a class is NULL when that
class is not registered with the driver core (patch [1/2]).

Next, make the thermal framework check the value of the thermal_class' private
pointer against NULL and fail the registration of thermal zones and cooling
devices when it is NULL (patch [2/2]).

Thanks!