Module Name: src
Committed By: martin
Date: Thu Jun 20 18:11:53 UTC 2024
Modified Files:
src/sys/arch/macppc/macppc [netbsd-10]: mainbus.c
Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #707):
sys/arch/macppc/macppc/mainbus.c: revision 1.26
check for proper error value from OF_finddevice()
should fix PR57394
To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.4.1 src/sys/arch/macppc/macppc/mainbus.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/macppc/macppc/mainbus.c
diff -u src/sys/arch/macppc/macppc/mainbus.c:1.25 src/sys/arch/macppc/macppc/mainbus.c:1.25.4.1
--- src/sys/arch/macppc/macppc/mainbus.c:1.25 Sat Jan 22 11:49:16 2022
+++ src/sys/arch/macppc/macppc/mainbus.c Thu Jun 20 18:11:53 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.25 2022/01/22 11:49:16 thorpej Exp $ */
+/* $NetBSD: mainbus.c,v 1.25.4.1 2024/06/20 18:11:53 martin Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.25 2022/01/22 11:49:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.25.4.1 2024/06/20 18:11:53 martin Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -76,7 +76,13 @@ mainbus_attach(device_t parent, device_t
devhandle_t selfh = device_handle(self);
cpus = OF_finddevice("/cpus");
- if (cpus != 0) {
+ /*
+ * XXX
+ * the canonical error value is -1 but I dimly remember some OF
+ * variants returning 0 here, so check for both just in case.
+ * It's not like this is a performance critical path.
+ */
+ if ((cpus != -1) && (cpus != 0)) {
node = OF_child(cpus);
while (node != 0) {
ca.ca_name = "cpu";