summaryrefslogtreecommitdiffstats
path: root/common/state/backend_bucket_circular.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/state/backend_bucket_circular.c')
-rw-r--r--common/state/backend_bucket_circular.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c
index da7c8421ae..4676730d05 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -162,11 +162,10 @@ static int state_mtd_peb_read(struct state_backend_storage_bucket_circular *circ
offset += (off_t)circ->eraseblock * circ->mtd->erasesize;
- ret = lseek(circ->fd, offset, SEEK_SET);
- if (ret < 0) {
+ if (lseek(circ->fd, offset, SEEK_SET) != offset) {
dev_err(circ->dev, "Failed to set circular read position to %lld, %d\n",
- (long long) offset, ret);
- return ret;
+ (long long) offset, -errno);
+ return -errno;
}
dev_dbg(circ->dev, "Read state from %lld length %d\n", (long long) offset,
@@ -191,11 +190,10 @@ static int state_mtd_peb_write(struct state_backend_storage_bucket_circular *cir
offset += circ->eraseblock * circ->mtd->erasesize;
- ret = lseek(circ->fd, offset, SEEK_SET);
- if (ret < 0) {
+ if (lseek(circ->fd, offset, SEEK_SET) != offset) {
dev_err(circ->dev, "Failed to set position for circular write %lld, %d\n",
- (long long) offset, ret);
- return ret;
+ (long long) offset, -errno);
+ return -errno;
}
ret = write_full(circ->fd, buf, len);