[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfO_3xBWyOsS=v3uNKP=iR5KTmDEH6a90mKh0vFM-xOjQ@mail.gmail.com>
Date: Mon, 25 Jul 2022 23:24:21 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Matti Lehtimäki <matti.lehtimaki@...il.com>
Cc: linux-iio <linux-iio@...r.kernel.org>,
~postmarketos/upstreaming@...ts.sr.ht,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Linus Walleij <linus.walleij@...aro.org>,
Cai Huoqing <cai.huoqing@...ux.dev>,
Alexandru Ardelean <aardelean@...iqon.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [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@...il.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
Powered by blists - more mailing lists