From: Julia Lawall <julia.lawall@lip6.fr>
To: Harsha Sharma <harshasharmaiitr@gmail.com>
Cc: daniel.vetter@ffwll.ch, seanpaul@chromium.org,
jani.nikula@linux.intel.com, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH] drm: Replace kzalloc with kcalloc
Date: Fri, 13 Oct 2017 07:51:57 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.20.1710130751031.3147@hadrien> (raw)
In-Reply-To: <20171012221758.512-1-harshasharmaiitr@gmail.com>
On Fri, 13 Oct 2017, Harsha Sharma wrote:
> Prefer kcalloc over kzalloc to allocate an array.
> This patch fixes checkcpatch issue.
>
> Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
> ---
> 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);
Doesn't kcalloc take 3 arguments? You need to compile the code and check
that you have obtained a .o file for the file you modified.
julia
> 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;
> --
> 2.11.0
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20171012221758.512-1-harshasharmaiitr%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
prev parent reply other threads:[~2017-10-13 5:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-12 22:17 Harsha Sharma
2017-10-13 5:51 ` Julia Lawall [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.20.1710130751031.3147@hadrien \
--to=julia.lawall@lip6.fr \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=harshasharmaiitr@gmail.com \
--cc=jani.nikula@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=outreachy-kernel@googlegroups.com \
--cc=seanpaul@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®