Skip to contentSkip to conversation

video: console: Fix default font selection

PATCH In review Ondřej Jirman 2 participants 2 messages May 25, 2023 – Jul 17, 2023 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: console: Fix default font selection

From: Ondrej Jirman <[email protected]>

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.

Cc Anatolij Gustschin <[email protected]>
---
 drivers/video/console_core.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/video/console_core.c +6 -0
index 1f93b1b85fa5..b5d0e3dceca3 100644
@@ -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);
Signature · 1 line
2.40.1
#1 lore raw
Quoted 11 lines · On Thu, 25 May 2023 14:17:15 +0200 Ondřej Jirman [email protected] wrote:

From: Ondrej Jirman <[email protected]>

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.

Cc Anatolij Gustschin <[email protected]>
---
 drivers/video/console_core.c | 6 ++++++
 1 file changed, 6 insertions(+)

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

--
Anatolij