Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 227b0631 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mtd: msm_qpic_nand: Support for partial page read - fix"

parents affbf61d 4ac704d3
Loading
Loading
Loading
Loading
+21 −8
Original line number Diff line number Diff line
@@ -1767,9 +1767,10 @@ static int msm_nand_read_partial_page(struct mtd_info *mtd,
	loff_t aligned_from;
	loff_t offset;
	size_t len;
	size_t actual_len;
	size_t actual_len, ret_len;

	actual_len = ops->len;
	ret_len = 0;
	actual_buf = ops->datbuf;

	bounce_buf = kmalloc(mtd->writesize, GFP_KERNEL);
@@ -1796,14 +1797,17 @@ static int msm_nand_read_partial_page(struct mtd_info *mtd,

		ops->datbuf = no_copy ? actual_buf : bounce_buf;
		err = msm_nand_read_oob(mtd, aligned_from, ops);
		if (err < 0)
		if (err < 0) {
			ret_len = ops->retlen;
			break;
		}

		if (!no_copy)
			memcpy(actual_buf, bounce_buf + offset, len);

		actual_len -= len;
		ops->retlen += len;
		ret_len += len;

		if (actual_len == 0)
			break;

@@ -1812,6 +1816,7 @@ static int msm_nand_read_partial_page(struct mtd_info *mtd,
		aligned_from += mtd->writesize;
	}

	ops->retlen = ret_len;
	kfree(bounce_buf);
out:
	return err;
@@ -1847,13 +1852,21 @@ static int msm_nand_read(struct mtd_info *mtd, loff_t from, size_t len,
				if (ret < 0)
					break;

				len -= mtd->writesize;
				*retlen += mtd->writesize;
				len -= ops.retlen;
				*retlen += ops.retlen;
				if (len == 0)
					break;
				buf += ops.retlen;
				from += ops.retlen;

				buf += mtd->writesize;
				from += mtd->writesize;
				if (len < mtd->writesize) {
					ops.len = len;
					ops.datbuf = buf;
					ret = msm_nand_read_partial_page(
						mtd, from, &ops);
					*retlen += ops.retlen;
					break;
				}
			}
		} else {
			ops.len = len;