Re: [PATCH v4 2/3] iio: pressure: Honeywell mprls0025pa pressure sensor

From: kernel test robot
Date: Fri May 05 2023 - 12:55:35 EST


Hi Andreas,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 457391b0380335d5e9a5babdec90ac53928b23b4]

url: https://github.com/intel-lab-lkp/linux/commits/Andreas-Klinger/dt-bindings-iio-pressure-Support-Honeywell-mprls0025pa-sensor/20230505-212836
base: 457391b0380335d5e9a5babdec90ac53928b23b4
patch link: https://lore.kernel.org/r/ZFUC%2F3zBFQRBsYUk%40arbad
patch subject: [PATCH v4 2/3] iio: pressure: Honeywell mprls0025pa pressure sensor
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230506/202305060054.AFXCprUA-lkp@xxxxxxxxx/config)
compiler: sparc64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/2e6fb6a53d15af5fb86052a7d5d64c4d343157d0
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andreas-Klinger/dt-bindings-iio-pressure-Support-Honeywell-mprls0025pa-sensor/20230505-212836
git checkout 2e6fb6a53d15af5fb86052a7d5d64c4d343157d0
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/iio/pressure/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202305060054.AFXCprUA-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from include/linux/device.h:15,
from drivers/iio/pressure/mprls0025pa.c:18:
drivers/iio/pressure/mprls0025pa.c: In function 'mpr_read_pressure':
>> drivers/iio/pressure/mprls0025pa.c:178:30: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' [-Wformat=]
178 | dev_err(dev, "received size doesn't fit - ret: %d / %u\n", ret,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/iio/pressure/mprls0025pa.c:178:17: note: in expansion of macro 'dev_err'
178 | dev_err(dev, "received size doesn't fit - ret: %d / %u\n", ret,
| ^~~~~~~
drivers/iio/pressure/mprls0025pa.c:178:70: note: format string is defined here
178 | dev_err(dev, "received size doesn't fit - ret: %d / %u\n", ret,
| ~^
| |
| unsigned int
| %lu
drivers/iio/pressure/mprls0025pa.c:221:30: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' [-Wformat=]
221 | dev_err(dev, "received size doesn't fit - ret: %d / %u\n", ret,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/iio/pressure/mprls0025pa.c:221:17: note: in expansion of macro 'dev_err'
221 | dev_err(dev, "received size doesn't fit - ret: %d / %u\n", ret,
| ^~~~~~~
drivers/iio/pressure/mprls0025pa.c:221:70: note: format string is defined here
221 | dev_err(dev, "received size doesn't fit - ret: %d / %u\n", ret,
| ~^
| |
| unsigned int
| %lu


vim +178 drivers/iio/pressure/mprls0025pa.c

144
145 /**
146 * mpr_read_pressure() - Read pressure value from sensor via I2C
147 * @data: Pointer to private data struct.
148 * @press: Output value read from sensor.
149 *
150 * Reading from the sensor by sending and receiving I2C telegrams.
151 *
152 * If there is an end of conversion (EOC) interrupt registered the function
153 * waits for a maximum of one second for the interrupt.
154 *
155 * Context: The function can sleep and data->lock should be held when calling it
156 * Return:
157 * * 0 - OK, the pressure value could be read
158 * * -ETIMEDOUT - Timeout while waiting for the EOC interrupt or busy flag is
159 * still set after nloops attempts of reading
160 */
161 static int mpr_read_pressure(struct mpr_data *data, s32 *press)
162 {
163 struct device *dev = &data->client->dev;
164 int ret, i;
165 u8 wdata[] = {0xAA, 0x00, 0x00};
166 s32 status;
167 int nloops = 10;
168 u8 buf[5];
169
170 reinit_completion(&data->completion);
171
172 ret = i2c_master_send(data->client, wdata, sizeof(wdata));
173 if (ret < 0) {
174 dev_err(dev, "error while writing ret: %d\n", ret);
175 return ret;
176 }
177 if (ret != sizeof(wdata)) {
> 178 dev_err(dev, "received size doesn't fit - ret: %d / %u\n", ret,
179 sizeof(wdata));
180 return -EIO;
181 }
182
183 if (data->irq > 0) {
184 ret = wait_for_completion_timeout(&data->completion, HZ);
185 if (!ret) {
186 dev_err(dev, "timeout while waiting for eoc irq\n");
187 return -ETIMEDOUT;
188 }
189 } else {
190 /* wait until status indicates data is ready */
191 for (i = 0; i < nloops; i++) {
192 /*
193 * datasheet only says to wait at least 5 ms for the
194 * data but leave the maximum response time open
195 * --> let's try it nloops (10) times which seems to be
196 * quite long
197 */
198 usleep_range(5000, 10000);
199 status = i2c_smbus_read_byte(data->client);
200 if (status < 0) {
201 dev_err(dev,
202 "error while reading, status: %d\n",
203 status);
204 return status;
205 }
206 if (!(status & MPR_I2C_BUSY))
207 break;
208 }
209 if (i == nloops) {
210 dev_err(dev, "timeout while reading\n");
211 return -ETIMEDOUT;
212 }
213 }
214
215 ret = i2c_master_recv(data->client, buf, sizeof(buf));
216 if (ret < 0) {
217 dev_err(dev, "error in i2c_master_recv ret: %d\n", ret);
218 return ret;
219 }
220 if (ret != sizeof(buf)) {
221 dev_err(dev, "received size doesn't fit - ret: %d / %u\n", ret,
222 sizeof(buf));
223 return -EIO;
224 }
225
226 if (buf[0] & MPR_I2C_BUSY) {
227 /*
228 * it should never be the case that status still indicates
229 * business
230 */
231 dev_err(dev, "data still not ready: %08x\n", buf[0]);
232 return -ETIMEDOUT;
233 }
234
235 *press = get_unaligned_be24(&buf[1]);
236
237 dev_dbg(dev, "received: %*ph cnt: %d\n", ret, buf, *press);
238
239 return 0;
240 }
241

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests