lkml.org 
[lkml]   [2018]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] drm/amdkfd: Use ARRAY_SIZE macro in kfd_build_sysfs_node_entry
From
Date
Looks good. This change is Reviewed-by: Felix Kuehling
<Felix.Kuehling@amd.com>

Regards,
  Felix


On 2018-01-18 07:39 PM, Gustavo A. R. Silva wrote:
> 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>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> index c6a7609..7783250 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),

\
 
 \ /
  Last update: 2018-01-19 23:18    [W:0.209 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site