From patchwork Wed Sep 20 17:00:00 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: 9961871 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 2A46060234 for ; Wed, 20 Sep 2017 17:00:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AC21291B8 for ; Wed, 20 Sep 2017 17:00:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FC9E291BB; Wed, 20 Sep 2017 17:00:34 +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 DEB92291BA for ; Wed, 20 Sep 2017 17:00:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751697AbdITRAO (ORCPT ); Wed, 20 Sep 2017 13:00:14 -0400 Received: from mout.web.de ([212.227.15.3]:58487 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751636AbdITRAM (ORCPT ); Wed, 20 Sep 2017 13:00:12 -0400 Received: from [192.168.1.2] ([77.181.108.184]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M9Xfb-1e6YjW2VeJ-00D1Pq; Wed, 20 Sep 2017 19:00:01 +0200 Subject: [PATCH 3/5] [media] s2255drv: Improve two size determinations in s2255_probe() From: SF Markus Elfring To: linux-media@vger.kernel.org, Arvind Yadav , Bhumika Goyal , Laurent Pinchart , Mauro Carvalho Chehab , Mike Isely , Sakari Ailus Cc: LKML , kernel-janitors@vger.kernel.org References: <55718a41-d76f-36bf-7197-db92014dcd3c@users.sourceforge.net> Message-ID: <4d151c18-662f-aabf-7f03-9c3cbb05b1ef@users.sourceforge.net> Date: Wed, 20 Sep 2017 19:00:00 +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: <55718a41-d76f-36bf-7197-db92014dcd3c@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:BLJzESaxlkdh0k354yqx+tvVPG1S4lfmjJyaHR1Ovt012Ns7S4J ewcyspCsi6hC84m8yD9OGRVtMH/8ZRvmUAWAUlqlVDVMEmUYsOK3u5fCAJkTlNRx9+hydIY SOWabUvm/ghxeqDfDaXWnZtH3iVpPljricHJ2oJlGzm3n7kAZZuDOVgBJDrZjntaMcpqacM HJ6d9D9pQgD7724j76Bmw== X-UI-Out-Filterresults: notjunk:1; V01:K0:hb32V1I0OgM=:aWzo549RvjViCOlqavNBno PlzmbrvPllcDRCptP+oDy3myWR+VUQ16o4t72Y/v1caWcnAiaJdYwDLW0tjg0/LMhLgiNuTFp 2+DIIesdKD/3CtmYFLYjVuTyh41Kh9AreRo14RxScJostpxnRNEz++wKt/YATPs+DLF6TcVAo jluDyyxZsTXhmRUZfu/VG5t/POCJP1bGD0H2U8jKMZdS4lVxPRYv8gVPia1CObGzNQmzP0ONX hJ+iTKxh2r0bJBTRcKNNV9PuW4jGfJcrO4VKn1FWD5GEumKfZjPtYH6jOSzi5PEMEYPqc3fVK cAvl40mHzrcPaA4ZJYnVf4L3Sm2EwsZpBav9p2XLZvAGKF9YcMqx+6UNbX1DaG6Hv5JUK0BXd OB4aSKJhM5b0wdgl1jDilQNkQn7RoA06DVa4H7BLhZCATJFHpX8K9d8ahsQk9GdQ8i5eDrUaQ JuDRu/sd8pUVcuryrxl6hyJX4EqjnIt3wqGVvD4g11tBOuJHnl/jOR+0wp+bDGSRJjkk7n9RN dKwcuPN5OyDPnK7dBlckVIjUZj5XkDKyTiIuuhpnCaBMJAUX7Pgs26Ag3z0cpEZoBdjQc19bi v0TzISrXoDLi5lS2TSknf3lnP6kOal2ISqPi32kPXRX2S3pgpJB3jdkCrdW0ek1JsH8tey6yW A42iLjyK5xGHpIjrd004TtXpM9TfT2j7xvqfoL+Z9FRKWE2Kim+vFnG2fqPN6jsb25NDa+E0/ OjzsVKXbgyQbXGbVM0bgqxnAiZm68d3d0+4mxEKrlTZ47jXUfjf31nykTogZxzLmQXlASmodb JifelC60+AiSPTF5t/KZ3JoOIs5Vc4OQakY6AvZsrHUG431rpc= 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: Wed, 20 Sep 2017 16:56:20 +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/s2255/s2255drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index aee83bf6fa94..29bc73ad7d8a 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -2237,4 +2237,4 @@ static int s2255_probe(struct usb_interface *interface, /* allocate memory for our device state and initialize it to zero */ - dev = kzalloc(sizeof(struct s2255_dev), GFP_KERNEL); + dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) return -ENOMEM; @@ -2247,4 +2247,4 @@ static int s2255_probe(struct usb_interface *interface, dev->pid = id->idProduct; - dev->fw_data = kzalloc(sizeof(struct s2255_fw), GFP_KERNEL); + dev->fw_data = kzalloc(sizeof(*dev->fw_data), GFP_KERNEL); if (!dev->fw_data) goto errorFWDATA1;