aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal/k3_j72xx_bandgap.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2022-05-20 18:02:39 +0300
committerDaniel Lezcano <daniel.lezcano@linaro.org>2022-07-28 17:29:48 +0200
commitcc67ca28cf8b29245b71e01117927ed2793f35b7 (patch)
treeb848bb5ad41a6c06fc1b6a9fe41000f331ef0faa /drivers/thermal/k3_j72xx_bandgap.c
parentthermal/drivers/k3_j72xx_bandgap: Fix ref_table memory leak during probe (diff)
downloadlinux-dev-cc67ca28cf8b29245b71e01117927ed2793f35b7.tar.xz
linux-dev-cc67ca28cf8b29245b71e01117927ed2793f35b7.zip
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>
Diffstat (limited to 'drivers/thermal/k3_j72xx_bandgap.c')
-rw-r--r--drivers/thermal/k3_j72xx_bandgap.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_bandgap.c
index 3a35aa38ff51..27d4cae44aa7 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;
}
/*