net: dsa: Move ports assignment closer to error checking
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 26 Jan 2017 18:45:54 +0000 (10:45 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Jan 2017 20:43:53 +0000 (15:43 -0500)
Move the assignment of ports in _dsa_register_switch() closer to where
it is checked, no functional change. Re-order declarations to be
preserve the inverted christmas tree style.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa2.c

index 4c11619a818be2d95faeaee2a5c245d7b1d6adad..75f5d1f8554b82bcc5fdce8d2c0c17eb7bc06749 100644 (file)
@@ -586,8 +586,8 @@ static struct device_node *dsa_get_ports(struct dsa_switch *ds,
 static int _dsa_register_switch(struct dsa_switch *ds, struct device *dev)
 {
        struct device_node *np = dev->of_node;
-       struct device_node *ports = dsa_get_ports(ds, np);
        struct dsa_switch_tree *dst;
+       struct device_node *ports;
        u32 tree, index;
        int i, err;
 
@@ -595,6 +595,7 @@ static int _dsa_register_switch(struct dsa_switch *ds, struct device *dev)
        if (err)
                return err;
 
+       ports = dsa_get_ports(ds, np);
        if (IS_ERR(ports))
                return PTR_ERR(ports);