diff mbox series

[thermal:,thermal/next] thermal/drivers/k3_j72xx_bandgap: Fix array underflow in prep_lookup_table()

Message ID 165902290964.15455.15523789691058201166.tip-bot2@tip-bot2
State New
Headers show
Series [thermal:,thermal/next] thermal/drivers/k3_j72xx_bandgap: Fix array underflow in prep_lookup_table() | expand

Commit Message

thermal-bot for Lad Prabhakar July 28, 2022, 3:41 p.m. UTC
The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     cc67ca28cf8b29245b71e01117927ed2793f35b7
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//cc67ca28cf8b29245b71e01117927ed2793f35b7
Author:        Dan Carpenter <dan.carpenter@oracle.com>
AuthorDate:    Fri, 20 May 2022 18:02:39 +03:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Thu, 28 Jul 2022 17:29:48 +02:00

thermal/drivers/k3_j72xx_bandgap: Fix array underflow in prep_lookup_table()

This while loop exits with "i" set to -1 and so then it sets:

	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>
Link: https://lore.kernel.org/r/YoetjwcOEzYEFp9b@kili
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/k3_j72xx_bandgap.c | 2 --
 1 file changed, 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_bandgap.c
index 3a35aa3..27d4cae 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;
 	}
 
 	/*