diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2013-07-02 21:07:53 +0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-07-15 14:37:13 +0400 |
commit | 48a7776e981fdf780728e45de4ae4f2b522c9c4d (patch) | |
tree | ff12c42effb7b70d80ec296025d47d3c6c982082 /drivers/spi/spi-ep93xx.c | |
parent | 701c3587ee38ed53719187b0f1b059e113ac534f (diff) | |
download | linux-48a7776e981fdf780728e45de4ae4f2b522c9c4d.tar.xz |
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) info = pdev->dev.platform_data; + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + dev_err(&pdev->dev, "failed to get irq resources\n"); + return -EBUSY; + } + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "unable to get iomem resource\n"); + return -ENODEV; + } + master = spi_alloc_master(&pdev->dev, sizeof(*espi)); if (!master) { dev_err(&pdev->dev, "failed to allocate spi master\n"); @@ -1027,20 +1039,6 @@ static int ep93xx_spi_probe(struct platform_device *pdev) espi->min_rate = clk_get_rate(espi->clk) / (254 * 256); espi->pdev = pdev; - irq = platform_get_irq(pdev, 0); - if (irq < 0) { - error = -EBUSY; - dev_err(&pdev->dev, "failed to get irq resources\n"); - goto fail_put_clock; - } - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "unable to get iomem resource\n"); - error = -ENODEV; - goto fail_put_clock; - } - espi->sspdr_phys = res->start + SSPDR; espi->regs_base = devm_ioremap_resource(&pdev->dev, res); |