From: Mike Snitzer <snitzer@redhat.com>
To: Wei Yongjun <weiyongjun1@huawei.com>
Cc: Alasdair Kergon <agk@redhat.com>,
Mikulas Patocka <mpatocka@redhat.com>,
dm-devel@redhat.com, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH -next] dm writecache: fix return value check in writecache_ctr()
Date: Thu, 31 May 2018 12:02:02 -0400 [thread overview]
Message-ID: <20180531160202.GA11300@redhat.com> (raw)
In-Reply-To: <1527767595-76082-1-git-send-email-weiyongjun1@huawei.com>
On Thu, May 31 2018 at 7:53am -0400,
Wei Yongjun <weiyongjun1@huawei.com> wrote:
> 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;
> }
>
Yes, I forgot to pull this in.. it got lost in the shuffle. Mikulas had
provided this same change (folded into a larger patch) yesterday, see:
https://patchwork.kernel.org/patch/10439345/
I'll get this folded in ASAP.
Thanks,
Mike
next prev parent reply other threads:[~2018-05-31 16:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-31 11:53 Wei Yongjun
2018-05-31 16:02 ` Mike Snitzer [this message]
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=20180531160202.GA11300@redhat.com \
--to=snitzer@redhat.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=weiyongjun1@huawei.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®