From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Date: Fri, 12 Jan 2018 17:03:40 +0000
Subject: drm/i915/pmu: Use kcalloc instead of kzalloc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Git-commit: dd5fec87efdd54db6870b5d24c1fd3cda94f4510
Patch-mainline: v4.17-rc1
References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166
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
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
drivers/gpu/drm/i915/i915_pmu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -861,16 +861,16 @@ create_event_attributes(struct drm_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;