Skip to contentSkip to conversation

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

PATCH Applied Fugang Duan 2 participants 2 messages Jul 16, 2015 – Jul 19, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: adc: vf610: fix the adc register read fail issue

Read the register only when the adc register address is 4 byte aligned.

---
 drivers/iio/adc/vf610_adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/vf610_adc.c +1 -1
index 480f335..819632b 100644
@@ -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);
Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw
Quoted 4 lines · Fugang Duan

Read the register only when the adc register address is 4 byte aligned.

Applied to the fixes-togreg branch of iio.git and marked for stable.

Quoted 18 lines
---
 drivers/iio/adc/vf610_adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/vf610_adc.c +1 -1
index 480f335..819632b 100644
@@ -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);