Skip to content

Commit

Permalink
fakelb: use list_for_each_entry_safe
Browse files Browse the repository at this point in the history
Iterate and removing items from a list, we should use
list_for_each_entry_safe instead list_for_each_entry to avoid accidents
by removing.

Signed-off-by: Alexander Aring <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
alexaring authored and holtmann committed May 19, 2015
1 parent 7e57905 commit 3186d3d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ieee802154/fakelb.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static void fakelb_del(struct fakelb_dev_priv *priv)
static int fakelb_probe(struct platform_device *pdev)
{
struct fakelb_priv *priv;
struct fakelb_dev_priv *dp;
struct fakelb_dev_priv *dp, *tmp;
int err = -ENOMEM;
int i;

Expand All @@ -238,7 +238,7 @@ static int fakelb_probe(struct platform_device *pdev)
return 0;

err_slave:
list_for_each_entry(dp, &priv->list, list)
list_for_each_entry_safe(dp, tmp, &priv->list, list)
fakelb_del(dp);
err_alloc:
return err;
Expand Down

0 comments on commit 3186d3d

Please sign in to comment.