libertas: remove redundant assignment to variable ret
diff mbox series

Message ID 20191002101517.10836-1-colin.king@canonical.com
State Accepted
Commit 60b5b49f6a6ed3a5dd5e1b4b72b8c792387a0f8c
Delegated to: Kalle Valo
Headers show
Series
  • libertas: remove redundant assignment to variable ret
Related show

Commit Message

Colin King Oct. 2, 2019, 10:15 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The variable ret is being assigned a value that is never read and is
being re-assigned a little later on. The assignment is redundant and hence
can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wireless/marvell/libertas/mesh.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Dan Carpenter Oct. 2, 2019, 1:17 p.m. UTC | #1
Added Lubomir Rintel to the CC list.

On Wed, Oct 02, 2019 at 11:15:17AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable ret is being assigned a value that is never read and is
> being re-assigned a little later on. The assignment is redundant and hence
> can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/net/wireless/marvell/libertas/mesh.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/marvell/libertas/mesh.c b/drivers/net/wireless/marvell/libertas/mesh.c
> index 2747c957d18c..44c8a550da4c 100644
> --- a/drivers/net/wireless/marvell/libertas/mesh.c
> +++ b/drivers/net/wireless/marvell/libertas/mesh.c
> @@ -1003,7 +1003,6 @@ static int lbs_add_mesh(struct lbs_private *priv)
>  	if (priv->mesh_tlv) {
>  		sprintf(mesh_wdev->ssid, "mesh");
>  		mesh_wdev->mesh_id_up_len = 4;
> -		ret = 1;
>  	}

Removing this is fine.  "ret = 1" is a mistake.

This was copy and pasted in commit 2199c9817670 ("libertas: use
mesh_wdev->ssid instead of priv->mesh_ssid").  The return value was
never used so it's not clear what returning 1 vs 0 was supposed to mean.

lbs_init_mesh() should just be a void function.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter
Kalle Valo Oct. 4, 2019, 1:46 p.m. UTC | #2
Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable ret is being assigned a value that is never read and is
> being re-assigned a little later on. The assignment is redundant and hence
> can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied to wireless-drivers-next.git, thanks.

60b5b49f6a6e libertas: remove redundant assignment to variable ret

Patch
diff mbox series

diff --git a/drivers/net/wireless/marvell/libertas/mesh.c b/drivers/net/wireless/marvell/libertas/mesh.c
index 2747c957d18c..44c8a550da4c 100644
--- a/drivers/net/wireless/marvell/libertas/mesh.c
+++ b/drivers/net/wireless/marvell/libertas/mesh.c
@@ -1003,7 +1003,6 @@  static int lbs_add_mesh(struct lbs_private *priv)
 	if (priv->mesh_tlv) {
 		sprintf(mesh_wdev->ssid, "mesh");
 		mesh_wdev->mesh_id_up_len = 4;
-		ret = 1;
 	}
 
 	mesh_wdev->netdev = mesh_dev;