public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org, Hans Verkuil <hverkuil@xs4all.nl>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/7] [media] saa7164: Improve a size determination in two functions
Date: Sun, 3 Sep 2017 22:32:03 +0200	[thread overview]
Message-ID: <76397eaa-9c30-af07-e7be-cecee2a9abc6@users.sourceforge.net> (raw)
In-Reply-To: <170abf7f-3b62-a37c-966a-8b574acae230@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 3 Sep 2017 17:53:05 +0200

Replace the specification of 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.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/pci/saa7164/saa7164-buffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/saa7164/saa7164-buffer.c b/drivers/media/pci/saa7164/saa7164-buffer.c
index 6bd665ea190d..c83b2e914dcb 100644
--- a/drivers/media/pci/saa7164/saa7164-buffer.c
+++ b/drivers/media/pci/saa7164/saa7164-buffer.c
@@ -98,5 +98,5 @@ struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_port *port,
 		goto ret;
 	}
 
-	buf = kzalloc(sizeof(struct saa7164_buffer), GFP_KERNEL);
+	buf = kzalloc(sizeof(*buf), GFP_KERNEL);
 	if (!buf)
@@ -281,5 +281,5 @@ struct saa7164_user_buffer *saa7164_buffer_alloc_user(struct saa7164_dev *dev,
 {
 	struct saa7164_user_buffer *buf;
 
-	buf = kzalloc(sizeof(struct saa7164_user_buffer), GFP_KERNEL);
+	buf = kzalloc(sizeof(*buf), GFP_KERNEL);
 	if (!buf)
-- 
2.14.1

  parent reply	other threads:[~2017-09-03 20:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-03 20:30 [PATCH 0/7] [media] SAA71..: Adjustments for four function implementations SF Markus Elfring
2017-09-03 20:31 ` [PATCH 1/7] [media] saa7164: Delete an error message for a failed memory allocation in saa7164_buffer_alloc() SF Markus Elfring
2017-09-03 20:32 ` SF Markus Elfring [this message]
2017-09-03 20:33 ` [PATCH 3/7] [media] Hexium Gemini: Delete an error message for a failed memory allocation in hexium_attach() SF Markus Elfring
2017-09-03 20:34 ` [PATCH 4/7] [media] Hexium Gemini: Improve a size determination " SF Markus Elfring
2017-09-03 20:35 ` [PATCH 5/7] [media] Hexium Orion: Delete an error message for a failed memory allocation in hexium_probe() SF Markus Elfring
2017-09-03 20:36 ` [PATCH 6/7] [media] Hexium Orion: Improve a size determination " SF Markus Elfring
2017-09-03 20:37 ` [PATCH 7/7] [media] Hexium Orion: Adjust one function call together with a variable assignment 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=76397eaa-9c30-af07-e7be-cecee2a9abc6@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /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