From patchwork Fri Sep 8 12:32:29 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: 9943847 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 53B9B6034B for ; Fri, 8 Sep 2017 12:32:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 472A6286CB for ; Fri, 8 Sep 2017 12:32:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BFA8286CF; Fri, 8 Sep 2017 12:32:55 +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 C9D91286CB for ; Fri, 8 Sep 2017 12:32:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754979AbdIHMch (ORCPT ); Fri, 8 Sep 2017 08:32:37 -0400 Received: from mout.web.de ([212.227.17.12]:57961 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753645AbdIHMcg (ORCPT ); Fri, 8 Sep 2017 08:32:36 -0400 Received: from [192.168.1.2] ([92.228.166.205]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0M8hsl-1dTyJQ1Sl9-00wDGL; Fri, 08 Sep 2017 14:32:31 +0200 Subject: [PATCH 2/3] [media] DaVinci-VPBE-Display: Improve a size determination in two functions From: SF Markus Elfring To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Prabhakar Lad Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Fri, 8 Sep 2017 14:32:29 +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:oMwuGMLMCL8dlTacx6S1sGB8Jhyz8oaic/AHoRPsP/F+dSEL4H2 httq/xJDCoupNBTC50y4Jk2DBgAu8pvb6QK+GRKodAIdfSFRIZ66ptCFADX0OltZck6WrL5 jmVY+QsXrfhXh4C7JQexkcuUm/CwfiyMni/0Py6PUhzkKuFG2XlxszYWTPUzMDrjCIRd5mJ SfYdgw38urkKfUzYrB/7A== X-UI-Out-Filterresults: notjunk:1; V01:K0:hP08/0y8QIM=:Gehg5QKF3uMswUuj07DMdX l192p9MiqhseFoIncpbI+xku+MQH92hm5GMRtygnfBheRxY7xXy0bTdf1Vyfz0IYr3tod2QOI gZcF3wq19gM60NdSjkt4ebtXZ1EeI26g/xyZNMu+6HLaAjHSAUeoX7Bzkzecu1lbvu/VdK6h/ 9fw32Gfj7NOkoQ1o4rnK0+RJH/exSjmn+nZ7tLGOYlsnaXxIx9gpTeUalxcnTkMuFrOg5XVsE if4AZrv3Wyv1gXieJEShrM0Nd3RqTfUG/BztryFqpdlo3io/3XNsr5FcFPf2jklXeYSPtYvUo /VaQ4e3ihYbn9oEmzZIbFxBmtlfcPj+n8JhsdxZrMeWWDEA5k03WsTXlSEjq04GJhldtQpj06 7vIKZI1oAEFpj/YX32KMNxBSv8IPCjTongzetbi/zHqY2r50ic61Fabc7tPRmMD22B/dK4Zh5 XIryWiNC3C8SIye23kC4rAHYdmARztglg+9s8gtFVQmYbpUXpfQqSICRM077BmyBY0/hK9NEM vgfUpCDoGHY3CqvrtyeSWUXv1R2SZ2d+iLRzm8amoC14SCSP1SRYBxPMIpgJLk7cjmi67wHLr 36zIWy5M6SpgrF5tM9NGPOs8m5U7TAMVbR4Ntgxuf1Ss7IH+lWWdJW9qc+zas40qMzGr1zVog 3F+QbL/bw61pdRpnkxKvUg7SgGRtTKQJNN0KC1B5lq4FxDk7Wfa5ygh9CQ/OpYy9UuPmX439B F5g8qBsA2orQXaXyDA/E1f6Kl2KTnHeGiaZSxoQw9Xrwh3VHzzZh3tEMJaemELzEgSwLL/SsO DfTW5JXcr6kjcQWbgNn87EgxWakXFL+nXvUC2Gz0WGLFmBdlo8= 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: Fri, 8 Sep 2017 10:50:32 +0200 Replace the specification of data structures by pointer dereferences 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 Acked-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpbe_display.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 5b6fc550736b..afe31900f5de 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c @@ -1305,9 +1305,5 @@ static int init_vpbe_layer(int i, struct vpbe_display *disp_dev, struct video_device *vbd = NULL; /* Allocate memory for four plane display objects */ - - disp_dev->dev[i] = - kzalloc(sizeof(struct vpbe_layer), GFP_KERNEL); - - /* If memory allocation fails, return error */ + disp_dev->dev[i] = kzalloc(sizeof(*disp_dev->dev[i]), GFP_KERNEL); if (!disp_dev->dev[i]) @@ -1396,6 +1392,5 @@ static int vpbe_display_probe(struct platform_device *pdev) printk(KERN_DEBUG "vpbe_display_probe\n"); /* Allocate memory for vpbe_display */ - disp_dev = devm_kzalloc(&pdev->dev, sizeof(struct vpbe_display), - GFP_KERNEL); + disp_dev = devm_kzalloc(&pdev->dev, sizeof(*disp_dev), GFP_KERNEL); if (!disp_dev)