Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: ad_sigma_delta: Fix use of uninitialized status_pos

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>

authored by

Purva Yeshi and committed by
Jonathan Cameron
e5cdb098 b1c5d68e

+4
+4
drivers/iio/adc/ad_sigma_delta.c
··· 587 587 * byte set to zero. */ 588 588 ad_sd_read_reg_raw(sigma_delta, data_reg, transfer_size, &data[1]); 589 589 break; 590 + 591 + default: 592 + dev_err_ratelimited(&indio_dev->dev, "Unsupported reg_size: %u\n", reg_size); 593 + goto irq_handled; 590 594 } 591 595 592 596 /*