]> git.baikalelectronics.ru Git - kernel.git/commit
net: phy: mscc: fix signedness bug in vsc85xx_downshift_get
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Tue, 16 Oct 2018 17:35:11 +0000 (19:35 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 18 Oct 2018 05:08:55 +0000 (22:08 -0700)
commitc8b5f4eeca8bca9f9fc85c43550e546e12679dbd
tree5509b9ce22e3653022ab50d415a75d39a596238f
parenta1b9b9a00ac29a64a5ec9b83e240214c173e2074
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: 903c8fe96b5d ("net: phy: mscc: migrate to phy_select/restore_page functions")
Reviewed-by: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/mscc.c