summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/prefix/efiprefix.c
diff options
context:
space:
mode:
authorMichael Brown2014-03-14 16:15:14 +0100
committerMichael Brown2014-03-14 17:20:55 +0100
commite662912c53825ed9ab0cd02c41b2ab460716c3c7 (patch)
treec8366704d57ac2d920310762d337d35ebc10d9cc /src/arch/x86/prefix/efiprefix.c
parent[netdevice] Notify upper-layer drivers when RX processing is (un)frozen (diff)
downloadipxe-e662912c53825ed9ab0cd02c41b2ab460716c3c7.tar.gz
ipxe-e662912c53825ed9ab0cd02c41b2ab460716c3c7.tar.xz
ipxe-e662912c53825ed9ab0cd02c41b2ab460716c3c7.zip
[efi] Avoid accidentally calling main() twice
EFIRC() uses PLATFORM_TO_ERRNO(), which evaluates its argument twice (and can't trivially use a braced-group expression or an inline function to avoid this, since it gets used outside of function context). The expression "EFIRC(main())" will therefore end up calling main() twice, which is not the intended behaviour. Every other instance of EFIRC() is of the simple form "EFIRC(rc)", so fix by converting this instance to match. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/x86/prefix/efiprefix.c')
-rw-r--r--src/arch/x86/prefix/efiprefix.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/arch/x86/prefix/efiprefix.c b/src/arch/x86/prefix/efiprefix.c
index a847045a..475ea505 100644
--- a/src/arch/x86/prefix/efiprefix.c
+++ b/src/arch/x86/prefix/efiprefix.c
@@ -33,11 +33,15 @@ FILE_LICENCE ( GPL2_OR_LATER );
EFI_STATUS EFIAPI _efi_start ( EFI_HANDLE image_handle,
EFI_SYSTEM_TABLE *systab ) {
EFI_STATUS efirc;
+ int rc;
/* Initialise EFI environment */
if ( ( efirc = efi_init ( image_handle, systab ) ) != 0 )
return efirc;
/* Call to main() */
- return EFIRC ( main () );
+ if ( ( rc = main() ) != 0 )
+ return EFIRC ( rc );
+
+ return 0;
}