From 7b2298cbd812320c7f78d41d556ecb174cfdd675 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 15 Jun 2021 00:39:28 -0400 Subject: [PATCH] sim: mips: fix uninitialized register use In the default case, this code will read from this variable before it is initialized as a dummy access. Set it to 0 to fix the compiler warning. --- sim/mips/ChangeLog | 5 +++++ sim/mips/dv-tx3904irc.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog index fcc8ab34703..1e57fe54326 100644 --- a/sim/mips/ChangeLog +++ b/sim/mips/ChangeLog @@ -1,3 +1,8 @@ +2021-06-16 Mike Frysinger + + * dv-tx3904irc.c (tx3904irc_io_write_buffer): Initialize + register_value to 0. + 2021-06-16 Mike Frysinger * configure: Regenerate. diff --git a/sim/mips/dv-tx3904irc.c b/sim/mips/dv-tx3904irc.c index 0896b0fabb0..6fbe61c7f54 100644 --- a/sim/mips/dv-tx3904irc.c +++ b/sim/mips/dv-tx3904irc.c @@ -381,7 +381,7 @@ tx3904irc_io_write_buffer (struct hw *me, int reg_number = (address - controller->base_address) / 4; int reg_offset = (address - controller->base_address) % 4; unsigned_4* register_ptr; - unsigned_4 register_value; + unsigned_4 register_value = 0; /* fill in entire register_value word */ switch (reg_number) -- 2.30.2