Skip to contentSkip to conversation

checkpatch: add hwaddr to @typeList

PATCH Applied Greg Kurz 2 participants 2 messages Sep 14, 2017 – Sep 15, 2017 Checkpatch

v1 of 3 Applied Latest is v3 →

lore
Share & tools
lore

Greg Kurz

author
#0 lore raw

PATCH 1/1 checkpatch: add hwaddr to @typeList

The script doesn't know about all possible types and learn them as it parses the code. If it reaches a line with a type cast but the type isn't known yet, it is misinterpreted as an identifier.

For example the following line:

    foo = (hwaddr) -1;

results in the following false-positive to be reported:

ERROR: spaces required around that '-' (ctx:VxV)

Let's add this standard QEMU type to the list of pre-known types.

---

checkpatch doesn't have an official maintainer, Cc'ing David in case he agrees to carry this patch through his ppc tree, along with:

https://lists.nongnu.org/archive/html/qemu-devel/2017-09/msg03686.html

 scripts/checkpatch.pl |    1 +
 1 file changed, 1 insertion(+)
scripts/checkpatch.pl +1 -0
index fa478074b88d..def5bc1cc0e1 100755
@@ -213,6 +213,7 @@ our @typeList = (
 	qr{${Ident}_handler},
 	qr{${Ident}_handler_fn},
 	qr{target_(?:u)?long},
+	qr{hwaddr},
 );
 
 # This can be modified by sub possible.  Since it can be empty, be careful
#1 lore raw
Quoted 31 lines · Greg Kurz

The script doesn't know about all possible types and learn them as it parses the code. If it reaches a line with a type cast but the type isn't known yet, it is misinterpreted as an identifier.

For example the following line:

    foo = (hwaddr) -1;

results in the following false-positive to be reported:

ERROR: spaces required around that '-' (ctx:VxV)

Let's add this standard QEMU type to the list of pre-known types.

---

checkpatch doesn't have an official maintainer, Cc'ing David in case he agrees to carry this patch through his ppc tree, along with:

https://lists.nongnu.org/archive/html/qemu-devel/2017-09/msg03686.html

 scripts/checkpatch.pl |    1 +
 1 file changed, 1 insertion(+)
scripts/checkpatch.pl +0 -0
index fa478074b88d..def5bc1cc0e1 100755

scripts/checkpatch.pl our @typeList = ( · line 219

Quoted 7 lines
scripts/checkpatch.pl +1 -0
@@ -213,6 +213,7 @@ our @typeList = (
 	qr{${Ident}_handler},
 	qr{${Ident}_handler_fn},
 	qr{target_(?:u)?long},
+	qr{hwaddr},
 );
 
 # This can be modified by sub possible.  Since it can be empty, be careful

Queued, thanks.

Paolo