From: Robin Murphy <robin.murphy@arm.com>
To: Ezequiel Garcia <ezequiel@collabora.com>,
Joerg Roedel <joro@8bytes.org>, Heiko Stuebner <heiko@sntech.de>
Cc: linux-rockchip@lists.infradead.org,
iommu@lists.linux-foundation.org, kernel@collabora.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu: rockchip: Free domain on .domain_free
Date: Tue, 15 Oct 2019 12:43:31 +0100 [thread overview]
Message-ID: <815abfca-a15f-365d-438c-5616a05b0513@arm.com> (raw)
In-Reply-To: <20191002172923.22430-1-ezequiel@collabora.com>
On 02/10/2019 18:29, Ezequiel Garcia wrote:
> IOMMU domain resource life is well-defined, managed
> by .domain_alloc and .domain_free.
>
> Therefore, domain-specific resources shouldn't be tied to
> the device life, but instead to its domain.
FWIW,
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> ---
> drivers/iommu/rockchip-iommu.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
> index 26290f310f90..e845bd01a1a2 100644
> --- a/drivers/iommu/rockchip-iommu.c
> +++ b/drivers/iommu/rockchip-iommu.c
> @@ -979,13 +979,13 @@ static struct iommu_domain *rk_iommu_domain_alloc(unsigned type)
> if (!dma_dev)
> return NULL;
>
> - rk_domain = devm_kzalloc(dma_dev, sizeof(*rk_domain), GFP_KERNEL);
> + rk_domain = kzalloc(sizeof(*rk_domain), GFP_KERNEL);
> if (!rk_domain)
> return NULL;
>
> if (type == IOMMU_DOMAIN_DMA &&
> iommu_get_dma_cookie(&rk_domain->domain))
> - return NULL;
> + goto err_free_domain;
>
> /*
> * rk32xx iommus use a 2 level pagetable.
> @@ -1020,6 +1020,8 @@ static struct iommu_domain *rk_iommu_domain_alloc(unsigned type)
> err_put_cookie:
> if (type == IOMMU_DOMAIN_DMA)
> iommu_put_dma_cookie(&rk_domain->domain);
> +err_free_domain:
> + kfree(rk_domain);
>
> return NULL;
> }
> @@ -1048,6 +1050,7 @@ static void rk_iommu_domain_free(struct iommu_domain *domain)
>
> if (domain->type == IOMMU_DOMAIN_DMA)
> iommu_put_dma_cookie(&rk_domain->domain);
> + kfree(rk_domain);
> }
>
> static int rk_iommu_add_device(struct device *dev)
>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2019-10-15 11:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-02 17:29 [PATCH] iommu: rockchip: Free domain on .domain_free Ezequiel Garcia
2019-10-15 11:16 ` Joerg Roedel
2019-10-15 11:43 ` Robin Murphy [this message]
2019-10-15 18:53 ` Heiko Stuebner
2019-10-16 7:43 ` Joerg Roedel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=815abfca-a15f-365d-438c-5616a05b0513@arm.com \
--to=robin.murphy@arm.com \
--cc=ezequiel@collabora.com \
--cc=heiko@sntech.de \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox