serial8250-em: clk_get() IS_ERR() error handling fix
authorMagnus Damm <damm@opensource.se>
Wed, 9 May 2012 06:49:57 +0000 (15:49 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 May 2012 22:11:30 +0000 (15:11 -0700)
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>
drivers/tty/serial/8250/8250_em.c

index ff4254249bd8d6c41afb37e6468305ad32f811c4..be6c28937ecc2a379dc63ba958c30351f9da10ff 100644 (file)
@@ -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;
        }
 
This page took 0.024634 seconds and 5 git commands to generate.