Skip to content

Commit e8d266c

Browse files
shengyongrichardweinberger
authored andcommitted
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>
1 parent f6e951a commit e8d266c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/mtd/ubi/vmt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
253253

254254
/* Calculate how many eraseblocks are requested */
255255
vol->usable_leb_size = ubi->leb_size - ubi->leb_size % req->alignment;
256-
vol->reserved_pebs += div_u64(req->bytes + vol->usable_leb_size - 1,
257-
vol->usable_leb_size);
256+
vol->reserved_pebs = div_u64(req->bytes + vol->usable_leb_size - 1,
257+
vol->usable_leb_size);
258258

259259
/* Reserve physical eraseblocks */
260260
if (vol->reserved_pebs > ubi->avail_pebs) {

0 commit comments

Comments
 (0)