Fix sensors/hyt271.c:811:16: error: 'data.data' may be used uninitialized [-Werror=maybe-uninitialized]

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-10-22 21:28:38 +08:00 committed by Petro Karashchenko
parent 85deafd7bf
commit e91e144fb6
1 changed files with 5 additions and 6 deletions

View File

@ -782,11 +782,11 @@ static int hyt271_thread(int argc, char** argv)
{ {
FAR struct hyt271_dev_s *priv = (FAR struct hyt271_dev_s *) FAR struct hyt271_dev_s *priv = (FAR struct hyt271_dev_s *)
((uintptr_t)strtoul(argv[1], NULL, 0)); ((uintptr_t)strtoul(argv[1], NULL, 0));
uint32_t orawdata = 0;
while (true) while (true)
{ {
int ret; int ret;
uint32_t orawdata;
struct hyt271_sensor_data_s data; struct hyt271_sensor_data_s data;
struct hyt271_sensor_s *hsensor = &priv->sensor[HYT271_SENSOR_HUMI]; struct hyt271_sensor_s *hsensor = &priv->sensor[HYT271_SENSOR_HUMI];
struct hyt271_sensor_s *tsensor = &priv->sensor[HYT271_SENSOR_TEMP]; struct hyt271_sensor_s *tsensor = &priv->sensor[HYT271_SENSOR_TEMP];
@ -806,12 +806,7 @@ static int hyt271_thread(int argc, char** argv)
} }
} }
/* Store the last sensor data for later comparison */
orawdata = data.data;
ret = hyt271_measure_read(priv, &data); ret = hyt271_measure_read(priv, &data);
if (!ret) if (!ret)
{ {
/* Notify upper */ /* Notify upper */
@ -838,6 +833,10 @@ static int hyt271_thread(int argc, char** argv)
{ {
priv->initial_read = true; priv->initial_read = true;
} }
/* Store the last sensor data for later comparison */
orawdata = data.data;
} }
/* Sleeping thread before fetching the next sensor data */ /* Sleeping thread before fetching the next sensor data */