UBI: use vol->usable_leb_size instead of (ubi->leb_size - vol->data_pad)
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Fri, 16 Sep 2016 14:59:13 +0000 (16:59 +0200)
committerRichard Weinberger <richard@nod.at>
Sun, 2 Oct 2016 20:48:14 +0000 (22:48 +0200)
vol->usable_size is already set to ubi->leb_size - vol->data_pad. Use
vol->usable_size instead of recalculating it.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/cdev.c

index ee2b74d1d1b5e388a7d60880e5ef0e1f07676e70..3490dcd99ad1fa575eba545bb87617b73d46de8b 100644 (file)
@@ -416,7 +416,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
                }
 
                rsvd_bytes = (long long)vol->reserved_pebs *
-                                       ubi->leb_size-vol->data_pad;
+                                       vol->usable_leb_size;
                if (bytes < 0 || bytes > rsvd_bytes) {
                        err = -EINVAL;
                        break;