diff --git a/sys/dev/uart/uart_subr.c b/sys/dev/uart/uart_subr.c --- a/sys/dev/uart/uart_subr.c +++ b/sys/dev/uart/uart_subr.c @@ -200,13 +200,6 @@ bus_addr_t addr = ~0U; int error; - /* - * All uart_class references are weak. Make sure the default - * device class has been compiled-in. - */ - if (class == NULL) - return (ENXIO); - /* * Check the environment variables "hw.uart.console" and * "hw.uart.dbgport". These variables, when present, specify @@ -300,6 +293,13 @@ goto inval; freeenv(cp); + /* + * The default uart_class reference is weak. Make sure the default + * device class has been compiled-in or we've set one with dt=. + */ + if (class == NULL) + return (ENXIO); + /* * Accept only the well-known baudrates. Any invalid baudrate * is silently replaced with a 0-valued baudrate. The 0 baudrate