habanalabs: Fix memleak in hl_device_reset
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Sat, 26 Dec 2020 07:27:14 +0000 (15:27 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Jan 2021 17:27:25 +0000 (18:27 +0100)
commit8c3520e21f6b048901534463233d7aa73900a112
tree5461914cd7ee1d373881779e823485ab6c991cc3
parent78755373aa48eb50367bcb674f99fdb79e236bff
habanalabs: Fix memleak in hl_device_reset

[ Upstream commit b000700d6db50c933ce8b661154e26cf4ad06dba ]

When kzalloc() fails, we should execute hl_mmu_fini()
to release the MMU module. It's the same when
hl_ctx_init() fails.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/misc/habanalabs/common/device.c