2020-05-27 09:17:23

by Colin King

[permalink] [raw]
Subject: [PATCH] mlxsw: spectrum_router: remove redundant initialization of pointer br_dev

From: Colin Ian King <[email protected]>

The pointer br_dev is being initialized with a value that is never read
and is being updated with a new value later on. The initialization
is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <[email protected]>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index 71aee4914619..8f485f9a07a7 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -7572,11 +7572,12 @@ static struct mlxsw_sp_fid *
mlxsw_sp_rif_vlan_fid_get(struct mlxsw_sp_rif *rif,
struct netlink_ext_ack *extack)
{
- struct net_device *br_dev = rif->dev;
+ struct net_device *br_dev;
u16 vid;
int err;

if (is_vlan_dev(rif->dev)) {
+
vid = vlan_dev_vlan_id(rif->dev);
br_dev = vlan_dev_real_dev(rif->dev);
if (WARN_ON(!netif_is_bridge_master(br_dev)))
--
2.25.1


2020-05-27 09:18:41

by Ido Schimmel

[permalink] [raw]
Subject: Re: [PATCH] mlxsw: spectrum_router: remove redundant initialization of pointer br_dev

On Tue, May 26, 2020 at 11:56:49PM +0100, Colin King wrote:
> From: Colin Ian King <[email protected]>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> index 71aee4914619..8f485f9a07a7 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> @@ -7572,11 +7572,12 @@ static struct mlxsw_sp_fid *
> mlxsw_sp_rif_vlan_fid_get(struct mlxsw_sp_rif *rif,
> struct netlink_ext_ack *extack)
> {
> - struct net_device *br_dev = rif->dev;
> + struct net_device *br_dev;
> u16 vid;
> int err;
>
> if (is_vlan_dev(rif->dev)) {
> +

Colin, please drop the extra blank line and mention in subject prefix
that the patch is for net-next. Thanks!

> vid = vlan_dev_vlan_id(rif->dev);
> br_dev = vlan_dev_real_dev(rif->dev);
> if (WARN_ON(!netif_is_bridge_master(br_dev)))
> --
> 2.25.1
>