UBI: Init vol->reserved_pebs by assignment
authorshengyong <shengyong1@huawei.com>
Tue, 26 May 2015 10:07:08 +0000 (10:07 +0000)
committerRichard Weinberger <richard@nod.at>
Tue, 2 Jun 2015 09:44:43 +0000 (11:44 +0200)
`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>
drivers/mtd/ubi/vmt.c

index ff4d97848d1c48cf85431aa7e01542abff307b5a..da2264b4facae4c9a9dda803517d0200ad4ef534 100644 (file)
@@ -253,8 +253,8 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
 
        /* Calculate how many eraseblocks are requested */
        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 */
        if (vol->reserved_pebs > ubi->avail_pebs) {