diff mbox

[U-Boot,1/4] efi_loader: only evaluate EFI_EXIT()'s ret once

Message ID 20170727120419.32186-1-robdclark@gmail.com
State Accepted
Commit 3f1aa97577b75ee2f4f13d2b9fbaf68ce89f42be
Delegated to: Alexander Graf
Headers show

Commit Message

Rob Clark July 27, 2017, 12:04 p.m. UTC
There are a couple spots doing things like:

   return EFI_EXIT(some_fxn(...));

which I handn't noticed before.  With addition of printing return value
in the EFI_EXIT() macro, now the fxn call was getting evaluated twice.
Which we didn't really want.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 include/efi_loader.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Alexander Graf July 28, 2017, 10:28 p.m. UTC | #1
> There are a couple spots doing things like:
> 
>    return EFI_EXIT(some_fxn(...));
> 
> which I handn't noticed before.  With addition of printing return value
> in the EFI_EXIT() macro, now the fxn call was getting evaluated twice.
> Which we didn't really want.
> 
> Signed-off-by: Rob Clark <robdclark@gmail.com>

Thanks, applied to efi-next

Alex
diff mbox

Patch

diff --git a/include/efi_loader.h b/include/efi_loader.h
index f384cbbe77..9700a88d69 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -21,8 +21,9 @@ 
 	} while(0)
 
 #define EFI_EXIT(ret) ({ \
-	debug("EFI: Exit: %s: %u\n", __func__, (u32)((ret) & ~EFI_ERROR_MASK)); \
-	efi_exit_func(ret); \
+	efi_status_t _r = ret; \
+	debug("EFI: Exit: %s: %u\n", __func__, (u32)(_r & ~EFI_ERROR_MASK)); \
+	efi_exit_func(_r); \
 	})
 
 extern struct efi_runtime_services efi_runtime_services;