From: Stefan Wahren <stefan.wahren@i2se.com>
To: "Noralf Trønnes" <noralf@tronnes.org>,
"Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Henri Chain <henri.chain@eleves.ec-nantes.fr>,
linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
Stefan Wahren <stefan.wahren@i2se.com>
Subject: [PATCH 2/2] staging: fbtft: replace master->setup() with spi_setup()
Date: Tue, 25 Aug 2015 21:04:12 +0000 [thread overview]
Message-ID: <1440536652-7940-3-git-send-email-stefan.wahren@i2se.com> (raw)
In-Reply-To: <1440536652-7940-1-git-send-email-stefan.wahren@i2se.com>
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: Stefan Wahren <stefan.wahren@i2se.com>
---
drivers/staging/fbtft/fb_uc1611.c | 2 +-
drivers/staging/fbtft/fb_watterott.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/fbtft/fb_uc1611.c b/drivers/staging/fbtft/fb_uc1611.c
index 32f3a9d..5cafa50 100644
--- a/drivers/staging/fbtft/fb_uc1611.c
+++ b/drivers/staging/fbtft/fb_uc1611.c
@@ -76,7 +76,7 @@ static int init_display(struct fbtft_par *par)
/* Set CS active high */
par->spi->mode |= SPI_CS_HIGH;
- ret = par->spi->master->setup(par->spi);
+ ret = spi_setup(par->spi);
if (ret) {
dev_err(par->info->device, "Could not set SPI_CS_HIGH\n");
return ret;
diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c
index 88fb2c0..8eae6ef 100644
--- a/drivers/staging/fbtft/fb_watterott.c
+++ b/drivers/staging/fbtft/fb_watterott.c
@@ -169,7 +169,7 @@ static int init_display(struct fbtft_par *par)
/* enable SPI interface by having CS and MOSI low during reset */
save_mode = par->spi->mode;
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) {
dev_err(par->info->device, "Could not set SPI_CS_HIGH\n");
return ret;
@@ -180,7 +180,7 @@ static int init_display(struct fbtft_par *par)
par->fbtftops.reset(par);
mdelay(1000);
par->spi->mode = save_mode;
- ret = par->spi->master->setup(par->spi);
+ ret = spi_setup(par->spi);
if (ret) {
dev_err(par->info->device, "Could not restore SPI mode\n");
return ret;
--
1.7.9.5
prev parent reply other threads:[~2015-08-25 21:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-25 21:04 [PATCH 0/2] staging: fbtft: Avoid calling SPI master setup directly Stefan Wahren
2015-08-25 21:04 ` [PATCH 1/2] staging: fbtft: fix 9-bit SPI support detection Stefan Wahren
2015-08-25 22:07 ` Noralf Trønnes
2015-08-25 21:04 ` Stefan Wahren [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1440536652-7940-3-git-send-email-stefan.wahren@i2se.com \
--to=stefan.wahren@i2se.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=henri.chain@eleves.ec-nantes.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=noralf@tronnes.org \
--cc=thomas.petazzoni@free-electrons.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®