diff options
Diffstat (limited to 'drivers/mtd/ubi/cdev.c')
-rw-r--r-- | drivers/mtd/ubi/cdev.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index 89193ba9451e..0cdaf9fba7b0 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c | |||
@@ -295,7 +295,7 @@ static ssize_t vol_cdev_direct_write(struct file *file, const char __user *buf, | |||
295 | off = do_div(tmp, vol->usable_leb_size); | 295 | off = do_div(tmp, vol->usable_leb_size); |
296 | lnum = tmp; | 296 | lnum = tmp; |
297 | 297 | ||
298 | if (off % ubi->min_io_size) { | 298 | if (off & (ubi->min_io_size - 1)) { |
299 | dbg_err("unaligned position"); | 299 | dbg_err("unaligned position"); |
300 | return -EINVAL; | 300 | return -EINVAL; |
301 | } | 301 | } |
@@ -304,7 +304,7 @@ static ssize_t vol_cdev_direct_write(struct file *file, const char __user *buf, | |||
304 | count_save = count = vol->used_bytes - *offp; | 304 | count_save = count = vol->used_bytes - *offp; |
305 | 305 | ||
306 | /* We can write only in fractions of the minimum I/O unit */ | 306 | /* We can write only in fractions of the minimum I/O unit */ |
307 | if (count % ubi->min_io_size) { | 307 | if (count & (ubi->min_io_size - 1)) { |
308 | dbg_err("unaligned write length"); | 308 | dbg_err("unaligned write length"); |
309 | return -EINVAL; | 309 | return -EINVAL; |
310 | } | 310 | } |
@@ -564,7 +564,7 @@ static int verify_mkvol_req(const struct ubi_device *ubi, | |||
564 | if (req->alignment > ubi->leb_size) | 564 | if (req->alignment > ubi->leb_size) |
565 | goto bad; | 565 | goto bad; |
566 | 566 | ||
567 | n = req->alignment % ubi->min_io_size; | 567 | n = req->alignment & (ubi->min_io_size - 1); |
568 | if (req->alignment != 1 && n) | 568 | if (req->alignment != 1 && n) |
569 | goto bad; | 569 | goto bad; |
570 | 570 | ||