linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: vchiq_arm: change vchiq_platform_init from global to static
@ 2022-04-18 16:43 Tom Rix
  2022-04-18 22:58 ` kernel test robot
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Tom Rix @ 2022-04-18 16:43 UTC (permalink / raw)
  To: nsaenz, bcm-kernel-feedback-list, gregkh, stefan.wahren, gascoar,
	ojaswin98
  Cc: linux-rpi-kernel, linux-arm-kernel, linux-staging, linux-kernel, Tom Rix

Smatch reports this issue
vchiq_arm.c:466:5: warning: symbol 'vchiq_platform_init'
  was not declared. Should it be static?

vchiq_platform_init is only used in vchiq_arm.c.  Single
file variables should not be global so change
vchiq_platform_init's storage-class specifier to static.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 0596ac61e286..7de98655e8ec 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -463,7 +463,7 @@ free_pagelist(struct vchiq_pagelist_info *pagelistinfo,
 	cleanup_pagelistinfo(pagelistinfo);
 }
 
-int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state *state)
+static int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state *state)
 {
 	struct device *dev = &pdev->dev;
 	struct vchiq_drvdata *drvdata = platform_get_drvdata(pdev);
-- 
2.27.0


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

* Re: [PATCH] staging: vchiq_arm: change vchiq_platform_init from global to static
  2022-04-18 16:43 [PATCH] staging: vchiq_arm: change vchiq_platform_init from global to static Tom Rix
@ 2022-04-18 22:58 ` kernel test robot
  2022-04-18 23:19 ` kernel test robot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2022-04-18 22:58 UTC (permalink / raw)
  To: Tom Rix, nsaenz, bcm-kernel-feedback-list, gregkh, stefan.wahren,
	gascoar, ojaswin98
  Cc: kbuild-all, linux-rpi-kernel, linux-arm-kernel, linux-staging,
	linux-kernel, Tom Rix

Hi Tom,

I love your patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]

url:    https://github.com/intel-lab-lkp/linux/commits/Tom-Rix/staging-vchiq_arm-change-vchiq_platform_init-from-global-to-static/20220419-004611
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git bed6d200f8ca38e1ecbdd8fb7e0564884002abd1
config: sparc-randconfig-c004-20220417 (https://download.01.org/0day-ci/archive/20220419/202204190650.yy0x0YCl-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/192ca8cdfd692f17162557c64e8d533c816eccff
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Tom-Rix/staging-vchiq_arm-change-vchiq_platform_init-from-global-to-static/20220419-004611
        git checkout 192ca8cdfd692f17162557c64e8d533c816eccff
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sparc SHELL=/bin/bash drivers/staging/vc04_services/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/string.h:20,
                    from include/linux/bitmap.h:11,
                    from include/linux/cpumask.h:12,
                    from include/linux/mm_types_task.h:14,
                    from include/linux/mm_types.h:5,
                    from include/linux/buildid.h:5,
                    from include/linux/module.h:14,
                    from drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:8:
   In function 'memcpy_to_page',
       inlined from 'free_pagelist' at drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:434:4:
>> arch/sparc/include/asm/string.h:15:25: warning: argument 2 null where non-null expected [-Wnonnull]
      15 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:353:9: note: in expansion of macro 'memcpy'
     353 |         memcpy(to + offset, from, len);
         |         ^~~~~~
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c: In function 'free_pagelist':
   arch/sparc/include/asm/string.h:15:25: note: in a call to built-in function '__builtin_memcpy'
      15 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:353:9: note: in expansion of macro 'memcpy'
     353 |         memcpy(to + offset, from, len);
         |         ^~~~~~
   In function 'memcpy_to_page',
       inlined from 'free_pagelist' at drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:441:4:
   arch/sparc/include/asm/string.h:15:25: warning: '__builtin_memcpy' offset 0 is out of the bounds [0, 0] [-Warray-bounds]
      15 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:353:9: note: in expansion of macro 'memcpy'
     353 |         memcpy(to + offset, from, len);
         |         ^~~~~~


vim +15 arch/sparc/include/asm/string.h

70a6fcf3283a0a Al Viro 2016-01-17  13  
70a6fcf3283a0a Al Viro 2016-01-17  14  #define __HAVE_ARCH_MEMCPY
70a6fcf3283a0a Al Viro 2016-01-17 @15  #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
70a6fcf3283a0a Al Viro 2016-01-17  16  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [PATCH] staging: vchiq_arm: change vchiq_platform_init from global to static
  2022-04-18 16:43 [PATCH] staging: vchiq_arm: change vchiq_platform_init from global to static Tom Rix
  2022-04-18 22:58 ` kernel test robot
@ 2022-04-18 23:19 ` kernel test robot
  2022-04-19 12:14 ` Greg KH
  2022-04-22 14:44 ` Dan Carpenter
  3 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2022-04-18 23:19 UTC (permalink / raw)
  To: Tom Rix, nsaenz, bcm-kernel-feedback-list, gregkh, stefan.wahren,
	gascoar, ojaswin98
  Cc: kbuild-all, linux-rpi-kernel, linux-arm-kernel, linux-staging,
	linux-kernel, Tom Rix

Hi Tom,

I love your patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]

url:    https://github.com/intel-lab-lkp/linux/commits/Tom-Rix/staging-vchiq_arm-change-vchiq_platform_init-from-global-to-static/20220419-004611
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git bed6d200f8ca38e1ecbdd8fb7e0564884002abd1
config: parisc-buildonly-randconfig-r004-20220417 (https://download.01.org/0day-ci/archive/20220419/202204190737.qhFLAafo-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/192ca8cdfd692f17162557c64e8d533c816eccff
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Tom-Rix/staging-vchiq_arm-change-vchiq_platform_init-from-global-to-static/20220419-004611
        git checkout 192ca8cdfd692f17162557c64e8d533c816eccff
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=parisc SHELL=/bin/bash drivers/staging/vc04_services/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:16:
   In function 'memcpy_to_page',
       inlined from 'free_pagelist' at drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:434:4:
>> include/linux/highmem.h:353:9: warning: argument 2 null where non-null expected [-Wnonnull]
     353 |         memcpy(to + offset, from, len);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/string.h:20,
                    from include/linux/bitmap.h:11,
                    from include/linux/cpumask.h:12,
                    from include/linux/mm_types_task.h:14,
                    from include/linux/mm_types.h:5,
                    from include/linux/buildid.h:5,
                    from include/linux/module.h:14,
                    from drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:8:
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c: In function 'free_pagelist':
   arch/parisc/include/asm/string.h:9:8: note: in a call to function 'memcpy' declared 'nonnull'
       9 | void * memcpy(void * dest,const void *src,size_t count);
         |        ^~~~~~
   In file included from drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:16:
   In function 'memcpy_to_page',
       inlined from 'free_pagelist' at drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:441:4:
>> include/linux/highmem.h:353:9: warning: 'memcpy' offset 0 is out of the bounds [0, 0] [-Warray-bounds]
     353 |         memcpy(to + offset, from, len);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +353 include/linux/highmem.h

bb90d4bc7b6a53 Ira Weiny         2021-02-09  346  
bb90d4bc7b6a53 Ira Weiny         2021-02-09  347  static inline void memcpy_to_page(struct page *page, size_t offset,
bb90d4bc7b6a53 Ira Weiny         2021-02-09  348  				  const char *from, size_t len)
bb90d4bc7b6a53 Ira Weiny         2021-02-09  349  {
61b205f579911a Ira Weiny         2021-02-09  350  	char *to = kmap_local_page(page);
bb90d4bc7b6a53 Ira Weiny         2021-02-09  351  
ca18f6ea012bf3 Ira Weiny         2021-02-10  352  	VM_BUG_ON(offset + len > PAGE_SIZE);
bb90d4bc7b6a53 Ira Weiny         2021-02-09 @353  	memcpy(to + offset, from, len);
8dad53a11f8d94 Christoph Hellwig 2021-07-23  354  	flush_dcache_page(page);
61b205f579911a Ira Weiny         2021-02-09  355  	kunmap_local(to);
bb90d4bc7b6a53 Ira Weiny         2021-02-09  356  }
bb90d4bc7b6a53 Ira Weiny         2021-02-09  357  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [PATCH] staging: vchiq_arm: change vchiq_platform_init from global to static
  2022-04-18 16:43 [PATCH] staging: vchiq_arm: change vchiq_platform_init from global to static Tom Rix
  2022-04-18 22:58 ` kernel test robot
  2022-04-18 23:19 ` kernel test robot
@ 2022-04-19 12:14 ` Greg KH
  2022-04-22 14:44 ` Dan Carpenter
  3 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2022-04-19 12:14 UTC (permalink / raw)
  To: Tom Rix
  Cc: nsaenz, bcm-kernel-feedback-list, stefan.wahren, gascoar,
	ojaswin98, linux-rpi-kernel, linux-arm-kernel, linux-staging,
	linux-kernel

On Mon, Apr 18, 2022 at 12:43:56PM -0400, Tom Rix wrote:
> Smatch reports this issue
> vchiq_arm.c:466:5: warning: symbol 'vchiq_platform_init'
>   was not declared. Should it be static?

Error messages can all go on one line.

> vchiq_platform_init is only used in vchiq_arm.c.  Single
> file variables should not be global so change
> vchiq_platform_init's storage-class specifier to static.

You have a full 72 columns, please use them.

> 
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index 0596ac61e286..7de98655e8ec 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -463,7 +463,7 @@ free_pagelist(struct vchiq_pagelist_info *pagelistinfo,
>  	cleanup_pagelistinfo(pagelistinfo);
>  }
>  
> -int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state *state)
> +static int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state *state)
>  {
>  	struct device *dev = &pdev->dev;
>  	struct vchiq_drvdata *drvdata = platform_get_drvdata(pdev);
> -- 
> 2.27.0
> 
> 

Always test build your patches.  To not do so is a bit rude, don't you
think?

{sigh}

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

* Re: [PATCH] staging: vchiq_arm: change vchiq_platform_init from global to static
  2022-04-18 16:43 [PATCH] staging: vchiq_arm: change vchiq_platform_init from global to static Tom Rix
                   ` (2 preceding siblings ...)
  2022-04-19 12:14 ` Greg KH
@ 2022-04-22 14:44 ` Dan Carpenter
  2022-04-22 15:32   ` Tom Rix
  3 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2022-04-22 14:44 UTC (permalink / raw)
  To: Tom Rix
  Cc: nsaenz, bcm-kernel-feedback-list, gregkh, stefan.wahren, gascoar,
	ojaswin98, linux-rpi-kernel, linux-arm-kernel, linux-staging,
	linux-kernel

On Mon, Apr 18, 2022 at 12:43:56PM -0400, Tom Rix wrote:
> Smatch reports this issue
> vchiq_arm.c:466:5: warning: symbol 'vchiq_platform_init'
>   was not declared. Should it be static?

This is a Sparse warning, not Smatch.

Use this command for Smatch
~/smatch/smatch_scripts/kchecker drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c

And this command for Sparse
~/smatch/smatch_scripts/kchecker --sparse drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c

regards,
dan carpenter


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

* Re: [PATCH] staging: vchiq_arm: change vchiq_platform_init from global to static
  2022-04-22 14:44 ` Dan Carpenter
@ 2022-04-22 15:32   ` Tom Rix
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Rix @ 2022-04-22 15:32 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: nsaenz, bcm-kernel-feedback-list, gregkh, stefan.wahren, gascoar,
	ojaswin98, linux-rpi-kernel, linux-arm-kernel, linux-staging,
	linux-kernel


On 4/22/22 7:44 AM, Dan Carpenter wrote:
> On Mon, Apr 18, 2022 at 12:43:56PM -0400, Tom Rix wrote:
>> Smatch reports this issue
>> vchiq_arm.c:466:5: warning: symbol 'vchiq_platform_init'
>>    was not declared. Should it be static?
> This is a Sparse warning, not Smatch.

Yes, this is correct.

Though I am using

make CC=cgcc

And forgot which one I had installed last.

Tom

>
> Use this command for Smatch
> ~/smatch/smatch_scripts/kchecker drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>
> And this command for Sparse
> ~/smatch/smatch_scripts/kchecker --sparse drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>
> regards,
> dan carpenter
>


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

end of thread, other threads:[~2022-04-22 15:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18 16:43 [PATCH] staging: vchiq_arm: change vchiq_platform_init from global to static Tom Rix
2022-04-18 22:58 ` kernel test robot
2022-04-18 23:19 ` kernel test robot
2022-04-19 12:14 ` Greg KH
2022-04-22 14:44 ` Dan Carpenter
2022-04-22 15:32   ` Tom Rix

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