imx: serial: handle initialisation failure correctly
authorDaniel Glöckner <dg@emlix.com>
Thu, 11 Jun 2009 13:39:21 +0000 (14:39 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Jun 2009 15:51:08 +0000 (08:51 -0700)
correctly de-initialise device when setting up failed,
call to pdata->exit() was missing.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
Signed-off-by: Oskar Schirmer <os@emlix.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/serial/imx.c

index e6c2ba26dcbb191f0007cb4b0b6e9821b060e6fe..cbd4f322464326bb335ca8548a95a899c73a28a5 100644 (file)
@@ -1157,10 +1157,15 @@ static int serial_imx_probe(struct platform_device *pdev)
                        goto clkput;
        }
 
-       uart_add_one_port(&imx_reg, &sport->port);
+       ret = uart_add_one_port(&imx_reg, &sport->port);
+       if (ret)
+               goto deinit;
        platform_set_drvdata(pdev, &sport->port);
 
        return 0;
+deinit:
+       if (pdata->exit)
+               pdata->exit(pdev);
 clkput:
        clk_put(sport->clk);
        clk_disable(sport->clk);