[PATCH] IMX serial: Check platform data pointer before use
Yauhen Kharuzhy
jekhor at gmail.com
Sat Jan 16 16:28:30 EST 2010
pdev->dev.platform_data can be NULL in driver probe function. This is
should be checked before any use of imxuart_platform_data structure.
Signed-off-by: Yauhen Kharuzhy <jekhor at gmail.com>
---
drivers/serial/imx.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 18130f1..8c0dd13 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);
--
1.6.5.7
More information about the linux-arm-kernel
mailing list