mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org,
	Rajat Khandelwal <rajat.khandelwal@linux.intel.com>,
	jic23@kernel.org, lars@metafoo.de
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
	rajat.khandelwal@intel.com,
	Rajat Khandelwal <rajat.khandelwal@linux.intel.com>
Subject: [kbuild] Re: [PATCH v2] iio: temperature: Add driver support for Maxim MAX30208
Date: Wed, 19 Oct 2022 19:09:14 +0300	[thread overview]
Message-ID: <202210191943.Pn4IKb2u-lkp@intel.com> (raw)
In-Reply-To: <20221019115539.779804-1-rajat.khandelwal@linux.intel.com>

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@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

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  


      reply	other threads:[~2022-10-19 16:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 11:55 Rajat Khandelwal
2022-10-19 16:09 ` Dan Carpenter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202210191943.Pn4IKb2u-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=jic23@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=rajat.khandelwal@intel.com \
    --cc=rajat.khandelwal@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®