linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/quota: erase unused but set variable warning
@ 2019-04-24  0:58 Jiang Biao
  2019-04-25 15:05 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Jiang Biao @ 2019-04-24  0:58 UTC (permalink / raw)
  To: jack; +Cc: linux-kernel, benbjiang

Local variable *reserved* of remove_dquot_ref() is only used if
define CONFIG_QUOTA_DEBUG, but not ebraced in CONFIG_QUOTA_DEBUG
macro, which leads to unused-but-set-variable warning when compiling.

This patch ebrace it into CONFIG_QUOTA_DEBUG macro like what is done
in add_dquot_ref().

Signed-off-by: Jiang Biao <benbjiang@tencent.com>
---
 fs/quota/dquot.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index fc20e06c56ba..14ee4c6deba1 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1049,7 +1049,9 @@ static void remove_dquot_ref(struct super_block *sb, int type,
 		struct list_head *tofree_head)
 {
 	struct inode *inode;
+#ifdef CONFIG_QUOTA_DEBUG
 	int reserved = 0;
+#endif
 
 	spin_lock(&sb->s_inode_list_lock);
 	list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
@@ -1061,8 +1063,10 @@ static void remove_dquot_ref(struct super_block *sb, int type,
 		 */
 		spin_lock(&dq_data_lock);
 		if (!IS_NOQUOTA(inode)) {
+#ifdef CONFIG_QUOTA_DEBUG
 			if (unlikely(inode_get_rsv_space(inode) > 0))
 				reserved = 1;
+#endif
 			remove_inode_dquot_ref(inode, type, tofree_head);
 		}
 		spin_unlock(&dq_data_lock);
-- 
2.17.2 (Apple Git-113)


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

* Re: [PATCH] fs/quota: erase unused but set variable warning
  2019-04-24  0:58 [PATCH] fs/quota: erase unused but set variable warning Jiang Biao
@ 2019-04-25 15:05 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2019-04-25 15:05 UTC (permalink / raw)
  To: Jiang Biao; +Cc: jack, linux-kernel

On Wed 24-04-19 08:58:57, Jiang Biao wrote:
> Local variable *reserved* of remove_dquot_ref() is only used if
> define CONFIG_QUOTA_DEBUG, but not ebraced in CONFIG_QUOTA_DEBUG
> macro, which leads to unused-but-set-variable warning when compiling.
> 
> This patch ebrace it into CONFIG_QUOTA_DEBUG macro like what is done
> in add_dquot_ref().
> 
> Signed-off-by: Jiang Biao <benbjiang@tencent.com>

Thanks. I've added the patch to my tree.

								Honza

> ---
>  fs/quota/dquot.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index fc20e06c56ba..14ee4c6deba1 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -1049,7 +1049,9 @@ static void remove_dquot_ref(struct super_block *sb, int type,
>  		struct list_head *tofree_head)
>  {
>  	struct inode *inode;
> +#ifdef CONFIG_QUOTA_DEBUG
>  	int reserved = 0;
> +#endif
>  
>  	spin_lock(&sb->s_inode_list_lock);
>  	list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
> @@ -1061,8 +1063,10 @@ static void remove_dquot_ref(struct super_block *sb, int type,
>  		 */
>  		spin_lock(&dq_data_lock);
>  		if (!IS_NOQUOTA(inode)) {
> +#ifdef CONFIG_QUOTA_DEBUG
>  			if (unlikely(inode_get_rsv_space(inode) > 0))
>  				reserved = 1;
> +#endif
>  			remove_inode_dquot_ref(inode, type, tofree_head);
>  		}
>  		spin_unlock(&dq_data_lock);
> -- 
> 2.17.2 (Apple Git-113)
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

end of thread, other threads:[~2019-04-25 15:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-24  0:58 [PATCH] fs/quota: erase unused but set variable warning Jiang Biao
2019-04-25 15:05 ` Jan Kara

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).