linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: build warning after merge of the crypto tree
@ 2016-08-25  1:38 Stephen Rothwell
  2016-08-25  6:20 ` Martin Schwidefsky
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Rothwell @ 2016-08-25  1:38 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-next, linux-kernel, Martin Schwidefsky

Hi Herbert,

After merging the crypto tree, today's linux-next build (powerpc
ppc64_defconfig) produced this warning:

crypto/xor.c: In function 'calibrate_xor_blocks':
crypto/xor.c:156:1: warning: label 'out' defined but not used [-Wunused-label]
 out:
 ^

Introduced by commit

  39457acda913 ("crypto: xor - skip speed test if the xor function is selected automatically")

This build does not have XOR_SELECT_TEMPLATE set.

-- 
Cheers,
Stephen Rothwell

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

* Re: linux-next: build warning after merge of the crypto tree
  2016-08-25  1:38 linux-next: build warning after merge of the crypto tree Stephen Rothwell
@ 2016-08-25  6:20 ` Martin Schwidefsky
  2016-08-25  7:47   ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Schwidefsky @ 2016-08-25  6:20 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Herbert Xu, linux-next, linux-kernel

On Thu, 25 Aug 2016 11:38:24 +1000
Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> Hi Herbert,
> 
> After merging the crypto tree, today's linux-next build (powerpc
> ppc64_defconfig) produced this warning:
> 
> crypto/xor.c: In function 'calibrate_xor_blocks':
> crypto/xor.c:156:1: warning: label 'out' defined but not used [-Wunused-label]
>  out:
>  ^
> 
> Introduced by commit
> 
>   39457acda913 ("crypto: xor - skip speed test if the xor function is selected automatically")
> 
> This build does not have XOR_SELECT_TEMPLATE set.

Hmm, this is probably the best option to get rid of the warning: 
--
diff --git a/crypto/xor.c b/crypto/xor.c
index b8975d9..f00edfc 100644
--- a/crypto/xor.c
+++ b/crypto/xor.c
@@ -117,7 +117,8 @@ calibrate_xor_blocks(void)
 		printk(KERN_INFO "xor: automatically using best "
 				 "checksumming function   %-10s\n",
 		       fastest->name);
-		goto out;
+		active_template = fastest;
+		return 0;
 	}
 #endif
 
@@ -153,7 +154,6 @@ calibrate_xor_blocks(void)
 #undef xor_speed
 
 	free_pages((unsigned long)b1, 2);
-out:
 	active_template = fastest;
 	return 0;
 }
-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

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

* Re: linux-next: build warning after merge of the crypto tree
  2016-08-25  6:20 ` Martin Schwidefsky
@ 2016-08-25  7:47   ` Herbert Xu
  2016-08-25 11:14     ` Stephen Rothwell
  0 siblings, 1 reply; 5+ messages in thread
From: Herbert Xu @ 2016-08-25  7:47 UTC (permalink / raw)
  To: Martin Schwidefsky; +Cc: Stephen Rothwell, linux-next, linux-kernel

On Thu, Aug 25, 2016 at 08:20:10AM +0200, Martin Schwidefsky wrote:
> On Thu, 25 Aug 2016 11:38:24 +1000
> Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
> > Hi Herbert,
> > 
> > After merging the crypto tree, today's linux-next build (powerpc
> > ppc64_defconfig) produced this warning:
> > 
> > crypto/xor.c: In function 'calibrate_xor_blocks':
> > crypto/xor.c:156:1: warning: label 'out' defined but not used [-Wunused-label]
> >  out:
> >  ^
> > 
> > Introduced by commit
> > 
> >   39457acda913 ("crypto: xor - skip speed test if the xor function is selected automatically")
> > 
> > This build does not have XOR_SELECT_TEMPLATE set.
> 
> Hmm, this is probably the best option to get rid of the warning: 

I'm going to do something like this:

---8<---
This patch fixes an unused label warning triggered when the macro
XOR_SELECT_TEMPLATE is not set.

Fixes: 39457acda913 ("crypto: xor - skip speed test if the xor...")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/crypto/xor.c b/crypto/xor.c
index b8975d9..69866e9 100644
--- a/crypto/xor.c
+++ b/crypto/xor.c
@@ -113,13 +113,14 @@ calibrate_xor_blocks(void)
 
 #ifdef XOR_SELECT_TEMPLATE
 	fastest = XOR_SELECT_TEMPLATE(fastest);
+#endif
+
 	if (fastest) {
 		printk(KERN_INFO "xor: automatically using best "
 				 "checksumming function   %-10s\n",
 		       fastest->name);
 		goto out;
 	}
-#endif
 
 	/*
 	 * Note: Since the memory is not actually used for _anything_ but to

-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: linux-next: build warning after merge of the crypto tree
  2016-08-25  7:47   ` Herbert Xu
@ 2016-08-25 11:14     ` Stephen Rothwell
  2016-08-26 15:19       ` crypto: xor - Fix warning when XOR_SELECT_TEMPLATE is unset Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Rothwell @ 2016-08-25 11:14 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Martin Schwidefsky, linux-next, linux-kernel

Hi Herbert,

On Thu, 25 Aug 2016 15:47:01 +0800 Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> I'm going to do something like this:
> 
> ---8<---
> This patch fixes an unused label warning triggered when the macro
> XOR_SELECT_TEMPLATE is not set.
> 
> Fixes: 39457acda913 ("crypto: xor - skip speed test if the xor...")
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
> diff --git a/crypto/xor.c b/crypto/xor.c
> index b8975d9..69866e9 100644
> --- a/crypto/xor.c
> +++ b/crypto/xor.c
> @@ -113,13 +113,14 @@ calibrate_xor_blocks(void)
>  
>  #ifdef XOR_SELECT_TEMPLATE
>  	fastest = XOR_SELECT_TEMPLATE(fastest);
> +#endif
> +
>  	if (fastest) {
>  		printk(KERN_INFO "xor: automatically using best "
>  				 "checksumming function   %-10s\n",
>  		       fastest->name);
>  		goto out;
>  	}
> -#endif

That looks fine to me.  An alternative might be to have:

#ifndef XOR_SELECT_TEMPLATE
#define XOR_SELECT_TEMPLATE(x)	(x)
#endif

near the top of the file.  That gets the #ifdef out of the code flow
and serves as some hint that such a thing can be defined by arch header
files.

Either way.
-- 
Cheers,
Stephen Rothwell

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

* crypto: xor - Fix warning when XOR_SELECT_TEMPLATE is unset
  2016-08-25 11:14     ` Stephen Rothwell
@ 2016-08-26 15:19       ` Herbert Xu
  0 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2016-08-26 15:19 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Martin Schwidefsky, linux-next, linux-kernel, Linux Crypto Mailing List

On Thu, Aug 25, 2016 at 09:14:11PM +1000, Stephen Rothwell wrote:
>
> That looks fine to me.  An alternative might be to have:
> 
> #ifndef XOR_SELECT_TEMPLATE
> #define XOR_SELECT_TEMPLATE(x)	(x)
> #endif
> 
> near the top of the file.  That gets the #ifdef out of the code flow
> and serves as some hint that such a thing can be defined by arch header
> files.

Good idea.  Thanks Stephen.

---8<---
This patch fixes an unused label warning triggered when the macro
XOR_SELECT_TEMPLATE is not set.

Fixes: 39457acda913 ("crypto: xor - skip speed test if the xor...")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Suggested-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/crypto/xor.c b/crypto/xor.c
index b8975d9..263af9f 100644
--- a/crypto/xor.c
+++ b/crypto/xor.c
@@ -24,6 +24,10 @@
 #include <linux/preempt.h>
 #include <asm/xor.h>
 
+#ifndef XOR_SELECT_TEMPLATE
+#define XOR_SELECT_TEMPLATE(x) (x)
+#endif
+
 /* The xor routines to use.  */
 static struct xor_block_template *active_template;
 
@@ -109,17 +113,14 @@ calibrate_xor_blocks(void)
 	void *b1, *b2;
 	struct xor_block_template *f, *fastest;
 
-	fastest = NULL;
+	fastest = XOR_SELECT_TEMPLATE(NULL);
 
-#ifdef XOR_SELECT_TEMPLATE
-	fastest = XOR_SELECT_TEMPLATE(fastest);
 	if (fastest) {
 		printk(KERN_INFO "xor: automatically using best "
 				 "checksumming function   %-10s\n",
 		       fastest->name);
 		goto out;
 	}
-#endif
 
 	/*
 	 * Note: Since the memory is not actually used for _anything_ but to
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2016-08-26 15:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-25  1:38 linux-next: build warning after merge of the crypto tree Stephen Rothwell
2016-08-25  6:20 ` Martin Schwidefsky
2016-08-25  7:47   ` Herbert Xu
2016-08-25 11:14     ` Stephen Rothwell
2016-08-26 15:19       ` crypto: xor - Fix warning when XOR_SELECT_TEMPLATE is unset Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).