linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blk-zoned: Remove needless request_queue NULL pointer checks
@ 2021-09-10  2:23 Xu Wang
  2021-09-10  2:41 ` Damien Le Moal
  0 siblings, 1 reply; 2+ messages in thread
From: Xu Wang @ 2021-09-10  2:23 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>
---
 block/blk-zoned.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 1d0c76c18fc5..5160972a009a 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -354,8 +354,6 @@ int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode,
 		return -EINVAL;
 
 	q = bdev_get_queue(bdev);
-	if (!q)
-		return -ENXIO;
 
 	if (!blk_queue_is_zoned(q))
 		return -ENOTTY;
@@ -412,8 +410,6 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode,
 		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] 2+ messages in thread

* Re: [PATCH] blk-zoned: Remove needless request_queue NULL pointer checks
  2021-09-10  2:23 [PATCH] blk-zoned: Remove needless request_queue NULL pointer checks Xu Wang
@ 2021-09-10  2:41 ` Damien Le Moal
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2021-09-10  2:41 UTC (permalink / raw)
  To: Xu Wang, axboe; +Cc: linux-block

On 2021/09/10 11:31, Xu Wang wrote:
> 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>
> ---
>  block/blk-zoned.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/block/blk-zoned.c b/block/blk-zoned.c
> index 1d0c76c18fc5..5160972a009a 100644
> --- a/block/blk-zoned.c
> +++ b/block/blk-zoned.c
> @@ -354,8 +354,6 @@ int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode,
>  		return -EINVAL;
>  
>  	q = bdev_get_queue(bdev);

Please move this together with the q variable declaration:

struct request_queue *q = bdev_get_queue(bdev);

> -	if (!q)
> -		return -ENXIO;
>  
>  	if (!blk_queue_is_zoned(q))
>  		return -ENOTTY;
> @@ -412,8 +410,6 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode,
>  		return -EINVAL;
>  
>  	q = bdev_get_queue(bdev);

Same here.

> -	if (!q)
> -		return -ENXIO;
>  
>  	if (!blk_queue_is_zoned(q))
>  		return -ENOTTY;
> 

With the above changed, this looks good (please at least compile test this !).

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>

-- 
Damien Le Moal
Western Digital Research

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10  2:23 [PATCH] blk-zoned: Remove needless request_queue NULL pointer checks Xu Wang
2021-09-10  2:41 ` Damien Le Moal

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).