public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* drivers/crypto/virtio/virtio_crypto_common.h:116:13: warning: variable 'cpu' set but not used
@ 2023-12-03 19:55 kernel test robot
  2023-12-03 20:26 ` Michael S. Tsirkin
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2023-12-03 19:55 UTC (permalink / raw)
  To: Gonglei; +Cc: oe-kbuild-all, linux-kernel, Michael S. Tsirkin

Hi Gonglei,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   33cc938e65a98f1d29d0a18403dbbee050dcad9a
commit: dbaf0624ffa57ae6e7d87a823185ccd9a7852d3c crypto: add virtio-crypto driver
date:   7 years ago
config: x86_64-randconfig-015-20231011 (https://download.01.org/0day-ci/archive/20231204/202312040315.kPrI1OCE-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231204/202312040315.kPrI1OCE-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312040315.kPrI1OCE-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/crypto/virtio/virtio_crypto_algs.c:28:
   drivers/crypto/virtio/virtio_crypto_common.h: In function 'virtio_crypto_get_current_node':
>> drivers/crypto/virtio/virtio_crypto_common.h:116:13: warning: variable 'cpu' set but not used [-Wunused-but-set-variable]
     116 |         int cpu, node;
         |             ^~~
--
   In file included from drivers/crypto/virtio/virtio_crypto_core.c:25:
   drivers/crypto/virtio/virtio_crypto_common.h: In function 'virtio_crypto_get_current_node':
>> drivers/crypto/virtio/virtio_crypto_common.h:116:13: warning: variable 'cpu' set but not used [-Wunused-but-set-variable]
     116 |         int cpu, node;
         |             ^~~
   In file included from drivers/crypto/virtio/virtio_crypto_core.c:20:
   drivers/crypto/virtio/virtio_crypto_core.c: At top level:
   include/linux/module.h:132:13: warning: 'init_module' specifies less restrictive attribute than its target 'virtio_crypto_driver_init': 'cold' [-Wmissing-attributes]
     132 |         int init_module(void) __attribute__((alias(#initfn)));
         |             ^~~~~~~~~~~
   include/linux/device.h:1463:1: note: in expansion of macro 'module_init'
    1463 | module_init(__driver##_init); \
         | ^~~~~~~~~~~
   include/linux/virtio.h:190:9: note: in expansion of macro 'module_driver'
     190 |         module_driver(__virtio_driver, register_virtio_driver, \
         |         ^~~~~~~~~~~~~
   drivers/crypto/virtio/virtio_crypto_core.c:471:1: note: in expansion of macro 'module_virtio_driver'
     471 | module_virtio_driver(virtio_crypto_driver);
         | ^~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/virtio.h:8,
                    from include/linux/virtio_config.h:6,
                    from drivers/crypto/virtio/virtio_crypto_core.c:21:
   drivers/crypto/virtio/virtio_crypto_core.c:471:22: note: 'init_module' target declared here
     471 | module_virtio_driver(virtio_crypto_driver);
         |                      ^~~~~~~~~~~~~~~~~~~~
   include/linux/device.h:1459:19: note: in definition of macro 'module_driver'
    1459 | static int __init __driver##_init(void) \
         |                   ^~~~~~~~
   drivers/crypto/virtio/virtio_crypto_core.c:471:1: note: in expansion of macro 'module_virtio_driver'
     471 | module_virtio_driver(virtio_crypto_driver);
         | ^~~~~~~~~~~~~~~~~~~~
   include/linux/module.h:138:14: warning: 'cleanup_module' specifies less restrictive attribute than its target 'virtio_crypto_driver_exit': 'cold' [-Wmissing-attributes]
     138 |         void cleanup_module(void) __attribute__((alias(#exitfn)));
         |              ^~~~~~~~~~~~~~
   include/linux/device.h:1468:1: note: in expansion of macro 'module_exit'
    1468 | module_exit(__driver##_exit);
         | ^~~~~~~~~~~
   include/linux/virtio.h:190:9: note: in expansion of macro 'module_driver'
     190 |         module_driver(__virtio_driver, register_virtio_driver, \
         |         ^~~~~~~~~~~~~
   drivers/crypto/virtio/virtio_crypto_core.c:471:1: note: in expansion of macro 'module_virtio_driver'
     471 | module_virtio_driver(virtio_crypto_driver);
         | ^~~~~~~~~~~~~~~~~~~~
   drivers/crypto/virtio/virtio_crypto_core.c:471:22: note: 'cleanup_module' target declared here
     471 | module_virtio_driver(virtio_crypto_driver);
         |                      ^~~~~~~~~~~~~~~~~~~~
   include/linux/device.h:1464:20: note: in definition of macro 'module_driver'
    1464 | static void __exit __driver##_exit(void) \
         |                    ^~~~~~~~
   drivers/crypto/virtio/virtio_crypto_core.c:471:1: note: in expansion of macro 'module_virtio_driver'
     471 | module_virtio_driver(virtio_crypto_driver);
         | ^~~~~~~~~~~~~~~~~~~~


vim +/cpu +116 drivers/crypto/virtio/virtio_crypto_common.h

   113	
   114	static inline int virtio_crypto_get_current_node(void)
   115	{
 > 116		int cpu, node;
   117	
   118		cpu = get_cpu();
   119		node = topology_physical_package_id(cpu);
   120		put_cpu();
   121	
   122		return node;
   123	}
   124	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: drivers/crypto/virtio/virtio_crypto_common.h:116:13: warning: variable 'cpu' set but not used
  2023-12-03 19:55 drivers/crypto/virtio/virtio_crypto_common.h:116:13: warning: variable 'cpu' set but not used kernel test robot
@ 2023-12-03 20:26 ` Michael S. Tsirkin
  2023-12-06 11:42   ` Gonglei (Arei)
  0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2023-12-03 20:26 UTC (permalink / raw)
  To: kernel test robot; +Cc: Gonglei, oe-kbuild-all, linux-kernel

On Mon, Dec 04, 2023 at 03:55:43AM +0800, kernel test robot wrote:
> Hi Gonglei,
> 
> FYI, the error/warning still remains.
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   33cc938e65a98f1d29d0a18403dbbee050dcad9a
> commit: dbaf0624ffa57ae6e7d87a823185ccd9a7852d3c crypto: add virtio-crypto driver
> date:   7 years ago
> config: x86_64-randconfig-015-20231011 (https://download.01.org/0day-ci/archive/20231204/202312040315.kPrI1OCE-lkp@intel.com/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231204/202312040315.kPrI1OCE-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202312040315.kPrI1OCE-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
>    In file included from drivers/crypto/virtio/virtio_crypto_algs.c:28:
>    drivers/crypto/virtio/virtio_crypto_common.h: In function 'virtio_crypto_get_current_node':
> >> drivers/crypto/virtio/virtio_crypto_common.h:116:13: warning: variable 'cpu' set but not used [-Wunused-but-set-variable]
>      116 |         int cpu, node;
>          |             ^~~
> --
>    In file included from drivers/crypto/virtio/virtio_crypto_core.c:25:
>    drivers/crypto/virtio/virtio_crypto_common.h: In function 'virtio_crypto_get_current_node':
> >> drivers/crypto/virtio/virtio_crypto_common.h:116:13: warning: variable 'cpu' set but not used [-Wunused-but-set-variable]
>      116 |         int cpu, node;
>          |             ^~~
>    In file included from drivers/crypto/virtio/virtio_crypto_core.c:20:
>    drivers/crypto/virtio/virtio_crypto_core.c: At top level:
>    include/linux/module.h:132:13: warning: 'init_module' specifies less restrictive attribute than its target 'virtio_crypto_driver_init': 'cold' [-Wmissing-attributes]
>      132 |         int init_module(void) __attribute__((alias(#initfn)));
>          |             ^~~~~~~~~~~
>    include/linux/device.h:1463:1: note: in expansion of macro 'module_init'
>     1463 | module_init(__driver##_init); \
>          | ^~~~~~~~~~~
>    include/linux/virtio.h:190:9: note: in expansion of macro 'module_driver'
>      190 |         module_driver(__virtio_driver, register_virtio_driver, \
>          |         ^~~~~~~~~~~~~
>    drivers/crypto/virtio/virtio_crypto_core.c:471:1: note: in expansion of macro 'module_virtio_driver'
>      471 | module_virtio_driver(virtio_crypto_driver);
>          | ^~~~~~~~~~~~~~~~~~~~
>    In file included from include/linux/virtio.h:8,
>                     from include/linux/virtio_config.h:6,
>                     from drivers/crypto/virtio/virtio_crypto_core.c:21:
>    drivers/crypto/virtio/virtio_crypto_core.c:471:22: note: 'init_module' target declared here
>      471 | module_virtio_driver(virtio_crypto_driver);
>          |                      ^~~~~~~~~~~~~~~~~~~~
>    include/linux/device.h:1459:19: note: in definition of macro 'module_driver'
>     1459 | static int __init __driver##_init(void) \
>          |                   ^~~~~~~~
>    drivers/crypto/virtio/virtio_crypto_core.c:471:1: note: in expansion of macro 'module_virtio_driver'
>      471 | module_virtio_driver(virtio_crypto_driver);
>          | ^~~~~~~~~~~~~~~~~~~~
>    include/linux/module.h:138:14: warning: 'cleanup_module' specifies less restrictive attribute than its target 'virtio_crypto_driver_exit': 'cold' [-Wmissing-attributes]
>      138 |         void cleanup_module(void) __attribute__((alias(#exitfn)));
>          |              ^~~~~~~~~~~~~~
>    include/linux/device.h:1468:1: note: in expansion of macro 'module_exit'
>     1468 | module_exit(__driver##_exit);
>          | ^~~~~~~~~~~
>    include/linux/virtio.h:190:9: note: in expansion of macro 'module_driver'
>      190 |         module_driver(__virtio_driver, register_virtio_driver, \
>          |         ^~~~~~~~~~~~~
>    drivers/crypto/virtio/virtio_crypto_core.c:471:1: note: in expansion of macro 'module_virtio_driver'
>      471 | module_virtio_driver(virtio_crypto_driver);
>          | ^~~~~~~~~~~~~~~~~~~~
>    drivers/crypto/virtio/virtio_crypto_core.c:471:22: note: 'cleanup_module' target declared here
>      471 | module_virtio_driver(virtio_crypto_driver);
>          |                      ^~~~~~~~~~~~~~~~~~~~
>    include/linux/device.h:1464:20: note: in definition of macro 'module_driver'
>     1464 | static void __exit __driver##_exit(void) \
>          |                    ^~~~~~~~
>    drivers/crypto/virtio/virtio_crypto_core.c:471:1: note: in expansion of macro 'module_virtio_driver'
>      471 | module_virtio_driver(virtio_crypto_driver);
>          | ^~~~~~~~~~~~~~~~~~~~
> 
> 
> vim +/cpu +116 drivers/crypto/virtio/virtio_crypto_common.h
> 
>    113	
>    114	static inline int virtio_crypto_get_current_node(void)
>    115	{
>  > 116		int cpu, node;
>    117	
>    118		cpu = get_cpu();
>    119		node = topology_physical_package_id(cpu);
>    120		put_cpu();
>    121	
>    122		return node;
>    123	}
>    124	
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

Seems easy to fix. Gonglei?

-- 
MST


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

* RE: drivers/crypto/virtio/virtio_crypto_common.h:116:13: warning: variable 'cpu' set but not used
  2023-12-03 20:26 ` Michael S. Tsirkin
@ 2023-12-06 11:42   ` Gonglei (Arei)
  0 siblings, 0 replies; 3+ messages in thread
From: Gonglei (Arei) @ 2023-12-06 11:42 UTC (permalink / raw)
  To: Michael S. Tsirkin, kernel test robot
  Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org



> -----Original Message-----
> From: Michael S. Tsirkin [mailto:mst@redhat.com]
> Sent: Monday, December 4, 2023 4:27 AM
> To: kernel test robot <lkp@intel.com>
> Cc: Gonglei (Arei) <arei.gonglei@huawei.com>; oe-kbuild-all@lists.linux.dev;
> linux-kernel@vger.kernel.org
> Subject: Re: drivers/crypto/virtio/virtio_crypto_common.h:116:13: warning:
> variable 'cpu' set but not used
> 
> On Mon, Dec 04, 2023 at 03:55:43AM +0800, kernel test robot wrote:
> > Hi Gonglei,
> >
> > FYI, the error/warning still remains.
> >
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> master
> > head:   33cc938e65a98f1d29d0a18403dbbee050dcad9a
> > commit: dbaf0624ffa57ae6e7d87a823185ccd9a7852d3c crypto: add
> virtio-crypto driver
> > date:   7 years ago
> > config: x86_64-randconfig-015-20231011
> > (https://download.01.org/0day-ci/archive/20231204/202312040315.kPrI1OC
> > E-lkp@intel.com/config)
> > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1
> > build):
> > (https://download.01.org/0day-ci/archive/20231204/202312040315.kPrI1OC
> > E-lkp@intel.com/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new
> > version of the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes:
> > | https://lore.kernel.org/oe-kbuild-all/202312040315.kPrI1OCE-lkp@inte
> > | l.com/
> >
> > All warnings (new ones prefixed by >>):
> >
> >    In file included from drivers/crypto/virtio/virtio_crypto_algs.c:28:
> >    drivers/crypto/virtio/virtio_crypto_common.h: In function
> 'virtio_crypto_get_current_node':
> > >> drivers/crypto/virtio/virtio_crypto_common.h:116:13: warning:
> > >> variable 'cpu' set but not used [-Wunused-but-set-variable]
> >      116 |         int cpu, node;
> >          |             ^~~
> > --
> >    In file included from drivers/crypto/virtio/virtio_crypto_core.c:25:
> >    drivers/crypto/virtio/virtio_crypto_common.h: In function
> 'virtio_crypto_get_current_node':
> > >> drivers/crypto/virtio/virtio_crypto_common.h:116:13: warning:
> > >> variable 'cpu' set but not used [-Wunused-but-set-variable]
> >      116 |         int cpu, node;
> >          |             ^~~

The warning occurs when CONFIG_SMG is not set. Will fix it later.


> >    In file included from drivers/crypto/virtio/virtio_crypto_core.c:20:
> >    drivers/crypto/virtio/virtio_crypto_core.c: At top level:
> >    include/linux/module.h:132:13: warning: 'init_module' specifies less
> restrictive attribute than its target 'virtio_crypto_driver_init': 'cold'
> [-Wmissing-attributes]
> >      132 |         int init_module(void) __attribute__((alias(#initfn)));
> >          |             ^~~~~~~~~~~
> >    include/linux/device.h:1463:1: note: in expansion of macro 'module_init'
> >     1463 | module_init(__driver##_init); \
> >          | ^~~~~~~~~~~
> >    include/linux/virtio.h:190:9: note: in expansion of macro 'module_driver'
> >      190 |         module_driver(__virtio_driver, register_virtio_driver, \
> >          |         ^~~~~~~~~~~~~
> >    drivers/crypto/virtio/virtio_crypto_core.c:471:1: note: in expansion of
> macro 'module_virtio_driver'
> >      471 | module_virtio_driver(virtio_crypto_driver);
> >          | ^~~~~~~~~~~~~~~~~~~~
> >    In file included from include/linux/virtio.h:8,
> >                     from include/linux/virtio_config.h:6,
> >                     from drivers/crypto/virtio/virtio_crypto_core.c:21:
> >    drivers/crypto/virtio/virtio_crypto_core.c:471:22: note: 'init_module'
> target declared here
> >      471 | module_virtio_driver(virtio_crypto_driver);
> >          |                      ^~~~~~~~~~~~~~~~~~~~
> >    include/linux/device.h:1459:19: note: in definition of macro
> 'module_driver'
> >     1459 | static int __init __driver##_init(void) \
> >          |                   ^~~~~~~~
> >    drivers/crypto/virtio/virtio_crypto_core.c:471:1: note: in expansion of
> macro 'module_virtio_driver'
> >      471 | module_virtio_driver(virtio_crypto_driver);
> >          | ^~~~~~~~~~~~~~~~~~~~
> >    include/linux/module.h:138:14: warning: 'cleanup_module' specifies less
> restrictive attribute than its target 'virtio_crypto_driver_exit': 'cold'
> [-Wmissing-attributes]
> >      138 |         void cleanup_module(void)
> __attribute__((alias(#exitfn)));
> >          |              ^~~~~~~~~~~~~~
> >    include/linux/device.h:1468:1: note: in expansion of macro 'module_exit'
> >     1468 | module_exit(__driver##_exit);
> >          | ^~~~~~~~~~~
> >    include/linux/virtio.h:190:9: note: in expansion of macro 'module_driver'
> >      190 |         module_driver(__virtio_driver, register_virtio_driver, \
> >          |         ^~~~~~~~~~~~~
> >    drivers/crypto/virtio/virtio_crypto_core.c:471:1: note: in expansion of
> macro 'module_virtio_driver'
> >      471 | module_virtio_driver(virtio_crypto_driver);
> >          | ^~~~~~~~~~~~~~~~~~~~
> >    drivers/crypto/virtio/virtio_crypto_core.c:471:22: note:
> 'cleanup_module' target declared here
> >      471 | module_virtio_driver(virtio_crypto_driver);
> >          |                      ^~~~~~~~~~~~~~~~~~~~
> >    include/linux/device.h:1464:20: note: in definition of macro
> 'module_driver'
> >     1464 | static void __exit __driver##_exit(void) \
> >          |                    ^~~~~~~~
> >    drivers/crypto/virtio/virtio_crypto_core.c:471:1: note: in expansion of
> macro 'module_virtio_driver'
> >      471 | module_virtio_driver(virtio_crypto_driver);
> >          | ^~~~~~~~~~~~~~~~~~~~
> >
Actually those warnings were fixed by upstream commit a6e60d84989.

> >
> > vim +/cpu +116 drivers/crypto/virtio/virtio_crypto_common.h
> >
> >    113
> >    114	static inline int virtio_crypto_get_current_node(void)
> >    115	{
> >  > 116		int cpu, node;
> >    117
> >    118		cpu = get_cpu();
> >    119		node = topology_physical_package_id(cpu);
> >    120		put_cpu();
> >    121
> >    122		return node;
> >    123	}
> >    124
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki
> 
> Seems easy to fix. Gonglei?
> 

Regards,
-Gonglei


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

end of thread, other threads:[~2023-12-06 11:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-03 19:55 drivers/crypto/virtio/virtio_crypto_common.h:116:13: warning: variable 'cpu' set but not used kernel test robot
2023-12-03 20:26 ` Michael S. Tsirkin
2023-12-06 11:42   ` Gonglei (Arei)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox