diff options
-rw-r--r-- | fs/partitions/check.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 8ed4d3433199..f82e762eeca2 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c @@ -256,10 +256,12 @@ ssize_t part_discard_alignment_show(struct device *dev, { struct hd_struct *p = dev_to_part(dev); struct gendisk *disk = dev_to_disk(dev); + unsigned int alignment = 0; - return sprintf(buf, "%u\n", - queue_limit_discard_alignment(&disk->queue->limits, - p->start_sect)); + if (disk->queue) + alignment = queue_limit_discard_alignment(&disk->queue->limits, + p->start_sect); + return sprintf(buf, "%u\n", alignment); } ssize_t part_stat_show(struct device *dev, |