Linux-EFI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] arm64/efi: fix variable 'si' set but not used
@ 2019-07-30 21:23 Qian Cai
  2019-07-31 16:18 ` Will Deacon
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Qian Cai @ 2019-07-30 21:23 UTC (permalink / raw)
  To: ard.biesheuvel
  Cc: will, catalin.marinas, linux-efi, linux-arm-kernel, linux-kernel,
	Qian Cai

GCC throws out this warning on arm64.

drivers/firmware/efi/libstub/arm-stub.c: In function 'efi_entry':
drivers/firmware/efi/libstub/arm-stub.c:132:22: warning: variable 'si'
set but not used [-Wunused-but-set-variable]

Fix it by making free_screen_info() a static inline function.

Signed-off-by: Qian Cai <cai@lca.pw>
---
 arch/arm64/include/asm/efi.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
index 8e79ce9c3f5c..76a144702586 100644
--- a/arch/arm64/include/asm/efi.h
+++ b/arch/arm64/include/asm/efi.h
@@ -105,7 +105,11 @@ static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base,
 	((protocol##_t *)instance)->f(instance, ##__VA_ARGS__)
 
 #define alloc_screen_info(x...)		&screen_info
-#define free_screen_info(x...)
+
+static inline void free_screen_info(efi_system_table_t *sys_table_arg,
+				    struct screen_info *si)
+{
+}
 
 /* redeclare as 'hidden' so the compiler will generate relative references */
 extern struct screen_info screen_info __attribute__((__visibility__("hidden")));
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64/efi: fix variable 'si' set but not used
  2019-07-30 21:23 [PATCH] arm64/efi: fix variable 'si' set but not used Qian Cai
@ 2019-07-31 16:18 ` Will Deacon
  2019-07-31 17:14 ` Catalin Marinas
  2019-08-05 13:53 ` Dave Martin
  2 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2019-07-31 16:18 UTC (permalink / raw)
  To: Qian Cai
  Cc: ard.biesheuvel, catalin.marinas, linux-efi, linux-arm-kernel,
	linux-kernel

On Tue, Jul 30, 2019 at 05:23:48PM -0400, Qian Cai wrote:
> GCC throws out this warning on arm64.
> 
> drivers/firmware/efi/libstub/arm-stub.c: In function 'efi_entry':
> drivers/firmware/efi/libstub/arm-stub.c:132:22: warning: variable 'si'
> set but not used [-Wunused-but-set-variable]
> 
> Fix it by making free_screen_info() a static inline function.
> 
> Signed-off-by: Qian Cai <cai@lca.pw>
> ---
>  arch/arm64/include/asm/efi.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
> index 8e79ce9c3f5c..76a144702586 100644
> --- a/arch/arm64/include/asm/efi.h
> +++ b/arch/arm64/include/asm/efi.h
> @@ -105,7 +105,11 @@ static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base,
>  	((protocol##_t *)instance)->f(instance, ##__VA_ARGS__)
>  
>  #define alloc_screen_info(x...)		&screen_info
> -#define free_screen_info(x...)
> +
> +static inline void free_screen_info(efi_system_table_t *sys_table_arg,
> +				    struct screen_info *si)
> +{
> +}
>  
>  /* redeclare as 'hidden' so the compiler will generate relative references */
>  extern struct screen_info screen_info __attribute__((__visibility__("hidden")));
> -- 
> 1.8.3.1

Acked-by: Will Deacon <will@kernel.org>

Will

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64/efi: fix variable 'si' set but not used
  2019-07-30 21:23 [PATCH] arm64/efi: fix variable 'si' set but not used Qian Cai
  2019-07-31 16:18 ` Will Deacon
@ 2019-07-31 17:14 ` Catalin Marinas
  2019-08-05 13:53 ` Dave Martin
  2 siblings, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2019-07-31 17:14 UTC (permalink / raw)
  To: Qian Cai; +Cc: ard.biesheuvel, will, linux-efi, linux-arm-kernel, linux-kernel

On Tue, Jul 30, 2019 at 05:23:48PM -0400, Qian Cai wrote:
> GCC throws out this warning on arm64.
> 
> drivers/firmware/efi/libstub/arm-stub.c: In function 'efi_entry':
> drivers/firmware/efi/libstub/arm-stub.c:132:22: warning: variable 'si'
> set but not used [-Wunused-but-set-variable]
> 
> Fix it by making free_screen_info() a static inline function.
> 
> Signed-off-by: Qian Cai <cai@lca.pw>

Queued for 5.3-rc3. Thanks.

-- 
Catalin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64/efi: fix variable 'si' set but not used
  2019-07-30 21:23 [PATCH] arm64/efi: fix variable 'si' set but not used Qian Cai
  2019-07-31 16:18 ` Will Deacon
  2019-07-31 17:14 ` Catalin Marinas
@ 2019-08-05 13:53 ` Dave Martin
  2 siblings, 0 replies; 4+ messages in thread
From: Dave Martin @ 2019-08-05 13:53 UTC (permalink / raw)
  To: Qian Cai
  Cc: ard.biesheuvel, linux-efi, catalin.marinas, linux-kernel, will,
	linux-arm-kernel

On Tue, Jul 30, 2019 at 05:23:48PM -0400, Qian Cai wrote:
> GCC throws out this warning on arm64.
> 
> drivers/firmware/efi/libstub/arm-stub.c: In function 'efi_entry':
> drivers/firmware/efi/libstub/arm-stub.c:132:22: warning: variable 'si'
> set but not used [-Wunused-but-set-variable]
> 
> Fix it by making free_screen_info() a static inline function.
> 
> Signed-off-by: Qian Cai <cai@lca.pw>
> ---
>  arch/arm64/include/asm/efi.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
> index 8e79ce9c3f5c..76a144702586 100644
> --- a/arch/arm64/include/asm/efi.h
> +++ b/arch/arm64/include/asm/efi.h
> @@ -105,7 +105,11 @@ static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base,
>  	((protocol##_t *)instance)->f(instance, ##__VA_ARGS__)
>  
>  #define alloc_screen_info(x...)		&screen_info
> -#define free_screen_info(x...)
> +
> +static inline void free_screen_info(efi_system_table_t *sys_table_arg,
> +				    struct screen_info *si)
> +{
> +}

Is this issue caused by the EFI stub being built with non-default
CFLAGS?

The toplevel Makefile specifies -Wno-unused-but-set-variable, which
would silence this warning.

It's debatable whether calling an empty inline function "uses" the
arguments, so I think your patch only silences the warning by accident:
different GCC versions, or clang, might still warn.


I wonder if we're missing any other options that would make sense for
the EFI stub.

[...]

Cheers
---Dave

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30 21:23 [PATCH] arm64/efi: fix variable 'si' set but not used Qian Cai
2019-07-31 16:18 ` Will Deacon
2019-07-31 17:14 ` Catalin Marinas
2019-08-05 13:53 ` Dave Martin

Linux-EFI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-efi/0 linux-efi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-efi linux-efi/ https://lore.kernel.org/linux-efi \
		linux-efi@vger.kernel.org linux-efi@archiver.kernel.org
	public-inbox-index linux-efi


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-efi


AGPL code for this site: git clone https://public-inbox.org/ public-inbox