int *val)
 {
        struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
+       struct device *dev = indio_dev->dev.parent;
        int regval, fifo_chan, fifo_val, count;
 
        if (!wait_for_completion_timeout(&priv->done,
 
        count = meson_sar_adc_get_fifo_count(indio_dev);
        if (count != 1) {
-               dev_err(&indio_dev->dev,
-                       "ADC FIFO has %d element(s) instead of one\n", count);
+               dev_err(dev, "ADC FIFO has %d element(s) instead of one\n", count);
                return -EINVAL;
        }
 
        regmap_read(priv->regmap, MESON_SAR_ADC_FIFO_RD, ®val);
        fifo_chan = FIELD_GET(MESON_SAR_ADC_FIFO_RD_CHAN_ID_MASK, regval);
        if (fifo_chan != chan->address) {
-               dev_err(&indio_dev->dev,
-                       "ADC FIFO entry belongs to channel %d instead of %lu\n",
+               dev_err(dev, "ADC FIFO entry belongs to channel %d instead of %lu\n",
                        fifo_chan, chan->address);
                return -EINVAL;
        }