OSDN Git Service

Fix build warnings
authorRob Herring <robh@kernel.org>
Wed, 29 Nov 2017 17:41:05 +0000 (11:41 -0600)
committerRob Herring <robh@kernel.org>
Wed, 29 Nov 2017 17:41:05 +0000 (11:41 -0600)
AOSP now builds with -Werror, so the build needs to be warning free.

Signed-off-by: Rob Herring <robh@kernel.org>
Android.mk
control.c
description.c
enumeration.c
transform.c
utils.c

index a1148fc..11b5b6e 100644 (file)
@@ -40,7 +40,7 @@ endif
 LOCAL_MODULE_OWNER := intel
 LOCAL_MODULE_RELATIVE_PATH := hw
 LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -DLOG_TAG=\"Sensors\" -fvisibility=hidden
+LOCAL_CFLAGS := -DLOG_TAG=\"Sensors\" -fvisibility=hidden -Wno-missing-field-initializers
 ifeq ($(NO_IIO_EVENTS),true)
 LOCAL_CFLAGS += -D__NO_EVENTS__
 endif
index 843e7b5..b366917 100644 (file)
--- a/control.c
+++ b/control.c
@@ -757,7 +757,6 @@ static float select_closest_available_rate(int s, float requested_rate)
        int j;
        float selected_rate = 0;
        float max_rate_from_prop = sensor_get_max_freq(s);
-       int dev_num = sensor[s].dev_num;
 
        if (!sensor[s].avail_freqs_count)
                return requested_rate;
index e001671..685b7eb 100644 (file)
@@ -660,7 +660,7 @@ static int get_cdd_freq (int s, int must)
  */
 max_delay_t sensor_get_max_delay (int s)
 {
-       int dev_num = sensor[s].dev_num, i;
+       int i;
        float min_supported_rate;
        float rate_cap;
 
@@ -738,7 +738,7 @@ float sensor_get_max_static_freq(int s)
 
 int32_t sensor_get_min_delay (int s)
 {
-       int dev_num = sensor[s].dev_num, i;
+       int i;
        float max_supported_rate = 0;
        float max_from_prop = sensor_get_max_freq(s);
 
index c43ec83..f4f2afe 100644 (file)
@@ -446,7 +446,7 @@ static void populate_descriptors (int s, int sensor_type)
        sensor_desc[s].minDelay = sensor_get_min_delay(s);
        sensor_desc[s].maxDelay = sensor_get_max_delay(s);
 
-       ALOGV("Sensor %d (%s) type(%d) minD(%d) maxD(%d) flags(%2.2x)\n",
+       ALOGV("Sensor %d (%s) type(%d) minD(%d) maxD(%zd) flags(%2.2zx)\n",
                s, sensor[s].friendly_name, sensor_desc[s].type,
                sensor_desc[s].minDelay, sensor_desc[s].maxDelay,
                sensor_desc[s].flags);
index 38c24d2..1b688d3 100644 (file)
@@ -598,7 +598,6 @@ uint64_t acquire_immediate_uint64_value (int s, int c)
        const char* input_path = sensor_catalog[i].channel[c].input_path;
        float scale = sensor[s].scale ? sensor[s].scale : sensor[s].channel[c].scale;
        float offset = sensor[s].offset;
-       int sensor_type = sensor_catalog[i].type;
        float correction;
 
        /* In case correction has been requested using properties, apply it */
diff --git a/utils.c b/utils.c
index 39e735e..688be53 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -202,7 +202,7 @@ int sysfs_read_str(const char path[PATH_MAX], char *buf, int buf_len)
 
 int64_t get_timestamp (clockid_t clock_id)
 {
-       struct timespec ts = {0};
+       struct timespec ts = {0, 0};
 
        if (!clock_gettime(clock_id, &ts))
                return 1000000000LL * ts.tv_sec + ts.tv_nsec;