]> www.infradead.org Git - users/hch/block.git/commitdiff
vsprintf: use bd_partno in bdev_name bd_contains-cleanup
authorChristoph Hellwig <hch@lst.de>
Wed, 2 Sep 2020 09:29:00 +0000 (11:29 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 2 Sep 2020 09:29:16 +0000 (11:29 +0200)
No need to go through the hd_struct to find the partition number.

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

index afb9521ddf91975aa6ebb2e853712f50f3f94cc3..14c9a6af1b239af68d80a41bfebf7ff467f4e8e0 100644 (file)
@@ -940,13 +940,13 @@ char *bdev_name(char *buf, char *end, struct block_device *bdev,
 
        hd = bdev->bd_disk;
        buf = string(buf, end, hd->disk_name, spec);
-       if (bdev->bd_part->partno) {
+       if (bdev->bd_partno) {
                if (isdigit(hd->disk_name[strlen(hd->disk_name)-1])) {
                        if (buf < end)
                                *buf = 'p';
                        buf++;
                }
-               buf = number(buf, end, bdev->bd_part->partno, spec);
+               buf = number(buf, end, bdev->bd_partno, spec);
        }
        return buf;
 }