From: Ondrej Jirman Date: Thu, 25 May 2023 12:17:15 +0000 (+0200) Subject: video: console: Fix default font selection X-Git-Tag: v2025.01-rc5-pxa1908~939^2~10 X-Git-Url: http://git.dujemihanovic.xyz/%22http:/www.sics.se/static/git-favicon.png?a=commitdiff_plain;h=7a2fee8d29a92eadac3fc656d2686ccd20c24a08;p=u-boot.git video: console: Fix default font selection Some callers expect to call this with NULL font name to select the default font (eg. boot/scene.c). Without handling the NULL condition U-Boot crashes instead of displaying a bootflow GUI menu. Signed-off-by: Ondrej Jirman Cc: Anatolij Gustschin --- diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c index 1f93b1b85f..b5d0e3dcec 100644 --- a/drivers/video/console_core.c +++ b/drivers/video/console_core.c @@ -201,6 +201,12 @@ int console_simple_select_font(struct udevice *dev, const char *name, uint size) { struct video_fontdata *font; + if (!name) { + if (fonts->name) + console_set_font(dev, fonts); + return 0; + } + for (font = fonts; font->name; font++) { if (!strcmp(name, font->name)) { console_set_font(dev, font);