return 1;
}
}
- file_cbfs_init(end_of_rom);
- if (cbfs_get_result() != CBFS_SUCCESS) {
+ if (file_cbfs_init(end_of_rom)) {
printf("%s.\n", file_cbfs_error());
return 1;
}
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)
/**
* file_cbfs_init() - Initialize the CBFS driver and load metadata into RAM.
*
- * @end_of_rom: Points to the end of the ROM the CBFS should be read
- * from.
+ * @end_of_rom: Points to the end of the ROM the CBFS should be read from
+ * @return 0 if OK, -ve on error
*/
-void file_cbfs_init(ulong end_of_rom);
+int file_cbfs_init(ulong end_of_rom);
/**
* file_cbfs_get_header() - Get the header structure for the current CBFS.