From d211c6e82435dfa4ae9f4d80bb2ee75930bde5d4 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 25 May 2013 01:41:44 +0800 Subject: 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 Acked-by: anish kumar Signed-off-by: Anton Vorontsov --- drivers/power/generic-adc-battery.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/power') diff --git a/drivers/power/generic-adc-battery.c b/drivers/power/generic-adc-battery.c index 8cb5d7f67ac..59a1421f928 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 -- cgit v1.2.3-18-g5258