Hi Stephen, On Tue, Oct 22, 2019 at 4:48 PM Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote: > > Hi Amit, > > On Tue, 22 Oct 2019 15:20:00 +0530 Amit Kucheria <amit.kucheria@xxxxxxxxxx> 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
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: