From: "Matti Lehtimäki" <matti.lehtimaki@gmail.com> To: linux-iio@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, "Matti Lehtimäki" <matti.lehtimaki@gmail.com>, "Jonathan Cameron" <jic23@kernel.org>, "Lars-Peter Clausen" <lars@metafoo.de>, "Miquel Raynal" <miquel.raynal@bootlin.com>, "Linus Walleij" <linus.walleij@linaro.org>, "Cai Huoqing" <cai.huoqing@linux.dev>, "Alexandru Ardelean" <aardelean@deviqon.com>, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] iio: st_sensors: Fix null pointer on defer_probe error Date: Sun, 24 Jul 2022 19:43:16 +0300 [thread overview] Message-ID: <20220724164316.68393-2-matti.lehtimaki@gmail.com> (raw) In-Reply-To: <20220724164316.68393-1-matti.lehtimaki@gmail.com> 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@gmail.com> --- 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
prev parent reply other threads:[~2022-07-24 16:45 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-24 16:43 [PATCH 1/2] iio: st_sensors: Retry ID verification on failure Matti Lehtimäki 2022-07-24 16:43 ` Matti Lehtimäki [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220724164316.68393-2-matti.lehtimaki@gmail.com \ --to=matti.lehtimaki@gmail.com \ --cc=aardelean@deviqon.com \ --cc=cai.huoqing@linux.dev \ --cc=jic23@kernel.org \ --cc=lars@metafoo.de \ --cc=linus.walleij@linaro.org \ --cc=linux-iio@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=miquel.raynal@bootlin.com \ --cc=~postmarketos/upstreaming@lists.sr.ht \ --subject='Re: [PATCH 2/2] iio: st_sensors: Fix null pointer on defer_probe error' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).
Read more here: Source link