Skip to content

Commit 8d96447

Browse files
ccalmelsChristoph Hellwig
authored andcommitted
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>
1 parent cb2fb68 commit 8d96447

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎drivers/scsi/sd.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3212,12 +3212,14 @@ static int __init init_sd(void)
32123212
0, 0, NULL);
32133213
if (!sd_cdb_cache) {
32143214
printk(KERN_ERR "sd: can't init extended cdb cache\n");
3215+
err = -ENOMEM;
32153216
goto err_out_class;
32163217
}
32173218

32183219
sd_cdb_pool = mempool_create_slab_pool(SD_MEMPOOL_SIZE, sd_cdb_cache);
32193220
if (!sd_cdb_pool) {
32203221
printk(KERN_ERR "sd: can't init extended cdb pool\n");
3222+
err = -ENOMEM;
32213223
goto err_out_cache;
32223224
}
32233225

0 commit comments

Comments
 (0)