From 8c641a2deb4cf927d079ead48e417eb4a77973e8 Mon Sep 17 00:00:00 2001 From: Bob Lee Date: Sun, 6 Oct 2024 14:25:49 +0800 Subject: [PATCH] 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 --- examples/procfs1.c | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/procfs1.c b/examples/procfs1.c index c27c357..444069d 100644 --- a/examples/procfs1.c +++ b/examples/procfs1.c @@ -48,7 +48,6 @@ static int __init procfs1_init(void) { our_proc_file = proc_create(procfs_name, 0644, NULL, &proc_file_fops); if (NULL == our_proc_file) { - proc_remove(our_proc_file); pr_alert("Error:Could not initialize /proc/%s\n", procfs_name); return -ENOMEM; }