From: Benjamin Herrenschmidt Date: Wed, 5 Dec 2007 00:14:27 +0000 (+1100) Subject: ibm_newemac: Fix ZMII refcounting bug X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=968530643a0685caced9dfd6f72f20d5e7bc8fbb;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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(). Signed-off-by: Benjamin Herrenschmidt Acked-by: Stefan Roese Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/ibm_newemac/zmii.c b/drivers/net/ibm_newemac/zmii.c index 2219ec2740e0..0f8cfbc0c618 100644 --- a/drivers/net/ibm_newemac/zmii.c +++ b/drivers/net/ibm_newemac/zmii.c @@ -83,12 +83,14 @@ int __devinit zmii_attach(struct of_device *ofdev, int input, int *mode) 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);