Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/dev Do not call OF_getprop on our node blin...



details:   https://anonhg.NetBSD.org/src/rev/78c222474d75
branches:  trunk
changeset: 822585:78c222474d75
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Mar 26 12:51:42 2017 +0000

description:
Do not call OF_getprop on our node blindly - for the "pcons" hack we may
be called with all zeroed attach args.

diffstat:

 sys/arch/sparc64/dev/psycho.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 1cfcf5c24639 -r 78c222474d75 sys/arch/sparc64/dev/psycho.c
--- a/sys/arch/sparc64/dev/psycho.c     Sun Mar 26 12:38:24 2017 +0000
+++ b/sys/arch/sparc64/dev/psycho.c     Sun Mar 26 12:51:42 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: psycho.c,v 1.125 2017/03/24 01:14:26 macallan Exp $    */
+/*     $NetBSD: psycho.c,v 1.126 2017/03/26 12:51:42 martin Exp $      */
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.125 2017/03/24 01:14:26 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.126 2017/03/26 12:51:42 martin Exp $");
 
 #include "opt_ddb.h"
 
@@ -228,9 +228,13 @@
 psycho_match(device_t parent, cfdata_t match, void *aux)
 {
        struct mainbus_attach_args *ma = aux;
-       char *model = prom_getpropstring(ma->ma_node, "model");
+       char *model;
        int i;
 
+       if (ma->ma_node == 0)
+               return 0;       /* no OF node, can't be us */
+
+       model = prom_getpropstring(ma->ma_node, "model");
        /* match on a name of "pci" and a sabre or a psycho */
        if (strcmp(ma->ma_name, ROM_PCI_NAME) == 0) {
                for (i=0; psycho_names[i].p_name; i++)



Home | Main Index | Thread Index | Old Index