summaryrefslogtreecommitdiffstats
path: root/drivers/net/pcs/pcs-xpcs-nxp.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2021-06-15 15:52:53 +0200
committerDavid S. Miller <davem@davemloft.net>2021-06-17 20:14:06 +0200
commitd356dbe23f607dc1a05eb3af887a6ea21c519cb3 (patch)
tree0c7c7e8ade5e04fb7eacd76ecb3ddf86c5fc6e2e /drivers/net/pcs/pcs-xpcs-nxp.c
parentMerge tag 'wireless-drivers-next-2021-06-16' of git://git.kernel.org/pub/scm/... (diff)
downloadlinux-d356dbe23f607dc1a05eb3af887a6ea21c519cb3.tar.xz
linux-d356dbe23f607dc1a05eb3af887a6ea21c519cb3.zip
net: pcs: xpcs: Fix a less than zero u16 comparison error
Currently the check for the u16 variable val being less than zero is always false because val is unsigned. Fix this by using the int variable for the assignment and less than zero check. Addresses-Coverity: ("Unsigned compared against 0") Fixes: f7380bba42fd ("net: pcs: xpcs: add support for NXP SJA1110") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--drivers/net/pcs/pcs-xpcs-nxp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/pcs/pcs-xpcs-nxp.c b/drivers/net/pcs/pcs-xpcs-nxp.c
index de99c37cf2ae..984c9f7f16a8 100644
--- a/drivers/net/pcs/pcs-xpcs-nxp.c
+++ b/drivers/net/pcs/pcs-xpcs-nxp.c
@@ -152,13 +152,13 @@ static int nxp_sja1110_pma_config(struct dw_xpcs *xpcs,
/* Enable TX and RX PLLs and circuits.
* Release reset of PMA to enable data flow to/from PCS.
*/
- val = xpcs_read(xpcs, MDIO_MMD_VEND2, SJA1110_POWERDOWN_ENABLE);
- if (val < 0)
- return val;
+ ret = xpcs_read(xpcs, MDIO_MMD_VEND2, SJA1110_POWERDOWN_ENABLE);
+ if (ret < 0)
+ return ret;
- val &= ~(SJA1110_TXPLL_PD | SJA1110_TXPD | SJA1110_RXCH_PD |
- SJA1110_RXBIAS_PD | SJA1110_RESET_SER_EN |
- SJA1110_RESET_SER | SJA1110_RESET_DES);
+ val = ret & ~(SJA1110_TXPLL_PD | SJA1110_TXPD | SJA1110_RXCH_PD |
+ SJA1110_RXBIAS_PD | SJA1110_RESET_SER_EN |
+ SJA1110_RESET_SER | SJA1110_RESET_DES);
val |= SJA1110_RXPKDETEN | SJA1110_RCVEN;
ret = xpcs_write(xpcs, MDIO_MMD_VEND2, SJA1110_POWERDOWN_ENABLE, val);