summaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorMark Brown2010-09-01 16:55:22 +0200
committerGrant Likely2010-09-01 16:55:22 +0200
commitcc0fc0bbeb17dd33ed7bfea58d0178e9c007ff67 (patch)
treee659a873a4095b594d21aa38ccbd415498aa7961 /drivers/spi
parentLinux 2.6.36-rc3 (diff)
downloadkernel-qcow2-linux-cc0fc0bbeb17dd33ed7bfea58d0178e9c007ff67.tar.gz
kernel-qcow2-linux-cc0fc0bbeb17dd33ed7bfea58d0178e9c007ff67.tar.xz
kernel-qcow2-linux-cc0fc0bbeb17dd33ed7bfea58d0178e9c007ff67.zip
spi/spi_s3c64xx: Make probe more robust against missing board config
The S3C64xx SPI driver requires the machine to call s3c64xx_spi_set_info() to select a few options, including the clock to use for the SPI controller. If this is not done then a NULL will be passed as the clock name for clk_get(), causing an obscure crash. Guard against this and other missing configuration by validating that the clock name has been filled in in the platform data that ets passed in. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi_s3c64xx.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/spi/spi_s3c64xx.c b/drivers/spi/spi_s3c64xx.c
index 97365815a729..a0b63b785418 100644
--- a/drivers/spi/spi_s3c64xx.c
+++ b/drivers/spi/spi_s3c64xx.c
@@ -919,6 +919,13 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
return -ENODEV;
}
+ sci = pdev->dev.platform_data;
+ if (!sci->src_clk_name) {
+ dev_err(&pdev->dev,
+ "Board init must call s3c64xx_spi_set_info()\n");
+ return -EINVAL;
+ }
+
/* Check for availability of necessary resource */
dmatx_res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
@@ -946,8 +953,6 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
return -ENOMEM;
}
- sci = pdev->dev.platform_data;
-
platform_set_drvdata(pdev, master);
sdd = spi_master_get_devdata(master);