Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1647426

[PATCH] checkpatch: Remove preference for alloc(sizeof(*p), ...)

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject [PATCH] checkpatch: Remove preference for alloc(sizeof(*p), ...)
Date 2017-05-23 00:00 +0200
Message-ID <tK3wR-2DV-1@gated-at.bofh.it> (permalink)
References <tK3dw-2wK-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This style has some negatives and positives and is not univerally
accepted so checkpatch should not warn on it one way or another.

Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5b0f57fce9b8..ba45638555d4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5927,14 +5927,6 @@ sub process {
 			     "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
 		}
 
-# alloc style
-# p = alloc(sizeof(struct foo), ...) should be p = alloc(sizeof(*p), ...)
-		if ($^V && $^V ge 5.10.0 &&
-		    $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*([kv][mz]alloc(?:_node)?)\s*\(\s*(sizeof\s*\(\s*struct\s+$Lval\s*\))/) {
-			CHK("ALLOC_SIZEOF_STRUCT",
-			    "Prefer $3(sizeof(*$1)...) over $3($4...)\n" . $herecurr);
-		}
-
 # check for k[mz]alloc with multiplies that could be kmalloc_array/kcalloc
 		if ($^V && $^V ge 5.10.0 &&
 		    defined $stat &&
-- 
2.10.0.rc2.1.g053435c

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred  allocation form Alexey Dobriyan <adobriyan@gmail.com> - 2017-05-22 23:40 +0200
  Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred  allocation form Randy Dunlap <rdunlap@infradead.org> - 2017-05-22 23:50 +0200
  Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as  preferred allocation form Joe Perches <joe@perches.com> - 2017-05-22 23:50 +0200
    Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as  preferred allocation form Andrew Morton <akpm@linux-foundation.org> - 2017-05-23 00:30 +0200
      Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as  preferred allocation form Joe Perches <joe@perches.com> - 2017-05-23 00:50 +0200
      Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred  allocation form Alexey Dobriyan <adobriyan@gmail.com> - 2017-05-24 12:20 +0200
  [PATCH] checkpatch: Remove preference for alloc(sizeof(*p), ...) Joe Perches <joe@perches.com> - 2017-05-23 00:00 +0200

csiph-web