diff options
author | Justin Stitt <justinstitt@google.com> | 2023-08-15 00:21:51 +0200 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2023-09-12 20:17:31 +0200 |
commit | 4ec7b666fb4247bc6b9cdc84fa753d8dc2994d25 (patch) | |
tree | 2ef998f3f18f0d7ba9335345062fbc36f4c1ed0d /drivers/power/reset/vexpress-poweroff.c | |
parent | power: reset: use capital "OR" for multiple licenses in SPDX (diff) | |
download | linux-4ec7b666fb4247bc6b9cdc84fa753d8dc2994d25.tar.xz linux-4ec7b666fb4247bc6b9cdc84fa753d8dc2994d25.zip |
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>
Diffstat (limited to 'drivers/power/reset/vexpress-poweroff.c')
-rw-r--r-- | drivers/power/reset/vexpress-poweroff.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/power/reset/vexpress-poweroff.c b/drivers/power/reset/vexpress-poweroff.c index 447ffdacddf9..17064d7b19f6 100644 --- a/drivers/power/reset/vexpress-poweroff.c +++ b/drivers/power/reset/vexpress-poweroff.c @@ -121,7 +121,7 @@ static int vexpress_reset_probe(struct platform_device *pdev) return PTR_ERR(regmap); dev_set_drvdata(&pdev->dev, regmap); - switch ((enum vexpress_reset_func)match->data) { + switch ((uintptr_t)match->data) { case FUNC_SHUTDOWN: vexpress_power_off_device = &pdev->dev; pm_power_off = vexpress_power_off; |