Skip to content

Commit 214509e

Browse files
ColinIanKingij-intel
authored andcommitted
platform/x86: thinkpad_acpi: remove redundant assignment to variable i
The variable i is being initialized with the value 0 that is never read, it is being re-assigned 0 again in a for-loop statement later on. The initialization is redundant and can be removed. The initialization of variable n can also be deferred after the sanity check on pointer n and the declaration of all the int variables can be combined as a final code clear-up. Cleans up clang scan build warning: warning: Value stored to 'i' is never read [deadcode.DeadStores] Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20240106154740.55202-1-colin.i.king@gmail.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 6613476 commit 214509e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/platform/x86/thinkpad_acpi.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6208,17 +6208,15 @@ static int thermal_get_sensor(int idx, s32 *value)
62086208

62096209
static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s)
62106210
{
6211-
int res, i;
6212-
int n;
6213-
6214-
n = 8;
6215-
i = 0;
6211+
int res, i, n;
62166212

62176213
if (!s)
62186214
return -EINVAL;
62196215

62206216
if (thermal_read_mode == TPACPI_THERMAL_TPEC_16)
62216217
n = 16;
6218+
else
6219+
n = 8;
62226220

62236221
for (i = 0 ; i < n; i++) {
62246222
res = thermal_get_sensor(i, &s->temp[i]);

0 commit comments

Comments
 (0)