]> www.infradead.org Git - users/hch/block.git/commitdiff
block: use the %pg format specifier in __blkdev_issue_discard
authorChristoph Hellwig <hch@lst.de>
Fri, 23 Jul 2021 06:30:20 +0000 (08:30 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 26 Jul 2021 06:34:14 +0000 (08:34 +0200)
Simplify printing the partition name by using the %pg format specifier
that is equivalent to a bdevname call.

Signed-off-by: Christoph Hellwig <hch@lst.de>
block/blk-lib.c

index 9f09beadcbe30a47588773027d785555101ffd7e..43d1aa016b8d3179222a7cf0697cf33352aff18e 100644 (file)
@@ -50,10 +50,8 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
 
        /* In case the discard granularity isn't set by buggy device driver */
        if (WARN_ON_ONCE(!q->limits.discard_granularity)) {
-               char dev_name[BDEVNAME_SIZE];
-
-               bdevname(bdev, dev_name);
-               pr_err_ratelimited("%s: Error: discard_granularity is 0.\n", dev_name);
+               pr_err_ratelimited("%pg: Error: discard_granularity is 0.\n",
+                               bdev);
                return -EOPNOTSUPP;
        }