]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
sd: bad return code of init_sd
authorClément Calmels <clement.calmels@free.fr>
Tue, 3 Jun 2014 21:34:25 +0000 (23:34 +0200)
committerChristoph Hellwig <hch@lst.de>
Thu, 17 Jul 2014 20:07:32 +0000 (22:07 +0200)
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 <clement.calmels@free.fr>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/sd.c

index 4056004102ae4a274e6e16ceffaee5be2ae2348d..5167b96782409d63599057175bc497b7ae82da90 100644 (file)
@@ -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;
        }