From 57841439b62e3ddb5ee50e765aa50330dde612d0 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 20 Sep 2013 18:39:18 +0800 Subject: [PATCH 1/3] spi: efm32: Don't call kfree() after spi_master_put() Calling kfree() to clean up the memory obtained from spi_alloc_master() is wrong as this is done in spi_master_release() when spi_master->dev's refcount reaches zero. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/spi/spi-efm32.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/spi/spi-efm32.c b/drivers/spi/spi-efm32.c index 7d84418a01d8..5b3117f69507 100644 --- a/drivers/spi/spi-efm32.c +++ b/drivers/spi/spi-efm32.c @@ -467,7 +467,6 @@ err_disable_clk: clk_disable_unprepare(ddata->clk); err: spi_master_put(master); - kfree(master); } return ret; @@ -484,7 +483,6 @@ static int efm32_spi_remove(struct platform_device *pdev) free_irq(ddata->rxirq, ddata); clk_disable_unprepare(ddata->clk); spi_master_put(master); - kfree(master); return 0; } From e6f7563b7354c2eb26d89b8622b3582a4c6510d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Tue, 10 Sep 2013 09:51:30 +0200 Subject: [PATCH 2/3] spi: efm32: add spi_bitbang_stop to device remove callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This call is needed to cleanup the resources requested by spi_bitbang_start in the probe callback. Noticed-by: Axel Lin Signed-off-by: Uwe Kleine-König Signed-off-by: Mark Brown --- drivers/spi/spi-efm32.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-efm32.c b/drivers/spi/spi-efm32.c index 34ef44c77e8e..5ce61e5f9770 100644 --- a/drivers/spi/spi-efm32.c +++ b/drivers/spi/spi-efm32.c @@ -477,6 +477,8 @@ static int efm32_spi_remove(struct platform_device *pdev) struct spi_master *master = platform_get_drvdata(pdev); struct efm32_spi_ddata *ddata = spi_master_get_devdata(master); + spi_bitbang_stop(&ddata->bitbang); + efm32_spi_write32(ddata, 0, REG_IEN); free_irq(ddata->txirq, ddata); From 6a009e8d886be476d7e6ea978c27c9517c449d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Tue, 8 Oct 2013 20:49:59 +0200 Subject: [PATCH 3/3] spi: efm32: drop unused struct and fix size check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The variable efm32_spi_pdata_default origins from an earlier revision of the patch introducing the driver, its use was dropped because of review comments but I forgot to also drop the variable itself. Signed-off-by: Uwe Kleine-König Signed-off-by: Mark Brown --- drivers/spi/spi-efm32.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/spi/spi-efm32.c b/drivers/spi/spi-efm32.c index 5ce61e5f9770..d4d3cc534792 100644 --- a/drivers/spi/spi-efm32.c +++ b/drivers/spi/spi-efm32.c @@ -280,10 +280,6 @@ static irqreturn_t efm32_spi_txirq(int irq, void *data) return IRQ_HANDLED; } -static const struct efm32_spi_pdata efm32_spi_pdata_default = { - .location = 1, -}; - static u32 efm32_spi_get_configured_location(struct efm32_spi_ddata *ddata) { u32 reg = efm32_spi_read32(ddata, REG_ROUTE); @@ -387,7 +383,7 @@ static int efm32_spi_probe(struct platform_device *pdev) goto err; } - if (resource_size(res) < 60) { + if (resource_size(res) < 0x60) { ret = -EINVAL; dev_err(&pdev->dev, "memory resource too small\n"); goto err;