From patchwork Wed May 27 11:56:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 1298826 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.a=rsa-sha256 header.s=s2014 header.b=E72yLMWG; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49X8TP6FxQz9sRK for ; Wed, 27 May 2020 21:57:29 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 01E8081A26; Wed, 27 May 2020 13:57:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.b="E72yLMWG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 01E6B81C64; Wed, 27 May 2020 13:56:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,FREEMAIL_FROM,SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from libero.it (smtp-16.italiaonline.it [213.209.10.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 31CE681688 for ; Wed, 27 May 2020 13:56:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=dariobin@libero.it Received: from localhost.localdomain ([185.33.57.41]) by smtp-16.iol.local with ESMTPA id dufZjM63oj8kvdufzjWCbD; Wed, 27 May 2020 13:56:51 +0200 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2014; t=1590580611; bh=hPmprvDQWtW1VtUk/44mAmm1QFw/9U5kk9vLvbRMI6g=; h=From; b=E72yLMWGO41wsLm/NPbBWQcjkS+I4d/32xPQZtGpxLJtGmY9VSQ8htzlGgJeKoYgY 7KV3OHnFbVzTlH+Xbv/Iw+jQr1vZIPHeG7hteEgYavtVPqWwtzMA+d1RBMido6hqYH CUXFqmD5BjeqQw8Wt3hc+L+HVZU30rTuxIwb0pQnBrh99ey2dksSSeoWzcEqL4ijsw tAZr7C1h9mSYYefWHseiUyuYWcLoFyJeal2uaCFI8xCJ4/DvgldV+JB4Uc+Dl2Q6za uaced+7r4RqUrqdllFgRa+u30aSuKnElqAM/MvFyavY6gOSNsgV3LPue7pZTE5dUBd E2mvMcpAX0inw== X-CNFS-Analysis: v=2.3 cv=V9gDLtvi c=1 sm=1 tr=0 a=7k5bMzoTbf4q2w+SfadHRQ==:117 a=7k5bMzoTbf4q2w+SfadHRQ==:17 a=iP-xVBlJAAAA:8 a=zQGMcW5UtX7eVOTNnpAA:9 a=lHLH-nfn2y1bM_0xSXwp:22 From: Dario Binacchi To: u-boot@lists.denx.de Cc: Michael Trimarchi , Dario Binacchi , Peng Fan , Simon Glass Subject: [PATCH v3 4/4] spl: fit: improve spl_nand_fit_read(...) readability Date: Wed, 27 May 2020 13:56:21 +0200 Message-Id: <20200527115621.1062-5-dariobin@libero.it> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200527115621.1062-1-dariobin@libero.it> References: <20200527115621.1062-1-dariobin@libero.it> X-CMAE-Envelope: MS4wfONEivDevikUic9OUct0plWxOtjbxYweY48UlYyRPStOf34c1xfbTKH2w9lVIXbi1YZ20BkIdmb13Jm8rqE1Cs2SC3hX1O7kb7oTggKtJ41ud951lFyE aZG6S6XPn5S6Bn1cc3DOLKJzmzyEzwJ+ezAZSBRwXSD6ONL0TK9RsPzMgVBAKRYIdjhnXw1t+bpJPtb0ZJwFhZAra3yZhHWPlZF6COdD/VH8IXm+43ELxU5W /cO5ntdPTC2Pu6B5uCemCl7By7Jsl2rg6QZniH51errVMA/JWIGfJ8X9HqNREmxP/ThqDkYULZQL8SQOI6HN6A== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean 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 Signed-off-by: Dario Binacchi --- 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,