From edc2b12f0fd3224e662356bd4ffbe57e6504f8bc Mon Sep 17 00:00:00 2001 From: Kostas Missos Date: Sat, 7 Dec 2019 02:40:56 +0200 Subject: [PATCH] chainloader: Only unmount if trying to update This will speed up boot times for some sd cards up to 500ms when running update.bin is not needed (old or same version). --- bootloader/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bootloader/main.c b/bootloader/main.c index 0992c7a..87e4a8a 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -270,8 +270,6 @@ int launch_payload(char *path, bool update) if (!update) gfx_clear_grey(0x1B); gfx_con_setpos(0, 0); - if (!path) - return 1; if (sd_mount()) { @@ -279,9 +277,8 @@ int launch_payload(char *path, bool update) if (f_open(&fp, path, FA_READ)) { EPRINTFARGS("Payload file is missing!\n(%s)", path); - sd_unmount(); - return 1; + goto out; } // Read and copy the payload to our chosen address @@ -296,15 +293,14 @@ int launch_payload(char *path, bool update) if (f_read(&fp, buf, size, NULL)) { f_close(&fp); - sd_unmount(); - - return 1; + + goto out; } f_close(&fp); if (update && is_ipl_updated(buf)) - return 1; + goto out; sd_unmount(); @@ -339,6 +335,10 @@ int launch_payload(char *path, bool update) } } +out: + if (!update) + sd_unmount(); + return 1; }