linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: false positives with checkpatch
       [not found] <1438959684.17630.4.camel@linux.intel.com>
@ 2015-08-07 15:37 ` Joe Perches
  2015-08-07 16:12   ` Andy Whitcroft
  2015-08-07 18:07   ` Ross Zwisler
  0 siblings, 2 replies; 3+ messages in thread
From: Joe Perches @ 2015-08-07 15:37 UTC (permalink / raw)
  To: Ross Zwisler; +Cc: Andy Whitcroft, LKML, sparse, Linus Torvalds

On Fri, 2015-08-07 at 09:01 -0600, Ross Zwisler wrote:
> When running checkpatch.pl against my latest patch set, I hit what I think are
> two false positives.  Here are the related lines:
> 
> 	+static inline void flush_cache_pmem(void __pmem *addr, size_t size)
> 	+{
> 	+       if (arch_has_pmem_api())
> 	+               arch_flush_cache_pmem(addr, size);
> 	+}
> 
> The error was:
> 
> 	ERROR: need consistent spacing around '*' (ctx:WxV)
> 	#88: FILE: include/linux/pmem.h:167:
> 	+static inline void flush_cache_pmem(void __pmem *addr, size_t size)
> 							 ^
> The (void __annotation *variable) syntax is correct, I believe, and is used
> consistently for both __iomem and __pmem annotations.

checkpatch doesn't know what a __pmem is.
Neither did I until a second ago.

Are there any other sparse annotations that were
added by this subsystem? (I don't notice any)

They need to be added to checkpatch's $Sparse use
so there's a patch proposal below this.

It looks like compiler.h's #define __safe is unused
in the linux kernel and it could be deleted as it's
not a gcc attribute.

Does anyone know?

Linus' commit is unrevealing.

commit e6b8f25bd950947d06c59432cbafd320dda66abf
Author: Linus Torvalds <torvalds@evo.osdl.org>
Date:   Fri Apr 16 03:49:32 2004 -0700

    Add sparse __safe annotation

---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index fd8e502..6362ec3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -264,6 +264,7 @@ our $Sparse	= qr{
 			__kernel|
 			__force|
 			__iomem|
+			__pmem|
 			__must_check|
 			__init_refok|
 			__kprobes|



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

* Re: false positives with checkpatch
  2015-08-07 15:37 ` false positives with checkpatch Joe Perches
@ 2015-08-07 16:12   ` Andy Whitcroft
  2015-08-07 18:07   ` Ross Zwisler
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Whitcroft @ 2015-08-07 16:12 UTC (permalink / raw)
  To: Joe Perches; +Cc: Ross Zwisler, LKML, sparse, Linus Torvalds

On Fri, Aug 07, 2015 at 08:37:47AM -0700, Joe Perches wrote:
> On Fri, 2015-08-07 at 09:01 -0600, Ross Zwisler wrote:
> > When running checkpatch.pl against my latest patch set, I hit what I think are
> > two false positives.  Here are the related lines:
> > 
> > 	+static inline void flush_cache_pmem(void __pmem *addr, size_t size)
> > 	+{
> > 	+       if (arch_has_pmem_api())
> > 	+               arch_flush_cache_pmem(addr, size);
> > 	+}
> > 
> > The error was:
> > 
> > 	ERROR: need consistent spacing around '*' (ctx:WxV)
> > 	#88: FILE: include/linux/pmem.h:167:
> > 	+static inline void flush_cache_pmem(void __pmem *addr, size_t size)
> > 							 ^
> > The (void __annotation *variable) syntax is correct, I believe, and is used
> > consistently for both __iomem and __pmem annotations.
> 
> checkpatch doesn't know what a __pmem is.
> Neither did I until a second ago.
> 
> Are there any other sparse annotations that were
> added by this subsystem? (I don't notice any)
> 
> They need to be added to checkpatch's $Sparse use
> so there's a patch proposal below this.
> 
> It looks like compiler.h's #define __safe is unused
> in the linux kernel and it could be deleted as it's
> not a gcc attribute.
> 
> Does anyone know?
> 
> Linus' commit is unrevealing.
> 
> commit e6b8f25bd950947d06c59432cbafd320dda66abf
> Author: Linus Torvalds <torvalds@evo.osdl.org>
> Date:   Fri Apr 16 03:49:32 2004 -0700
> 
>     Add sparse __safe annotation
> 
> ---
>  scripts/checkpatch.pl | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index fd8e502..6362ec3 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -264,6 +264,7 @@ our $Sparse	= qr{
>  			__kernel|
>  			__force|
>  			__iomem|
> +			__pmem|
>  			__must_check|
>  			__init_refok|
>  			__kprobes|

Looks good to me.

-apw

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

* Re: false positives with checkpatch
  2015-08-07 15:37 ` false positives with checkpatch Joe Perches
  2015-08-07 16:12   ` Andy Whitcroft
@ 2015-08-07 18:07   ` Ross Zwisler
  1 sibling, 0 replies; 3+ messages in thread
From: Ross Zwisler @ 2015-08-07 18:07 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andy Whitcroft, LKML, sparse, Linus Torvalds

On Fri, 2015-08-07 at 08:37 -0700, Joe Perches wrote:
> On Fri, 2015-08-07 at 09:01 -0600, Ross Zwisler wrote:
> > When running checkpatch.pl against my latest patch set, I hit what I think are
> > two false positives.  Here are the related lines:
> > 
> > 	+static inline void flush_cache_pmem(void __pmem *addr, size_t size)
> > 	+{
> > 	+       if (arch_has_pmem_api())
> > 	+               arch_flush_cache_pmem(addr, size);
> > 	+}
> > 
> > The error was:
> > 
> > 	ERROR: need consistent spacing around '*' (ctx:WxV)
> > 	#88: FILE: include/linux/pmem.h:167:
> > 	+static inline void flush_cache_pmem(void __pmem *addr, size_t size)
> > 							 ^
> > The (void __annotation *variable) syntax is correct, I believe, and is used
> > consistently for both __iomem and __pmem annotations.
> 
> checkpatch doesn't know what a __pmem is.
> Neither did I until a second ago.
> 
> Are there any other sparse annotations that were
> added by this subsystem? (I don't notice any)

This was the only sparse annotation that we added.

> ---
>  scripts/checkpatch.pl | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index fd8e502..6362ec3 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -264,6 +264,7 @@ our $Sparse	= qr{
>  			__kernel|
>  			__force|
>  			__iomem|
> +			__pmem|
>  			__must_check|
>  			__init_refok|
>  			__kprobes|

Yep, this works for me.

Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>



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

end of thread, other threads:[~2015-08-07 18:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1438959684.17630.4.camel@linux.intel.com>
2015-08-07 15:37 ` false positives with checkpatch Joe Perches
2015-08-07 16:12   ` Andy Whitcroft
2015-08-07 18:07   ` Ross Zwisler

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