LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH -next] scsi: lpfc: Remove unnecessary null check before kfree
@ 2019-07-11 14:10 YueHaibing
  2019-07-15 14:51 ` James Smart
  2019-07-17  2:46 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: YueHaibing @ 2019-07-11 14:10 UTC (permalink / raw)
  To: james.smart, dick.kennedy, jejb, martin.petersen
  Cc: linux-kernel, linux-scsi, YueHaibing

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(-)

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;
 }
-- 
2.7.4



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

* Re: [PATCH -next] scsi: lpfc: Remove unnecessary null check before kfree
  2019-07-11 14:10 [PATCH -next] scsi: lpfc: Remove unnecessary null check before kfree YueHaibing
@ 2019-07-15 14:51 ` James Smart
  2019-07-17  2:46 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: James Smart @ 2019-07-15 14:51 UTC (permalink / raw)
  To: YueHaibing, dick.kennedy, jejb, martin.petersen; +Cc: linux-kernel, linux-scsi



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

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

* Re: [PATCH -next] scsi: lpfc: Remove unnecessary null check before kfree
  2019-07-11 14:10 [PATCH -next] scsi: lpfc: Remove unnecessary null check before kfree YueHaibing
  2019-07-15 14:51 ` James Smart
@ 2019-07-17  2:46 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-07-17  2:46 UTC (permalink / raw)
  To: YueHaibing
  Cc: james.smart, dick.kennedy, jejb, martin.petersen, linux-kernel,
	linux-scsi


YueHaibing,

> A null check before a kfree is redundant, so remove it.
> This is detected by coccinelle.

Applied to 5.4/scsi-queue. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2019-07-17  2:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-11 14:10 [PATCH -next] scsi: lpfc: Remove unnecessary null check before kfree YueHaibing
2019-07-15 14:51 ` James Smart
2019-07-17  2:46 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).