cpm_uart: Initialize port.dev before it's used.
authorScott Wood <scottwood@freescale.com>
Fri, 3 Apr 2009 20:48:44 +0000 (15:48 -0500)
committerKumar Gala <galak@kernel.crashing.org>
Mon, 6 Apr 2009 14:09:28 +0000 (09:09 -0500)
Previously, this caused NULL to sometimes be passed as a device
to the DMA code.  With recent DMA changes, that now causes a BUG().

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
drivers/serial/cpm_uart/cpm_uart_core.c

index 5c6ef51da274db66b60e2e83cd2195044b55d252..4dd00bea191a162cdd7b47c49cc2d08831ff4efb 100644 (file)
@@ -1339,13 +1339,13 @@ static int __devinit cpm_uart_probe(struct of_device *ofdev,
 
        dev_set_drvdata(&ofdev->dev, pinfo);
 
+       /* initialize the device pointer for the port */
+       pinfo->port.dev = &ofdev->dev;
+
        ret = cpm_uart_init_port(ofdev->node, pinfo);
        if (ret)
                return ret;
 
-       /* initialize the device pointer for the port */
-       pinfo->port.dev = &ofdev->dev;
-
        return uart_add_one_port(&cpm_reg, &pinfo->port);
 }