Skip to contentSkip to conversation

net/xgene: fix Wvoid-pointer-to-enum-cast warning

PATCH Applied Krzysztof Kozlowski 3 participants 5 messages Aug 10, 2023 – Aug 11, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net/xgene: fix Wvoid-pointer-to-enum-cast warning

'enet_id' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes:

xgene_enet_main.c:2044:20: error: cast to smaller integer type 'enum xgene_enet_id' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/apm/xgene/xgene_enet_main.c +1 -1
index 41d96f4b23d8..4d4140b7c450 100644
@@ -2041,7 +2041,7 @@ static int xgene_enet_probe(struct platform_device *pdev)
 
 	of_id = of_match_device(xgene_enet_of_match, &pdev->dev);
 	if (of_id) {
-		pdata->enet_id = (enum xgene_enet_id)of_id->data;
+		pdata->enet_id = (uintptr_t)of_id->data;
 	}
 #ifdef CONFIG_ACPI
 	else {
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 net/marvell: fix Wvoid-pointer-to-enum-cast warning

'type' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes:

mvmdio.c:272:9: error: cast to smaller integer type 'enum orion_mdio_bus_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

---
 drivers/net/ethernet/marvell/mvmdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvmdio.c +1 -1
index a1a80f13b1e8..674913184ebf 100644
@@ -269,7 +269,7 @@ static int orion_mdio_probe(struct platform_device *pdev)
 	struct orion_mdio_dev *dev;
 	int i, ret;
 
-	type = (enum orion_mdio_bus_type)device_get_match_data(&pdev->dev);
+	type = (uintptr_t)device_get_match_data(&pdev->dev);
 
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!r) {
Signature · 1 line
2.34.1
reviewer Reviewed-by Tested-by on v1 2/2
#2 lore raw

Re: [PATCH net-next 2/2] net/marvell: fix Wvoid-pointer-to-enum-cast warning

Quoted 6 lines · Krzysztof Kozlowski

'type' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes:

mvmdio.c:272:9: error: cast to smaller integer type 'enum orion_mdio_bus_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

reviewer Reviewed-by Tested-by on v1 1/2
#3 lore raw
In reply to Krzysztof Kozlowski
Quoted 6 lines · Krzysztof Kozlowski

'enet_id' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes:

xgene_enet_main.c:2044:20: error: cast to smaller integer type 'enum xgene_enet_id' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

#4 lore raw
In reply to Krzysztof Kozlowski
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 8 lines · On Thu, 10 Aug 2023 12:39:22 +0200 you wrote:

'enet_id' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes:

xgene_enet_main.c:2044:20: error: cast to smaller integer type 'enum xgene_enet_id' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

[...]

Here is the summary with links:
- [net-next,1/2] net/xgene: fix Wvoid-pointer-to-enum-cast warning

    https://git.kernel.org/netdev/net-next/c/c5b0c34fae1e
  - [net-next,2/2] net/marvell: fix Wvoid-pointer-to-enum-cast warning
    https://git.kernel.org/netdev/net-next/c/e5cd429e7928

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html