mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
Thermal: Check trip type in thermal_zone_device_register().
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
@@ -678,6 +678,7 @@ thermal_zone_device_register(FAR const char *name,
|
|||||||
FAR struct thermal_governor_s *gov;
|
FAR struct thermal_governor_s *gov;
|
||||||
FAR struct thermal_zone_device_s *pos;
|
FAR struct thermal_zone_device_s *pos;
|
||||||
FAR struct thermal_zone_device_s *zdev;
|
FAR struct thermal_zone_device_s *zdev;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (!ops || !ops->get_temp)
|
if (!ops || !ops->get_temp)
|
||||||
{
|
{
|
||||||
@@ -685,6 +686,15 @@ thermal_zone_device_register(FAR const char *name,
|
|||||||
return NULL;
|
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);
|
nxmutex_lock(&g_thermal_lock);
|
||||||
|
|
||||||
list_for_every_entry(&g_zone_dev_list, pos,
|
list_for_every_entry(&g_zone_dev_list, pos,
|
||||||
|
|||||||
@@ -69,10 +69,10 @@ enum thermal_trend_e
|
|||||||
|
|
||||||
enum thermal_trip_type_e
|
enum thermal_trip_type_e
|
||||||
{
|
{
|
||||||
THERMAL_COLD,
|
|
||||||
THERMAL_NORMAL,
|
THERMAL_NORMAL,
|
||||||
THERMAL_HOT,
|
THERMAL_HOT,
|
||||||
THERMAL_CRITICAL,
|
THERMAL_CRITICAL,
|
||||||
|
THERMAL_TRIP_TYPE_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct thermal_governor_s
|
struct thermal_governor_s
|
||||||
|
|||||||
Reference in New Issue
Block a user