Commit ca62009e authored by Enze Li's avatar Enze Li Committed by Martin K. Petersen

scsi: sr: Simplify the sr_open() function

Simplify the sr_open() by removing the goto label as the function only
returns one error code.
Signed-off-by: default avatarEnze Li <lienze@kylinos.cn>
Link: https://lore.kernel.org/r/20230327030237.3407253-1-lienze@kylinos.cnReviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Reviewed-by: default avatarBenjamin Block <bblock@linux.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent aa4d7812
...@@ -590,20 +590,15 @@ static int sr_open(struct cdrom_device_info *cdi, int purpose) ...@@ -590,20 +590,15 @@ static int sr_open(struct cdrom_device_info *cdi, int purpose)
{ {
struct scsi_cd *cd = cdi->handle; struct scsi_cd *cd = cdi->handle;
struct scsi_device *sdev = cd->device; struct scsi_device *sdev = cd->device;
int retval;
/* /*
* If the device is in error recovery, wait until it is done. * If the device is in error recovery, wait until it is done.
* If the device is offline, then disallow any access to it. * If the device is offline, then disallow any access to it.
*/ */
retval = -ENXIO;
if (!scsi_block_when_processing_errors(sdev)) if (!scsi_block_when_processing_errors(sdev))
goto error_out; return -ENXIO;
return 0; return 0;
error_out:
return retval;
} }
static void sr_release(struct cdrom_device_info *cdi) static void sr_release(struct cdrom_device_info *cdi)
......
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