diff options
| author | Byungho An <bh74.an@samsung.com> | 2014-04-18 07:59:39 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-04-22 16:07:17 -0400 |
| commit | 7b07bd4e5187e8553d7776f5225e19f00b9fb863 (patch) | |
| tree | 9afebf68f1a9491f296a8aa3bab971c4543b5d4e | |
| parent | 3ee2b7c4b6785aab45a548b161b4c42ac6522592 (diff) | |
net: sxgbe: Added phy_found error path
This patch adds phy_found error path when there is no phy device
and changes bus_name.
Signed-off-by: Byungho An <bh74.an@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c index 01af2cbb479d..43ccb4a6de15 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | #define SXGBE_SMA_PREAD_CMD 0x02 /* post read increament address */ | 27 | #define SXGBE_SMA_PREAD_CMD 0x02 /* post read increament address */ |
| 28 | #define SXGBE_SMA_READ_CMD 0x03 /* read command */ | 28 | #define SXGBE_SMA_READ_CMD 0x03 /* read command */ |
| 29 | #define SXGBE_SMA_SKIP_ADDRFRM 0x00040000 /* skip the address frame */ | 29 | #define SXGBE_SMA_SKIP_ADDRFRM 0x00040000 /* skip the address frame */ |
| 30 | #define SXGBE_MII_BUSY 0x00800000 /* mii busy */ | 30 | #define SXGBE_MII_BUSY 0x00400000 /* mii busy */ |
| 31 | 31 | ||
| 32 | static int sxgbe_mdio_busy_wait(void __iomem *ioaddr, unsigned int mii_data) | 32 | static int sxgbe_mdio_busy_wait(void __iomem *ioaddr, unsigned int mii_data) |
| 33 | { | 33 | { |
| @@ -147,6 +147,7 @@ int sxgbe_mdio_register(struct net_device *ndev) | |||
| 147 | struct sxgbe_mdio_bus_data *mdio_data = priv->plat->mdio_bus_data; | 147 | struct sxgbe_mdio_bus_data *mdio_data = priv->plat->mdio_bus_data; |
| 148 | int err, phy_addr; | 148 | int err, phy_addr; |
| 149 | int *irqlist; | 149 | int *irqlist; |
| 150 | bool phy_found = false; | ||
| 150 | bool act; | 151 | bool act; |
| 151 | 152 | ||
| 152 | /* allocate the new mdio bus */ | 153 | /* allocate the new mdio bus */ |
| @@ -162,7 +163,7 @@ int sxgbe_mdio_register(struct net_device *ndev) | |||
| 162 | irqlist = priv->mii_irq; | 163 | irqlist = priv->mii_irq; |
| 163 | 164 | ||
| 164 | /* assign mii bus fields */ | 165 | /* assign mii bus fields */ |
| 165 | mdio_bus->name = "samsxgbe"; | 166 | mdio_bus->name = "sxgbe"; |
| 166 | mdio_bus->read = &sxgbe_mdio_read; | 167 | mdio_bus->read = &sxgbe_mdio_read; |
| 167 | mdio_bus->write = &sxgbe_mdio_write; | 168 | mdio_bus->write = &sxgbe_mdio_write; |
| 168 | snprintf(mdio_bus->id, MII_BUS_ID_SIZE, "%s-%x", | 169 | snprintf(mdio_bus->id, MII_BUS_ID_SIZE, "%s-%x", |
| @@ -216,13 +217,22 @@ int sxgbe_mdio_register(struct net_device *ndev) | |||
| 216 | netdev_info(ndev, "PHY ID %08x at %d IRQ %s (%s)%s\n", | 217 | netdev_info(ndev, "PHY ID %08x at %d IRQ %s (%s)%s\n", |
| 217 | phy->phy_id, phy_addr, irq_str, | 218 | phy->phy_id, phy_addr, irq_str, |
| 218 | dev_name(&phy->dev), act ? " active" : ""); | 219 | dev_name(&phy->dev), act ? " active" : ""); |
| 220 | phy_found = true; | ||
| 219 | } | 221 | } |
| 220 | } | 222 | } |
| 221 | 223 | ||
| 224 | if (!phy_found) { | ||
| 225 | netdev_err(ndev, "PHY not found\n"); | ||
| 226 | goto phyfound_err; | ||
| 227 | } | ||
| 228 | |||
| 222 | priv->mii = mdio_bus; | 229 | priv->mii = mdio_bus; |
| 223 | 230 | ||
| 224 | return 0; | 231 | return 0; |
| 225 | 232 | ||
| 233 | phyfound_err: | ||
| 234 | err = -ENODEV; | ||
| 235 | mdiobus_unregister(mdio_bus); | ||
| 226 | mdiobus_err: | 236 | mdiobus_err: |
| 227 | mdiobus_free(mdio_bus); | 237 | mdiobus_free(mdio_bus); |
| 228 | return err; | 238 | return err; |
