Re: [PATCH 2/2] iio: st_sensors: Fix null pointer on defer_probe error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 24, 2022 at 7:01 PM Matti Lehtimäki
<matti.lehtimaki@xxxxxxxxx> wrote:
>
> 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.

the parent device pointer

...

>         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");

Why not use the 'parent' variable?

...

>         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),

Ditto.

>                                      "unable to get Vdd_IO supply\n");


-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux