Re: [PATCH v1] lpfc 8.3.37: Remove redundant NULL check before kfree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Syam,

Thank you for the patch - it is valid.

However, I prefer not to merge this. I would rather force the coder to think about the pointer value explicitly rather than depending on the convenience/one line optimization. We've had errors in the past covered up by this gracious behavior. Additionally, we have coders that work on linux and vmware, and the semantics of the kfree() routine differ. For now, I'd prefer to stay as is and force good habits.

-- james s


On 3/6/2013 3:12 PM, syamsidhardh@xxxxxxxxx wrote:
From: Syam Sidhardhan <s.syam@xxxxxxxxxxx>

kfree on NULL pointer is a no-op.

Signed-off-by: Syam Sidhardhan <s.syam@xxxxxxxxxxx>
---
v1-> Corrected the from address.

  drivers/scsi/lpfc/lpfc_bsg.c |    3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 32d5683..2166097 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -1129,8 +1129,7 @@ lpfc_bsg_hba_set_event(struct fc_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;

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux