[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200903100142.57117-1-alex.dewar90@gmail.com>
Date: Thu, 3 Sep 2020 11:01:42 +0100
From: Alex Dewar <alex.dewar90@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Alex Dewar <alex.dewar90@...il.com>,
Ohad Ben-Cohen <ohad@...ery.com>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Loic Pallardy <loic.pallardy@...com>,
linux-remoteproc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] remoteproc: core: Free rvdev on error path
In rpoc_handle_vdev(), rvdev is not freed properly on the error path and
one of the labels is misnamed. Fix this up.
Fixes: 086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool")
Signed-off-by: Alex Dewar <alex.dewar90@...il.com>
---
drivers/remoteproc/remoteproc_core.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index d4bd71f87b03..84dea43d196e 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -531,7 +531,7 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc,
rvdev->dev.parent = &rproc->dev;
ret = dma_copy_dma_range_map(&rvdev->dev, rproc->dev.parent);
if (ret)
- return ret;
+ goto free_rvdev;
rvdev->dev.release = rproc_rvdev_release;
dev_set_name(&rvdev->dev, "%s#%s", dev_name(rvdev->dev.parent), name);
dev_set_drvdata(&rvdev->dev, rvdev);
@@ -539,7 +539,7 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc,
ret = device_register(&rvdev->dev);
if (ret) {
put_device(&rvdev->dev);
- return ret;
+ goto free_rvdev;
}
/* Make device dma capable by inheriting from parent's capabilities */
set_dma_ops(&rvdev->dev, get_dma_ops(rproc->dev.parent));
@@ -556,7 +556,7 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc,
for (i = 0; i < rsc->num_of_vrings; i++) {
ret = rproc_parse_vring(rvdev, rsc, i);
if (ret)
- goto free_rvdev;
+ goto unregister_dev;
}
/* remember the resource offset*/
@@ -581,8 +581,10 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc,
unwind_vring_allocations:
for (i--; i >= 0; i--)
rproc_free_vring(&rvdev->vring[i]);
-free_rvdev:
+unregister_dev:
device_unregister(&rvdev->dev);
+free_rvdev:
+ kfree(rvdev);
return ret;
}
--
2.28.0
Powered by blists - more mailing lists