diff --git a/common/usb_kbd.c b/common/usb_kbd.c index 36107a3b278..c037359260a 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -626,6 +626,14 @@ static int probe_usb_keyboard(struct usb_device *dev) return error; stdinname = env_get("stdin"); + if (!stdinname) { + /* + * `stdin` can be unset in the default env, so don't + * crash if a USB keyboard happens to be plugged in. + */ + return 0; + } + #if CONFIG_IS_ENABLED(CONSOLE_MUX) if (strstr(stdinname, DEVNAME) != NULL) { error = iomux_doenv(stdin, stdinname);