From: Yafang Shao <laoar.shao@gmail.com>
To: josef@toxicpanda.com, axboe@fb.com
Cc: linux-block@vger.kernel.org, nbd@other.debian.org,
shaoyafang@didiglobal.com, Yafang Shao <laoar.shao@gmail.com>
Subject: [PATCH] nbd: use kmalloc instead of kzalloc when allocating recv_thread_args
Date: Thu, 17 Jan 2019 17:55:55 +0800 [thread overview]
Message-ID: <1547718955-870-1-git-send-email-laoar.shao@gmail.com> (raw)
As all the members of recv_thread_args will be set before queue_work(),
we don't need to use kzalloc() here.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
drivers/block/nbd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 08696f5..1656a60 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -983,7 +983,7 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)
if (!sock)
return err;
- args = kzalloc(sizeof(*args), GFP_KERNEL);
+ args = kmalloc(sizeof(*args), GFP_KERNEL);
if (!args) {
sockfd_put(sock);
return -ENOMEM;
@@ -1166,7 +1166,7 @@ static int nbd_start_device(struct nbd_device *nbd)
for (i = 0; i < num_connections; i++) {
struct recv_thread_args *args;
- args = kzalloc(sizeof(*args), GFP_KERNEL);
+ args = kmalloc(sizeof(*args), GFP_KERNEL);
if (!args) {
sock_shutdown(nbd);
return -ENOMEM;
--
1.8.3.1
reply other threads:[~2019-01-17 9:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1547718955-870-1-git-send-email-laoar.shao@gmail.com \
--to=laoar.shao@gmail.com \
--cc=axboe@fb.com \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=nbd@other.debian.org \
--cc=shaoyafang@didiglobal.com \
/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).