Skip to contentSkip to conversation

linux-next: build warning after merge of the crypto tree

DISCUSSION Stephen Rothwell 3 participants 5 messages Aug 25, 2016 – Aug 26, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 10 lines · On Thu, 25 Aug 2016 11:38:24 +1000 Stephen Rothwell <[email protected]>…

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:
^

Quoted 5 lines

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:
--

crypto/xor.c +2 -2
index b8975d9..f00edfc 100644
@@ -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;
 }
Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
maintainer
#2 lore raw
Quoted 13 lines · Martin Schwidefsky
Quoted 10 lines · On Thu, 25 Aug 2016 11:38:24 +1000 Stephen Rothwell <[email protected]>…

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:
^

Quoted 7 lines
Quoted 5 lines

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...")
crypto/xor.c +2 -1
index b8975d9..69866e9 100644
@@ -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
Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#3 lore raw

Hi Herbert,

Quoted 18 lines · On Thu, 25 Aug 2016 15:47:01 +0800 Herbert Xu <[email protected]>…

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...")
crypto/xor.c +0 -0
index b8975d9..69866e9 100644
@@ -113,13 +113,14 @@ calibrate_xor_blocks(void)
 
 #ifdef XOR_SELECT_TEMPLATE

crypto/xor.c calibrate_xor_blocks(void) · line 122

Quoted 10 lines
crypto/xor.c +2 -1
 	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.

Signature · 2 lines
Cheers,
Stephen Rothwell
maintainer
#4 lore raw

crypto: xor - Fix warning when XOR_SELECT_TEMPLATE is unset

Quoted 10 lines · Stephen Rothwell

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...")
crypto/xor.c +5 -4
index b8975d9..263af9f 100644
@@ -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
Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt