From patchwork Mon Oct 19 11:37:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 7435171 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 98545BEEA4 for ; Mon, 19 Oct 2015 11:41:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F8C320693 for ; Mon, 19 Oct 2015 11:41:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AA96020691 for ; Mon, 19 Oct 2015 11:41:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751424AbbJSLlX (ORCPT ); Mon, 19 Oct 2015 07:41:23 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:35112 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751036AbbJSLlW (ORCPT ); Mon, 19 Oct 2015 07:41:22 -0400 Received: by pasz6 with SMTP id z6so28617829pas.2 for ; Mon, 19 Oct 2015 04:41:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=l1dnBaDWNKhlIM9NgjtY7nGfkI3sGVKLIl8RBtPRv4Q=; b=vyi9SsBZl/TCVRcVBp5S1bG2g588TQsppdgIhA4HyLMBo/sA8VmqAO75n0a3eWr7N3 Bg5ztx6feiNnvdwQsfPPd1PVeDuORJXxLXPzOn43bJsZb15pMj+fELUHs0h+q+Yxled/ CZQHJ9YReAxOzxl1RYHejInGXP8jU42C3MwOx5vP5VTDdwD/Y7N+aC3OvlU8/7lP9aRv XD/mFGJtMpHaP5jrch7BYhqCPsEc8M6CV77YJzpY17oRMkqJepHKHVP38d+k6KWOtdml Va9ziACgrsoyX7HjSAdz2bE6DrEFGXtFSYmgzpoHQlmxLL7vpEttpy52gx9fD+EJ1BTl FF9Q== X-Received: by 10.66.120.208 with SMTP id le16mr33380948pab.133.1445254882525; Mon, 19 Oct 2015 04:41:22 -0700 (PDT) Received: from localhost ([128.199.137.77]) by smtp.gmail.com with ESMTPSA id qd5sm35907103pbc.73.2015.10.19.04.41.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 04:41:22 -0700 (PDT) From: Eryu Guan To: linux-btrfs@vger.kernel.org Cc: Eryu Guan Subject: [PATCH 02/10] btrfs-progs: save error number correctly in check_chunks_and_extents Date: Mon, 19 Oct 2015 19:37:52 +0800 Message-Id: <1445254680-11102-3-git-send-email-guaneryu@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1445254680-11102-1-git-send-email-guaneryu@gmail.com> References: <1445254680-11102-1-git-send-email-guaneryu@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Coverity reports assigning value from "err" to "ret", but that stored value is overwritten by check_extent_refs() before it can be used. Signed-off-by: Eryu Guan --- cmds-check.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index 4225b21..80a7c29 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -8066,13 +8066,12 @@ again: goto out; } - err = check_chunks(&chunk_cache, &block_group_cache, + ret = check_chunks(&chunk_cache, &block_group_cache, &dev_extent_cache, NULL, NULL, NULL, 0); - if (err) { - if (err == -EAGAIN) + if (ret) { + if (ret == -EAGAIN) goto loop; - if (!ret) - ret = err; + err = ret; } ret = check_extent_refs(root, &extent_cache); @@ -8082,8 +8081,8 @@ again: goto out; } - err = check_devices(&dev_cache, &dev_extent_cache); - if (err && !ret) + ret = check_devices(&dev_cache, &dev_extent_cache); + if (ret && err) ret = err; out: