]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: adc: vf610: fix the adc register read fail issue
authorFugang Duan <b38611@freescale.com>
Thu, 16 Jul 2015 06:49:09 +0000 (14:49 +0800)
committerLuis Henriques <luis.henriques@canonical.com>
Tue, 11 Aug 2015 08:57:35 +0000 (09:57 +0100)
commit bf604a4c44a91cc2ceb60d4643a091b6b32cc999 upstream.

Read the register only when the adc register address is 4 byte aligned.
(rather than the other way around).

Signed-off-by: Haibo Chen <haibo.chen@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/iio/adc/vf610_adc.c

index 11048473b89eb033605c80327bd98afc35e85536..0062d0e71d03f97786c5f0fe0cb42d9f12a58ef1 100644 (file)
@@ -555,7 +555,7 @@ static int vf610_adc_reg_access(struct iio_dev *indio_dev,
        struct vf610_adc *info = iio_priv(indio_dev);
 
        if ((readval == NULL) ||
-               (!(reg % 4) || (reg > VF610_REG_ADC_PCTL)))
+               ((reg % 4) || (reg > VF610_REG_ADC_PCTL)))
                return -EINVAL;
 
        *readval = readl(info->regs + reg);