From: "Ewan D. Milne" <emi...@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 <emi...@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

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to