From 8d964478b2d124fcfde8017d02d4d70ae20802f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Calmels?= Date: Tue, 3 Jun 2014 23:34:25 +0200 Subject: sd: bad return code of init_sd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In init_sd function, if kmem_cache_create or mempool_create_slab_pools calls fail, the error will not be correclty reported because class_register previously set the value of err to 0. Signed-off-by: Clément Calmels Reviewed-by: Ewan D. Milne Signed-off-by: Christoph Hellwig diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 4056004..5167b96 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3212,12 +3212,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; } -- cgit v0.10.2