Skip to content

Commit

Permalink
net: mscc: ocelot: use list_for_each_entry in ocelot_vcap_block_remov…
Browse files Browse the repository at this point in the history
…e_filter

Simplify ocelot_vcap_block_remove_filter by using list_for_each_entry
instead of list_for_each.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vladimir Oltean authored and David S. Miller committed Mar 4, 2022
1 parent f9f52c3 commit c5a0eda
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/net/ethernet/mscc/ocelot_vcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1195,18 +1195,16 @@ static void ocelot_vcap_block_remove_filter(struct ocelot *ocelot,
struct ocelot_vcap_block *block,
struct ocelot_vcap_filter *filter)
{
struct ocelot_vcap_filter *tmp;
struct list_head *pos, *q;
struct ocelot_vcap_filter *tmp, *n;

list_for_each_safe(pos, q, &block->rules) {
tmp = list_entry(pos, struct ocelot_vcap_filter, list);
list_for_each_entry_safe(tmp, n, &block->rules, list) {
if (ocelot_vcap_filter_equal(filter, tmp)) {
if (tmp->block_id == VCAP_IS2 &&
tmp->action.police_ena)
ocelot_vcap_policer_del(ocelot,
tmp->action.pol_ix);

list_del(pos);
list_del(&tmp->list);
kfree(tmp);
}
}
Expand Down

0 comments on commit c5a0eda

Please sign in to comment.