spi: au1550: Fix bug in deallocation of memory
authorHimangi Saraogi <himangi774@gmail.com>
Fri, 4 Jul 2014 17:39:49 +0000 (23:09 +0530)
committerMark Brown <broonie@linaro.org>
Fri, 4 Jul 2014 18:33:40 +0000 (19:33 +0100)
This patch fixes a bug on the deallocation of memory allocated using
request_mem_region, by using release_mem_region instead of
release_resource and kfree.

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-au1550.c

index 67375a11d4bdc1f25b117005c06b2f0917a236d4..fb61464348a1d3673c183693199aa1d26844ff0f 100644 (file)
@@ -925,8 +925,7 @@ err_no_txdma:
        iounmap((void __iomem *)hw->regs);
 
 err_ioremap:
-       release_resource(hw->ioarea);
-       kfree(hw->ioarea);
+       release_mem_region(r->start, sizeof(psc_spi_t));
 
 err_no_iores:
 err_no_pdata:
@@ -946,8 +945,7 @@ static int au1550_spi_remove(struct platform_device *pdev)
        spi_bitbang_stop(&hw->bitbang);
        free_irq(hw->irq, hw);
        iounmap((void __iomem *)hw->regs);
-       release_resource(hw->ioarea);
-       kfree(hw->ioarea);
+       release_mem_region(r->start, sizeof(psc_spi_t));
 
        if (hw->usedma) {
                au1550_spi_dma_rxtmp_free(hw);