summaryrefslogtreecommitdiffstats
path: root/common/state
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-11-09 10:55:05 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-11-09 10:55:05 +0100
commita024d889a02a0c7e1e2406ae0be358906150d713 (patch)
treee4c35d2991a012d21ef1943f0aa68b660807bed9 /common/state
parenta1fc81a7fdf5088a99b073d656a68dd23f549215 (diff)
parent416024c9aefb9c484033433d9b051d422f34ce64 (diff)
downloadbarebox-a024d889a02a0c7e1e2406ae0be358906150d713.tar.gz
Merge branch 'for-next/state'
Diffstat (limited to 'common/state')
-rw-r--r--common/state/backend_bucket_circular.c13
-rw-r--r--common/state/state.c2
2 files changed, 8 insertions, 7 deletions
diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c
index 0529421..4b71d87 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -155,8 +155,6 @@ static int state_mtd_peb_read(struct state_backend_storage_bucket_circular *circ
{
int ret;
off_t offset = suboffset;
- struct mtd_ecc_stats stat1, stat2;
- bool nostats = false;
offset += (off_t)circ->eraseblock * circ->mtd->erasesize;
@@ -480,7 +478,8 @@ int state_backend_bucket_circular_create(struct device_d *dev, const char *path,
circ->fd = open(path, O_RDWR);
if (circ->fd < 0) {
pr_err("Failed to open circular bucket '%s'\n", path);
- return -errno;
+ ret = -errno;
+ goto out_free;
}
#endif
@@ -489,7 +488,7 @@ int state_backend_bucket_circular_create(struct device_d *dev, const char *path,
dev_info(dev, "Not using eraseblock %u, it is marked as bad (%d)\n",
circ->eraseblock, ret);
ret = -EIO;
- goto out_free;
+ goto out_close;
}
circ->bucket.read = state_backend_bucket_circular_read;
@@ -499,13 +498,15 @@ int state_backend_bucket_circular_create(struct device_d *dev, const char *path,
ret = state_backend_bucket_circular_init(*bucket);
if (ret)
- goto out_free;
+ goto out_close;
return 0;
-out_free:
+out_close:
#ifndef __BAREBOX__
close(circ->fd);
+out_free:
+ free(circ->mtd);
#endif
free(circ);
diff --git a/common/state/state.c b/common/state/state.c
index 1597197..54c5723 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -83,7 +83,7 @@ out:
}
/**
- * state_load - Loads a state from the backend
+ * state_do_load - Loads a state from the backend
* @param state The state that should be updated to contain the loaded data
* @return 0 on success, -errno on failure. If no state is loaded the previous
* values remain in the state.