]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i2c: bcm-iproc: Fix Wvoid-pointer-to-enum-cast warning
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Wed, 26 Nov 2025 18:22:58 +0000 (19:22 +0100)
committerAndi Shyti <andi.shyti@kernel.org>
Tue, 16 Dec 2025 23:28:43 +0000 (00:28 +0100)
'type' is an enum, thus cast of pointer on 64-bit compile test with
clang and W=1 causes:

  i2c-bcm-iproc.c:1102:3: error: cast to smaller integer type 'enum bcm_iproc_i2c_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

One of the discussions in 2023 on LKML suggested warning is not suitable
for kernel.  Nothing changed in this regard since that time, so assume
the warning will stay and we want to have warnings-free builds.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20251126182257.157439-4-krzysztof.kozlowski@oss.qualcomm.com
drivers/i2c/busses/i2c-bcm-iproc.c

index e418a4f23f156feef294a62b542ec2043d571324..b5629cffe99b58a5040db9182b81a67749e8557c 100644 (file)
@@ -1098,8 +1098,7 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, iproc_i2c);
        iproc_i2c->device = &pdev->dev;
-       iproc_i2c->type =
-               (enum bcm_iproc_i2c_type)of_device_get_match_data(&pdev->dev);
+       iproc_i2c->type = (kernel_ulong_t)of_device_get_match_data(&pdev->dev);
        init_completion(&iproc_i2c->done);
 
        iproc_i2c->base = devm_platform_ioremap_resource(pdev, 0);