mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] SPI: spi-au1550: Fix build problem in au1550_spi_remove
@ 2014-08-20 14:40 Markos Chandras
  2014-08-20 15:33 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Markos Chandras @ 2014-08-20 14:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Markos Chandras, Mark Brown, Himangi Saraogi, linux-spi, linux-mips

Commit 30670539b867 ("spi: au1550: Fix bug in deallocation of memory")
switched from release_resource to release_mem_region to release
memory regions allocated using the request_mem_region. However,
a build problem was introduced due to 'r' being undefined in that
function. We fix this by having 'r' being defined as the platform's
IORESROUCE_MEM region.

This fixes a problem triggered by the db1xxx defconfig in the MIPS tree:

drivers/spi/spi-au1550.c: In function 'au1550_spi_remove':
drivers/spi/spi-au1550.c:948:21: error: 'r' undeclared (first use in this
							function)
release_mem_region(r->start, sizeof(psc_spi_t));

Cc: Mark Brown <broonie@kernel.org>
Cc: Himangi Saraogi <himangi774@gmail.com>
Cc: linux-spi@vger.kernel.org
Cc: linux-mips@linux-mips.org
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
---
This has only been compile tested
---
 drivers/spi/spi-au1550.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c
index 40c3d43c9292..f7edb504df78 100644
--- a/drivers/spi/spi-au1550.c
+++ b/drivers/spi/spi-au1550.c
@@ -937,6 +937,7 @@ err_nomem:
 
 static int au1550_spi_remove(struct platform_device *pdev)
 {
+	struct resource *r;
 	struct au1550_spi *hw = platform_get_drvdata(pdev);
 
 	dev_info(&pdev->dev, "spi master remove: bus_num=%d\n",
@@ -945,6 +946,13 @@ static int au1550_spi_remove(struct platform_device *pdev)
 	spi_bitbang_stop(&hw->bitbang);
 	free_irq(hw->irq, hw);
 	iounmap((void __iomem *)hw->regs);
+
+	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!r) {
+		dev_err(&pdev->dev, "no mmio resource\n");
+		return -ENODEV;
+	}
+
 	release_mem_region(r->start, sizeof(psc_spi_t));
 
 	if (hw->usedma) {
-- 
2.0.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] SPI: spi-au1550: Fix build problem in au1550_spi_remove
  2014-08-20 14:40 [PATCH] SPI: spi-au1550: Fix build problem in au1550_spi_remove Markos Chandras
@ 2014-08-20 15:33 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-08-20 15:33 UTC (permalink / raw)
  To: Markos Chandras; +Cc: linux-kernel, Himangi Saraogi, linux-spi, linux-mips

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

On Wed, Aug 20, 2014 at 03:40:13PM +0100, Markos Chandras wrote:
> Commit 30670539b867 ("spi: au1550: Fix bug in deallocation of memory")
> switched from release_resource to release_mem_region to release
> memory regions allocated using the request_mem_region. However,
> a build problem was introduced due to 'r' being undefined in that
> function. We fix this by having 'r' being defined as the platform's
> IORESROUCE_MEM region.

A different fix has already been sent for htis issue - please check if
there's anything you want to change with that and resubmit if there's
anything.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-20 16:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20 14:40 [PATCH] SPI: spi-au1550: Fix build problem in au1550_spi_remove Markos Chandras
2014-08-20 15:33 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®