1
0
Fork 0

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>
hifive-unleashed-5.1
Axel Lin 2013-05-25 01:41:44 +08:00 committed by Anton Vorontsov
parent e083587924
commit d211c6e824
1 changed files with 3 additions and 1 deletions

View File

@ -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