Skip to content

Commit 24c667d

Browse files
Gerrit RenkerArnaldo Carvalho de Melo
authored andcommitted
[CCID2/3]: Initialisation assignments of 0 are redundant
Assigning initial values of `0' is redundant when loading a new CCID structure, since in net/dccp/ccid.c the entire CCID structure is zeroed out prior to initialisation in ccid_new(): struct ccid { struct ccid_operations *ccid_ops; char ccid_priv[0]; }; // ... if (rx) { memset(ccid + 1, 0, ccid_ops->ccid_hc_rx_obj_size); if (ccid->ccid_ops->ccid_hc_rx_init != NULL && ccid->ccid_ops->ccid_hc_rx_init(ccid, sk) != 0) goto out_free_ccid; } else { memset(ccid + 1, 0, ccid_ops->ccid_hc_tx_obj_size); /* analogous to the rx case */ } This patch therefore removes the redundant assignments. Thanks to Arnaldo for the inspiration. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 76fd1e8 commit 24c667d

2 files changed

Lines changed: 0 additions & 8 deletions

File tree

‎net/dccp/ccids/ccid2.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -750,20 +750,16 @@ static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk)
750750
*/
751751
hctx->ccid2hctx_ssthresh = ~0;
752752
hctx->ccid2hctx_numdupack = 3;
753-
hctx->ccid2hctx_seqbufc = 0;
754753

755754
/* XXX init ~ to window size... */
756755
if (ccid2_hc_tx_alloc_seq(hctx))
757756
return -ENOMEM;
758757

759-
hctx->ccid2hctx_sent = 0;
760758
hctx->ccid2hctx_rto = 3 * HZ;
761759
ccid2_change_srtt(hctx, -1);
762760
hctx->ccid2hctx_rttvar = -1;
763-
hctx->ccid2hctx_lastrtt = 0;
764761
hctx->ccid2hctx_rpdupack = -1;
765762
hctx->ccid2hctx_last_cong = jiffies;
766-
hctx->ccid2hctx_high_ack = 0;
767763

768764
hctx->ccid2hctx_rtotimer.function = &ccid2_hc_tx_rto_expire;
769765
hctx->ccid2hctx_rtotimer.data = (unsigned long)sk;

‎net/dccp/ccids/ccid3.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,6 @@ static int ccid3_hc_tx_init(struct ccid *ccid, struct sock *sk)
604604
{
605605
struct ccid3_hc_tx_sock *hctx = ccid_priv(ccid);
606606

607-
hctx->ccid3hctx_s = 0;
608-
hctx->ccid3hctx_rtt = 0;
609607
hctx->ccid3hctx_state = TFRC_SSTATE_NO_SENT;
610608
INIT_LIST_HEAD(&hctx->ccid3hctx_hist);
611609

@@ -966,8 +964,6 @@ static int ccid3_hc_rx_init(struct ccid *ccid, struct sock *sk)
966964
INIT_LIST_HEAD(&hcrx->ccid3hcrx_li_hist);
967965
hcrx->ccid3hcrx_tstamp_last_feedback =
968966
hcrx->ccid3hcrx_tstamp_last_ack = ktime_get_real();
969-
hcrx->ccid3hcrx_s = 0;
970-
hcrx->ccid3hcrx_rtt = 0;
971967
return 0;
972968
}
973969

0 commit comments

Comments
 (0)