]> xenbits.xensource.com Git - people/hx242/xen.git/commitdiff
xen/iommu: smmu: Silence clang in arm_smmu_device_dt_probe()
authorJulien Grall <jgrall@amazon.com>
Fri, 2 Apr 2021 15:51:06 +0000 (16:51 +0100)
committerJulien Grall <jgrall@amazon.com>
Tue, 13 Apr 2021 17:57:59 +0000 (18:57 +0100)
Clang 11 will throw the following error:

smmu.c:2284:18: error: cast to smaller integer type 'enum arm_smmu_arch_version' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
        smmu->version = (enum arm_smmu_arch_version)of_id->data;
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The error can be prevented by initially casting to (uintptr_t) and then
enum.

Signed-off-by: Julien Grall <jgrall@amazon.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
xen/drivers/passthrough/arm/smmu.c

index 20ac672e91b63608982672755ab7f1172498e109..fab7be8b48bbbb687702f7ec47213933c9ddf860 100644 (file)
@@ -2382,7 +2382,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
        smmu->dev = dev;
 
        of_id = of_match_node(arm_smmu_of_match, dev->of_node);
-       smmu->version = (enum arm_smmu_arch_version)of_id->data;
+       smmu->version = (enum arm_smmu_arch_version)(uintptr_t)of_id->data;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        smmu->base = devm_ioremap_resource(dev, res);