Skip to content

Commit 1db9b37

Browse files
committed
iio: adc: cf_axi_adc_core: relax check in register access
With commit c5a5970 ("iio: adc: cf_axi_adc_core: use devm_jesd204_fsm_start()"), we started to use devm_platform_ioremap_resource() which means 'regs_size' will stay unchanged during probe and will be 0. Thus, checking the register to fit the mapped area will fail in the debugfs interface. Hence, relax that check and only check for proper alignment. While checking if the register fits the mapped area would be a nice thing, this is a debug interface and users are expected to know what they are doing. Hence I prefer to have simplicity during probe and not to keep 'regs_size' only to be used in the debugfs interface. Fixes: c5a5970 ("iio: adc: cf_axi_adc_core: use devm_jesd204_fsm_start()") Signed-off-by: Nuno Sa <nuno.sa@analog.com>
1 parent c7fe871 commit 1db9b37

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/iio/adc/cf_axi_adc_core.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ struct axiadc_state {
4949
struct clk *clk;
5050
struct gpio_desc *gpio_decimation;
5151
struct jesd204_dev *jdev;
52-
size_t regs_size;
5352
void __iomem *regs;
5453
void __iomem *slave_regs;
5554
unsigned int max_usr_channel;
@@ -234,9 +233,8 @@ static int axiadc_reg_access(struct iio_dev *indio_dev,
234233
struct axiadc_converter *conv = to_converter(st->dev_spi);
235234
int ret;
236235

237-
/* Check that the register is in range and aligned */
238-
if ((reg & DEBUGFS_DRA_PCORE_REG_MAGIC) &&
239-
((reg & 0xffff) >= st->regs_size || (reg & 0x3)))
236+
/* Check that the register is aligned */
237+
if ((reg & DEBUGFS_DRA_PCORE_REG_MAGIC) && (reg & 0x3))
240238
return -EINVAL;
241239

242240
mutex_lock(&conv->lock);

0 commit comments

Comments
 (0)