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

Subsystems: applied micro (apm) x-gene soc ethernet driver, networking drivers, the rest

STALE1126d

5 messages, 3 authors, 2023-08-11 · open the first message on its own page

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

From: Krzysztof Kozlowski <hidden>
Date: 2023-08-10 10:40:00

'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]

Signed-off-by: Krzysztof Kozlowski <redacted>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 41d96f4b23d8..4d4140b7c450 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -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 {
-- 
2.34.1

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

From: Krzysztof Kozlowski <hidden>
Date: 2023-08-10 10:40:09

'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]

Signed-off-by: Krzysztof Kozlowski <redacted>
---
 drivers/net/ethernet/marvell/mvmdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index a1a80f13b1e8..674913184ebf 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -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) {
-- 
2.34.1

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

From: Simon Horman <horms@kernel.org>
Date: 2023-08-10 20:24:51

On Thu, Aug 10, 2023 at 12:39:23PM +0200, Krzysztof Kozlowski wrote:
'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]

Signed-off-by: Krzysztof Kozlowski <redacted>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Simon Horman <horms@kernel.org> # build-tested

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

From: Simon Horman <horms@kernel.org>
Date: 2023-08-10 20:25:12

On Thu, Aug 10, 2023 at 12:39:22PM +0200, Krzysztof Kozlowski 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]

Signed-off-by: Krzysztof Kozlowski <redacted>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Simon Horman <horms@kernel.org> # build-tested

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

From: patchwork-bot+netdevbpf@kernel.org
Date: 2023-08-11 09:00:37

Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller [off-list ref]:

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]

Signed-off-by: Krzysztof Kozlowski <redacted>

[...]
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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help