mlxsw: spectrum_router: Remove deadcode in mlxsw_sp_rif_mac_profile_find
authorDanielle Ratson <danieller@nvidia.com>
Tue, 23 Nov 2021 07:54:46 +0000 (09:54 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Nov 2021 11:44:31 +0000 (11:44 +0000)
The function idr_for_each_entry() already checks that the next entry in
the IDR is not NULL.

Therefore, checking that again in every iteration leads to deadcode.

Remove the unnecessary check in order to avoid that.

Addresses-Coverity: ("Logically dead code")
Signed-off-by: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

index 217e3b351dfe6048f90e9f93930a23fde8b2e09f..98df6e8fa45fd571cf7a16b8906577c2eb0ad5dc 100644 (file)
@@ -8369,9 +8369,6 @@ mlxsw_sp_rif_mac_profile_find(const struct mlxsw_sp *mlxsw_sp, const char *mac)
        int id;
 
        idr_for_each_entry(&router->rif_mac_profiles_idr, profile, id) {
-               if (!profile)
-                       continue;
-
                if (ether_addr_equal_masked(profile->mac_prefix, mac,
                                            mlxsw_sp->mac_mask))
                        return profile;