From: Chengguang Xu <cgxu519@gmx.com>
To: bcrl@kvack.org, viro@zeniv.linux.org.uk
Cc: linux-aio@kvack.org, linux-fsdevel@vger.kernel.org,
Chengguang Xu <cgxu519@gmx.com>
Subject: [PATCH] aio: remove redundant check in ioctx_alloc()
Date: Fri, 4 Jan 2019 22:31:36 +0800 [thread overview]
Message-ID: <20190104143136.25078-1-cgxu519@gmx.com> (raw)
We don't have to check if nr_events is zero in
ioctx_alloc() because the caller has already
done that.
Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
fs/aio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/aio.c b/fs/aio.c
index b906ff70c90f..7b26c4feb0de 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -720,7 +720,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
return ERR_PTR(-EINVAL);
}
- if (!nr_events || (unsigned long)max_reqs > aio_max_nr)
+ if ((unsigned long)max_reqs > aio_max_nr)
return ERR_PTR(-EAGAIN);
ctx = kmem_cache_zalloc(kioctx_cachep, GFP_KERNEL);
--
2.17.2
next reply other threads:[~2019-01-04 14:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-04 14:31 Chengguang Xu [this message]
2019-01-04 16:03 ` [PATCH] aio: remove redundant check in ioctx_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=20190104143136.25078-1-cgxu519@gmx.com \
--to=cgxu519@gmx.com \
--cc=bcrl@kvack.org \
--cc=linux-aio@kvack.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).