remoteproc: fix vdev reference management

Commit 2b45cef586 ("remoteproc: Further extend the vdev life cycle")
extends kref support for vdev management.
It introduces a regression when following sequence is executed:
rproc_boot --> rproc_shutdown --> rproc_boot
Second rproc_boot call crashes on register_virtio_device as device
is already existing.
Issue is previous vdev is never released when rproc is stop because
associated refcount is too high.

kref_get introduces is not needed as kref_init already initializes
krefcount to 1 because it considers associated variable as used.
This introduces a misalignment between kref_get and kref_put calls.

Fixes: 2b45cef586 ("remoteproc: Further extend the vdev life cycle")
Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Loic Pallardy 2016-12-14 16:11:00 +01:00 committed by Bjorn Andersson
parent 7ce7d89f48
commit c81c0e0710
1 changed files with 0 additions and 3 deletions

View File

@ -396,9 +396,6 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc,
goto unwind_vring_allocations; goto unwind_vring_allocations;
} }
/* track the rvdevs list reference */
kref_get(&rvdev->refcount);
list_add_tail(&rvdev->node, &rproc->rvdevs); list_add_tail(&rvdev->node, &rproc->rvdevs);
rproc_add_subdev(rproc, &rvdev->subdev, rproc_add_subdev(rproc, &rvdev->subdev,