diff mbox series

[next] scsi: lpfc: remove dead code on second !ndlp check

Message ID 20201118133744.461385-1-colin.king@canonical.com
State New
Headers show
Series [next] scsi: lpfc: remove dead code on second !ndlp check | expand

Commit Message

Colin King Nov. 18, 2020, 1:37 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Currently there is a null check on the pointer ndlp that exits via
error path issue_ct_rsp_exit followed by another null check on the
same pointer that is almost identical to the previous null check
stanza and yet can never can be reached because the previous check
exited via issue_ct_rsp_exit. This is deadcode and can be removed.

Addresses-Coverity: ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/lpfc/lpfc_bsg.c | 6 ------
 1 file changed, 6 deletions(-)

Comments

James Smart Nov. 19, 2020, 8:57 p.m. UTC | #1
On 11/18/2020 5:37 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently there is a null check on the pointer ndlp that exits via
> error path issue_ct_rsp_exit followed by another null check on the
> same pointer that is almost identical to the previous null check
> stanza and yet can never can be reached because the previous check
> exited via issue_ct_rsp_exit. This is deadcode and can be removed.
>
> Addresses-Coverity: ("Logically dead code")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/scsi/lpfc/lpfc_bsg.c | 6 ------
>   1 file changed, 6 deletions(-)
>
> diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
> index 35f4998504c1..41e3657c2d8d 100644
> --- a/drivers/scsi/lpfc/lpfc_bsg.c
> +++ b/drivers/scsi/lpfc/lpfc_bsg.c
> @@ -1526,12 +1526,6 @@ lpfc_issue_ct_rsp(struct lpfc_hba *phba, struct bsg_job *job, uint32_t tag,
>   			goto issue_ct_rsp_exit;
>   		}
>   
> -		/* Check if the ndlp is active */
> -		if (!ndlp) {
> -			rc = IOCB_ERROR;
> -			goto issue_ct_rsp_exit;
> -		}
> -
>   		/* get a refernece count so the ndlp doesn't go away while
>   		 * we respond
>   		 */
Looks good.

Reviewed-by: James Smart <james.smart@broadcom.com>

-- james
Martin K. Petersen Nov. 20, 2020, 3:17 a.m. UTC | #2
Colin,

> Currently there is a null check on the pointer ndlp that exits via

> error path issue_ct_rsp_exit followed by another null check on the

> same pointer that is almost identical to the previous null check

> stanza and yet can never can be reached because the previous check

> exited via issue_ct_rsp_exit. This is deadcode and can be removed.


Applied to 5.11/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering
Martin K. Petersen Nov. 24, 2020, 3:58 a.m. UTC | #3
On Wed, 18 Nov 2020 13:37:44 +0000, Colin King wrote:

> Currently there is a null check on the pointer ndlp that exits via

> error path issue_ct_rsp_exit followed by another null check on the

> same pointer that is almost identical to the previous null check

> stanza and yet can never can be reached because the previous check

> exited via issue_ct_rsp_exit. This is deadcode and can be removed.


Applied to 5.11/scsi-queue, thanks!

[1/1] scsi: lpfc: Remove dead code on second !ndlp check
      https://git.kernel.org/mkp/scsi/c/61795a5316ad

-- 
Martin K. Petersen	Oracle Linux Engineering
diff mbox series

Patch

diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 35f4998504c1..41e3657c2d8d 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -1526,12 +1526,6 @@  lpfc_issue_ct_rsp(struct lpfc_hba *phba, struct bsg_job *job, uint32_t tag,
 			goto issue_ct_rsp_exit;
 		}
 
-		/* Check if the ndlp is active */
-		if (!ndlp) {
-			rc = IOCB_ERROR;
-			goto issue_ct_rsp_exit;
-		}
-
 		/* get a refernece count so the ndlp doesn't go away while
 		 * we respond
 		 */