]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.3.8/spi-mpc83xx-fix-null-pdata-dereference-bug.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.3.8 / spi-mpc83xx-fix-null-pdata-dereference-bug.patch
1 From 5039a86973cd35bdb2f64d28ee12f13fe2bb5a4c Mon Sep 17 00:00:00 2001
2 From: Kenth Eriksson <kenth.eriksson@transmode.com>
3 Date: Fri, 30 Mar 2012 17:05:30 +0200
4 Subject: spi/mpc83xx: fix NULL pdata dereference bug
5
6 From: Kenth Eriksson <kenth.eriksson@transmode.com>
7
8 commit 5039a86973cd35bdb2f64d28ee12f13fe2bb5a4c upstream.
9
10 Commit 178db7d3, "spi: Fix device unregistration when unregistering
11 the bus master", changed device initialization to be children of the
12 bus master, not children of the bus masters parent device. The pdata
13 pointer used in fsl_spi_chipselect must updated to reflect the changed
14 initialization.
15
16 Signed-off-by: Kenth Eriksson <kenth.eriksson@transmode.com>
17 Acked-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
18 Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21 ---
22 drivers/spi/spi-fsl-spi.c | 4 +++-
23 1 file changed, 3 insertions(+), 1 deletion(-)
24
25 --- a/drivers/spi/spi-fsl-spi.c
26 +++ b/drivers/spi/spi-fsl-spi.c
27 @@ -139,10 +139,12 @@ static void fsl_spi_change_mode(struct s
28 static void fsl_spi_chipselect(struct spi_device *spi, int value)
29 {
30 struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master);
31 - struct fsl_spi_platform_data *pdata = spi->dev.parent->platform_data;
32 + struct fsl_spi_platform_data *pdata;
33 bool pol = spi->mode & SPI_CS_HIGH;
34 struct spi_mpc8xxx_cs *cs = spi->controller_state;
35
36 + pdata = spi->dev.parent->parent->platform_data;
37 +
38 if (value == BITBANG_CS_INACTIVE) {
39 if (pdata->cs_control)
40 pdata->cs_control(spi, !pol);