powerpc/virtex/spi: Xilinx SPI driver not releasing memory
The driver was not releasing memory when it was removed or when there was a failure during probe. This fixes it. Signed-off-by: John Linn <john.linn@xilinx.com> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This commit is contained in:
Родитель
e7eec2fc27
Коммит
1df879e4bb
|
@ -354,7 +354,7 @@ static int __init xilinx_spi_of_probe(struct of_device *ofdev,
|
||||||
if (xspi->regs == NULL) {
|
if (xspi->regs == NULL) {
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
dev_warn(&ofdev->dev, "ioremap failure\n");
|
dev_warn(&ofdev->dev, "ioremap failure\n");
|
||||||
goto put_master;
|
goto release_mem;
|
||||||
}
|
}
|
||||||
xspi->irq = r_irq->start;
|
xspi->irq = r_irq->start;
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ static int __init xilinx_spi_of_probe(struct of_device *ofdev,
|
||||||
prop = of_get_property(ofdev->node, "xlnx,num-ss-bits", &len);
|
prop = of_get_property(ofdev->node, "xlnx,num-ss-bits", &len);
|
||||||
if (!prop || len < sizeof(*prop)) {
|
if (!prop || len < sizeof(*prop)) {
|
||||||
dev_warn(&ofdev->dev, "no 'xlnx,num-ss-bits' property\n");
|
dev_warn(&ofdev->dev, "no 'xlnx,num-ss-bits' property\n");
|
||||||
goto put_master;
|
goto unmap_io;
|
||||||
}
|
}
|
||||||
master->num_chipselect = *prop;
|
master->num_chipselect = *prop;
|
||||||
|
|
||||||
|
@ -397,6 +397,8 @@ free_irq:
|
||||||
free_irq(xspi->irq, xspi);
|
free_irq(xspi->irq, xspi);
|
||||||
unmap_io:
|
unmap_io:
|
||||||
iounmap(xspi->regs);
|
iounmap(xspi->regs);
|
||||||
|
release_mem:
|
||||||
|
release_mem_region(r_mem->start, resource_size(r_mem));
|
||||||
put_master:
|
put_master:
|
||||||
spi_master_put(master);
|
spi_master_put(master);
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -406,6 +408,7 @@ static int __devexit xilinx_spi_remove(struct of_device *ofdev)
|
||||||
{
|
{
|
||||||
struct xilinx_spi *xspi;
|
struct xilinx_spi *xspi;
|
||||||
struct spi_master *master;
|
struct spi_master *master;
|
||||||
|
struct resource r_mem;
|
||||||
|
|
||||||
master = platform_get_drvdata(ofdev);
|
master = platform_get_drvdata(ofdev);
|
||||||
xspi = spi_master_get_devdata(master);
|
xspi = spi_master_get_devdata(master);
|
||||||
|
@ -413,6 +416,8 @@ static int __devexit xilinx_spi_remove(struct of_device *ofdev)
|
||||||
spi_bitbang_stop(&xspi->bitbang);
|
spi_bitbang_stop(&xspi->bitbang);
|
||||||
free_irq(xspi->irq, xspi);
|
free_irq(xspi->irq, xspi);
|
||||||
iounmap(xspi->regs);
|
iounmap(xspi->regs);
|
||||||
|
if (!of_address_to_resource(ofdev->node, 0, &r_mem))
|
||||||
|
release_mem_region(r_mem.start, resource_size(&r_mem));
|
||||||
dev_set_drvdata(&ofdev->dev, 0);
|
dev_set_drvdata(&ofdev->dev, 0);
|
||||||
spi_master_put(xspi->bitbang.master);
|
spi_master_put(xspi->bitbang.master);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче