[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 8/9] vhost-vdpa: add accurate error string when fail to open
From: |
Laurent Vivier |
Subject: |
Re: [PATCH 8/9] vhost-vdpa: add accurate error string when fail to open vhost vDPA device |
Date: |
Wed, 16 Sep 2020 18:09:43 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 |
On 31/08/2020 10:27, Jason Wang wrote:
> This patch adds more accurate error string when fail to open vhost
> vDPA device.
>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> net/vhost-vdpa.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
> index f5cc4e8326..9a6f0b63d3 100644
> --- a/net/vhost-vdpa.c
> +++ b/net/vhost-vdpa.c
> @@ -219,6 +219,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char
> *name,
I think you can also remove the "assert(name)", qemu_net_client_setup()
in qemu_new_net_client() uses a default value if NULL.
> s = DO_UPCAST(VhostVDPAState, nc, nc);
> vdpa_device_fd = qemu_open(opts->vhostdev, O_RDWR);
> if (vdpa_device_fd == -1) {
> + error_setg(errp, "Fail to open vhost-vdpa device %s",
> opts->vhostdev);
> return -errno;
you can "return -1" now: no one checks for the exact returned value, all
the other init functions from net_client_init_fun[] return -1 or 0, and
the errno is now in the error string.
> }
> s->vhost_vdpa.device_fd = vdpa_device_fd;
>
Thanks,
Laurent
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 8/9] vhost-vdpa: add accurate error string when fail to open vhost vDPA device,
Laurent Vivier <=