* [patch -next] nouveua: sizeof() vs ARRAY_SIZE()
@ 2010-12-20 9:26 Dan Carpenter
2010-12-21 1:12 ` Ben Skeggs
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-12-20 9:26 UTC (permalink / raw)
To: David Airlie; +Cc: kernel-janitors, Ben Skeggs, dri-devel
ARRAY_SIZE() was intended here, sizeof() is too large.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/gpu/drm/nouveau/nv50_vram.c b/drivers/gpu/drm/nouveau/nv50_vram.c
index 47489ed..58e98ad 100644
--- a/drivers/gpu/drm/nouveau/nv50_vram.c
+++ b/drivers/gpu/drm/nouveau/nv50_vram.c
@@ -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;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch -next] nouveua: sizeof() vs ARRAY_SIZE()
2010-12-20 9:26 [patch -next] nouveua: sizeof() vs ARRAY_SIZE() Dan Carpenter
@ 2010-12-21 1:12 ` Ben Skeggs
0 siblings, 0 replies; 2+ messages in thread
From: Ben Skeggs @ 2010-12-21 1:12 UTC (permalink / raw)
To: Dan Carpenter; +Cc: kernel-janitors, dri-devel
On Mon, 2010-12-20 at 12:26 +0300, Dan Carpenter wrote:
> ARRAY_SIZE() was intended here, sizeof() is too large.
Thanks, I've queued this patch.
Ben.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/drivers/gpu/drm/nouveau/nv50_vram.c b/drivers/gpu/drm/nouveau/nv50_vram.c
> index 47489ed..58e98ad 100644
> --- a/drivers/gpu/drm/nouveau/nv50_vram.c
> +++ b/drivers/gpu/drm/nouveau/nv50_vram.c
> @@ -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;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-21 1:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-20 9:26 [patch -next] nouveua: sizeof() vs ARRAY_SIZE() Dan Carpenter
2010-12-21 1:12 ` Ben Skeggs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox