Skip to content

Commit b27cc6d

Browse files
committed
iio: adc: ad4630: Fix possible use of uninitialized variable
Previously, due to return 0 after goto jump, '*val = temp;' could execute with temp uninitialized if regmap_read() failed in ad4630_get_avg_frame_len(). Prevent that by returning the actual error code if regmap_read() fails in ad4630_get_avg_frame_len(). Suggested-by: Jorge Marques <[email protected]> Fixes: 5bc31c5 ("iio: adc: ad4630: Use oversampling iio attribute for average mode") Signed-off-by: Marcelo Schmitt <[email protected]>
1 parent b903e79 commit b27cc6d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iio/adc/ad4630.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static int ad4630_get_avg_frame_len(struct iio_dev *dev, unsigned int *avg_len)
339339
out:
340340
iio_device_release_direct_mode(dev);
341341

342-
return 0;
342+
return ret;
343343
}
344344

345345
static int ad4630_read_raw(struct iio_dev *indio_dev,

0 commit comments

Comments
 (0)