summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshengyong <shengyong1@huawei.com>2016-05-27 09:44:40 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-05-27 12:30:27 +0200
commit78ae01bf2bd502c468df56cae85b0fe02f70c5d0 (patch)
tree1a2ac3ea6eeb96a1bc81c00cce0aeebacccdfb5b
parentc59fb39da358c73706cab597e1a2db9b1f287113 (diff)
downloadbarebox-78ae01bf2bd502c468df56cae85b0fe02f70c5d0.tar.gz
barebox-78ae01bf2bd502c468df56cae85b0fe02f70c5d0.tar.xz
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> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/mtd/ubi/vmt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index fbe88768ff..41b814cf90 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -89,8 +89,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) {