Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755653AbdIHMch (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 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-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1488 Lines: 37 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 --- 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) -- 2.14.1