mlxsw: spectrum_router: Use helper to check for last neighbor
authorArkadi Sharshevsky <arkadis@mellanox.com>
Mon, 25 Sep 2017 08:32:24 +0000 (10:32 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 27 Sep 2017 03:04:35 +0000 (20:04 -0700)
Use list_is_last helper to check for last neighbor.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

index 0cd4b2a7d9d0e61e509649c6a4795edfa12301f1..65e59a989084d02286739017deb13434699a9331 100644 (file)
@@ -1317,7 +1317,7 @@ mlxsw_sp_rif_neigh_next(struct mlxsw_sp_rif *rif,
                                                typeof(*neigh_entry),
                                                rif_list_node);
        }
-       if (neigh_entry->rif_list_node.next == &rif->neigh_list)
+       if (list_is_last(&neigh_entry->rif_list_node, &rif->neigh_list))
                return NULL;
        return list_next_entry(neigh_entry, rif_list_node);
 }