Commit c283782f authored by Hui Wang's avatar Hui Wang Committed by Jakub Kicinski

net: phy: realtek: Check the index value in led_hw_control_get

Just like rtl8211f_led_hw_is_supported() and
rtl8211f_led_hw_control_set(), the rtl8211f_led_hw_control_get() also
needs to check the index value, otherwise the caller is likely to get
an incorrect rules.

Fixes: 17784801 ("net: phy: realtek: Add support for PHY LEDs on RTL8211F")
Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
Reviewed-by: default avatarMarek Vasut <marex@denx.de>
Link: https://patch.msgid.link/20240927114610.1278935-1-hui.wang@canonical.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent aec72910
...@@ -527,6 +527,9 @@ static int rtl8211f_led_hw_control_get(struct phy_device *phydev, u8 index, ...@@ -527,6 +527,9 @@ static int rtl8211f_led_hw_control_get(struct phy_device *phydev, u8 index,
{ {
int val; int val;
if (index >= RTL8211F_LED_COUNT)
return -EINVAL;
val = phy_read_paged(phydev, 0xd04, RTL8211F_LEDCR); val = phy_read_paged(phydev, 0xd04, RTL8211F_LEDCR);
if (val < 0) if (val < 0)
return val; return val;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment