diff options
author | Johan Hovold <johan@kernel.org> | 2014-11-11 20:00:12 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-11-12 13:55:36 -0500 |
commit | 8620546c39a379e3b0cc5210519c0bc22377b914 (patch) | |
tree | aff73ee35f687ea56b7303ff67c47e8c6ac64b1f | |
parent | 57a38effa598aa18ca707fdd844cda02e528afae (diff) | |
download | linux-8620546c39a379e3b0cc5210519c0bc22377b914.tar.bz2 |
net: phy: micrel: add led-mode sanity check
Make sure never to update more than two bits when setting the led mode,
something which could for example change the reference-clock setting.
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/phy/micrel.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 16135ac18bfe..1b3985cdc64c 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -173,6 +173,11 @@ static int kszphy_setup_led(struct phy_device *phydev, if (of_property_read_u32(of_node, "micrel,led-mode", &val)) return 0; + if (val > 3) { + dev_err(&phydev->dev, "invalid led mode: 0x%02x\n", val); + return -EINVAL; + } + temp = phy_read(phydev, reg); if (temp < 0) return temp; |