From patchwork Wed Oct 12 15:10:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9373415 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 C20B460865 for ; Wed, 12 Oct 2016 15:15:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B44EA29316 for ; Wed, 12 Oct 2016 15:15:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8B632965E; Wed, 12 Oct 2016 15:15:31 +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=ham 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 3EB862944A for ; Wed, 12 Oct 2016 15:15:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933710AbcJLPNM (ORCPT ); Wed, 12 Oct 2016 11:13:12 -0400 Received: from mout.web.de ([212.227.15.14]:56283 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755400AbcJLPMi (ORCPT ); Wed, 12 Oct 2016 11:12:38 -0400 Received: from [192.168.1.2] ([78.49.9.22]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0MXYTG-1bNqNT4AII-00WZJi; Wed, 12 Oct 2016 17:10:58 +0200 Subject: [PATCH 30/34] [media] DaVinci-VPIF-Display: Use kcalloc() in vpif_probe() To: linux-media@vger.kernel.org, Hans Verkuil , "Lad, Prabhakar" , Mauro Carvalho Chehab References: Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: Date: Wed, 12 Oct 2016 17:10:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:xVU6irTmL1mke8OWGFzskYOpvSNx6hnX7GI1xL0zBz3+TKYbwAf V8D2zGuSjXY3LJEGr6wGUGQz08AjNMfAxTP2yMz1seN+YgBQY7WDXs0lDPZWBDQAqqVULSP ZsgpInj+rAce+FGWD+wuoH7mxAsV5v4Q3BisxZiPuTzDw56kzij6CDY7BbOzhOnCSuRvsjq /nlUsovMd8LJxM4r1lH5A== X-UI-Out-Filterresults: notjunk:1; V01:K0:cOQoiacTYzI=:0sfianm+6KfnZwzW+kLMxU E857qQeqBy1NMnMo6tziupbixKPud+6+hIHFPW0CjU782YajgklsSjvjr32eeGcuzbuqH1fe6 tVNXOBWEq79oc7dolFaztbBLiiCPedA2yXxJnGUgM+BNYphDj3CM3fw+5p6Sqyo6VScj/ew9y dqQ9rTUfFXwbQzrydNhRWm3Bw48RQbgXU+tDfHttqRQrOMiZ/mh3+7o47ylZuaWoXjmCP7xUU RbTYoKuq1Lgw2pkJ5SsKte6IwBwPe0Oed0VWv0GjXLtlssnNWsWJhLNa+bzHai9p1yktj++n6 kH9N8sX4k6sa/6ItzkrJPt0ARYSjBZwjsbjOAqhbd0GqAMpo84L8xVgURF6/KoaTt+zSWutQx Rkuk85G/MsCmSjPBniOZAXYjwybcsbkrvSsmBKDz6m1JGDH0wyyaVXtp3/+E2ZJ06dQIVkG/p h9wZ7ySeOwH6Vx0ByHaRVbgRHcBf4+eSohg/WTgFE5eMRUYSoFE9Izlf+0NdlT5ntLaT+tDhl es3a1vcB6MJDzAAQjw+od7qQWJLH4xcbS2gRsp5/qIhRqicgjmjtGZgkW7qA+ouw56O3rkPCN rjITDsfbxkcouk8oo8I8pi5biVN6tPIYdGiUk/y6jIpocNTyj3Ta+F16Kz9YQFAVl8cli2sZx Y5M8aso4guawQFqSmoofFdX6YOTWe6CMgYT8gE2+CDWpoA9FJqCIYzvaALpyctC827sfSHKKp 2VIJD/uyfTLuua8zGBEiHu6eySJwChb8GZ/rmkDueS7vORhq4i32MOE5+iCVvWmLPKY2yNhOX tC6T7nt 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, 12 Oct 2016 15:30:44 +0200 * A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. * Replace the specification of a data type by a pointer dereference 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/vpif_display.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index 75b2723..80121e8 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -1279,8 +1279,7 @@ static __init int vpif_probe(struct platform_device *pdev) vpif_obj.config = pdev->dev.platform_data; subdev_count = vpif_obj.config->subdev_count; subdevdata = vpif_obj.config->subdevinfo; - vpif_obj.sd = kzalloc(sizeof(struct v4l2_subdev *) * subdev_count, - GFP_KERNEL); + vpif_obj.sd = kcalloc(subdev_count, sizeof(*vpif_obj.sd), GFP_KERNEL); if (vpif_obj.sd == NULL) { vpif_err("unable to allocate memory for subdevice pointers\n"); err = -ENOMEM;