public inbox for [email protected]
 help / color / mirror / Atom feed
From: Wu Bo <[email protected]>
To: <[email protected]>
Cc: <[email protected]>, <[email protected]>,
	<[email protected]>, <[email protected]>
Subject: [PATCH] io_uring: NULL check before kfree() is not needed
Date: Sat, 15 Aug 2020 11:25:12 +0800	[thread overview]
Message-ID: <[email protected]> (raw)

NULL check before kfree() is not needed

Signed-off-by: Wu Bo <[email protected]>
---
 fs/io_uring.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 2a3af95..59c19c8 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1537,8 +1537,7 @@ static void io_dismantle_req(struct io_kiocb *req)
 {
 	io_clean_op(req);
 
-	if (req->io)
-		kfree(req->io);
+	kfree(req->io);
 	if (req->file)
 		io_put_file(req, req->file, (req->flags & REQ_F_FIXED_FILE));
 	io_req_clean_work(req);
@@ -3111,8 +3110,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
 		return -EAGAIN;
 	}
 out_free:
-	if (iovec)
-		kfree(iovec);
+	kfree(iovec);
 	return ret;
 }
 
@@ -3210,8 +3208,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock,
 		return -EAGAIN;
 	}
 out_free:
-	if (iovec)
-		kfree(iovec);
+	kfree(iovec);
 	return ret;
 }
 
-- 
1.8.3.1


             reply	other threads:[~2020-08-16  3:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-15  3:25 Wu Bo [this message]
2020-08-15  3:39 ` [PATCH] io_uring: NULL check before kfree() is not needed Jens Axboe

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=1597461912-262969-1-git-send-email-wubo40@huawei.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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