From patchwork Mon Sep 19 15:54:48 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: 9339803 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 54E746077A for ; Mon, 19 Sep 2016 15:55:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45FDC294A2 for ; Mon, 19 Sep 2016 15:55:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38DE329569; Mon, 19 Sep 2016 15:55:03 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A35562953A for ; Mon, 19 Sep 2016 15:54:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D97356E4D3; Mon, 19 Sep 2016 15:54:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.web.de (mout.web.de [212.227.15.3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 44D4D6E4D3 for ; Mon, 19 Sep 2016 15:54:54 +0000 (UTC) Received: from [192.168.1.2] ([77.182.197.179]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0Lmchn-1bDmHa1gOJ-00aAIO; Mon, 19 Sep 2016 17:54:49 +0200 Subject: [PATCH 2/5] GPU-DRM: Replace two kzalloc() calls by kcalloc() in drm_legacy_addbufs_pci() To: dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie References: <566ABCD9.1060404@users.sourceforge.net> <2fd2da19-d57e-5017-0594-fd52e78493fa@users.sourceforge.net> From: SF Markus Elfring Message-ID: <51f88f44-130d-48ac-f531-32ca9ae3919f@users.sourceforge.net> Date: Mon, 19 Sep 2016 17:54:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <2fd2da19-d57e-5017-0594-fd52e78493fa@users.sourceforge.net> X-Provags-ID: V03:K0:MxJLfoLh8fNtj91bMceLt4i0SdzhnLAfd+lxA6I352ueaC5t6sc vHCS4OKt2LW7YdPjtXbfgyaJLELvaKsyDJmG3SuqeZKdabfQ1czkhkOGj0fzOC5eyvHAKKu 0sDz4MU1ty70wjKGC1Cbl6mxzDLm6umSGY9CcIJlwZqC56qjphbaqdZxXRAqhdfCO61zFPW Bt+2YQ0Kne8+mUp7LMmpA== X-UI-Out-Filterresults: notjunk:1; V01:K0:7LtG5icDLyU=:EPm/wzLk0oV61VgVxsf7bO Jbx+9d7p9ROJwLO2uYuF6h8ma70IACgzM0QVSZ1cDw+ZR5Bc4/1vpdu4cWB9isjLNSBwVfRQv 4xMY9VcBAaoveuCk0bNP0+4qwvkIz1wErRT9FcV9/v6jc7uV8WpvIQNSBtZV+zMNtv8lwY4Rp YB72gmzo29IcF9cIrxxb24t71wAT991oeOKYX8EJMsuDtH5Lve5osL/EelInywos3EoNkEYuP XuRrP9dsum3JJxlBMFd3ie5Ipswufc2ZBYz6aGL2FXSD1Q6GTijvLqhHv6JsZ/OZaPoUrkT/B 0sB13dA5D1m0UFH5nDLGE3opzze8EEIgjKDLCreT9aRIgfDAWXz+piRSmQR11tQ2qfT1kxdOw oKoKMQRYWALHT1QKkD2+Cgyskh6VsnhkbrG1FXjX2jlheu0JTyeMzNBtNJHiYt8pcKUBrou/O 5vxgRTzwnrhK5hC2QIcv+df1wWCG7AmoHeoa2V8h7M/4pyNzJMvd9eAoKBQLd12n1H0x4RjkK oG1ECEpyh+qOU8bXxkuf7v92J3CEw8lpvrfEHu1IKtV1Sp8vmU2EPgbTtyH6Hgs+CVDHCwuFH +gPDgJVJBcxHCcd3Pc17f/x1QOZE9Oh5owjM+jedD50uy7KgQmksB3CS02tWnzbQh2T/7EIiz kq5ydS80W41ihdf3c12qVJDzuvy4K28/tUnTnCdl0HJZMRuH4L4TLrDQe+xdLTD3dhXB9m36J 4N40nu6eM6LFtIWMRv1ZMZvoRDbXUr5LB5HcsEs1fo7CKNmYSBP4rjTSNLg8/2/Wa5bhxYkVV csfl40V Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 19 Sep 2016 17:17:34 +0200 The script "checkpatch.pl" can point information out like the following. WARNING: Prefer kcalloc over kzalloc with multiply Thus fix the affected source code places. Signed-off-by: Markus Elfring --- drivers/gpu/drm/drm_bufs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index ed33f43..8a31dac 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -905,14 +905,14 @@ int drm_legacy_addbufs_pci(struct drm_device *dev, return -EINVAL; } - entry->buflist = kzalloc(count * sizeof(*entry->buflist), GFP_KERNEL); + entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); if (!entry->buflist) { mutex_unlock(&dev->struct_mutex); atomic_dec(&dev->buf_alloc); return -ENOMEM; } - entry->seglist = kzalloc(count * sizeof(*entry->seglist), GFP_KERNEL); + entry->seglist = kcalloc(count, sizeof(*entry->seglist), GFP_KERNEL); if (!entry->seglist) { kfree(entry->buflist); mutex_unlock(&dev->struct_mutex);