Module Name: src Committed By: thorpej Date: Sun Jan 24 16:23:06 UTC 2021
Modified Files: src/sys/arch/arm/sunxi: sunxi_sramc.c src/sys/dev/ofw: ofw_subr.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/sunxi/sunxi_sramc.c cvs rdiff -u -r1.43 -r1.44 src/sys/dev/ofw/ofw_subr.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/arm/sunxi/sunxi_sramc.c diff -u src/sys/arch/arm/sunxi/sunxi_sramc.c:1.7 src/sys/arch/arm/sunxi/sunxi_sramc.c:1.8 --- src/sys/arch/arm/sunxi/sunxi_sramc.c:1.7 Wed Jan 20 00:48:49 2021 +++ src/sys/arch/arm/sunxi/sunxi_sramc.c Sun Jan 24 16:23:06 2021 @@ -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 <jmcne...@invisible.ca> @@ -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 @@ sunxi_sramc_init_mmio(struct sunxi_sramc 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; Index: src/sys/dev/ofw/ofw_subr.c diff -u src/sys/dev/ofw/ofw_subr.c:1.43 src/sys/dev/ofw/ofw_subr.c:1.44 --- src/sys/dev/ofw/ofw_subr.c:1.43 Wed Jan 20 00:41:15 2021 +++ src/sys/dev/ofw/ofw_subr.c Sun Jan 24 16:23:05 2021 @@ -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 @@ of_search_compatible(int phandle, 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; } /*