aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-11-27 07:30:08 +0900
committerLinus Torvalds <torvalds@linux-foundation.org>2010-11-27 07:30:08 +0900
commit1eb4c6362cb7d6a2f904c555c10dc45caeeefc31 (patch)
treec54002f0106014b25921bbf70b986d695de0a1fa /drivers
parent03187552762cba3db20d22bc7b0fe2d3642bc15b (diff)
parent1b1d76e2df2a0aa965d6a227db7061d3fff029b1 (diff)
downloadmrst-s0i3-test-1eb4c6362cb7d6a2f904c555c10dc45caeeefc31.tar.gz
mrst-s0i3-test-1eb4c6362cb7d6a2f904c555c10dc45caeeefc31.tar.xz
mrst-s0i3-test-1eb4c6362cb7d6a2f904c555c10dc45caeeefc31.zip
Merge branch 'linux-next' of git://git.infradead.org/ubi-2.6
* 'linux-next' of git://git.infradead.org/ubi-2.6: UBI: release locks in check_corruption
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/ubi/scan.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index 3c631863bf4..204345be8e6 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -787,16 +787,15 @@ static int check_corruption(struct ubi_device *ubi, struct ubi_vid_hdr *vid_hdr,
* erased, so it became unstable and corrupted, and should be
* erased.
*/
- return 0;
+ err = 0;
+ goto out_unlock;
}
if (err)
- return err;
+ goto out_unlock;
- if (ubi_check_pattern(ubi->peb_buf1, 0xFF, ubi->leb_size)) {
- mutex_unlock(&ubi->buf_mutex);
- return 0;
- }
+ if (ubi_check_pattern(ubi->peb_buf1, 0xFF, ubi->leb_size))
+ goto out_unlock;
ubi_err("PEB %d contains corrupted VID header, and the data does not "
"contain all 0xFF, this may be a non-UBI PEB or a severe VID "
@@ -806,8 +805,11 @@ static int check_corruption(struct ubi_device *ubi, struct ubi_vid_hdr *vid_hdr,
pnum, ubi->leb_start, ubi->leb_size);
ubi_dbg_print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1,
ubi->peb_buf1, ubi->leb_size, 1);
+ err = 1;
+
+out_unlock:
mutex_unlock(&ubi->buf_mutex);
- return 1;
+ return err;
}
/**