Skip to content

Commit 8c641a2

Browse files
committed
Remove the redundant code
proc_remove does nothing when the argument is NULL[1]. We don't need proc_remove after proc_create failed. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/proc/generic.c#n789
1 parent 3a09a1e commit 8c641a2

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

examples/procfs1.c

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ static int __init procfs1_init(void)
4848
{
4949
our_proc_file = proc_create(procfs_name, 0644, NULL, &proc_file_fops);
5050
if (NULL == our_proc_file) {
51-
proc_remove(our_proc_file);
5251
pr_alert("Error:Could not initialize /proc/%s\n", procfs_name);
5352
return -ENOMEM;
5453
}

0 commit comments

Comments
 (0)