initrd: Use str_plural() in rd_load_image()

Add the local variable 'nr_disks' and replace the manual ternary "s"
pluralization with the standardized str_plural() helper function.

Use pr_notice() instead of printk(KERN_NOTICE) to silence a checkpatch
warning.

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Thorsten Blum 2025-09-12 09:46:52 +02:00 committed by Christian Brauner
parent e60625e7ce
commit beb022ef92
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
1 changed files with 5 additions and 3 deletions

View File

@ -7,6 +7,7 @@
#include <uapi/linux/cramfs_fs.h>
#include <linux/initrd.h>
#include <linux/string.h>
#include <linux/string_choices.h>
#include <linux/slab.h>
#include "do_mounts.h"
@ -186,7 +187,7 @@ static unsigned long nr_blocks(struct file *file)
int __init rd_load_image(char *from)
{
int res = 0;
unsigned long rd_blocks, devblocks;
unsigned long rd_blocks, devblocks, nr_disks;
int nblocks, i;
char *buf = NULL;
unsigned short rotate = 0;
@ -242,8 +243,9 @@ int __init rd_load_image(char *from)
goto done;
}
printk(KERN_NOTICE "RAMDISK: Loading %dKiB [%ld disk%s] into ram disk... ",
nblocks, ((nblocks-1)/devblocks)+1, nblocks>devblocks ? "s" : "");
nr_disks = (nblocks - 1) / devblocks + 1;
pr_notice("RAMDISK: Loading %dKiB [%ld disk%s] into ram disk... ",
nblocks, nr_disks, str_plural(nr_disks));
for (i = 0; i < nblocks; i++) {
if (i && (i % devblocks == 0)) {
pr_cont("done disk #1.\n");