From patchwork Thu Oct 12 22:17:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harsha sharma X-Patchwork-Id: 10003559 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 0A54B60325 for ; Fri, 13 Oct 2017 07:07:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE63328FCA for ; Fri, 13 Oct 2017 07:07:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E14FB28FDB; Fri, 13 Oct 2017 07:07:04 +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 54FA228FCA for ; Fri, 13 Oct 2017 07:07:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A87FA6EA34; Fri, 13 Oct 2017 07:07:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 491E36E98B for ; Thu, 12 Oct 2017 22:20:20 +0000 (UTC) Received: by mail-pf0-x241.google.com with SMTP id b85so6886062pfj.13 for ; Thu, 12 Oct 2017 15:20:20 -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=Z6kbDAziuEJbzcOUckxGL0JOKFUDdJgw4uKP4VNuy30=; b=VyqvY830vzF77xJqDR54CHN1W0qgXmVXGIRZ6lE3Tb+6Sw97JBaPzm1ShGF6rMv7fF cTYc+UZZSx23pjYc13odapkw+bYpcLXsi6/I0IFVeNTEJYqQEceLqilu7t068s2iauvS PH0e/zSp8SmXvd9bNNNEoQSLD0V7F9LszcvDnduo1X2xlp95+IyeOaIKfWZ+ukTpPeLH 7LKzuNPnI0+rg7bPNdk53ivNgRCfxt6xUscA34FCLjRcBsJbUeBSZ4Sn017WL4eqw3ol kePM1cJEHXsMhVqCCkrhu2kdbJwLmHp4CGpj1xPrwmdE+E3ttoAjjMm2Y57lR7TlBmNh OsxA== 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=Z6kbDAziuEJbzcOUckxGL0JOKFUDdJgw4uKP4VNuy30=; b=C/FC5+jaDFvMz/nLHVP9hKq0dfUsBrdtWR73D4LdJr0E1PrV2PeaKRu22LYE9AzXi6 1eT+XegHCzYJwztEzBcOoTzZEVDENgdrjB7WcUnPEPf5g41TCYAPhZMBtVci+Nj+UHyT ufZ6YmaffCq1cVTcthXCJF91BKNIRrxD7IEHq17XZsAyMvihXlof3pKAvequvtlUdkTF ylq+8rkwqW84oTLUhqqH5CxXrbQOjZYKI5AC2HDJ2CgntV8tP/LwZl3/ltqw/x07LlI0 6/7yk27BMQimD+doQjwvDaGNK4x/i/CJz5+PwZaDg+GT0xpXatRUkM0vKuWakaxQFF1c 9BEQ== X-Gm-Message-State: AMCzsaV9EV6UC+R758MU4IVfgMiAZ8y7wfxo1KezjToMMsvozZ63Zq1g u7o9ZLbwX8DX2K+jtS5pcd0= X-Google-Smtp-Source: AOwi7QBvYn5vve8Sly3YBiKush2CbecB2aSqfceknZGdqfHDoz4rASNnHMq50lY9n1JE8cvbZiVxKg== X-Received: by 10.98.32.206 with SMTP id m75mr1819687pfj.231.1507846819930; Thu, 12 Oct 2017 15:20:19 -0700 (PDT) Received: from localhost.localdomain ([103.37.201.27]) by smtp.gmail.com with ESMTPSA id d27sm31851006pfb.121.2017.10.12.15.20.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Oct 2017 15:20:19 -0700 (PDT) From: Harsha Sharma To: daniel.vetter@ffwll.ch, seanpaul@chromium.org, jani.nikula@linux.intel.com Subject: [PATCH] drm: Replace kzalloc with kcalloc Date: Fri, 13 Oct 2017 03:47:58 +0530 Message-Id: <20171012221758.512-1-harshasharmaiitr@gmail.com> X-Mailer: git-send-email 2.11.0 X-Mailman-Approved-At: Fri, 13 Oct 2017 07:07:02 +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 --- 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..ceb131637e2f 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..68d197df89fd 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..74054653530e 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;