All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Binacchi <dariobin@libero.it>
To: u-boot@lists.denx.de
Subject: [PATCH v3 4/4] spl: fit: improve spl_nand_fit_read(...) readability
Date: Wed, 27 May 2020 13:56:21 +0200	[thread overview]
Message-ID: <20200527115621.1062-5-dariobin@libero.it> (raw)
In-Reply-To: <20200527115621.1062-1-dariobin@libero.it>

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>
---

Changes in v3: None
Changes in v2: None

 common/spl/spl_nand.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index 1e6f2dce56..d13a524597 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -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,
-- 
2.17.1

  parent reply	other threads:[~2020-05-27 11:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 11:56 [PATCH v3 0/4] Fix the SPL loading of a FIT image from NAND Dario Binacchi
2020-05-27 11:56 ` [PATCH v3 1/4] spl: fix format of function documentation Dario Binacchi
2020-05-31 14:08   ` Simon Glass
2020-07-09  0:22   ` Tom Rini
2020-05-27 11:56 ` [PATCH v3 2/4] spl: fit: fail fit loading in case of FDT appending error Dario Binacchi
2020-05-31 14:08   ` Simon Glass
2020-07-09  0:22   ` Tom Rini
2020-05-27 11:56 ` [PATCH v3 3/4] spl: fit: nand: fix fit loading in case of bad blocks Dario Binacchi
2020-06-06 19:23   ` Michael Nazzareno Trimarchi
2020-07-09  0:22   ` Tom Rini
2020-05-27 11:56 ` Dario Binacchi [this message]
2020-05-31 14:08   ` [PATCH v3 4/4] spl: fit: improve spl_nand_fit_read(...) readability Simon Glass
2020-07-09  0:22   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200527115621.1062-5-dariobin@libero.it \
    --to=dariobin@libero.it \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.