Commit dd3afa57 authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman

staging: fbtft: replace master->setup() with spi_setup()

Calling the setup of the SPI master directly causes a NULL pointer
dereference with master drivers without a separate setup function.
This problem is reproduceable on ARM MXS platform.

So fix this issue by using spi_setup() instead.
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Acked-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cabb5b2a
...@@ -76,7 +76,7 @@ static int init_display(struct fbtft_par *par) ...@@ -76,7 +76,7 @@ static int init_display(struct fbtft_par *par)
/* Set CS active high */ /* Set CS active high */
par->spi->mode |= SPI_CS_HIGH; par->spi->mode |= SPI_CS_HIGH;
ret = par->spi->master->setup(par->spi); ret = spi_setup(par->spi);
if (ret) { if (ret) {
dev_err(par->info->device, "Could not set SPI_CS_HIGH\n"); dev_err(par->info->device, "Could not set SPI_CS_HIGH\n");
return ret; return ret;
......
...@@ -169,7 +169,7 @@ static int init_display(struct fbtft_par *par) ...@@ -169,7 +169,7 @@ static int init_display(struct fbtft_par *par)
/* enable SPI interface by having CS and MOSI low during reset */ /* enable SPI interface by having CS and MOSI low during reset */
save_mode = par->spi->mode; save_mode = par->spi->mode;
par->spi->mode |= SPI_CS_HIGH; par->spi->mode |= SPI_CS_HIGH;
ret = par->spi->master->setup(par->spi); /* set CS inactive low */ ret = spi_setup(par->spi); /* set CS inactive low */
if (ret) { if (ret) {
dev_err(par->info->device, "Could not set SPI_CS_HIGH\n"); dev_err(par->info->device, "Could not set SPI_CS_HIGH\n");
return ret; return ret;
...@@ -180,7 +180,7 @@ static int init_display(struct fbtft_par *par) ...@@ -180,7 +180,7 @@ static int init_display(struct fbtft_par *par)
par->fbtftops.reset(par); par->fbtftops.reset(par);
mdelay(1000); mdelay(1000);
par->spi->mode = save_mode; par->spi->mode = save_mode;
ret = par->spi->master->setup(par->spi); ret = spi_setup(par->spi);
if (ret) { if (ret) {
dev_err(par->info->device, "Could not restore SPI mode\n"); dev_err(par->info->device, "Could not restore SPI mode\n");
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment