From patchwork Fri Oct 13 07:37:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harsha sharma X-Patchwork-Id: 10007209 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 9ECF1603FA for ; Sun, 15 Oct 2017 16:52:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A00520881 for ; Sun, 15 Oct 2017 16:52:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EED92094F; Sun, 15 Oct 2017 16:52:24 +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.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 1EEF420950 for ; Sun, 15 Oct 2017 16:52:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C0336E269; Sun, 15 Oct 2017 16:12:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0E6B16EA32 for ; Fri, 13 Oct 2017 07:40:01 +0000 (UTC) Received: by mail-pf0-x243.google.com with SMTP id a8so8443895pfc.0 for ; Fri, 13 Oct 2017 00:40:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=bJVinvkuYiOdjd715UOyM9cZibnNBKMYXFPuFZg90Mk=; b=Ug7Z2/C3cDo8pSTer4EaxBCryrMt22W2zRu0QZvQ+hJCz3u1TaEbyP8qin3QZ5PdVx eMP0p04qQ1i6t/XSGzQ17IfGDlCaqdymj9K0B6G48vNFOo9e2W9CZ5W3N4EJmdLhmAud H/4JP39nBm6M7ZT2c6H9+XSD4pSiDNAGp2s/irEP1UQzOx2lkpIV2jrmsxAAYY28Pfu9 b8Cs9fbUtbCr4jlrkKRNyi+lG6RI61ewQJz6vyKi0rCNJeAWSMYemzkdjYYBYILUVTi4 wFY/p5nvWiZ/N2GqcaBmNeMPiKrsQJW80wl2l1gHgz/uui2Y1jegmLbEbXomYPgOP7b8 RTBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bJVinvkuYiOdjd715UOyM9cZibnNBKMYXFPuFZg90Mk=; b=ebOWFlcm8ufy/y1C4GZzHFc5OlZNV6m4oqwmjjQjgZdUwFcPS4cUeD1row1V6Nfosz X/05GpShPXkCXkcBMcTEYYkZZ7+1gxrkWzZzMjhuDrl/VDu97ITwVFjxL+kVQkH/fkWp DjhRNEZEFpZb9UkdiObO4/wtEWR8QIK6rkN+qd9KhwPDwDJv9tt2aYJ93yEsho7wg8vK /RdSQ2UgwtazGwnWGlorEl+L08//BtfOFwOorZIPUDkmqShYeChtcKKCLjEWOyQ6PeID 4xvDT8GZEtnvOWt95aGnGN6NElDGcTaeBqVPEYs0vduez1rL6m0e0WtMUBCdw0fBXqCA du+g== X-Gm-Message-State: AMCzsaWSoVNliu1twjwaHmxWHWzbjjLWP390azBMJ30vs8EUiQ7leujJ qSZ31XjJNz0789fGyfK/6EQ= X-Google-Smtp-Source: AOwi7QArSqJaoE1CG7D2S6XfXa3ULQVdPPc/CDXeMVdvNRmgljNLdyatRQxyd321saJbtAfvsob0/Q== X-Received: by 10.99.115.5 with SMTP id o5mr579615pgc.225.1507880401541; Fri, 13 Oct 2017 00:40:01 -0700 (PDT) Received: from localhost.localdomain ([103.37.201.122]) by smtp.gmail.com with ESMTPSA id y83sm1203276pfa.31.2017.10.13.00.39.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 00:40:00 -0700 (PDT) From: Harsha Sharma To: daniel.vetter@ffwll.ch, seanpaul@chromium.org, jani.nikula@linux.intel.com Subject: [PATCH v2] drm: Replace kzalloc with kcalloc Date: Fri, 13 Oct 2017 13:07:47 +0530 Message-Id: <20171013073747.29877-1-harshasharmaiitr@gmail.com> X-Mailer: git-send-email 2.11.0 X-Mailman-Approved-At: Sun, 15 Oct 2017 16:12:36 +0000 Cc: outreachy-kernel@googlegroups.com, Harsha Sharma , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Prefer kcalloc over kzalloc to allocate an array. This patch fixes checkcpatch issue. Signed-off-by: Harsha Sharma --- Changes in v2: -kcalloc will take 3 arguments drivers/gpu/drm/drm_crtc_helper.c | 4 ++-- drivers/gpu/drm/drm_fb_helper.c | 2 +- drivers/gpu/drm/drm_plane_helper.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index eab36a460638..5a84c3bc915d 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -562,12 +562,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set, * Allocate space for the backup of all (non-pointer) encoder and * connector data. */ - save_encoder_crtcs = kzalloc(dev->mode_config.num_encoder * + save_encoder_crtcs = kcalloc(dev->mode_config.num_encoder, sizeof(struct drm_crtc *), GFP_KERNEL); if (!save_encoder_crtcs) return -ENOMEM; - save_connector_encoders = kzalloc(dev->mode_config.num_connector * + save_connector_encoders = kcalloc(dev->mode_config.num_connector, sizeof(struct drm_encoder *), GFP_KERNEL); if (!save_connector_encoders) { kfree(save_encoder_crtcs); diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 1b8f013ffa65..de31e52ab9cb 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -2266,7 +2266,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper, if (modes[n] == NULL) return best_score; - crtcs = kzalloc(fb_helper->connector_count * + crtcs = kcalloc(fb_helper->connector_count, sizeof(struct drm_fb_helper_crtc *), GFP_KERNEL); if (!crtcs) return best_score; diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index 06aee1741e96..759ed93f4ba8 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c @@ -354,7 +354,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, /* Find current connectors for CRTC */ num_connectors = get_connectors_for_crtc(crtc, NULL, 0); BUG_ON(num_connectors == 0); - connector_list = kzalloc(num_connectors * sizeof(*connector_list), + connector_list = kcalloc(num_connectors, sizeof(*connector_list), GFP_KERNEL); if (!connector_list) return -ENOMEM;