From: SF Markus Elfring Date: Sat, 16 Sep 2017 18:32:30 +0000 Subject: [PATCH 2/2] [media] it913x: Improve three size determinations Message-Id: List-Id: References: <0ad553a6-9aca-d20b-48df-4084d80e2223@users.sourceforge.net> In-Reply-To: <0ad553a6-9aca-d20b-48df-4084d80e2223@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-media@vger.kernel.org, Antti Palosaari , Mauro Carvalho Chehab Cc: LKML , kernel-janitors@vger.kernel.org From: Markus Elfring 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 --- 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