net: remove redundant check for timer pending state before del_timer
As in del_timer() there has already placed a timer_pending() function to check whether the timer to be deleted is pending or not, it's unnecessary to check timer pending state again before del_timer() is called. Signed-off-by: Ying Xue <ying.xue@windriver.com> Cc: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
2b3c9a850c
commit
25cc4ae913
@@ -434,8 +434,7 @@ void sctp_association_free(struct sctp_association *asoc)
|
||||
* on our state.
|
||||
*/
|
||||
for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) {
|
||||
if (timer_pending(&asoc->timers[i]) &&
|
||||
del_timer(&asoc->timers[i]))
|
||||
if (del_timer(&asoc->timers[i]))
|
||||
sctp_association_put(asoc);
|
||||
}
|
||||
|
||||
@@ -1497,7 +1496,7 @@ void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned int len)
|
||||
|
||||
/* Stop the SACK timer. */
|
||||
timer = &asoc->timers[SCTP_EVENT_TIMEOUT_SACK];
|
||||
if (timer_pending(timer) && del_timer(timer))
|
||||
if (del_timer(timer))
|
||||
sctp_association_put(asoc);
|
||||
}
|
||||
}
|
||||
|
@@ -468,8 +468,7 @@ void sctp_icmp_proto_unreachable(struct sock *sk,
|
||||
} else {
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
if (timer_pending(&t->proto_unreach_timer) &&
|
||||
del_timer(&t->proto_unreach_timer))
|
||||
if (del_timer(&t->proto_unreach_timer))
|
||||
sctp_association_put(asoc);
|
||||
|
||||
sctp_do_sm(net, SCTP_EVENT_T_OTHER,
|
||||
|
@@ -1700,10 +1700,8 @@ static void sctp_check_transmitted(struct sctp_outq *q,
|
||||
* address.
|
||||
*/
|
||||
if (!transport->flight_size) {
|
||||
if (timer_pending(&transport->T3_rtx_timer) &&
|
||||
del_timer(&transport->T3_rtx_timer)) {
|
||||
if (del_timer(&transport->T3_rtx_timer))
|
||||
sctp_transport_put(transport);
|
||||
}
|
||||
} else if (restart_timer) {
|
||||
if (!mod_timer(&transport->T3_rtx_timer,
|
||||
jiffies + transport->rto))
|
||||
|
@@ -674,10 +674,8 @@ static void sctp_cmd_t3_rtx_timers_stop(sctp_cmd_seq_t *cmds,
|
||||
|
||||
list_for_each_entry(t, &asoc->peer.transport_addr_list,
|
||||
transports) {
|
||||
if (timer_pending(&t->T3_rtx_timer) &&
|
||||
del_timer(&t->T3_rtx_timer)) {
|
||||
if (del_timer(&t->T3_rtx_timer))
|
||||
sctp_transport_put(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1517,7 +1515,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
|
||||
|
||||
case SCTP_CMD_TIMER_STOP:
|
||||
timer = &asoc->timers[cmd->obj.to];
|
||||
if (timer_pending(timer) && del_timer(timer))
|
||||
if (del_timer(timer))
|
||||
sctp_association_put(asoc);
|
||||
break;
|
||||
|
||||
|
@@ -151,13 +151,11 @@ void sctp_transport_free(struct sctp_transport *transport)
|
||||
* structure hang around in memory since we know
|
||||
* the tranport is going away.
|
||||
*/
|
||||
if (timer_pending(&transport->T3_rtx_timer) &&
|
||||
del_timer(&transport->T3_rtx_timer))
|
||||
if (del_timer(&transport->T3_rtx_timer))
|
||||
sctp_transport_put(transport);
|
||||
|
||||
/* Delete the ICMP proto unreachable timer if it's active. */
|
||||
if (timer_pending(&transport->proto_unreach_timer) &&
|
||||
del_timer(&transport->proto_unreach_timer))
|
||||
if (del_timer(&transport->proto_unreach_timer))
|
||||
sctp_association_put(transport->asoc);
|
||||
|
||||
sctp_transport_put(transport);
|
||||
@@ -655,10 +653,9 @@ void sctp_transport_reset(struct sctp_transport *t)
|
||||
void sctp_transport_immediate_rtx(struct sctp_transport *t)
|
||||
{
|
||||
/* Stop pending T3_rtx_timer */
|
||||
if (timer_pending(&t->T3_rtx_timer)) {
|
||||
(void)del_timer(&t->T3_rtx_timer);
|
||||
if (del_timer(&t->T3_rtx_timer))
|
||||
sctp_transport_put(t);
|
||||
}
|
||||
|
||||
sctp_retransmit(&t->asoc->outqueue, t, SCTP_RTXR_T3_RTX);
|
||||
if (!timer_pending(&t->T3_rtx_timer)) {
|
||||
if (!mod_timer(&t->T3_rtx_timer, jiffies + t->rto))
|
||||
|
Reference in New Issue
Block a user