summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/nvmem
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/nvmem')
-rw-r--r--kernel/drivers/nvmem/mxs-ocotp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/drivers/nvmem/mxs-ocotp.c b/kernel/drivers/nvmem/mxs-ocotp.c
index 8ba19bba3..2bb3c5799 100644
--- a/kernel/drivers/nvmem/mxs-ocotp.c
+++ b/kernel/drivers/nvmem/mxs-ocotp.c
@@ -94,7 +94,7 @@ static int mxs_ocotp_read(void *context, const void *reg, size_t reg_size,
if (ret)
goto close_banks;
- while (val_size) {
+ while (val_size >= reg_size) {
if ((offset < OCOTP_DATA_OFFSET) || (offset % 16)) {
/* fill up non-data register */
*buf = 0;
@@ -103,7 +103,7 @@ static int mxs_ocotp_read(void *context, const void *reg, size_t reg_size,
}
buf++;
- val_size--;
+ val_size -= reg_size;
offset += reg_size;
}