linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Dong Aisheng <aisheng.dong@nxp.com>
Cc: Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org, broonie@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Applied "regulator: anatop: make sure regulator name is properly defined" to the regulator tree
Date: Fri, 14 Apr 2017 18:12:10 +0100	[thread overview]
Message-ID: <E1cz4lW-0005eN-KI@debutante> (raw)
In-Reply-To: <1492180363-2578-1-git-send-email-aisheng.dong@nxp.com>

The patch

   regulator: anatop: make sure regulator name is properly defined

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 4af5924c02818ca170bb6902dbb883687b969aeb Mon Sep 17 00:00:00 2001
From: Dong Aisheng <aisheng.dong@nxp.com>
Date: Fri, 14 Apr 2017 22:32:43 +0800
Subject: [PATCH] regulator: anatop: make sure regulator name is properly
 defined

For anatop regulator we must have a name accordingly. Make sure the name
is properly checked before using it to avoid a possible kernel NULL
point crash.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/anatop-regulator.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index fa27c9de6744..606f3fa6de62 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -198,6 +198,10 @@ static int anatop_regulator_probe(struct platform_device *pdev)
 	rdesc->owner = THIS_MODULE;
 
 	of_property_read_string(np, "regulator-name", &rdesc->name);
+	if (!rdesc->name) {
+		dev_err(dev, "failed to get a regulator-name\n");
+		return -EINVAL;
+	}
 
 	initdata = of_get_regulator_init_data(dev, np, rdesc);
 	if (!initdata)
@@ -300,8 +304,7 @@ static int anatop_regulator_probe(struct platform_device *pdev)
 			sreg->sel = 22;
 
 		/* set the default voltage of the pcie phy to be 1.100v */
-		if (!sreg->sel && rdesc->name &&
-		    !strcmp(rdesc->name, "vddpcie"))
+		if (!sreg->sel && !strcmp(rdesc->name, "vddpcie"))
 			sreg->sel = 0x10;
 
 		if (!sreg->bypass && !sreg->sel) {
-- 
2.11.0

  parent reply	other threads:[~2017-04-14 17:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-14 14:30 [PATCH v2 1/2] dt-binding: regulator: anatop: make regulator name property required Dong Aisheng
2017-04-14 14:32 ` [PATCH v2 2/2] regulator: anatop: make sure regulator name is properly defined Dong Aisheng
2017-04-14 17:09   ` Mark Brown
2017-04-14 17:12   ` Mark Brown [this message]
2017-04-19 15:33 ` [PATCH v2 1/2] dt-binding: regulator: anatop: make regulator name property required A.S. Dong
2017-04-20 20:26   ` Mark Brown
2017-04-20 13:50 ` Rob Herring
2017-04-21 17:28 ` Applied "regulator: anatop: make regulator name property required" to the regulator tree 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=E1cz4lW-0005eN-KI@debutante \
    --to=broonie@kernel.org \
    --cc=aisheng.dong@nxp.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;
as well as URLs for NNTP newsgroup(s).