All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/gvt: Use ARRAY_SIZE macro
@ 2018-06-18  7:48 rajan.vaja
  2018-06-18 16:20   ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: rajan.vaja @ 2018-06-18  7:48 UTC (permalink / raw)
  To: zhenyuw, zhi.a.wang, jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied
  Cc: intel-gvt-dev, dri-devel, linux-kernel, Rajan Vaja

From: Rajan Vaja <rajan.vaja@gmail.com>

Use ARRAY_SIZE instead of dividing sizeof array with sizeof
an element. This fixes below warning reported by Coccinelle:
drivers/gpu/drm//i915/gvt/vgpu.c:122:30-31: WARNING: Use ARRAY_SIZE

Signed-off-by: Rajan Vaja <rajan.vaja@gmail.com>
---
 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 2e0a02a..e4c3368 100644
--- a/drivers/gpu/drm/i915/gvt/vgpu.c
+++ b/drivers/gpu/drm/i915/gvt/vgpu.c
@@ -119,7 +119,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 = kzalloc(num_types * sizeof(struct intel_vgpu_type),
 			     GFP_KERNEL);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-18 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18  7:48 [PATCH] drm/i915/gvt: Use ARRAY_SIZE macro rajan.vaja
2018-06-18 16:20 ` Joe Perches
2018-06-18 16:20   ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.