Commit 30da26ea authored by Kasumov Ruslan's avatar Kasumov Ruslan Committed by Jonathan Cameron

iio: adc: qcom-pm8xxx-xoadc: Remove useless condition in pm8xxx_xoadc_parse_channel()

The left side of the loop condition never becomes false. hwchan cannot be
NULL, because it points to elements of the hw_channels array that takes
one of 4 predefined values: pm8018_xoadc_channels, pm8038_xoadc_channels,
pm8058_xoadc_channels, pm8921_xoadc_channels.

Found by Linux Verification Center (linuxtesting.org) with SVACE.
Reviewed-by: default avatarAndi Shyti <andi.shyti@kernel.org>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarKasumov Ruslan <s02210418@gse.cs.msu.ru>
Link: https://lore.kernel.org/r/20230315135114.22684-1-xhxgldhlpfy@gmail.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 225dc61e
......@@ -758,7 +758,7 @@ static int pm8xxx_xoadc_parse_channel(struct device *dev,
/* Find the right channel setting */
chid = 0;
hwchan = &hw_channels[0];
while (hwchan && hwchan->datasheet_name) {
while (hwchan->datasheet_name) {
if (hwchan->pre_scale_mux == pre_scale_mux &&
hwchan->amux_channel == amux_channel)
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment