Skip to content

Commit

Permalink
drm/i915/pmu: Use kcalloc instead of kzalloc
Browse files Browse the repository at this point in the history
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>
Link: https://patchwork.freedesktop.org/patch/msgid/20180112170340.5387-2-tvrtko.ursulin@linux.intel.com
  • Loading branch information
Tvrtko Ursulin committed Jan 12, 2018
1 parent 4c50123 commit dd5fec8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/i915_pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit dd5fec8

Please sign in to comment.