From: Pavel Machek <pavel@ucw.cz>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Richard Purdie <rpurdie@rpsys.net>,
Sean Wang <sean.wang@mediatek.com>,
Jacek Anaszewski <jacek.anaszewski@gmail.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
linux-leds@vger.kernel.org, linux-mediatek@lists.infradead.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] leds: mt6323: Fix an off by one bug in probe
Date: Thu, 23 Mar 2017 11:16:55 +0000 [thread overview]
Message-ID: <20170323111655.GA12792@amd> (raw)
In-Reply-To: <20170323104049.GC20154@mwanda>
[-- Attachment #1: Type: text/plain, Size: 1040 bytes --]
On Thu 2017-03-23 13:40:49, Dan Carpenter wrote:
> It should be ">= MT6323_MAX_LEDS" instead of ">". Also "reg" is a u32
> so it can't be negative and we can remove the test for negative values.
>
> Fixes: 216ec6cc4c19 ("leds: Add LED support for MT6323 PMIC")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
> diff --git a/drivers/leds/leds-mt6323.c b/drivers/leds/leds-mt6323.c
> index 48081bccbea5..8893c74e9a1f 100644
> --- a/drivers/leds/leds-mt6323.c
> +++ b/drivers/leds/leds-mt6323.c
> @@ -417,7 +417,7 @@ static int mt6323_led_probe(struct platform_device *pdev)
> goto put_child_node;
> }
>
> - if (reg < 0 || reg > MT6323_MAX_LEDS || leds->led[reg]) {
> + if (reg >= MT6323_MAX_LEDS || leds->led[reg]) {
> dev_err(dev, "Invalid led reg %u\n", reg);
> ret = -EINVAL;
> goto put_child_node;
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2017-03-23 11:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-23 10:40 [PATCH] leds: mt6323: Fix an off by one bug in probe Dan Carpenter
2017-03-23 11:16 ` Pavel Machek [this message]
2017-03-23 19:37 ` Jacek Anaszewski
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=20170323111655.GA12792@amd \
--to=pavel@ucw.cz \
--cc=dan.carpenter@oracle.com \
--cc=jacek.anaszewski@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=rpurdie@rpsys.net \
--cc=sean.wang@mediatek.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