[RESEND PATCH] jbd2: Use str_plural() to fix Coccinelle warning

Thorsten Blum posted 1 patch 1 year, 8 months ago
fs/jbd2/recovery.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[RESEND PATCH] jbd2: Use str_plural() to fix Coccinelle warning
Posted by Thorsten Blum 1 year, 8 months ago
Use str_plural() to fix the following Coccinelle/coccicheck warning
reported by string_choices.cocci:

	opportunity for str_plural(dropped)

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
 fs/jbd2/recovery.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
index 1f7664984d6e..af930c3d0d97 100644
--- a/fs/jbd2/recovery.c
+++ b/fs/jbd2/recovery.c
@@ -19,6 +19,7 @@
 #include <linux/errno.h>
 #include <linux/crc32.h>
 #include <linux/blkdev.h>
+#include <linux/string_choices.h>
 #endif
 
 /*
@@ -374,7 +375,7 @@ int jbd2_journal_skip_recovery(journal_t *journal)
 			be32_to_cpu(journal->j_superblock->s_sequence);
 		jbd2_debug(1,
 			  "JBD2: ignoring %d transaction%s from the journal.\n",
-			  dropped, (dropped == 1) ? "" : "s");
+			  dropped, str_plural(dropped));
 #endif
 		journal->j_transaction_sequence = ++info.end_transaction;
 		journal->j_head = info.head_block;
-- 
2.45.1
Re: [RESEND PATCH] jbd2: Use str_plural() to fix Coccinelle warning
Posted by Jan Kara 1 year, 8 months ago
On Fri 31-05-24 12:42:00, Thorsten Blum wrote:
> Use str_plural() to fix the following Coccinelle/coccicheck warning
> reported by string_choices.cocci:
> 
> 	opportunity for str_plural(dropped)
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/jbd2/recovery.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
> index 1f7664984d6e..af930c3d0d97 100644
> --- a/fs/jbd2/recovery.c
> +++ b/fs/jbd2/recovery.c
> @@ -19,6 +19,7 @@
>  #include <linux/errno.h>
>  #include <linux/crc32.h>
>  #include <linux/blkdev.h>
> +#include <linux/string_choices.h>
>  #endif
>  
>  /*
> @@ -374,7 +375,7 @@ int jbd2_journal_skip_recovery(journal_t *journal)
>  			be32_to_cpu(journal->j_superblock->s_sequence);
>  		jbd2_debug(1,
>  			  "JBD2: ignoring %d transaction%s from the journal.\n",
> -			  dropped, (dropped == 1) ? "" : "s");
> +			  dropped, str_plural(dropped));
>  #endif
>  		journal->j_transaction_sequence = ++info.end_transaction;
>  		journal->j_head = info.head_block;
> -- 
> 2.45.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR