aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@uclinux.org>2014-10-21 01:57:48 -0400
committerMark Brown <broonie@kernel.org>2014-10-22 06:05:54 -0400
commit9a2d3635524fe80d9e23623b2fe4a2113045f8d8 (patch)
treebf32e9630ecff25d1f110fdcfe36f4ea63396f6c /drivers/spi
parentf114040e3ea6e07372334ade75d1ee0775c355e1 (diff)
spi: orion: fix potential NULL pointer de-reference
It's possible that the call to of_match_device() (introduced in commit df59fa7f ["spi: orion: support armada extended baud rates"]) may return a NULL if there is no match in the device tree (or perhaps no device tree at all). Check the return pointer and set the local device data to the lowest common denominator orion device data if it is NULL. Reported-by: Karl Beldan <karl.beldan@gmail.com> Signed-off-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-orion.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
index 835cdda6f4f5..c76b7d7879df 100644
--- a/drivers/spi/spi-orion.c
+++ b/drivers/spi/spi-orion.c
@@ -454,7 +454,7 @@ static int orion_spi_probe(struct platform_device *pdev)
454 spi->master = master; 454 spi->master = master;
455 455
456 of_id = of_match_device(orion_spi_of_match_table, &pdev->dev); 456 of_id = of_match_device(orion_spi_of_match_table, &pdev->dev);
457 devdata = of_id->data; 457 devdata = (of_id) ? of_id->data : &orion_spi_dev_data;
458 spi->devdata = devdata; 458 spi->devdata = devdata;
459 459
460 spi->clk = devm_clk_get(&pdev->dev, NULL); 460 spi->clk = devm_clk_get(&pdev->dev, NULL);