summaryrefslogtreecommitdiff
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorClément Calmels <clement.calmels@free.fr>2014-06-03 23:34:25 +0200
committerChristoph Hellwig <hch@lst.de>2014-07-17 22:07:32 +0200
commit8d964478b2d124fcfde8017d02d4d70ae20802f2 (patch)
tree3bdf7252f41c91a6f8e2b84d9c6494451087d2a2 /drivers/scsi/sd.c
parentcb2fb68d064c16a559483651132815cc378fd1f9 (diff)
downloadlwn-8d964478b2d124fcfde8017d02d4d70ae20802f2.tar.gz
lwn-8d964478b2d124fcfde8017d02d4d70ae20802f2.zip
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 <clement.calmels@free.fr> Reviewed-by: Ewan D. Milne <emilne@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c2
1 files changed, 2 insertions, 0 deletions
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;
}