linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] xen-blkback: Remove needless request_queue NULL pointer check
@ 2021-09-10  3:59 Xu Wang
  2021-09-14  7:58 ` Roger Pau Monné
  0 siblings, 1 reply; 2+ messages in thread
From: Xu Wang @ 2021-09-10  3:59 UTC (permalink / raw)
  To: Damien.LeMoal, konrad.wilk, roger.pau, axboe, xen-devel
  Cc: linux-block, linux-kernel

The request_queue pointer returned from bdev_get_queue() shall
never be NULL, so the null check is unnecessary, just remove it.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
Changes since v2:
- Add missing parenthesis.
- Remove another null pointer check.
---
 drivers/block/xen-blkback/xenbus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 33eba3df4dd9..aac08b4369ac 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -516,10 +516,10 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
 		vbd->type |= VDISK_REMOVABLE;
 
 	q = bdev_get_queue(bdev);
-	if (q && test_bit(QUEUE_FLAG_WC, &q->queue_flags))
+	if (test_bit(QUEUE_FLAG_WC, &q->queue_flags))
 		vbd->flush_support = true;
 
-	if (q && blk_queue_secure_erase(q))
+	if (blk_queue_secure_erase(q))
 		vbd->discard_secure = true;
 
 	vbd->feature_gnt_persistent = feature_persistent;
-- 
2.17.1


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

* Re: [PATCH v2] xen-blkback: Remove needless request_queue NULL pointer check
  2021-09-10  3:59 [PATCH v2] xen-blkback: Remove needless request_queue NULL pointer check Xu Wang
@ 2021-09-14  7:58 ` Roger Pau Monné
  0 siblings, 0 replies; 2+ messages in thread
From: Roger Pau Monné @ 2021-09-14  7:58 UTC (permalink / raw)
  To: Xu Wang
  Cc: Damien.LeMoal, konrad.wilk, axboe, xen-devel, linux-block, linux-kernel

On Fri, Sep 10, 2021 at 03:59:18AM +0000, Xu Wang wrote:
> The request_queue pointer returned from bdev_get_queue() shall
> never be NULL, so the null check is unnecessary, just remove it.

There are other places in the code where the return of bdev_get_queue
is checked to not be NULL, like __blkdev_issue_discard. Should those
also be changed?

> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>

Acked-by: Roger Pau Monné <roger.pau@citrix.com>

Regards, Roger.

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10  3:59 [PATCH v2] xen-blkback: Remove needless request_queue NULL pointer check Xu Wang
2021-09-14  7:58 ` Roger Pau Monné

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