From f3add6dec36d9d747929918ba1d7ce8866e1c054 Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Tue, 15 Aug 2023 20:35:59 +0000 Subject: net: mdio: fix -Wvoid-pointer-to-enum-cast warning When building with clang 18 I see the following warning: | drivers/net/mdio/mdio-xgene.c:338:13: warning: cast to smaller integer | type 'enum xgene_mdio_id' from 'const void *' [-Wvoid-pointer-to-enum-cast] | 338 | mdio_id = (enum xgene_mdio_id)of_id->data; This is due to the fact that `of_id->data` is a void* while `enum xgene_mdio_id` has the size of an int. This leads to truncation and possible data loss. Link: https://github.com/ClangBuiltLinux/linux/issues/1910 Reported-by: Nathan Chancellor Signed-off-by: Justin Stitt Reviewed-by: Andrew Lunn Reviewed-by: Russell King (Oracle) Link: https://lore.kernel.org/r/20230815-void-drivers-net-mdio-mdio-xgene-v1-1-5304342e0659@google.com Signed-off-by: Jakub Kicinski --- drivers/net/mdio/mdio-xgene.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/mdio') diff --git a/drivers/net/mdio/mdio-xgene.c b/drivers/net/mdio/mdio-xgene.c index 683e8f8319ab..1af7a4d9f86c 100644 --- a/drivers/net/mdio/mdio-xgene.c +++ b/drivers/net/mdio/mdio-xgene.c @@ -335,7 +335,7 @@ static int xgene_mdio_probe(struct platform_device *pdev) of_id = of_match_device(xgene_mdio_of_match, &pdev->dev); if (of_id) { - mdio_id = (enum xgene_mdio_id)of_id->data; + mdio_id = (uintptr_t)of_id->data; } else { #ifdef CONFIG_ACPI const struct acpi_device_id *acpi_id; -- cgit v1.2.3