mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-03 21:45:08 -04:00
iio: adc: ad7768-1: Move setting of val a bit later to avoid unnecessary return value check
The data used is all in local variables so there is no advantage in setting *val = ret with the direct mode claim held. Move it later to after error check. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-13-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
@@ -370,12 +370,11 @@ static int ad7768_read_raw(struct iio_dev *indio_dev,
|
||||
return ret;
|
||||
|
||||
ret = ad7768_scan_direct(indio_dev);
|
||||
if (ret >= 0)
|
||||
*val = ret;
|
||||
|
||||
iio_device_release_direct_mode(indio_dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
*val = ret;
|
||||
|
||||
return IIO_VAL_INT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user