Skip to contentSkip to conversation

scsi: lpfc: remove unnnecessary NULL check

PATCH Applied Dan Carpenter 3 participants 4 messages Aug 13 – Aug 26

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: lpfc: remove unnnecessary NULL check

The "evt_dat" variale is non-NULL at this point so there is no need to check. Delete the check and pull the code in a tab.

---
 drivers/scsi/lpfc/lpfc_bsg.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_bsg.c +2 -4
index c95165905483..7354ae9ba8e5 100644
@@ -1329,10 +1329,8 @@ lpfc_bsg_hba_get_event(struct bsg_job *job)
 	else
 		bsg_reply->reply_payload_rcv_len = 0;
 
-	if (evt_dat) {
-		kfree(evt_dat->data);
-		kfree(evt_dat);
-	}
+	kfree(evt_dat->data);
+	kfree(evt_dat);
 
 	spin_lock_irqsave(&phba->ct_ev_lock, flags);
 	lpfc_bsg_event_unref(evt);
Signature · 1 line
2.53.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Dan Carpenter

The "evt_dat" variale is non-NULL at this point so there is no need to check. Delete the check and pull the code in a tab.

---
 drivers/scsi/lpfc/lpfc_bsg.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_bsg.c +2 -5
index c95165905483..7354ae9ba8e5 100644
@@ -1329,10 +1329,8 @@ lpfc_bsg_hba_get_event(struct bsg_job *job)
        else
                bsg_reply->reply_payload_rcv_len = 0;
 
-       if (evt_dat) {
-               kfree(evt_dat->data);
-               kfree(evt_dat);
-       }
+       kfree(evt_dat->data);
+       kfree(evt_dat);
 
        spin_lock_irqsave(&phba->ct_ev_lock, flags);
        lpfc_bsg_event_unref(evt);
--
Quoted 2 lines

2.53.0

Yes, evt_data was already checked for NULL and the follow up check has no value. Looks good.

maintainer Applied
#2 lore raw
In reply to Dan Carpenter

Dan,

Quoted 2 lines

The "evt_dat" variale is non-NULL at this point so there is no need to check. Delete the check and pull the code in a tab.

Applied to 7.3/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen