Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/dev/fdt Pull up following revision(s) (requested by j...
details: https://anonhg.NetBSD.org/src/rev/872315452097
branches: netbsd-8
changeset: 434119:872315452097
user: snj <snj%NetBSD.org@localhost>
date: Thu Jul 20 01:20:07 2017 +0000
description:
Pull up following revision(s) (requested by jmcneill in ticket #147):
sys/dev/fdt/fdt_subr.c: revision 1.17
Fix a problem with fdtbus_get_phandle where we were passing size -1 to
kmem_alloc when the property was not found. This seemed to work with
DIAGNOSTIC kernels, but panics in vmem with a non-DIAGNOSTIC kernel.
diffstat:
sys/dev/fdt/fdt_subr.c | 22 +++++++---------------
1 files changed, 7 insertions(+), 15 deletions(-)
diffs (50 lines):
diff -r b1e54c09652b -r 872315452097 sys/dev/fdt/fdt_subr.c
--- a/sys/dev/fdt/fdt_subr.c Thu Jul 20 01:18:42 2017 +0000
+++ b/sys/dev/fdt/fdt_subr.c Thu Jul 20 01:20:07 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_subr.c,v 1.13.2.1 2017/07/18 19:13:09 snj Exp $ */
+/* $NetBSD: fdt_subr.c,v 1.13.2.2 2017/07/20 01:20:07 snj Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,11 +27,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.13.2.1 2017/07/18 19:13:09 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.13.2.2 2017/07/20 01:20:07 snj Exp $");
#include <sys/param.h>
#include <sys/bus.h>
-#include <sys/kmem.h>
#include <libfdt.h>
#include <dev/fdt/fdtvar.h>
@@ -108,22 +107,15 @@
fdtbus_get_phandle(int phandle, const char *prop)
{
u_int phandle_ref;
- u_int *buf;
+ const u_int *buf;
int len;
- len = OF_getproplen(phandle, prop);
- if (len < sizeof(phandle_ref))
+ buf = fdt_getprop(fdtbus_get_data(),
+ fdtbus_phandle2offset(phandle), prop, &len);
+ if (buf == NULL || len < sizeof(phandle_ref))
return -1;
- buf = kmem_alloc(len, KM_SLEEP);
-
- if (OF_getprop(phandle, prop, buf, len) != len) {
- kmem_free(buf, len);
- return -1;
- }
-
- phandle_ref = fdt32_to_cpu(buf[0]);
- kmem_free(buf, len);
+ phandle_ref = be32dec(buf);
return fdtbus_get_phandle_from_native(phandle_ref);
}
Home |
Main Index |
Thread Index |
Old Index