Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/fdt Skip xref if it is 0



details:   https://anonhg.NetBSD.org/src/rev/4aa606382f71
branches:  trunk
changeset: 460678:4aa606382f71
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Oct 30 21:37:36 2019 +0000

description:
Skip xref if it is 0

diffstat:

 sys/dev/fdt/fdt_phy.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r b9cdc567baa3 -r 4aa606382f71 sys/dev/fdt/fdt_phy.c
--- a/sys/dev/fdt/fdt_phy.c     Wed Oct 30 20:24:44 2019 +0000
+++ b/sys/dev/fdt/fdt_phy.c     Wed Oct 30 21:37:36 2019 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
 
        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 @@
                        }
                        break;
                }
+next:
                resid -= (phy_cells + 1) * 4;
                p += phy_cells + 1;
        }



Home | Main Index | Thread Index | Old Index