* [PATCH][next] leds: TI LMU: remove redundant u8 comparisons with less than zero
@ 2019-05-22 8:26 ` Colin King
0 siblings, 0 replies; 6+ messages in thread
From: Colin King @ 2019-05-22 8:26 UTC (permalink / raw)
To: Dan Murphy, Jacek Anaszewski, Pavel Machek, linux-leds
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The u8 variables ramp_up and ramp_down are being compared to less
than zero, this will always be false. Code is redundant so remove
it.
Addresses-Coverity: ("Unsigned compared against 0")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/leds/leds-ti-lmu-common.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/leds/leds-ti-lmu-common.c b/drivers/leds/leds-ti-lmu-common.c
index adc7293004f1..6db47accfe62 100644
--- a/drivers/leds/leds-ti-lmu-common.c
+++ b/drivers/leds/leds-ti-lmu-common.c
@@ -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);
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH][next] leds: TI LMU: remove redundant u8 comparisons with less than zero
@ 2019-05-22 8:26 ` Colin King
0 siblings, 0 replies; 6+ messages in thread
From: Colin King @ 2019-05-22 8:26 UTC (permalink / raw)
To: Dan Murphy, Jacek Anaszewski, Pavel Machek, linux-leds
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The u8 variables ramp_up and ramp_down are being compared to less
than zero, this will always be false. Code is redundant so remove
it.
Addresses-Coverity: ("Unsigned compared against 0")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/leds/leds-ti-lmu-common.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/leds/leds-ti-lmu-common.c b/drivers/leds/leds-ti-lmu-common.c
index adc7293004f1..6db47accfe62 100644
--- a/drivers/leds/leds-ti-lmu-common.c
+++ b/drivers/leds/leds-ti-lmu-common.c
@@ -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);
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH][next] leds: TI LMU: remove redundant u8 comparisons with less than zero
2019-05-22 8:26 ` Colin King
@ 2019-05-22 9:53 ` Dan Carpenter
-1 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2019-05-22 9:53 UTC (permalink / raw)
To: Colin King
Cc: Dan Murphy, Jacek Anaszewski, Pavel Machek, linux-leds,
kernel-janitors, linux-kernel
No. This isn't the right fix. We should declare them as int instead.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][next] leds: TI LMU: remove redundant u8 comparisons with less than zero
@ 2019-05-22 9:53 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2019-05-22 9:53 UTC (permalink / raw)
To: Colin King
Cc: Dan Murphy, Jacek Anaszewski, Pavel Machek, linux-leds,
kernel-janitors, linux-kernel
No. This isn't the right fix. We should declare them as int instead.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][next] leds: TI LMU: remove redundant u8 comparisons with less than zero
2019-05-22 9:53 ` Dan Carpenter
@ 2019-05-22 10:00 ` Colin Ian King
-1 siblings, 0 replies; 6+ messages in thread
From: Colin Ian King @ 2019-05-22 10:00 UTC (permalink / raw)
To: Dan Carpenter
Cc: Dan Murphy, Jacek Anaszewski, Pavel Machek, linux-leds,
kernel-janitors, linux-kernel
On 22/05/2019 10:53, Dan Carpenter wrote:
> No. This isn't the right fix. We should declare them as int instead.
Doh, brown paper bag time. I'll do a V2.
>
> regards,
> dan carpenter
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][next] leds: TI LMU: remove redundant u8 comparisons with less than zero
@ 2019-05-22 10:00 ` Colin Ian King
0 siblings, 0 replies; 6+ messages in thread
From: Colin Ian King @ 2019-05-22 10:00 UTC (permalink / raw)
To: Dan Carpenter
Cc: Dan Murphy, Jacek Anaszewski, Pavel Machek, linux-leds,
kernel-janitors, linux-kernel
On 22/05/2019 10:53, Dan Carpenter wrote:
> No. This isn't the right fix. We should declare them as int instead.
Doh, brown paper bag time. I'll do a V2.
>
> regards,
> dan carpenter
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-05-22 10:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-22 8:26 [PATCH][next] leds: TI LMU: remove redundant u8 comparisons with less than zero Colin King
2019-05-22 8:26 ` Colin King
2019-05-22 9:53 ` Dan Carpenter
2019-05-22 9:53 ` Dan Carpenter
2019-05-22 10:00 ` Colin Ian King
2019-05-22 10:00 ` Colin Ian King
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.