Skip to content

Commit a417ab3

Browse files
JustinStittmiquelraynal
authored andcommitted
mtd: maps: fix -Wvoid-pointer-to-enum-cast warning
When building with clang 18 I see the following warning: | drivers/mtd/maps/physmap-versatile.c:209:25: warning: cast to smaller | integer type 'enum versatile_flashprot' from 'const void *' [-Wvoid-pointer-to-enum-cast] | 209 | versatile_flashprot = (enum versatile_flashprot)devid->data; This is due to the fact that `devid->data` is a void* while `enum versatile_flashprot` has the size of an int. Cast `devid->data` to a uintptr_t to silence the above warning for clang builds using W=1. Link: ClangBuiltLinux#1910 Reported-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Justin Stitt <justinstitt@google.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20230816-void-drivers-mtd-maps-physmap-versatile-v2-1-433a25272bfa@google.com
1 parent 264725e commit a417ab3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mtd/maps/physmap-versatile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ int of_flash_probe_versatile(struct platform_device *pdev,
206206
if (!sysnp)
207207
return -ENODEV;
208208

209-
versatile_flashprot = (enum versatile_flashprot)devid->data;
209+
versatile_flashprot = (uintptr_t)devid->data;
210210
rmap = syscon_node_to_regmap(sysnp);
211211
of_node_put(sysnp);
212212
if (IS_ERR(rmap))

0 commit comments

Comments
 (0)