[PATCH 6/6] net/vhost-user: Remove unused "err" from chr_closed_bh() (CID 1612365)

Laurent Vivier posted 6 patches 4 months ago
Maintainers: Jason Wang <jasowang@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
[PATCH 6/6] net/vhost-user: Remove unused "err" from chr_closed_bh() (CID 1612365)
Posted by Laurent Vivier 4 months ago
The "err" variable was declared but never used within the
chr_closed_bh() function. This resulted in a dead code
warning (CID 1612365) from Coverity.

Remove the unused variable and the associated error block
to resolve the issue.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 net/vhost-user.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/net/vhost-user.c b/net/vhost-user.c
index cec83e925ff0..8b96157145a7 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -298,7 +298,6 @@ static void chr_closed_bh(void *opaque)
     const char *name = opaque;
     NetClientState *ncs[MAX_QUEUE_NUM];
     NetVhostUserState *s;
-    Error *err = NULL;
     int queues, i;
 
     queues = qemu_find_net_clients_except(name, ncs,
@@ -317,9 +316,6 @@ static void chr_closed_bh(void *opaque)
     qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event,
                              NULL, opaque, NULL, true);
 
-    if (err) {
-        error_report_err(err);
-    }
     qapi_event_send_netdev_vhost_user_disconnected(name);
 }
 
-- 
2.49.0
Re: [PATCH 6/6] net/vhost-user: Remove unused "err" from chr_closed_bh() (CID 1612365)
Posted by Peter Maydell 3 months, 4 weeks ago
On Thu, 17 Jul 2025 at 18:50, Laurent Vivier <lvivier@redhat.com> wrote:
>
> The "err" variable was declared but never used within the
> chr_closed_bh() function. This resulted in a dead code
> warning (CID 1612365) from Coverity.
>
> Remove the unused variable and the associated error block
> to resolve the issue.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  net/vhost-user.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/net/vhost-user.c b/net/vhost-user.c
> index cec83e925ff0..8b96157145a7 100644
> --- a/net/vhost-user.c
> +++ b/net/vhost-user.c
> @@ -298,7 +298,6 @@ static void chr_closed_bh(void *opaque)
>      const char *name = opaque;
>      NetClientState *ncs[MAX_QUEUE_NUM];
>      NetVhostUserState *s;
> -    Error *err = NULL;
>      int queues, i;
>
>      queues = qemu_find_net_clients_except(name, ncs,
> @@ -317,9 +316,6 @@ static void chr_closed_bh(void *opaque)
>      qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event,
>                               NULL, opaque, NULL, true);
>
> -    if (err) {
> -        error_report_err(err);
> -    }
>      qapi_event_send_netdev_vhost_user_disconnected(name);
>  }
>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM