Skip to contentSkip to conversation

elevator: remove unneeded kfree in error path of elevator_alloc

PATCH In review Chao Yu 2 participants 2 messages Apr 23, 2015 Block layer

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/1 elevator: remove unneeded kfree in error path of elevator_alloc

In elevator_alloc, if we fail to allocate memory for storing elevator queue, our eq pointer must be NULL, we do not need to release it in error path, so remove it.

---
 block/elevator.c | 1 -
 1 file changed, 1 deletion(-)
block/elevator.c +0 -1
index 59794d0..d146a5e 100644
@@ -166,7 +166,6 @@ struct elevator_queue *elevator_alloc(struct request_queue *q,
 
 	return eq;
 err:
-	kfree(eq);
 	elevator_put(e);
 	return NULL;
 }
Signature · 1 line
2.3.3
Acked-by on v1 1/1
#1 lore raw
Quoted 14 lines · Chao Yu

In elevator_alloc, if we fail to allocate memory for storing elevator queue, our eq pointer must be NULL, we do not need to release it in error path, so remove it.

---
 block/elevator.c | 1 -
 1 file changed, 1 deletion(-)
block/elevator.c +0 -0
index 59794d0..d146a5e 100644

block/elevator.c struct elevator_queue *elevator_alloc(struct request_queue *q, · line 171

Quoted 7 lines
block/elevator.c +0 -1
@@ -166,7 +166,6 @@ struct elevator_queue *elevator_alloc(struct request_queue *q,
 
 	return eq;
 err:
-	kfree(eq);
 	elevator_put(e);
 	return NULL;
 }