diff mbox series

video: console: Fix default font selection

Message ID 20230525121715.836196-1-megi@xff.cz
State Accepted
Commit 7a2fee8d29a92eadac3fc656d2686ccd20c24a08
Delegated to: Anatolij Gustschin
Headers show
Series video: console: Fix default font selection | expand

Commit Message

Ondřej Jirman May 25, 2023, 12:17 p.m. UTC
From: Ondrej Jirman <megi@xff.cz>

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>
---
 drivers/video/console_core.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Anatolij Gustschin July 17, 2023, 3:23 p.m. UTC | #1
On Thu, 25 May 2023 14:17:15 +0200
Ondřej Jirman megi@xff.cz wrote:

> From: Ondrej Jirman <megi@xff.cz>
> 
> 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>
> ---
>  drivers/video/console_core.c | 6 ++++++
>  1 file changed, 6 insertions(+)

applied to u-boot-video/master, thanks!

--
Anatolij
diff mbox series

Patch

diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c
index 1f93b1b85fa5..b5d0e3dceca3 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);