From 10df010029a08fbaf94b963b2d304bc178391af9 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Wed, 5 Oct 2022 14:22:29 +0200 Subject: [PATCH] limine: Do not panic if failing to set up terminal or framebuffer --- common/protos/limine.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/common/protos/limine.c b/common/protos/limine.c index 6c8c432e..bb30e35f 100644 --- a/common/protos/limine.c +++ b/common/protos/limine.c @@ -692,13 +692,20 @@ FEAT_START char *term_conf_override_s = config_get_value(config, 0, "TERM_CONFIG_OVERRIDE"); if (term_conf_override_s != NULL && strcmp(term_conf_override_s, "yes") == 0) { - gterm_init(config, req_width, req_height); + if (!gterm_init(config, req_width, req_height)) { + goto term_fail; + } } else { - gterm_init(NULL, req_width, req_height); + if (!gterm_init(NULL, req_width, req_height)) { + goto term_fail; + } } - if (term == NULL) { - panic(true, "limine: Failed to initialise terminal"); + if (0) { +term_fail: + pmm_free(terminal, sizeof(struct limine_terminal)); + pmm_free(terminal_response, sizeof(struct limine_terminal_response)); + break; // next feature } fb = fbinfo; @@ -751,7 +758,7 @@ FEAT_END term = NULL; if (!fb_init(&fb, req_width, req_height, req_bpp)) { - panic(true, "limine: Could not acquire framebuffer"); + goto no_fb; } skip_fb_init: @@ -804,6 +811,7 @@ FEAT_START framebuffer_request->response = reported_addr(framebuffer_response); FEAT_END +no_fb: // Boot time feature FEAT_START struct limine_boot_time_request *boot_time_request = get_request(LIMINE_BOOT_TIME_REQUEST);