Skip to contentSkip to conversation

UBI: fastmap break out of used PEB search

PATCH Applied Brian Pomerantz 3 participants 3 messages May 2, 2013 – May 29, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 UBI: fastmap break out of used PEB search

While searching for PEB matches for each volume in the used PEB list, the search fails to stop when the PEB is found. This patch adds a break in the inner loop to stop the search when it is matched.

---
 drivers/mtd/ubi/fastmap.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/mtd/ubi/fastmap.c +3 -1
index 0648c69..1542751 100644
@@ -727,8 +727,10 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
 
 			aeb = NULL;
 			list_for_each_entry(tmp_aeb, &used, u.list) {
-				if (tmp_aeb->pnum == pnum)
+				if (tmp_aeb->pnum == pnum) {
 					aeb = tmp_aeb;
+					break;
+				}
 			}
 
 			/* This can happen if a PEB is already in an EBA known
Signature · 1 line
1.7.0.1
Acked-by Richard Weinberger on v1 1/1
#1 lore raw
Quoted 26 lines · Brian Pomerantz

While searching for PEB matches for each volume in the used PEB list, the search fails to stop when the PEB is found. This patch adds a break in the inner loop to stop the search when it is matched.

---
 drivers/mtd/ubi/fastmap.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/mtd/ubi/fastmap.c +3 -2
index 0648c69..1542751 100644
@@ -727,8 +727,10 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
 
                        aeb = NULL;
                        list_for_each_entry(tmp_aeb, &used, u.list) {
-                               if (tmp_aeb->pnum == pnum)
+                               if (tmp_aeb->pnum == pnum) {
                                        aeb = tmp_aeb;
+                                       break;
+                               }
                        }
 
                        /* This can happen if a PEB is already in an EBA known
--
Quoted 1 line

1.7.0.1

--
Thanks,
//richard

#2 lore raw
In reply to Brian Pomerantz
Quoted 5 lines · Brian Pomerantz

While searching for PEB matches for each volume in the used PEB list, the search fails to stop when the PEB is found. This patch adds a break in the inner loop to stop the search when it is matched.

Pushed to linux-ubi.git, thanks!

Signature · 2 lines
Best Regards,
Artem Bityutskiy