lkml.org 
[lkml]   [2022]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/2] iio: st_sensors: Fix null pointer on defer_probe error
On Sun, Jul 24, 2022 at 7:01 PM Matti Lehtimäki
<matti.lehtimaki@gmail.com> 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

\
 
 \ /
  Last update: 2022-07-25 23:25    [W:0.108 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site