From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org, Antti Palosaari <crope@iki.fi>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/2] [media] it913x: Improve three size determinations
Date: Sat, 16 Sep 2017 20:32:30 +0200 [thread overview]
Message-ID: <d3a7f3ed-1a5e-87f5-44fd-a6f242b219eb@users.sourceforge.net> (raw)
In-Reply-To: <0ad553a6-9aca-d20b-48df-4084d80e2223@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 16 Sep 2017 20:06:01 +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/tuners/it913x.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/media/tuners/it913x.c b/drivers/media/tuners/it913x.c
index 6af9507823fa..149f36d5e503 100644
--- a/drivers/media/tuners/it913x.c
+++ b/drivers/media/tuners/it913x.c
@@ -393,5 +393,5 @@ static int it913x_probe(struct platform_device *pdev)
const struct platform_device_id *id = platform_get_device_id(pdev);
char *chip_ver_str;
- dev = kzalloc(sizeof(struct it913x_dev), GFP_KERNEL);
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev)
@@ -404,8 +404,7 @@ static int it913x_probe(struct platform_device *pdev)
dev->role = pdata->role;
fe->tuner_priv = dev;
- memcpy(&fe->ops.tuner_ops, &it913x_tuner_ops,
- sizeof(struct dvb_tuner_ops));
+ memcpy(&fe->ops.tuner_ops, &it913x_tuner_ops, sizeof(it913x_tuner_ops));
platform_set_drvdata(pdev, dev);
if (dev->chip_ver == 1)
@@ -427,8 +426,7 @@ static int it913x_remove(struct platform_device *pdev)
struct dvb_frontend *fe = dev->fe;
dev_dbg(&pdev->dev, "\n");
-
- memset(&fe->ops.tuner_ops, 0, sizeof(struct dvb_tuner_ops));
+ memset(&fe->ops.tuner_ops, 0, sizeof(it913x_tuner_ops));
fe->tuner_priv = NULL;
kfree(dev);
--
2.14.1
prev parent reply other threads:[~2017-09-16 18:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-16 18:30 [PATCH 0/2] [media] IT913X: Adjustments for two function implementations SF Markus Elfring
2017-09-16 18:31 ` [PATCH 1/2] [media] it913x: Delete two error messages for a failed memory allocation in it913x_probe() SF Markus Elfring
2017-09-16 18:32 ` SF Markus Elfring [this message]
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=d3a7f3ed-1a5e-87f5-44fd-a6f242b219eb@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=crope@iki.fi \
--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
Powered by JetHome