summaryrefslogtreecommitdiff
path: root/drivers/mtd/devices
diff options
context:
space:
mode:
authorvdumpa <vdumpa@nvidia.com>2010-06-14 12:08:44 -0700
committerGary King <gking@nvidia.com>2010-06-15 08:47:45 -0700
commit6ec469a60822d9dce1a190a56d19eaece8e7958b (patch)
tree5bb39b67e34de97615a91a96d419496435982dca /drivers/mtd/devices
parent0f0019e053309159030e64c483e26001f8f335fb (diff)
tegra mtd: Fixed read api to return correct length.
Fixed tegra_nand_read api to return correct number of read bytes. Change-Id: If08514052fa266b27d1a5d5d4139ae35e185f853 Reviewed-on: http://git-master/r/2593 Reviewed-by: Krishna Reddy <vdumpa@nvidia.com> Tested-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-by: Gary King <gking@nvidia.com>
Diffstat (limited to 'drivers/mtd/devices')
-rw-r--r--drivers/mtd/devices/tegra_mtd_nand.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mtd/devices/tegra_mtd_nand.c b/drivers/mtd/devices/tegra_mtd_nand.c
index 5af697695c89..846ea7cef637 100644
--- a/drivers/mtd/devices/tegra_mtd_nand.c
+++ b/drivers/mtd/devices/tegra_mtd_nand.c
@@ -293,6 +293,8 @@ static int tegra_nand_read(struct mtd_info *mtd, loff_t from, size_t len,
memset(page_list, 0xff, sizeof(page_list));
mutex_lock(&info->lock);
+ if (retlen)
+ *retlen = 0;
NvDdkNandResumeClocks(info->ddk);
while (len) {
@@ -329,11 +331,11 @@ static int tegra_nand_read(struct mtd_info *mtd, loff_t from, size_t len,
from += count;
len -= count;
buf += count;
- *retlen += count;
+ if (retlen)
+ *retlen += count;
}
NvDdkNandSuspendClocks(info->ddk);
- *retlen = len;
mutex_unlock(&info->lock);
return (len) ? -EIO : 0;
}