Skip to content

Commit 4ec7b66

Browse files
JustinStittsre
authored andcommitted
power: vexpress: fix -Wvoid-pointer-to-enum-cast warning
When building with clang 18 I see the following warning: | drivers/power/reset/vexpress-poweroff.c:124:10: warning: cast to smaller integer type 'enum vexpress_reset_func' from 'const void *' [-Wvoid-pointer-to-enum-cast] | 124 | switch ((enum vexpress_reset_func)match->data) { This is due to the fact that `match->data` is a void* while `enum vexpress_reset_func` has the size of an int. This leads to truncation and possible data loss. Link: ClangBuiltLinux#1910 Reported-by: Nathan Chancellor <[email protected]> Signed-off-by: Justin Stitt <[email protected]> Acked-by: Sudeep Holla <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 926ce6b commit 4ec7b66

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/power/reset/vexpress-poweroff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static int vexpress_reset_probe(struct platform_device *pdev)
121121
return PTR_ERR(regmap);
122122
dev_set_drvdata(&pdev->dev, regmap);
123123

124-
switch ((enum vexpress_reset_func)match->data) {
124+
switch ((uintptr_t)match->data) {
125125
case FUNC_SHUTDOWN:
126126
vexpress_power_off_device = &pdev->dev;
127127
pm_power_off = vexpress_power_off;

0 commit comments

Comments
 (0)