All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] virtio/virtio.c: include virtio prefix in error message
@ 2022-04-14 11:29 Moteen Shah
  2022-04-15 11:10 ` Alex Bennée
  0 siblings, 1 reply; 2+ messages in thread
From: Moteen Shah @ 2022-04-14 11:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: Moteen Shah

From: Moteen Shah <moteenshah.02@gmail.com>

The error message in virtio_init_region_cache()
is given a prefix virtio.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/230
Buglink: https://bugs.launchpad.net/qemu/+bug/1919021``

Signed-off-by: Moteen Shah <moteenshah.02@gmail.com>
---
 hw/virtio/virtio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 9d637e043e..f31427bd41 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -174,7 +174,7 @@ static void virtio_init_region_cache(VirtIODevice *vdev, int n)
     len = address_space_cache_init(&new->desc, vdev->dma_as,
                                    addr, size, packed);
     if (len < size) {
-        virtio_error(vdev, "Cannot map desc");
+        virtio_error(vdev, "Virtio cannot map desc");
         goto err_desc;
     }
 
@@ -182,7 +182,7 @@ static void virtio_init_region_cache(VirtIODevice *vdev, int n)
     len = address_space_cache_init(&new->used, vdev->dma_as,
                                    vq->vring.used, size, true);
     if (len < size) {
-        virtio_error(vdev, "Cannot map used");
+        virtio_error(vdev, "Virtio cannot map used");
         goto err_used;
     }
 
@@ -190,7 +190,7 @@ static void virtio_init_region_cache(VirtIODevice *vdev, int n)
     len = address_space_cache_init(&new->avail, vdev->dma_as,
                                    vq->vring.avail, size, false);
     if (len < size) {
-        virtio_error(vdev, "Cannot map avail");
+        virtio_error(vdev, "Virtio cannot map avail");
         goto err_avail;
     }
 
-- 
2.35.1



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

* Re: [PATCH v1] virtio/virtio.c: include virtio prefix in error message
  2022-04-14 11:29 [PATCH v1] virtio/virtio.c: include virtio prefix in error message Moteen Shah
@ 2022-04-15 11:10 ` Alex Bennée
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Bennée @ 2022-04-15 11:10 UTC (permalink / raw)
  To: Moteen Shah; +Cc: qemu-devel


Moteen Shah <moteenshah.02@gmail.com> writes:

> From: Moteen Shah <moteenshah.02@gmail.com>
>
> The error message in virtio_init_region_cache()
> is given a prefix virtio.

It seems a shame considering we have a common virtio_error function that
we couldn't do it in one place. One option would be to make virtio_error
a macro that could insert __func__ in place:

  #define virtio_error(vdev, fmt, ...)                            \
      virtio_error_impl(vdev, "%s: " fmt, __func__, ## __VA_ARGS__);

  void virtio_error_impl(VirtIODevice *vdev, const char *fmt, ...) G_GNUC_PRINTF(2, 3);

and make rename the function in virtio.c. As the functions calling this
all tend to have virtio in their names anyway. What do you think?

>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/230
> Buglink: https://bugs.launchpad.net/qemu/+bug/1919021``
>
> Signed-off-by: Moteen Shah <moteenshah.02@gmail.com>
> ---
>  hw/virtio/virtio.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index 9d637e043e..f31427bd41 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -174,7 +174,7 @@ static void virtio_init_region_cache(VirtIODevice *vdev, int n)
>      len = address_space_cache_init(&new->desc, vdev->dma_as,
>                                     addr, size, packed);
>      if (len < size) {
> -        virtio_error(vdev, "Cannot map desc");
> +        virtio_error(vdev, "Virtio cannot map desc");
>          goto err_desc;
>      }
>  
> @@ -182,7 +182,7 @@ static void virtio_init_region_cache(VirtIODevice *vdev, int n)
>      len = address_space_cache_init(&new->used, vdev->dma_as,
>                                     vq->vring.used, size, true);
>      if (len < size) {
> -        virtio_error(vdev, "Cannot map used");
> +        virtio_error(vdev, "Virtio cannot map used");
>          goto err_used;
>      }
>  
> @@ -190,7 +190,7 @@ static void virtio_init_region_cache(VirtIODevice *vdev, int n)
>      len = address_space_cache_init(&new->avail, vdev->dma_as,
>                                     vq->vring.avail, size, false);
>      if (len < size) {
> -        virtio_error(vdev, "Cannot map avail");
> +        virtio_error(vdev, "Virtio cannot map avail");
>          goto err_avail;
>      }


-- 
Alex Bennée


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

end of thread, other threads:[~2022-04-15 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14 11:29 [PATCH v1] virtio/virtio.c: include virtio prefix in error message Moteen Shah
2022-04-15 11:10 ` Alex Bennée

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.