aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/ubi/block.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index 52cefae01887..043919ad35e4 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -378,7 +378,7 @@ int ubiblock_create(struct ubi_volume_info *vi)
378{ 378{
379 struct ubiblock *dev; 379 struct ubiblock *dev;
380 struct gendisk *gd; 380 struct gendisk *gd;
381 int disk_capacity; 381 int disk_capacity = (vi->size * vi->usable_leb_size) >> 9;
382 int ret; 382 int ret;
383 383
384 /* Check that the volume isn't already handled */ 384 /* Check that the volume isn't already handled */
@@ -412,7 +412,6 @@ int ubiblock_create(struct ubi_volume_info *vi)
412 gd->first_minor = dev->ubi_num * UBI_MAX_VOLUMES + dev->vol_id; 412 gd->first_minor = dev->ubi_num * UBI_MAX_VOLUMES + dev->vol_id;
413 gd->private_data = dev; 413 gd->private_data = dev;
414 sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id); 414 sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id);
415 disk_capacity = (vi->size * vi->usable_leb_size) >> 9;
416 set_capacity(gd, disk_capacity); 415 set_capacity(gd, disk_capacity);
417 dev->gd = gd; 416 dev->gd = gd;
418 417
@@ -501,7 +500,7 @@ int ubiblock_remove(struct ubi_volume_info *vi)
501static int ubiblock_resize(struct ubi_volume_info *vi) 500static int ubiblock_resize(struct ubi_volume_info *vi)
502{ 501{
503 struct ubiblock *dev; 502 struct ubiblock *dev;
504 int disk_capacity; 503 int disk_capacity = (vi->size * vi->usable_leb_size) >> 9;
505 504
506 /* 505 /*
507 * Need to lock the device list until we stop using the device, 506 * Need to lock the device list until we stop using the device,
@@ -516,7 +515,6 @@ static int ubiblock_resize(struct ubi_volume_info *vi)
516 } 515 }
517 516
518 mutex_lock(&dev->dev_mutex); 517 mutex_lock(&dev->dev_mutex);
519 disk_capacity = (vi->size * vi->usable_leb_size) >> 9;
520 set_capacity(dev->gd, disk_capacity); 518 set_capacity(dev->gd, disk_capacity);
521 ubi_msg("%s resized to %d LEBs", dev->gd->disk_name, vi->size); 519 ubi_msg("%s resized to %d LEBs", dev->gd->disk_name, vi->size);
522 mutex_unlock(&dev->dev_mutex); 520 mutex_unlock(&dev->dev_mutex);