From: Jonathan Cameron <jic23@kernel.org>
To: David Heidelberg via B4 Relay <devnull+david.ixit.cz@kernel.org>
Cc: david@ixit.cz, Lars-Peter Clausen <lars@metafoo.de>,
Svyatoslav Ryhel <clamor95@gmail.com>,
Robert Eckelmann <longnoserob@gmail.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 11/13] iio: light: al3320a: Improve error handling with dev_err_probe
Date: Sun, 30 Mar 2025 18:38:21 +0100 [thread overview]
Message-ID: <20250330183821.0f4f1a45@jic23-huawei> (raw)
In-Reply-To: <20250319-al3010-iio-regmap-v2-11-1310729d0543@ixit.cz>
On Wed, 19 Mar 2025 21:59:50 +0100
David Heidelberg via B4 Relay <devnull+david.ixit.cz@kernel.org> wrote:
> From: David Heidelberg <david@ixit.cz>
>
> Slight simplification of the code.
>
> Signed-off-by: David Heidelberg <david@ixit.cz>
> ---
> drivers/iio/light/al3320a.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/light/al3320a.c b/drivers/iio/light/al3320a.c
> index 1b2b0359ed5dad5e00d2fe584f8f3495c13c997e..1943e6f34a70b00b5d732dbf4ae6ccb4376303b7 100644
> --- a/drivers/iio/light/al3320a.c
> +++ b/drivers/iio/light/al3320a.c
> @@ -206,14 +206,12 @@ static int al3320a_probe(struct i2c_client *client)
> indio_dev->modes = INDIO_DIRECT_MODE;
>
> ret = al3320a_init(data);
> - if (ret < 0) {
> - dev_err(dev, "al3320a chip init failed\n");
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret, "failed to init ALS\n");
>
> ret = devm_add_action_or_reset(dev, al3320a_set_pwr_off, data);
Seeing this here made me look. Seems that the error path I highlighted in
patch 9 is here as well. I'd push this devm registration down into init
where it can immediately follow the power up.
> - if (ret < 0)
> - return ret;
> + if (ret)
> + return dev_err_probe(dev, ret, "failed to add action\n");
>
> return devm_iio_device_register(dev, indio_dev);
> }
>
next prev parent reply other threads:[~2025-03-30 17:38 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-19 20:59 [PATCH v2 00/13] iio: light: Modernize al3010 and al3320a codebase David Heidelberg via B4 Relay
2025-03-19 20:59 ` [PATCH v2 01/13] iio: light: al3010: Use unsigned int for the indexing David Heidelberg via B4 Relay
2025-03-30 17:26 ` Jonathan Cameron
2025-03-19 20:59 ` [PATCH v2 02/13] iio: light: al3320a: " David Heidelberg via B4 Relay
2025-03-19 20:59 ` [PATCH v2 03/13] iio: light: al3010: Remove DRV_NAME definition David Heidelberg via B4 Relay
2025-03-30 17:27 ` Jonathan Cameron
2025-03-19 20:59 ` [PATCH v2 04/13] iio: light: al3320a: " David Heidelberg via B4 Relay
2025-03-19 20:59 ` [PATCH v2 05/13] iio: light: al3010: Abstract device reference in the probe function David Heidelberg via B4 Relay
2025-03-30 17:29 ` Jonathan Cameron
2025-03-19 20:59 ` [PATCH v2 06/13] iio: light: al3320a: " David Heidelberg via B4 Relay
2025-03-19 20:59 ` [PATCH v2 07/13] iio: light: al3010: Split set_pwr function into set_pwr_on and _off David Heidelberg via B4 Relay
2025-03-30 17:30 ` Jonathan Cameron
2025-03-19 20:59 ` [PATCH v2 08/13] iio: light: al3320a: " David Heidelberg via B4 Relay
2025-03-19 20:59 ` [PATCH v2 09/13] iio: light: al3010: Move devm_add_action_or_reset back to _probe David Heidelberg via B4 Relay
2025-03-30 17:34 ` Jonathan Cameron
2025-04-01 16:36 ` David Heidelberg
2025-03-19 20:59 ` [PATCH v2 10/13] iio: light: al3010: Improve al3010_init error handling with dev_err_probe David Heidelberg via B4 Relay
2025-03-30 17:36 ` Jonathan Cameron
2025-03-19 20:59 ` [PATCH v2 11/13] iio: light: al3320a: Improve " David Heidelberg via B4 Relay
2025-03-30 17:38 ` Jonathan Cameron [this message]
2025-03-19 20:59 ` [PATCH v2 12/13] iio: light: al3010: Implement regmap support David Heidelberg via B4 Relay
2025-03-30 17:45 ` Jonathan Cameron
2025-03-30 17:47 ` Jonathan Cameron
2025-03-19 20:59 ` [PATCH v2 13/13] iio: light: al3320a: " David Heidelberg via B4 Relay
2025-03-30 17:48 ` Jonathan Cameron
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=20250330183821.0f4f1a45@jic23-huawei \
--to=jic23@kernel.org \
--cc=clamor95@gmail.com \
--cc=david@ixit.cz \
--cc=devnull+david.ixit.cz@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longnoserob@gmail.com \
/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