Skip to content

Commit f3add6d

Browse files
JustinStittkuba-moo
authored andcommitted
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: ClangBuiltLinux#1910 Reported-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Justin Stitt <justinstitt@google.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://lore.kernel.org/r/20230815-void-drivers-net-mdio-mdio-xgene-v1-1-5304342e0659@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 0c2d822 commit f3add6d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/net/mdio/mdio-xgene.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ static int xgene_mdio_probe(struct platform_device *pdev)
335335

336336
of_id = of_match_device(xgene_mdio_of_match, &pdev->dev);
337337
if (of_id) {
338-
mdio_id = (enum xgene_mdio_id)of_id->data;
338+
mdio_id = (uintptr_t)of_id->data;
339339
} else {
340340
#ifdef CONFIG_ACPI
341341
const struct acpi_device_id *acpi_id;

0 commit comments

Comments
 (0)