Skip to content

Commit fa182ea

Browse files
Divya-Kopperakuba-moo
authored andcommitted
net: phy: micrel: Fixes FIELD_GET assertion
FIELD_GET() must only be used with a mask that is a compile-time constant. Mark the functions as __always_inline to avoid the problem. Fixes: 21b688d ("net: phy: micrel: Cable Diag feature for lan8814 phy") Reported-by: kernel test robot <[email protected]> Signed-off-by: Divya Koppera <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3c18605 commit fa182ea

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/net/phy/micrel.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,7 +1838,7 @@ static int ksz886x_cable_test_start(struct phy_device *phydev)
18381838
return phy_clear_bits(phydev, MII_BMCR, BMCR_ANENABLE | BMCR_SPEED100);
18391839
}
18401840

1841-
static int ksz886x_cable_test_result_trans(u16 status, u16 mask)
1841+
static __always_inline int ksz886x_cable_test_result_trans(u16 status, u16 mask)
18421842
{
18431843
switch (FIELD_GET(mask, status)) {
18441844
case KSZ8081_LMD_STAT_NORMAL:
@@ -1854,13 +1854,13 @@ static int ksz886x_cable_test_result_trans(u16 status, u16 mask)
18541854
}
18551855
}
18561856

1857-
static bool ksz886x_cable_test_failed(u16 status, u16 mask)
1857+
static __always_inline bool ksz886x_cable_test_failed(u16 status, u16 mask)
18581858
{
18591859
return FIELD_GET(mask, status) ==
18601860
KSZ8081_LMD_STAT_FAIL;
18611861
}
18621862

1863-
static bool ksz886x_cable_test_fault_length_valid(u16 status, u16 mask)
1863+
static __always_inline bool ksz886x_cable_test_fault_length_valid(u16 status, u16 mask)
18641864
{
18651865
switch (FIELD_GET(mask, status)) {
18661866
case KSZ8081_LMD_STAT_OPEN:
@@ -1871,7 +1871,8 @@ static bool ksz886x_cable_test_fault_length_valid(u16 status, u16 mask)
18711871
return false;
18721872
}
18731873

1874-
static int ksz886x_cable_test_fault_length(struct phy_device *phydev, u16 status, u16 data_mask)
1874+
static __always_inline int ksz886x_cable_test_fault_length(struct phy_device *phydev,
1875+
u16 status, u16 data_mask)
18751876
{
18761877
int dt;
18771878

0 commit comments

Comments
 (0)