2020-05-18 15:06:38

by Aishwarya Ramakrishnan

[permalink] [raw]
Subject: [PATCH] drm/i915/gvt: Use ARRAY_SIZE for vgpu_types

Prefer ARRAY_SIZE instead of using sizeof

Fixes coccicheck warning: Use ARRAY_SIZE

Signed-off-by: Aishwarya Ramakrishnan <[email protected]>
---
drivers/gpu/drm/i915/gvt/vgpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
index 1d5ff88078bd..7d361623ff67 100644
--- a/drivers/gpu/drm/i915/gvt/vgpu.c
+++ b/drivers/gpu/drm/i915/gvt/vgpu.c
@@ -124,7 +124,7 @@ int intel_gvt_init_vgpu_types(struct intel_gvt *gvt)
*/
low_avail = gvt_aperture_sz(gvt) - HOST_LOW_GM_SIZE;
high_avail = gvt_hidden_sz(gvt) - HOST_HIGH_GM_SIZE;
- num_types = sizeof(vgpu_types) / sizeof(vgpu_types[0]);
+ num_types = ARRAY_SIZE(vgpu_types);

gvt->types = kcalloc(num_types, sizeof(struct intel_vgpu_type),
GFP_KERNEL);
--
2.17.1


2020-05-18 21:03:06

by Chris Wilson

[permalink] [raw]
Subject: Re: [PATCH] drm/i915/gvt: Use ARRAY_SIZE for vgpu_types

Quoting Aishwarya Ramakrishnan (2020-05-18 16:03:36)
> Prefer ARRAY_SIZE instead of using sizeof
>
> Fixes coccicheck warning: Use ARRAY_SIZE
>
> Signed-off-by: Aishwarya Ramakrishnan <[email protected]>
Reviewed-by: Chris Wilson <[email protected]>
-Chris

2020-05-19 09:20:49

by Zhenyu Wang

[permalink] [raw]
Subject: Re: [PATCH] drm/i915/gvt: Use ARRAY_SIZE for vgpu_types

On 2020.05.18 22:00:52 +0100, Chris Wilson wrote:
> Quoting Aishwarya Ramakrishnan (2020-05-18 16:03:36)
> > Prefer ARRAY_SIZE instead of using sizeof
> >
> > Fixes coccicheck warning: Use ARRAY_SIZE
> >
> > Signed-off-by: Aishwarya Ramakrishnan <[email protected]>
> Reviewed-by: Chris Wilson <[email protected]>

Applied, thanks!

--
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827


Attachments:
(No filename) (465.00 B)
signature.asc (201.00 B)
Download all attachments