From: Li Heng <[email protected]>
To: <[email protected]>, <[email protected]>
Cc: <[email protected]>, <[email protected]>,
<[email protected]>
Subject: [PATCH -next] io_uring: Remove redundant NULL check
Date: Thu, 23 Jul 2020 11:19:10 +0800 [thread overview]
Message-ID: <[email protected]> (raw)
Fix below warnings reported by coccicheck:
./fs/io_uring.c:1544:2-7: WARNING: NULL check before some freeing functions is not needed.
./fs/io_uring.c:3095:2-7: WARNING: NULL check before some freeing functions is not needed.
./fs/io_uring.c:3195:2-7: WARNING: NULL check before some freeing functions is not needed.
Signed-off-by: Li Heng <[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 6587935..71ac3f7 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1540,8 +1540,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);
@@ -3091,8 +3090,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
}
}
out_free:
- if (iovec)
- kfree(iovec);
+ kfree(iovec);
return ret;
}
@@ -3191,8 +3189,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock,
}
}
out_free:
- if (iovec)
- kfree(iovec);
+ kfree(iovec);
return ret;
}
--
2.7.4
next reply other threads:[~2020-07-23 3:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-23 3:19 Li Heng [this message]
2020-07-23 3:25 ` [PATCH -next] io_uring: Remove redundant NULL check 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=1595474350-10039-1-git-send-email-liheng40@huawei.com \
[email protected] \
[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