public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <chao2.yu@samsung.com>
To: axboe@kernel.dk
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] elevator: remove unneeded kfree in error path of elevator_alloc
Date: Thu, 23 Apr 2015 15:44:09 +0800	[thread overview]
Message-ID: <005601d07d99$5dec4d20$19c4e760$@samsung.com> (raw)

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.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
---
 block/elevator.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/block/elevator.c b/block/elevator.c
index 59794d0..d146a5e 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -166,7 +166,6 @@ struct elevator_queue *elevator_alloc(struct request_queue *q,
 
 	return eq;
 err:
-	kfree(eq);
 	elevator_put(e);
 	return NULL;
 }
-- 
2.3.3



             reply	other threads:[~2015-04-23  7:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23  7:44 Chao Yu [this message]
2015-04-23 14:58 ` [PATCH] elevator: remove unneeded kfree in error path of elevator_alloc Jeff Moyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='005601d07d99$5dec4d20$19c4e760$@samsung.com' \
    --to=chao2.yu@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox