linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/scsi/aic94xx/aic94xx_hwi.c: add missing kfree
@ 2012-04-29 20:03 Julia Lawall
  0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2012-04-29 20:03 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: kernel-janitors, linux-scsi, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

The free is not strictly necessary, because as long as the tc_index_array
field is not NULL, the free will performed by the calling context, in the
function asd_destroy_ha_caches.  But doing it here in this case, makes this
case consistent with the rest of the function.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
Alternatively, the frees could be dropped from the subsequent block of
error-handling code.

 drivers/scsi/aic94xx/aic94xx_hwi.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c b/drivers/scsi/aic94xx/aic94xx_hwi.c
index 81b736c..f7c093c 100644
--- a/drivers/scsi/aic94xx/aic94xx_hwi.c
+++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
@@ -228,8 +228,11 @@ static int asd_init_scbs(struct asd_ha_struct *asd_ha)
 	bitmap_bytes = (asd_ha->seq.tc_index_bitmap_bits+7)/8;
 	bitmap_bytes = BITS_TO_LONGS(bitmap_bytes*8)*sizeof(unsigned long);
 	asd_ha->seq.tc_index_bitmap = kzalloc(bitmap_bytes, GFP_KERNEL);
-	if (!asd_ha->seq.tc_index_bitmap)
+	if (!asd_ha->seq.tc_index_bitmap) {
+		kfree(asd_ha->seq.tc_index_array);
+		asd_ha->seq.tc_index_array = NULL;
 		return -ENOMEM;
+	}
 
 	spin_lock_init(&seq->tc_index_lock);
 


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-04-29 20:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-29 20:03 [PATCH] drivers/scsi/aic94xx/aic94xx_hwi.c: add missing kfree Julia Lawall

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