From: Clément Calmels Date: Tue, 3 Jun 2014 21:34:25 +0000 (+0200) Subject: sd: bad return code of init_sd X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=8d964478b2d124fcfde8017d02d4d70ae20802f2;p=linux-beck.git sd: bad return code of init_sd 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 4056004102ae..5167b9678240 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; }