]> git.baikalelectronics.ru Git - kernel.git/commit
habanalabs: fix reset process in case of failures
authorOded Gabbay <ogabbay@kernel.org>
Mon, 11 Jan 2021 13:00:38 +0000 (15:00 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Tue, 12 Jan 2021 12:59:52 +0000 (14:59 +0200)
commitef94667bacd67b3e580f23ba0e4c69bb51e1fe97
tree592984f950d9ffe10b1466a9ddc4d24a4ac24fd4
parent0aa1d5bafc3318d64553d3b5b05d8c692a88c41c
habanalabs: fix reset process in case of failures

There are some points in the reset process where if the code fails
for some reason, and the system admin tries to initiate the reset
process again we will get a kernel panic.

This is because there aren't any protections in different fini
functions that are called during the reset process.

The protections that are added in this patch make sure that if the fini
functions are called multiple times, without calling init functions
between them, there won't be double release of already released
resources.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/device.c
drivers/misc/habanalabs/common/mmu_v1.c