Skip to content

Commit

Permalink
mc146818rtc: rtc_set_time(): initialize tm to zeroes
Browse files Browse the repository at this point in the history
set_time() function doesn't set all the fields, so it's better to
initialize tm structure. And Coverity will be happier about it.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Maksim Davydov <davydov-max@yandex-team.ru>
Message-id: 20231017125941.810461-4-vsementsov@yandex-team.ru
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
Vladimir Sementsov-Ogievskiy authored and pm215 committed Nov 6, 2023
1 parent 2e12dd4 commit 394bca2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hw/rtc/mc146818rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ static void rtc_get_time(MC146818RtcState *s, struct tm *tm)

static void rtc_set_time(MC146818RtcState *s)
{
struct tm tm;
struct tm tm = {};
g_autofree const char *qom_path = object_get_canonical_path(OBJECT(s));

rtc_get_time(s, &tm);
Expand Down

0 comments on commit 394bca2

Please sign in to comment.