diff options
author | Johan Hovold <johan@kernel.org> | 2014-11-11 14:00:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-11-12 13:55:35 -0500 |
commit | 5bb8fc0d1073e867f381316cb1c348fa45e2d602 (patch) | |
tree | d92b62f2a6c00e3248df2c99a757b58efe6e418b /drivers/net/phy | |
parent | c88c7d3204e66faf1f24402d551ac1d0b400e3ff (diff) |
net: phy: micrel: fix config_intr error handling
Make sure never to update the control register with random data (an
error code) by checking the return value after reading it.
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/micrel.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index bcc6c0ea75fa..62ca9613a514 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
@@ -122,6 +122,8 @@ static int kszphy_config_intr(struct phy_device *phydev) | |||
122 | 122 | ||
123 | /* set the interrupt pin active low */ | 123 | /* set the interrupt pin active low */ |
124 | temp = phy_read(phydev, MII_KSZPHY_CTRL); | 124 | temp = phy_read(phydev, MII_KSZPHY_CTRL); |
125 | if (temp < 0) | ||
126 | return temp; | ||
125 | temp &= ~KSZPHY_CTRL_INT_ACTIVE_HIGH; | 127 | temp &= ~KSZPHY_CTRL_INT_ACTIVE_HIGH; |
126 | phy_write(phydev, MII_KSZPHY_CTRL, temp); | 128 | phy_write(phydev, MII_KSZPHY_CTRL, temp); |
127 | rc = kszphy_set_interrupt(phydev); | 129 | rc = kszphy_set_interrupt(phydev); |
@@ -134,6 +136,8 @@ static int ksz9021_config_intr(struct phy_device *phydev) | |||
134 | 136 | ||
135 | /* set the interrupt pin active low */ | 137 | /* set the interrupt pin active low */ |
136 | temp = phy_read(phydev, MII_KSZPHY_CTRL); | 138 | temp = phy_read(phydev, MII_KSZPHY_CTRL); |
139 | if (temp < 0) | ||
140 | return temp; | ||
137 | temp &= ~KSZ9021_CTRL_INT_ACTIVE_HIGH; | 141 | temp &= ~KSZ9021_CTRL_INT_ACTIVE_HIGH; |
138 | phy_write(phydev, MII_KSZPHY_CTRL, temp); | 142 | phy_write(phydev, MII_KSZPHY_CTRL, temp); |
139 | rc = kszphy_set_interrupt(phydev); | 143 | rc = kszphy_set_interrupt(phydev); |
@@ -146,6 +150,8 @@ static int ks8737_config_intr(struct phy_device *phydev) | |||
146 | 150 | ||
147 | /* set the interrupt pin active low */ | 151 | /* set the interrupt pin active low */ |
148 | temp = phy_read(phydev, MII_KSZPHY_CTRL); | 152 | temp = phy_read(phydev, MII_KSZPHY_CTRL); |
153 | if (temp < 0) | ||
154 | return temp; | ||
149 | temp &= ~KS8737_CTRL_INT_ACTIVE_HIGH; | 155 | temp &= ~KS8737_CTRL_INT_ACTIVE_HIGH; |
150 | phy_write(phydev, MII_KSZPHY_CTRL, temp); | 156 | phy_write(phydev, MII_KSZPHY_CTRL, temp); |
151 | rc = kszphy_set_interrupt(phydev); | 157 | rc = kszphy_set_interrupt(phydev); |