blob: 340ffc59ac1c7c80459a80d575e7e872c5e85f54 [file] [log] [blame]
From koba@kmckk.co.jp Wed Oct 3 04:27:34 2012
From: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
Date: Wed, 3 Oct 2012 20:23:02 +0900
Subject: [PATCH 10/26] serial8250-em: clk_get() IS_ERR() error handling fix
To: greg@kroah.com
Cc: ltsi-dev@lists.linuxfoundation.org, horms@verge.net.au, damm@opensource.se, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Tetsuyuki Kobayashi <koba@kmckk.co.jp>
Message-ID: <1349263398-13152-11-git-send-email-koba@kmckk.co.jp>
From: Magnus Damm <damm@opensource.se>
Update the 8250_em driver to correctly handle the case
where no clock is associated with the device.
The return value of clk_get() needs to be checked with
IS_ERR() to avoid NULL pointer referencing.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 94e792ab66d696aad2e52c91bae4cfbeefe4c9f6)
Signed-off-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
---
drivers/tty/serial/8250/8250_em.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
index ff42542..be6c289 100644
--- a/drivers/tty/serial/8250/8250_em.c
+++ b/drivers/tty/serial/8250/8250_em.c
@@ -110,8 +110,9 @@ static int __devinit serial8250_em_probe(struct platform_device *pdev)
}
priv->sclk = clk_get(&pdev->dev, "sclk");
- if (!priv->sclk) {
+ if (IS_ERR(priv->sclk)) {
dev_err(&pdev->dev, "unable to get clock\n");
+ ret = PTR_ERR(priv->sclk);
goto err1;
}
--
1.7.9.5