aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kernel/debug.c')
-rw-r--r--arch/s390/kernel/debug.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index ba500d8dc392..4e8215e0d4b6 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -1127,13 +1127,14 @@ debug_register_view(debug_info_t * id, struct debug_view *view)
1127 if (i == DEBUG_MAX_VIEWS) { 1127 if (i == DEBUG_MAX_VIEWS) {
1128 pr_err("Registering view %s/%s would exceed the maximum " 1128 pr_err("Registering view %s/%s would exceed the maximum "
1129 "number of views %i\n", id->name, view->name, i); 1129 "number of views %i\n", id->name, view->name, i);
1130 debugfs_remove(pde);
1131 rc = -1; 1130 rc = -1;
1132 } else { 1131 } else {
1133 id->views[i] = view; 1132 id->views[i] = view;
1134 id->debugfs_entries[i] = pde; 1133 id->debugfs_entries[i] = pde;
1135 } 1134 }
1136 spin_unlock_irqrestore(&id->lock, flags); 1135 spin_unlock_irqrestore(&id->lock, flags);
1136 if (rc)
1137 debugfs_remove(pde);
1137out: 1138out:
1138 return rc; 1139 return rc;
1139} 1140}
@@ -1146,9 +1147,9 @@ EXPORT_SYMBOL(debug_register_view);
1146int 1147int
1147debug_unregister_view(debug_info_t * id, struct debug_view *view) 1148debug_unregister_view(debug_info_t * id, struct debug_view *view)
1148{ 1149{
1149 int rc = 0; 1150 struct dentry *dentry = NULL;
1150 int i;
1151 unsigned long flags; 1151 unsigned long flags;
1152 int i, rc = 0;
1152 1153
1153 if (!id) 1154 if (!id)
1154 goto out; 1155 goto out;
@@ -1160,10 +1161,12 @@ debug_unregister_view(debug_info_t * id, struct debug_view *view)
1160 if (i == DEBUG_MAX_VIEWS) 1161 if (i == DEBUG_MAX_VIEWS)
1161 rc = -1; 1162 rc = -1;
1162 else { 1163 else {
1163 debugfs_remove(id->debugfs_entries[i]); 1164 dentry = id->debugfs_entries[i];
1164 id->views[i] = NULL; 1165 id->views[i] = NULL;
1166 id->debugfs_entries[i] = NULL;
1165 } 1167 }
1166 spin_unlock_irqrestore(&id->lock, flags); 1168 spin_unlock_irqrestore(&id->lock, flags);
1169 debugfs_remove(dentry);
1167out: 1170out:
1168 return rc; 1171 return rc;
1169} 1172}