aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenth Eriksson <kenth.eriksson@transmode.com>2012-03-30 17:05:30 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-02 09:47:54 -0700
commit7388a987be7ae204e00e27f1ef6d3e1b7689637c (patch)
tree2e07225ac25234e0245e1fda9c61f736e140d9ad
parentaaa9ef3b913499bdcc81ac859624a06ffea62374 (diff)
spi/mpc83xx: fix NULL pdata dereference bug
commit 5039a86973cd35bdb2f64d28ee12f13fe2bb5a4c upstream. Commit 178db7d3, "spi: Fix device unregistration when unregistering the bus master", changed device initialization to be children of the bus master, not children of the bus masters parent device. The pdata pointer used in fsl_spi_chipselect must updated to reflect the changed initialization. Signed-off-by: Kenth Eriksson <kenth.eriksson@transmode.com> Acked-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Alfredo Capella <alfredo.capella@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/spi/spi_fsl_spi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/spi/spi_fsl_spi.c b/drivers/spi/spi_fsl_spi.c
index 7963c9b4956..1be6b418561 100644
--- a/drivers/spi/spi_fsl_spi.c
+++ b/drivers/spi/spi_fsl_spi.c
@@ -139,10 +139,12 @@ static void fsl_spi_change_mode(struct spi_device *spi)
static void fsl_spi_chipselect(struct spi_device *spi, int value)
{
struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master);
- struct fsl_spi_platform_data *pdata = spi->dev.parent->platform_data;
+ struct fsl_spi_platform_data *pdata;
bool pol = spi->mode & SPI_CS_HIGH;
struct spi_mpc8xxx_cs *cs = spi->controller_state;
+ pdata = spi->dev.parent->parent->platform_data;
+
if (value == BITBANG_CS_INACTIVE) {
if (pdata->cs_control)
pdata->cs_control(spi, !pol);