2018-11-22 21:02:45

by Yue Haibing

[permalink] [raw]
Subject: [PATCH net-next] net: mvneta: remove redundant check for eee->tx_lpi_timer < 0

fixes the smatch warning:

drivers/net/ethernet/marvell/mvneta.c:4252 mvneta_ethtool_set_eee() warn:
unsigned 'eee->tx_lpi_timer' is never less than zero.

Signed-off-by: YueHaibing <[email protected]>
---
drivers/net/ethernet/marvell/mvneta.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index e5397c8..46a0f6b 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -4248,8 +4248,7 @@ static int mvneta_ethtool_set_eee(struct net_device *dev,

/* The Armada 37x documents do not give limits for this other than
* it being an 8-bit register. */
- if (eee->tx_lpi_enabled &&
- (eee->tx_lpi_timer < 0 || eee->tx_lpi_timer > 255))
+ if (eee->tx_lpi_enabled && eee->tx_lpi_timer > 255)
return -EINVAL;

lpi_ctl0 = mvreg_read(pp, MVNETA_LPI_CTRL_0);
--
2.7.0




2018-11-22 19:59:20

by Thomas Petazzoni

[permalink] [raw]
Subject: Re: [PATCH net-next] net: mvneta: remove redundant check for eee->tx_lpi_timer < 0

Hello,

On Thu, 22 Nov 2018 14:42:00 +0800, YueHaibing wrote:
> fixes the smatch warning:
>
> drivers/net/ethernet/marvell/mvneta.c:4252 mvneta_ethtool_set_eee() warn:
> unsigned 'eee->tx_lpi_timer' is never less than zero.
>
> Signed-off-by: YueHaibing <[email protected]>

Acked-by: Thomas Petazzoni <[email protected]>

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2018-11-24 08:56:06

by David Miller

[permalink] [raw]
Subject: Re: [PATCH net-next] net: mvneta: remove redundant check for eee->tx_lpi_timer < 0

From: YueHaibing <[email protected]>
Date: Thu, 22 Nov 2018 14:42:00 +0800

> fixes the smatch warning:
>
> drivers/net/ethernet/marvell/mvneta.c:4252 mvneta_ethtool_set_eee() warn:
> unsigned 'eee->tx_lpi_timer' is never less than zero.
>
> Signed-off-by: YueHaibing <[email protected]>

Applied.