Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Clément Calmels and committed by
Christoph Hellwig
8d964478 cb2fb68d

+2
+2
drivers/scsi/sd.c
··· 3212 3212 0, 0, NULL); 3213 3213 if (!sd_cdb_cache) { 3214 3214 printk(KERN_ERR "sd: can't init extended cdb cache\n"); 3215 + err = -ENOMEM; 3215 3216 goto err_out_class; 3216 3217 } 3217 3218 3218 3219 sd_cdb_pool = mempool_create_slab_pool(SD_MEMPOOL_SIZE, sd_cdb_cache); 3219 3220 if (!sd_cdb_pool) { 3220 3221 printk(KERN_ERR "sd: can't init extended cdb pool\n"); 3222 + err = -ENOMEM; 3221 3223 goto err_out_cache; 3222 3224 } 3223 3225