]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
env: Adjust the get_char() method to return an int
authorSimon Glass <sjg@chromium.org>
Thu, 3 Aug 2017 18:22:16 +0000 (12:22 -0600)
committerTom Rini <trini@konsulko.com>
Wed, 16 Aug 2017 12:31:24 +0000 (08:31 -0400)
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>
env/dataflash.c
env/eeprom.c
env/nvram.c
include/environment.h

index 28dcf6fa1cda7aaee4284d7598bced32dccd7475..afa08f8fd50914b875f53b9cc1138edf7c23e125 100644 (file)
@@ -14,7 +14,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static unsigned char env_dataflash_get_char(int index)
+static int env_dataflash_get_char(int index)
 {
        uchar c;
 
index 39adccabbee106e4eeb5ba30c2e169bd3f4063e2..fbe4fd4efc5d7ea2d7090a384745b375282d3a5d 100644 (file)
@@ -61,7 +61,7 @@ static int eeprom_bus_write(unsigned dev_addr, unsigned offset,
        return rcode;
 }
 
-static uchar env_eeprom_get_char(int index)
+static int env_eeprom_get_char(int index)
 {
        uchar c;
        unsigned int off = CONFIG_ENV_OFFSET;
index ac389ace622d701cd8f7e73a71ac67d684d81676..85af37d4a0540fd51dfce4c099c4bc297b751a64 100644 (file)
@@ -41,7 +41,7 @@ env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
 #endif
 
 #ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
-static uchar env_nvram_get_char(int index)
+static int env_nvram_get_char(int index)
 {
        uchar c;
 
index 9a4421523555db78d0f86495e0cbeb2b720242dc..ba8af28414be611d437b1b41117237f4ac0230ab 100644 (file)
@@ -227,9 +227,9 @@ struct env_driver {
         * will read from gd->env_addr.
         *
         * @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