From: Jonathan Cameron <jic23@kernel.org>
To: Cai Huoqing <caihuoqing@baidu.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>, <linux-iio@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
Denis CIOCCA <denis.ciocca@st.com>
Subject: Re: [PATCH v2 1/2] iio: st_sensors: Make use of the helper function dev_err_probe()
Date: Thu, 7 Oct 2021 18:28:10 +0100 [thread overview]
Message-ID: <20211007182810.245d5502@jic23-huawei> (raw)
In-Reply-To: <20210928014055.1431-1-caihuoqing@baidu.com>
On Tue, 28 Sep 2021 09:40:53 +0800
Cai Huoqing <caihuoqing@baidu.com> wrote:
> When possible use dev_err_probe help to properly deal with the
> PROBE_DEFER error, the benefit is that DEFER issue will be logged
> in the devices_deferred debugfs file.
> Using dev_err_probe() can reduce code size, and the error value
> gets printed.
>
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
+CC Denis though this looks simple enough I'll take it now.
Applied to the togreg branch of iio.git and pushed out as testing for all the
normal reasons.
Thanks,
Jonathan
> ---
> v1->v2: Remove the separate line of PTR_ERR().
>
> .../iio/common/st_sensors/st_sensors_core.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index a5a140de9a23..732d0f8f99f6 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -228,10 +228,10 @@ 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)) {
> - dev_err(&indio_dev->dev, "unable to get Vdd supply\n");
> - return PTR_ERR(pdata->vdd);
> - }
> + if (IS_ERR(pdata->vdd))
> + return dev_err_probe(&indio_dev->dev, PTR_ERR(pdata->vdd),
> + "unable to get Vdd supply\n");
> +
> err = regulator_enable(pdata->vdd);
> if (err != 0) {
> dev_warn(&indio_dev->dev,
> @@ -243,10 +245,10 @@ int st_sensors_power_enable(struct iio_dev *indio_dev)
> return err;
>
> pdata->vdd_io = devm_regulator_get(parent, "vddio");
> - if (IS_ERR(pdata->vdd_io)) {
> - dev_err(&indio_dev->dev, "unable to get Vdd_IO supply\n");
> - return PTR_ERR(pdata->vdd_io);
> - }
> + if (IS_ERR(pdata->vdd_io))
> + return dev_err_probe(&indio_dev->dev, PTR_ERR(pdata->vdd_io),
> + "unable to get Vdd_IO supply\n");
> +
> err = regulator_enable(pdata->vdd_io);
> if (err != 0) {
> dev_warn(&indio_dev->dev,
prev parent reply other threads:[~2021-10-07 17:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-28 1:40 [PATCH v2 1/2] iio: st_sensors: Make use of the helper function dev_err_probe() Cai Huoqing
2021-09-28 1:40 ` [PATCH v2 2/2] iio: st_lsm9ds0: " Cai Huoqing
2021-09-29 17:06 ` Jonathan Cameron
2021-10-07 17:30 ` Jonathan Cameron
2021-10-07 17:30 ` Andy Shevchenko
2021-10-07 17:28 ` Jonathan Cameron [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=20211007182810.245d5502@jic23-huawei \
--to=jic23@kernel.org \
--cc=caihuoqing@baidu.com \
--cc=denis.ciocca@st.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox