All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][V2] leds: TI LMU: fix u8 variable comparisons with less than zero
@ 2019-05-22 10:17 ` Colin King
  0 siblings, 0 replies; 7+ messages in thread
From: Colin King @ 2019-05-22 10:17 UTC (permalink / raw)
  To: Jacek Anaszewski, Pavel Machek, Dan Murphy, linux-leds
  Cc: kernel-janitors, linux-kernel

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;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH][V2] leds: TI LMU: fix u8 variable comparisons with less than zero
@ 2019-05-22 10:17 ` Colin King
  0 siblings, 0 replies; 7+ messages in thread
From: Colin King @ 2019-05-22 10:17 UTC (permalink / raw)
  To: Jacek Anaszewski, Pavel Machek, Dan Murphy, linux-leds
  Cc: kernel-janitors, linux-kernel

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;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH][V2] leds: TI LMU: fix u8 variable comparisons with less than zero
  2019-05-22 10:17 ` Colin King
  (?)
@ 2019-05-22 11:42   ` Dan Murphy
  -1 siblings, 0 replies; 7+ messages in thread
From: Dan Murphy @ 2019-05-22 11:42 UTC (permalink / raw)
  To: Colin King, Jacek Anaszewski, Pavel Machek, linux-leds
  Cc: kernel-janitors, linux-kernel



On 5/22/19 5:17 AM, 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;
> 

Reviewed-by: Dan Murphy <dmurphy@ti.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][V2] leds: TI LMU: fix u8 variable comparisons with less than zero
@ 2019-05-22 11:42   ` Dan Murphy
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Murphy @ 2019-05-22 11:42 UTC (permalink / raw)
  To: Colin King, Jacek Anaszewski, Pavel Machek, linux-leds
  Cc: kernel-janitors, linux-kernel



On 5/22/19 5:17 AM, 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;
> 

Reviewed-by: Dan Murphy <dmurphy@ti.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][V2] leds: TI LMU: fix u8 variable comparisons with less than zero
@ 2019-05-22 11:42   ` Dan Murphy
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Murphy @ 2019-05-22 11:42 UTC (permalink / raw)
  To: Colin King, Jacek Anaszewski, Pavel Machek, linux-leds
  Cc: kernel-janitors, linux-kernel



On 5/22/19 5:17 AM, 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;
> 

Reviewed-by: Dan Murphy <dmurphy@ti.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][V2] leds: TI LMU: fix u8 variable comparisons with less than zero
  2019-05-22 10:17 ` Colin King
@ 2019-05-22 20:48   ` Jacek Anaszewski
  -1 siblings, 0 replies; 7+ messages in thread
From: Jacek Anaszewski @ 2019-05-22 20:48 UTC (permalink / raw)
  To: Colin King
  Cc: Pavel Machek, Dan Murphy, linux-leds, kernel-janitors, linux-kernel

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][V2] leds: TI LMU: fix u8 variable comparisons with less than zero
@ 2019-05-22 20:48   ` Jacek Anaszewski
  0 siblings, 0 replies; 7+ messages in thread
From: Jacek Anaszewski @ 2019-05-22 20:48 UTC (permalink / raw)
  To: Colin King
  Cc: Pavel Machek, Dan Murphy, linux-leds, kernel-janitors, linux-kernel

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-05-22 20:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 10:17 [PATCH][V2] leds: TI LMU: fix u8 variable comparisons with less than zero Colin King
2019-05-22 10:17 ` Colin King
2019-05-22 11:42 ` Dan Murphy
2019-05-22 11:42   ` Dan Murphy
2019-05-22 11:42   ` Dan Murphy
2019-05-22 20:48 ` Jacek Anaszewski
2019-05-22 20:48   ` Jacek Anaszewski

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.