aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-02-06 06:27:43 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-03-26 19:32:19 -0400
commitbcb1d238716d138c9e16347fc32b3c1ae006339e (patch)
treeccb7a9aea7b77481fa3474124218521e0c32de82 /drivers/mtd/maps
parent0dd5235f51fb0eb0b8cef3fed35be39b8a06d7bd (diff)
mtd: move zero length verification to MTD API functions
In many places in drivers we verify for the zero length, but this is very inconsistent across drivers. This is obviously the right thing to do, though. This patch moves the check to the MTD API functions instead and removes a lot of duplication. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Reviewed-by: Shmulik Ladkani <shmulik.ladkani@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r--drivers/mtd/maps/vmu-flash.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/drivers/mtd/maps/vmu-flash.c b/drivers/mtd/maps/vmu-flash.c
index 48a803e2cd2e..2e2b0945edc7 100644
--- a/drivers/mtd/maps/vmu-flash.c
+++ b/drivers/mtd/maps/vmu-flash.c
@@ -360,9 +360,6 @@ static int vmu_flash_read(struct mtd_info *mtd, loff_t from, size_t len,
360 int index = 0, retval, partition, leftover, numblocks; 360 int index = 0, retval, partition, leftover, numblocks;
361 unsigned char cx; 361 unsigned char cx;
362 362
363 if (len < 1)
364 return -EIO;
365
366 mpart = mtd->priv; 363 mpart = mtd->priv;
367 mdev = mpart->mdev; 364 mdev = mpart->mdev;
368 partition = mpart->partition; 365 partition = mpart->partition;
@@ -434,11 +431,6 @@ static int vmu_flash_write(struct mtd_info *mtd, loff_t to, size_t len,
434 partition = mpart->partition; 431 partition = mpart->partition;
435 card = maple_get_drvdata(mdev); 432 card = maple_get_drvdata(mdev);
436 433
437 /* simple sanity checks */
438 if (len < 1) {
439 error = -EIO;
440 goto failed;
441 }
442 numblocks = card->parts[partition].numblocks; 434 numblocks = card->parts[partition].numblocks;
443 if (to + len > numblocks * card->blocklen) 435 if (to + len > numblocks * card->blocklen)
444 len = numblocks * card->blocklen - to; 436 len = numblocks * card->blocklen - to;