Skip to content

Commit 7e19a35

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: stmmac: use unsigned int for eee_timer
Since eee_timer is used to initialise priv->tx_lpi_timer, this also should be unsigned to avoid a negative number being interpreted as a very large positive number. Note that this makes the check for negative numbers passed in as a module parameter redundant, and passing a negative number will now produce a large delay rather than the default. Since the default is used without an argument, passing a negative number would be quite obscure. However, if users do, then this will need to be revisited. Reviewed-by: Simon Horman <[email protected]> Tested-by: Choong Yong Liang <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent bba9f47 commit 7e19a35

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ static const u32 default_msg_level = (NETIF_MSG_DRV | NETIF_MSG_PROBE |
111111
NETIF_MSG_IFDOWN | NETIF_MSG_TIMER);
112112

113113
#define STMMAC_DEFAULT_LPI_TIMER 1000
114-
static int eee_timer = STMMAC_DEFAULT_LPI_TIMER;
115-
module_param(eee_timer, int, 0644);
114+
static unsigned int eee_timer = STMMAC_DEFAULT_LPI_TIMER;
115+
module_param(eee_timer, uint, 0644);
116116
MODULE_PARM_DESC(eee_timer, "LPI tx expiration time in msec");
117117
#define STMMAC_LPI_T(x) (jiffies + usecs_to_jiffies(x))
118118

@@ -194,8 +194,6 @@ static void stmmac_verify_args(void)
194194
flow_ctrl = FLOW_OFF;
195195
if (unlikely((pause < 0) || (pause > 0xffff)))
196196
pause = PAUSE_TIME;
197-
if (eee_timer < 0)
198-
eee_timer = STMMAC_DEFAULT_LPI_TIMER;
199197
}
200198

201199
static void __stmmac_disable_all_queues(struct stmmac_priv *priv)

0 commit comments

Comments
 (0)