Re: [PATCH 2/2] drivers:iio:light: add ADPD188 driver support

From: kernel test robot
Date: Sat Oct 09 2021 - 16:32:07 EST


Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on linux/master robh/for-next linus/master v5.15-rc4 next-20211008]
[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/andrei-drimbarean-analog-com/ADPD188-linux-driver/20211008-193035
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: arm-randconfig-c002-20211010 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 30caca39f401ae17927439c0a0bd6d1b1916dd6a)
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
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/2fdc24f2cc61e00f472a8857c942bfa26ec97f0b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review andrei-drimbarean-analog-com/ADPD188-linux-driver/20211008-193035
git checkout 2fdc24f2cc61e00f472a8857c942bfa26ec97f0b
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/iio/light/

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

All error/warnings (new ones prefixed by >>):

>> drivers/iio/light/adpd188.c:572:13: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
} else if (config.slot_id == ADPD188_SLOTB) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/light/adpd188.c:583:9: note: uninitialized use occurs here
return ret;
^~~
drivers/iio/light/adpd188.c:572:9: note: remove the 'if' if its condition is always true
} else if (config.slot_id == ADPD188_SLOTB) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/light/adpd188.c:561:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
>> drivers/iio/light/adpd188.c:1306:22: error: no member named 'id' in 'struct iio_dev'
indio_dev->id);
~~~~~~~~~ ^
1 warning and 1 error generated.


vim +1306 drivers/iio/light/adpd188.c

1266
1267 static int adpd188_core_setup(struct iio_dev *indio_dev, struct device *dev,
1268 int irq)
1269 {
1270 int ret;
1271 int regval;
1272 struct adpd188 *dev_data = iio_priv(indio_dev);
1273 struct adpd188_ops *ops = dev_data->ops;
1274 struct iio_trigger *trig;
1275
1276 ret = ops->reg_read(dev_data->bus, ADPD188_REG_DEVID, &regval);
1277 if (ret < 0)
1278 return ret;
1279 if ((regval & ADPD188_DEVID_MASK) != ADPD188_DEVID) {
1280 dev_err(dev, "Error wrong device ID: %d\n", regval);
1281 return -ENODEV;
1282 }
1283
1284 ret = adpd188_reg_write_mask(dev_data, ADPD188_REG_SAMPLE_CLK, 1, ADPD188_CLK32K_EN);
1285 if (ret < 0)
1286 return ret;
1287
1288 ret = adpd188_core_smoke_setup(dev_data);
1289 if (ret < 0)
1290 return ret;
1291
1292 ret = adpd188_reg_write_mask(dev_data, ADPD188_REG_GPIO_DRV, 1, ADPD188_GPIO0_ENA);
1293 if (ret < 0)
1294 return ret;
1295 if (dev_data->no_devices > 1)
1296 regval = 0xD;
1297 else
1298 regval = 0x0;
1299 ret = adpd188_reg_write_mask(dev_data, ADPD188_REG_GPIO_CTRL,
1300 regval, ADPD188_GPIO0_ALT_CONFIG);
1301 if (ret < 0)
1302 return ret;
1303
1304 trig = devm_iio_trigger_alloc(indio_dev->dev.parent, "%s-dev%d",
1305 indio_dev->name,
> 1306 indio_dev->id);
1307 if (!trig)
1308 return -ENOMEM;
1309
1310 trig->dev.parent = indio_dev->dev.parent;
1311 trig->ops = &adpd188_trigger_ops;
1312 iio_trigger_set_drvdata(trig, indio_dev);
1313
1314 ret = devm_iio_trigger_register(dev, trig);
1315 if (ret)
1316 return ret;
1317
1318 indio_dev->trig = iio_trigger_get(trig);
1319
1320 init_completion(&dev_data->value_ok);
1321
1322 ret = devm_request_threaded_irq(indio_dev->dev.parent, irq,
1323 &adpd188_interrupt, &adpd188_oneshot_apply,
1324 IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
1325 indio_dev->name, indio_dev);
1326 if (ret)
1327 return ret;
1328
1329 return devm_iio_triggered_buffer_setup(indio_dev->dev.parent, indio_dev,
1330 &iio_pollfunc_store_time,
1331 &adpd188_trigger_handler,
1332 &adpd188_buffer_setup_ops);
1333 }
1334

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

Attachment: .config.gz
Description: application/gzip