Skip to content

Commit

Permalink
UBI: Init vol->reserved_pebs by assignment
Browse files Browse the repository at this point in the history
`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>
  • Loading branch information
shengyong authored and Richard Weinberger committed Jun 2, 2015
1 parent f6e951a commit e8d266c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/mtd/ubi/vmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e8d266c

Please sign in to comment.