Commit aa8c65a4 authored by Quentin Lambert's avatar Quentin Lambert Committed by Martin K. Petersen

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: default avatarQuentin Lambert <lambert.quentin@gmail.com>
Reviewed-by: default avatarTomas Henzl <thenzl@redhat.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 16961204
...@@ -228,8 +228,11 @@ static int asd_init_scbs(struct asd_ha_struct *asd_ha) ...@@ -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 = (asd_ha->seq.tc_index_bitmap_bits+7)/8;
bitmap_bytes = BITS_TO_LONGS(bitmap_bytes*8)*sizeof(unsigned long); bitmap_bytes = BITS_TO_LONGS(bitmap_bytes*8)*sizeof(unsigned long);
asd_ha->seq.tc_index_bitmap = kzalloc(bitmap_bytes, GFP_KERNEL); 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; return -ENOMEM;
}
spin_lock_init(&seq->tc_index_lock); spin_lock_init(&seq->tc_index_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment