public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Colin Ian King <colin.i.king@gmail.com>
Cc: Jean Delvare <jdelvare@suse.com>,
	linux-hwmon@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: (adm1031): Remove redundant assignment to variable range
Date: Tue, 7 Dec 2021 09:30:54 -0800	[thread overview]
Message-ID: <20211207173054.GA657431@roeck-us.net> (raw)
In-Reply-To: <20211204233155.55454-1-colin.i.king@gmail.com>

On Sat, Dec 04, 2021 at 11:31:55PM +0000, Colin Ian King wrote:
> Variable range is being initialized with a value that is never read, it
> is being re-assigned in the next statement. The assignment is redundant,
> remove it and initialize range using the second assigned value. Clean up
> the formatting too by adding missing spaces.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/adm1031.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
> index 257ec53ae723..ac841fa3a369 100644
> --- a/drivers/hwmon/adm1031.c
> +++ b/drivers/hwmon/adm1031.c
> @@ -242,9 +242,8 @@ static int FAN_TO_REG(int reg, int div)
>  static int AUTO_TEMP_MAX_TO_REG(int val, int reg, int pwm)
>  {
>  	int ret;
> -	int range = val - AUTO_TEMP_MIN_FROM_REG(reg);
> +	int range = ((val - AUTO_TEMP_MIN_FROM_REG(reg)) * 10) / (16 - pwm);
>  
> -	range = ((val - AUTO_TEMP_MIN_FROM_REG(reg))*10)/(16 - pwm);
>  	ret = ((reg & 0xf8) |
>  	       (range < 10000 ? 0 :
>  		range < 20000 ? 1 :

      reply	other threads:[~2021-12-07 17:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-04 23:31 [PATCH] hwmon: (adm1031): Remove redundant assignment to variable range Colin Ian King
2021-12-07 17:30 ` Guenter Roeck [this message]

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=20211207173054.GA657431@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=colin.i.king@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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