* [PATCH] pwm: sun4i: redundant assignment to variable pval
@ 2019-10-02 10:08 Colin King
2019-10-02 10:16 ` Uwe Kleine-König
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Colin King @ 2019-10-02 10:08 UTC (permalink / raw)
To: Thierry Reding, Uwe Kleine-König, Maxime Ripard,
Chen-Yu Tsai, linux-pwm, linux-arm-kernel
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Variable pval is being assigned a value that is never read. The
assignment is redundant and hence can be removed.
Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/pwm/pwm-sun4i.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
index 6f5840a1a82d..53970d4ba695 100644
--- a/drivers/pwm/pwm-sun4i.c
+++ b/drivers/pwm/pwm-sun4i.c
@@ -156,7 +156,6 @@ static int sun4i_pwm_calculate(struct sun4i_pwm_chip *sun4i_pwm,
if (sun4i_pwm->data->has_prescaler_bypass) {
/* First, test without any prescaler when available */
prescaler = PWM_PRESCAL_MASK;
- pval = 1;
/*
* When not using any prescaler, the clock period in nanoseconds
* is not an integer so round it half up instead of
--
2.20.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] pwm: sun4i: redundant assignment to variable pval
2019-10-02 10:08 [PATCH] pwm: sun4i: redundant assignment to variable pval Colin King
@ 2019-10-02 10:16 ` Uwe Kleine-König
2019-10-02 10:39 ` Thierry Reding
2019-10-02 13:25 ` Dan Carpenter
2 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2019-10-02 10:16 UTC (permalink / raw)
To: Colin King
Cc: Thierry Reding, Maxime Ripard, Chen-Yu Tsai, linux-pwm,
linux-arm-kernel, kernel-janitors, linux-kernel
On Wed, Oct 02, 2019 at 11:08:44AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Variable pval is being assigned a value that is never read. The
> assignment is redundant and hence can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/pwm/pwm-sun4i.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
> index 6f5840a1a82d..53970d4ba695 100644
> --- a/drivers/pwm/pwm-sun4i.c
> +++ b/drivers/pwm/pwm-sun4i.c
> @@ -156,7 +156,6 @@ static int sun4i_pwm_calculate(struct sun4i_pwm_chip *sun4i_pwm,
> if (sun4i_pwm->data->has_prescaler_bypass) {
> /* First, test without any prescaler when available */
> prescaler = PWM_PRESCAL_MASK;
> - pval = 1;
> /*
> * When not using any prescaler, the clock period in nanoseconds
> * is not an integer so round it half up instead of
Looks fine, the issue exists since
deb9c462f4e539cc7f8389b9855eb7a507c78e7e.
You can even make pval a local variable for the second for loop.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pwm: sun4i: redundant assignment to variable pval
2019-10-02 10:08 [PATCH] pwm: sun4i: redundant assignment to variable pval Colin King
2019-10-02 10:16 ` Uwe Kleine-König
@ 2019-10-02 10:39 ` Thierry Reding
2019-10-02 13:25 ` Dan Carpenter
2 siblings, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2019-10-02 10:39 UTC (permalink / raw)
To: Colin King
Cc: Uwe Kleine-König, Maxime Ripard, Chen-Yu Tsai, linux-pwm,
linux-arm-kernel, kernel-janitors, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 446 bytes --]
On Wed, Oct 02, 2019 at 11:08:44AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Variable pval is being assigned a value that is never read. The
> assignment is redundant and hence can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/pwm/pwm-sun4i.c | 1 -
> 1 file changed, 1 deletion(-)
Applied, thanks.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pwm: sun4i: redundant assignment to variable pval
2019-10-02 10:08 [PATCH] pwm: sun4i: redundant assignment to variable pval Colin King
2019-10-02 10:16 ` Uwe Kleine-König
2019-10-02 10:39 ` Thierry Reding
@ 2019-10-02 13:25 ` Dan Carpenter
2019-10-02 13:28 ` Colin Ian King
2019-10-02 13:29 ` Dan Carpenter
2 siblings, 2 replies; 7+ messages in thread
From: Dan Carpenter @ 2019-10-02 13:25 UTC (permalink / raw)
To: Colin King
Cc: Thierry Reding, Uwe Kleine-König, Maxime Ripard,
Chen-Yu Tsai, linux-pwm, linux-arm-kernel, kernel-janitors,
linux-kernel
On Wed, Oct 02, 2019 at 11:08:44AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Variable pval is being assigned a value that is never read. The
> assignment is redundant and hence can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/pwm/pwm-sun4i.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
> index 6f5840a1a82d..53970d4ba695 100644
> --- a/drivers/pwm/pwm-sun4i.c
> +++ b/drivers/pwm/pwm-sun4i.c
> @@ -156,7 +156,6 @@ static int sun4i_pwm_calculate(struct sun4i_pwm_chip *sun4i_pwm,
> if (sun4i_pwm->data->has_prescaler_bypass) {
> /* First, test without any prescaler when available */
> prescaler = PWM_PRESCAL_MASK;
> - pval = 1;
> /*
> * When not using any prescaler, the clock period in nanoseconds
> * is not an integer so round it half up instead of
Are you sure? It looks used to me.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pwm: sun4i: redundant assignment to variable pval
2019-10-02 13:25 ` Dan Carpenter
@ 2019-10-02 13:28 ` Colin Ian King
2019-10-02 13:29 ` Dan Carpenter
1 sibling, 0 replies; 7+ messages in thread
From: Colin Ian King @ 2019-10-02 13:28 UTC (permalink / raw)
To: Dan Carpenter
Cc: Thierry Reding, Uwe Kleine-König, Maxime Ripard,
Chen-Yu Tsai, linux-pwm, linux-arm-kernel, kernel-janitors,
linux-kernel
On 02/10/2019 14:25, Dan Carpenter wrote:
> On Wed, Oct 02, 2019 at 11:08:44AM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Variable pval is being assigned a value that is never read. The
>> assignment is redundant and hence can be removed.
>>
>> Addresses-Coverity: ("Unused value")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>> drivers/pwm/pwm-sun4i.c | 1 -
>> 1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
>> index 6f5840a1a82d..53970d4ba695 100644
>> --- a/drivers/pwm/pwm-sun4i.c
>> +++ b/drivers/pwm/pwm-sun4i.c
>> @@ -156,7 +156,6 @@ static int sun4i_pwm_calculate(struct sun4i_pwm_chip *sun4i_pwm,
>> if (sun4i_pwm->data->has_prescaler_bypass) {
>> /* First, test without any prescaler when available */
>> prescaler = PWM_PRESCAL_MASK;
>> - pval = 1;
>> /*
>> * When not using any prescaler, the clock period in nanoseconds
>> * is not an integer so round it half up instead of
>
> Are you sure? It looks used to me.
It's only read in a do_div() and before that it is being assigned:
pval = prescaler_table[prescaler];
div = clk_rate;
do_div(div, pval);
so the assigned value of pval = 1 is never read
Colin
>
> regards,
> dan carpenter
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pwm: sun4i: redundant assignment to variable pval
2019-10-02 13:25 ` Dan Carpenter
2019-10-02 13:28 ` Colin Ian King
@ 2019-10-02 13:29 ` Dan Carpenter
2019-10-02 13:30 ` Colin Ian King
1 sibling, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2019-10-02 13:29 UTC (permalink / raw)
To: Colin King
Cc: Thierry Reding, Uwe Kleine-König, Maxime Ripard,
Chen-Yu Tsai, linux-pwm, linux-arm-kernel, kernel-janitors,
linux-kernel
On Wed, Oct 02, 2019 at 04:25:06PM +0300, Dan Carpenter wrote:
> On Wed, Oct 02, 2019 at 11:08:44AM +0100, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > Variable pval is being assigned a value that is never read. The
> > assignment is redundant and hence can be removed.
> >
> > Addresses-Coverity: ("Unused value")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> > drivers/pwm/pwm-sun4i.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
> > index 6f5840a1a82d..53970d4ba695 100644
> > --- a/drivers/pwm/pwm-sun4i.c
> > +++ b/drivers/pwm/pwm-sun4i.c
> > @@ -156,7 +156,6 @@ static int sun4i_pwm_calculate(struct sun4i_pwm_chip *sun4i_pwm,
> > if (sun4i_pwm->data->has_prescaler_bypass) {
> > /* First, test without any prescaler when available */
> > prescaler = PWM_PRESCAL_MASK;
> > - pval = 1;
> > /*
> > * When not using any prescaler, the clock period in nanoseconds
> > * is not an integer so round it half up instead of
>
> Are you sure? It looks used to me.
Ah. Never mind. My tree was out of date.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pwm: sun4i: redundant assignment to variable pval
2019-10-02 13:29 ` Dan Carpenter
@ 2019-10-02 13:30 ` Colin Ian King
0 siblings, 0 replies; 7+ messages in thread
From: Colin Ian King @ 2019-10-02 13:30 UTC (permalink / raw)
To: Dan Carpenter
Cc: Thierry Reding, Uwe Kleine-König, Maxime Ripard,
Chen-Yu Tsai, linux-pwm, linux-arm-kernel, kernel-janitors,
linux-kernel
On 02/10/2019 14:29, Dan Carpenter wrote:
> On Wed, Oct 02, 2019 at 04:25:06PM +0300, Dan Carpenter wrote:
>> On Wed, Oct 02, 2019 at 11:08:44AM +0100, Colin King wrote:
>>> From: Colin Ian King <colin.king@canonical.com>
>>>
>>> Variable pval is being assigned a value that is never read. The
>>> assignment is redundant and hence can be removed.
>>>
>>> Addresses-Coverity: ("Unused value")
>>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>>> ---
>>> drivers/pwm/pwm-sun4i.c | 1 -
>>> 1 file changed, 1 deletion(-)
>>>
>>> diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
>>> index 6f5840a1a82d..53970d4ba695 100644
>>> --- a/drivers/pwm/pwm-sun4i.c
>>> +++ b/drivers/pwm/pwm-sun4i.c
>>> @@ -156,7 +156,6 @@ static int sun4i_pwm_calculate(struct sun4i_pwm_chip *sun4i_pwm,
>>> if (sun4i_pwm->data->has_prescaler_bypass) {
>>> /* First, test without any prescaler when available */
>>> prescaler = PWM_PRESCAL_MASK;
>>> - pval = 1;
>>> /*
>>> * When not using any prescaler, the clock period in nanoseconds
>>> * is not an integer so round it half up instead of
>>
>> Are you sure? It looks used to me.
>
> Ah. Never mind. My tree was out of date.
No problem. I appreciated you eyeballing my fixes.
>
> regards,
> dan carpenter
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-10-02 13:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-02 10:08 [PATCH] pwm: sun4i: redundant assignment to variable pval Colin King
2019-10-02 10:16 ` Uwe Kleine-König
2019-10-02 10:39 ` Thierry Reding
2019-10-02 13:25 ` Dan Carpenter
2019-10-02 13:28 ` Colin Ian King
2019-10-02 13:29 ` Dan Carpenter
2019-10-02 13:30 ` Colin Ian King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox