Skip to content

Commit 786c4a5

Browse files
Dan Murphydavem330
authored andcommitted
net: phy: dp83869: Fix return paths to return proper values
Fix the return paths for all I/O operations to ensure that the I/O completed successfully. Then pass the return to the caller for further processing Fixes: 01db923 ("net: phy: dp83869: Add TI dp83869 phy") Reported-by: Andrew Lunn <[email protected]> Signed-off-by: Dan Murphy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7eb9d76 commit 786c4a5

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

drivers/net/phy/dp83869.c

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ static int dp83869_config_port_mirroring(struct phy_device *phydev)
151151
struct dp83869_private *dp83869 = phydev->priv;
152152

153153
if (dp83869->port_mirroring == DP83869_PORT_MIRRORING_EN)
154-
phy_set_bits_mmd(phydev, DP83869_DEVADDR, DP83869_GEN_CFG3,
155-
DP83869_CFG3_PORT_MIRROR_EN);
154+
return phy_set_bits_mmd(phydev, DP83869_DEVADDR,
155+
DP83869_GEN_CFG3,
156+
DP83869_CFG3_PORT_MIRROR_EN);
156157
else
157-
phy_clear_bits_mmd(phydev, DP83869_DEVADDR, DP83869_GEN_CFG3,
158-
DP83869_CFG3_PORT_MIRROR_EN);
159-
160-
return 0;
158+
return phy_clear_bits_mmd(phydev, DP83869_DEVADDR,
159+
DP83869_GEN_CFG3,
160+
DP83869_CFG3_PORT_MIRROR_EN);
161161
}
162162

163163
#ifdef CONFIG_OF_MDIO
@@ -204,7 +204,7 @@ static int dp83869_of_init(struct phy_device *phydev)
204204
&dp83869->tx_fifo_depth))
205205
dp83869->tx_fifo_depth = DP83869_PHYCR_FIFO_DEPTH_4_B_NIB;
206206

207-
return 0;
207+
return ret;
208208
}
209209
#else
210210
static int dp83869_of_init(struct phy_device *phydev)
@@ -216,7 +216,7 @@ static int dp83869_of_init(struct phy_device *phydev)
216216
static int dp83869_configure_rgmii(struct phy_device *phydev,
217217
struct dp83869_private *dp83869)
218218
{
219-
int ret, val;
219+
int ret = 0, val;
220220

221221
if (phy_interface_is_rgmii(phydev)) {
222222
val = phy_read(phydev, MII_DP83869_PHYCTRL);
@@ -233,13 +233,13 @@ static int dp83869_configure_rgmii(struct phy_device *phydev,
233233
}
234234

235235
if (dp83869->io_impedance >= 0)
236-
phy_modify_mmd(phydev, DP83869_DEVADDR,
237-
DP83869_IO_MUX_CFG,
238-
DP83869_IO_MUX_CFG_IO_IMPEDANCE_CTRL,
239-
dp83869->io_impedance &
240-
DP83869_IO_MUX_CFG_IO_IMPEDANCE_CTRL);
236+
ret = phy_modify_mmd(phydev, DP83869_DEVADDR,
237+
DP83869_IO_MUX_CFG,
238+
DP83869_IO_MUX_CFG_IO_IMPEDANCE_CTRL,
239+
dp83869->io_impedance &
240+
DP83869_IO_MUX_CFG_IO_IMPEDANCE_CTRL);
241241

242-
return 0;
242+
return ret;
243243
}
244244

245245
static int dp83869_configure_mode(struct phy_device *phydev,
@@ -284,9 +284,11 @@ static int dp83869_configure_mode(struct phy_device *phydev,
284284
return ret;
285285
break;
286286
case DP83869_RGMII_SGMII_BRIDGE:
287-
phy_modify_mmd(phydev, DP83869_DEVADDR, DP83869_OP_MODE,
288-
DP83869_SGMII_RGMII_BRIDGE,
289-
DP83869_SGMII_RGMII_BRIDGE);
287+
ret = phy_modify_mmd(phydev, DP83869_DEVADDR, DP83869_OP_MODE,
288+
DP83869_SGMII_RGMII_BRIDGE,
289+
DP83869_SGMII_RGMII_BRIDGE);
290+
if (ret)
291+
return ret;
290292

291293
ret = phy_write_mmd(phydev, DP83869_DEVADDR,
292294
DP83869_FX_CTRL, DP83869_FX_CTRL_DEFAULT);
@@ -334,7 +336,7 @@ static int dp83869_configure_mode(struct phy_device *phydev,
334336
return -EINVAL;
335337
};
336338

337-
return 0;
339+
return ret;
338340
}
339341

340342
static int dp83869_config_init(struct phy_device *phydev)
@@ -358,12 +360,13 @@ static int dp83869_config_init(struct phy_device *phydev)
358360

359361
/* Clock output selection if muxing property is set */
360362
if (dp83869->clk_output_sel != DP83869_CLK_O_SEL_REF_CLK)
361-
phy_modify_mmd(phydev, DP83869_DEVADDR, DP83869_IO_MUX_CFG,
362-
DP83869_IO_MUX_CFG_CLK_O_SEL_MASK,
363-
dp83869->clk_output_sel <<
364-
DP83869_IO_MUX_CFG_CLK_O_SEL_SHIFT);
363+
ret = phy_modify_mmd(phydev,
364+
DP83869_DEVADDR, DP83869_IO_MUX_CFG,
365+
DP83869_IO_MUX_CFG_CLK_O_SEL_MASK,
366+
dp83869->clk_output_sel <<
367+
DP83869_IO_MUX_CFG_CLK_O_SEL_SHIFT);
365368

366-
return 0;
369+
return ret;
367370
}
368371

369372
static int dp83869_probe(struct phy_device *phydev)

0 commit comments

Comments
 (0)