linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org,
	Arvind Yadav <arvind.yadav.cs@gmail.com>,
	Bhumika Goyal <bhumirks@gmail.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Mike Isely <isely@pobox.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 3/5] [media] s2255drv: Improve two size determinations in s2255_probe()
Date: Wed, 20 Sep 2017 19:00:00 +0200	[thread overview]
Message-ID: <4d151c18-662f-aabf-7f03-9c3cbb05b1ef@users.sourceforge.net> (raw)
In-Reply-To: <55718a41-d76f-36bf-7197-db92014dcd3c@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 20 Sep 2017 16:56:20 +0200

Replace the specification of data structures by variable references
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/media/usb/s2255/s2255drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index aee83bf6fa94..29bc73ad7d8a 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -2237,4 +2237,4 @@ static int s2255_probe(struct usb_interface *interface,
 	/* allocate memory for our device state and initialize it to zero */
-	dev = kzalloc(sizeof(struct s2255_dev), GFP_KERNEL);
+	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 	if (!dev)
 		return -ENOMEM;
@@ -2247,4 +2247,4 @@ static int s2255_probe(struct usb_interface *interface,
 	dev->pid = id->idProduct;
-	dev->fw_data = kzalloc(sizeof(struct s2255_fw), GFP_KERNEL);
+	dev->fw_data = kzalloc(sizeof(*dev->fw_data), GFP_KERNEL);
 	if (!dev->fw_data)
 		goto errorFWDATA1;
-- 
2.14.1

  parent reply	other threads:[~2017-09-20 17:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20 16:55 [PATCH 0/5] [media] s2255drv: Fine-tuning for some function implementations SF Markus Elfring
2017-09-20 16:57 ` [PATCH 1/5] [media] s2255drv: Delete three error messages for a failed memory allocation in s2255_probe() SF Markus Elfring
2017-09-20 16:58 ` [PATCH 2/5] [media] s2255drv: Adjust 13 checks for null pointers SF Markus Elfring
2017-09-20 23:07   ` Dan Carpenter
2017-09-21  8:12     ` SF Markus Elfring
2017-09-21  9:22       ` Dan Carpenter
2017-09-21 11:23         ` SF Markus Elfring
2017-09-20 17:00 ` SF Markus Elfring [this message]
2017-09-20 17:01 ` [PATCH 4/5] [media] s2255drv: Use common error handling code in read_pipe_completion() SF Markus Elfring
2017-09-20 17:02 ` [PATCH 5/5] [media] s2255drv: Delete an unnecessary return statement in five functions 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=4d151c18-662f-aabf-7f03-9c3cbb05b1ef@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=bhumirks@gmail.com \
    --cc=isely@pobox.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --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;
as well as URLs for NNTP newsgroup(s).