diff mbox

[RFC,3/6] of: iommu: Increment DT node refcount in of_iommu_set_ops()

Message ID 1453872079-27140-4-git-send-email-anup.patel@broadcom.com (mailing list archive)
State New, archived
Headers show

Commit Message

Anup Patel Jan. 27, 2016, 5:21 a.m. UTC
We are saving pointer to iommu DT node in of_iommu_set_ops()
hence we should increment DT node ref count.

Signed-off-by: Anup Patel <anup.patel@broadcom.com>
Reviewed-by: Ray Jui <rjui@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
---
 drivers/iommu/of_iommu.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Robin Murphy Jan. 28, 2016, 5:15 p.m. UTC | #1
On 27/01/16 05:21, Anup Patel wrote:
> We are saving pointer to iommu DT node in of_iommu_set_ops()
> hence we should increment DT node ref count.

Oh man, shame on whoever wrote that code! :P

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

> Signed-off-by: Anup Patel <anup.patel@broadcom.com>
> Reviewed-by: Ray Jui <rjui@broadcom.com>
> Reviewed-by: Scott Branden <sbranden@broadcom.com>
> ---
>   drivers/iommu/of_iommu.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
> index 60ba238..5fea665 100644
> --- a/drivers/iommu/of_iommu.c
> +++ b/drivers/iommu/of_iommu.c
> @@ -110,6 +110,7 @@ void of_iommu_set_ops(struct device_node *np, struct iommu_ops *ops)
>   	if (WARN_ON(!iommu))
>   		return;
>
> +	of_node_get(np);
>   	INIT_LIST_HEAD(&iommu->list);
>   	iommu->np = np;
>   	iommu->ops = ops;
>
diff mbox

Patch

diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
index 60ba238..5fea665 100644
--- a/drivers/iommu/of_iommu.c
+++ b/drivers/iommu/of_iommu.c
@@ -110,6 +110,7 @@  void of_iommu_set_ops(struct device_node *np, struct iommu_ops *ops)
 	if (WARN_ON(!iommu))
 		return;
 
+	of_node_get(np);
 	INIT_LIST_HEAD(&iommu->list);
 	iommu->np = np;
 	iommu->ops = ops;