Linux-Next Archive on lore.kernel.org
 help / color / Atom feed
* linux-next: build warning after merge of the thermal tree
@ 2019-10-21 23:23 Stephen Rothwell
  2019-10-22  9:50 ` Amit Kucheria
  2019-10-29  9:05 ` Geert Uytterhoeven
  0 siblings, 2 replies; 9+ messages in thread
From: Stephen Rothwell @ 2019-10-21 23:23 UTC (permalink / raw)
  To: Daniel Lezcano, Zhang Rui, Eduardo Valentin
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Amit Kucheria

[-- Attachment #1: Type: text/plain, Size: 1383 bytes --]

Hi all,

After merging the thermal tree, today's linux-next build (x86_64
allmodconfig) produced this warning:

In file included from drivers/thermal/qcom/tsens-common.c:13:
drivers/thermal/qcom/tsens-common.c: In function 'tsens_set_interrupt':
include/linux/regmap.h:87:2: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized]
   87 |  regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/thermal/qcom/tsens-common.c:183:6: note: 'index' was declared here
  183 |  u32 index;
      |      ^~~~~
In file included from drivers/thermal/qcom/tsens-common.c:13:
include/linux/regmap.h:87:2: warning: 'index_clear' may be used uninitialized in this function [-Wmaybe-uninitialized]
   87 |  regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/thermal/qcom/tsens-common.c:199:18: note: 'index_clear' was declared here
  199 |  u32 index_mask, index_clear;
      |                  ^~~~~~~~~~~
drivers/thermal/qcom/tsens-common.c:199:6: warning: 'index_mask' may be used uninitialized in this function [-Wmaybe-uninitialized]
  199 |  u32 index_mask, index_clear;
      |      ^~~~~~~~~~

Introduced by commit

  fbfe1a042cfd ("drivers: thermal: tsens: Add interrupt support")

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: linux-next: build warning after merge of the thermal tree
  2019-10-21 23:23 linux-next: build warning after merge of the thermal tree Stephen Rothwell
@ 2019-10-22  9:50 ` Amit Kucheria
  2019-10-22 11:18   ` Stephen Rothwell
  2019-10-29  9:05 ` Geert Uytterhoeven
  1 sibling, 1 reply; 9+ messages in thread
From: Amit Kucheria @ 2019-10-22  9:50 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Daniel Lezcano, Zhang Rui, Eduardo Valentin,
	Linux Next Mailing List, Linux Kernel Mailing List

(Resending since Gmail mobile client converts email to HTML)

Hi Stephen,

On Tue, Oct 22, 2019 at 4:53 AM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi all,
>
> After merging the thermal tree, today's linux-next build (x86_64
> allmodconfig) produced this warning:
>
> In file included from drivers/thermal/qcom/tsens-common.c:13:
> drivers/thermal/qcom/tsens-common.c: In function 'tsens_set_interrupt':
> include/linux/regmap.h:87:2: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized]
>    87 |  regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
>       |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/thermal/qcom/tsens-common.c:183:6: note: 'index' was declared here
>   183 |  u32 index;
>       |      ^~~~~
> In file included from drivers/thermal/qcom/tsens-common.c:13:
> include/linux/regmap.h:87:2: warning: 'index_clear' may be used uninitialized in this function [-Wmaybe-uninitialized]
>    87 |  regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
>       |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/thermal/qcom/tsens-common.c:199:18: note: 'index_clear' was declared here
>   199 |  u32 index_mask, index_clear;
>       |                  ^~~~~~~~~~~
> drivers/thermal/qcom/tsens-common.c:199:6: warning: 'index_mask' may be used uninitialized in this function [-Wmaybe-uninitialized]
>   199 |  u32 index_mask, index_clear;
>       |      ^~~~~~~~~~
>
> Introduced by commit
>
>   fbfe1a042cfd ("drivers: thermal: tsens: Add interrupt support")
>


What compiler version do you use? Any additional flags to make? I'm
not seeing this, even with W=1.

$ make -k -j`nproc` O=~/work/builds/build-x86/ allmodconfig
$ touch drivers/thermal/qcom/*
──• amit@matterhorn •───(~/.../sources/linux-amit.git) $ make -k
-j`nproc` O=~/work/builds/build-x86/
make[1]: Entering directory '/home/amit/work/builds/build-x86'
  GEN     Makefile
scripts/kconfig/conf  --syncconfig Kconfig
  GEN     Makefile
  DESCEND  objtool
  CALL    /home/amit/work/sources/linux-amit.git/scripts/atomic/check-atomics.sh
  CALL    /home/amit/work/sources/linux-amit.git/scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CHK     kernel/kheaders_data.tar.xz
  CC [M]  drivers/thermal/qcom/tsens.o
  CC [M]  drivers/thermal/qcom/tsens-common.o
  CC [M]  drivers/thermal/qcom/tsens-v0_1.o
  CC [M]  drivers/thermal/qcom/tsens-8960.o
  CC [M]  drivers/thermal/qcom/tsens-v2.o
  CC [M]  drivers/thermal/qcom/tsens-v1.o
  CC [M]  drivers/thermal/qcom/qcom-spmi-temp-alarm.o
  LD [M]  drivers/thermal/qcom/qcom_tsens.o
  Building modules, stage 2.
  MODPOST 7437 modules
Kernel: arch/x86/boot/bzImage is ready  (#3)
  LD [M]  drivers/thermal/qcom/qcom-spmi-temp-alarm.ko
  LD [M]  drivers/thermal/qcom/qcom_tsens.ko
make[1]: Leaving directory '/home/amit/work/builds/build-x86'

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: linux-next: build warning after merge of the thermal tree
  2019-10-22  9:50 ` Amit Kucheria
@ 2019-10-22 11:18   ` Stephen Rothwell
  2019-10-24  7:26     ` Amit Kucheria
  0 siblings, 1 reply; 9+ messages in thread
From: Stephen Rothwell @ 2019-10-22 11:18 UTC (permalink / raw)
  To: Amit Kucheria
  Cc: Daniel Lezcano, Zhang Rui, Eduardo Valentin,
	Linux Next Mailing List, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]

Hi Amit,

On Tue, 22 Oct 2019 15:20:00 +0530 Amit Kucheria <amit.kucheria@linaro.org> wrote:
> 
> What compiler version do you use? Any additional flags to make? I'm
> not seeing this, even with W=1.

$ x86_64-linux-gnu-gcc --version
x86_64-linux-gnu-gcc (Debian 9.2.1-8) 9.2.1 20190909

No special flags to make.
-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: linux-next: build warning after merge of the thermal tree
  2019-10-22 11:18   ` Stephen Rothwell
@ 2019-10-24  7:26     ` Amit Kucheria
  0 siblings, 0 replies; 9+ messages in thread
From: Amit Kucheria @ 2019-10-24  7:26 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Daniel Lezcano, Zhang Rui, Eduardo Valentin,
	Linux Next Mailing List, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 972 bytes --]

Hi Stephen,

On Tue, Oct 22, 2019 at 4:48 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi Amit,
>
> On Tue, 22 Oct 2019 15:20:00 +0530 Amit Kucheria <amit.kucheria@linaro.org> wrote:
> >
> > What compiler version do you use? Any additional flags to make? I'm
> > not seeing this, even with W=1.
>
> $ x86_64-linux-gnu-gcc --version
> x86_64-linux-gnu-gcc (Debian 9.2.1-8) 9.2.1 20190909
>
> No special flags to make.

So this warning only shows up with gcc 9.x. I was using 8.x from my
distro. Will upgrade.

I believe the "fix" is to simply initialize the three variables to
zero (See attached diff). I'll squash that into the patch unless
someone disagrees.

In practice though, we depend on the enum tsens_irq_type irq_type
function parameter to throw a compilation error if we use anything not
defined in the enum. That is also the reason we removed the 'default'
case during review - we should never end up with an undefined value at
runtime.

Regards,
Amit

[-- Attachment #2: variable_init.patch --]
[-- Type: text/x-patch, Size: 837 bytes --]

diff --git i/drivers/thermal/qcom/tsens-common.c w/drivers/thermal/qcom/tsens-common.c
index 03bf1b8133eac..4359a4247ac31 100644
--- i/drivers/thermal/qcom/tsens-common.c
+++ w/drivers/thermal/qcom/tsens-common.c
@@ -180,7 +180,7 @@ static inline enum tsens_ver tsens_version(struct tsens_priv *priv)
 static void tsens_set_interrupt_v1(struct tsens_priv *priv, u32 hw_id,
 				   enum tsens_irq_type irq_type, bool enable)
 {
-	u32 index;
+	u32 index = 0;
 
 	switch (irq_type) {
 	case UPPER:
@@ -196,7 +196,7 @@ static void tsens_set_interrupt_v1(struct tsens_priv *priv, u32 hw_id,
 static void tsens_set_interrupt_v2(struct tsens_priv *priv, u32 hw_id,
 				   enum tsens_irq_type irq_type, bool enable)
 {
-	u32 index_mask, index_clear;
+	u32 index_mask = 0, index_clear = 0;
 
 	/*
 	 * To enable the interrupt flag for a sensor:

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: linux-next: build warning after merge of the thermal tree
  2019-10-21 23:23 linux-next: build warning after merge of the thermal tree Stephen Rothwell
  2019-10-22  9:50 ` Amit Kucheria
@ 2019-10-29  9:05 ` Geert Uytterhoeven
  1 sibling, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2019-10-29  9:05 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Daniel Lezcano, Zhang Rui, Eduardo Valentin,
	Linux Next Mailing List, Linux Kernel Mailing List,
	Amit Kucheria

On Tue, Oct 22, 2019 at 1:25 AM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> After merging the thermal tree, today's linux-next build (x86_64
> allmodconfig) produced this warning:
>
> In file included from drivers/thermal/qcom/tsens-common.c:13:
> drivers/thermal/qcom/tsens-common.c: In function 'tsens_set_interrupt':
> include/linux/regmap.h:87:2: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized]
>    87 |  regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
>       |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/thermal/qcom/tsens-common.c:183:6: note: 'index' was declared here
>   183 |  u32 index;
>       |      ^~~~~
> In file included from drivers/thermal/qcom/tsens-common.c:13:
> include/linux/regmap.h:87:2: warning: 'index_clear' may be used uninitialized in this function [-Wmaybe-uninitialized]
>    87 |  regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
>       |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/thermal/qcom/tsens-common.c:199:18: note: 'index_clear' was declared here
>   199 |  u32 index_mask, index_clear;
>       |                  ^~~~~~~~~~~
> drivers/thermal/qcom/tsens-common.c:199:6: warning: 'index_mask' may be used uninitialized in this function [-Wmaybe-uninitialized]
>   199 |  u32 index_mask, index_clear;
>       |      ^~~~~~~~~~
>
> Introduced by commit
>
>   fbfe1a042cfd ("drivers: thermal: tsens: Add interrupt support")

And kisskb reported the following link failure on m68k:

    ERROR: "__udivdi3" [drivers/thermal/qcom/qcom_tsens.ko] undefined!

Probably caused by a plain 64-bit division in the code.
I expect this shows up on other 32-bit platforms, too.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 9+ messages in thread

* linux-next: build warning after merge of the thermal tree
@ 2019-04-30  3:48 Stephen Rothwell
  0 siblings, 0 replies; 9+ messages in thread
From: Stephen Rothwell @ 2019-04-30  3:48 UTC (permalink / raw)
  To: Zhang Rui
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Daniel Lezcano

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]

Hi Zhang,

After merging the thermal tree, today's linux-next build (arm
multi_v7_defconfig) produced this warning:

boolean symbol THERMAL tested for 'm'? test forced to 'n'

Introduced by commit

  be33e4fbbea5 ("thermal/drivers/core: Remove the module Kconfig's option")

There is a test for =m in drivers/net/ethernet/mellanox/mlxsw/Kconfig.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* linux-next: build warning after merge of the thermal tree
@ 2017-09-01  0:52 Stephen Rothwell
  0 siblings, 0 replies; 9+ messages in thread
From: Stephen Rothwell @ 2017-09-01  0:52 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Linux-Next Mailing List, Linux Kernel Mailing List

Hi Zhang,

After merging the thermal tree, today's linux-next build (x86_64
allmodconfig) produced this warning:

drivers/thermal/int340x_thermal/int3406_thermal.c: In function 'int3406_thermal_get_limit':
drivers/thermal/int340x_thermal/int3406_thermal.c:116:6: warning: unused variable 'index' [-Wunused-variable]
  int index;
      ^

Introduced by commit

  c658894562ba ("Thermal: int3406_thermal: fix thermal sysfs I/F")

-- 
Cheers,
Stephen Rothwell

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: linux-next: build warning after merge of the thermal tree
  2016-08-24  3:38 Stephen Rothwell
@ 2016-08-24  7:56 ` Zhang Rui
  0 siblings, 0 replies; 9+ messages in thread
From: Zhang Rui @ 2016-08-24  7:56 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-next, linux-kernel, Amit Kucheria, Leo Yan

On 三, 2016-08-24 at 13:38 +1000, Stephen Rothwell wrote:
> Hi Zhang,
> 
> After merging the thermal tree, today's linux-next build (powerpc
> allyesconfig) produced this warning:
> 
> warning: (HISI_THERMAL) selects STUB_CLK_HI6220 which has unmet
> direct dependencies (COMMON_CLK && COMMON_CLK_HI6220 && MAILBOX)
> 
> Introduced by commit
> 
>   5f63581ce68e ("thermal: hisilicon: Add dependency on the clock
> driver to allow frequency scaling")
> 
> BTW: That commit message does not match the change (which adds a
> "select" not a "depends on".
> 
Right, thanks for reporting the issue. Patch dropped from thermal -next
tree.

thanks,
rui

^ permalink raw reply	[flat|nested] 9+ messages in thread

* linux-next: build warning after merge of the thermal tree
@ 2016-08-24  3:38 Stephen Rothwell
  2016-08-24  7:56 ` Zhang Rui
  0 siblings, 1 reply; 9+ messages in thread
From: Stephen Rothwell @ 2016-08-24  3:38 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-next, linux-kernel, Amit Kucheria, Leo Yan

Hi Zhang,

After merging the thermal tree, today's linux-next build (powerpc
allyesconfig) produced this warning:

warning: (HISI_THERMAL) selects STUB_CLK_HI6220 which has unmet direct dependencies (COMMON_CLK && COMMON_CLK_HI6220 && MAILBOX)

Introduced by commit

  5f63581ce68e ("thermal: hisilicon: Add dependency on the clock driver to allow frequency scaling")

BTW: That commit message does not match the change (which adds a
"select" not a "depends on".

-- 
Cheers,
Stephen Rothwell

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 23:23 linux-next: build warning after merge of the thermal tree Stephen Rothwell
2019-10-22  9:50 ` Amit Kucheria
2019-10-22 11:18   ` Stephen Rothwell
2019-10-24  7:26     ` Amit Kucheria
2019-10-29  9:05 ` Geert Uytterhoeven
  -- strict thread matches above, loose matches on Subject: below --
2019-04-30  3:48 Stephen Rothwell
2017-09-01  0:52 Stephen Rothwell
2016-08-24  3:38 Stephen Rothwell
2016-08-24  7:56 ` Zhang Rui

Linux-Next Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-next/0 linux-next/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-next linux-next/ https://lore.kernel.org/linux-next \
		linux-next@vger.kernel.org
	public-inbox-index linux-next

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-next


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git