git: 81b41b2ef5bf - main - ofw_firmware: Return BUS_PROBE_GENERIC instead of 0

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Tue, 15 Aug 2023 06:45:53 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=81b41b2ef5bfd571123919e93d37624d53d4f589

commit 81b41b2ef5bfd571123919e93d37624d53d4f589
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2023-08-15 05:59:09 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-08-15 06:45:22 +0000

    ofw_firmware: Return BUS_PROBE_GENERIC instead of 0
    
    While here make it only probe if the node is directly under the root
    one. If it's not it's likely a device node named 'firmware' and not the
    firmware group we're interested in.
    
    Suggested by:   jhb
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
---
 sys/dev/ofw/ofw_firmware.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sys/dev/ofw/ofw_firmware.c b/sys/dev/ofw/ofw_firmware.c
index 7d62fc317c1d..8723965f74be 100644
--- a/sys/dev/ofw/ofw_firmware.c
+++ b/sys/dev/ofw/ofw_firmware.c
@@ -101,16 +101,21 @@ static int
 ofw_firmware_probe(device_t dev)
 {
 	const char *name, *compat;
+	phandle_t root, parent;
 
 	name = ofw_bus_get_name(dev);
 	if (name == NULL || strcmp(name, "firmware") != 0)
 		return (ENXIO);
+	parent = OF_parent(ofw_bus_get_node(dev));
+	root = OF_finddevice("/");
+	if (parent != root)
+		return (ENXIO);
 	compat = ofw_bus_get_compat(dev);
 	if (compat != NULL)
 		return (ENXIO);
 
 	device_set_desc(dev, "OFW Firmware Group");
-	return (0);
+	return (BUS_PROBE_GENERIC);
 }
 
 static int