summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Jirman <megi@xff.cz>2023-05-25 14:17:15 +0200
committerAnatolij Gustschin <agust@denx.de>2023-07-14 18:07:31 +0200
commit7a2fee8d29a92eadac3fc656d2686ccd20c24a08 (patch)
tree014f12362fd61e4de37c9de7bcc21f9baef62187
parent8e21064cb3452950b09301baec06d86e37342471 (diff)
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 <megi@xff.cz> Cc: Anatolij Gustschin <agust@denx.de>
-rw-r--r--drivers/video/console_core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c
index 1f93b1b85fa..b5d0e3dceca 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);