Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH] crypto: rng - Combine two seq_printf() calls into one in crypto_rng_show()
@ 2025-11-10 15:56 Markus Elfring
  2025-11-19  4:45 ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2025-11-10 15:56 UTC (permalink / raw)
  To: linux-crypto, David S. Miller, Herbert Xu, Neil Horman; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 crypto/rng.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/crypto/rng.c b/crypto/rng.c
index ee1768c5a400..479c4ac6fb6c 100644
--- a/crypto/rng.c
+++ b/crypto/rng.c
@@ -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 = {
-- 
2.51.1


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

* Re: [PATCH] crypto: rng - Combine two seq_printf() calls into one in crypto_rng_show()
  2025-11-10 15:56 [PATCH] crypto: rng - Combine two seq_printf() calls into one in crypto_rng_show() Markus Elfring
@ 2025-11-19  4:45 ` Herbert Xu
  2025-11-19 10:16   ` Markus Elfring
  0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2025-11-19  4:45 UTC (permalink / raw)
  To: Markus Elfring; +Cc: linux-crypto, David S. Miller, Neil Horman, LKML

On Mon, Nov 10, 2025 at 04:56:10PM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  crypto/rng.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/crypto/rng.c b/crypto/rng.c
> index ee1768c5a400..479c4ac6fb6c 100644
> --- a/crypto/rng.c
> +++ b/crypto/rng.c
> @@ -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,
-- 
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	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: rng - Combine two seq_printf() calls into one in crypto_rng_show()
  2025-11-19  4:45 ` Herbert Xu
@ 2025-11-19 10:16   ` Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2025-11-19 10:16 UTC (permalink / raw)
  To: Herbert Xu, linux-crypto; +Cc: David S. Miller, Neil Horman, LKML

…>> +++ b/crypto/rng.c
>> @@ -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

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

end of thread, other threads:[~2025-11-19 10:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 15:56 [PATCH] crypto: rng - Combine two seq_printf() calls into one in crypto_rng_show() Markus Elfring
2025-11-19  4:45 ` Herbert Xu
2025-11-19 10:16   ` Markus Elfring

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