提交 dd5fec87 编写于 作者: T Tvrtko Ursulin

drm/i915/pmu: Use kcalloc instead of kzalloc

kcalloc is preffered for allocating arrays.
Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
Suggested-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180112170340.5387-2-tvrtko.ursulin@linux.intel.com
上级 4c501230
...@@ -785,16 +785,16 @@ create_event_attributes(struct drm_i915_private *i915) ...@@ -785,16 +785,16 @@ create_event_attributes(struct drm_i915_private *i915)
} }
/* Allocate attribute objects and table. */ /* 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) if (!i915_attr)
goto err_alloc; goto err_alloc;
pmu_attr = kzalloc(count * sizeof(*pmu_attr), GFP_KERNEL); pmu_attr = kcalloc(count, sizeof(*pmu_attr), GFP_KERNEL);
if (!pmu_attr) if (!pmu_attr)
goto err_alloc; goto err_alloc;
/* Max one pointer of each attribute type plus a termination entry. */ /* 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) if (!attr)
goto err_alloc; goto err_alloc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册