From: Stephen Warren <swarren@wwwdotorg.org>
To: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Liam Girdwood <lrg@ti.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Axel Lin <axel.lin@gmail.com>,
Gyungoh Yoo <jack.yoo@maxim-ic.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] max8907: fix use of possibly NULL idata
Date: Thu, 23 Aug 2012 12:25:19 -0600 [thread overview]
Message-ID: <5036758F.1030507@wwwdotorg.org> (raw)
In-Reply-To: <1345745958-16782-1-git-send-email-swarren@wwwdotorg.org>
On 08/23/2012 12:19 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> If a regulator is not used by a board, it's quite legitimate not to
> provide platform data or a device tree node to configure it (i.e.
> regulator_init_data). In that case, during MAX8907 regulator's
> probe(), the idata variable will be NULL for that regulator. Prevent
> dereferincing it.
>
> If the MBATT regulator's init_data is not specified, or no name was
> specified in the constraints, the regulator will be named based on
> the regulator descriptor, so initialize mbatt_rail_name from there.
Laxman,
The TPS6586x driver avoids this NULL-dereference issue by simply not
registering any regulators when idata is NULL. See
drivers/mfd/tps6586x.c:tps6586x_parse_dt():
> for (i = 0, j = 0; i < num && j < count; i++) {
> struct regulator_init_data *reg_idata;
>
> if (!tps6586x_matches[i].init_data)
> continue;
If I interpreted Mark Brown correctly, this isn't correct; all the
regulators within the chip should always be registered, just without any
user-supplied constraints. Assuming I didn't misinterpret Mark, can you
please fix the TPS6586x driver to always register the regulators, and
apply the fix below. Could you please check the TPS65911 driver and see
what the status is there too? Thanks very much!
next prev parent reply other threads:[~2012-08-23 18:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-23 18:19 [PATCH] max8907: fix use of possibly NULL idata Stephen Warren
2012-08-23 18:25 ` Stephen Warren [this message]
2012-08-23 18:09 ` Laxman Dewangan
2012-08-27 18:22 ` Mark Brown
2012-08-27 16:42 ` 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=5036758F.1030507@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=axel.lin@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=jack.yoo@maxim-ic.com \
--cc=ldewangan@nvidia.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 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.