Should've tested the devinfo first, before sending it out.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 drivers/aiodev/imx7d_adc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/aiodev/imx7d_adc.c b/drivers/aiodev/imx7d_adc.c
index 9820aaff1ac4..d35216aac421 100644
--- a/drivers/aiodev/imx7d_adc.c
+++ b/drivers/aiodev/imx7d_adc.c
@@ -383,7 +383,7 @@ static u32 imx7d_adc_get_sample_rate(struct imx7d_adc *info)
 
 static void imx7d_adc_devinfo(struct device_d *dev)
 {
-       struct imx7d_adc *info = dev->priv;
+       struct imx7d_adc *info = dev->parent->priv;
 
        if (info->aiodev_info)
                info->aiodev_info(dev);
@@ -415,7 +415,8 @@ static int imx7d_adc_probe(struct device_d *dev)
                return dev_err_probe(dev, PTR_ERR(info->regs),
                                     "Failed to get memory region\n");
 
-       dev->priv = aiodev = &info->aiodev;
+       dev->priv = info;
+       aiodev = &info->aiodev;
 
        aiodev->num_channels = 16;
        aiodev->hwdev = dev;
-- 
2.30.2


Reply via email to