phy: ti: Init node before reading
authorMichal Simek <michal.simek@xilinx.com>
Sat, 16 Mar 2019 11:43:17 +0000 (12:43 +0100)
committerJoe Hershberger <joe.hershberger@ni.com>
Tue, 14 May 2019 19:43:33 +0000 (14:43 -0500)
There is a need to fill node before clk_output_sel is setup.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Reviewed-by: <hannes.schmelzer@br-automation.com>
drivers/net/phy/ti.c

index 6ac890a7f5c33d082f006cca1734a6e51f5db189..25f1332ca98b6ef0328a3b1dcecd07779f132977 100644 (file)
@@ -138,6 +138,10 @@ static int dp83867_of_init(struct phy_device *phydev)
 
        /* Optional configuration */
 
+       node = phy_get_ofnode(phydev);
+       if (!ofnode_valid(node))
+               return -EINVAL;
+
        /*
         * Keep the default value if ti,clk-output-sel is not set
         * or to high
@@ -147,10 +151,6 @@ static int dp83867_of_init(struct phy_device *phydev)
                ofnode_read_u32_default(node, "ti,clk-output-sel",
                                        DP83867_CLK_O_SEL_REF_CLK);
 
-       node = phy_get_ofnode(phydev);
-       if (!ofnode_valid(node))
-               return -EINVAL;
-
        if (ofnode_read_bool(node, "ti,max-output-impedance"))
                dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX;
        else if (ofnode_read_bool(node, "ti,min-output-impedance"))