Be stricter about warnings

Test: build for several platforms
Change-Id: I8d66a74c72713f3cd7021b1924f72ea4a9e11c15
diff --git a/modules/audio/Android.bp b/modules/audio/Android.bp
index 02da2b3..69e99f9 100644
--- a/modules/audio/Android.bp
+++ b/modules/audio/Android.bp
@@ -26,7 +26,7 @@
         "liblog",
         "libcutils",
     ],
-    cflags: ["-Wno-unused-parameter"],
+    cflags: ["-Wall", "-Werror", "-Wno-unused-parameter"],
 }
 
 // The stub audio HAL module, identical to the default audio hal, but with
@@ -43,7 +43,7 @@
         "liblog",
         "libcutils",
     ],
-    cflags: ["-Wno-unused-parameter"],
+    cflags: ["-Wall", "-Werror", "-Wno-unused-parameter"],
 }
 
 // The stub audio policy HAL module that can be used as a skeleton for
@@ -56,5 +56,5 @@
         "liblog",
         "libcutils",
     ],
-    cflags: ["-Wno-unused-parameter"],
+    cflags: ["-Wall", "-Werror", "-Wno-unused-parameter"],
 }
diff --git a/modules/audio/audio_hw.c b/modules/audio/audio_hw.c
index 35901e4..55a5c3b 100644
--- a/modules/audio/audio_hw.c
+++ b/modules/audio/audio_hw.c
@@ -297,11 +297,9 @@
 {
     ALOGV("adev_open_output_stream...");
 
-    struct stub_audio_device *ladev = (struct stub_audio_device *)dev;
-    struct stub_stream_out *out;
-    int ret;
-
-    out = (struct stub_stream_out *)calloc(1, sizeof(struct stub_stream_out));
+    *stream_out = NULL;
+    struct stub_stream_out *out =
+            (struct stub_stream_out *)calloc(1, sizeof(struct stub_stream_out));
     if (!out)
         return -ENOMEM;
 
@@ -325,11 +323,6 @@
 
     *stream_out = &out->stream;
     return 0;
-
-err_open:
-    free(out);
-    *stream_out = NULL;
-    return ret;
 }
 
 static void adev_close_output_stream(struct audio_hw_device *dev,
@@ -424,11 +417,8 @@
 {
     ALOGV("adev_open_input_stream...");
 
-    struct stub_audio_device *ladev = (struct stub_audio_device *)dev;
-    struct stub_stream_in *in;
-    int ret;
-
-    in = (struct stub_stream_in *)calloc(1, sizeof(struct stub_stream_in));
+    *stream_in = NULL;
+    struct stub_stream_in *in = (struct stub_stream_in *)calloc(1, sizeof(struct stub_stream_in));
     if (!in)
         return -ENOMEM;
 
@@ -450,11 +440,6 @@
 
     *stream_in = &in->stream;
     return 0;
-
-err_open:
-    free(in);
-    *stream_in = NULL;
-    return ret;
 }
 
 static void adev_close_input_stream(struct audio_hw_device *dev,
@@ -483,7 +468,6 @@
     ALOGV("adev_open: %s", name);
 
     struct stub_audio_device *adev;
-    int ret;
 
     if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0)
         return -EINVAL;
diff --git a/modules/audio/audio_policy.c b/modules/audio/audio_policy.c
index 9335654..4f9cd5a 100644
--- a/modules/audio/audio_policy.c
+++ b/modules/audio/audio_policy.c
@@ -241,9 +241,7 @@
                              void *service,
                              struct audio_policy **ap)
 {
-    struct default_ap_device *dev;
     struct default_audio_policy *dap;
-    int ret;
 
     *ap = NULL;