LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Colin King <colin.king@canonical.com>
Cc: Pavel Machek <pavel@ucw.cz>, Dan Murphy <dmurphy@ti.com>,
	linux-leds@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][V2] leds: TI LMU: fix u8 variable comparisons with less than zero
Date: Wed, 22 May 2019 22:48:44 +0200	[thread overview]
Message-ID: <1dab790f-0b82-5fac-2081-7943379ccc54@gmail.com> (raw)
In-Reply-To: <20190522101745.21828-1-colin.king@canonical.com>

Hi Colin,

Thank you for the patch.

On 5/22/19 12:17 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The u8 variables ramp_ups and ramp_downs are being compared to less
> than zero, this will always be false.  Fix this by making the ramp
> variables ints.
> 
> Addresses-Coverity: ("Unsigned compared against 0")
> Fixes: 9a8e66ebeaa2 ("leds: TI LMU: Add common code for TI LMU devices")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> 
> V2: make u8 vars ints rather than removing the comparison. Thanks once
> more to Dan Carpenter for spotting my clearly stupid V1 version and
> correcting my mistake.
> 
> ---
>   drivers/leds/leds-ti-lmu-common.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/leds/leds-ti-lmu-common.c b/drivers/leds/leds-ti-lmu-common.c
> index adc7293004f1..c9ab40d5a6ba 100644
> --- a/drivers/leds/leds-ti-lmu-common.c
> +++ b/drivers/leds/leds-ti-lmu-common.c
> @@ -84,7 +84,7 @@ static int ti_lmu_common_convert_ramp_to_index(unsigned int usec)
>   int ti_lmu_common_set_ramp(struct ti_lmu_bank *lmu_bank)
>   {
>   	struct regmap *regmap = lmu_bank->regmap;
> -	u8 ramp, ramp_up, ramp_down;
> +	int ramp, ramp_up, ramp_down;
>   
>   	if (lmu_bank->ramp_up_usec == 0 && lmu_bank->ramp_down_usec == 0) {
>   		ramp_up = 0;
> 

Applied.

-- 
Best regards,
Jacek Anaszewski

      parent reply	other threads:[~2019-05-22 20:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22 10:17 Colin King
2019-05-22 11:42 ` Dan Murphy
2019-05-22 20:48 ` Jacek Anaszewski [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=1dab790f-0b82-5fac-2081-7943379ccc54@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=colin.king@canonical.com \
    --cc=dmurphy@ti.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --subject='Re: [PATCH][V2] leds: TI LMU: fix u8 variable comparisons with less than zero' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).