mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: ipr: Remove unneeded return variable
@ 2021-02-04  7:26 Yang Li
  2021-02-04  9:33 ` Johannes Thumshirn
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2021-02-04  7:26 UTC (permalink / raw)
  To: martin.petersen; +Cc: jejb, brking, linux-scsi, linux-kernel, Yang Li

This patch removes unneeded return variables, using only
'0' instead.
It fixes the following warning detected by coccinelle:
./drivers/scsi/ipr.c:9508:5-7: Unneeded variable: "rc". Return "0" on
line 9524

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/scsi/ipr.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index e451102..8eced7c 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -9505,7 +9505,6 @@ static pci_ers_result_t ipr_pci_error_detected(struct pci_dev *pdev,
  **/
 static int ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
 {
-	int rc = 0;
 	unsigned long host_lock_flags = 0;
 
 	ENTER;
@@ -9521,7 +9520,7 @@ static int ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
 	spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags);
 
 	LEAVE;
-	return rc;
+	return 0;
 }
 
 /**
-- 
1.8.3.1


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

* Re: [PATCH] scsi: ipr: Remove unneeded return variable
  2021-02-04  7:26 [PATCH] scsi: ipr: Remove unneeded return variable Yang Li
@ 2021-02-04  9:33 ` Johannes Thumshirn
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Thumshirn @ 2021-02-04  9:33 UTC (permalink / raw)
  To: Yang Li, martin.petersen; +Cc: jejb, brking, linux-scsi, linux-kernel

On 04/02/2021 08:28, Yang Li wrote:
> This patch removes unneeded return variables, using only
> '0' instead.
> It fixes the following warning detected by coccinelle:
> ./drivers/scsi/ipr.c:9508:5-7: Unneeded variable: "rc". Return "0" on
> line 9524
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  drivers/scsi/ipr.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
> index e451102..8eced7c 100644
> --- a/drivers/scsi/ipr.c
> +++ b/drivers/scsi/ipr.c
> @@ -9505,7 +9505,6 @@ static pci_ers_result_t ipr_pci_error_detected(struct pci_dev *pdev,
>   **/
>  static int ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
>  {
> -	int rc = 0;
>  	unsigned long host_lock_flags = 0;
>  
>  	ENTER;
> @@ -9521,7 +9520,7 @@ static int ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
>  	spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags);
>  
>  	LEAVE;
> -	return rc;
> +	return 0;
>  }
>  
>  /**
> 

As it's always returning 0 this is dead code as well:

	rc = ipr_probe_ioa_part2(ioa_cfg);

	if (rc) {
		__ipr_remove(pdev);
		return rc;
	}

I think:
- static int ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
+ static void ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)

is the right thing to do if you really want to touch it.




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

end of thread, other threads:[~2021-02-04  9:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04  7:26 [PATCH] scsi: ipr: Remove unneeded return variable Yang Li
2021-02-04  9:33 ` Johannes Thumshirn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome