* [bug report] iio: adc: ad7124: change setup reg allocation strategy
@ 2025-10-22 11:04 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2025-10-22 11:04 UTC (permalink / raw)
To: David Lechner; +Cc: linux-iio
Hello David Lechner,
Commit 9065197e0d41 ("iio: adc: ad7124: change setup reg allocation
strategy") from Sep 23, 2025 (linux-next), leads to the following
Smatch static checker warning:
drivers/iio/adc/ad7124.c:595 ad7124_release_config_slot()
warn: potential bounds check after use 'channel'
drivers/iio/adc/ad7124.c
587 static void ad7124_release_config_slot(struct ad7124_state *st, u8 channel)
588 {
589 unsigned int slot = st->channels[channel].cfg.cfg_slot;
^^^^^^^^^^^^^^^^^^^^^
590
591 /*
592 * All of these conditions can happen at probe when all channels are
593 * disabled. Otherwise, they should not happen normally.
594 */
--> 595 if (channel >= st->num_channels || slot == AD7124_CFG_SLOT_UNASSIGNED ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
If channel is invalid then we would already have read from out of bounds.
596 st->cfg_slot_use_count[slot] == 0)
597 return;
598
599 st->cfg_slot_use_count[slot]--;
600 st->channels[channel].cfg.cfg_slot = AD7124_CFG_SLOT_UNASSIGNED;
601 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-22 11:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22 11:04 [bug report] iio: adc: ad7124: change setup reg allocation strategy Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).