diff options
author | George Hilliard <thirtythreeforty@gmail.com> | 2019-03-20 16:42:03 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-03-22 15:20:27 +0100 |
commit | f2778bb3cb6c7544578c45688f3d5bcb09e0ac87 (patch) | |
tree | 29ca29cd4d8d7a95a40f65c03257de5a10af9607 /drivers/staging/mt7621-mmc/dbg.c | |
parent | 561fb35a9d04ca7d1a5b955bcac50c6c4f49227d (diff) |
staging: mt7621-mmc: Fix warning when reloading module with debug msgs enabled
The kernel complained:
[ 510.277151] WARNING: CPU: 0 PID: 395 at fs/proc/generic.c:360 proc_register+0xf0/0x108
[ 510.292891] proc_dir_entry '/proc/msdc_debug' already registered
when doing a modprobe/rmmod/modprobe of this module if debug messages
are compiled in. Fix this by removing the proc entry when the module is
unloaded.
Signed-off-by: George Hilliard <thirtythreeforty@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/mt7621-mmc/dbg.c')
-rw-r--r-- | drivers/staging/mt7621-mmc/dbg.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index fda3ba38ba37..2310f3bcc16e 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -294,9 +294,18 @@ static const struct file_operations msdc_debug_fops = { .release = single_release, }; -void msdc_debug_proc_init(void) +// Keep ahold of the proc entry we create so it can be freed during +// module removal +struct proc_dir_entry *msdc_debug_proc_entry; + +void __init msdc_debug_proc_init(void) +{ + msdc_debug_proc_entry = proc_create("msdc_debug", 0660, + NULL, &msdc_debug_fops); +} + +void __exit msdc_debug_proc_deinit(void) { - proc_create("msdc_debug", 0660, NULL, &msdc_debug_fops); + proc_remove(msdc_debug_proc_entry); } -EXPORT_SYMBOL_GPL(msdc_debug_proc_init); #endif |