Skip to contentSkip to conversation

crypto: rng - Combine two seq_printf() calls into one in crypto_rng_show()

PATCH In review Markus Elfring 2 participants 3 messages Nov 10, 2025 – Nov 19, 2025 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: rng - Combine two seq_printf() calls into one in crypto_rng_show()

From: Markus Elfring <[email protected]>
Date: Mon, 10 Nov 2025 16:45:13 +0100

A bit of data was put into a sequence by two separate function calls. Print the same data by a single function call instead.

---
 crypto/rng.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
crypto/rng.c +1 -2
index ee1768c5a400..479c4ac6fb6c 100644
@@ -81,8 +81,7 @@ static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg)
 	__maybe_unused;
 static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg)
 {
-	seq_printf(m, "type         : rng\n");
-	seq_printf(m, "seedsize     : %u\n", seedsize(alg));
+	seq_printf(m, "type         : rng\nseedsize     : %u\n", seedsize(alg));
 }
 
 static const struct crypto_type crypto_rng_type = {
Signature · 1 line
2.51.1
maintainer
#1 lore raw
Quoted 16 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Mon, 10 Nov 2025 16:45:13 +0100

A bit of data was put into a sequence by two separate function calls. Print the same data by a single function call instead.

---
 crypto/rng.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
crypto/rng.c +0 -0
index ee1768c5a400..479c4ac6fb6c 100644

crypto/rng.c static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg) · line 84

Quoted 6 lines
crypto/rng.c +1 -2
@@ -81,8 +81,7 @@ static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg)
 	__maybe_unused;
 static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg)
 {
-	seq_printf(m, "type         : rng\n");
-	seq_printf(m, "seedsize     : %u\n", seedsize(alg));
+	seq_printf(m, "type         : rng\nseedsize     : %u\n", seedsize(alg));

This makes the code look worse and appears to be an optimisation that isn't really needed.

Cheers,

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
#2 lore raw

…>> +++ b/crypto/rng.c

Quoted 10 lines

crypto/rng.c static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg) · line 84

Quoted 7 lines
crypto/rng.c +1 -2
@@ -81,8 +81,7 @@ static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg)
 	__maybe_unused;
 static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg)
 {
-	seq_printf(m, "type         : rng\n");
-	seq_printf(m, "seedsize     : %u\n", seedsize(alg));
+	seq_printf(m, "type         : rng\nseedsize     : %u\n", seedsize(alg));

This makes the code look worse and appears to be an optimisation that isn't really needed.

Would you expect to specify still two string literals at such a source code place?

Regards,
Markus