diff mbox

[3/3] external/opal-prd: Correct partition offset

Message ID 1425450374-6855-3-git-send-email-joel@jms.id.au
State Superseded
Headers show

Commit Message

Joel Stanley March 4, 2015, 6:26 a.m. UTC
The start of the partition was not used when sending the size to the
mtd_{read,write} calls. This meant they were unconditionally reading and
writing to the start of the flash, instead of the partition.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 external/opal-prd/pnor.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/external/opal-prd/pnor.c b/external/opal-prd/pnor.c
index e40d292..3ae7fcd 100644
--- a/external/opal-prd/pnor.c
+++ b/external/opal-prd/pnor.c
@@ -294,18 +294,12 @@  int pnor_operation(struct pnor *pnor, const char *name, uint64_t offset,
 		return fd;
 	}
 
-	rc = lseek(fd, pstart, SEEK_SET);
-	if (rc < 0) {
-		perror(pnor->path);
-		goto out;
-	}
-
 	switch (op) {
 	case PNOR_OP_READ:
-		rc = mtd_read(pnor, fd, data, offset, size);
+		rc = mtd_read(pnor, fd, data, pstart + offset, size);
 		break;
 	case PNOR_OP_WRITE:
-		rc = mtd_write(pnor, fd, data, offset, size);
+		rc = mtd_write(pnor, fd, data, pstart + offset, size);
 		break;
 	default:
 		rc  = -EIO;