* [PATCH] iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe()
@ 2022-12-19 18:06 Christophe JAILLET
2022-12-19 18:16 ` Matthias Brugger
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Christophe JAILLET @ 2022-12-19 18:06 UTC (permalink / raw)
To: Yong Wu, Joerg Roedel, Will Deacon, Robin Murphy,
Matthias Brugger, Honghui Zhang
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, Joerg Roedel,
iommu, linux-mediatek, linux-arm-kernel
A clk, prepared and enabled in mtk_iommu_v1_hw_init(), is not released in
the error handling path of mtk_iommu_v1_probe().
Add the corresponding clk_disable_unprepare(), as already done in the
remove function.
Fixes: b17336c55d89 ("iommu/mediatek: add support for mtk iommu generation one HW")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Another option would be to use devm_clk_get_enabled(). This would save a
few LoC in mtk_iommu_v1_hw_init() and in the remove function.
However, it would change the order of function calls in the remove function
so I leave it as-is.
Let me know if it is fine and if you prefer this alternative.
---
drivers/iommu/mtk_iommu_v1.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 69682ee068d2..ca581ff1c769 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -683,7 +683,7 @@ static int mtk_iommu_v1_probe(struct platform_device *pdev)
ret = iommu_device_sysfs_add(&data->iommu, &pdev->dev, NULL,
dev_name(&pdev->dev));
if (ret)
- return ret;
+ goto out_clk_unprepare;
ret = iommu_device_register(&data->iommu, &mtk_iommu_v1_ops, dev);
if (ret)
@@ -698,6 +698,8 @@ static int mtk_iommu_v1_probe(struct platform_device *pdev)
iommu_device_unregister(&data->iommu);
out_sysfs_remove:
iommu_device_sysfs_remove(&data->iommu);
+out_clk_unprepare:
+ clk_disable_unprepare(data->bclk);
return ret;
}
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe()
2022-12-19 18:06 [PATCH] iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe() Christophe JAILLET
@ 2022-12-19 18:16 ` Matthias Brugger
2022-12-20 9:42 ` AngeloGioacchino Del Regno
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Matthias Brugger @ 2022-12-19 18:16 UTC (permalink / raw)
To: Christophe JAILLET, Yong Wu, Joerg Roedel, Will Deacon,
Robin Murphy, Honghui Zhang
Cc: linux-kernel, kernel-janitors, Joerg Roedel, iommu,
linux-mediatek, linux-arm-kernel
On 19/12/2022 19:06, Christophe JAILLET wrote:
> A clk, prepared and enabled in mtk_iommu_v1_hw_init(), is not released in
> the error handling path of mtk_iommu_v1_probe().
>
> Add the corresponding clk_disable_unprepare(), as already done in the
> remove function.
>
> Fixes: b17336c55d89 ("iommu/mediatek: add support for mtk iommu generation one HW")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
> ---
> Another option would be to use devm_clk_get_enabled(). This would save a
> few LoC in mtk_iommu_v1_hw_init() and in the remove function.
> However, it would change the order of function calls in the remove function
> so I leave it as-is.
> Let me know if it is fine and if you prefer this alternative.
> ---
> drivers/iommu/mtk_iommu_v1.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> index 69682ee068d2..ca581ff1c769 100644
> --- a/drivers/iommu/mtk_iommu_v1.c
> +++ b/drivers/iommu/mtk_iommu_v1.c
> @@ -683,7 +683,7 @@ static int mtk_iommu_v1_probe(struct platform_device *pdev)
> ret = iommu_device_sysfs_add(&data->iommu, &pdev->dev, NULL,
> dev_name(&pdev->dev));
> if (ret)
> - return ret;
> + goto out_clk_unprepare;
>
> ret = iommu_device_register(&data->iommu, &mtk_iommu_v1_ops, dev);
> if (ret)
> @@ -698,6 +698,8 @@ static int mtk_iommu_v1_probe(struct platform_device *pdev)
> iommu_device_unregister(&data->iommu);
> out_sysfs_remove:
> iommu_device_sysfs_remove(&data->iommu);
> +out_clk_unprepare:
> + clk_disable_unprepare(data->bclk);
> return ret;
> }
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe()
2022-12-19 18:06 [PATCH] iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe() Christophe JAILLET
2022-12-19 18:16 ` Matthias Brugger
@ 2022-12-20 9:42 ` AngeloGioacchino Del Regno
2022-12-22 9:17 ` Yong Wu (吴勇)
2023-01-13 12:44 ` Joerg Roedel
3 siblings, 0 replies; 5+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-12-20 9:42 UTC (permalink / raw)
To: Christophe JAILLET, Yong Wu, Joerg Roedel, Will Deacon,
Robin Murphy, Matthias Brugger, Honghui Zhang
Cc: linux-kernel, kernel-janitors, Joerg Roedel, iommu,
linux-mediatek, linux-arm-kernel
Il 19/12/22 19:06, Christophe JAILLET ha scritto:
> A clk, prepared and enabled in mtk_iommu_v1_hw_init(), is not released in
> the error handling path of mtk_iommu_v1_probe().
>
> Add the corresponding clk_disable_unprepare(), as already done in the
> remove function.
>
> Fixes: b17336c55d89 ("iommu/mediatek: add support for mtk iommu generation one HW")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe()
2022-12-19 18:06 [PATCH] iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe() Christophe JAILLET
2022-12-19 18:16 ` Matthias Brugger
2022-12-20 9:42 ` AngeloGioacchino Del Regno
@ 2022-12-22 9:17 ` Yong Wu (吴勇)
2023-01-13 12:44 ` Joerg Roedel
3 siblings, 0 replies; 5+ messages in thread
From: Yong Wu (吴勇) @ 2022-12-22 9:17 UTC (permalink / raw)
To: christophe.jaillet@wanadoo.fr, joro@8bytes.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mediatek@lists.infradead.org, robin.murphy@arm.com,
jroedel@suse.de, linux-arm-kernel@lists.infradead.org,
iommu@lists.linux.dev, matthias.bgg@gmail.com, will@kernel.org
On Mon, 2022-12-19 at 19:06 +0100, Christophe JAILLET wrote:
> A clk, prepared and enabled in mtk_iommu_v1_hw_init(), is not
> released in
> the error handling path of mtk_iommu_v1_probe().
>
> Add the corresponding clk_disable_unprepare(), as already done in the
> remove function.
>
> Fixes: b17336c55d89 ("iommu/mediatek: add support for mtk iommu
> generation one HW")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Yong Wu <yong.wu@mediatek.com>
Thanks.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe()
2022-12-19 18:06 [PATCH] iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe() Christophe JAILLET
` (2 preceding siblings ...)
2022-12-22 9:17 ` Yong Wu (吴勇)
@ 2023-01-13 12:44 ` Joerg Roedel
3 siblings, 0 replies; 5+ messages in thread
From: Joerg Roedel @ 2023-01-13 12:44 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Yong Wu, Will Deacon, Robin Murphy, Matthias Brugger,
Honghui Zhang, linux-kernel, kernel-janitors, Joerg Roedel, iommu,
linux-mediatek, linux-arm-kernel
On Mon, Dec 19, 2022 at 07:06:22PM +0100, Christophe JAILLET wrote:
> Fixes: b17336c55d89 ("iommu/mediatek: add support for mtk iommu generation one HW")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Another option would be to use devm_clk_get_enabled(). This would save a
> few LoC in mtk_iommu_v1_hw_init() and in the remove function.
> However, it would change the order of function calls in the remove function
> so I leave it as-is.
> Let me know if it is fine and if you prefer this alternative.
> ---
> drivers/iommu/mtk_iommu_v1.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Applied, thanks.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-13 12:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-19 18:06 [PATCH] iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe() Christophe JAILLET
2022-12-19 18:16 ` Matthias Brugger
2022-12-20 9:42 ` AngeloGioacchino Del Regno
2022-12-22 9:17 ` Yong Wu (吴勇)
2023-01-13 12:44 ` 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).