Commit 6f9faa91 authored by Stefan Weil's avatar Stefan Weil Committed by Stefan Hajnoczi
Browse files

sh4: Fix potential crash in debug code



cppcheck reports this error:

qemu/hw/sh_intc.c:390: error: Possible null pointer dereference:
 s - otherwise it is redundant to check if s is null at line 385

If s were NULL, the printf() statement would crash.
Setting braces fixes this bug.

Signed-off-by: default avatarStefan Weil <weil@mail.berlios.de>
Reviewed-by: default avatarAndreas Färber <andreas.faerber@web.de>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
parent 625f9e1f
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -382,7 +382,7 @@ void sh_intc_register_sources(struct intc_desc *desc,

	sh_intc_register_source(desc, vect->enum_id, groups, nr_groups);
	s = sh_intc_source(desc, vect->enum_id);
	if (s)
        if (s) {
            s->vect = vect->vect;

#ifdef DEBUG_INTC_SOURCES
@@ -390,6 +390,7 @@ void sh_intc_register_sources(struct intc_desc *desc,
                   vect->enum_id, s->vect, s->enable_count, s->enable_max);
#endif
        }
    }

    if (groups) {
        for (i = 0; i < nr_groups; i++) {