Skip to contentSkip to conversation

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

PATCH Applied Cyrill Gorcunov 2 participants 2 messages Apr 1, 2008 – Apr 4, 2008 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---

 ds.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/ds.c +4 -4
Index: linux-2.6.git/arch/x86/kernel/ds.c
===================================================================
@@ -220,11 +220,11 @@ int ds_allocate(void **dsp, size_t bts_s
 
 int ds_free(void **dsp)
 {
-	if (*dsp)
+	if (*dsp) {
 		kfree((void *)get_bts_buffer_base(*dsp));
-	kfree(*dsp);
-	*dsp = NULL;
-
+		kfree(*dsp);
+		*dsp = NULL;
+	}
 	return 0;
 }
 
Applied
#1 lore raw
Quoted 3 lines · Cyrill Gorcunov

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

thanks, applied.

Ingo