]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: adc: ad_sigma_delta: Fix use of uninitialized status_pos
authorPurva Yeshi <purvayeshi550@gmail.com>
Thu, 10 Apr 2025 17:04:08 +0000 (22:34 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 6 Jul 2025 08:57:55 +0000 (10:57 +0200)
commitec80ee6ec20c752fd6e981ae53d3863c0c9f1581
treeeb39c7718582cdfdd4fc8d60bd6478897979bcc4
parent1ac826cebc2776f91569f2aa9c9c3da2375d2096
iio: adc: ad_sigma_delta: Fix use of uninitialized status_pos

[ Upstream commit e5cdb098a3cb165d52282ffc3a6448642953ea13 ]

Fix Smatch-detected issue:
drivers/iio/adc/ad_sigma_delta.c:604 ad_sd_trigger_handler() error:
uninitialized symbol 'status_pos'.

The variable `status_pos` was only initialized in specific switch cases
(1, 2, 3, 4), which could leave it uninitialized if `reg_size` had an
unexpected value.

Fix by adding a default case to the switch block to catch unexpected
values of `reg_size`. Use `dev_err_ratelimited()` for error logging and
`goto irq_handled` instead of returning early.

Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
Link: https://patch.msgid.link/20250410170408.8585-1-purvayeshi550@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/adc/ad_sigma_delta.c