commit ec0237216e47335bbc7f2427519d6365922eb6a8 Author: Bas Vermeulen bas.vermeulen@novero.com Date: Thu Feb 11 18:53:52 2010 +0100 imx serial driver Check for NULL pointer before dereferencing, as it is possible and legal to pass in NULL for the platform data for a serial port. Signed-off-by: Bas Vermeulen diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 60d665a..d00fcf8 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c @@ -1279,7 +1279,7 @@ static int serial_imx_probe(struct platform_device *pdev) sport->use_irda = 1; #endif - if (pdata->init) { + if (pdata && pdata->init) { ret = pdata->init(pdev); if (ret) goto clkput; @@ -1292,7 +1292,7 @@ static int serial_imx_probe(struct platform_device *pdev) return 0; deinit: - if (pdata->exit) + if (pdata && pdata->exit) pdata->exit(pdev); clkput: clk_put(sport->clk); @@ -1321,7 +1321,7 @@ static int serial_imx_remove(struct platform_device *pdev) clk_disable(sport->clk); - if (pdata->exit) + if (pdata && pdata->exit) pdata->exit(pdev); iounmap(sport->port.membase);