The *str = "Reserved" is intended as the default value when index is outside of the array. str shouldn't retain values from an earlier invocation of the function.
Signed-off-by: Jerry Hoemann <jerry.hoem...@hpe.com> --- dmioem.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dmioem.c b/dmioem.c index 1b4fcd8..c26fff9 100644 --- a/dmioem.c +++ b/dmioem.c @@ -243,7 +243,7 @@ static void dmi_hp_203_bayenc(const char *fname, u8 num) static void dmi_hp_203_devtyp(const char *fname, unsigned int code) { - static const char *str = "Reserved"; + const char *str = "Reserved"; static const char *type[] = { "Unknown", /* 0x00 */ "Reserved", @@ -273,7 +273,7 @@ static void dmi_hp_203_devtyp(const char *fname, unsigned int code) static void dmi_hp_203_devloc(const char *fname, unsigned int code) { - static const char *str = "Reserved"; + const char *str = "Reserved"; static const char *location[] = { "Unknown", /* 0x00 */ "Embedded", @@ -301,7 +301,7 @@ static void dmi_hp_203_devloc(const char *fname, unsigned int code) static void dmi_hp_238_loc(const char *fname, unsigned int code) { - static const char *str = "Reserved"; + const char *str = "Reserved"; static const char *location[] = { "Internal", /* 0x00 */ "Front of Server", @@ -321,7 +321,7 @@ static void dmi_hp_238_loc(const char *fname, unsigned int code) static void dmi_hp_238_flags(const char *fname, unsigned int code) { - static const char *str = "Reserved"; + const char *str = "Reserved"; static const char *flags[] = { "Not Shared", /* 0x00 */ "Shared with physical switch", @@ -336,7 +336,7 @@ static void dmi_hp_238_flags(const char *fname, unsigned int code) static void dmi_hp_238_speed(const char *fname, unsigned int code) { - static const char *str = "Reserved"; + const char *str = "Reserved"; static const char *speed[] = { "Reserved", /* 0x00 */ "USB 1.1 Full Speed", -- 2.36.1 _______________________________________________ https://lists.nongnu.org/mailman/listinfo/dmidecode-devel