]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: fbtft: do not allocate huge txbuf
authorMichal Suchanek <hramrach@gmail.com>
Thu, 9 Jun 2016 15:08:42 +0000 (15:08 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2016 15:52:47 +0000 (17:52 +0200)
txbuflen can be set to arbitrary value by user and it is also set
automagically to the maximum transfer size of the SPI master controller.

Do not allocate the buffer when larger than vmem. When my SPI master
controller reports maximum transfer size 16M the probe of fbtft fails.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fbtft/fbtft-core.c

index 0c1a77cafe14191a397f6a4be43201da2f92dd75..ce4fd374c3d0a7ce8b12b79fc9e949691b62bca7 100644 (file)
@@ -820,6 +820,8 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
        /* Transmit buffer */
        if (txbuflen == -1)
                txbuflen = vmem_size + 2; /* add in case startbyte is used */
+       if (txbuflen >= vmem_size + 2)
+               txbuflen = 0;
 
 #ifdef __LITTLE_ENDIAN
        if ((!txbuflen) && (bpp > 8))