1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

cbfs: Change file_cbfs_find_uncached() to return an error

This function currently returns a node pointer so there is no way to know
the error code. Also it uses data in BSS which seems unnecessary since the
caller might prefer to use a local variable.

Update the function and split its body out into a separate function so we
can use it later.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass
2020-05-24 17:38:22 -06:00
committed by Bin Meng
parent 0e7b6312e7
commit 924e346a66
2 changed files with 36 additions and 29 deletions

View File

@@ -161,17 +161,18 @@ int cbfs_init_mem(ulong base, ulong size, struct cbfs_priv **privp);
/***************************************************************************/
/**
* file_cbfs_find_uncached() - Find a file with a particular name in CBFS
* without using the heap.
* file_cbfs_find_uncached() - Find a file in CBFS given the end of the ROM
*
* @end_of_rom: Points to the end of the ROM the CBFS should be read
* from.
* @name: The name to search for.
* Note that @node should be declared by the caller. This design is to avoid
* the need for allocation here.
*
* @return A handle to the file, or NULL on error.
* @end_of_rom: Points to the end of the ROM the CBFS should be read from
* @name: The name to search for
* @node: Returns the contents of the node if found (i.e. copied into *node)
* @return 0 on success, -ENOENT if not found, -EFAULT on bad header
*/
const struct cbfs_cachenode *file_cbfs_find_uncached(ulong end_of_rom,
const char *name);
int file_cbfs_find_uncached(ulong end_of_rom, const char *name,
struct cbfs_cachenode *node);
/**
* file_cbfs_name() - Get the name of a file in CBFS.