[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eda0d691-93ac-4833-8978-6d39730c4db2@wanadoo.fr>
Date: Thu, 3 Apr 2025 20:01:46 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: devnull+david.ixit.cz@...nel.org
Cc: clamor95@...il.com, david@...t.cz, jic23@...nel.org, lars@...afoo.de,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
longnoserob@...il.com
Subject: Re: [PATCH v4 1/5] iio: light: al3010: Improve al3010_init error
handling with dev_err_probe()
Le 02/04/2025 à 21:33, David Heidelberg via B4 Relay a écrit :
> From: David Heidelberg <david-W22tF5X+A20@...lic.gmane.org>
>
> Minor code simplifications and improved error reporting.
>
> Signed-off-by: David Heidelberg <david-W22tF5X+A20@...lic.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.
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);
> }
>
Powered by blists - more mailing lists