Skip to contentSkip to conversation

ibm_newemac: Fix ZMII refcounting bug

PATCH In review Benjamin Herrenschmidt 1 participant 1 message Dec 5, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/11 ibm_newemac: Fix ZMII refcounting bug

When using ZMII for MDIO only (such as 440GX with RGMII for data and ZMII for MDIO), the ZMII code would fail to properly refcount, thus triggering a BUG_ON().

---

 drivers/net/ibm_newemac/zmii.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ibm_newemac/zmii.c +3 -1
Index: linux-work/drivers/net/ibm_newemac/zmii.c
===================================================================
@@ -83,12 +83,14 @@ int __devinit zmii_attach(struct of_devi
 
 	ZMII_DBG(dev, "init(%d, %d)" NL, input, *mode);
 
-	if (!zmii_valid_mode(*mode))
+	if (!zmii_valid_mode(*mode)) {
 		/* Probably an EMAC connected to RGMII,
 		 * but it still may need ZMII for MDIO so
 		 * we don't fail here.
 		 */
+		dev->users++;
 		return 0;
+	}
 
 	mutex_lock(&dev->lock);