From patchwork Fri Apr 21 07:08:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 86157 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp876056vqo; Fri, 21 Apr 2023 00:12:55 -0700 (PDT) X-Google-Smtp-Source: AKy350YIp8c3YEAbmKZRzNW78EIvMVBE2JJ72peIVRbauLdXEdezl9t8Ng/N4jivPyTFJYQn+tYL X-Received: by 2002:a17:903:2281:b0:1a1:b174:836c with SMTP id b1-20020a170903228100b001a1b174836cmr5786621plh.16.1682061175730; Fri, 21 Apr 2023 00:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682061175; cv=none; d=google.com; s=arc-20160816; b=yoAkcKhTyc5IayNBhhrHwmGL1vs2ftHmAglCP7dd7LnP9QqBa5QFoDokrDlMK2cwtA TLLMXu8hlBfh3/BzuqPbu3HSz2mcP223PMic17Wx/mr4OCcCeDnvG/U1e1bKtrVTLxYJ qDLyGFssHDXqj0WmVB12CwP5ek5t/sMBJAwg/7DEK3gamPYN6oShyaJiTSLO1YtYOc86 qwjjfnOtG9ouuNWsJbp2af2DVtta5cm8ELh2HF+M5ePbLhYvjctyo5x5CLiXu1LIGQ/E xZLDF2L1iNKcJUzsOui2wDj9kIcYnio4lAhHwbI/vVtzkE1whE9eTf2z2ZJgYPq9CPFo TURw== 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=vjeE5L9P395rd09U86rfmFPTyS6Uf0IuPhW9If+EyBc=; b=c08ZXffd8Wy1W6Z1+V1unekarfDLGEJou25fWakC4sQ2Nv3ANm9knuI+4wCTxFw7xQ a2wBXwWmBNjBAD7LwrJU+qldQmswjGKYU58hGPW9xskjD6P05VuC4AzY6byAK1Vk89uo HptLv8Lx9GklTuHmeYHfia+pPOr3EBAem5ROj5hATM54dHpCWsysFszF5ewixdIEMBrc yoM+1kjBZ4qm51f9xcID8yv6Lmq/R7sDow3Dcr83RbsnptpCQ64VBUf8tC7hYxL1bnwH nyxBRNmunnw4Wjq3nAwlpKBwxUWvQ2Gnl5EZaeTzoaOpXvTgqEjCQuDJKo0wVtfPjAyA +5mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Sgyw3xUI; 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=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ke3-20020a170903340300b001a6567d42a4si3461978plb.478.2023.04.21.00.12.42; Fri, 21 Apr 2023 00:12:55 -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=@kernel.org header.s=k20201202 header.b=Sgyw3xUI; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229543AbjDUHIm (ORCPT + 99 others); Fri, 21 Apr 2023 03:08:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbjDUHIi (ORCPT ); Fri, 21 Apr 2023 03:08:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EB9E7DBF; Fri, 21 Apr 2023 00:08:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 27B0F61BD4; Fri, 21 Apr 2023 07:08:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DF2FC433D2; Fri, 21 Apr 2023 07:08:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682060901; bh=bQzQaoashK/4PV029DbpZuuIfz5K69u3O9j4z8ufa1w=; h=From:To:Cc:Subject:Date:From; b=Sgyw3xUIbQ0riYIXVtTtryebT2IV79C2Dzffgn++x2nOcPdFgf0uy8AiHWsh9R/I8 MxN+cYCzKwsO5w1H9vWHm87B0HQXXNFj2n90LKBusL7ViUDQCFyHcQ6l/OKGQblLef Z+Cmf+YjuD5FIGnZF+93/Jl0067BzmVh+gIiPJTQHVTOP9eVGCLozkvR8VPDRQcORE Mapq9etseBp9hqZbip30rMIja9qwF3dKrQ8zFA9dZeCepeyF7u08Tnk4U/SP+CUP67 JfFejy8zqaN905Fynf0q3jxJNEgBo++0nSuW72UKMK+bYSWH4X9ndfhuFoZBYWF/vJ ltmYXZX7e0n8Q== From: Arnd Bergmann To: "Theodore Ts'o" , Andreas Dilger , Jason Yan Cc: Arnd Bergmann , Jan Kara , Ritesh Harjani , Eric Biggers , Ye Bin , Baokun Li , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ext4: avoid unused-variable warning with CONFIG_QUOTA=n Date: Fri, 21 Apr 2023 09:08:11 +0200 Message-Id: <20230421070815.2260326-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763768979346066013?= X-GMAIL-MSGID: =?utf-8?q?1763768979346066013?= From: Arnd Bergmann After some code reshuffling, the index variables in two functions are only used in an #ifdef: fs/ext4/super.c: In function 'ext4_put_super': fs/ext4/super.c:1262:13: error: unused variable 'i' [-Werror=unused-variable] fs/ext4/super.c: In function '__ext4_fill_super': fs/ext4/super.c:5200:22: error: unused variable 'i' [-Werror=unused-variable] Since all supported compilers now allow having variable declarations inside of a for() loop, move them into the #ifdef block directly. Fixes: dcbf87589d90 ("ext4: factor out ext4_flex_groups_free()") Signed-off-by: Arnd Bergmann --- fs/ext4/super.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index d03bf0ecf505..9b331ef593ea 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1259,7 +1259,7 @@ static void ext4_put_super(struct super_block *sb) struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_super_block *es = sbi->s_es; int aborted = 0; - int i, err; + int err; /* * Unregister sysfs before destroying jbd2 journal. @@ -1311,7 +1311,7 @@ static void ext4_put_super(struct super_block *sb) ext4_flex_groups_free(sbi); ext4_percpu_param_destroy(sbi); #ifdef CONFIG_QUOTA - for (i = 0; i < EXT4_MAXQUOTAS; i++) + for (int i = 0; i < EXT4_MAXQUOTAS; i++) kfree(get_qf_name(sb, sbi, i)); #endif @@ -5197,7 +5197,6 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) ext4_fsblk_t logical_sb_block; struct inode *root; int ret = -ENOMEM; - unsigned int i; int needs_recovery; int err = 0; ext4_group_t first_not_zeroed; @@ -5628,7 +5627,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) #endif #ifdef CONFIG_QUOTA - for (i = 0; i < EXT4_MAXQUOTAS; i++) + for (int i = 0; i < EXT4_MAXQUOTAS; i++) kfree(get_qf_name(sb, sbi, i)); #endif fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy);