aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2013-02-03 15:32:57 -0500
committerDavid S. Miller <davem@davemloft.net>2013-02-04 13:26:49 -0500
commit25cc4ae913a46bcc11b03c37bec59568f2122a36 (patch)
tree0a69dfa2c245d48fb44c6f2ab8e93587cf8516a7 /net/sctp
parent2b3c9a850c3f2da7430c39dde0fb5cab56f8501d (diff)
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>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/associola.c5
-rw-r--r--net/sctp/input.c3
-rw-r--r--net/sctp/outqueue.c4
-rw-r--r--net/sctp/sm_sideeffect.c6
-rw-r--r--net/sctp/transport.c11
5 files changed, 10 insertions, 19 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index b45ed1f96921..2f95f5a5145d 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -434,8 +434,7 @@ void sctp_association_free(struct sctp_association *asoc)
434 * on our state. 434 * on our state.
435 */ 435 */
436 for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) { 436 for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) {
437 if (timer_pending(&asoc->timers[i]) && 437 if (del_timer(&asoc->timers[i]))
438 del_timer(&asoc->timers[i]))
439 sctp_association_put(asoc); 438 sctp_association_put(asoc);
440 } 439 }
441 440
@@ -1497,7 +1496,7 @@ void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned int len)
1497 1496
1498 /* Stop the SACK timer. */ 1497 /* Stop the SACK timer. */
1499 timer = &asoc->timers[SCTP_EVENT_TIMEOUT_SACK]; 1498 timer = &asoc->timers[SCTP_EVENT_TIMEOUT_SACK];
1500 if (timer_pending(timer) && del_timer(timer)) 1499 if (del_timer(timer))
1501 sctp_association_put(asoc); 1500 sctp_association_put(asoc);
1502 } 1501 }
1503} 1502}
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 8bd3c279427e..965bbbbe48d4 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -468,8 +468,7 @@ void sctp_icmp_proto_unreachable(struct sock *sk,
468 } else { 468 } else {
469 struct net *net = sock_net(sk); 469 struct net *net = sock_net(sk);
470 470
471 if (timer_pending(&t->proto_unreach_timer) && 471 if (del_timer(&t->proto_unreach_timer))
472 del_timer(&t->proto_unreach_timer))
473 sctp_association_put(asoc); 472 sctp_association_put(asoc);
474 473
475 sctp_do_sm(net, SCTP_EVENT_T_OTHER, 474 sctp_do_sm(net, SCTP_EVENT_T_OTHER,
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 9bcdbd02d777..01dca753db16 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -1700,10 +1700,8 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1700 * address. 1700 * address.
1701 */ 1701 */
1702 if (!transport->flight_size) { 1702 if (!transport->flight_size) {
1703 if (timer_pending(&transport->T3_rtx_timer) && 1703 if (del_timer(&transport->T3_rtx_timer))
1704 del_timer(&transport->T3_rtx_timer)) {
1705 sctp_transport_put(transport); 1704 sctp_transport_put(transport);
1706 }
1707 } else if (restart_timer) { 1705 } else if (restart_timer) {
1708 if (!mod_timer(&transport->T3_rtx_timer, 1706 if (!mod_timer(&transport->T3_rtx_timer,
1709 jiffies + transport->rto)) 1707 jiffies + transport->rto))
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index c9577754a708..8aab894aeabe 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -674,10 +674,8 @@ static void sctp_cmd_t3_rtx_timers_stop(sctp_cmd_seq_t *cmds,
674 674
675 list_for_each_entry(t, &asoc->peer.transport_addr_list, 675 list_for_each_entry(t, &asoc->peer.transport_addr_list,
676 transports) { 676 transports) {
677 if (timer_pending(&t->T3_rtx_timer) && 677 if (del_timer(&t->T3_rtx_timer))
678 del_timer(&t->T3_rtx_timer)) {
679 sctp_transport_put(t); 678 sctp_transport_put(t);
680 }
681 } 679 }
682} 680}
683 681
@@ -1517,7 +1515,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1517 1515
1518 case SCTP_CMD_TIMER_STOP: 1516 case SCTP_CMD_TIMER_STOP:
1519 timer = &asoc->timers[cmd->obj.to]; 1517 timer = &asoc->timers[cmd->obj.to];
1520 if (timer_pending(timer) && del_timer(timer)) 1518 if (del_timer(timer))
1521 sctp_association_put(asoc); 1519 sctp_association_put(asoc);
1522 break; 1520 break;
1523 1521
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index ca5331cc1ed2..fafd2a461ba0 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -151,13 +151,11 @@ void sctp_transport_free(struct sctp_transport *transport)
151 * structure hang around in memory since we know 151 * structure hang around in memory since we know
152 * the tranport is going away. 152 * the tranport is going away.
153 */ 153 */
154 if (timer_pending(&transport->T3_rtx_timer) && 154 if (del_timer(&transport->T3_rtx_timer))
155 del_timer(&transport->T3_rtx_timer))
156 sctp_transport_put(transport); 155 sctp_transport_put(transport);
157 156
158 /* Delete the ICMP proto unreachable timer if it's active. */ 157 /* Delete the ICMP proto unreachable timer if it's active. */
159 if (timer_pending(&transport->proto_unreach_timer) && 158 if (del_timer(&transport->proto_unreach_timer))
160 del_timer(&transport->proto_unreach_timer))
161 sctp_association_put(transport->asoc); 159 sctp_association_put(transport->asoc);
162 160
163 sctp_transport_put(transport); 161 sctp_transport_put(transport);
@@ -655,10 +653,9 @@ void sctp_transport_reset(struct sctp_transport *t)
655void sctp_transport_immediate_rtx(struct sctp_transport *t) 653void sctp_transport_immediate_rtx(struct sctp_transport *t)
656{ 654{
657 /* Stop pending T3_rtx_timer */ 655 /* Stop pending T3_rtx_timer */
658 if (timer_pending(&t->T3_rtx_timer)) { 656 if (del_timer(&t->T3_rtx_timer))
659 (void)del_timer(&t->T3_rtx_timer);
660 sctp_transport_put(t); 657 sctp_transport_put(t);
661 } 658
662 sctp_retransmit(&t->asoc->outqueue, t, SCTP_RTXR_T3_RTX); 659 sctp_retransmit(&t->asoc->outqueue, t, SCTP_RTXR_T3_RTX);
663 if (!timer_pending(&t->T3_rtx_timer)) { 660 if (!timer_pending(&t->T3_rtx_timer)) {
664 if (!mod_timer(&t->T3_rtx_timer, jiffies + t->rto)) 661 if (!mod_timer(&t->T3_rtx_timer, jiffies + t->rto))