]> git.baikalelectronics.ru Git - kernel.git/commit
generic-adc-battery: Fix forever loop in gab_remove()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 14 Feb 2013 07:26:43 +0000 (10:26 +0300)
committerAnton Vorontsov <anton@enomsg.org>
Sat, 16 Feb 2013 21:27:09 +0000 (13:27 -0800)
commitc869f4d3534fa446da241b156d9798f2ef39881c
treee4c8079771c59852d2bc4fa6752096012d385572
parent91c77e382678290557dc536d7f6b2d9eb80db9a7
generic-adc-battery: Fix forever loop in gab_remove()

There is a forever loop calling iio_channel_release() because the
"chan < " part of the "chan < ARRAY_SIZE()" is missing.  This is in both
the error handling on probe and also in the remove function.

The other thing is that it's possible for some of the elements of the
adc_bat->channel[chan] array to be an ERR_PTR().  I've changed them to be
NULL instead.  We're still not allowed to pass NULLs to
iio_channel_release() so I've added a check.

Finally, I removed an unused "chan = ARRAY_SIZE(gab_chan_name);" statement
as a small cleanup.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
drivers/power/generic-adc-battery.c