summaryrefslogtreecommitdiffstats
path: root/lib/dynamic_debug.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-07 22:25:37 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-07 22:25:37 -0500
commitb5dd0c658c31b469ccff1b637e5124851e7a4a1c (patch)
treedc0b31a5aa62bb4e1fa653a4f176c2faae51f9e0 /lib/dynamic_debug.c
parent610cd4eadec4f97acd25d3108b0e50d1362b3319 (diff)
parentfe0436e10c8845aed24cad3a1c719efcd6e583eb (diff)
Merge branch 'akpm' (patches from Andrew)
Merge more updates from Andrew Morton: - some of the rest of MM - various misc things - dynamic-debug updates - checkpatch - some epoll speedups - autofs - rapidio - lib/, lib/lzo/ updates * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (83 commits) samples/mic/mpssd/mpssd.h: remove duplicate header kernel/fork.c: remove duplicated include include/linux/relay.h: fix percpu annotation in struct rchan arch/nios2/mm/fault.c: remove duplicate include unicore32: stop printing the virtual memory layout MAINTAINERS: fix GTA02 entry and mark as orphan mm: create the new vm_fault_t type arm, s390, unicore32: remove oneliner wrappers for memblock_alloc() arch: simplify several early memory allocations openrisc: simplify pte_alloc_one_kernel() sh: prefer memblock APIs returning virtual address microblaze: prefer memblock API returning virtual address powerpc: prefer memblock APIs returning virtual address lib/lzo: separate lzo-rle from lzo lib/lzo: implement run-length encoding lib/lzo: fast 8-byte copy on arm64 lib/lzo: 64-bit CTZ on arm64 lib/lzo: tidy-up ifdefs ipc/sem.c: replace kvmalloc/memset with kvzalloc and use struct_size ipc: annotate implicit fall through ...
Diffstat (limited to 'lib/dynamic_debug.c')
-rw-r--r--lib/dynamic_debug.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index dbf2b457e47e..7bdf98c37e91 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -847,17 +847,19 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
847 const char *name) 847 const char *name)
848{ 848{
849 struct ddebug_table *dt; 849 struct ddebug_table *dt;
850 const char *new_name;
851 850
852 dt = kzalloc(sizeof(*dt), GFP_KERNEL); 851 dt = kzalloc(sizeof(*dt), GFP_KERNEL);
853 if (dt == NULL) 852 if (dt == NULL) {
854 return -ENOMEM; 853 pr_err("error adding module: %s\n", name);
855 new_name = kstrdup_const(name, GFP_KERNEL);
856 if (new_name == NULL) {
857 kfree(dt);
858 return -ENOMEM; 854 return -ENOMEM;
859 } 855 }
860 dt->mod_name = new_name; 856 /*
857 * For built-in modules, name lives in .rodata and is
858 * immortal. For loaded modules, name points at the name[]
859 * member of struct module, which lives at least as long as
860 * this struct ddebug_table.
861 */
862 dt->mod_name = name;
861 dt->num_ddebugs = n; 863 dt->num_ddebugs = n;
862 dt->ddebugs = tab; 864 dt->ddebugs = tab;
863 865
@@ -868,7 +870,6 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
868 vpr_info("%u debug prints in module %s\n", n, dt->mod_name); 870 vpr_info("%u debug prints in module %s\n", n, dt->mod_name);
869 return 0; 871 return 0;
870} 872}
871EXPORT_SYMBOL_GPL(ddebug_add_module);
872 873
873/* helper for ddebug_dyndbg_(boot|module)_param_cb */ 874/* helper for ddebug_dyndbg_(boot|module)_param_cb */
874static int ddebug_dyndbg_param_cb(char *param, char *val, 875static int ddebug_dyndbg_param_cb(char *param, char *val,
@@ -913,7 +914,6 @@ int ddebug_dyndbg_module_param_cb(char *param, char *val, const char *module)
913static void ddebug_table_free(struct ddebug_table *dt) 914static void ddebug_table_free(struct ddebug_table *dt)
914{ 915{
915 list_del_init(&dt->link); 916 list_del_init(&dt->link);
916 kfree_const(dt->mod_name);
917 kfree(dt); 917 kfree(dt);
918} 918}
919 919
@@ -930,15 +930,15 @@ int ddebug_remove_module(const char *mod_name)
930 930
931 mutex_lock(&ddebug_lock); 931 mutex_lock(&ddebug_lock);
932 list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) { 932 list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) {
933 if (!strcmp(dt->mod_name, mod_name)) { 933 if (dt->mod_name == mod_name) {
934 ddebug_table_free(dt); 934 ddebug_table_free(dt);
935 ret = 0; 935 ret = 0;
936 break;
936 } 937 }
937 } 938 }
938 mutex_unlock(&ddebug_lock); 939 mutex_unlock(&ddebug_lock);
939 return ret; 940 return ret;
940} 941}
941EXPORT_SYMBOL_GPL(ddebug_remove_module);
942 942
943static void ddebug_remove_all_tables(void) 943static void ddebug_remove_all_tables(void)
944{ 944{