Skip to content

Commit 160f17e

Browse files
Wang Chendavem330
authored andcommitted
[SCTP]: Use proc_create() to setup ->proc_fops first
Use proc_create() to make sure that ->proc_fops be setup before gluing PDE to main tree. Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 25296d5 commit 160f17e

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

‎net/sctp/objcnt.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,11 @@ void sctp_dbg_objcnt_init(void)
132132
{
133133
struct proc_dir_entry *ent;
134134

135-
ent = create_proc_entry("sctp_dbg_objcnt", 0, proc_net_sctp);
135+
ent = proc_create("sctp_dbg_objcnt", 0,
136+
proc_net_sctp, &sctp_objcnt_ops);
136137
if (!ent)
137138
printk(KERN_WARNING
138139
"sctp_dbg_objcnt: Unable to create /proc entry.\n");
139-
else
140-
ent->proc_fops = &sctp_objcnt_ops;
141140
}
142141

143142
/* Cleanup the objcount entry in the proc filesystem. */

‎net/sctp/proc.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,10 @@ int __init sctp_snmp_proc_init(void)
108108
{
109109
struct proc_dir_entry *p;
110110

111-
p = create_proc_entry("snmp", S_IRUGO, proc_net_sctp);
111+
p = proc_create("snmp", S_IRUGO, proc_net_sctp, &sctp_snmp_seq_fops);
112112
if (!p)
113113
return -ENOMEM;
114114

115-
p->proc_fops = &sctp_snmp_seq_fops;
116-
117115
return 0;
118116
}
119117

0 commit comments

Comments
 (0)