Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84246
b: refs/heads/master
c: 783b273
h: refs/heads/master
v: v3
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Dec 26, 2007
1 parent 6b1d756 commit fb50db9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 897a316c9e6f7fea6f1d3759797b75c0ebaec479
refs/heads/master: 783b273afab43437dca731a229d53d72faf77fd3
1 change: 1 addition & 0 deletions trunk/drivers/mtd/ubi/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
goto out_free;

mutex_init(&ubi->buf_mutex);
mutex_init(&ubi->ckvol_mutex);
ubi->peb_buf1 = vmalloc(ubi->peb_size);
if (!ubi->peb_buf1)
goto out_free;
Expand Down
11 changes: 3 additions & 8 deletions trunk/drivers/mtd/ubi/kapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,12 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode)
desc->vol = vol;
desc->mode = mode;

/*
* To prevent simultaneous checks of the same volume we use
* @volumes_mutex, although it is not the purpose it was introduced
* for.
*/
mutex_lock(&ubi->volumes_mutex);
mutex_lock(&ubi->ckvol_mutex);
if (!vol->checked) {
/* This is the first open - check the volume */
err = ubi_check_volume(ubi, vol_id);
if (err < 0) {
mutex_unlock(&ubi->volumes_mutex);
mutex_unlock(&ubi->ckvol_mutex);
ubi_close_volume(desc);
return ERR_PTR(err);
}
Expand All @@ -190,7 +185,7 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode)
}
vol->checked = 1;
}
mutex_unlock(&ubi->volumes_mutex);
mutex_unlock(&ubi->ckvol_mutex);

return desc;

Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/mtd/ubi/ubi.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ struct ubi_device {
void *peb_buf1;
void *peb_buf2;
struct mutex buf_mutex;
struct mutex ckvol_mutex;
#ifdef CONFIG_MTD_UBI_DEBUG
void *dbg_peb_buf;
struct mutex dbg_buf_mutex;
Expand Down

0 comments on commit fb50db9

Please sign in to comment.