Skip to content

Commit

Permalink
eth: mlx5: avoid iterator use outside of a loop
Browse files Browse the repository at this point in the history
Fix the following warning about risky iterator use:

drivers/net/ethernet/mellanox/mlx5/core/eq.c:1010 mlx5_comp_irq_get_affinity_mask() warn: iterator used outside loop: 'eq'

Acked-by: Saeed Mahameed <saeed@kernel.org>
Link: https://lore.kernel.org/r/20230420015802.815362-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Apr 21, 2023
1 parent 8c966a1 commit 6171820
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/ethernet/mellanox/mlx5/core/eq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1070,10 +1070,11 @@ mlx5_comp_irq_get_affinity_mask(struct mlx5_core_dev *dev, int vector)

list_for_each_entry(eq, &table->comp_eqs_list, list) {
if (i++ == vector)
break;
return mlx5_irq_get_affinity_mask(eq->core.irq);
}

return mlx5_irq_get_affinity_mask(eq->core.irq);
WARN_ON_ONCE(1);
return NULL;
}
EXPORT_SYMBOL(mlx5_comp_irq_get_affinity_mask);

Expand Down

0 comments on commit 6171820

Please sign in to comment.