Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6971849rwl; Wed, 22 Mar 2023 19:34:00 -0700 (PDT) X-Google-Smtp-Source: AK7set+1TOncfZu8tFKgvX2D8+PonWB1zBWtMd5pZSamsKofz68FNhUUY6rDjRGSvQL9+itv7WDz X-Received: by 2002:a17:906:1c86:b0:933:1134:be1e with SMTP id g6-20020a1709061c8600b009331134be1emr8122347ejh.53.1679538840483; Wed, 22 Mar 2023 19:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679538840; cv=none; d=google.com; s=arc-20160816; b=foCIQAGsi5hk+BdZ9D7nKjAX+2H9CEnsLUM0paIBDvF85lN9Uau1oLbMz4YemnSzYz G/1zn+w6eywIaynybQVtGgQ28aSdYXCLnTcELMJwV8pjeZGsS4/g1/h8pLgBD2iKT3Rh POB8l/VOEEiUVSRNJB6aKjrZ9WwqUkeAAs7wij7rhPfAGFB9cQSakbJv6f4RTXlhl59m sPGgaSs++3iJ8JM+uPWGdPg4tP3p4/gEdXOY5b9r2kcDgmch1q3JpVJIAzO5rg1EODef mXzfy5QT1vIyBOmixpYpAPfHg0ByRyl3rOUJ8k6BDv7zoomJeTN85b3Zoqm/mIAuSCW/ DXiw== 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; bh=ET98pFy6FZrC1sINPMsGgWTY9LjIeymGXd5WBv0KWvQ=; b=qkeTaktxaJLkM9+zeTF0bOafS15RvTBgyolNMJUO3JazqDjVwOKXhS+l2dyYq6qDI1 J4gxcy5nLtaQE8SmyhwhGTZwifgYM26YgW73x+5mGIeuOv/oJVfsZZd92Xubg/06gNfK LYth4tqDE49PBh6PAVHzUgr/ntD5m6o8VyUvKlyVvKUNpcbjkDT80Kefi4OA+kTNuyka bxWcjMfMW9m0vf5irxVi4KgSTMOUnhvf/Jgj2eBQGVmMRUYVuu2J+4BxL1YgKjQEvoHq 4gpkts28TFxAKS1BujsKEGQkQ0jKZr9+IFLlGgXk9phfV//3gYoUqrDY41biXYQqhwjD uxOg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lt27-20020a170906fa9b00b008cbb481fc84si16478761ejb.20.2023.03.22.19.33.35; Wed, 22 Mar 2023 19:34:00 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230081AbjCWCdK (ORCPT + 99 others); Wed, 22 Mar 2023 22:33:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbjCWCdJ (ORCPT ); Wed, 22 Mar 2023 22:33:09 -0400 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D1D32CC53; Wed, 22 Mar 2023 19:33:07 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VeSSihz_1679538780; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VeSSihz_1679538780) by smtp.aliyun-inc.com; Thu, 23 Mar 2023 10:33:04 +0800 From: Jiapeng Chong To: viro@zeniv.linux.org.uk Cc: brauner@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH v2] fs/buffer: Remove redundant assignment to err Date: Thu, 23 Mar 2023 10:32:59 +0800 Message-Id: <20230323023259.6924-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.0 required=5.0 tests=ENV_AND_HDR_SPF_MATCH, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=unavailable 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 Variable 'err' set but not used. fs/buffer.c:2613:2: warning: Value stored to 'err' is never read. Reported-by: Abaci Robot Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4589 Signed-off-by: Jiapeng Chong --- Changes in v2: -Remove unused out label. fs/buffer.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index d759b105c1e7..b3eb905f87d6 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2580,7 +2580,7 @@ int block_truncate_page(struct address_space *mapping, struct inode *inode = mapping->host; struct page *page; struct buffer_head *bh; - int err; + int err = 0; blocksize = i_blocksize(inode); length = offset & (blocksize - 1); @@ -2593,9 +2593,8 @@ int block_truncate_page(struct address_space *mapping, iblock = (sector_t)index << (PAGE_SHIFT - inode->i_blkbits); page = grab_cache_page(mapping, index); - err = -ENOMEM; if (!page) - goto out; + return -ENOMEM; if (!page_has_buffers(page)) create_empty_buffers(page, blocksize, 0); @@ -2609,7 +2608,6 @@ int block_truncate_page(struct address_space *mapping, pos += blocksize; } - err = 0; if (!buffer_mapped(bh)) { WARN_ON(bh->b_size != blocksize); err = get_block(inode, iblock, bh, 0); @@ -2633,12 +2631,11 @@ int block_truncate_page(struct address_space *mapping, zero_user(page, offset, length); mark_buffer_dirty(bh); - err = 0; unlock: unlock_page(page); put_page(page); -out: + return err; } EXPORT_SYMBOL(block_truncate_page); -- 2.20.1.7.g153144c