linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: elfring@users.sourceforge.net (SF Markus Elfring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] coresight: etb10: Improve a size determination in etb_alloc_buffer()
Date: Fri, 12 May 2017 20:53:16 +0200	[thread overview]
Message-ID: <b8ed57f7-cdcf-9b35-4fdd-8833db008ff0@users.sourceforge.net> (raw)
In-Reply-To: <5d5cd752-f2f2-b511-6b1e-daf5bf1bc522@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 12 May 2017 20:36:03 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/hwtracing/coresight/coresight-etb10.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
index d5b96423e1a5..7096c4562e15 100644
--- a/drivers/hwtracing/coresight/coresight-etb10.c
+++ b/drivers/hwtracing/coresight/coresight-etb10.c
@@ -278,8 +278,7 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, int cpu,
 	if (cpu == -1)
 		cpu = smp_processor_id();
 	node = cpu_to_node(cpu);
-
-	buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node);
+	buf = kzalloc_node(sizeof(*buf), GFP_KERNEL, node);
 	if (!buf)
 		return NULL;
 
-- 
2.12.3

  parent reply	other threads:[~2017-05-12 18:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-12 18:50 [PATCH 0/3] CoreSight-ETB10: Adjustments for three function implementations SF Markus Elfring
2017-05-12 18:51 ` [PATCH 1/3] coresight: etb10: Delete an error message for a failed memory allocation in etb_probe() SF Markus Elfring
2017-05-15 17:44   ` Mathieu Poirier
2017-05-12 18:52 ` [PATCH 2/3] coresight: etb10: Fix a typo in a comment line SF Markus Elfring
2017-05-15 17:44   ` Mathieu Poirier
2017-05-12 18:53 ` SF Markus Elfring [this message]
2017-05-15 17:47   ` [PATCH 3/3] coresight: etb10: Improve a size determination in etb_alloc_buffer() Mathieu Poirier
2017-05-15 19:34     ` SF Markus Elfring

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=b8ed57f7-cdcf-9b35-4fdd-8833db008ff0@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).