scsi: hisi_sas: fix free'ing in probe and remove
authorXiaofei Tan <tanxiaofei@huawei.com>
Tue, 29 Nov 2016 15:45:57 +0000 (23:45 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 5 Dec 2016 21:54:12 +0000 (16:54 -0500)
commitd37a0082919360dda828679cccb5c4e8e83ec199
tree62b1eb4c4ea94fa522d7e25c44068e780930b3ce
parente3cb0e47b9233a42f8c5865ad748666b6bbbc12f
scsi: hisi_sas: fix free'ing in probe and remove

This patch addresses 4 problems in the module probe/remove:

 - When hisi_sas_shost_alloc() fails after we alloc shost memory, we
   should free shost memory before the function returns.

 - When hisi_sas_probe() fails after we alloc the HBA memories, we
   should also free the HBA memories.

 - We should free shost memory at the end of hisi_sas_remove().

 - sha->core.shost is set twice, so remove extra set.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas_main.c