All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Claudiu Beznea <claudiu.beznea@microchip.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Ludovic Desroches <ludovic.desroches@microchip.com>,
	linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pwm: atmel: remove redundant initialization of variable timeout
Date: Fri, 10 Dec 2021 09:02:15 +0000	[thread overview]
Message-ID: <a51bc835-f707-7ba6-5112-20592bb3ca31@gmail.com> (raw)
In-Reply-To: <20211210074536.lawpsch2i5bwyew7@pengutronix.de>

On 10/12/2021 07:45, Uwe Kleine-König wrote:
> On Fri, Dec 10, 2021 at 12:22:50AM +0000, Colin Ian King wrote:
>> The variable timeout is being initialized with a value that is never
>> read, it is being re-assigned the same value later on. Remove the
>> redundant initialization and keep the latter assignment because it's
>> closer to the use of the variable.
>>
>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
>> ---
>>   drivers/pwm/pwm-atmel.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
>> index 98b34ea9f38e..8e00a4286145 100644
>> --- a/drivers/pwm/pwm-atmel.c
>> +++ b/drivers/pwm/pwm-atmel.c
>> @@ -271,7 +271,7 @@ static void atmel_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm,
>>   			      bool disable_clk)
>>   {
>>   	struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip);
>> -	unsigned long timeout = jiffies + 2 * HZ;
>> +	unsigned long timeout;
>>   
>>   	atmel_pwm_wait_nonpending(atmel_pwm, pwm->hwpwm);
> 
> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> Did you spot this by using some static checker? If so, maybe attribute
> it in the commit log?

Just clang.

> 
> Thanks
> Uwe
> 


WARNING: multiple messages have this Message-ID (diff)
From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-pwm@vger.kernel.org,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ludovic Desroches <ludovic.desroches@microchip.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Claudiu Beznea <claudiu.beznea@microchip.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] pwm: atmel: remove redundant initialization of variable timeout
Date: Fri, 10 Dec 2021 09:02:15 +0000	[thread overview]
Message-ID: <a51bc835-f707-7ba6-5112-20592bb3ca31@gmail.com> (raw)
In-Reply-To: <20211210074536.lawpsch2i5bwyew7@pengutronix.de>

On 10/12/2021 07:45, Uwe Kleine-König wrote:
> On Fri, Dec 10, 2021 at 12:22:50AM +0000, Colin Ian King wrote:
>> The variable timeout is being initialized with a value that is never
>> read, it is being re-assigned the same value later on. Remove the
>> redundant initialization and keep the latter assignment because it's
>> closer to the use of the variable.
>>
>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
>> ---
>>   drivers/pwm/pwm-atmel.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
>> index 98b34ea9f38e..8e00a4286145 100644
>> --- a/drivers/pwm/pwm-atmel.c
>> +++ b/drivers/pwm/pwm-atmel.c
>> @@ -271,7 +271,7 @@ static void atmel_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm,
>>   			      bool disable_clk)
>>   {
>>   	struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip);
>> -	unsigned long timeout = jiffies + 2 * HZ;
>> +	unsigned long timeout;
>>   
>>   	atmel_pwm_wait_nonpending(atmel_pwm, pwm->hwpwm);
> 
> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> Did you spot this by using some static checker? If so, maybe attribute
> it in the commit log?

Just clang.

> 
> Thanks
> Uwe
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-12-10  9:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-10  0:22 [PATCH] pwm: atmel: remove redundant initialization of variable timeout Colin Ian King
2021-12-10  0:22 ` Colin Ian King
2021-12-10  7:45 ` Uwe Kleine-König
2021-12-10  7:45   ` Uwe Kleine-König
2021-12-10  9:02   ` Colin King (gmail) [this message]
2021-12-10  9:02     ` Colin King (gmail)
2022-02-24 12:54 ` Thierry Reding
2022-02-24 12:54   ` Thierry Reding

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=a51bc835-f707-7ba6-5112-20592bb3ca31@gmail.com \
    --to=colin.i.king@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=claudiu.beznea@microchip.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=ludovic.desroches@microchip.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 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.