diff mbox series

[RFC,01/11] net: phy: Don't report success if devices weren't found

Message ID 20200522213059.1535892-2-jeremy.linton@arm.com
State New
Headers show
Series [RFC,01/11] net: phy: Don't report success if devices weren't found | expand

Commit Message

Jeremy Linton May 22, 2020, 9:30 p.m. UTC
C45 devices are to return 0 for registers they haven't
implemented. This means in theory we can terminate the
device search loop without finding any MMDs. In that
case we want to immediately return indicating that
nothing was found rather than continuing to probe
and falling into the success state at the bottom.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 drivers/net/phy/phy_device.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index ac2784192472..245899b58a7d 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -742,6 +742,12 @@  static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id,
 		}
 	}
 
+	/* no reported devices */
+	if (*devs == 0) {
+		*phy_id = 0xffffffff;
+		return 0;
+	}
+
 	/* Now probe Device Identifiers for each device present. */
 	for (i = 1; i < num_ids; i++) {
 		if (!(c45_ids->devices_in_package & (1 << i)))