Messages in this thread Patch in this message | | | Date | Thu, 17 Aug 2023 17:52:21 +0000 | Subject | [PATCH v2] mtd: rawnand: fix -Wvoid-pointer-to-enum-cast warning | From | Justin Stitt <> |
| |
When building with clang 18 I see the following warning: | drivers/mtd/nand/raw/vf610_nfc.c:853:17: warning: cast to smaller integer | type 'enum vf610_nfc_variant' from 'const void *' [-Wvoid-pointer-to-enum-cast] | 853 | nfc->variant = (enum vf610_nfc_variant)of_id->data;
This is due to the fact that `of_id->data` is a void* while `enum vf610_nfc_variant` has the size of an int.
Cast `of_id->data` to a uintptr_t to silence the above warning for clang builds using W=1.
Link: https://github.com/ClangBuiltLinux/linux/issues/1910 Reported-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Justin Stitt <justinstitt@google.com> --- Changes in v2: - use better commit message (thanks Krzysztof and Miquel) - Link to v1: https://lore.kernel.org/r/20230815-void-drivers-mtd-nand-raw-vf610_nfc-v1-1-7cc65314c56c@google.com --- drivers/mtd/nand/raw/vf610_nfc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c index 86522048e271..11d996dc655d 100644 --- a/drivers/mtd/nand/raw/vf610_nfc.c +++ b/drivers/mtd/nand/raw/vf610_nfc.c @@ -850,7 +850,7 @@ static int vf610_nfc_probe(struct platform_device *pdev) goto err_disable_clk; } - nfc->variant = (enum vf610_nfc_variant)of_id->data; + nfc->variant = (uintptr_t)of_id->data; for_each_available_child_of_node(nfc->dev->of_node, child) { if (of_device_is_compatible(child, "fsl,vf610-nfc-nandcs")) { --- base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421 change-id: 20230815-void-drivers-mtd-nand-raw-vf610_nfc-6c358f424b8a Best regards, -- Justin Stitt <justinstitt@google.com>
| |