* drivers/iio/temperature/ltc2983.c:549:29: warning: 'strcmp' of a string of length 24 and an array of size 22 evaluates to nonzero
@ 2026-09-11 22:29 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-09-11 22:29 UTC (permalink / raw)
To: Liviu Stan; +Cc: oe-kbuild-all, linux-kernel, Jonathan Cameron
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 827751b699b79a6e569983359c02dce67f81b94c
commit: 3dd0c048409e335320418c632966f149be628fd4 iio: temperature: ltc2983: Add support for ADT7604
date: 3 months ago
config: s390-randconfig-r052-20260911 (https://download.01.org/0day-ci/archive/20260912/202609120045.OxEsKLIn-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 10.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260912/202609120045.OxEsKLIn-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: 3dd0c048409e ("iio: temperature: ltc2983: Add support for ADT7604")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609120045.OxEsKLIn-lkp@intel.com/
All warnings (new ones prefixed by >>):
In function '__ltc2983_custom_sensor_new',
inlined from 'ltc2983_thermistor_new' at drivers/iio/temperature/ltc2983.c:1069:24:
>> drivers/iio/temperature/ltc2983.c:549:29: warning: 'strcmp' of a string of length 24 and an array of size 22 evaluates to nonzero [-Wstring-compare]
549 | if ((index % 2) != 0 && !strcmp(propname, "adi,custom-leak-detector"))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/strcmp +549 drivers/iio/temperature/ltc2983.c
472
473 static struct ltc2983_custom_sensor *
474 __ltc2983_custom_sensor_new(struct ltc2983_data *st, const struct fwnode_handle *fn,
475 const char *propname, const bool is_steinhart,
476 const u32 resolution, const bool has_signed)
477 {
478 struct ltc2983_custom_sensor *new_custom;
479 struct device *dev = &st->spi->dev;
480 /*
481 * For custom steinhart, the full u32 is taken. For all the others
482 * the MSB is discarded.
483 */
484 const u8 n_size = is_steinhart ? 4 : 3;
485 u8 index, n_entries;
486 int ret;
487
488 if (is_steinhart)
489 n_entries = fwnode_property_count_u32(fn, propname);
490 else
491 n_entries = fwnode_property_count_u64(fn, propname);
492 /* n_entries must be an even number */
493 if (!n_entries || (n_entries % 2) != 0)
494 return dev_err_ptr_probe(dev, -EINVAL,
495 "Number of entries either 0 or not even\n");
496
497 new_custom = devm_kzalloc(dev, sizeof(*new_custom), GFP_KERNEL);
498 if (!new_custom)
499 return ERR_PTR(-ENOMEM);
500
501 new_custom->size = n_entries * n_size;
502 /* check Steinhart size */
503 if (is_steinhart && new_custom->size != LTC2983_CUSTOM_STEINHART_SIZE)
504 return dev_err_ptr_probe(dev, -EINVAL,
505 "Steinhart sensors size(%zu) must be %u\n",
506 new_custom->size, LTC2983_CUSTOM_STEINHART_SIZE);
507
508 /* Check space on the table. */
509 if (st->custom_table_size + new_custom->size >
510 (LTC2983_CUST_SENS_TBL_END_REG - LTC2983_CUST_SENS_TBL_START_REG) + 1)
511 return dev_err_ptr_probe(dev, -EINVAL,
512 "No space left(%d) for new custom sensor(%zu)\n",
513 st->custom_table_size, new_custom->size);
514
515 /* allocate the table */
516 if (is_steinhart)
517 new_custom->table = devm_kcalloc(dev, n_entries, sizeof(u32), GFP_KERNEL);
518 else
519 new_custom->table = devm_kcalloc(dev, n_entries, sizeof(u64), GFP_KERNEL);
520 if (!new_custom->table)
521 return ERR_PTR(-ENOMEM);
522
523 /*
524 * Steinhart sensors are configured with raw values in the firmware
525 * node. For the other sensors we must convert the value to raw.
526 * The odd index's correspond to temperatures and always have 1/1024
527 * of resolution. Temperatures also come in Kelvin, so signed values
528 * are not possible.
529 */
530 if (is_steinhart) {
531 ret = fwnode_property_read_u32_array(fn, propname, new_custom->table, n_entries);
532 if (ret < 0)
533 return ERR_PTR(ret);
534
535 cpu_to_be32_array(new_custom->table, new_custom->table, n_entries);
536 } else {
537 ret = fwnode_property_read_u64_array(fn, propname, new_custom->table, n_entries);
538 if (ret < 0)
539 return ERR_PTR(ret);
540
541 for (index = 0; index < n_entries; index++) {
542 u64 temp = ((u64 *)new_custom->table)[index];
543
544 /*
545 * Users specify plain coverage percentage (0-100). Convert
546 * to µK so __convert_to_raw() produces the correct hardware
547 * encoding: P + 273.15 K.
548 */
> 549 if ((index % 2) != 0 && !strcmp(propname, "adi,custom-leak-detector"))
550 temp = temp * 1000000 + 273150000;
551
552 if ((index % 2) != 0)
553 temp = __convert_to_raw(temp, 1024);
554 else if (has_signed && (s64)temp < 0)
555 temp = __convert_to_raw_sign(temp, resolution);
556 else
557 temp = __convert_to_raw(temp, resolution);
558
559 put_unaligned_be24(temp, new_custom->table + index * 3);
560 }
561 }
562
563 new_custom->is_steinhart = is_steinhart;
564 /*
565 * This is done to first add all the steinhart sensors to the table,
566 * in order to maximize the table usage. If we mix adding steinhart
567 * with the other sensors, we might have to do some roundup to make
568 * sure that sensor_addr - 0x250(start address) is a multiple of 4
569 * (for steinhart), and a multiple of 6 for all the other sensors.
570 * Since we have const 24 bytes for steinhart sensors and 24 is
571 * also a multiple of 6, we guarantee that the first non-steinhart
572 * sensor will sit in a correct address without the need of filling
573 * addresses.
574 */
575 if (is_steinhart) {
576 new_custom->offset = st->custom_table_size /
577 LTC2983_CUSTOM_STEINHART_ENTRY_SZ;
578 st->custom_table_size += new_custom->size;
579 } else {
580 /* mark as unset. This is checked later on the assign phase */
581 new_custom->offset = -1;
582 }
583
584 return new_custom;
585 }
586
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-11 22:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 22:29 drivers/iio/temperature/ltc2983.c:549:29: warning: 'strcmp' of a string of length 24 and an array of size 22 evaluates to nonzero kernel test robot
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®