diff options
author | Mateusz Kulikowski <mateusz.kulikowski@gmail.com> | 2015-06-26 00:03:21 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-06-26 02:00:42 +0200 |
commit | 10895d2c82cce9650f7d34c81c1bd29958e15293 (patch) | |
tree | 2d5af9f5c96b954487c34bd389c834d86c44ec12 | |
parent | checkpatch: suggest using eth_zero_addr() and eth_broadcast_addr() (diff) | |
download | linux-10895d2c82cce9650f7d34c81c1bd29958e15293.tar.xz linux-10895d2c82cce9650f7d34c81c1bd29958e15293.zip |
checkpatch: add multi-line handling for PREFER_ETHER_ADDR_COPY
Handle multi-line memcpy() properly.
Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Acked-by: Joe Perches <joe@perches.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rwxr-xr-x | scripts/checkpatch.pl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a81fc66e62cc..dfeb553de798 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -5149,9 +5149,10 @@ sub process { # Check for memcpy(foo, bar, ETH_ALEN) that could be ether_addr_copy(foo, bar) if ($^V && $^V ge 5.10.0 && - $line =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/s) { + defined $stat && + $stat =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) { if (WARN("PREFER_ETHER_ADDR_COPY", - "Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)\n" . $herecurr) && + "Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)\n" . "$here\n$stat\n") && $fix) { $fixed[$fixlinenr] =~ s/\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/ether_addr_copy($2, $7)/; } |