summaryrefslogtreecommitdiff
path: root/fs/cbfs/cbfs.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-05-24 17:38:21 -0600
committerBin Meng <bmeng.cn@gmail.com>2020-05-27 14:40:09 +0800
commit0e7b6312e7c6780381612fe09a73c77f77e63c2d (patch)
tree86bf311dd1e2de0b65cfce44d9e2968375b29690 /fs/cbfs/cbfs.c
parentc685f8bcfcf097b1f46ea742a65765b7696a9a48 (diff)
downloadu-boot-0e7b6312e7c6780381612fe09a73c77f77e63c2d.tar.gz
u-boot-0e7b6312e7c6780381612fe09a73c77f77e63c2d.tar.bz2
u-boot-0e7b6312e7c6780381612fe09a73c77f77e63c2d.zip
cbfs: Return the error code from file_cbfs_init()
We may as well return the error code and use it directly in the command code. CBFS still uses its own error enum which we may be able to remove, but leave it for now. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'fs/cbfs/cbfs.c')
-rw-r--r--fs/cbfs/cbfs.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index dc9789fcb8..73fe3b3624 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -253,19 +253,26 @@ static int cbfs_load_header_ptr(struct cbfs_priv *priv, ulong base)
return 0;
}
-static void cbfs_init(struct cbfs_priv *priv, ulong end_of_rom)
+static int cbfs_init(struct cbfs_priv *priv, ulong end_of_rom)
{
- if (file_cbfs_load_header(priv, end_of_rom))
- return;
+ int ret;
- file_cbfs_fill_cache(priv, priv->header.rom_size, priv->header.align);
- if (priv->result == CBFS_SUCCESS)
- priv->initialized = true;
+ ret = file_cbfs_load_header(priv, end_of_rom);
+ if (ret)
+ return ret;
+
+ ret = file_cbfs_fill_cache(priv, priv->header.rom_size,
+ priv->header.align);
+ if (ret)
+ return ret;
+ priv->initialized = true;
+
+ return 0;
}
-void file_cbfs_init(ulong end_of_rom)
+int file_cbfs_init(ulong end_of_rom)
{
- cbfs_init(&cbfs_s, end_of_rom);
+ return cbfs_init(&cbfs_s, end_of_rom);
}
int cbfs_init_mem(ulong base, ulong size, struct cbfs_priv **privp)