net: phy: qcom: qca808x: fix logic error in LED brightness set
authorChristian Marangi <ansuelsmth@gmail.com>
Thu, 1 Feb 2024 13:46:00 +0000 (14:46 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 3 Feb 2024 12:50:45 +0000 (12:50 +0000)
In switching to using phy_modify_mmd and a more short version of the
LED ON/OFF condition in later revision, it was made a logic error where

value ? QCA808X_LED_FORCE_ON : QCA808X_LED_FORCE_OFF is always true as
value is always OR with QCA808X_LED_FORCE_EN due to missing ()
resulting in the testing condition being QCA808X_LED_FORCE_EN | value.

Add the () to apply the correct condition and restore correct
functionality of the brightness ON/OFF.

Fixes: 7196062b64ee ("net: phy: at803x: add LED support for qca808x")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/qcom/qca808x.c

index 0f549027d899d1dba020c97c1233a5b57397c676..00db4b2742640103096f325e6fc625b03a51c446 100644 (file)
@@ -820,8 +820,8 @@ static int qca808x_led_brightness_set(struct phy_device *phydev,
 
        return phy_modify_mmd(phydev, MDIO_MMD_AN, reg,
                              QCA808X_LED_FORCE_EN | QCA808X_LED_FORCE_MODE_MASK,
-                             QCA808X_LED_FORCE_EN | value ? QCA808X_LED_FORCE_ON :
-                                                            QCA808X_LED_FORCE_OFF);
+                             QCA808X_LED_FORCE_EN | (value ? QCA808X_LED_FORCE_ON :
+                                                            QCA808X_LED_FORCE_OFF));
 }
 
 static int qca808x_led_blink_set(struct phy_device *phydev, u8 index,