From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org,
Hans Verkuil <hans.verkuil@cisco.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 3/6] [media] go7007: Improve a size determination in four functions
Date: Mon, 18 Sep 2017 15:56:25 +0200 [thread overview]
Message-ID: <092d6885-5101-73b2-bb69-42873d940369@users.sourceforge.net> (raw)
In-Reply-To: <b36ece3f-0f31-9bb6-14ae-c4abf7cd23ee@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 18 Sep 2017 11:27:30 +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/usb/go7007/go7007-driver.c | 2 +-
drivers/media/usb/go7007/go7007-usb.c | 2 +-
drivers/media/usb/go7007/s2250-board.c | 2 +-
drivers/media/usb/go7007/snd-go7007.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/usb/go7007/go7007-driver.c b/drivers/media/usb/go7007/go7007-driver.c
index 390f66ec8fd2..f8c06b2f9d2f 100644
--- a/drivers/media/usb/go7007/go7007-driver.c
+++ b/drivers/media/usb/go7007/go7007-driver.c
@@ -699,5 +699,5 @@ struct go7007 *go7007_alloc(const struct go7007_board_info *board,
struct go7007 *go;
int i;
- go = kzalloc(sizeof(struct go7007), GFP_KERNEL);
+ go = kzalloc(sizeof(*go), GFP_KERNEL);
if (!go)
diff --git a/drivers/media/usb/go7007/go7007-usb.c b/drivers/media/usb/go7007/go7007-usb.c
index 5ad40b77763d..f0f70a92541a 100644
--- a/drivers/media/usb/go7007/go7007-usb.c
+++ b/drivers/media/usb/go7007/go7007-usb.c
@@ -1122,5 +1122,5 @@ static int go7007_usb_probe(struct usb_interface *intf,
if (!go)
return -ENOMEM;
- usb = kzalloc(sizeof(struct go7007_usb), GFP_KERNEL);
+ usb = kzalloc(sizeof(*usb), GFP_KERNEL);
if (!usb) {
diff --git a/drivers/media/usb/go7007/s2250-board.c b/drivers/media/usb/go7007/s2250-board.c
index d987c5f2b45a..1fd4c09dd516 100644
--- a/drivers/media/usb/go7007/s2250-board.c
+++ b/drivers/media/usb/go7007/s2250-board.c
@@ -515,5 +515,5 @@ static int s2250_probe(struct i2c_client *client,
if (!audio)
return -ENOMEM;
- state = kzalloc(sizeof(struct s2250), GFP_KERNEL);
+ state = kzalloc(sizeof(*state), GFP_KERNEL);
if (!state) {
diff --git a/drivers/media/usb/go7007/snd-go7007.c b/drivers/media/usb/go7007/snd-go7007.c
index 4e612cf1afd9..68e421bf38e1 100644
--- a/drivers/media/usb/go7007/snd-go7007.c
+++ b/drivers/media/usb/go7007/snd-go7007.c
@@ -235,5 +235,5 @@ int go7007_snd_init(struct go7007 *go)
dev++;
return -ENOENT;
}
- gosnd = kmalloc(sizeof(struct go7007_snd), GFP_KERNEL);
+ gosnd = kmalloc(sizeof(*gosnd), GFP_KERNEL);
if (!gosnd)
--
2.14.1
next prev parent reply other threads:[~2017-09-18 13:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-18 13:52 [PATCH 0/6] [media] Go7007: Adjustments for some function implementations SF Markus Elfring
2017-09-18 13:53 ` [PATCH 1/6] [media] go7007: Delete an error message for a failed memory allocation in go7007_load_encoder() SF Markus Elfring
2017-09-18 13:55 ` [PATCH 2/6] [media] go7007: Adjust 35 checks for null pointers SF Markus Elfring
2017-09-18 13:56 ` SF Markus Elfring [this message]
2017-09-18 13:57 ` [PATCH 4/6] [media] go7007: Use common error handling code in s2250_probe() SF Markus Elfring
2017-09-19 8:42 ` Dan Carpenter
2017-09-20 7:09 ` SF Markus Elfring
2017-09-20 9:12 ` Dan Carpenter
2017-09-18 13:58 ` [PATCH 5/6] [media] go7007: Use common error handling code in go7007_snd_init() SF Markus Elfring
2017-09-19 8:49 ` Dan Carpenter
2017-09-18 14:00 ` [PATCH 6/6] [media] go7007: Delete an unnecessary variable initialisation " 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=092d6885-5101-73b2-bb69-42873d940369@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=hans.verkuil@cisco.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@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;
as well as URLs for NNTP newsgroup(s).