linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amit Kucheria <amit.kucheria@linaro.org>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	Zhang Rui <rui.zhang@intel.com>,
	Eduardo Valentin <edubezval@gmail.com>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: linux-next: build warning after merge of the thermal tree
Date: Thu, 24 Oct 2019 12:56:34 +0530	[thread overview]
Message-ID: <CAHLCerOkeOEEUgtJ=YgDKKXDiyFXHQ4LBdzg3-3VtKvpyceqFg@mail.gmail.com> (raw)
In-Reply-To: <20191022221406.298ccd6a@canb.auug.org.au>

[-- 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:

  reply	other threads:[~2019-10-24  7:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2019-10-29  9:05 ` Geert Uytterhoeven
  -- strict thread matches above, loose matches on Subject: below --
2020-10-27  0:34 Stephen Rothwell
2020-03-02 23:42 Stephen Rothwell
2020-03-03  0:17 ` Daniel Lezcano
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHLCerOkeOEEUgtJ=YgDKKXDiyFXHQ4LBdzg3-3VtKvpyceqFg@mail.gmail.com' \
    --to=amit.kucheria@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=edubezval@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).