diff mbox series

[V2,1/1] blk-lib: don't check bdev_get_queue() NULL check

Message ID 20220215115247.11717-2-kch@nvidia.com (mailing list archive)
State New, archived
Headers show
Series [V2,1/1] blk-lib: don't check bdev_get_queue() NULL check | expand

Commit Message

Chaitanya Kulkarni Feb. 15, 2022, 11:52 a.m. UTC
Based on the comment present in the bdev_get_queue()
bdev->bd_queue can never be NULL. Remove the NULL check for the local
variable q that is set from bdev_get_queue() for discard, write_same,
and write_zeroes.

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 block/blk-lib.c | 14 --------------
 1 file changed, 14 deletions(-)

Comments

Ming Lei Feb. 15, 2022, 12:02 p.m. UTC | #1
On Tue, Feb 15, 2022 at 03:52:47AM -0800, Chaitanya Kulkarni wrote:
> Based on the comment present in the bdev_get_queue()
> bdev->bd_queue can never be NULL. Remove the NULL check for the local
> variable q that is set from bdev_get_queue() for discard, write_same,
> and write_zeroes.
> 
> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>

Looks fine,

Reviewed-by: Ming Lei <ming.lei@redhat.com>
diff mbox series

Patch

diff --git a/block/blk-lib.c b/block/blk-lib.c
index 1b8ced45e4e5..fc6ea52e7482 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -19,9 +19,6 @@  int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
 	unsigned int op;
 	sector_t bs_mask, part_offset = 0;
 
-	if (!q)
-		return -ENXIO;
-
 	if (bdev_read_only(bdev))
 		return -EPERM;
 
@@ -156,9 +153,6 @@  static int __blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
 	struct bio *bio = *biop;
 	sector_t bs_mask;
 
-	if (!q)
-		return -ENXIO;
-
 	if (bdev_read_only(bdev))
 		return -EPERM;
 
@@ -232,10 +226,6 @@  static int __blkdev_issue_write_zeroes(struct block_device *bdev,
 {
 	struct bio *bio = *biop;
 	unsigned int max_write_zeroes_sectors;
-	struct request_queue *q = bdev_get_queue(bdev);
-
-	if (!q)
-		return -ENXIO;
 
 	if (bdev_read_only(bdev))
 		return -EPERM;
@@ -284,14 +274,10 @@  static int __blkdev_issue_zero_pages(struct block_device *bdev,
 		sector_t sector, sector_t nr_sects, gfp_t gfp_mask,
 		struct bio **biop)
 {
-	struct request_queue *q = bdev_get_queue(bdev);
 	struct bio *bio = *biop;
 	int bi_size = 0;
 	unsigned int sz;
 
-	if (!q)
-		return -ENXIO;
-
 	if (bdev_read_only(bdev))
 		return -EPERM;