Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1336672rwb; Fri, 19 Aug 2022 01:39:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR53TfNyg1C/3xgrTznrNUEj+xmm6R5crZDs+Bg7h/WDa351s2RWU9JX2k0rmfU1i0UM4l2u X-Received: by 2002:a63:353:0:b0:41d:eeb:aa5c with SMTP id 80-20020a630353000000b0041d0eebaa5cmr5675982pgd.90.1660898391712; Fri, 19 Aug 2022 01:39:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660898391; cv=none; d=google.com; s=arc-20160816; b=vSMYujbY/B98j4HzkO3gOtnS5NcE9I5rLrbaX+rkI2b8jXDj5kt8LQ+l3T9AjgNloh KsD3QqyvfQU3uNMgMY1bcdrB1F4YPPQ7cbYfXv8Ch6VJElx8Ie9F01kGL65EX1M6LHEq Z9blNeWxKoaenz7r9vWd9Xl/7NgWhGJsWF8ZW5sJnhKx5ghoWA2VWCTlO218sdcWjxxR SznqQl2dWqnOWv1+YiUSxMcUYoCXhyA1gdjsdV0oS29YStqs9JESbY9TkwyiLPo/Ovxv f36OLteGW3xfhsoXWHi0hp9Lm2rjUfkZJbiMSIktQwDxHiYaDIQPhICWinXEYbhupsCL WjLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sWp63BpVW8U7jAJS0MU5jHAUsPkleFN5R+CfvsKi3C8=; b=j9Ux16tynpYPVSgM3CbjC1BEA/INndCJEmscDXDty76tjUXpzBFeBgkFVWlkEzrlT1 UW6kb9zZ/BLDnfGCFDES/Z5y8Z39FBBE1g8WpFeoUUfTmS5mXW5YYRVrB/XDzIvo+37u BBEcdcjNPfZU+LKIYax/XKDU+AJACMCXN/zhKN+iGBnqqialuLdpRcGDt0NOFsr/8DTq qmXqUVjpOVXeCUof3NlMJ7pun5+aGgljERTMjivJ6WnDAGQXQ/1DwGeLTvpPYMStvZbQ illA3IxkOmtPI1DAo4WS9jWdb4fylHboUYw6n26Vsv1U9PNUI4w6ThXCb1uvsFVORSPO 6B/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=C6E1jDIS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a170903228800b001727963cea4si1180189plh.525.2022.08.19.01.39.41; Fri, 19 Aug 2022 01:39:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=C6E1jDIS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347681AbiHSIR5 (ORCPT + 99 others); Fri, 19 Aug 2022 04:17:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347584AbiHSIRH (ORCPT ); Fri, 19 Aug 2022 04:17:07 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3297BE192F; Fri, 19 Aug 2022 01:17:05 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id y4so3551828plb.2; Fri, 19 Aug 2022 01:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=sWp63BpVW8U7jAJS0MU5jHAUsPkleFN5R+CfvsKi3C8=; b=C6E1jDISCgMWDW9pnZhE7J0+TOlfLs/SL0BvEnbhBl1cOaLOXPUkG0PsMKXga8lGMf S2wHURTITV1Rq9JkhGaTwKlby/7FSHfRAIPScHpHSMT3YjsBMELwfC8ipcrB464GrD9h ZnJjlI6vdcoh0J+8Cyay7v86g01ubH4NdCXSZqylVbyit+YHsruhkTAkIT62SuJ09kiX hwh+ogQuE+SpWKDkY7qLQNHDWxp287xo5wQ7QCtE/P9sEfHcRkIJGifHtkQfRbJUcGHY RNGtxDVImZlWR/qzbM2CWJPwn243C+fiGciyO9ooeAdtPheFINVJaw6zGFirPIHpyXvj 1oSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=sWp63BpVW8U7jAJS0MU5jHAUsPkleFN5R+CfvsKi3C8=; b=5Ehr7Wpj4N+TbuPElcD5Gbfv7CB3mvwFoY0WTNksWswo6nQMm7wjN3QjXOIJwr150F HvzDQROkoQ3hmgx0Vz4uNaJmiqgyC8Ym0Ax5OQvx9zfAJ4gECnmPfkcviDt06rrshq3d jB4DQI3yH4chjcH5GZ8x5HvEsaX9bjd48HZNkRqZX19QuEmvFkjSmHH5Mcwh5YkVLUiO w/RhqBDBXY1JiMgAGed5QshP0XIKAzXjQomBkZ6KNigUoRYShNaHdwkb7M3DqRhaZQMJ 1mWkF6e6wzAzNM6nMWt2QYrNdAo2Jx/GS0aEnHKq2bPueDHHvDjH5CXRKcvIG/a5P1jt +WZA== X-Gm-Message-State: ACgBeo0rg+GzzY7oALQ87KwYpZkFvnaoD7RgzaEvmA92YTJGvQngjqdX XsX6TW34kPyoCSoPtEwmR22NiZorRmo= X-Received: by 2002:a17:90b:1bc7:b0:1f5:37a6:e473 with SMTP id oa7-20020a17090b1bc700b001f537a6e473mr6995083pjb.87.1660897024753; Fri, 19 Aug 2022 01:17:04 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id s10-20020a170902ea0a00b00172a6cf0a84sm2631032plg.124.2022.08.19.01.17.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 01:17:04 -0700 (PDT) From: cgel.zte@gmail.com X-Google-Original-From: chi.minghao@zte.com.cn To: konishi.ryusuke@gmail.com Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org, Minghao Chi , Zeal Robot Subject: [PATCH] nilfs2: delete unnecessary checks before brelse() Date: Fri, 19 Aug 2022 08:17:00 +0000 Message-Id: <20220819081700.96279-1-chi.minghao@zte.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Minghao Chi The brelse() function tests whether its argument is NULL and then returns immediately. Thus remove the tests which are not needed around the shown calls. Reported-by: Zeal Robot Signed-off-by: Minghao Chi --- fs/nilfs2/btree.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index f544c22fff78..b3b5a46488c2 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c @@ -1668,8 +1668,7 @@ static int nilfs_btree_check_delete(struct nilfs_bmap *btree, __u64 key) maxkey = nilfs_btree_node_get_key(node, nchildren - 1); nextmaxkey = (nchildren > 1) ? nilfs_btree_node_get_key(node, nchildren - 2) : 0; - if (bh != NULL) - brelse(bh); + brelse(bh); return (maxkey == key) && (nextmaxkey < NILFS_BMAP_LARGE_LOW); } @@ -1717,8 +1716,7 @@ static int nilfs_btree_gather_data(struct nilfs_bmap *btree, ptrs[i] = le64_to_cpu(dptrs[i]); } - if (bh != NULL) - brelse(bh); + brelse(bh); return nitems; } -- 2.25.1