Re: [PATCH 4/4] iio: imu: add BNO055 serdev driver

From: kernel test robot
Date: Thu Jul 15 2021 - 13:10:01 EST


Hi Andrea,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on iio/togreg]
[also build test WARNING on robh/for-next linus/master v5.14-rc1 next-20210715]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Andrea-Merello/Add-support-for-Bosch-BNO055-IMU/20210715-222018
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 10.3.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/0day-ci/linux/commit/616d1b9a99ec2045cdf6cc827751660a48ccc5d2
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andrea-Merello/Add-support-for-Bosch-BNO055-IMU/20210715-222018
git checkout 616d1b9a99ec2045cdf6cc827751660a48ccc5d2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=arc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/iio/imu/bno055/bno055.c:250:5: warning: no previous prototype for 'bno055_calibration_load' [-Wmissing-prototypes]
250 | int bno055_calibration_load(struct bno055_priv *priv, const struct firmware *fw)
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/imu/bno055/bno055.c: In function '_bno055_write_raw':
>> drivers/iio/imu/bno055/bno055.c:770:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
770 | switch (mask) {
| ^~~~~~
drivers/iio/imu/bno055/bno055.c:774:2: note: here
774 | default:
| ^~~~~~~


vim +/bno055_calibration_load +250 drivers/iio/imu/bno055/bno055.c

d13cfdff130569 Andrea Merello 2021-07-15 248
d13cfdff130569 Andrea Merello 2021-07-15 249 /* must be called in configuration mode */
d13cfdff130569 Andrea Merello 2021-07-15 @250 int bno055_calibration_load(struct bno055_priv *priv, const struct firmware *fw)
d13cfdff130569 Andrea Merello 2021-07-15 251 {
d13cfdff130569 Andrea Merello 2021-07-15 252 int i;
d13cfdff130569 Andrea Merello 2021-07-15 253 unsigned int tmp;
d13cfdff130569 Andrea Merello 2021-07-15 254 u8 cal[BNO055_CALDATA_LEN];
d13cfdff130569 Andrea Merello 2021-07-15 255 int read, tot_read = 0;
d13cfdff130569 Andrea Merello 2021-07-15 256 int ret = 0;
d13cfdff130569 Andrea Merello 2021-07-15 257 char *buf = kmalloc(fw->size + 1, GFP_KERNEL);
d13cfdff130569 Andrea Merello 2021-07-15 258
d13cfdff130569 Andrea Merello 2021-07-15 259 if (!buf)
d13cfdff130569 Andrea Merello 2021-07-15 260 return -ENOMEM;
d13cfdff130569 Andrea Merello 2021-07-15 261
d13cfdff130569 Andrea Merello 2021-07-15 262 memcpy(buf, fw->data, fw->size);
d13cfdff130569 Andrea Merello 2021-07-15 263 buf[fw->size] = '\0';
d13cfdff130569 Andrea Merello 2021-07-15 264 for (i = 0; i < BNO055_CALDATA_LEN; i++) {
d13cfdff130569 Andrea Merello 2021-07-15 265 ret = sscanf(buf + tot_read, "%x%n",
d13cfdff130569 Andrea Merello 2021-07-15 266 &tmp, &read);
d13cfdff130569 Andrea Merello 2021-07-15 267 if (ret != 1 || tmp > 0xff) {
d13cfdff130569 Andrea Merello 2021-07-15 268 ret = -EINVAL;
d13cfdff130569 Andrea Merello 2021-07-15 269 goto exit;
d13cfdff130569 Andrea Merello 2021-07-15 270 }
d13cfdff130569 Andrea Merello 2021-07-15 271 cal[i] = tmp;
d13cfdff130569 Andrea Merello 2021-07-15 272 tot_read += read;
d13cfdff130569 Andrea Merello 2021-07-15 273 }
d13cfdff130569 Andrea Merello 2021-07-15 274 dev_dbg(priv->dev, "loading cal data: %*ph", BNO055_CALDATA_LEN, cal);
d13cfdff130569 Andrea Merello 2021-07-15 275 ret = regmap_bulk_write(priv->regmap, BNO055_CALDATA_START,
d13cfdff130569 Andrea Merello 2021-07-15 276 cal, BNO055_CALDATA_LEN);
d13cfdff130569 Andrea Merello 2021-07-15 277 exit:
d13cfdff130569 Andrea Merello 2021-07-15 278 kfree(buf);
d13cfdff130569 Andrea Merello 2021-07-15 279 return ret;
d13cfdff130569 Andrea Merello 2021-07-15 280 }
d13cfdff130569 Andrea Merello 2021-07-15 281

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip