nouveua: sizeof() vs ARRAY_SIZE()
Subsystems (4)
PATCH 1/1 nouveua: sizeof() vs ARRAY_SIZE()
ARRAY_SIZE() was intended here, sizeof() is too large.
Signed-off-by Dan Carpenter <[email protected]>
drivers/gpu/drm/nouveau/nv50_vram.c +1 -1
@@ -42,7 +42,7 @@ nv50_vram_flags_valid(struct drm_device *dev, u32 tile_flags) {int type = (tile_flags &NOUVEAU_GEM_TILE_LAYOUT_MASK ) >>8 ; -if (likely (type <sizeof (types) && types[type])) +if (likely (type <ARRAY_SIZE (types) && types[type]))return true;return false; }
Quoted 1 line · Dan Carpenter
ARRAY_SIZE()was intended here,sizeof()is too large.
Thanks, I've queued this patch.
Ben.
Quoted 16 lines
Signed-off-by Dan Carpenter <[email protected]>drivers/gpu/drm/nouveau/nv50_vram.c +1
-1@@ -42,7 +42,7 @@ nv50_vram_flags_valid(struct drm_device *dev, u32 tile_flags) {int type = (tile_flags &NOUVEAU_GEM_TILE_LAYOUT_MASK ) >>8 ; -if (likely (type <sizeof (types) && types[type])) +if (likely (type <ARRAY_SIZE (types) && types[type]))return true;return false; }