Skip to contentSkip to conversation

virtio: Fix return value for dummy function vhost_net_virtqueue_pending

PATCH Applied Stefan Weil 2 participants 2 messages Dec 22, 2013 – Dec 25, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio: Fix return value for dummy function vhost_net_virtqueue_pending

cgcc complains that -ENOSYS is not a good value for 'bool'.

A dummy virtio will never have pending queue entries, so let us return false.

---

Could we also use g_assert_not_reached or hw_error in those dummy functions?

Regards
Stefan

 hw/net/vhost_net.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/vhost_net.c +1 -1
index 006576d..854997d 100644
@@ -321,7 +321,7 @@ void vhost_net_ack_features(struct vhost_net *net, unsigned features)
 
 bool vhost_net_virtqueue_pending(VHostNetState *net, int idx)
 {
-    return -ENOSYS;
+    return false;
 }
 
 void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 6 lines · Stefan Weil

cgcc complains that -ENOSYS is not a good value for 'bool'.

A dummy virtio will never have pending queue entries, so let us return false.

Applied, thanks.

Quoted 6 lines

---

Could we also use g_assert_not_reached or hw_error in those dummy functions?

Regards
Stefan

I'd go for g_assert_not_reached normally - it's an internal bug if this is called since init stub fails.
Or leave it as is - it's an unusual configuration.

Quoted 18 lines
 hw/net/vhost_net.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/vhost_net.c +1 -1
index 006576d..854997d 100644
@@ -321,7 +321,7 @@ void vhost_net_ack_features(struct vhost_net *net, unsigned features)
 
 bool vhost_net_virtqueue_pending(VHostNetState *net, int idx)
 {
-    return -ENOSYS;
+    return false;
 }
 
 void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
Signature · 1 line
1.7.10.4