From: Dan Murphy <dmurphy@ti.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: <jacek.anaszewski@gmail.com>, <linux-leds@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] leds: core: Fix LED_COLOR_MAX_ID
Date: Wed, 2 Oct 2019 13:42:36 -0500 [thread overview]
Message-ID: <fae233c1-7c5b-7468-33c1-5309c036fd66@ti.com> (raw)
In-Reply-To: <20191002183603.GC13492@amd>
Hello
On 10/2/19 1:36 PM, Pavel Machek wrote:
> On Wed 2019-10-02 11:34:00, Dan Murphy wrote:
>> The LED_COLOR_MAX_ID is incorrect. THe MAX_ID should
>> be the last COLOR_ID in the list. If an array was allocate
>> with MAX_ID the allocation would be correct but the meaning
>> is wrong.
>>
>> So for array allocation the code should use LED_NUM_COLOR_IDS
>> which will allocate MAX_ID + 1. Whent the code needs to validate
>> that the color ID is not out of bounds then the code should use
>> LED_COLOR_MAX_ID.
> Renaming original define might have been okay. Having two defines is
> not. I'd say we can keep it as is...
OK. It was just not logical that MAX_ID will always be 1 more then the
actual MAX_ID.
So every ID boundary check will need to be ">=" as opposed to ">" which
means we have to take care in reviews to make sure this is what is intended.
But it was just a RFC so I am not pushing this fix. It would mean I
would have to re-touch the MC framework patches.
Dan
>
> Pavel
>
prev parent reply other threads:[~2019-10-02 18:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-02 16:34 Dan Murphy
2019-10-02 18:36 ` Pavel Machek
2019-10-02 18:42 ` Dan Murphy [this message]
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=fae233c1-7c5b-7468-33c1-5309c036fd66@ti.com \
--to=dmurphy@ti.com \
--cc=jacek.anaszewski@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
/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®