From 5e2b7aa2e378bd919babd00af0c5c9afa29e27d1 Mon Sep 17 00:00:00 2001 From: keytouch Date: Sun, 23 Jul 2023 18:41:46 +0800 Subject: [PATCH] procfs: Remove unnecessary cleanup on proc_create failure --- examples/procfs2.c | 1 - examples/procfs3.c | 1 - examples/procfs4.c | 1 - examples/sleep.c | 1 - 4 files changed, 4 deletions(-) diff --git a/examples/procfs2.c b/examples/procfs2.c index ec55cf0..b5539c5 100644 --- a/examples/procfs2.c +++ b/examples/procfs2.c @@ -77,7 +77,6 @@ static int __init procfs2_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; } diff --git a/examples/procfs3.c b/examples/procfs3.c index ff741f7..38e7bd1 100644 --- a/examples/procfs3.c +++ b/examples/procfs3.c @@ -82,7 +82,6 @@ static int __init procfs3_init(void) our_proc_file = proc_create(PROCFS_ENTRY_FILENAME, 0644, NULL, &file_ops_4_our_proc_file); if (our_proc_file == NULL) { - remove_proc_entry(PROCFS_ENTRY_FILENAME, NULL); pr_debug("Error: Could not initialize /proc/%s\n", PROCFS_ENTRY_FILENAME); return -ENOMEM; diff --git a/examples/procfs4.c b/examples/procfs4.c index c1da7f7..8c7e4ab 100644 --- a/examples/procfs4.c +++ b/examples/procfs4.c @@ -98,7 +98,6 @@ static int __init procfs4_init(void) entry = proc_create(PROC_NAME, 0, NULL, &my_file_ops); if (entry == NULL) { - remove_proc_entry(PROC_NAME, NULL); pr_debug("Error: Could not initialize /proc/%s\n", PROC_NAME); return -ENOMEM; } diff --git a/examples/sleep.c b/examples/sleep.c index ad8c1dd..8ce7ff9 100644 --- a/examples/sleep.c +++ b/examples/sleep.c @@ -194,7 +194,6 @@ static int __init sleep_init(void) our_proc_file = proc_create(PROC_ENTRY_FILENAME, 0644, NULL, &file_ops_4_our_proc_file); if (our_proc_file == NULL) { - remove_proc_entry(PROC_ENTRY_FILENAME, NULL); pr_debug("Error: Could not initialize /proc/%s\n", PROC_ENTRY_FILENAME); return -ENOMEM; }