diff mbox series

PM / devfreq: exynos-ppmu: fix clang -Wvoid-pointer-to-enum-cast warning

Message ID 20230816-void-drivers-devfreq-event-exynos-ppmu-v1-1-3fac11083742@google.com (mailing list archive)
State New, archived
Headers show
Series PM / devfreq: exynos-ppmu: fix clang -Wvoid-pointer-to-enum-cast warning | expand

Commit Message

Justin Stitt Aug. 16, 2023, 8:19 p.m. UTC
When building with clang 18 I see the following warning:
|       drivers/devfreq/event/exynos-ppmu.c:530:21: warning: cast to smaller
|       integer type 'enum exynos_ppmu_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
|         530 |       info->ppmu_type = (enum exynos_ppmu_type)of_id->data;

This is due to the fact that `of_id->data` is a void* while
`enum exynos_ppmu_type` 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>
---
 drivers/devfreq/event/exynos-ppmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421
change-id: 20230816-void-drivers-devfreq-event-exynos-ppmu-64ad102497f2

Best regards,
--
Justin Stitt <justinstitt@google.com>
diff mbox series

Patch

diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c
index 896a6cc93b00..f798e1d6994d 100644
--- a/drivers/devfreq/event/exynos-ppmu.c
+++ b/drivers/devfreq/event/exynos-ppmu.c
@@ -527,7 +527,7 @@  static int of_get_devfreq_events(struct device_node *np,
 
 	of_id = of_match_device(exynos_ppmu_id_match, dev);
 	if (of_id)
-		info->ppmu_type = (enum exynos_ppmu_type)of_id->data;
+		info->ppmu_type = (uintptr_t)of_id->data;
 	else {
 		of_node_put(events_np);
 		return -EINVAL;