Skip to content

Commit

Permalink
scsi: sr: Simplify the sr_open() function
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Enze Li authored and Martin K. Petersen committed Apr 3, 2023
1 parent aa4d781 commit ca62009
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/scsi/sr.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,20 +590,15 @@ static int sr_open(struct cdrom_device_info *cdi, int purpose)
{
struct scsi_cd *cd = cdi->handle;
struct scsi_device *sdev = cd->device;
int retval;

/*
* If the device is in error recovery, wait until it is done.
* If the device is offline, then disallow any access to it.
*/
retval = -ENXIO;
if (!scsi_block_when_processing_errors(sdev))
goto error_out;
return -ENXIO;

return 0;

error_out:
return retval;
}

static void sr_release(struct cdrom_device_info *cdi)
Expand Down

0 comments on commit ca62009

Please sign in to comment.