aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/xilinx_spi.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index fe7e5f35e5d0..494d3f756e29 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -354,7 +354,7 @@ static int __init xilinx_spi_of_probe(struct of_device *ofdev,
354 if (xspi->regs == NULL) { 354 if (xspi->regs == NULL) {
355 rc = -ENOMEM; 355 rc = -ENOMEM;
356 dev_warn(&ofdev->dev, "ioremap failure\n"); 356 dev_warn(&ofdev->dev, "ioremap failure\n");
357 goto put_master; 357 goto release_mem;
358 } 358 }
359 xspi->irq = r_irq->start; 359 xspi->irq = r_irq->start;
360 360
@@ -365,7 +365,7 @@ static int __init xilinx_spi_of_probe(struct of_device *ofdev,
365 prop = of_get_property(ofdev->node, "xlnx,num-ss-bits", &len); 365 prop = of_get_property(ofdev->node, "xlnx,num-ss-bits", &len);
366 if (!prop || len < sizeof(*prop)) { 366 if (!prop || len < sizeof(*prop)) {
367 dev_warn(&ofdev->dev, "no 'xlnx,num-ss-bits' property\n"); 367 dev_warn(&ofdev->dev, "no 'xlnx,num-ss-bits' property\n");
368 goto put_master; 368 goto unmap_io;
369 } 369 }
370 master->num_chipselect = *prop; 370 master->num_chipselect = *prop;
371 371
@@ -397,6 +397,8 @@ free_irq:
397 free_irq(xspi->irq, xspi); 397 free_irq(xspi->irq, xspi);
398unmap_io: 398unmap_io:
399 iounmap(xspi->regs); 399 iounmap(xspi->regs);
400release_mem:
401 release_mem_region(r_mem->start, resource_size(r_mem));
400put_master: 402put_master:
401 spi_master_put(master); 403 spi_master_put(master);
402 return rc; 404 return rc;
@@ -406,6 +408,7 @@ static int __devexit xilinx_spi_remove(struct of_device *ofdev)
406{ 408{
407 struct xilinx_spi *xspi; 409 struct xilinx_spi *xspi;
408 struct spi_master *master; 410 struct spi_master *master;
411 struct resource r_mem;
409 412
410 master = platform_get_drvdata(ofdev); 413 master = platform_get_drvdata(ofdev);
411 xspi = spi_master_get_devdata(master); 414 xspi = spi_master_get_devdata(master);
@@ -413,6 +416,8 @@ static int __devexit xilinx_spi_remove(struct of_device *ofdev)
413 spi_bitbang_stop(&xspi->bitbang); 416 spi_bitbang_stop(&xspi->bitbang);
414 free_irq(xspi->irq, xspi); 417 free_irq(xspi->irq, xspi);
415 iounmap(xspi->regs); 418 iounmap(xspi->regs);
419 if (!of_address_to_resource(ofdev->node, 0, &r_mem))
420 release_mem_region(r_mem.start, resource_size(&r_mem));
416 dev_set_drvdata(&ofdev->dev, 0); 421 dev_set_drvdata(&ofdev->dev, 0);
417 spi_master_put(xspi->bitbang.master); 422 spi_master_put(xspi->bitbang.master);
418 423