diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2013-07-02 13:07:53 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-07-15 06:37:13 -0400 |
commit | 48a7776e981fdf780728e45de4ae4f2b522c9c4d (patch) | |
tree | ff12c42effb7b70d80ec296025d47d3c6c982082 /drivers/spi/spi-ep93xx.c | |
parent | 701c3587ee38ed53719187b0f1b059e113ac534f (diff) |
spi: spi-ep93xx: get platform resources early in (*probe)
Get the platform resources early in the (*probe) to minimize the number
of goto's in the error path.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-ep93xx.c')
-rw-r--r-- | drivers/spi/spi-ep93xx.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c index d5e64201cdd3..c2660c24c0ab 100644 --- a/drivers/spi/spi-ep93xx.c +++ b/drivers/spi/spi-ep93xx.c | |||
@@ -991,6 +991,18 @@ static int ep93xx_spi_probe(struct platform_device *pdev) | |||
991 | 991 | ||
992 | info = pdev->dev.platform_data; | 992 | info = pdev->dev.platform_data; |
993 | 993 | ||
994 | irq = platform_get_irq(pdev, 0); | ||
995 | if (irq < 0) { | ||
996 | dev_err(&pdev->dev, "failed to get irq resources\n"); | ||
997 | return -EBUSY; | ||
998 | } | ||
999 | |||
1000 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1001 | if (!res) { | ||
1002 | dev_err(&pdev->dev, "unable to get iomem resource\n"); | ||
1003 | return -ENODEV; | ||
1004 | } | ||
1005 | |||
994 | master = spi_alloc_master(&pdev->dev, sizeof(*espi)); | 1006 | master = spi_alloc_master(&pdev->dev, sizeof(*espi)); |
995 | if (!master) { | 1007 | if (!master) { |
996 | dev_err(&pdev->dev, "failed to allocate spi master\n"); | 1008 | dev_err(&pdev->dev, "failed to allocate spi master\n"); |
@@ -1027,20 +1039,6 @@ static int ep93xx_spi_probe(struct platform_device *pdev) | |||
1027 | espi->min_rate = clk_get_rate(espi->clk) / (254 * 256); | 1039 | espi->min_rate = clk_get_rate(espi->clk) / (254 * 256); |
1028 | espi->pdev = pdev; | 1040 | espi->pdev = pdev; |
1029 | 1041 | ||
1030 | irq = platform_get_irq(pdev, 0); | ||
1031 | if (irq < 0) { | ||
1032 | error = -EBUSY; | ||
1033 | dev_err(&pdev->dev, "failed to get irq resources\n"); | ||
1034 | goto fail_put_clock; | ||
1035 | } | ||
1036 | |||
1037 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1038 | if (!res) { | ||
1039 | dev_err(&pdev->dev, "unable to get iomem resource\n"); | ||
1040 | error = -ENODEV; | ||
1041 | goto fail_put_clock; | ||
1042 | } | ||
1043 | |||
1044 | espi->sspdr_phys = res->start + SSPDR; | 1042 | espi->sspdr_phys = res->start + SSPDR; |
1045 | 1043 | ||
1046 | espi->regs_base = devm_ioremap_resource(&pdev->dev, res); | 1044 | espi->regs_base = devm_ioremap_resource(&pdev->dev, res); |