Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/acorn26/acorn26 move assignment outside setjmp, bec...



details:   https://anonhg.NetBSD.org/src/rev/dffcfc0bd89a
branches:  trunk
changeset: 787656:dffcfc0bd89a
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jun 27 21:16:20 2013 +0000

description:
move assignment outside setjmp, because static analyzers are not smart enough
to know that it is impossible for id to be uninitialized.

diffstat:

 sys/arch/acorn26/acorn26/cpu.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 919422e77e8c -r dffcfc0bd89a sys/arch/acorn26/acorn26/cpu.c
--- a/sys/arch/acorn26/acorn26/cpu.c    Thu Jun 27 20:17:36 2013 +0000
+++ b/sys/arch/acorn26/acorn26/cpu.c    Thu Jun 27 21:16:20 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.28 2009/11/21 20:32:13 rmind Exp $ */
+/* $NetBSD: cpu.c,v 1.29 2013/06/27 21:16:20 christos Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001 Ben Harris
@@ -32,7 +32,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.28 2009/11/21 20:32:13 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.29 2013/06/27 21:16:20 christos Exp $");
 
 #include <sys/device.h>
 #include <sys/proc.h>
@@ -147,14 +147,13 @@
 cpu_identify(void)
 {
        register_t dummy;
-       volatile register_t id;
+       volatile register_t id = CPU_ID_ARM2;
        void *cp_core, *cp15;
 
        cp_core = install_coproc_handler(CORE_UNKNOWN_HANDLER,
            cpu_undef_handler);
        cp15 = install_coproc_handler(SYSTEM_COPROC, cpu_undef_handler);
        if (setjmp(&undef_jmp) == 0) {
-               id = CPU_ID_ARM2;
                /* ARM250 and ARM3 support SWP. */
                __asm volatile ("swp r0, r0, [%0]" : : "r" (&dummy) : "r0");
                id = CPU_ID_ARM250;



Home | Main Index | Thread Index | Old Index