]> err.no Git - linux-2.6/blobdiff - drivers/video/vesafb.c
Merge head 'drm-fixes' of master.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6
[linux-2.6] / drivers / video / vesafb.c
index f3069b01e248efa1eaf86e00fec16ff6047fc048..9ed1a931dd315c8008d7d6b952f1a34900c2222f 100644 (file)
@@ -389,10 +389,11 @@ static int __init vesafb_probe(struct device *device)
                unsigned int temp_size = size_total;
                /* Find the largest power-of-two */
                while (temp_size & (temp_size - 1))
-                       temp_size &= (temp_size - 1);
-                        
-                /* Try and find a power of two to add */
-               while (temp_size && mtrr_add(vesafb_fix.smem_start, temp_size, MTRR_TYPE_WRCOMB, 1)==-EINVAL) {
+                       temp_size &= (temp_size - 1);
+
+               /* Try and find a power of two to add */
+               while (temp_size > PAGE_SIZE &&
+                       mtrr_add(vesafb_fix.smem_start, temp_size, MTRR_TYPE_WRCOMB, 1)==-EINVAL) {
                        temp_size >>= 1;
                }
        }