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 1/3] ARM: dmabounce: Improve a size determination in two functions
Date: Thu, 1 Jun 2017 17:59:55 +0200	[thread overview]
Message-ID: <d78ce917-3920-7858-b866-48a61b1c8fc3@users.sourceforge.net> (raw)
In-Reply-To: <697e7810-d280-08f3-2a24-026ff41e15a3@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 1 Jun 2017 17:00:17 +0200

Replace the specification of two data structures by pointer dereferences
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>
---
 arch/arm/common/dmabounce.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c
index 9b1b7be2ec0e..fcdecb2de242 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -123,5 +123,5 @@ alloc_safe_buffer(struct dmabounce_device_info *device_info, void *ptr,
 		pool = NULL;
 	}
 
-	buf = kmalloc(sizeof(struct safe_buffer), GFP_ATOMIC);
+	buf = kmalloc(sizeof(*buf), GFP_ATOMIC);
 	if (buf == NULL) {
@@ -487,5 +487,5 @@ int dmabounce_register_dev(struct device *dev, unsigned long small_buffer_size,
 	struct dmabounce_device_info *device_info;
 	int ret;
 
-	device_info = kmalloc(sizeof(struct dmabounce_device_info), GFP_ATOMIC);
+	device_info = kmalloc(sizeof(*device_info), GFP_ATOMIC);
 	if (!device_info) {
-- 
2.13.0

  reply	other threads:[~2017-06-01 15:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 15:56 [PATCH 0/3] ARM: dmabounce: Adjustments for four function implementations SF Markus Elfring
2017-06-01 15:59 ` SF Markus Elfring [this message]
2017-06-01 16:00 ` [PATCH 2/3] ARM: dmabounce: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2017-06-01 16:02 ` [PATCH 3/3] ARM: dmabounce: Combine substrings for two messages 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=d78ce917-3920-7858-b866-48a61b1c8fc3@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).