2019-05-30 19:06:18

by Colin King

[permalink] [raw]
Subject: [PATCH] xen-netback: remove redundant assignment to err

From: Colin Ian King <[email protected]>

The variable err is assigned with the value -ENOMEM that is never
read and it is re-assigned a new value later on. The assignment is
redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <[email protected]>
---
drivers/net/xen-netback/interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index 783198844dd7..240f762b3749 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -633,7 +633,7 @@ int xenvif_connect_data(struct xenvif_queue *queue,
unsigned int rx_evtchn)
{
struct task_struct *task;
- int err = -ENOMEM;
+ int err;

BUG_ON(queue->tx_irq);
BUG_ON(queue->task);
--
2.20.1


2019-05-31 07:29:41

by Wei Liu

[permalink] [raw]
Subject: Re: [PATCH] xen-netback: remove redundant assignment to err

On Thu, May 30, 2019 at 08:04:38PM +0100, Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> The variable err is assigned with the value -ENOMEM that is never
> read and it is re-assigned a new value later on. The assignment is
> redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <[email protected]>

Acked-by: Wei Liu <[email protected]>


> ---
> drivers/net/xen-netback/interface.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
> index 783198844dd7..240f762b3749 100644
> --- a/drivers/net/xen-netback/interface.c
> +++ b/drivers/net/xen-netback/interface.c
> @@ -633,7 +633,7 @@ int xenvif_connect_data(struct xenvif_queue *queue,
> unsigned int rx_evtchn)
> {
> struct task_struct *task;
> - int err = -ENOMEM;
> + int err;
>
> BUG_ON(queue->tx_irq);
> BUG_ON(queue->task);
> --
> 2.20.1
>

2019-05-31 21:38:34

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] xen-netback: remove redundant assignment to err

From: Colin King <[email protected]>
Date: Thu, 30 May 2019 20:04:38 +0100

> From: Colin Ian King <[email protected]>
>
> The variable err is assigned with the value -ENOMEM that is never
> read and it is re-assigned a new value later on. The assignment is
> redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <[email protected]>

Applied to net-next.