From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Tvrtko Ursulin <tursulin@ursulin.net>
Cc: Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/i915/pmu: Use kcalloc instead of kzalloc
Date: Fri, 12 Jan 2018 19:14:06 +0200 [thread overview]
Message-ID: <20180112171406.GH10981@intel.com> (raw)
In-Reply-To: <20180112170340.5387-2-tvrtko.ursulin@linux.intel.com>
On Fri, Jan 12, 2018 at 05:03:40PM +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> kcalloc is preffered for allocating arrays.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/i915_pmu.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 9be4f5201e41..065a28c713c4 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -785,16 +785,16 @@ create_event_attributes(struct drm_i915_private *i915)
> }
>
> /* Allocate attribute objects and table. */
> - i915_attr = kzalloc(count * sizeof(*i915_attr), GFP_KERNEL);
> + i915_attr = kcalloc(count, sizeof(*i915_attr), GFP_KERNEL);
> if (!i915_attr)
> goto err_alloc;
>
> - pmu_attr = kzalloc(count * sizeof(*pmu_attr), GFP_KERNEL);
> + pmu_attr = kcalloc(count, sizeof(*pmu_attr), GFP_KERNEL);
> if (!pmu_attr)
> goto err_alloc;
>
> /* Max one pointer of each attribute type plus a termination entry. */
> - attr = kzalloc((count * 2 + 1) * sizeof(*attr), GFP_KERNEL);
> + attr = kcalloc(count * 2 + 1, sizeof(*attr), GFP_KERNEL);
> if (!attr)
> goto err_alloc;
>
> --
> 2.14.1
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-01-12 17:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-12 17:03 [PATCH 1/2] drm/i915/pmu: fix noderef.cocci warnings Tvrtko Ursulin
2018-01-12 17:03 ` [PATCH 2/2] drm/i915/pmu: Use kcalloc instead of kzalloc Tvrtko Ursulin
2018-01-12 17:14 ` Ville Syrjälä [this message]
2018-01-12 17:25 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915/pmu: fix noderef.cocci warnings Patchwork
2018-01-12 18:46 ` ✓ Fi.CI.IGT: " Patchwork
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=20180112171406.GH10981@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=tursulin@ursulin.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.