All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: qcom-pm8xxx-xoadc: Remove useless condition in pm8xxx_xoadc_parse_channel()
@ 2023-03-14 19:37 Kasumov Ruslan
  2023-03-14 20:42 ` Andi Shyti
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Kasumov Ruslan @ 2023-03-14 19:37 UTC (permalink / raw)
  To: Andy Gross
  Cc: Bjorn Andersson, Konrad Dybcio, Jonathan Cameron,
	Lars-Peter Clausen, Linus Walleij, linux-arm-msm, linux-iio,
	linux-kernel, lvc-project, Kasumov Ruslan

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.

Fixes: 63c3ecd946d4 ("iio: adc: add a driver for Qualcomm PM8xxx HK/XOADC")
Signed-off-by: Kasumov Ruslan <s02210418@gse.cs.msu.ru>
---
 drivers/iio/adc/qcom-pm8xxx-xoadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
index eb424496ee1d..64a3aeb6261c 100644
--- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c
+++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-03-18 15:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14 19:37 [PATCH] iio: adc: qcom-pm8xxx-xoadc: Remove useless condition in pm8xxx_xoadc_parse_channel() Kasumov Ruslan
2023-03-14 20:42 ` Andi Shyti
2023-03-14 21:12 ` Linus Walleij
2023-03-14 21:28   ` Andi Shyti
2023-03-14 22:03     ` [lvc-project] " Alexey Khoroshilov
2023-03-14 22:07       ` Linus Walleij
2023-03-14 22:41         ` Andi Shyti
2023-03-14 22:04   ` Linus Walleij
2023-03-14 22:16 ` Linus Walleij
2023-03-15 13:51 ` [PATCH v2] " Kasumov Ruslan
2023-03-18 15:48   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.