scsi: sd: set valid return value in failed path
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().
Signed-off-by Guo Chao <[email protected]>
--- drivers/scsi/sd.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/sd.c +1 -0
@@ -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
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.
Signed-off-by Guo Chao <[email protected]>
--- drivers/scsi/sd.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/sd.c +0 -1
@@ -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
PATCH RESEND 3/3 scsi: sd: remove unnecessary initialization in sd_probe()
In reply to Guo ChaoWe use kzalloc() to allocate scsi_disk, no need to reset ->openers.
Signed-off-by Guo Chao <[email protected]>
--- drivers/scsi/sd.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/sd.c +0 -1
@@ -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