power: vexpress: fix -Wvoid-pointer-to-enum-cast warning
authorJustin Stitt <justinstitt@google.com>
Mon, 14 Aug 2023 22:21:51 +0000 (22:21 +0000)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Tue, 12 Sep 2023 18:17:31 +0000 (20:17 +0200)
commit4ec7b666fb4247bc6b9cdc84fa753d8dc2994d25
tree2ef998f3f18f0d7ba9335345062fbc36f4c1ed0d
parent926ce6ba25101ccc659475e01ce5748374ab5856
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: https://github.com/ClangBuiltLinux/linux/issues/1910
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Justin Stitt <justinstitt@google.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/reset/vexpress-poweroff.c