Skip to content

Commit 4114470

Browse files
Arnaldo Carvalho de Melodavem330
authored andcommitted
[DCCP] CCID: Allow ccid_{init,exit} to be NULL
Testing if the ccid being instantiated has these methods in ccid_init(). Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 02bcf28 commit 4114470

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

net/dccp/ccid.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ int ccid_register(struct ccid *ccid)
5959
{
6060
int err;
6161

62-
if (ccid->ccid_init == NULL)
63-
return -1;
64-
6562
ccids_write_lock();
6663
err = -EEXIST;
6764
if (ccids[ccid->ccid_id] == NULL) {
@@ -106,7 +103,7 @@ struct ccid *ccid_init(unsigned char id, struct sock *sk)
106103
if (!try_module_get(ccid->ccid_owner))
107104
goto out_err;
108105

109-
if (ccid->ccid_init(sk) != 0)
106+
if (ccid->ccid_init != NULL && ccid->ccid_init(sk) != 0)
110107
goto out_module_put;
111108
out:
112109
ccids_read_unlock();

net/dccp/ccids/ccid3.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,6 @@ static struct dccp_tx_hist *ccid3_tx_hist;
7676
static struct dccp_rx_hist *ccid3_rx_hist;
7777
static struct dccp_li_hist *ccid3_li_hist;
7878

79-
static int ccid3_init(struct sock *sk)
80-
{
81-
return 0;
82-
}
83-
84-
static void ccid3_exit(struct sock *sk)
85-
{
86-
}
87-
8879
/* TFRC sender states */
8980
enum ccid3_hc_tx_states {
9081
TFRC_SSTATE_NO_SENT = 1,
@@ -1182,8 +1173,6 @@ static struct ccid ccid3 = {
11821173
.ccid_id = 3,
11831174
.ccid_name = "ccid3",
11841175
.ccid_owner = THIS_MODULE,
1185-
.ccid_init = ccid3_init,
1186-
.ccid_exit = ccid3_exit,
11871176
.ccid_hc_tx_init = ccid3_hc_tx_init,
11881177
.ccid_hc_tx_exit = ccid3_hc_tx_exit,
11891178
.ccid_hc_tx_send_packet = ccid3_hc_tx_send_packet,

0 commit comments

Comments
 (0)