aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@linux-m68k.org>2013-12-23 13:34:23 -0500
committerMark Brown <broonie@linaro.org>2013-12-24 08:12:04 -0500
commitefd85acb4f2118348fc3a7c831872d5e70c7bec0 (patch)
treea720b0ba0755f99cccefede249f034b04763b2fa /drivers/spi
parent6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff)
spi: rspi: Fix NULL pointer dereference on SH7757
SH7757 doesn't pass platform data, in which case spi-rspi uses default parameters. However, commit 5ce0ba88650f2606244a761d92e2b725f4ab3583 ("spi: rcar: add Renesas QSPI support on RSPI") added a new user of the platform data, but forgot to check for its validity first, causing a NULL pointer dereference on SH7757. Add the missing check to fix this. Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org> Acked-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-rspi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index 58449ad4ad0d..b60862f58534 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -958,8 +958,9 @@ static int rspi_probe(struct platform_device *pdev)
958 INIT_WORK(&rspi->ws, rspi_work); 958 INIT_WORK(&rspi->ws, rspi_work);
959 init_waitqueue_head(&rspi->wait); 959 init_waitqueue_head(&rspi->wait);
960 960
961 master->num_chipselect = rspi_pd->num_chipselect; 961 if (rspi_pd && rspi_pd->num_chipselect)
962 if (!master->num_chipselect) 962 master->num_chipselect = rspi_pd->num_chipselect;
963 else
963 master->num_chipselect = 2; /* default */ 964 master->num_chipselect = 2; /* default */
964 965
965 master->bus_num = pdev->id; 966 master->bus_num = pdev->id;