efi_loader: only evaluate EFI_EXIT()'s ret once
authorRob Clark <robdclark@gmail.com>
Thu, 27 Jul 2017 12:04:16 +0000 (08:04 -0400)
committerAlexander Graf <agraf@suse.de>
Fri, 28 Jul 2017 07:14:01 +0000 (09:14 +0200)
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>
Signed-off-by: Alexander Graf <agraf@suse.de>
include/efi_loader.h

index f384cbbe771b07f6ff684944fd4611e5cd081b0b..9700a88d6998fb6b0331e45fb0975486a4ca0f9d 100644 (file)
@@ -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;