From: AnilKumar Ch <anilkumar@ti.com>
To: <broonie@opensource.wolfsonmicro.com>, <linux-kernel@vger.kernel.org>
Cc: <axel.lin@gmail.com>, <lrg@ti.com>, AnilKumar Ch <anilkumar@ti.com>
Subject: [PATCH] regulator: core: fix rdev->regmap NULL pointer
Date: Fri, 7 Sep 2012 20:45:05 +0530 [thread overview]
Message-ID: <1347030905-17722-1-git-send-email-anilkumar@ti.com> (raw)
Fixes rdev->regmap NULL pointer if regmap for regulator device
is NULL. If it is NULL then get regmap for regulator device
from its parent (MFD).
Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
---
drivers/regulator/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 4838531..7d85402 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3189,8 +3189,10 @@ regulator_register(const struct regulator_desc *regulator_desc,
rdev->desc = regulator_desc;
if (config->regmap)
rdev->regmap = config->regmap;
- else
+ else if (dev_get_regmap(dev, NULL))
rdev->regmap = dev_get_regmap(dev, NULL);
+ else if (dev->parent)
+ rdev->regmap = dev_get_regmap(dev->parent, NULL);
INIT_LIST_HEAD(&rdev->consumer_list);
INIT_LIST_HEAD(&rdev->list);
BLOCKING_INIT_NOTIFIER_HEAD(&rdev->notifier);
--
1.7.9.5
next reply other threads:[~2012-09-07 15:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-07 15:15 AnilKumar Ch [this message]
2012-09-08 0:57 ` 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=1347030905-17722-1-git-send-email-anilkumar@ti.com \
--to=anilkumar@ti.com \
--cc=axel.lin@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
/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®