[PATCH] mtd: nand-bb: use list_for_each_entry_safe

Alexander Aring alex.aring at gmail.com
Tue Apr 29 06:19:07 PDT 2014


Hi,

thanks Sascha.

On Tue, Apr 29, 2014 at 08:06:46AM +0200, Sascha Hauer wrote:
> We need list_for_each_entry_safe in dev_remove_bb_dev since the
> list entries are removed during iteration over the list.
> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> Reported-by: Alexander Aring <alex.aring at gmail.com>
> ---
>  drivers/mtd/nand/nand-bb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand-bb.c b/drivers/mtd/nand/nand-bb.c
> index f387ef6..89d5945 100644
> --- a/drivers/mtd/nand/nand-bb.c
> +++ b/drivers/mtd/nand/nand-bb.c
> @@ -308,9 +308,9 @@ out1:
>  
>  int dev_remove_bb_dev(const char *name)
>  {
> -	struct nand_bb *bb;
> +	struct nand_bb *bb, *tmp;
>  
> -	list_for_each_entry(bb, &bb_list, list) {
> +	list_for_each_entry_safe(bb, tmp, &bb_list, list) {
>  		if (!strcmp(bb->cdev.name, name)) {
>  			devfs_remove(&bb->cdev);
>  			cdev_close(bb->cdev_parent);

Fixes f4af6690e41e1f1b995b5b3b56016c8a8fcd3246
("nand-bb: Fix remove of nand-bb device.")

- Alex



More information about the barebox mailing list