Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1182753 > unrolled thread
| Started by | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| First post | 2015-07-13 14:10 +0200 |
| Last post | 2015-07-13 14:10 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 1/2] char: misc: remove redundant ifdef Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-07-13 14:10 +0200
[PATCH 2/2] char: misc: fix error path Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-07-13 14:10 +0200
| From | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| Date | 2015-07-13 14:10 +0200 |
| Subject | [PATCH 1/2] char: misc: remove redundant ifdef |
| Message-ID | <pLKIy-4R5-11@gated-at.bofh.it> |
The check for CONFIG_PROC_FS is not required as the check is being done
in proc_fs.h and incase CONFIG_PROC_FS is not defined then proc_create()
is defined as NULL.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
drivers/char/misc.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index fdb0f9b..3b95795 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -282,9 +282,7 @@ static int __init misc_init(void)
{
int err;
-#ifdef CONFIG_PROC_FS
proc_create("misc", 0, NULL, &misc_proc_fops);
-#endif
misc_class = class_create(THIS_MODULE, "misc");
err = PTR_ERR(misc_class);
if (IS_ERR(misc_class))
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| Date | 2015-07-13 14:10 +0200 |
| Subject | [PATCH 2/2] char: misc: fix error path |
| Message-ID | <pLKIz-4R5-49@gated-at.bofh.it> |
| In reply to | #1182753 |
Lets call remove_proc_entry() in the error path only if we have
successfully created "misc" in procfs.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
drivers/char/misc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 3b95795..acedbaf 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -281,8 +281,9 @@ static char *misc_devnode(struct device *dev, umode_t *mode)
static int __init misc_init(void)
{
int err;
+ struct proc_dir_entry *ret;
- proc_create("misc", 0, NULL, &misc_proc_fops);
+ ret = proc_create("misc", 0, NULL, &misc_proc_fops);
misc_class = class_create(THIS_MODULE, "misc");
err = PTR_ERR(misc_class);
if (IS_ERR(misc_class))
@@ -298,7 +299,8 @@ fail_printk:
printk("unable to get major %d for misc devices\n", MISC_MAJOR);
class_destroy(misc_class);
fail_remove:
- remove_proc_entry("misc", NULL);
+ if (ret)
+ remove_proc_entry("misc", NULL);
return err;
}
subsys_initcall(misc_init);
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web