aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRoy Spliet2010-10-04 23:01:08 +0200
committerBen Skeggs2010-10-05 09:59:43 +1000
commita845fff841b13678b2d80f10425aba87db840e4a (patch)
treeb94b3bda5b9a6cc5650585d5072788ab72949cc6 /drivers
parentca8e7c6ccdfb9a77de9b9719e6ef768373fb607c (diff)
drm/nouveau: fix thinkos in mem timing table recordlen check
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_mem.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
index 00b31b5e16cd..a163c7c612e7 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -35,6 +35,8 @@
#include "drm_sarea.h"
#include "nouveau_drv.h"
+#define MIN(a,b) a < b ? a : b
+
/*
* NV10-NV40 tiling helpers
*/
@@ -717,14 +719,14 @@ nouveau_mem_timing_init(struct drm_device *dev)
tUNK_19 = 1;
tUNK_20 = 0;
tUNK_21 = 0;
- switch (recordlen) {
- case 0x21:
+ switch (MIN(recordlen,21)) {
+ case 21:
tUNK_21 = entry[21];
- case 0x20:
+ case 20:
tUNK_20 = entry[20];
- case 0x19:
+ case 19:
tUNK_19 = entry[19];
- case 0x18:
+ case 18:
tUNK_18 = entry[18];
default:
tUNK_0 = entry[0];