From: Tony Lindgren <tony@atomide.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: Peter De Schrijver <pdeschrijver@nvidia.com>,
linux-omap@vger.kernel.org, Samuel Ortiz <sameo@linux.intel.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/4] mfd: twl4030-power: Add support for board specific configuration
Date: Mon, 28 Apr 2014 08:36:20 -0700 [thread overview]
Message-ID: <20140428153620.GJ20807@atomide.com> (raw)
In-Reply-To: <20140428114726.GW21279@lee--X1>
* Lee Jones <lee.jones@linaro.org> [140428 04:47]:
> > With the recommended twl4030 configuration added, we can now add
> > board specific changes as modifications to the recommended
> > configuration.
> >
> > Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
> > Cc: Samuel Ortiz <sameo@linux.intel.com>
> > Cc: Lee Jones <lee.jones@linaro.org>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > ---
> > drivers/mfd/twl4030-power.c | 21 +++++++++++++++++++++
> > include/linux/i2c/twl.h | 1 +
> > 2 files changed, 22 insertions(+)
> >
> > diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
> > index 89a8528..89c6b1a 100644
> > --- a/drivers/mfd/twl4030-power.c
> > +++ b/drivers/mfd/twl4030-power.c
> > @@ -511,13 +511,34 @@ twl4030_power_configure_scripts(const struct twl4030_power_data *pdata)
> > return 0;
> > }
> >
> > +static void twl4030_patch_rconfig(struct twl4030_resconfig *common,
> > + struct twl4030_resconfig *board)
> > +{
> > + while (common->resource) {
> > + struct twl4030_resconfig *b = board;
> > +
> > + while (b->resource) {
> > + if (b->resource == common->resource) {
> > + *common = *b;
> > + break;
> > + }
> > + b++;
> > + }
> > + common++;
> > + }
> > +}
>
> Forgive my ignorance, as I don't know how 'common' is setup, but we
> appear to move to the next 'common' reference them immediately
> dereference it without checking to see if it actually exists. Same
> with 'b'. What happens if we reach the end of the array? NULL
> dereference or does the final element always have a NULLed resource
> attribute?
Yes there's always a NULL entry at the end of the list always in
this case, and the configured lists are always static in the driver.
Regards,
Tony
WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] mfd: twl4030-power: Add support for board specific configuration
Date: Mon, 28 Apr 2014 08:36:20 -0700 [thread overview]
Message-ID: <20140428153620.GJ20807@atomide.com> (raw)
In-Reply-To: <20140428114726.GW21279@lee--X1>
* Lee Jones <lee.jones@linaro.org> [140428 04:47]:
> > With the recommended twl4030 configuration added, we can now add
> > board specific changes as modifications to the recommended
> > configuration.
> >
> > Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
> > Cc: Samuel Ortiz <sameo@linux.intel.com>
> > Cc: Lee Jones <lee.jones@linaro.org>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > ---
> > drivers/mfd/twl4030-power.c | 21 +++++++++++++++++++++
> > include/linux/i2c/twl.h | 1 +
> > 2 files changed, 22 insertions(+)
> >
> > diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
> > index 89a8528..89c6b1a 100644
> > --- a/drivers/mfd/twl4030-power.c
> > +++ b/drivers/mfd/twl4030-power.c
> > @@ -511,13 +511,34 @@ twl4030_power_configure_scripts(const struct twl4030_power_data *pdata)
> > return 0;
> > }
> >
> > +static void twl4030_patch_rconfig(struct twl4030_resconfig *common,
> > + struct twl4030_resconfig *board)
> > +{
> > + while (common->resource) {
> > + struct twl4030_resconfig *b = board;
> > +
> > + while (b->resource) {
> > + if (b->resource == common->resource) {
> > + *common = *b;
> > + break;
> > + }
> > + b++;
> > + }
> > + common++;
> > + }
> > +}
>
> Forgive my ignorance, as I don't know how 'common' is setup, but we
> appear to move to the next 'common' reference them immediately
> dereference it without checking to see if it actually exists. Same
> with 'b'. What happens if we reach the end of the array? NULL
> dereference or does the final element always have a NULLed resource
> attribute?
Yes there's always a NULL entry at the end of the list always in
this case, and the configured lists are always static in the driver.
Regards,
Tony
next prev parent reply other threads:[~2014-04-28 15:36 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-24 0:40 [PATCH 0/4] mfd: twl4030-power: Enable off-idle configuration when booted with device tree Tony Lindgren
2014-04-24 0:40 ` Tony Lindgren
2014-04-24 0:40 ` [PATCH 1/4] mfd: twl4030-power: Add recommended idle configuration Tony Lindgren
2014-04-24 0:40 ` Tony Lindgren
2014-04-28 11:41 ` Lee Jones
2014-04-28 11:41 ` Lee Jones
2014-04-28 15:33 ` Tony Lindgren
2014-04-28 15:33 ` Tony Lindgren
2014-04-28 15:42 ` Lee Jones
2014-04-28 15:42 ` Lee Jones
2014-04-24 0:40 ` [PATCH 2/4] mfd: twl4030-power: Add support for board specific configuration Tony Lindgren
2014-04-24 0:40 ` Tony Lindgren
2014-04-28 11:47 ` Lee Jones
2014-04-28 11:47 ` Lee Jones
2014-04-28 15:36 ` Tony Lindgren [this message]
2014-04-28 15:36 ` Tony Lindgren
2014-04-24 0:40 ` [PATCH 3/4] mfd: twl4030power: Add a configuration to turn off oscillator during off-idle Tony Lindgren
2014-04-24 0:40 ` Tony Lindgren
2014-04-28 11:48 ` Lee Jones
2014-04-28 11:48 ` Lee Jones
2014-04-24 0:40 ` [PATCH 4/4] ARM: dts: Enable twl4030 off-idle configuration for selected omaps Tony Lindgren
2014-04-24 0:40 ` Tony Lindgren
2014-04-24 0:49 ` [PATCH 1a/4] mfd: twl4030-power: Add generic reset configuration Tony Lindgren
2014-04-24 0:49 ` Tony Lindgren
2014-04-28 11:37 ` Lee Jones
2014-04-28 11:37 ` Lee Jones
2014-04-28 16:01 ` Tony Lindgren
2014-04-28 16:01 ` Tony Lindgren
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=20140428153620.GJ20807@atomide.com \
--to=tony@atomide.com \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=pdeschrijver@nvidia.com \
--cc=sameo@linux.intel.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.