drivers/iio/dac/ad7293.c:524 ad7293_read_raw() error: uninitialized symbol 'data'.

From: Dan Carpenter
Date: Mon Jan 24 2022 - 07:06:24 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: dd81e1c7d5fb126e5fbc5c9e334d7b3ec29a16a0
commit: 0bb12606c05fe9737e3056fe76d6e4b9c2a87b57 iio:dac:ad7293: add support for AD7293
config: nios2-randconfig-m031-20220124 (https://download.01.org/0day-ci/archive/20220124/202201241944.dodYYcTk-lkp@xxxxxxxxx/config)
compiler: nios2-linux-gcc (GCC) 11.2.0

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

smatch warnings:
drivers/iio/dac/ad7293.c:524 ad7293_read_raw() error: uninitialized symbol 'data'.

vim +/data +524 drivers/iio/dac/ad7293.c

0bb12606c05fe9 Antoniu Miclaus 2021-12-02 510 if (ret)
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 511 return ret;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 512
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 513 *val = data;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 514
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 515 return IIO_VAL_INT;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 516 case IIO_CHAN_INFO_OFFSET:
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 517 switch (chan->type) {
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 518 case IIO_VOLTAGE:
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 519 if (chan->output) {
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 520 ret = ad7293_get_offset(st,
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 521 chan->channel + AD7293_VOUT_MIN_OFFSET_CH,
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 522 &data);

ad7293_get_offset() can fail

0bb12606c05fe9 Antoniu Miclaus 2021-12-02 523
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 @524 data = FIELD_GET(AD7293_REG_VOUT_OFFSET_MSK, data);
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 525 } else {
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 526 ret = ad7293_get_offset(st, chan->channel, &data);
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 527 }
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 528
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 529 break;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 530 case IIO_CURRENT:
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 531 ret = ad7293_get_offset(st,
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 532 chan->channel + AD7293_ISENSE_MIN_OFFSET_CH,
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 533 &data);
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 534
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 535 break;

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