Skip to contentSkip to conversation

scsi: sd: set valid return value in failed path

PATCH RESEND New Guo Chao 1 participant 3 messages Jan 15, 2013 SCSI

lore
Share & tools
lore

Guo Chao

author
#0 lore raw

PATCH RESEND 1/3 scsi: sd: set valid return value in failed path

Set valid return value to avoid returning 0 in a
failed path of sd_init().

---
 drivers/scsi/sd.c |    1 +
 1 file changed, 1 insertion(+)
drivers/scsi/sd.c +1 -0
index 7992635..181cd87 100644
@@ -3126,6 +3126,7 @@ static int __init init_sd(void)
 	if (err)
 		goto err_out;
 
+	err = -ENOMEM;
 	sd_cdb_cache = kmem_cache_create("sd_ext_cdb", SD_EXT_CDB_SIZE,
 					 0, 0, NULL);
 	if (!sd_cdb_cache) {
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH RESEND 2/3 scsi: sd: no need to set gendisk->minors in sd_probe_async()

We already call alloc_disk() with SD_MINORS and ->minors will be always set there.

---
 drivers/scsi/sd.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/sd.c +0 -1
index 181cd87..9fd67be 100644
@@ -2801,7 +2801,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;
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH RESEND 3/3 scsi: sd: remove unnecessary initialization in sd_probe()

In reply to Guo Chao

We use kzalloc() to allocate scsi_disk, no need to reset ->openers.

---
 drivers/scsi/sd.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/sd.c +0 -1
index 9fd67be..4f4bc7e 100644
@@ -2907,7 +2907,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) {
Signature · 1 line
1.7.9.5