From: Jonathan Cameron <jic23@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: "Waqar Hameed" <waqar.hameed@axis.com>,
"Song Qiang" <songqiang1304521@gmail.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v2 next] iio: proximity: vl53l0x-i2c: Fix error code in probe()
Date: Tue, 19 Aug 2025 18:49:08 +0100 [thread overview]
Message-ID: <20250819184908.324b0ca8@jic23-huawei> (raw)
In-Reply-To: <aKSSHTdJf5QoYiRx@stanley.mountain>
On Tue, 19 Aug 2025 18:02:53 +0300
Dan Carpenter <dan.carpenter@linaro.org> wrote:
> Commit 65e8202f0322 ("iio: Remove error prints for
> devm_add_action_or_reset()") accidentally introduced a bug where we
> returned "ret" but the error code was stored in "error" if
> devm_add_action_or_reset() failed. Using two variables to store error
> codes is unnecessary and confusing. Delete the "error" variable and use
> "ret" everywhere instead.
>
> Fixes: 65e8202f0322 ("iio: Remove error prints for devm_add_action_or_reset()")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> Reviewed-by: Andy Shevchenko <andy@kernel.org>
Applied to the togreg branch of iio.git (where that patch is)
and very briefly pushed out as testing to get some build coverage for other
stuff I'm queuing this evening.
Thanks
Jonathan
> ---
> v2: Fix typos. Add Andy's r-b tag.
>
> drivers/iio/proximity/vl53l0x-i2c.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/proximity/vl53l0x-i2c.c b/drivers/iio/proximity/vl53l0x-i2c.c
> index 696340ec027a..ad3e46d47fa8 100644
> --- a/drivers/iio/proximity/vl53l0x-i2c.c
> +++ b/drivers/iio/proximity/vl53l0x-i2c.c
> @@ -311,7 +311,6 @@ static int vl53l0x_probe(struct i2c_client *client)
> {
> struct vl53l0x_data *data;
> struct iio_dev *indio_dev;
> - int error;
> int ret;
>
> indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> @@ -344,13 +343,13 @@ static int vl53l0x_probe(struct i2c_client *client)
> return dev_err_probe(&client->dev, PTR_ERR(data->reset_gpio),
> "Cannot get reset GPIO\n");
>
> - error = vl53l0x_power_on(data);
> - if (error)
> - return dev_err_probe(&client->dev, error,
> + ret = vl53l0x_power_on(data);
> + if (ret)
> + return dev_err_probe(&client->dev, ret,
> "Failed to power on the chip\n");
>
> - error = devm_add_action_or_reset(&client->dev, vl53l0x_power_off, data);
> - if (error)
> + ret = devm_add_action_or_reset(&client->dev, vl53l0x_power_off, data);
> + if (ret)
> return ret;
>
> indio_dev->name = "vl53l0x";
prev parent reply other threads:[~2025-08-19 17:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 15:02 [PATCH v2 next] iio: proximity: vl53l0x-i2c: Fix error code in probe() Dan Carpenter
2025-08-19 17:49 ` 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=20250819184908.324b0ca8@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=dlechner@baylibre.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=songqiang1304521@gmail.com \
--cc=waqar.hameed@axis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.