Re: [PATCH v7 2/2] rtc: max31335: add driver support

From: Dan Carpenter
Date: Mon Nov 20 2023 - 06:35:35 EST


Hi Antoniu,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Antoniu-Miclaus/rtc-max31335-add-driver-support/20231109-231755
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
patch link: https://lore.kernel.org/r/20231109101449.8347-2-antoniu.miclaus%40analog.com
patch subject: [PATCH v7 2/2] rtc: max31335: add driver support
config: i386-randconfig-141-20231111 (https://download.01.org/0day-ci/archive/20231111/202311110943.V2lcrQlf-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231111/202311110943.V2lcrQlf-lkp@xxxxxxxxx/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
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <error27@xxxxxxxxx>
| Closes: https://lore.kernel.org/r/202311110943.V2lcrQlf-lkp@xxxxxxxxx/

smatch warnings:
drivers/rtc/rtc-max31335.c:415 max31335_trickle_charger_setup() error: uninitialized symbol 'trickle_cfg'.

vim +/trickle_cfg +415 drivers/rtc/rtc-max31335.c

d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 383 static int max31335_trickle_charger_setup(struct device *dev,
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 384 struct max31335_data *max31335)
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 385 {
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 386 u32 ohms, chargeable;
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 387 int i, trickle_cfg;
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 388 const char *diode;
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 389
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 390 if (device_property_read_u32(dev, "aux-voltage-chargeable",
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 391 &chargeable))
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 392 return 0;
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 393
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 394 if (device_property_read_u32(dev, "trickle-resistor-ohms", &ohms))
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 395 return 0;
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 396
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 397 if (device_property_read_string(dev, "adi,tc-diode", &diode))
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 398 return 0;
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 399
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 400 if (!strcmp(diode, "schottky"))
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 401 trickle_cfg = MAX31335_TRICKLE_SCHOTTKY_DIODE;
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 402 else if (!strcmp(diode, "standard+schottky"))
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 403 trickle_cfg = MAX31335_TRICKLE_STANDARD_DIODE;
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 404 else
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 405 dev_err_probe(dev, -EINVAL, "Invalid tc-diode value: %s\n",
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 406 diode);

Probably was intended to be return dev_err_probe();

d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 407
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 408 for (i = 0; i < ARRAY_SIZE(max31335_trickle_resistors); i++)
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 409 if (ohms == max31335_trickle_resistors[i])
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 410 break;
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 411
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 412 if (i >= ARRAY_SIZE(max31335_trickle_resistors))
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 413 return 0;
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 414
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 @415 i = i + trickle_cfg;
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 416
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 417 return regmap_write(max31335->regmap, MAX31335_TRICKLE_REG,
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 418 FIELD_PREP(MAX31335_TRICKLE_REG_TRICKLE, i) |
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 419 FIELD_PREP(MAX31335_TRICKLE_REG_EN_TRICKLE,
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 420 chargeable));
d76a0d3a61615e5 Antoniu Miclaus 2023-11-09 421 }

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