Message ID | 20190711141037.57880-1-yuehaibing@huawei.com (mailing list archive) |
---|---|
State | Mainlined |
Commit | 70a51d8c53176080e82b2aef050f820ccdd4b3f8 |
Headers | show |
Series | [-next] scsi: lpfc: Remove unnecessary null check before kfree | expand |
On 7/11/2019 7:10 AM, YueHaibing wrote: > A null check before a kfree is redundant, so remove it. > This is detected by coccinelle. > > Signed-off-by: YueHaibing <yuehaibing@huawei.com> > --- > drivers/scsi/lpfc/lpfc_bsg.c | 4 +--- > Reviewed-by: James Smart <james.smart@broadcom.com> -- james
YueHaibing, > A null check before a kfree is redundant, so remove it. > This is detected by coccinelle. Applied to 5.4/scsi-queue. Thanks!
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c index b7216d6..c7f6623 100644 --- a/drivers/scsi/lpfc/lpfc_bsg.c +++ b/drivers/scsi/lpfc/lpfc_bsg.c @@ -1276,9 +1276,7 @@ lpfc_bsg_hba_set_event(struct bsg_job *job) return 0; /* call job done later */ job_error: - if (dd_data != NULL) - kfree(dd_data); - + kfree(dd_data); job->dd_data = NULL; return rc; }
A null check before a kfree is redundant, so remove it. This is detected by coccinelle. Signed-off-by: YueHaibing <yuehaibing@huawei.com> --- drivers/scsi/lpfc/lpfc_bsg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)