From patchwork Sun Sep 24 10:24:45 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: 9967867 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 D2115602D8 for ; Sun, 24 Sep 2017 10:25:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C30C328D35 for ; Sun, 24 Sep 2017 10:25:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A93D828D5B; Sun, 24 Sep 2017 10:25:18 +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 6D4D528D35 for ; Sun, 24 Sep 2017 10:25:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751890AbdIXKY5 (ORCPT ); Sun, 24 Sep 2017 06:24:57 -0400 Received: from mout.web.de ([212.227.15.4]:64898 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751267AbdIXKY4 (ORCPT ); Sun, 24 Sep 2017 06:24:56 -0400 Received: from [192.168.1.2] ([78.48.160.4]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LwD3G-1dJ09g40fm-018255; Sun, 24 Sep 2017 12:24:47 +0200 Subject: [PATCH 2/6] [media] omap_vout: Improve a size determination in two functions From: SF Markus Elfring To: linux-media@vger.kernel.org, Hans Verkuil , Jan Kara , Lorenzo Stoakes , Mauro Carvalho Chehab , Michal Hocko , Muralidharan Karicheri Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <7edbd298-6d56-3ac7-08c1-b25527181994@users.sourceforge.net> Date: Sun, 24 Sep 2017 12:24:45 +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:AiB4pACb9GhlUoPmD0lrNEKEz3aqftzooAXs4u+Vonw6AP0oCtr fsB5ewwKU75Y6Brc42gOG7Hu4hR5eTDuWsnKv/8lGpYhp0Sp9afOHhRGHsWidtpJDI8r2P9 VjBpHbfJEslx71rg/UY61gN4kcT6BlAqR1/a9LKCjJkaFndKOtcUd7yCly6HttHSEQ9kdp1 HkyWFhszMwVvImlJ0Qthw== X-UI-Out-Filterresults: notjunk:1; V01:K0:qTSduhsHTM0=:Z/S6jJNbASj1KNloi7iQjv 2+RWJEZ5J0X74/RQ6yVoThDmjhevfmNZ9r3ma5rkJ3tiVs2otFJ7CYNDvoXQZzLhDioexSceF ZDDUli5AsX5d8C1H00CNS6OhkgcfYDoPKYAzXMmlFxrGt6cRRkuUBokE3+Vqhmfk45PAqwhJ6 Pevtf7eqQggz8tdMIGBMcV9n0noqkBkZS6eUlS77PeYsLrH/yUD7EwNu094Stpo5av/4DSVay d41vz8d03Fl5n8rTClOc4Bt+SSulJW897gqST3mld85ou0QmiSKfdCIEjh7qZn3gxKu9pn3MT 1wfi8Wl9x9ZKhhBL8sDvoyt23UWag9eVxGYrPsaJP1VJ4eGil4Rw3eKHcomFGlwjC0ReSI6FV yvS/iZnZSdce7njS2P9wzMxmssgsBM08FbrC5d1Rp/F4DaLFvJu/RyUXKU2wMSnu5HrmwF2ZG r1G1OEZrGI7Rvx7mt+dK0fBu/T9qF6MO9Z8FJ7aHPyqGGYWN7Cfd9vU9CHO6QFZQtkSrdyl0f 9jdAylzr6T1d6ITXCyHppubNqckMGENkwgbeDUD0efR+6wIkeUOxomTqvEgpxiBwq2j0+We0Y pXyzA12QUGhj0vPpVRAPw5Wt5IVCdRojki7WT7NYoVsJEs1MbfyD5sAERDzJAah/zL0UeI/8n P6ymhbD9soaR5wGHvZ5FevzLANG+3bYH2xufrTK48fyM0g2JxVrJUVlaqXiHjJO3Lrv0gTD65 y9UFX62MQyf/lHtp037N3v9bEkEoalYYZ7nzmAc4oxDjdfcF32jwBrYXN2YNLu5QlwlQLoX/b WVkRJ+IiATZfNRDUCn9ElwcJpjd22SeZGtsW5nq13PyIH5cMIk= 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, 24 Sep 2017 10:18:26 +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. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/platform/omap/omap_vout.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c index aebc1e628ac5..4a4d171ca573 100644 --- a/drivers/media/platform/omap/omap_vout.c +++ b/drivers/media/platform/omap/omap_vout.c @@ -1943,8 +1943,7 @@ static int __init omap_vout_create_video_devices(struct platform_device *pdev) struct omap2video_device, v4l2_dev); for (k = 0; k < pdev->num_resources; k++) { - - vout = kzalloc(sizeof(struct omap_vout_device), GFP_KERNEL); + vout = kzalloc(sizeof(*vout), GFP_KERNEL); if (!vout) return -ENOMEM; @@ -2095,7 +2094,7 @@ static int __init omap_vout_probe(struct platform_device *pdev) goto err_dss_init; } - vid_dev = kzalloc(sizeof(struct omap2video_device), GFP_KERNEL); + vid_dev = kzalloc(sizeof(*vid_dev), GFP_KERNEL); if (vid_dev == NULL) { ret = -ENOMEM; goto err_dss_init;