提交 8620546c 编写于 作者: J Johan Hovold 提交者: David S. Miller

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: NJohan Hovold <johan@kernel.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 57a38eff
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册