mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
iio: proximity: vl53l0x-i2c: Fix error code in probe()
Commit65e8202f03("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:65e8202f03("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> Link: https://patch.msgid.link/aKSSHTdJf5QoYiRx@stanley.mountain Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
788c57f476
commit
d20a8a8ecd
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user