lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <33672077-77b9-476c-9565-b78aae2a38de@arm.com>
Date: Tue, 24 Jun 2025 18:36:29 +0100
From: Robin Murphy <robin.murphy@....com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
 Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
 Yong Wu <yong.wu@...iatek.com>, Matthias Brugger <matthias.bgg@...il.com>,
 AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
Cc: iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
 linux-mediatek@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v3 3/3] iommu: mtk_iommu_v1: Simplify by dropping local
 'mtk_mapping' variable

On 2025-06-24 1:22 pm, Krzysztof Kozlowski wrote:
> Storing 'data->mapping' in local variable in
> mtk_iommu_v1_probe_finalize() does not make the code easier to read.
> Use the 'data->mapping' directly.
> 
> ARM64 W=1 builds also complain with:
> 
>    mtk_iommu_v1.c:512:28: error: variable 'mtk_mapping' set but not used [-Werror,-Wunused-but-set-variable]
> 
> but this is not being fixed here and 'data' still won't be used in such
> compile test.

Sorry, I guess that's on me for doing the COMPILE_TEST stubs the lazy 
way... TBH I'm still not sure this driver hasn't completely bitrotted, 
but if we're touching it at all we should probably actually fix the 
warning, e.g.:

-#define arm_iommu_attach_device(...)   -ENODEV
+#define arm_iommu_attach_device(d, m)  ((void)m, -ENODEV)

or perhaps make it a less lazy static inline.

> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
> 
> ---
> 
> Old warning is changed now to:
> 
>    error: variable 'data' set but not used [-Werror,-Wunused-but-set-variable]
> ---
>   drivers/iommu/mtk_iommu_v1.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> index 66824982e05fbfdda224276ad41b90f9d5f9ca4e..bbe3e9d901c69ac6405d9549a4481fc80f1adb80 100644
> --- a/drivers/iommu/mtk_iommu_v1.c
> +++ b/drivers/iommu/mtk_iommu_v1.c
> @@ -509,14 +509,12 @@ 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;
>   	int err;
>   
>   	data        = dev_iommu_priv_get(dev);

And for the sake of a readability cleanup you may as well fold this into 
the declaration line as well. And then maybe also whack a __maybe_unused 
on it, for even less effort than the first silly thing I thought of 
above... :)

Thanks,
Robin.

> -	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");
>   }
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ