Skip to content

Commit

Permalink
net/smc: fix compile warning for smc_sysctl
Browse files Browse the repository at this point in the history
Fix build:

   In file included from net/smc/smc_sysctl.c:17:
>> net/smc/smc_sysctl.h:23:5: warning: no previous prototype \
	for function 'smc_sysctl_init' [-Wmissing-prototypes]
   int smc_sysctl_init(void)
       ^

and

>> WARNING: modpost: vmlinux.o(.text+0x12ced2d): Section mismatch \
in reference from the function smc_sysctl_exit() to the variable
.init.data:smc_sysctl_ops
The function smc_sysctl_exit() references
the variable __initdata smc_sysctl_ops.
This is often because smc_sysctl_exit lacks a __initdata
annotation or the annotation of smc_sysctl_ops is wrong.

Fixes: 462791b ("net/smc: add sysctl interface for SMC")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Dust Li <dust.li@linux.alibaba.com>
  • Loading branch information
Dust Li authored and intel-lab-lkp committed Mar 2, 2022
1 parent 7282c12 commit 4b16b08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions net/smc/smc_sysctl.c
Expand Up @@ -69,12 +69,12 @@ static struct pernet_operations smc_sysctl_ops __net_initdata = {
.exit = smc_sysctl_exit_net,
};

int __init smc_sysctl_init(void)
int __net_init smc_sysctl_init(void)
{
return register_pernet_subsys(&smc_sysctl_ops);
}

void smc_sysctl_exit(void)
void __net_exit smc_sysctl_exit(void)
{
unregister_pernet_subsys(&smc_sysctl_ops);
}
4 changes: 2 additions & 2 deletions net/smc/smc_sysctl.h
Expand Up @@ -20,12 +20,12 @@ void smc_sysctl_exit(void);

#else

int smc_sysctl_init(void)
static inline int smc_sysctl_init(void)
{
return 0;
}

void smc_sysctl_exit(void) { }
static inline void smc_sysctl_exit(void) { }

#endif /* CONFIG_SYSCTL */

Expand Down

0 comments on commit 4b16b08

Please sign in to comment.