2023-01-08 16:57:43

by Deepak R Varma

[permalink] [raw]
Subject: [PATCH v2] scsi: ipr: Convert ipr_probe_ioa_part2 as void

Convert function ipr_probe_ioa_part2() to return void instead
of int since the current implementation always returns 0 to the caller.
The transformation also eliminates the dead code when calling
ipr_probe_ioa_part2() function.
Issue identified using returnvar Coccinelle semantic patch.

Signed-off-by: Deepak R Varma <[email protected]>
---
Changes in v2:
- retain and update Return value comment in function documentation

drivers/scsi/ipr.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 2022ffb45041..dfb759fbbd87 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -9505,11 +9505,10 @@ static pci_ers_result_t ipr_pci_error_detected(struct pci_dev *pdev,
* This function takes care of initilizing the adapter to the point
* where it can accept new commands.
* Return value:
- * 0 on success / -EIO on failure
+ * none
**/
-static int ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
+static void ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
{
- int rc = 0;
unsigned long host_lock_flags = 0;

ENTER;
@@ -9525,7 +9524,6 @@ 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;
}

/**
@@ -10568,12 +10566,7 @@ static int ipr_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
return rc;

ioa_cfg = pci_get_drvdata(pdev);
- rc = ipr_probe_ioa_part2(ioa_cfg);
-
- if (rc) {
- __ipr_remove(pdev);
- return rc;
- }
+ ipr_probe_ioa_part2(ioa_cfg);

rc = scsi_add_host(ioa_cfg->host, &pdev->dev);

--
2.34.1




2023-01-22 19:13:22

by Deepak R Varma

[permalink] [raw]
Subject: Re: [PATCH v2] scsi: ipr: Convert ipr_probe_ioa_part2 as void

On Sun, Jan 08, 2023 at 09:58:51PM +0530, Deepak R Varma wrote:
> Convert function ipr_probe_ioa_part2() to return void instead
> of int since the current implementation always returns 0 to the caller.
> The transformation also eliminates the dead code when calling
> ipr_probe_ioa_part2() function.
> Issue identified using returnvar Coccinelle semantic patch.
>
> Signed-off-by: Deepak R Varma <[email protected]>
> ---
> Changes in v2:
> - retain and update Return value comment in function documentation

Hello,
May I request a review and feedback comments on this patch proposal please?

Thank you,
./drv

>
> drivers/scsi/ipr.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
> index 2022ffb45041..dfb759fbbd87 100644
> --- a/drivers/scsi/ipr.c
> +++ b/drivers/scsi/ipr.c
> @@ -9505,11 +9505,10 @@ static pci_ers_result_t ipr_pci_error_detected(struct pci_dev *pdev,
> * This function takes care of initilizing the adapter to the point
> * where it can accept new commands.
> * Return value:
> - * 0 on success / -EIO on failure
> + * none
> **/
> -static int ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
> +static void ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
> {
> - int rc = 0;
> unsigned long host_lock_flags = 0;
>
> ENTER;
> @@ -9525,7 +9524,6 @@ 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;
> }
>
> /**
> @@ -10568,12 +10566,7 @@ static int ipr_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
> return rc;
>
> ioa_cfg = pci_get_drvdata(pdev);
> - rc = ipr_probe_ioa_part2(ioa_cfg);
> -
> - if (rc) {
> - __ipr_remove(pdev);
> - return rc;
> - }
> + ipr_probe_ioa_part2(ioa_cfg);
>
> rc = scsi_add_host(ioa_cfg->host, &pdev->dev);
>
> --
> 2.34.1
>
>
>



2023-02-21 19:41:10

by Brian King

[permalink] [raw]
Subject: Re: [PATCH v2] scsi: ipr: Convert ipr_probe_ioa_part2 as void

On 1/8/23 10:28 AM, Deepak R Varma wrote:
> Convert function ipr_probe_ioa_part2() to return void instead
> of int since the current implementation always returns 0 to the caller.
> The transformation also eliminates the dead code when calling
> ipr_probe_ioa_part2() function.
> Issue identified using returnvar Coccinelle semantic patch.
>
> Signed-off-by: Deepak R Varma <[email protected]>
> ---
> Changes in v2:
> - retain and update Return value comment in function documentation
>
> drivers/scsi/ipr.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
> index 2022ffb45041..dfb759fbbd87 100644
> --- a/drivers/scsi/ipr.c
> +++ b/drivers/scsi/ipr.c
> @@ -9505,11 +9505,10 @@ static pci_ers_result_t ipr_pci_error_detected(struct pci_dev *pdev,
> * This function takes care of initilizing the adapter to the point
> * where it can accept new commands.
> * Return value:
> - * 0 on success / -EIO on failure
> + * none
> **/
> -static int ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
> +static void ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
> {
> - int rc = 0;
> unsigned long host_lock_flags = 0;
>
> ENTER;
> @@ -9525,7 +9524,6 @@ 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;
> }
>
> /**
> @@ -10568,12 +10566,7 @@ static int ipr_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
> return rc;
>
> ioa_cfg = pci_get_drvdata(pdev);
> - rc = ipr_probe_ioa_part2(ioa_cfg);
> -
> - if (rc) {
> - __ipr_remove(pdev);
> - return rc;
> - }
> + ipr_probe_ioa_part2(ioa_cfg);
>
> rc = scsi_add_host(ioa_cfg->host, &pdev->dev);
>
> --
> 2.34.1

Acked-by: Brian King <[email protected]>

--
Brian King
Power Linux I/O
IBM Linux Technology Center