Commit 1d6da406 authored by Alberto Escolar Piedras's avatar Alberto Escolar Piedras Committed by Henrik Brix Andersen
Browse files

lib: os: clock: Fix possibly unitialized variable warning

When building with high optimization level, the compiler thinks
duration may be used initialized and warns as much.

Let's initialize this variable always to ensure it does not happen
and with it pacify the compiler.

Signed-off-by: default avatarAlberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
parent 83165ec6
Loading
Loading
Loading
Loading
+1 −1
Changes for lib/os/clock.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ int z_impl_sys_clock_nanosleep(int clock_id, int flags, const struct timespec *r
{
	k_timepoint_t end;
	k_timeout_t timeout;
	struct timespec duration;
	struct timespec duration = {0, 0};
	const bool update_rmtp = rmtp != NULL;
	const bool abstime = (flags & SYS_TIMER_ABSTIME) != 0;