2022-04-29 21:14:17

by Dan Carpenter

[permalink] [raw]
Subject: [sailus-media-tree:master 55/60] drivers/media/i2c/adv7180.c:573 adv7180_test_pattern() error: uninitialized symbol 'reg'.

tree: git://linuxtv.org/sailus/media_tree.git master
head: ea1280040a678f38a4ce6f1817933c04cfe74552
commit: f3b4b140d87dc7f256229f20a8d70429a7549aca [55/60] media: i2c: adv7180: Add support for the test patterns
config: microblaze-randconfig-m031-20220427 (https://download.01.org/0day-ci/archive/20220429/[email protected]/config)
compiler: microblaze-linux-gcc (GCC) 11.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
drivers/media/i2c/adv7180.c:573 adv7180_test_pattern() error: uninitialized symbol 'reg'.

vim +/reg +573 drivers/media/i2c/adv7180.c

f3b4b140d87dc7f Fabio Estevam 2022-04-27 563 static int adv7180_test_pattern(struct adv7180_state *state, int value)
f3b4b140d87dc7f Fabio Estevam 2022-04-27 564 {
f3b4b140d87dc7f Fabio Estevam 2022-04-27 565 unsigned int reg;
f3b4b140d87dc7f Fabio Estevam 2022-04-27 566
f3b4b140d87dc7f Fabio Estevam 2022-04-27 567 /* Map menu value into register value */
f3b4b140d87dc7f Fabio Estevam 2022-04-27 568 if (value < 3)
f3b4b140d87dc7f Fabio Estevam 2022-04-27 569 reg = value;
f3b4b140d87dc7f Fabio Estevam 2022-04-27 570 if (value == 3)
f3b4b140d87dc7f Fabio Estevam 2022-04-27 571 reg = 5;

Just write something like:

if (value < 3)
reg = value;
else
reg = 3;

f3b4b140d87dc7f Fabio Estevam 2022-04-27 572
f3b4b140d87dc7f Fabio Estevam 2022-04-27 @573 adv7180_write(state, ADV7180_REG_ANALOG_CLAMP_CTL, reg);
^^^
Uninitialized

f3b4b140d87dc7f Fabio Estevam 2022-04-27 574
f3b4b140d87dc7f Fabio Estevam 2022-04-27 575 if (value == ARRAY_SIZE(test_pattern_menu) - 1) {
f3b4b140d87dc7f Fabio Estevam 2022-04-27 576 reg = adv7180_read(state, ADV7180_REG_DEF_VALUE_Y);
f3b4b140d87dc7f Fabio Estevam 2022-04-27 577 reg &= ~ADV7180_DEF_VAL_EN;
f3b4b140d87dc7f Fabio Estevam 2022-04-27 578 adv7180_write(state, ADV7180_REG_DEF_VALUE_Y, reg);
f3b4b140d87dc7f Fabio Estevam 2022-04-27 579 return 0;
f3b4b140d87dc7f Fabio Estevam 2022-04-27 580 }
f3b4b140d87dc7f Fabio Estevam 2022-04-27 581
f3b4b140d87dc7f Fabio Estevam 2022-04-27 582 reg = adv7180_read(state, ADV7180_REG_DEF_VALUE_Y);
f3b4b140d87dc7f Fabio Estevam 2022-04-27 583 reg |= ADV7180_DEF_VAL_EN | ADV7180_DEF_VAL_AUTO_EN;
f3b4b140d87dc7f Fabio Estevam 2022-04-27 584 adv7180_write(state, ADV7180_REG_DEF_VALUE_Y, reg);
f3b4b140d87dc7f Fabio Estevam 2022-04-27 585
f3b4b140d87dc7f Fabio Estevam 2022-04-27 586 return 0;
f3b4b140d87dc7f Fabio Estevam 2022-04-27 587 }

--
0-DAY CI Kernel Test Service
https://01.org/lkp


2022-04-30 13:53:02

by Fabio Estevam

[permalink] [raw]
Subject: Re: [sailus-media-tree:master 55/60] drivers/media/i2c/adv7180.c:573 adv7180_test_pattern() error: uninitialized symbol 'reg'.

Hi Dan,

On Fri, Apr 29, 2022 at 7:30 AM Dan Carpenter <[email protected]> wrote:
>
> tree: git://linuxtv.org/sailus/media_tree.git master
> head: ea1280040a678f38a4ce6f1817933c04cfe74552
> commit: f3b4b140d87dc7f256229f20a8d70429a7549aca [55/60] media: i2c: adv7180: Add support for the test patterns
> config: microblaze-randconfig-m031-20220427 (https://download.01.org/0day-ci/archive/20220429/[email protected]/config)
> compiler: microblaze-linux-gcc (GCC) 11.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <[email protected]>
> Reported-by: Dan Carpenter <[email protected]>
>
> smatch warnings:
> drivers/media/i2c/adv7180.c:573 adv7180_test_pattern() error: uninitialized symbol 'reg'.

Thanks for the report.

This problem has been resolved in v3:

https://patchwork.linuxtv.org/project/linux-media/patch/[email protected]/