Thermal: Check trip type in thermal_zone_device_register().
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
parent
6442683359
commit
515c3978dd
@ -678,6 +678,7 @@ thermal_zone_device_register(FAR const char *name,
|
||||
FAR struct thermal_governor_s *gov;
|
||||
FAR struct thermal_zone_device_s *pos;
|
||||
FAR struct thermal_zone_device_s *zdev;
|
||||
int i;
|
||||
|
||||
if (!ops || !ops->get_temp)
|
||||
{
|
||||
@ -685,6 +686,15 @@ thermal_zone_device_register(FAR const char *name,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < params->num_trips; i++)
|
||||
{
|
||||
if (params->trips[i].type >= THERMAL_TRIP_TYPE_MAX)
|
||||
{
|
||||
therr("Invalid trip type (%d)!\n", params->trips[i].type);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nxmutex_lock(&g_thermal_lock);
|
||||
|
||||
list_for_every_entry(&g_zone_dev_list, pos,
|
||||
|
@ -69,10 +69,10 @@ enum thermal_trend_e
|
||||
|
||||
enum thermal_trip_type_e
|
||||
{
|
||||
THERMAL_COLD,
|
||||
THERMAL_NORMAL,
|
||||
THERMAL_HOT,
|
||||
THERMAL_CRITICAL,
|
||||
THERMAL_TRIP_TYPE_MAX,
|
||||
};
|
||||
|
||||
struct thermal_governor_s
|
||||
|
Loading…
Reference in New Issue
Block a user