* [PATCH] mfd: Silence uninitialized variable warning for wm8994-core
@ 2012-04-05 3:49 Axel Lin
2012-04-05 9:57 ` Mark Brown
2012-04-16 15:37 ` Samuel Ortiz
0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2012-04-05 3:49 UTC (permalink / raw)
To: linux-kernel; +Cc: Mark Brown, Samuel Ortiz
Fix below build warning:
CC drivers/mfd/wm8994-core.o
drivers/mfd/wm8994-core.c: In function 'wm8994_i2c_probe':
drivers/mfd/wm8994-core.c:582:7: warning: 'patch_regs' may be used uninitialized in this function [-Wuninitialized]
drivers/mfd/wm8994-core.c:393:14: note: 'patch_regs' was declared here
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/mfd/wm8994-core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 9d7ca1e..bd02202 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -390,7 +390,7 @@ static __devinit int wm8994_device_init(struct wm8994 *wm8994, int irq)
struct regmap_config *regmap_config;
const struct reg_default *regmap_patch = NULL;
const char *devname;
- int ret, i, patch_regs;
+ int ret, i, patch_regs = 0;
int pulls = 0;
dev_set_drvdata(wm8994->dev, wm8994);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mfd: Silence uninitialized variable warning for wm8994-core
2012-04-05 3:49 [PATCH] mfd: Silence uninitialized variable warning for wm8994-core Axel Lin
@ 2012-04-05 9:57 ` Mark Brown
2012-04-16 15:37 ` Samuel Ortiz
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2012-04-05 9:57 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Samuel Ortiz
[-- Attachment #1: Type: text/plain, Size: 408 bytes --]
On Thu, Apr 05, 2012 at 11:49:12AM +0800, Axel Lin wrote:
> - int ret, i, patch_regs;
> + int ret, i, patch_regs = 0;
This just unconditionally squashes any possible warnings from this which
isn't great. If we're going to work around flow analysis bugs like this
it's better to do it by doing something like adding an assignment in the
paths that GCC isn't figuring out than by just squashing everything.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mfd: Silence uninitialized variable warning for wm8994-core
2012-04-05 3:49 [PATCH] mfd: Silence uninitialized variable warning for wm8994-core Axel Lin
2012-04-05 9:57 ` Mark Brown
@ 2012-04-16 15:37 ` Samuel Ortiz
1 sibling, 0 replies; 3+ messages in thread
From: Samuel Ortiz @ 2012-04-16 15:37 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Mark Brown
Hi Axel,
On Thu, Apr 05, 2012 at 11:49:12AM +0800, Axel Lin wrote:
> Fix below build warning:
> CC drivers/mfd/wm8994-core.o
> drivers/mfd/wm8994-core.c: In function 'wm8994_i2c_probe':
> drivers/mfd/wm8994-core.c:582:7: warning: 'patch_regs' may be used uninitialized in this function [-Wuninitialized]
> drivers/mfd/wm8994-core.c:393:14: note: 'patch_regs' was declared here
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> drivers/mfd/wm8994-core.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
> index 9d7ca1e..bd02202 100644
> --- a/drivers/mfd/wm8994-core.c
> +++ b/drivers/mfd/wm8994-core.c
> @@ -390,7 +390,7 @@ static __devinit int wm8994_device_init(struct wm8994 *wm8994, int irq)
> struct regmap_config *regmap_config;
> const struct reg_default *regmap_patch = NULL;
> const char *devname;
> - int ret, i, patch_regs;
> + int ret, i, patch_regs = 0;
I'd agree with Mark here. I don't particularily like this kind of fix as it
basically turns potentially useful gcc warnings off.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-16 15:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-05 3:49 [PATCH] mfd: Silence uninitialized variable warning for wm8994-core Axel Lin
2012-04-05 9:57 ` Mark Brown
2012-04-16 15:37 ` Samuel Ortiz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox