Skip to content

Commit

Permalink
block: remove a dead check in show_partition
Browse files Browse the repository at this point in the history
disk_max_parts never returns 0 given that ->minors for devices not using
the extended dev_t must be non-zero, and disk_max_parts always returns
DISK_MAX_PARTS for the latter.

Signed-off-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Nov 29, 2021
1 parent 1a827ce commit e3b3bad
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,7 @@ static int show_partition(struct seq_file *seqf, void *v)
struct block_device *part;
unsigned long idx;

/* Don't show non-partitionable removeable devices or empty devices */
if (!get_capacity(sgp) || (!disk_max_parts(sgp) &&
(sgp->flags & GENHD_FL_REMOVABLE)))
if (!get_capacity(sgp))
return 0;
if (sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO)
return 0;
Expand Down

0 comments on commit e3b3bad

Please sign in to comment.