All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: sr: simplify the sr_open function
@ 2022-09-16  9:04 Enze Li
  0 siblings, 0 replies; 6+ messages in thread
From: Enze Li @ 2022-09-16  9:04 UTC (permalink / raw)
  To: jejb, martin.petersen; +Cc: lienze, linux-scsi, linux-kernel

Simplify the sr_open function by removing the goto label as it does only
return one error code.

Signed-off-by: Enze Li <lienze@kylinos.cn>
---
 drivers/scsi/sr.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index a278b739d0c5..ad1704e21609 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -587,20 +587,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)
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] scsi: sr: simplify the sr_open function
  2023-03-27  3:02 Enze Li
                   ` (2 preceding siblings ...)
  2023-04-03  1:37 ` Martin K. Petersen
@ 2023-04-12  2:04 ` Martin K. Petersen
  3 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2023-04-12  2:04 UTC (permalink / raw)
  To: jejb, Enze Li; +Cc: Martin K . Petersen, linux-scsi, enze.li

On Mon, 27 Mar 2023 11:02:37 +0800, Enze Li wrote:

> Simplify the sr_open function 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

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] scsi: sr: simplify the sr_open function
  2023-03-27  3:02 Enze Li
  2023-03-29 20:50 ` Bart Van Assche
  2023-03-30 14:46 ` Benjamin Block
@ 2023-04-03  1:37 ` Martin K. Petersen
  2023-04-12  2:04 ` Martin K. Petersen
  3 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2023-04-03  1:37 UTC (permalink / raw)
  To: Enze Li; +Cc: jejb, martin.petersen, linux-scsi, enze.li


Enze,

> Simplify the sr_open function by removing the goto label as it does only
> return one error code.

Applied to 6.4/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] scsi: sr: simplify the sr_open function
  2023-03-27  3:02 Enze Li
  2023-03-29 20:50 ` Bart Van Assche
@ 2023-03-30 14:46 ` Benjamin Block
  2023-04-03  1:37 ` Martin K. Petersen
  2023-04-12  2:04 ` Martin K. Petersen
  3 siblings, 0 replies; 6+ messages in thread
From: Benjamin Block @ 2023-03-30 14:46 UTC (permalink / raw)
  To: Enze Li; +Cc: jejb, martin.petersen, linux-scsi, enze.li

On Mon, Mar 27, 2023 at 11:02:37AM +0800, Enze Li wrote:
> Simplify the sr_open function by removing the goto label as it does only
> return one error code.
> 
> Signed-off-by: Enze Li <lienze@kylinos.cn>
> ---
>  drivers/scsi/sr.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 

Looks good to me.


Reviewed-by: Benjamin Block <bblock@linux.ibm.com>

-- 
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] scsi: sr: simplify the sr_open function
  2023-03-27  3:02 Enze Li
@ 2023-03-29 20:50 ` Bart Van Assche
  2023-03-30 14:46 ` Benjamin Block
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Bart Van Assche @ 2023-03-29 20:50 UTC (permalink / raw)
  To: Enze Li, jejb, martin.petersen; +Cc: linux-scsi, enze.li

On 3/26/23 20:02, Enze Li wrote:
> Simplify the sr_open function by removing the goto label as it does only
> return one error code.
> 
> Signed-off-by: Enze Li <lienze@kylinos.cn>
> ---
>   drivers/scsi/sr.c | 7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
> index 9e51dcd30bfd..12869e6d4ebd 100644
> --- a/drivers/scsi/sr.c
> +++ b/drivers/scsi/sr.c
> @@ -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;	
>   }

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] scsi: sr: simplify the sr_open function
@ 2023-03-27  3:02 Enze Li
  2023-03-29 20:50 ` Bart Van Assche
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Enze Li @ 2023-03-27  3:02 UTC (permalink / raw)
  To: jejb, martin.petersen; +Cc: linux-scsi, lienze, enze.li

Simplify the sr_open function by removing the goto label as it does only
return one error code.

Signed-off-by: Enze Li <lienze@kylinos.cn>
---
 drivers/scsi/sr.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 9e51dcd30bfd..12869e6d4ebd 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -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)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-12  2:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16  9:04 [PATCH] scsi: sr: simplify the sr_open function Enze Li
2023-03-27  3:02 Enze Li
2023-03-29 20:50 ` Bart Van Assche
2023-03-30 14:46 ` Benjamin Block
2023-04-03  1:37 ` Martin K. Petersen
2023-04-12  2:04 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.