linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Philipp Reisner <philipp.reisner@linbit.com>,
	Lars Ellenberg <lars.ellenberg@linbit.com>
Cc: drbd-dev@lists.linbit.com, linux-kernel@vger.kernel.org
Subject: [PATCH] drdb: don't check for failure from mempool_alloc()
Date: Mon, 10 Apr 2017 12:06:30 +1000	[thread overview]
Message-ID: <87mvbpxbh5.fsf@notabene.neil.brown.name> (raw)

[-- Attachment #1: Type: text/plain, Size: 1367 bytes --]


mempool_alloc() cannot fail if the gfp flags allow
it to sleep, and GFP_NOIO allows for sleeping.
So drbd_req_new() cannot fail, and drbd_request_prepare() doesn't need
to check if it did.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 drivers/block/drbd/drbd_req.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index 652114ae1a8a..2e796f79b324 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -52,8 +52,6 @@ static struct drbd_request *drbd_req_new(struct drbd_device *device, struct bio
 	struct drbd_request *req;
 
 	req = mempool_alloc(drbd_request_mempool, GFP_NOIO);
-	if (!req)
-		return NULL;
 	memset(req, 0, sizeof(*req));
 
 	drbd_req_make_private_bio(req, bio_src);
@@ -1214,15 +1212,6 @@ drbd_request_prepare(struct drbd_device *device, struct bio *bio, unsigned long
 
 	/* allocate outside of all locks; */
 	req = drbd_req_new(device, bio);
-	if (!req) {
-		dec_ap_bio(device);
-		/* only pass the error to the upper layers.
-		 * if user cannot handle io errors, that's not our business. */
-		drbd_err(device, "could not kmalloc() req\n");
-		bio->bi_error = -ENOMEM;
-		bio_endio(bio);
-		return ERR_PTR(-ENOMEM);
-	}
 	req->start_jif = start_jif;
 
 	if (!get_ldev(device)) {
-- 
2.12.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

                 reply	other threads:[~2017-04-10  2:06 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=87mvbpxbh5.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=drbd-dev@lists.linbit.com \
    --cc=lars.ellenberg@linbit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philipp.reisner@linbit.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).