Skip to content

Commit ca62009

Browse files
lienzemartinkpetersen
authored andcommitted
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: Enze Li <lienze@kylinos.cn> Link: https://lore.kernel.org/r/20230327030237.3407253-1-lienze@kylinos.cn Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Benjamin Block <bblock@linux.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent aa4d781 commit ca62009

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

drivers/scsi/sr.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -590,20 +590,15 @@ static int sr_open(struct cdrom_device_info *cdi, int purpose)
590590
{
591591
struct scsi_cd *cd = cdi->handle;
592592
struct scsi_device *sdev = cd->device;
593-
int retval;
594593

595594
/*
596595
* If the device is in error recovery, wait until it is done.
597596
* If the device is offline, then disallow any access to it.
598597
*/
599-
retval = -ENXIO;
600598
if (!scsi_block_when_processing_errors(sdev))
601-
goto error_out;
599+
return -ENXIO;
602600

603601
return 0;
604-
605-
error_out:
606-
return retval;
607602
}
608603

609604
static void sr_release(struct cdrom_device_info *cdi)

0 commit comments

Comments
 (0)