projects
/
GitHub
/
LineageOS
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
57a38ef
)
net: phy: micrel: add led-mode sanity check
author
Johan Hovold
<johan@kernel.org>
Tue, 11 Nov 2014 19:00:12 +0000
(20:00 +0100)
committer
David S. Miller
<davem@davemloft.net>
Wed, 12 Nov 2014 18:55:36 +0000
(13:55 -0500)
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>
drivers/net/phy/micrel.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/net/phy/micrel.c
b/drivers/net/phy/micrel.c
index 16135ac18bfe7e6ad9925405ac1a427e4db626a4..1b3985cdc64c0a8eddb762d3db33440b0830ae52 100644
(file)
--- 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;