dev_err_probe() calls __device_set_deferred_probe_reason() on -EPROBE_DEFER error. The device pointer to driver core private structure is not yet initialized at this stage for the iio device causing a null pointer error. Use parent device instead. Fixes: 4dff75487695 ("iio: st_sensors: Make use of the helper function dev_err_probe()") Signed-off-by: Matti Lehtimäki <matti.lehtimaki@xxxxxxxxx> --- drivers/iio/common/st_sensors/st_sensors_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 106f7953683e..575607058291 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -235,7 +235,7 @@ int st_sensors_power_enable(struct iio_dev *indio_dev) /* Regulators not mandatory, but if requested we should enable them. */ pdata->vdd = devm_regulator_get(parent, "vdd"); if (IS_ERR(pdata->vdd)) - return dev_err_probe(&indio_dev->dev, PTR_ERR(pdata->vdd), + return dev_err_probe(indio_dev->dev.parent, PTR_ERR(pdata->vdd), "unable to get Vdd supply\n"); err = regulator_enable(pdata->vdd); @@ -251,7 +251,7 @@ int st_sensors_power_enable(struct iio_dev *indio_dev) pdata->vdd_io = devm_regulator_get(parent, "vddio"); if (IS_ERR(pdata->vdd_io)) - return dev_err_probe(&indio_dev->dev, PTR_ERR(pdata->vdd_io), + return dev_err_probe(indio_dev->dev.parent, PTR_ERR(pdata->vdd_io), "unable to get Vdd_IO supply\n"); err = regulator_enable(pdata->vdd_io); -- 2.34.1