From: Mateusz Kulikowski Date: Thu, 25 Jun 2015 22:03:21 +0000 (-0700) Subject: checkpatch: add multi-line handling for PREFER_ETHER_ADDR_COPY X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=10895d2c82cce9650f7d34c81c1bd29958e15293;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git checkpatch: add multi-line handling for PREFER_ETHER_ADDR_COPY Handle multi-line memcpy() properly. Signed-off-by: Mateusz Kulikowski Acked-by: Joe Perches Cc: David Miller Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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)/; }