[Qemu-devel] [PATCH] block: Remove NULL check in bdrv_co_flush

Fam Zheng posted 1 patch 6 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170426020349.25257-1-famz@redhat.com
Test checkpatch passed
Test docker passed
Test s390x passed
block/io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] block: Remove NULL check in bdrv_co_flush
Posted by Fam Zheng 6 years, 11 months ago
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.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/io.c b/block/io.c
index a7142e0..a039966 100644
--- a/block/io.c
+++ b/block/io.c
@@ -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;
     }
-- 
2.9.3


Re: [Qemu-devel] [PATCH] block: Remove NULL check in bdrv_co_flush
Posted by Max Reitz 6 years, 11 months ago
On 26.04.2017 04:03, Fam Zheng wrote:
> 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.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/io.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>

Re: [Qemu-devel] [PATCH] block: Remove NULL check in bdrv_co_flush
Posted by Kevin Wolf 6 years, 11 months ago
Am 26.04.2017 um 04:03 hat Fam Zheng geschrieben:
> 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.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>

Thanks, applied to block-next.

Kevin