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 <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
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;
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;