summaryrefslogtreecommitdiffstats
path: root/common/state/backend_storage.c
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2016-07-22 15:00:19 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-07-25 10:21:16 +0200
commitf3895311ef49171b58b5ea1f06942408c8685a1e (patch)
treee4f31ea1821c238d986e5293819bd11f0de0270b /common/state/backend_storage.c
parent2ccd60013dc2dabdb91cd2964cd9ce15eb949b1b (diff)
downloadbarebox-f3895311ef49171b58b5ea1f06942408c8685a1e.tar.gz
barebox-f3895311ef49171b58b5ea1f06942408c8685a1e.tar.xz
state: only build circular backend if MTD is enabled
The circular backend depends on MTD symbols and is only useful if MTD is present. Exclude it from the build if MTD is not enabled. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/state/backend_storage.c')
-rw-r--r--common/state/backend_storage.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c
index c4508a8aba..5dc8c50267 100644
--- a/common/state/backend_storage.c
+++ b/common/state/backend_storage.c
@@ -471,7 +471,7 @@ int state_storage_init(struct state_backend_storage *storage,
off_t offset, size_t max_size, uint32_t stridesize,
const char *storagetype)
{
- int ret;
+ int ret = -ENODEV;
struct mtd_info_user meminfo;
INIT_LIST_HEAD(&storage->buckets);
@@ -479,7 +479,9 @@ int state_storage_init(struct state_backend_storage *storage,
storage->name = storagetype;
storage->stridesize = stridesize;
- ret = mtd_get_meminfo(path, &meminfo);
+ if (IS_ENABLED(CONFIG_MTD))
+ ret = mtd_get_meminfo(path, &meminfo);
+
if (!ret && !(meminfo.flags & MTD_NO_ERASE)) {
bool non_circular = false;
if (!storagetype) {