public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Keerthy <j-keerthy@ti.com>
Cc: Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
	linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] thermal: k3_j72xx_bandgap: Fix array underflow in prep_lookup_table()
Date: Fri, 20 May 2022 17:25:56 +0200	[thread overview]
Message-ID: <3061a9fd-5301-4d91-2d60-b85a5d4910e9@linaro.org> (raw)
In-Reply-To: <YoetjwcOEzYEFp9b@kili>

On 20/05/2022 17:02, Dan Carpenter wrote:
> This while loop exits with "i" set to -1 and so then it sets:

Won't it exit with 'i' set to '0' ?


> 	derived_table[-1] = derived_table[0] - 300;
> 
> There is no need for this assignment at all.  Just delete it.
> 
> Fixes: 72b3fc61c752 ("thermal: k3_j72xx_bandgap: Add the bandgap driver support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>   drivers/thermal/k3_j72xx_bandgap.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_bandgap.c
> index 64e323158952..a9789b17513b 100644
> --- a/drivers/thermal/k3_j72xx_bandgap.c
> +++ b/drivers/thermal/k3_j72xx_bandgap.c
> @@ -151,8 +151,6 @@ static int prep_lookup_table(struct err_values *err_vals, int *ref_table)
>   		/* 300 milli celsius steps */
>   		while (i--)
>   			derived_table[i] = derived_table[i + 1] - 300;
> -		/* case 0 */
> -		derived_table[i] = derived_table[i + 1] - 300;
>   	}
>   
>   	/*


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

  reply	other threads:[~2022-05-20 15:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-20 15:02 [PATCH] thermal: k3_j72xx_bandgap: Fix array underflow in prep_lookup_table() Dan Carpenter
2022-05-20 15:25 ` Daniel Lezcano [this message]
2022-05-21  6:56   ` Dan Carpenter
2022-05-21  7:04     ` Dan Carpenter
2022-07-28 15:41 ` [thermal: thermal/next] thermal/drivers/k3_j72xx_bandgap: " thermal-bot for Dan Carpenter

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=3061a9fd-5301-4d91-2d60-b85a5d4910e9@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=amitk@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=j-keerthy@ti.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    /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