From: Brian Pomerantz Date: Thu, 2 May 2013 00:10:44 +0000 (-0700) Subject: UBI: fastmap break out of used PEB search X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=584d4623357db8f79029db76ec2b4953418018f0;p=deliverable%2Flinux.git 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. Signed-off-by: Brian Pomerantz Acked-by: Richard Weinberger Signed-off-by: Artem Bityutskiy --- diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index 0648c6996d43..154275182b4b 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c @@ -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