]> www.infradead.org Git - users/hch/misc.git/commitdiff
nvdimm: Use str_plural() to simplify the code
authorXichao Zhao <zhao.xichao@vivo.com>
Wed, 27 Aug 2025 02:13:25 +0000 (10:13 +0800)
committerIra Weiny <ira.weiny@intel.com>
Tue, 16 Sep 2025 15:57:33 +0000 (10:57 -0500)
Use the string choice helper function str_plural() to simplify the code.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
drivers/nvdimm/namespace_devs.c
drivers/nvdimm/region.c

index 55cfbf1e0a95611e662c6e277e0831fb2ed5b0d8..53bce1fa376ecd0e7cb424baf65f319d382370ed 100644 (file)
@@ -1983,7 +1983,7 @@ static struct device **scan_labels(struct nd_region *nd_region)
        }
 
        dev_dbg(&nd_region->dev, "discovered %d namespace%s\n", count,
-               count == 1 ? "" : "s");
+               str_plural(count));
 
        if (count == 0) {
                struct nd_namespace_pmem *nspm;
index 88dc062af5f84f28ef39ce1df787d92e358ee53a..68a26002f8b9e83a77d9ac7ec0d0a79fd66a32f1 100644 (file)
@@ -70,7 +70,7 @@ static int nd_region_probe(struct device *dev)
         * "<async-registered>/<total>" namespace count.
         */
        dev_err(dev, "failed to register %d namespace%s, continuing...\n",
-                       err, err == 1 ? "" : "s");
+                       err, str_plural(err));
        return 0;
 }