spi: spi-ep93xx: get platform resources early in (*probe)
PATCH v2 4/11 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 <[email protected]>
Cc Ryan Mallon <[email protected]>
Cc Mika Westerberg <[email protected]>
Cc Mark Brown <[email protected]>
Cc Grant Likely <[email protected]>
--- drivers/spi/spi-ep93xx.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
drivers/spi/spi-ep93xx.c +12 -14
@@ -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);
Signature · 1 line
1.8.1.4
Quoted 6 lines · H Hartley Sweeten
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 <[email protected]>Cc Ryan Mallon <[email protected]>Cc Mika Westerberg <[email protected]>
Acked-by Mika Westerberg <[email protected]>
Quoted 2 lines · H Hartley Sweeten
Get the platform resources early in the (*probe) to minimize the number of goto's in the error path.
Applied, thanks.