mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 17:22:22 +02:00
env: Adjust the get_char() method to return an int
In principle this can fail, e.g. if the index is out of range. Adjust the driver signature to allow returning an error code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
2
env/dataflash.c
vendored
2
env/dataflash.c
vendored
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
static unsigned char env_dataflash_get_char(int index)
|
static int env_dataflash_get_char(int index)
|
||||||
{
|
{
|
||||||
uchar c;
|
uchar c;
|
||||||
|
|
||||||
|
2
env/eeprom.c
vendored
2
env/eeprom.c
vendored
@@ -61,7 +61,7 @@ static int eeprom_bus_write(unsigned dev_addr, unsigned offset,
|
|||||||
return rcode;
|
return rcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uchar env_eeprom_get_char(int index)
|
static int env_eeprom_get_char(int index)
|
||||||
{
|
{
|
||||||
uchar c;
|
uchar c;
|
||||||
unsigned int off = CONFIG_ENV_OFFSET;
|
unsigned int off = CONFIG_ENV_OFFSET;
|
||||||
|
2
env/nvram.c
vendored
2
env/nvram.c
vendored
@@ -41,7 +41,7 @@ env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
|
#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
|
||||||
static uchar env_nvram_get_char(int index)
|
static int env_nvram_get_char(int index)
|
||||||
{
|
{
|
||||||
uchar c;
|
uchar c;
|
||||||
|
|
||||||
|
@@ -227,9 +227,9 @@ struct env_driver {
|
|||||||
* will read from gd->env_addr.
|
* will read from gd->env_addr.
|
||||||
*
|
*
|
||||||
* @index: Index of character to read (0=first)
|
* @index: Index of character to read (0=first)
|
||||||
* @return character read
|
* @return character read, or -ve on error
|
||||||
*/
|
*/
|
||||||
unsigned char (*get_char)(int index);
|
int (*get_char)(int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load() - Load the environment from storage
|
* load() - Load the environment from storage
|
||||||
|
Reference in New Issue
Block a user