Re: [PATCH v3 1/2] Driver for TI HDC20x0 humidity and temperature sensors

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

 



Hi Jonathan,


On 23.12.2019 18:16, Jonathan Cameron wrote:
>
> As below. Why change the existing return value?
>
>> +		}
>> +		return ret;
>> +	}
>> +	case IIO_CHAN_INFO_PEAK: {
>> +		int ret;
>> +
>> +		ret = iio_device_claim_direct_mode(indio_dev);
>> +		if (ret)
>> +			return ret;
>> +		mutex_lock(&data->lock);
>> +		ret = hdc2010_get_measurement_byte(data, chan);
>> +		mutex_unlock(&data->lock);
>> +		iio_device_release_direct_mode(indio_dev);
>> +		if (ret >= 0) {
>> +		  /* Scaling up the value so we can use same offset as RAW */
>> +			*val = ret * 256;
>> +			ret = IIO_VAL_INT;
>> +		} else
> Why overwrite ret?  That might provide better information
> on what went wrong.

As with the other stylistic notes before, no good reason other than how it was handled in other drivers in the tree. So I assumed it was the practice. Will tidy up later this week I hope and send a new patchset.

--
  Eugene




[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