iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/exynos: add missing put_device() call in exynos_iommu_of_xlate()
@ 2020-09-18  1:13 ` Yu Kuai
  2020-09-18 15:27   ` Marek Szyprowski
  0 siblings, 1 reply; 3+ messages in thread
From: Yu Kuai @ 2020-09-18  1:13 UTC (permalink / raw)
  To: m.szyprowski, joro, kgene, krzk
  Cc: linux-samsung-soc, yi.zhang, linux-kernel, iommu, yukuai3,
	linux-arm-kernel

if of_find_device_by_node() succeed, exynos_iommu_of_xlate() doesn't have
a corresponding put_device(). Thus add put_device() to fix the exception
handling for this function implementation.

Fixes: aa759fd376fb ("iommu/exynos: Add callback for initializing devices from device tree")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 drivers/iommu/exynos-iommu.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index bad3c0ce10cb..de324b4eedfe 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -1295,13 +1295,17 @@ static int exynos_iommu_of_xlate(struct device *dev,
 		return -ENODEV;
 
 	data = platform_get_drvdata(sysmmu);
-	if (!data)
+	if (!data) {
+		put_device(&sysmmu->dev);
 		return -ENODEV;
+	}
 
 	if (!owner) {
 		owner = kzalloc(sizeof(*owner), GFP_KERNEL);
-		if (!owner)
+		if (!owner) {
+			put_device(&sysmmu->dev);
 			return -ENOMEM;
+		}
 
 		INIT_LIST_HEAD(&owner->controllers);
 		mutex_init(&owner->rpm_lock);
-- 
2.25.4

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu/exynos: add missing put_device() call in exynos_iommu_of_xlate()
  2020-09-18  1:13 ` [PATCH] iommu/exynos: add missing put_device() call in exynos_iommu_of_xlate() Yu Kuai
@ 2020-09-18 15:27   ` Marek Szyprowski
  2020-09-24  8:48     ` Joerg Roedel
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Szyprowski @ 2020-09-18 15:27 UTC (permalink / raw)
  To: Yu Kuai, joro, kgene, krzk
  Cc: iommu, linux-samsung-soc, linux-kernel, linux-arm-kernel, yi.zhang

Hi

On 18.09.2020 03:13, Yu Kuai wrote:
> if of_find_device_by_node() succeed, exynos_iommu_of_xlate() doesn't have
> a corresponding put_device(). Thus add put_device() to fix the exception
> handling for this function implementation.
>
> Fixes: aa759fd376fb ("iommu/exynos: Add callback for initializing devices from device tree")
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>

Thanks for the fix!

Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---
>   drivers/iommu/exynos-iommu.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> index bad3c0ce10cb..de324b4eedfe 100644
> --- a/drivers/iommu/exynos-iommu.c
> +++ b/drivers/iommu/exynos-iommu.c
> @@ -1295,13 +1295,17 @@ static int exynos_iommu_of_xlate(struct device *dev,
>   		return -ENODEV;
>   
>   	data = platform_get_drvdata(sysmmu);
> -	if (!data)
> +	if (!data) {
> +		put_device(&sysmmu->dev);
>   		return -ENODEV;
> +	}
>   
>   	if (!owner) {
>   		owner = kzalloc(sizeof(*owner), GFP_KERNEL);
> -		if (!owner)
> +		if (!owner) {
> +			put_device(&sysmmu->dev);
>   			return -ENOMEM;
> +		}
>   
>   		INIT_LIST_HEAD(&owner->controllers);
>   		mutex_init(&owner->rpm_lock);

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu/exynos: add missing put_device() call in exynos_iommu_of_xlate()
  2020-09-18 15:27   ` Marek Szyprowski
@ 2020-09-24  8:48     ` Joerg Roedel
  0 siblings, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2020-09-24  8:48 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-samsung-soc, yi.zhang, linux-kernel, krzk, iommu, kgene,
	Yu Kuai, linux-arm-kernel

On Fri, Sep 18, 2020 at 05:27:59PM +0200, Marek Szyprowski wrote:
> Hi
> 
> On 18.09.2020 03:13, Yu Kuai wrote:
> > if of_find_device_by_node() succeed, exynos_iommu_of_xlate() doesn't have
> > a corresponding put_device(). Thus add put_device() to fix the exception
> > handling for this function implementation.
> >
> > Fixes: aa759fd376fb ("iommu/exynos: Add callback for initializing devices from device tree")
> > Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> 
> Thanks for the fix!
> 
> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>

Applied for v5.9, thanks.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-24  8:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200918011240eucas1p1e16e5b1b11a4ea6c078ffeceaf554966@eucas1p1.samsung.com>
2020-09-18  1:13 ` [PATCH] iommu/exynos: add missing put_device() call in exynos_iommu_of_xlate() Yu Kuai
2020-09-18 15:27   ` Marek Szyprowski
2020-09-24  8:48     ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).