mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sd: bad return code of init_sd
@ 2014-06-03 21:34 Clément Calmels
  2014-06-04 16:44 ` Ewan Milne
  2014-06-11 12:10 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Clément Calmels @ 2014-06-03 21:34 UTC (permalink / raw)
  To: JBottomley, linux-scsi, linux-kernel

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>
---
 drivers/scsi/sd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e9689d5..7daa2aa 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3205,12 +3205,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;
 	}
 
-- 
2.0.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-11 12:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-03 21:34 [PATCH] sd: bad return code of init_sd Clément Calmels
2014-06-04 16:44 ` Ewan Milne
2014-06-11 12:10 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®