Re: [PATCH 1/2] iio: sx9500: rework error handling of raw readings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/07/15 19:39, Hartmut Knaack wrote:
> Vlad Dogaru schrieb am 30.06.2015 um 13:20:
>> Fix error handling so that we can power the chip down even if a raw read
>> fails.
>>
>> Reported-by: Hartmut Knaack <knaack.h@xxxxxx>
>> Signed-off-by: Vlad Dogaru <vlad.dogaru@xxxxxxxxx>
> Acked-by: Hartmut Knaack <knaack.h@xxxxxx>
Applied to the fixes-for-4.2 branch of iio.git

Thanks,

Jonathan
>> ---
>>  drivers/iio/proximity/sx9500.c | 16 +++++++++-------
>>  1 file changed, 9 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
>> index 2042e37..ba1cbbe 100644
>> --- a/drivers/iio/proximity/sx9500.c
>> +++ b/drivers/iio/proximity/sx9500.c
>> @@ -329,27 +329,29 @@ static int sx9500_read_proximity(struct sx9500_data *data,
>>  	else
>>  		ret = sx9500_wait_for_sample(data);
>>  
>> -	if (ret < 0)
>> -		return ret;
>> -
>>  	mutex_lock(&data->mutex);
>>  
>> -	ret = sx9500_read_prox_data(data, chan, val);
>>  	if (ret < 0)
>> -		goto out;
>> +		goto out_dec_data_rdy;
>>  
>> -	ret = sx9500_dec_chan_users(data, chan->channel);
>> +	ret = sx9500_read_prox_data(data, chan, val);
>>  	if (ret < 0)
>> -		goto out;
>> +		goto out_dec_data_rdy;
>>  
>>  	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)
>>  		goto out;
>>  
>>  	ret = IIO_VAL_INT;
>>  
>>  	goto out;
>>  
>> +out_dec_data_rdy:
>> +	sx9500_dec_data_rdy_users(data);
>>  out_dec_chan:
>>  	sx9500_dec_chan_users(data, chan->channel);
>>  out:
>>
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux