linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: remove an unused variable warning with CONFIG_QUOTA=n
@ 2021-08-24  3:49 Austin Kim
  2021-09-05 23:19 ` Austin Kim
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Austin Kim @ 2021-08-24  3:49 UTC (permalink / raw)
  To: tytso, adilger.kernel; +Cc: linux-ext4, linux-kernel, austin.kim

The 'enable_quota' variable is only used in an CONFIG_QUOTA.
With CONFIG_QUOTA=n, compiler causes a harmless warning:

fs/ext4/super.c: In function ‘ext4_remount’:
fs/ext4/super.c:5840:6: warning: variable ‘enable_quota’ set but not used
  [-Wunused-but-set-variable]
  int enable_quota = 0;
              ^~~~~

Move 'enable_quota' into the same #ifdef CONFIG_QUOTA block
to remove an unused variable warning.

Signed-off-by: Austin Kim <austindh.kim@gmail.com>
---
 fs/ext4/super.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6b03e4281f6f..6adb570f4b31 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5845,10 +5845,10 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	unsigned long old_sb_flags, vfs_flags;
 	struct ext4_mount_options old_opts;
-	int enable_quota = 0;
 	ext4_group_t g;
 	int err = 0;
 #ifdef CONFIG_QUOTA
+	int enable_quota = 0;
 	int i, j;
 	char *to_free[EXT4_MAXQUOTAS];
 #endif
@@ -6053,7 +6053,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
 					err = -EROFS;
 					goto restore_opts;
 				}
+#ifdef CONFIG_QUOTA
 			enable_quota = 1;
+#endif
 		}
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4: remove an unused variable warning with CONFIG_QUOTA=n
  2021-08-24  3:49 [PATCH] ext4: remove an unused variable warning with CONFIG_QUOTA=n Austin Kim
@ 2021-09-05 23:19 ` Austin Kim
  2021-10-14  9:26 ` Jan Kara
  2021-10-28 14:56 ` Theodore Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Austin Kim @ 2021-09-05 23:19 UTC (permalink / raw)
  To: Theodore Y. Ts'o, adilger.kernel
  Cc: linux-ext4, Linux Kernel Mailing List, 김동현

2021년 8월 24일 (화) 오후 12:49, Austin Kim <austindh.kim@gmail.com>님이 작성:
>
> The 'enable_quota' variable is only used in an CONFIG_QUOTA.
> With CONFIG_QUOTA=n, compiler causes a harmless warning:
>
> fs/ext4/super.c: In function ‘ext4_remount’:
> fs/ext4/super.c:5840:6: warning: variable ‘enable_quota’ set but not used
>   [-Wunused-but-set-variable]
>   int enable_quota = 0;
>               ^~~~~
>
> Move 'enable_quota' into the same #ifdef CONFIG_QUOTA block
> to remove an unused variable warning.
>
> Signed-off-by: Austin Kim <austindh.kim@gmail.com>
> ---
>  fs/ext4/super.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 6b03e4281f6f..6adb570f4b31 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -5845,10 +5845,10 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
>         struct ext4_sb_info *sbi = EXT4_SB(sb);
>         unsigned long old_sb_flags, vfs_flags;
>         struct ext4_mount_options old_opts;
> -       int enable_quota = 0;
>         ext4_group_t g;
>         int err = 0;
>  #ifdef CONFIG_QUOTA
> +       int enable_quota = 0;
>         int i, j;
>         char *to_free[EXT4_MAXQUOTAS];
>  #endif
> @@ -6053,7 +6053,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
>                                         err = -EROFS;
>                                         goto restore_opts;
>                                 }
> +#ifdef CONFIG_QUOTA
>                         enable_quota = 1;
> +#endif
>                 }
>         }
>
> --
> 2.20.1
>

If you are available, would you please review this patch?
It will not take long.

BR,
Austin Kim

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4: remove an unused variable warning with CONFIG_QUOTA=n
  2021-08-24  3:49 [PATCH] ext4: remove an unused variable warning with CONFIG_QUOTA=n Austin Kim
  2021-09-05 23:19 ` Austin Kim
@ 2021-10-14  9:26 ` Jan Kara
  2021-10-28 14:56 ` Theodore Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2021-10-14  9:26 UTC (permalink / raw)
  To: Austin Kim; +Cc: tytso, adilger.kernel, linux-ext4, linux-kernel, austin.kim

On Tue 24-08-21 04:49:29, Austin Kim wrote:
> The 'enable_quota' variable is only used in an CONFIG_QUOTA.
> With CONFIG_QUOTA=n, compiler causes a harmless warning:
> 
> fs/ext4/super.c: In function ‘ext4_remount’:
> fs/ext4/super.c:5840:6: warning: variable ‘enable_quota’ set but not used
>   [-Wunused-but-set-variable]
>   int enable_quota = 0;
>               ^~~~~
> 
> Move 'enable_quota' into the same #ifdef CONFIG_QUOTA block
> to remove an unused variable warning.
> 
> Signed-off-by: Austin Kim <austindh.kim@gmail.com>

I guess this has fallen through the cracks. The fix looks good to me. Feel
free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/super.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 6b03e4281f6f..6adb570f4b31 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -5845,10 +5845,10 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
>  	struct ext4_sb_info *sbi = EXT4_SB(sb);
>  	unsigned long old_sb_flags, vfs_flags;
>  	struct ext4_mount_options old_opts;
> -	int enable_quota = 0;
>  	ext4_group_t g;
>  	int err = 0;
>  #ifdef CONFIG_QUOTA
> +	int enable_quota = 0;
>  	int i, j;
>  	char *to_free[EXT4_MAXQUOTAS];
>  #endif
> @@ -6053,7 +6053,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
>  					err = -EROFS;
>  					goto restore_opts;
>  				}
> +#ifdef CONFIG_QUOTA
>  			enable_quota = 1;
> +#endif
>  		}
>  	}
>  
> -- 
> 2.20.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4: remove an unused variable warning with CONFIG_QUOTA=n
  2021-08-24  3:49 [PATCH] ext4: remove an unused variable warning with CONFIG_QUOTA=n Austin Kim
  2021-09-05 23:19 ` Austin Kim
  2021-10-14  9:26 ` Jan Kara
@ 2021-10-28 14:56 ` Theodore Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2021-10-28 14:56 UTC (permalink / raw)
  To: Austin Kim, adilger.kernel
  Cc: Theodore Ts'o, linux-kernel, linux-ext4, austin.kim

On Tue, 24 Aug 2021 04:49:29 +0100, Austin Kim wrote:
> The 'enable_quota' variable is only used in an CONFIG_QUOTA.
> With CONFIG_QUOTA=n, compiler causes a harmless warning:
> 
> fs/ext4/super.c: In function ‘ext4_remount’:
> fs/ext4/super.c:5840:6: warning: variable ‘enable_quota’ set but not used
>   [-Wunused-but-set-variable]
>   int enable_quota = 0;
>               ^~~~~
> 
> [...]

Applied, thanks!

[1/1] ext4: remove an unused variable warning with CONFIG_QUOTA=n
      commit: d94ca0e1d65f4c274e3425a35f23ffe58ecea18a

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-28 14:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24  3:49 [PATCH] ext4: remove an unused variable warning with CONFIG_QUOTA=n Austin Kim
2021-09-05 23:19 ` Austin Kim
2021-10-14  9:26 ` Jan Kara
2021-10-28 14:56 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).