mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Keith Busch <keith.busch@intel.com>
To: linux-kernel@vger.kernel.org
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Keith Busch <keith.busch@intel.com>
Subject: [PATCH] Regulator: Suppress compiler warnings
Date: Mon, 31 Aug 2015 10:41:52 -0600	[thread overview]
Message-ID: <1441039312-2961-1-git-send-email-keith.busch@intel.com> (raw)

Some compilers complain of possible uninitialized variable usage, like
the following:

  drivers/regulator/helpers.c: In function ‘regulator_get_bypass_regmap’:
  drivers/regulator/helpers.c:463:16: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized]

The code is safe though, and only uses the variables if they were
successfully set, so suppressing the warning with uninitialized_val.

Signed-off-by: Keith Busch <keith.busch@intel.com>
---
 drivers/regulator/helpers.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c
index 3bbb326..bb5b22a 100644
--- a/drivers/regulator/helpers.c
+++ b/drivers/regulator/helpers.c
@@ -30,7 +30,7 @@
  */
 int regulator_is_enabled_regmap(struct regulator_dev *rdev)
 {
-	unsigned int val;
+	unsigned int uninitialized_var(val);
 	int ret;
 
 	ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val);
@@ -114,7 +114,7 @@ EXPORT_SYMBOL_GPL(regulator_disable_regmap);
  */
 int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev)
 {
-	unsigned int val;
+	unsigned int uninitialized_var(val);
 	int ret;
 
 	ret = regmap_read(rdev->regmap, rdev->desc->vsel_reg, &val);
@@ -453,7 +453,7 @@ EXPORT_SYMBOL_GPL(regulator_set_bypass_regmap);
  */
 int regulator_get_bypass_regmap(struct regulator_dev *rdev, bool *enable)
 {
-	unsigned int val;
+	unsigned int uninitialized_var(val);
 	int ret;
 
 	ret = regmap_read(rdev->regmap, rdev->desc->bypass_reg, &val);
-- 
1.7.10.4


             reply	other threads:[~2015-08-31 16:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-31 16:41 Keith Busch [this message]
2015-09-01  0:52 ` Krzysztof Kozlowski
2015-09-01 13:09   ` Mark Brown
2015-09-01 18:40     ` Keith Busch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441039312-2961-1-git-send-email-keith.busch@intel.com \
    --to=keith.busch@intel.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®