From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Sven Wegener <sven.wegener@stealer.net>
Cc: Richard Purdie <rpurdie@rpsys.net>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] leds: Add WM8350 LED driver
Date: Wed, 26 Nov 2008 18:17:11 +0000 [thread overview]
Message-ID: <20081126181710.GH6234@sirena.org.uk> (raw)
In-Reply-To: <alpine.LNX.2.00.0811261837420.23445@titan.stealer.net>
On Wed, Nov 26, 2008 at 06:39:04PM +0100, Sven Wegener wrote:
You should cut irrelevant text from your mail; it makes it much easier
to find what you're actually saying - if you've got hundreds of lines of
unbroken quoted text it's easy to page straight past small comments.
> On Wed, 26 Nov 2008, Mark Brown wrote:
> > + isink = regulator_get(&pdev->dev, "led_isink");
> > + if (IS_ERR(isink) || isink == NULL) {
> > + printk(KERN_ERR "%s: cant get ISINK\n", __func__);
> > + return PTR_ERR(isink);
> Uhm, if isink is ever NULL, which according to your check above you
> expect it to happen, this will return 0, meaning success. I'm not sure
> if this is what you want and looking at regulator_get() it should never
> be NULL.
No, it should never be NULL - this is was inherited from the out of tree
history.
> > + for (i = 0; i < ARRAY_SIZE(isink_cur) - 1; i++)
> This loop will skip the last array member.
This is intentional, it ensures that we always end up pointing to a
value within the array.
> > +int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink,
> > + struct wm8350_led_platform_data *pdata)
> > +{
> > + struct wm8350_led *led = &wm8350->pmic.led[lednum];
> > + struct platform_device *pdev;
> > + int ret;
> > +
> > + if (lednum > ARRAY_SIZE(wm8350->pmic.led) || lednum < 0) {
> > + dev_err(wm8350->dev, "Invalid LED index %d\n", lednum);
> > + return -ENODEV;
> > + }
> You already used lednum as an array index above, I'm not sure if this
> can have any side effects. I think it shouldn't, as you only use it to
> get a pointer.
It's out of spec to index beyond the end of the array but shouldn't
produce any actual runtime problems unless the either the implementation
or the platform code is being silly. I'll shuffle the code around,
though.
Fixed everything else.
next prev parent reply other threads:[~2008-11-26 18:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-26 13:53 [PATCH] leds: Add WM8350 LED driver Mark Brown
2008-11-26 17:39 ` Sven Wegener
2008-11-26 18:17 ` Mark Brown [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-12-03 13:20 [PATCH 0/5] ASoC updates Mark Brown
2008-12-03 13:24 ` [PATCH 1/5] ASoC: Push workqueue data into snd_soc_card Mark Brown
2008-12-03 13:24 ` [PATCH] leds: Add WM8350 LED driver Mark Brown
2008-12-03 13:29 ` Mark Brown
2008-11-26 18:26 Mark Brown
2008-11-17 14:52 Mark Brown
2008-11-17 15:25 ` Frederik Deweerdt
2008-11-17 15:29 ` Mark Brown
2008-11-13 12:39 Mark Brown
2008-11-14 23:19 ` Andrew Morton
2008-11-17 11:57 ` Mark Brown
2008-11-15 17:29 ` Pavel Machek
2008-11-15 17:43 ` 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=20081126181710.GH6234@sirena.org.uk \
--to=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rpurdie@rpsys.net \
--cc=sven.wegener@stealer.net \
/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.