]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdkfd: Use ARRAY_SIZE macro in kfd_build_sysfs_node_entry
authorGustavo A. R. Silva <garsilva@embeddedor.com>
Fri, 19 Jan 2018 00:39:55 +0000 (18:39 -0600)
committerOded Gabbay <oded.gabbay@gmail.com>
Fri, 19 Jan 2018 00:39:55 +0000 (18:39 -0600)
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 <garsilva@embeddedor.com>
Reviewed-by: Felix Kuehling<Felix.Kuehling@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/gpu/drm/amd/amdkfd/kfd_topology.c

index c6a76090a725055df2bc61cccc50e34056ea8574..7783250e1c6ddc96aad7b5cf7d54abc64bcab223 100644 (file)
@@ -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),