Skip to contentSkip to conversation

vhost-blk: delete the unused return value

PATCH Superseded Jin Yu 2 participants 5 messages Nov 26, 2019 – Jan 9, 2020

lore
Share & tools
lore

Jin Yu

author
#0 lore raw

PATCH 1/1 vhost-blk: delete the unused return value

Coverity issue: 350592

Fixes c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")
---
 examples/vhost_blk/vhost_blk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost_blk/vhost_blk.c +1 -1
index 3182a488b..ff2f138b3 100644
@@ -852,7 +852,7 @@ new_device(int vid)
 
 		if (ctrlr->packed_ring) {
 			/* for the reconnection */
-			ret = rte_vhost_get_vring_base_from_inflight(
+			rte_vhost_get_vring_base_from_inflight(
 				ctrlr->bdev->vid, i,
 				&blk_vq->last_avail_idx,
 				&blk_vq->last_used_idx);
Signature · 1 line
2.17.2
#1 lore raw
Quoted 15 lines · Jin Yu

Coverity issue: 350592

Fixes c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")
---
 examples/vhost_blk/vhost_blk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost_blk/vhost_blk.c +0 -0
index 3182a488b..ff2f138b3 100644

examples/vhost_blk/vhost_blk.c new_device(int vid) · line 858

Quoted 8 lines
examples/vhost_blk/vhost_blk.c +1 -1
@@ -852,7 +852,7 @@ new_device(int vid)
 
 		if (ctrlr->packed_ring) {
 			/* for the reconnection */
-			ret = rte_vhost_get_vring_base_from_inflight(
+			rte_vhost_get_vring_base_from_inflight(
 				ctrlr->bdev->vid, i,
 				&blk_vq->last_avail_idx,
 				&blk_vq->last_used_idx);

It may be safer to handle the error, isn't it?

Maxime

author
#2 lore raw

PATCH v2 1/1 vhost-blk: fix the unused return value

In reply to Jin Yu

add the assert to handle error.

Coverity issue: 350592

Fixes c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")

---
v2 - add the error hander

---
 examples/vhost_blk/vhost_blk.c | 1 +
 1 file changed, 1 insertion(+)
examples/vhost_blk/vhost_blk.c +1 -0
index 3182a488b..e1036bf3a 100644
@@ -856,6 +856,7 @@ new_device(int vid)
 				ctrlr->bdev->vid, i,
 				&blk_vq->last_avail_idx,
 				&blk_vq->last_used_idx);
+			assert(ret == 0);
 
 			blk_vq->avail_wrap_counter = blk_vq->last_avail_idx &
 				(1 << 15);
Signature · 1 line
2.17.2
Reviewed-by on v2 1/1
#3 lore raw

Re: [dpdk-dev] [PATCH v2] vhost-blk: fix the unused return value

Quoted 19 lines · Jin Yu

add the assert to handle error.

Coverity issue: 350592

Fixes c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")

---
v2 - add the error hander

---
 examples/vhost_blk/vhost_blk.c | 1 +
 1 file changed, 1 insertion(+)
examples/vhost_blk/vhost_blk.c +0 -0
index 3182a488b..e1036bf3a 100644

examples/vhost_blk/vhost_blk.c new_device(int vid) · line 862

Quoted 7 lines
examples/vhost_blk/vhost_blk.c +1 -0
@@ -856,6 +856,7 @@ new_device(int vid)
 				ctrlr->bdev->vid, i,
 				&blk_vq->last_avail_idx,
 				&blk_vq->last_used_idx);
+			assert(ret == 0);
 
 			blk_vq->avail_wrap_counter = blk_vq->last_avail_idx &
 				(1 << 15);

Thanks,
Maxime

#4 lore raw

Re: [dpdk-dev] [PATCH v2] vhost-blk: fix the unused return value

Quoted 26 lines · Maxime Coquelin
Quoted 23 lines · Jin Yu

add the assert to handle error.

Coverity issue: 350592

Fixes c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")

---
v2 - add the error hander

---
 examples/vhost_blk/vhost_blk.c | 1 +
 1 file changed, 1 insertion(+)
examples/vhost_blk/vhost_blk.c +1 -0
index 3182a488b..e1036bf3a 100644
@@ -856,6 +856,7 @@ new_device(int vid)
 				ctrlr->bdev->vid, i,
 				&blk_vq->last_avail_idx,
 				&blk_vq->last_used_idx);
+			assert(ret == 0);
 
Quoted 9 lines

examples/vhost_blk/vhost_blk.c new_device(int vid) · line 862

Quoted 3 lines
examples/vhost_blk/vhost_blk.c +0 -0
 			blk_vq->avail_wrap_counter = blk_vq->last_avail_idx &
 				(1 << 15);

Thanks,
Maxime

Applied to dpdk-next-virtio/master.

Thanks,
Maxime