From patchwork Sun Sep 17 20:18:40 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: 9955067 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 2DDF46028A for ; Sun, 17 Sep 2017 20:19:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 257852895B for ; Sun, 17 Sep 2017 20:19:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A35128970; Sun, 17 Sep 2017 20:19:23 +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=unavailable 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 BF1F02895B for ; Sun, 17 Sep 2017 20:19:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751711AbdIQUTJ (ORCPT ); Sun, 17 Sep 2017 16:19:09 -0400 Received: from mout.web.de ([212.227.17.11]:63293 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751334AbdIQUTH (ORCPT ); Sun, 17 Sep 2017 16:19:07 -0400 Received: from [192.168.1.2] ([77.181.201.34]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LkPnr-1dHrR31reF-00cQUM; Sun, 17 Sep 2017 22:18:42 +0200 Subject: [PATCH 3/8] [media] cx231xx: Improve six size determinations From: SF Markus Elfring To: linux-media@vger.kernel.org, Bhumika Goyal , Hans Verkuil , Johan Hovold , Julia Lawall , Matthias Schwarzott , Mauro Carvalho Chehab , Oleh Kravchenko , Peter Rosin , Sakari Ailus Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Sun, 17 Sep 2017 22:18:40 +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: Content-Language: en-GB X-Provags-ID: V03:K0:exdwhqOFP6RzV9VrTbHa15nDTPS3OwrhUIhqj+Wf8eM2oiFizyi iZWbV+goIIKShMYFVATg7yqsoFV6715niYIBfT23E0MuGcg1KlEDlhPCWkpJQxkU6gs2Xa4 PWkdCWsJ1yhTdp1gj8SeymixnREYKw+bS3O6Cm86tSxPN/sfqPtm7cddadyesFfEiVJ88bw U+NkyC2v1r15ifBuQ/AZQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:hmRAnVqIx+o=:Yesf4+3G+8/VGGNsQ/zvAo 7wjtGpMrqtaO5O4Cepo8Hk3bB1f4EZRBvZy6x/CJMBQ6u6uEYbiUFgTm0YVDwKCRgDQRlzcRL 2l6r42QRSGO7qck/Gtg/3vLyrtI7ouDcQIN3bkJ+MKE8BGJdKLdMklbxgH50E6SW/xf6/+hs+ xeDNUI5O0yoR6XBaXqz9c7/ubWSRGXJ2p2Ut/SwlNqfEx67f+3uv+fbTOOJUNdqT7YF8LFMVU CUg/focz6Ikx/e9dgAOHLLyDfFmAd30QfO4MFcmRQPLg7FVYa0+QyvC73Lxb1NbNIRaLfHo+D M/WV4Wzqe+6TPTe1v7h7mUqCc5Rqg4G73XqBA2AQrYvz0GITnmjGWTx4ukHxNedNhGY5hb1qA 0VPIMLZqKvLLrpXy5p+dMHJ3ARa3A3G2I4vnjYFoCeKAS/SiKBgJzW47aPFA6TrOFNqZ4ec7v bbQBGSMDUA8Ac4fEmB5zo2f0RMDlH6AEzcMUmr0CEXW1/ckNH07seangeQjYPtWf9R3KxO55+ XlRUVvqt5B4H0Fbx5Ob93nqzI3msOcYKXE8S+TasdQ124S8J2Qn4hVmajMT3ByVZHdyZh11hr XVskVwyvnKwSeTbym0JiU4i0RsXY87dnLlUT0tp2iueUaMp4glyKsdEbWQMvBdJnEVZyVY3Ox c3xIh+cyxRwBItBY7NWkqI4gOVaMKteRgJd43VFkwgien1fHoZixL1lGUk+PQ4AJL9KC0HItG +nlydYqWmjzMtnl0tmoh/VieW5TUnBTcu3EHWmO1sos+ila93DY4XUFaiFgghn2sDAHFC220x yM0X4PfJn9osrkmVCsDghgZLhxUZZnqDrKymJe2uJE39vEEzNA= 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: Sun, 17 Sep 2017 18:38:50 +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/usb/cx231xx/cx231xx-dvb.c | 10 +++++----- drivers/media/usb/cx231xx/cx231xx-video.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index 0813f368fb3c..35d98ec948b2 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -611,5 +611,5 @@ static int dvb_init(struct cx231xx *dev) return 0; } - dvb = kzalloc(sizeof(struct cx231xx_dvb), GFP_KERNEL); + dvb = kzalloc(sizeof(*dvb), GFP_KERNEL); if (!dvb) @@ -754,7 +754,7 @@ static int dvb_init(struct cx231xx *dev) si2165_pdata.chip_mode = SI2165_MODE_PLL_XTAL, si2165_pdata.ref_freq_Hz = 16000000, - memset(&info, 0, sizeof(struct i2c_board_info)); + memset(&info, 0, sizeof(info)); strlcpy(info.type, "si2165", I2C_NAME_SIZE); info.addr = 0x64; info.platform_data = &si2165_pdata; @@ -801,7 +801,7 @@ static int dvb_init(struct cx231xx *dev) si2165_pdata.chip_mode = SI2165_MODE_PLL_EXT, si2165_pdata.ref_freq_Hz = 24000000, - memset(&info, 0, sizeof(struct i2c_board_info)); + memset(&info, 0, sizeof(info)); strlcpy(info.type, "si2165", I2C_NAME_SIZE); info.addr = 0x64; info.platform_data = &si2165_pdata; @@ -822,7 +822,7 @@ static int dvb_init(struct cx231xx *dev) dvb->i2c_client_demod = client; - memset(&info, 0, sizeof(struct i2c_board_info)); + memset(&info, 0, sizeof(info)); dev->dvb->frontend->ops.i2c_gate_ctrl = NULL; @@ -869,7 +869,7 @@ static int dvb_init(struct cx231xx *dev) struct i2c_board_info info; struct si2157_config si2157_config; - memset(&info, 0, sizeof(struct i2c_board_info)); + memset(&info, 0, sizeof(info)); dev->dvb->frontend = dvb_attach(lgdt3306a_attach, &hauppauge_955q_lgdt3306a_config, diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index 956f8cbcb454..a12ec3567684 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -1771,5 +1771,5 @@ static int cx231xx_v4l2_open(struct file *filp) } #endif - fh = kzalloc(sizeof(struct cx231xx_fh), GFP_KERNEL); + fh = kzalloc(sizeof(*fh), GFP_KERNEL); if (!fh)