OSDN Git Service

fsl/fman: Initialize fman->dev earlier
authorIgal Liberman <igal.liberman@freescale.com>
Sun, 28 Feb 2016 21:59:53 +0000 (23:59 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 Mar 2016 20:21:23 +0000 (15:21 -0500)
Currently, in a case of error, dev_err is using fman->dev
before its initialization and "(NULL device *)" is printed.
This patch fixes this issue.

Signed-off-by: Igal Liberman <igal.liberman@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fman/fman.c

index 623aa1c..79a210a 100644 (file)
@@ -2791,6 +2791,8 @@ static struct fman *read_dts_node(struct platform_device *of_dev)
                goto fman_free;
        }
 
+       fman->dev = &of_dev->dev;
+
        return fman;
 
 fman_node_put:
@@ -2845,8 +2847,6 @@ static int fman_probe(struct platform_device *of_dev)
 
        dev_set_drvdata(dev, fman);
 
-       fman->dev = dev;
-
        dev_dbg(dev, "FMan%d probed\n", fman->dts_params.id);
 
        return 0;