From 38c2efa260e6d0eab861c21c6ad1e4d79e1377ac Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Mon, 14 Aug 2023 22:11:28 +0000 Subject: [PATCH] pmdomain: renesas: rmobile-sysc: fix -Wvoid-pointer-to-enum-cast warning When building with clang 18 I see the following warning: | drivers/soc/renesas/rmobile-sysc.c:193:22: warning: cast to smaller integer | type 'enum pd_types' from 'const void *' [-Wvoid-pointer-to-enum-cast] | 193 | add_special_pd(np, (enum pd_types)id->data); This is due to the fact that `id->data` is a void* and `enum pd_types` has the size of an integer. This cast from pointer-width to int-width causes truncation and possible data loss. Instead, cast to `uintptr_t` which has the same width as void*. Reported-by: Nathan Chancellor Closes: https://github.com/ClangBuiltLinux/linux/issues/1910 Signed-off-by: Justin Stitt Reviewed-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20230814-void-drivers-soc-renesas-rmobile-sysc-v1-1-6648dfd854de@google.com Signed-off-by: Ulf Hansson --- drivers/pmdomain/renesas/rmobile-sysc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pmdomain/renesas/rmobile-sysc.c b/drivers/pmdomain/renesas/rmobile-sysc.c index 912daadaa10d1..0b77f37787d58 100644 --- a/drivers/pmdomain/renesas/rmobile-sysc.c +++ b/drivers/pmdomain/renesas/rmobile-sysc.c @@ -190,7 +190,7 @@ static void __init get_special_pds(void) /* PM domains containing other special devices */ for_each_matching_node_and_match(np, special_ids, &id) - add_special_pd(np, (enum pd_types)id->data); + add_special_pd(np, (uintptr_t)id->data); } static void __init put_special_pds(void) -- 2.30.2