Skip to content

Commit e519869

Browse files
GustavoARSilvadavem330
authored andcommitted
net: phy: mscc: fix signedness bug in vsc85xx_downshift_get
Currently, the error handling for the call to function phy_read_paged() doesn't work because *reg_val* is of type u16 (16 bits, unsigned), which makes it impossible for it to hold a value less than 0. Fix this by changing the type of variable *reg_val* to int. Addresses-Coverity-ID: 1473970 ("Unsigned compared against 0") Fixes: 6a0bfbb ("net: phy: mscc: migrate to phy_select/restore_page functions") Reviewed-by: Quentin Schulz <[email protected]> Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 33c4368 commit e519869

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/phy/mscc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ static int vsc85xx_mdix_set(struct phy_device *phydev, u8 mdix)
522522

523523
static int vsc85xx_downshift_get(struct phy_device *phydev, u8 *count)
524524
{
525-
u16 reg_val;
525+
int reg_val;
526526

527527
reg_val = phy_read_paged(phydev, MSCC_PHY_PAGE_EXTENDED,
528528
MSCC_PHY_ACTIPHY_CNTL);

0 commit comments

Comments
 (0)