Skip to content

Commit 72a045e

Browse files
committed
Fixed unused variable warning
1 parent 71d6496 commit 72a045e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

extmod/vfs_fat.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,15 @@ STATIC mp_obj_t vfs_fat_utime(mp_obj_t vfs_in, mp_obj_t path_in, mp_obj_t times_
422422
mp_raise_type_arg(&mp_type_TypeError, times_in);
423423
}
424424

425-
mp_obj_t *times;
426-
mp_obj_get_array_fixed_n(times_in, 2, &times);
427-
const int atime = mp_obj_get_int(times[0]);
428-
const int mtime = mp_obj_get_int(times[1]);
425+
mp_obj_t *otimes;
426+
mp_obj_get_array_fixed_n(times_in, 2, &otimes);
427+
428+
// Validate that both elements of the tuple are int and discard the second one
429+
int time[2];
430+
time[0] = mp_obj_get_int(otimes[0]);
431+
time[1] = mp_obj_get_int(otimes[1]);
429432
timeutils_struct_time_t tm;
430-
timeutils_seconds_since_epoch_to_struct_time(atime, &tm);
433+
timeutils_seconds_since_epoch_to_struct_time(time[0], &tm);
431434

432435
FILINFO fno;
433436
fno.fdate = (WORD)(((tm.tm_year - 1980) * 512U) | tm.tm_mon * 32U | tm.tm_mday);

0 commit comments

Comments
 (0)