Skip to contentSkip to conversation

block: Remove NULL check in bdrv_co_flush

PATCH Applied Fam Zheng 3 participants 3 messages Apr 26, 2017 Block layer

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 block: Remove NULL check in bdrv_co_flush

Reported by Coverity. We already use bs in bdrv_inc_in_flight before checking for NULL. It is unnecessary as all callers pass non-NULL bs, so drop it.

---
 block/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/io.c +1 -1
index a7142e0..a039966 100644
@@ -2308,7 +2308,7 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
 
     bdrv_inc_in_flight(bs);
 
-    if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||
+    if (!bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||
         bdrv_is_sg(bs)) {
         goto early_exit;
     }
Signature · 1 line
2.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Fam Zheng

Reported by Coverity. We already use bs in bdrv_inc_in_flight before checking for NULL. It is unnecessary as all callers pass non-NULL bs, so drop it.

---
 block/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Applied
#2 lore raw
In reply to Fam Zheng

Am 26.04.2017 um 04:03 hat Fam Zheng geschrieben:

Quoted 5 lines

Reported by Coverity. We already use bs in bdrv_inc_in_flight before checking for NULL. It is unnecessary as all callers pass non-NULL bs, so drop it.

Thanks, applied to block-next.

Kevin