linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] blk-zoned: Remove needless request_queue NULL pointer checks
@ 2021-09-10  6:44 Xu Wang
  2021-09-10  9:33 ` Chaitanya Kulkarni
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Xu Wang @ 2021-09-10  6:44 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel

The request_queue pointer returned from bdev_get_queue() shall
never be NULL, so the NULL checks are unnecessary, just remove them.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Changes since v2:
- Make the q variable assignment together with declaration.
---
 block/blk-zoned.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 1d0c76c18fc5..a406ead05ab7 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -346,17 +346,13 @@ int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode,
 {
 	void __user *argp = (void __user *)arg;
 	struct zone_report_args args;
-	struct request_queue *q;
+	struct request_queue *q = dev_get_queue(bdev);
 	struct blk_zone_report rep;
 	int ret;
 
 	if (!argp)
 		return -EINVAL;
 
-	q = bdev_get_queue(bdev);
-	if (!q)
-		return -ENXIO;
-
 	if (!blk_queue_is_zoned(q))
 		return -ENOTTY;
 
@@ -403,7 +399,7 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode,
 			   unsigned int cmd, unsigned long arg)
 {
 	void __user *argp = (void __user *)arg;
-	struct request_queue *q;
+	struct request_queue *q = bdev_get_queue(bdev);
 	struct blk_zone_range zrange;
 	enum req_opf op;
 	int ret;
@@ -411,10 +407,6 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode,
 	if (!argp)
 		return -EINVAL;
 
-	q = bdev_get_queue(bdev);
-	if (!q)
-		return -ENXIO;
-
 	if (!blk_queue_is_zoned(q))
 		return -ENOTTY;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-10 14:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10  6:44 [PATCH v2] blk-zoned: Remove needless request_queue NULL pointer checks Xu Wang
2021-09-10  9:33 ` Chaitanya Kulkarni
2021-09-10  9:45 ` kernel test robot
2021-09-10 11:45 ` kernel test robot
2021-09-10 14:04 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).