mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/xen: clean up clang build warning
@ 2017-09-18  8:38 Colin King
  2017-09-18  8:43 ` Juergen Gross
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-09-18  8:38 UTC (permalink / raw)
  To: Boris Ostrovsky, Juergen Gross, Thomas Gleixner, Ingo Molnar,
	H . Peter Anvin, x86, xen-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

In the case where sizeof(maddr) != sizeof(long) p is initialized and
never read and clang throws a warning on this.  Move declaration of
p to clean up the clang build warning:

warning: Value stored to 'p' during its initialization is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 arch/x86/include/asm/xen/hypercall.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
index 9606688caa4b..5ff77cb2529e 100644
--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -552,13 +552,13 @@ static inline void
 MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
 			struct desc_struct desc)
 {
-	u32 *p = (u32 *) &desc;
-
 	mcl->op = __HYPERVISOR_update_descriptor;
 	if (sizeof(maddr) == sizeof(long)) {
 		mcl->args[0] = maddr;
 		mcl->args[1] = *(unsigned long *)&desc;
 	} else {
+		u32 *p = (u32 *) &desc;
+
 		mcl->args[0] = maddr;
 		mcl->args[1] = maddr >> 32;
 		mcl->args[2] = *p++;
-- 
2.14.1

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

* Re: [PATCH] x86/xen: clean up clang build warning
  2017-09-18  8:38 [PATCH] x86/xen: clean up clang build warning Colin King
@ 2017-09-18  8:43 ` Juergen Gross
  0 siblings, 0 replies; 2+ messages in thread
From: Juergen Gross @ 2017-09-18  8:43 UTC (permalink / raw)
  To: Colin King, Boris Ostrovsky, Thomas Gleixner, Ingo Molnar,
	H . Peter Anvin, x86, xen-devel
  Cc: kernel-janitors, linux-kernel

On 18/09/17 10:38, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> In the case where sizeof(maddr) != sizeof(long) p is initialized and
> never read and clang throws a warning on this.  Move declaration of
> p to clean up the clang build warning:
> 
> warning: Value stored to 'p' during its initialization is never read
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

With the code style issue pointed out below fixed:

Reviewed-by: Juergen Gross <jgross@suse.com>

> ---
>  arch/x86/include/asm/xen/hypercall.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
> index 9606688caa4b..5ff77cb2529e 100644
> --- a/arch/x86/include/asm/xen/hypercall.h
> +++ b/arch/x86/include/asm/xen/hypercall.h
> @@ -552,13 +552,13 @@ static inline void
>  MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
>  			struct desc_struct desc)
>  {
> -	u32 *p = (u32 *) &desc;
> -
>  	mcl->op = __HYPERVISOR_update_descriptor;
>  	if (sizeof(maddr) == sizeof(long)) {
>  		mcl->args[0] = maddr;
>  		mcl->args[1] = *(unsigned long *)&desc;
>  	} else {
> +		u32 *p = (u32 *) &desc;

Please omit the space here      ^


Juergen

> +
>  		mcl->args[0] = maddr;
>  		mcl->args[1] = maddr >> 32;
>  		mcl->args[2] = *p++;
> 

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

end of thread, other threads:[~2017-09-18  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-18  8:38 [PATCH] x86/xen: clean up clang build warning Colin King
2017-09-18  8:43 ` Juergen Gross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome