mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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] tda18212: Improve three size determinations
Date: Sun, 17 Sep 2017 10:20:55 +0200	[thread overview]
Message-ID: <e3688a0e-1970-c7ff-fdf8-d943bf4bb8e2@users.sourceforge.net> (raw)
In-Reply-To: <eb35c033-46b3-4fd6-8398-f1e3869a67a8@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 17 Sep 2017 09:42:17 +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/tda18212.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/media/tuners/tda18212.c b/drivers/media/tuners/tda18212.c
index 8f89d52cd39c..16a90d75f7d4 100644
--- a/drivers/media/tuners/tda18212.c
+++ b/drivers/media/tuners/tda18212.c
@@ -207,6 +207,6 @@ static int tda18212_probe(struct i2c_client *client,
 	}
 
-	memcpy(&dev->cfg, cfg, sizeof(struct tda18212_config));
+	memcpy(&dev->cfg, cfg, sizeof(*cfg));
 	dev->client = client;
 	dev->regmap = devm_regmap_init_i2c(client, &regmap_config);
 	if (IS_ERR(dev->regmap)) {
@@ -244,7 +244,7 @@ static int tda18212_probe(struct i2c_client *client,
 
 	fe->tuner_priv = dev;
 	memcpy(&fe->ops.tuner_ops, &tda18212_tuner_ops,
-			sizeof(struct dvb_tuner_ops));
+	       sizeof(fe->ops.tuner_ops));
 	i2c_set_clientdata(client, dev);
 
 	return 0;
@@ -261,8 +261,7 @@ static int tda18212_remove(struct i2c_client *client)
 	struct dvb_frontend *fe = dev->cfg.fe;
 
 	dev_dbg(&client->dev, "\n");
-
-	memset(&fe->ops.tuner_ops, 0, sizeof(struct dvb_tuner_ops));
+	memset(&fe->ops.tuner_ops, 0, sizeof(fe->ops.tuner_ops));
 	fe->tuner_priv = NULL;
 	kfree(dev);
 
-- 
2.14.1

      parent reply	other threads:[~2017-09-17  8:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-17  8:18 [PATCH 0/2] [media] TDA18212HN: Adjustments for two function implementations SF Markus Elfring
2017-09-17  8:20 ` [PATCH 1/2] [media] tda18212: Delete an error message for a failed memory allocation in tda18212_probe() SF Markus Elfring
2017-09-17  8:20 ` 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=e3688a0e-1970-c7ff-fdf8-d943bf4bb8e2@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

all inboxes | Powered by JetHome®