qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio: Fix return value for dummy function vhost_net_virtqueue_pending
@ 2013-12-22 14:51 Stefan Weil
  2013-12-25 15:18 ` Michael S. Tsirkin
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2013-12-22 14:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Stefan Weil, Michael S. Tsirkin

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 <sw@weilnetz.de>
---

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(-)

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 006576d..854997d 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -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,
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio: Fix return value for dummy function vhost_net_virtqueue_pending
  2013-12-22 14:51 [Qemu-devel] [PATCH] virtio: Fix return value for dummy function vhost_net_virtqueue_pending Stefan Weil
@ 2013-12-25 15:18 ` Michael S. Tsirkin
  0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2013-12-25 15:18 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-trivial, qemu-devel

On Sun, Dec 22, 2013 at 03:51:22PM +0100, Stefan Weil wrote:
> 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 <sw@weilnetz.de>

Applied, thanks.

> ---
> 
> 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.

>  hw/net/vhost_net.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 006576d..854997d 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -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,
> -- 
> 1.7.10.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-25 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-22 14:51 [Qemu-devel] [PATCH] virtio: Fix return value for dummy function vhost_net_virtqueue_pending Stefan Weil
2013-12-25 15:18 ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).