[kbuild] Re: [PATCH v2] iio: temperature: Add driver support for Maxim MAX30208

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

 



Hi Rajat,

https://git-scm.com/docs/git-format-patch#_base_tree_information  ]

url:    https://github.com/intel-lab-lkp/linux/commits/Rajat-Khandelwal/iio-temperature-Add-driver-support-for-Maxim-MAX30208/20221018-195706  
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git   togreg
patch link:    https://lore.kernel.org/r/20221019115539.779804-1-rajat.khandelwal%40linux.intel.com  
patch subject: [PATCH v2] iio: temperature: Add driver support for Maxim MAX30208
config: openrisc-randconfig-m041-20221019
compiler: or1k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/iio/temperature/max30208.c:161 max30208_update_temp() warn: inconsistent returns '&data->lock'.

vim +161 drivers/iio/temperature/max30208.c

b9d159ff5aa726 Rajat Khandelwal 2022-10-19  108  static int max30208_update_temp(struct max30208_data *data)
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  109  {
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  110  	u16 temp_raw = 0;
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  111  	s8 data_count;
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  112  	int ret;
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  113  
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  114  	mutex_lock(&data->lock);
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  115  
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  116  	ret = max30208_request(data);
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  117  	if (ret < 0)
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  118  		return ret;
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  119  
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  120  	ret = i2c_smbus_read_byte_data(data->client, MAX30208_FIFO_OVF_CNTR);
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  121  	if (ret < 0) {
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  122  		dev_err(&data->client->dev, "Error reading reg FIFO overflow counter\n");
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  123  		return ret;

goto unlock;

b9d159ff5aa726 Rajat Khandelwal 2022-10-19  124  	} else if (!ret) {
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  125  		ret = i2c_smbus_read_byte_data(data->client,
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  126  					       MAX30208_FIFO_DATA_CNTR);
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  127  		if (ret < 0) {
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  128  			dev_err(&data->client->dev, "Error reading reg FIFO data counter\n");
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  129  			return ret;

goto unlock;

b9d159ff5aa726 Rajat Khandelwal 2022-10-19  130  		}
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  131  	}
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  132  
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  133  	data_count = ret;
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  134  
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  135  	/*
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  136  	 * Ideally, counter should decrease by 1 each time a word is read from FIFO.
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  137  	 * However, practically, the device behaves erroneously and counter sometimes
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  138  	 * decreases by more than 1. Hence, do not loop the counter until it becomes 0
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  139  	 * rather, use the exact counter value after each FIFO word is read.
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  140  	 * Return the last reading from FIFO as the most recently triggered one.
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  141  	 */
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  142  	while (data_count) {
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  143  		ret = i2c_smbus_read_word_swapped(data->client,
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  144  						  MAX30208_FIFO_DATA);
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  145  		if (ret < 0) {
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  146  			dev_err(&data->client->dev, "Error reading reg FIFO data\n");
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  147  			return ret;

goto unlock;

b9d159ff5aa726 Rajat Khandelwal 2022-10-19  148  		}
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  149  
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  150  		data_count = i2c_smbus_read_byte_data(data->client,
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  151  						      MAX30208_FIFO_DATA_CNTR);
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  152  		if (data_count < 0) {
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  153  			dev_err(&data->client->dev, "Error reading reg FIFO data counter\n");
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  154  			return data_count;

goto unlock;

b9d159ff5aa726 Rajat Khandelwal 2022-10-19  155  		}
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  156  	}
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  157  	temp_raw = ret;
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  158  

unlock:

b9d159ff5aa726 Rajat Khandelwal 2022-10-19  159  	mutex_unlock(&data->lock);
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  160  
b9d159ff5aa726 Rajat Khandelwal 2022-10-19 @161  	return temp_raw;
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  162  }
b9d159ff5aa726 Rajat Khandelwal 2022-10-19  163  




[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