All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: wm8994: add missing variable initialization
@ 2013-02-19  0:56 Jingoo Han
  2013-02-19 12:18 ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Jingoo Han @ 2013-02-19  0:56 UTC (permalink / raw)
  To: 'Samuel Ortiz'
  Cc: 'Mark Brown', patches, linux-kernel, 'Jingoo Han'

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

Signed-off-by: Jingoo Han <jg1.han@samsung.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 803e93f..97e929e 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -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)) {
-- 
1.7.2.5



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

* Re: [PATCH] mfd: wm8994: add missing variable initialization
  2013-02-19  0:56 [PATCH] mfd: wm8994: add missing variable initialization Jingoo Han
@ 2013-02-19 12:18 ` Mark Brown
  2013-02-20  2:53   ` [PATCH v2] mfd: wm8994: silence bogus warning in wm8994_device_init() Jingoo Han
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2013-02-19 12:18 UTC (permalink / raw)
  To: Jingoo Han; +Cc: 'Samuel Ortiz', patches, linux-kernel

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

On Tue, Feb 19, 2013 at 09:56:26AM +0900, Jingoo Han wrote:

> -	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.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH v2] mfd: wm8994: silence bogus warning in wm8994_device_init()
  2013-02-19 12:18 ` Mark Brown
@ 2013-02-20  2:53   ` Jingoo Han
  2013-02-20 16:48     ` Mark Brown
  2013-04-08  9:57     ` Samuel Ortiz
  0 siblings, 2 replies; 5+ messages in thread
From: Jingoo Han @ 2013-02-20  2:53 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Samuel Ortiz', patches, linux-kernel, 'Jingoo Han'

'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

Signed-off-by: Jingoo Han <jg1.han@samsung.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 803e93f..97e929e 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -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)) {
-- 
1.7.2.5



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

* Re: [PATCH v2] mfd: wm8994: silence bogus warning in wm8994_device_init()
  2013-02-20  2:53   ` [PATCH v2] mfd: wm8994: silence bogus warning in wm8994_device_init() Jingoo Han
@ 2013-02-20 16:48     ` Mark Brown
  2013-04-08  9:57     ` Samuel Ortiz
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-02-20 16:48 UTC (permalink / raw)
  To: Jingoo Han; +Cc: 'Samuel Ortiz', patches, linux-kernel

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

On Wed, Feb 20, 2013 at 11:53:36AM +0900, Jingoo Han wrote:
> '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.

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH v2] mfd: wm8994: silence bogus warning in wm8994_device_init()
  2013-02-20  2:53   ` [PATCH v2] mfd: wm8994: silence bogus warning in wm8994_device_init() Jingoo Han
  2013-02-20 16:48     ` Mark Brown
@ 2013-04-08  9:57     ` Samuel Ortiz
  1 sibling, 0 replies; 5+ messages in thread
From: Samuel Ortiz @ 2013-04-08  9:57 UTC (permalink / raw)
  To: Jingoo Han; +Cc: 'Mark Brown', patches, linux-kernel

Hi Jingoo,

On Wed, Feb 20, 2013 at 11:53:36AM +0900, Jingoo Han wrote:
> '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
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
>  drivers/mfd/wm8994-core.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
Applied, thanks.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

end of thread, other threads:[~2013-04-08  9:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-19  0:56 [PATCH] mfd: wm8994: add missing variable initialization Jingoo Han
2013-02-19 12:18 ` Mark Brown
2013-02-20  2:53   ` [PATCH v2] mfd: wm8994: silence bogus warning in wm8994_device_init() Jingoo Han
2013-02-20 16:48     ` Mark Brown
2013-04-08  9:57     ` Samuel Ortiz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.