linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ewan D. Milne" <emilne@redhat.com>
To: linux-scsi@vger.kernel.org
Subject: [PATCH] [SCSI] sd: Do not return success from init_sd if DIF mempool allocation fails
Date: Thu, 14 Feb 2013 11:36:35 -0500	[thread overview]
Message-ID: <1360859795-30448-3-git-send-email-emilne@redhat.com> (raw)
In-Reply-To: <1360859795-30448-1-git-send-email-emilne@redhat.com>

From: "Ewan D. Milne" <emilne@redhat.com>

init_sd() was returning 0 if sd_cdb_cache or sd_cdb_pool could
not be allocated.  Return -ENOMEM instead, since the sd_disk_class
and the blkdevs will be unregistered if this happens.

Signed-off-by: Ewan D. Milne <emilne@redhat.com>
---
 drivers/scsi/sd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 8551f3e..4943a4f 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2931,12 +2931,14 @@ static int __init init_sd(void)
 					 0, 0, NULL);
 	if (!sd_cdb_cache) {
 		printk(KERN_ERR "sd: can't init extended cdb cache\n");
+		err = -ENOMEM;
 		goto err_out_class;
 	}
 
 	sd_cdb_pool = mempool_create_slab_pool(SD_MEMPOOL_SIZE, sd_cdb_cache);
 	if (!sd_cdb_pool) {
 		printk(KERN_ERR "sd: can't init extended cdb pool\n");
+		err = -ENOMEM;
 		goto err_out_cache;
 	}
 
-- 
1.7.11.7


  parent reply	other threads:[~2013-02-14 16:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-14 16:36 [PATCH] [SCSI] Automatic LUN removal Ewan D. Milne
2013-02-14 16:36 ` [PATCH] [SCSI] scsi_debug: Do not respond to INQUIRY commands with CHECK CONDITION when sense pending Ewan D. Milne
2013-02-14 21:46   ` Douglas Gilbert
2013-02-15 14:58     ` Ewan Milne
2013-02-14 16:36 ` Ewan D. Milne [this message]
2013-04-05 15:02   ` [PATCH] [SCSI] sd: Do not return success from init_sd if DIF mempool allocation fails Ewan Milne

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=1360859795-30448-3-git-send-email-emilne@redhat.com \
    --to=emilne@redhat.com \
    --cc=linux-scsi@vger.kernel.org \
    /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).