From patchwork Mon Sep 5 04:59:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Schocher X-Patchwork-Id: 665611 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sSHfd26M5z9sD5 for ; Mon, 5 Sep 2016 15:02:48 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bgm1V-0006xz-3o; Mon, 05 Sep 2016 05:00:45 +0000 Received: from mail-out.m-online.net ([212.18.0.9]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bgm1C-0005vC-Qn for linux-mtd@lists.infradead.org; Mon, 05 Sep 2016 05:00:28 +0000 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3sSHbN2fqMz3hjJ1; Mon, 5 Sep 2016 07:00:00 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3sSHbN20ZWzvkWY; Mon, 5 Sep 2016 07:00:00 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id qeOaMXgcagm6; Mon, 5 Sep 2016 06:59:58 +0200 (CEST) Received: from mail-internal.denx.de (host-82-135-33-74.customer.m-online.net [82.135.33.74]) by mail.mnet-online.de (Postfix) with ESMTP; Mon, 5 Sep 2016 06:59:58 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail-internal.denx.de (Postfix) with ESMTP id CA5631807D2; Mon, 5 Sep 2016 06:59:58 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 515) id 93A2B1FF5; Mon, 5 Sep 2016 06:59:58 +0200 (CEST) From: Heiko Schocher To: linux-mtd@lists.infradead.org Subject: [PATCH] ubifs: compress lines for immediate return Date: Mon, 5 Sep 2016 06:59:57 +0200 Message-Id: <1473051597-30078-1-git-send-email-hs@denx.de> X-Mailer: git-send-email 2.5.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160904_220027_040063_F7B986C7 X-CRM114-Status: UNSURE ( 8.58 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [212.18.0.9 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [212.18.0.9 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Artem Bityutskiy , Richard Weinberger , Adrian Hunter , linux-kernel@vger.kernel.org, Masahiro Yamada , Heiko Schocher MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org fix the following code: -ret = expression; -if (ret) - return ret; -return 0; +return expression; From: Masahiro Yamada posted on the U-Boot mailinglist. Signed-off-by: Heiko Schocher --- fs/ubifs/budget.c | 7 ++----- fs/ubifs/gc.c | 6 ++---- fs/ubifs/lpt_commit.c | 5 +---- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c index 11a11b3..48d6851 100644 --- a/fs/ubifs/budget.c +++ b/fs/ubifs/budget.c @@ -77,7 +77,7 @@ static void shrink_liability(struct ubifs_info *c, int nr_to_write) */ static int run_gc(struct ubifs_info *c) { - int err, lnum; + int lnum; /* Make some free space by garbage-collecting dirty space */ down_read(&c->commit_sem); @@ -88,10 +88,7 @@ static int run_gc(struct ubifs_info *c) /* GC freed one LEB, return it to lprops */ dbg_budg("GC freed LEB %d", lnum); - err = ubifs_return_leb(c, lnum); - if (err) - return err; - return 0; + return = ubifs_return_leb(c, lnum); } /** diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index 821b348..88cd61d 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c @@ -297,10 +297,8 @@ static int sort_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb, err = dbg_check_data_nodes_order(c, &sleb->nodes); if (err) return err; - err = dbg_check_nondata_nodes_order(c, nondata); - if (err) - return err; - return 0; + + return dbg_check_nondata_nodes_order(c, nondata); } /** diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index ce89bdc..79a8e96 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c @@ -313,10 +313,7 @@ static int layout_cnodes(struct ubifs_info *c) alen = ALIGN(offs, c->min_io_size); upd_ltab(c, lnum, c->leb_size - alen, alen - offs); dbg_chk_lpt_sz(c, 4, alen - offs); - err = dbg_chk_lpt_sz(c, 3, alen); - if (err) - return err; - return 0; + return dbg_chk_lpt_sz(c, 3, alen); no_space: ubifs_err(c, "LPT out of space at LEB %d:%d needing %d, done_ltab %d, done_lsave %d",