linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jekhor@gmail.com (Yauhen Kharuzhy)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] IMX serial: Check platform data pointer before use
Date: Sat, 16 Jan 2010 23:28:30 +0200	[thread overview]
Message-ID: <1263677310-14244-1-git-send-email-jekhor@gmail.com> (raw)

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@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

             reply	other threads:[~2010-01-16 21:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-16 21:28 Yauhen Kharuzhy [this message]
2010-01-16 21:44 ` [PATCH] IMX serial: Check platform data pointer before use Wolfram Sang
2010-01-17  3:40 ` Baruch Siach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263677310-14244-1-git-send-email-jekhor@gmail.com \
    --to=jekhor@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).