Skip to content

Commit

Permalink
sd: bad return code of init_sd
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Clément Calmels authored and Christoph Hellwig committed Jul 17, 2014
1 parent cb2fb68 commit 8d96447
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 8d96447

Please sign in to comment.