* [PATCH] mm/cma: Use str_plural() in cma_declare_contiguous_multi()
@ 2025-06-30 13:23 Thorsten Blum
2025-06-30 14:11 ` Dev Jain
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Thorsten Blum @ 2025-06-30 13:23 UTC (permalink / raw)
To: Andrew Morton; +Cc: Thorsten Blum, linux-mm, linux-kernel
Use the string choice helper function str_plural() to simplify the code
and to fix the following Coccinelle/coccicheck warning reported by
string_choices.cocci:
opportunity for str_plural(nr)
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
mm/cma.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/cma.c b/mm/cma.c
index c0b2630a1b81..c40d53298801 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -22,6 +22,7 @@
#include <linux/mm.h>
#include <linux/sizes.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
#include <linux/log2.h>
#include <linux/cma.h>
#include <linux/highmem.h>
@@ -548,8 +549,7 @@ int __init cma_declare_contiguous_multi(phys_addr_t total_size,
(unsigned long)total_size / SZ_1M);
else
pr_info("Reserved %lu MiB in %d range%s\n",
- (unsigned long)total_size / SZ_1M, nr,
- nr > 1 ? "s" : "");
+ (unsigned long)total_size / SZ_1M, nr, str_plural(nr));
return ret;
}
--
2.50.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/cma: Use str_plural() in cma_declare_contiguous_multi()
2025-06-30 13:23 [PATCH] mm/cma: Use str_plural() in cma_declare_contiguous_multi() Thorsten Blum
@ 2025-06-30 14:11 ` Dev Jain
2025-07-02 4:12 ` Anshuman Khandual
2025-07-04 14:21 ` David Hildenbrand
2 siblings, 0 replies; 4+ messages in thread
From: Dev Jain @ 2025-06-30 14:11 UTC (permalink / raw)
To: Thorsten Blum, Andrew Morton; +Cc: linux-mm, linux-kernel
On 30/06/25 6:53 pm, Thorsten Blum wrote:
> Use the string choice helper function str_plural() to simplify the code
> and to fix the following Coccinelle/coccicheck warning reported by
> string_choices.cocci:
>
> opportunity for str_plural(nr)
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>
Thanks for basing on mm-new, I have tested the patch.
Reviewed-by: Dev Jain <dev.jain@arm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/cma: Use str_plural() in cma_declare_contiguous_multi()
2025-06-30 13:23 [PATCH] mm/cma: Use str_plural() in cma_declare_contiguous_multi() Thorsten Blum
2025-06-30 14:11 ` Dev Jain
@ 2025-07-02 4:12 ` Anshuman Khandual
2025-07-04 14:21 ` David Hildenbrand
2 siblings, 0 replies; 4+ messages in thread
From: Anshuman Khandual @ 2025-07-02 4:12 UTC (permalink / raw)
To: Thorsten Blum, Andrew Morton; +Cc: linux-mm, linux-kernel
On 30/06/25 6:53 PM, Thorsten Blum wrote:
> Use the string choice helper function str_plural() to simplify the code
> and to fix the following Coccinelle/coccicheck warning reported by
> string_choices.cocci:
>
> opportunity for str_plural(nr)
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> mm/cma.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/cma.c b/mm/cma.c
> index c0b2630a1b81..c40d53298801 100644
> --- a/mm/cma.c
> +++ b/mm/cma.c
> @@ -22,6 +22,7 @@
> #include <linux/mm.h>
> #include <linux/sizes.h>
> #include <linux/slab.h>
> +#include <linux/string_choices.h>
> #include <linux/log2.h>
> #include <linux/cma.h>
> #include <linux/highmem.h>
> @@ -548,8 +549,7 @@ int __init cma_declare_contiguous_multi(phys_addr_t total_size,
> (unsigned long)total_size / SZ_1M);
> else
> pr_info("Reserved %lu MiB in %d range%s\n",
> - (unsigned long)total_size / SZ_1M, nr,
> - nr > 1 ? "s" : "");
> + (unsigned long)total_size / SZ_1M, nr, str_plural(nr));
> return ret;
> }
>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/cma: Use str_plural() in cma_declare_contiguous_multi()
2025-06-30 13:23 [PATCH] mm/cma: Use str_plural() in cma_declare_contiguous_multi() Thorsten Blum
2025-06-30 14:11 ` Dev Jain
2025-07-02 4:12 ` Anshuman Khandual
@ 2025-07-04 14:21 ` David Hildenbrand
2 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2025-07-04 14:21 UTC (permalink / raw)
To: Thorsten Blum, Andrew Morton; +Cc: linux-mm, linux-kernel
On 30.06.25 15:23, Thorsten Blum wrote:
> Use the string choice helper function str_plural() to simplify the code
> and to fix the following Coccinelle/coccicheck warning reported by
> string_choices.cocci:
>
> opportunity for str_plural(nr)
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-07-04 14:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-30 13:23 [PATCH] mm/cma: Use str_plural() in cma_declare_contiguous_multi() Thorsten Blum
2025-06-30 14:11 ` Dev Jain
2025-07-02 4:12 ` Anshuman Khandual
2025-07-04 14:21 ` David Hildenbrand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox