We were supporting 24bpp.  However, the pixel organisation in
memory was 0RGB, so it was 24bpp in 32bit words.  This means
we're actually supporting 32bpp and not 24bpp.
Also, add a check to ensure that we don't exceed the available
framebuffer when changing display resolutions.
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
                        var->blue.offset        = 10;
                }
                break;
-       case 24:
+       case 32:
                if (fb->panel->cntl & CNTL_LCDTFT) {
                        var->red.length         = 8;
                        var->green.length       = 8;
 
        if (fb->board->check)
                ret = fb->board->check(fb, var);
+
+       if (ret == 0 &&
+           var->xres_virtual * var->bits_per_pixel / 8 *
+           var->yres_virtual > fb->fb.fix.smem_len)
+               ret = -EINVAL;
+
        if (ret == 0)
                ret = clcdfb_set_bitfields(fb, var);
 
 
        case 16:
                val |= CNTL_LCDBPP16;
                break;
-       case 24:
+       case 32:
                val |= CNTL_LCDBPP24;
                break;
        }