mfd: wm8994: add missing variable initialization
Subsystems (2)
PATCH 1/1 mfd: wm8994: add missing variable initialization
Fixed build warning as below:
drivers/mfd/wm8994-core.c: In function 'wm8994_i2c_probe':drivers/mfd/wm8994-core.c:595:7: warning: 'patch_regs' may be used uninitialized in this function [-Wuninitialized] drivers/mfd/wm8994-core.c:408:14: note: 'patch_regs' was declared here
--- drivers/mfd/wm8994-core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mfd/wm8994-core.c +1 -1
@@ -405,7 +405,7 @@ static 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 ;if (dev_get_platdata (wm8994->dev)) {
Signature · 1 line
1.7.2.5
drivers/mfd/wm8994-core.c static int wm8994_device_init(struct wm8994 *wm8994, int irq) · line 408
Quoted 2 lines · Jingoo Han
drivers/mfd/wm8994-core.c +1
-1-int ret, i, patch_regs; +int ret, i, patch_regs =0 ;
As with all such changes you really need to explain why it's safe to just blindly initialise to this particular value and why this isn't just masking a real issue in the code. Initialising with a random value will fix the warning but that might just be turning off the compiler's checks.
PATCH v2 1/1 mfd: wm8994: silence bogus warning in wm8994_device_init()
'patch_regs' cannot be used uninitialized in wm8994_device_init(), because 'patch_regs' was already guarded by 'regmap_patch'. Thus, that's a bogus warning.
Without this patch, the build warning happens as below:
drivers/mfd/wm8994-core.c: In function 'wm8994_i2c_probe':drivers/mfd/wm8994-core.c:595:7: warning: 'patch_regs' may be used uninitialized in this function [-Wuninitialized] drivers/mfd/wm8994-core.c:408:14: note: 'patch_regs' was declared here
--- drivers/mfd/wm8994-core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mfd/wm8994-core.c +1 -1
@@ -405,7 +405,7 @@ static 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 ;if (dev_get_platdata (wm8994->dev)) {
Signature · 1 line
1.7.2.5
Re: [PATCH v2] mfd: wm8994: silence bogus warning in wm8994_device_init()
Quoted 3 lines · Jingoo Han
'
patch_regs' cannot be used uninitialized inwm8994_device_init(), because 'patch_regs' was already guarded by 'regmap_patch'. Thus, that's a bogus warning.
Samuel Ortiz
AppliedRe: [PATCH v2] mfd: wm8994: silence bogus warning in wm8994_device_init()
In reply to Jingoo HanHi Jingoo,
Quoted 6 lines · Jingoo Han
'
patch_regs' cannot be used uninitialized inwm8994_device_init(), because 'patch_regs' was already guarded by 'regmap_patch'. Thus, that's a bogus warning.Without this patch, the build warning happens as below:
Quoted 8 lines
drivers/mfd/wm8994-core.c: In function 'wm8994_i2c_probe':drivers/mfd/wm8994-core.c:595:7: warning: 'patch_regs' may be used uninitialized in this function [-Wuninitialized]drivers/mfd/wm8994-core.c:408:14: note: 'patch_regs' was declared hereSigned-off-by Jingoo Han <[email protected]>--- drivers/mfd/wm8994-core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied, thanks.
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/