Commit 54f22a7f authored by Fugang Duan's avatar Fugang Duan Committed by Luis Henriques

iio: adc: vf610: fix the adc register read fail issue

commit bf604a4c upstream.

Read the register only when the adc register address is 4 byte aligned.
(rather than the other way around).
Signed-off-by: default avatarHaibo Chen <haibo.chen@freescale.com>
Signed-off-by: default avatarFugang Duan <B38611@freescale.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent be5d25c9
...@@ -555,7 +555,7 @@ static int vf610_adc_reg_access(struct iio_dev *indio_dev, ...@@ -555,7 +555,7 @@ static int vf610_adc_reg_access(struct iio_dev *indio_dev,
struct vf610_adc *info = iio_priv(indio_dev); struct vf610_adc *info = iio_priv(indio_dev);
if ((readval == NULL) || if ((readval == NULL) ||
(!(reg % 4) || (reg > VF610_REG_ADC_PCTL))) ((reg % 4) || (reg > VF610_REG_ADC_PCTL)))
return -EINVAL; return -EINVAL;
*readval = readl(info->regs + reg); *readval = readl(info->regs + reg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment