]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spl: fit: improve spl_nand_fit_read(...) readability
authorDario Binacchi <dariobin@libero.it>
Wed, 27 May 2020 11:56:21 +0000 (13:56 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 8 Jul 2020 21:21:46 +0000 (17:21 -0400)
Replacing the ret variable with err and handling first the error
condition about the value returned by the spl_nand_fit_read routine,
improves the code readability.
Furthermore, the 'else' int the 'else return ret' instruction was
useless.

cc: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dariobin@libero.it>
common/spl/spl_nand.c

index 1e6f2dce5698498e8df110188bf0b21654988485..d13a5245974fedb0f3dd0b639f9645d8284be8e2 100644 (file)
@@ -43,15 +43,15 @@ static ulong spl_nand_fit_read(struct spl_load_info *load, ulong offs,
                               ulong size, void *dst)
 {
        ulong sector;
-       int ret;
+       int err;
 
        sector = *(int *)load->priv;
        offs = sector + nand_spl_adjust_offset(sector, offs - sector);
-       ret = nand_spl_load_image(offs, size, dst);
-       if (!ret)
-               return size;
-       else
+       err = nand_spl_load_image(offs, size, dst);
+       if (err)
                return 0;
+
+       return size;
 }
 
 static int spl_nand_load_element(struct spl_image_info *spl_image,