Skip to contentSkip to conversation

iommu/mediatek-v1: Tidy up probe_finalize

PATCH Applied Robin Murphy 4 participants 4 messages Jun 27, 2025 – Jul 4, 2025

Subsystems (3)
lore
Share & tools
lore

Robin Murphy

author reviewer
#0 lore raw

PATCH 1/1 iommu/mediatek-v1: Tidy up probe_finalize

Krzysztof points out that although the driver now supports COMPILE_TEST for other architectures, it does not build cleanly with W=1 where the stubbed-out ARM API can lead to an unused variable warning.

Since this is effectively the correct intent of the code in such cases, mark it as __maybe_unused, tidying up some cruft in the process.

---

Since I'd already got as far as thinking this through, I figure I may as well save Krzysztof the trouble of rewriting it :)

 drivers/iommu/mtk_iommu_v1.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/iommu/mtk_iommu_v1.c +2 -6
index 66824982e05f..2fc18e194e19 100644
@@ -509,14 +509,10 @@ static struct iommu_device *mtk_iommu_v1_probe_device(struct device *dev)
 
 static void mtk_iommu_v1_probe_finalize(struct device *dev)
 {
-	struct dma_iommu_mapping *mtk_mapping;
-	struct mtk_iommu_v1_data *data;
+	__maybe_unused struct mtk_iommu_v1_data *data = dev_iommu_priv_get(dev);
 	int err;
 
-	data        = dev_iommu_priv_get(dev);
-	mtk_mapping = data->mapping;
-
-	err = arm_iommu_attach_device(dev, mtk_mapping);
+	err = arm_iommu_attach_device(dev, data->mapping);
 	if (err)
 		dev_err(dev, "Can't create IOMMU mapping - DMA-OPS will not work\n");
 }
Signature · 1 line
2.39.2.101.g768bb238c484.dirty
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Robin Murphy

External email : Please do not click links or open attachments until you have verified the sender or the content.

Krzysztof points out that although the driver now supports COMPILE_TEST
for other architectures, it does not build cleanly with W=1 where the stubbed-out ARM API can lead to an unused variable warning.

Quoted 6 lines

Since this is effectively the correct intent of the code in such cases,
mark it as __maybe_unused, tidying up some cruft in the process.

Quoted 36 lines

---

Since I'd already got as far as thinking this through, I figure I may as well save Krzysztof the trouble of rewriting it :)

 drivers/iommu/mtk_iommu_v1.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/iommu/mtk_iommu_v1.c +2 -6
index 66824982e05f..2fc18e194e19 100644
@@ -509,14 +509,10 @@ static struct iommu_device
 *mtk_iommu_v1_probe_device(struct device *dev)
 
 static void mtk_iommu_v1_probe_finalize(struct device *dev)
 {
-       struct dma_iommu_mapping *mtk_mapping;
-       struct mtk_iommu_v1_data *data;
+       __maybe_unused struct mtk_iommu_v1_data *data =
 dev_iommu_priv_get(dev);
        int err;
 
-       data        = dev_iommu_priv_get(dev);
-       mtk_mapping = data->mapping;
-
-       err = arm_iommu_attach_device(dev, mtk_mapping);
+       err = arm_iommu_attach_device(dev, data->mapping);
        if (err)

dev_err(dev, "Can't create IOMMU mapping - DMA-OPS
will not work\n");
}
--
2.39.2.101.g768bb238c484.dirty

Reviewed-by on v1 1/1
#2 lore raw
In reply to Robin Murphy
Quoted 7 lines · Robin Murphy

Krzysztof points out that although the driver now supports COMPILE_TEST for other architectures, it does not build cleanly with W=1 where the stubbed-out ARM API can lead to an unused variable warning.

Since this is effectively the correct intent of the code in such cases, mark it as __maybe_unused, tidying up some cruft in the process.

Quoted 6 lines

---

Since I'd already got as far as thinking this through, I figure I may as well save Krzysztof the trouble of rewriting it :)

Sure, thanks!

Best regards,
Krzysztof

maintainer Applied
#3 lore raw
In reply to Robin Murphy
Quoted 2 lines · Robin Murphy
 drivers/iommu/mtk_iommu_v1.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Applied, thanks Robin.