Fix sensors/hyt271.c:811:16: error: 'data.data' may be used uninitialized [-Werror=maybe-uninitialized]
@@ -782,11 +782,11 @@ static int hyt271_thread(int argc, char** argv)
{
FAR struct hyt271_dev_s *priv = (FAR struct hyt271_dev_s *)
((uintptr_t)strtoul(argv[1], NULL, 0));
+ uint32_t orawdata = 0;
while (true)
{
int ret;
- uint32_t orawdata;
struct hyt271_sensor_data_s data;
struct hyt271_sensor_s *hsensor = &priv->sensor[HYT271_SENSOR_HUMI];
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);
-
if (!ret)
{
/* Notify upper */
@@ -838,6 +833,10 @@ static int hyt271_thread(int argc, char** argv)
{
priv->initial_read = true;
}
+
+ /* Store the last sensor data for later comparison */
+
+ orawdata = data.data;
}
/* Sleeping thread before fetching the next sensor data */
