Commit c02465fa authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

scsi: osd_uld: Check scsi_device_get() return value

scsi_device_get() can fail. Hence check its return value.
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Acked-by: default avatarBoaz Harrosh <ooo@electrozaur.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 8690218a
...@@ -464,14 +464,15 @@ static int osd_probe(struct device *dev) ...@@ -464,14 +464,15 @@ static int osd_probe(struct device *dev)
/* hold one more reference to the scsi_device that will get released /* hold one more reference to the scsi_device that will get released
* in __release, in case a logout is happening while fs is mounted * in __release, in case a logout is happening while fs is mounted
*/ */
scsi_device_get(scsi_device); if (scsi_device_get(scsi_device))
goto err_put_disk;
osd_dev_init(&oud->od, scsi_device); osd_dev_init(&oud->od, scsi_device);
/* Detect the OSD Version */ /* Detect the OSD Version */
error = __detect_osd(oud); error = __detect_osd(oud);
if (error) { if (error) {
OSD_ERR("osd detection failed, non-compatible OSD device\n"); OSD_ERR("osd detection failed, non-compatible OSD device\n");
goto err_put_disk; goto err_put_sdev;
} }
/* init the char-device for communication with user-mode */ /* init the char-device for communication with user-mode */
...@@ -508,8 +509,9 @@ static int osd_probe(struct device *dev) ...@@ -508,8 +509,9 @@ static int osd_probe(struct device *dev)
err_put_cdev: err_put_cdev:
cdev_del(&oud->cdev); cdev_del(&oud->cdev);
err_put_disk: err_put_sdev:
scsi_device_put(scsi_device); scsi_device_put(scsi_device);
err_put_disk:
put_disk(disk); put_disk(disk);
err_free_osd: err_free_osd:
dev_set_drvdata(dev, NULL); dev_set_drvdata(dev, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment