2018-09-19 02:29:15

by zhong jiang

[permalink] [raw]
Subject: [PATCH] staging: erofs: Fix a unused variable 'arg' warning

I find the following warning when compiling the kernel.

drivers/staging/erofs/super.c:195:6: warning: unused variable 'arg' [-Wunused-variable]
int arg = 0;

Signed-off-by: zhong jiang <[email protected]>
---
drivers/staging/erofs/super.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
index 6423592..c04313f 100644
--- a/drivers/staging/erofs/super.c
+++ b/drivers/staging/erofs/super.c
@@ -192,7 +192,9 @@ static int parse_options(struct super_block *sb, char *options)
{
substring_t args[MAX_OPT_ARGS];
char *p;
+#ifdef CONFIG_EROFS_FAULT_INJECTION
int arg = 0;
+#endif

if (!options)
return 0;
--
1.7.12.4



2018-09-19 03:08:00

by Chengguang Xu

[permalink] [raw]
Subject: Re: [PATCH] staging: erofs: Fix a unused variable 'arg' warning

On 09/19/2018 10:16 AM, zhong jiang wrote:
> I find the following warning when compiling the kernel.
>
> drivers/staging/erofs/super.c:195:6: warning: unused variable 'arg' [-Wunused-variable]
> int arg = 0;
>
> Signed-off-by: zhong jiang <[email protected]>
> ---
> drivers/staging/erofs/super.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
> index 6423592..c04313f 100644
> --- a/drivers/staging/erofs/super.c
> +++ b/drivers/staging/erofs/super.c
> @@ -192,7 +192,9 @@ static int parse_options(struct super_block *sb, char *options)
> {
> substring_t args[MAX_OPT_ARGS];
> char *p;
> +#ifdef CONFIG_EROFS_FAULT_INJECTION
> int arg = 0;
> +#endif
>
> if (!options)
> return 0;

Hi,

The fix has already included in my patch series "staging: erofs: option
validation for remount and some code cleanups",
so it will be fixed when the series merge into tree and we do not
encourage surrounding the code with macro in option
parsing for this case.

Thanks,
Chengguang

2018-09-19 03:17:33

by zhong jiang

[permalink] [raw]
Subject: Re: [PATCH] staging: erofs: Fix a unused variable 'arg' warning

On 2018/9/19 11:07, cgxu519 wrote:
> On 09/19/2018 10:16 AM, zhong jiang wrote:
>> I find the following warning when compiling the kernel.
>>
>> drivers/staging/erofs/super.c:195:6: warning: unused variable 'arg' [-Wunused-variable]
>> int arg = 0;
>>
>> Signed-off-by: zhong jiang <[email protected]>
>> ---
>> drivers/staging/erofs/super.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
>> index 6423592..c04313f 100644
>> --- a/drivers/staging/erofs/super.c
>> +++ b/drivers/staging/erofs/super.c
>> @@ -192,7 +192,9 @@ static int parse_options(struct super_block *sb, char *options)
>> {
>> substring_t args[MAX_OPT_ARGS];
>> char *p;
>> +#ifdef CONFIG_EROFS_FAULT_INJECTION
>> int arg = 0;
>> +#endif
>> if (!options)
>> return 0;
>
> Hi,
>
> The fix has already included in my patch series "staging: erofs: option validation for remount and some code cleanups",
> so it will be fixed when the series merge into tree and we do not encourage surrounding the code with macro in option
> parsing for this case.
>
Fine. Thank you for explaination.

Sincerely,
zhong jiang
> Thanks,
> Chengguang
>
> .
>