[PATCH] drivers: serial: Make sure we really return a serial device
Mark Kettenis
kettenis at openbsd.org
Sun Feb 6 00:10:18 CET 2022
The stdout-path property in the device tree does not necessarily
point at a serial device. The code that binds the device if it
isn't marked to be bound before relocation does not check whether
the device really is a serial device. So check that its uclass is
UCLASS_SERIAL before probing it.
Signed-off-by: Mark Kettenis <kettenis at openbsd.org>
---
drivers/serial/serial-uclass.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 96a1cb65ba..931a90bdbd 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -66,7 +66,8 @@ static int serial_check_stdout(const void *blob, struct udevice **devp)
*/
if (node > 0 && !lists_bind_fdt(gd->dm_root, offset_to_ofnode(node),
devp, NULL, false)) {
- if (!device_probe(*devp))
+ if (device_get_uclass_id(*devp) == UCLASS_SERIAL &&
+ !device_probe(*devp))
return 0;
}
--
2.34.1
More information about the U-Boot
mailing list