Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ofw Change of_search_compable() to return NULL on no...



details:   https://anonhg.NetBSD.org/src/rev/b7bbc2647a7e
branches:  trunk
changeset: 1018166:b7bbc2647a7e
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Jan 24 16:23:05 2021 +0000

description:
Change of_search_compable() to return NULL on no-match, which is much more
sensible than the previous behavior.  As such, back out rev 1.7 of
sunxi_sramc.c.  All other of_search_compable() call sites have been audited.

diffstat:

 sys/arch/arm/sunxi/sunxi_sramc.c |  6 +++---
 sys/dev/ofw/ofw_subr.c           |  8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diffs (57 lines):

diff -r c9a4bde379ba -r b7bbc2647a7e sys/arch/arm/sunxi/sunxi_sramc.c
--- a/sys/arch/arm/sunxi/sunxi_sramc.c  Sun Jan 24 16:22:55 2021 +0000
+++ b/sys/arch/arm/sunxi/sunxi_sramc.c  Sun Jan 24 16:23:05 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_sramc.c,v 1.7 2021/01/20 00:48:49 jmcneill Exp $ */
+/* $NetBSD: sunxi_sramc.c,v 1.8 2021/01/24 16:23:06 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_sramc.c,v 1.7 2021/01/20 00:48:49 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_sramc.c,v 1.8 2021/01/24 16:23:06 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -127,7 +127,7 @@
 
        for (child = OF_child(phandle); child; child = OF_peer(child)) {
                dce = of_search_compatible(child, sunxi_sramc_areas);
-               if (dce->data != NULL) {
+               if (dce != NULL) {
                        node = kmem_alloc(sizeof(*node), KM_SLEEP);
                        node->phandle = child;
                        node->area = dce->data;
diff -r c9a4bde379ba -r b7bbc2647a7e sys/dev/ofw/ofw_subr.c
--- a/sys/dev/ofw/ofw_subr.c    Sun Jan 24 16:22:55 2021 +0000
+++ b/sys/dev/ofw/ofw_subr.c    Sun Jan 24 16:23:05 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofw_subr.c,v 1.43 2021/01/20 00:41:15 jmcneill Exp $   */
+/*     $NetBSD: ofw_subr.c,v 1.44 2021/01/24 16:23:05 thorpej Exp $    */
 
 /*
  * Copyright 1998
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.43 2021/01/20 00:41:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.44 2021/01/24 16:23:05 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -253,9 +253,9 @@
        for (; compat_data->compat != NULL; compat_data++) {
                const char *compat[] = { compat_data->compat, NULL };
                if (of_match_compatible(phandle, compat))
-                       break;
+                       return compat_data;
        }
-       return compat_data;
+       return NULL;
 }
 
 /*



Home | Main Index | Thread Index | Old Index