mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
spi: bcm63xx: Use devm_clk_get()
Use devm_clk_get() to make cleanup paths simpler. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
6ce4eac1f6
commit
acf4fc6ffa
1 changed files with 4 additions and 11 deletions
|
@ -345,22 +345,19 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
|
||||||
irq = platform_get_irq(pdev, 0);
|
irq = platform_get_irq(pdev, 0);
|
||||||
if (irq < 0) {
|
if (irq < 0) {
|
||||||
dev_err(dev, "no irq\n");
|
dev_err(dev, "no irq\n");
|
||||||
ret = -ENXIO;
|
return -ENXIO;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clk = clk_get(dev, "spi");
|
clk = devm_clk_get(dev, "spi");
|
||||||
if (IS_ERR(clk)) {
|
if (IS_ERR(clk)) {
|
||||||
dev_err(dev, "no clock for device\n");
|
dev_err(dev, "no clock for device\n");
|
||||||
ret = PTR_ERR(clk);
|
return PTR_ERR(clk);
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
master = spi_alloc_master(dev, sizeof(*bs));
|
master = spi_alloc_master(dev, sizeof(*bs));
|
||||||
if (!master) {
|
if (!master) {
|
||||||
dev_err(dev, "out of memory\n");
|
dev_err(dev, "out of memory\n");
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto out_clk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bs = spi_master_get_devdata(master);
|
bs = spi_master_get_devdata(master);
|
||||||
|
@ -427,9 +424,6 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
|
||||||
clk_disable_unprepare(clk);
|
clk_disable_unprepare(clk);
|
||||||
out_err:
|
out_err:
|
||||||
spi_master_put(master);
|
spi_master_put(master);
|
||||||
out_clk:
|
|
||||||
clk_put(clk);
|
|
||||||
out:
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +437,6 @@ static int bcm63xx_spi_remove(struct platform_device *pdev)
|
||||||
|
|
||||||
/* HW shutdown */
|
/* HW shutdown */
|
||||||
clk_disable_unprepare(bs->clk);
|
clk_disable_unprepare(bs->clk);
|
||||||
clk_put(bs->clk);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue