public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Dan Murphy <dmurphy@ti.com>, pavel@ucw.cz
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] leds: ti-lmu-common: Fix coccinelle issue in TI LMU
Date: Wed, 28 Aug 2019 22:27:24 +0200	[thread overview]
Message-ID: <3c0d26f7-52db-d0ff-e2cf-0dcc15edc67b@gmail.com> (raw)
In-Reply-To: <20190828152219.27640-1-dmurphy@ti.com>

Hi Dan,

Thank you for the update.

On 8/28/19 5:22 PM, Dan Murphy wrote:
> Fix the coccinelle issues found in the TI LMU common code
> 
> drivers/leds/leds-ti-lmu-common.c:97:20-29: WARNING: Unsigned expression compared with zero: ramp_down < 0
> drivers/leds/leds-ti-lmu-common.c:97:5-12: WARNING: Unsigned expression compared with zero: ramp_up < 0
> 
> Fixes: f717460ba4d7 ("leds: TI LMU: Add common code for TI LMU devices")
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
>  drivers/leds/leds-ti-lmu-common.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/leds/leds-ti-lmu-common.c b/drivers/leds/leds-ti-lmu-common.c
> index adc7293004f1..e294a0b097e3 100644
> --- a/drivers/leds/leds-ti-lmu-common.c
> +++ b/drivers/leds/leds-ti-lmu-common.c
> @@ -11,10 +11,10 @@
>  
>  #include <linux/leds-ti-lmu-common.h>
>  
> -const static int ramp_table[16] = {2048, 262000, 524000, 1049000, 2090000,
> -				4194000, 8389000, 16780000, 33550000, 41940000,
> -				50330000, 58720000, 67110000, 83880000,
> -				100660000, 117440000};
> +const static unsigned int ramp_table[16] = {2048, 262000, 524000, 1049000,
> +				2090000, 4194000, 8389000, 16780000, 33550000,
> +				41940000, 50330000, 58720000, 67110000,
> +				83880000, 100660000, 117440000};
>  
>  static int ti_lmu_common_update_brightness(struct ti_lmu_bank *lmu_bank,
>  					   int brightness)
> @@ -54,7 +54,7 @@ int ti_lmu_common_set_brightness(struct ti_lmu_bank *lmu_bank, int brightness)
>  }
>  EXPORT_SYMBOL(ti_lmu_common_set_brightness);
>  
> -static int ti_lmu_common_convert_ramp_to_index(unsigned int usec)
> +static unsigned int ti_lmu_common_convert_ramp_to_index(unsigned int usec)
>  {
>  	int size = ARRAY_SIZE(ramp_table);
>  	int i;
> @@ -78,7 +78,7 @@ static int ti_lmu_common_convert_ramp_to_index(unsigned int usec)
>  		}
>  	}
>  
> -	return -EINVAL;
> +	return 0;
>  }
>  
>  int ti_lmu_common_set_ramp(struct ti_lmu_bank *lmu_bank)
> @@ -94,9 +94,6 @@ int ti_lmu_common_set_ramp(struct ti_lmu_bank *lmu_bank)
>  		ramp_down = ti_lmu_common_convert_ramp_to_index(lmu_bank->ramp_down_usec);
>  	}
>  
> -	if (ramp_up < 0 || ramp_down < 0)
> -		return -EINVAL;
> -
>  	ramp = (ramp_up << 4) | ramp_down;
>  
>  	return regmap_write(regmap, lmu_bank->runtime_ramp_reg, ramp);
> 

I've applied the patch but amended SHA1 in the Fixes tag - in mainline
it is 3fce8e1eb994.

-- 
Best regards,
Jacek Anaszewski

      reply	other threads:[~2019-08-28 20:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28 15:22 [PATCH v2] leds: ti-lmu-common: Fix coccinelle issue in TI LMU Dan Murphy
2019-08-28 20:27 ` 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=3c0d26f7-52db-d0ff-e2cf-0dcc15edc67b@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=dmurphy@ti.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