All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: warn about incorrect __initdata placement
@ 2013-09-30 13:23 Bartlomiej Zolnierkiewicz
  2013-09-30 15:50 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-09-30 13:23 UTC (permalink / raw
  To: Andy Whitcroft; +Cc: Joe Perches, linux-kernel, Kyungmin Park

__initdata tag should be placed between the variable name and equal
sign for the variable to be placed in the intended .init.data section.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 23d55bf..88d07a6 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4275,6 +4275,12 @@ sub process {
 			WARN("EXPORTED_WORLD_WRITABLE",
 			     "Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr);
 		}
+
+# check for incorrect __initdata placement
+		if ($line =~ /\bstruct\s+__initdata.*\=/) {
+			WARN("INITDATA_PLACEMENT",
+			     "__initdata tag should be placed between the variable name and equal sign\n" . $herecurr);
+		}
 	}
 
 	# If we have no input at all, then there is nothing to report on
-- 
1.8.2.3



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

* Re: [PATCH] checkpatch: warn about incorrect __initdata placement
  2013-09-30 13:23 [PATCH] checkpatch: warn about incorrect __initdata placement Bartlomiej Zolnierkiewicz
@ 2013-09-30 15:50 ` Joe Perches
  2013-09-30 17:11   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2013-09-30 15:50 UTC (permalink / raw
  To: Bartlomiej Zolnierkiewicz; +Cc: Andy Whitcroft, linux-kernel, Kyungmin Park

On Mon, 2013-09-30 at 15:23 +0200, Bartlomiej Zolnierkiewicz wrote:
> __initdata tag should be placed between the variable name and equal
> sign for the variable to be placed in the intended .init.data section.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -4275,6 +4275,12 @@ sub process {
[]
> +# check for incorrect __initdata placement
> +		if ($line =~ /\bstruct\s+__initdata.*\=/) {
> +			WARN("INITDATA_PLACEMENT",
> +			     "__initdata tag should be placed between the variable name and equal sign\n" . $herecurr);
> +		}

Hello Bartlomiej

I believe that -next commit 12de1c1ad0df
("checkpatch: add rules to check init attribute and const defects")

which adds $InitAttribute already does this test.

Anyway, this should be:
	if ($line =~ /\b(struct|union)\s+$InitAttribute.*=/) {

and please add this test adjacent to the other $InitAttribute
tests only if it's not already covered by the first bit added
by that commit below (again, I believe it is):

------------------------

# check for bad placement of section $InitAttribute (e.g.: __initdata)
		if ($line =~ /(\b$InitAttribute\b)/) {
			my $attr = $1;
			if ($line =~ /^\+\s*static\s+(?:const\s+)?(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Ident(?:\[[^]]*\])?)\s*[=;]/) {



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

* Re: [PATCH] checkpatch: warn about incorrect __initdata placement
  2013-09-30 15:50 ` Joe Perches
@ 2013-09-30 17:11   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-09-30 17:11 UTC (permalink / raw
  To: Joe Perches; +Cc: Andy Whitcroft, linux-kernel, Kyungmin Park


Hi,

On Monday, September 30, 2013 08:50:23 AM Joe Perches wrote:
> On Mon, 2013-09-30 at 15:23 +0200, Bartlomiej Zolnierkiewicz wrote:
> > __initdata tag should be placed between the variable name and equal
> > sign for the variable to be placed in the intended .init.data section.
> []
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
> > @@ -4275,6 +4275,12 @@ sub process {
> []
> > +# check for incorrect __initdata placement
> > +		if ($line =~ /\bstruct\s+__initdata.*\=/) {
> > +			WARN("INITDATA_PLACEMENT",
> > +			     "__initdata tag should be placed between the variable name and equal sign\n" . $herecurr);
> > +		}
> 
> Hello Bartlomiej
> 
> I believe that -next commit 12de1c1ad0df
> ("checkpatch: add rules to check init attribute and const defects")
> 
> which adds $InitAttribute already does this test.
> 
> Anyway, this should be:
> 	if ($line =~ /\b(struct|union)\s+$InitAttribute.*=/) {
> 
> and please add this test adjacent to the other $InitAttribute
> tests only if it's not already covered by the first bit added
> by that commit below (again, I believe it is):
> 
> ------------------------
> 
> # check for bad placement of section $InitAttribute (e.g.: __initdata)
> 		if ($line =~ /(\b$InitAttribute\b)/) {
> 			my $attr = $1;
> 			if ($line =~ /^\+\s*static\s+(?:const\s+)?(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Ident(?:\[[^]]*\])?)\s*[=;]/) {

It seems that a bit earlier patch which was merged for v3.12-rc1 (commit
8716de3 "checkpatch: add test for positional misuse of section specifiers
like __initdata" from September 11) already covers detection of the wrong
placement of __initdata (it was even inspired by the same EXYNOS4 code
issues as mine patch). I originally did my patch on August 30 so commit
8716de3 wasn't there yet, now it is all covered up nicely in the upstream.
Thanks for the work on this and sorry for the noise.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


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

end of thread, other threads:[~2013-09-30 17:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-30 13:23 [PATCH] checkpatch: warn about incorrect __initdata placement Bartlomiej Zolnierkiewicz
2013-09-30 15:50 ` Joe Perches
2013-09-30 17:11   ` Bartlomiej Zolnierkiewicz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.