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>
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;