From: Jonathan Cameron <jic23@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: devnull+david.ixit.cz@kernel.org, clamor95@gmail.com,
david@ixit.cz, lars@metafoo.de, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org, longnoserob@gmail.com
Subject: Re: [PATCH v4 1/5] iio: light: al3010: Improve al3010_init error handling with dev_err_probe()
Date: Sat, 5 Apr 2025 17:52:35 +0100 [thread overview]
Message-ID: <20250405175235.0b9d2508@jic23-huawei> (raw)
In-Reply-To: <eda0d691-93ac-4833-8978-6d39730c4db2@wanadoo.fr>
On Thu, 3 Apr 2025 20:01:46 +0200
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> Le 02/04/2025 à 21:33, David Heidelberg via B4 Relay a écrit :
> > From: David Heidelberg <david-W22tF5X+A20@public.gmane.org>
> >
> > Minor code simplifications and improved error reporting.
> >
> > Signed-off-by: David Heidelberg <david-W22tF5X+A20@public.gmane.org>
> > ---
> > drivers/iio/light/al3010.c | 10 ++++------
> > 1 file changed, 4 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/iio/light/al3010.c b/drivers/iio/light/al3010.c
> > index 8c004a9239aef246a8c6f6c3f4acd6b760ee8249..34a29a51c5f9e8aa143d3ba195b79a19793e4f88 100644
> > --- a/drivers/iio/light/al3010.c
> > +++ b/drivers/iio/light/al3010.c
> > @@ -92,8 +92,8 @@ static int al3010_init(struct al3010_data *data)
> > ret = devm_add_action_or_reset(&data->client->dev,
> > al3010_set_pwr_off,
> > data);
> > - if (ret < 0)
> > - return ret;
> > + if (ret)
> > + return dev_err_probe(&data->client->dev, ret, "failed to add action\n");
>
> Not sure this new message is needed.
>
> The error is unlikely, and kmalloc(), which is used in is
> devm_add_action_or_reset(), is already verbose.
Good point. I agree this should stay as a simple return.
If nothing else comes up I'll tidy that up whilst applying,
Jonathan
>
> CJ
>
> >
> > ret = i2c_smbus_write_byte_data(data->client, AL3010_REG_CONFIG,
> > FIELD_PREP(AL3010_GAIN_MASK,
> > @@ -190,10 +190,8 @@ static int al3010_probe(struct i2c_client *client)
> > indio_dev->modes = INDIO_DIRECT_MODE;
> >
> > ret = al3010_init(data);
> > - if (ret < 0) {
> > - dev_err(dev, "al3010 chip init failed\n");
> > - return ret;
> > - }
> > + if (ret)
> > + return dev_err_probe(dev, ret, "failed to init ALS\n");
> >
> > return devm_iio_device_register(dev, indio_dev);
> > }
> >
>
next prev parent reply other threads:[~2025-04-05 16:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 19:33 [PATCH v4 0/5] iio: light: Modernize al3010 and al3320a codebase David Heidelberg via B4 Relay
2025-04-02 19:33 ` [PATCH v4 1/5] iio: light: al3010: Improve al3010_init error handling with dev_err_probe() David Heidelberg via B4 Relay
2025-04-03 18:01 ` Christophe JAILLET
2025-04-05 16:52 ` Jonathan Cameron [this message]
2025-04-02 19:33 ` [PATCH v4 2/5] iio: light: al3000a: Fix an error handling path in al3000a_probe() David Heidelberg via B4 Relay
2025-04-05 16:57 ` Jonathan Cameron
2025-04-02 19:33 ` [PATCH v4 3/5] iio: light: al3320a: Fix an error handling path in al3320a_probe() David Heidelberg via B4 Relay
2025-04-05 16:59 ` Jonathan Cameron
2025-04-02 19:33 ` [PATCH v4 4/5] iio: light: al3010: Implement regmap support David Heidelberg via B4 Relay
2025-04-02 19:33 ` [PATCH v4 5/5] iio: light: al3320a: " David Heidelberg via B4 Relay
2025-04-05 17:12 ` [PATCH v4 0/5] iio: light: Modernize al3010 and al3320a codebase Jonathan Cameron
2025-04-06 13:01 ` David Heidelberg
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=20250405175235.0b9d2508@jic23-huawei \
--to=jic23@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--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