From patchwork Sat Sep 16 18:32:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9954437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D1F22601C0 for ; Sat, 16 Sep 2017 18:32:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0B79290BE for ; Sat, 16 Sep 2017 18:32:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B57AF290C2; Sat, 16 Sep 2017 18:32:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E7BF290BE for ; Sat, 16 Sep 2017 18:32:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751413AbdIPScn (ORCPT ); Sat, 16 Sep 2017 14:32:43 -0400 Received: from mout.web.de ([212.227.15.3]:55259 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751259AbdIPScm (ORCPT ); Sat, 16 Sep 2017 14:32:42 -0400 Received: from [192.168.1.2] ([78.48.47.134]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MWirL-1dvfPA151n-00Xpsu; Sat, 16 Sep 2017 20:32:31 +0200 Subject: [PATCH 2/2] [media] it913x: Improve three size determinations From: SF Markus Elfring To: linux-media@vger.kernel.org, Antti Palosaari , Mauro Carvalho Chehab Cc: LKML , kernel-janitors@vger.kernel.org References: <0ad553a6-9aca-d20b-48df-4084d80e2223@users.sourceforge.net> Message-ID: Date: Sat, 16 Sep 2017 20:32:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <0ad553a6-9aca-d20b-48df-4084d80e2223@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:+XgslZKcnGd6ju1NCNquX3teim0VJoJCBXM35qX7CWXrofza7G4 O/X6WOpsc5sh4KgdLwyh0GNjsoT9OCMdg81utN3G5fA0M1ACwQyvH7PdlfH953Xir2wgfER FChm+32hWVc6xlm6mmrpgAC4xt8N/hA9qcspmQr4SPrE1i/gRaN8ODUTYKzeqw13GhO/UVo DUe0JK6n78aF8x0YO3sxg== X-UI-Out-Filterresults: notjunk:1; V01:K0:9FwAO5ApIsc=:IWYs05EdfAFak6VyM36sv7 GAybQk80FG4Zb3q4bu/R78mzB9U/yucrBLlNbc8QMwyriM9DJpC7ZH76OnouN+pEnuh1gfFFk MiVzEQcTaYtYkPreYSy+PelhrhPJFwaxn2gbIoN1Z+a7QqVxobJWIxQJplLS/oHwRwQHz3QMe gkPNC107FG896wR1ZqDQN7eqCq26fgtZwxzlvMSJTMrJusGwod5WLbsuNwiFa55FOccPBcSTG CK5lk45fq5R5aqvXKNQBZ6seHEMpHfCCqI+iAgm3yr9OUytx8VEL6s8LniyfQ7kUxhSTIxPj/ H2Iy7YD6/+P4rbVSD9QI3MGa818pHr0ZAlO3IUU7lGXO7dT+bkME1jhehW1/zvj5wLQnV/hJC 9a66DsqKh3RAFe2jA1TzXhJp05s9i9Gwv73+jsFwFZqfKEBdVk4HcHc1pPjXxq3xzdo+YVqHG XOhF+ZEn0P9Urw5v/Vdw18EqHSXqL31a7OYI+C8T9sAVvwRjJ+KzpeyGVWUldDSEY+kEo/I4d FTJVSglR7PH7wf+4R11oYj7EYghT/RsCOre9OKSFCXc8WSY3hTejkVB4yDpUdj0D6SMlnZ76i E1wgYKgzVxVDgzyTtjca6QgUX05N3C384ESnyWF66a723viMBBUe0VsWP3LfstkWyf0Pnj+td N5EN+sN1WTh+M63AiMQKJaVi+yz/TWBvWutVkGJJM6sfbfSvL6AgxUudqhI/lRqy1RCCZyaWB ol2mYKDnQ2e7f185Il031GmkS+gGMSJum30gjPx3nrmOAbjN5EFjuN8K/pdEHm8JvjcxL6QwQ cP6UTqLn1AuWHen2/JLN/x2LRjc4kjkLylkYv6eOUMyKpFtTpI= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);