da9052-battery: Fix da9052_determine_vc_tbl_index's return value
authorAnton Vorontsov <anton.vorontsov@linaro.org>
Thu, 23 Aug 2012 02:29:44 +0000 (19:29 -0700)
committerAnton Vorontsov <anton.vorontsov@linaro.org>
Thu, 23 Aug 2012 02:31:42 +0000 (19:31 -0700)
The patch fixes the following warnings:

  CHECK   drivers/power/da9052-battery.c
drivers/power/da9052-battery.c:330:15: warning: symbol 'da9052_determine_vc_tbl_index' was not declared. Should it be static?
  CC      drivers/power/da9052-battery.o
drivers/power/da9052-battery.c: In function 'da9052_determine_vc_tbl_index':
drivers/power/da9052-battery.c:348:1: warning: control reaches end of non-void function [-Wreturn-type]

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
drivers/power/da9052-battery.c

index a5f6a0ec15726b8e93180ea51b1a4facde4474a5..20b86ed946e3eb2c71f410d0288b3547cf12edee 100644 (file)
@@ -327,7 +327,7 @@ static int da9052_bat_interpolate(int vbat_lower, int  vbat_upper,
        return tmp;
 }
 
-unsigned char da9052_determine_vc_tbl_index(unsigned char adc_temp)
+static unsigned char da9052_determine_vc_tbl_index(unsigned char adc_temp)
 {
        int i;
 
@@ -345,6 +345,13 @@ unsigned char da9052_determine_vc_tbl_index(unsigned char adc_temp)
                     && (adc_temp <= vc_tbl_ref[i]))
                                return i + 1;
        }
+       /*
+        * For some reason authors of the driver didn't presume that we can
+        * end up here. It might be OK, but might be not, no one knows for
+        * sure. Go check your battery, is it on fire?
+        */
+       WARN_ON(1);
+       return 0;
 }
 
 static int da9052_bat_read_capacity(struct da9052_battery *bat, int *capacity)