From: Joe Perches <joe@perches.com>
To: Alexey Dobriyan <adobriyan@gmail.com>, akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] checkpatch: Remove preference for alloc(sizeof(*p), ...)
Date: Mon, 22 May 2017 14:49:48 -0700 [thread overview]
Message-ID: <1495489788.2093.52.camel@perches.com> (raw)
In-Reply-To: <20170522213837.GA13861@avx2>
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
prev parent reply other threads:[~2017-05-22 21:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-22 21:38 [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form Alexey Dobriyan
2017-05-22 21:43 ` Joe Perches
2017-05-22 21:49 ` Randy Dunlap
2017-05-22 22:22 ` Andrew Morton
2017-05-22 22:41 ` Joe Perches
2017-05-24 10:18 ` Alexey Dobriyan
2017-05-25 10:35 ` Joe Perches
2017-05-25 10:46 ` Bernd Petrovitsch
2017-05-28 19:16 ` Pavel Machek
2017-05-22 21:49 ` Joe Perches [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1495489788.2093.52.camel@perches.com \
--to=joe@perches.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox