From dc78e71d7c1534293eaf6d17c5ce83e547532cf9 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 10 Mar 2025 15:43:05 -0500 Subject: [PATCH] iio: adc: ad4030: remove some duplicate code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Remove some duplicate code in the ad4030_get_chan_scale() function by simplifying the if statement. Signed-off-by: David Lechner Reviewed-by: Nuno Sá Link: https://patch.msgid.link/20250310-iio-adc-ad4030-check-scan-type-err-v1-2-589e4ebd9711@baylibre.com Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ad4030.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/ad4030.c b/drivers/iio/adc/ad4030.c index af7a817e8273..f24b46164a47 100644 --- a/drivers/iio/adc/ad4030.c +++ b/drivers/iio/adc/ad4030.c @@ -394,14 +394,13 @@ static int ad4030_get_chan_scale(struct iio_dev *indio_dev, if (IS_ERR(scan_type)) return PTR_ERR(scan_type); - if (chan->differential) { + if (chan->differential) *val = (st->vref_uv * 2) / MILLI; - *val2 = scan_type->realbits; - return IIO_VAL_FRACTIONAL_LOG2; - } + else + *val = st->vref_uv / MILLI; - *val = st->vref_uv / MILLI; *val2 = scan_type->realbits; + return IIO_VAL_FRACTIONAL_LOG2; } -- 2.25.1