Re: [PATCH 2/3] iio: Introduce the generic counter interface

From: kbuild test robot
Date: Mon Jul 31 2017 - 19:15:38 EST


Hi William,

[auto build test WARNING on iio/togreg]
[cannot apply to v4.13-rc3 next-20170731]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/William-Breathitt-Gray/iio-Introduce-the-generic-counter-interface/20170801-050943
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa

All warnings (new ones prefixed by >>):

drivers/iio/industrialio-counter.c: In function '__iio_counter_value_ext_info_alloc':
>> drivers/iio/industrialio-counter.c:466:23: warning: assignment makes integer from pointer without a cast
ext_info[i].private = (void *)&trigger_pos->signal->id;
^
drivers/iio/industrialio-counter.c:476:23: warning: assignment makes integer from pointer without a cast
ext_info[i].private = (void *)&trigger_pos->signal->id;
^

vim +466 drivers/iio/industrialio-counter.c

388
389 static int __iio_counter_value_ext_info_alloc(struct iio_chan_spec *const chan,
390 struct iio_counter_value *const value)
391 {
392 const struct iio_chan_spec_ext_info ext_info_default[] = {
393 {
394 .name = "name",
395 .shared = IIO_SEPARATE,
396 .read = __iio_counter_value_name_read
397 },
398 IIO_ENUM("function", IIO_SEPARATE, &value->function_enum),
399 {
400 .name = "function_available",
401 .shared = IIO_SEPARATE,
402 .read = iio_enum_available_read,
403 .private = (uintptr_t)((void *)&value->function_enum)
404 },
405 {
406 .name = "triggers",
407 .shared = IIO_SEPARATE,
408 .read = __iio_counter_value_triggers_read
409 }
410 };
411 const size_t num_default = ARRAY_SIZE(ext_info_default);
412 const struct iio_chan_spec_ext_info ext_info_trigger[] = {
413 {
414 .shared = IIO_SEPARATE,
415 .read = __iio_counter_trigger_mode_read,
416 .write = __iio_counter_trigger_mode_write
417 },
418 {
419 .shared = IIO_SEPARATE,
420 .read = __iio_counter_trigger_mode_available_read
421 }
422 };
423 const size_t num_ext_info_trigger = ARRAY_SIZE(ext_info_trigger);
424 const struct list_head *pos;
425 size_t num_triggers = 0;
426 size_t num_triggers_ext_info;
427 size_t num_ext_info;
428 int err;
429 struct iio_chan_spec_ext_info *ext_info;
430 const struct iio_counter_trigger *trigger_pos;
431 size_t i;
432
433 value->function_enum.items = value->function_modes;
434 value->function_enum.num_items = value->num_function_modes;
435 value->function_enum.set = __iio_counter_value_function_set;
436 value->function_enum.get = __iio_counter_value_function_get;
437
438 mutex_lock(&value->trigger_list_lock);
439
440 list_for_each(pos, &value->trigger_list)
441 num_triggers++;
442
443 num_triggers_ext_info = num_ext_info_trigger * num_triggers;
444 num_ext_info = num_default + num_triggers_ext_info + 1;
445
446 ext_info = kmalloc_array(num_ext_info, sizeof(*ext_info), GFP_KERNEL);
447 if (!ext_info) {
448 err = -ENOMEM;
449 goto err_ext_info_alloc;
450 }
451 ext_info[num_ext_info - 1].name = NULL;
452
453 memcpy(ext_info, ext_info_default, sizeof(ext_info_default));
454 for (i = 0; i < num_triggers_ext_info; i += num_ext_info_trigger)
455 memcpy(ext_info + num_default + i, ext_info_trigger,
456 sizeof(ext_info_trigger));
457
458 i = num_default;
459 list_for_each_entry(trigger_pos, &value->trigger_list, list) {
460 ext_info[i].name = kasprintf(GFP_KERNEL, "trigger_signal%d-%d",
461 chan->channel, trigger_pos->signal->id);
462 if (!ext_info[i].name) {
463 err = -ENOMEM;
464 goto err_name_alloc;
465 }
> 466 ext_info[i].private = (void *)&trigger_pos->signal->id;
467 i++;
468
469 ext_info[i].name = kasprintf(GFP_KERNEL,
470 "trigger_signal%d-%d_available",
471 chan->channel, trigger_pos->signal->id);
472 if (!ext_info[i].name) {
473 err = -ENOMEM;
474 goto err_name_alloc;
475 }
476 ext_info[i].private = (void *)&trigger_pos->signal->id;
477 i++;
478 }
479
480 chan->ext_info = ext_info;
481
482 mutex_unlock(&value->trigger_list_lock);
483
484 return 0;
485
486 err_name_alloc:
487 while (i-- > num_default)
488 kfree(ext_info[i].name);
489 kfree(ext_info);
490 err_ext_info_alloc:
491 mutex_unlock(&value->trigger_list_lock);
492 return err;
493 }
494

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip