mirror of
https://github.com/torvalds/linux.git
synced 2024-12-10 13:12:04 +00:00
iio: sx9500: rework error handling of raw readings
Fix error handling so that we can power the chip down even if a raw read fails. Reported-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com> Acked-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
2616dfa1d3
commit
657c7ff56f
@ -329,20 +329,20 @@ static int sx9500_read_proximity(struct sx9500_data *data,
|
|||||||
else
|
else
|
||||||
ret = sx9500_wait_for_sample(data);
|
ret = sx9500_wait_for_sample(data);
|
||||||
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
mutex_lock(&data->mutex);
|
mutex_lock(&data->mutex);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
goto out_dec_data_rdy;
|
||||||
|
|
||||||
ret = sx9500_read_prox_data(data, chan, val);
|
ret = sx9500_read_prox_data(data, chan, val);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out_dec_data_rdy;
|
||||||
|
|
||||||
ret = sx9500_dec_chan_users(data, chan->channel);
|
|
||||||
if (ret < 0)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
ret = sx9500_dec_data_rdy_users(data);
|
ret = sx9500_dec_data_rdy_users(data);
|
||||||
|
if (ret < 0)
|
||||||
|
goto out_dec_chan;
|
||||||
|
|
||||||
|
ret = sx9500_dec_chan_users(data, chan->channel);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -350,6 +350,8 @@ static int sx9500_read_proximity(struct sx9500_data *data,
|
|||||||
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
out_dec_data_rdy:
|
||||||
|
sx9500_dec_data_rdy_users(data);
|
||||||
out_dec_chan:
|
out_dec_chan:
|
||||||
sx9500_dec_chan_users(data, chan->channel);
|
sx9500_dec_chan_users(data, chan->channel);
|
||||||
out:
|
out:
|
||||||
|
Loading…
Reference in New Issue
Block a user