* [patch 2.6.28-rc6] spi: fix spi_imx probe oopsing
@ 2008-11-22 19:53 David Brownell
0 siblings, 0 replies; only message in thread
From: David Brownell @ 2008-11-22 19:53 UTC (permalink / raw)
To: Andrew Morton
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Julien Boibessot
From: Julien Boibessot <julien.boibessot-GANU6spQydw@public.gmane.org>
Corrects spi_imx driver oops during initialization/probing:
can't use drv_data before it's allocated.
Signed-off-by: Julien Boibessot <julien.boibessot-d2DlULPkwbNWk0Htik3J/w@public.gmane.org>
Acked-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
---
drivers/spi/spi_imx.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
--- a/drivers/spi/spi_imx.c
+++ b/drivers/spi/spi_imx.c
@@ -1456,7 +1456,7 @@ static int __init spi_imx_probe(struct p
struct device *dev = &pdev->dev;
struct spi_imx_master *platform_info;
struct spi_master *master;
- struct driver_data *drv_data = NULL;
+ struct driver_data *drv_data;
struct resource *res;
int irq, status = 0;
@@ -1467,14 +1467,6 @@ static int __init spi_imx_probe(struct p
goto err_no_pdata;
}
- drv_data->clk = clk_get(&pdev->dev, "perclk2");
- if (IS_ERR(drv_data->clk)) {
- dev_err(&pdev->dev, "probe - cannot get get\n");
- status = PTR_ERR(drv_data->clk);
- goto err_no_clk;
- }
- clk_enable(drv_data->clk);
-
/* Allocate master with space for drv_data */
master = spi_alloc_master(dev, sizeof(struct driver_data));
if (!master) {
@@ -1495,6 +1487,14 @@ static int __init spi_imx_probe(struct p
drv_data->dummy_dma_buf = SPI_DUMMY_u32;
+ drv_data->clk = clk_get(&pdev->dev, "perclk2");
+ if (IS_ERR(drv_data->clk)) {
+ dev_err(&pdev->dev, "probe - cannot get clock\n");
+ status = PTR_ERR(drv_data->clk);
+ goto err_no_clk;
+ }
+ clk_enable(drv_data->clk);
+
/* Find and map resources */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
@@ -1630,12 +1630,13 @@ err_no_iomap:
kfree(drv_data->ioarea);
err_no_iores:
- spi_master_put(master);
-
-err_no_pdata:
clk_disable(drv_data->clk);
clk_put(drv_data->clk);
+
err_no_clk:
+ spi_master_put(master);
+
+err_no_pdata:
err_no_mem:
return status;
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-11-22 19:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-22 19:53 [patch 2.6.28-rc6] spi: fix spi_imx probe oopsing David Brownell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).