All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix build waring: drivers/regulator/core.c: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized]
@ 2012-11-09  9:29 helight
  2012-11-09 11:03 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: helight @ 2012-11-09  9:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: lrg, broonie

fix build waring on drivers/regulator/core.c
drivers/regulator/core.c: In function ‘regulator_get_bypass_regmap’:
drivers/regulator/core.c:2748:16: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized]
drivers/regulator/core.c: In function ‘regulator_get_voltage_sel_regmap’:
drivers/regulator/core.c:2016:6: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized]
drivers/regulator/core.c: In function ‘regulator_is_enabled_regmap’:
drivers/regulator/core.c:1786:14: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized]


>From c5b564ba10101961ffca9a67c6ddcc6216b99dce Mon Sep 17 00:00:00 2001
From: helight xu <helight.xu@gmail.com>
Date: Sat, 10 Nov 2012 01:11:14 +0800
Subject: [PATCH] fix build waring: drivers/regulator/core.c: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized]


Signed-off-by: helight xu <helight.xu@gmail.com>
---
 drivers/regulator/core.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5c4829c..7ad7174 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1776,8 +1776,8 @@ EXPORT_SYMBOL_GPL(regulator_disable_deferred);
  */
 int regulator_is_enabled_regmap(struct regulator_dev *rdev)
 {
-   unsigned int val;
    int ret;
+   unsigned int val = 0;

    ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val);
    if (ret != 0)
@@ -2006,8 +2006,8 @@ EXPORT_SYMBOL_GPL(regulator_is_supported_voltage);
  */
 int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev)
 {
-   unsigned int val;
    int ret;
+   unsigned int val = 0;

    ret = regmap_read(rdev->regmap, rdev->desc->vsel_reg, &val);
    if (ret != 0)
@@ -2738,8 +2738,8 @@ EXPORT_SYMBOL_GPL(regulator_set_bypass_regmap);
  */
 int regulator_get_bypass_regmap(struct regulator_dev *rdev, bool *enable)
 {
-   unsigned int val;
    int ret;
+   unsigned int val = 0;

    ret = regmap_read(rdev->regmap, rdev->desc->bypass_reg, &val);
    if (ret != 0)
-- 
1.7.10.4

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

* Re: [PATCH] fix build waring: drivers/regulator/core.c: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized]
  2012-11-09  9:29 [PATCH] fix build waring: drivers/regulator/core.c: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized] helight
@ 2012-11-09 11:03 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-11-09 11:03 UTC (permalink / raw)
  To: helight; +Cc: linux-kernel, lrg

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

On Fri, Nov 09, 2012 at 05:29:40PM +0800, helight wrote:

> -   unsigned int val;
>     int ret;
> +   unsigned int val = 0;

This sort of change is really not at all helpful, we should be making
sure that whatever path should be initialising the value but isn't does
so, just initialising at declaration means that if the compiler has
spotted a genuine error we won't fix it.

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

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

end of thread, other threads:[~2012-11-09 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-09  9:29 [PATCH] fix build waring: drivers/regulator/core.c: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized] helight
2012-11-09 11:03 ` Mark Brown

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.