mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Thierry Reding" <thierry.reding@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pwm: sun4i: redundant assignment to variable pval
Date: Wed, 2 Oct 2019 14:28:05 +0100	[thread overview]
Message-ID: <1080ef65-b089-937d-dfae-6f5484d4ed5f@canonical.com> (raw)
In-Reply-To: <20191002132506.GO22609@kadam>

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
> 


  reply	other threads:[~2019-10-02 13:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 10:08 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 [this message]
2019-10-02 13:29   ` Dan Carpenter
2019-10-02 13:30     ` Colin Ian King

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=1080ef65-b089-937d-dfae-6f5484d4ed5f@canonical.com \
    --to=colin.king@canonical.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=wens@csie.org \
    /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

all inboxes | Powered by JetHome®