virtio: Fix return value for dummy function vhost_net_virtqueue_pending
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.
Signed-off-by Stefan Weil <[email protected]>
---
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
@@ -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
Michael S. Tsirkin
AppliedQuoted 6 lines · Stefan Weil
cgcc complains that
-ENOSYSis not a good value for 'bool'.A dummy virtio will never have pending queue entries, so let us return false.
Signed-off-by Stefan Weil <[email protected]>
Applied, thanks.
Quoted 6 lines
---
Could we also use
g_assert_not_reachedorhw_errorin 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@@ -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