aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r--drivers/mtd/ubi/cdev.c10
-rw-r--r--drivers/mtd/ubi/kapi.c10
2 files changed, 9 insertions, 11 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index a60a3a24c2a1..a7aa123afaf6 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -184,13 +184,13 @@ static ssize_t vol_cdev_read(struct file *file, __user char *buf, size_t count,
184 struct ubi_volume_desc *desc = file->private_data; 184 struct ubi_volume_desc *desc = file->private_data;
185 struct ubi_volume *vol = desc->vol; 185 struct ubi_volume *vol = desc->vol;
186 struct ubi_device *ubi = vol->ubi; 186 struct ubi_device *ubi = vol->ubi;
187 int err, lnum, off, len, vol_id = desc->vol->vol_id, tbuf_size; 187 int err, lnum, off, len, tbuf_size;
188 size_t count_save = count; 188 size_t count_save = count;
189 void *tbuf; 189 void *tbuf;
190 uint64_t tmp; 190 uint64_t tmp;
191 191
192 dbg_msg("read %zd bytes from offset %lld of volume %d", 192 dbg_msg("read %zd bytes from offset %lld of volume %d",
193 count, *offp, vol_id); 193 count, *offp, vol->vol_id);
194 194
195 if (vol->updating) { 195 if (vol->updating) {
196 dbg_err("updating"); 196 dbg_err("updating");
@@ -204,7 +204,7 @@ static ssize_t vol_cdev_read(struct file *file, __user char *buf, size_t count,
204 return 0; 204 return 0;
205 205
206 if (vol->corrupted) 206 if (vol->corrupted)
207 dbg_msg("read from corrupted volume %d", vol_id); 207 dbg_msg("read from corrupted volume %d", vol->vol_id);
208 208
209 if (*offp + count > vol->used_bytes) 209 if (*offp + count > vol->used_bytes)
210 count_save = count = vol->used_bytes - *offp; 210 count_save = count = vol->used_bytes - *offp;
@@ -268,13 +268,13 @@ static ssize_t vol_cdev_direct_write(struct file *file, const char __user *buf,
268 struct ubi_volume_desc *desc = file->private_data; 268 struct ubi_volume_desc *desc = file->private_data;
269 struct ubi_volume *vol = desc->vol; 269 struct ubi_volume *vol = desc->vol;
270 struct ubi_device *ubi = vol->ubi; 270 struct ubi_device *ubi = vol->ubi;
271 int lnum, off, len, tbuf_size, vol_id = vol->vol_id, err = 0; 271 int lnum, off, len, tbuf_size, err = 0;
272 size_t count_save = count; 272 size_t count_save = count;
273 char *tbuf; 273 char *tbuf;
274 uint64_t tmp; 274 uint64_t tmp;
275 275
276 dbg_msg("requested: write %zd bytes to offset %lld of volume %u", 276 dbg_msg("requested: write %zd bytes to offset %lld of volume %u",
277 count, *offp, desc->vol->vol_id); 277 count, *offp, vol->vol_id);
278 278
279 if (vol->vol_type == UBI_STATIC_VOLUME) 279 if (vol->vol_type == UBI_STATIC_VOLUME)
280 return -EROFS; 280 return -EROFS;
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c
index 146957c3380d..a70d58823f8d 100644
--- a/drivers/mtd/ubi/kapi.c
+++ b/drivers/mtd/ubi/kapi.c
@@ -480,9 +480,9 @@ int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum)
480{ 480{
481 struct ubi_volume *vol = desc->vol; 481 struct ubi_volume *vol = desc->vol;
482 struct ubi_device *ubi = vol->ubi; 482 struct ubi_device *ubi = vol->ubi;
483 int err, vol_id = vol->vol_id; 483 int err;
484 484
485 dbg_msg("erase LEB %d:%d", vol_id, lnum); 485 dbg_msg("erase LEB %d:%d", vol->vol_id, lnum);
486 486
487 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) 487 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
488 return -EROFS; 488 return -EROFS;
@@ -541,9 +541,8 @@ int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum)
541{ 541{
542 struct ubi_volume *vol = desc->vol; 542 struct ubi_volume *vol = desc->vol;
543 struct ubi_device *ubi = vol->ubi; 543 struct ubi_device *ubi = vol->ubi;
544 int vol_id = vol->vol_id;
545 544
546 dbg_msg("unmap LEB %d:%d", vol_id, lnum); 545 dbg_msg("unmap LEB %d:%d", vol->vol_id, lnum);
547 546
548 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) 547 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
549 return -EROFS; 548 return -EROFS;
@@ -579,9 +578,8 @@ int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype)
579{ 578{
580 struct ubi_volume *vol = desc->vol; 579 struct ubi_volume *vol = desc->vol;
581 struct ubi_device *ubi = vol->ubi; 580 struct ubi_device *ubi = vol->ubi;
582 int vol_id = vol->vol_id;
583 581
584 dbg_msg("unmap LEB %d:%d", vol_id, lnum); 582 dbg_msg("unmap LEB %d:%d", vol->vol_id, lnum);
585 583
586 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) 584 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
587 return -EROFS; 585 return -EROFS;