From: Wei Yongjun <weiyongjun1@huawei.com>
To: Alasdair Kergon <agk@redhat.com>,
Mike Snitzer <snitzer@redhat.com>,
Mikulas Patocka <mpatocka@redhat.com>
Cc: Wei Yongjun <weiyongjun1@huawei.com>, <dm-devel@redhat.com>,
<linux-kernel@vger.kernel.org>, <kernel-janitors@vger.kernel.org>
Subject: [PATCH -next] dm writecache: fix return value check in writecache_ctr()
Date: Thu, 31 May 2018 11:53:15 +0000 [thread overview]
Message-ID: <1527767595-76082-1-git-send-email-weiyongjun1@huawei.com> (raw)
Function dm_io_client_create() and dm_kcopyd_client_create() return
ERR_PTR() not NULL in case of error. The NULL test in the return value
check should be replaced with IS_ERR()
Fixes: 2105231db61b ("dm: add writecache target")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
drivers/md/dm-writecache.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
index 844c4fb..0b2b436 100644
--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -1872,9 +1872,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
}
wc->dm_io = dm_io_client_create();
- if (!wc->dm_io) {
- r = -ENOMEM;
+ if (IS_ERR(wc->dm_io)) {
+ r = PTR_ERR(wc->dm_io);
ti->error = "Unable to allocate dm-io client";
+ wc->dm_io = NULL;
goto bad;
}
@@ -2096,9 +2097,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
}
wc->dm_kcopyd = dm_kcopyd_client_create(&dm_kcopyd_throttle);
- if (!wc->dm_kcopyd) {
- r = -ENOMEM;
+ if (IS_ERR(wc->dm_kcopyd)) {
+ r = PTR_ERR(wc->dm_kcopyd);
ti->error = "Unable to allocate dm-kcopyd client";
+ wc->dm_kcopyd = NULL;
goto bad;
}
next reply other threads:[~2018-05-31 11:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-31 11:53 Wei Yongjun [this message]
2018-05-31 16:02 ` Mike Snitzer
2018-05-31 16:07 ` Mike Snitzer
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=1527767595-76082-1-git-send-email-weiyongjun1@huawei.com \
--to=weiyongjun1@huawei.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=snitzer@redhat.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
all inboxes | Powered by JetHome®