linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mpa@pengutronix.de (Markus Pargmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 4/4] regulator: tps65090: Fix gpio initialization
Date: Mon,  3 Nov 2014 19:12:07 +0100	[thread overview]
Message-ID: <1415038327-32616-5-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1415038327-32616-1-git-send-email-mpa@pengutronix.de>

The config is used for multiple regulators within a for loop. The config
field is not cleared before it is used for the next item. To avoid any
issues this patch adds a proper initialization for the config->ena_gpio
field in case no gpio is available.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 drivers/regulator/tps65090-regulator.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c
index 2e92aa8718cc..f1df4423d361 100644
--- a/drivers/regulator/tps65090-regulator.c
+++ b/drivers/regulator/tps65090-regulator.c
@@ -314,6 +314,9 @@ static void tps65090_configure_regulator_config(
 		config->ena_gpio = tps_pdata->gpio;
 		config->ena_gpio_initialized = true;
 		config->ena_gpio_flags = gpio_flag;
+	} else {
+		config->ena_gpio = -EINVAL;
+		config->ena_gpio_initialized = false;
 	}
 }
 
-- 
2.1.1

  parent reply	other threads:[~2014-11-03 18:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-03 18:12 [PATCH v3 0/4] regulator: Fix core behaviour for gpio 0, remaining patches Markus Pargmann
2014-11-03 18:12 ` [PATCH v3 1/4] regulator: Set ena_gpio_initialized in regulator drivers Markus Pargmann
2014-11-03 18:12 ` [PATCH v3 2/4] regulator: fixed: Use gpio_is_valid Markus Pargmann
2014-11-03 18:12 ` [PATCH v3 3/4] regulator: gpio: " Markus Pargmann
2014-11-03 18:12 ` Markus Pargmann [this message]
2014-11-07 11:30 ` [PATCH v3 0/4] regulator: Fix core behaviour for gpio 0, remaining patches Mark Brown

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=1415038327-32616-5-git-send-email-mpa@pengutronix.de \
    --to=mpa@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).