[RESEND,1/3] ublk: remove unnecessary NULL check in ublk_rq_has_data()

Message ID 20230207070839.370817-2-ZiyangZhang@linux.alibaba.com
State New
Headers
Series cleanup for ublk |

Commit Message

Ziyang Zhang Feb. 7, 2023, 7:08 a.m. UTC
  bio_has_data() allows a NULL bio so the NULL check in
ublk_rq_has_data() is unnecessary.

Signed-off-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
---
 drivers/block/ublk_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ming Lei Feb. 7, 2023, 2:06 p.m. UTC | #1
On Tue, Feb 07, 2023 at 03:08:37PM +0800, Ziyang Zhang wrote:
> bio_has_data() allows a NULL bio so the NULL check in
> ublk_rq_has_data() is unnecessary.
> 
> Signed-off-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>

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


Thanks,
Ming
  

Patch

diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index c932e9ea5a0f..55fccce68a9c 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -322,7 +322,7 @@  static inline struct ublk_queue *ublk_get_queue(struct ublk_device *dev,
 
 static inline bool ublk_rq_has_data(const struct request *rq)
 {
-	return rq->bio && bio_has_data(rq->bio);
+	return bio_has_data(rq->bio);
 }
 
 static inline struct ublksrv_io_desc *ublk_get_iod(struct ublk_queue *ubq,