summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-05-24 21:41:44 +0400
committerAnton Vorontsov <anton@enomsg.org>2013-06-07 04:33:40 +0400
commitd211c6e82435dfa4ae9f4d80bb2ee75930bde5d4 (patch)
tree1bde31258a74078e08d3d814bf56072a6be0cfab /drivers/power
parente08358792422ef0b78d7c81f333fc0803fb41cd4 (diff)
downloadlinux-d211c6e82435dfa4ae9f4d80bb2ee75930bde5d4.tar.xz
generic-adc-battery: Fix checking if none of the channels are supported
If none of the channels are supported, index is 0. Also ensure to return error code instead of 0 in goto second_mem_fail path. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: anish kumar <anish198519851985@gmail.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/generic-adc-battery.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/power/generic-adc-battery.c b/drivers/power/generic-adc-battery.c
index 8cb5d7f67ace..59a1421f9288 100644
--- a/drivers/power/generic-adc-battery.c
+++ b/drivers/power/generic-adc-battery.c
@@ -299,8 +299,10 @@ static int gab_probe(struct platform_device *pdev)
}
/* none of the channels are supported so let's bail out */
- if (index == ARRAY_SIZE(gab_chan_name))
+ if (index == 0) {
+ ret = -ENODEV;
goto second_mem_fail;
+ }
/*
* Total number of properties is equal to static properties