From e8d266cf8d24e52eac65bdab24afd6f4cfc0ad07 Mon Sep 17 00:00:00 2001 From: shengyong Date: Tue, 26 May 2015 10:07:08 +0000 Subject: [PATCH] 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 Signed-off-by: Richard Weinberger --- drivers/mtd/ubi/vmt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c index ff4d97848d1c..da2264b4faca 100644 --- a/drivers/mtd/ubi/vmt.c +++ b/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 */ 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) { -- 2.34.1