浏览代码

x86: debug Store - call kfree if only we really need it

We should call for kfree if only we really need it.
Though it's safe to call kfree with NULL pointer passed
in this code we've already tested the pointer and can
eliminate the call

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cyrill Gorcunov 17 年之前
父节点
当前提交
431ef7a2a4
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      arch/x86/kernel/ds.c

+ 4 - 4
arch/x86/kernel/ds.c

@@ -220,11 +220,11 @@ int ds_allocate(void **dsp, size_t bts_size_in_bytes)
 
 
 int ds_free(void **dsp)
 int ds_free(void **dsp)
 {
 {
-	if (*dsp)
+	if (*dsp) {
 		kfree((void *)get_bts_buffer_base(*dsp));
 		kfree((void *)get_bts_buffer_base(*dsp));
-	kfree(*dsp);
-	*dsp = NULL;
-
+		kfree(*dsp);
+		*dsp = NULL;
+	}
 	return 0;
 	return 0;
 }
 }