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.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.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);
- 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.48.1
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@linaro.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"); > } >
© 2016 - 2025 Red Hat, Inc.