summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Lambert <lambert.quentin@gmail.com>2016-11-25 13:23:51 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2016-11-29 17:21:49 +0100
commitaa8c65a4fdc881b32c012c45f985617659aef1a9 (patch)
tree6ea31f7dbdb2895c905021827b2a8408753d231b
parentscsi: hpsa: add 'ctlr_num' sysfs attribute (diff)
downloadlinux-aa8c65a4fdc881b32c012c45f985617659aef1a9.tar.xz
linux-aa8c65a4fdc881b32c012c45f985617659aef1a9.zip
scsi: aic94xx: Add a missing call to kfree
Most error branches following the call to kzalloc contain a call to kfree. This patch add these calls where they are missing and set the relevant pointers to NULL. This issue was found with Hector. Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/aic94xx/aic94xx_hwi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c b/drivers/scsi/aic94xx/aic94xx_hwi.c
index 7c713f797535..f2671a8fa7e3 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);