video: rockchip: mpp: put node for attach mpp service

relative function:
of_parse_phandle ==> of_node_put
of_find_device_by_node ==> platform_device_put

Change-Id: I06ef97baa675efff79b2bc653fabda54e3f707df
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
This commit is contained in:
Ding Wei
2020-04-30 11:09:21 +08:00
parent ea9afa6584
commit 06973883c2
2 changed files with 13 additions and 7 deletions

View File

@@ -602,17 +602,19 @@ static int mpp_attach_service(struct mpp_dev *mpp, struct device *dev)
}
pdev = of_find_device_by_node(np);
of_node_put(np);
if (!pdev) {
dev_err(dev, "failed to get mpp service from node\n");
ret = -ENODEV;
goto fail;
goto err_put_pdev;
}
mpp->pdev_srv = pdev;
mpp->srv = platform_get_drvdata(pdev);
if (!mpp->srv) {
dev_err(&pdev->dev, "failed attach service\n");
ret = -EINVAL;
goto fail;
goto err_put_pdev;
}
of_property_read_u32(dev->of_node,
@@ -621,7 +623,7 @@ static int mpp_attach_service(struct mpp_dev *mpp, struct device *dev)
dev_err(dev, "rockchip,taskqueue-node %d must less than %d\n",
taskqueue_node, mpp->srv->taskqueue_cnt);
ret = -ENODEV;
goto fail;
goto err_put_pdev;
}
of_property_read_u32(dev->of_node,
@@ -630,7 +632,7 @@ static int mpp_attach_service(struct mpp_dev *mpp, struct device *dev)
dev_err(dev, "rockchip,resetgroup-node %d must less than %d\n",
reset_group_node, mpp->srv->reset_group_cnt);
ret = -ENODEV;
goto fail;
goto err_put_pdev;
}
device_lock(&pdev->dev);
@@ -642,10 +644,12 @@ static int mpp_attach_service(struct mpp_dev *mpp, struct device *dev)
mpp->reset_group = mpp->srv->reset_groups[reset_group_node];
mpp->srv->hw_support |= BIT(mpp->var->device_type);
device_unlock(&pdev->dev);
put_device(&pdev->dev);
fail:
of_node_put(np);
return 0;
err_put_pdev:
platform_device_put(pdev);
return ret;
}
@@ -1523,6 +1527,7 @@ int mpp_dev_remove(struct mpp_dev *mpp)
mpp->hw_ops->exit(mpp);
mpp_iommu_remove(mpp->iommu_info);
platform_device_put(mpp->pdev_srv);
if (mpp->workq) {
destroy_workqueue(mpp->workq);

View File

@@ -200,6 +200,7 @@ struct mpp_dev {
struct mpp_taskqueue *queue;
struct mpp_reset_group *reset_group;
/* point to MPP Service */
struct platform_device *pdev_srv;
struct mpp_service *srv;
};