Module Name: src Committed By: jmcneill Date: Wed Oct 30 21:37:36 UTC 2019
Modified Files: src/sys/dev/fdt: fdt_phy.c Log Message: Skip xref if it is 0 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/fdt_phy.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/dev/fdt/fdt_phy.c diff -u src/sys/dev/fdt/fdt_phy.c:1.5 src/sys/dev/fdt/fdt_phy.c:1.6 --- src/sys/dev/fdt/fdt_phy.c:1.5 Wed Feb 27 16:56:00 2019 +++ src/sys/dev/fdt/fdt_phy.c Wed Oct 30 21:37:36 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_phy.c,v 1.5 2019/02/27 16:56:00 jakllsch Exp $ */ +/* $NetBSD: fdt_phy.c,v 1.6 2019/10/30 21:37:36 jmcneill Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill <jmcne...@invisible.ca> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fdt_phy.c,v 1.5 2019/02/27 16:56:00 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_phy.c,v 1.6 2019/10/30 21:37:36 jmcneill Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -100,6 +100,10 @@ fdtbus_phy_get_index(int phandle, u_int p = phys; for (n = 0, resid = len; resid > 0; n++) { + if (p[0] == 0) { + phy_cells = 0; + goto next; + } const int pc_phandle = fdtbus_get_phandle_from_native(be32toh(p[0])); if (of_getprop_uint32(pc_phandle, "#phy-cells", &phy_cells)) @@ -117,6 +121,7 @@ fdtbus_phy_get_index(int phandle, u_int } break; } +next: resid -= (phy_cells + 1) * 4; p += phy_cells + 1; }