IO-Uring Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH -next] io_uring: Remove redundant NULL check
@ 2020-07-23  3:19 Li Heng
  2020-07-23  3:25 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Li Heng @ 2020-07-23  3:19 UTC (permalink / raw)
  To: axboe, viro; +Cc: io-uring, linux-fsdevel, linux-kernel

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 <liheng40@huawei.com>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-23  3:19 [PATCH -next] io_uring: Remove redundant NULL check Li Heng
2020-07-23  3:25 ` Jens Axboe

IO-Uring Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/io-uring/0 io-uring/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 io-uring io-uring/ https://lore.kernel.org/io-uring \
		io-uring@vger.kernel.org
	public-inbox-index io-uring

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.io-uring


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git