scsi: sr: simplify the sr_open function
PATCH 1/1 scsi: sr: simplify the sr_open function
Simplify the sr_open function by removing the goto label as it does only return one error code.
--- drivers/scsi/sr.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/scsi/sr.c +1 -6
@@ -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)
Signature · 1 line
2.39.2
Quoted 22 lines · Enze Li
Simplify the
sr_openfunction by removing the goto label as it does only return one error code.Signed-off-by Enze Li <[email protected]>--- drivers/scsi/sr.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)drivers/scsi/sr.c +0
-1@@ -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. */
drivers/scsi/sr.c static int sr_open(struct cdrom_device_info *cdi, int purpose) · line 602
Quoted 10 lines
drivers/scsi/sr.c +1
-5- retval = -ENXIO ;if (!scsi_block_when_processing_errors (sdev)) - goto error_out; +return -ENXIO ;return 0 ; - -error_out: -return retval; }
Quoted 8 lines · Enze Li
Simplify the
sr_openfunction by removing the goto label as it does only return one error code.Signed-off-by Enze Li <[email protected]>--- drivers/scsi/sr.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
Looks good to me.
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Martin K. Petersen
AppliedEnze,
Quoted 2 lines
Simplify the
sr_openfunction by removing the goto label as it does only return one error code.
Applied to 6.4/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 4 lines · Enze Li
Simplify the
sr_openfunction by removing the goto label as it does only return one error code.
Applied to 6.4/scsi-queue, thanks!
[1/1] scsi: sr: simplify the sr_open function
https://git.kernel.org/mkp/scsi/c/ca62009eff72
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering