summaryrefslogtreecommitdiffstats
path: root/drivers/staging/fbtft/fbtft-core.c
diff options
context:
space:
mode:
authorStefan Wahren2015-08-25 23:04:11 +0200
committerGreg Kroah-Hartman2015-09-13 18:33:58 +0200
commitcabb5b2a2866829177df2f1cee70f0dd42ee6ae0 (patch)
tree2ab184760bc67873c8603b181e2eb078b6db2c35 /drivers/staging/fbtft/fbtft-core.c
parentstaging/lustre: change Lustre URLs and mailing list (diff)
downloadkernel-qcow2-linux-cabb5b2a2866829177df2f1cee70f0dd42ee6ae0.tar.gz
kernel-qcow2-linux-cabb5b2a2866829177df2f1cee70f0dd42ee6ae0.tar.xz
kernel-qcow2-linux-cabb5b2a2866829177df2f1cee70f0dd42ee6ae0.zip
staging: fbtft: fix 9-bit SPI support detection
Since the result of the setup function isn't adequate to check 9-bit SPI support, we better check bits_per_word_mask. Btw this change avoids a NULL pointer dereference with master drivers without a separate setup function. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Acked-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/fbtft/fbtft-core.c')
-rw-r--r--drivers/staging/fbtft/fbtft-core.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index 23392eb6799e..7f5fa3d1cab0 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -1436,15 +1436,11 @@ int fbtft_probe_common(struct fbtft_display *display,
/* 9-bit SPI setup */
if (par->spi && display->buswidth == 9) {
- par->spi->bits_per_word = 9;
- ret = par->spi->master->setup(par->spi);
- if (ret) {
+ if (par->spi->master->bits_per_word_mask & SPI_BPW_MASK(9)) {
+ par->spi->bits_per_word = 9;
+ } else {
dev_warn(&par->spi->dev,
"9-bit SPI not available, emulating using 8-bit.\n");
- par->spi->bits_per_word = 8;
- ret = par->spi->master->setup(par->spi);
- if (ret)
- goto out_release;
/* allocate buffer with room for dc bits */
par->extra = devm_kzalloc(par->info->device,
par->txbuf.len + (par->txbuf.len / 8) + 8,