Skip to content

Commit 87d728f

Browse files
committed
drivers: adc_ad4130|adc_7124: Add ret initialization in *_perform_read()
Add initialization of `ret` to avoid reports of uninitialized variable being returned. This variable normally gets initialized while the loop iterates over channels, but potentially it could be left uninitialized if the loop finished in its first iteration because of no channels to be processed. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
1 parent 8eb075f commit 87d728f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/adc/adc_ad4130.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ static int adc_ad4130_wait_for_conv_ready(const struct device *dev)
822822

823823
static int adc_ad4130_perform_read(const struct device *dev)
824824
{
825-
int ret;
825+
int ret = 0;
826826
struct adc_ad4130_data *data = dev->data;
827827
uint16_t ch_idx = AD4130_INVALID_CHANNEL;
828828
uint16_t prev_ch_idx = AD4130_INVALID_CHANNEL;

drivers/adc/adc_ad7124.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ static int adc_ad7124_get_read_chan_id(const struct device *dev, uint16_t *chan_
11191119

11201120
static int adc_ad7124_perform_read(const struct device *dev)
11211121
{
1122-
int ret;
1122+
int ret = 0;
11231123
struct adc_ad7124_data *data = dev->data;
11241124
uint16_t ch_idx = -1;
11251125
uint16_t prev_ch_idx = -1;

0 commit comments

Comments
 (0)