]> git.baikalelectronics.ru Git - kernel.git/commit
iio: adc: Fix incorrect exit of for-loop
authorColin Ian King <colin.king@canonical.com>
Fri, 30 Jul 2021 07:16:51 +0000 (08:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Aug 2021 06:56:56 +0000 (08:56 +0200)
commitfc8c2a5c800a73762e3ecad97a6978b05db7e701
tree38c84ae3cf61f9983ea508f886dd31abfcc0c01d
parent69f6b2b0cd0798ab2e62fd2ce07dc997efb5ec78
iio: adc: Fix incorrect exit of for-loop

commit 5afc1540f13804a31bb704b763308e17688369c5 upstream.

Currently the for-loop that scans for the optimial adc_period iterates
through all the possible adc_period levels because the exit logic in
the loop is inverted. I believe the comparison should be swapped and
the continue replaced with a break to exit the loop at the correct
point.

Addresses-Coverity: ("Continue has no effect")
Fixes: cd27d90e925d ("iio:adc: add iio driver for Palmas (twl6035/7) gpadc")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210730071651.17394-1-colin.king@canonical.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/adc/palmas_gpadc.c