* [PATCH 1/3] scsi: sd: set valid return value in init_sd()
@ 2012-11-23 3:06 Guo Chao
2012-11-23 3:06 ` [PATCH 2/3] scsi: sd: no need to set gendisk->minors in sd_probe_async() Guo Chao
2012-11-23 3:06 ` [PATCH 3/3] scsi: sd: remove unnecessary initialization in sd_probe() Guo Chao
0 siblings, 2 replies; 3+ messages in thread
From: Guo Chao @ 2012-11-23 3:06 UTC (permalink / raw)
To: JBottomley; +Cc: linux-scsi
init_sd() forgets to set error code when we fail to create slab
cache, thus return 0 in a failed path. Return ENOMEM in this case.
Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
---
drivers/scsi/sd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 352bc77..4cc277d 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3120,6 +3120,7 @@ static int __init init_sd(void)
if (err)
goto err_out_class;
+ err = -ENOMEM;
sd_cdb_cache = kmem_cache_create("sd_ext_cdb", SD_EXT_CDB_SIZE,
0, 0, NULL);
if (!sd_cdb_cache) {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/3] scsi: sd: no need to set gendisk->minors in sd_probe_async()
2012-11-23 3:06 [PATCH 1/3] scsi: sd: set valid return value in init_sd() Guo Chao
@ 2012-11-23 3:06 ` Guo Chao
2012-11-23 3:06 ` [PATCH 3/3] scsi: sd: remove unnecessary initialization in sd_probe() Guo Chao
1 sibling, 0 replies; 3+ messages in thread
From: Guo Chao @ 2012-11-23 3:06 UTC (permalink / raw)
To: JBottomley; +Cc: linux-scsi
We already call alloc_disk() with SD_MINORS and ->minors will
be always set there.
Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
---
drivers/scsi/sd.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 4cc277d..e934ffc 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2791,7 +2791,6 @@ static void sd_probe_async(void *data, async_cookie_t cookie)
gd->major = sd_major((index & 0xf0) >> 4);
gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
- gd->minors = SD_MINORS;
gd->fops = &sd_fops;
gd->private_data = &sdkp->driver;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] scsi: sd: remove unnecessary initialization in sd_probe()
2012-11-23 3:06 [PATCH 1/3] scsi: sd: set valid return value in init_sd() Guo Chao
2012-11-23 3:06 ` [PATCH 2/3] scsi: sd: no need to set gendisk->minors in sd_probe_async() Guo Chao
@ 2012-11-23 3:06 ` Guo Chao
1 sibling, 0 replies; 3+ messages in thread
From: Guo Chao @ 2012-11-23 3:06 UTC (permalink / raw)
To: JBottomley; +Cc: linux-scsi
We use kzalloc() to allocate scsi_disk, no need to reset ->openers.
Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
---
drivers/scsi/sd.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e934ffc..d3b66a2 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2897,7 +2897,6 @@ static int sd_probe(struct device *dev)
sdkp->driver = &sd_template;
sdkp->disk = gd;
sdkp->index = index;
- atomic_set(&sdkp->openers, 0);
atomic_set(&sdkp->device->ioerr_cnt, 0);
if (!sdp->request_queue->rq_timeout) {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-23 3:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-23 3:06 [PATCH 1/3] scsi: sd: set valid return value in init_sd() Guo Chao
2012-11-23 3:06 ` [PATCH 2/3] scsi: sd: no need to set gendisk->minors in sd_probe_async() Guo Chao
2012-11-23 3:06 ` [PATCH 3/3] scsi: sd: remove unnecessary initialization in sd_probe() Guo Chao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).