lockd: define nlm_port_min,max with CONFIG_SYSCTL

Message ID 20230502180713.2930022-1-trix@redhat.com
State New
Headers
Series lockd: define nlm_port_min,max with CONFIG_SYSCTL |

Commit Message

Tom Rix May 2, 2023, 6:07 p.m. UTC
  gcc with W=1 and ! CONFIG_SYSCTL
fs/lockd/svc.c:80:51: error: ‘nlm_port_max’ defined but not used [-Werror=unused-const-variable=]
   80 | static const int                nlm_port_min = 0, nlm_port_max = 65535;
      |                                                   ^~~~~~~~~~~~
fs/lockd/svc.c:80:33: error: ‘nlm_port_min’ defined but not used [-Werror=unused-const-variable=]
   80 | static const int                nlm_port_min = 0, nlm_port_max = 65535;
      |                                 ^~~~~~~~~~~~

The only use of these variables is when CONFIG_SYSCTL
is defined, so their definition should be likewise conditional.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 fs/lockd/svc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jeff Layton May 2, 2023, 6:16 p.m. UTC | #1
On Tue, 2023-05-02 at 14:07 -0400, Tom Rix wrote:
> gcc with W=1 and ! CONFIG_SYSCTL
> fs/lockd/svc.c:80:51: error: ‘nlm_port_max’ defined but not used [-Werror=unused-const-variable=]
>    80 | static const int                nlm_port_min = 0, nlm_port_max = 65535;
>       |                                                   ^~~~~~~~~~~~
> fs/lockd/svc.c:80:33: error: ‘nlm_port_min’ defined but not used [-Werror=unused-const-variable=]
>    80 | static const int                nlm_port_min = 0, nlm_port_max = 65535;
>       |                                 ^~~~~~~~~~~~
> 
> The only use of these variables is when CONFIG_SYSCTL
> is defined, so their definition should be likewise conditional.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  fs/lockd/svc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
> index bb94949bc223..04ba95b83d16 100644
> --- a/fs/lockd/svc.c
> +++ b/fs/lockd/svc.c
> @@ -77,9 +77,9 @@ static const unsigned long	nlm_grace_period_min = 0;
>  static const unsigned long	nlm_grace_period_max = 240;
>  static const unsigned long	nlm_timeout_min = 3;
>  static const unsigned long	nlm_timeout_max = 20;
> -static const int		nlm_port_min = 0, nlm_port_max = 65535;
>  
>  #ifdef CONFIG_SYSCTL
> +static const int		nlm_port_min = 0, nlm_port_max = 65535;
>  static struct ctl_table_header * nlm_sysctl_table;
>  #endif
>  

Reviewed-by: Jeff Layton <jlayton@kernel.org>
  
Chuck Lever May 2, 2023, 7:50 p.m. UTC | #2
> On May 2, 2023, at 2:16 PM, Jeff Layton <jlayton@kernel.org> wrote:
> 
> On Tue, 2023-05-02 at 14:07 -0400, Tom Rix wrote:
>> gcc with W=1 and ! CONFIG_SYSCTL
>> fs/lockd/svc.c:80:51: error: ‘nlm_port_max’ defined but not used [-Werror=unused-const-variable=]
>>   80 | static const int                nlm_port_min = 0, nlm_port_max = 65535;
>>      |                                                   ^~~~~~~~~~~~
>> fs/lockd/svc.c:80:33: error: ‘nlm_port_min’ defined but not used [-Werror=unused-const-variable=]
>>   80 | static const int                nlm_port_min = 0, nlm_port_max = 65535;
>>      |                                 ^~~~~~~~~~~~
>> 
>> The only use of these variables is when CONFIG_SYSCTL
>> is defined, so their definition should be likewise conditional.
>> 
>> Signed-off-by: Tom Rix <trix@redhat.com>
>> ---
>> fs/lockd/svc.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
>> index bb94949bc223..04ba95b83d16 100644
>> --- a/fs/lockd/svc.c
>> +++ b/fs/lockd/svc.c
>> @@ -77,9 +77,9 @@ static const unsigned long nlm_grace_period_min = 0;
>> static const unsigned long nlm_grace_period_max = 240;
>> static const unsigned long nlm_timeout_min = 3;
>> static const unsigned long nlm_timeout_max = 20;
>> -static const int nlm_port_min = 0, nlm_port_max = 65535;
>> 
>> #ifdef CONFIG_SYSCTL
>> +static const int nlm_port_min = 0, nlm_port_max = 65535;
>> static struct ctl_table_header * nlm_sysctl_table;
>> #endif
>> 
> 
> Reviewed-by: Jeff Layton <jlayton@kernel.org>

Provisionally applied to nfsd-fixes. Thanks!


--
Chuck Lever
  

Patch

diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index bb94949bc223..04ba95b83d16 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -77,9 +77,9 @@  static const unsigned long	nlm_grace_period_min = 0;
 static const unsigned long	nlm_grace_period_max = 240;
 static const unsigned long	nlm_timeout_min = 3;
 static const unsigned long	nlm_timeout_max = 20;
-static const int		nlm_port_min = 0, nlm_port_max = 65535;
 
 #ifdef CONFIG_SYSCTL
+static const int		nlm_port_min = 0, nlm_port_max = 65535;
 static struct ctl_table_header * nlm_sysctl_table;
 #endif