From 81b41b2ef5bfd571123919e93d37624d53d4f589 Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Tue, 15 Aug 2023 07:59:09 +0200 Subject: [PATCH] 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 7d62fc317c1..8723965f74b 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