term: Fix deinitialisation issues
diff --git a/common/lib/term.c b/common/lib/term.c
index e3cdb326..4778befe 100644
--- a/common/lib/term.c
+++ b/common/lib/term.c
@@ -25,7 +25,9 @@ void term_deinit(void) {
}
void term_vbe(size_t width, size_t height) {
- term_notready();
+ if (term_backend != VBE) {
+ term_deinit();
+ }
if (quiet || allocations_disallowed) {
return;
@@ -349,7 +351,7 @@ void term_reinit(void) {
#if bios == 1
void term_textmode(void) {
- term_notready();
+ term_deinit();
if (quiet || allocations_disallowed) {
return;
diff --git a/common/protos/stivale2.c b/common/protos/stivale2.c
index 5035c390..9dc933a6 100644
--- a/common/protos/stivale2.c
+++ b/common/protos/stivale2.c
@@ -594,6 +594,8 @@ failed_to_load_header_section:
fb = &_fb;
}
+ term_deinit();
+
if (hdrtag != NULL || (avtag != NULL && uefi) || (avtag != NULL && preference == 0)) {
term_deinit();
