aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo A. R. Silva <[email protected]>2018-01-18 18:39:55 -0600
committerOded Gabbay <[email protected]>2018-01-18 18:39:55 -0600
commit3f866f5f04d3645970662409d2bdff3dca58b1a3 (patch)
tree24d9913276b39e680517a8e82762d83470e18302
parent4518cd28d81fa4d2872268e4f8f7b35f387642cc (diff)
drm/amdkfd: Use ARRAY_SIZE macro in kfd_build_sysfs_node_entry
Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <[email protected]> Reviewed-by: Felix Kuehling<[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_topology.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index c6a76090a725..7783250e1c6d 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -677,7 +677,7 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
}
/* All hardware blocks have the same number of attributes. */
- num_attrs = sizeof(perf_attr_iommu)/sizeof(struct kfd_perf_attr);
+ num_attrs = ARRAY_SIZE(perf_attr_iommu);
list_for_each_entry(perf, &dev->perf_props, list) {
perf->attr_group = kzalloc(sizeof(struct kfd_perf_attr)
* num_attrs + sizeof(struct attribute_group),