Browse Source

UBI: Init vol->reserved_pebs by assignment

`vol' is a newly allocated value by kzalloc. Initialize it by assignment
instead of `+='.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
shengyong 10 years ago
parent
commit
e8d266cf8d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      drivers/mtd/ubi/vmt.c

+ 2 - 2
drivers/mtd/ubi/vmt.c

@@ -253,8 +253,8 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
 
 
 	/* Calculate how many eraseblocks are requested */
 	/* Calculate how many eraseblocks are requested */
 	vol->usable_leb_size = ubi->leb_size - ubi->leb_size % req->alignment;
 	vol->usable_leb_size = ubi->leb_size - ubi->leb_size % req->alignment;
-	vol->reserved_pebs += div_u64(req->bytes + vol->usable_leb_size - 1,
-				      vol->usable_leb_size);
+	vol->reserved_pebs = div_u64(req->bytes + vol->usable_leb_size - 1,
+				     vol->usable_leb_size);
 
 
 	/* Reserve physical eraseblocks */
 	/* Reserve physical eraseblocks */
 	if (vol->reserved_pebs > ubi->avail_pebs) {
 	if (vol->reserved_pebs > ubi->avail_pebs) {