]> git.karo-electronics.de Git - linux-beck.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)
committerJonathan Cameron <jic23@kernel.org>
Sun, 19 Jul 2015 12:35:26 +0000 (13:35 +0100)
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>
Cc: <Stable.vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/adc/vf610_adc.c

index 480f335a0f9faee31bc6b2ac14f7899f18d6c9be..819632bf1fda7fee8fddd2acb3c02d9ff112b1ff 100644 (file)
@@ -635,7 +635,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);