Message ID | 1413871068-32174-1-git-send-email-gerg@uclinux.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 9a2d3635524fe80d9e23623b2fe4a2113045f8d8 |
Headers | show |
On Tue, Oct 21, 2014 at 03:57:48PM +1000, gerg@uclinux.org wrote: > From: Greg Ungerer <gerg@uclinux.org> > > 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. Applied, thanks.
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index 835cdda..c76b7d7 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) spi->master = master; of_id = of_match_device(orion_spi_of_match_table, &pdev->dev); - devdata = of_id->data; + devdata = (of_id) ? of_id->data : &orion_spi_dev_data; spi->devdata = devdata; spi->clk = devm_clk_get(&pdev->dev, NULL);