public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Wei Yongjun <weiyongjun1@huawei.com>
Cc: dhowells@redhat.com, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH -next] watch_queue: Fix error return code in watch_queue_set_size()
Date: Mon, 20 Jan 2020 11:32:28 +0000	[thread overview]
Message-ID: <771479.1579519948@warthog.procyon.org.uk> (raw)
In-Reply-To: <20200120085411.116252-1-weiyongjun1@huawei.com>

Wei Yongjun <weiyongjun1@huawei.com> wrote:

>  	pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL);
> -	if (!pages)
> +	if (!pages) {
> +		ret = -ENOMEM;

I think the preferred method would be to set ret before calling kcalloc as the
attached.

David
---

diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
index 8c625cf451e6..a11724d66834 100644
--- a/kernel/watch_queue.c
+++ b/kernel/watch_queue.c
@@ -249,6 +249,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes)
 	if (ret < 0)
 		goto error;
 
+	ret = -ENOMEM;
 	pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL);
 	if (!pages)
 		goto error;


  reply	other threads:[~2020-01-20 11:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-20  8:54 [PATCH -next] watch_queue: Fix error return code in watch_queue_set_size() Wei Yongjun
2020-01-20 11:32 ` David Howells [this message]
2020-01-22  7:48 ` [PATCH -next v2] watch_queue: fix " Wei Yongjun
  -- strict thread matches above, loose matches on Subject: below --
2021-05-19 14:16 [PATCH -next] watch_queue: Fix " Wei Yongjun

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=771479.1579519948@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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