iio: dac: ad5380: fix incorrect assignment to val
authorColin Ian King <colin.king@canonical.com>
Thu, 15 Aug 2019 11:58:46 +0000 (12:58 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jan 2020 13:51:09 +0000 (14:51 +0100)
[ Upstream commit b1e18768ef1214c0a8048327918a182cabe09f9d ]

Currently the pointer val is being incorrectly incremented
instead of the value pointed to by val. Fix this by adding
in the missing * indirection operator.

Addresses-Coverity: ("Unused value")
Fixes: c03f2c536818 ("staging:iio:dac: Add AD5380 driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/dac/ad5380.c

index 873c2bf..617c9f7 100644 (file)
@@ -221,7 +221,7 @@ static int ad5380_read_raw(struct iio_dev *indio_dev,
                if (ret)
                        return ret;
                *val >>= chan->scan_type.shift;
-               val -= (1 << chan->scan_type.realbits) / 2;
+               *val -= (1 << chan->scan_type.realbits) / 2;
                return IIO_VAL_INT;
        case IIO_CHAN_INFO_SCALE:
                *val = 2 * st->vref;