From 175f5a4130b20e25b34d9f9b0bb4cfe80ee49d88 Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: Thu, 9 Jun 2016 15:08:42 +0000 Subject: [PATCH] staging: fbtft: do not allocate huge txbuf MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Acked-by: Noralf Trønnes Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fbtft-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 0c1a77cafe14..ce4fd374c3d0 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -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)) -- 2.11.0